{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s824153913", "group_id": "codeNet:p02537", "input_text": "module segment_tree_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n abstract interface\n function operator(x,y) result(ret)\n use, intrinsic:: iso_fortran_env\n integer(int32),intent(in):: x,y\n integer(int32):: ret\n end function\n end interface\n private\n public:: seg_tree, st_from_array\n type,public:: seg_tree\n integer(int32),private:: n, elnum\n integer(int32),allocatable,private:: v(:)\n procedure(operator),pointer,nopass,private:: op => null()\n integer(int32),private:: e\n contains\n procedure:: at => st_at\n procedure:: update => st_update\n procedure:: query => st_query\n procedure:: to_array => st_to_array\n end type\n\n interface seg_tree\n module procedure:: st_init\n end interface\n\n\ncontains\n function st_init(n, op, e) result(st)\n type(seg_tree):: st\n procedure(operator):: op\n integer(int32),intent(in):: n,e\n integer(int32):: x\n\n st%op => op\n st%e = e\n st%elnum = n\n x=1\n do while(n > x)\n x = 2*x\n end do\n st%n = x\n allocate(st%v(2*x-1), source=e)\n end function\n\n function st_from_array(ar, op, e) result(st)\n type(seg_tree):: st\n procedure(operator):: op\n integer(int32),intent(in):: ar(:),e\n integer(int32):: x,i\n\n st%op => op\n st%e = e\n st%elnum = size(ar)\n x=1\n do while(size(ar) > x)\n x = 2*x\n end do\n st%n = x\n allocate(st%v(2*x-1), source=e)\n st%v(x:x+st%elnum-1) = ar(:)\n do i=x-1,1,-1\n st%v(i) = st%op(st%v(2*i), st%V(2*i+1))\n end do\n end function\n\n \n function st_at(st,i) result(ret)\n class(seg_tree):: st\n integer(int32):: i,ret\n\n ret = st%v(st%n-1+i)\n end function\n\n subroutine st_update(st, i, x)\n class(seg_tree):: st\n integer(int32), intent(in):: i\n integer(int32):: ind\n integer(int32), intent(in):: x\n \n ind = i+st%n-1\n st%v(ind) = x\n do while(ind > 1)\n ind = ind/2\n st%v(ind) = st%op(st%v(2*ind), st%v(2*ind+1))\n end do\n end subroutine\n\n function st_query(st, a, b) result(ret)\n class(seg_tree):: st\n integer(int32), intent(in):: a,b\n integer(int32):: ret,l,r\n\n l=a+st%n-1; r=b+st%n-1\n ret = st%e\n do while (l <= r)\n if ( btest(l,0)) ret = st%op(st%v(l), ret)\n if (.not. btest(r,0)) ret = st%op(st%v(r), ret)\n l=(l+1)/2; r=(r-1)/2\n end do\n end function\n\n function st_to_array(st) result(ret)\n class(seg_tree):: st\n integer(int32):: ret(st%elnum)\n\n ret(:) = st%v(st%n:st%n+st%elnum-1)\n end function\nend module\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use segment_tree_mod\n implicit none\n integer(int32):: n,i,k,l,r\n integer(int32), allocatable:: a(:)\n type(seg_tree):: st\n\n read*, n,k\n allocate(a(n))\n do i=1,n\n read*, a(i)\n end do\n st = seg_tree(300001,maxx,0)\n do i=1,n\n l = max(1,a(i)-k+1); r = min(300001,a(i)+k+1)\n call st%update(a(i)+1, st%query(l,r)+1)\n end do\n\n print'(i0)', maxval(st%to_array())\n\ncontains\n function maxx(a,b) result(ret)\n integer(int32),intent(in):: a,b\n integer(int32):: ret\n\n ret = max(a,b)\n end function\n \n \nend program main", "language": "Fortran", "metadata": {"date": 1601176060, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02537.html", "problem_id": "p02537", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02537/input.txt", "sample_output_relpath": "derived/input_output/data/p02537/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02537/Fortran/s824153913.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s824153913", "user_id": "u234636620"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "module segment_tree_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n abstract interface\n function operator(x,y) result(ret)\n use, intrinsic:: iso_fortran_env\n integer(int32),intent(in):: x,y\n integer(int32):: ret\n end function\n end interface\n private\n public:: seg_tree, st_from_array\n type,public:: seg_tree\n integer(int32),private:: n, elnum\n integer(int32),allocatable,private:: v(:)\n procedure(operator),pointer,nopass,private:: op => null()\n integer(int32),private:: e\n contains\n procedure:: at => st_at\n procedure:: update => st_update\n procedure:: query => st_query\n procedure:: to_array => st_to_array\n end type\n\n interface seg_tree\n module procedure:: st_init\n end interface\n\n\ncontains\n function st_init(n, op, e) result(st)\n type(seg_tree):: st\n procedure(operator):: op\n integer(int32),intent(in):: n,e\n integer(int32):: x\n\n st%op => op\n st%e = e\n st%elnum = n\n x=1\n do while(n > x)\n x = 2*x\n end do\n st%n = x\n allocate(st%v(2*x-1), source=e)\n end function\n\n function st_from_array(ar, op, e) result(st)\n type(seg_tree):: st\n procedure(operator):: op\n integer(int32),intent(in):: ar(:),e\n integer(int32):: x,i\n\n st%op => op\n st%e = e\n st%elnum = size(ar)\n x=1\n do while(size(ar) > x)\n x = 2*x\n end do\n st%n = x\n allocate(st%v(2*x-1), source=e)\n st%v(x:x+st%elnum-1) = ar(:)\n do i=x-1,1,-1\n st%v(i) = st%op(st%v(2*i), st%V(2*i+1))\n end do\n end function\n\n \n function st_at(st,i) result(ret)\n class(seg_tree):: st\n integer(int32):: i,ret\n\n ret = st%v(st%n-1+i)\n end function\n\n subroutine st_update(st, i, x)\n class(seg_tree):: st\n integer(int32), intent(in):: i\n integer(int32):: ind\n integer(int32), intent(in):: x\n \n ind = i+st%n-1\n st%v(ind) = x\n do while(ind > 1)\n ind = ind/2\n st%v(ind) = st%op(st%v(2*ind), st%v(2*ind+1))\n end do\n end subroutine\n\n function st_query(st, a, b) result(ret)\n class(seg_tree):: st\n integer(int32), intent(in):: a,b\n integer(int32):: ret,l,r\n\n l=a+st%n-1; r=b+st%n-1\n ret = st%e\n do while (l <= r)\n if ( btest(l,0)) ret = st%op(st%v(l), ret)\n if (.not. btest(r,0)) ret = st%op(st%v(r), ret)\n l=(l+1)/2; r=(r-1)/2\n end do\n end function\n\n function st_to_array(st) result(ret)\n class(seg_tree):: st\n integer(int32):: ret(st%elnum)\n\n ret(:) = st%v(st%n:st%n+st%elnum-1)\n end function\nend module\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use segment_tree_mod\n implicit none\n integer(int32):: n,i,k,l,r\n integer(int32), allocatable:: a(:)\n type(seg_tree):: st\n\n read*, n,k\n allocate(a(n))\n do i=1,n\n read*, a(i)\n end do\n st = seg_tree(300001,maxx,0)\n do i=1,n\n l = max(1,a(i)-k+1); r = min(300001,a(i)+k+1)\n call st%update(a(i)+1, st%query(l,r)+1)\n end do\n\n print'(i0)', maxval(st%to_array())\n\ncontains\n function maxx(a,b) result(ret)\n integer(int32),intent(in):: a,b\n integer(int32):: ret\n\n ret = max(a,b)\n end function\n \n \nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given a sequence A_1, A_2, ..., A_N and an integer K.\n\nPrint the maximum possible length of a sequence B that satisfies the following conditions:\n\nB is a (not necessarily continuous) subsequence of A.\n\nFor each pair of adjacents elements of B, the absolute difference of the elements is at most K.\n\nConstraints\n\n1 \\leq N \\leq 300,000\n\n0 \\leq A_i \\leq 300,000\n\n0 \\leq K \\leq 300,000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1\nA_2\n:\nA_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n10 3\n1\n5\n4\n3\n8\n6\n9\n7\n2\n4\n\nSample Output 1\n\n7\n\nFor example, B = (1, 4, 3, 6, 9, 7, 4) satisfies the conditions.\n\nIt is a subsequence of A = (1, 5, 4, 3, 8, 6, 9, 7, 2, 4).\n\nAll of the absolute differences between two adjacent elements (|1-4|, |4-3|, |3-6|, |6-9|, |9-7|, |7-4|) are at most K = 3.", "sample_input": "10 3\n1\n5\n4\n3\n8\n6\n9\n7\n2\n4\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02537", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given a sequence A_1, A_2, ..., A_N and an integer K.\n\nPrint the maximum possible length of a sequence B that satisfies the following conditions:\n\nB is a (not necessarily continuous) subsequence of A.\n\nFor each pair of adjacents elements of B, the absolute difference of the elements is at most K.\n\nConstraints\n\n1 \\leq N \\leq 300,000\n\n0 \\leq A_i \\leq 300,000\n\n0 \\leq K \\leq 300,000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1\nA_2\n:\nA_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n10 3\n1\n5\n4\n3\n8\n6\n9\n7\n2\n4\n\nSample Output 1\n\n7\n\nFor example, B = (1, 4, 3, 6, 9, 7, 4) satisfies the conditions.\n\nIt is a subsequence of A = (1, 5, 4, 3, 8, 6, 9, 7, 2, 4).\n\nAll of the absolute differences between two adjacent elements (|1-4|, |4-3|, |3-6|, |6-9|, |9-7|, |7-4|) are at most K = 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3503, "cpu_time_ms": 159, "memory_kb": 8820}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s587695755", "group_id": "codeNet:p02537", "input_text": "module segment_tree_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n abstract interface\n function operator(x,y) result(ret)\n use, intrinsic:: iso_fortran_env\n integer(int32),intent(in):: x,y\n integer(int32):: ret\n end function\n end interface\n private\n public:: seg_tree, st_from_array\n type,public:: seg_tree\n integer(int32),private:: n, elnum\n integer(int32),allocatable,private:: v(:)\n procedure(operator),pointer,nopass,private:: op => null()\n integer(int32),private:: e\n contains\n procedure:: at => st_at\n procedure:: update => st_update\n procedure:: query => st_query\n procedure:: to_array => st_to_array\n end type\n\n interface seg_tree\n module procedure:: st_init\n end interface\n\n\ncontains\n function st_init(n, op, e) result(st)\n type(seg_tree):: st\n procedure(operator):: op\n integer(int32),intent(in):: n,e\n integer(int32):: x\n\n st%op => op\n st%e = e\n st%elnum = n\n x=1\n do while(n > x)\n x = 2*x\n end do\n st%n = x\n allocate(st%v(2*x-1), source=e)\n end function\n\n function st_from_array(ar, op, e) result(st)\n type(seg_tree):: st\n procedure(operator):: op\n integer(int32),intent(in):: ar(:),e\n integer(int32):: x,i\n\n st%op => op\n st%e = e\n st%elnum = size(ar)\n x=1\n do while(size(ar) > x)\n x = 2*x\n end do\n st%n = x\n allocate(st%v(2*x-1), source=e)\n st%v(x:x+st%elnum-1) = ar(:)\n do i=x-1,1,-1\n st%v(i) = st%op(st%v(2*i), st%V(2*i+1))\n end do\n end function\n\n \n function st_at(st,i) result(ret)\n class(seg_tree):: st\n integer(int32):: i,ret\n\n ret = st%v(st%n-1+i)\n end function\n\n subroutine st_update(st, i, x)\n class(seg_tree):: st\n integer(int32), intent(in):: i\n integer(int32):: ind\n integer(int32), intent(in):: x\n \n ind = i+st%n-1\n st%v(ind) = x\n do while(ind > 1)\n ind = ind/2\n st%v(ind) = st%op(st%v(2*ind), st%v(2*ind+1))\n end do\n end subroutine\n\n function st_query(st, a, b) result(ret)\n class(seg_tree):: st\n integer(int32), intent(in):: a,b\n integer(int32):: ret,l,r\n\n l=a+st%n-1; r=b+st%n-1\n ret = st%e\n do while (l <= r)\n if ( btest(l,0)) ret = st%op(st%v(l), ret)\n if (.not. btest(r,0)) ret = st%op(st%v(r), ret)\n l=(l+1)/2; r=(r-1)/2\n end do\n end function\n\n function st_to_array(st) result(ret)\n class(seg_tree):: st\n integer(int32):: ret(st%elnum)\n\n ret(:) = st%v(st%n:st%n+st%elnum-1)\n end function\nend module\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use segment_tree_mod\n implicit none\n integer(int32):: n,i,k,l,r\n integer(int32), allocatable:: a(:)\n type(seg_tree):: st\n\n read*, n,k\n allocate(a(n))\n do i=1,n\n read*, a(i)\n end do\n st = seg_tree(300001,maxx,0)\n do i=1,n\n l = max(1,a(i)-k); r = min(300001,a(i)+k)\n call st%update(a(i)+1,st%query(l,r)+1)\n end do\n\n print'(i0)', maxval(st%to_array())\n\ncontains\n function maxx(a,b) result(ret)\n integer(int32),intent(in):: a,b\n integer(int32):: ret\n\n ret = max(a,b)\n end function\n \n \nend program main", "language": "Fortran", "metadata": {"date": 1601175590, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02537.html", "problem_id": "p02537", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02537/input.txt", "sample_output_relpath": "derived/input_output/data/p02537/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02537/Fortran/s587695755.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s587695755", "user_id": "u234636620"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "module segment_tree_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n abstract interface\n function operator(x,y) result(ret)\n use, intrinsic:: iso_fortran_env\n integer(int32),intent(in):: x,y\n integer(int32):: ret\n end function\n end interface\n private\n public:: seg_tree, st_from_array\n type,public:: seg_tree\n integer(int32),private:: n, elnum\n integer(int32),allocatable,private:: v(:)\n procedure(operator),pointer,nopass,private:: op => null()\n integer(int32),private:: e\n contains\n procedure:: at => st_at\n procedure:: update => st_update\n procedure:: query => st_query\n procedure:: to_array => st_to_array\n end type\n\n interface seg_tree\n module procedure:: st_init\n end interface\n\n\ncontains\n function st_init(n, op, e) result(st)\n type(seg_tree):: st\n procedure(operator):: op\n integer(int32),intent(in):: n,e\n integer(int32):: x\n\n st%op => op\n st%e = e\n st%elnum = n\n x=1\n do while(n > x)\n x = 2*x\n end do\n st%n = x\n allocate(st%v(2*x-1), source=e)\n end function\n\n function st_from_array(ar, op, e) result(st)\n type(seg_tree):: st\n procedure(operator):: op\n integer(int32),intent(in):: ar(:),e\n integer(int32):: x,i\n\n st%op => op\n st%e = e\n st%elnum = size(ar)\n x=1\n do while(size(ar) > x)\n x = 2*x\n end do\n st%n = x\n allocate(st%v(2*x-1), source=e)\n st%v(x:x+st%elnum-1) = ar(:)\n do i=x-1,1,-1\n st%v(i) = st%op(st%v(2*i), st%V(2*i+1))\n end do\n end function\n\n \n function st_at(st,i) result(ret)\n class(seg_tree):: st\n integer(int32):: i,ret\n\n ret = st%v(st%n-1+i)\n end function\n\n subroutine st_update(st, i, x)\n class(seg_tree):: st\n integer(int32), intent(in):: i\n integer(int32):: ind\n integer(int32), intent(in):: x\n \n ind = i+st%n-1\n st%v(ind) = x\n do while(ind > 1)\n ind = ind/2\n st%v(ind) = st%op(st%v(2*ind), st%v(2*ind+1))\n end do\n end subroutine\n\n function st_query(st, a, b) result(ret)\n class(seg_tree):: st\n integer(int32), intent(in):: a,b\n integer(int32):: ret,l,r\n\n l=a+st%n-1; r=b+st%n-1\n ret = st%e\n do while (l <= r)\n if ( btest(l,0)) ret = st%op(st%v(l), ret)\n if (.not. btest(r,0)) ret = st%op(st%v(r), ret)\n l=(l+1)/2; r=(r-1)/2\n end do\n end function\n\n function st_to_array(st) result(ret)\n class(seg_tree):: st\n integer(int32):: ret(st%elnum)\n\n ret(:) = st%v(st%n:st%n+st%elnum-1)\n end function\nend module\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use segment_tree_mod\n implicit none\n integer(int32):: n,i,k,l,r\n integer(int32), allocatable:: a(:)\n type(seg_tree):: st\n\n read*, n,k\n allocate(a(n))\n do i=1,n\n read*, a(i)\n end do\n st = seg_tree(300001,maxx,0)\n do i=1,n\n l = max(1,a(i)-k); r = min(300001,a(i)+k)\n call st%update(a(i)+1,st%query(l,r)+1)\n end do\n\n print'(i0)', maxval(st%to_array())\n\ncontains\n function maxx(a,b) result(ret)\n integer(int32),intent(in):: a,b\n integer(int32):: ret\n\n ret = max(a,b)\n end function\n \n \nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given a sequence A_1, A_2, ..., A_N and an integer K.\n\nPrint the maximum possible length of a sequence B that satisfies the following conditions:\n\nB is a (not necessarily continuous) subsequence of A.\n\nFor each pair of adjacents elements of B, the absolute difference of the elements is at most K.\n\nConstraints\n\n1 \\leq N \\leq 300,000\n\n0 \\leq A_i \\leq 300,000\n\n0 \\leq K \\leq 300,000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1\nA_2\n:\nA_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n10 3\n1\n5\n4\n3\n8\n6\n9\n7\n2\n4\n\nSample Output 1\n\n7\n\nFor example, B = (1, 4, 3, 6, 9, 7, 4) satisfies the conditions.\n\nIt is a subsequence of A = (1, 5, 4, 3, 8, 6, 9, 7, 2, 4).\n\nAll of the absolute differences between two adjacent elements (|1-4|, |4-3|, |3-6|, |6-9|, |9-7|, |7-4|) are at most K = 3.", "sample_input": "10 3\n1\n5\n4\n3\n8\n6\n9\n7\n2\n4\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02537", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given a sequence A_1, A_2, ..., A_N and an integer K.\n\nPrint the maximum possible length of a sequence B that satisfies the following conditions:\n\nB is a (not necessarily continuous) subsequence of A.\n\nFor each pair of adjacents elements of B, the absolute difference of the elements is at most K.\n\nConstraints\n\n1 \\leq N \\leq 300,000\n\n0 \\leq A_i \\leq 300,000\n\n0 \\leq K \\leq 300,000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1\nA_2\n:\nA_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n10 3\n1\n5\n4\n3\n8\n6\n9\n7\n2\n4\n\nSample Output 1\n\n7\n\nFor example, B = (1, 4, 3, 6, 9, 7, 4) satisfies the conditions.\n\nIt is a subsequence of A = (1, 5, 4, 3, 8, 6, 9, 7, 2, 4).\n\nAll of the absolute differences between two adjacent elements (|1-4|, |4-3|, |3-6|, |6-9|, |9-7|, |7-4|) are at most K = 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3498, "cpu_time_ms": 152, "memory_kb": 8880}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s812080893", "group_id": "codeNet:p02538", "input_text": "module mint_mod\n use, intrinsic :: iso_fortran_env\n implicit none\n integer(int64) :: md = 998244353\n type,public:: mint\n integer(int64), private :: val = 0_8\n contains\n procedure:: to_int => mint_to_int64\n end type\n\n interface mint\n module procedure:: mi_init\n end interface\n interface operator( + )\n module procedure :: mi_add\n end interface\n interface operator( - )\n module procedure :: mi_sub\n end interface\n interface operator( * )\n module procedure :: mi_mul\n end interface\n interface operator( / )\n module procedure :: mi_div\n end interface\n interface operator( ** )\n module procedure :: mi_pow\n end interface\n interface assignment( = )\n module procedure:: mi_asgn\n end interface\n interface dot_product\n module procedure :: dot_prod\n end interface dot_product\n interface matmul\n module procedure :: matmul1, matmul2, matmul3\n end interface matmul\ncontains\n pure elemental function mi_init(num) result(ret)\n class(*),intent(in):: num\n type(mint):: ret\n ret = to_modint(num)\n end function\n\n\n\n pure elemental function to_int64(num) result(ret)\n class(*), intent(in) :: num\n integer(int64):: ret\n\n select type (num)\n type is (mint)\n ret = num%val\n type is (integer(int64))\n ret = num\n type is (integer(int32))\n ret = int(num, int64)\n type is (integer(int16))\n ret = int(num, int64)\n type is (integer(int8))\n ret = int(num, int64)\n class default\n ret = 0_8\n ret = 1_8/ret\n end select\n ret=modulo(ret,md)\n end function\n\n\n pure elemental function mint_to_int64(mx) result(ret)\n class(mint),intent(in):: mx\n integer(int64):: ret\n\n ret = to_int64(mx)\n end function\n\n pure elemental function to_modint(num) result(ret)\n class(*), intent(in):: num\n type(mint):: ret\n\n ret%val = to_int64(num)\n end function\n\n\n pure elemental subroutine mi_asgn(xm,y)\n type(mint), intent(inout) :: xm\n class(*), intent(in) :: y\n \n xm%val = to_int64(y)\n end subroutine\n\n\n pure elemental function mi_add(xm,y) result(ret)\n class(mint), intent(in) :: xm\n class(*), intent(in) :: y\n type(mint):: ret\n\n ret%val = modulo(xm%val + to_int64(y), md)\n end function\n\n\n pure elemental function mi_sub(xm,y) result(ret)\n class(mint), intent(in) :: xm\n class(*), intent(in) :: y\n type(mint):: ret\n\n ret%val = modulo(xm%val - to_int64(y), md)\n end function\n\n\n\n pure elemental function mi_mul(xm,y) result(ret)\n class(mint), intent(in) :: xm\n class(*), intent(in) :: y\n type(mint) ret\n\n ret%val = modulo(xm%val * to_int64(y), md)\n end function\n\n\n pure elemental function mi_div(xm,y) result(ret)\n class(mint), intent(in) :: xm\n class(*), intent(in) :: y\n type(mint):: ret\n\n ret%val = xm%val * to_int64(inv(to_modint(y)))\n end function\n\n \n pure elemental function inv(xm) result(ret)\n class(mint), intent(in) :: xm\n type(mint):: ret\n integer(int64) :: a, b, c, n\n integer(int64) :: x, y, z, m\n\n a = xm%val\n b = md\n c = 0_8\n n = 1_8\n do while (b /= 0_8)\n x = b\n y = mod(a,b)\n z = n-a/b*c\n m = c\n a = x\n b = y\n c = z\n n = m\n end do\n ret%val = n\n end function\n\n\n pure elemental function mi_pow(xm,y) result(ret)\n class(mint), intent(in) :: xm\n class(*), intent(in) :: y\n type(mint):: ret\n integer(int64) :: n\n type(mint) :: i\n\n ret%val = 1_8\n i%val = xm%val\n n = to_int64(y)\n do while (n > 0_8)\n if (btest(n,0)) ret%val = to_int64(mi_mul(ret,i))\n i%val = to_int64(mi_mul(i,i))\n n = rshift(n,1)\n end do\n end function\n\n pure type(mint) function dot_prod(x,y) result(ret)\n type(mint), intent(in) :: x(:), y(:)\n integer(int64):: i\n if (size(x,1) /= size(y,1)) i = to_int64('')\n do i = 1, size(x,1)\n call mi_asgn(ret,mi_add(ret,mi_mul(x(i),y(i))))\n end do\n end function\n\n\n pure function matmul1(x,y) result(ret)\n type(mint), intent(in) :: x(:,:), y(:)\n type(mint) :: ret(size(x,1))\n integer :: i\n do i = 1, size(x,1)\n call mi_asgn(ret(i),dot_prod(x(i,:),y))\n end do\n end function\n\n\n pure function matmul2(x,y) result(ret)\n type(mint), intent(in) :: x(:), y(:,:)\n type(mint) :: ret(size(y,2))\n integer :: i\n do i = 1, size(y,2)\n call mi_asgn(ret(i),dot_prod(x,y(:,i)))\n end do\n end function\n\n\n pure function matmul3(x,y) result(ret)\n type(mint), intent(in) :: x(:,:), y(:,:)\n type(mint) :: ret(size(x,1),size(y,2))\n integer :: i\n do i = 1, size(x,1)\n call mi_asgn(ret(i,:),matmul2(x(i,:),y))\n end do\n end function\nend module mint_mod\n\n\nmodule lazy_segtree_operators\n use mint_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n type s_elem\n type(mint):: v,k\n end type\n type f_elem\n type(mint):: v\n end type\ncontains\n function f_same(f1,f2)\n type(f_elem),intent(in):: f1,f2\n logical:: f_same\n\n f_same = (f1%v%to_int() == f2%v%to_int())\n end function\n\n function e()\n type(s_elem):: e\n\n e = s_elem(mint(0),mint(1))\n end function\n\n\n function id()\n type(f_elem):: id\n\n id = f_elem(mint(0))\n end function\n\n\n function op(a,b)\n type(s_elem),intent(in):: a,b\n type(s_elem):: op\n \n op%v = a%v*a%k + b%v\n op%k = a%k*b%k\n end function\n\n\n function mapping(s,f) result(new_s)\n type(s_elem),intent(in):: s\n type(f_elem),intent(in):: f\n type(s_elem):: new_s\n type(mint):: inv9\n inv9 = inv(mint(9))\n\n ! print*, \"mp\"\n if (f_same(f,id())) then\n new_s%v = s%v\n new_s%k = s%k\n else\n new_s%v = ((s%k-1)*inv9)*f%v\n new_s%k = s%k\n ! print'(*(i0,1x))', new_s%v%to_int()\n end if\n end function\n\n\n function composition(old_f,f) result(new_f)\n type(f_elem),intent(in):: old_f,f\n type(f_elem):: new_f\n ! print*, \"cps\"\n if (f_same(f,id())) then\n new_f = old_f\n else\n new_f = f\n end if\n end function\nend module\n\nmodule lazy_segtree_mod\n use,intrinsic :: iso_fortran_env\n use lazy_segtree_operators\n implicit none\n\n type,public:: lazy_segtree\n type(s_elem),allocatable:: d(:)\n type(f_elem),allocatable:: lz(:)\n integer(int32):: len\n contains\n procedure:: leaf => lst_leaf\n procedure:: update => lst_update, lst_update_one\n procedure:: query => lst_query, lst_query_one\n procedure:: to_array => lst_to_array\n procedure:: set => lst_set\n end type\n interface lazy_segtree\n module procedure:: lst_init\n end interface\ncontains\n function lst_init(n) result(lst)\n type(lazy_segtree):: lst\n integer(int32),intent(in):: n\n integer(int32):: x\n\n lst%len = n\n\n x=1\n do while(n > x)\n x = 2*x\n end do\n allocate(lst%d(2*x-1), source=e())\n allocate(lst%lz(2*x-1),source=id())\n end function\n\n function lst_leaf(lst)\n class(lazy_segtree):: lst\n integer(int32):: lst_leaf\n\n lst_leaf = size(lst%d)/2+1\n end function\n\n\n subroutine lst_set(lst,i,s)\n class(lazy_segtree),intent(inout):: lst\n type(s_elem),intent(in):: s\n integer(int32),value:: i\n\n i=i+lst%leaf()-1\n lst%d(i) = s\n i=rshift(i,1)\n do while(i > 0)\n lst%d(i) = op(lst%d(i*2), lst%d(i*2+1))\n i=rshift(i,1)\n end do\n end subroutine\n\n\n subroutine lst_update_one(lst,i,f)\n class(lazy_segtree),intent(inout):: lst\n type(f_elem),intent(in):: f\n integer(int32),intent(in):: i\n\n call lst_update(lst,i,i,f)\n end subroutine\n\n\n subroutine lst_update(lst, l,r,f)\n class(lazy_segtree),intent(inout):: lst\n type(f_elem),intent(in):: f\n integer(int32),intent(in):: l,r\n \n call lst_update_sub(lst,l,r,f,1,lst%leaf(),1)\n end subroutine\n\n\n recursive subroutine lst_update_sub(lst,ql,qr,f,nl,nr,i)\n class(lazy_segtree),intent(inout):: lst\n integer(int32),intent(in):: ql,qr,nl,nr,i\n type(f_elem),intent(in):: f\n integer(int32):: nm\n \n ! print'(*(i0,1x))', ql,qr,nl,nr\n ! print'(*(i0,1x))', f%v%to_int()\n call eval(lst,i)\n if (ql <= nl .and. nr <= qr) then\n ! print*, \"u\",1\n lst%lz(i) = composition(lst%lz(i), f)\n call eval(lst,i)\n else if (ql <= nr .and. nl <= qr) then\n ! print*, \"u\",2\n nm = (nl+nr)/2\n ! call lst_update_sub(lst,ql,qr,f,nl, nm,i*2 )\n ! call lst_update_sub(lst,ql,qr,f,nm+1,nr,i*2+1)\n lst%d(i) = op(lst%d(i*2), lst%d(i*2+1))\n end if\n end subroutine\n\n\n subroutine eval(lst,i)\n class(lazy_segtree):: lst\n integer(int32):: i\n\n ! print*, \"ev\", i\n if (f_same(lst%lz(i),id())) return\n if (i < lst%leaf()) then\n ! print*, \"comp\",i\n lst%lz(i*2) = composition(lst%lz(i*2), lst%lz(i))\n lst%lz(i*2+1) = composition(lst%lz(i*2+1), lst%lz(i))\n end if\n ! print'(a)', \"mp\"\n lst%d(i) = mapping(lst%d(i),lst%lz(i))\n ! print'(a)', \"id\"\n lst%lz(i) = id()\n end subroutine\n\n\n subroutine correct_laziness(lst)\n class(lazy_segtree):: lst\n integer(int32):: i\n \n do i=1,size(lst%d)\n call eval(lst,i)\n end do\n end subroutine\n\n\n function lst_query_one(lst,i) result(ret)\n class(lazy_segtree),intent(inout):: lst\n integer(int32),intent(in):: i\n type(s_elem):: ret\n\n ret = lst_query(lst,i,i)\n end function\n\n\n function lst_query(lst,l,r) result(ret)\n class(lazy_segtree),intent(inout):: lst\n integer(int32), intent(in):: l,r\n type(s_elem):: ret\n\n ret = lst_query_sub(lst,l,r,1,lst%leaf(),1)\n end function\n\n\n recursive function lst_query_sub(lst,ql,qr,nl,nr,i) result(ret)\n class(lazy_segtree),intent(inout):: lst\n integer(int32),intent(in):: ql,qr,nl,nr,i\n integer(int32):: nm\n type(s_elem):: ret,r1,r2\n \n call eval(lst,i)\n if (nr < ql .or. qr < nl) then\n ret = e()\n else if (ql <= nl .and. nr <= qr) then\n ret = lst%d(i)\n else\n nm = (nl+nr)/2\n ! r1 = lst_query_sub(lst,ql,qr,nl, nm,i*2 )\n ! r2 = lst_query_sub(lst,ql,qr,nm+1,nr,i*2+1)\n ret = op(r1,r2)\n end if\n end function\n\n function lst_to_array(lst) result(ret)\n class(lazy_segtree):: lst\n type(s_elem):: ret(lst%len)\n\n call correct_laziness(lst)\n ret(:) = lst%d(lst%leaf():lst%leaf()+lst%len-1)\n end function\n\n\n subroutine debug_print(lst)\n class(lazy_segtree):: lst\n integer(int32):: l,r\n\n print'(a)', \"datav\"\n l=1; r=1\n do while(r <= size(lst%d))\n print'(*(i0,1x))', lst%d(l:r)%v%to_int()\n l=l*2; r=r*2+1\n end do\n\n print'(a)', \"datak\"\n l=1; r=1\n do while(r <= size(lst%d))\n print'(*(i0,1x))', lst%d(l:r)%k%to_int()\n l=l*2; r=r*2+1\n end do\n\n print'(a)', \"lz\"\n l=1; r=1\n do while(r <= size(lst%lz))\n print'(*(i0,1x))', lst%lz(l:r)%v%to_int()\n l=l*2; r=r*2+1\n end do\n \n\n end subroutine\nend module\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use lazy_segtree_mod\n use lazy_segtree_operators\n implicit none\n integer(int32):: n,q,i\n integer(int32):: l,r,d\n type(lazy_segtree)::lst\n type(s_elem):: ans\n\n read*, n,q\n lst = lazy_segtree(n)\n do i=1,n\n ! print'(i0)', i\n call lst%set(i,s_elem(mint(1),mint(10)))\n end do\n\n do i=1,q\n read*, l,r,d\n print'(a)', \"update\"\n call lst%update(l,r,f_elem(mint(d)))\n call debug_print(lst)\n print'(a)', \"query\"\n ans = lst%query(1,n)\n print'(i0)', ans%v%to_int()\n end do\nend program main", "language": "Fortran", "metadata": {"date": 1601398154, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02538.html", "problem_id": "p02538", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02538/input.txt", "sample_output_relpath": "derived/input_output/data/p02538/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02538/Fortran/s812080893.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s812080893", "user_id": "u234636620"}, "prompt_components": {"gold_output": "11222211\n77772211\n77333333\n72333333\n72311333\n", "input_to_evaluate": "module mint_mod\n use, intrinsic :: iso_fortran_env\n implicit none\n integer(int64) :: md = 998244353\n type,public:: mint\n integer(int64), private :: val = 0_8\n contains\n procedure:: to_int => mint_to_int64\n end type\n\n interface mint\n module procedure:: mi_init\n end interface\n interface operator( + )\n module procedure :: mi_add\n end interface\n interface operator( - )\n module procedure :: mi_sub\n end interface\n interface operator( * )\n module procedure :: mi_mul\n end interface\n interface operator( / )\n module procedure :: mi_div\n end interface\n interface operator( ** )\n module procedure :: mi_pow\n end interface\n interface assignment( = )\n module procedure:: mi_asgn\n end interface\n interface dot_product\n module procedure :: dot_prod\n end interface dot_product\n interface matmul\n module procedure :: matmul1, matmul2, matmul3\n end interface matmul\ncontains\n pure elemental function mi_init(num) result(ret)\n class(*),intent(in):: num\n type(mint):: ret\n ret = to_modint(num)\n end function\n\n\n\n pure elemental function to_int64(num) result(ret)\n class(*), intent(in) :: num\n integer(int64):: ret\n\n select type (num)\n type is (mint)\n ret = num%val\n type is (integer(int64))\n ret = num\n type is (integer(int32))\n ret = int(num, int64)\n type is (integer(int16))\n ret = int(num, int64)\n type is (integer(int8))\n ret = int(num, int64)\n class default\n ret = 0_8\n ret = 1_8/ret\n end select\n ret=modulo(ret,md)\n end function\n\n\n pure elemental function mint_to_int64(mx) result(ret)\n class(mint),intent(in):: mx\n integer(int64):: ret\n\n ret = to_int64(mx)\n end function\n\n pure elemental function to_modint(num) result(ret)\n class(*), intent(in):: num\n type(mint):: ret\n\n ret%val = to_int64(num)\n end function\n\n\n pure elemental subroutine mi_asgn(xm,y)\n type(mint), intent(inout) :: xm\n class(*), intent(in) :: y\n \n xm%val = to_int64(y)\n end subroutine\n\n\n pure elemental function mi_add(xm,y) result(ret)\n class(mint), intent(in) :: xm\n class(*), intent(in) :: y\n type(mint):: ret\n\n ret%val = modulo(xm%val + to_int64(y), md)\n end function\n\n\n pure elemental function mi_sub(xm,y) result(ret)\n class(mint), intent(in) :: xm\n class(*), intent(in) :: y\n type(mint):: ret\n\n ret%val = modulo(xm%val - to_int64(y), md)\n end function\n\n\n\n pure elemental function mi_mul(xm,y) result(ret)\n class(mint), intent(in) :: xm\n class(*), intent(in) :: y\n type(mint) ret\n\n ret%val = modulo(xm%val * to_int64(y), md)\n end function\n\n\n pure elemental function mi_div(xm,y) result(ret)\n class(mint), intent(in) :: xm\n class(*), intent(in) :: y\n type(mint):: ret\n\n ret%val = xm%val * to_int64(inv(to_modint(y)))\n end function\n\n \n pure elemental function inv(xm) result(ret)\n class(mint), intent(in) :: xm\n type(mint):: ret\n integer(int64) :: a, b, c, n\n integer(int64) :: x, y, z, m\n\n a = xm%val\n b = md\n c = 0_8\n n = 1_8\n do while (b /= 0_8)\n x = b\n y = mod(a,b)\n z = n-a/b*c\n m = c\n a = x\n b = y\n c = z\n n = m\n end do\n ret%val = n\n end function\n\n\n pure elemental function mi_pow(xm,y) result(ret)\n class(mint), intent(in) :: xm\n class(*), intent(in) :: y\n type(mint):: ret\n integer(int64) :: n\n type(mint) :: i\n\n ret%val = 1_8\n i%val = xm%val\n n = to_int64(y)\n do while (n > 0_8)\n if (btest(n,0)) ret%val = to_int64(mi_mul(ret,i))\n i%val = to_int64(mi_mul(i,i))\n n = rshift(n,1)\n end do\n end function\n\n pure type(mint) function dot_prod(x,y) result(ret)\n type(mint), intent(in) :: x(:), y(:)\n integer(int64):: i\n if (size(x,1) /= size(y,1)) i = to_int64('')\n do i = 1, size(x,1)\n call mi_asgn(ret,mi_add(ret,mi_mul(x(i),y(i))))\n end do\n end function\n\n\n pure function matmul1(x,y) result(ret)\n type(mint), intent(in) :: x(:,:), y(:)\n type(mint) :: ret(size(x,1))\n integer :: i\n do i = 1, size(x,1)\n call mi_asgn(ret(i),dot_prod(x(i,:),y))\n end do\n end function\n\n\n pure function matmul2(x,y) result(ret)\n type(mint), intent(in) :: x(:), y(:,:)\n type(mint) :: ret(size(y,2))\n integer :: i\n do i = 1, size(y,2)\n call mi_asgn(ret(i),dot_prod(x,y(:,i)))\n end do\n end function\n\n\n pure function matmul3(x,y) result(ret)\n type(mint), intent(in) :: x(:,:), y(:,:)\n type(mint) :: ret(size(x,1),size(y,2))\n integer :: i\n do i = 1, size(x,1)\n call mi_asgn(ret(i,:),matmul2(x(i,:),y))\n end do\n end function\nend module mint_mod\n\n\nmodule lazy_segtree_operators\n use mint_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n type s_elem\n type(mint):: v,k\n end type\n type f_elem\n type(mint):: v\n end type\ncontains\n function f_same(f1,f2)\n type(f_elem),intent(in):: f1,f2\n logical:: f_same\n\n f_same = (f1%v%to_int() == f2%v%to_int())\n end function\n\n function e()\n type(s_elem):: e\n\n e = s_elem(mint(0),mint(1))\n end function\n\n\n function id()\n type(f_elem):: id\n\n id = f_elem(mint(0))\n end function\n\n\n function op(a,b)\n type(s_elem),intent(in):: a,b\n type(s_elem):: op\n \n op%v = a%v*a%k + b%v\n op%k = a%k*b%k\n end function\n\n\n function mapping(s,f) result(new_s)\n type(s_elem),intent(in):: s\n type(f_elem),intent(in):: f\n type(s_elem):: new_s\n type(mint):: inv9\n inv9 = inv(mint(9))\n\n ! print*, \"mp\"\n if (f_same(f,id())) then\n new_s%v = s%v\n new_s%k = s%k\n else\n new_s%v = ((s%k-1)*inv9)*f%v\n new_s%k = s%k\n ! print'(*(i0,1x))', new_s%v%to_int()\n end if\n end function\n\n\n function composition(old_f,f) result(new_f)\n type(f_elem),intent(in):: old_f,f\n type(f_elem):: new_f\n ! print*, \"cps\"\n if (f_same(f,id())) then\n new_f = old_f\n else\n new_f = f\n end if\n end function\nend module\n\nmodule lazy_segtree_mod\n use,intrinsic :: iso_fortran_env\n use lazy_segtree_operators\n implicit none\n\n type,public:: lazy_segtree\n type(s_elem),allocatable:: d(:)\n type(f_elem),allocatable:: lz(:)\n integer(int32):: len\n contains\n procedure:: leaf => lst_leaf\n procedure:: update => lst_update, lst_update_one\n procedure:: query => lst_query, lst_query_one\n procedure:: to_array => lst_to_array\n procedure:: set => lst_set\n end type\n interface lazy_segtree\n module procedure:: lst_init\n end interface\ncontains\n function lst_init(n) result(lst)\n type(lazy_segtree):: lst\n integer(int32),intent(in):: n\n integer(int32):: x\n\n lst%len = n\n\n x=1\n do while(n > x)\n x = 2*x\n end do\n allocate(lst%d(2*x-1), source=e())\n allocate(lst%lz(2*x-1),source=id())\n end function\n\n function lst_leaf(lst)\n class(lazy_segtree):: lst\n integer(int32):: lst_leaf\n\n lst_leaf = size(lst%d)/2+1\n end function\n\n\n subroutine lst_set(lst,i,s)\n class(lazy_segtree),intent(inout):: lst\n type(s_elem),intent(in):: s\n integer(int32),value:: i\n\n i=i+lst%leaf()-1\n lst%d(i) = s\n i=rshift(i,1)\n do while(i > 0)\n lst%d(i) = op(lst%d(i*2), lst%d(i*2+1))\n i=rshift(i,1)\n end do\n end subroutine\n\n\n subroutine lst_update_one(lst,i,f)\n class(lazy_segtree),intent(inout):: lst\n type(f_elem),intent(in):: f\n integer(int32),intent(in):: i\n\n call lst_update(lst,i,i,f)\n end subroutine\n\n\n subroutine lst_update(lst, l,r,f)\n class(lazy_segtree),intent(inout):: lst\n type(f_elem),intent(in):: f\n integer(int32),intent(in):: l,r\n \n call lst_update_sub(lst,l,r,f,1,lst%leaf(),1)\n end subroutine\n\n\n recursive subroutine lst_update_sub(lst,ql,qr,f,nl,nr,i)\n class(lazy_segtree),intent(inout):: lst\n integer(int32),intent(in):: ql,qr,nl,nr,i\n type(f_elem),intent(in):: f\n integer(int32):: nm\n \n ! print'(*(i0,1x))', ql,qr,nl,nr\n ! print'(*(i0,1x))', f%v%to_int()\n call eval(lst,i)\n if (ql <= nl .and. nr <= qr) then\n ! print*, \"u\",1\n lst%lz(i) = composition(lst%lz(i), f)\n call eval(lst,i)\n else if (ql <= nr .and. nl <= qr) then\n ! print*, \"u\",2\n nm = (nl+nr)/2\n ! call lst_update_sub(lst,ql,qr,f,nl, nm,i*2 )\n ! call lst_update_sub(lst,ql,qr,f,nm+1,nr,i*2+1)\n lst%d(i) = op(lst%d(i*2), lst%d(i*2+1))\n end if\n end subroutine\n\n\n subroutine eval(lst,i)\n class(lazy_segtree):: lst\n integer(int32):: i\n\n ! print*, \"ev\", i\n if (f_same(lst%lz(i),id())) return\n if (i < lst%leaf()) then\n ! print*, \"comp\",i\n lst%lz(i*2) = composition(lst%lz(i*2), lst%lz(i))\n lst%lz(i*2+1) = composition(lst%lz(i*2+1), lst%lz(i))\n end if\n ! print'(a)', \"mp\"\n lst%d(i) = mapping(lst%d(i),lst%lz(i))\n ! print'(a)', \"id\"\n lst%lz(i) = id()\n end subroutine\n\n\n subroutine correct_laziness(lst)\n class(lazy_segtree):: lst\n integer(int32):: i\n \n do i=1,size(lst%d)\n call eval(lst,i)\n end do\n end subroutine\n\n\n function lst_query_one(lst,i) result(ret)\n class(lazy_segtree),intent(inout):: lst\n integer(int32),intent(in):: i\n type(s_elem):: ret\n\n ret = lst_query(lst,i,i)\n end function\n\n\n function lst_query(lst,l,r) result(ret)\n class(lazy_segtree),intent(inout):: lst\n integer(int32), intent(in):: l,r\n type(s_elem):: ret\n\n ret = lst_query_sub(lst,l,r,1,lst%leaf(),1)\n end function\n\n\n recursive function lst_query_sub(lst,ql,qr,nl,nr,i) result(ret)\n class(lazy_segtree),intent(inout):: lst\n integer(int32),intent(in):: ql,qr,nl,nr,i\n integer(int32):: nm\n type(s_elem):: ret,r1,r2\n \n call eval(lst,i)\n if (nr < ql .or. qr < nl) then\n ret = e()\n else if (ql <= nl .and. nr <= qr) then\n ret = lst%d(i)\n else\n nm = (nl+nr)/2\n ! r1 = lst_query_sub(lst,ql,qr,nl, nm,i*2 )\n ! r2 = lst_query_sub(lst,ql,qr,nm+1,nr,i*2+1)\n ret = op(r1,r2)\n end if\n end function\n\n function lst_to_array(lst) result(ret)\n class(lazy_segtree):: lst\n type(s_elem):: ret(lst%len)\n\n call correct_laziness(lst)\n ret(:) = lst%d(lst%leaf():lst%leaf()+lst%len-1)\n end function\n\n\n subroutine debug_print(lst)\n class(lazy_segtree):: lst\n integer(int32):: l,r\n\n print'(a)', \"datav\"\n l=1; r=1\n do while(r <= size(lst%d))\n print'(*(i0,1x))', lst%d(l:r)%v%to_int()\n l=l*2; r=r*2+1\n end do\n\n print'(a)', \"datak\"\n l=1; r=1\n do while(r <= size(lst%d))\n print'(*(i0,1x))', lst%d(l:r)%k%to_int()\n l=l*2; r=r*2+1\n end do\n\n print'(a)', \"lz\"\n l=1; r=1\n do while(r <= size(lst%lz))\n print'(*(i0,1x))', lst%lz(l:r)%v%to_int()\n l=l*2; r=r*2+1\n end do\n \n\n end subroutine\nend module\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use lazy_segtree_mod\n use lazy_segtree_operators\n implicit none\n integer(int32):: n,q,i\n integer(int32):: l,r,d\n type(lazy_segtree)::lst\n type(s_elem):: ans\n\n read*, n,q\n lst = lazy_segtree(n)\n do i=1,n\n ! print'(i0)', i\n call lst%set(i,s_elem(mint(1),mint(10)))\n end do\n\n do i=1,q\n read*, l,r,d\n print'(a)', \"update\"\n call lst%update(l,r,f_elem(mint(d)))\n call debug_print(lst)\n print'(a)', \"query\"\n ans = lst%query(1,n)\n print'(i0)', ans%v%to_int()\n end do\nend program main", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou have a string S of length N.\nInitially, all characters in S are 1s.\n\nYou will perform queries Q times.\nIn the i-th query, you are given two integers L_i, R_i and a character D_i (which is a digit).\nThen, you must replace all characters from the L_i-th to the R_i-th (inclusive) with D_i.\n\nAfter each query, read the string S as a decimal integer, and print its value modulo 998,244,353.\n\nConstraints\n\n1 \\leq N, Q \\leq 200,000\n\n1 \\leq L_i \\leq R_i \\leq N\n\n1 \\leq D_i \\leq 9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nL_1 R_1 D_1\n:\nL_Q R_Q D_Q\n\nOutput\n\nPrint Q lines.\nIn the i-th line print the value of S after the i-th query, modulo 998,244,353.\n\nSample Input 1\n\n8 5\n3 6 2\n1 4 7\n3 8 3\n2 2 2\n4 5 1\n\nSample Output 1\n\n11222211\n77772211\n77333333\n72333333\n72311333\n\nSample Input 2\n\n200000 1\n123 456 7\n\nSample Output 2\n\n641437905\n\nDon't forget to take the modulo.", "sample_input": "8 5\n3 6 2\n1 4 7\n3 8 3\n2 2 2\n4 5 1\n"}, "reference_outputs": ["11222211\n77772211\n77333333\n72333333\n72311333\n"], "source_document_id": "p02538", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou have a string S of length N.\nInitially, all characters in S are 1s.\n\nYou will perform queries Q times.\nIn the i-th query, you are given two integers L_i, R_i and a character D_i (which is a digit).\nThen, you must replace all characters from the L_i-th to the R_i-th (inclusive) with D_i.\n\nAfter each query, read the string S as a decimal integer, and print its value modulo 998,244,353.\n\nConstraints\n\n1 \\leq N, Q \\leq 200,000\n\n1 \\leq L_i \\leq R_i \\leq N\n\n1 \\leq D_i \\leq 9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nL_1 R_1 D_1\n:\nL_Q R_Q D_Q\n\nOutput\n\nPrint Q lines.\nIn the i-th line print the value of S after the i-th query, modulo 998,244,353.\n\nSample Input 1\n\n8 5\n3 6 2\n1 4 7\n3 8 3\n2 2 2\n4 5 1\n\nSample Output 1\n\n11222211\n77772211\n77333333\n72333333\n72311333\n\nSample Input 2\n\n200000 1\n123 456 7\n\nSample Output 2\n\n641437905\n\nDon't forget to take the modulo.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 12755, "cpu_time_ms": 2265, "memory_kb": 57668}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s314179071", "group_id": "codeNet:p02546", "input_text": " PROGRAM piyo\n IMPLICIT NONE\n character(1000) :: s\n integer :: len\n \n read*,s\n len = len_trim( s )\n \n \n if(s(len:len)=='s')then\n print*,s(1:len)//'es'\n else\n print*,s(1:len)//'s'\n end if\n \n \n \n stop\n !debugg\n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1600542142, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02546.html", "problem_id": "p02546", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02546/input.txt", "sample_output_relpath": "derived/input_output/data/p02546/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02546/Fortran/s314179071.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s314179071", "user_id": "u171356453"}, "prompt_components": {"gold_output": "apples\n", "input_to_evaluate": " PROGRAM piyo\n IMPLICIT NONE\n character(1000) :: s\n integer :: len\n \n read*,s\n len = len_trim( s )\n \n \n if(s(len:len)=='s')then\n print*,s(1:len)//'es'\n else\n print*,s(1:len)//'s'\n end if\n \n \n \n stop\n !debugg\n \n \n \n END PROGRAM", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.\n\nIn Taknese, the plural form of a noun is spelled based on the following rules:\n\nIf a noun's singular form does not end with s, append s to the end of the singular form.\n\nIf a noun's singular form ends with s, append es to the end of the singular form.\n\nYou are given the singular form S of a Taknese noun. Output its plural form.\n\nConstraints\n\nS is a string of length 1 between 1000, inclusive.\n\nS contains only lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the plural form of the given Taknese word.\n\nSample Input 1\n\napple\n\nSample Output 1\n\napples\n\napple ends with e, so its plural form is apples.\n\nSample Input 2\n\nbus\n\nSample Output 2\n\nbuses\n\nbus ends with s, so its plural form is buses.\n\nSample Input 3\n\nbox\n\nSample Output 3\n\nboxs", "sample_input": "apple\n"}, "reference_outputs": ["apples\n"], "source_document_id": "p02546", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn the Kingdom of AtCoder, people use a language called Taknese, which uses lowercase English letters.\n\nIn Taknese, the plural form of a noun is spelled based on the following rules:\n\nIf a noun's singular form does not end with s, append s to the end of the singular form.\n\nIf a noun's singular form ends with s, append es to the end of the singular form.\n\nYou are given the singular form S of a Taknese noun. Output its plural form.\n\nConstraints\n\nS is a string of length 1 between 1000, inclusive.\n\nS contains only lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the plural form of the given Taknese word.\n\nSample Input 1\n\napple\n\nSample Output 1\n\napples\n\napple ends with e, so its plural form is apples.\n\nSample Input 2\n\nbus\n\nSample Output 2\n\nbuses\n\nbus ends with s, so its plural form is buses.\n\nSample Input 3\n\nbox\n\nSample Output 3\n\nboxs", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 345, "cpu_time_ms": 12, "memory_kb": 2864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s270079203", "group_id": "codeNet:p02547", "input_text": "program abc68\n implicit none\n integer(8)::N,ia,ib,c=0\n integer(8),allocatable::a(:),b(:)\n read(*,*)N\n allocate(a(N),b(N))\n do ia=1,N\n read(*,*)a(ia),b(ia)\n end do\n do ib=1,N-2\n if(a(ib)==b(ib).and.a(ib+1)==b(ib+1).and.a(ib+2)==b(ib+2))then\n c=1\n exit\n end if\n end do\n if(c==1)then\n print'(a)',\"Yes\"\n else\n print'(a)',\"No\"\n end if\n deallocate(a,b)\nend program abc68", "language": "Fortran", "metadata": {"date": 1600543031, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02547.html", "problem_id": "p02547", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02547/input.txt", "sample_output_relpath": "derived/input_output/data/p02547/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02547/Fortran/s270079203.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s270079203", "user_id": "u897889420"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program abc68\n implicit none\n integer(8)::N,ia,ib,c=0\n integer(8),allocatable::a(:),b(:)\n read(*,*)N\n allocate(a(N),b(N))\n do ia=1,N\n read(*,*)a(ia),b(ia)\n end do\n do ib=1,N-2\n if(a(ib)==b(ib).and.a(ib+1)==b(ib+1).and.a(ib+2)==b(ib+2))then\n c=1\n exit\n end if\n end do\n if(c==1)then\n print'(a)',\"Yes\"\n else\n print'(a)',\"No\"\n end if\n deallocate(a,b)\nend program abc68", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTak performed the following action N times: rolling two dice.\nThe result of the i-th roll is D_{i,1} and D_{i,2}.\n\nCheck if doublets occurred at least three times in a row.\nSpecifically, check if there exists at lease one i such that D_{i,1}=D_{i,2}, D_{i+1,1}=D_{i+1,2} and D_{i+2,1}=D_{i+2,2} hold.\n\nConstraints\n\n3 \\leq N \\leq 100\n\n1\\leq D_{i,j} \\leq 6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD_{1,1} D_{1,2}\n\\vdots\nD_{N,1} D_{N,2}\n\nOutput\n\nPrint Yes if doublets occurred at least three times in a row. Print No otherwise.\n\nSample Input 1\n\n5\n1 2\n6 6\n4 4\n3 3\n3 2\n\nSample Output 1\n\nYes\n\nFrom the second roll to the fourth roll, three doublets occurred in a row.\n\nSample Input 2\n\n5\n1 1\n2 2\n3 4\n5 5\n6 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n6\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n\nSample Output 3\n\nYes", "sample_input": "5\n1 2\n6 6\n4 4\n3 3\n3 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02547", "source_text": "Score : 200 points\n\nProblem Statement\n\nTak performed the following action N times: rolling two dice.\nThe result of the i-th roll is D_{i,1} and D_{i,2}.\n\nCheck if doublets occurred at least three times in a row.\nSpecifically, check if there exists at lease one i such that D_{i,1}=D_{i,2}, D_{i+1,1}=D_{i+1,2} and D_{i+2,1}=D_{i+2,2} hold.\n\nConstraints\n\n3 \\leq N \\leq 100\n\n1\\leq D_{i,j} \\leq 6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nD_{1,1} D_{1,2}\n\\vdots\nD_{N,1} D_{N,2}\n\nOutput\n\nPrint Yes if doublets occurred at least three times in a row. Print No otherwise.\n\nSample Input 1\n\n5\n1 2\n6 6\n4 4\n3 3\n3 2\n\nSample Output 1\n\nYes\n\nFrom the second roll to the fourth roll, three doublets occurred in a row.\n\nSample Input 2\n\n5\n1 1\n2 2\n3 4\n5 5\n6 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n6\n1 1\n2 2\n3 3\n4 4\n5 5\n6 6\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 373, "cpu_time_ms": 11, "memory_kb": 2932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s523140557", "group_id": "codeNet:p02548", "input_text": " PROGRAM piyo\n IMPLICIT NONE\n INTEGER,PARAMETER :: p = 8\n integer(p) :: n,a,b,c ,nn=10**6\n integer(p) :: t(0:10**6)\n \n read*,n\n \n do a = 1,nn\n do b = 1, nn/a\n if( a*b>10**6 )cycle\n \n t(a*b) = t(a*b) + 1\n end do\n end do\n \n print*,sum(t(1:n-1))\n \n \n \n stop\n !debugg\n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1600546077, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02548.html", "problem_id": "p02548", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02548/input.txt", "sample_output_relpath": "derived/input_output/data/p02548/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02548/Fortran/s523140557.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s523140557", "user_id": "u171356453"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": " PROGRAM piyo\n IMPLICIT NONE\n INTEGER,PARAMETER :: p = 8\n integer(p) :: n,a,b,c ,nn=10**6\n integer(p) :: t(0:10**6)\n \n read*,n\n \n do a = 1,nn\n do b = 1, nn/a\n if( a*b>10**6 )cycle\n \n t(a*b) = t(a*b) + 1\n end do\n end do\n \n print*,sum(t(1:n-1))\n \n \n \n stop\n !debugg\n \n \n \n END PROGRAM", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer N.\nHow many tuples (A,B,C) of positive integers satisfy A \\times B + C = N?\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n3\n\nThere are 3 tuples of integers that satisfy A \\times B + C = 3: (A, B, C) = (1, 1, 2), (1, 2, 1), (2, 1, 1).\n\nSample Input 2\n\n100\n\nSample Output 2\n\n473\n\nSample Input 3\n\n1000000\n\nSample Output 3\n\n13969985", "sample_input": "3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02548", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer N.\nHow many tuples (A,B,C) of positive integers satisfy A \\times B + C = N?\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n3\n\nThere are 3 tuples of integers that satisfy A \\times B + C = 3: (A, B, C) = (1, 1, 2), (1, 2, 1), (2, 1, 1).\n\nSample Input 2\n\n100\n\nSample Output 2\n\n473\n\nSample Input 3\n\n1000000\n\nSample Output 3\n\n13969985", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 428, "cpu_time_ms": 71, "memory_kb": 10672}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s278542977", "group_id": "codeNet:p02549", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,k,i,j,l,ns\n integer(int32):: md = 998244353\n integer(int32), allocatable:: lr(:,:), s(:),dp(:)\n\n\n read*, n, k\n allocate(lr(2,k))\n do i=1,k\n read*, lr(:,i)\n end do\n allocate(s(n),source=0)\n do i=1,k\n do j=lr(1,i),lr(2,i)\n s(j) = 1\n end do\n end do\n\n allocate(dp(n),source=0)\n ! print'(*(i0,1x))', s(:)\n dp(1) = 1\n do i=1,n-1\n dp(i+1:n) = mod(dp(i+1:n)+mod(dp(i)*s(:n-i),md),md)\n ! print'(*(i0,1x))', dp(:)\n end do\n print'(i0)', dp(n)\nend program main", "language": "Fortran", "metadata": {"date": 1600545540, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02549.html", "problem_id": "p02549", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02549/input.txt", "sample_output_relpath": "derived/input_output/data/p02549/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02549/Fortran/s278542977.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s278542977", "user_id": "u234636620"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,k,i,j,l,ns\n integer(int32):: md = 998244353\n integer(int32), allocatable:: lr(:,:), s(:),dp(:)\n\n\n read*, n, k\n allocate(lr(2,k))\n do i=1,k\n read*, lr(:,i)\n end do\n allocate(s(n),source=0)\n do i=1,k\n do j=lr(1,i),lr(2,i)\n s(j) = 1\n end do\n end do\n\n allocate(dp(n),source=0)\n ! print'(*(i0,1x))', s(:)\n dp(1) = 1\n do i=1,n-1\n dp(i+1:n) = mod(dp(i+1:n)+mod(dp(i)*s(:n-i),md),md)\n ! print'(*(i0,1x))', dp(:)\n end do\n print'(i0)', dp(n)\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N cells arranged in a row, numbered 1, 2, \\ldots, N from left to right.\n\nTak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below.\n\nYou are given an integer K that is less than or equal to 10, and K non-intersecting segments [L_1, R_1], [L_2, R_2], \\ldots, [L_K, R_K].\nLet S be the union of these K segments.\nHere, the segment [l, r] denotes the set consisting of all integers i that satisfy l \\leq i \\leq r.\n\n\bWhen you are on Cell i, pick an integer d from S and move to Cell i + d. You cannot move out of the cells.\n\nTo help Tak, find the number of ways to go to Cell N, modulo 998244353.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\min(N, 10)\n\n1 \\leq L_i \\leq R_i \\leq N\n\n[L_i, R_i] and [L_j, R_j] do not intersect (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nL_1 R_1\nL_2 R_2\n:\nL_K R_K\n\nOutput\n\nPrint the number of ways for Tak to go from Cell 1 to Cell N, modulo 998244353.\n\nSample Input 1\n\n5 2\n1 1\n3 4\n\nSample Output 1\n\n4\n\nThe set S is the union of the segment [1, 1] and the segment [3, 4], therefore S = \\{ 1, 3, 4 \\} holds.\n\nThere are 4 possible ways to get to Cell 5:\n\n1 \\to 2 \\to 3 \\to 4 \\to 5,\n\n1 \\to 2 \\to 5,\n\n1 \\to 4 \\to 5 and\n\n1 \\to 5.\n\nSample Input 2\n\n5 2\n3 3\n5 5\n\nSample Output 2\n\n0\n\nBecause S = \\{ 3, 5 \\} holds, you cannot reach to Cell 5.\nPrint 0.\n\nSample Input 3\n\n5 1\n1 2\n\nSample Output 3\n\n5\n\nSample Input 4\n\n60 3\n5 8\n1 3\n10 15\n\nSample Output 4\n\n221823067\n\nNote that you have to print the answer modulo 998244353.", "sample_input": "5 2\n1 1\n3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02549", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N cells arranged in a row, numbered 1, 2, \\ldots, N from left to right.\n\nTak lives in these cells and is currently on Cell 1. He is trying to reach Cell N by using the procedure described below.\n\nYou are given an integer K that is less than or equal to 10, and K non-intersecting segments [L_1, R_1], [L_2, R_2], \\ldots, [L_K, R_K].\nLet S be the union of these K segments.\nHere, the segment [l, r] denotes the set consisting of all integers i that satisfy l \\leq i \\leq r.\n\n\bWhen you are on Cell i, pick an integer d from S and move to Cell i + d. You cannot move out of the cells.\n\nTo help Tak, find the number of ways to go to Cell N, modulo 998244353.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq \\min(N, 10)\n\n1 \\leq L_i \\leq R_i \\leq N\n\n[L_i, R_i] and [L_j, R_j] do not intersect (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nL_1 R_1\nL_2 R_2\n:\nL_K R_K\n\nOutput\n\nPrint the number of ways for Tak to go from Cell 1 to Cell N, modulo 998244353.\n\nSample Input 1\n\n5 2\n1 1\n3 4\n\nSample Output 1\n\n4\n\nThe set S is the union of the segment [1, 1] and the segment [3, 4], therefore S = \\{ 1, 3, 4 \\} holds.\n\nThere are 4 possible ways to get to Cell 5:\n\n1 \\to 2 \\to 3 \\to 4 \\to 5,\n\n1 \\to 2 \\to 5,\n\n1 \\to 4 \\to 5 and\n\n1 \\to 5.\n\nSample Input 2\n\n5 2\n3 3\n5 5\n\nSample Output 2\n\n0\n\nBecause S = \\{ 3, 5 \\} holds, you cannot reach to Cell 5.\nPrint 0.\n\nSample Input 3\n\n5 1\n1 2\n\nSample Output 3\n\n5\n\nSample Input 4\n\n60 3\n5 8\n1 3\n10 15\n\nSample Output 4\n\n221823067\n\nNote that you have to print the answer modulo 998244353.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 630, "cpu_time_ms": 2205, "memory_kb": 4184}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s862963105", "group_id": "codeNet:p02550", "input_text": "program sequence_sum\n implicit none\n integer(8) :: n, num, tmp, a(0:100000) = 0\n integer :: x, m, b(0:100000) = 0, period, offset, rem, i\n read(*,*) n, x, m\n tmp = m\n if (n <= 2 * m) then\n num = x\n rem = int(n)\n do i = 2, rem\n x = mod(int(x, 8) * x, tmp)\n if (x == 0) exit\n num = num + x\n end do\n write(*,'(i0)') num\n stop\n end if\n a(1) = x\n b(x) = 1\n do i = 2, m + 1\n x = int(mod(int(x, 8) * x, tmp))\n a(i) = a(i - 1) + x\n if (b(x) > 0) then\n offset = b(x) - 1\n period = i - offset - 1\n exit\n end if\n b(x) = i\n end do\n num = (n - offset) / period\n rem = int(n - offset - num * period)\n write(*,'(i0)') (a(offset + period) - a(offset)) * num + a(offset + rem)\nend program sequence_sum", "language": "Fortran", "metadata": {"date": 1600566629, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02550.html", "problem_id": "p02550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02550/input.txt", "sample_output_relpath": "derived/input_output/data/p02550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02550/Fortran/s862963105.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s862963105", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1369\n", "input_to_evaluate": "program sequence_sum\n implicit none\n integer(8) :: n, num, tmp, a(0:100000) = 0\n integer :: x, m, b(0:100000) = 0, period, offset, rem, i\n read(*,*) n, x, m\n tmp = m\n if (n <= 2 * m) then\n num = x\n rem = int(n)\n do i = 2, rem\n x = mod(int(x, 8) * x, tmp)\n if (x == 0) exit\n num = num + x\n end do\n write(*,'(i0)') num\n stop\n end if\n a(1) = x\n b(x) = 1\n do i = 2, m + 1\n x = int(mod(int(x, 8) * x, tmp))\n a(i) = a(i - 1) + x\n if (b(x) > 0) then\n offset = b(x) - 1\n period = i - offset - 1\n exit\n end if\n b(x) = i\n end do\n num = (n - offset) / period\n rem = int(n - offset - num * period)\n write(*,'(i0)') (a(offset + period) - a(offset)) * num + a(offset + rem)\nend program sequence_sum", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "sample_input": "6 2 1001\n"}, "reference_outputs": ["1369\n"], "source_document_id": "p02550", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 761, "cpu_time_ms": 14, "memory_kb": 3528}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s702090710", "group_id": "codeNet:p02550", "input_text": "program sequence_sum\n implicit none\n integer(8) :: n, num, k, tmp, a(0:100000) = 0\n integer :: x, m, b(0:100000) = 0, period, offset, rem, i\n read(*,*) n, x, m\n tmp = m\n if (n <= 2 * m) then\n num = x\n do k = 2, n\n x = mod(int(x, 8) * x, tmp)\n if (x == 0) exit\n num = num + x\n end do\n write(*,'(i0)') num\n stop\n end if\n a(1) = x\n b(x) = 1\n do i = 2, m + 1\n x = mod(int(x, 8) * x, tmp)\n a(i) = a(i - 1) + x\n if (b(x) > 0) then\n offset = b(x) - 1\n period = i - offset - 1\n exit\n end if\n b(x) = i\n end do\n num = (n - offset) / period\n rem = int(n - offset - num * period)\n write(*,'(i0)') (a(offset + period) - a(offset)) * num + a(offset + rem)\nend program sequence_sum", "language": "Fortran", "metadata": {"date": 1600566343, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02550.html", "problem_id": "p02550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02550/input.txt", "sample_output_relpath": "derived/input_output/data/p02550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02550/Fortran/s702090710.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s702090710", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1369\n", "input_to_evaluate": "program sequence_sum\n implicit none\n integer(8) :: n, num, k, tmp, a(0:100000) = 0\n integer :: x, m, b(0:100000) = 0, period, offset, rem, i\n read(*,*) n, x, m\n tmp = m\n if (n <= 2 * m) then\n num = x\n do k = 2, n\n x = mod(int(x, 8) * x, tmp)\n if (x == 0) exit\n num = num + x\n end do\n write(*,'(i0)') num\n stop\n end if\n a(1) = x\n b(x) = 1\n do i = 2, m + 1\n x = mod(int(x, 8) * x, tmp)\n a(i) = a(i - 1) + x\n if (b(x) > 0) then\n offset = b(x) - 1\n period = i - offset - 1\n exit\n end if\n b(x) = i\n end do\n num = (n - offset) / period\n rem = int(n - offset - num * period)\n write(*,'(i0)') (a(offset + period) - a(offset)) * num + a(offset + rem)\nend program sequence_sum", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "sample_input": "6 2 1001\n"}, "reference_outputs": ["1369\n"], "source_document_id": "p02550", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet us denote by f(x, m) the remainder of the Euclidean division of x by m.\n\nLet A be the sequence that is defined by the initial value A_1=X and the recurrence relation A_{n+1} = f(A_n^2, M).\nFind \\displaystyle{\\sum_{i=1}^N A_i}.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\n0 \\leq X < M \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X M\n\nOutput\n\nPrint \\displaystyle{\\sum_{i=1}^N A_i}.\n\nSample Input 1\n\n6 2 1001\n\nSample Output 1\n\n1369\n\nThe sequence A begins 2,4,16,256,471,620,\\ldots Therefore, the answer is 2+4+16+256+471+620=1369.\n\nSample Input 2\n\n1000 2 16\n\nSample Output 2\n\n6\n\nThe sequence A begins 2,4,0,0,\\ldots Therefore, the answer is 6.\n\nSample Input 3\n\n10000000000 10 99959\n\nSample Output 3\n\n492443256176507", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 740, "cpu_time_ms": 5, "memory_kb": 3516}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s470720903", "group_id": "codeNet:p02550", "input_text": "module vector_int64_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: vec_to_array, vec_size\n type,public:: vector_int64\n integer(int64),allocatable:: array(:)\n integer(int64),private:: l=0\n contains\n procedure:: push_back=>vec_push_back, insert=>vec_insert\n procedure:: pop_back=>vec_pop_back, pop=>vec_pop, erase => vec_erase\n procedure:: at=>vec_at, back=>vec_back, head=>vec_head\n end type\ncontains\n function vec_size(vec) result(ret)\n type(vector_int64),intent(in):: vec\n integer(int64):: ret\n\n ret = vec%l\n end function\n\n\n subroutine check_array_allocation(vec)\n type(vector_int64),intent(inout):: vec\n\n if (.not. allocated(vec%array)) allocate(vec%array(1))\n end subroutine\n\n\n function vec_at(vec,i) result(ret)\n class(vector_int64),intent(inout):: vec\n integer(int64):: i,ret\n\n call check_array_allocation(vec)\n ret = vec%array(i)\n end function\n\n\n function vec_back(vec) result(ret)\n class(vector_int64),intent(inout):: vec\n integer(int64):: ret\n \n ret = vec%at(vec%l)\n end function\n\n\n function vec_head(vec) result(ret)\n class(vector_int64),intent(inout):: vec\n integer(int64):: ret\n \n ret = vec%at(1_8)\n end function\n\n\n subroutine vec_append_array(vec,l,r)\n type(vector_int64),intent(inout):: vec\n integer(int64),intent(in):: l,r\n integer(int64),allocatable:: tmp(:)\n \n allocate(tmp(l:2*r))\n tmp(l:r) = vec%array(l:r)\n call move_alloc(tmp, vec%array)\n end subroutine\n\n\n subroutine vec_reduce_array(vec,l,r)\n type(vector_int64),intent(inout):: vec\n integer(int64),intent(in):: l,r\n integer(int64),allocatable:: tmp(:)\n \n allocate(tmp(l:r/2))\n tmp(l:r/2) = vec%array(l:r/2)\n call move_alloc(tmp, vec%array)\n end subroutine\n\n\n subroutine check_allocation_size(vec)\n type(vector_int64),intent(inout):: vec\n integer(int64):: len_alloc\n\n call check_array_allocation(vec)\n len_alloc = size(vec%array)\n if (vec%l >= len_alloc) then\n call vec_append_array(vec,1_8,len_alloc)\n else if (vec%l <= len_alloc/2) then\n call vec_reduce_array(vec,1_8,len_alloc)\n end if\n end subroutine\n\n\n subroutine vec_push_back(vec, v)\n class(vector_int64),intent(inout):: vec\n integer(int64),intent(in):: v\n\n vec%l=vec%l+1\n call check_allocation_size(vec)\n vec%array(vec%l) = v\n end subroutine\n\n\n subroutine vec_insert(vec,i,v)\n class(vector_int64),intent(inout):: vec\n integer(int64),intent(in)::i, v\n\n vec%l=vec%l+1\n call check_allocation_size(vec)\n vec%array(i+1:vec%l+1) = vec%array(i:vec%l)\n vec%array(i) = v\n end subroutine\n\n\n function vec_pop_back(vec) result(ret)\n class(vector_int64),intent(inout):: vec\n integer(int64):: ret\n\n ret = vec%back()\n vec%l=vec%l-1\n call check_allocation_size(vec)\n end function\n\n\n function vec_pop(vec,i) result(ret)\n class(vector_int64),intent(inout):: vec\n integer(int64),intent(in):: i\n integer(int64):: ret\n\n ret = vec%at(i)\n vec%l=vec%l-1\n vec%array(i:vec%l) = vec%array(i+1:vec%l+1)\n call check_allocation_size(vec)\n end function\n\n\n subroutine vec_erase(vec,i)\n class(vector_int64):: vec\n integer(int64),intent(in):: i\n integer(int64):: dmp\n\n dmp = vec%pop(i)\n end subroutine\n\n\n function vec_to_array(vec) result(ret)\n type(vector_int64),intent(inout):: vec\n integer(int64):: ret(1:vec%l)\n\n call check_array_allocation(vec)\n ret = vec%array(1:vec%l)\n end function\nend module\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use vector_int64_mod\n implicit none\n integer(int64):: n,x,m\n integer(int64):: i,j,l,ln,tot=0,s=0,ans=0\n integer(int64), allocatable:: id(:)\n type(vector_int64):: a\n\n read*, n,x,m\n allocate(id(0:m),source=-1_8)\n\n j=1\n do while(id(x) == -1_8)\n call a%push_back(x)\n tot=tot+x\n id(x)=j\n x=mod(x*x,m)\n j=j+1\n end do\n l = j-id(x)\n do i=id(x),j-1\n s=s+a%at(i)\n end do\n \n if (nvec_push_back, insert=>vec_insert\n procedure:: pop_back=>vec_pop_back, pop=>vec_pop, erase => vec_erase\n procedure:: at=>vec_at, back=>vec_back, head=>vec_head\n end type\ncontains\n function vec_size(vec) result(ret)\n type(vector_int64),intent(in):: vec\n integer(int64):: ret\n\n ret = vec%l\n end function\n\n\n subroutine check_array_allocation(vec)\n type(vector_int64),intent(inout):: vec\n\n if (.not. allocated(vec%array)) allocate(vec%array(1))\n end subroutine\n\n\n function vec_at(vec,i) result(ret)\n class(vector_int64),intent(inout):: vec\n integer(int64):: i,ret\n\n call check_array_allocation(vec)\n ret = vec%array(i)\n end function\n\n\n function vec_back(vec) result(ret)\n class(vector_int64),intent(inout):: vec\n integer(int64):: ret\n \n ret = vec%at(vec%l)\n end function\n\n\n function vec_head(vec) result(ret)\n class(vector_int64),intent(inout):: vec\n integer(int64):: ret\n \n ret = vec%at(1_8)\n end function\n\n\n subroutine vec_append_array(vec,l,r)\n type(vector_int64),intent(inout):: vec\n integer(int64),intent(in):: l,r\n integer(int64),allocatable:: tmp(:)\n \n allocate(tmp(l:2*r))\n tmp(l:r) = vec%array(l:r)\n call move_alloc(tmp, vec%array)\n end subroutine\n\n\n subroutine vec_reduce_array(vec,l,r)\n type(vector_int64),intent(inout):: vec\n integer(int64),intent(in):: l,r\n integer(int64),allocatable:: tmp(:)\n \n allocate(tmp(l:r/2))\n tmp(l:r/2) = vec%array(l:r/2)\n call move_alloc(tmp, vec%array)\n end subroutine\n\n\n subroutine check_allocation_size(vec)\n type(vector_int64),intent(inout):: vec\n integer(int64):: len_alloc\n\n call check_array_allocation(vec)\n len_alloc = size(vec%array)\n if (vec%l >= len_alloc) then\n call vec_append_array(vec,1_8,len_alloc)\n else if (vec%l <= len_alloc/2) then\n call vec_reduce_array(vec,1_8,len_alloc)\n end if\n end subroutine\n\n\n subroutine vec_push_back(vec, v)\n class(vector_int64),intent(inout):: vec\n integer(int64),intent(in):: v\n\n vec%l=vec%l+1\n call check_allocation_size(vec)\n vec%array(vec%l) = v\n end subroutine\n\n\n subroutine vec_insert(vec,i,v)\n class(vector_int64),intent(inout):: vec\n integer(int64),intent(in)::i, v\n\n vec%l=vec%l+1\n call check_allocation_size(vec)\n vec%array(i+1:vec%l+1) = vec%array(i:vec%l)\n vec%array(i) = v\n end subroutine\n\n\n function vec_pop_back(vec) result(ret)\n class(vector_int64),intent(inout):: vec\n integer(int64):: ret\n\n ret = vec%back()\n vec%l=vec%l-1\n call check_allocation_size(vec)\n end function\n\n\n function vec_pop(vec,i) result(ret)\n class(vector_int64),intent(inout):: vec\n integer(int64),intent(in):: i\n integer(int64):: ret\n\n ret = vec%at(i)\n vec%l=vec%l-1\n vec%array(i:vec%l) = vec%array(i+1:vec%l+1)\n call check_allocation_size(vec)\n end function\n\n\n subroutine vec_erase(vec,i)\n class(vector_int64):: vec\n integer(int64),intent(in):: i\n integer(int64):: dmp\n\n dmp = vec%pop(i)\n end subroutine\n\n\n function vec_to_array(vec) result(ret)\n type(vector_int64),intent(inout):: vec\n integer(int64):: ret(1:vec%l)\n\n call check_array_allocation(vec)\n ret = vec%array(1:vec%l)\n end function\nend module\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use vector_int64_mod\n implicit none\n integer(int64):: n,x,m\n integer(int64):: i,j,l,ln,tot=0,s=0,ans=0\n integer(int64), allocatable:: id(:)\n type(vector_int64):: a\n\n read*, n,x,m\n allocate(id(0:m),source=-1_8)\n\n j=1\n do while(id(x) == -1_8)\n call a%push_back(x)\n tot=tot+x\n id(x)=j\n x=mod(x*x,m)\n j=j+1\n end do\n l = j-id(x)\n do i=id(x),j-1\n s=s+a%at(i)\n end do\n \n if (n=ans) then\n print *,\"Yes\"\n else\n print *,\"No\"\n end if\nend program donot_be_late", "language": "Fortran", "metadata": {"date": 1599136156, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02570.html", "problem_id": "p02570", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02570/input.txt", "sample_output_relpath": "derived/input_output/data/p02570/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02570/Fortran/s496555606.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s496555606", "user_id": "u273543964"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program donot_be_late\n implicit none\n integer d, t, s\n real ans\n\n read *, d, t, s\n\n ans=d/s\n if(t>=ans) then\n print *,\"Yes\"\n else\n print *,\"No\"\n end if\nend program donot_be_late", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\n\nWill he arrive in time?\n\nConstraints\n\n1 \\leq D \\leq 10000\n\n1 \\leq T \\leq 10000\n\n1 \\leq S \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD T S\n\nOutput\n\nIf Takahashi will reach the place in time, print Yes; otherwise, print No.\n\nSample Input 1\n\n1000 15 80\n\nSample Output 1\n\nYes\n\nIt takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.\n\nSample Input 2\n\n2000 20 100\n\nSample Output 2\n\nYes\n\nIt takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.\n\nSample Input 3\n\n10000 1 1\n\nSample Output 3\n\nNo\n\nHe will be late.", "sample_input": "1000 15 80\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02570", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\n\nWill he arrive in time?\n\nConstraints\n\n1 \\leq D \\leq 10000\n\n1 \\leq T \\leq 10000\n\n1 \\leq S \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD T S\n\nOutput\n\nIf Takahashi will reach the place in time, print Yes; otherwise, print No.\n\nSample Input 1\n\n1000 15 80\n\nSample Output 1\n\nYes\n\nIt takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.\n\nSample Input 2\n\n2000 20 100\n\nSample Output 2\n\nYes\n\nIt takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.\n\nSample Input 3\n\n10000 1 1\n\nSample Output 3\n\nNo\n\nHe will be late.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 215, "cpu_time_ms": 8, "memory_kb": 2860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s396217056", "group_id": "codeNet:p02570", "input_text": "program dont_be_late\n implicit none\n real d, t, s\n read *, d, t, s\n if(d/t <= s)then\n print *, 'Yes'\n else\n print *, 'No'\n end if\nend program", "language": "Fortran", "metadata": {"date": 1598873297, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02570.html", "problem_id": "p02570", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02570/input.txt", "sample_output_relpath": "derived/input_output/data/p02570/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02570/Fortran/s396217056.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s396217056", "user_id": "u622206408"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program dont_be_late\n implicit none\n real d, t, s\n read *, d, t, s\n if(d/t <= s)then\n print *, 'Yes'\n else\n print *, 'No'\n end if\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\n\nWill he arrive in time?\n\nConstraints\n\n1 \\leq D \\leq 10000\n\n1 \\leq T \\leq 10000\n\n1 \\leq S \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD T S\n\nOutput\n\nIf Takahashi will reach the place in time, print Yes; otherwise, print No.\n\nSample Input 1\n\n1000 15 80\n\nSample Output 1\n\nYes\n\nIt takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.\n\nSample Input 2\n\n2000 20 100\n\nSample Output 2\n\nYes\n\nIt takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.\n\nSample Input 3\n\n10000 1 1\n\nSample Output 3\n\nNo\n\nHe will be late.", "sample_input": "1000 15 80\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02570", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\n\nWill he arrive in time?\n\nConstraints\n\n1 \\leq D \\leq 10000\n\n1 \\leq T \\leq 10000\n\n1 \\leq S \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD T S\n\nOutput\n\nIf Takahashi will reach the place in time, print Yes; otherwise, print No.\n\nSample Input 1\n\n1000 15 80\n\nSample Output 1\n\nYes\n\nIt takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.\n\nSample Input 2\n\n2000 20 100\n\nSample Output 2\n\nYes\n\nIt takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.\n\nSample Input 3\n\n10000 1 1\n\nSample Output 3\n\nNo\n\nHe will be late.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 173, "cpu_time_ms": 15, "memory_kb": 2952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s040259201", "group_id": "codeNet:p02570", "input_text": "program dont_be_late\n implicit none\n real d, t, s\n read *, d, t, s\n if(d/s <= s)then\n print *, 'Yes'\n else\n print *, 'No'\n end if\nend program", "language": "Fortran", "metadata": {"date": 1598873054, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02570.html", "problem_id": "p02570", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02570/input.txt", "sample_output_relpath": "derived/input_output/data/p02570/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02570/Fortran/s040259201.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s040259201", "user_id": "u622206408"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program dont_be_late\n implicit none\n real d, t, s\n read *, d, t, s\n if(d/s <= s)then\n print *, 'Yes'\n else\n print *, 'No'\n end if\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\n\nWill he arrive in time?\n\nConstraints\n\n1 \\leq D \\leq 10000\n\n1 \\leq T \\leq 10000\n\n1 \\leq S \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD T S\n\nOutput\n\nIf Takahashi will reach the place in time, print Yes; otherwise, print No.\n\nSample Input 1\n\n1000 15 80\n\nSample Output 1\n\nYes\n\nIt takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.\n\nSample Input 2\n\n2000 20 100\n\nSample Output 2\n\nYes\n\nIt takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.\n\nSample Input 3\n\n10000 1 1\n\nSample Output 3\n\nNo\n\nHe will be late.", "sample_input": "1000 15 80\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02570", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\n\nWill he arrive in time?\n\nConstraints\n\n1 \\leq D \\leq 10000\n\n1 \\leq T \\leq 10000\n\n1 \\leq S \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD T S\n\nOutput\n\nIf Takahashi will reach the place in time, print Yes; otherwise, print No.\n\nSample Input 1\n\n1000 15 80\n\nSample Output 1\n\nYes\n\nIt takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.\n\nSample Input 2\n\n2000 20 100\n\nSample Output 2\n\nYes\n\nIt takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.\n\nSample Input 3\n\n10000 1 1\n\nSample Output 3\n\nNo\n\nHe will be late.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 173, "cpu_time_ms": 14, "memory_kb": 2980}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s467207437", "group_id": "codeNet:p02570", "input_text": "program a177\n\nimplicit none\ninteger(16) :: d, t, s, dist\n\nread *, d, t, s\n\ndist = s * t\n\nif(dist < d) then\n print *, 'No'\nelse\n print *, 'Yes'\nend if\n\nend program a177", "language": "Fortran", "metadata": {"date": 1598727712, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02570.html", "problem_id": "p02570", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02570/input.txt", "sample_output_relpath": "derived/input_output/data/p02570/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02570/Fortran/s467207437.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s467207437", "user_id": "u644436095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program a177\n\nimplicit none\ninteger(16) :: d, t, s, dist\n\nread *, d, t, s\n\ndist = s * t\n\nif(dist < d) then\n print *, 'No'\nelse\n print *, 'Yes'\nend if\n\nend program a177", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\n\nWill he arrive in time?\n\nConstraints\n\n1 \\leq D \\leq 10000\n\n1 \\leq T \\leq 10000\n\n1 \\leq S \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD T S\n\nOutput\n\nIf Takahashi will reach the place in time, print Yes; otherwise, print No.\n\nSample Input 1\n\n1000 15 80\n\nSample Output 1\n\nYes\n\nIt takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.\n\nSample Input 2\n\n2000 20 100\n\nSample Output 2\n\nYes\n\nIt takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.\n\nSample Input 3\n\n10000 1 1\n\nSample Output 3\n\nNo\n\nHe will be late.", "sample_input": "1000 15 80\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02570", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is meeting up with Aoki.\n\nThey have planned to meet at a place that is D meters away from Takahashi's house in T minutes from now.\n\nTakahashi will leave his house now and go straight to the place at a speed of S meters per minute.\n\nWill he arrive in time?\n\nConstraints\n\n1 \\leq D \\leq 10000\n\n1 \\leq T \\leq 10000\n\n1 \\leq S \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD T S\n\nOutput\n\nIf Takahashi will reach the place in time, print Yes; otherwise, print No.\n\nSample Input 1\n\n1000 15 80\n\nSample Output 1\n\nYes\n\nIt takes 12.5 minutes to go 1000 meters to the place at a speed of 80 meters per minute. They have planned to meet in 15 minutes so he will arrive in time.\n\nSample Input 2\n\n2000 20 100\n\nSample Output 2\n\nYes\n\nIt takes 20 minutes to go 2000 meters to the place at a speed of 100 meters per minute. They have planned to meet in 20 minutes so he will arrive just on time.\n\nSample Input 3\n\n10000 1 1\n\nSample Output 3\n\nNo\n\nHe will be late.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 167, "cpu_time_ms": 12, "memory_kb": 2792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s954078011", "group_id": "codeNet:p02571", "input_text": "program main\n implicit none\n character(len=1000) :: S,T\n integer :: len_S, len_T\n !\n integer :: i, j\n integer,allocatable :: counter(:)\n read(*,*) S\n read(*,*) T\n len_S = len(trim(S))\n len_T = len(trim(T))\n\n allocate(counter(len_S-len_T))\n counter = 0\n do i = 1, len_S-len_T\n do j = 0,len_T-1\n if (S(i+j:i+j) == T(j+1:j+1)) counter(i) = counter(i) + 1\n end do\n end do\n write(*,'(i0)') len_T- maxval(counter)\n stop\nend program main\n", "language": "Fortran", "metadata": {"date": 1598728188, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02571.html", "problem_id": "p02571", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02571/input.txt", "sample_output_relpath": "derived/input_output/data/p02571/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02571/Fortran/s954078011.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s954078011", "user_id": "u886432251"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n character(len=1000) :: S,T\n integer :: len_S, len_T\n !\n integer :: i, j\n integer,allocatable :: counter(:)\n read(*,*) S\n read(*,*) T\n len_S = len(trim(S))\n len_T = len(trim(T))\n\n allocate(counter(len_S-len_T))\n counter = 0\n do i = 1, len_S-len_T\n do j = 0,len_T-1\n if (S(i+j:i+j) == T(j+1:j+1)) counter(i) = counter(i) + 1\n end do\n end do\n write(*,'(i0)') len_T- maxval(counter)\n stop\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are two strings S and T.\n\nLet us change some of the characters in S so that T will be a substring of S.\n\nAt least how many characters do we need to change?\n\nHere, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.\n\nConstraints\n\nThe lengths of S and T are each at least 1 and at most 1000.\n\nThe length of T is at most that of S.\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the minimum number of characters in S that need to be changed.\n\nSample Input 1\n\ncabacc\nabc\n\nSample Output 1\n\n1\n\nFor example, changing the fourth character a in S to c will match the second through fourth characters in S to T.\n\nSince S itself does not have T as its substring, this number of changes - one - is the minimum needed.\n\nSample Input 2\n\ncodeforces\natcoder\n\nSample Output 2\n\n6", "sample_input": "cabacc\nabc\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02571", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are two strings S and T.\n\nLet us change some of the characters in S so that T will be a substring of S.\n\nAt least how many characters do we need to change?\n\nHere, a substring is a consecutive subsequence. For example, xxx is a substring of yxxxy, but not a substring of xxyxx.\n\nConstraints\n\nThe lengths of S and T are each at least 1 and at most 1000.\n\nThe length of T is at most that of S.\n\nS and T consist of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the minimum number of characters in S that need to be changed.\n\nSample Input 1\n\ncabacc\nabc\n\nSample Output 1\n\n1\n\nFor example, changing the fourth character a in S to c will match the second through fourth characters in S to T.\n\nSince S itself does not have T as its substring, this number of changes - one - is the minimum needed.\n\nSample Input 2\n\ncodeforces\natcoder\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 463, "cpu_time_ms": 5, "memory_kb": 2908}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s511549226", "group_id": "codeNet:p02575", "input_text": "module mod_skip_list\n implicit none\n integer, private, parameter :: key_kind = 4\n integer, private, parameter :: val_kind = 4\n real(8), private, parameter :: threshold = 0.5d0\n integer(key_kind), private, parameter :: infty = lshift(1_key_kind, 8 * key_kind - 2)\n type t_node\n private\n integer(key_kind) :: key\n integer(val_kind) :: val\n integer :: length = 0\n type(t_node), pointer :: prev => null(), next => null()\n type(t_node), pointer :: above => null(), below => null()\n end type\n type t_skip_list\n integer :: size = 0\n integer :: level = 0\n integer(val_kind) :: default = -1\n type(t_node), private, pointer :: head => null()\n type(t_node), private, pointer :: tail => null()\n contains\n procedure :: search => search\n procedure :: contains => contain\n procedure :: insert => insert\n procedure :: index_of => index_of\n procedure :: get_key_at => get_key_at\n procedure :: remove => remove\n procedure :: remove_key_at => remove_key_at\n procedure :: first_key => first_key\n procedure :: poll_first => poll_first\n procedure :: last_key => last_key\n procedure :: poll_last => poll_last\n procedure :: floor_key => floor_key\n procedure :: lower_key => lower_key\n procedure :: ceiling_key => ceiling_key\n procedure :: higher_key => higher_key\n final :: finalize\n end type\n interface skip_list\n module procedure :: newsl0, newsl1\n end interface\n private :: t_node, random_seed_clock, new_node, less, finalize, increase_level, search_node\ncontains\n subroutine random_seed_clock()\n integer :: nseed, clock\n integer, allocatable :: seed(:)\n call system_clock(clock)\n call random_seed(size = nseed)\n allocate(seed(nseed))\n seed = clock\n call random_seed(put = seed)\n deallocate(seed)\n end\n logical function flip_coin() result(res)\n real(8) :: rand\n call random_number(rand)\n res = rand < threshold\n end\n function new_node(key, val, length) result(res)\n integer(key_kind), intent(in) :: key\n integer(val_kind), intent(in) :: val\n integer, intent(in) :: length\n type(t_node), pointer :: res\n allocate(res)\n res%key = key\n res%val = val\n res%length = length\n end\n logical function less(key1, key2) result(res)\n integer(key_kind), intent(in) :: key1, key2\n res = key1 < key2\n end\n subroutine finalize(this)\n type(t_skip_list), intent(inout) :: this\n call clear(this)\n end\n subroutine clear(this)\n class(t_skip_list), intent(inout) :: this\n type(t_node), pointer :: node, next, above\n if (.not.associated(this%head)) return\n node => this%head\n do while (associated(node%below))\n node => node%below\n end do\n do while (associated(node))\n next => node%next\n do while (associated(node))\n above => node%above\n deallocate(node)\n node => above\n end do\n node => next\n end do\n this%head => null()\n this%tail => null()\n this%size = 0\n end\n type(t_skip_list) function newsl0() result(res)\n type(t_node), pointer :: head, tail\n call random_seed_clock()\n head => new_node(-infty, 0, 1)\n tail => new_node(infty, 0, infty)\n head%next => tail\n tail%next => head\n res%head => head\n res%tail => tail\n end\n type(t_skip_list) function newsl1(default) result(res)\n integer(key_kind), intent(in) :: default\n res = newsl0()\n res%default = default\n end\n subroutine increase_level(this, level)\n type(t_skip_list), intent(inout) :: this\n integer, intent(in) :: level\n type(t_node), pointer :: head, tail, habove, tabove\n integer :: i\n if (this%level >= level) return\n head => this%head\n tail => this%tail\n do i = 1, this%level\n head => head%above\n tail => tail%above\n end do\n do i = this%level + 1, level\n habove => new_node(-infty, 0, 1)\n head%above => habove\n habove%below => head\n tabove => new_node(infty, 0, infty)\n tail%above => tabove\n tabove%below => tail\n head => habove\n tail => tabove\n head%next => tail\n tail%prev => head\n end do\n this%level = level\n end\n function search_node(this, key) result(res)\n type(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: res\n res => this%head\n do while (associated(res%above))\n res => res%above\n end do\n do\n do while (.not.less(key, res%next%key))\n res => res%next\n end do\n if (.not.associated(res%below)) exit\n res => res%below\n end do\n end\n integer(val_kind) function search(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = merge(node%val, this%default, node%key == key)\n end\n logical function contain(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = node%key == key\n end\n subroutine insert(this, key, val)\n class(t_skip_list), intent(inout) :: this\n integer(key_kind), intent(in) :: key\n integer(val_kind), intent(in) :: val\n type(t_node), pointer :: node, prev, next, above\n integer :: i, level, length, prevlength\n prev => search_node(this, key)\n if (prev%key == key) then\n prev%val = val\n return\n end if\n this%size = this%size + 1\n node => new_node(key, val, 1)\n next => prev%next\n prev%next => node\n node%prev => prev\n node%next => next\n next%prev => node\n level = 0\n do while (flip_coin())\n level = level + 1\n end do\n call increase_level(this, level)\n prevlength = 1\n length = 1\n do i = 1, level\n do while (.not.associated(prev%above))\n prev => prev%prev\n prevlength = prevlength + prev%length\n end do\n prev => prev%above\n prev%length = prevlength\n do while (.not.associated(next%above))\n length = length + next%length\n next => next%next\n end do\n next => next%above\n above => new_node(key, val, length)\n above%below => node\n node%above => above\n node => above\n prev%next => node\n node%prev => prev\n node%next => next\n next%prev => node\n end do\n do i = level + 1, this%level\n do while (.not.associated(prev%above))\n prev => prev%prev\n end do\n prev => prev%above\n prev%length = prev%length + 1\n end do\n end\n integer function index_of(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n res = 0\n node => this%head\n do while (associated(node%above))\n node => node%above\n end do\n do\n do while (.not.less(key, node%next%key))\n res = res + node%length\n node => node%next\n end do\n if (node%key == key) exit\n if (.not.associated(node%below)) exit\n node => node%below\n end do\n if (node%key /= key) res = -(res + 1)\n end\n integer(key_kind) function get_key_at(this, idx) result(res)\n class(t_skip_list), intent(in) :: this\n integer, intent(in) :: idx\n integer :: length\n type(t_node), pointer :: node\n if (idx < 1) then\n res = -infty\n return\n end if\n if (idx > this%size) then\n res = infty\n return\n end if\n length = 0\n node => this%head\n do while (associated(node%above))\n node => node%above\n end do\n do\n do while (length + node%length <= idx)\n length = length + node%length\n node => node%next\n end do\n if (length == idx) exit\n if (.not.associated(node%below)) exit\n node => node%below\n end do\n res = node%key\n end\n subroutine remove(this, key)\n class(t_skip_list), intent(inout) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node, prev, next, above\n integer :: i, level\n node => search_node(this, key)\n if (node%key /= key) return\n this%size = this%size - 1\n level = 0\n prev => node%prev\n next => node%next\n prev%next => next\n next%prev => prev\n do\n above => node%above\n deallocate(node)\n node => above\n level = level + 1\n if (.not.associated(node)) exit\n do while (.not.associated(prev%above))\n prev => prev%prev\n end do\n prev => prev%above\n prev%length = prev%length + node%length - 1\n next => node%next\n prev%next => next\n next%prev => prev\n end do\n do i = level, this%level\n do while (.not.associated(prev%above))\n prev => prev%prev\n end do\n prev => prev%above\n prev%length = prev%length - 1\n end do\n end\n subroutine remove_key_at(this, idx)\n class(t_skip_list), intent(inout) :: this\n integer, intent(in) :: idx\n integer :: key\n if (idx < 1 .or. idx > this%size) return\n key = get_key_at(this, idx)\n call remove(this, key)\n end\n integer(key_kind) function first_key(this) result(res)\n class(t_skip_list), intent(in) :: this\n res = merge(-infty, this%head%next%key, this%size == 0)\n end\n integer(key_kind) function poll_first(this) result(res)\n class(t_skip_list), intent(inout) :: this\n type(t_node), pointer :: node\n res = merge(-infty, this%head%next%key, this%size == 0)\n if (this%size > 0) call remove(this, res)\n end\n integer(key_kind) function last_key(this) result(res)\n class(t_skip_list), intent(in) :: this\n res = merge(infty, this%tail%prev%key, this%size == 0)\n end\n integer(key_kind) function poll_last(this) result(res)\n class(t_skip_list), intent(inout) :: this\n res = merge(infty, this%tail%prev%key, this%size == 0)\n if (this%size > 0) call remove(this, res)\n end\n integer(key_kind) function floor_key(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = node%key\n end\n integer(key_kind) function lower_key(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = merge(node%prev%key, node%key, node%key == key)\n end\n integer(key_kind) function ceiling_key(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = merge(node%key, node%next%key, node%key == key)\n end\n integer(key_kind) function higher_key(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = node%next%key\n end\nend module mod_skip_list\nprogram i_hate_shortest_path_problem\n use mod_skip_list\n implicit none\n integer :: h, w, a, b, c, d, e, key, val, i\n type(t_skip_list) :: map, cnt\n map = skip_list()\n cnt = skip_list(0)\n read(*,*) h, w\n do i = 1, w\n call map%insert(i, i)\n end do\n call cnt%insert(0, w)\n do i = 1, h\n read(*,*) a, b\n key = map%ceiling_key(a)\n b = b + 1\n c = -1\n do while (key <= b)\n val = map%search(key)\n c = max(c, val)\n d = key - val\n e = cnt%search(d) - 1\n if (e == 0) then\n call cnt%remove(d)\n else\n call cnt%insert(d, e)\n end if\n call map%remove(key)\n key = map%ceiling_key(key)\n end do\n if (c > 0 .and. b <= w) then\n call map%insert(b, c)\n d = b - c\n call cnt%insert(d, cnt%search(d) + 1)\n end if\n write(*,'(i0)') merge(cnt%first_key() + i, -1, cnt%size > 0)\n end do\nend program i_hate_shortest_path_problem", "language": "Fortran", "metadata": {"date": 1598897445, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02575.html", "problem_id": "p02575", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02575/input.txt", "sample_output_relpath": "derived/input_output/data/p02575/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02575/Fortran/s511549226.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s511549226", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1\n3\n6\n-1\n", "input_to_evaluate": "module mod_skip_list\n implicit none\n integer, private, parameter :: key_kind = 4\n integer, private, parameter :: val_kind = 4\n real(8), private, parameter :: threshold = 0.5d0\n integer(key_kind), private, parameter :: infty = lshift(1_key_kind, 8 * key_kind - 2)\n type t_node\n private\n integer(key_kind) :: key\n integer(val_kind) :: val\n integer :: length = 0\n type(t_node), pointer :: prev => null(), next => null()\n type(t_node), pointer :: above => null(), below => null()\n end type\n type t_skip_list\n integer :: size = 0\n integer :: level = 0\n integer(val_kind) :: default = -1\n type(t_node), private, pointer :: head => null()\n type(t_node), private, pointer :: tail => null()\n contains\n procedure :: search => search\n procedure :: contains => contain\n procedure :: insert => insert\n procedure :: index_of => index_of\n procedure :: get_key_at => get_key_at\n procedure :: remove => remove\n procedure :: remove_key_at => remove_key_at\n procedure :: first_key => first_key\n procedure :: poll_first => poll_first\n procedure :: last_key => last_key\n procedure :: poll_last => poll_last\n procedure :: floor_key => floor_key\n procedure :: lower_key => lower_key\n procedure :: ceiling_key => ceiling_key\n procedure :: higher_key => higher_key\n final :: finalize\n end type\n interface skip_list\n module procedure :: newsl0, newsl1\n end interface\n private :: t_node, random_seed_clock, new_node, less, finalize, increase_level, search_node\ncontains\n subroutine random_seed_clock()\n integer :: nseed, clock\n integer, allocatable :: seed(:)\n call system_clock(clock)\n call random_seed(size = nseed)\n allocate(seed(nseed))\n seed = clock\n call random_seed(put = seed)\n deallocate(seed)\n end\n logical function flip_coin() result(res)\n real(8) :: rand\n call random_number(rand)\n res = rand < threshold\n end\n function new_node(key, val, length) result(res)\n integer(key_kind), intent(in) :: key\n integer(val_kind), intent(in) :: val\n integer, intent(in) :: length\n type(t_node), pointer :: res\n allocate(res)\n res%key = key\n res%val = val\n res%length = length\n end\n logical function less(key1, key2) result(res)\n integer(key_kind), intent(in) :: key1, key2\n res = key1 < key2\n end\n subroutine finalize(this)\n type(t_skip_list), intent(inout) :: this\n call clear(this)\n end\n subroutine clear(this)\n class(t_skip_list), intent(inout) :: this\n type(t_node), pointer :: node, next, above\n if (.not.associated(this%head)) return\n node => this%head\n do while (associated(node%below))\n node => node%below\n end do\n do while (associated(node))\n next => node%next\n do while (associated(node))\n above => node%above\n deallocate(node)\n node => above\n end do\n node => next\n end do\n this%head => null()\n this%tail => null()\n this%size = 0\n end\n type(t_skip_list) function newsl0() result(res)\n type(t_node), pointer :: head, tail\n call random_seed_clock()\n head => new_node(-infty, 0, 1)\n tail => new_node(infty, 0, infty)\n head%next => tail\n tail%next => head\n res%head => head\n res%tail => tail\n end\n type(t_skip_list) function newsl1(default) result(res)\n integer(key_kind), intent(in) :: default\n res = newsl0()\n res%default = default\n end\n subroutine increase_level(this, level)\n type(t_skip_list), intent(inout) :: this\n integer, intent(in) :: level\n type(t_node), pointer :: head, tail, habove, tabove\n integer :: i\n if (this%level >= level) return\n head => this%head\n tail => this%tail\n do i = 1, this%level\n head => head%above\n tail => tail%above\n end do\n do i = this%level + 1, level\n habove => new_node(-infty, 0, 1)\n head%above => habove\n habove%below => head\n tabove => new_node(infty, 0, infty)\n tail%above => tabove\n tabove%below => tail\n head => habove\n tail => tabove\n head%next => tail\n tail%prev => head\n end do\n this%level = level\n end\n function search_node(this, key) result(res)\n type(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: res\n res => this%head\n do while (associated(res%above))\n res => res%above\n end do\n do\n do while (.not.less(key, res%next%key))\n res => res%next\n end do\n if (.not.associated(res%below)) exit\n res => res%below\n end do\n end\n integer(val_kind) function search(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = merge(node%val, this%default, node%key == key)\n end\n logical function contain(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = node%key == key\n end\n subroutine insert(this, key, val)\n class(t_skip_list), intent(inout) :: this\n integer(key_kind), intent(in) :: key\n integer(val_kind), intent(in) :: val\n type(t_node), pointer :: node, prev, next, above\n integer :: i, level, length, prevlength\n prev => search_node(this, key)\n if (prev%key == key) then\n prev%val = val\n return\n end if\n this%size = this%size + 1\n node => new_node(key, val, 1)\n next => prev%next\n prev%next => node\n node%prev => prev\n node%next => next\n next%prev => node\n level = 0\n do while (flip_coin())\n level = level + 1\n end do\n call increase_level(this, level)\n prevlength = 1\n length = 1\n do i = 1, level\n do while (.not.associated(prev%above))\n prev => prev%prev\n prevlength = prevlength + prev%length\n end do\n prev => prev%above\n prev%length = prevlength\n do while (.not.associated(next%above))\n length = length + next%length\n next => next%next\n end do\n next => next%above\n above => new_node(key, val, length)\n above%below => node\n node%above => above\n node => above\n prev%next => node\n node%prev => prev\n node%next => next\n next%prev => node\n end do\n do i = level + 1, this%level\n do while (.not.associated(prev%above))\n prev => prev%prev\n end do\n prev => prev%above\n prev%length = prev%length + 1\n end do\n end\n integer function index_of(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n res = 0\n node => this%head\n do while (associated(node%above))\n node => node%above\n end do\n do\n do while (.not.less(key, node%next%key))\n res = res + node%length\n node => node%next\n end do\n if (node%key == key) exit\n if (.not.associated(node%below)) exit\n node => node%below\n end do\n if (node%key /= key) res = -(res + 1)\n end\n integer(key_kind) function get_key_at(this, idx) result(res)\n class(t_skip_list), intent(in) :: this\n integer, intent(in) :: idx\n integer :: length\n type(t_node), pointer :: node\n if (idx < 1) then\n res = -infty\n return\n end if\n if (idx > this%size) then\n res = infty\n return\n end if\n length = 0\n node => this%head\n do while (associated(node%above))\n node => node%above\n end do\n do\n do while (length + node%length <= idx)\n length = length + node%length\n node => node%next\n end do\n if (length == idx) exit\n if (.not.associated(node%below)) exit\n node => node%below\n end do\n res = node%key\n end\n subroutine remove(this, key)\n class(t_skip_list), intent(inout) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node, prev, next, above\n integer :: i, level\n node => search_node(this, key)\n if (node%key /= key) return\n this%size = this%size - 1\n level = 0\n prev => node%prev\n next => node%next\n prev%next => next\n next%prev => prev\n do\n above => node%above\n deallocate(node)\n node => above\n level = level + 1\n if (.not.associated(node)) exit\n do while (.not.associated(prev%above))\n prev => prev%prev\n end do\n prev => prev%above\n prev%length = prev%length + node%length - 1\n next => node%next\n prev%next => next\n next%prev => prev\n end do\n do i = level, this%level\n do while (.not.associated(prev%above))\n prev => prev%prev\n end do\n prev => prev%above\n prev%length = prev%length - 1\n end do\n end\n subroutine remove_key_at(this, idx)\n class(t_skip_list), intent(inout) :: this\n integer, intent(in) :: idx\n integer :: key\n if (idx < 1 .or. idx > this%size) return\n key = get_key_at(this, idx)\n call remove(this, key)\n end\n integer(key_kind) function first_key(this) result(res)\n class(t_skip_list), intent(in) :: this\n res = merge(-infty, this%head%next%key, this%size == 0)\n end\n integer(key_kind) function poll_first(this) result(res)\n class(t_skip_list), intent(inout) :: this\n type(t_node), pointer :: node\n res = merge(-infty, this%head%next%key, this%size == 0)\n if (this%size > 0) call remove(this, res)\n end\n integer(key_kind) function last_key(this) result(res)\n class(t_skip_list), intent(in) :: this\n res = merge(infty, this%tail%prev%key, this%size == 0)\n end\n integer(key_kind) function poll_last(this) result(res)\n class(t_skip_list), intent(inout) :: this\n res = merge(infty, this%tail%prev%key, this%size == 0)\n if (this%size > 0) call remove(this, res)\n end\n integer(key_kind) function floor_key(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = node%key\n end\n integer(key_kind) function lower_key(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = merge(node%prev%key, node%key, node%key == key)\n end\n integer(key_kind) function ceiling_key(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = merge(node%key, node%next%key, node%key == key)\n end\n integer(key_kind) function higher_key(this, key) result(res)\n class(t_skip_list), intent(in) :: this\n integer(key_kind), intent(in) :: key\n type(t_node), pointer :: node\n node => search_node(this, key)\n res = node%next%key\n end\nend module mod_skip_list\nprogram i_hate_shortest_path_problem\n use mod_skip_list\n implicit none\n integer :: h, w, a, b, c, d, e, key, val, i\n type(t_skip_list) :: map, cnt\n map = skip_list()\n cnt = skip_list(0)\n read(*,*) h, w\n do i = 1, w\n call map%insert(i, i)\n end do\n call cnt%insert(0, w)\n do i = 1, h\n read(*,*) a, b\n key = map%ceiling_key(a)\n b = b + 1\n c = -1\n do while (key <= b)\n val = map%search(key)\n c = max(c, val)\n d = key - val\n e = cnt%search(d) - 1\n if (e == 0) then\n call cnt%remove(d)\n else\n call cnt%insert(d, e)\n end if\n call map%remove(key)\n key = map%ceiling_key(key)\n end do\n if (c > 0 .and. b <= w) then\n call map%insert(b, c)\n d = b - c\n call cnt%insert(d, cnt%search(d) + 1)\n end if\n write(*,'(i0)') merge(cnt%first_key() + i, -1, cnt%size > 0)\n end do\nend program i_hate_shortest_path_problem", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere is a grid of squares with H+1 horizontal rows and W vertical columns.\n\nYou will start at one of the squares in the top row and repeat moving one square right or down. However, for each integer i from 1 through H, you cannot move down from the A_i-th, (A_i + 1)-th, \\ldots, B_i-th squares from the left in the i-th row from the top.\n\nFor each integer k from 1 through H, find the minimum number of moves needed to reach one of the squares in the (k+1)-th row from the top. (The starting square can be chosen individually for each case.) If, starting from any square in the top row, none of the squares in the (k+1)-th row can be reached, print -1 instead.\n\nConstraints\n\n1 \\leq H,W \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq B_i \\leq W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nA_1 B_1\nA_2 B_2\n:\nA_H B_H\n\nOutput\n\nPrint H lines. The i-th line should contain the answer for the case k=i.\n\nSample Input 1\n\n4 4\n2 4\n1 1\n2 3\n2 4\n\nSample Output 1\n\n1\n3\n6\n-1\n\nLet (i,j) denote the square at the i-th row from the top and j-th column from the left.\n\nFor k=1, we need one move such as (1,1) → (2,1).\n\nFor k=2, we need three moves such as (1,1) → (2,1) → (2,2) → (3,2).\n\nFor k=3, we need six moves such as (1,1) → (2,1) → (2,2) → (3,2) → (3,3) → (3,4) → (4,4).\n\nFor k=4, it is impossible to reach any square in the fifth row from the top.", "sample_input": "4 4\n2 4\n1 1\n2 3\n2 4\n"}, "reference_outputs": ["1\n3\n6\n-1\n"], "source_document_id": "p02575", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere is a grid of squares with H+1 horizontal rows and W vertical columns.\n\nYou will start at one of the squares in the top row and repeat moving one square right or down. However, for each integer i from 1 through H, you cannot move down from the A_i-th, (A_i + 1)-th, \\ldots, B_i-th squares from the left in the i-th row from the top.\n\nFor each integer k from 1 through H, find the minimum number of moves needed to reach one of the squares in the (k+1)-th row from the top. (The starting square can be chosen individually for each case.) If, starting from any square in the top row, none of the squares in the (k+1)-th row can be reached, print -1 instead.\n\nConstraints\n\n1 \\leq H,W \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq B_i \\leq W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nA_1 B_1\nA_2 B_2\n:\nA_H B_H\n\nOutput\n\nPrint H lines. The i-th line should contain the answer for the case k=i.\n\nSample Input 1\n\n4 4\n2 4\n1 1\n2 3\n2 4\n\nSample Output 1\n\n1\n3\n6\n-1\n\nLet (i,j) denote the square at the i-th row from the top and j-th column from the left.\n\nFor k=1, we need one move such as (1,1) → (2,1).\n\nFor k=2, we need three moves such as (1,1) → (2,1) → (2,2) → (3,2).\n\nFor k=3, we need six moves such as (1,1) → (2,1) → (2,2) → (3,2) → (3,3) → (3,4) → (4,4).\n\nFor k=4, it is impossible to reach any square in the fifth row from the top.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 11771, "cpu_time_ms": 456, "memory_kb": 27880}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s595241733", "group_id": "codeNet:p02577", "input_text": "program B176\nimplicit none\ncharacter(200000) :: N\ninteger(8) :: sum = 0\ninteger(8) :: len\ninteger(8) :: i\ninteger(8) :: num\nread(5,*) N\nlen=len_trim(N)\n\ndo i = 1,len\n\t\n read(N(i:i),*)num\n\tsum = sum + num\nend do\n\nif (mod(sum,9)==0) then\n\twrite(6,*) \"Yes\"\nelse\n\twrite(6,*) \"No\"\nendif\n\n\nend program B176\n", "language": "Fortran", "metadata": {"date": 1598132280, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02577.html", "problem_id": "p02577", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02577/input.txt", "sample_output_relpath": "derived/input_output/data/p02577/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02577/Fortran/s595241733.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s595241733", "user_id": "u859396346"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program B176\nimplicit none\ncharacter(200000) :: N\ninteger(8) :: sum = 0\ninteger(8) :: len\ninteger(8) :: i\ninteger(8) :: num\nread(5,*) N\nlen=len_trim(N)\n\ndo i = 1,len\n\t\n read(N(i:i),*)num\n\tsum = sum + num\nend do\n\nif (mod(sum,9)==0) then\n\twrite(6,*) \"Yes\"\nelse\n\twrite(6,*) \"No\"\nendif\n\n\nend program B176\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAn integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.\n\nDetermine whether N is a multiple of 9.\n\nConstraints\n\n0 \\leq N < 10^{200000}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N is a multiple of 9, print Yes; otherwise, print No.\n\nSample Input 1\n\n123456789\n\nSample Output 1\n\nYes\n\nThe sum of these digits is 1+2+3+4+5+6+7+8+9=45, which is a multiple of 9, so 123456789 is a multiple of 9.\n\nSample Input 2\n\n0\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n31415926535897932384626433832795028841971693993751058209749445923078164062862089986280\n\nSample Output 3\n\nNo", "sample_input": "123456789\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02577", "source_text": "Score : 200 points\n\nProblem Statement\n\nAn integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.\n\nDetermine whether N is a multiple of 9.\n\nConstraints\n\n0 \\leq N < 10^{200000}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N is a multiple of 9, print Yes; otherwise, print No.\n\nSample Input 1\n\n123456789\n\nSample Output 1\n\nYes\n\nThe sum of these digits is 1+2+3+4+5+6+7+8+9=45, which is a multiple of 9, so 123456789 is a multiple of 9.\n\nSample Input 2\n\n0\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n31415926535897932384626433832795028841971693993751058209749445923078164062862089986280\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 304, "cpu_time_ms": 80, "memory_kb": 3284}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s170315273", "group_id": "codeNet:p02577", "input_text": "program B176\nimplicit none\ncharacter(200000) :: N\n\n\nread(5,*) N\n\nwrite(6,*) N\n\n\n\n\nend program B176", "language": "Fortran", "metadata": {"date": 1598131552, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02577.html", "problem_id": "p02577", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02577/input.txt", "sample_output_relpath": "derived/input_output/data/p02577/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02577/Fortran/s170315273.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s170315273", "user_id": "u952194205"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program B176\nimplicit none\ncharacter(200000) :: N\n\n\nread(5,*) N\n\nwrite(6,*) N\n\n\n\n\nend program B176", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAn integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.\n\nDetermine whether N is a multiple of 9.\n\nConstraints\n\n0 \\leq N < 10^{200000}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N is a multiple of 9, print Yes; otherwise, print No.\n\nSample Input 1\n\n123456789\n\nSample Output 1\n\nYes\n\nThe sum of these digits is 1+2+3+4+5+6+7+8+9=45, which is a multiple of 9, so 123456789 is a multiple of 9.\n\nSample Input 2\n\n0\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n31415926535897932384626433832795028841971693993751058209749445923078164062862089986280\n\nSample Output 3\n\nNo", "sample_input": "123456789\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02577", "source_text": "Score : 200 points\n\nProblem Statement\n\nAn integer N is a multiple of 9 if and only if the sum of the digits in the decimal representation of N is a multiple of 9.\n\nDetermine whether N is a multiple of 9.\n\nConstraints\n\n0 \\leq N < 10^{200000}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N is a multiple of 9, print Yes; otherwise, print No.\n\nSample Input 1\n\n123456789\n\nSample Output 1\n\nYes\n\nThe sum of these digits is 1+2+3+4+5+6+7+8+9=45, which is a multiple of 9, so 123456789 is a multiple of 9.\n\nSample Input 2\n\n0\n\nSample Output 2\n\nYes\n\nSample Input 3\n\n31415926535897932384626433832795028841971693993751058209749445923078164062862089986280\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 98, "cpu_time_ms": 20, "memory_kb": 3260}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s231550648", "group_id": "codeNet:p02578", "input_text": "program step\n implicit none\n integer(8) n, i\n integer(8) :: dai = 0\n integer,allocatable :: a(:)\n read *, n\n allocate(a(n))\n read *, a(:n)\n do i = 2, n\n if(a(i) .lt. a(i-1))then\n dai = dai+(a(i-1)-a(i))\n a(i) = a(i) + (a(i-1)-a(i))\n end if\n end do\n print *, dai\nend program", "language": "Fortran", "metadata": {"date": 1598448661, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02578.html", "problem_id": "p02578", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02578/input.txt", "sample_output_relpath": "derived/input_output/data/p02578/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02578/Fortran/s231550648.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s231550648", "user_id": "u622206408"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program step\n implicit none\n integer(8) n, i\n integer(8) :: dai = 0\n integer,allocatable :: a(:)\n read *, n\n allocate(a(n))\n read *, a(:n)\n do i = 2, n\n if(a(i) .lt. a(i-1))then\n dai = dai+(a(i-1)-a(i))\n a(i) = a(i) + (a(i-1)-a(i))\n end if\n end do\n print *, dai\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nN persons are standing in a row. The height of the i-th person from the front is A_i.\n\nWe want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:\n\nCondition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool.\n\nFind the minimum total height of the stools needed to meet this goal.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum total height of the stools needed to meet the goal.\n\nSample Input 1\n\n5\n2 1 5 4 3\n\nSample Output 1\n\n4\n\nIf the persons stand on stools of heights 0, 1, 0, 1, and 2, respectively, their heights will be 2, 2, 5, 5, and 5, satisfying the condition.\n\nWe cannot meet the goal with a smaller total height of the stools.\n\nSample Input 2\n\n5\n3 3 3 3 3\n\nSample Output 2\n\n0\n\nGiving a stool of height 0 to everyone will work.", "sample_input": "5\n2 1 5 4 3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02578", "source_text": "Score : 300 points\n\nProblem Statement\n\nN persons are standing in a row. The height of the i-th person from the front is A_i.\n\nWe want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:\n\nCondition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool.\n\nFind the minimum total height of the stools needed to meet this goal.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum total height of the stools needed to meet the goal.\n\nSample Input 1\n\n5\n2 1 5 4 3\n\nSample Output 1\n\n4\n\nIf the persons stand on stools of heights 0, 1, 0, 1, and 2, respectively, their heights will be 2, 2, 5, 5, and 5, satisfying the condition.\n\nWe cannot meet the goal with a smaller total height of the stools.\n\nSample Input 2\n\n5\n3 3 3 3 3\n\nSample Output 2\n\n0\n\nGiving a stool of height 0 to everyone will work.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 339, "cpu_time_ms": 62, "memory_kb": 3948}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s370635496", "group_id": "codeNet:p02578", "input_text": "program abc44\n implicit none\n integer(8)::N,ia,ib,ans=0,r\n integer(8),allocatable::A(:)\n read(*,*)N\n allocate(A(N))\n read(*,*)(A(ia),ia=1,N)\n r=A(1)\n do ib=2,N\n if(r>A(ib))then\n ans=ans+r-A(ib)\n else\n r=A(ib)\n end if\n end do\n print'(i0)',ans\n deallocate(A)\nend program abc44", "language": "Fortran", "metadata": {"date": 1598177777, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02578.html", "problem_id": "p02578", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02578/input.txt", "sample_output_relpath": "derived/input_output/data/p02578/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02578/Fortran/s370635496.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s370635496", "user_id": "u897889420"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program abc44\n implicit none\n integer(8)::N,ia,ib,ans=0,r\n integer(8),allocatable::A(:)\n read(*,*)N\n allocate(A(N))\n read(*,*)(A(ia),ia=1,N)\n r=A(1)\n do ib=2,N\n if(r>A(ib))then\n ans=ans+r-A(ib)\n else\n r=A(ib)\n end if\n end do\n print'(i0)',ans\n deallocate(A)\nend program abc44", "problem_context": "Score : 300 points\n\nProblem Statement\n\nN persons are standing in a row. The height of the i-th person from the front is A_i.\n\nWe want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:\n\nCondition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool.\n\nFind the minimum total height of the stools needed to meet this goal.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum total height of the stools needed to meet the goal.\n\nSample Input 1\n\n5\n2 1 5 4 3\n\nSample Output 1\n\n4\n\nIf the persons stand on stools of heights 0, 1, 0, 1, and 2, respectively, their heights will be 2, 2, 5, 5, and 5, satisfying the condition.\n\nWe cannot meet the goal with a smaller total height of the stools.\n\nSample Input 2\n\n5\n3 3 3 3 3\n\nSample Output 2\n\n0\n\nGiving a stool of height 0 to everyone will work.", "sample_input": "5\n2 1 5 4 3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02578", "source_text": "Score : 300 points\n\nProblem Statement\n\nN persons are standing in a row. The height of the i-th person from the front is A_i.\n\nWe want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:\n\nCondition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool.\n\nFind the minimum total height of the stools needed to meet this goal.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum total height of the stools needed to meet the goal.\n\nSample Input 1\n\n5\n2 1 5 4 3\n\nSample Output 1\n\n4\n\nIf the persons stand on stools of heights 0, 1, 0, 1, and 2, respectively, their heights will be 2, 2, 5, 5, and 5, satisfying the condition.\n\nWe cannot meet the goal with a smaller total height of the stools.\n\nSample Input 2\n\n5\n3 3 3 3 3\n\nSample Output 2\n\n0\n\nGiving a stool of height 0 to everyone will work.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 281, "cpu_time_ms": 65, "memory_kb": 4596}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s013385180", "group_id": "codeNet:p02578", "input_text": "program c176\n \nimplicit none\ninteger :: n, i, m, x\ninteger, allocatable :: a(:)\n \nread *, n\n \nif(n == 1) then\n print *, 0\n stop\nend if\n \nallocate(a(1:n))\n \nx = 0\n \nread *, a(:)\n \ndo i = 1, n-1\n m = a(i) - a(i+1) \n if(m <= 0) then\n x = x\n Print *, m ,x\n else\n x = x + m\n a(i+1) = a(i+1) + m\n Print *, m ,x\n end if\nend do\n \n \nprint *, a(:)\nprint *, x\n \nend program c176", "language": "Fortran", "metadata": {"date": 1598127613, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02578.html", "problem_id": "p02578", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02578/input.txt", "sample_output_relpath": "derived/input_output/data/p02578/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02578/Fortran/s013385180.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s013385180", "user_id": "u644436095"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program c176\n \nimplicit none\ninteger :: n, i, m, x\ninteger, allocatable :: a(:)\n \nread *, n\n \nif(n == 1) then\n print *, 0\n stop\nend if\n \nallocate(a(1:n))\n \nx = 0\n \nread *, a(:)\n \ndo i = 1, n-1\n m = a(i) - a(i+1) \n if(m <= 0) then\n x = x\n Print *, m ,x\n else\n x = x + m\n a(i+1) = a(i+1) + m\n Print *, m ,x\n end if\nend do\n \n \nprint *, a(:)\nprint *, x\n \nend program c176", "problem_context": "Score : 300 points\n\nProblem Statement\n\nN persons are standing in a row. The height of the i-th person from the front is A_i.\n\nWe want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:\n\nCondition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool.\n\nFind the minimum total height of the stools needed to meet this goal.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum total height of the stools needed to meet the goal.\n\nSample Input 1\n\n5\n2 1 5 4 3\n\nSample Output 1\n\n4\n\nIf the persons stand on stools of heights 0, 1, 0, 1, and 2, respectively, their heights will be 2, 2, 5, 5, and 5, satisfying the condition.\n\nWe cannot meet the goal with a smaller total height of the stools.\n\nSample Input 2\n\n5\n3 3 3 3 3\n\nSample Output 2\n\n0\n\nGiving a stool of height 0 to everyone will work.", "sample_input": "5\n2 1 5 4 3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02578", "source_text": "Score : 300 points\n\nProblem Statement\n\nN persons are standing in a row. The height of the i-th person from the front is A_i.\n\nWe want to have each person stand on a stool of some heights - at least zero - so that the following condition is satisfied for every person:\n\nCondition: Nobody in front of the person is taller than the person. Here, the height of a person includes the stool.\n\nFind the minimum total height of the stools needed to meet this goal.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum total height of the stools needed to meet the goal.\n\nSample Input 1\n\n5\n2 1 5 4 3\n\nSample Output 1\n\n4\n\nIf the persons stand on stools of heights 0, 1, 0, 1, and 2, respectively, their heights will be 2, 2, 5, 5, and 5, satisfying the condition.\n\nWe cannot meet the goal with a smaller total height of the stools.\n\nSample Input 2\n\n5\n3 3 3 3 3\n\nSample Output 2\n\n0\n\nGiving a stool of height 0 to everyone will work.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 370, "cpu_time_ms": 274, "memory_kb": 9700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s791369940", "group_id": "codeNet:p02579", "input_text": "module deque_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n type deque\n integer(int32),pointer:: v(:)\n integer(int32):: l,r\n integer(int32):: lmax, rmax\n contains\n procedure:: append => dq_append\n procedure:: appendleft => dq_appendleft\n procedure:: pop => dq_pop\n procedure:: popleft => dq_popleft\n procedure:: right => dq_right\n procedure:: left => dq_left\n procedure:: remaining_elements => dq_remaining_elements\n procedure:: remain => dq_remain\n end type\n\n interface deque\n procedure:: dq_init\n end interface\ncontains\n function dq_init() result(dq)\n ! 初期化\n type(deque):: dq\n dq%r=0; dq%rmax=1\n dq%l=1; dq%lmax=-1\n allocate(dq%v(dq%lmax:dq%rmax))\n end function\n\n\n subroutine dq_append(dq,num)\n ! 右端に挿入\n class(deque):: dq\n integer(int32):: num\n if (dq%r+1 > dq%rmax) call dq_add_(dq)\n dq%r=dq%r+1\n dq%v(dq%r) = num\n end subroutine\n\n subroutine dq_appendleft(dq,num)\n ! 左端に挿入\n class(deque):: dq\n integer(int32):: num\n if (dq%l-1 < dq%lmax) call dq_add_(dq)\n dq%l=dq%l-1\n dq%v(dq%l) = num\n end subroutine\n\n subroutine dq_add_(dq)\n ! arrayの延長\n class(deque):: dq\n integer(int32):: l\n integer(int32),pointer:: tmp(:)\n l = size(dq%v)\n allocate(tmp(l))\n tmp(:) = dq%v(:)\n deallocate(dq%v)\n allocate(dq%v(2*dq%lmax:2*dq%rmax))\n dq%v(dq%lmax:dq%rmax) = tmp(:)\n dq%lmax = 2*dq%lmax\n dq%rmax = 2*dq%rmax\n end subroutine\n\n\n function dq_pop(dq) result(ret)\n ! 右端から取り出し\n class(deque):: dq\n integer(int32):: ret\n ret = dq%v(dq%r)\n dq%r=dq%r-1\n end function\n\n function dq_popleft(dq) result(ret)\n ! 左端から取り出し\n class(deque):: dq\n integer(int32):: ret\n ret = dq%v(dq%l)\n dq%l=dq%l+1\n end function\n\n\n function dq_right(dq) result(ret)\n ! 右端を確認\n class(deque):: dq\n integer(int32):: ret\n ret = dq%v(dq%r)\n end function\n\n function dq_left(dq) result(ret)\n ! 左端を確認\n class(deque):: dq\n integer(int32):: ret\n ret = dq%v(dq%l)\n end function\n\n function dq_remaining_elements(dq) result(ret)\n ! 残りの要素数\n class(deque):: dq\n integer(int32):: ret \n ret = dq%r - dq%l + 1\n end function\n\n function dq_remain(dq) result(ret)\n ! 要素が残っているかどうか\n class(deque):: dq\n logical:: ret\n ret = dq%remaining_elements() > 0\n end function\nend module\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use deque_mod\n implicit none\n integer(int32):: h,w,sx,sy,gx,gy,i,j,x,y,dx,dy,nx,ny\n integer(int32),allocatable:: nm(:,:)\n character(1),allocatable:: s(:,:)\n logical,allocatable:: passed(:,:)\n type(deque):: tx, ty\n\n tx = deque()\n ty = deque()\n read*, h,w\n read*, sy,sx\n read*, gy,gx\n\n allocate(nm(w,h), source=1000000000)\n allocate(s(w,h))\n allocate(passed(w,h),source=.false.)\n \n do y=1,h\n block; character(w):: inpt_s\n read*, inpt_s\n do x=1,w\n s(x,y) = inpt_s(x:x)\n end do\n end block\n end do\n\n call tx%append(sx)\n call ty%append(sy)\n nm(sx,sy) = 0\n\n do while(tx%remain())\n x = tx%popleft()\n y = ty%popleft()\n ! print'(*(i0,1x))', x,y\n passed(x,y) = .true.\n ! do i=1,h\n ! print'(*(i0,1x))', nm(:,i)\n ! end do\n\n do dy = -1,1\n do dx = -1,1\n if (dx==0 .and. dy==0) cycle\n if (dx /= 0 .and. dy /= 0) cycle\n nx = x+dx; ny = y+dy\n if (.not. in_s(nx,ny)) cycle\n if (s(nx,ny) == \"#\") cycle\n if (nm(nx,ny) > nm(x,y)) then\n ! print'(*(i0,1x))', nx,ny\n nm(nx,ny) = nm(x,y)\n call tx%append(nx)\n call ty%append(ny)\n end if\n end do\n end do\n\n ! do i=1,h\n ! print'(*(i0,1x))', nm(:,i)\n ! end do\n\n do dy=-2,2\n do dx=-2,2\n nx = dx+x; ny=dy+y\n if (.not. in_s(nx,ny)) cycle\n if (s(nx, ny) == \"#\") cycle\n if (nm(nx,ny) > nm(x,y)+1) then\n ! print'(*(i0,1x))', nx,ny\n nm(nx,ny) = nm(x,y)+1\n call tx%append(nx)\n call ty%append(ny)\n end if\n end do\n end do\n end do\n if (nm(gx,gy) == 1000000000) then\n print'(i0)', -1\n stop\n end if\n print'(i0)', nm(gx,gy)\ncontains\n function in_s(x,y) result(ret)\n integer(int32):: x,y\n logical:: ret\n\n ret = 1 <= x .and. x <= w\n ret = ret .and. (1 <= y .and. y <= h)\n end function\nend program main", "language": "Fortran", "metadata": {"date": 1598127098, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02579.html", "problem_id": "p02579", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02579/input.txt", "sample_output_relpath": "derived/input_output/data/p02579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02579/Fortran/s791369940.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s791369940", "user_id": "u234636620"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module deque_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n type deque\n integer(int32),pointer:: v(:)\n integer(int32):: l,r\n integer(int32):: lmax, rmax\n contains\n procedure:: append => dq_append\n procedure:: appendleft => dq_appendleft\n procedure:: pop => dq_pop\n procedure:: popleft => dq_popleft\n procedure:: right => dq_right\n procedure:: left => dq_left\n procedure:: remaining_elements => dq_remaining_elements\n procedure:: remain => dq_remain\n end type\n\n interface deque\n procedure:: dq_init\n end interface\ncontains\n function dq_init() result(dq)\n ! 初期化\n type(deque):: dq\n dq%r=0; dq%rmax=1\n dq%l=1; dq%lmax=-1\n allocate(dq%v(dq%lmax:dq%rmax))\n end function\n\n\n subroutine dq_append(dq,num)\n ! 右端に挿入\n class(deque):: dq\n integer(int32):: num\n if (dq%r+1 > dq%rmax) call dq_add_(dq)\n dq%r=dq%r+1\n dq%v(dq%r) = num\n end subroutine\n\n subroutine dq_appendleft(dq,num)\n ! 左端に挿入\n class(deque):: dq\n integer(int32):: num\n if (dq%l-1 < dq%lmax) call dq_add_(dq)\n dq%l=dq%l-1\n dq%v(dq%l) = num\n end subroutine\n\n subroutine dq_add_(dq)\n ! arrayの延長\n class(deque):: dq\n integer(int32):: l\n integer(int32),pointer:: tmp(:)\n l = size(dq%v)\n allocate(tmp(l))\n tmp(:) = dq%v(:)\n deallocate(dq%v)\n allocate(dq%v(2*dq%lmax:2*dq%rmax))\n dq%v(dq%lmax:dq%rmax) = tmp(:)\n dq%lmax = 2*dq%lmax\n dq%rmax = 2*dq%rmax\n end subroutine\n\n\n function dq_pop(dq) result(ret)\n ! 右端から取り出し\n class(deque):: dq\n integer(int32):: ret\n ret = dq%v(dq%r)\n dq%r=dq%r-1\n end function\n\n function dq_popleft(dq) result(ret)\n ! 左端から取り出し\n class(deque):: dq\n integer(int32):: ret\n ret = dq%v(dq%l)\n dq%l=dq%l+1\n end function\n\n\n function dq_right(dq) result(ret)\n ! 右端を確認\n class(deque):: dq\n integer(int32):: ret\n ret = dq%v(dq%r)\n end function\n\n function dq_left(dq) result(ret)\n ! 左端を確認\n class(deque):: dq\n integer(int32):: ret\n ret = dq%v(dq%l)\n end function\n\n function dq_remaining_elements(dq) result(ret)\n ! 残りの要素数\n class(deque):: dq\n integer(int32):: ret \n ret = dq%r - dq%l + 1\n end function\n\n function dq_remain(dq) result(ret)\n ! 要素が残っているかどうか\n class(deque):: dq\n logical:: ret\n ret = dq%remaining_elements() > 0\n end function\nend module\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use deque_mod\n implicit none\n integer(int32):: h,w,sx,sy,gx,gy,i,j,x,y,dx,dy,nx,ny\n integer(int32),allocatable:: nm(:,:)\n character(1),allocatable:: s(:,:)\n logical,allocatable:: passed(:,:)\n type(deque):: tx, ty\n\n tx = deque()\n ty = deque()\n read*, h,w\n read*, sy,sx\n read*, gy,gx\n\n allocate(nm(w,h), source=1000000000)\n allocate(s(w,h))\n allocate(passed(w,h),source=.false.)\n \n do y=1,h\n block; character(w):: inpt_s\n read*, inpt_s\n do x=1,w\n s(x,y) = inpt_s(x:x)\n end do\n end block\n end do\n\n call tx%append(sx)\n call ty%append(sy)\n nm(sx,sy) = 0\n\n do while(tx%remain())\n x = tx%popleft()\n y = ty%popleft()\n ! print'(*(i0,1x))', x,y\n passed(x,y) = .true.\n ! do i=1,h\n ! print'(*(i0,1x))', nm(:,i)\n ! end do\n\n do dy = -1,1\n do dx = -1,1\n if (dx==0 .and. dy==0) cycle\n if (dx /= 0 .and. dy /= 0) cycle\n nx = x+dx; ny = y+dy\n if (.not. in_s(nx,ny)) cycle\n if (s(nx,ny) == \"#\") cycle\n if (nm(nx,ny) > nm(x,y)) then\n ! print'(*(i0,1x))', nx,ny\n nm(nx,ny) = nm(x,y)\n call tx%append(nx)\n call ty%append(ny)\n end if\n end do\n end do\n\n ! do i=1,h\n ! print'(*(i0,1x))', nm(:,i)\n ! end do\n\n do dy=-2,2\n do dx=-2,2\n nx = dx+x; ny=dy+y\n if (.not. in_s(nx,ny)) cycle\n if (s(nx, ny) == \"#\") cycle\n if (nm(nx,ny) > nm(x,y)+1) then\n ! print'(*(i0,1x))', nx,ny\n nm(nx,ny) = nm(x,y)+1\n call tx%append(nx)\n call ty%append(ny)\n end if\n end do\n end do\n end do\n if (nm(gx,gy) == 1000000000) then\n print'(i0)', -1\n stop\n end if\n print'(i0)', nm(gx,gy)\ncontains\n function in_s(x,y) result(ret)\n integer(int32):: x,y\n logical:: ret\n\n ret = 1 <= x .and. x <= w\n ret = ret .and. (1 <= y .and. y <= h)\n end function\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA maze is composed of a grid of H \\times W squares - H vertical, W horizontal.\n\nThe square at the i-th row from the top and the j-th column from the left - (i,j) - is a wall if S_{ij} is # and a road if S_{ij} is ..\n\nThere is a magician in (C_h,C_w). He can do the following two kinds of moves:\n\nMove A: Walk to a road square that is vertically or horizontally adjacent to the square he is currently in.\n\nMove B: Use magic to warp himself to a road square in the 5\\times 5 area centered at the square he is currently in.\n\nIn either case, he cannot go out of the maze.\n\nAt least how many times does he need to use the magic to reach (D_h, D_w)?\n\nConstraints\n\n1 \\leq H,W \\leq 10^3\n\n1 \\leq C_h,D_h \\leq H\n\n1 \\leq C_w,D_w \\leq W\n\nS_{ij} is # or ..\n\nS_{C_h C_w} and S_{D_h D_w} are ..\n\n(C_h,C_w) \\neq (D_h,D_w)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nC_h C_w\nD_h D_w\nS_{11}\\ldots S_{1W}\n\\vdots\nS_{H1}\\ldots S_{HW}\n\nOutput\n\nPrint the minimum number of times the magician needs to use the magic. If he cannot reach (D_h,D_w), print -1 instead.\n\nSample Input 1\n\n4 4\n1 1\n4 4\n..#.\n..#.\n.#..\n.#..\n\nSample Output 1\n\n1\n\nFor example, by walking to (2,2) and then using the magic to travel to (4,4), just one use of magic is enough.\n\nNote that he cannot walk diagonally.\n\nSample Input 2\n\n4 4\n1 4\n4 1\n.##.\n####\n####\n.##.\n\nSample Output 2\n\n-1\n\nHe cannot move from there.\n\nSample Input 3\n\n4 4\n2 2\n3 3\n....\n....\n....\n....\n\nSample Output 3\n\n0\n\nNo use of magic is needed.\n\nSample Input 4\n\n4 5\n1 2\n2 5\n#.###\n####.\n#..##\n#..##\n\nSample Output 4\n\n2", "sample_input": "4 4\n1 1\n4 4\n..#.\n..#.\n.#..\n.#..\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02579", "source_text": "Score : 400 points\n\nProblem Statement\n\nA maze is composed of a grid of H \\times W squares - H vertical, W horizontal.\n\nThe square at the i-th row from the top and the j-th column from the left - (i,j) - is a wall if S_{ij} is # and a road if S_{ij} is ..\n\nThere is a magician in (C_h,C_w). He can do the following two kinds of moves:\n\nMove A: Walk to a road square that is vertically or horizontally adjacent to the square he is currently in.\n\nMove B: Use magic to warp himself to a road square in the 5\\times 5 area centered at the square he is currently in.\n\nIn either case, he cannot go out of the maze.\n\nAt least how many times does he need to use the magic to reach (D_h, D_w)?\n\nConstraints\n\n1 \\leq H,W \\leq 10^3\n\n1 \\leq C_h,D_h \\leq H\n\n1 \\leq C_w,D_w \\leq W\n\nS_{ij} is # or ..\n\nS_{C_h C_w} and S_{D_h D_w} are ..\n\n(C_h,C_w) \\neq (D_h,D_w)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nC_h C_w\nD_h D_w\nS_{11}\\ldots S_{1W}\n\\vdots\nS_{H1}\\ldots S_{HW}\n\nOutput\n\nPrint the minimum number of times the magician needs to use the magic. If he cannot reach (D_h,D_w), print -1 instead.\n\nSample Input 1\n\n4 4\n1 1\n4 4\n..#.\n..#.\n.#..\n.#..\n\nSample Output 1\n\n1\n\nFor example, by walking to (2,2) and then using the magic to travel to (4,4), just one use of magic is enough.\n\nNote that he cannot walk diagonally.\n\nSample Input 2\n\n4 4\n1 4\n4 1\n.##.\n####\n####\n.##.\n\nSample Output 2\n\n-1\n\nHe cannot move from there.\n\nSample Input 3\n\n4 4\n2 2\n3 3\n....\n....\n....\n....\n\nSample Output 3\n\n0\n\nNo use of magic is needed.\n\nSample Input 4\n\n4 5\n1 2\n2 5\n#.###\n####.\n#..##\n#..##\n\nSample Output 4\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5104, "cpu_time_ms": 2213, "memory_kb": 235544}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s253565833", "group_id": "codeNet:p02581", "input_text": "module mod_selection_sort\n implicit none\n integer, private, parameter :: intkind = 4\ncontains\n logical function less(a, b) result(res)\n integer(intkind), intent(in) :: a, b\n res = a <= b\n end\n subroutine swap(a, b)\n integer(intkind), intent(inout) :: a, b\n a = xor(a, b)\n b = xor(a, b)\n a = xor(a, b)\n end\n subroutine selection_sort(a)\n integer(intkind), intent(inout) :: a(:)\n integer :: n, i, j, m\n n = size(a)\n do i = 1, n - 1\n m = i\n do j = i + 1, n\n if (.not.less(a(m), a(j))) m = j\n end do\n if (i /= m) call swap(a(i), a(m))\n end do\n end\nend module mod_selection_sort\nprogram brave_chain\n use mod_selection_sort\n implicit none\n integer :: n, a(6000) = 0, dp(2000, 2000) = -1, m = 0, b(3) = 0, v, i, j\n integer, dimension(2000) :: dp0 = 0, mv = -1, mv0 = 0\n read(*,*) n\n read(*,*) a(1:3 * n)\n call update(a(1), a(2), 0)\n do i = 3, 3 * n - 2, 3\n if (a(i) == a(i + 1) .and. a(i) == a(i + 2)) then\n m = m + 1\n cycle\n end if\n call selection_sort(a(i:i + 2))\n if (a(i + 1) == a(i + 2)) call swap(a(i), a(i + 2))\n do j = 1, n\n dp0(j) = dp(min(a(i), j), max(a(i), j))\n end do\n mv0(1:n) = mv(1:n)\n v = maxval(mv(1:n))\n do j = 1, 3\n b(j) = dp(a(i + j), a(i + j))\n end do\n if (a(i) == a(i + 1)) then\n do j = 1, n\n call update(a(i + 2), j, dp0(j) + 1)\n end do\n end if\n call update(a(i + 1), a(i + 2), b(1) + 1)\n call update(a(i), a(i + 2), b(2) + 1)\n call update(a(i), a(i + 1), b(3) + 1)\n call update(a(i + 1), a(i + 2), v)\n call update(a(i), a(i + 2), v)\n call update(a(i), a(i + 1), v)\n do j = 1, n\n call update(a(i), j, mv0(j))\n call update(a(i + 1), j, mv0(j))\n call update(a(i + 2), j, mv0(j))\n end do\n end do\n write(*,'(i0)') max(dp(a(3 * n), a(3 * n)) + 1, maxval(mv(1:n))) + m\ncontains\n subroutine update(a, b, z)\n integer, intent(in) :: a, b, z\n integer :: x, y\n if (a > b) then\n x = b\n y = a\n else\n x = a\n y = b\n end if\n if (dp(x, y) >= z) return\n dp(x, y) = z\n mv(x) = max(mv(x), z)\n mv(y) = max(mv(y), z)\n end\nend program brave_chain", "language": "Fortran", "metadata": {"date": 1598204104, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02581.html", "problem_id": "p02581", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02581/input.txt", "sample_output_relpath": "derived/input_output/data/p02581/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02581/Fortran/s253565833.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s253565833", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "module mod_selection_sort\n implicit none\n integer, private, parameter :: intkind = 4\ncontains\n logical function less(a, b) result(res)\n integer(intkind), intent(in) :: a, b\n res = a <= b\n end\n subroutine swap(a, b)\n integer(intkind), intent(inout) :: a, b\n a = xor(a, b)\n b = xor(a, b)\n a = xor(a, b)\n end\n subroutine selection_sort(a)\n integer(intkind), intent(inout) :: a(:)\n integer :: n, i, j, m\n n = size(a)\n do i = 1, n - 1\n m = i\n do j = i + 1, n\n if (.not.less(a(m), a(j))) m = j\n end do\n if (i /= m) call swap(a(i), a(m))\n end do\n end\nend module mod_selection_sort\nprogram brave_chain\n use mod_selection_sort\n implicit none\n integer :: n, a(6000) = 0, dp(2000, 2000) = -1, m = 0, b(3) = 0, v, i, j\n integer, dimension(2000) :: dp0 = 0, mv = -1, mv0 = 0\n read(*,*) n\n read(*,*) a(1:3 * n)\n call update(a(1), a(2), 0)\n do i = 3, 3 * n - 2, 3\n if (a(i) == a(i + 1) .and. a(i) == a(i + 2)) then\n m = m + 1\n cycle\n end if\n call selection_sort(a(i:i + 2))\n if (a(i + 1) == a(i + 2)) call swap(a(i), a(i + 2))\n do j = 1, n\n dp0(j) = dp(min(a(i), j), max(a(i), j))\n end do\n mv0(1:n) = mv(1:n)\n v = maxval(mv(1:n))\n do j = 1, 3\n b(j) = dp(a(i + j), a(i + j))\n end do\n if (a(i) == a(i + 1)) then\n do j = 1, n\n call update(a(i + 2), j, dp0(j) + 1)\n end do\n end if\n call update(a(i + 1), a(i + 2), b(1) + 1)\n call update(a(i), a(i + 2), b(2) + 1)\n call update(a(i), a(i + 1), b(3) + 1)\n call update(a(i + 1), a(i + 2), v)\n call update(a(i), a(i + 2), v)\n call update(a(i), a(i + 1), v)\n do j = 1, n\n call update(a(i), j, mv0(j))\n call update(a(i + 1), j, mv0(j))\n call update(a(i + 2), j, mv0(j))\n end do\n end do\n write(*,'(i0)') max(dp(a(3 * n), a(3 * n)) + 1, maxval(mv(1:n))) + m\ncontains\n subroutine update(a, b, z)\n integer, intent(in) :: a, b, z\n integer :: x, y\n if (a > b) then\n x = b\n y = a\n else\n x = a\n y = b\n end if\n if (dp(x, y) >= z) return\n dp(x, y) = z\n mv(x) = max(mv(x), z)\n mv(y) = max(mv(y), z)\n end\nend program brave_chain", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have 3N cards arranged in a row from left to right, where each card has an integer between 1 and N (inclusive) written on it. The integer written on the i-th card from the left is A_i.\n\nYou will do the following operation N-1 times:\n\nRearrange the five leftmost cards in any order you like, then remove the three leftmost cards. If the integers written on those three cards are all equal, you gain 1 point.\n\nAfter these N-1 operations, if the integers written on the remaining three cards are all equal, you will gain 1 additional point.\n\nFind the maximum number of points you can gain.\n\nConstraints\n\n1 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\cdots A_{3N}\n\nOutput\n\nPrint the maximum number of points you can gain.\n\nSample Input 1\n\n2\n1 2 1 2 2 1\n\nSample Output 1\n\n2\n\nLet us rearrange the five leftmost cards so that the integers written on the six cards will be 2\\ 2\\ 2\\ 1\\ 1\\ 1 from left to right.\n\nThen, remove the three leftmost cards, all of which have the same integer 2, gaining 1 point.\n\nNow, the integers written on the remaining cards are 1\\ 1\\ 1.\n\nSince these three cards have the same integer 1, we gain 1 more point.\n\nIn this way, we can gain 2 points - which is the maximum possible.\n\nSample Input 2\n\n3\n1 1 2 2 3 3 3 2 1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1 1 2 2 2 3 3 3 1\n\nSample Output 3\n\n3", "sample_input": "2\n1 2 1 2 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02581", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have 3N cards arranged in a row from left to right, where each card has an integer between 1 and N (inclusive) written on it. The integer written on the i-th card from the left is A_i.\n\nYou will do the following operation N-1 times:\n\nRearrange the five leftmost cards in any order you like, then remove the three leftmost cards. If the integers written on those three cards are all equal, you gain 1 point.\n\nAfter these N-1 operations, if the integers written on the remaining three cards are all equal, you will gain 1 additional point.\n\nFind the maximum number of points you can gain.\n\nConstraints\n\n1 \\leq N \\leq 2000\n\n1 \\leq A_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\cdots A_{3N}\n\nOutput\n\nPrint the maximum number of points you can gain.\n\nSample Input 1\n\n2\n1 2 1 2 2 1\n\nSample Output 1\n\n2\n\nLet us rearrange the five leftmost cards so that the integers written on the six cards will be 2\\ 2\\ 2\\ 1\\ 1\\ 1 from left to right.\n\nThen, remove the three leftmost cards, all of which have the same integer 2, gaining 1 point.\n\nNow, the integers written on the remaining cards are 1\\ 1\\ 1.\n\nSince these three cards have the same integer 1, we gain 1 more point.\n\nIn this way, we can gain 2 points - which is the maximum possible.\n\nSample Input 2\n\n3\n1 1 2 2 3 3 3 2 1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1 1 2 2 2 3 3 3 1\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2179, "cpu_time_ms": 114, "memory_kb": 18616}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s332333252", "group_id": "codeNet:p02582", "input_text": "program main\n implicit none\n integer :: n, i, j, k, counts\n integer, allocatable :: l(:)\n \n read(*,*) n\n \n allocate( l(n) )\n read(*,*) ( l(i), i = 1, n )\n \n counts = 0\n \n do i = 1, n-2\n do j = i+1, n-1\n do k = i+2, n\n if ( l(i)+l(j) > l(k) .and. l(j)+l(k) > l(i) .and. l(k)+l(i) > l(j) ) then\n if( l(i) == l(j) .or. l(i) == l(k) .or. l(j) == l(k) ) then\n counts = counts\n else\n counts = counts + 1\n endif\n else\n counts = counts\n endif\n enddo\n enddo\n enddo\n \n write(*,*) counts\n \nend program main", "language": "Fortran", "metadata": {"date": 1597523891, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02582.html", "problem_id": "p02582", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02582/input.txt", "sample_output_relpath": "derived/input_output/data/p02582/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02582/Fortran/s332333252.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s332333252", "user_id": "u660615005"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, i, j, k, counts\n integer, allocatable :: l(:)\n \n read(*,*) n\n \n allocate( l(n) )\n read(*,*) ( l(i), i = 1, n )\n \n counts = 0\n \n do i = 1, n-2\n do j = i+1, n-1\n do k = i+2, n\n if ( l(i)+l(j) > l(k) .and. l(j)+l(k) > l(i) .and. l(k)+l(i) > l(j) ) then\n if( l(i) == l(j) .or. l(i) == l(k) .or. l(j) == l(k) ) then\n counts = counts\n else\n counts = counts + 1\n endif\n else\n counts = counts\n endif\n enddo\n enddo\n enddo\n \n write(*,*) counts\n \nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "sample_input": "RRS\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02582", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 606, "cpu_time_ms": 16, "memory_kb": 3136}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s229541577", "group_id": "codeNet:p02582", "input_text": "program answer\n implicit none\n character(len=3) :: S\n read(*,*) S\n if(S(1:1)=='R'.and.S(2:2)=='R'.and.S(3:3)=='R') then\n write(*,*) '3'\n stop\n else if(S(1:1)=='R'.and.S(2:2)=='R'.and.S(3:3)=='S') then\n write(*,*) '2'\n else if(S(1:1)=='S'.and.S(2:2)=='R'.and.S(3:3)=='R') then\n write(*,*) '2'\n else if(S(1:1)=='S'.and.S(2:2)=='S'.and.S(3:3)=='S') then\n write(*,*) '0'\n else\n write(*,*) '1'\n end if\n\n stop\n end program answer", "language": "Fortran", "metadata": {"date": 1597518388, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02582.html", "problem_id": "p02582", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02582/input.txt", "sample_output_relpath": "derived/input_output/data/p02582/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02582/Fortran/s229541577.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s229541577", "user_id": "u873780029"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program answer\n implicit none\n character(len=3) :: S\n read(*,*) S\n if(S(1:1)=='R'.and.S(2:2)=='R'.and.S(3:3)=='R') then\n write(*,*) '3'\n stop\n else if(S(1:1)=='R'.and.S(2:2)=='R'.and.S(3:3)=='S') then\n write(*,*) '2'\n else if(S(1:1)=='S'.and.S(2:2)=='R'.and.S(3:3)=='R') then\n write(*,*) '2'\n else if(S(1:1)=='S'.and.S(2:2)=='S'.and.S(3:3)=='S') then\n write(*,*) '0'\n else\n write(*,*) '1'\n end if\n\n stop\n end program answer", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "sample_input": "RRS\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02582", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have weather records at AtCoder Town for some consecutive three days. A string of length 3, S, represents the records - if the i-th character is S, it means it was sunny on the i-th day; if that character is R, it means it was rainy on that day.\n\nFind the maximum number of consecutive rainy days in this period.\n\nConstraints\n\n|S| = 3\n\nEach character of S is S or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of consecutive rainy days in the period.\n\nSample Input 1\n\nRRS\n\nSample Output 1\n\n2\n\nWe had rain on the 1-st and 2-nd days in the period. Here, the maximum number of consecutive rainy days is 2, so we should print 2.\n\nSample Input 2\n\nSSS\n\nSample Output 2\n\n0\n\nIt was sunny throughout the period. We had no rainy days, so we should print 0.\n\nSample Input 3\n\nRSR\n\nSample Output 3\n\n1\n\nWe had rain on the 1-st and 3-rd days - two \"streaks\" of one rainy day, so we should print 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 457, "cpu_time_ms": 14, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s274759441", "group_id": "codeNet:p02583", "input_text": "program make_triangle\n integer :: n\n integer,allocatable :: l(:)\n integer :: i, j, k\n integer :: t(3)\n integer :: ans = 0\n\n read *, n\n allocate(l(n))\n do i = 1, n\n read *, l(i)\n end do\n\n do i = 1, n-1\n do j = i + 1, n\n if(l(i) .gt. l(j))then\n k = t(i)\n t(i) = t(j)\n t(j) = k\n end if\n end do\n end do\n\n do i = 1, n\n do j = 1, i-1\n do k = 1, j-1\n if(t(k) /= t(j) .and. t(i) /= t(j) .and. t(k) + t(j) > t(i))then\n ans = ans + 1\n end if\n end do\n end do\n end do\n print *, ans\nend program", "language": "Fortran", "metadata": {"date": 1597922654, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02583.html", "problem_id": "p02583", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02583/input.txt", "sample_output_relpath": "derived/input_output/data/p02583/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02583/Fortran/s274759441.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s274759441", "user_id": "u622206408"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program make_triangle\n integer :: n\n integer,allocatable :: l(:)\n integer :: i, j, k\n integer :: t(3)\n integer :: ans = 0\n\n read *, n\n allocate(l(n))\n do i = 1, n\n read *, l(i)\n end do\n\n do i = 1, n-1\n do j = i + 1, n\n if(l(i) .gt. l(j))then\n k = t(i)\n t(i) = t(j)\n t(j) = k\n end if\n end do\n end do\n\n do i = 1, n\n do j = 1, i-1\n do k = 1, j-1\n if(t(k) /= t(j) .and. t(i) /= t(j) .and. t(k) + t(j) > t(i))then\n ans = ans + 1\n end if\n end do\n end do\n end do\n print *, ans\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have sticks numbered 1, \\cdots, N. The length of Stick i (1 \\leq i \\leq N) is L_i.\n\nIn how many ways can we choose three of the sticks with different lengths that can form a triangle?\n\nThat is, find the number of triples of integers (i, j, k) (1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nL_i, L_j, and L_k are all different.\n\nThere exists a triangle whose sides have lengths L_i, L_j, and L_k.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 \\cdots L_N\n\nOutput\n\nPrint the number of ways to choose three of the sticks with different lengths that can form a triangle.\n\nSample Input 1\n\n5\n4 4 9 7 5\n\nSample Output 1\n\n5\n\nThe following five triples (i, j, k) satisfy the conditions: (1, 3, 4), (1, 4, 5), (2, 3, 4), (2, 4, 5), and (3, 4, 5).\n\nSample Input 2\n\n6\n4 5 4 3 3 5\n\nSample Output 2\n\n8\n\nWe have two sticks for each of the lengths 3, 4, and 5. To satisfy the first condition, we have to choose one from each length.\n\nThere is a triangle whose sides have lengths 3, 4, and 5, so we have 2 ^ 3 = 8 triples (i, j, k) that satisfy the conditions.\n\nSample Input 3\n\n10\n9 4 6 1 9 6 10 6 6 8\n\nSample Output 3\n\n39\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\n0\n\nNo triple (i, j, k) satisfies 1 \\leq i < j < k \\leq N, so we should print 0.", "sample_input": "5\n4 4 9 7 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02583", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have sticks numbered 1, \\cdots, N. The length of Stick i (1 \\leq i \\leq N) is L_i.\n\nIn how many ways can we choose three of the sticks with different lengths that can form a triangle?\n\nThat is, find the number of triples of integers (i, j, k) (1 \\leq i < j < k \\leq N) that satisfy both of the following conditions:\n\nL_i, L_j, and L_k are all different.\n\nThere exists a triangle whose sides have lengths L_i, L_j, and L_k.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 \\cdots L_N\n\nOutput\n\nPrint the number of ways to choose three of the sticks with different lengths that can form a triangle.\n\nSample Input 1\n\n5\n4 4 9 7 5\n\nSample Output 1\n\n5\n\nThe following five triples (i, j, k) satisfy the conditions: (1, 3, 4), (1, 4, 5), (2, 3, 4), (2, 4, 5), and (3, 4, 5).\n\nSample Input 2\n\n6\n4 5 4 3 3 5\n\nSample Output 2\n\n8\n\nWe have two sticks for each of the lengths 3, 4, and 5. To satisfy the first condition, we have to choose one from each length.\n\nThere is a triangle whose sides have lengths 3, 4, and 5, so we have 2 ^ 3 = 8 triples (i, j, k) that satisfy the conditions.\n\nSample Input 3\n\n10\n9 4 6 1 9 6 10 6 6 8\n\nSample Output 3\n\n39\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\n0\n\nNo triple (i, j, k) satisfies 1 \\leq i < j < k \\leq N, so we should print 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 691, "cpu_time_ms": 18, "memory_kb": 3160}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s960886629", "group_id": "codeNet:p02584", "input_text": "program abc41\n implicit none\n integer(8)::X,K,D,Z,Y,ans,L\n read(*,*)X,K,D\n Y=abs(X)\n if(Y>K*D)then\n print'(i0)',Y-K*D\n stop\n end if\n L=K-nint(real((Y-mod(Y,D))/D))\n Z=mod(Y,D)\n if(mod(L,2)==0)then\n print'(i0)',Z\n else\n print'(i0)',D-Z\n end if\nend program abc41", "language": "Fortran", "metadata": {"date": 1597522123, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02584.html", "problem_id": "p02584", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02584/input.txt", "sample_output_relpath": "derived/input_output/data/p02584/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02584/Fortran/s960886629.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s960886629", "user_id": "u897889420"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program abc41\n implicit none\n integer(8)::X,K,D,Z,Y,ans,L\n read(*,*)X,K,D\n Y=abs(X)\n if(Y>K*D)then\n print'(i0)',Y-K*D\n stop\n end if\n L=K-nint(real((Y-mod(Y,D))/D))\n Z=mod(Y,D)\n if(mod(L,2)==0)then\n print'(i0)',Z\n else\n print'(i0)',D-Z\n end if\nend program abc41", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "sample_input": "6 2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02584", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 264, "cpu_time_ms": 11, "memory_kb": 2924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s600065651", "group_id": "codeNet:p02584", "input_text": " PROGRAM walkingTakahashi\n IMPLICIT NONE\n INTEGER,PARAMETER :: p = 16\n integer(p) :: x,k,d, right,left\n \n read*,x,k,d\n \n x = abs(x)\n \n !rightまでたどり着かないorギリ\n if( k<=x/d )then\n print*,x-k*d\n stop\n end if\n \n right = x - x/d*d\n k = k - x/d\n \n left = right - d\n \n if( mod(k,2)==0 )then\n print*,right\n else\n print*,abs(left)\n end if\n \n \n \n \n \n stop\n !debugg\n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1597519371, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02584.html", "problem_id": "p02584", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02584/input.txt", "sample_output_relpath": "derived/input_output/data/p02584/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02584/Fortran/s600065651.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s600065651", "user_id": "u171356453"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " PROGRAM walkingTakahashi\n IMPLICIT NONE\n INTEGER,PARAMETER :: p = 16\n integer(p) :: x,k,d, right,left\n \n read*,x,k,d\n \n x = abs(x)\n \n !rightまでたどり着かないorギリ\n if( k<=x/d )then\n print*,x-k*d\n stop\n end if\n \n right = x - x/d*d\n k = k - x/d\n \n left = right - d\n \n if( mod(k,2)==0 )then\n print*,right\n else\n print*,abs(left)\n end if\n \n \n \n \n \n stop\n !debugg\n \n \n \n END PROGRAM", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "sample_input": "6 2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02584", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi, who lives on the number line, is now at coordinate X. He will make exactly K moves of distance D in the positive or negative direction.\n\nMore specifically, in one move, he can go from coordinate x to x + D or x - D.\n\nHe wants to make K moves so that the absolute value of the coordinate of the destination will be the smallest possible.\n\nFind the minimum possible absolute value of the coordinate of the destination.\n\nConstraints\n\n-10^{15} \\leq X \\leq 10^{15}\n\n1 \\leq K \\leq 10^{15}\n\n1 \\leq D \\leq 10^{15}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX K D\n\nOutput\n\nPrint the minimum possible absolute value of the coordinate of the destination.\n\nSample Input 1\n\n6 2 4\n\nSample Output 1\n\n2\n\nTakahashi is now at coordinate 6. It is optimal to make the following moves:\n\nMove from coordinate 6 to (6 - 4 =) 2.\n\nMove from coordinate 2 to (2 - 4 =) -2.\n\nHere, the absolute value of the coordinate of the destination is 2, and we cannot make it smaller.\n\nSample Input 2\n\n7 4 3\n\nSample Output 2\n\n1\n\nTakahashi is now at coordinate 7. It is optimal to make, for example, the following moves:\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 7.\n\nMove from coordinate 7 to 4.\n\nMove from coordinate 4 to 1.\n\nHere, the absolute value of the coordinate of the destination is 1, and we cannot make it smaller.\n\nSample Input 3\n\n10 1 2\n\nSample Output 3\n\n8\n\nSample Input 4\n\n1000000000000000 1000000000000000 1000000000000000\n\nSample Output 4\n\n1000000000000000\n\nThe answer can be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 579, "cpu_time_ms": 11, "memory_kb": 2844}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s419586034", "group_id": "codeNet:p02585", "input_text": "program MovingPiece\n\n implicit none\n\n integer(16) :: N, K\n integer(16), allocatable :: P(:), C(:)\n integer(16) :: i, j, l\n integer(16) :: maxscore, temp\n\n read(*, *) N, K\n allocate(P(1:N), C(1:N))\n read(*, *) P\n read(*, *) C\n\n\n maxscore = -1000000000\n do i = 1, N\n l = P(i)\n temp = 0\n do j = 1, K\n temp = temp + C(l)\n if (maxscore < temp) then\n maxscore = temp\n end if\n l = P(l)\n end do\n end do\n\n write(*, *) maxscore\n\nend program MovingPiece\n", "language": "Fortran", "metadata": {"date": 1597545392, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02585.html", "problem_id": "p02585", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02585/input.txt", "sample_output_relpath": "derived/input_output/data/p02585/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02585/Fortran/s419586034.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s419586034", "user_id": "u367319568"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program MovingPiece\n\n implicit none\n\n integer(16) :: N, K\n integer(16), allocatable :: P(:), C(:)\n integer(16) :: i, j, l\n integer(16) :: maxscore, temp\n\n read(*, *) N, K\n allocate(P(1:N), C(1:N))\n read(*, *) P\n read(*, *) C\n\n\n maxscore = -1000000000\n do i = 1, N\n l = P(i)\n temp = 0\n do j = 1, K\n temp = temp + C(l)\n if (maxscore < temp) then\n maxscore = temp\n end if\n l = P(l)\n end do\n end do\n\n write(*, *) maxscore\n\nend program MovingPiece\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi will play a game using a piece on an array of squares numbered 1, 2, \\cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \\cdots, N: P_1, P_2, \\cdots, P_N.\n\nNow, he will choose one square and place the piece on that square. Then, he will make the following move some number of times between 1 and K (inclusive):\n\nIn one move, if the piece is now on Square i (1 \\leq i \\leq N), move it to Square P_i. Here, his score increases by C_{P_i}.\n\nHelp him by finding the maximum possible score at the end of the game. (The score is 0 at the beginning of the game.)\n\nConstraints\n\n2 \\leq N \\leq 5000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq P_i \\leq N\n\nP_i \\neq i\n\nP_1, P_2, \\cdots, P_N are all different.\n\n-10^9 \\leq C_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nP_1 P_2 \\cdots P_N\nC_1 C_2 \\cdots C_N\n\nOutput\n\nPrint the maximum possible score at the end of the game.\n\nSample Input 1\n\n5 2\n2 4 5 1 3\n3 4 -10 -8 8\n\nSample Output 1\n\n8\n\nWhen we start at some square of our choice and make at most two moves, we have the following options:\n\nIf we start at Square 1, making one move sends the piece to Square 2, after which the score is 4. Making another move sends the piece to Square 4, after which the score is 4 + (-8) = -4.\n\nIf we start at Square 2, making one move sends the piece to Square 4, after which the score is -8. Making another move sends the piece to Square 1, after which the score is -8 + 3 = -5.\n\nIf we start at Square 3, making one move sends the piece to Square 5, after which the score is 8. Making another move sends the piece to Square 3, after which the score is 8 + (-10) = -2.\n\nIf we start at Square 4, making one move sends the piece to Square 1, after which the score is 3. Making another move sends the piece to Square 2, after which the score is 3 + 4 = 7.\n\nIf we start at Square 5, making one move sends the piece to Square 3, after which the score is -10. Making another move sends the piece to Square 5, after which the score is -10 + 8 = -2.\n\nThe maximum score achieved is 8.\n\nSample Input 2\n\n2 3\n2 1\n10 -7\n\nSample Output 2\n\n13\n\nSample Input 3\n\n3 3\n3 1 2\n-1000 -2000 -3000\n\nSample Output 3\n\n-1000\n\nWe have to make at least one move.\n\nSample Input 4\n\n10 58\n9 1 6 7 8 4 3 2 10 5\n695279662 988782657 -119067776 382975538 -151885171 -177220596 -169777795 37619092 389386780 980092719\n\nSample Output 4\n\n29507023469\n\nThe absolute value of the answer may be enormous.", "sample_input": "5 2\n2 4 5 1 3\n3 4 -10 -8 8\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02585", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi will play a game using a piece on an array of squares numbered 1, 2, \\cdots, N. Square i has an integer C_i written on it. Also, he is given a permutation of 1, 2, \\cdots, N: P_1, P_2, \\cdots, P_N.\n\nNow, he will choose one square and place the piece on that square. Then, he will make the following move some number of times between 1 and K (inclusive):\n\nIn one move, if the piece is now on Square i (1 \\leq i \\leq N), move it to Square P_i. Here, his score increases by C_{P_i}.\n\nHelp him by finding the maximum possible score at the end of the game. (The score is 0 at the beginning of the game.)\n\nConstraints\n\n2 \\leq N \\leq 5000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq P_i \\leq N\n\nP_i \\neq i\n\nP_1, P_2, \\cdots, P_N are all different.\n\n-10^9 \\leq C_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nP_1 P_2 \\cdots P_N\nC_1 C_2 \\cdots C_N\n\nOutput\n\nPrint the maximum possible score at the end of the game.\n\nSample Input 1\n\n5 2\n2 4 5 1 3\n3 4 -10 -8 8\n\nSample Output 1\n\n8\n\nWhen we start at some square of our choice and make at most two moves, we have the following options:\n\nIf we start at Square 1, making one move sends the piece to Square 2, after which the score is 4. Making another move sends the piece to Square 4, after which the score is 4 + (-8) = -4.\n\nIf we start at Square 2, making one move sends the piece to Square 4, after which the score is -8. Making another move sends the piece to Square 1, after which the score is -8 + 3 = -5.\n\nIf we start at Square 3, making one move sends the piece to Square 5, after which the score is 8. Making another move sends the piece to Square 3, after which the score is 8 + (-10) = -2.\n\nIf we start at Square 4, making one move sends the piece to Square 1, after which the score is 3. Making another move sends the piece to Square 2, after which the score is 3 + 4 = 7.\n\nIf we start at Square 5, making one move sends the piece to Square 3, after which the score is -10. Making another move sends the piece to Square 5, after which the score is -10 + 8 = -2.\n\nThe maximum score achieved is 8.\n\nSample Input 2\n\n2 3\n2 1\n10 -7\n\nSample Output 2\n\n13\n\nSample Input 3\n\n3 3\n3 1 2\n-1000 -2000 -3000\n\nSample Output 3\n\n-1000\n\nWe have to make at least one move.\n\nSample Input 4\n\n10 58\n9 1 6 7 8 4 3 2 10 5\n695279662 988782657 -119067776 382975538 -151885171 -177220596 -169777795 37619092 389386780 980092719\n\nSample Output 4\n\n29507023469\n\nThe absolute value of the answer may be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 569, "cpu_time_ms": 3308, "memory_kb": 2996}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s303326539", "group_id": "codeNet:p02587", "input_text": "program making_palindrome\n implicit none\n integer(8), parameter :: inf = 1e18\n integer :: n, i\n character(20) :: s(50, 2) = ''\n integer(8) :: c(50) = 0, m(50, 21, 2) = 0, x = inf\n logical :: u(50, 21, 2) = .false.\n read(*,*) n\n do i = 1, n\n read(*,*) s(i, 1), c(i)\n s(i, 2) = reverse(s(i, 1)(1:len_trim(s(i, 1))))\n end do\n do i = 1, n\n x = min(x, solve(i, 1, 1) + c(i))\n end do\n write(*,'(i0)') merge(x, -1_8, x < inf)\ncontains\n function reverse(s) result(res)\n character(*), intent(in) :: s\n character(len_trim(s)) :: res\n integer :: n, i\n n = len_trim(s)\n do i = 1, n\n res(i:i) = s(n - i + 1:n - i + 1)\n end do\n end\n recursive integer(8) function solve(i, j, k) result(res)\n integer, intent(in) :: i, j, k\n integer :: l, r, t\n logical :: f\n res = m(i, j, k)\n if (u(i, j, k)) return\n u(i, j, k) = .true.\n m(i, j, k) = inf\n l = j\n r = len_trim(s(i, k))\n f = .true.\n do while (l < r)\n if (s(i, k)(l:l) /= s(i, k)(r:r)) then\n f = .false.\n exit\n end if\n l = l + 1\n r = r - 1\n end do\n if (f) then\n m(i, j, k) = 0\n res = 0\n return\n end if\n do t = 1, n\n l = j\n r = 1\n do while (l <= len_trim(s(i, k)) .and. r <= len_trim(s(t, 3 - k)))\n if (s(i, k)(l:l) /= s(t, 3 - k)(r:r)) exit\n l = l + 1\n r = r + 1\n end do\n if (l == len_trim(s(i, k)) + 1) then\n m(i, j, k) = min(m(i, j, k), solve(t, r, 3 - k) + c(t))\n end if\n if (r == len_trim(s(t, 3 - k)) + 1) then\n m(i, j, k) = min(m(i, j, k), solve(i, l, k) + c(t))\n end if\n end do\n res = m(i, j, k)\n end\nend program making_palindrome", "language": "Fortran", "metadata": {"date": 1597615490, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02587.html", "problem_id": "p02587", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02587/input.txt", "sample_output_relpath": "derived/input_output/data/p02587/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02587/Fortran/s303326539.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s303326539", "user_id": "u506403362"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program making_palindrome\n implicit none\n integer(8), parameter :: inf = 1e18\n integer :: n, i\n character(20) :: s(50, 2) = ''\n integer(8) :: c(50) = 0, m(50, 21, 2) = 0, x = inf\n logical :: u(50, 21, 2) = .false.\n read(*,*) n\n do i = 1, n\n read(*,*) s(i, 1), c(i)\n s(i, 2) = reverse(s(i, 1)(1:len_trim(s(i, 1))))\n end do\n do i = 1, n\n x = min(x, solve(i, 1, 1) + c(i))\n end do\n write(*,'(i0)') merge(x, -1_8, x < inf)\ncontains\n function reverse(s) result(res)\n character(*), intent(in) :: s\n character(len_trim(s)) :: res\n integer :: n, i\n n = len_trim(s)\n do i = 1, n\n res(i:i) = s(n - i + 1:n - i + 1)\n end do\n end\n recursive integer(8) function solve(i, j, k) result(res)\n integer, intent(in) :: i, j, k\n integer :: l, r, t\n logical :: f\n res = m(i, j, k)\n if (u(i, j, k)) return\n u(i, j, k) = .true.\n m(i, j, k) = inf\n l = j\n r = len_trim(s(i, k))\n f = .true.\n do while (l < r)\n if (s(i, k)(l:l) /= s(i, k)(r:r)) then\n f = .false.\n exit\n end if\n l = l + 1\n r = r - 1\n end do\n if (f) then\n m(i, j, k) = 0\n res = 0\n return\n end if\n do t = 1, n\n l = j\n r = 1\n do while (l <= len_trim(s(i, k)) .and. r <= len_trim(s(t, 3 - k)))\n if (s(i, k)(l:l) /= s(t, 3 - k)(r:r)) exit\n l = l + 1\n r = r + 1\n end do\n if (l == len_trim(s(i, k)) + 1) then\n m(i, j, k) = min(m(i, j, k), solve(t, r, 3 - k) + c(t))\n end if\n if (r == len_trim(s(t, 3 - k)) + 1) then\n m(i, j, k) = min(m(i, j, k), solve(i, l, k) + c(t))\n end if\n end do\n res = m(i, j, k)\n end\nend program making_palindrome", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have N strings of lowercase English letters: S_1, S_2, \\cdots, S_N.\n\nTakahashi wants to make a string that is a palindrome by choosing one or more of these strings - the same string can be chosen more than once - and concatenating them in some order of his choice.\n\nThe cost of using the string S_i once is C_i, and the cost of using it multiple times is C_i multiplied by that number of times.\n\nFind the minimum total cost needed to choose strings so that Takahashi can make a palindrome.\n\nIf there is no choice of strings in which he can make a palindrome, print -1.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq |S_i| \\leq 20\n\nS_i consists of lowercase English letters.\n\n1 \\leq C_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 C_1\nS_2 C_2\n:\nS_N C_N\n\nOutput\n\nPrint the minimum total cost needed to choose strings so that Takahashi can make a palindrome, or -1 if there is no such choice.\n\nSample Input 1\n\n3\nba 3\nabc 4\ncbaa 5\n\nSample Output 1\n\n7\n\nWe have ba, abc, and cbaa.\n\nFor example, we can use ba once and abc once for a cost of 7, then concatenate them in the order abc, ba to make a palindrome.\nAlso, we can use abc once and cbaa once for a cost of 9, then concatenate them in the order cbaa, abc to make a palindrome.\n\nWe cannot make a palindrome for a cost less than 7, so we should print 7.\n\nSample Input 2\n\n2\nabcab 5\ncba 3\n\nSample Output 2\n\n11\n\nWe can choose abcab once and cba twice, then concatenate them in the order abcab, cba, cba to make a palindrome for a cost of 11.\n\nSample Input 3\n\n4\nab 5\ncba 3\na 12\nab 10\n\nSample Output 3\n\n8\n\nWe can choose a once, which is already a palindrome, but it is cheaper to concatenate ab and cba.\n\nSample Input 4\n\n2\nabc 1\nab 2\n\nSample Output 4\n\n-1\n\nWe cannot make a palindrome, so we should print -1.", "sample_input": "3\nba 3\nabc 4\ncbaa 5\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02587", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have N strings of lowercase English letters: S_1, S_2, \\cdots, S_N.\n\nTakahashi wants to make a string that is a palindrome by choosing one or more of these strings - the same string can be chosen more than once - and concatenating them in some order of his choice.\n\nThe cost of using the string S_i once is C_i, and the cost of using it multiple times is C_i multiplied by that number of times.\n\nFind the minimum total cost needed to choose strings so that Takahashi can make a palindrome.\n\nIf there is no choice of strings in which he can make a palindrome, print -1.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq |S_i| \\leq 20\n\nS_i consists of lowercase English letters.\n\n1 \\leq C_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 C_1\nS_2 C_2\n:\nS_N C_N\n\nOutput\n\nPrint the minimum total cost needed to choose strings so that Takahashi can make a palindrome, or -1 if there is no such choice.\n\nSample Input 1\n\n3\nba 3\nabc 4\ncbaa 5\n\nSample Output 1\n\n7\n\nWe have ba, abc, and cbaa.\n\nFor example, we can use ba once and abc once for a cost of 7, then concatenate them in the order abc, ba to make a palindrome.\nAlso, we can use abc once and cbaa once for a cost of 9, then concatenate them in the order cbaa, abc to make a palindrome.\n\nWe cannot make a palindrome for a cost less than 7, so we should print 7.\n\nSample Input 2\n\n2\nabcab 5\ncba 3\n\nSample Output 2\n\n11\n\nWe can choose abcab once and cba twice, then concatenate them in the order abcab, cba, cba to make a palindrome for a cost of 11.\n\nSample Input 3\n\n4\nab 5\ncba 3\na 12\nab 10\n\nSample Output 3\n\n8\n\nWe can choose a once, which is already a palindrome, but it is cheaper to concatenate ab and cba.\n\nSample Input 4\n\n2\nabc 1\nab 2\n\nSample Output 4\n\n-1\n\nWe cannot make a palindrome, so we should print -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1692, "cpu_time_ms": 13, "memory_kb": 2924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s016994117", "group_id": "codeNet:p02587", "input_text": "program making_palindrome\n implicit none\n integer(8), parameter :: inf = 1e18\n integer :: n, i\n character(20) :: s(50, 2) = ''\n integer(8) :: c(50) = 0, m(50, 21, 2) = 0, x = inf\n logical :: u(50, 21, 2) = .false.\n read(*,*) n\n do i = 1, n\n read(*,*) s(i, 1), c(i)\n s(i, 2) = reverse(s(i, 1)(1:len_trim(s(i, 1))))\n end do\n do i = 1, n\n x = min(x, solve(i, 1, 1) + c(i))\n end do\n write(*,'(i0)') merge(x, -1_8, x < inf)\ncontains\n function reverse(s) result(res)\n character(*), intent(in) :: s\n character(len_trim(s)) :: res\n integer :: n, i\n n = len_trim(s)\n do i = 1, n\n res(i:i) = s(n - i + 1:n - i + 1)\n end do\n end\n recursive integer(8) function solve(i, j, k) result(res)\n integer, intent(in) :: i, j, k\n integer :: l, r, t\n logical :: f\n res = m(i, j, k)\n if (u(i, j, k)) return\n u(i, j, k) = .true.\n m(i, j, k) = inf\n l = j\n r = len_trim(s(i, k))\n f = .true.\n do while (l < r)\n if (s(i, k)(l:l) /= s(i, k)(r:r)) then\n f = .false.\n exit\n end if\n l = l + 1\n r = r - 1\n end do\n if (f) then\n m(i, j, k) = 0\n res = 0\n return\n end if\n do t = 1, n\n l = j\n r = 1\n do while (l <= len_trim(s(i, k)) .and. r <= len_trim(s(t, 3 - k)))\n if (s(i, k)(l:l) /= s(t, 3 - k)(r:r)) exit\n l = l + 1\n r = r + 1\n end do\n if (l == len_trim(s(i, k)) + 1) then\n m(i, j, k) = min(m(i, j, k), solve(t, r, 3 - k) + c(t))\n end if\n if (r == len_trim(s(t, 3 - k)) + 1) then\n m(i, j, k) = min(m(i, j, k), solve(i, l, k) + c(t))\n end if\n end do\n res = m(i, j, k)\n end\nend program making_palindrome", "language": "Fortran", "metadata": {"date": 1597615443, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02587.html", "problem_id": "p02587", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02587/input.txt", "sample_output_relpath": "derived/input_output/data/p02587/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02587/Fortran/s016994117.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s016994117", "user_id": "u506403362"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program making_palindrome\n implicit none\n integer(8), parameter :: inf = 1e18\n integer :: n, i\n character(20) :: s(50, 2) = ''\n integer(8) :: c(50) = 0, m(50, 21, 2) = 0, x = inf\n logical :: u(50, 21, 2) = .false.\n read(*,*) n\n do i = 1, n\n read(*,*) s(i, 1), c(i)\n s(i, 2) = reverse(s(i, 1)(1:len_trim(s(i, 1))))\n end do\n do i = 1, n\n x = min(x, solve(i, 1, 1) + c(i))\n end do\n write(*,'(i0)') merge(x, -1_8, x < inf)\ncontains\n function reverse(s) result(res)\n character(*), intent(in) :: s\n character(len_trim(s)) :: res\n integer :: n, i\n n = len_trim(s)\n do i = 1, n\n res(i:i) = s(n - i + 1:n - i + 1)\n end do\n end\n recursive integer(8) function solve(i, j, k) result(res)\n integer, intent(in) :: i, j, k\n integer :: l, r, t\n logical :: f\n res = m(i, j, k)\n if (u(i, j, k)) return\n u(i, j, k) = .true.\n m(i, j, k) = inf\n l = j\n r = len_trim(s(i, k))\n f = .true.\n do while (l < r)\n if (s(i, k)(l:l) /= s(i, k)(r:r)) then\n f = .false.\n exit\n end if\n l = l + 1\n r = r - 1\n end do\n if (f) then\n m(i, j, k) = 0\n res = 0\n return\n end if\n do t = 1, n\n l = j\n r = 1\n do while (l <= len_trim(s(i, k)) .and. r <= len_trim(s(t, 3 - k)))\n if (s(i, k)(l:l) /= s(t, 3 - k)(r:r)) exit\n l = l + 1\n r = r + 1\n end do\n if (l == len_trim(s(i, k)) + 1) then\n m(i, j, k) = min(m(i, j, k), solve(t, r, 3 - k) + c(t))\n end if\n if (r == len_trim(s(t, 3 - k)) + 1) then\n m(i, j, k) = min(m(i, j, k), solve(i, l, k) + c(t))\n end if\n end do\n res = m(i, j, k)\n end\nend program making_palindrome", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have N strings of lowercase English letters: S_1, S_2, \\cdots, S_N.\n\nTakahashi wants to make a string that is a palindrome by choosing one or more of these strings - the same string can be chosen more than once - and concatenating them in some order of his choice.\n\nThe cost of using the string S_i once is C_i, and the cost of using it multiple times is C_i multiplied by that number of times.\n\nFind the minimum total cost needed to choose strings so that Takahashi can make a palindrome.\n\nIf there is no choice of strings in which he can make a palindrome, print -1.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq |S_i| \\leq 20\n\nS_i consists of lowercase English letters.\n\n1 \\leq C_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 C_1\nS_2 C_2\n:\nS_N C_N\n\nOutput\n\nPrint the minimum total cost needed to choose strings so that Takahashi can make a palindrome, or -1 if there is no such choice.\n\nSample Input 1\n\n3\nba 3\nabc 4\ncbaa 5\n\nSample Output 1\n\n7\n\nWe have ba, abc, and cbaa.\n\nFor example, we can use ba once and abc once for a cost of 7, then concatenate them in the order abc, ba to make a palindrome.\nAlso, we can use abc once and cbaa once for a cost of 9, then concatenate them in the order cbaa, abc to make a palindrome.\n\nWe cannot make a palindrome for a cost less than 7, so we should print 7.\n\nSample Input 2\n\n2\nabcab 5\ncba 3\n\nSample Output 2\n\n11\n\nWe can choose abcab once and cba twice, then concatenate them in the order abcab, cba, cba to make a palindrome for a cost of 11.\n\nSample Input 3\n\n4\nab 5\ncba 3\na 12\nab 10\n\nSample Output 3\n\n8\n\nWe can choose a once, which is already a palindrome, but it is cheaper to concatenate ab and cba.\n\nSample Input 4\n\n2\nabc 1\nab 2\n\nSample Output 4\n\n-1\n\nWe cannot make a palindrome, so we should print -1.", "sample_input": "3\nba 3\nabc 4\ncbaa 5\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02587", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have N strings of lowercase English letters: S_1, S_2, \\cdots, S_N.\n\nTakahashi wants to make a string that is a palindrome by choosing one or more of these strings - the same string can be chosen more than once - and concatenating them in some order of his choice.\n\nThe cost of using the string S_i once is C_i, and the cost of using it multiple times is C_i multiplied by that number of times.\n\nFind the minimum total cost needed to choose strings so that Takahashi can make a palindrome.\n\nIf there is no choice of strings in which he can make a palindrome, print -1.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq |S_i| \\leq 20\n\nS_i consists of lowercase English letters.\n\n1 \\leq C_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 C_1\nS_2 C_2\n:\nS_N C_N\n\nOutput\n\nPrint the minimum total cost needed to choose strings so that Takahashi can make a palindrome, or -1 if there is no such choice.\n\nSample Input 1\n\n3\nba 3\nabc 4\ncbaa 5\n\nSample Output 1\n\n7\n\nWe have ba, abc, and cbaa.\n\nFor example, we can use ba once and abc once for a cost of 7, then concatenate them in the order abc, ba to make a palindrome.\nAlso, we can use abc once and cbaa once for a cost of 9, then concatenate them in the order cbaa, abc to make a palindrome.\n\nWe cannot make a palindrome for a cost less than 7, so we should print 7.\n\nSample Input 2\n\n2\nabcab 5\ncba 3\n\nSample Output 2\n\n11\n\nWe can choose abcab once and cba twice, then concatenate them in the order abcab, cba, cba to make a palindrome for a cost of 11.\n\nSample Input 3\n\n4\nab 5\ncba 3\na 12\nab 10\n\nSample Output 3\n\n8\n\nWe can choose a once, which is already a palindrome, but it is cheaper to concatenate ab and cba.\n\nSample Input 4\n\n2\nabc 1\nab 2\n\nSample Output 4\n\n-1\n\nWe cannot make a palindrome, so we should print -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1692, "cpu_time_ms": 13, "memory_kb": 2932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s726377526", "group_id": "codeNet:p02588", "input_text": "program abc34\n implicit none\n integer::N,ia,ib,ic,c=0\n integer,parameter::srk=selected_real_kind(16)\n real(srk),allocatable::a(:)\n read(*,*)N\n allocate(a(N))\n do ia=1,N\n read(*,*)a(ia)\n end do\n do ib=1,N-1\n do ic=ib+1,N\n if(a(ib)*a(ic)==floor(a(ib)*a(ic)))then\n c=c+1\n end if\n end do\n end do\n print'(i0)',c\n deallocate(a)\nend program abc34", "language": "Fortran", "metadata": {"date": 1597022829, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02588.html", "problem_id": "p02588", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02588/input.txt", "sample_output_relpath": "derived/input_output/data/p02588/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02588/Fortran/s726377526.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s726377526", "user_id": "u897889420"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program abc34\n implicit none\n integer::N,ia,ib,ic,c=0\n integer,parameter::srk=selected_real_kind(16)\n real(srk),allocatable::a(:)\n read(*,*)N\n allocate(a(N))\n do ia=1,N\n read(*,*)a(ia)\n end do\n do ib=1,N-1\n do ic=ib+1,N\n if(a(ib)*a(ic)==floor(a(ib)*a(ic)))then\n c=c+1\n end if\n end do\n end do\n print'(i0)',c\n deallocate(a)\nend program abc34", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N real values A_1, A_2, \\ldots, A_N.\nCompute the number of pairs of indices (i, j)\nsuch that i < j and the product A_i \\cdot A_j is integer.\n\nConstraints\n\n2 \\leq N \\leq 200\\,000\n\n0 < A_i < 10^4\n\nA_i is given with at most 9 digits after the decimal.\n\nInput\n\nInput is given from Standard Input in the following format.\n\nN\nA_1\nA_2\n\\vdots\nA_N\n\nOutput\n\nPrint the number of pairs with integer product A_i \\cdot A_j (and i < j).\n\nSample Input 1\n\n5\n7.5\n2.4\n17.000000001\n17\n16.000000000\n\nSample Output 1\n\n3\n\nThere are 3 pairs with integer product:\n\n7.5 \\cdot 2.4 = 18\n\n7.5 \\cdot 16 = 120\n\n17 \\cdot 16 = 272\n\nSample Input 2\n\n11\n0.9\n1\n1\n1.25\n2.30000\n5\n70\n0.000000001\n9999.999999999\n0.999999999\n1.000000001\n\nSample Output 2\n\n8", "sample_input": "5\n7.5\n2.4\n17.000000001\n17\n16.000000000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02588", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N real values A_1, A_2, \\ldots, A_N.\nCompute the number of pairs of indices (i, j)\nsuch that i < j and the product A_i \\cdot A_j is integer.\n\nConstraints\n\n2 \\leq N \\leq 200\\,000\n\n0 < A_i < 10^4\n\nA_i is given with at most 9 digits after the decimal.\n\nInput\n\nInput is given from Standard Input in the following format.\n\nN\nA_1\nA_2\n\\vdots\nA_N\n\nOutput\n\nPrint the number of pairs with integer product A_i \\cdot A_j (and i < j).\n\nSample Input 1\n\n5\n7.5\n2.4\n17.000000001\n17\n16.000000000\n\nSample Output 1\n\n3\n\nThere are 3 pairs with integer product:\n\n7.5 \\cdot 2.4 = 18\n\n7.5 \\cdot 16 = 120\n\n17 \\cdot 16 = 272\n\nSample Input 2\n\n11\n0.9\n1\n1\n1.25\n2.30000\n5\n70\n0.000000001\n9999.999999999\n0.999999999\n1.000000001\n\nSample Output 2\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 349, "cpu_time_ms": 2205, "memory_kb": 5804}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s265386702", "group_id": "codeNet:p02594", "input_text": "program AtCoder\nimplicit none\ninteger x, res\ncharacter a*4, b*3\na = \"Yes\"\nb = \"No\"\nread *, x\nif (x >= 30) then\nprint *, a\nelse\nprint *, b\nend if\nend program AtCoder", "language": "Fortran", "metadata": {"date": 1596488678, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Fortran/s265386702.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s265386702", "user_id": "u892305365"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "program AtCoder\nimplicit none\ninteger x, res\ncharacter a*4, b*3\na = \"Yes\"\nb = \"No\"\nread *, x\nif (x >= 30) then\nprint *, a\nelse\nprint *, b\nend if\nend program AtCoder", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 164, "cpu_time_ms": 14, "memory_kb": 2920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s820983949", "group_id": "codeNet:p02594", "input_text": "program main \n implicit none\n integer::x\n read*,x\n\n if(x>=30) then\n print*,'Yes'\n else\n print*,'No'\n end if\n\nend program main", "language": "Fortran", "metadata": {"date": 1596416654, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Fortran/s820983949.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s820983949", "user_id": "u882765852"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "program main \n implicit none\n integer::x\n read*,x\n\n if(x>=30) then\n print*,'Yes'\n else\n print*,'No'\n end if\n\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 157, "cpu_time_ms": 12, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s995945648", "group_id": "codeNet:p02594", "input_text": "program answer\n implicit none\n integer :: X\n read(*,*) X\n if(X>=30) then\n write(*,*) 'Yes'\n else\n write(*,*) 'No'\n end if\n\n stop\n end program answer", "language": "Fortran", "metadata": {"date": 1596416490, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Fortran/s995945648.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s995945648", "user_id": "u873780029"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "program answer\n implicit none\n integer :: X\n read(*,*) X\n if(X>=30) then\n write(*,*) 'Yes'\n else\n write(*,*) 'No'\n end if\n\n stop\n end program answer", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 163, "cpu_time_ms": 12, "memory_kb": 2796}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s417893541", "group_id": "codeNet:p02594", "input_text": " PROGRAM piyo\n IMPLICIT NONE\n INTEGER,PARAMETER :: p = 16\n integer(p) :: x\n read*,x\n \n if( x>=30 )then\n print*,'Yes'\n else\n print*,'No'\n end if\n \n \n \n \n stop\n !debugg\n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1596416479, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02594.html", "problem_id": "p02594", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02594/input.txt", "sample_output_relpath": "derived/input_output/data/p02594/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02594/Fortran/s417893541.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s417893541", "user_id": "u171356453"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": " PROGRAM piyo\n IMPLICIT NONE\n INTEGER,PARAMETER :: p = 16\n integer(p) :: x\n read*,x\n \n if( x>=30 )then\n print*,'Yes'\n else\n print*,'No'\n end if\n \n \n \n \n stop\n !debugg\n \n \n \n END PROGRAM", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "sample_input": "25\n"}, "reference_outputs": ["No\n"], "source_document_id": "p02594", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will turn on the air conditioner if, and only if, the temperature of the room is 30 degrees Celsius or above.\n\nThe current temperature of the room is X degrees Celsius. Will you turn on the air conditioner?\n\nConstraints\n\n-40 \\leq X \\leq 40\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint Yes if you will turn on the air conditioner; print No otherwise.\n\nSample Input 1\n\n25\n\nSample Output 1\n\nNo\n\nSample Input 2\n\n30\n\nSample Output 2\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 294, "cpu_time_ms": 11, "memory_kb": 2904}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s055433408", "group_id": "codeNet:p02595", "input_text": "program distance\n integer :: n, d, i\n integer :: ans = 0\n integer(8), allocatable :: x(:)\n integer(8), allocatable :: y(:)\n\n read *, n, d\n allocate(x(n))\n allocate(y(n))\n do i = 1, n\n read *, x(i), y(i)\n if(real(d) >= sqrt(real((x(i)**2)+(y(i)**2))))then\n ans = ans+1\n end if\n end do\n print *, ans\nend program", "language": "Fortran", "metadata": {"date": 1597952379, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02595.html", "problem_id": "p02595", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02595/input.txt", "sample_output_relpath": "derived/input_output/data/p02595/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02595/Fortran/s055433408.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s055433408", "user_id": "u622206408"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program distance\n integer :: n, d, i\n integer :: ans = 0\n integer(8), allocatable :: x(:)\n integer(8), allocatable :: y(:)\n\n read *, n, d\n allocate(x(n))\n allocate(y(n))\n do i = 1, n\n read *, x(i), y(i)\n if(real(d) >= sqrt(real((x(i)**2)+(y(i)**2))))then\n ans = ans+1\n end if\n end do\n print *, ans\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "sample_input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02595", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 371, "cpu_time_ms": 113, "memory_kb": 6060}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s721657641", "group_id": "codeNet:p02595", "input_text": "program distance\n integer :: n, d, i\n integer :: ans = 0\n integer, allocatable :: x(:)\n integer, allocatable :: y(:)\n\n read *, n, d\n allocate(x(n))\n allocate(y(n))\n print *, \"座標を入力\"\n do i = 1, n\n read *, x(i), y(i)\n if(real(d) >= sqrt(real((x(i))**2+(y(i))**2)))then\n ans = ans+1\n end if\n end do\n print *, ans\nend program\n", "language": "Fortran", "metadata": {"date": 1597949933, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02595.html", "problem_id": "p02595", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02595/input.txt", "sample_output_relpath": "derived/input_output/data/p02595/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02595/Fortran/s721657641.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s721657641", "user_id": "u622206408"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program distance\n integer :: n, d, i\n integer :: ans = 0\n integer, allocatable :: x(:)\n integer, allocatable :: y(:)\n\n read *, n, d\n allocate(x(n))\n allocate(y(n))\n print *, \"座標を入力\"\n do i = 1, n\n read *, x(i), y(i)\n if(real(d) >= sqrt(real((x(i))**2+(y(i))**2)))then\n ans = ans+1\n end if\n end do\n print *, ans\nend program\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "sample_input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02595", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 397, "cpu_time_ms": 112, "memory_kb": 4436}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s775714976", "group_id": "codeNet:p02595", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,d,x,y,d2,i,ans\n integer(int64), allocatable:: dist(:)\n\n read*, n,d\n allocate(dist(n))\n\n do i=1,n\n read*, x,y\n dist(i) = x*x + y*y\n end do\n\n d2 = d*d\n ans = 0\n do i=1,n\n if (dist(i) <= d2) ans=ans+1\n end do\n print'(i0)', ans\nend program main", "language": "Fortran", "metadata": {"date": 1596977991, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02595.html", "problem_id": "p02595", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02595/input.txt", "sample_output_relpath": "derived/input_output/data/p02595/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02595/Fortran/s775714976.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s775714976", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,d,x,y,d2,i,ans\n integer(int64), allocatable:: dist(:)\n\n read*, n,d\n allocate(dist(n))\n\n do i=1,n\n read*, x,y\n dist(i) = x*x + y*y\n end do\n\n d2 = d*d\n ans = 0\n do i=1,n\n if (dist(i) <= d2) ans=ans+1\n end do\n print'(i0)', ans\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "sample_input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02595", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 382, "cpu_time_ms": 106, "memory_kb": 4444}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s208886653", "group_id": "codeNet:p02595", "input_text": "program abc29\n implicit none\n integer(8)::N,D,i,ia,c=0\n integer(8),allocatable::a(:),b(:)\n read(*,*)N,D\n allocate(a(N),b(N))\n do i=1,N\n read(*,*)a(i),b(i)\n end do\n do ia=1,N\n if(a(ia)**2+b(ia)**2<=D**2)then\n c=c+1\n end if\n end do\n print'(i0)',c\n deallocate(a,b)\nend program abc29", "language": "Fortran", "metadata": {"date": 1596418025, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02595.html", "problem_id": "p02595", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02595/input.txt", "sample_output_relpath": "derived/input_output/data/p02595/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02595/Fortran/s208886653.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s208886653", "user_id": "u897889420"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program abc29\n implicit none\n integer(8)::N,D,i,ia,c=0\n integer(8),allocatable::a(:),b(:)\n read(*,*)N,D\n allocate(a(N),b(N))\n do i=1,N\n read(*,*)a(i),b(i)\n end do\n do ia=1,N\n if(a(ia)**2+b(ia)**2<=D**2)then\n c=c+1\n end if\n end do\n print'(i0)',c\n deallocate(a,b)\nend program abc29", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "sample_input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02595", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 284, "cpu_time_ms": 128, "memory_kb": 5644}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s991779033", "group_id": "codeNet:p02595", "input_text": "program b174\n\nimplicit none\ninteger(16) :: n, d, i, a\ninteger(16), allocatable :: x(:), y(:)\n\na = 0\n\nread *, n, d\n\nallocate(x(1:n))\nallocate(y(1:n))\n\ndo i = 1, n\n read *, x(i), y(i)\n\nif (x(i) ** 2 + y(i) ** 2 <= d ** 2) then\n a = a + 1\nend if\n\n!print *, x(i) ** 2 + y(i) ** 2\n\nend do\n\nprint *, a\n\nend program b174", "language": "Fortran", "metadata": {"date": 1596417094, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02595.html", "problem_id": "p02595", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02595/input.txt", "sample_output_relpath": "derived/input_output/data/p02595/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02595/Fortran/s991779033.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s991779033", "user_id": "u644436095"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program b174\n\nimplicit none\ninteger(16) :: n, d, i, a\ninteger(16), allocatable :: x(:), y(:)\n\na = 0\n\nread *, n, d\n\nallocate(x(1:n))\nallocate(y(1:n))\n\ndo i = 1, n\n read *, x(i), y(i)\n\nif (x(i) ** 2 + y(i) ** 2 <= d ** 2) then\n a = a + 1\nend if\n\n!print *, x(i) ** 2 + y(i) ** 2\n\nend do\n\nprint *, a\n\nend program b174", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "sample_input": "4 5\n0 5\n-2 4\n3 4\n4 -4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02595", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N points in the two-dimensional plane. The coordinates of the i-th point are (X_i,Y_i).\n\nAmong them, we are looking for the points such that the distance from the origin is at most D. How many such points are there?\n\nWe remind you that the distance between the origin and the point (p, q) can be represented as \\sqrt{p^2+q^2}.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n0 \\leq D \\leq 2\\times 10^5\n\n|X_i|,|Y_i| \\leq 2\\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_1 Y_1\n\\vdots\nX_N Y_N\n\nOutput\n\nPrint an integer representing the number of points such that the distance from the origin is at most D.\n\nSample Input 1\n\n4 5\n0 5\n-2 4\n3 4\n4 -4\n\nSample Output 1\n\n3\n\nThe distance between the origin and each of the given points is as follows:\n\n\\sqrt{0^2+5^2}=5\n\n\\sqrt{(-2)^2+4^2}=4.472\\ldots\n\n\\sqrt{3^2+4^2}=5\n\n\\sqrt{4^2+(-4)^2}=5.656\\ldots\n\nThus, we have three points such that the distance from the origin is at most 5.\n\nSample Input 2\n\n12 3\n1 1\n1 1\n1 1\n1 1\n1 2\n1 3\n2 1\n2 2\n2 3\n3 1\n3 2\n3 3\n\nSample Output 2\n\n7\n\nMultiple points may exist at the same coordinates.\n\nSample Input 3\n\n20 100000\n14309 -32939\n-56855 100340\n151364 25430\n103789 -113141\n147404 -136977\n-37006 -30929\n188810 -49557\n13419 70401\n-88280 165170\n-196399 137941\n-176527 -61904\n46659 115261\n-153551 114185\n98784 -6820\n94111 -86268\n-30401 61477\n-55056 7872\n5901 -163796\n138819 -185986\n-69848 -96669\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 313, "cpu_time_ms": 158, "memory_kb": 9124}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s115039506", "group_id": "codeNet:p02596", "input_text": "program baisuu_search\n integer(8) :: K, i\n integer(8) :: c = 0\n logical :: f = .false.\n\n read *, K\n do i = 7 ,2**15-1,i*10+1\n c = c + 1\n if(mod(i, K) .eq. 0)then\n f = .true.\n end if\n if(f .eqv. .true.)exit\n end do\n if(f .eqv. .true.)then\n print *, c\n else\n print *, '-1'\n end if\nend program", "language": "Fortran", "metadata": {"date": 1597956172, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02596.html", "problem_id": "p02596", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02596/input.txt", "sample_output_relpath": "derived/input_output/data/p02596/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02596/Fortran/s115039506.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s115039506", "user_id": "u622206408"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program baisuu_search\n integer(8) :: K, i\n integer(8) :: c = 0\n logical :: f = .false.\n\n read *, K\n do i = 7 ,2**15-1,i*10+1\n c = c + 1\n if(mod(i, K) .eq. 0)then\n f = .true.\n end if\n if(f .eqv. .true.)exit\n end do\n if(f .eqv. .true.)then\n print *, c\n else\n print *, '-1'\n end if\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi loves the number 7 and multiples of K.\n\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\n\nIf the sequence contains no multiples of K, print -1 instead.\n\nConstraints\n\n1 \\leq K \\leq 10^6\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint an integer representing the position of the first occurrence of a multiple of K. (For example, if the first occurrence is the fourth element of the sequence, print 4.)\n\nSample Input 1\n\n101\n\nSample Output 1\n\n4\n\nNone of 7, 77, and 777 is a multiple of 101, but 7777 is.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1\n\nAll elements in the sequence are odd numbers; there are no multiples of 2.\n\nSample Input 3\n\n999983\n\nSample Output 3\n\n999982", "sample_input": "101\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02596", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi loves the number 7 and multiples of K.\n\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\n\nIf the sequence contains no multiples of K, print -1 instead.\n\nConstraints\n\n1 \\leq K \\leq 10^6\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint an integer representing the position of the first occurrence of a multiple of K. (For example, if the first occurrence is the fourth element of the sequence, print 4.)\n\nSample Input 1\n\n101\n\nSample Output 1\n\n4\n\nNone of 7, 77, and 777 is a multiple of 101, but 7777 is.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1\n\nAll elements in the sequence are odd numbers; there are no multiples of 2.\n\nSample Input 3\n\n999983\n\nSample Output 3\n\n999982", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 370, "cpu_time_ms": 10, "memory_kb": 2860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s644212604", "group_id": "codeNet:p02596", "input_text": "program answer\n implicit none\n integer(8) :: i, K, a\n read(*,*) k\n\n if(k==1) then\n write(*,*) '1'\n stop\n else if(k==3) then\n write(*,*) '3'\n stop\n else if(mod(k,5)==0) then\n write(*,*) '-1'\n stop\n else if(k==7) then\n write(*,*) '1'\n stop\n else if(mod(k,2)==0) then\n write(*,*) '-1'\n stop\n end if\n do i = 1, 12\n if(mod(7*(10**i-1)/9,K)==0) then\n write(*,*) i\n stop\n end if\n end do\n\n a=0\n do i = 3, int(sqrt(dble(K)))+1, 2\n if(mod(K,i)==0) then\n\ta=i\n exit\n end if\n end do\n\n if(a==0) then\n write(*,*) k-1\n stop\n end if\n stop\n end program answer\n", "language": "Fortran", "metadata": {"date": 1596422211, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02596.html", "problem_id": "p02596", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02596/input.txt", "sample_output_relpath": "derived/input_output/data/p02596/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02596/Fortran/s644212604.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s644212604", "user_id": "u873780029"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program answer\n implicit none\n integer(8) :: i, K, a\n read(*,*) k\n\n if(k==1) then\n write(*,*) '1'\n stop\n else if(k==3) then\n write(*,*) '3'\n stop\n else if(mod(k,5)==0) then\n write(*,*) '-1'\n stop\n else if(k==7) then\n write(*,*) '1'\n stop\n else if(mod(k,2)==0) then\n write(*,*) '-1'\n stop\n end if\n do i = 1, 12\n if(mod(7*(10**i-1)/9,K)==0) then\n write(*,*) i\n stop\n end if\n end do\n\n a=0\n do i = 3, int(sqrt(dble(K)))+1, 2\n if(mod(K,i)==0) then\n\ta=i\n exit\n end if\n end do\n\n if(a==0) then\n write(*,*) k-1\n stop\n end if\n stop\n end program answer\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi loves the number 7 and multiples of K.\n\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\n\nIf the sequence contains no multiples of K, print -1 instead.\n\nConstraints\n\n1 \\leq K \\leq 10^6\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint an integer representing the position of the first occurrence of a multiple of K. (For example, if the first occurrence is the fourth element of the sequence, print 4.)\n\nSample Input 1\n\n101\n\nSample Output 1\n\n4\n\nNone of 7, 77, and 777 is a multiple of 101, but 7777 is.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1\n\nAll elements in the sequence are odd numbers; there are no multiples of 2.\n\nSample Input 3\n\n999983\n\nSample Output 3\n\n999982", "sample_input": "101\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02596", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi loves the number 7 and multiples of K.\n\nWhere is the first occurrence of a multiple of K in the sequence 7,77,777,\\ldots? (Also see Output and Sample Input/Output below.)\n\nIf the sequence contains no multiples of K, print -1 instead.\n\nConstraints\n\n1 \\leq K \\leq 10^6\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint an integer representing the position of the first occurrence of a multiple of K. (For example, if the first occurrence is the fourth element of the sequence, print 4.)\n\nSample Input 1\n\n101\n\nSample Output 1\n\n4\n\nNone of 7, 77, and 777 is a multiple of 101, but 7777 is.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1\n\nAll elements in the sequence are odd numbers; there are no multiples of 2.\n\nSample Input 3\n\n999983\n\nSample Output 3\n\n999982", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 642, "cpu_time_ms": 13, "memory_kb": 2912}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s906621485", "group_id": "codeNet:p02597", "input_text": "program alter_altar\n character(200001) :: c\n integer x, y, n, i, j\n integer :: r(100001)\n integer :: w(100001)\n read *, n\n read *, c\n do i = 1, n\n if(i == 1)then\n w(i) = index(c,'W')\n r(i) = index(c,'R',back=.true.)\n if(x == 0 .or. y == 0 .or. x > y)exit\n else\n w(i) = index(c(w(i):),'W')\n r(i) = index(c(r(i):),'R',back=.true.)\n if(x == 0 .or. y == 0 .or. x > y)exit\n end if\n end do\n do j = 1, i\n c(w(j):w(j)) = 'R'\n c(r(j):r(j)) = 'W'\n end do\n print *, i-1\nend program", "language": "Fortran", "metadata": {"date": 1598036909, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02597.html", "problem_id": "p02597", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02597/input.txt", "sample_output_relpath": "derived/input_output/data/p02597/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02597/Fortran/s906621485.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s906621485", "user_id": "u622206408"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program alter_altar\n character(200001) :: c\n integer x, y, n, i, j\n integer :: r(100001)\n integer :: w(100001)\n read *, n\n read *, c\n do i = 1, n\n if(i == 1)then\n w(i) = index(c,'W')\n r(i) = index(c,'R',back=.true.)\n if(x == 0 .or. y == 0 .or. x > y)exit\n else\n w(i) = index(c(w(i):),'W')\n r(i) = index(c(r(i):),'R',back=.true.)\n if(x == 0 .or. y == 0 .or. x > y)exit\n end if\n end do\n do j = 1, i\n c(w(j):w(j)) = 'R'\n c(r(j):r(j)) = 'W'\n end do\n print *, i-1\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "sample_input": "4\nWWRR\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02597", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 604, "cpu_time_ms": 10, "memory_kb": 3212}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s605743439", "group_id": "codeNet:p02597", "input_text": "program alter_altar\n character(200001) :: c\n integer i, x, y, n\n read *, n\n read *, c\n do i = 1, n\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n c(x:x) = 'R'\n c(y:y) = 'W'\n if(x == 0 .or. y == 0 .or. x > y)exit\n end do\n print *, i\nend program", "language": "Fortran", "metadata": {"date": 1598034595, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02597.html", "problem_id": "p02597", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02597/input.txt", "sample_output_relpath": "derived/input_output/data/p02597/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02597/Fortran/s605743439.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s605743439", "user_id": "u622206408"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program alter_altar\n character(200001) :: c\n integer i, x, y, n\n read *, n\n read *, c\n do i = 1, n\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n c(x:x) = 'R'\n c(y:y) = 'W'\n if(x == 0 .or. y == 0 .or. x > y)exit\n end do\n print *, i\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "sample_input": "4\nWWRR\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02597", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 301, "cpu_time_ms": 2205, "memory_kb": 3300}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s546333559", "group_id": "codeNet:p02597", "input_text": "program alter_altar\n character(200001) :: c\n integer j, i, x, y, n\n integer :: r(200001) = 0\n integer :: w(200001) = 0\n read *, n\n read *, c\n do i = 1, n\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n c(x:x) = 'R'\n c(y:y) = 'W'\n if(x == 0 .or. y == 0 .or. x > y)exit\n end do\n print *, i-1\nend program", "language": "Fortran", "metadata": {"date": 1598034019, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02597.html", "problem_id": "p02597", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02597/input.txt", "sample_output_relpath": "derived/input_output/data/p02597/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02597/Fortran/s546333559.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s546333559", "user_id": "u622206408"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program alter_altar\n character(200001) :: c\n integer j, i, x, y, n\n integer :: r(200001) = 0\n integer :: w(200001) = 0\n read *, n\n read *, c\n do i = 1, n\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n c(x:x) = 'R'\n c(y:y) = 'W'\n if(x == 0 .or. y == 0 .or. x > y)exit\n end do\n print *, i-1\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "sample_input": "4\nWWRR\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02597", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 364, "cpu_time_ms": 2205, "memory_kb": 3296}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s070804613", "group_id": "codeNet:p02597", "input_text": "program alter_altar\n character(200001) :: c\n integer i, x, y\n integer :: k = 0\n integer :: n = 0\n\n read *, n\n read *, c\n\n do i = 1, n\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n if(x == 0 .or. y == 0)exit\n if(x < y)then\n c(x:x) = 'R'\n c(y:y) = 'W'\n k = k + 1\n end if\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n if(x < y)then\n c(x:x) = 'R'\n k = k + 1\n end if\n x = index(c,'W')\n y = index(c,'R', back=.true.)\n if(x > y)exit\n end do\n print *, k\nend program", "language": "Fortran", "metadata": {"date": 1598021595, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02597.html", "problem_id": "p02597", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02597/input.txt", "sample_output_relpath": "derived/input_output/data/p02597/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02597/Fortran/s070804613.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s070804613", "user_id": "u622206408"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program alter_altar\n character(200001) :: c\n integer i, x, y\n integer :: k = 0\n integer :: n = 0\n\n read *, n\n read *, c\n\n do i = 1, n\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n if(x == 0 .or. y == 0)exit\n if(x < y)then\n c(x:x) = 'R'\n c(y:y) = 'W'\n k = k + 1\n end if\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n if(x < y)then\n c(x:x) = 'R'\n k = k + 1\n end if\n x = index(c,'W')\n y = index(c,'R', back=.true.)\n if(x > y)exit\n end do\n print *, k\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "sample_input": "4\nWWRR\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02597", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 630, "cpu_time_ms": 2205, "memory_kb": 3296}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s563607611", "group_id": "codeNet:p02597", "input_text": "program alter_altar\n character(200001) :: c\n integer i, x, y\n integer :: k = 0\n integer :: n = 0\n\n read *, n\n read *, c\n\n do i = 1, n\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n if(x == 0)exit\n if(x < y)then\n c(x:x) = 'R'\n c(y:y) = 'W'\n k = k + 1\n end if\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n if(x < y)then\n c(x:x) = 'R'\n k = k + 1\n end if\n x = index(c,'W', back=.true.)\n y = index(c,'R')\n if(x > y)exit\n end do\n print *, k\nend program", "language": "Fortran", "metadata": {"date": 1598020907, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02597.html", "problem_id": "p02597", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02597/input.txt", "sample_output_relpath": "derived/input_output/data/p02597/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02597/Fortran/s563607611.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s563607611", "user_id": "u622206408"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program alter_altar\n character(200001) :: c\n integer i, x, y\n integer :: k = 0\n integer :: n = 0\n\n read *, n\n read *, c\n\n do i = 1, n\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n if(x == 0)exit\n if(x < y)then\n c(x:x) = 'R'\n c(y:y) = 'W'\n k = k + 1\n end if\n x = index(c,'W')\n y = index(c,'R',back=.true.)\n if(x < y)then\n c(x:x) = 'R'\n k = k + 1\n end if\n x = index(c,'W', back=.true.)\n y = index(c,'R')\n if(x > y)exit\n end do\n print *, k\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "sample_input": "4\nWWRR\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02597", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 618, "cpu_time_ms": 12, "memory_kb": 3292}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s136800735", "group_id": "codeNet:p02597", "input_text": "program ABC174D\n implicit none\n integer(8)::N,i,Wc(0:200000),Rc(0:200000),ans=2000000\n character(200000)::C\n read*,N,C\n Wc(0)=0\n Rc(0)=0\n do i=1,N\n if(C(i:i)==\"R\")then\n Rc(i)=Rc(i-1)+1\n Wc(i)=Wc(i-1)\n else\n Rc(i)=Rc(i-1)\n Wc(i)=Wc(i-1)+1\n end if\n end do\n\n do i=0,N\n ans=min(ans,max(Wc(i)-Wc(0),Rc(N)-Rc(i+1)))\n end do\n print'(i0)',ans\nend program ABC174D", "language": "Fortran", "metadata": {"date": 1596732186, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02597.html", "problem_id": "p02597", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02597/input.txt", "sample_output_relpath": "derived/input_output/data/p02597/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02597/Fortran/s136800735.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s136800735", "user_id": "u414699019"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ABC174D\n implicit none\n integer(8)::N,i,Wc(0:200000),Rc(0:200000),ans=2000000\n character(200000)::C\n read*,N,C\n Wc(0)=0\n Rc(0)=0\n do i=1,N\n if(C(i:i)==\"R\")then\n Rc(i)=Rc(i-1)+1\n Wc(i)=Wc(i-1)\n else\n Rc(i)=Rc(i-1)\n Wc(i)=Wc(i-1)+1\n end if\n end do\n\n do i=0,N\n ans=min(ans,max(Wc(i)-Wc(0),Rc(N)-Rc(i+1)))\n end do\n print'(i0)',ans\nend program ABC174D", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "sample_input": "4\nWWRR\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02597", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn altar enshrines N stones arranged in a row from left to right. The color of the i-th stone from the left (1 \\leq i \\leq N) is given to you as a character c_i; R stands for red and W stands for white.\n\nYou can do the following two kinds of operations any number of times in any order:\n\nChoose two stones (not necessarily adjacent) and swap them.\n\nChoose one stone and change its color (from red to white and vice versa).\n\nAccording to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nc_i is R or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nc_{1}c_{2}...c_{N}\n\nOutput\n\nPrint an integer representing the minimum number of operations needed.\n\nSample Input 1\n\n4\nWWRR\n\nSample Output 1\n\n2\n\nFor example, the two operations below will achieve the objective.\n\nSwap the 1-st and 3-rd stones from the left, resulting in RWWR.\n\nChange the color of the 4-th stone from the left, resulting in RWWW.\n\nSample Input 2\n\n2\nRR\n\nSample Output 2\n\n0\n\nIt can be the case that no operation is needed.\n\nSample Input 3\n\n8\nWRWWRWRR\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 459, "cpu_time_ms": 16, "memory_kb": 6340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s919132622", "group_id": "codeNet:p02599", "input_text": "module mod_wavelet_matrix\n implicit none\n integer, private, parameter :: intkind = 4\n type wavelet_matrix\n integer :: n, m\n integer, private, allocatable :: bit(:, :), order(:), start(:)\n integer(intkind), private, allocatable :: vals(:)\n contains\n procedure :: access => access_to\n procedure :: rank => rank_of\n procedure :: select => select_from\n procedure :: quantile => quantile\n procedure :: range_less => range_less\n procedure :: range_freq => range_freq\n end type\n interface wavelet_matrix\n module procedure :: newwm0\n end interface\n private :: find, lower_bound\ncontains\n type(wavelet_matrix) function newwm0(a) result(res)\n integer(intkind), intent(in) :: a(:)\n integer(intkind) :: maxa, x(size(a)), y(size(a)), z(size(a))\n integer, allocatable :: s(:), t(:), u(:)\n integer :: n, m, nx, ny, i, j\n logical :: flag\n maxa = maxval(a)\n n = size(a)\n m = 8 * intkind - 1\n do while (.not.btest(maxa, m))\n m = m - 1\n end do\n res%n = n\n res%m = m\n allocate(res%bit(0:n, 0:m))\n z = a\n do j = 0, m\n nx = 0\n ny = 0\n do i = 1, n\n flag = btest(z(i), m - j)\n res%bit(i, j) = res%bit(i - 1, j) + merge(1, 0, flag)\n if (flag) then\n ny = ny + 1\n y(ny) = z(i)\n else\n nx = nx + 1\n x(nx) = z(i)\n end if\n end do\n z(1:nx) = x(1:nx)\n z(nx + 1:n) = y(1:ny)\n end do\n nx = n\n n = 1\n do i = 2, nx\n if (z(i) /= z(i - 1)) n = n + 1\n end do\n allocate(s(n), t(n), u(n), res%order(n), res%start(n), res%vals(n))\n u = [(i, i = 1, n)]\n n = 1\n res%start(1) = 1\n do i = 2, nx\n if (z(i) /= z(n)) then\n n = n + 1\n z(n) = z(i)\n res%start(n) = i\n end if\n end do\n do j = 0, m\n nx = 0\n ny = 0\n do i = 1, n\n if (btest(z(i), j)) then\n ny = ny + 1\n y(ny) = z(i)\n t(ny) = u(i)\n else\n nx = nx + 1\n x(nx) = z(i)\n s(nx) = u(i)\n end if\n end do\n z(1:nx) = x(1:nx)\n z(nx + 1:n) = y(1:ny)\n u(1:nx) = s(1:nx)\n u(nx + 1:n) = t(1:ny)\n end do\n res%order = u\n res%vals = z(1:n)\n end\n integer(intkind) function access_to(this, idx) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: idx\n integer :: i, j\n i = idx\n res = 0\n do j = 0, this%m\n if (this%bit(i, j) - this%bit(i - 1, j) == 1) then\n res = ibset(res, this%m - j)\n i = this%bit(i, j) + this%n - this%bit(this%n, j)\n else\n i = i - this%bit(i, j)\n end if\n end do\n end\n integer function find(this, val) result(res)\n type(wavelet_matrix), intent(in) :: this\n integer(intkind) :: val\n integer :: l, r\n l = 0\n r = size(this%vals) + 1\n do while (r - l > 1)\n res = (l + r) / 2\n if (this%vals(res) < val) then\n l = res\n else if (this%vals(res) > val) then\n r = res\n else\n return\n end if\n end do\n res = -1\n end\n integer function lower_bound(n, a, b) result(res)\n integer, intent(in) :: n, a(0:n), b\n integer :: l, r, m\n l = 0\n r = n + 1\n do while (r - l > 1)\n m = (l + r) / 2\n if (a(m) < b) then\n l = m\n else\n r = m\n end if\n end do\n res = r\n end\n integer function rank_of(this, idx, val) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: idx\n integer(intkind), intent(in) :: val\n integer :: i, j, k\n res = 0\n k = find(this, val)\n if (k < 0) return\n k = this%order(k)\n i = idx\n do j = 0, this%m\n if (btest(val, this%m - j)) then\n i = this%bit(i, j) + this%n - this%bit(this%n, j)\n else\n i = i - this%bit(i, j)\n end if\n end do\n res = i - this%start(k) + 1\n end\n integer function select_from(this, ord, val) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: ord\n integer(intkind), intent(in) :: val\n integer :: i, j, k, l\n res = -1\n k = find(this, val)\n if (k < 0) return\n k = this%order(k)\n i = this%start(k) + ord - 1\n if (k == size(this%start)) then\n if (i > this%n) return\n else\n if (i >= this%start(k + 1)) return\n end if\n do j = this%m, 0, -1\n if (btest(val, this%m - j)) then\n i = lower_bound(this%n, this%bit(:, j), i - (this%n - this%bit(this%n, j)))\n else\n i = lower_bound(this%n, [(l - this%bit(l, j), l = 0, this%n)], i)\n end if\n end do\n res = i\n end\n integer(intkind) function quantile(this, a, b, ord) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: a, b, ord\n integer :: l, r, i, j, d\n res = -1\n if (b - a + 1 < ord) return\n l = a\n r = b\n i = ord\n res = 0\n do j = 0, this%m\n d = (r - l + 1) - (this%bit(r, j) - this%bit(l - 1, j))\n if (i > d) then\n res = ibset(res, this%m - j)\n l = this%bit(l - 1, j) + this%n - this%bit(this%n, j) + 1\n r = this%bit(r, j) + this%n - this%bit(this%n, j)\n i = i - d\n else\n l = l - this%bit(l - 1, j)\n r = r - this%bit(r, j)\n end if\n end do\n end\n integer function range_less(this, a, b, val) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: a, b\n integer(intkind), intent(in) :: val\n integer :: l, r, i, j, d\n res = 0\n if (a > b) return\n l = a\n r = b\n do j = 0, this%m\n if (btest(val, this%m - j)) then\n res = res + (r - l + 1) - (this%bit(r, j) - this%bit(l - 1, j))\n l = this%bit(l - 1, j) + this%n - this%bit(this%n, j) + 1\n r = this%bit(r, j) + this%n - this%bit(this%n, j)\n else\n l = l - this%bit(l - 1, j)\n r = r - this%bit(r, j)\n end if\n end do\n end\n integer function range_freq(this, a, b, x, y) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: a, b\n integer(intkind), intent(in) :: x, y\n res = 0\n if (x > y) return\n res = range_less(this, a, b, y + 1) - range_less(this, a, b, x)\n end\nend module mod_wavelet_matrix\nprogram range_set_query\n use mod_wavelet_matrix\n implicit none\n integer :: n, q, l, r, i\n integer, dimension(500000) :: c = 0, a = 0, b = 0\n type(wavelet_matrix) :: wm\n read(*,*) n, q\n read(*,*) c(1:n)\n b(1:n) = n + 1\n do i = 1, n\n a(i) = b(c(i))\n b(c(i)) = i\n end do\n wm = wavelet_matrix(a(1:n))\n do i = 1, q\n read(*,*) l, r\n write(*,'(i0)') r - l + 1 - wm%range_freq(l, r, l, r)\n end do\nend program range_set_query", "language": "Fortran", "metadata": {"date": 1599357434, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02599.html", "problem_id": "p02599", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02599/input.txt", "sample_output_relpath": "derived/input_output/data/p02599/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02599/Fortran/s919132622.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s919132622", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n3\n1\n", "input_to_evaluate": "module mod_wavelet_matrix\n implicit none\n integer, private, parameter :: intkind = 4\n type wavelet_matrix\n integer :: n, m\n integer, private, allocatable :: bit(:, :), order(:), start(:)\n integer(intkind), private, allocatable :: vals(:)\n contains\n procedure :: access => access_to\n procedure :: rank => rank_of\n procedure :: select => select_from\n procedure :: quantile => quantile\n procedure :: range_less => range_less\n procedure :: range_freq => range_freq\n end type\n interface wavelet_matrix\n module procedure :: newwm0\n end interface\n private :: find, lower_bound\ncontains\n type(wavelet_matrix) function newwm0(a) result(res)\n integer(intkind), intent(in) :: a(:)\n integer(intkind) :: maxa, x(size(a)), y(size(a)), z(size(a))\n integer, allocatable :: s(:), t(:), u(:)\n integer :: n, m, nx, ny, i, j\n logical :: flag\n maxa = maxval(a)\n n = size(a)\n m = 8 * intkind - 1\n do while (.not.btest(maxa, m))\n m = m - 1\n end do\n res%n = n\n res%m = m\n allocate(res%bit(0:n, 0:m))\n z = a\n do j = 0, m\n nx = 0\n ny = 0\n do i = 1, n\n flag = btest(z(i), m - j)\n res%bit(i, j) = res%bit(i - 1, j) + merge(1, 0, flag)\n if (flag) then\n ny = ny + 1\n y(ny) = z(i)\n else\n nx = nx + 1\n x(nx) = z(i)\n end if\n end do\n z(1:nx) = x(1:nx)\n z(nx + 1:n) = y(1:ny)\n end do\n nx = n\n n = 1\n do i = 2, nx\n if (z(i) /= z(i - 1)) n = n + 1\n end do\n allocate(s(n), t(n), u(n), res%order(n), res%start(n), res%vals(n))\n u = [(i, i = 1, n)]\n n = 1\n res%start(1) = 1\n do i = 2, nx\n if (z(i) /= z(n)) then\n n = n + 1\n z(n) = z(i)\n res%start(n) = i\n end if\n end do\n do j = 0, m\n nx = 0\n ny = 0\n do i = 1, n\n if (btest(z(i), j)) then\n ny = ny + 1\n y(ny) = z(i)\n t(ny) = u(i)\n else\n nx = nx + 1\n x(nx) = z(i)\n s(nx) = u(i)\n end if\n end do\n z(1:nx) = x(1:nx)\n z(nx + 1:n) = y(1:ny)\n u(1:nx) = s(1:nx)\n u(nx + 1:n) = t(1:ny)\n end do\n res%order = u\n res%vals = z(1:n)\n end\n integer(intkind) function access_to(this, idx) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: idx\n integer :: i, j\n i = idx\n res = 0\n do j = 0, this%m\n if (this%bit(i, j) - this%bit(i - 1, j) == 1) then\n res = ibset(res, this%m - j)\n i = this%bit(i, j) + this%n - this%bit(this%n, j)\n else\n i = i - this%bit(i, j)\n end if\n end do\n end\n integer function find(this, val) result(res)\n type(wavelet_matrix), intent(in) :: this\n integer(intkind) :: val\n integer :: l, r\n l = 0\n r = size(this%vals) + 1\n do while (r - l > 1)\n res = (l + r) / 2\n if (this%vals(res) < val) then\n l = res\n else if (this%vals(res) > val) then\n r = res\n else\n return\n end if\n end do\n res = -1\n end\n integer function lower_bound(n, a, b) result(res)\n integer, intent(in) :: n, a(0:n), b\n integer :: l, r, m\n l = 0\n r = n + 1\n do while (r - l > 1)\n m = (l + r) / 2\n if (a(m) < b) then\n l = m\n else\n r = m\n end if\n end do\n res = r\n end\n integer function rank_of(this, idx, val) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: idx\n integer(intkind), intent(in) :: val\n integer :: i, j, k\n res = 0\n k = find(this, val)\n if (k < 0) return\n k = this%order(k)\n i = idx\n do j = 0, this%m\n if (btest(val, this%m - j)) then\n i = this%bit(i, j) + this%n - this%bit(this%n, j)\n else\n i = i - this%bit(i, j)\n end if\n end do\n res = i - this%start(k) + 1\n end\n integer function select_from(this, ord, val) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: ord\n integer(intkind), intent(in) :: val\n integer :: i, j, k, l\n res = -1\n k = find(this, val)\n if (k < 0) return\n k = this%order(k)\n i = this%start(k) + ord - 1\n if (k == size(this%start)) then\n if (i > this%n) return\n else\n if (i >= this%start(k + 1)) return\n end if\n do j = this%m, 0, -1\n if (btest(val, this%m - j)) then\n i = lower_bound(this%n, this%bit(:, j), i - (this%n - this%bit(this%n, j)))\n else\n i = lower_bound(this%n, [(l - this%bit(l, j), l = 0, this%n)], i)\n end if\n end do\n res = i\n end\n integer(intkind) function quantile(this, a, b, ord) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: a, b, ord\n integer :: l, r, i, j, d\n res = -1\n if (b - a + 1 < ord) return\n l = a\n r = b\n i = ord\n res = 0\n do j = 0, this%m\n d = (r - l + 1) - (this%bit(r, j) - this%bit(l - 1, j))\n if (i > d) then\n res = ibset(res, this%m - j)\n l = this%bit(l - 1, j) + this%n - this%bit(this%n, j) + 1\n r = this%bit(r, j) + this%n - this%bit(this%n, j)\n i = i - d\n else\n l = l - this%bit(l - 1, j)\n r = r - this%bit(r, j)\n end if\n end do\n end\n integer function range_less(this, a, b, val) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: a, b\n integer(intkind), intent(in) :: val\n integer :: l, r, i, j, d\n res = 0\n if (a > b) return\n l = a\n r = b\n do j = 0, this%m\n if (btest(val, this%m - j)) then\n res = res + (r - l + 1) - (this%bit(r, j) - this%bit(l - 1, j))\n l = this%bit(l - 1, j) + this%n - this%bit(this%n, j) + 1\n r = this%bit(r, j) + this%n - this%bit(this%n, j)\n else\n l = l - this%bit(l - 1, j)\n r = r - this%bit(r, j)\n end if\n end do\n end\n integer function range_freq(this, a, b, x, y) result(res)\n class(wavelet_matrix), intent(in) :: this\n integer, intent(in) :: a, b\n integer(intkind), intent(in) :: x, y\n res = 0\n if (x > y) return\n res = range_less(this, a, b, y + 1) - range_less(this, a, b, x)\n end\nend module mod_wavelet_matrix\nprogram range_set_query\n use mod_wavelet_matrix\n implicit none\n integer :: n, q, l, r, i\n integer, dimension(500000) :: c = 0, a = 0, b = 0\n type(wavelet_matrix) :: wm\n read(*,*) n, q\n read(*,*) c(1:n)\n b(1:n) = n + 1\n do i = 1, n\n a(i) = b(c(i))\n b(c(i)) = i\n end do\n wm = wavelet_matrix(a(1:n))\n do i = 1, q\n read(*,*) l, r\n write(*,'(i0)') r - l + 1 - wm%range_freq(l, r, l, r)\n end do\nend program range_set_query", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have N colored balls arranged in a row from left to right; the color of the i-th ball from the left is c_i.\n\nYou are given Q queries. The i-th query is as follows: how many different colors do the l_i-th through r_i-th balls from the left have?\n\nConstraints\n\n1\\leq N,Q \\leq 5 \\times 10^5\n\n1\\leq c_i \\leq N\n\n1\\leq l_i \\leq r_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nc_1 c_2 \\cdots c_N\nl_1 r_1\nl_2 r_2\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the response to the i-th query.\n\nSample Input 1\n\n4 3\n1 2 1 3\n1 3\n2 4\n3 3\n\nSample Output 1\n\n2\n3\n1\n\nThe 1-st, 2-nd, and 3-rd balls from the left have the colors 1, 2, and 1 - two different colors.\n\nThe 2-st, 3-rd, and 4-th balls from the left have the colors 2, 1, and 3 - three different colors.\n\nThe 3-rd ball from the left has the color 1 - just one color.\n\nSample Input 2\n\n10 10\n2 5 6 5 2 1 7 9 7 2\n5 5\n2 4\n6 7\n2 2\n7 8\n7 9\n1 8\n6 9\n8 10\n6 8\n\nSample Output 2\n\n1\n2\n2\n1\n2\n2\n6\n3\n3\n3", "sample_input": "4 3\n1 2 1 3\n1 3\n2 4\n3 3\n"}, "reference_outputs": ["2\n3\n1\n"], "source_document_id": "p02599", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have N colored balls arranged in a row from left to right; the color of the i-th ball from the left is c_i.\n\nYou are given Q queries. The i-th query is as follows: how many different colors do the l_i-th through r_i-th balls from the left have?\n\nConstraints\n\n1\\leq N,Q \\leq 5 \\times 10^5\n\n1\\leq c_i \\leq N\n\n1\\leq l_i \\leq r_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nc_1 c_2 \\cdots c_N\nl_1 r_1\nl_2 r_2\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the response to the i-th query.\n\nSample Input 1\n\n4 3\n1 2 1 3\n1 3\n2 4\n3 3\n\nSample Output 1\n\n2\n3\n1\n\nThe 1-st, 2-nd, and 3-rd balls from the left have the colors 1, 2, and 1 - two different colors.\n\nThe 2-st, 3-rd, and 4-th balls from the left have the colors 2, 1, and 3 - three different colors.\n\nThe 3-rd ball from the left has the color 1 - just one color.\n\nSample Input 2\n\n10 10\n2 5 6 5 2 1 7 9 7 2\n5 5\n2 4\n6 7\n2 2\n7 8\n7 9\n1 8\n6 9\n8 10\n6 8\n\nSample Output 2\n\n1\n2\n2\n1\n2\n2\n6\n3\n3\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6610, "cpu_time_ms": 1090, "memory_kb": 59552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s379725892", "group_id": "codeNet:p02600", "input_text": "program main\n implicit none\n integer x\n read(*,*) x\n if(x <= 599) then\n write(*,*) 8\n else if(x <= 799) then\n write(*,*) 7\n else if(x <= 999) then\n write(*,*) 6\n else if(x <= 1199) then\n write(*,*) 5\n else if(x <= 1399) then\n write(*,*) 4\n else if(x <= 1599) then\n write(*,*) 3\n else if(x <= 1799) then\n write(*,*) 2\n else if(x <= 1999) then\n write(*,*) 1\n end if\nend program\n", "language": "Fortran", "metadata": {"date": 1595725423, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Fortran/s379725892.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s379725892", "user_id": "u806372060"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program main\n implicit none\n integer x\n read(*,*) x\n if(x <= 599) then\n write(*,*) 8\n else if(x <= 799) then\n write(*,*) 7\n else if(x <= 999) then\n write(*,*) 6\n else if(x <= 1199) then\n write(*,*) 5\n else if(x <= 1399) then\n write(*,*) 4\n else if(x <= 1599) then\n write(*,*) 3\n else if(x <= 1799) then\n write(*,*) 2\n else if(x <= 1999) then\n write(*,*) 1\n end if\nend program\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 468, "cpu_time_ms": 12, "memory_kb": 2796}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s567756504", "group_id": "codeNet:p02600", "input_text": "program sample\n implicit none\n \n integer(8) :: i,j,m,n\n integer(8),allocatable :: x(:),y(:)\n \n read(*,*) n\n \n write(*,*) 10-n/200\n \n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1595725309, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02600.html", "problem_id": "p02600", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02600/input.txt", "sample_output_relpath": "derived/input_output/data/p02600/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02600/Fortran/s567756504.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s567756504", "user_id": "u713568912"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program sample\n implicit none\n \n integer(8) :: i,j,m,n\n integer(8),allocatable :: x(:),y(:)\n \n read(*,*) n\n \n write(*,*) 10-n/200\n \n stop\nend program sample\n \n\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "sample_input": "725\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02600", "source_text": "Score: 100 points\n\nProblem Statement\n\nM-kun is a competitor in AtCoder, whose highest rating is X.\n\nIn this site, a competitor is given a kyu (class) according to his/her highest rating. For ratings from 400 through 1999, the following kyus are given:\n\nFrom 400 through 599: 8-kyu\n\nFrom 600 through 799: 7-kyu\n\nFrom 800 through 999: 6-kyu\n\nFrom 1000 through 1199: 5-kyu\n\nFrom 1200 through 1399: 4-kyu\n\nFrom 1400 through 1599: 3-kyu\n\nFrom 1600 through 1799: 2-kyu\n\nFrom 1800 through 1999: 1-kyu\n\nWhat kyu does M-kun have?\n\nConstraints\n\n400 \\leq X \\leq 1999\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the kyu M-kun has, as an integer.\nFor example, if he has 8-kyu, print 8.\n\nSample Input 1\n\n725\n\nSample Output 1\n\n7\n\nM-kun's highest rating is 725, which corresponds to 7-kyu.\n\nThus, 7 is the correct output.\n\nSample Input 2\n\n1600\n\nSample Output 2\n\n2\n\nM-kun's highest rating is 1600, which corresponds to 2-kyu.\n\nThus, 2 is the correct output.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 183, "cpu_time_ms": 13, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s935905446", "group_id": "codeNet:p02602", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,k\n integer(int64), allocatable:: a(:)\n integer(int64):: i\n\n read*, n,k\n allocate(a(n))\n read*, a(:)\n\n do i=k+1,n\n if (a(i) > a(i-k)) then\n print'(a)', 'Yes'\n else\n print'(a)', 'No'\n end if\n end do\nend program main", "language": "Fortran", "metadata": {"date": 1596840030, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02602.html", "problem_id": "p02602", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02602/input.txt", "sample_output_relpath": "derived/input_output/data/p02602/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02602/Fortran/s935905446.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s935905446", "user_id": "u234636620"}, "prompt_components": {"gold_output": "Yes\nNo\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,k\n integer(int64), allocatable:: a(:)\n integer(int64):: i\n\n read*, n,k\n allocate(a(n))\n read*, a(:)\n\n do i=k+1,n\n if (a(i) > a(i-k)) then\n print'(a)', 'Yes'\n else\n print'(a)', 'No'\n end if\n end do\nend program main", "problem_context": "Score: 300 points\n\nProblem Statement\n\nM-kun is a student in Aoki High School, where a year is divided into N terms.\n\nThere is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:\n\nFor the first through (K-1)-th terms: not given.\n\nFor each of the K-th through N-th terms: the multiplication of the scores in the last K exams, including the exam in the graded term.\n\nM-kun scored A_i in the exam at the end of the i-th term.\n\nFor each i such that K+1 \\leq i \\leq N, determine whether his grade for the i-th term is strictly greater than the grade for the (i-1)-th term.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq K \\leq N-1\n\n1 \\leq A_i \\leq 10^{9}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 A_3 \\ldots A_N\n\nOutput\n\nPrint the answer in N-K lines.\n\nThe i-th line should contain Yes if the grade for the (K+i)-th term is greater than the grade for the (K+i-1)-th term, and No otherwise.\n\nSample Input 1\n\n5 3\n96 98 95 100 20\n\nSample Output 1\n\nYes\nNo\n\nHis grade for each term is computed as follows:\n\n3-rd term: (96 \\times 98 \\times 95) = 893760\n\n4-th term: (98 \\times 95 \\times 100) = 931000\n\n5-th term: (95 \\times 100 \\times 20) = 190000\n\nSample Input 2\n\n3 2\n1001 869120 1001\n\nSample Output 2\n\nNo\n\nNote that the output should be No if the grade for the 3-rd term is equal to the grade for the 2-nd term.\n\nSample Input 3\n\n15 7\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9\n\nSample Output 3\n\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nYes", "sample_input": "5 3\n96 98 95 100 20\n"}, "reference_outputs": ["Yes\nNo\n"], "source_document_id": "p02602", "source_text": "Score: 300 points\n\nProblem Statement\n\nM-kun is a student in Aoki High School, where a year is divided into N terms.\n\nThere is an exam at the end of each term. According to the scores in those exams, a student is given a grade for each term, as follows:\n\nFor the first through (K-1)-th terms: not given.\n\nFor each of the K-th through N-th terms: the multiplication of the scores in the last K exams, including the exam in the graded term.\n\nM-kun scored A_i in the exam at the end of the i-th term.\n\nFor each i such that K+1 \\leq i \\leq N, determine whether his grade for the i-th term is strictly greater than the grade for the (i-1)-th term.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq K \\leq N-1\n\n1 \\leq A_i \\leq 10^{9}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 A_3 \\ldots A_N\n\nOutput\n\nPrint the answer in N-K lines.\n\nThe i-th line should contain Yes if the grade for the (K+i)-th term is greater than the grade for the (K+i-1)-th term, and No otherwise.\n\nSample Input 1\n\n5 3\n96 98 95 100 20\n\nSample Output 1\n\nYes\nNo\n\nHis grade for each term is computed as follows:\n\n3-rd term: (96 \\times 98 \\times 95) = 893760\n\n4-th term: (98 \\times 95 \\times 100) = 931000\n\n5-th term: (95 \\times 100 \\times 20) = 190000\n\nSample Input 2\n\n3 2\n1001 869120 1001\n\nSample Output 2\n\nNo\n\nNote that the output should be No if the grade for the 3-rd term is equal to the grade for the 2-nd term.\n\nSample Input 3\n\n15 7\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9\n\nSample Output 3\n\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 368, "cpu_time_ms": 92, "memory_kb": 4656}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s938942566", "group_id": "codeNet:p02603", "input_text": "program answer\n implicit none\n integer :: i, N, sum, ka\n integer, allocatable :: A(:)\n read(*,*) N\n allocate(A(N))\n read(*,*) A\n\n sum=1000\n ka=0\n\n do i = 1, N-1\n if(A(i)<=A(i+1)) then\n ka=sum/A(i)\n sum=sum-ka*A(i)\n else\n sum=sum+ka*A(i)\n\tka=0\n end if\n end do\n write(*,*) sum\n\n deallocate(A)\n stop\n end program answer\n\n", "language": "Fortran", "metadata": {"date": 1595732656, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02603.html", "problem_id": "p02603", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02603/input.txt", "sample_output_relpath": "derived/input_output/data/p02603/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02603/Fortran/s938942566.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s938942566", "user_id": "u873780029"}, "prompt_components": {"gold_output": "1685\n", "input_to_evaluate": "program answer\n implicit none\n integer :: i, N, sum, ka\n integer, allocatable :: A(:)\n read(*,*) N\n allocate(A(N))\n read(*,*) A\n\n sum=1000\n ka=0\n\n do i = 1, N-1\n if(A(i)<=A(i+1)) then\n ka=sum/A(i)\n sum=sum-ka*A(i)\n else\n sum=sum+ka*A(i)\n\tka=0\n end if\n end do\n write(*,*) sum\n\n deallocate(A)\n stop\n end program answer\n\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nTo become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.\n\nHe is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the next N days will be as follows:\n\nA_1 yen on the 1-st day, A_2 yen on the 2-nd day, ..., A_N yen on the N-th day.\n\nIn the i-th day, M-kun can make the following trade any number of times (possibly zero), within the amount of money and stocks that he has at the time.\n\nBuy stock: Pay A_i yen and receive one stock.\n\nSell stock: Sell one stock for A_i yen.\n\nWhat is the maximum possible amount of money that M-kun can have in the end by trading optimally?\n\nConstraints\n\n2 \\leq N \\leq 80\n\n100 \\leq A_i \\leq 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the maximum possible amount of money that M-kun can have in the end, as an integer.\n\nSample Input 1\n\n7\n100 130 130 130 115 115 150\n\nSample Output 1\n\n1685\n\nIn this sample input, M-kun has seven days of trading. One way to have 1685 yen in the end is as follows:\n\nInitially, he has 1000 yen and no stocks.\n\nDay 1: Buy 10 stocks for 1000 yen. Now he has 0 yen.\n\nDay 2: Sell 7 stocks for 910 yen. Now he has 910 yen.\n\nDay 3: Sell 3 stocks for 390 yen. Now he has 1300 yen.\n\nDay 4: Do nothing.\n\nDay 5: Buy 1 stock for 115 yen. Now he has 1185 yen.\n\nDay 6: Buy 10 stocks for 1150 yen. Now he has 35 yen.\n\nDay 7: Sell 11 stocks for 1650 yen. Now he has 1685 yen.\n\nThere is no way to have 1686 yen or more in the end, so the answer is 1685.\n\nSample Input 2\n\n6\n200 180 160 140 120 100\n\nSample Output 2\n\n1000\n\nIn this sample input, it is optimal to do nothing throughout the six days, after which we will have 1000 yen.\n\nSample Input 3\n\n2\n157 193\n\nSample Output 3\n\n1216\n\nIn this sample input, it is optimal to buy 6 stocks in Day 1 and sell them in Day 2, after which we will have 1216 yen.", "sample_input": "7\n100 130 130 130 115 115 150\n"}, "reference_outputs": ["1685\n"], "source_document_id": "p02603", "source_text": "Score: 400 points\n\nProblem Statement\n\nTo become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.\n\nHe is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the next N days will be as follows:\n\nA_1 yen on the 1-st day, A_2 yen on the 2-nd day, ..., A_N yen on the N-th day.\n\nIn the i-th day, M-kun can make the following trade any number of times (possibly zero), within the amount of money and stocks that he has at the time.\n\nBuy stock: Pay A_i yen and receive one stock.\n\nSell stock: Sell one stock for A_i yen.\n\nWhat is the maximum possible amount of money that M-kun can have in the end by trading optimally?\n\nConstraints\n\n2 \\leq N \\leq 80\n\n100 \\leq A_i \\leq 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the maximum possible amount of money that M-kun can have in the end, as an integer.\n\nSample Input 1\n\n7\n100 130 130 130 115 115 150\n\nSample Output 1\n\n1685\n\nIn this sample input, M-kun has seven days of trading. One way to have 1685 yen in the end is as follows:\n\nInitially, he has 1000 yen and no stocks.\n\nDay 1: Buy 10 stocks for 1000 yen. Now he has 0 yen.\n\nDay 2: Sell 7 stocks for 910 yen. Now he has 910 yen.\n\nDay 3: Sell 3 stocks for 390 yen. Now he has 1300 yen.\n\nDay 4: Do nothing.\n\nDay 5: Buy 1 stock for 115 yen. Now he has 1185 yen.\n\nDay 6: Buy 10 stocks for 1150 yen. Now he has 35 yen.\n\nDay 7: Sell 11 stocks for 1650 yen. Now he has 1685 yen.\n\nThere is no way to have 1686 yen or more in the end, so the answer is 1685.\n\nSample Input 2\n\n6\n200 180 160 140 120 100\n\nSample Output 2\n\n1000\n\nIn this sample input, it is optimal to do nothing throughout the six days, after which we will have 1000 yen.\n\nSample Input 3\n\n2\n157 193\n\nSample Output 3\n\n1216\n\nIn this sample input, it is optimal to buy 6 stocks in Day 1 and sell them in Day 2, after which we will have 1216 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 363, "cpu_time_ms": 11, "memory_kb": 2860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s363911686", "group_id": "codeNet:p02603", "input_text": "program answer\n implicit none\n integer :: i, N, sum, ka\n integer, allocatable :: A(:)\n read(*,*) N\n allocate(A(N))\n read(*,*) A\n\n sum=1000\n\n do i = 1, N-1\n if(A(i)<=A(i+1)) then\n\tsum=(int(sum/A(i)))*(A(i+1)-A(i))+sum\n end if\n end do\n\n write(*,*) sum\n\n deallocate(A)\n stop\n end program answer\n", "language": "Fortran", "metadata": {"date": 1595730335, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02603.html", "problem_id": "p02603", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02603/input.txt", "sample_output_relpath": "derived/input_output/data/p02603/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02603/Fortran/s363911686.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s363911686", "user_id": "u873780029"}, "prompt_components": {"gold_output": "1685\n", "input_to_evaluate": "program answer\n implicit none\n integer :: i, N, sum, ka\n integer, allocatable :: A(:)\n read(*,*) N\n allocate(A(N))\n read(*,*) A\n\n sum=1000\n\n do i = 1, N-1\n if(A(i)<=A(i+1)) then\n\tsum=(int(sum/A(i)))*(A(i+1)-A(i))+sum\n end if\n end do\n\n write(*,*) sum\n\n deallocate(A)\n stop\n end program answer\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nTo become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.\n\nHe is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the next N days will be as follows:\n\nA_1 yen on the 1-st day, A_2 yen on the 2-nd day, ..., A_N yen on the N-th day.\n\nIn the i-th day, M-kun can make the following trade any number of times (possibly zero), within the amount of money and stocks that he has at the time.\n\nBuy stock: Pay A_i yen and receive one stock.\n\nSell stock: Sell one stock for A_i yen.\n\nWhat is the maximum possible amount of money that M-kun can have in the end by trading optimally?\n\nConstraints\n\n2 \\leq N \\leq 80\n\n100 \\leq A_i \\leq 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the maximum possible amount of money that M-kun can have in the end, as an integer.\n\nSample Input 1\n\n7\n100 130 130 130 115 115 150\n\nSample Output 1\n\n1685\n\nIn this sample input, M-kun has seven days of trading. One way to have 1685 yen in the end is as follows:\n\nInitially, he has 1000 yen and no stocks.\n\nDay 1: Buy 10 stocks for 1000 yen. Now he has 0 yen.\n\nDay 2: Sell 7 stocks for 910 yen. Now he has 910 yen.\n\nDay 3: Sell 3 stocks for 390 yen. Now he has 1300 yen.\n\nDay 4: Do nothing.\n\nDay 5: Buy 1 stock for 115 yen. Now he has 1185 yen.\n\nDay 6: Buy 10 stocks for 1150 yen. Now he has 35 yen.\n\nDay 7: Sell 11 stocks for 1650 yen. Now he has 1685 yen.\n\nThere is no way to have 1686 yen or more in the end, so the answer is 1685.\n\nSample Input 2\n\n6\n200 180 160 140 120 100\n\nSample Output 2\n\n1000\n\nIn this sample input, it is optimal to do nothing throughout the six days, after which we will have 1000 yen.\n\nSample Input 3\n\n2\n157 193\n\nSample Output 3\n\n1216\n\nIn this sample input, it is optimal to buy 6 stocks in Day 1 and sell them in Day 2, after which we will have 1216 yen.", "sample_input": "7\n100 130 130 130 115 115 150\n"}, "reference_outputs": ["1685\n"], "source_document_id": "p02603", "source_text": "Score: 400 points\n\nProblem Statement\n\nTo become a millionaire, M-kun has decided to make money by trading in the next N days. Currently, he has 1000 yen and no stocks - only one kind of stock is issued in the country where he lives.\n\nHe is famous across the country for his ability to foresee the future. He already knows that the price of one stock in the next N days will be as follows:\n\nA_1 yen on the 1-st day, A_2 yen on the 2-nd day, ..., A_N yen on the N-th day.\n\nIn the i-th day, M-kun can make the following trade any number of times (possibly zero), within the amount of money and stocks that he has at the time.\n\nBuy stock: Pay A_i yen and receive one stock.\n\nSell stock: Sell one stock for A_i yen.\n\nWhat is the maximum possible amount of money that M-kun can have in the end by trading optimally?\n\nConstraints\n\n2 \\leq N \\leq 80\n\n100 \\leq A_i \\leq 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the maximum possible amount of money that M-kun can have in the end, as an integer.\n\nSample Input 1\n\n7\n100 130 130 130 115 115 150\n\nSample Output 1\n\n1685\n\nIn this sample input, M-kun has seven days of trading. One way to have 1685 yen in the end is as follows:\n\nInitially, he has 1000 yen and no stocks.\n\nDay 1: Buy 10 stocks for 1000 yen. Now he has 0 yen.\n\nDay 2: Sell 7 stocks for 910 yen. Now he has 910 yen.\n\nDay 3: Sell 3 stocks for 390 yen. Now he has 1300 yen.\n\nDay 4: Do nothing.\n\nDay 5: Buy 1 stock for 115 yen. Now he has 1185 yen.\n\nDay 6: Buy 10 stocks for 1150 yen. Now he has 35 yen.\n\nDay 7: Sell 11 stocks for 1650 yen. Now he has 1685 yen.\n\nThere is no way to have 1686 yen or more in the end, so the answer is 1685.\n\nSample Input 2\n\n6\n200 180 160 140 120 100\n\nSample Output 2\n\n1000\n\nIn this sample input, it is optimal to do nothing throughout the six days, after which we will have 1000 yen.\n\nSample Input 3\n\n2\n157 193\n\nSample Output 3\n\n1216\n\nIn this sample input, it is optimal to buy 6 stocks in Day 1 and sell them in Day 2, after which we will have 1216 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 312, "cpu_time_ms": 11, "memory_kb": 2796}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s717541765", "group_id": "codeNet:p02605", "input_text": "module mod_two_dim_merge_sort\n implicit none\n integer, private, parameter :: intkind = 4\ncontains\n logical function less(a, b) result(res)\n integer(intkind), intent(in) :: a(:), b(:)\n res = a(1) < b(1) .or. (a(1) == b(1) .and. a(2) <= b(2))\n end\n subroutine merge_sort(a)\n integer(intkind), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), &\n a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(intkind), intent(inout) :: a1(:, :), a2(:, :)\n integer(intkind) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (less(a1(i1, :), a2(i2, :))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\nend module mod_two_dim_merge_sort\nprogram air_safety\n use mod_two_dim_merge_sort\n implicit none\n integer, parameter :: inf = 1e9\n integer :: n, x(200000) = 0, y(200000) = 0, u(200000) = 0, i, j, k, z\n integer :: p(200000, 2) = 0, m(0:400000) = 0, ans = inf\n character(1) :: s\n type t_list\n integer, allocatable :: at(:, :)\n end type\n type(t_list) :: list(0:400000)\n read(*,*) n\n do i = 1, n\n read(*,*) x(i), y(i), s\n select case (s)\n case ('U')\n u(i) = 1\n case ('R')\n u(i) = 2\n case ('D')\n u(i) = 3\n case ('L')\n u(i) = 4\n end select\n end do\n do k = 1, 4\n if (k == 1 .or. k == 2) then\n m = 0\n do i = 1, n\n if (mod(u(i), 2) == 1) then\n m(x(i)) = m(x(i)) + 1\n end if\n end do\n do i = 0, 200000\n if (m(i) == 0) cycle\n allocate(list(i)%at(m(i), 2))\n end do\n m = 0\n do i = 1, n\n if (mod(u(i), 2) == 1) then\n m(x(i)) = m(x(i)) + 1\n list(x(i))%at(m(x(i)), 1) = y(i)\n list(x(i))%at(m(x(i)), 2) = u(i)\n end if\n end do\n do i = 0, 200000\n if (m(i) == 0) cycle\n call merge_sort(list(i)%at(1:m(i), :))\n do j = 1, m(i) - 1\n if (list(i)%at(j + 1, 2) - list(i)%at(j, 2) == 2) then\n ans = min(ans, 5 * (list(i)%at(j + 1, 1) - list(i)%at(j, 1)))\n end if\n end do\n deallocate(list(i)%at)\n end do\n end if\n m = 0\n do i = 1, n\n if (u(i) == 1 .or. u(i) == 2) then\n z = x(i) + y(i)\n m(z) = m(z) + 1\n end if\n end do\n do i = 0, 400000\n if (m(i) == 0) cycle\n allocate(list(i)%at(m(i), 2))\n end do\n m = 0\n do i = 1, n\n if (u(i) == 1 .or. u(i) == 2) then\n z = x(i) + y(i)\n m(z) = m(z) + 1\n list(z)%at(m(z), 1) = y(i)\n list(z)%at(m(z), 2) = u(i)\n end if\n end do\n do i = 0, 400000\n if (m(i) == 0) cycle\n call merge_sort(list(i)%at(1:m(i), :))\n do j = 1, m(i) - 1\n if (list(i)%at(j + 1, 2) - list(i)%at(j, 2) == 1) then\n ans = min(ans, 10 * (list(i)%at(j + 1, 1) - list(i)%at(j, 1)))\n end if\n end do\n deallocate(list(i)%at)\n end do\n do i = 1, n\n u(i) = u(i) + 1\n if (u(i) == 5) u(i) = 1\n z = x(i)\n x(i) = y(i)\n y(i) = 200000 - z\n end do\n end do\n if (ans == inf) then\n write(*,'(a)') 'SAFE'\n else\n write(*,'(i0)') ans\n end if\nend program air_safety", "language": "Fortran", "metadata": {"date": 1595740380, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02605.html", "problem_id": "p02605", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02605/input.txt", "sample_output_relpath": "derived/input_output/data/p02605/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02605/Fortran/s717541765.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s717541765", "user_id": "u506403362"}, "prompt_components": {"gold_output": "230\n", "input_to_evaluate": "module mod_two_dim_merge_sort\n implicit none\n integer, private, parameter :: intkind = 4\ncontains\n logical function less(a, b) result(res)\n integer(intkind), intent(in) :: a(:), b(:)\n res = a(1) < b(1) .or. (a(1) == b(1) .and. a(2) <= b(2))\n end\n subroutine merge_sort(a)\n integer(intkind), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), &\n a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(intkind), intent(inout) :: a1(:, :), a2(:, :)\n integer(intkind) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (less(a1(i1, :), a2(i2, :))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\nend module mod_two_dim_merge_sort\nprogram air_safety\n use mod_two_dim_merge_sort\n implicit none\n integer, parameter :: inf = 1e9\n integer :: n, x(200000) = 0, y(200000) = 0, u(200000) = 0, i, j, k, z\n integer :: p(200000, 2) = 0, m(0:400000) = 0, ans = inf\n character(1) :: s\n type t_list\n integer, allocatable :: at(:, :)\n end type\n type(t_list) :: list(0:400000)\n read(*,*) n\n do i = 1, n\n read(*,*) x(i), y(i), s\n select case (s)\n case ('U')\n u(i) = 1\n case ('R')\n u(i) = 2\n case ('D')\n u(i) = 3\n case ('L')\n u(i) = 4\n end select\n end do\n do k = 1, 4\n if (k == 1 .or. k == 2) then\n m = 0\n do i = 1, n\n if (mod(u(i), 2) == 1) then\n m(x(i)) = m(x(i)) + 1\n end if\n end do\n do i = 0, 200000\n if (m(i) == 0) cycle\n allocate(list(i)%at(m(i), 2))\n end do\n m = 0\n do i = 1, n\n if (mod(u(i), 2) == 1) then\n m(x(i)) = m(x(i)) + 1\n list(x(i))%at(m(x(i)), 1) = y(i)\n list(x(i))%at(m(x(i)), 2) = u(i)\n end if\n end do\n do i = 0, 200000\n if (m(i) == 0) cycle\n call merge_sort(list(i)%at(1:m(i), :))\n do j = 1, m(i) - 1\n if (list(i)%at(j + 1, 2) - list(i)%at(j, 2) == 2) then\n ans = min(ans, 5 * (list(i)%at(j + 1, 1) - list(i)%at(j, 1)))\n end if\n end do\n deallocate(list(i)%at)\n end do\n end if\n m = 0\n do i = 1, n\n if (u(i) == 1 .or. u(i) == 2) then\n z = x(i) + y(i)\n m(z) = m(z) + 1\n end if\n end do\n do i = 0, 400000\n if (m(i) == 0) cycle\n allocate(list(i)%at(m(i), 2))\n end do\n m = 0\n do i = 1, n\n if (u(i) == 1 .or. u(i) == 2) then\n z = x(i) + y(i)\n m(z) = m(z) + 1\n list(z)%at(m(z), 1) = y(i)\n list(z)%at(m(z), 2) = u(i)\n end if\n end do\n do i = 0, 400000\n if (m(i) == 0) cycle\n call merge_sort(list(i)%at(1:m(i), :))\n do j = 1, m(i) - 1\n if (list(i)%at(j + 1, 2) - list(i)%at(j, 2) == 1) then\n ans = min(ans, 10 * (list(i)%at(j + 1, 1) - list(i)%at(j, 1)))\n end if\n end do\n deallocate(list(i)%at)\n end do\n do i = 1, n\n u(i) = u(i) + 1\n if (u(i) == 5) u(i) = 1\n z = x(i)\n x(i) = y(i)\n y(i) = 200000 - z\n end do\n end do\n if (ans == inf) then\n write(*,'(a)') 'SAFE'\n else\n write(*,'(i0)') ans\n end if\nend program air_safety", "problem_context": "Score: 600 points\n\nProblem Statement\n\nM-kun is a brilliant air traffic controller.\n\nOn the display of his radar, there are N airplanes numbered 1, 2, ..., N, all flying at the same altitude.\n\nEach of the airplanes flies at a constant speed of 0.1 per second in a constant direction. The current coordinates of the airplane numbered i are (X_i, Y_i), and the direction of the airplane is as follows:\n\nif U_i is U, it flies in the positive y direction;\n\nif U_i is R, it flies in the positive x direction;\n\nif U_i is D, it flies in the negative y direction;\n\nif U_i is L, it flies in the negative x direction.\n\nTo help M-kun in his work, determine whether there is a pair of airplanes that will collide with each other if they keep flying as they are now.\n\nIf there is such a pair, find the number of seconds after which the first collision will happen.\n\nWe assume that the airplanes are negligibly small so that two airplanes only collide when they reach the same coordinates simultaneously.\n\nConstraints\n\n1 \\leq N \\leq 200000\n\n0 \\leq X_i, Y_i \\leq 200000\n\nU_i is U, R, D, or L.\n\nThe current positions of the N airplanes, (X_i, Y_i), are all distinct.\n\nN, X_i, and Y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 Y_1 U_1\nX_2 Y_2 U_2\nX_3 Y_3 U_3\n:\nX_N Y_N U_N\n\nOutput\n\nIf there is a pair of airplanes that will collide with each other if they keep flying as they are now, print an integer representing the number of seconds after which the first collision will happen.\n\nIf there is no such pair, print SAFE.\n\nSample Input 1\n\n2\n11 1 U\n11 47 D\n\nSample Output 1\n\n230\n\nIf the airplanes keep flying as they are now, two airplanes numbered 1 and 2 will reach the coordinates (11, 24) simultaneously and collide.\n\nSample Input 2\n\n4\n20 30 U\n30 20 R\n20 10 D\n10 20 L\n\nSample Output 2\n\nSAFE\n\nNo pair of airplanes will collide.\n\nSample Input 3\n\n8\n168 224 U\n130 175 R\n111 198 D\n121 188 L\n201 116 U\n112 121 R\n145 239 D\n185 107 L\n\nSample Output 3\n\n100", "sample_input": "2\n11 1 U\n11 47 D\n"}, "reference_outputs": ["230\n"], "source_document_id": "p02605", "source_text": "Score: 600 points\n\nProblem Statement\n\nM-kun is a brilliant air traffic controller.\n\nOn the display of his radar, there are N airplanes numbered 1, 2, ..., N, all flying at the same altitude.\n\nEach of the airplanes flies at a constant speed of 0.1 per second in a constant direction. The current coordinates of the airplane numbered i are (X_i, Y_i), and the direction of the airplane is as follows:\n\nif U_i is U, it flies in the positive y direction;\n\nif U_i is R, it flies in the positive x direction;\n\nif U_i is D, it flies in the negative y direction;\n\nif U_i is L, it flies in the negative x direction.\n\nTo help M-kun in his work, determine whether there is a pair of airplanes that will collide with each other if they keep flying as they are now.\n\nIf there is such a pair, find the number of seconds after which the first collision will happen.\n\nWe assume that the airplanes are negligibly small so that two airplanes only collide when they reach the same coordinates simultaneously.\n\nConstraints\n\n1 \\leq N \\leq 200000\n\n0 \\leq X_i, Y_i \\leq 200000\n\nU_i is U, R, D, or L.\n\nThe current positions of the N airplanes, (X_i, Y_i), are all distinct.\n\nN, X_i, and Y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 Y_1 U_1\nX_2 Y_2 U_2\nX_3 Y_3 U_3\n:\nX_N Y_N U_N\n\nOutput\n\nIf there is a pair of airplanes that will collide with each other if they keep flying as they are now, print an integer representing the number of seconds after which the first collision will happen.\n\nIf there is no such pair, print SAFE.\n\nSample Input 1\n\n2\n11 1 U\n11 47 D\n\nSample Output 1\n\n230\n\nIf the airplanes keep flying as they are now, two airplanes numbered 1 and 2 will reach the coordinates (11, 24) simultaneously and collide.\n\nSample Input 2\n\n4\n20 30 U\n30 20 R\n20 10 D\n10 20 L\n\nSample Output 2\n\nSAFE\n\nNo pair of airplanes will collide.\n\nSample Input 3\n\n8\n168 224 U\n130 175 R\n111 198 D\n121 188 L\n201 116 U\n112 121 R\n145 239 D\n185 107 L\n\nSample Output 3\n\n100", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3772, "cpu_time_ms": 269, "memory_kb": 46704}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s662175093", "group_id": "codeNet:p02606", "input_text": "program atcoder\nimplicit none\ninteger :: l , r , d , n\nread *,l , r , d\nif(l == 1)then\n print *, r\nelse if (mod(l,d) == 0)then\n n = int(r/d) - int(l/d) + 1\n print *,n\nelse\n n = int(r/d) - int(l/d)\n print *,n\nend if\nend program atcoder", "language": "Fortran", "metadata": {"date": 1594516199, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02606.html", "problem_id": "p02606", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02606/input.txt", "sample_output_relpath": "derived/input_output/data/p02606/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02606/Fortran/s662175093.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s662175093", "user_id": "u223215060"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program atcoder\nimplicit none\ninteger :: l , r , d , n\nread *,l , r , d\nif(l == 1)then\n print *, r\nelse if (mod(l,d) == 0)then\n n = int(r/d) - int(l/d) + 1\n print *,n\nelse\n n = int(r/d) - int(l/d)\n print *,n\nend if\nend program atcoder", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHow many multiples of d are there among the integers between L and R (inclusive)?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq L \\leq R \\leq 100\n\n1 \\leq d \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R d\n\nOutput\n\nPrint the number of multiples of d among the integers between L and R (inclusive).\n\nSample Input 1\n\n5 10 2\n\nSample Output 1\n\n3\n\nAmong the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\nSample Input 2\n\n6 20 7\n\nSample Output 2\n\n2\n\nAmong the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\nSample Input 3\n\n1 100 1\n\nSample Output 3\n\n100", "sample_input": "5 10 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02606", "source_text": "Score : 100 points\n\nProblem Statement\n\nHow many multiples of d are there among the integers between L and R (inclusive)?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq L \\leq R \\leq 100\n\n1 \\leq d \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL R d\n\nOutput\n\nPrint the number of multiples of d among the integers between L and R (inclusive).\n\nSample Input 1\n\n5 10 2\n\nSample Output 1\n\n3\n\nAmong the integers between 5 and 10, there are three multiples of 2: 6, 8, and 10.\n\nSample Input 2\n\n6 20 7\n\nSample Output 2\n\n2\n\nAmong the integers between 6 and 20, there are two multiples of 7: 7 and 14.\n\nSample Input 3\n\n1 100 1\n\nSample Output 3\n\n100", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 239, "cpu_time_ms": 11, "memory_kb": 2828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s115745546", "group_id": "codeNet:p02608", "input_text": "program AIsing2020C\n implicit none\n integer(8)::N,i,j,k,A(10000),m\n read*,N\n A=0\n \n do i=1,100\n do j=1,100\n do k=1,100\n m=i**2+j**2+k**2+i*j+j*k+k*i\n if(m<=10000)A(m)=A(m)+1\n end do\n end do\n end do\n \n do i=1,N\n print'(i0)',A(i)\n end do\nend program AIsing2020C", "language": "Fortran", "metadata": {"date": 1598368534, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02608.html", "problem_id": "p02608", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02608/input.txt", "sample_output_relpath": "derived/input_output/data/p02608/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02608/Fortran/s115745546.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s115745546", "user_id": "u622206408"}, "prompt_components": {"gold_output": "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n", "input_to_evaluate": "program AIsing2020C\n implicit none\n integer(8)::N,i,j,k,A(10000),m\n read*,N\n A=0\n \n do i=1,100\n do j=1,100\n do k=1,100\n m=i**2+j**2+k**2+i*j+j*k+k*i\n if(m<=10000)A(m)=A(m)+1\n end do\n end do\n end do\n \n do i=1,N\n print'(i0)',A(i)\n end do\nend program AIsing2020C", "problem_context": "Score : 300 points\n\nProblem Statement\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n1 \\leq x,y,z\n\nx^2 + y^2 + z^2 + xy + yz + zx = n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,f(N).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(i).\n\nSample Input 1\n\n20\n\nSample Output 1\n\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n\nFor n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.\n\nFor n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.\n\nFor n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.\n\nFor n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.", "sample_input": "20\n"}, "reference_outputs": ["0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n"], "source_document_id": "p02608", "source_text": "Score : 300 points\n\nProblem Statement\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n1 \\leq x,y,z\n\nx^2 + y^2 + z^2 + xy + yz + zx = n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,f(N).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(i).\n\nSample Input 1\n\n20\n\nSample Output 1\n\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n\nFor n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.\n\nFor n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.\n\nFor n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.\n\nFor n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 356, "cpu_time_ms": 12, "memory_kb": 2940}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s593884701", "group_id": "codeNet:p02608", "input_text": "program r20711c\n\nimplicit none\ninteger :: x, y, z, n, f, i\ninteger :: a(1:11000)\n\na = 0\n\nread *, n\nroop: do x = 1, 100\n do y = 1, x\n do z = 1, y\n f = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x\n if(f > 11000) then\n exit roop\n end if\n !print '(5(I2, 1x))', i, x, y, z, f\n if(x == y .and. y == z) then\n a(f) = a(f) + 1\n else if(x == y .or. y == z) then\n a(f) = a(f) + 3\n else\n a(f) = a(f) + 6\n end if\n end do\n end do\nend do roop\n\ndo i = 1, n\n print *, a(i)\nend do\n \nend program r20711c", "language": "Fortran", "metadata": {"date": 1594518990, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02608.html", "problem_id": "p02608", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02608/input.txt", "sample_output_relpath": "derived/input_output/data/p02608/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02608/Fortran/s593884701.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s593884701", "user_id": "u644436095"}, "prompt_components": {"gold_output": "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n", "input_to_evaluate": "program r20711c\n\nimplicit none\ninteger :: x, y, z, n, f, i\ninteger :: a(1:11000)\n\na = 0\n\nread *, n\nroop: do x = 1, 100\n do y = 1, x\n do z = 1, y\n f = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x\n if(f > 11000) then\n exit roop\n end if\n !print '(5(I2, 1x))', i, x, y, z, f\n if(x == y .and. y == z) then\n a(f) = a(f) + 1\n else if(x == y .or. y == z) then\n a(f) = a(f) + 3\n else\n a(f) = a(f) + 6\n end if\n end do\n end do\nend do roop\n\ndo i = 1, n\n print *, a(i)\nend do\n \nend program r20711c", "problem_context": "Score : 300 points\n\nProblem Statement\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n1 \\leq x,y,z\n\nx^2 + y^2 + z^2 + xy + yz + zx = n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,f(N).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(i).\n\nSample Input 1\n\n20\n\nSample Output 1\n\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n\nFor n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.\n\nFor n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.\n\nFor n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.\n\nFor n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.", "sample_input": "20\n"}, "reference_outputs": ["0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n"], "source_document_id": "p02608", "source_text": "Score : 300 points\n\nProblem Statement\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n1 \\leq x,y,z\n\nx^2 + y^2 + z^2 + xy + yz + zx = n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,f(N).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(i).\n\nSample Input 1\n\n20\n\nSample Output 1\n\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n\nFor n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.\n\nFor n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.\n\nFor n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.\n\nFor n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 536, "cpu_time_ms": 16, "memory_kb": 2868}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s658618815", "group_id": "codeNet:p02608", "input_text": "program tsundoku\n implicit none\n integer :: n, m, i,j, h = 0, l, r, p\n integer(8) :: k, t\n integer(8), dimension(0:200001) :: a = 0, b = 0,c=0, x = 0, y = 0\n read(*,*) n\n do t=1,n\n m=int(sqrt(dble(t/1.5)))\n p=0\n\tdo i=1,m\n \tdo j=1,m\n \tdo k=1,m\n \tif((i+j)*(i+j)+(i+k)*(i+k)+(k+j)*(k+j)==2*t)then\n! a(i)=i\n! b(i)=j\n! c(i)=k\n p=p+1\n end if\n end do\n end do\n end do\n! do i=1,m\n \n! if()\n write(*,*)p\n end do\nend program tsundoku", "language": "Fortran", "metadata": {"date": 1594517708, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02608.html", "problem_id": "p02608", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02608/input.txt", "sample_output_relpath": "derived/input_output/data/p02608/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02608/Fortran/s658618815.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s658618815", "user_id": "u970637660"}, "prompt_components": {"gold_output": "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n", "input_to_evaluate": "program tsundoku\n implicit none\n integer :: n, m, i,j, h = 0, l, r, p\n integer(8) :: k, t\n integer(8), dimension(0:200001) :: a = 0, b = 0,c=0, x = 0, y = 0\n read(*,*) n\n do t=1,n\n m=int(sqrt(dble(t/1.5)))\n p=0\n\tdo i=1,m\n \tdo j=1,m\n \tdo k=1,m\n \tif((i+j)*(i+j)+(i+k)*(i+k)+(k+j)*(k+j)==2*t)then\n! a(i)=i\n! b(i)=j\n! c(i)=k\n p=p+1\n end if\n end do\n end do\n end do\n! do i=1,m\n \n! if()\n write(*,*)p\n end do\nend program tsundoku", "problem_context": "Score : 300 points\n\nProblem Statement\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n1 \\leq x,y,z\n\nx^2 + y^2 + z^2 + xy + yz + zx = n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,f(N).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(i).\n\nSample Input 1\n\n20\n\nSample Output 1\n\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n\nFor n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.\n\nFor n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.\n\nFor n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.\n\nFor n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.", "sample_input": "20\n"}, "reference_outputs": ["0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n"], "source_document_id": "p02608", "source_text": "Score : 300 points\n\nProblem Statement\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n1 \\leq x,y,z\n\nx^2 + y^2 + z^2 + xy + yz + zx = n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,f(N).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(i).\n\nSample Input 1\n\n20\n\nSample Output 1\n\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n\nFor n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.\n\nFor n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.\n\nFor n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.\n\nFor n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 565, "cpu_time_ms": 1805, "memory_kb": 2760}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s256730162", "group_id": "codeNet:p02608", "input_text": "program answer\n implicit none\n\n integer(8) :: N, i, j, k, count, eg(10000)\n read(*,*) N\n eg=0\n do i = 1, 100\n do j = 1, 100\n do k= 1, 100\n if(i**2+j**2+k**2+i*j+j*k+k*i<=10000) then\n eg(i**2+j**2+k**2+i*j+j*k+k*i)=eg(i**2+j**2+k**2+i*j+j*k+k*i)+1\n end if\n end do\n end do\n end do\n\n \n do i = 1, N\n write(*,*) eg(i)\n end do\n stop\n end program answer", "language": "Fortran", "metadata": {"date": 1594517341, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02608.html", "problem_id": "p02608", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02608/input.txt", "sample_output_relpath": "derived/input_output/data/p02608/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02608/Fortran/s256730162.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s256730162", "user_id": "u873780029"}, "prompt_components": {"gold_output": "0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n", "input_to_evaluate": "program answer\n implicit none\n\n integer(8) :: N, i, j, k, count, eg(10000)\n read(*,*) N\n eg=0\n do i = 1, 100\n do j = 1, 100\n do k= 1, 100\n if(i**2+j**2+k**2+i*j+j*k+k*i<=10000) then\n eg(i**2+j**2+k**2+i*j+j*k+k*i)=eg(i**2+j**2+k**2+i*j+j*k+k*i)+1\n end if\n end do\n end do\n end do\n\n \n do i = 1, N\n write(*,*) eg(i)\n end do\n stop\n end program answer", "problem_context": "Score : 300 points\n\nProblem Statement\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n1 \\leq x,y,z\n\nx^2 + y^2 + z^2 + xy + yz + zx = n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,f(N).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(i).\n\nSample Input 1\n\n20\n\nSample Output 1\n\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n\nFor n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.\n\nFor n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.\n\nFor n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.\n\nFor n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.", "sample_input": "20\n"}, "reference_outputs": ["0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n"], "source_document_id": "p02608", "source_text": "Score : 300 points\n\nProblem Statement\n\nLet f(n) be the number of triples of integers (x,y,z) that satisfy both of the following conditions:\n\n1 \\leq x,y,z\n\nx^2 + y^2 + z^2 + xy + yz + zx = n\n\nGiven an integer N, find each of f(1),f(2),f(3),\\ldots,f(N).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(i).\n\nSample Input 1\n\n20\n\nSample Output 1\n\n0\n0\n0\n0\n0\n1\n0\n0\n0\n0\n3\n0\n0\n0\n0\n0\n3\n3\n0\n0\n\nFor n=6, only (1,1,1) satisfies both of the conditions. Thus, f(6) = 1.\n\nFor n=11, three triples, (1,1,2), (1,2,1), and (2,1,1), satisfy both of the conditions. Thus, f(6) = 3.\n\nFor n=17, three triples, (1,2,2), (2,1,2), and (2,2,1), satisfy both of the conditions. Thus, f(17) = 3.\n\nFor n=18, three triples, (1,1,3), (1,3,1), and (3,1,1), satisfy both of the conditions. Thus, f(18) = 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 414, "cpu_time_ms": 14, "memory_kb": 2740}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s280571996", "group_id": "codeNet:p02613", "input_text": "program testcase\n integer(8) n\n integer(8) :: i= 0\n integer(8) :: c0 = 0\n integer(8) :: c1 = 0\n integer(8) :: c2 = 0\n integer(8) :: c3 = 0\n character(3) str\n read *, n\n do\n if(i == n)exit\n read *, str\n if(str .eq. \"AC\")then\n c0 = c0 + 1\n else if(str .eq. \"WA\")then\n c1 = c1 + 1\n else if(str .eq. \"TLE\")then\n c2 = c2 + 1\n else if(str .eq. \"RE\")then\n c3 = c3 + 1\n end if\n i = i + 1\n end do\n print \"('AC x ',i0)\", c0\n print \"('WA x ',i0)\", c1\n print \"('TLE x ',i0)\", c2\n print \"('RE x ',i0)\", c3\nend program", "language": "Fortran", "metadata": {"date": 1598045841, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02613.html", "problem_id": "p02613", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02613/input.txt", "sample_output_relpath": "derived/input_output/data/p02613/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02613/Fortran/s280571996.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s280571996", "user_id": "u622206408"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "program testcase\n integer(8) n\n integer(8) :: i= 0\n integer(8) :: c0 = 0\n integer(8) :: c1 = 0\n integer(8) :: c2 = 0\n integer(8) :: c3 = 0\n character(3) str\n read *, n\n do\n if(i == n)exit\n read *, str\n if(str .eq. \"AC\")then\n c0 = c0 + 1\n else if(str .eq. \"WA\")then\n c1 = c1 + 1\n else if(str .eq. \"TLE\")then\n c2 = c2 + 1\n else if(str .eq. \"RE\")then\n c3 = c3 + 1\n end if\n i = i + 1\n end do\n print \"('AC x ',i0)\", c0\n print \"('WA x ',i0)\", c1\n print \"('TLE x ',i0)\", c2\n print \"('RE x ',i0)\", c3\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "sample_input": "6\nAC\nTLE\nAC\nAC\nWA\nTLE\n"}, "reference_outputs": ["AC x 3\nWA x 1\nTLE x 2\nRE x 0\n"], "source_document_id": "p02613", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 646, "cpu_time_ms": 40, "memory_kb": 2932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s912513456", "group_id": "codeNet:p02613", "input_text": "program testcase\n integer(8) n\n integer(8) :: i= 0\n integer(8) :: c0 = 0\n integer(8) :: c1 = 0\n integer(8) :: c2 = 0\n integer(8) :: c3 = 0\n character(3) str\n read *, n\n do\n if(i == n)exit\n read *, str\n if(str .eq. \"AC\")then\n c0 = c0 + 1\n else if(str .eq. \"WA\")then\n c1 = c1 + 1\n else if(str .eq. \"TLE\")then\n c2 = c2 + 1\n else if(str .eq. \"RE\")then\n c3 = c3 + 1\n end if\n i = i + 1\n end do\n print \"('AC × ',i0)\", c0\n print \"('WA × ',i0)\", c1\n print \"('TLE × ',i0)\", c2\n print \"('RE × ',i0)\", c3\nend program", "language": "Fortran", "metadata": {"date": 1598045320, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02613.html", "problem_id": "p02613", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02613/input.txt", "sample_output_relpath": "derived/input_output/data/p02613/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02613/Fortran/s912513456.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s912513456", "user_id": "u622206408"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "program testcase\n integer(8) n\n integer(8) :: i= 0\n integer(8) :: c0 = 0\n integer(8) :: c1 = 0\n integer(8) :: c2 = 0\n integer(8) :: c3 = 0\n character(3) str\n read *, n\n do\n if(i == n)exit\n read *, str\n if(str .eq. \"AC\")then\n c0 = c0 + 1\n else if(str .eq. \"WA\")then\n c1 = c1 + 1\n else if(str .eq. \"TLE\")then\n c2 = c2 + 1\n else if(str .eq. \"RE\")then\n c3 = c3 + 1\n end if\n i = i + 1\n end do\n print \"('AC × ',i0)\", c0\n print \"('WA × ',i0)\", c1\n print \"('TLE × ',i0)\", c2\n print \"('RE × ',i0)\", c3\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "sample_input": "6\nAC\nTLE\nAC\nAC\nWA\nTLE\n"}, "reference_outputs": ["AC x 3\nWA x 1\nTLE x 2\nRE x 0\n"], "source_document_id": "p02613", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 650, "cpu_time_ms": 41, "memory_kb": 2908}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s318666267", "group_id": "codeNet:p02613", "input_text": "program testcase\n integer n, i\n character str\n integer :: ac = 0\n integer :: tle = 0\n integer :: wa = 0\n integer :: re = 0\n character, allocatable :: s(:)\n read *, n\n allocate (s(n))\n do i = 1, n\n read *, str\n if(str == 'AC')then\n ac = ac + 1\n else if(str == 'WA')then\n wa = wa + 1\n else if(str == 'RE')then\n re = re + 1\n else if(str == 'TLE')then\n tle = tle + 1\n end if\n end do\n print *, 'AC ×', ac\n print *, 'WA ×', wa\n print *, 'RE ×', re\n print *, 'TLE ×', tle\nend program", "language": "Fortran", "metadata": {"date": 1598039407, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02613.html", "problem_id": "p02613", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02613/input.txt", "sample_output_relpath": "derived/input_output/data/p02613/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02613/Fortran/s318666267.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s318666267", "user_id": "u622206408"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "program testcase\n integer n, i\n character str\n integer :: ac = 0\n integer :: tle = 0\n integer :: wa = 0\n integer :: re = 0\n character, allocatable :: s(:)\n read *, n\n allocate (s(n))\n do i = 1, n\n read *, str\n if(str == 'AC')then\n ac = ac + 1\n else if(str == 'WA')then\n wa = wa + 1\n else if(str == 'RE')then\n re = re + 1\n else if(str == 'TLE')then\n tle = tle + 1\n end if\n end do\n print *, 'AC ×', ac\n print *, 'WA ×', wa\n print *, 'RE ×', re\n print *, 'TLE ×', tle\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "sample_input": "6\nAC\nTLE\nAC\nAC\nWA\nTLE\n"}, "reference_outputs": ["AC x 3\nWA x 1\nTLE x 2\nRE x 0\n"], "source_document_id": "p02613", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 611, "cpu_time_ms": 40, "memory_kb": 2840}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s054985910", "group_id": "codeNet:p02613", "input_text": "program r20718j\n \nimplicit none\ninteger :: ac, wa, tle, re, n, i\ncharacter(len=3) :: a\n \nac = 0\nwa = 0\ntle = 0\nre = 0\n \nread *, n\n \ndo i = 1, n\n \n read *, a\n \n if (trim(a) == 'AC') then\n ac = ac + 1\n else if (trim(a) == 'WA') then\n wa = wa + 1\n else if (trim(a) == 'TLE') then\n tle = tle + 1\n else\n re = re + 1\n end if\nend do\n \nprint *, 'AC x ', ac\nprint *, 'WA x ', wa\nprint *, 'TLE x ', tle\nprint *, 'RE x ', re\n \nend program r20718j", "language": "Fortran", "metadata": {"date": 1595124892, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02613.html", "problem_id": "p02613", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02613/input.txt", "sample_output_relpath": "derived/input_output/data/p02613/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02613/Fortran/s054985910.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s054985910", "user_id": "u644436095"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "program r20718j\n \nimplicit none\ninteger :: ac, wa, tle, re, n, i\ncharacter(len=3) :: a\n \nac = 0\nwa = 0\ntle = 0\nre = 0\n \nread *, n\n \ndo i = 1, n\n \n read *, a\n \n if (trim(a) == 'AC') then\n ac = ac + 1\n else if (trim(a) == 'WA') then\n wa = wa + 1\n else if (trim(a) == 'TLE') then\n tle = tle + 1\n else\n re = re + 1\n end if\nend do\n \nprint *, 'AC x ', ac\nprint *, 'WA x ', wa\nprint *, 'TLE x ', tle\nprint *, 'RE x ', re\n \nend program r20718j", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "sample_input": "6\nAC\nTLE\nAC\nAC\nWA\nTLE\n"}, "reference_outputs": ["AC x 3\nWA x 1\nTLE x 2\nRE x 0\n"], "source_document_id": "p02613", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 439, "cpu_time_ms": 37, "memory_kb": 2868}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s064269736", "group_id": "codeNet:p02613", "input_text": "program sample\n implicit none\n character(3)::s\n integer(8) :: i,j,m,n,w,t,a,r\n integer(8),allocatable :: x(:),y(:)\n \n read(*,*) n\n w=0\n a=0\n r=0\n t=0\n do i=1,n\n read(*,*)s\n if (s .eq. 'WA')then\n w=w+1\n else if(s .eq. 'TLE')then\n t=t+1\n else if(s .eq. 'AC')then\n a=a+1\n else\n r=r+1 \n end if\n end do\n write(*,'(a,x,a,x,i6)')'AC','*',a\n write(*,'(a,x,a,x,i6)')'WA','*',w\n write(*,'(a,x,a,x,i6)')'TLE','*',t\n write(*,'(a,x,a,x,i6)')'RE','*',r\n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1593998419, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02613.html", "problem_id": "p02613", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02613/input.txt", "sample_output_relpath": "derived/input_output/data/p02613/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02613/Fortran/s064269736.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s064269736", "user_id": "u713568912"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "program sample\n implicit none\n character(3)::s\n integer(8) :: i,j,m,n,w,t,a,r\n integer(8),allocatable :: x(:),y(:)\n \n read(*,*) n\n w=0\n a=0\n r=0\n t=0\n do i=1,n\n read(*,*)s\n if (s .eq. 'WA')then\n w=w+1\n else if(s .eq. 'TLE')then\n t=t+1\n else if(s .eq. 'AC')then\n a=a+1\n else\n r=r+1 \n end if\n end do\n write(*,'(a,x,a,x,i6)')'AC','*',a\n write(*,'(a,x,a,x,i6)')'WA','*',w\n write(*,'(a,x,a,x,i6)')'TLE','*',t\n write(*,'(a,x,a,x,i6)')'RE','*',r\n stop\nend program sample\n \n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "sample_input": "6\nAC\nTLE\nAC\nAC\nWA\nTLE\n"}, "reference_outputs": ["AC x 3\nWA x 1\nTLE x 2\nRE x 0\n"], "source_document_id": "p02613", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 606, "cpu_time_ms": 43, "memory_kb": 2936}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s742431086", "group_id": "codeNet:p02613", "input_text": "program main\n\timplicit none\n\tinteger(8):: N,i,j1=0,j2=0,j3=0,j4=0,t,k\n\tcharacter(200000):: S\n\tread *, N\n\tdo i=1,N\n\tread *,S\n\tif(S==\"AC\")j1=1+j1\n\tif(S==\"WA\")j2=1+j2\n\tif(S==\"TLE\")j3=1+j3\n\tif(S==\"RE\")j4=1+j4 \n\tend do\n\twrite(*,*)\"AC×\",j1\n\twrite(*,*)\"WA×\",j2\n\twrite(*,*)\"TLE×\",j3\n\twrite(*,*)\"RE×\",j4\n\tend program main", "language": "Fortran", "metadata": {"date": 1593998259, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02613.html", "problem_id": "p02613", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02613/input.txt", "sample_output_relpath": "derived/input_output/data/p02613/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02613/Fortran/s742431086.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s742431086", "user_id": "u970637660"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "program main\n\timplicit none\n\tinteger(8):: N,i,j1=0,j2=0,j3=0,j4=0,t,k\n\tcharacter(200000):: S\n\tread *, N\n\tdo i=1,N\n\tread *,S\n\tif(S==\"AC\")j1=1+j1\n\tif(S==\"WA\")j2=1+j2\n\tif(S==\"TLE\")j3=1+j3\n\tif(S==\"RE\")j4=1+j4 \n\tend do\n\twrite(*,*)\"AC×\",j1\n\twrite(*,*)\"WA×\",j2\n\twrite(*,*)\"TLE×\",j3\n\twrite(*,*)\"RE×\",j4\n\tend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "sample_input": "6\nAC\nTLE\nAC\nAC\nWA\nTLE\n"}, "reference_outputs": ["AC x 3\nWA x 1\nTLE x 2\nRE x 0\n"], "source_document_id": "p02613", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest called AXC002, and he has just submitted his code to Problem A.\n\nThe problem has N test cases.\n\nFor each test case i (1\\leq i \\leq N), you are given a string S_i representing the verdict for that test case. Find the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSee the Output section for the output format.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i is AC, WA, TLE, or RE.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n\\vdots\nS_N\n\nOutput\n\nLet C_0, C_1, C_2, and C_3 be the numbers of test cases for which the verdict is AC, WA, TLE, and RE, respectively. Print the following:\n\nAC x C_0\nWA x C_1\nTLE x C_2\nRE x C_3\n\nSample Input 1\n\n6\nAC\nTLE\nAC\nAC\nWA\nTLE\n\nSample Output 1\n\nAC x 3\nWA x 1\nTLE x 2\nRE x 0\n\nWe have 3, 1, 2, and 0 test case(s) for which the verdict is AC, WA, TLE, and RE, respectively.\n\nSample Input 2\n\n10\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\nAC\n\nSample Output 2\n\nAC x 10\nWA x 0\nTLE x 0\nRE x 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 319, "cpu_time_ms": 2205, "memory_kb": 3052}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s785365847", "group_id": "codeNet:p02614", "input_text": "program h_and_v\n implicit none\n integer :: h, w, k, i, j, l, u, a(6, 6) = 0, b(6, 6) = 0, m = 0\n character(6) :: s\n read(*,*) h, w, k\n do i = 1, h\n read(*,*) s\n do j = 1, w\n if (s(j:j) == '#') a(i, j) = 1\n end do\n end do\n u = lshift(1, h + w) - 1\n do l = 0, u\n b = a\n do i = 1, h\n if (btest(l, i - 1)) b(i, :) = -1\n end do\n do j = 1, w\n if (btest(l, j + h - 1)) b(:, j) = -1\n end do\n if (sum(b, b > 0) == k) m = m + 1\n end do\n write(*,'(i0)') m\nend program h_and_v", "language": "Fortran", "metadata": {"date": 1593997890, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02614.html", "problem_id": "p02614", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02614/input.txt", "sample_output_relpath": "derived/input_output/data/p02614/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02614/Fortran/s785365847.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s785365847", "user_id": "u506403362"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program h_and_v\n implicit none\n integer :: h, w, k, i, j, l, u, a(6, 6) = 0, b(6, 6) = 0, m = 0\n character(6) :: s\n read(*,*) h, w, k\n do i = 1, h\n read(*,*) s\n do j = 1, w\n if (s(j:j) == '#') a(i, j) = 1\n end do\n end do\n u = lshift(1, h + w) - 1\n do l = 0, u\n b = a\n do i = 1, h\n if (btest(l, i - 1)) b(i, :) = -1\n end do\n do j = 1, w\n if (btest(l, j + h - 1)) b(:, j) = -1\n end do\n if (sum(b, b > 0) == k) m = m + 1\n end do\n write(*,'(i0)') m\nend program h_and_v", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \\leq i \\leq H, 1 \\leq j \\leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is ., and black if c_{i,j} is #.\n\nConsider doing the following operation:\n\nChoose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns.\n\nYou are given a positive integer K. How many choices of rows and columns result in exactly K black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices.\n\nConstraints\n\n1 \\leq H, W \\leq 6\n\n1 \\leq K \\leq HW\n\nc_{i,j} is . or #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nc_{1,1}c_{1,2}...c_{1,W}\nc_{2,1}c_{2,2}...c_{2,W}\n:\nc_{H,1}c_{H,2}...c_{H,W}\n\nOutput\n\nPrint an integer representing the number of choices of rows and columns satisfying the condition.\n\nSample Input 1\n\n2 3 2\n..#\n###\n\nSample Output 1\n\n5\n\nFive choices below satisfy the condition.\n\nThe 1-st row and 1-st column\n\nThe 1-st row and 2-nd column\n\nThe 1-st row and 3-rd column\n\nThe 1-st and 2-nd column\n\nThe 3-rd column\n\nSample Input 2\n\n2 3 4\n..#\n###\n\nSample Output 2\n\n1\n\nOne choice, which is choosing nothing, satisfies the condition.\n\nSample Input 3\n\n2 2 3\n##\n##\n\nSample Output 3\n\n0\n\nSample Input 4\n\n6 6 8\n..##..\n.#..#.\n#....#\n######\n#....#\n#....#\n\nSample Output 4\n\n208", "sample_input": "2 3 2\n..#\n###\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02614", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \\leq i \\leq H, 1 \\leq j \\leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is ., and black if c_{i,j} is #.\n\nConsider doing the following operation:\n\nChoose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns.\n\nYou are given a positive integer K. How many choices of rows and columns result in exactly K black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices.\n\nConstraints\n\n1 \\leq H, W \\leq 6\n\n1 \\leq K \\leq HW\n\nc_{i,j} is . or #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nc_{1,1}c_{1,2}...c_{1,W}\nc_{2,1}c_{2,2}...c_{2,W}\n:\nc_{H,1}c_{H,2}...c_{H,W}\n\nOutput\n\nPrint an integer representing the number of choices of rows and columns satisfying the condition.\n\nSample Input 1\n\n2 3 2\n..#\n###\n\nSample Output 1\n\n5\n\nFive choices below satisfy the condition.\n\nThe 1-st row and 1-st column\n\nThe 1-st row and 2-nd column\n\nThe 1-st row and 3-rd column\n\nThe 1-st and 2-nd column\n\nThe 3-rd column\n\nSample Input 2\n\n2 3 4\n..#\n###\n\nSample Output 2\n\n1\n\nOne choice, which is choosing nothing, satisfies the condition.\n\nSample Input 3\n\n2 2 3\n##\n##\n\nSample Output 3\n\n0\n\nSample Input 4\n\n6 6 8\n..##..\n.#..#.\n#....#\n######\n#....#\n#....#\n\nSample Output 4\n\n208", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 516, "cpu_time_ms": 11, "memory_kb": 2796}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s253410120", "group_id": "codeNet:p02615", "input_text": "module module_sort\n use iso_fortran_env\n implicit none\n\n interface quicksort\n module procedure :: int32_qsort\n module procedure :: int64_qsort\n end interface quicksort\ncontains\n\n recursive function int32_qsort(m) result(res)\n integer(int32), intent(in) :: m(:)\n integer(int32) :: res(size(m)) \n\n if (size(m) <= 1) then; res = m\n else; res = [int32_qsort( pack(m(2:), m(2:) >= m(1)) ), m(1), int32_qsort( pack(m(2:), m(2:) < m(1)) )]\n end if\n\n end function int32_qsort\n\n recursive function int64_qsort(m) result(res)\n integer(int64), intent(in) :: m(:)\n integer(int64) :: res(size(m)) \n\n if (size(m) <= 1) then; res = m\n else; res = [int64_qsort( pack(m(2:), m(2:) >= m(1)) ), m(1), int64_qsort( pack(m(2:), m(2:) < m(1)) )]\n end if\n\n end function int64_qsort\n\nend module module_sort\n\nprogram main\n use module_sort\n use iso_fortran_env\n implicit none\n integer(int32) :: n\n integer(int32), allocatable :: ai(:)\n integer(int32) :: i, ie\n integer(int32) :: ans\n\n read *, n\n allocate( ai(n) )\n read *, ai( 1:n )\n ai = quicksort( ai )\n! call qsort( ai )\n! ai(n:1:-1) = ai(1:n)\n! ai = intQsort( ai )\n! ai(n:1:-1) = ai(1:n)\n\n if ( mod((n-1), 2) == 0 ) then\n ie = (n-1) / 2\n ans = ai(1) + ai(ie + 1)\n else\n ie = n / 2\n ans = ai(1)\n endif\n\n do i = 2, ie\n ans = ans + ai(i) * 2\n enddo\n\n print *, ans\n\ncontains\n\nrecursive subroutine qsort(a)\n implicit none\n integer(8),intent(inout) :: a(:)\n integer(8)::i,j,toobig,toosmall,pv,n\n\n n = size(a)\ni = 1\nj = n\npv = a((i+j)/2)\ndo\n do\n if (a(i) < pv) then\n i = i+1\n else\n exit\n end if\n end do\n do\n if(a(j) > pv) then\n j = j-1\n else\n exit\n end if\n end do\n if (i>=j) then\n exit\n else\n toobig = a(j)\n toosmall = a(i)\n a(i) = toobig\n a(j) = toosmall\n i = i+1\n j = j-1\n end if\n end do\n if (i > 2) then\n call qsort(a(1:i-1))\n end if\n if (j < n-1) then\n call qsort(a(j+1:n))\n end if\nend subroutine qsort\n\npure recursive function intQsort( a ) result( r )\nimplicit none\ninteger(16), intent(in) :: a(:)\ninteger(16) :: r( size(a) )\ninteger(16) :: sample(3), len, i,j\n\nlen = size( a(:) )\nif( len<=1 )then\n r = a\nelse\n !select pivot\n sample(1:3) = [a(1), a(len/2), a(len)]\n do i = 1,2\n do j = 2,3\n if( sample(i)>sample(j) )then\n len = sample(i) !len is buffer\n sample(i) = sample(j)\n sample(j) = len\n end if\n end do\n end do\n \n r = [ intQsort( pack(a(:), a(:)< sample(2)) ), &\n pack(a(:), a(:)==sample(2)) , &\n intQsort( pack(a(:), a(:)> sample(2)) ) ]\nend if\nend function intQsort\n\nend program main", "language": "Fortran", "metadata": {"date": 1596390571, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02615.html", "problem_id": "p02615", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02615/input.txt", "sample_output_relpath": "derived/input_output/data/p02615/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02615/Fortran/s253410120.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s253410120", "user_id": "u128084721"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "module module_sort\n use iso_fortran_env\n implicit none\n\n interface quicksort\n module procedure :: int32_qsort\n module procedure :: int64_qsort\n end interface quicksort\ncontains\n\n recursive function int32_qsort(m) result(res)\n integer(int32), intent(in) :: m(:)\n integer(int32) :: res(size(m)) \n\n if (size(m) <= 1) then; res = m\n else; res = [int32_qsort( pack(m(2:), m(2:) >= m(1)) ), m(1), int32_qsort( pack(m(2:), m(2:) < m(1)) )]\n end if\n\n end function int32_qsort\n\n recursive function int64_qsort(m) result(res)\n integer(int64), intent(in) :: m(:)\n integer(int64) :: res(size(m)) \n\n if (size(m) <= 1) then; res = m\n else; res = [int64_qsort( pack(m(2:), m(2:) >= m(1)) ), m(1), int64_qsort( pack(m(2:), m(2:) < m(1)) )]\n end if\n\n end function int64_qsort\n\nend module module_sort\n\nprogram main\n use module_sort\n use iso_fortran_env\n implicit none\n integer(int32) :: n\n integer(int32), allocatable :: ai(:)\n integer(int32) :: i, ie\n integer(int32) :: ans\n\n read *, n\n allocate( ai(n) )\n read *, ai( 1:n )\n ai = quicksort( ai )\n! call qsort( ai )\n! ai(n:1:-1) = ai(1:n)\n! ai = intQsort( ai )\n! ai(n:1:-1) = ai(1:n)\n\n if ( mod((n-1), 2) == 0 ) then\n ie = (n-1) / 2\n ans = ai(1) + ai(ie + 1)\n else\n ie = n / 2\n ans = ai(1)\n endif\n\n do i = 2, ie\n ans = ans + ai(i) * 2\n enddo\n\n print *, ans\n\ncontains\n\nrecursive subroutine qsort(a)\n implicit none\n integer(8),intent(inout) :: a(:)\n integer(8)::i,j,toobig,toosmall,pv,n\n\n n = size(a)\ni = 1\nj = n\npv = a((i+j)/2)\ndo\n do\n if (a(i) < pv) then\n i = i+1\n else\n exit\n end if\n end do\n do\n if(a(j) > pv) then\n j = j-1\n else\n exit\n end if\n end do\n if (i>=j) then\n exit\n else\n toobig = a(j)\n toosmall = a(i)\n a(i) = toobig\n a(j) = toosmall\n i = i+1\n j = j-1\n end if\n end do\n if (i > 2) then\n call qsort(a(1:i-1))\n end if\n if (j < n-1) then\n call qsort(a(j+1:n))\n end if\nend subroutine qsort\n\npure recursive function intQsort( a ) result( r )\nimplicit none\ninteger(16), intent(in) :: a(:)\ninteger(16) :: r( size(a) )\ninteger(16) :: sample(3), len, i,j\n\nlen = size( a(:) )\nif( len<=1 )then\n r = a\nelse\n !select pivot\n sample(1:3) = [a(1), a(len/2), a(len)]\n do i = 1,2\n do j = 2,3\n if( sample(i)>sample(j) )then\n len = sample(i) !len is buffer\n sample(i) = sample(j)\n sample(j) = len\n end if\n end do\n end do\n \n r = [ intQsort( pack(a(:), a(:)< sample(2)) ), &\n pack(a(:), a(:)==sample(2)) , &\n intQsort( pack(a(:), a(:)> sample(2)) ) ]\nend if\nend function intQsort\n\nend program main", "problem_context": "Score: 400 points\n\nProblem Statement\n\nQuickly after finishing the tutorial of the online game ATChat, you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the friendliness of Player i is A_i.\n\nThe N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere.\n\nWhen each player, except the first one to arrive, arrives at the place, the player gets comfort equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0.\n\nWhat is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the maximum total comfort the N players can get.\n\nSample Input 1\n\n4\n2 2 1 3\n\nSample Output 1\n\n7\n\nBy arriving at the place in the order Player 4, 2, 1, 3, and cutting into the circle as shown in the figure, they can get the total comfort of 7.\n\nThey cannot get the total comfort greater than 7, so the answer is 7.\n\nSample Input 2\n\n7\n1 1 1 1 1 1 1\n\nSample Output 2\n\n6", "sample_input": "4\n2 2 1 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02615", "source_text": "Score: 400 points\n\nProblem Statement\n\nQuickly after finishing the tutorial of the online game ATChat, you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the friendliness of Player i is A_i.\n\nThe N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere.\n\nWhen each player, except the first one to arrive, arrives at the place, the player gets comfort equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0.\n\nWhat is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the maximum total comfort the N players can get.\n\nSample Input 1\n\n4\n2 2 1 3\n\nSample Output 1\n\n7\n\nBy arriving at the place in the order Player 4, 2, 1, 3, and cutting into the circle as shown in the figure, they can get the total comfort of 7.\n\nThey cannot get the total comfort greater than 7, so the answer is 7.\n\nSample Input 2\n\n7\n1 1 1 1 1 1 1\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2790, "cpu_time_ms": 2275, "memory_kb": 2527968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s032424993", "group_id": "codeNet:p02615", "input_text": "program sample\n implicit none\n \n integer(8) :: i,j,m,n\n integer(8),allocatable :: x(:),y(:)\n \n read(*,*) n\n allocate(x(n))\n read(*,*)x\n call msort(x)\n m=x(n)\n if (mod(n,2)==0)then\n do i=n/2+1,n-1\n m=m+x(i)*2\n end do\n else\n m=m+x(n/2+1)\n do i=n/2+2,n-1\n m=m+x(i)*2\n end do\n end if\n\n write(*,*)m\n stop\n contains\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n \n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n \n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n \n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n \n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n \n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n \n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1594000636, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02615.html", "problem_id": "p02615", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02615/input.txt", "sample_output_relpath": "derived/input_output/data/p02615/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02615/Fortran/s032424993.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s032424993", "user_id": "u713568912"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program sample\n implicit none\n \n integer(8) :: i,j,m,n\n integer(8),allocatable :: x(:),y(:)\n \n read(*,*) n\n allocate(x(n))\n read(*,*)x\n call msort(x)\n m=x(n)\n if (mod(n,2)==0)then\n do i=n/2+1,n-1\n m=m+x(i)*2\n end do\n else\n m=m+x(n/2+1)\n do i=n/2+2,n-1\n m=m+x(i)*2\n end do\n end if\n\n write(*,*)m\n stop\n contains\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n \n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n \n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n \n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n \n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n \n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n \n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\nend program sample\n \n\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nQuickly after finishing the tutorial of the online game ATChat, you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the friendliness of Player i is A_i.\n\nThe N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere.\n\nWhen each player, except the first one to arrive, arrives at the place, the player gets comfort equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0.\n\nWhat is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the maximum total comfort the N players can get.\n\nSample Input 1\n\n4\n2 2 1 3\n\nSample Output 1\n\n7\n\nBy arriving at the place in the order Player 4, 2, 1, 3, and cutting into the circle as shown in the figure, they can get the total comfort of 7.\n\nThey cannot get the total comfort greater than 7, so the answer is 7.\n\nSample Input 2\n\n7\n1 1 1 1 1 1 1\n\nSample Output 2\n\n6", "sample_input": "4\n2 2 1 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02615", "source_text": "Score: 400 points\n\nProblem Statement\n\nQuickly after finishing the tutorial of the online game ATChat, you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the friendliness of Player i is A_i.\n\nThe N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere.\n\nWhen each player, except the first one to arrive, arrives at the place, the player gets comfort equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0.\n\nWhat is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the maximum total comfort the N players can get.\n\nSample Input 1\n\n4\n2 2 1 3\n\nSample Output 1\n\n7\n\nBy arriving at the place in the order Player 4, 2, 1, 3, and cutting into the circle as shown in the figure, they can get the total comfort of 7.\n\nThey cannot get the total comfort greater than 7, so the answer is 7.\n\nSample Input 2\n\n7\n1 1 1 1 1 1 1\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1699, "cpu_time_ms": 81, "memory_kb": 6928}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s603146993", "group_id": "codeNet:p02615", "input_text": "program main\n implicit none\n integer(8) i, ans, frag, r, N\n integer(8),allocatable :: A(:)\n \n read(*, *) N\n allocate(A(N))\n read(*, *) (A(i), i = 1,N)\n call qsort(A)\n ans = 0\n r = N\n frag = 1\n do i = 1,N-1\n ans = ans + A(r)\n if (frag == 1) then\n frag = 0\n r = r-1\n else\n frag = 1\n end if\n end do\n\n write(*, *) ans\n \ncontains\n\nrecursive subroutine qsort(a)\nimplicit none\n!integer(8),intent(in) :: n\ninteger(8),intent(inout) :: a(:)\ninteger(8)::i,j,toobig,toosmall,pv,n\nn = size(a)\ni = 1\nj = n\npv = a((i+j)/2)\ndo\n do\n if (a(i) < pv) then\n i = i+1\n else\n exit\n end if\n end do\n do\n if(a(j) > pv) then\n j = j-1\n else\n exit\n end if\n end do\n if (i>=j) then\n exit\n else\n toobig = a(j)\n toosmall = a(i)\n a(i) = toobig\n a(j) = toosmall\n i = i+1\n j = j-1\n end if\n end do\n if (i > 2) then\n call qsort(a(1:i-1))\n end if\n if (j < n-1) then\n call qsort(a(j+1:n))\n end if\nend subroutine qsort\nend program main\n\n", "language": "Fortran", "metadata": {"date": 1593999837, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02615.html", "problem_id": "p02615", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02615/input.txt", "sample_output_relpath": "derived/input_output/data/p02615/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02615/Fortran/s603146993.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s603146993", "user_id": "u050276949"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program main\n implicit none\n integer(8) i, ans, frag, r, N\n integer(8),allocatable :: A(:)\n \n read(*, *) N\n allocate(A(N))\n read(*, *) (A(i), i = 1,N)\n call qsort(A)\n ans = 0\n r = N\n frag = 1\n do i = 1,N-1\n ans = ans + A(r)\n if (frag == 1) then\n frag = 0\n r = r-1\n else\n frag = 1\n end if\n end do\n\n write(*, *) ans\n \ncontains\n\nrecursive subroutine qsort(a)\nimplicit none\n!integer(8),intent(in) :: n\ninteger(8),intent(inout) :: a(:)\ninteger(8)::i,j,toobig,toosmall,pv,n\nn = size(a)\ni = 1\nj = n\npv = a((i+j)/2)\ndo\n do\n if (a(i) < pv) then\n i = i+1\n else\n exit\n end if\n end do\n do\n if(a(j) > pv) then\n j = j-1\n else\n exit\n end if\n end do\n if (i>=j) then\n exit\n else\n toobig = a(j)\n toosmall = a(i)\n a(i) = toobig\n a(j) = toosmall\n i = i+1\n j = j-1\n end if\n end do\n if (i > 2) then\n call qsort(a(1:i-1))\n end if\n if (j < n-1) then\n call qsort(a(j+1:n))\n end if\nend subroutine qsort\nend program main\n\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nQuickly after finishing the tutorial of the online game ATChat, you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the friendliness of Player i is A_i.\n\nThe N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere.\n\nWhen each player, except the first one to arrive, arrives at the place, the player gets comfort equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0.\n\nWhat is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the maximum total comfort the N players can get.\n\nSample Input 1\n\n4\n2 2 1 3\n\nSample Output 1\n\n7\n\nBy arriving at the place in the order Player 4, 2, 1, 3, and cutting into the circle as shown in the figure, they can get the total comfort of 7.\n\nThey cannot get the total comfort greater than 7, so the answer is 7.\n\nSample Input 2\n\n7\n1 1 1 1 1 1 1\n\nSample Output 2\n\n6", "sample_input": "4\n2 2 1 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02615", "source_text": "Score: 400 points\n\nProblem Statement\n\nQuickly after finishing the tutorial of the online game ATChat, you have decided to visit a particular place with N-1 players who happen to be there. These N players, including you, are numbered 1 through N, and the friendliness of Player i is A_i.\n\nThe N players will arrive at the place one by one in some order. To make sure nobody gets lost, you have set the following rule: players who have already arrived there should form a circle, and a player who has just arrived there should cut into the circle somewhere.\n\nWhen each player, except the first one to arrive, arrives at the place, the player gets comfort equal to the smaller of the friendliness of the clockwise adjacent player and that of the counter-clockwise adjacent player. The first player to arrive there gets the comfort of 0.\n\nWhat is the maximum total comfort the N players can get by optimally choosing the order of arrivals and the positions in the circle to cut into?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the maximum total comfort the N players can get.\n\nSample Input 1\n\n4\n2 2 1 3\n\nSample Output 1\n\n7\n\nBy arriving at the place in the order Player 4, 2, 1, 3, and cutting into the circle as shown in the figure, they can get the total comfort of 7.\n\nThey cannot get the total comfort greater than 7, so the answer is 7.\n\nSample Input 2\n\n7\n1 1 1 1 1 1 1\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1031, "cpu_time_ms": 74, "memory_kb": 4628}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s376597510", "group_id": "codeNet:p02616", "input_text": "program multiplication_4\n implicit none\n integer(8), parameter :: m = 1000000007\n integer :: n, k, i, j, cnt = 0\n integer(8) :: a(200000, 2) = 0, nega = -1, posi = -1, x = 1, y = -1, z = -1\n real(8) :: nn = -1.d0, pp = -1.d0\n read(*,*) n, k\n read(*,*) a(1:n, 1)\n if (n == k) then\n do i = 1, n\n x = modulo(x * a(i, 1), m)\n end do\n write(*,'(i0)') x\n stop\n end if\n call merge_sort(a(1:n, :))\n if (a(1, 1) < 0 .and. mod(k, 2) == 1) then\n do i = 1, k\n x = modulo(x * a(i, 1), m)\n end do\n write(*,'(i0)') x\n stop\n end if\n do i = 1, n\n if (a(i, 1) >= 0) then\n a(i, 2) = 0\n else\n a(i, 1) = -a(i, 1)\n a(i, 2) = 1\n end if\n end do\n call merge_sort(a(1:n, :))\n do i = 1, k\n x = mod(x * a(i, 1), m)\n if (a(i, 2) == 1) then\n cnt = cnt + 1\n nega = a(i, 1)\n else\n posi = a(i, 1)\n end if\n end do\n if (x == 0 .or. mod(cnt, 2) == 0) then\n write(*,'(i0)') x\n stop\n end if\n if (posi /= -1) then\n do i = k + 1, n\n if (a(i, 2) == 1) then\n y = mod(x * a(i, 1), m)\n y = mod(y * inv(posi), m)\n pp = a(i, 1) / real(posi, 8)\n exit\n end if\n end do\n end if\n if (nega /= -1) then\n do i = k + 1, n\n if (a(i, 2) == 0) then\n z = mod(x * a(i, 1), m)\n z = mod(z * inv(nega), m)\n nn = a(i, 1) / real(nega, 8)\n exit\n end if\n end do\n end if\n write(*,'(i0)') merge(y, z, pp > nn)\ncontains\n subroutine merge_sort(a)\n integer(8), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(8), intent(inout) :: a1(:, :), a2(:, :)\n integer(8) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (a1(i1, 1) > a2(i2, 1) .or. &\n (a1(i1, 1) == a2(i2, 1) .and. a1(i1, 2) <= a2(i2, 2))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\n pure elemental integer(8) function inv(v) result(res)\n integer(8), intent(in) :: v\n integer(8) :: a, b, c, x, y, z\n a = v\n b = m\n c = 0\n res = 1\n do while (b /= 0)\n x = b\n y = mod(a, b)\n z = res - a / b * c\n res = c\n a = x\n b = y\n c = z\n end do\n res = modulo(res, m)\n end\nend program multiplication_4", "language": "Fortran", "metadata": {"date": 1593982442, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02616.html", "problem_id": "p02616", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02616/input.txt", "sample_output_relpath": "derived/input_output/data/p02616/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02616/Fortran/s376597510.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s376597510", "user_id": "u506403362"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "program multiplication_4\n implicit none\n integer(8), parameter :: m = 1000000007\n integer :: n, k, i, j, cnt = 0\n integer(8) :: a(200000, 2) = 0, nega = -1, posi = -1, x = 1, y = -1, z = -1\n real(8) :: nn = -1.d0, pp = -1.d0\n read(*,*) n, k\n read(*,*) a(1:n, 1)\n if (n == k) then\n do i = 1, n\n x = modulo(x * a(i, 1), m)\n end do\n write(*,'(i0)') x\n stop\n end if\n call merge_sort(a(1:n, :))\n if (a(1, 1) < 0 .and. mod(k, 2) == 1) then\n do i = 1, k\n x = modulo(x * a(i, 1), m)\n end do\n write(*,'(i0)') x\n stop\n end if\n do i = 1, n\n if (a(i, 1) >= 0) then\n a(i, 2) = 0\n else\n a(i, 1) = -a(i, 1)\n a(i, 2) = 1\n end if\n end do\n call merge_sort(a(1:n, :))\n do i = 1, k\n x = mod(x * a(i, 1), m)\n if (a(i, 2) == 1) then\n cnt = cnt + 1\n nega = a(i, 1)\n else\n posi = a(i, 1)\n end if\n end do\n if (x == 0 .or. mod(cnt, 2) == 0) then\n write(*,'(i0)') x\n stop\n end if\n if (posi /= -1) then\n do i = k + 1, n\n if (a(i, 2) == 1) then\n y = mod(x * a(i, 1), m)\n y = mod(y * inv(posi), m)\n pp = a(i, 1) / real(posi, 8)\n exit\n end if\n end do\n end if\n if (nega /= -1) then\n do i = k + 1, n\n if (a(i, 2) == 0) then\n z = mod(x * a(i, 1), m)\n z = mod(z * inv(nega), m)\n nn = a(i, 1) / real(nega, 8)\n exit\n end if\n end do\n end if\n write(*,'(i0)') merge(y, z, pp > nn)\ncontains\n subroutine merge_sort(a)\n integer(8), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(8), intent(inout) :: a1(:, :), a2(:, :)\n integer(8) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (a1(i1, 1) > a2(i2, 1) .or. &\n (a1(i1, 1) == a2(i2, 1) .and. a1(i1, 2) <= a2(i2, 2))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\n pure elemental integer(8) function inv(v) result(res)\n integer(8), intent(in) :: v\n integer(8) :: a, b, c, x, y, z\n a = v\n b = m\n c = 0\n res = 1\n do while (b /= 0)\n x = b\n y = mod(a, b)\n z = res - a / b * c\n res = c\n a = x\n b = y\n c = z\n end do\n res = modulo(res, m)\n end\nend program multiplication_4", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nWe will choose exactly K of these elements. Find the maximum possible product of the chosen elements.\n\nThen, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2\\times 10^5\n\n|A_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 \\ldots A_N\n\nOutput\n\nPrint the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nSample Input 1\n\n4 2\n1 2 -3 -4\n\nSample Output 1\n\n12\n\nThe possible products of the two chosen elements are 2, -3, -4, -6, -8, and 12, so the maximum product is 12.\n\nSample Input 2\n\n4 3\n-1 -2 -3 -4\n\nSample Output 2\n\n1000000001\n\nThe possible products of the three chosen elements are -24, -12, -8, and -6, so the maximum product is -6.\n\nWe print this value modulo (10^9+7), that is, 1000000001.\n\nSample Input 3\n\n2 1\n-1 1000000000\n\nSample Output 3\n\n1000000000\n\nThe possible products of the one chosen element are -1 and 1000000000, so the maximum product is 1000000000.\n\nSample Input 4\n\n10 10\n1000000000 100000000 10000000 1000000 100000 10000 1000 100 10 1\n\nSample Output 4\n\n999983200\n\nBe sure to print the product modulo (10^9+7).", "sample_input": "4 2\n1 2 -3 -4\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02616", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nWe will choose exactly K of these elements. Find the maximum possible product of the chosen elements.\n\nThen, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2\\times 10^5\n\n|A_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 \\ldots A_N\n\nOutput\n\nPrint the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nSample Input 1\n\n4 2\n1 2 -3 -4\n\nSample Output 1\n\n12\n\nThe possible products of the two chosen elements are 2, -3, -4, -6, -8, and 12, so the maximum product is 12.\n\nSample Input 2\n\n4 3\n-1 -2 -3 -4\n\nSample Output 2\n\n1000000001\n\nThe possible products of the three chosen elements are -24, -12, -8, and -6, so the maximum product is -6.\n\nWe print this value modulo (10^9+7), that is, 1000000001.\n\nSample Input 3\n\n2 1\n-1 1000000000\n\nSample Output 3\n\n1000000000\n\nThe possible products of the one chosen element are -1 and 1000000000, so the maximum product is 1000000000.\n\nSample Input 4\n\n10 10\n1000000000 100000000 10000000 1000000 100000 10000 1000 100 10 1\n\nSample Output 4\n\n999983200\n\nBe sure to print the product modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2910, "cpu_time_ms": 111, "memory_kb": 10504}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s350050712", "group_id": "codeNet:p02616", "input_text": "program multiplication_4\n implicit none\n integer(8), parameter :: m = 1000000007\n integer :: n, k, i, j, cnt = 0\n integer(8) :: a(200000, 2) = 0, nega = -1, posi = -1, x = 1, y = -1, z = -1\n real(8) :: nn = -1.d0, pp = -1.d0\n read(*,*) n, k\n read(*,*) a(1:n, 1)\n if (n == k) then\n do i = 1, n\n x = modulo(x * a(i, 1), m)\n end do\n write(*,'(i0)') x\n stop\n end if\n call merge_sort(a(1:n, :))\n if (a(1, 1) < 0) then\n if (mod(k, 2) == 0) then\n do i = 1, k\n x = modulo(x * a(n - i + 1, 1), m)\n end do\n else\n do i = 1, k\n x = modulo(x * a(i, 1), m)\n end do\n end if\n write(*,'(i0)') x\n stop\n end if\n do i = 1, n\n if (a(i, 1) >= 0) then\n a(i, 2) = 0\n else\n a(i, 1) = -a(i, 1)\n a(i, 2) = 1\n end if\n end do\n call merge_sort(a(1:n, :))\n do i = 1, k\n x = mod(x * a(i, 1), m)\n if (a(i, 2) == 1) then\n cnt = cnt + 1\n nega = a(i, 1)\n else\n posi = a(i, 1)\n end if\n end do\n if (x == 0 .or. mod(cnt, 2) == 0) then\n write(*,'(i0)') x\n stop\n end if\n if (posi /= -1) then\n do i = k + 1, n\n if (a(i, 2) == 1) then\n y = mod(x * a(i, 1), m)\n y = mod(y * inv(posi), m)\n pp = a(i, 1) / real(posi, 8)\n exit\n end if\n end do\n end if\n if (nega /= -1) then\n do i = k + 1, n\n if (a(i, 2) == 0) then\n z = mod(x * a(i, 1), m)\n z = mod(z * inv(nega), m)\n nn = a(i, 1) / real(nega, 8)\n exit\n end if\n end do\n end if\n write(*,'(i0)') merge(y, z, pp > nn)\ncontains\n subroutine merge_sort(a)\n integer(8), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(8), intent(inout) :: a1(:, :), a2(:, :)\n integer(8) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (a1(i1, 1) > a2(i2, 1) .or. &\n (a1(i1, 1) == a2(i2, 1) .and. a1(i1, 2) <= a2(i2, 2))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\n pure elemental integer(8) function inv(v) result(res)\n integer(8), intent(in) :: v\n integer(8) :: a, b, c, x, y, z\n a = v\n b = m\n c = 0\n res = 1\n do while (b /= 0)\n x = b\n y = mod(a, b)\n z = res - a / b * c\n res = c\n a = x\n b = y\n c = z\n end do\n res = modulo(res, m)\n end\nend program multiplication_4", "language": "Fortran", "metadata": {"date": 1593981591, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02616.html", "problem_id": "p02616", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02616/input.txt", "sample_output_relpath": "derived/input_output/data/p02616/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02616/Fortran/s350050712.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s350050712", "user_id": "u506403362"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "program multiplication_4\n implicit none\n integer(8), parameter :: m = 1000000007\n integer :: n, k, i, j, cnt = 0\n integer(8) :: a(200000, 2) = 0, nega = -1, posi = -1, x = 1, y = -1, z = -1\n real(8) :: nn = -1.d0, pp = -1.d0\n read(*,*) n, k\n read(*,*) a(1:n, 1)\n if (n == k) then\n do i = 1, n\n x = modulo(x * a(i, 1), m)\n end do\n write(*,'(i0)') x\n stop\n end if\n call merge_sort(a(1:n, :))\n if (a(1, 1) < 0) then\n if (mod(k, 2) == 0) then\n do i = 1, k\n x = modulo(x * a(n - i + 1, 1), m)\n end do\n else\n do i = 1, k\n x = modulo(x * a(i, 1), m)\n end do\n end if\n write(*,'(i0)') x\n stop\n end if\n do i = 1, n\n if (a(i, 1) >= 0) then\n a(i, 2) = 0\n else\n a(i, 1) = -a(i, 1)\n a(i, 2) = 1\n end if\n end do\n call merge_sort(a(1:n, :))\n do i = 1, k\n x = mod(x * a(i, 1), m)\n if (a(i, 2) == 1) then\n cnt = cnt + 1\n nega = a(i, 1)\n else\n posi = a(i, 1)\n end if\n end do\n if (x == 0 .or. mod(cnt, 2) == 0) then\n write(*,'(i0)') x\n stop\n end if\n if (posi /= -1) then\n do i = k + 1, n\n if (a(i, 2) == 1) then\n y = mod(x * a(i, 1), m)\n y = mod(y * inv(posi), m)\n pp = a(i, 1) / real(posi, 8)\n exit\n end if\n end do\n end if\n if (nega /= -1) then\n do i = k + 1, n\n if (a(i, 2) == 0) then\n z = mod(x * a(i, 1), m)\n z = mod(z * inv(nega), m)\n nn = a(i, 1) / real(nega, 8)\n exit\n end if\n end do\n end if\n write(*,'(i0)') merge(y, z, pp > nn)\ncontains\n subroutine merge_sort(a)\n integer(8), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(8), intent(inout) :: a1(:, :), a2(:, :)\n integer(8) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (a1(i1, 1) > a2(i2, 1) .or. &\n (a1(i1, 1) == a2(i2, 1) .and. a1(i1, 2) <= a2(i2, 2))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\n pure elemental integer(8) function inv(v) result(res)\n integer(8), intent(in) :: v\n integer(8) :: a, b, c, x, y, z\n a = v\n b = m\n c = 0\n res = 1\n do while (b /= 0)\n x = b\n y = mod(a, b)\n z = res - a / b * c\n res = c\n a = x\n b = y\n c = z\n end do\n res = modulo(res, m)\n end\nend program multiplication_4", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nWe will choose exactly K of these elements. Find the maximum possible product of the chosen elements.\n\nThen, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2\\times 10^5\n\n|A_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 \\ldots A_N\n\nOutput\n\nPrint the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nSample Input 1\n\n4 2\n1 2 -3 -4\n\nSample Output 1\n\n12\n\nThe possible products of the two chosen elements are 2, -3, -4, -6, -8, and 12, so the maximum product is 12.\n\nSample Input 2\n\n4 3\n-1 -2 -3 -4\n\nSample Output 2\n\n1000000001\n\nThe possible products of the three chosen elements are -24, -12, -8, and -6, so the maximum product is -6.\n\nWe print this value modulo (10^9+7), that is, 1000000001.\n\nSample Input 3\n\n2 1\n-1 1000000000\n\nSample Output 3\n\n1000000000\n\nThe possible products of the one chosen element are -1 and 1000000000, so the maximum product is 1000000000.\n\nSample Input 4\n\n10 10\n1000000000 100000000 10000000 1000000 100000 10000 1000 100 10 1\n\nSample Output 4\n\n999983200\n\nBe sure to print the product modulo (10^9+7).", "sample_input": "4 2\n1 2 -3 -4\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02616", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are N integers A_1,\\ldots,A_N.\n\nWe will choose exactly K of these elements. Find the maximum possible product of the chosen elements.\n\nThen, print the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2\\times 10^5\n\n|A_i| \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 \\ldots A_N\n\nOutput\n\nPrint the maximum product modulo (10^9+7), using an integer between 0 and 10^9+6 (inclusive).\n\nSample Input 1\n\n4 2\n1 2 -3 -4\n\nSample Output 1\n\n12\n\nThe possible products of the two chosen elements are 2, -3, -4, -6, -8, and 12, so the maximum product is 12.\n\nSample Input 2\n\n4 3\n-1 -2 -3 -4\n\nSample Output 2\n\n1000000001\n\nThe possible products of the three chosen elements are -24, -12, -8, and -6, so the maximum product is -6.\n\nWe print this value modulo (10^9+7), that is, 1000000001.\n\nSample Input 3\n\n2 1\n-1 1000000000\n\nSample Output 3\n\n1000000000\n\nThe possible products of the one chosen element are -1 and 1000000000, so the maximum product is 1000000000.\n\nSample Input 4\n\n10 10\n1000000000 100000000 10000000 1000000 100000 10000 1000 100 10 1\n\nSample Output 4\n\n999983200\n\nBe sure to print the product modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3018, "cpu_time_ms": 111, "memory_kb": 10508}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s040001877", "group_id": "codeNet:p02620", "input_text": "program incremental_scoring\n implicit none\n integer :: d, c(26) = 0, s(26, 365) = 0, t(365) = 0, m, p, q, i\n read(*,*) d\n read(*,*) c\n read(*,*) (s(:, i), i = 1, d)\n read(*,*) (t(i), i = 1, d)\n read(*,*) m\n do i = 1, m\n read(*,*) p, q\n t(p) = q\n write(*,'(i0)') score()\n end do\ncontains\n integer function score() result(res)\n integer :: last(26), i\n last = 0\n res = 0\n do i = 1, d\n last(t(i)) = i\n res = res + s(t(i), i) - sum(c * (i - last))\n end do\n end\nend program incremental_scoring", "language": "Fortran", "metadata": {"date": 1593393857, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02620.html", "problem_id": "p02620", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02620/input.txt", "sample_output_relpath": "derived/input_output/data/p02620/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02620/Fortran/s040001877.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s040001877", "user_id": "u506403362"}, "prompt_components": {"gold_output": "72882\n56634\n38425\n27930\n42884\n", "input_to_evaluate": "program incremental_scoring\n implicit none\n integer :: d, c(26) = 0, s(26, 365) = 0, t(365) = 0, m, p, q, i\n read(*,*) d\n read(*,*) c\n read(*,*) (s(:, i), i = 1, d)\n read(*,*) (t(i), i = 1, d)\n read(*,*) m\n do i = 1, m\n read(*,*) p, q\n t(p) = q\n write(*,'(i0)') score()\n end do\ncontains\n integer function score() result(res)\n integer :: last(26), i\n last = 0\n res = 0\n do i = 1, d\n last(t(i)) = i\n res = res + s(t(i), i) - sum(c * (i - last))\n end do\n end\nend program incremental_scoring", "problem_context": "(Please read problem A first. The maximum score you can get by solving this problem C is 1, which will have almost no effect on your ranking.)\n\nBeginner's Guide\n\n\"Local search\" is a powerful method for finding a high-quality solution.\nIn this method, instead of constructing a solution from scratch, we try to find a better solution by slightly modifying the already found solution.\nIf the solution gets better, update it, and if it gets worse, restore it.\nBy repeating this process, the quality of the solution is gradually improved over time.\nThe pseudo-code is as follows.\n\nsolution = compute an initial solution (by random generation, or by applying other methods such as greedy)\nwhile the remaining time > 0:\nslightly modify the solution (randomly)\nif the solution gets worse:\nrestore the solution\n\nFor example, in this problem, we can use the following modification: pick the date d and contest type q at random and change the type of contest to be held on day d to q.\nThe pseudo-code is as follows.\n\nt[1..D] = compute an initial solution (by random generation, or by applying other methods such as greedy)\nwhile the remaining time > 0:\npick d and q at random\nold = t[d] # Remember the original value so that we can restore it later\nt[d] = q\nif the solution gets worse:\nt[d] = old\n\nThe most important thing when using the local search method is the design of how to modify solutions.\n\nIf the amount of modification is too small, we will soon fall into a dead-end (local optimum) and, conversely, if the amount of modification is too large, the probability of finding an improving move becomes extremely small.\n\nIn order to increase the number of iterations, it is desirable to be able to quickly calculate the score after applying a modification.\n\nIn this problem C, we focus on the second point.\nThe score after the modification can, of course, be obtained by calculating the score from scratch.\nHowever, by focusing on only the parts that have been modified, it may be possible to quickly compute the difference between the scores before and after the modification.\nFrom another viewpoint, the impossibility of such a fast incremental calculation implies that a small modification to the solution affects a majority of the score calculation.\nIn such a case, we may need to redesign how to modify solutions, or there is a high possibility that the problem is not suitable for local search.\nLet's implement fast incremental score computation.\nIt's time to demonstrate the skills of algorithms and data structures you have developed in ABC and ARC!\n\nIn this kind of contest, where the objective is to find a better solution instead of the optimal one, a bug in a program does not result in a wrong answer, which may delay the discovery of the bug.\nFor early detection of bugs, it is a good idea to unit test functions you implemented complicated routines.\nFor example, if you implement fast incremental score calculation, it is a good idea to test that the scores computed by the fast implementation match the scores computed from scratch, as we will do in this problem C.\n\nProblem Statement\n\nYou will be given a contest schedule for D days and M queries of schedule modification.\nIn the i-th query, given integers d_i and q_i, change the type of contest to be held on day d_i to q_i, and then output the final satisfaction at the end of day D on the updated schedule.\nNote that we do not revert each query. That is, the i-th query is applied to the new schedule obtained by the (i-1)-th query.\n\nInput\n\nInput is given from Standard Input in the form of the input of Problem A followed by the output of Problem A and the queries.\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\nt_1\nt_2\n\\vdots\nt_D\nM\nd_1 q_1\nd_2 q_2\n\\vdots\nd_M q_M\n\nThe constraints and generation methods for the input part are the same as those for Problem A.\n\nFor each d=1,\\ldots,D, t_d is an integer generated independently and uniformly at random from {1,2,\\ldots,26}.\n\nThe number of queries M is an integer satisfying 1\\leq M\\leq 10^5.\n\nFor each i=1,\\ldots,M, d_i is an integer generated independently and uniformly at random from {1,2,\\ldots,D}.\n\nFor each i=1,\\ldots,26, q_i is an integer satisfying 1\\leq q_i\\leq 26 generated uniformly at random from the 25 values that differ from the type of contest on day d_i.\n\nOutput\n\nLet v_i be the final satisfaction at the end of day D on the schedule after applying the i-th query.\nPrint M integers v_i to Standard Output in the following format:\n\nv_1\nv_2\n\\vdots\nv_M\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n1\n17\n13\n14\n13\n5\n1 7\n4 11\n3 4\n5 24\n4 19\n\nSample Output 1\n\n72882\n56634\n38425\n27930\n42884\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case.\n\nNext Step\n\nLet's go back to Problem A and implement the local search algorithm by utilizing the incremental score calculator you just implemented!\nFor this problem, the current modification \"pick the date d and contest type q at random and change the type of contest to be held on day d to q\" is actually not so good. By considering why it is not good, let's improve the modification operation.\nOne of the most powerful and widely used variant of the local search method is \"Simulated Annealing (SA)\", which makes it easier to reach a better solution by stochastically accepting worsening moves.\nFor more information about SA and other local search techniques, please refer to the editorial that will be published after the contest.", "sample_input": "5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n1\n17\n13\n14\n13\n5\n1 7\n4 11\n3 4\n5 24\n4 19\n"}, "reference_outputs": ["72882\n56634\n38425\n27930\n42884\n"], "source_document_id": "p02620", "source_text": "(Please read problem A first. The maximum score you can get by solving this problem C is 1, which will have almost no effect on your ranking.)\n\nBeginner's Guide\n\n\"Local search\" is a powerful method for finding a high-quality solution.\nIn this method, instead of constructing a solution from scratch, we try to find a better solution by slightly modifying the already found solution.\nIf the solution gets better, update it, and if it gets worse, restore it.\nBy repeating this process, the quality of the solution is gradually improved over time.\nThe pseudo-code is as follows.\n\nsolution = compute an initial solution (by random generation, or by applying other methods such as greedy)\nwhile the remaining time > 0:\nslightly modify the solution (randomly)\nif the solution gets worse:\nrestore the solution\n\nFor example, in this problem, we can use the following modification: pick the date d and contest type q at random and change the type of contest to be held on day d to q.\nThe pseudo-code is as follows.\n\nt[1..D] = compute an initial solution (by random generation, or by applying other methods such as greedy)\nwhile the remaining time > 0:\npick d and q at random\nold = t[d] # Remember the original value so that we can restore it later\nt[d] = q\nif the solution gets worse:\nt[d] = old\n\nThe most important thing when using the local search method is the design of how to modify solutions.\n\nIf the amount of modification is too small, we will soon fall into a dead-end (local optimum) and, conversely, if the amount of modification is too large, the probability of finding an improving move becomes extremely small.\n\nIn order to increase the number of iterations, it is desirable to be able to quickly calculate the score after applying a modification.\n\nIn this problem C, we focus on the second point.\nThe score after the modification can, of course, be obtained by calculating the score from scratch.\nHowever, by focusing on only the parts that have been modified, it may be possible to quickly compute the difference between the scores before and after the modification.\nFrom another viewpoint, the impossibility of such a fast incremental calculation implies that a small modification to the solution affects a majority of the score calculation.\nIn such a case, we may need to redesign how to modify solutions, or there is a high possibility that the problem is not suitable for local search.\nLet's implement fast incremental score computation.\nIt's time to demonstrate the skills of algorithms and data structures you have developed in ABC and ARC!\n\nIn this kind of contest, where the objective is to find a better solution instead of the optimal one, a bug in a program does not result in a wrong answer, which may delay the discovery of the bug.\nFor early detection of bugs, it is a good idea to unit test functions you implemented complicated routines.\nFor example, if you implement fast incremental score calculation, it is a good idea to test that the scores computed by the fast implementation match the scores computed from scratch, as we will do in this problem C.\n\nProblem Statement\n\nYou will be given a contest schedule for D days and M queries of schedule modification.\nIn the i-th query, given integers d_i and q_i, change the type of contest to be held on day d_i to q_i, and then output the final satisfaction at the end of day D on the updated schedule.\nNote that we do not revert each query. That is, the i-th query is applied to the new schedule obtained by the (i-1)-th query.\n\nInput\n\nInput is given from Standard Input in the form of the input of Problem A followed by the output of Problem A and the queries.\n\nD\nc_1 c_2 \\cdots c_{26}\ns_{1,1} s_{1,2} \\cdots s_{1,26}\n\\vdots\ns_{D,1} s_{D,2} \\cdots s_{D,26}\nt_1\nt_2\n\\vdots\nt_D\nM\nd_1 q_1\nd_2 q_2\n\\vdots\nd_M q_M\n\nThe constraints and generation methods for the input part are the same as those for Problem A.\n\nFor each d=1,\\ldots,D, t_d is an integer generated independently and uniformly at random from {1,2,\\ldots,26}.\n\nThe number of queries M is an integer satisfying 1\\leq M\\leq 10^5.\n\nFor each i=1,\\ldots,M, d_i is an integer generated independently and uniformly at random from {1,2,\\ldots,D}.\n\nFor each i=1,\\ldots,26, q_i is an integer satisfying 1\\leq q_i\\leq 26 generated uniformly at random from the 25 values that differ from the type of contest on day d_i.\n\nOutput\n\nLet v_i be the final satisfaction at the end of day D on the schedule after applying the i-th query.\nPrint M integers v_i to Standard Output in the following format:\n\nv_1\nv_2\n\\vdots\nv_M\n\nSample Input 1\n\n5\n86 90 69 51 2 96 71 47 88 34 45 46 89 34 31 38 97 84 41 80 14 4 50 83 7 82\n19771 12979 18912 10432 10544 12928 13403 3047 10527 9740 8100 92 2856 14730 1396 15905 6534 4650 11469 3628 8433 2994 10899 16396 18355 11424\n6674 17707 13855 16407 12232 2886 11908 1705 5000 1537 10440 10711 4917 10770 17272 15364 19277 18094 3929 3705 7169 6159 18683 15410 9092 4570\n6878 4239 19925 1799 375 9563 3445 5658 19857 11401 6997 6498 19933 3848 2426 2146 19745 16880 17773 18359 3921 14172 16730 11157 5439 256\n8633 15862 15303 10749 18499 7792 10317 5901 9395 11433 3514 3959 5202 19850 19469 9790 5653 784 18500 10552 17975 16615 7852 197 8471 7452\n19855 17918 7990 10572 4333 438 9140 9104 12622 4985 12319 4028 19922 12132 16259 17476 2976 547 19195 19830 16285 4806 4471 9457 2864 2192\n1\n17\n13\n14\n13\n5\n1 7\n4 11\n3 4\n5 24\n4 19\n\nSample Output 1\n\n72882\n56634\n38425\n27930\n42884\n\nNote that this example is a small one for checking the problem specification. It does not satisfy the constraint D=365 and is never actually given as a test case.\n\nNext Step\n\nLet's go back to Problem A and implement the local search algorithm by utilizing the incremental score calculator you just implemented!\nFor this problem, the current modification \"pick the date d and contest type q at random and change the type of contest to be held on day d to q\" is actually not so good. By considering why it is not good, let's improve the modification operation.\nOne of the most powerful and widely used variant of the local search method is \"Simulated Annealing (SA)\", which makes it easier to reach a better solution by stochastically accepting worsening moves.\nFor more information about SA and other local search techniques, please refer to the editorial that will be published after the contest.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 532, "cpu_time_ms": 710, "memory_kb": 2868}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s980038298", "group_id": "codeNet:p02621", "input_text": "program calc\n implicit none\n integer :: a\n read(*,*) a\n write(*,'(i0)') ((a + 1) * a + 1) * a\nend program calc", "language": "Fortran", "metadata": {"date": 1593317379, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02621.html", "problem_id": "p02621", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02621/input.txt", "sample_output_relpath": "derived/input_output/data/p02621/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02621/Fortran/s980038298.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s980038298", "user_id": "u506403362"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program calc\n implicit none\n integer :: a\n read(*,*) a\n write(*,'(i0)') ((a + 1) * a + 1) * a\nend program calc", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "sample_input": "2\n"}, "reference_outputs": ["14\n"], "source_document_id": "p02621", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven an integer a as input, print the value a + a^2 + a^3.\n\nConstraints\n\n1 \\leq a \\leq 10\n\na is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\n\nOutput\n\nPrint the value a + a^2 + a^3 as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n14\n\nWhen a = 2, we have a + a^2 + a^3 = 2 + 2^2 + 2^3 = 2 + 4 + 8 = 14.\n\nPrint the answer as an input. Outputs such as 14.0 will be judged as incorrect.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1110", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 114, "cpu_time_ms": 6, "memory_kb": 2864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s490673521", "group_id": "codeNet:p02622", "input_text": "program minor\n\n implicit none\n character::s*200000,t*200000,ss*200000,tt*200000\n integer::length,i,ans\n\n read*,s,t\n length=len_trim(s)\n !print*,length\n !ss=s(1:length)\n !tt=t(1:length)\n !print*,s,t\n\n\n ans=0\n do i=1,length\n if(s(i:i)/=t(i:i)) then\n ans=ans+1\n end if\n end do\n\n print*,ans\n\nend program minor", "language": "Fortran", "metadata": {"date": 1593307541, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02622.html", "problem_id": "p02622", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02622/input.txt", "sample_output_relpath": "derived/input_output/data/p02622/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02622/Fortran/s490673521.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s490673521", "user_id": "u882765852"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program minor\n\n implicit none\n character::s*200000,t*200000,ss*200000,tt*200000\n integer::length,i,ans\n\n read*,s,t\n length=len_trim(s)\n !print*,length\n !ss=s(1:length)\n !tt=t(1:length)\n !print*,s,t\n\n\n ans=0\n do i=1,length\n if(s(i:i)/=t(i:i)) then\n ans=ans+1\n end if\n end do\n\n print*,ans\n\nend program minor", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "sample_input": "cupofcoffee\ncupofhottea\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02622", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 309, "cpu_time_ms": 18, "memory_kb": 3448}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s386975027", "group_id": "codeNet:p02622", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: ls, i, cnt=0\n character(200000):: s,t\n\n read*, s\n read*, t\n\n do i=1,len_trim(s)\n if (s(i:i) /= t(i:i)) cnt=cnt+1\n end do\n print'(i0)', cnt\nend program main", "language": "Fortran", "metadata": {"date": 1593306141, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02622.html", "problem_id": "p02622", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02622/input.txt", "sample_output_relpath": "derived/input_output/data/p02622/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02622/Fortran/s386975027.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s386975027", "user_id": "u234636620"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: ls, i, cnt=0\n character(200000):: s,t\n\n read*, s\n read*, t\n\n do i=1,len_trim(s)\n if (s(i:i) /= t(i:i)) cnt=cnt+1\n end do\n print'(i0)', cnt\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "sample_input": "cupofcoffee\ncupofhottea\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02622", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings S and T. Consider changing S to T by repeating the operation below. Find the minimum number of operations required to do so.\n\nOperation: Choose one character of S and replace it with a different character.\n\nConstraints\n\nS and T have lengths between 1 and 2\\times 10^5 (inclusive).\n\nS and T consists of lowercase English letters.\n\nS and T have equal lengths.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\ncupofcoffee\ncupofhottea\n\nSample Output 1\n\n4\n\nWe can achieve the objective in four operations, such as the following:\n\nFirst, replace the sixth character c with h.\n\nSecond, replace the eighth character f with t.\n\nThird, replace the ninth character f with t.\n\nFourth, replace the eleventh character e with a.\n\nSample Input 2\n\nabcde\nbcdea\n\nSample Output 2\n\n5\n\nSample Input 3\n\napple\napple\n\nSample Output 3\n\n0\n\nNo operations may be needed to achieve the objective.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 269, "cpu_time_ms": 18, "memory_kb": 3508}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s678312979", "group_id": "codeNet:p02626", "input_text": "program main\n use iso_fortran_env\n implicit none\n integer(int32) :: n, i\n integer(int64), allocatable :: a(:)\n integer(int64) :: s, x, d, ans\n logical :: bx, bd\n\n read *, n\n allocate(a(n))\n read *, a(1:n)\n\n x = 0\n d = 0\n s = a(1) + a(2)\n ans = 0\n\n if ( n>2 ) then\n do i = 3, n\n x = ieor(x, a(i))\n enddo\n endif\n\n if ( trailz(s-x) >= 1 ) then\n d = (s - x) / 2\n else\n print *, \"-1\"\n stop\n endif\n\n if ( iand(x, d) /= 0) then\n print *, \"-1\"\n stop\n endif\n\n do i = 0, 63\n bd = btest(d, i)\n if (bd) then\n ans = ibset(ans, i)\n endif\n enddo\n\n do i = 63, 0, -1\n bx = btest(x, i)\n if (bx) then\n if ( ibset(ans, i) <= a(1) ) then\n ans = ibset(ans, i)\n endif\n endif\n enddo\n\n if (ans == 0) then\n print *, \"-1\"\n else\n print *, a(1) - ans\n endif\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1595920787, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02626.html", "problem_id": "p02626", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02626/input.txt", "sample_output_relpath": "derived/input_output/data/p02626/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02626/Fortran/s678312979.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s678312979", "user_id": "u128084721"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n use iso_fortran_env\n implicit none\n integer(int32) :: n, i\n integer(int64), allocatable :: a(:)\n integer(int64) :: s, x, d, ans\n logical :: bx, bd\n\n read *, n\n allocate(a(n))\n read *, a(1:n)\n\n x = 0\n d = 0\n s = a(1) + a(2)\n ans = 0\n\n if ( n>2 ) then\n do i = 3, n\n x = ieor(x, a(i))\n enddo\n endif\n\n if ( trailz(s-x) >= 1 ) then\n d = (s - x) / 2\n else\n print *, \"-1\"\n stop\n endif\n\n if ( iand(x, d) /= 0) then\n print *, \"-1\"\n stop\n endif\n\n do i = 0, 63\n bd = btest(d, i)\n if (bd) then\n ans = ibset(ans, i)\n endif\n enddo\n\n do i = 63, 0, -1\n bx = btest(x, i)\n if (bx) then\n if ( ibset(ans, i) <= a(1) ) then\n ans = ibset(ans, i)\n endif\n endif\n enddo\n\n if (ans == 0) then\n print *, \"-1\"\n else\n print *, a(1) - ans\n endif\n\nend program main\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere are N piles of stones. The i-th pile has A_i stones.\n\nAoki and Takahashi are about to use them to play the following game:\n\nStarting with Aoki, the two players alternately do the following operation:\n\nOperation: Choose one pile of stones, and remove one or more stones from it.\n\nWhen a player is unable to do the operation, he loses, and the other player wins.\n\nWhen the two players play optimally, there are two possibilities in this game: the player who moves first always wins, or the player who moves second always wins, only depending on the initial number of stones in each pile.\n\nIn such a situation, Takahashi, the second player to act, is trying to guarantee his win by moving at least zero and at most (A_1 - 1) stones from the 1-st pile to the 2-nd pile before the game begins.\n\nIf this is possible, print the minimum number of stones to move to guarantee his victory; otherwise, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 300\n\n1 \\leq A_i \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum number of stones to move to guarantee Takahashi's win; otherwise, print -1 instead.\n\nSample Input 1\n\n2\n5 3\n\nSample Output 1\n\n1\n\nWithout moving stones, if Aoki first removes 2 stones from the 1-st pile, Takahashi cannot win in any way.\n\nIf Takahashi moves 1 stone from the 1-st pile to the 2-nd before the game begins so that both piles have 4 stones, Takahashi can always win by properly choosing his actions.\n\nSample Input 2\n\n2\n3 5\n\nSample Output 2\n\n-1\n\nIt is not allowed to move stones from the 2-nd pile to the 1-st.\n\nSample Input 3\n\n3\n1 1 2\n\nSample Output 3\n\n-1\n\nIt is not allowed to move all stones from the 1-st pile.\n\nSample Input 4\n\n8\n10 9 8 7 6 5 4 3\n\nSample Output 4\n\n3\n\nSample Input 5\n\n3\n4294967297 8589934593 12884901890\n\nSample Output 5\n\n1\n\nWatch out for overflows.", "sample_input": "2\n5 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02626", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere are N piles of stones. The i-th pile has A_i stones.\n\nAoki and Takahashi are about to use them to play the following game:\n\nStarting with Aoki, the two players alternately do the following operation:\n\nOperation: Choose one pile of stones, and remove one or more stones from it.\n\nWhen a player is unable to do the operation, he loses, and the other player wins.\n\nWhen the two players play optimally, there are two possibilities in this game: the player who moves first always wins, or the player who moves second always wins, only depending on the initial number of stones in each pile.\n\nIn such a situation, Takahashi, the second player to act, is trying to guarantee his win by moving at least zero and at most (A_1 - 1) stones from the 1-st pile to the 2-nd pile before the game begins.\n\nIf this is possible, print the minimum number of stones to move to guarantee his victory; otherwise, print -1 instead.\n\nConstraints\n\n2 \\leq N \\leq 300\n\n1 \\leq A_i \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 \\ldots A_N\n\nOutput\n\nPrint the minimum number of stones to move to guarantee Takahashi's win; otherwise, print -1 instead.\n\nSample Input 1\n\n2\n5 3\n\nSample Output 1\n\n1\n\nWithout moving stones, if Aoki first removes 2 stones from the 1-st pile, Takahashi cannot win in any way.\n\nIf Takahashi moves 1 stone from the 1-st pile to the 2-nd before the game begins so that both piles have 4 stones, Takahashi can always win by properly choosing his actions.\n\nSample Input 2\n\n2\n3 5\n\nSample Output 2\n\n-1\n\nIt is not allowed to move stones from the 2-nd pile to the 1-st.\n\nSample Input 3\n\n3\n1 1 2\n\nSample Output 3\n\n-1\n\nIt is not allowed to move all stones from the 1-st pile.\n\nSample Input 4\n\n8\n10 9 8 7 6 5 4 3\n\nSample Output 4\n\n3\n\nSample Input 5\n\n3\n4294967297 8589934593 12884901890\n\nSample Output 5\n\n1\n\nWatch out for overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 992, "cpu_time_ms": 6, "memory_kb": 2872}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s928953665", "group_id": "codeNet:p02627", "input_text": "program alphabet\n implicit none\n character alpha\n read *, alpha\n if(alpha >= 'a' .and. alpha <= 'z')then\n print *, 'a'\n else if(alpha >= 'A' .and. alpha <= 'Z')then\n print *, 'A'\n end if\nend program", "language": "Fortran", "metadata": {"date": 1598296300, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Fortran/s928953665.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s928953665", "user_id": "u622206408"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program alphabet\n implicit none\n character alpha\n read *, alpha\n if(alpha >= 'a' .and. alpha <= 'z')then\n print *, 'a'\n else if(alpha >= 'A' .and. alpha <= 'Z')then\n print *, 'A'\n end if\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 230, "cpu_time_ms": 9, "memory_kb": 2716}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s839298598", "group_id": "codeNet:p02627", "input_text": "character :: alpha\n\nread*,alpha\n\nif( ichar(alpha)=65)print'(A)',\"A\"\n if(ichar(a)<=122.and.ichar(a)>=97)print'(A)',\"a\"\nend program ABC171A", "language": "Fortran", "metadata": {"date": 1592865862, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Fortran/s211554911.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s211554911", "user_id": "u414699019"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program ABC171A\n implicit none\n character(1)::a\n read*,a\n if(ichar(a)<=90.and.ichar(a)>=65)print'(A)',\"A\"\n if(ichar(a)<=122.and.ichar(a)>=97)print'(A)',\"a\"\nend program ABC171A", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 190, "cpu_time_ms": 13, "memory_kb": 2880}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s411270027", "group_id": "codeNet:p02627", "input_text": "program sample\n implicit none\n \n integer(8) :: i,j,m,n,k,l,q,t(100000)\n \n integer(8),allocatable :: a(:),b(:),c(:)\n \n read(*,*) n\n allocate(a(n))\n read(*,*)a\n read(*,*)q\n allocate(b(q))\n allocate(c(q))\n do i=1,q\n read(*,*)b(i),c(i)\n end do\n do i=1,10000\n t(i)=0\n end do\n do i=1,n\n m=a(i)\n t(m)=t(m)+1\n end do\n m=sum(a)\n\n\n do i=1,q\n k=b(i)\n l=c(i)\n m=m+(l-k)*t(k)\n t(l)=t(l)+t(k)\n t(k)=0\n \n write(*,*)m\n end do\n \n \n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1592792825, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Fortran/s411270027.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s411270027", "user_id": "u713568912"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program sample\n implicit none\n \n integer(8) :: i,j,m,n,k,l,q,t(100000)\n \n integer(8),allocatable :: a(:),b(:),c(:)\n \n read(*,*) n\n allocate(a(n))\n read(*,*)a\n read(*,*)q\n allocate(b(q))\n allocate(c(q))\n do i=1,q\n read(*,*)b(i),c(i)\n end do\n do i=1,10000\n t(i)=0\n end do\n do i=1,n\n m=a(i)\n t(m)=t(m)+1\n end do\n m=sum(a)\n\n\n do i=1,q\n k=b(i)\n l=c(i)\n m=m+(l-k)*t(k)\n t(l)=t(l)+t(k)\n t(k)=0\n \n write(*,*)m\n end do\n \n \n stop\nend program sample\n \n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 588, "cpu_time_ms": 16, "memory_kb": 3180}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s331984856", "group_id": "codeNet:p02627", "input_text": "program moji\ncharacter(1)::a\nk=0\nread*,a\n if(a=='A')then\n print*,'A'\n k=1\n end if\n if(a=='B')then\n print*,'A'\n k=1\n end if\n if(a=='C')then\n print*,'A'\n k=1\n end if\n if(a=='D')then\n print*,'A'\n k=1\n end if\n if(a=='E')then\n print*,'A'\n k=1\n end if\n if(a=='F')then\n print*,'A'\n k=1\n end if\n if(a=='G')then\n print*,'A'\n k=1\n end if\n if(a=='H')then\n print*,'A'\n k=1\n end if\n if(a=='I')then\n print*,'A'\n k=1\n end if\n if(a=='J')then\n print*,'A'\n k=1\n end if\n if(a=='K')then\n print*,'A'\n k=1\n end if\n if(a=='L')then\n print*,'A'\n k=1\n end if\n if(a=='M')then\n print*,'A'\n k=1\n end if\n if(a=='N')then\n print*,'A'\n k=1\n end if\n if(a=='O')then\n print*,'A'\n k=1\n end if\n if(a=='P')then\n print*,'A'\n k=1\n end if\n if(a=='Q')then\n print*,'A'\n k=1\n end if\n if(a=='R')then\n print*,'A'\n k=1\n end if\n if(a=='S')then\n print*,'A'\n k=1\n end if\n if(a=='T')then\n print*,'A'\n k=1\n end if\n if(a=='U')then\n print*,'A'\n k=1\n end if\n if(a=='V')then\n print*,'A'\n k=1\n end if\n if(a=='W')then\n print*,'A'\n k=1\n end if\n if(a=='X')then\n print*,'A'\n k=1\n end if\n if(a=='Y')then\n print*,'A'\n k=1\n end if\n if(a=='Z')then\n print*,'A'\n k=1\n end if\n \n IF(K==0)THEN\n PRINT*,'a'\n end if\nend program moji", "language": "Fortran", "metadata": {"date": 1592788331, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Fortran/s331984856.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s331984856", "user_id": "u298439196"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program moji\ncharacter(1)::a\nk=0\nread*,a\n if(a=='A')then\n print*,'A'\n k=1\n end if\n if(a=='B')then\n print*,'A'\n k=1\n end if\n if(a=='C')then\n print*,'A'\n k=1\n end if\n if(a=='D')then\n print*,'A'\n k=1\n end if\n if(a=='E')then\n print*,'A'\n k=1\n end if\n if(a=='F')then\n print*,'A'\n k=1\n end if\n if(a=='G')then\n print*,'A'\n k=1\n end if\n if(a=='H')then\n print*,'A'\n k=1\n end if\n if(a=='I')then\n print*,'A'\n k=1\n end if\n if(a=='J')then\n print*,'A'\n k=1\n end if\n if(a=='K')then\n print*,'A'\n k=1\n end if\n if(a=='L')then\n print*,'A'\n k=1\n end if\n if(a=='M')then\n print*,'A'\n k=1\n end if\n if(a=='N')then\n print*,'A'\n k=1\n end if\n if(a=='O')then\n print*,'A'\n k=1\n end if\n if(a=='P')then\n print*,'A'\n k=1\n end if\n if(a=='Q')then\n print*,'A'\n k=1\n end if\n if(a=='R')then\n print*,'A'\n k=1\n end if\n if(a=='S')then\n print*,'A'\n k=1\n end if\n if(a=='T')then\n print*,'A'\n k=1\n end if\n if(a=='U')then\n print*,'A'\n k=1\n end if\n if(a=='V')then\n print*,'A'\n k=1\n end if\n if(a=='W')then\n print*,'A'\n k=1\n end if\n if(a=='X')then\n print*,'A'\n k=1\n end if\n if(a=='Y')then\n print*,'A'\n k=1\n end if\n if(a=='Z')then\n print*,'A'\n k=1\n end if\n \n IF(K==0)THEN\n PRINT*,'a'\n end if\nend program moji", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1222, "cpu_time_ms": 13, "memory_kb": 2792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s731209419", "group_id": "codeNet:p02627", "input_text": "program alphabet\n\timplicit none\n integer:: i\n character(len=1)::x\n character,parameter :: large='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n\n\tread(*,'(a)') x\n \n do i = 1, 26\n \tif ( x==large(i:i) ) then\n \t\twrite(*,'(a)') 'A'\n \t stop\n end if \n end do\n \n write(*,'(a)') 'a'\n \n stop\nend program alphabet\n\n", "language": "Fortran", "metadata": {"date": 1592787950, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Fortran/s731209419.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s731209419", "user_id": "u961266059"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program alphabet\n\timplicit none\n integer:: i\n character(len=1)::x\n character,parameter :: large='ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n\n\tread(*,'(a)') x\n \n do i = 1, 26\n \tif ( x==large(i:i) ) then\n \t\twrite(*,'(a)') 'A'\n \t stop\n end if \n end do\n \n write(*,'(a)') 'a'\n \n stop\nend program alphabet\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 338, "cpu_time_ms": 11, "memory_kb": 2868}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s891098167", "group_id": "codeNet:p02627", "input_text": "program alphabet\n\n character::yomu*1\n\n read*,yomu\n\n if(yomu>='a' .and. yomu<='z') then\n print*,'a'\n end if\n\n if(yomu>='A' .and. yomu<='Z') then\n print*,'A'\n end if\n\n \nend program alphabet", "language": "Fortran", "metadata": {"date": 1592787789, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02627.html", "problem_id": "p02627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02627/input.txt", "sample_output_relpath": "derived/input_output/data/p02627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02627/Fortran/s891098167.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s891098167", "user_id": "u882765852"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "program alphabet\n\n character::yomu*1\n\n read*,yomu\n\n if(yomu>='a' .and. yomu<='z') then\n print*,'a'\n end if\n\n if(yomu>='A' .and. yomu<='Z') then\n print*,'A'\n end if\n\n \nend program alphabet", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "sample_input": "B\n"}, "reference_outputs": ["A\n"], "source_document_id": "p02627", "source_text": "Score : 100 points\n\nProblem Statement\n\nAn uppercase or lowercase English letter \\alpha will be given as input.\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nConstraints\n\n\\alpha is an uppercase (A - Z) or lowercase (a - z) English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nα\n\nOutput\n\nIf \\alpha is uppercase, print A; if it is lowercase, print a.\n\nSample Input 1\n\nB\n\nSample Output 1\n\nA\n\nB is uppercase, so we should print A.\n\nSample Input 2\n\na\n\nSample Output 2\n\na\n\na is lowercase, so we should print a.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 189, "cpu_time_ms": 11, "memory_kb": 2796}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s062611817", "group_id": "codeNet:p02628", "input_text": "program b171\n \nimplicit none\ninteger :: n, k, z, m, i, j\ninteger, allocatable :: p(:)\n \nread *, n, k\n \nallocate(p(1:n))\n \nread *, p(:)\n \ndo j = 1, n-1\n do i = 1, n-1\n if(p(i) > p(i+1)) then\n m = p(i)\n p(i) = p(i+1)\n p(i+1) = m\n end if\n end do\nend do\n\nz = 0\n \ndo i = 1, k\n z = z + p(i)\nend do\n \nprint *, z\n \nend program b171", "language": "Fortran", "metadata": {"date": 1592788374, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Fortran/s062611817.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s062611817", "user_id": "u644436095"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program b171\n \nimplicit none\ninteger :: n, k, z, m, i, j\ninteger, allocatable :: p(:)\n \nread *, n, k\n \nallocate(p(1:n))\n \nread *, p(:)\n \ndo j = 1, n-1\n do i = 1, n-1\n if(p(i) > p(i+1)) then\n m = p(i)\n p(i) = p(i+1)\n p(i+1) = m\n end if\n end do\nend do\n\nz = 0\n \ndo i = 1, k\n z = z + p(i)\nend do\n \nprint *, z\n \nend program b171", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 331, "cpu_time_ms": 11, "memory_kb": 2736}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s231296421", "group_id": "codeNet:p02628", "input_text": "program juice\n\timplicit none\n integer :: n, k, i, m, j\n integer,allocatable :: p(:)\n \n read(*,*) n, k\n allocate(p(n))\n \n read(*,*) p\n \n do i = n, 2, -1\n \tdo j = 1, i-1\n \tif ( p(j)>=p(j+1) ) then\n \tm = p(j+1)\n p(j+1) = p(j)\n p(j) = m\n end if\n end do\n end do\n \n write(*,*) sum(p(1:k))\n \n stop\nend program juice", "language": "Fortran", "metadata": {"date": 1592788255, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02628.html", "problem_id": "p02628", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02628/input.txt", "sample_output_relpath": "derived/input_output/data/p02628/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02628/Fortran/s231296421.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s231296421", "user_id": "u961266059"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program juice\n\timplicit none\n integer :: n, k, i, m, j\n integer,allocatable :: p(:)\n \n read(*,*) n, k\n allocate(p(n))\n \n read(*,*) p\n \n do i = n, 2, -1\n \tdo j = 1, i-1\n \tif ( p(j)>=p(j+1) ) then\n \tm = p(j+1)\n p(j+1) = p(j)\n p(j) = m\n end if\n end do\n end do\n \n write(*,*) sum(p(1:k))\n \n stop\nend program juice", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "sample_input": "5 3\n50 100 80 120 80\n"}, "reference_outputs": ["210\n"], "source_document_id": "p02628", "source_text": "Score : 200 points\n\nProblem Statement\n\nA shop sells N kinds of fruits, Fruit 1, \\ldots, N, at prices of p_1, \\ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)\n\nHere, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 1000\n\n1 \\leq p_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint an integer representing the minimum possible total price of fruits.\n\nSample Input 1\n\n5 3\n50 100 80 120 80\n\nSample Output 1\n\n210\n\nThis shop sells Fruit 1, 2, 3, 4, and 5 for 50 yen, 100 yen, 80 yen, 120 yen, and 80 yen, respectively.\n\nThe minimum total price for three kinds of fruits is 50 + 80 + 80 = 210 yen when choosing Fruit 1, 3, and 5.\n\nSample Input 2\n\n1 1\n1000\n\nSample Output 2\n\n1000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 419, "cpu_time_ms": 11, "memory_kb": 2800}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s277596710", "group_id": "codeNet:p02629", "input_text": "program main\n use iso_fortran_env\n implicit none\n\n integer(int64) :: n, m\n character(:),allocatable :: txt\n character(26) :: alp\n\n alp = \"abcdefghijklmnopqrstuvwxyz\"\n\n read(*,*) n\n txt = \"\"\n\n do\n if (n <= 0) exit\n m = mod(n-1, 26)\n n = (n-1)/26\n txt = alp(m+1:m+1)//txt\n enddo\n\n print'(a)', trim(txt)\n\nend program main", "language": "Fortran", "metadata": {"date": 1592972425, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Fortran/s277596710.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s277596710", "user_id": "u128084721"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "program main\n use iso_fortran_env\n implicit none\n\n integer(int64) :: n, m\n character(:),allocatable :: txt\n character(26) :: alp\n\n alp = \"abcdefghijklmnopqrstuvwxyz\"\n\n read(*,*) n\n txt = \"\"\n\n do\n if (n <= 0) exit\n m = mod(n-1, 26)\n n = (n-1)/26\n txt = alp(m+1:m+1)//txt\n enddo\n\n print'(a)', trim(txt)\n\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 379, "cpu_time_ms": 10, "memory_kb": 2932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s768007746", "group_id": "codeNet:p02629", "input_text": "program main\n use iso_fortran_env\n implicit none\n\n integer(int64) :: n\n integer(int64) :: i, m, k, left, right\n character(1),allocatable :: name(:)\n character(26) :: alp\n alp = \"zabcdefghijklmnopqrstuvwxy\"\n\n read(*,*) n\n\n i = 0\n left = 0\n right = 0\n\n do\n left = left + (26**(i) * 1)\n right = right + (26**(i) * 26)\n if ( (left <= n).and.(n <= right) ) then\n exit\n endif\n i = i + 1\n! print *, i, left, right\n enddo\n allocate(name(0:i))\n\n do k = 0, i\n m = mod(n, 26)\n name( i - k ) = alp(m+1:m+1)\n n = int( (n-1) / 26)\n enddo\n print *, name\n\nend program main", "language": "Fortran", "metadata": {"date": 1592895907, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Fortran/s768007746.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s768007746", "user_id": "u128084721"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "program main\n use iso_fortran_env\n implicit none\n\n integer(int64) :: n\n integer(int64) :: i, m, k, left, right\n character(1),allocatable :: name(:)\n character(26) :: alp\n alp = \"zabcdefghijklmnopqrstuvwxy\"\n\n read(*,*) n\n\n i = 0\n left = 0\n right = 0\n\n do\n left = left + (26**(i) * 1)\n right = right + (26**(i) * 26)\n if ( (left <= n).and.(n <= right) ) then\n exit\n endif\n i = i + 1\n! print *, i, left, right\n enddo\n allocate(name(0:i))\n\n do k = 0, i\n m = mod(n, 26)\n name( i - k ) = alp(m+1:m+1)\n n = int( (n-1) / 26)\n enddo\n print *, name\n\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 681, "cpu_time_ms": 11, "memory_kb": 2932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s535105373", "group_id": "codeNet:p02629", "input_text": "program main\n use iso_fortran_env\n implicit none\n\n integer(int64) :: n\n integer(int32) :: i, m, k, left, right\n character(1),allocatable :: name(:)\n character(26) :: alp\n alp = \"zabcdefghijklmnopqrstuvwxy\"\n\n read(*,*) n\n\n i = 0\n left = 0\n right = 0\n\n do\n left = left + (26**(i) * 1)\n right = right + (26**(i) * 26)\n if ( (left <= n).and.(n <= right) ) then\n exit\n endif\n i = i + 1\n enddo\n\n allocate(name(0:i))\n\n do k = 0, i\n m = mod(n, 26)\n name( i - k ) = alp(m+1:m+1)\n n = int( (n-1) / 26)\n enddo\n print *, name\n\nend program main", "language": "Fortran", "metadata": {"date": 1592895005, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Fortran/s535105373.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s535105373", "user_id": "u128084721"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "program main\n use iso_fortran_env\n implicit none\n\n integer(int64) :: n\n integer(int32) :: i, m, k, left, right\n character(1),allocatable :: name(:)\n character(26) :: alp\n alp = \"zabcdefghijklmnopqrstuvwxy\"\n\n read(*,*) n\n\n i = 0\n left = 0\n right = 0\n\n do\n left = left + (26**(i) * 1)\n right = right + (26**(i) * 26)\n if ( (left <= n).and.(n <= right) ) then\n exit\n endif\n i = i + 1\n enddo\n\n allocate(name(0:i))\n\n do k = 0, i\n m = mod(n, 26)\n name( i - k ) = alp(m+1:m+1)\n n = int( (n-1) / 26)\n enddo\n print *, name\n\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 649, "cpu_time_ms": 2205, "memory_kb": 2900}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s993691865", "group_id": "codeNet:p02629", "input_text": "program main\n use iso_fortran_env\n implicit none\n\n integer(int32) :: n\n integer(int32) :: i, m, k, left, right\n character(1),allocatable :: name(:)\n character(26) :: alp\n alp = \"zabcdefghijklmnopqrstuvwxy\"\n\n read(*,*) n\n\n i = 0\n left = 0\n right = 0\n\n do\n left = left + (26**(i) * 1)\n right = right + (26**(i) * 26)\n if ( (left <= n).and.(n <= right) ) then\n exit\n endif\n i = i + 1\n enddo\n\n allocate(name(0:i))\n\n do k = 0, i\n m = mod(n, 26)\n name( i - k ) = alp(m+1:m+1)\n n = int( (n-1) / 26)\n enddo\n print *, name\n\nend program main", "language": "Fortran", "metadata": {"date": 1592894702, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Fortran/s993691865.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s993691865", "user_id": "u128084721"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "program main\n use iso_fortran_env\n implicit none\n\n integer(int32) :: n\n integer(int32) :: i, m, k, left, right\n character(1),allocatable :: name(:)\n character(26) :: alp\n alp = \"zabcdefghijklmnopqrstuvwxy\"\n\n read(*,*) n\n\n i = 0\n left = 0\n right = 0\n\n do\n left = left + (26**(i) * 1)\n right = right + (26**(i) * 26)\n if ( (left <= n).and.(n <= right) ) then\n exit\n endif\n i = i + 1\n enddo\n\n allocate(name(0:i))\n\n do k = 0, i\n m = mod(n, 26)\n name( i - k ) = alp(m+1:m+1)\n n = int( (n-1) / 26)\n enddo\n print *, name\n\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 649, "cpu_time_ms": 14, "memory_kb": 2932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s850288665", "group_id": "codeNet:p02629", "input_text": "program c171\n\nimplicit none\ninteger(16) :: n, m, l\ninteger :: i, j\ncharacter(len=12) :: a, b\n\nread *, n\n\ni = 0\n\ndo while (n > 26)\n i = i + 1\n m = mod(n,26)\n if (m == 0) then\n m = 26\n end if\n a(i:i) = char(96 + m)\n n = n - m\n n = n / 26\nend do\n\na(i+1:i+1) = char(96 + n)\n\ndo j = 1, i+1\n b(j:j) = a(i+2-j:i+2-j)\nend do\n\nif (i+1 == 12) then\n print '(A12)', trim(adjustl(b))\nelse if (i+1 == 11) then\n print '(A11)', trim(adjustl(b))\nelse if (i+1 == 10) then\n print '(A10)', trim(adjustl(b))\nelse if (i+1 == 9) then\n print '(A9)', trim(adjustl(b))\nelse if (i+1 == 8) then\n print '(A8)', trim(adjustl(b))\nelse if (i+1 == 7) then\n print '(A7)', trim(adjustl(b))\nelse if (i+1 == 6) then\n print '(A6)', trim(adjustl(b))\nelse if (i+1 == 5) then\n print '(A5)', trim(adjustl(b))\nelse if (i+1 == 4) then\n print '(A4)', trim(adjustl(b))\nelse if (i+1 == 3) then\n print '(A3)', trim(adjustl(b))\nelse if (i+1 == 2) then\n print '(A2)', trim(adjustl(b))\nelse\n print '(A1)', trim(adjustl(b))\nend if\n\nend program c171", "language": "Fortran", "metadata": {"date": 1592792771, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Fortran/s850288665.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s850288665", "user_id": "u644436095"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "program c171\n\nimplicit none\ninteger(16) :: n, m, l\ninteger :: i, j\ncharacter(len=12) :: a, b\n\nread *, n\n\ni = 0\n\ndo while (n > 26)\n i = i + 1\n m = mod(n,26)\n if (m == 0) then\n m = 26\n end if\n a(i:i) = char(96 + m)\n n = n - m\n n = n / 26\nend do\n\na(i+1:i+1) = char(96 + n)\n\ndo j = 1, i+1\n b(j:j) = a(i+2-j:i+2-j)\nend do\n\nif (i+1 == 12) then\n print '(A12)', trim(adjustl(b))\nelse if (i+1 == 11) then\n print '(A11)', trim(adjustl(b))\nelse if (i+1 == 10) then\n print '(A10)', trim(adjustl(b))\nelse if (i+1 == 9) then\n print '(A9)', trim(adjustl(b))\nelse if (i+1 == 8) then\n print '(A8)', trim(adjustl(b))\nelse if (i+1 == 7) then\n print '(A7)', trim(adjustl(b))\nelse if (i+1 == 6) then\n print '(A6)', trim(adjustl(b))\nelse if (i+1 == 5) then\n print '(A5)', trim(adjustl(b))\nelse if (i+1 == 4) then\n print '(A4)', trim(adjustl(b))\nelse if (i+1 == 3) then\n print '(A3)', trim(adjustl(b))\nelse if (i+1 == 2) then\n print '(A2)', trim(adjustl(b))\nelse\n print '(A1)', trim(adjustl(b))\nend if\n\nend program c171", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1001, "cpu_time_ms": 7, "memory_kb": 2832}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s929995490", "group_id": "codeNet:p02629", "input_text": "program ABC171_C\n character(11)::B\n integer(16)::N,cnt=1,i,j\n integer(16),allocatable::C(:)\n read(*,*)N\n do i=1,11\n if(N>26**i) then\n N=N-26**i\n cnt=cnt+1\n else\n allocate(C(cnt))\n C=97\n do j=1,cnt\n C(j)=mod(N,26)+C(j)-1\n if(C(j)==96) C(j)=122\n N=N/26\n if(N==0) then\n if(cnt>1) then\n do k=2,cnt\n if(C(k)/=97) C(k)=C(k)+1\n end do\n end if\n exit\n end if\n end do\n exit\n end if\n end do\n do i=1,cnt\n B(cnt+1-i:cnt+1-i)=char(C(i))\n end do\n B=adjustl(B)\n B=trim(B)\n write(*,'(a)')B\nend program ABC171_C", "language": "Fortran", "metadata": {"date": 1592792719, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Fortran/s929995490.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s929995490", "user_id": "u359178469"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "program ABC171_C\n character(11)::B\n integer(16)::N,cnt=1,i,j\n integer(16),allocatable::C(:)\n read(*,*)N\n do i=1,11\n if(N>26**i) then\n N=N-26**i\n cnt=cnt+1\n else\n allocate(C(cnt))\n C=97\n do j=1,cnt\n C(j)=mod(N,26)+C(j)-1\n if(C(j)==96) C(j)=122\n N=N/26\n if(N==0) then\n if(cnt>1) then\n do k=2,cnt\n if(C(k)/=97) C(k)=C(k)+1\n end do\n end if\n exit\n end if\n end do\n exit\n end if\n end do\n do i=1,cnt\n B(cnt+1-i:cnt+1-i)=char(C(i))\n end do\n B=adjustl(B)\n B=trim(B)\n write(*,'(a)')B\nend program ABC171_C", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 710, "cpu_time_ms": 90, "memory_kb": 2932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s164069564", "group_id": "codeNet:p02629", "input_text": "program abc171\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n, ni, val\n character(20):: ans\n \n read*, n\n ! n=n-1\n ans = ''\n do while(n>0)\n ni = mod(n-1,26_8)\n val = ni + ichar('a')\n ans = char(val) //trim(ans)\n if (n==26) exit\n n=n/26\n end do\n print'(a)', ans\nend program abc171", "language": "Fortran", "metadata": {"date": 1592788700, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02629.html", "problem_id": "p02629", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02629/input.txt", "sample_output_relpath": "derived/input_output/data/p02629/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02629/Fortran/s164069564.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s164069564", "user_id": "u234636620"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "program abc171\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n, ni, val\n character(20):: ans\n \n read*, n\n ! n=n-1\n ans = ''\n do while(n>0)\n ni = mod(n-1,26_8)\n val = ni + ichar('a')\n ans = char(val) //trim(ans)\n if (n==26) exit\n n=n/26\n end do\n print'(a)', ans\nend program abc171", "problem_context": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "sample_input": "2\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02629", "source_text": "Score : 300 points\n\nProblem Statement\n\n1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:\n\nthe dogs numbered 1,2,\\cdots,26 were respectively given the names a, b, ..., z;\n\nthe dogs numbered 27,28,29,\\cdots,701,702 were respectively given the names aa, ab, ac, ..., zy, zz;\n\nthe dogs numbered 703,704,705,\\cdots,18277,18278 were respectively given the names aaa, aab, aac, ..., zzy, zzz;\n\nthe dogs numbered 18279,18280,18281,\\cdots,475253,475254 were respectively given the names aaaa, aaab, aaac, ..., zzzy, zzzz;\n\nthe dogs numbered 475255,475256,\\cdots were respectively given the names aaaaa, aaaab, ...;\n\nand so on.\n\nTo sum it up, the dogs numbered 1, 2, \\cdots were respectively given the following names:\n\na, b, ..., z, aa, ab, ..., az, ba, bb, ..., bz, ..., za, zb, ..., zz, aaa, aab, ..., aaz, aba, abb, ..., abz, ..., zzz, aaaa, ...\n\nNow, Roger asks you:\n\n\"What is the name for the dog numbered N?\"\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 1000000000000001\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer to Roger's question as a string consisting of lowercase English letters.\n\nSample Input 1\n\n2\n\nSample Output 1\n\nb\n\nSample Input 2\n\n27\n\nSample Output 2\n\naa\n\nSample Input 3\n\n123456789\n\nSample Output 3\n\njjddja", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 368, "cpu_time_ms": 9, "memory_kb": 2932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s389740082", "group_id": "codeNet:p02630", "input_text": "program main\n use iso_fortran_env\n implicit none\n integer(int64) :: n, q\n integer(int64) :: an(100000)\n integer(int64),allocatable :: a(:), b(:), c(:)\n integer(int64) :: i\n integer(int64) :: s\n\n read *, n\n allocate(a(n))\n read *, (a(i), i = 1, n)\n read *, q\n allocate(b(q), c(q))\n read *, (b(i), c(i), i = 1, q)\n\n an = 0\n do i = 1, n\n an(a(i)) = an(a(i)) + 1\n enddo\n\n s = sum(a)\n\n do i = 1, q\n s = s + (c(i) - b(i)) * an(b(i))\n an(c(i)) = an(c(i)) + an(b(i))\n an(b(i)) = 0\n print *, s\n enddo\n\nend program main", "language": "Fortran", "metadata": {"date": 1592977352, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02630.html", "problem_id": "p02630", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02630/input.txt", "sample_output_relpath": "derived/input_output/data/p02630/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02630/Fortran/s389740082.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s389740082", "user_id": "u128084721"}, "prompt_components": {"gold_output": "11\n12\n16\n", "input_to_evaluate": "program main\n use iso_fortran_env\n implicit none\n integer(int64) :: n, q\n integer(int64) :: an(100000)\n integer(int64),allocatable :: a(:), b(:), c(:)\n integer(int64) :: i\n integer(int64) :: s\n\n read *, n\n allocate(a(n))\n read *, (a(i), i = 1, n)\n read *, q\n allocate(b(q), c(q))\n read *, (b(i), c(i), i = 1, q)\n\n an = 0\n do i = 1, n\n an(a(i)) = an(a(i)) + 1\n enddo\n\n s = sum(a)\n\n do i = 1, q\n s = s + (c(i) - b(i)) * an(b(i))\n an(c(i)) = an(c(i)) + an(b(i))\n an(b(i)) = 0\n print *, s\n enddo\n\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have a sequence A composed of N positive integers: A_{1}, A_{2}, \\cdots, A_{N}.\n\nYou will now successively do the following Q operations:\n\nIn the i-th operation, you replace every element whose value is B_{i} with C_{i}.\n\nFor each i (1 \\leq i \\leq Q), find S_{i}: the sum of all elements in A just after the i-th operation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q, A_{i}, B_{i}, C_{i} \\leq 10^{5}\n\nB_{i} \\neq C_{i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1} A_{2} \\cdots A_{N}\nQ\nB_{1} C_{1}\nB_{2} C_{2}\n\\vdots\nB_{Q} C_{Q}\n\nOutput\n\nPrint Q integers S_{i} to Standard Output in the following format:\n\nS_{1}\nS_{2}\n\\vdots\nS_{Q}\n\nNote that S_{i} may not fit into a 32-bit integer.\n\nSample Input 1\n\n4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n\nSample Output 1\n\n11\n12\n16\n\nInitially, the sequence A is 1,2,3,4.\n\nAfter each operation, it becomes the following:\n\n2, 2, 3, 4\n\n2, 2, 4, 4\n\n4, 4, 4, 4\n\nSample Input 2\n\n4\n1 1 1 1\n3\n1 2\n2 1\n3 5\n\nSample Output 2\n\n8\n4\n4\n\nNote that the sequence A may not contain an element whose value is B_{i}.\n\nSample Input 3\n\n2\n1 2\n3\n1 100\n2 100\n100 1000\n\nSample Output 3\n\n102\n200\n2000", "sample_input": "4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n"}, "reference_outputs": ["11\n12\n16\n"], "source_document_id": "p02630", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have a sequence A composed of N positive integers: A_{1}, A_{2}, \\cdots, A_{N}.\n\nYou will now successively do the following Q operations:\n\nIn the i-th operation, you replace every element whose value is B_{i} with C_{i}.\n\nFor each i (1 \\leq i \\leq Q), find S_{i}: the sum of all elements in A just after the i-th operation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q, A_{i}, B_{i}, C_{i} \\leq 10^{5}\n\nB_{i} \\neq C_{i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1} A_{2} \\cdots A_{N}\nQ\nB_{1} C_{1}\nB_{2} C_{2}\n\\vdots\nB_{Q} C_{Q}\n\nOutput\n\nPrint Q integers S_{i} to Standard Output in the following format:\n\nS_{1}\nS_{2}\n\\vdots\nS_{Q}\n\nNote that S_{i} may not fit into a 32-bit integer.\n\nSample Input 1\n\n4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n\nSample Output 1\n\n11\n12\n16\n\nInitially, the sequence A is 1,2,3,4.\n\nAfter each operation, it becomes the following:\n\n2, 2, 3, 4\n\n2, 2, 4, 4\n\n4, 4, 4, 4\n\nSample Input 2\n\n4\n1 1 1 1\n3\n1 2\n2 1\n3 5\n\nSample Output 2\n\n8\n4\n4\n\nNote that the sequence A may not contain an element whose value is B_{i}.\n\nSample Input 3\n\n2\n1 2\n3\n1 100\n2 100\n100 1000\n\nSample Output 3\n\n102\n200\n2000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 601, "cpu_time_ms": 102, "memory_kb": 6328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s358866309", "group_id": "codeNet:p02630", "input_text": "program d171\n\nimplicit none\ninteger :: n, q, i, j, s, b, c\ninteger,allocatable :: a(:)\n\ns = 0\n\nread *, n\n\nallocate(a(1:n))\n\nread *, a(:)\nread *, q\n\ndo i = 1, q\n read *, b, c\n do j = 1, n\n if (a(j) == b) then\n a(j) = c\n end if\n s = s + a(j)\n end do\n print *, s\n s = 0\nend do\n\nend program d171", "language": "Fortran", "metadata": {"date": 1592793460, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02630.html", "problem_id": "p02630", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02630/input.txt", "sample_output_relpath": "derived/input_output/data/p02630/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02630/Fortran/s358866309.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s358866309", "user_id": "u644436095"}, "prompt_components": {"gold_output": "11\n12\n16\n", "input_to_evaluate": "program d171\n\nimplicit none\ninteger :: n, q, i, j, s, b, c\ninteger,allocatable :: a(:)\n\ns = 0\n\nread *, n\n\nallocate(a(1:n))\n\nread *, a(:)\nread *, q\n\ndo i = 1, q\n read *, b, c\n do j = 1, n\n if (a(j) == b) then\n a(j) = c\n end if\n s = s + a(j)\n end do\n print *, s\n s = 0\nend do\n\nend program d171", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have a sequence A composed of N positive integers: A_{1}, A_{2}, \\cdots, A_{N}.\n\nYou will now successively do the following Q operations:\n\nIn the i-th operation, you replace every element whose value is B_{i} with C_{i}.\n\nFor each i (1 \\leq i \\leq Q), find S_{i}: the sum of all elements in A just after the i-th operation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q, A_{i}, B_{i}, C_{i} \\leq 10^{5}\n\nB_{i} \\neq C_{i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1} A_{2} \\cdots A_{N}\nQ\nB_{1} C_{1}\nB_{2} C_{2}\n\\vdots\nB_{Q} C_{Q}\n\nOutput\n\nPrint Q integers S_{i} to Standard Output in the following format:\n\nS_{1}\nS_{2}\n\\vdots\nS_{Q}\n\nNote that S_{i} may not fit into a 32-bit integer.\n\nSample Input 1\n\n4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n\nSample Output 1\n\n11\n12\n16\n\nInitially, the sequence A is 1,2,3,4.\n\nAfter each operation, it becomes the following:\n\n2, 2, 3, 4\n\n2, 2, 4, 4\n\n4, 4, 4, 4\n\nSample Input 2\n\n4\n1 1 1 1\n3\n1 2\n2 1\n3 5\n\nSample Output 2\n\n8\n4\n4\n\nNote that the sequence A may not contain an element whose value is B_{i}.\n\nSample Input 3\n\n2\n1 2\n3\n1 100\n2 100\n100 1000\n\nSample Output 3\n\n102\n200\n2000", "sample_input": "4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n"}, "reference_outputs": ["11\n12\n16\n"], "source_document_id": "p02630", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have a sequence A composed of N positive integers: A_{1}, A_{2}, \\cdots, A_{N}.\n\nYou will now successively do the following Q operations:\n\nIn the i-th operation, you replace every element whose value is B_{i} with C_{i}.\n\nFor each i (1 \\leq i \\leq Q), find S_{i}: the sum of all elements in A just after the i-th operation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q, A_{i}, B_{i}, C_{i} \\leq 10^{5}\n\nB_{i} \\neq C_{i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1} A_{2} \\cdots A_{N}\nQ\nB_{1} C_{1}\nB_{2} C_{2}\n\\vdots\nB_{Q} C_{Q}\n\nOutput\n\nPrint Q integers S_{i} to Standard Output in the following format:\n\nS_{1}\nS_{2}\n\\vdots\nS_{Q}\n\nNote that S_{i} may not fit into a 32-bit integer.\n\nSample Input 1\n\n4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n\nSample Output 1\n\n11\n12\n16\n\nInitially, the sequence A is 1,2,3,4.\n\nAfter each operation, it becomes the following:\n\n2, 2, 3, 4\n\n2, 2, 4, 4\n\n4, 4, 4, 4\n\nSample Input 2\n\n4\n1 1 1 1\n3\n1 2\n2 1\n3 5\n\nSample Output 2\n\n8\n4\n4\n\nNote that the sequence A may not contain an element whose value is B_{i}.\n\nSample Input 3\n\n2\n1 2\n3\n1 100\n2 100\n100 1000\n\nSample Output 3\n\n102\n200\n2000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 302, "cpu_time_ms": 2205, "memory_kb": 3588}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s405508944", "group_id": "codeNet:p02630", "input_text": "program abc171\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,i,q,ans\n integer(int64):: cnt(100000)=0\n integer(int32), allocatable:: a(:),b(:),c(:)\n\n\n read*, n\n allocate(a(n))\n read*, a(:)\n ans = sum(a)\n do i=1,n\n cnt(a(i))=cnt(a(i))+1\n end do\n read*, q\n allocate(b(q),c(q))\n do i=1,q\n read*, b(i),c(i)\n end do\n do i=1,q\n ans = ans+(c(i)-b(i))*cnt(b(i))\n cnt(c(i)) = cnt(c(i)) + cnt(b(i))\n cnt(b(i)) = 0\n print'(i0)', ans\n end do\nend program abc171", "language": "Fortran", "metadata": {"date": 1592789861, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02630.html", "problem_id": "p02630", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02630/input.txt", "sample_output_relpath": "derived/input_output/data/p02630/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02630/Fortran/s405508944.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s405508944", "user_id": "u234636620"}, "prompt_components": {"gold_output": "11\n12\n16\n", "input_to_evaluate": "program abc171\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,i,q,ans\n integer(int64):: cnt(100000)=0\n integer(int32), allocatable:: a(:),b(:),c(:)\n\n\n read*, n\n allocate(a(n))\n read*, a(:)\n ans = sum(a)\n do i=1,n\n cnt(a(i))=cnt(a(i))+1\n end do\n read*, q\n allocate(b(q),c(q))\n do i=1,q\n read*, b(i),c(i)\n end do\n do i=1,q\n ans = ans+(c(i)-b(i))*cnt(b(i))\n cnt(c(i)) = cnt(c(i)) + cnt(b(i))\n cnt(b(i)) = 0\n print'(i0)', ans\n end do\nend program abc171", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have a sequence A composed of N positive integers: A_{1}, A_{2}, \\cdots, A_{N}.\n\nYou will now successively do the following Q operations:\n\nIn the i-th operation, you replace every element whose value is B_{i} with C_{i}.\n\nFor each i (1 \\leq i \\leq Q), find S_{i}: the sum of all elements in A just after the i-th operation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q, A_{i}, B_{i}, C_{i} \\leq 10^{5}\n\nB_{i} \\neq C_{i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1} A_{2} \\cdots A_{N}\nQ\nB_{1} C_{1}\nB_{2} C_{2}\n\\vdots\nB_{Q} C_{Q}\n\nOutput\n\nPrint Q integers S_{i} to Standard Output in the following format:\n\nS_{1}\nS_{2}\n\\vdots\nS_{Q}\n\nNote that S_{i} may not fit into a 32-bit integer.\n\nSample Input 1\n\n4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n\nSample Output 1\n\n11\n12\n16\n\nInitially, the sequence A is 1,2,3,4.\n\nAfter each operation, it becomes the following:\n\n2, 2, 3, 4\n\n2, 2, 4, 4\n\n4, 4, 4, 4\n\nSample Input 2\n\n4\n1 1 1 1\n3\n1 2\n2 1\n3 5\n\nSample Output 2\n\n8\n4\n4\n\nNote that the sequence A may not contain an element whose value is B_{i}.\n\nSample Input 3\n\n2\n1 2\n3\n1 100\n2 100\n100 1000\n\nSample Output 3\n\n102\n200\n2000", "sample_input": "4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n"}, "reference_outputs": ["11\n12\n16\n"], "source_document_id": "p02630", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have a sequence A composed of N positive integers: A_{1}, A_{2}, \\cdots, A_{N}.\n\nYou will now successively do the following Q operations:\n\nIn the i-th operation, you replace every element whose value is B_{i} with C_{i}.\n\nFor each i (1 \\leq i \\leq Q), find S_{i}: the sum of all elements in A just after the i-th operation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q, A_{i}, B_{i}, C_{i} \\leq 10^{5}\n\nB_{i} \\neq C_{i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1} A_{2} \\cdots A_{N}\nQ\nB_{1} C_{1}\nB_{2} C_{2}\n\\vdots\nB_{Q} C_{Q}\n\nOutput\n\nPrint Q integers S_{i} to Standard Output in the following format:\n\nS_{1}\nS_{2}\n\\vdots\nS_{Q}\n\nNote that S_{i} may not fit into a 32-bit integer.\n\nSample Input 1\n\n4\n1 2 3 4\n3\n1 2\n3 4\n2 4\n\nSample Output 1\n\n11\n12\n16\n\nInitially, the sequence A is 1,2,3,4.\n\nAfter each operation, it becomes the following:\n\n2, 2, 3, 4\n\n2, 2, 4, 4\n\n4, 4, 4, 4\n\nSample Input 2\n\n4\n1 1 1 1\n3\n1 2\n2 1\n3 5\n\nSample Output 2\n\n8\n4\n4\n\nNote that the sequence A may not contain an element whose value is B_{i}.\n\nSample Input 3\n\n2\n1 2\n3\n1 100\n2 100\n100 1000\n\nSample Output 3\n\n102\n200\n2000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 563, "cpu_time_ms": 120, "memory_kb": 5044}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s201211844", "group_id": "codeNet:p02635", "input_text": "program shift\n implicit none\n integer(8), parameter :: p = 998244353\n character(300) :: s\n integer :: k, n, c(0:301) = 0, m = 0, i, j, x = 0\n integer(8) :: dp(0:301, 0:301) = 0\n integer(8) :: ans = 0\n read(*,*) s, k\n n = len_trim(s)\n do i = 1, n\n if (s(i:i) == '0') m = m + 1\n end do\n if (m == 0 .or. m == n) then\n write(*,'(i0)') 0\n stop\n end if\n m = m + 1\n j = m\n do i = n, 1, -1\n if (s(i:i) == '0') then\n j = j - 1\n else\n c(j) = c(j) + 1\n end if\n end do\n dp(m, 0) = 1\n x = c(m)\n do i = m - 1, 0, -1\n do j = x, 0, -1\n dp(i, j) = mod(sum(dp(i + 1, max(j - k, 0):j)), p)\n end do\n x = x + c(i)\n end do\n do i = 0, k\n ans = mod(ans + dp(0, i), p)\n end do\n write(*,'(i0)') ans\nend program shift", "language": "Fortran", "metadata": {"date": 1592712105, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02635.html", "problem_id": "p02635", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02635/input.txt", "sample_output_relpath": "derived/input_output/data/p02635/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02635/Fortran/s201211844.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s201211844", "user_id": "u506403362"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program shift\n implicit none\n integer(8), parameter :: p = 998244353\n character(300) :: s\n integer :: k, n, c(0:301) = 0, m = 0, i, j, x = 0\n integer(8) :: dp(0:301, 0:301) = 0\n integer(8) :: ans = 0\n read(*,*) s, k\n n = len_trim(s)\n do i = 1, n\n if (s(i:i) == '0') m = m + 1\n end do\n if (m == 0 .or. m == n) then\n write(*,'(i0)') 0\n stop\n end if\n m = m + 1\n j = m\n do i = n, 1, -1\n if (s(i:i) == '0') then\n j = j - 1\n else\n c(j) = c(j) + 1\n end if\n end do\n dp(m, 0) = 1\n x = c(m)\n do i = m - 1, 0, -1\n do j = x, 0, -1\n dp(i, j) = mod(sum(dp(i + 1, max(j - k, 0):j)), p)\n end do\n x = x + c(i)\n end do\n do i = 0, k\n ans = mod(ans + dp(0, i), p)\n end do\n write(*,'(i0)') ans\nend program shift", "problem_context": "Score : 800 points\n\nProblem Statement\n\nGiven is a string S consisting of 0 and 1. Find the number of strings, modulo 998244353, that can result from applying the following operation on S between 0 and K times (inclusive):\n\nChoose a pair of integers i, j (1\\leq i < j\\leq |S|) such that the i-th and j-th characters of S are 0 and 1, respectively. Remove the j-th character from S and insert it to the immediate left of the i-th character.\n\nConstraints\n\n1 \\leq |S| \\leq 300\n\n0 \\leq K \\leq 10^9\n\nS consists of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS K\n\nOutput\n\nFind the number of strings, modulo 998244353, that can result from applying the operation on S between 0 and K times (inclusive).\n\nSample Input 1\n\n0101 1\n\nSample Output 1\n\n4\n\nFour strings, 0101, 0110, 1001, and 1010, can result.\n\nSample Input 2\n\n01100110 2\n\nSample Output 2\n\n14\n\nSample Input 3\n\n1101010010101101110111100011011111011000111101110101010010101010101 20\n\nSample Output 3\n\n113434815", "sample_input": "0101 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02635", "source_text": "Score : 800 points\n\nProblem Statement\n\nGiven is a string S consisting of 0 and 1. Find the number of strings, modulo 998244353, that can result from applying the following operation on S between 0 and K times (inclusive):\n\nChoose a pair of integers i, j (1\\leq i < j\\leq |S|) such that the i-th and j-th characters of S are 0 and 1, respectively. Remove the j-th character from S and insert it to the immediate left of the i-th character.\n\nConstraints\n\n1 \\leq |S| \\leq 300\n\n0 \\leq K \\leq 10^9\n\nS consists of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS K\n\nOutput\n\nFind the number of strings, modulo 998244353, that can result from applying the operation on S between 0 and K times (inclusive).\n\nSample Input 1\n\n0101 1\n\nSample Output 1\n\n4\n\nFour strings, 0101, 0110, 1001, and 1010, can result.\n\nSample Input 2\n\n01100110 2\n\nSample Output 2\n\n14\n\nSample Input 3\n\n1101010010101101110111100011011111011000111101110101010010101010101 20\n\nSample Output 3\n\n113434815", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 758, "cpu_time_ms": 130, "memory_kb": 3676}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s663148315", "group_id": "codeNet:p02639", "input_text": " program abc170a\n implicit none\n integer,dimension(5)::x\n integer::i\n\n read *, x(1:5)\n do i=1,5\n if ( x(i)==0 ) then\n print *, i\n stop\n end if\n end do\n\n end program abc170a", "language": "Fortran", "metadata": {"date": 1592182985, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Fortran/s663148315.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s663148315", "user_id": "u792534719"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": " program abc170a\n implicit none\n integer,dimension(5)::x\n integer::i\n\n read *, x(1:5)\n do i=1,5\n if ( x(i)==0 ) then\n print *, i\n stop\n end if\n end do\n\n end program abc170a", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 265, "cpu_time_ms": 4, "memory_kb": 2792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s353045131", "group_id": "codeNet:p02639", "input_text": "program five\n implicit none\n integer :: i, a(5)\n read(*,*) a\n do i = 1, 5\n if (a(i)==0) then\n write(*,*) i\n stop\n end if\n end do\n stop\nend program five\n", "language": "Fortran", "metadata": {"date": 1592182973, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02639.html", "problem_id": "p02639", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02639/input.txt", "sample_output_relpath": "derived/input_output/data/p02639/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02639/Fortran/s353045131.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s353045131", "user_id": "u961266059"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program five\n implicit none\n integer :: i, a(5)\n read(*,*) a\n do i = 1, 5\n if (a(i)==0) then\n write(*,*) i\n stop\n end if\n end do\n stop\nend program five\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "sample_input": "0 2 3 4 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02639", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have five variables x_1, x_2, x_3, x_4, and x_5.\n\nThe variable x_i was initially assigned a value of i.\n\nSnuke chose one of these variables and assigned it 0.\n\nYou are given the values of the five variables after this assignment.\n\nFind out which variable Snuke assigned 0.\n\nConstraints\n\nThe values of x_1, x_2, x_3, x_4, and x_5 given as input are a possible outcome of the assignment by Snuke.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 x_2 x_3 x_4 x_5\n\nOutput\n\nIf the variable Snuke assigned 0 was x_i, print the integer i.\n\nSample Input 1\n\n0 2 3 4 5\n\nSample Output 1\n\n1\n\nIn this case, Snuke assigned 0 to x_1, so we should print 1.\n\nSample Input 2\n\n1 2 0 4 5\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 180, "cpu_time_ms": 7, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s920128858", "group_id": "codeNet:p02640", "input_text": "program main\ninteger::x,y\nread*,x,y\nif(mod(x,2)==0 .and. 2*x<=y .and. y<=4*x)then\n print*,\"Yes\"\nelse \n print*,\"No\"\nend if\nend program main", "language": "Fortran", "metadata": {"date": 1592363913, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Fortran/s920128858.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s920128858", "user_id": "u737968367"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\ninteger::x,y\nread*,x,y\nif(mod(x,2)==0 .and. 2*x<=y .and. y<=4*x)then\n print*,\"Yes\"\nelse \n print*,\"No\"\nend if\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 138, "cpu_time_ms": 30, "memory_kb": 2812}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s179839046", "group_id": "codeNet:p02640", "input_text": "program b170\n\nimplicit none\ninteger :: x, y\n\nread *, x, y\n\nif (mod(y,2) == 1) then\n print *, 'No'\nelse if (y > x * 4) then\n print *, 'No'\nelse if (y < x * 2) then\n print *, 'No'\nelse\n print *, 'Yes'\nend if\n\nend program b170", "language": "Fortran", "metadata": {"date": 1592188498, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Fortran/s179839046.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s179839046", "user_id": "u644436095"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program b170\n\nimplicit none\ninteger :: x, y\n\nread *, x, y\n\nif (mod(y,2) == 1) then\n print *, 'No'\nelse if (y > x * 4) then\n print *, 'No'\nelse if (y < x * 2) then\n print *, 'No'\nelse\n print *, 'Yes'\nend if\n\nend program b170", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 223, "cpu_time_ms": 6, "memory_kb": 2848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s333803656", "group_id": "codeNet:p02640", "input_text": "program main\nimplicit none\ninteger i, j\nif(j < 2*i .or. j > 4*i) then\n write(*, *) \"No\"\nelse if (mod(j, 2)/=0) then\n write(*, *) \"No\"\nelse if (mod(j, 2)==0) then\n write(*, *) \"Yes\"\nendif\nstop\nend program main\n \n", "language": "Fortran", "metadata": {"date": 1592184520, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Fortran/s333803656.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s333803656", "user_id": "u683443673"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\nimplicit none\ninteger i, j\nif(j < 2*i .or. j > 4*i) then\n write(*, *) \"No\"\nelse if (mod(j, 2)/=0) then\n write(*, *) \"No\"\nelse if (mod(j, 2)==0) then\n write(*, *) \"Yes\"\nendif\nstop\nend program main\n \n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 227, "cpu_time_ms": 2, "memory_kb": 2860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s368085254", "group_id": "codeNet:p02640", "input_text": "program abc170b\n implicit none\n integer :: x, y\n real(8) :: a, b, err=1d-3\n\n read(*,*) x, y\n\n a = dble(y)/2d0 - dble(x)\n b = dble(x) - a\n\n if (a >= 0d0 .and. b >=0d0) then\n if (a-int(a) <= err .and. b-int(b) <= err) then\n print *, \"Yes\"\n endif\n else\n print *, \"No\"\n endif\nend program abc170b\n", "language": "Fortran", "metadata": {"date": 1592184184, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Fortran/s368085254.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s368085254", "user_id": "u210113718"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program abc170b\n implicit none\n integer :: x, y\n real(8) :: a, b, err=1d-3\n\n read(*,*) x, y\n\n a = dble(y)/2d0 - dble(x)\n b = dble(x) - a\n\n if (a >= 0d0 .and. b >=0d0) then\n if (a-int(a) <= err .and. b-int(b) <= err) then\n print *, \"Yes\"\n endif\n else\n print *, \"No\"\n endif\nend program abc170b\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 333, "cpu_time_ms": 2, "memory_kb": 2880}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s900463712", "group_id": "codeNet:p02640", "input_text": "program main\n\timplicit none\n\tinteger(8):: X,Y,A,B,C,N,i,j,t,k,D,E\n\tread *, X,Y\n\t\n \tif(mod(Y,2)==1)then\n \tprint'(a)',\"No\"\n \tstop\n \tend if\n \tif((2*X-Y/2)>=0.and.(Y/2-X)>=0)then\n \tprint'(a)',\"Yes\"\n \tstop\n \telse \n \tprint'(a)',\"No\"\n\tstop\n end if\n\t\nend program main", "language": "Fortran", "metadata": {"date": 1592183513, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Fortran/s900463712.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900463712", "user_id": "u970637660"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n\timplicit none\n\tinteger(8):: X,Y,A,B,C,N,i,j,t,k,D,E\n\tread *, X,Y\n\t\n \tif(mod(Y,2)==1)then\n \tprint'(a)',\"No\"\n \tstop\n \tend if\n \tif((2*X-Y/2)>=0.and.(Y/2-X)>=0)then\n \tprint'(a)',\"Yes\"\n \tstop\n \telse \n \tprint'(a)',\"No\"\n\tstop\n end if\n\t\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 276, "cpu_time_ms": 6, "memory_kb": 2872}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s073629332", "group_id": "codeNet:p02640", "input_text": "program answer\n implicit none\n\n integer :: x, y, i\n\n read(*,*) x, y\n\n do i = 0, x\n if(4*x-2*i==y) then\n write(*,*) 'Yes'\n stop\n end if\n end do\n\n write(*,*) 'No'\n\n stop\n end program answer\n", "language": "Fortran", "metadata": {"date": 1592183327, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02640.html", "problem_id": "p02640", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02640/input.txt", "sample_output_relpath": "derived/input_output/data/p02640/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02640/Fortran/s073629332.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s073629332", "user_id": "u873780029"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program answer\n implicit none\n\n integer :: x, y, i\n\n read(*,*) x, y\n\n do i = 0, x\n if(4*x-2*i==y) then\n write(*,*) 'Yes'\n stop\n end if\n end do\n\n write(*,*) 'No'\n\n stop\n end program answer\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "sample_input": "3 8\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02640", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.\n\nTakahashi says: \"there are X animals in total in the garden, and they have Y legs in total.\" Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n1 \\leq Y \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 8\n\nSample Output 1\n\nYes\n\nThe statement \"there are 3 animals in total in the garden, and they have 8 legs in total\" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.\n\nSample Input 2\n\n2 100\n\nSample Output 2\n\nNo\n\nThere is no combination of numbers of cranes and turtles in which this statement is correct.\n\nSample Input 3\n\n1 2\n\nSample Output 3\n\nYes\n\nWe also consider the case in which there are only cranes or only turtles.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 217, "cpu_time_ms": 2, "memory_kb": 2860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s515510313", "group_id": "codeNet:p02641", "input_text": " program abc170c\n implicit none\n integer::x,n\n integer,allocatable,dimension(:)::p\n logical,allocatable,dimension(:)::check\n integer::i,step\n\n\n read *, x,n\n allocate( p(n),check(-100:200) )\n check=.false.\n read *, p(1:n)\n\n if ( n==0 ) then\n print *, x\n stop\n end if\n\n do i=1,n\n check(p(i))=.true.\n end do\n\n if ( check(x) .eqv. .false. ) then\n print *, x\n stop\n end if\n\n step=0\n do while ( check(x+step) .and. check(x-step) )\n step=step+1\n if ( check(x+step) .eqv. .false. ) then\n if ( check(x-step) .eqv. .false. ) then\n print *, x-step\n stop\n else\n print *, x+step\n stop\n end if\n end if\n end do\n\n\n end program abc170c", "language": "Fortran", "metadata": {"date": 1592186891, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02641.html", "problem_id": "p02641", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02641/input.txt", "sample_output_relpath": "derived/input_output/data/p02641/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02641/Fortran/s515510313.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s515510313", "user_id": "u792534719"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": " program abc170c\n implicit none\n integer::x,n\n integer,allocatable,dimension(:)::p\n logical,allocatable,dimension(:)::check\n integer::i,step\n\n\n read *, x,n\n allocate( p(n),check(-100:200) )\n check=.false.\n read *, p(1:n)\n\n if ( n==0 ) then\n print *, x\n stop\n end if\n\n do i=1,n\n check(p(i))=.true.\n end do\n\n if ( check(x) .eqv. .false. ) then\n print *, x\n stop\n end if\n\n step=0\n do while ( check(x+step) .and. check(x-step) )\n step=step+1\n if ( check(x+step) .eqv. .false. ) then\n if ( check(x-step) .eqv. .false. ) then\n print *, x-step\n stop\n else\n print *, x+step\n stop\n end if\n end if\n end do\n\n\n end program abc170c", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "sample_input": "6 5\n4 7 10 6 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02641", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 949, "cpu_time_ms": 7, "memory_kb": 2876}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s628998826", "group_id": "codeNet:p02641", "input_text": "program main\n implicit none\n\n integer :: x, y, z, n, i, k\n integer,allocatable :: p(:)\n\n read(*,*) x, n\n\n if(n == 0) then\n write(*,*) x\n stop\n end if\n \n allocate(p(n))\n read(*,*) p\n\n\n call heapsort(p)\n\n do i = 1, n\n if(p(i) == x) then\n k = i\n exit\n else\n k = -1\n end if\n end do\n\n if(k == -1) then\n write(*,*) x\n stop\n else\n if(k == 1) then\n y = x-1\n else\n \n do i = 1, k-1\n if(p(k-i) /= x-i) then\n y = x-i\n exit\n else\n y = x - k\n end if\n end do\n end if\n\n if(k == n) then\n z = x + 1\n else\n \n do i = 1, n-k\n if(p(k+i) /= x+i) then\n z = x+i\n exit\n else\n z = x + (n - k + 1)\n end if\n end do\n end if\n \n \n end if\n \n if(abs(y-x) <= abs(z-x))then\n write(*,*) y\n else\n write(*,*) z\n end if\n\n stop\n \n\n contains\n subroutine heapsort(array)\n implicit none\n integer, intent(inout) :: array(:)\n \n integer :: i,k,j,l\n double precision :: t\n \n if(n <= 0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n == 1)return\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j <= k)\n if(j < k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n\n return\nend subroutine heapsort\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1592186152, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02641.html", "problem_id": "p02641", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02641/input.txt", "sample_output_relpath": "derived/input_output/data/p02641/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02641/Fortran/s628998826.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s628998826", "user_id": "u979474608"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program main\n implicit none\n\n integer :: x, y, z, n, i, k\n integer,allocatable :: p(:)\n\n read(*,*) x, n\n\n if(n == 0) then\n write(*,*) x\n stop\n end if\n \n allocate(p(n))\n read(*,*) p\n\n\n call heapsort(p)\n\n do i = 1, n\n if(p(i) == x) then\n k = i\n exit\n else\n k = -1\n end if\n end do\n\n if(k == -1) then\n write(*,*) x\n stop\n else\n if(k == 1) then\n y = x-1\n else\n \n do i = 1, k-1\n if(p(k-i) /= x-i) then\n y = x-i\n exit\n else\n y = x - k\n end if\n end do\n end if\n\n if(k == n) then\n z = x + 1\n else\n \n do i = 1, n-k\n if(p(k+i) /= x+i) then\n z = x+i\n exit\n else\n z = x + (n - k + 1)\n end if\n end do\n end if\n \n \n end if\n \n if(abs(y-x) <= abs(z-x))then\n write(*,*) y\n else\n write(*,*) z\n end if\n\n stop\n \n\n contains\n subroutine heapsort(array)\n implicit none\n integer, intent(inout) :: array(:)\n \n integer :: i,k,j,l\n double precision :: t\n \n if(n <= 0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n == 1)return\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j <= k)\n if(j < k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n\n return\nend subroutine heapsort\n\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "sample_input": "6 5\n4 7 10 6 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02641", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1814, "cpu_time_ms": 2, "memory_kb": 2860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s650782115", "group_id": "codeNet:p02641", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: cnt(0:101), x,n,i,l,r\n integer(int32), allocatable:: p(:)\n\n read*, x,n\n allocate(p(n))\n read*, p(:)\n cnt(:) = 0\n do i=1,n\n cnt(p(i))=cnt(p(i))+1\n end do\n\n l=x\n r=x\n\n do while(0 /= l .or. r /= 101)\n if (cnt(l) == 0) then\n print'(i0)', l \n stop\n end if\n\n if (cnt(r) == 0) then\n print'(i0)', r\n stop\n end if\n\n l=max(l-1,0)\n r=min(r+1,101)\n end do\nend program main", "language": "Fortran", "metadata": {"date": 1592183462, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02641.html", "problem_id": "p02641", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02641/input.txt", "sample_output_relpath": "derived/input_output/data/p02641/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02641/Fortran/s650782115.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s650782115", "user_id": "u234636620"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: cnt(0:101), x,n,i,l,r\n integer(int32), allocatable:: p(:)\n\n read*, x,n\n allocate(p(n))\n read*, p(:)\n cnt(:) = 0\n do i=1,n\n cnt(p(i))=cnt(p(i))+1\n end do\n\n l=x\n r=x\n\n do while(0 /= l .or. r /= 101)\n if (cnt(l) == 0) then\n print'(i0)', l \n stop\n end if\n\n if (cnt(r) == 0) then\n print'(i0)', r\n stop\n end if\n\n l=max(l-1,0)\n r=min(r+1,101)\n end do\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "sample_input": "6 5\n4 7 10 6 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02641", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are an integer X and an integer sequence of length N: p_1, \\ldots, p_N.\n\nAmong the integers not contained in the sequence p_1, \\ldots, p_N (not necessarily positive), find the integer nearest to X, that is, find the integer whose absolute difference with X is the minimum. If there are multiple such integers, report the smallest such integer.\n\nConstraints\n\n1 \\leq X \\leq 100\n\n0 \\leq N \\leq 100\n\n1 \\leq p_i \\leq 100\n\np_1, \\ldots, p_N are all distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX N\np_1 ... p_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n6 5\n4 7 10 6 5\n\nSample Output 1\n\n8\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the one nearest to 6 is 8.\n\nSample Input 2\n\n10 5\n4 7 10 6 5\n\nSample Output 2\n\n9\n\nAmong the integers not contained in the sequence 4, 7, 10, 6, 5, the ones nearest to 10 are 9 and 11. We should print the smaller one, 9.\n\nSample Input 3\n\n100 0\n\nSample Output 3\n\n100\n\nWhen N = 0, the second line in the input will be empty. Also, as seen here, X itself can be the answer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 575, "cpu_time_ms": 4, "memory_kb": 2932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s290446161", "group_id": "codeNet:p02645", "input_text": "program probA\n implicit none\n integer::i\n character(len=21)::S\n character(len=1)::v(3)\n read(*,*) S\n\n do i = 1,3\n v(i) = S(i:i)\n end do\n\n write(*,*) v\n stop\nend program", "language": "Fortran", "metadata": {"date": 1592106537, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02645.html", "problem_id": "p02645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02645/input.txt", "sample_output_relpath": "derived/input_output/data/p02645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02645/Fortran/s290446161.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s290446161", "user_id": "u841856382"}, "prompt_components": {"gold_output": "tak\n", "input_to_evaluate": "program probA\n implicit none\n integer::i\n character(len=21)::S\n character(len=1)::v(3)\n read(*,*) S\n\n do i = 1,3\n v(i) = S(i:i)\n end do\n\n write(*,*) v\n stop\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWhen you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters.\nYou have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him.\n\nConstraints\n\n3 \\leq |S| \\leq 20\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint your answer.\n\nSample Input 1\n\ntakahashi\n\nSample Output 1\n\ntak\n\nSample Input 2\n\nnaohiro\n\nSample Output 2\n\nnao", "sample_input": "takahashi\n"}, "reference_outputs": ["tak\n"], "source_document_id": "p02645", "source_text": "Score : 100 points\n\nProblem Statement\n\nWhen you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters.\nYou have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him.\n\nConstraints\n\n3 \\leq |S| \\leq 20\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint your answer.\n\nSample Input 1\n\ntakahashi\n\nSample Output 1\n\ntak\n\nSample Input 2\n\nnaohiro\n\nSample Output 2\n\nnao", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 202, "cpu_time_ms": 13, "memory_kb": 2780}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s187265545", "group_id": "codeNet:p02645", "input_text": "program a613\n \nimplicit none\ncharacter(len=20) :: s\n \nread *, s\n\nprint '(A3)', trim(s(:3))\n \nend program a613", "language": "Fortran", "metadata": {"date": 1592101403, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02645.html", "problem_id": "p02645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02645/input.txt", "sample_output_relpath": "derived/input_output/data/p02645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02645/Fortran/s187265545.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s187265545", "user_id": "u644436095"}, "prompt_components": {"gold_output": "tak\n", "input_to_evaluate": "program a613\n \nimplicit none\ncharacter(len=20) :: s\n \nread *, s\n\nprint '(A3)', trim(s(:3))\n \nend program a613", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWhen you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters.\nYou have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him.\n\nConstraints\n\n3 \\leq |S| \\leq 20\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint your answer.\n\nSample Input 1\n\ntakahashi\n\nSample Output 1\n\ntak\n\nSample Input 2\n\nnaohiro\n\nSample Output 2\n\nnao", "sample_input": "takahashi\n"}, "reference_outputs": ["tak\n"], "source_document_id": "p02645", "source_text": "Score : 100 points\n\nProblem Statement\n\nWhen you asked some guy in your class his name, he called himself S, where S is a string of length between 3 and 20 (inclusive) consisting of lowercase English letters.\nYou have decided to choose some three consecutive characters from S and make it his nickname. Print a string that is a valid nickname for him.\n\nConstraints\n\n3 \\leq |S| \\leq 20\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint your answer.\n\nSample Input 1\n\ntakahashi\n\nSample Output 1\n\ntak\n\nSample Input 2\n\nnaohiro\n\nSample Output 2\n\nnao", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 109, "cpu_time_ms": 6, "memory_kb": 2896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s452607856", "group_id": "codeNet:p02646", "input_text": "program answer\n implicit none\n\n integer :: A, V, B, W, T\n\n read(*,*) A, V\n read(*,*) B, W\n read(*,*) T\n\n if(W>=V) then\n write(*,*) 'NO'\n stop\n end if\n \n if(A=V) then\n write(*,*) 'NO'\n stop\n end if\n \n if(An*log(n))then\n A(:)=n\n else\n do i =1,k\n do j = 1,n\n B(j) =0\n end do\n do m =1,n\n d = A(m)\n B(m) =B(m)+1\n do l = 1,d\n if ((m+l).le.n)then\n B(m+l) =B(m+l)+1\n endif\n if (m.gt.l)then\n B(m-l) = B(m-l)+1\n endif\n end do\n end do\n do p = 1,n\n A(p) = B(p)\n end do\n\n end do\n endif\n\n write(*,*)A\n\n end program\n\n \n", "language": "Fortran", "metadata": {"date": 1592105670, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02647.html", "problem_id": "p02647", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02647/input.txt", "sample_output_relpath": "derived/input_output/data/p02647/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02647/Fortran/s981993830.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s981993830", "user_id": "u062754605"}, "prompt_components": {"gold_output": "1 2 2 1 2\n", "input_to_evaluate": " program tokyoA\n implicit none\n\n integer(8) :: i,k,l,m,j,d,p\n real(8)::n\n integer(8),allocatable::B(:),A(:)\n\n read(*,*)n,k\n allocate(A(n),B(n))\n\n read(*,*)A(:)\n\n if (K >n*log(n))then\n A(:)=n\n else\n do i =1,k\n do j = 1,n\n B(j) =0\n end do\n do m =1,n\n d = A(m)\n B(m) =B(m)+1\n do l = 1,d\n if ((m+l).le.n)then\n B(m+l) =B(m+l)+1\n endif\n if (m.gt.l)then\n B(m-l) = B(m-l)+1\n endif\n end do\n end do\n do p = 1,n\n A(p) = B(p)\n end do\n\n end do\n endif\n\n write(*,*)A\n\n end program\n\n \n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N bulbs arranged on a number line, numbered 1 to N from left to right.\nBulb i is at coordinate i.\n\nEach bulb has a non-negative integer parameter called intensity.\nWhen there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5.\nInitially, the intensity of Bulb i is A_i. We will now do the following operation K times in a row:\n\nFor each integer i between 1 and N (inclusive), let B_i be the number of bulbs illuminating coordinate i. Then, change the intensity of each bulb i to B_i.\n\nFind the intensity of each bulb after the K operations.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq 2 \\times 10^5\n\n0 \\leq A_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the intensity A{'}_i of each bulb i after the K operations to Standard Output in the following format:\n\nA{'}_1 A{'}_2 \\ldots A{'}_N\n\nSample Input 1\n\n5 1\n1 0 0 1 0\n\nSample Output 1\n\n1 2 2 1 2\n\nInitially, only Bulb 1 illuminates coordinate 1, so the intensity of Bulb 1 becomes 1 after the operation.\nSimilarly, the bulbs initially illuminating coordinate 2 are Bulb 1 and 2, so the intensity of Bulb 2 becomes 2.\n\nSample Input 2\n\n5 2\n1 0 0 1 0\n\nSample Output 2\n\n3 3 4 4 3", "sample_input": "5 1\n1 0 0 1 0\n"}, "reference_outputs": ["1 2 2 1 2\n"], "source_document_id": "p02647", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N bulbs arranged on a number line, numbered 1 to N from left to right.\nBulb i is at coordinate i.\n\nEach bulb has a non-negative integer parameter called intensity.\nWhen there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5.\nInitially, the intensity of Bulb i is A_i. We will now do the following operation K times in a row:\n\nFor each integer i between 1 and N (inclusive), let B_i be the number of bulbs illuminating coordinate i. Then, change the intensity of each bulb i to B_i.\n\nFind the intensity of each bulb after the K operations.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq 2 \\times 10^5\n\n0 \\leq A_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the intensity A{'}_i of each bulb i after the K operations to Standard Output in the following format:\n\nA{'}_1 A{'}_2 \\ldots A{'}_N\n\nSample Input 1\n\n5 1\n1 0 0 1 0\n\nSample Output 1\n\n1 2 2 1 2\n\nInitially, only Bulb 1 illuminates coordinate 1, so the intensity of Bulb 1 becomes 1 after the operation.\nSimilarly, the bulbs initially illuminating coordinate 2 are Bulb 1 and 2, so the intensity of Bulb 2 becomes 2.\n\nSample Input 2\n\n5 2\n1 0 0 1 0\n\nSample Output 2\n\n3 3 4 4 3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 758, "cpu_time_ms": 2205, "memory_kb": 8240}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s918066268", "group_id": "codeNet:p02647", "input_text": "program c613\n\nimplicit none\ninteger :: n, k, i, j, h\ninteger, allocatable :: a(:), b(:)\n\nread *, n, k\nallocate(a(1:n))\nallocate(b(1:n))\n\nread *, a(:)\n\nb(:) = 0\n\ndo h = 1, k\n do i = 1, n\n do j = i - a(i), i + a(i)\n b(j) = b(j) + 1\n end do\n end do\n a(:) = b(:) \nend do\n\nprint *, a(:)\n\nend program c613", "language": "Fortran", "metadata": {"date": 1592099532, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02647.html", "problem_id": "p02647", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02647/input.txt", "sample_output_relpath": "derived/input_output/data/p02647/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02647/Fortran/s918066268.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s918066268", "user_id": "u644436095"}, "prompt_components": {"gold_output": "1 2 2 1 2\n", "input_to_evaluate": "program c613\n\nimplicit none\ninteger :: n, k, i, j, h\ninteger, allocatable :: a(:), b(:)\n\nread *, n, k\nallocate(a(1:n))\nallocate(b(1:n))\n\nread *, a(:)\n\nb(:) = 0\n\ndo h = 1, k\n do i = 1, n\n do j = i - a(i), i + a(i)\n b(j) = b(j) + 1\n end do\n end do\n a(:) = b(:) \nend do\n\nprint *, a(:)\n\nend program c613", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N bulbs arranged on a number line, numbered 1 to N from left to right.\nBulb i is at coordinate i.\n\nEach bulb has a non-negative integer parameter called intensity.\nWhen there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5.\nInitially, the intensity of Bulb i is A_i. We will now do the following operation K times in a row:\n\nFor each integer i between 1 and N (inclusive), let B_i be the number of bulbs illuminating coordinate i. Then, change the intensity of each bulb i to B_i.\n\nFind the intensity of each bulb after the K operations.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq 2 \\times 10^5\n\n0 \\leq A_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the intensity A{'}_i of each bulb i after the K operations to Standard Output in the following format:\n\nA{'}_1 A{'}_2 \\ldots A{'}_N\n\nSample Input 1\n\n5 1\n1 0 0 1 0\n\nSample Output 1\n\n1 2 2 1 2\n\nInitially, only Bulb 1 illuminates coordinate 1, so the intensity of Bulb 1 becomes 1 after the operation.\nSimilarly, the bulbs initially illuminating coordinate 2 are Bulb 1 and 2, so the intensity of Bulb 2 becomes 2.\n\nSample Input 2\n\n5 2\n1 0 0 1 0\n\nSample Output 2\n\n3 3 4 4 3", "sample_input": "5 1\n1 0 0 1 0\n"}, "reference_outputs": ["1 2 2 1 2\n"], "source_document_id": "p02647", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N bulbs arranged on a number line, numbered 1 to N from left to right.\nBulb i is at coordinate i.\n\nEach bulb has a non-negative integer parameter called intensity.\nWhen there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5.\nInitially, the intensity of Bulb i is A_i. We will now do the following operation K times in a row:\n\nFor each integer i between 1 and N (inclusive), let B_i be the number of bulbs illuminating coordinate i. Then, change the intensity of each bulb i to B_i.\n\nFind the intensity of each bulb after the K operations.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq 2 \\times 10^5\n\n0 \\leq A_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the intensity A{'}_i of each bulb i after the K operations to Standard Output in the following format:\n\nA{'}_1 A{'}_2 \\ldots A{'}_N\n\nSample Input 1\n\n5 1\n1 0 0 1 0\n\nSample Output 1\n\n1 2 2 1 2\n\nInitially, only Bulb 1 illuminates coordinate 1, so the intensity of Bulb 1 becomes 1 after the operation.\nSimilarly, the bulbs initially illuminating coordinate 2 are Bulb 1 and 2, so the intensity of Bulb 2 becomes 2.\n\nSample Input 2\n\n5 2\n1 0 0 1 0\n\nSample Output 2\n\n3 3 4 4 3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 303, "cpu_time_ms": 209, "memory_kb": 5104}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s009013269", "group_id": "codeNet:p02657", "input_text": "program mondai2\nimplicit none\ninteger*8 i, n, b\ninteger*8 a(100000)\nb = 1\ni = 1\nread(*,*) n\nread(*,*) (a(i), i=1,n)\ni = 1\ndo while (i<=n)\n b = b * a(i)\n i = i + 1\nend do\nif (b / 10.0 ** 18.0 > 1) then\n b = -1\nend if\nwrite(*,*) b\nend program mondai2", "language": "Fortran", "metadata": {"date": 1590979067, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02657.html", "problem_id": "p02657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02657/input.txt", "sample_output_relpath": "derived/input_output/data/p02657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02657/Fortran/s009013269.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s009013269", "user_id": "u893337809"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program mondai2\nimplicit none\ninteger*8 i, n, b\ninteger*8 a(100000)\nb = 1\ni = 1\nread(*,*) n\nread(*,*) (a(i), i=1,n)\ni = 1\ndo while (i<=n)\n b = b * a(i)\n i = i + 1\nend do\nif (b / 10.0 ** 18.0 > 1) then\n b = -1\nend if\nwrite(*,*) b\nend program mondai2", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "sample_input": "2 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02657", "source_text": "Score : 100 points\n\nProblem Statement\n\nCompute A \\times B.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the value A \\times B as an integer.\n\nSample Input 1\n\n2 5\n\nSample Output 1\n\n10\n\nWe have 2 \\times 5 = 10.\n\nSample Input 2\n\n100 100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 251, "cpu_time_ms": 14, "memory_kb": 3156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s551762072", "group_id": "codeNet:p02660", "input_text": "program main\n implicit none\n integer(8) i, N, lim, m(39), t, ans, exp, level\n !integer(8),allocatable:: A(:,:)\n read(*, *) N\n lim = floor(N ** 0.5) + 1\n !allocate(A(N,2)\n m = 0\n t = 0\n do i = 1,39\n m(i) = t+i\n t = m(i)\n end do\n !read(*, *) (L(i), i = 1,N)\n t = 2\n exp = 0\n level = 0\n ans = 0\n if (N == 1) then\n ans = 0\n else\n do\n if (mod(N,t) == 0) then\n exp = exp + 1\n N = N/t\n if (exp == m(level+1)) then\n level = level + 1\n end if\n else\n ans = ans + level\n exp = 0\n level = 0\n t = t+1\n endif\n if (t == lim) then\n if (ans == 0) then\n ans = ans + 1\n endif\n exit\n endif\n end do\n endif\n write(*, *) ans\nend program main\n", "language": "Fortran", "metadata": {"date": 1590977106, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02660.html", "problem_id": "p02660", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02660/input.txt", "sample_output_relpath": "derived/input_output/data/p02660/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02660/Fortran/s551762072.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s551762072", "user_id": "u050276949"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n implicit none\n integer(8) i, N, lim, m(39), t, ans, exp, level\n !integer(8),allocatable:: A(:,:)\n read(*, *) N\n lim = floor(N ** 0.5) + 1\n !allocate(A(N,2)\n m = 0\n t = 0\n do i = 1,39\n m(i) = t+i\n t = m(i)\n end do\n !read(*, *) (L(i), i = 1,N)\n t = 2\n exp = 0\n level = 0\n ans = 0\n if (N == 1) then\n ans = 0\n else\n do\n if (mod(N,t) == 0) then\n exp = exp + 1\n N = N/t\n if (exp == m(level+1)) then\n level = level + 1\n end if\n else\n ans = ans + level\n exp = 0\n level = 0\n t = t+1\n endif\n if (t == lim) then\n if (ans == 0) then\n ans = ans + 1\n endif\n exit\n endif\n end do\n endif\n write(*, *) ans\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N. Consider repeatedly applying the operation below on N:\n\nFirst, choose a positive integer z satisfying all of the conditions below:\n\nz can be represented as z=p^e, where p is a prime number and e is a positive integer;\n\nz divides N;\n\nz is different from all integers chosen in previous operations.\n\nThen, replace N with N/z.\n\nFind the maximum number of times the operation can be applied.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum number of times the operation can be applied.\n\nSample Input 1\n\n24\n\nSample Output 1\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=12.)\n\nChoose z=3 (=3^1). (Now we have N=4.)\n\nChoose z=4 (=2^2). (Now we have N=1.)\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0\n\nWe cannot apply the operation at all.\n\nSample Input 3\n\n64\n\nSample Output 3\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=32.)\n\nChoose z=4 (=2^2). (Now we have N=8.)\n\nChoose z=8 (=2^3). (Now we have N=1.)\n\nSample Input 4\n\n1000000007\n\nSample Output 4\n\n1\n\nWe can apply the operation once by, for example, making the following choice:\n\nz=1000000007 (=1000000007^1). (Now we have N=1.)\n\nSample Input 5\n\n997764507000\n\nSample Output 5\n\n7", "sample_input": "24\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02660", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N. Consider repeatedly applying the operation below on N:\n\nFirst, choose a positive integer z satisfying all of the conditions below:\n\nz can be represented as z=p^e, where p is a prime number and e is a positive integer;\n\nz divides N;\n\nz is different from all integers chosen in previous operations.\n\nThen, replace N with N/z.\n\nFind the maximum number of times the operation can be applied.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum number of times the operation can be applied.\n\nSample Input 1\n\n24\n\nSample Output 1\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=12.)\n\nChoose z=3 (=3^1). (Now we have N=4.)\n\nChoose z=4 (=2^2). (Now we have N=1.)\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0\n\nWe cannot apply the operation at all.\n\nSample Input 3\n\n64\n\nSample Output 3\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=32.)\n\nChoose z=4 (=2^2). (Now we have N=8.)\n\nChoose z=8 (=2^3). (Now we have N=1.)\n\nSample Input 4\n\n1000000007\n\nSample Output 4\n\n1\n\nWe can apply the operation once by, for example, making the following choice:\n\nz=1000000007 (=1000000007^1). (Now we have N=1.)\n\nSample Input 5\n\n997764507000\n\nSample Output 5\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 773, "cpu_time_ms": 19, "memory_kb": 2920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s591413484", "group_id": "codeNet:p02660", "input_text": "program d\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64)::n,i,j,ans\n integer(int64):: dn(1000000)=0, bn(0:5050)\n logical:: pn(1000000) = .true. \n\n\n read*, n\n pn(1) = .false.\n\n do i=2,1000000\n if (pn(i)) then\n j=2\n do while(i*j <= 1000000)\n pn(i*j) = .false.\n j=j+1\n end do\n end if\n end do\n\n do i=2,1000000\n if (pn(i)) then\n do while(mod(n,i) == 0)\n n=n/i\n dn(i) = dn(i)+1\n end do\n end if\n end do\n ans = 0\n\n if (n > 1) ans=ans+1\n bn(:) = 0\n do i=100,1,-1\n bn((i*(i+1))/2) = i\n end do\n do i=2,5050\n bn(i) = max(bn(i),bn(i-1))\n end do\n\n do i=1,1000000\n ans=ans+bn(dn(i))\n end do\n print'(i0)', ans\n\nend program d", "language": "Fortran", "metadata": {"date": 1590976150, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02660.html", "problem_id": "p02660", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02660/input.txt", "sample_output_relpath": "derived/input_output/data/p02660/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02660/Fortran/s591413484.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s591413484", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program d\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64)::n,i,j,ans\n integer(int64):: dn(1000000)=0, bn(0:5050)\n logical:: pn(1000000) = .true. \n\n\n read*, n\n pn(1) = .false.\n\n do i=2,1000000\n if (pn(i)) then\n j=2\n do while(i*j <= 1000000)\n pn(i*j) = .false.\n j=j+1\n end do\n end if\n end do\n\n do i=2,1000000\n if (pn(i)) then\n do while(mod(n,i) == 0)\n n=n/i\n dn(i) = dn(i)+1\n end do\n end if\n end do\n ans = 0\n\n if (n > 1) ans=ans+1\n bn(:) = 0\n do i=100,1,-1\n bn((i*(i+1))/2) = i\n end do\n do i=2,5050\n bn(i) = max(bn(i),bn(i-1))\n end do\n\n do i=1,1000000\n ans=ans+bn(dn(i))\n end do\n print'(i0)', ans\n\nend program d", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N. Consider repeatedly applying the operation below on N:\n\nFirst, choose a positive integer z satisfying all of the conditions below:\n\nz can be represented as z=p^e, where p is a prime number and e is a positive integer;\n\nz divides N;\n\nz is different from all integers chosen in previous operations.\n\nThen, replace N with N/z.\n\nFind the maximum number of times the operation can be applied.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum number of times the operation can be applied.\n\nSample Input 1\n\n24\n\nSample Output 1\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=12.)\n\nChoose z=3 (=3^1). (Now we have N=4.)\n\nChoose z=4 (=2^2). (Now we have N=1.)\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0\n\nWe cannot apply the operation at all.\n\nSample Input 3\n\n64\n\nSample Output 3\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=32.)\n\nChoose z=4 (=2^2). (Now we have N=8.)\n\nChoose z=8 (=2^3). (Now we have N=1.)\n\nSample Input 4\n\n1000000007\n\nSample Output 4\n\n1\n\nWe can apply the operation once by, for example, making the following choice:\n\nz=1000000007 (=1000000007^1). (Now we have N=1.)\n\nSample Input 5\n\n997764507000\n\nSample Output 5\n\n7", "sample_input": "24\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02660", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N. Consider repeatedly applying the operation below on N:\n\nFirst, choose a positive integer z satisfying all of the conditions below:\n\nz can be represented as z=p^e, where p is a prime number and e is a positive integer;\n\nz divides N;\n\nz is different from all integers chosen in previous operations.\n\nThen, replace N with N/z.\n\nFind the maximum number of times the operation can be applied.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum number of times the operation can be applied.\n\nSample Input 1\n\n24\n\nSample Output 1\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=12.)\n\nChoose z=3 (=3^1). (Now we have N=4.)\n\nChoose z=4 (=2^2). (Now we have N=1.)\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0\n\nWe cannot apply the operation at all.\n\nSample Input 3\n\n64\n\nSample Output 3\n\n3\n\nWe can apply the operation three times by, for example, making the following choices:\n\nChoose z=2 (=2^1). (Now we have N=32.)\n\nChoose z=4 (=2^2). (Now we have N=8.)\n\nChoose z=8 (=2^3). (Now we have N=1.)\n\nSample Input 4\n\n1000000007\n\nSample Output 4\n\n1\n\nWe can apply the operation once by, for example, making the following choice:\n\nz=1000000007 (=1000000007^1). (Now we have N=1.)\n\nSample Input 5\n\n997764507000\n\nSample Output 5\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 853, "cpu_time_ms": 24, "memory_kb": 6812}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s584866687", "group_id": "codeNet:p02663", "input_text": "program a0530\n\nimplicit none\ninteger :: h1, h2, m1, m2, k, t\n\nread *, h1, m1, h2, m2, k\nt = (h2 - h1) * 60 + m2 - m1\n\nprint *, t - k\n\nend program a0530", "language": "Fortran", "metadata": {"date": 1591408631, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02663.html", "problem_id": "p02663", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02663/input.txt", "sample_output_relpath": "derived/input_output/data/p02663/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02663/Fortran/s584866687.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s584866687", "user_id": "u644436095"}, "prompt_components": {"gold_output": "270\n", "input_to_evaluate": "program a0530\n\nimplicit none\ninteger :: h1, h2, m1, m2, k, t\n\nread *, h1, m1, h2, m2, k\nt = (h2 - h1) * 60 + m2 - m1\n\nprint *, t - k\n\nend program a0530", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn this problem, we use the 24-hour clock.\n\nTakahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.)\nHe has decided to study for K consecutive minutes while he is up.\nWhat is the length of the period in which he can start studying?\n\nConstraints\n\n0 \\le H_1, H_2 \\le 23\n\n0 \\le M_1, M_2 \\le 59\n\nThe time H_1 : M_1 comes before the time H_2 : M_2.\n\nK \\ge 1\n\nTakahashi is up for at least K minutes.\n\nAll values in input are integers (without leading zeros).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH_1 M_1 H_2 M_2 K\n\nOutput\n\nPrint the length of the period in which he can start studying, as an integer.\n\nSample Input 1\n\n10 0 15 0 30\n\nSample Output 1\n\n270\n\nTakahashi gets up at exactly ten in the morning and goes to bed at exactly three in the afternoon.\nIt takes 30 minutes to do the study, so he can start it in the period between ten o'clock and half-past two. The length of this period is 270 minutes, so we should print 270.\n\nSample Input 2\n\n10 0 12 0 120\n\nSample Output 2\n\n0\n\nTakahashi gets up at exactly ten in the morning and goes to bed at exactly noon. It takes 120 minutes to do the study, so he has to start it at exactly ten o'clock. Thus, we should print 0.", "sample_input": "10 0 15 0 30\n"}, "reference_outputs": ["270\n"], "source_document_id": "p02663", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn this problem, we use the 24-hour clock.\n\nTakahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.)\nHe has decided to study for K consecutive minutes while he is up.\nWhat is the length of the period in which he can start studying?\n\nConstraints\n\n0 \\le H_1, H_2 \\le 23\n\n0 \\le M_1, M_2 \\le 59\n\nThe time H_1 : M_1 comes before the time H_2 : M_2.\n\nK \\ge 1\n\nTakahashi is up for at least K minutes.\n\nAll values in input are integers (without leading zeros).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH_1 M_1 H_2 M_2 K\n\nOutput\n\nPrint the length of the period in which he can start studying, as an integer.\n\nSample Input 1\n\n10 0 15 0 30\n\nSample Output 1\n\n270\n\nTakahashi gets up at exactly ten in the morning and goes to bed at exactly three in the afternoon.\nIt takes 30 minutes to do the study, so he can start it in the period between ten o'clock and half-past two. The length of this period is 270 minutes, so we should print 270.\n\nSample Input 2\n\n10 0 12 0 120\n\nSample Output 2\n\n0\n\nTakahashi gets up at exactly ten in the morning and goes to bed at exactly noon. It takes 120 minutes to do the study, so he has to start it at exactly ten o'clock. Thus, we should print 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 151, "cpu_time_ms": 6, "memory_kb": 2848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s287904808", "group_id": "codeNet:p02663", "input_text": " program main\n\n integer H1,H2,M1,M2,K,ANS\n ANS = 0\n read *,H1,M1,H2,M2,K\n ANS = ( H2 * 60 + M2 ) - ( H1 * 60 + M1 ) - K\n print *,ANS\n end program main", "language": "Fortran", "metadata": {"date": 1590887633, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02663.html", "problem_id": "p02663", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02663/input.txt", "sample_output_relpath": "derived/input_output/data/p02663/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02663/Fortran/s287904808.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s287904808", "user_id": "u416318434"}, "prompt_components": {"gold_output": "270\n", "input_to_evaluate": " program main\n\n integer H1,H2,M1,M2,K,ANS\n ANS = 0\n read *,H1,M1,H2,M2,K\n ANS = ( H2 * 60 + M2 ) - ( H1 * 60 + M1 ) - K\n print *,ANS\n end program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn this problem, we use the 24-hour clock.\n\nTakahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.)\nHe has decided to study for K consecutive minutes while he is up.\nWhat is the length of the period in which he can start studying?\n\nConstraints\n\n0 \\le H_1, H_2 \\le 23\n\n0 \\le M_1, M_2 \\le 59\n\nThe time H_1 : M_1 comes before the time H_2 : M_2.\n\nK \\ge 1\n\nTakahashi is up for at least K minutes.\n\nAll values in input are integers (without leading zeros).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH_1 M_1 H_2 M_2 K\n\nOutput\n\nPrint the length of the period in which he can start studying, as an integer.\n\nSample Input 1\n\n10 0 15 0 30\n\nSample Output 1\n\n270\n\nTakahashi gets up at exactly ten in the morning and goes to bed at exactly three in the afternoon.\nIt takes 30 minutes to do the study, so he can start it in the period between ten o'clock and half-past two. The length of this period is 270 minutes, so we should print 270.\n\nSample Input 2\n\n10 0 12 0 120\n\nSample Output 2\n\n0\n\nTakahashi gets up at exactly ten in the morning and goes to bed at exactly noon. It takes 120 minutes to do the study, so he has to start it at exactly ten o'clock. Thus, we should print 0.", "sample_input": "10 0 15 0 30\n"}, "reference_outputs": ["270\n"], "source_document_id": "p02663", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn this problem, we use the 24-hour clock.\n\nTakahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.)\nHe has decided to study for K consecutive minutes while he is up.\nWhat is the length of the period in which he can start studying?\n\nConstraints\n\n0 \\le H_1, H_2 \\le 23\n\n0 \\le M_1, M_2 \\le 59\n\nThe time H_1 : M_1 comes before the time H_2 : M_2.\n\nK \\ge 1\n\nTakahashi is up for at least K minutes.\n\nAll values in input are integers (without leading zeros).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH_1 M_1 H_2 M_2 K\n\nOutput\n\nPrint the length of the period in which he can start studying, as an integer.\n\nSample Input 1\n\n10 0 15 0 30\n\nSample Output 1\n\n270\n\nTakahashi gets up at exactly ten in the morning and goes to bed at exactly three in the afternoon.\nIt takes 30 minutes to do the study, so he can start it in the period between ten o'clock and half-past two. The length of this period is 270 minutes, so we should print 270.\n\nSample Input 2\n\n10 0 12 0 120\n\nSample Output 2\n\n0\n\nTakahashi gets up at exactly ten in the morning and goes to bed at exactly noon. It takes 120 minutes to do the study, so he has to start it at exactly ten o'clock. Thus, we should print 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 171, "cpu_time_ms": 2, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s565320943", "group_id": "codeNet:p02664", "input_text": "program main\n implicit none\n character t*200000\n character, allocatable :: s(:)\n integer i,n\n\n read(*,*) t\n n = len_trim(t)\n allocate(s(n))\n do i = 1,n\n if(t(i:i) == \"?\") then\n s(i:i) = \"D\"\n else\n s(i:i) = t(i:i)\n end if\n end do\n\n write(*,*) s\n\nend program\n\n", "language": "Fortran", "metadata": {"date": 1590888886, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02664.html", "problem_id": "p02664", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02664/input.txt", "sample_output_relpath": "derived/input_output/data/p02664/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02664/Fortran/s565320943.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s565320943", "user_id": "u806372060"}, "prompt_components": {"gold_output": "PDPDPDP\n", "input_to_evaluate": "program main\n implicit none\n character t*200000\n character, allocatable :: s(:)\n integer i,n\n\n read(*,*) t\n n = len_trim(t)\n allocate(s(n))\n do i = 1,n\n if(t(i:i) == \"?\") then\n s(i:i) = \"D\"\n else\n s(i:i) = t(i:i)\n end if\n end do\n\n write(*,*) s\n\nend program\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFor a string S consisting of the uppercase English letters P and D, let the doctoral and postdoctoral quotient of S be the total number of occurrences of D and PD in S as contiguous substrings. For example, if S = PPDDP, it contains two occurrences of D and one occurrence of PD as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3.\n\nWe have a string T consisting of P, D, and ?.\n\nAmong the strings that can be obtained by replacing each ? in T with P or D, find one with the maximum possible doctoral and postdoctoral quotient.\n\nConstraints\n\n1 \\leq |T| \\leq 2 \\times 10^5\n\nT consists of P, D, and ?.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT\n\nOutput\n\nPrint one string with the maximum possible doctoral and postdoctoral quotient among the strings that can be obtained by replacing each ? in T with P or D.\nIf there are multiple such strings, you may print any of them.\n\nSample Input 1\n\nPD?D??P\n\nSample Output 1\n\nPDPDPDP\n\nThis string contains three occurrences of D and three occurrences of PD as contiguous substrings, so its doctoral and postdoctoral quotient is 6, which is the maximum doctoral and postdoctoral quotient of a string obtained by replacing each ? in T with P or D.\n\nSample Input 2\n\nP?P?\n\nSample Output 2\n\nPDPD", "sample_input": "PD?D??P\n"}, "reference_outputs": ["PDPDPDP\n"], "source_document_id": "p02664", "source_text": "Score : 200 points\n\nProblem Statement\n\nFor a string S consisting of the uppercase English letters P and D, let the doctoral and postdoctoral quotient of S be the total number of occurrences of D and PD in S as contiguous substrings. For example, if S = PPDDP, it contains two occurrences of D and one occurrence of PD as contiguous substrings, so the doctoral and postdoctoral quotient of S is 3.\n\nWe have a string T consisting of P, D, and ?.\n\nAmong the strings that can be obtained by replacing each ? in T with P or D, find one with the maximum possible doctoral and postdoctoral quotient.\n\nConstraints\n\n1 \\leq |T| \\leq 2 \\times 10^5\n\nT consists of P, D, and ?.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT\n\nOutput\n\nPrint one string with the maximum possible doctoral and postdoctoral quotient among the strings that can be obtained by replacing each ? in T with P or D.\nIf there are multiple such strings, you may print any of them.\n\nSample Input 1\n\nPD?D??P\n\nSample Output 1\n\nPDPDPDP\n\nThis string contains three occurrences of D and three occurrences of PD as contiguous substrings, so its doctoral and postdoctoral quotient is 6, which is the maximum doctoral and postdoctoral quotient of a string obtained by replacing each ? in T with P or D.\n\nSample Input 2\n\nP?P?\n\nSample Output 2\n\nPDPD", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 331, "cpu_time_ms": 17, "memory_kb": 3456}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s592324819", "group_id": "codeNet:p02665", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,i,j,asum,pmax,ans=0\n integer(int64), allocatable:: a(:)\n\n read*, n\n allocate(a(0:n))\n read*, a(:)\n asum = sum(a)\n pmax = 1\n i=0\n do while(pmax < asum)\n ans = ans + min(pmax, asum)\n if (a(i) > pmax) then\n print'(i0)', -1\n stop\n end if\n asum=asum-a(i)\n pmax=(pmax-a(i))*2\n i=i+1\n end do\n\n do j=i,n\n ans = ans + asum\n asum=asum-a(j)\n end do\n print'(i0)', ans\nend program main", "language": "Fortran", "metadata": {"date": 1598596715, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02665.html", "problem_id": "p02665", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02665/input.txt", "sample_output_relpath": "derived/input_output/data/p02665/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02665/Fortran/s592324819.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s592324819", "user_id": "u234636620"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,i,j,asum,pmax,ans=0\n integer(int64), allocatable:: a(:)\n\n read*, n\n allocate(a(0:n))\n read*, a(:)\n asum = sum(a)\n pmax = 1\n i=0\n do while(pmax < asum)\n ans = ans + min(pmax, asum)\n if (a(i) > pmax) then\n print'(i0)', -1\n stop\n end if\n asum=asum-a(i)\n pmax=(pmax-a(i))*2\n i=i+1\n end do\n\n do j=i,n\n ans = ans + asum\n asum=asum-a(j)\n end do\n print'(i0)', ans\nend program main", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \\ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.\n\nNotes\n\nA binary tree is a rooted tree such that each vertex has at most two direct children.\n\nA leaf in a binary tree is a vertex with zero children.\n\nThe depth of a vertex v in a binary tree is the distance from the tree's root to v. (The root has the depth of 0.)\n\nThe depth of a binary tree is the maximum depth of a vertex in the tree.\n\nConstraints\n\n0 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{8} (0 \\leq i \\leq N)\n\nA_N \\geq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_0 A_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n3\n0 1 1 2\n\nSample Output 1\n\n7\n\nBelow is the tree with the maximum possible number of vertices. It has seven vertices, so we should print 7.\n\nSample Input 2\n\n4\n0 0 1 0 2\n\nSample Output 2\n\n10\n\nSample Input 3\n\n2\n0 3 1\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n1\n1 1\n\nSample Output 4\n\n-1\n\nSample Input 5\n\n10\n0 0 1 1 2 3 5 8 13 21 34\n\nSample Output 5\n\n264", "sample_input": "3\n0 1 1 2\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02665", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \\ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.\n\nNotes\n\nA binary tree is a rooted tree such that each vertex has at most two direct children.\n\nA leaf in a binary tree is a vertex with zero children.\n\nThe depth of a vertex v in a binary tree is the distance from the tree's root to v. (The root has the depth of 0.)\n\nThe depth of a binary tree is the maximum depth of a vertex in the tree.\n\nConstraints\n\n0 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{8} (0 \\leq i \\leq N)\n\nA_N \\geq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_0 A_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n3\n0 1 1 2\n\nSample Output 1\n\n7\n\nBelow is the tree with the maximum possible number of vertices. It has seven vertices, so we should print 7.\n\nSample Input 2\n\n4\n0 0 1 0 2\n\nSample Output 2\n\n10\n\nSample Input 3\n\n2\n0 3 1\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n1\n1 1\n\nSample Output 4\n\n-1\n\nSample Input 5\n\n10\n0 0 1 1 2 3 5 8 13 21 34\n\nSample Output 5\n\n264", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 577, "cpu_time_ms": 39, "memory_kb": 3884}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s669205527", "group_id": "codeNet:p02665", "input_text": "program NOMURA2020C\n integer(8)::N,i\n integer(8),allocatable::A(:),k(:),l(:)\n read(*,*)N\n allocate(A(0:N),k(0:N),l(0:N))\n read(*,*)A\n if(A(0)==0) then\n k(0)=1_8\n else\n k(0)=0_8\n end if\n do i=1,N\n k(i)=k(i-1)*2_8-A(i)\n if((k(i)<=0 .and. ik(N)+A(N)) then\n write(*,*)'-1'\n stop\n end if\n do i=N-1_8,0_8,-1_8\n l(i)=l(i+1)+A(i)\n if(l(i)>k(i)+A(i)) l(i)=k(i)+A(i)\n if(l(i)0) then\n write(*,*)'-1'\n stop\n end if\n end do\n write(*,*) sum(l)\nend program NOMURA2020C", "language": "Fortran", "metadata": {"date": 1590893486, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02665.html", "problem_id": "p02665", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02665/input.txt", "sample_output_relpath": "derived/input_output/data/p02665/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02665/Fortran/s669205527.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s669205527", "user_id": "u359178469"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program NOMURA2020C\n integer(8)::N,i\n integer(8),allocatable::A(:),k(:),l(:)\n read(*,*)N\n allocate(A(0:N),k(0:N),l(0:N))\n read(*,*)A\n if(A(0)==0) then\n k(0)=1_8\n else\n k(0)=0_8\n end if\n do i=1,N\n k(i)=k(i-1)*2_8-A(i)\n if((k(i)<=0 .and. ik(N)+A(N)) then\n write(*,*)'-1'\n stop\n end if\n do i=N-1_8,0_8,-1_8\n l(i)=l(i+1)+A(i)\n if(l(i)>k(i)+A(i)) l(i)=k(i)+A(i)\n if(l(i)0) then\n write(*,*)'-1'\n stop\n end if\n end do\n write(*,*) sum(l)\nend program NOMURA2020C", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \\ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.\n\nNotes\n\nA binary tree is a rooted tree such that each vertex has at most two direct children.\n\nA leaf in a binary tree is a vertex with zero children.\n\nThe depth of a vertex v in a binary tree is the distance from the tree's root to v. (The root has the depth of 0.)\n\nThe depth of a binary tree is the maximum depth of a vertex in the tree.\n\nConstraints\n\n0 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{8} (0 \\leq i \\leq N)\n\nA_N \\geq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_0 A_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n3\n0 1 1 2\n\nSample Output 1\n\n7\n\nBelow is the tree with the maximum possible number of vertices. It has seven vertices, so we should print 7.\n\nSample Input 2\n\n4\n0 0 1 0 2\n\nSample Output 2\n\n10\n\nSample Input 3\n\n2\n0 3 1\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n1\n1 1\n\nSample Output 4\n\n-1\n\nSample Input 5\n\n10\n0 0 1 1 2 3 5 8 13 21 34\n\nSample Output 5\n\n264", "sample_input": "3\n0 1 1 2\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02665", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence of length N+1: A_0, A_1, A_2, \\ldots, A_N. Is there a binary tree of depth N such that, for each d = 0, 1, \\ldots, N, there are exactly A_d leaves at depth d? If such a tree exists, print the maximum possible number of vertices in such a tree; otherwise, print -1.\n\nNotes\n\nA binary tree is a rooted tree such that each vertex has at most two direct children.\n\nA leaf in a binary tree is a vertex with zero children.\n\nThe depth of a vertex v in a binary tree is the distance from the tree's root to v. (The root has the depth of 0.)\n\nThe depth of a binary tree is the maximum depth of a vertex in the tree.\n\nConstraints\n\n0 \\leq N \\leq 10^5\n\n0 \\leq A_i \\leq 10^{8} (0 \\leq i \\leq N)\n\nA_N \\geq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_0 A_1 A_2 \\cdots A_N\n\nOutput\n\nPrint the answer as an integer.\n\nSample Input 1\n\n3\n0 1 1 2\n\nSample Output 1\n\n7\n\nBelow is the tree with the maximum possible number of vertices. It has seven vertices, so we should print 7.\n\nSample Input 2\n\n4\n0 0 1 0 2\n\nSample Output 2\n\n10\n\nSample Input 3\n\n2\n0 3 1\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n1\n1 1\n\nSample Output 4\n\n-1\n\nSample Input 5\n\n10\n0 0 1 1 2 3 5 8 13 21 34\n\nSample Output 5\n\n264", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 653, "cpu_time_ms": 32, "memory_kb": 5196}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s483410531", "group_id": "codeNet:p02675", "input_text": "program therefore\n\n implicit none\n character::n*3\n integer::m\n\n read*,n\n m=len_trim(n)\n\n if(n(m:m)=='0'.or.n(m:m)=='1'.or.n(m:m)=='6'.or.n(m:m)=='8') then\n print*,'pon'\n else if(n(m:m)=='3') then\n print*,'bon'\n else\n print*,'hon'\n end if\n\nend program therefore\n ", "language": "Fortran", "metadata": {"date": 1589764144, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Fortran/s483410531.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s483410531", "user_id": "u882765852"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program therefore\n\n implicit none\n character::n*3\n integer::m\n\n read*,n\n m=len_trim(n)\n\n if(n(m:m)=='0'.or.n(m:m)=='1'.or.n(m:m)=='6'.or.n(m:m)=='8') then\n print*,'pon'\n else if(n(m:m)=='3') then\n print*,'bon'\n else\n print*,'hon'\n end if\n\nend program therefore\n ", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 265, "cpu_time_ms": 2, "memory_kb": 2876}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s783540042", "group_id": "codeNet:p02675", "input_text": "program therefore\n\n implicit none\n character::n\n integer::m\n\n read*,n\n m=len_trim(n)\n\n if(n(m:m)=='0'.or.n(m:m)=='1'.or.n(m:m)=='6'.or.n(m:m)=='8') then\n print*,'pon'\n else if(n(m:m)=='3') then\n print*,'bon'\n else\n print*,'hon'\n end if\n\nend program therefore\n ", "language": "Fortran", "metadata": {"date": 1589764032, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Fortran/s783540042.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s783540042", "user_id": "u882765852"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program therefore\n\n implicit none\n character::n\n integer::m\n\n read*,n\n m=len_trim(n)\n\n if(n(m:m)=='0'.or.n(m:m)=='1'.or.n(m:m)=='6'.or.n(m:m)=='8') then\n print*,'pon'\n else if(n(m:m)=='3') then\n print*,'bon'\n else\n print*,'hon'\n end if\n\nend program therefore\n ", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 263, "cpu_time_ms": 2, "memory_kb": 2852}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s110111112", "group_id": "codeNet:p02675", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n, ni\n\n read*, n\n ni = mod(n,10)\n\n if (ni==3) then\n print'(a)', 'bon'\n else if (ni==0 .or. ni==1 .or. ni==6 .or. ni==8) then\n print'(a)', 'pon'\n else\n print'(a)', 'hon'\n end if\nend program main", "language": "Fortran", "metadata": {"date": 1589763760, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02675.html", "problem_id": "p02675", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02675/input.txt", "sample_output_relpath": "derived/input_output/data/p02675/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02675/Fortran/s110111112.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s110111112", "user_id": "u234636620"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n, ni\n\n read*, n\n ni = mod(n,10)\n\n if (ni==3) then\n print'(a)', 'bon'\n else if (ni==0 .or. ni==1 .or. ni==6 .or. ni==8) then\n print'(a)', 'pon'\n else\n print'(a)', 'hon'\n end if\nend program main", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "sample_input": "16\n"}, "reference_outputs": ["pon\n"], "source_document_id": "p02675", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe cat Snuke wants to play a popular Japanese game called ÅtCoder, so Iroha has decided to teach him Japanese.\n\nWhen counting pencils in Japanese, the counter word \"本\" follows the number. The pronunciation of this word varies depending on the number. Specifically, the pronunciation of \"本\" in the phrase \"N 本\" for a positive integer N not exceeding 999 is as follows:\n\nhon when the digit in the one's place of N is 2, 4, 5, 7, or 9;\n\npon when the digit in the one's place of N is 0, 1, 6 or 8;\n\nbon when the digit in the one's place of N is 3.\n\nGiven N, print the pronunciation of \"本\" in the phrase \"N 本\".\n\nConstraints\n\nN is a positive integer not exceeding 999.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n16\n\nSample Output 1\n\npon\n\nThe digit in the one's place of 16 is 6, so the \"本\" in \"16 本\" is pronounced pon.\n\nSample Input 2\n\n2\n\nSample Output 2\n\nhon\n\nSample Input 3\n\n183\n\nSample Output 3\n\nbon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 321, "cpu_time_ms": 10, "memory_kb": 2924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s455855089", "group_id": "codeNet:p02676", "input_text": "program main\ncharacter S*100\ninteger K,K2,I\n\nread *,K\nread *,S\nI = K + 1\nK2 = len_trim(S)\nif( K < K2 ) then\n S(I:K2) = \"\"\n S(I:I) = \".\"\n S(I+1:I+1) = \".\"\n S(I+2:I+2) = \".\"\nend if\nprint '(A)', trim(S)\nend program main", "language": "Fortran", "metadata": {"date": 1590897577, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Fortran/s455855089.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s455855089", "user_id": "u416318434"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "program main\ncharacter S*100\ninteger K,K2,I\n\nread *,K\nread *,S\nI = K + 1\nK2 = len_trim(S)\nif( K < K2 ) then\n S(I:K2) = \"\"\n S(I:I) = \".\"\n S(I+1:I+1) = \".\"\n S(I+2:I+2) = \".\"\nend if\nprint '(A)', trim(S)\nend program main", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 220, "cpu_time_ms": 2, "memory_kb": 2868}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s303612308", "group_id": "codeNet:p02676", "input_text": "program main\ncharacter S*100\ninteger K,K2,I\n\nread *,K\nread *,S\nK2 = len_trim(S)\nI = K + 1\ndo\nS(I:I) = \".\"\nI = I + 1\n if (I > K2) then\n exit\n end if\nend do\nprint '(A)', trim(S)\nend program main", "language": "Fortran", "metadata": {"date": 1590896139, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Fortran/s303612308.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s303612308", "user_id": "u416318434"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "program main\ncharacter S*100\ninteger K,K2,I\n\nread *,K\nread *,S\nK2 = len_trim(S)\nI = K + 1\ndo\nS(I:I) = \".\"\nI = I + 1\n if (I > K2) then\n exit\n end if\nend do\nprint '(A)', trim(S)\nend program main", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 199, "cpu_time_ms": 3, "memory_kb": 2924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s473116259", "group_id": "codeNet:p02676", "input_text": "program main\ninteger :: k\ncharacter*100 ::s\n\nread(*,*)k\nread(*,*)s\nif (len_trim(s) <= k) then\nwrite(*,*) s\nelse\ndo i = (len_trim(s) - k),len_trim(s)\ns(i:i) = ''\nend do\nwrite(*,*)s//'...'\nend if\nend program", "language": "Fortran", "metadata": {"date": 1589764771, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02676.html", "problem_id": "p02676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02676/input.txt", "sample_output_relpath": "derived/input_output/data/p02676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02676/Fortran/s473116259.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s473116259", "user_id": "u850779832"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "program main\ninteger :: k\ncharacter*100 ::s\n\nread(*,*)k\nread(*,*)s\nif (len_trim(s) <= k) then\nwrite(*,*) s\nelse\ndo i = (len_trim(s) - k),len_trim(s)\ns(i:i) = ''\nend do\nwrite(*,*)s//'...'\nend if\nend program", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "sample_input": "7\nnikoandsolstice\n"}, "reference_outputs": ["nikoand...\n"], "source_document_id": "p02676", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have a string S consisting of lowercase English letters.\n\nIf the length of S is at most K, print S without change.\n\nIf the length of S exceeds K, extract the first K characters in S, append ... to the end of them, and print the result.\n\nConstraints\n\nK is an integer between 1 and 100 (inclusive).\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nS\n\nOutput\n\nPrint a string as stated in Problem Statement.\n\nSample Input 1\n\n7\nnikoandsolstice\n\nSample Output 1\n\nnikoand...\n\nnikoandsolstice has a length of 15, which exceeds K=7.\n\nWe should extract the first 7 characters in this string, append ... to the end of them, and print the result nikoand....\n\nSample Input 2\n\n40\nferelibenterhominesidquodvoluntcredunt\n\nSample Output 2\n\nferelibenterhominesidquodvoluntcredunt\n\nThe famous quote from Gaius Julius Caesar.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 205, "cpu_time_ms": 7, "memory_kb": 2812}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s843129270", "group_id": "codeNet:p02677", "input_text": "program main\n implicit none\n integer :: a, b, h, m\n real(16) :: a2, b2, rad, c\n\n read *, a, b, h, m\n\n a2 = real(a)\n b2 = real(b)\n rad = abs( 0.5*(real(h)*60+m) - 6*m )\n rad = 3.141592653589793238462643383279*rad / 180.0\n\n c = a2**2 + b2**2 - 2*a2*b2*cos(rad)\n\n print *, sqrt(c)\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1589765335, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02677.html", "problem_id": "p02677", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02677/input.txt", "sample_output_relpath": "derived/input_output/data/p02677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02677/Fortran/s843129270.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s843129270", "user_id": "u353721260"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "program main\n implicit none\n integer :: a, b, h, m\n real(16) :: a2, b2, rad, c\n\n read *, a, b, h, m\n\n a2 = real(a)\n b2 = real(b)\n rad = abs( 0.5*(real(h)*60+m) - 6*m )\n rad = 3.141592653589793238462643383279*rad / 180.0\n\n c = a2**2 + b2**2 - 2*a2*b2*cos(rad)\n\n print *, sqrt(c)\n\nend program main\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "sample_input": "3 4 9 0\n"}, "reference_outputs": ["5.00000000000000000000\n"], "source_document_id": "p02677", "source_text": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 346, "cpu_time_ms": 4, "memory_kb": 2980}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s177717126", "group_id": "codeNet:p02677", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n real(real64):: a,b,h,m\n real(real64)x1,y1,x2,y2\n real(real64),parameter:: pi=acos(-1d0)\n read*, a,b,h,m\n h=(h+m/60)/12*2*pi\n m=m/60d0*2*pi\n \n\n x1 = a*cos(h)\n y1 = a*sin(h)\n x2 = b*cos(m)\n y2 = b*sin(m)\n print*, sqrt((x1-x2)**2 + (y1-y2)**2)\nend program main", "language": "Fortran", "metadata": {"date": 1589764420, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02677.html", "problem_id": "p02677", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02677/input.txt", "sample_output_relpath": "derived/input_output/data/p02677/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02677/Fortran/s177717126.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s177717126", "user_id": "u234636620"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n real(real64):: a,b,h,m\n real(real64)x1,y1,x2,y2\n real(real64),parameter:: pi=acos(-1d0)\n read*, a,b,h,m\n h=(h+m/60)/12*2*pi\n m=m/60d0*2*pi\n \n\n x1 = a*cos(h)\n y1 = a*sin(h)\n x2 = b*cos(m)\n y2 = b*sin(m)\n print*, sqrt((x1-x2)**2 + (y1-y2)**2)\nend program main", "problem_context": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "sample_input": "3 4 9 0\n"}, "reference_outputs": ["5.00000000000000000000\n"], "source_document_id": "p02677", "source_text": "Score: 300 points\n\nProblem Statement\n\nConsider an analog clock whose hour and minute hands are A and B centimeters long, respectively.\n\nAn endpoint of the hour hand and an endpoint of the minute hand are fixed at the same point, around which each hand rotates clockwise at constant angular velocity. It takes the hour and minute hands 12 hours and 1 hour to make one full rotation, respectively.\n\nAt 0 o'clock, the two hands overlap each other. H hours and M minutes later, what is the distance in centimeters between the unfixed endpoints of the hands?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 1000\n\n0 \\leq H \\leq 11\n\n0 \\leq M \\leq 59\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B H M\n\nOutput\n\nPrint the answer without units. Your output will be accepted when its absolute or relative error from the correct value is at most 10^{-9}.\n\nSample Input 1\n\n3 4 9 0\n\nSample Output 1\n\n5.00000000000000000000\n\nThe two hands will be in the positions shown in the figure below, so the answer is 5 centimeters.\n\nSample Input 2\n\n3 4 10 40\n\nSample Output 2\n\n4.56425719433005567605\n\nThe two hands will be in the positions shown in the figure below. Note that each hand always rotates at constant angular velocity.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 362, "cpu_time_ms": 4, "memory_kb": 3240}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s543585149", "group_id": "codeNet:p02678", "input_text": " MODULE intQueueMod\n implicit none\n! Module for QUEUE : First in, First out\n! reference : プログラミングコンテスト攻略のための\n! アルゴリズムとデータ構造\n\n integer(16),parameter :: binSize = 10**6\n integer(16),parameter :: precision = 16\n \n type intQueue\n private\n integer(precision) :: bin( 1:binSize ) = 0\n integer(precision) :: head = 1, tail = 1\n !head : Where the head value is.\n !tail : Where the blank next to tail is.\n contains\n procedure,public,pass :: initialize => intInit\n procedure,public,pass :: isEmpty => intIsEmpty\n procedure,public,pass :: isFull => intIsFull\n procedure,public,pass :: enQueue => intEnQ\n procedure,public,pass :: deQueue => intDeQ\n end type\n \n contains\n!Reset queue. Not nessesary in first time.\n pure subroutine intInit( q )\n implicit none\n class(intQueue),intent(inout) :: q\n \n q%head = 1\n q%tail = 1\n end subroutine intInit\n \n!Check status\n pure function intIsEmpty( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==q%tail\n end function intIsEmpty\n \n \n pure function intIsFull( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==mod( q%tail+1,binSize )\n end function intIsFull\n\n!set x to tail\n subroutine intEnQ( q,x )\n implicit none\n class(intQueue) ,intent(inout) :: q\n integer(precision),intent(in ) :: x\n \n if( q%isFull() )then\n print*,'Queue is full,Error!';stop\n else\n q%bin(q%tail) = x\n if( q%tail==binSize )then\n q%tail = 1\n else\n q%tail = q%tail + 1\n end if\n end if\n end subroutine intEnQ\n \n!get x from head\n impure function intDeQ( q ) result( x )\n implicit none\n class(intQueue),intent(inout) :: q\n integer(precision) :: x\n \n if( q%isEmpty() )then\n print*,'Stack is empty, Error!';stop\n else\n x = q%bin(q%head)\n if( q%head==binSize )then\n q%head = 1\n else\n q%head = q%head + 1\n end if\n end if\n end function intDeQ\n END MODULE intQueueMod\n \n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n MODULE graphMod\n implicit none\n! 重みなしのグラフを扱うためのモジュール\n\n integer(16),parameter,private :: prec = 16\n \n type :: nodes\n integer(prec),allocatable :: next(:)\n integer(prec) :: degree = 0\n contains\n procedure,public,pass :: appendNode\n end type\n \n contains\n subroutine appendNode( node, nodeNumber )\n implicit none\n class(nodes),intent(inout) :: node\n integer(prec),intent(in) :: nodeNumber\n integer(prec),allocatable :: buffer(:)\n \n if(.not.(allocated(node%next)))then\n allocate(node%next(1))\n node%degree = 0\n end if\n \n if( node%degree==0 )then\n node%next(1) = nodeNumber\n node%degree = 1\n return\n end if\n \n node%degree = node%degree + 1\n buffer = node%next(1:node%degree-1)\n if( size(node%next)=1 )then\n print*,'No';stop\n end if\n \n print*,'Yes'\n do i = 2,2\n print*,flag(i)\n end do\n \n \n ! print*,n,m\n ! do i = 1,m\n ! print*,a(i),b(i)\n ! end do\n \n \n ! do i= 1,n\n ! print*,'room',i,room(i)%numNei\n ! print*,room(i)%nei\n ! end do\n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1589946255, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02678.html", "problem_id": "p02678", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02678/input.txt", "sample_output_relpath": "derived/input_output/data/p02678/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02678/Fortran/s543585149.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s543585149", "user_id": "u171356453"}, "prompt_components": {"gold_output": "Yes\n1\n2\n2\n", "input_to_evaluate": " MODULE intQueueMod\n implicit none\n! Module for QUEUE : First in, First out\n! reference : プログラミングコンテスト攻略のための\n! アルゴリズムとデータ構造\n\n integer(16),parameter :: binSize = 10**6\n integer(16),parameter :: precision = 16\n \n type intQueue\n private\n integer(precision) :: bin( 1:binSize ) = 0\n integer(precision) :: head = 1, tail = 1\n !head : Where the head value is.\n !tail : Where the blank next to tail is.\n contains\n procedure,public,pass :: initialize => intInit\n procedure,public,pass :: isEmpty => intIsEmpty\n procedure,public,pass :: isFull => intIsFull\n procedure,public,pass :: enQueue => intEnQ\n procedure,public,pass :: deQueue => intDeQ\n end type\n \n contains\n!Reset queue. Not nessesary in first time.\n pure subroutine intInit( q )\n implicit none\n class(intQueue),intent(inout) :: q\n \n q%head = 1\n q%tail = 1\n end subroutine intInit\n \n!Check status\n pure function intIsEmpty( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==q%tail\n end function intIsEmpty\n \n \n pure function intIsFull( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==mod( q%tail+1,binSize )\n end function intIsFull\n\n!set x to tail\n subroutine intEnQ( q,x )\n implicit none\n class(intQueue) ,intent(inout) :: q\n integer(precision),intent(in ) :: x\n \n if( q%isFull() )then\n print*,'Queue is full,Error!';stop\n else\n q%bin(q%tail) = x\n if( q%tail==binSize )then\n q%tail = 1\n else\n q%tail = q%tail + 1\n end if\n end if\n end subroutine intEnQ\n \n!get x from head\n impure function intDeQ( q ) result( x )\n implicit none\n class(intQueue),intent(inout) :: q\n integer(precision) :: x\n \n if( q%isEmpty() )then\n print*,'Stack is empty, Error!';stop\n else\n x = q%bin(q%head)\n if( q%head==binSize )then\n q%head = 1\n else\n q%head = q%head + 1\n end if\n end if\n end function intDeQ\n END MODULE intQueueMod\n \n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n MODULE graphMod\n implicit none\n! 重みなしのグラフを扱うためのモジュール\n\n integer(16),parameter,private :: prec = 16\n \n type :: nodes\n integer(prec),allocatable :: next(:)\n integer(prec) :: degree = 0\n contains\n procedure,public,pass :: appendNode\n end type\n \n contains\n subroutine appendNode( node, nodeNumber )\n implicit none\n class(nodes),intent(inout) :: node\n integer(prec),intent(in) :: nodeNumber\n integer(prec),allocatable :: buffer(:)\n \n if(.not.(allocated(node%next)))then\n allocate(node%next(1))\n node%degree = 0\n end if\n \n if( node%degree==0 )then\n node%next(1) = nodeNumber\n node%degree = 1\n return\n end if\n \n node%degree = node%degree + 1\n buffer = node%next(1:node%degree-1)\n if( size(node%next)=1 )then\n print*,'No';stop\n end if\n \n print*,'Yes'\n do i = 2,2\n print*,flag(i)\n end do\n \n \n ! print*,n,m\n ! do i = 1,m\n ! print*,a(i),b(i)\n ! end do\n \n \n ! do i= 1,n\n ! print*,'room',i,room(i)%numNei\n ! print*,room(i)%nei\n ! end do\n \n END PROGRAM", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "sample_input": "4 4\n1 2\n2 3\n3 4\n4 2\n"}, "reference_outputs": ["Yes\n1\n2\n2\n"], "source_document_id": "p02678", "source_text": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5674, "cpu_time_ms": 2206, "memory_kb": 29380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s406904838", "group_id": "codeNet:p02678", "input_text": " MODULE intQueueMod\n implicit none\n! Module for QUEUE : First in, First out\n! reference : プログラミングコンテスト攻略のための\n! アルゴリズムとデータ構造\n\n integer(16),parameter :: binSize = 10**6\n integer(16),parameter :: precision = 16\n \n type intQueue\n private\n integer(precision) :: bin( 1:binSize ) = 0\n integer(precision) :: head = 1, tail = 1\n !head : Where the head value is.\n !tail : Where the blank next to tail is.\n contains\n procedure,public,pass :: initialize => intInit\n procedure,public,pass :: isEmpty => intIsEmpty\n procedure,public,pass :: isFull => intIsFull\n procedure,public,pass :: enQueue => intEnQ\n procedure,public,pass :: deQueue => intDeQ\n end type\n \n contains\n!Reset queue. Not nessesary in first time.\n pure subroutine intInit( q )\n implicit none\n class(intQueue),intent(inout) :: q\n \n q%head = 1\n q%tail = 1\n end subroutine intInit\n \n!Check status\n pure function intIsEmpty( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==q%tail\n end function intIsEmpty\n \n \n pure function intIsFull( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==mod( q%tail+1,binSize )\n end function intIsFull\n\n!set x to tail\n subroutine intEnQ( q,x )\n implicit none\n class(intQueue) ,intent(inout) :: q\n integer(precision),intent(in ) :: x\n \n if( q%isFull() )then\n print*,'Queue is full,Error!';stop\n else\n q%bin(q%tail) = x\n if( q%tail==binSize )then\n q%tail = 1\n else\n q%tail = q%tail + 1\n end if\n end if\n end subroutine intEnQ\n \n!get x from head\n impure function intDeQ( q ) result( x )\n implicit none\n class(intQueue),intent(inout) :: q\n integer(precision) :: x\n \n if( q%isEmpty() )then\n print*,'Stack is empty, Error!';stop\n else\n x = q%bin(q%head)\n if( q%head==binSize )then\n q%head = 1\n else\n q%head = q%head + 1\n end if\n end if\n end function intDeQ\n END MODULE intQueueMod\n \n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n MODULE graphMod\n implicit none\n! 重みなしのグラフを扱うためのモジュール\n\n integer(16),parameter,private :: prec = 16\n \n type :: nodes\n integer(prec),allocatable :: next(:)\n integer(prec) :: degree = 0\n contains\n procedure,public,pass :: appendNode\n end type\n \n contains\n subroutine appendNode( node, nodeNumber )\n implicit none\n class(nodes),intent(inout) :: node\n integer(prec),intent(in) :: nodeNumber\n integer(prec),allocatable :: buffer(:)\n \n if(.not.(allocated(node%next)))then\n allocate(node%next(1))\n node%degree = 0\n end if\n \n if( node%degree==0 )then\n node%next(1) = nodeNumber\n node%degree = 1\n return\n end if\n \n node%degree = node%degree + 1\n buffer = node%next(1:node%degree-1)\n if( size(node%next)=1 )then\n print*,'No';stop\n end if\n \n print*,'Yes'\n do i = 2,n\n print*,flag(i)\n end do\n \n \n \n \n \n \n ! print*,n,m\n ! do i = 1,m\n ! print*,a(i),b(i)\n ! end do\n \n \n ! do i= 1,n\n ! print*,'room',i,room(i)%numNei\n ! print*,room(i)%nei\n ! end do\n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1589945601, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02678.html", "problem_id": "p02678", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02678/input.txt", "sample_output_relpath": "derived/input_output/data/p02678/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02678/Fortran/s406904838.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s406904838", "user_id": "u171356453"}, "prompt_components": {"gold_output": "Yes\n1\n2\n2\n", "input_to_evaluate": " MODULE intQueueMod\n implicit none\n! Module for QUEUE : First in, First out\n! reference : プログラミングコンテスト攻略のための\n! アルゴリズムとデータ構造\n\n integer(16),parameter :: binSize = 10**6\n integer(16),parameter :: precision = 16\n \n type intQueue\n private\n integer(precision) :: bin( 1:binSize ) = 0\n integer(precision) :: head = 1, tail = 1\n !head : Where the head value is.\n !tail : Where the blank next to tail is.\n contains\n procedure,public,pass :: initialize => intInit\n procedure,public,pass :: isEmpty => intIsEmpty\n procedure,public,pass :: isFull => intIsFull\n procedure,public,pass :: enQueue => intEnQ\n procedure,public,pass :: deQueue => intDeQ\n end type\n \n contains\n!Reset queue. Not nessesary in first time.\n pure subroutine intInit( q )\n implicit none\n class(intQueue),intent(inout) :: q\n \n q%head = 1\n q%tail = 1\n end subroutine intInit\n \n!Check status\n pure function intIsEmpty( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==q%tail\n end function intIsEmpty\n \n \n pure function intIsFull( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==mod( q%tail+1,binSize )\n end function intIsFull\n\n!set x to tail\n subroutine intEnQ( q,x )\n implicit none\n class(intQueue) ,intent(inout) :: q\n integer(precision),intent(in ) :: x\n \n if( q%isFull() )then\n print*,'Queue is full,Error!';stop\n else\n q%bin(q%tail) = x\n if( q%tail==binSize )then\n q%tail = 1\n else\n q%tail = q%tail + 1\n end if\n end if\n end subroutine intEnQ\n \n!get x from head\n impure function intDeQ( q ) result( x )\n implicit none\n class(intQueue),intent(inout) :: q\n integer(precision) :: x\n \n if( q%isEmpty() )then\n print*,'Stack is empty, Error!';stop\n else\n x = q%bin(q%head)\n if( q%head==binSize )then\n q%head = 1\n else\n q%head = q%head + 1\n end if\n end if\n end function intDeQ\n END MODULE intQueueMod\n \n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n MODULE graphMod\n implicit none\n! 重みなしのグラフを扱うためのモジュール\n\n integer(16),parameter,private :: prec = 16\n \n type :: nodes\n integer(prec),allocatable :: next(:)\n integer(prec) :: degree = 0\n contains\n procedure,public,pass :: appendNode\n end type\n \n contains\n subroutine appendNode( node, nodeNumber )\n implicit none\n class(nodes),intent(inout) :: node\n integer(prec),intent(in) :: nodeNumber\n integer(prec),allocatable :: buffer(:)\n \n if(.not.(allocated(node%next)))then\n allocate(node%next(1))\n node%degree = 0\n end if\n \n if( node%degree==0 )then\n node%next(1) = nodeNumber\n node%degree = 1\n return\n end if\n \n node%degree = node%degree + 1\n buffer = node%next(1:node%degree-1)\n if( size(node%next)=1 )then\n print*,'No';stop\n end if\n \n print*,'Yes'\n do i = 2,n\n print*,flag(i)\n end do\n \n \n \n \n \n \n ! print*,n,m\n ! do i = 1,m\n ! print*,a(i),b(i)\n ! end do\n \n \n ! do i= 1,n\n ! print*,'room',i,room(i)%numNei\n ! print*,room(i)%nei\n ! end do\n \n END PROGRAM", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "sample_input": "4 4\n1 2\n2 3\n3 4\n4 2\n"}, "reference_outputs": ["Yes\n1\n2\n2\n"], "source_document_id": "p02678", "source_text": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6576, "cpu_time_ms": 2206, "memory_kb": 29516}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s565816854", "group_id": "codeNet:p02678", "input_text": " MODULE intQueueMod\n implicit none\n! Module for QUEUE : First in, First out\n! reference : プログラミングコンテスト攻略のための\n! アルゴリズムとデータ構造\n\n integer(16),parameter :: binSize = 10**6\n integer(16),parameter :: precision = 16\n \n type intQueue\n private\n integer(precision) :: bin( 1:binSize ) = 0\n integer(precision) :: head = 1, tail = 1\n !head : Where the head value is.\n !tail : Where the blank next to tail is.\n contains\n procedure,public,pass :: initialize => intInit\n procedure,public,pass :: isEmpty => intIsEmpty\n procedure,public,pass :: isFull => intIsFull\n procedure,public,pass :: enQueue => intEnQ\n procedure,public,pass :: deQueue => intDeQ\n end type\n \n contains\n!Reset queue. Not nessesary in first time.\n pure subroutine intInit( q )\n implicit none\n class(intQueue),intent(inout) :: q\n \n q%head = 1\n q%tail = 1\n end subroutine intInit\n \n!Check status\n pure function intIsEmpty( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==q%tail\n end function intIsEmpty\n \n \n pure function intIsFull( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==mod( q%tail+1,binSize )\n end function intIsFull\n\n!set x to tail\n subroutine intEnQ( q,x )\n implicit none\n class(intQueue) ,intent(inout) :: q\n integer(precision),intent(in ) :: x\n \n if( q%isFull() )then\n print*,'Queue is full,Error!';stop\n else\n q%bin(q%tail) = x\n if( q%tail==binSize )then\n q%tail = 1\n else\n q%tail = q%tail + 1\n end if\n end if\n end subroutine intEnQ\n \n!get x from head\n impure function intDeQ( q ) result( x )\n implicit none\n class(intQueue),intent(inout) :: q\n integer(precision) :: x\n \n if( q%isEmpty() )then\n print*,'Stack is empty, Error!';stop\n else\n x = q%bin(q%head)\n if( q%head==binSize )then\n q%head = 1\n else\n q%head = q%head + 1\n end if\n end if\n end function intDeQ\n END MODULE intQueueMod\n \n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n module piyoMod\n use intQueueMod\n \n type rooms\n integer(16),allocatable :: nei(:)\n integer(16) :: numNei=0\n end type\n \n integer(16),allocatable :: flag(:)\n type(intQueue) :: nextQ,beforeQ\n \n contains\n subroutine solve( rIn,roomNum,before )\n implicit none\n type(rooms),intent(in),allocatable :: rIn(:)\n integer(16),intent(in) :: roomNum,before\n integer(16) :: i\n \n if( flag(roomNum)/=-1 ) return\n flag( roomNum ) = before\n if( rIn(roomNum)%numNei==0 ) return\n \n do i = 1,rIn(roomNum)%numNei\n call nextQ%enQueue( rIn(roomNum)%nei(i) )\n call beforeQ%enQueue( roomNum )\n end do\n \n end subroutine\n end module\n \n PROGRAM doubleDots\n use piyoMod\n IMPLICIT NONE\n integer(16) :: n,m,numNei\n integer(16),allocatable :: a(:),b(:)\n type(rooms),allocatable :: room(:)\n integer(16) :: i\n integer(16),allocatable :: buffer(:)\n \n read*,n,m\n allocate( a(m),b(m),room(n),flag(n) )\n flag(1:n) = -1\n do i = 1,m\n read*,a(i),b(i)\n end do\n \n do i = 1,m\n room(a(i))%numNei = room(a(i))%numNei + 1\n numNei = room(a(i))%numNei\n allocate( buffer(numNei) )\n buffer(1:numNei-1) = room(a(i))%nei\n if(allocated(room(a(i))%nei) )deallocate( room(a(i))%nei )\n buffer(numNei) = b(i)\n room(a(i))%nei = buffer(1:numNei)\n deallocate( buffer )\n \n room(b(i))%numNei = room(b(i))%numNei + 1\n numNei = room(b(i))%numNei\n allocate( buffer(numNei) )\n buffer(1:numNei-1) = room(b(i))%nei\n if(allocated(room(b(i))%nei) )deallocate( room(b(i))%nei )\n buffer(numNei) = a(i)\n room(b(i))%nei = buffer(1:numNei)\n deallocate( buffer )\n end do\n \n \n call nextQ%enQueue(1_16)\n call beforeQ%enQueue(0_16) !dummy\n do while( .true. )\n if( nextQ%isEmpty() ) exit\n \n ! call solve( room,nextQ%deQueue(),beforeQ%deQueue() )\n end do\n \n \n \n \n if( count(flag(2:n)==-1) >=1 )then\n print*,'No';stop\n end if\n \n print*,'Yes'\n do i = 2,n\n print*,flag(i)\n end do\n \n \n \n \n \n \n ! print*,n,m\n ! do i = 1,m\n ! print*,a(i),b(i)\n ! end do\n \n \n ! do i= 1,n\n ! print*,'room',i,room(i)%numNei\n ! print*,room(i)%nei\n ! end do\n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1589926012, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02678.html", "problem_id": "p02678", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02678/input.txt", "sample_output_relpath": "derived/input_output/data/p02678/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02678/Fortran/s565816854.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s565816854", "user_id": "u171356453"}, "prompt_components": {"gold_output": "Yes\n1\n2\n2\n", "input_to_evaluate": " MODULE intQueueMod\n implicit none\n! Module for QUEUE : First in, First out\n! reference : プログラミングコンテスト攻略のための\n! アルゴリズムとデータ構造\n\n integer(16),parameter :: binSize = 10**6\n integer(16),parameter :: precision = 16\n \n type intQueue\n private\n integer(precision) :: bin( 1:binSize ) = 0\n integer(precision) :: head = 1, tail = 1\n !head : Where the head value is.\n !tail : Where the blank next to tail is.\n contains\n procedure,public,pass :: initialize => intInit\n procedure,public,pass :: isEmpty => intIsEmpty\n procedure,public,pass :: isFull => intIsFull\n procedure,public,pass :: enQueue => intEnQ\n procedure,public,pass :: deQueue => intDeQ\n end type\n \n contains\n!Reset queue. Not nessesary in first time.\n pure subroutine intInit( q )\n implicit none\n class(intQueue),intent(inout) :: q\n \n q%head = 1\n q%tail = 1\n end subroutine intInit\n \n!Check status\n pure function intIsEmpty( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==q%tail\n end function intIsEmpty\n \n \n pure function intIsFull( q ) result( ans )\n implicit none\n class(intQueue),intent(in) :: q\n logical :: ans\n \n ans = q%head==mod( q%tail+1,binSize )\n end function intIsFull\n\n!set x to tail\n subroutine intEnQ( q,x )\n implicit none\n class(intQueue) ,intent(inout) :: q\n integer(precision),intent(in ) :: x\n \n if( q%isFull() )then\n print*,'Queue is full,Error!';stop\n else\n q%bin(q%tail) = x\n if( q%tail==binSize )then\n q%tail = 1\n else\n q%tail = q%tail + 1\n end if\n end if\n end subroutine intEnQ\n \n!get x from head\n impure function intDeQ( q ) result( x )\n implicit none\n class(intQueue),intent(inout) :: q\n integer(precision) :: x\n \n if( q%isEmpty() )then\n print*,'Stack is empty, Error!';stop\n else\n x = q%bin(q%head)\n if( q%head==binSize )then\n q%head = 1\n else\n q%head = q%head + 1\n end if\n end if\n end function intDeQ\n END MODULE intQueueMod\n \n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n module piyoMod\n use intQueueMod\n \n type rooms\n integer(16),allocatable :: nei(:)\n integer(16) :: numNei=0\n end type\n \n integer(16),allocatable :: flag(:)\n type(intQueue) :: nextQ,beforeQ\n \n contains\n subroutine solve( rIn,roomNum,before )\n implicit none\n type(rooms),intent(in),allocatable :: rIn(:)\n integer(16),intent(in) :: roomNum,before\n integer(16) :: i\n \n if( flag(roomNum)/=-1 ) return\n flag( roomNum ) = before\n if( rIn(roomNum)%numNei==0 ) return\n \n do i = 1,rIn(roomNum)%numNei\n call nextQ%enQueue( rIn(roomNum)%nei(i) )\n call beforeQ%enQueue( roomNum )\n end do\n \n end subroutine\n end module\n \n PROGRAM doubleDots\n use piyoMod\n IMPLICIT NONE\n integer(16) :: n,m,numNei\n integer(16),allocatable :: a(:),b(:)\n type(rooms),allocatable :: room(:)\n integer(16) :: i\n integer(16),allocatable :: buffer(:)\n \n read*,n,m\n allocate( a(m),b(m),room(n),flag(n) )\n flag(1:n) = -1\n do i = 1,m\n read*,a(i),b(i)\n end do\n \n do i = 1,m\n room(a(i))%numNei = room(a(i))%numNei + 1\n numNei = room(a(i))%numNei\n allocate( buffer(numNei) )\n buffer(1:numNei-1) = room(a(i))%nei\n if(allocated(room(a(i))%nei) )deallocate( room(a(i))%nei )\n buffer(numNei) = b(i)\n room(a(i))%nei = buffer(1:numNei)\n deallocate( buffer )\n \n room(b(i))%numNei = room(b(i))%numNei + 1\n numNei = room(b(i))%numNei\n allocate( buffer(numNei) )\n buffer(1:numNei-1) = room(b(i))%nei\n if(allocated(room(b(i))%nei) )deallocate( room(b(i))%nei )\n buffer(numNei) = a(i)\n room(b(i))%nei = buffer(1:numNei)\n deallocate( buffer )\n end do\n \n \n call nextQ%enQueue(1_16)\n call beforeQ%enQueue(0_16) !dummy\n do while( .true. )\n if( nextQ%isEmpty() ) exit\n \n ! call solve( room,nextQ%deQueue(),beforeQ%deQueue() )\n end do\n \n \n \n \n if( count(flag(2:n)==-1) >=1 )then\n print*,'No';stop\n end if\n \n print*,'Yes'\n do i = 2,n\n print*,flag(i)\n end do\n \n \n \n \n \n \n ! print*,n,m\n ! do i = 1,m\n ! print*,a(i),b(i)\n ! end do\n \n \n ! do i= 1,n\n ! print*,'room',i,room(i)%numNei\n ! print*,room(i)%nei\n ! end do\n \n END PROGRAM", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "sample_input": "4 4\n1 2\n2 3\n3 4\n4 2\n"}, "reference_outputs": ["Yes\n1\n2\n2\n"], "source_document_id": "p02678", "source_text": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5113, "cpu_time_ms": 2206, "memory_kb": 36416}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s037648439", "group_id": "codeNet:p02678", "input_text": "program main\n\timplicit none\n\tinteger(8):: N,i,j,t,B,K\n\tinteger,dimension(1:2*10**5)::B1,A \t\n\tread *, N, K \n read(*,*) (A(i), i = 1, K),(B1(i), i = 1, K)\n\tdo i=1,K\n\t\tif(A(i)==1)then\n\t\tprint '(a)',\"Yes\"\n\t\tprint '(i0)',A(i)\n\t\tstop\n\t end if\n\t if(B1(i)==1)then\n\t\tprint '(a)',\"Yes\"\n\t\tprint '(i0)',B1(i)\n\t\tstop\n\t end if\n\t \n\tend do\n\tprint'(a)',\"No\"\t\t\nend program main", "language": "Fortran", "metadata": {"date": 1589767945, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02678.html", "problem_id": "p02678", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02678/input.txt", "sample_output_relpath": "derived/input_output/data/p02678/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02678/Fortran/s037648439.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s037648439", "user_id": "u970637660"}, "prompt_components": {"gold_output": "Yes\n1\n2\n2\n", "input_to_evaluate": "program main\n\timplicit none\n\tinteger(8):: N,i,j,t,B,K\n\tinteger,dimension(1:2*10**5)::B1,A \t\n\tread *, N, K \n read(*,*) (A(i), i = 1, K),(B1(i), i = 1, K)\n\tdo i=1,K\n\t\tif(A(i)==1)then\n\t\tprint '(a)',\"Yes\"\n\t\tprint '(i0)',A(i)\n\t\tstop\n\t end if\n\t if(B1(i)==1)then\n\t\tprint '(a)',\"Yes\"\n\t\tprint '(i0)',B1(i)\n\t\tstop\n\t end if\n\t \n\tend do\n\tprint'(a)',\"No\"\t\t\nend program main", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "sample_input": "4 4\n1 2\n2 3\n3 4\n4 2\n"}, "reference_outputs": ["Yes\n1\n2\n2\n"], "source_document_id": "p02678", "source_text": "Score: 400 points\n\nProblem Statement\n\nThere is a cave.\n\nThe cave has N rooms and M passages. The rooms are numbered 1 to N, and the passages are numbered 1 to M. Passage i connects Room A_i and Room B_i bidirectionally. One can travel between any two rooms by traversing passages. Room 1 is a special room with an entrance from the outside.\n\nIt is dark in the cave, so we have decided to place a signpost in each room except Room 1. The signpost in each room will point to one of the rooms directly connected to that room with a passage.\n\nSince it is dangerous in the cave, our objective is to satisfy the condition below for each room except Room 1.\n\nIf you start in that room and repeatedly move to the room indicated by the signpost in the room you are in, you will reach Room 1 after traversing the minimum number of passages possible.\n\nDetermine whether there is a way to place signposts satisfying our objective, and print one such way if it exists.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq N\\ (1 \\leq i \\leq M)\n\nA_i \\neq B_i\\ (1 \\leq i \\leq M)\n\nOne can travel between any two rooms by traversing passages.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_M B_M\n\nOutput\n\nIf there is no way to place signposts satisfying the objective, print No.\n\nOtherwise, print N lines. The first line should contain Yes, and the i-th line (2 \\leq i \\leq N) should contain the integer representing the room indicated by the signpost in Room i.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 2\n\nSample Output 1\n\nYes\n1\n2\n2\n\nIf we place the signposts as described in the sample output, the following happens:\n\nStarting in Room 2, you will reach Room 1 after traversing one passage: (2) \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 3, you will reach Room 1 after traversing two passages: (3) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nStarting in Room 4, you will reach Room 1 after traversing two passages: (4) \\to 2 \\to 1. This is the minimum number of passages possible.\n\nThus, the objective is satisfied.\n\nSample Input 2\n\n6 9\n3 4\n6 1\n2 4\n5 3\n4 6\n1 5\n6 2\n4 5\n5 6\n\nSample Output 2\n\nYes\n6\n5\n5\n1\n1\n\nIf there are multiple solutions, any of them will be accepted.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 377, "cpu_time_ms": 75, "memory_kb": 4500}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s065589437", "group_id": "codeNet:p02681", "input_text": "program main\n\timplicit none\n character(11)::s,t\n integer::i,lenn\n read(*,*)s\n read(*,*)t\n lenn=len_trim(s)\n do i=1,lenn\n \tif(s(i:i)==t(i:i))then\n \tcycle\n else\n \twrite(*,*)'No'\n stop\n end if\n end do\n write(*,*)'Yes'\n stop\nend program main\n \n", "language": "Fortran", "metadata": {"date": 1592636034, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02681.html", "problem_id": "p02681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02681/input.txt", "sample_output_relpath": "derived/input_output/data/p02681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02681/Fortran/s065589437.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s065589437", "user_id": "u884601206"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n\timplicit none\n character(11)::s,t\n integer::i,lenn\n read(*,*)s\n read(*,*)t\n lenn=len_trim(s)\n do i=1,lenn\n \tif(s(i:i)==t(i:i))then\n \tcycle\n else\n \twrite(*,*)'No'\n stop\n end if\n end do\n write(*,*)'Yes'\n stop\nend program main\n \n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "sample_input": "chokudai\nchokudaiz\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02681", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to be a member of some web service.\n\nHe tried to register himself with the ID S, which turned out to be already used by another user.\n\nThus, he decides to register using a string obtained by appending one character at the end of S as his ID.\n\nHe is now trying to register with the ID T. Determine whether this string satisfies the property above.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\n1 \\leq |S| \\leq 10\n\n|T| = |S| + 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf T satisfies the property in Problem Statement, print Yes; otherwise, print No.\n\nSample Input 1\n\nchokudai\nchokudaiz\n\nSample Output 1\n\nYes\n\nchokudaiz can be obtained by appending z at the end of chokudai.\n\nSample Input 2\n\nsnuke\nsnekee\n\nSample Output 2\n\nNo\n\nsnekee cannot be obtained by appending one character at the end of snuke.\n\nSample Input 3\n\na\naa\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 312, "cpu_time_ms": 6, "memory_kb": 2808}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s294130735", "group_id": "codeNet:p02682", "input_text": "program main\n implicit none\n integer(8) :: a, b, c, k, filled, fill, res\n read *, a, b, c, k\n\n fill = min(a, k)\n res = fill\n filled = fill\n\n fill = min(b, k - filled)\n filled = filled + fill\n\n fill = min(c, k - filled)\n res = res - fill\n filled = filled + fill\n\n print \"(i0)\", res\nend program main\n", "language": "Fortran", "metadata": {"date": 1600917181, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02682.html", "problem_id": "p02682", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02682/input.txt", "sample_output_relpath": "derived/input_output/data/p02682/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02682/Fortran/s294130735.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s294130735", "user_id": "u388927326"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: a, b, c, k, filled, fill, res\n read *, a, b, c, k\n\n fill = min(a, k)\n res = fill\n filled = fill\n\n fill = min(b, k - filled)\n filled = filled + fill\n\n fill = min(c, k - filled)\n res = res - fill\n filled = filled + fill\n\n print \"(i0)\", res\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "sample_input": "2 1 1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02682", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 310, "cpu_time_ms": 12, "memory_kb": 2924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s573802938", "group_id": "codeNet:p02682", "input_text": "program main\n\timplicit none\n integer a, b, c, k, i\n read(*,*)a, b, c, k\n if (a>=k) then\n \twrite(*,*)a\n else\n \ti = a-(k-a-b)\n write(*,*)i\n\tend if\nend program main", "language": "Fortran", "metadata": {"date": 1590897461, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02682.html", "problem_id": "p02682", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02682/input.txt", "sample_output_relpath": "derived/input_output/data/p02682/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02682/Fortran/s573802938.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s573802938", "user_id": "u552145906"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n\timplicit none\n integer a, b, c, k, i\n read(*,*)a, b, c, k\n if (a>=k) then\n \twrite(*,*)a\n else\n \ti = a-(k-a-b)\n write(*,*)i\n\tend if\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "sample_input": "2 1 1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02682", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 186, "cpu_time_ms": 6, "memory_kb": 2848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s334908790", "group_id": "codeNet:p02682", "input_text": "program test\n\timplicit none\n\tinteger :: a=0,b=0,c=0,k=0,ans=0\n read *,a,b,c,k\n if(k<=a) then\n \twrite (*,'(i0)') k\n else\n \tans=a-(k-a-b)\n \twrite (*,'(i0)') ans\n end if\nend program test", "language": "Fortran", "metadata": {"date": 1589201204, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02682.html", "problem_id": "p02682", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02682/input.txt", "sample_output_relpath": "derived/input_output/data/p02682/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02682/Fortran/s334908790.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s334908790", "user_id": "u469867719"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program test\n\timplicit none\n\tinteger :: a=0,b=0,c=0,k=0,ans=0\n read *,a,b,c,k\n if(k<=a) then\n \twrite (*,'(i0)') k\n else\n \tans=a-(k-a-b)\n \twrite (*,'(i0)') ans\n end if\nend program test", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "sample_input": "2 1 1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02682", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 204, "cpu_time_ms": 7, "memory_kb": 2920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s379538198", "group_id": "codeNet:p02682", "input_text": "program main\n integer(8) :: A,B,C,K\n integer(8) :: i,j\n read(*,*) A,B,C,K\n if ( K-A > 0) then\n if (K-A-B > 0 ) then\n write(*,'(i0)') A-(K-A-B)\n else\n write(*,'(i0)') A\n end if\n else \n write(*,'(i0)') K\n end if\nend program main\n", "language": "Fortran", "metadata": {"date": 1589159202, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02682.html", "problem_id": "p02682", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02682/input.txt", "sample_output_relpath": "derived/input_output/data/p02682/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02682/Fortran/s379538198.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s379538198", "user_id": "u886432251"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n integer(8) :: A,B,C,K\n integer(8) :: i,j\n read(*,*) A,B,C,K\n if ( K-A > 0) then\n if (K-A-B > 0 ) then\n write(*,'(i0)') A-(K-A-B)\n else\n write(*,'(i0)') A\n end if\n else \n write(*,'(i0)') K\n end if\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "sample_input": "2 1 1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02682", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have A cards, each of which has an integer 1 written on it. Similarly, we also have B cards with 0s and C cards with -1s.\n\nWe will pick up K among these cards. What is the maximum possible sum of the numbers written on the cards chosen?\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, B, C\n\n1 \\leq K \\leq A + B + C \\leq 2 \\times 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the maximum possible sum of the numbers written on the cards chosen.\n\nSample Input 1\n\n2 1 1 3\n\nSample Output 1\n\n2\n\nConsider picking up two cards with 1s and one card with a 0.\nIn this case, the sum of the numbers written on the cards is 2, which is the maximum possible value.\n\nSample Input 2\n\n1 2 3 4\n\nSample Output 2\n\n0\n\nSample Input 3\n\n2000000000 0 0 2000000000\n\nSample Output 3\n\n2000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 264, "cpu_time_ms": 3, "memory_kb": 2924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s772244963", "group_id": "codeNet:p02683", "input_text": "program main\n integer :: N, M\n integer :: X\n integer,allocatable :: C(:), A(:, :)\n integer :: i,j\n integer :: out,tmp\n logical,allocatable :: switch(:)\n integer,allocatable :: test(:)\n \n read(*,*) N, M, X\n allocate(C(N))\n allocate(A(N, M))\n allocate(switch(N))\n allocate(test(M))\n do i = 1, N\n read(*,*) C(i), A(i, :)\n end do\n if (all(sum(A(:,:), dim = 1) >= X)) then\n out = sum(C)\n do i=0,2**n-1\n do j=1,n\n switch(j) = btest(i,j-1)\n end do\n do j = 1,M\n test(j) = sum(A(:,j), mask=switch)\n end do\n if ( all(test >= X) ) then\n tmp = sum(C(:), mask=switch)\n if (tmp < out) then\n out = tmp\n end if\n end if\n end do\n write(*,'(i0)') out\n else\n write(*,'(i0)') -1\n end if\ncontains\n\n \nend program main\n", "language": "Fortran", "metadata": {"date": 1589163074, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02683.html", "problem_id": "p02683", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02683/input.txt", "sample_output_relpath": "derived/input_output/data/p02683/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02683/Fortran/s772244963.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s772244963", "user_id": "u886432251"}, "prompt_components": {"gold_output": "120\n", "input_to_evaluate": "program main\n integer :: N, M\n integer :: X\n integer,allocatable :: C(:), A(:, :)\n integer :: i,j\n integer :: out,tmp\n logical,allocatable :: switch(:)\n integer,allocatable :: test(:)\n \n read(*,*) N, M, X\n allocate(C(N))\n allocate(A(N, M))\n allocate(switch(N))\n allocate(test(M))\n do i = 1, N\n read(*,*) C(i), A(i, :)\n end do\n if (all(sum(A(:,:), dim = 1) >= X)) then\n out = sum(C)\n do i=0,2**n-1\n do j=1,n\n switch(j) = btest(i,j-1)\n end do\n do j = 1,M\n test(j) = sum(A(:,j), mask=switch)\n end do\n if ( all(test >= X) ) then\n tmp = sum(C(:), mask=switch)\n if (tmp < out) then\n out = tmp\n end if\n end if\n end do\n write(*,'(i0)') out\n else\n write(*,'(i0)') -1\n end if\ncontains\n\n \nend program main\n", "problem_context": "Score : 300 points\n\nProblem\n\nTakahashi, who is a novice in competitive programming, wants to learn M algorithms.\nInitially, his understanding level of each of the M algorithms is 0.\n\nTakahashi is visiting a bookstore, where he finds N books on algorithms.\nThe i-th book (1\\leq i\\leq N) is sold for C_i yen (the currency of Japan). If he buys and reads it, his understanding level of the j-th algorithm will increase by A_{i,j} for each j (1\\leq j\\leq M).\nThere is no other way to increase the understanding levels of the algorithms.\n\nTakahashi's objective is to make his understanding levels of all the M algorithms X or higher. Determine whether this objective is achievable. If it is achievable, find the minimum amount of money needed to achieve it.\n\nConstraints\n\nAll values in input are integers.\n\n1\\leq N, M\\leq 12\n\n1\\leq X\\leq 10^5\n\n1\\leq C_i \\leq 10^5\n\n0\\leq A_{i, j} \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nC_1 A_{1,1} A_{1,2} \\cdots A_{1,M}\nC_2 A_{2,1} A_{2,2} \\cdots A_{2,M}\n\\vdots\nC_N A_{N,1} A_{N,2} \\cdots A_{N,M}\n\nOutput\n\nIf the objective is not achievable, print -1; otherwise, print the minimum amount of money needed to achieve it.\n\nSample Input 1\n\n3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n\nSample Output 1\n\n120\n\nBuying the second and third books makes his understanding levels of all the algorithms 10 or higher, at the minimum cost possible.\n\nSample Input 2\n\n3 3 10\n100 3 1 4\n100 1 5 9\n100 2 6 5\n\nSample Output 2\n\n-1\n\nBuying all the books is still not enough to make his understanding levels of all the algorithms 10 or higher.\n\nSample Input 3\n\n8 5 22\n100 3 7 5 3 1\n164 4 5 2 7 8\n334 7 2 7 2 9\n234 4 7 2 8 2\n541 5 4 3 3 6\n235 4 8 6 9 7\n394 3 6 1 6 2\n872 8 4 3 7 2\n\nSample Output 3\n\n1067", "sample_input": "3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n"}, "reference_outputs": ["120\n"], "source_document_id": "p02683", "source_text": "Score : 300 points\n\nProblem\n\nTakahashi, who is a novice in competitive programming, wants to learn M algorithms.\nInitially, his understanding level of each of the M algorithms is 0.\n\nTakahashi is visiting a bookstore, where he finds N books on algorithms.\nThe i-th book (1\\leq i\\leq N) is sold for C_i yen (the currency of Japan). If he buys and reads it, his understanding level of the j-th algorithm will increase by A_{i,j} for each j (1\\leq j\\leq M).\nThere is no other way to increase the understanding levels of the algorithms.\n\nTakahashi's objective is to make his understanding levels of all the M algorithms X or higher. Determine whether this objective is achievable. If it is achievable, find the minimum amount of money needed to achieve it.\n\nConstraints\n\nAll values in input are integers.\n\n1\\leq N, M\\leq 12\n\n1\\leq X\\leq 10^5\n\n1\\leq C_i \\leq 10^5\n\n0\\leq A_{i, j} \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nC_1 A_{1,1} A_{1,2} \\cdots A_{1,M}\nC_2 A_{2,1} A_{2,2} \\cdots A_{2,M}\n\\vdots\nC_N A_{N,1} A_{N,2} \\cdots A_{N,M}\n\nOutput\n\nIf the objective is not achievable, print -1; otherwise, print the minimum amount of money needed to achieve it.\n\nSample Input 1\n\n3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n\nSample Output 1\n\n120\n\nBuying the second and third books makes his understanding levels of all the algorithms 10 or higher, at the minimum cost possible.\n\nSample Input 2\n\n3 3 10\n100 3 1 4\n100 1 5 9\n100 2 6 5\n\nSample Output 2\n\n-1\n\nBuying all the books is still not enough to make his understanding levels of all the algorithms 10 or higher.\n\nSample Input 3\n\n8 5 22\n100 3 7 5 3 1\n164 4 5 2 7 8\n334 7 2 7 2 9\n234 4 7 2 8 2\n541 5 4 3 3 6\n235 4 8 6 9 7\n394 3 6 1 6 2\n872 8 4 3 7 2\n\nSample Output 3\n\n1067", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 844, "cpu_time_ms": 4, "memory_kb": 2864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s674686931", "group_id": "codeNet:p02683", "input_text": "program cm\n implicit none\n integer::N,M,X\n integer,allocatable,dimension(:)::C\n integer,allocatable,dimension(:,:)::A\n integer,allocatable,dimension(:)::R\n integer::ans=10**9\n\n integer::i\n read*,N,M,X\n allocate(C(N),A(N,M))\n do i=1,N\n read*,C(i),A(i,:)\n end do\n\n allocate(R(M))\n do i=0,2**N-1\n call Rcheck(i)\n if(minval(R)>=X)then\n ans=min(ans,calc(i))\n endif\n end do\n print\"(i0)\",merge(-1,ans,ans==10**9)\n\ncontains\nsubroutine Rcheck(k)\n integer::k\n integer::i,j\n R=0\n do i=1,N\n if(btest(k,i-1))then\n do j=1,M\n R(j)=R(j)+A(i,j)\n end do\n endif\n end do\nend subroutine\ninteger function calc(k)\n integer::k\n integer::i\n calc=0\n do i=1,N\n if(btest(k,i-1))then\n calc=calc+C(i)\n endif\n end do\nend function\nend program cm", "language": "Fortran", "metadata": {"date": 1589160063, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02683.html", "problem_id": "p02683", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02683/input.txt", "sample_output_relpath": "derived/input_output/data/p02683/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02683/Fortran/s674686931.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s674686931", "user_id": "u598073939"}, "prompt_components": {"gold_output": "120\n", "input_to_evaluate": "program cm\n implicit none\n integer::N,M,X\n integer,allocatable,dimension(:)::C\n integer,allocatable,dimension(:,:)::A\n integer,allocatable,dimension(:)::R\n integer::ans=10**9\n\n integer::i\n read*,N,M,X\n allocate(C(N),A(N,M))\n do i=1,N\n read*,C(i),A(i,:)\n end do\n\n allocate(R(M))\n do i=0,2**N-1\n call Rcheck(i)\n if(minval(R)>=X)then\n ans=min(ans,calc(i))\n endif\n end do\n print\"(i0)\",merge(-1,ans,ans==10**9)\n\ncontains\nsubroutine Rcheck(k)\n integer::k\n integer::i,j\n R=0\n do i=1,N\n if(btest(k,i-1))then\n do j=1,M\n R(j)=R(j)+A(i,j)\n end do\n endif\n end do\nend subroutine\ninteger function calc(k)\n integer::k\n integer::i\n calc=0\n do i=1,N\n if(btest(k,i-1))then\n calc=calc+C(i)\n endif\n end do\nend function\nend program cm", "problem_context": "Score : 300 points\n\nProblem\n\nTakahashi, who is a novice in competitive programming, wants to learn M algorithms.\nInitially, his understanding level of each of the M algorithms is 0.\n\nTakahashi is visiting a bookstore, where he finds N books on algorithms.\nThe i-th book (1\\leq i\\leq N) is sold for C_i yen (the currency of Japan). If he buys and reads it, his understanding level of the j-th algorithm will increase by A_{i,j} for each j (1\\leq j\\leq M).\nThere is no other way to increase the understanding levels of the algorithms.\n\nTakahashi's objective is to make his understanding levels of all the M algorithms X or higher. Determine whether this objective is achievable. If it is achievable, find the minimum amount of money needed to achieve it.\n\nConstraints\n\nAll values in input are integers.\n\n1\\leq N, M\\leq 12\n\n1\\leq X\\leq 10^5\n\n1\\leq C_i \\leq 10^5\n\n0\\leq A_{i, j} \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nC_1 A_{1,1} A_{1,2} \\cdots A_{1,M}\nC_2 A_{2,1} A_{2,2} \\cdots A_{2,M}\n\\vdots\nC_N A_{N,1} A_{N,2} \\cdots A_{N,M}\n\nOutput\n\nIf the objective is not achievable, print -1; otherwise, print the minimum amount of money needed to achieve it.\n\nSample Input 1\n\n3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n\nSample Output 1\n\n120\n\nBuying the second and third books makes his understanding levels of all the algorithms 10 or higher, at the minimum cost possible.\n\nSample Input 2\n\n3 3 10\n100 3 1 4\n100 1 5 9\n100 2 6 5\n\nSample Output 2\n\n-1\n\nBuying all the books is still not enough to make his understanding levels of all the algorithms 10 or higher.\n\nSample Input 3\n\n8 5 22\n100 3 7 5 3 1\n164 4 5 2 7 8\n334 7 2 7 2 9\n234 4 7 2 8 2\n541 5 4 3 3 6\n235 4 8 6 9 7\n394 3 6 1 6 2\n872 8 4 3 7 2\n\nSample Output 3\n\n1067", "sample_input": "3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n"}, "reference_outputs": ["120\n"], "source_document_id": "p02683", "source_text": "Score : 300 points\n\nProblem\n\nTakahashi, who is a novice in competitive programming, wants to learn M algorithms.\nInitially, his understanding level of each of the M algorithms is 0.\n\nTakahashi is visiting a bookstore, where he finds N books on algorithms.\nThe i-th book (1\\leq i\\leq N) is sold for C_i yen (the currency of Japan). If he buys and reads it, his understanding level of the j-th algorithm will increase by A_{i,j} for each j (1\\leq j\\leq M).\nThere is no other way to increase the understanding levels of the algorithms.\n\nTakahashi's objective is to make his understanding levels of all the M algorithms X or higher. Determine whether this objective is achievable. If it is achievable, find the minimum amount of money needed to achieve it.\n\nConstraints\n\nAll values in input are integers.\n\n1\\leq N, M\\leq 12\n\n1\\leq X\\leq 10^5\n\n1\\leq C_i \\leq 10^5\n\n0\\leq A_{i, j} \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nC_1 A_{1,1} A_{1,2} \\cdots A_{1,M}\nC_2 A_{2,1} A_{2,2} \\cdots A_{2,M}\n\\vdots\nC_N A_{N,1} A_{N,2} \\cdots A_{N,M}\n\nOutput\n\nIf the objective is not achievable, print -1; otherwise, print the minimum amount of money needed to achieve it.\n\nSample Input 1\n\n3 3 10\n60 2 2 4\n70 8 7 9\n50 2 3 9\n\nSample Output 1\n\n120\n\nBuying the second and third books makes his understanding levels of all the algorithms 10 or higher, at the minimum cost possible.\n\nSample Input 2\n\n3 3 10\n100 3 1 4\n100 1 5 9\n100 2 6 5\n\nSample Output 2\n\n-1\n\nBuying all the books is still not enough to make his understanding levels of all the algorithms 10 or higher.\n\nSample Input 3\n\n8 5 22\n100 3 7 5 3 1\n164 4 5 2 7 8\n334 7 2 7 2 9\n234 4 7 2 8 2\n541 5 4 3 3 6\n235 4 8 6 9 7\n394 3 6 1 6 2\n872 8 4 3 7 2\n\nSample Output 3\n\n1067", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 846, "cpu_time_ms": 5, "memory_kb": 2876}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s446600230", "group_id": "codeNet:p02687", "input_text": " program abc166a\n implicit none\n character(3)::s\n\n read *, s\n\n if (s=='ARC') then\n print *, 'ABC'\n else\n print *, 'ARC'\n end if\n\n end program abc166a", "language": "Fortran", "metadata": {"date": 1588554114, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02687.html", "problem_id": "p02687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02687/input.txt", "sample_output_relpath": "derived/input_output/data/p02687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02687/Fortran/s446600230.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s446600230", "user_id": "u792534719"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": " program abc166a\n implicit none\n character(3)::s\n\n read *, s\n\n if (s=='ARC') then\n print *, 'ABC'\n else\n print *, 'ARC'\n end if\n\n end program abc166a", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "sample_input": "ABC\n"}, "reference_outputs": ["ARC\n"], "source_document_id": "p02687", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoder Inc. holds a contest every Saturday.\n\nThere are two types of contests called ABC and ARC, and just one of them is held at a time.\n\nThe company holds these two types of contests alternately: an ARC follows an ABC and vice versa.\n\nGiven a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.\n\nConstraints\n\nS is ABC or ARC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the string representing the type of the contest held this week.\n\nSample Input 1\n\nABC\n\nSample Output 1\n\nARC\n\nThey held an ABC last week, so they will hold an ARC this week.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 217, "cpu_time_ms": 5, "memory_kb": 2872}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s437122162", "group_id": "codeNet:p02688", "input_text": "module ABC166\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: read_data\n public :: solve_task_B\n\n\n ! s for this \n\n\n type type_task_B\n integer(INT32), public :: num_people\n integer(INT32), public :: num_kinds_snack\n logical, allocatable, public :: status_snack(:,:)\n end type type_task_B\n\n\n ! contained s and s are below\n contains\n \n\n subroutine read_data (obj_task_B)\n\n ! arguments for this \n type(type_task_B), intent(inout) :: obj_task_B\n\n ! variables for this \n integer(INT32) :: itr_id, itr_snack\n integer(INT32) :: bffr_num\n integer(INT32), allocatable :: bffr_id(:)\n\n\n read(unit= INPUT_UNIT, fmt= *) obj_task_B%num_people, obj_task_B%num_kinds_snack\n\n allocate( bffr_id(1:obj_task_B%num_kinds_snack) )\n allocate( obj_task_B%status_snack(1:obj_task_B%num_kinds_snack, 1:obj_task_B%num_people), mold= .false. )\n\n do itr_snack = 1_INT32, obj_task_B%num_kinds_snack, 1_INT32\n\n read(unit= INPUT_UNIT, fmt= *) bffr_num\n read(unit= INPUT_UNIT, fmt= *) bffr_id(1:bffr_num)\n\n do itr_id = 1_INT32, bffr_num, 1_INT32\n obj_task_B%status_snack( itr_snack, bffr_id(itr_id) ) = .true.\n end do\n\n end do\n\n end subroutine read_data\n\n\n subroutine solve_task_B (obj_task_B)\n\n ! arguments for this \n type(type_task_B), intent(in) :: obj_task_B\n\n ! variables for this \n integer(INT32) :: num_victims\n integer(INT32) :: itr_id, itr_snack\n logical :: buffer_status_snack\n\n num_victims = obj_task_B%num_people\n\n\n loop_id: do itr_id = 1_INT32, obj_task_B%num_people, 1_INT32\n loop_sk: do itr_snack = 1_INT32, obj_task_B%num_kinds_snack, 1_INT32\n if ( obj_task_B%status_snack(itr_snack, itr_id) ) then\n num_victims = num_victims - 1_INT32\n exit loop_sk\n end if\n end do loop_sk\n end do loop_id\n\n write(unit= OUTPUT_UNIT, fmt='(I0)') num_victims\n\n end subroutine solve_task_B\n\nend module ABC166\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC166\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! variables for this \n type(type_task_B) :: obj_task_B\n\n\n call read_data(obj_task_B)\n call solve_task_B(obj_task_B)\n\nend program main", "language": "Fortran", "metadata": {"date": 1588556965, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02688.html", "problem_id": "p02688", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02688/input.txt", "sample_output_relpath": "derived/input_output/data/p02688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02688/Fortran/s437122162.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s437122162", "user_id": "u484703930"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module ABC166\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: read_data\n public :: solve_task_B\n\n\n ! s for this \n\n\n type type_task_B\n integer(INT32), public :: num_people\n integer(INT32), public :: num_kinds_snack\n logical, allocatable, public :: status_snack(:,:)\n end type type_task_B\n\n\n ! contained s and s are below\n contains\n \n\n subroutine read_data (obj_task_B)\n\n ! arguments for this \n type(type_task_B), intent(inout) :: obj_task_B\n\n ! variables for this \n integer(INT32) :: itr_id, itr_snack\n integer(INT32) :: bffr_num\n integer(INT32), allocatable :: bffr_id(:)\n\n\n read(unit= INPUT_UNIT, fmt= *) obj_task_B%num_people, obj_task_B%num_kinds_snack\n\n allocate( bffr_id(1:obj_task_B%num_kinds_snack) )\n allocate( obj_task_B%status_snack(1:obj_task_B%num_kinds_snack, 1:obj_task_B%num_people), mold= .false. )\n\n do itr_snack = 1_INT32, obj_task_B%num_kinds_snack, 1_INT32\n\n read(unit= INPUT_UNIT, fmt= *) bffr_num\n read(unit= INPUT_UNIT, fmt= *) bffr_id(1:bffr_num)\n\n do itr_id = 1_INT32, bffr_num, 1_INT32\n obj_task_B%status_snack( itr_snack, bffr_id(itr_id) ) = .true.\n end do\n\n end do\n\n end subroutine read_data\n\n\n subroutine solve_task_B (obj_task_B)\n\n ! arguments for this \n type(type_task_B), intent(in) :: obj_task_B\n\n ! variables for this \n integer(INT32) :: num_victims\n integer(INT32) :: itr_id, itr_snack\n logical :: buffer_status_snack\n\n num_victims = obj_task_B%num_people\n\n\n loop_id: do itr_id = 1_INT32, obj_task_B%num_people, 1_INT32\n loop_sk: do itr_snack = 1_INT32, obj_task_B%num_kinds_snack, 1_INT32\n if ( obj_task_B%status_snack(itr_snack, itr_id) ) then\n num_victims = num_victims - 1_INT32\n exit loop_sk\n end if\n end do loop_sk\n end do loop_id\n\n write(unit= OUTPUT_UNIT, fmt='(I0)') num_victims\n\n end subroutine solve_task_B\n\nend module ABC166\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC166\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! variables for this \n type(type_task_B) :: obj_task_B\n\n\n call read_data(obj_task_B)\n call solve_task_B(obj_task_B)\n\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "sample_input": "3 2\n2\n1 3\n1\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02688", "source_text": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2733, "cpu_time_ms": 6, "memory_kb": 2912}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s538779920", "group_id": "codeNet:p02688", "input_text": "program main\n implicit none\n integer n,k,i,d,j,l,a\n integer,allocatable::c(:),b(:)\n read(*,*) n,k\n allocate(b(n))\n do i=1,k\n read(*,*) d\n allocate(c(d))\n read(*,*) c(1:d)\n do j=1,d\n b(c(j))=b(c(j))+1\n end do\n deallocate(c)\n end do\n a=0\n do l=1,n\n if(b(l)==0) a=a+1\n end do\n write(*,*) a\nend program main\n\n", "language": "Fortran", "metadata": {"date": 1588555764, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02688.html", "problem_id": "p02688", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02688/input.txt", "sample_output_relpath": "derived/input_output/data/p02688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02688/Fortran/s538779920.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s538779920", "user_id": "u440779866"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n integer n,k,i,d,j,l,a\n integer,allocatable::c(:),b(:)\n read(*,*) n,k\n allocate(b(n))\n do i=1,k\n read(*,*) d\n allocate(c(d))\n read(*,*) c(1:d)\n do j=1,d\n b(c(j))=b(c(j))+1\n end do\n deallocate(c)\n end do\n a=0\n do l=1,n\n if(b(l)==0) a=a+1\n end do\n write(*,*) a\nend program main\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "sample_input": "3 2\n2\n1 3\n1\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02688", "source_text": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 398, "cpu_time_ms": 5, "memory_kb": 2864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s683270189", "group_id": "codeNet:p02688", "input_text": "program trick_or_treat\n implicit none\n integer :: n, k, d, a(100) = 0, c(100) = 1, i, j\n read(*,*) n, k\n do i = 1, k\n read(*,*) d\n read(*,*) a(1:d)\n do j = 1, d\n c(a(j)) = c(a(j))-1\n end do\n end do\n write(*,'(i0)') sum(c(1:n),c(1:n) > 0)\nend program trick_or_treat", "language": "Fortran", "metadata": {"date": 1588554352, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02688.html", "problem_id": "p02688", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02688/input.txt", "sample_output_relpath": "derived/input_output/data/p02688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02688/Fortran/s683270189.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s683270189", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program trick_or_treat\n implicit none\n integer :: n, k, d, a(100) = 0, c(100) = 1, i, j\n read(*,*) n, k\n do i = 1, k\n read(*,*) d\n read(*,*) a(1:d)\n do j = 1, d\n c(a(j)) = c(a(j))-1\n end do\n end do\n write(*,'(i0)') sum(c(1:n),c(1:n) > 0)\nend program trick_or_treat", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "sample_input": "3 2\n2\n1 3\n1\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02688", "source_text": "Score : 200 points\n\nProblem Statement\n\nN Snukes called Snuke 1, Snuke 2, ..., Snuke N live in a town.\n\nThere are K kinds of snacks sold in this town, called Snack 1, Snack 2, ..., Snack K. The following d_i Snukes have Snack i: Snuke A_{i, 1}, A_{i, 2}, \\cdots, A_{i, {d_i}}.\n\nTakahashi will walk around this town and make mischief on the Snukes who have no snacks. How many Snukes will fall victim to Takahashi's mischief?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n1 \\leq d_i \\leq N\n\n1 \\leq A_{i, 1} < \\cdots < A_{i, d_i} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nd_1\nA_{1, 1} \\cdots A_{1, d_1}\n\\vdots\nd_K\nA_{K, 1} \\cdots A_{K, d_K}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n2\n1 3\n1\n3\n\nSample Output 1\n\n1\n\nSnuke 1 has Snack 1.\n\nSnuke 2 has no snacks.\n\nSnuke 3 has Snack 1 and 2.\n\nThus, there will be one victim: Snuke 2.\n\nSample Input 2\n\n3 3\n1\n3\n1\n3\n1\n3\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 287, "cpu_time_ms": 4, "memory_kb": 2932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s650217571", "group_id": "codeNet:p02689", "input_text": " MODULE stackMod\n IMPLICIT NONE\n!Module for STACK : Last in, First out\n!reference : プログラミングコンテスト攻略のための\n! アルゴリズムとデータ構造\n\n!2020/05/04 sizeを追加.精度をパラメータに変更.\n integer(16),parameter :: binSize = 10**5\n integer(16),parameter :: precision = 4\n \n type intStack\n private\n !bin(0) must not have any value.\n integer(precision) :: bin(0:binSize) = 0, top = 0\n \n contains\n procedure,public,pass :: initialize => intInitialize\n procedure,public,pass :: isEmpty => intIsEmpty\n procedure,public,pass :: isFull => intIsFull\n procedure,public,pass :: push => intPush\n procedure,public,pass :: pop => intPop\n procedure,public,pass :: size => intSize\n end type\n \n contains\n!Reset stack\n subroutine intInitialize( s )\n implicit none\n class(intStack),intent(inout) :: s\n \n s%top = 0\n end subroutine\n \n!Check status\n function intIsEmpty( s ) result( TorF )\n implicit none\n class(intStack),intent(in) :: s\n logical :: TorF\n \n if( s%top==0 )then\n TorF = .true.\n else\n TorF = .false.\n endif\n end function\n \n function intIsFull( s ) result( TorF )\n implicit none\n class(intStack),intent(in) :: s\n logical :: TorF\n \n if( s%top>=binSize )then\n TorF = .true.\n else\n TorF = .false.\n endif\n end function\n \n!Push into STACK\n subroutine intPush( s,x )\n implicit none\n class(intStack) ,intent(inout) :: s\n integer(precision),intent(in) :: x\n \n if( s%isFull() )then\n print*,'Stack is full, Error!';stop\n else\n s%top = s%top + 1\n s%bin(s%top) = x\n endif\n end subroutine\n \n!Get from STACK\n function intPop( s ) result( x )\n implicit none\n class(intStack),intent(inout) :: s\n integer(precision) :: x\n \n if( s%isEmpty() )then\n print*,'Stack is empty, Error!';stop\n else\n x = s%bin(s%top)\n s%top = s%top - 1\n end if\n end function\n \n!Current STACK size\n function intSize( s ) result( x )\n implicit none\n class(intStack),intent(in) :: s\n integer(precision) :: x\n \n x = s%top\n end function\n \n END MODULE stackMod\n\n\n PROGRAM piyo\n use stackMod\n IMPLICIT NONE\n integer,parameter :: prec = 4\n integer(prec) :: n,m\n integer(prec),allocatable :: h(:),a(:),b(:)\n integer(prec) :: i,k,ans\n type(intStack),allocatable :: list(:)\n \n \n read*,n,m\n allocate( h(n), a(m),b(m) )\n read*,h(1:n)\n \n do i = 1,m\n read*,a(i),b(i)\n end do\n \n \n allocate( list(n) )\n \n do i = 1,m\n call list(a(i))%push( b(i) )\n call list(b(i))%push( a(i) )\n end do\n \n \n ans = 0\n outer:do i = 1,n\n \n if( list(i)%size()==0 ) cycle outer\n do k = 1,list(i)%size()\n \n if( list(i)%pop() > h(i) ) cycle outer\n \n end do\n ans = ans + 1\n end do outer\n \n print*,ans\n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1588575646, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02689.html", "problem_id": "p02689", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02689/input.txt", "sample_output_relpath": "derived/input_output/data/p02689/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02689/Fortran/s650217571.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s650217571", "user_id": "u171356453"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " MODULE stackMod\n IMPLICIT NONE\n!Module for STACK : Last in, First out\n!reference : プログラミングコンテスト攻略のための\n! アルゴリズムとデータ構造\n\n!2020/05/04 sizeを追加.精度をパラメータに変更.\n integer(16),parameter :: binSize = 10**5\n integer(16),parameter :: precision = 4\n \n type intStack\n private\n !bin(0) must not have any value.\n integer(precision) :: bin(0:binSize) = 0, top = 0\n \n contains\n procedure,public,pass :: initialize => intInitialize\n procedure,public,pass :: isEmpty => intIsEmpty\n procedure,public,pass :: isFull => intIsFull\n procedure,public,pass :: push => intPush\n procedure,public,pass :: pop => intPop\n procedure,public,pass :: size => intSize\n end type\n \n contains\n!Reset stack\n subroutine intInitialize( s )\n implicit none\n class(intStack),intent(inout) :: s\n \n s%top = 0\n end subroutine\n \n!Check status\n function intIsEmpty( s ) result( TorF )\n implicit none\n class(intStack),intent(in) :: s\n logical :: TorF\n \n if( s%top==0 )then\n TorF = .true.\n else\n TorF = .false.\n endif\n end function\n \n function intIsFull( s ) result( TorF )\n implicit none\n class(intStack),intent(in) :: s\n logical :: TorF\n \n if( s%top>=binSize )then\n TorF = .true.\n else\n TorF = .false.\n endif\n end function\n \n!Push into STACK\n subroutine intPush( s,x )\n implicit none\n class(intStack) ,intent(inout) :: s\n integer(precision),intent(in) :: x\n \n if( s%isFull() )then\n print*,'Stack is full, Error!';stop\n else\n s%top = s%top + 1\n s%bin(s%top) = x\n endif\n end subroutine\n \n!Get from STACK\n function intPop( s ) result( x )\n implicit none\n class(intStack),intent(inout) :: s\n integer(precision) :: x\n \n if( s%isEmpty() )then\n print*,'Stack is empty, Error!';stop\n else\n x = s%bin(s%top)\n s%top = s%top - 1\n end if\n end function\n \n!Current STACK size\n function intSize( s ) result( x )\n implicit none\n class(intStack),intent(in) :: s\n integer(precision) :: x\n \n x = s%top\n end function\n \n END MODULE stackMod\n\n\n PROGRAM piyo\n use stackMod\n IMPLICIT NONE\n integer,parameter :: prec = 4\n integer(prec) :: n,m\n integer(prec),allocatable :: h(:),a(:),b(:)\n integer(prec) :: i,k,ans\n type(intStack),allocatable :: list(:)\n \n \n read*,n,m\n allocate( h(n), a(m),b(m) )\n read*,h(1:n)\n \n do i = 1,m\n read*,a(i),b(i)\n end do\n \n \n allocate( list(n) )\n \n do i = 1,m\n call list(a(i))%push( b(i) )\n call list(b(i))%push( a(i) )\n end do\n \n \n ans = 0\n outer:do i = 1,n\n \n if( list(i)%size()==0 ) cycle outer\n do k = 1,list(i)%size()\n \n if( list(i)%pop() > h(i) ) cycle outer\n \n end do\n ans = ans + 1\n end do outer\n \n print*,ans\n \n END PROGRAM", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i.\nThere are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.\n\nObs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road.\nNote that Obs. i is also good when no observatory can be reached from Obs. i using just one road.\n\nHow many good observatories are there?\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\n1 \\leq A_i,B_i \\leq N\n\nA_i \\neq B_i\n\nMultiple roads may connect the same pair of observatories.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nH_1 H_2 ... H_N\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nPrint the number of good observatories.\n\nSample Input 1\n\n4 3\n1 2 3 4\n1 3\n2 3\n2 4\n\nSample Output 1\n\n2\n\nFrom Obs. 1, you can reach Obs. 3 using just one road. The elevation of Obs. 1 is not higher than that of Obs. 3, so Obs. 1 is not good.\n\nFrom Obs. 2, you can reach Obs. 3 and 4 using just one road. The elevation of Obs. 2 is not higher than that of Obs. 3, so Obs. 2 is not good.\n\nFrom Obs. 3, you can reach Obs. 1 and 2 using just one road. The elevation of Obs. 3 is higher than those of Obs. 1 and 2, so Obs. 3 is good.\n\nFrom Obs. 4, you can reach Obs. 2 using just one road. The elevation of Obs. 4 is higher than that of Obs. 2, so Obs. 4 is good.\n\nThus, the good observatories are Obs. 3 and 4, so there are two good observatories.\n\nSample Input 2\n\n6 5\n8 6 9 1 2 1\n1 3\n4 2\n4 3\n4 6\n4 6\n\nSample Output 2\n\n3", "sample_input": "4 3\n1 2 3 4\n1 3\n2 3\n2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02689", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i.\nThere are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.\n\nObs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road.\nNote that Obs. i is also good when no observatory can be reached from Obs. i using just one road.\n\nHow many good observatories are there?\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\n1 \\leq A_i,B_i \\leq N\n\nA_i \\neq B_i\n\nMultiple roads may connect the same pair of observatories.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nH_1 H_2 ... H_N\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nPrint the number of good observatories.\n\nSample Input 1\n\n4 3\n1 2 3 4\n1 3\n2 3\n2 4\n\nSample Output 1\n\n2\n\nFrom Obs. 1, you can reach Obs. 3 using just one road. The elevation of Obs. 1 is not higher than that of Obs. 3, so Obs. 1 is not good.\n\nFrom Obs. 2, you can reach Obs. 3 and 4 using just one road. The elevation of Obs. 2 is not higher than that of Obs. 3, so Obs. 2 is not good.\n\nFrom Obs. 3, you can reach Obs. 1 and 2 using just one road. The elevation of Obs. 3 is higher than those of Obs. 1 and 2, so Obs. 3 is good.\n\nFrom Obs. 4, you can reach Obs. 2 using just one road. The elevation of Obs. 4 is higher than that of Obs. 2, so Obs. 4 is good.\n\nThus, the good observatories are Obs. 3 and 4, so there are two good observatories.\n\nSample Input 2\n\n6 5\n8 6 9 1 2 1\n1 3\n4 2\n4 3\n4 6\n4 6\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3423, "cpu_time_ms": 80, "memory_kb": 7316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s664595308", "group_id": "codeNet:p02689", "input_text": "program main\n implicit none\n integer :: N, M\n integer,allocatable :: H(:), A(:), B(:)\n type neig\n integer, allocatable :: cand(:)\n end type neig\n type(neig), allocatable :: obs(:)\n integer, allocatable :: cnt(:)\n logical, allocatable :: flag(:)\n integer :: i,j,k\n\n\n read(*,*) N,M\n allocate(H(N),A(M),B(M))\n allocate(obs(N))\n allocate(cnt(N))\n read(*,*) H(:)\n do i = 1,M\n read(*,*) A(i),B(i)\n end do\n\n cnt(:) = 0\n do i = 1,M\n cnt(A(i)) = cnt(A(i)) + 1\n cnt(B(i)) = cnt(B(i)) + 1\n end do\n do i = 1,N\n allocate( obs(i)%cand(cnt(i)) )\n end do\n cnt(:) = 0\n do i = 1,M\n cnt(A(i)) = cnt(A(i)) + 1\n obs(A(i))%cand(cnt(A(i))) = B(i)\n cnt(B(i)) = cnt(B(i)) + 1\n obs(B(i))%cand(cnt(B(i))) = A(i)\n end do\n allocate(flag(N)) \n flag(:) = .true.\n do i = 1,N\n do j = 1,cnt(i)\n if ( H(i) <= H( obs(i)%cand(j) ) ) then\n flag(i) = .false.\n exit\n end if\n end do\n end do\n write(*,'(i0)') count(flag)\n stop\nend program main\n", "language": "Fortran", "metadata": {"date": 1588555755, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02689.html", "problem_id": "p02689", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02689/input.txt", "sample_output_relpath": "derived/input_output/data/p02689/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02689/Fortran/s664595308.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s664595308", "user_id": "u886432251"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer :: N, M\n integer,allocatable :: H(:), A(:), B(:)\n type neig\n integer, allocatable :: cand(:)\n end type neig\n type(neig), allocatable :: obs(:)\n integer, allocatable :: cnt(:)\n logical, allocatable :: flag(:)\n integer :: i,j,k\n\n\n read(*,*) N,M\n allocate(H(N),A(M),B(M))\n allocate(obs(N))\n allocate(cnt(N))\n read(*,*) H(:)\n do i = 1,M\n read(*,*) A(i),B(i)\n end do\n\n cnt(:) = 0\n do i = 1,M\n cnt(A(i)) = cnt(A(i)) + 1\n cnt(B(i)) = cnt(B(i)) + 1\n end do\n do i = 1,N\n allocate( obs(i)%cand(cnt(i)) )\n end do\n cnt(:) = 0\n do i = 1,M\n cnt(A(i)) = cnt(A(i)) + 1\n obs(A(i))%cand(cnt(A(i))) = B(i)\n cnt(B(i)) = cnt(B(i)) + 1\n obs(B(i))%cand(cnt(B(i))) = A(i)\n end do\n allocate(flag(N)) \n flag(:) = .true.\n do i = 1,N\n do j = 1,cnt(i)\n if ( H(i) <= H( obs(i)%cand(j) ) ) then\n flag(i) = .false.\n exit\n end if\n end do\n end do\n write(*,'(i0)') count(flag)\n stop\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i.\nThere are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.\n\nObs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road.\nNote that Obs. i is also good when no observatory can be reached from Obs. i using just one road.\n\nHow many good observatories are there?\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\n1 \\leq A_i,B_i \\leq N\n\nA_i \\neq B_i\n\nMultiple roads may connect the same pair of observatories.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nH_1 H_2 ... H_N\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nPrint the number of good observatories.\n\nSample Input 1\n\n4 3\n1 2 3 4\n1 3\n2 3\n2 4\n\nSample Output 1\n\n2\n\nFrom Obs. 1, you can reach Obs. 3 using just one road. The elevation of Obs. 1 is not higher than that of Obs. 3, so Obs. 1 is not good.\n\nFrom Obs. 2, you can reach Obs. 3 and 4 using just one road. The elevation of Obs. 2 is not higher than that of Obs. 3, so Obs. 2 is not good.\n\nFrom Obs. 3, you can reach Obs. 1 and 2 using just one road. The elevation of Obs. 3 is higher than those of Obs. 1 and 2, so Obs. 3 is good.\n\nFrom Obs. 4, you can reach Obs. 2 using just one road. The elevation of Obs. 4 is higher than that of Obs. 2, so Obs. 4 is good.\n\nThus, the good observatories are Obs. 3 and 4, so there are two good observatories.\n\nSample Input 2\n\n6 5\n8 6 9 1 2 1\n1 3\n4 2\n4 3\n4 6\n4 6\n\nSample Output 2\n\n3", "sample_input": "4 3\n1 2 3 4\n1 3\n2 3\n2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02689", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N observatories in AtCoder Hill, called Obs. 1, Obs. 2, ..., Obs. N. The elevation of Obs. i is H_i.\nThere are also M roads, each connecting two different observatories. Road j connects Obs. A_j and Obs. B_j.\n\nObs. i is said to be good when its elevation is higher than those of all observatories that can be reached from Obs. i using just one road.\nNote that Obs. i is also good when no observatory can be reached from Obs. i using just one road.\n\nHow many good observatories are there?\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\n1 \\leq A_i,B_i \\leq N\n\nA_i \\neq B_i\n\nMultiple roads may connect the same pair of observatories.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nH_1 H_2 ... H_N\nA_1 B_1\nA_2 B_2\n:\nA_M B_M\n\nOutput\n\nPrint the number of good observatories.\n\nSample Input 1\n\n4 3\n1 2 3 4\n1 3\n2 3\n2 4\n\nSample Output 1\n\n2\n\nFrom Obs. 1, you can reach Obs. 3 using just one road. The elevation of Obs. 1 is not higher than that of Obs. 3, so Obs. 1 is not good.\n\nFrom Obs. 2, you can reach Obs. 3 and 4 using just one road. The elevation of Obs. 2 is not higher than that of Obs. 3, so Obs. 2 is not good.\n\nFrom Obs. 3, you can reach Obs. 1 and 2 using just one road. The elevation of Obs. 3 is higher than those of Obs. 1 and 2, so Obs. 3 is good.\n\nFrom Obs. 4, you can reach Obs. 2 using just one road. The elevation of Obs. 4 is higher than that of Obs. 2, so Obs. 4 is good.\n\nThus, the good observatories are Obs. 3 and 4, so there are two good observatories.\n\nSample Input 2\n\n6 5\n8 6 9 1 2 1\n1 3\n4 2\n4 3\n4 6\n4 6\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1010, "cpu_time_ms": 95, "memory_kb": 14780}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s886696180", "group_id": "codeNet:p02690", "input_text": "program sample\nimplicit none\ninteger(8)X,k,i\ninteger(8) A,B,A1,B1\nread(*,*)X\nA1=0\nB1=0\ndo A=-150,150\ndo B=-150,150\nif (A**5-B**5==X) then\nA1=A\nB1=B\nend if\nend do\nend do\nwrite(*,*) A1,B1\nstop\nend program sample", "language": "Fortran", "metadata": {"date": 1588569845, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02690.html", "problem_id": "p02690", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02690/input.txt", "sample_output_relpath": "derived/input_output/data/p02690/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02690/Fortran/s886696180.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s886696180", "user_id": "u457263576"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "program sample\nimplicit none\ninteger(8)X,k,i\ninteger(8) A,B,A1,B1\nread(*,*)X\nA1=0\nB1=0\ndo A=-150,150\ndo B=-150,150\nif (A**5-B**5==X) then\nA1=A\nB1=B\nend if\nend do\nend do\nwrite(*,*) A1,B1\nstop\nend program sample", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "sample_input": "33\n"}, "reference_outputs": ["2 -1\n"], "source_document_id": "p02690", "source_text": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 209, "cpu_time_ms": 2, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s091838885", "group_id": "codeNet:p02690", "input_text": "program ABC166_D\n integer::A\n integer::C(10000)\n double precision::X\n C=0\n read(*,*)X\n N=0\n A=int(sqrt(X))\n do i=1,A\n if(int(X)/i*i==int(X)) then\n N=N+1\n C(N)=i\n end if\n end do\n do i=1,N\n do j=-100000000,100000000\n if(C(i)*(5*j**4+10*(j**3)*C(i)+10*(j**2)*(C(i)**2)+5*j*(C(i)**3)+C(i)**4)==int(X)) then\n write(*,*)C(i)+j,j\n stop\n end if\n end do\n end do\nend program ABC166_D", "language": "Fortran", "metadata": {"date": 1588560993, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02690.html", "problem_id": "p02690", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02690/input.txt", "sample_output_relpath": "derived/input_output/data/p02690/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02690/Fortran/s091838885.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s091838885", "user_id": "u359178469"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "program ABC166_D\n integer::A\n integer::C(10000)\n double precision::X\n C=0\n read(*,*)X\n N=0\n A=int(sqrt(X))\n do i=1,A\n if(int(X)/i*i==int(X)) then\n N=N+1\n C(N)=i\n end if\n end do\n do i=1,N\n do j=-100000000,100000000\n if(C(i)*(5*j**4+10*(j**3)*C(i)+10*(j**2)*(C(i)**2)+5*j*(C(i)**3)+C(i)**4)==int(X)) then\n write(*,*)C(i)+j,j\n stop\n end if\n end do\n end do\nend program ABC166_D", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "sample_input": "33\n"}, "reference_outputs": ["2 -1\n"], "source_document_id": "p02690", "source_text": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 448, "cpu_time_ms": 2205, "memory_kb": 2948}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s620990404", "group_id": "codeNet:p02690", "input_text": "program main\n \n implicit none\n integer(8) :: a,b,x, tmp\n integer(8) :: ansa, ansb\n \n read(*,*) x\n \n do a = -100, 100 \n tmp = a**5 - x\n do b = -100, 100\n if ( tmp == b**5)then\n ansa = a\n ansb = b\n end if\n end do\n end do\n \n print*, ansa, ansb\n \n \nend program main\n\n", "language": "Fortran", "metadata": {"date": 1588559510, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02690.html", "problem_id": "p02690", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02690/input.txt", "sample_output_relpath": "derived/input_output/data/p02690/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02690/Fortran/s620990404.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s620990404", "user_id": "u675314298"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "program main\n \n implicit none\n integer(8) :: a,b,x, tmp\n integer(8) :: ansa, ansb\n \n read(*,*) x\n \n do a = -100, 100 \n tmp = a**5 - x\n do b = -100, 100\n if ( tmp == b**5)then\n ansa = a\n ansb = b\n end if\n end do\n end do\n \n print*, ansa, ansb\n \n \nend program main\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "sample_input": "33\n"}, "reference_outputs": ["2 -1\n"], "source_document_id": "p02690", "source_text": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 308, "cpu_time_ms": 5, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s843407998", "group_id": "codeNet:p02690", "input_text": "program main\n \n implicit none\n integer(8) :: a,b,x, tmp, n\n integer(8) :: ansa, ansb\n \n read(*,*) x\n \n do a = 0, 100 \n tmp = a**5 - x\n do b = -100, 100\n if ( tmp == b**5 )then\n ansa = a\n ansb = b\n n = 1\n exit\n end if\n end do\n if( n == 1) exit\n end do\n \n print*, ansa, ansb\n \nend program main\n\n", "language": "Fortran", "metadata": {"date": 1588557969, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02690.html", "problem_id": "p02690", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02690/input.txt", "sample_output_relpath": "derived/input_output/data/p02690/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02690/Fortran/s843407998.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s843407998", "user_id": "u675314298"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "program main\n \n implicit none\n integer(8) :: a,b,x, tmp, n\n integer(8) :: ansa, ansb\n \n read(*,*) x\n \n do a = 0, 100 \n tmp = a**5 - x\n do b = -100, 100\n if ( tmp == b**5 )then\n ansa = a\n ansb = b\n n = 1\n exit\n end if\n end do\n if( n == 1) exit\n end do\n \n print*, ansa, ansb\n \nend program main\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "sample_input": "33\n"}, "reference_outputs": ["2 -1\n"], "source_document_id": "p02690", "source_text": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 354, "cpu_time_ms": 5, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s130112591", "group_id": "codeNet:p02690", "input_text": "program main\n \n implicit none\n integer :: a,b,x, tmp\n integer :: ansa, ansb\n \n read(*,*) x\n \n do a = 1, 65 \n tmp = a**5 - x\n do b = -65, 65\n if ( tmp == b**5)then\n ansa = a\n ansb = b\n end if\n end do\n end do\n \n print*, ansa, ansb\n \nend program main\n\n", "language": "Fortran", "metadata": {"date": 1588557738, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02690.html", "problem_id": "p02690", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02690/input.txt", "sample_output_relpath": "derived/input_output/data/p02690/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02690/Fortran/s130112591.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s130112591", "user_id": "u675314298"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "program main\n \n implicit none\n integer :: a,b,x, tmp\n integer :: ansa, ansb\n \n read(*,*) x\n \n do a = 1, 65 \n tmp = a**5 - x\n do b = -65, 65\n if ( tmp == b**5)then\n ansa = a\n ansb = b\n end if\n end do\n end do\n \n print*, ansa, ansb\n \nend program main\n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "sample_input": "33\n"}, "reference_outputs": ["2 -1\n"], "source_document_id": "p02690", "source_text": "Score : 400 points\n\nProblem Statement\n\nGive a pair of integers (A, B) such that A^5-B^5 = X.\nIt is guaranteed that there exists such a pair for the given integer X.\n\nConstraints\n\n1 \\leq X \\leq 10^9\n\nX is an integer.\n\nThere exists a pair of integers (A, B) satisfying the condition in Problem Statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint A and B, with space in between.\nIf there are multiple pairs of integers (A, B) satisfying the condition, you may print any of them.\n\nA B\n\nSample Input 1\n\n33\n\nSample Output 1\n\n2 -1\n\nFor A=2 and B=-1, A^5-B^5 = 33.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0 -1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 293, "cpu_time_ms": 2, "memory_kb": 2824}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s967160939", "group_id": "codeNet:p02691", "input_text": " program abc166e\n implicit none\n integer(8)::n\n integer(8),allocatable::a(:)\n integer(8)::ans=0\n\n read *, n\n allocate(a(n))\n read *, a\n\n call abs_tall(1_8)\n\n print *, ans\n stop\n\n contains\n\n recursive subroutine abs_tall(k)\n implicit none\n integer(8),intent(in)::k\n integer(8)::i\n\n do i=k,n\n if ( abs(i-k)==a(i)+a(k) ) ans=ans+1\n end do\n\n if (k==n-1) return\n call abs_tall(k+1)\n\n end subroutine abs_tall\n\n end program abc166e", "language": "Fortran", "metadata": {"date": 1588566410, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02691.html", "problem_id": "p02691", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02691/input.txt", "sample_output_relpath": "derived/input_output/data/p02691/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02691/Fortran/s967160939.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s967160939", "user_id": "u792534719"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": " program abc166e\n implicit none\n integer(8)::n\n integer(8),allocatable::a(:)\n integer(8)::ans=0\n\n read *, n\n allocate(a(n))\n read *, a\n\n call abs_tall(1_8)\n\n print *, ans\n stop\n\n contains\n\n recursive subroutine abs_tall(k)\n implicit none\n integer(8),intent(in)::k\n integer(8)::i\n\n do i=k,n\n if ( abs(i-k)==a(i)+a(k) ) ans=ans+1\n end do\n\n if (k==n-1) return\n call abs_tall(k+1)\n\n end subroutine abs_tall\n\n end program abc166e", "problem_context": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5\n\nSample Output 3\n\n22", "sample_input": "6\n2 3 3 1 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02691", "source_text": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5\n\nSample Output 3\n\n22", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 590, "cpu_time_ms": 2205, "memory_kb": 4976}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s568927709", "group_id": "codeNet:p02691", "input_text": "program main\n implicit none\n integer n,i,j,x\n integer,allocatable::a(:)\n read(*,*) n\n allocate(a(n))\n read(*,*) a(1:n)\n x=0\n do i=1,n\n if(a(i)>2*10**5) a(i)=0\n end do\n i=0\n do i=1,n-2\n if(a(i)==0) cycle\n do j=2,n-i\n if(a(i+j)==0) cycle\n if(a(i)+a(i+j)==j) x=x+1\n end do\n end do\n write(*,*) x\nend program main\n", "language": "Fortran", "metadata": {"date": 1588559334, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02691.html", "problem_id": "p02691", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02691/input.txt", "sample_output_relpath": "derived/input_output/data/p02691/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02691/Fortran/s568927709.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s568927709", "user_id": "u440779866"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n implicit none\n integer n,i,j,x\n integer,allocatable::a(:)\n read(*,*) n\n allocate(a(n))\n read(*,*) a(1:n)\n x=0\n do i=1,n\n if(a(i)>2*10**5) a(i)=0\n end do\n i=0\n do i=1,n-2\n if(a(i)==0) cycle\n do j=2,n-i\n if(a(i+j)==0) cycle\n if(a(i)+a(i+j)==j) x=x+1\n end do\n end do\n write(*,*) x\nend program main\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5\n\nSample Output 3\n\n22", "sample_input": "6\n2 3 3 1 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02691", "source_text": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5\n\nSample Output 3\n\n22", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 398, "cpu_time_ms": 2205, "memory_kb": 3972}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s179353444", "group_id": "codeNet:p02691", "input_text": "program sample\nimplicit none\n\ninteger :: n\ninteger, allocatable :: a(:)\n\ninteger :: i, j\ninteger :: number\n\nread(*,*) n\nallocate(a(n))\nread(*,*) a\n\nnumber = 0\ndo i = 1, n-1\ndo j = i+1, n\nif (j > a(i)) then\nif (j > a(j)) then\nif (j-i == a(i) + a(j)) then\nnumber = number + 1\nend if\nend if\nend if\nend do\nend do\n\nwrite(*,*) number\n\nstop\nend program sample", "language": "Fortran", "metadata": {"date": 1588557475, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02691.html", "problem_id": "p02691", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02691/input.txt", "sample_output_relpath": "derived/input_output/data/p02691/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02691/Fortran/s179353444.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s179353444", "user_id": "u368978023"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program sample\nimplicit none\n\ninteger :: n\ninteger, allocatable :: a(:)\n\ninteger :: i, j\ninteger :: number\n\nread(*,*) n\nallocate(a(n))\nread(*,*) a\n\nnumber = 0\ndo i = 1, n-1\ndo j = i+1, n\nif (j > a(i)) then\nif (j > a(j)) then\nif (j-i == a(i) + a(j)) then\nnumber = number + 1\nend if\nend if\nend if\nend do\nend do\n\nwrite(*,*) number\n\nstop\nend program sample", "problem_context": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5\n\nSample Output 3\n\n22", "sample_input": "6\n2 3 3 1 3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02691", "source_text": "Score: 500 points\n\nProblem Statement\n\nYou are the top spy of AtCoder Kingdom. To prevent the stolen secret from being handed to AlDebaran Kingdom, you have sneaked into the party where the transaction happens.\n\nThere are N attendees in the party, and they are given attendee numbers from 1 through N. The height of Attendee i is A_i.\n\nAccording to an examination beforehand, you know that a pair of attendees satisfying the condition below will make the transaction.\n\nThe absolute difference of their attendee numbers is equal to the sum of their heights.\n\nThere are \\frac{N(N-1)}{2} ways to choose two from the N attendees and make a pair. Among them, how many satisfy the condition above?\n\nP.S.: We cannot let you know the secret.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\dots A_N\n\nOutput\n\nPrint the number of pairs satisfying the condition.\n\nSample Input 1\n\n6\n2 3 3 1 3 1\n\nSample Output 1\n\n3\n\nA_1 + A_4 = 3, so the pair of Attendee 1 and 4 satisfy the condition.\n\nA_2 + A_6 = 4, so the pair of Attendee 2 and 6 satisfy the condition.\n\nA_4 + A_6 = 2, so the pair of Attendee 4 and 6 satisfy the condition.\n\nNo other pair satisfies the condition, so you should print 3.\n\nSample Input 2\n\n6\n5 2 4 2 8 8\n\nSample Output 2\n\n0\n\nNo pair satisfies the condition, so you should print 0.\n\nSample Input 3\n\n32\n3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5\n\nSample Output 3\n\n22", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 352, "cpu_time_ms": 2205, "memory_kb": 3924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s007141122", "group_id": "codeNet:p02692", "input_text": "program main\n implicit none\n INTEGER n,a(3),i,x(2),x2(2),ans(100000),flag\n CHARACTER s1*2,s2\n read(*,*) n,(a(i),i=1,3)\n i=0\n flag=1\n!0が二つ含まれる場合\n if ( ((a(1)==0 .and. a(2)==0) .or. (a(2)==0 .and. a(3)==0) .or. (a(3)==0 .and. a(1)==0)) .and. a(1)+a(2)+a(3)/=2 ) then\n do i = 1,n\n call read_s(s1,x)\n if ( a(x(1))+a(x(2))==0 ) then\n write(*,*) \"No\"\n flag=0\n exit\n else\n call nomal(a,ans,x,i)\n end if\n end do\n!1,1,0の場合\n else if ( a(1)+a(2)+a(3)==2 ) then\n call read_s(s1,x)\n do i = 1, n\n call read_s(s2,x2)\n call exceptional(a,ans,x,x2,i)\n x=x2\n end do\n!それ以外\n else\n do i = 1, n\n call read_s(s1,x)\n call nomal(a,ans,x,i)\n end do\n end if\n\n if ( flag==1 ) then\n write(*,*) \"Yes\"\n do i = 1, n\n if(ans(i)==1) then\n write(*,*) \"A\"\n else if ( ans(i)==2 ) then\n write(*,*) \"B\"\n else\n write(*,*) \"c\"\n end if\n end do\n end if\ncontains\n subroutine read_s(sr, xr)\n implicit none\n INTEGER,INTENT(OUT):: xr(2)\n CHARACTER(*) sr\n read(*,*) sr\n if ( sr==\"AB\" ) then\n xr(1)=1\n xr(2)=2\n else if ( sr==\"BC\" ) then\n xr(1)=2\n xr(2)=3\n else \n xr(1)=3\n xr(2)=1\n end if\n end subroutine read_s\n\n subroutine nomal(an, ansn, xn,in)\n implicit none\n INTEGER an(3),xn(2),ansn(100000),in\n if ( an(xn(1))>=an(xn(2)) ) then\n an(xn(1))=an(xn(1))-1\n an(xn(2))=an(xn(2))+1\n ansn(in)=xn(2)\n else\n an(xn(1))=an(xn(1))+1\n an(xn(2))=an(xn(2))-1\n ansn(in)=xn(1)\n end if\n end subroutine nomal\n\n subroutine exceptional(as, anss, xs, x2s,is)\n implicit none\n INTEGER as(3),xs(2),x2s(2),anss(100000),is\n if ( as(xs(1))>as(xs(2)) ) then\n as(xs(1))=as(xs(1))-1\n as(xs(2))=as(xs(2))+1\n anss(is)=xs(2)\n else if ( a(x(1))=an(xn(2)) ) then\n an(xn(1))=an(xn(1))-1\n an(xn(2))=an(xn(2))+1\n ansn(in)=xn(2)\n else\n an(xn(1))=an(xn(1))+1\n an(xn(2))=an(xn(2))-1\n ansn(in)=xn(1)\n end if\n end subroutine nomal\n\n subroutine exceptional(as, anss, xs, x2s,is)\n implicit none\n INTEGER as(3),xs(2),x2s(2),anss(100000),is\n if ( as(xs(1))>as(xs(2)) ) then\n as(xs(1))=as(xs(1))-1\n as(xs(2))=as(xs(2))+1\n anss(is)=xs(2)\n else if ( a(x(1))=x) exit\n year=year+1\n yen=aint(yen)\n !print*,yen\n end do\n\n print*,year\n\nend program percent", "language": "Fortran", "metadata": {"date": 1588471434, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Fortran/s089280728.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s089280728", "user_id": "u882765852"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program percent\n\n implicit none\n integer :: year,i\n real(4) :: yen\n real(8) :: x\n\n read*,x\n !print*,x \n\n year=1\n yen=100\n\n do i=1,100000\n yen=yen*1.01\n if(yen>=x) exit\n year=year+1\n yen=aint(yen)\n !print*,yen\n end do\n\n print*,year\n\nend program percent", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 256, "cpu_time_ms": 3, "memory_kb": 2924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s875042062", "group_id": "codeNet:p02694", "input_text": "program problemB\n implicit none\n\n\ninteger(8) :: X, n\ninteger(8) :: BNUM, RNUM, NMAX, count,MMAX, sum, A, B, C, D,multi,countA,countC\ninteger(8) :: money, yr\ncharacter(len=4) :: color\n\n\n\nread(*,*) X\n\n! yr=log(real(X)/real(100))/log(1.01)\n!\n! if (int(yr)==yr) then\n! n=int(yr)\n! else\n! n=int(yr)+1\n! end if\n\nn=0\nmoney=100\ndo while (int(money)=x) exit\n year=year+1\n yen=real(k)\n end do\n\n print*,year\n\nend program percent\n\n \n ", "language": "Fortran", "metadata": {"date": 1588470091, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Fortran/s661893800.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s661893800", "user_id": "u882765852"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program percent\n\n implicit none\n integer(8) :: year,i,k,x\n real(8) :: yen\n\n read*,x\n \n year=1\n yen=100\n do i=1,10000000\n yen=yen*1.01\n k=int(yen)\n if(k>=x) exit\n year=year+1\n yen=real(k)\n end do\n\n print*,year\n\nend program percent\n\n \n ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 240, "cpu_time_ms": 12, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s964760084", "group_id": "codeNet:p02694", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: x,y,n\n \n read*, x\n y=100 \n n=0\n do while(y < x)\n y=y+y/100\n n=n+1\n end do\n print'(i0)', n\nend program name", "language": "Fortran", "metadata": {"date": 1588468860, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Fortran/s964760084.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s964760084", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: x,y,n\n \n read*, x\n y=100 \n n=0\n do while(y < x)\n y=y+y/100\n n=n+1\n end do\n print'(i0)', n\nend program name", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 232, "cpu_time_ms": 6, "memory_kb": 2924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s118424843", "group_id": "codeNet:p02694", "input_text": "program one_per_cent\n implicit none\n integer :: i = 1\n integer(16) :: x, m = 100\n read(*,*) x\n do\n m = int(m*1.01,16)\n if (m >= x) then\n write(*,'(i0)') i\n stop\n end if\n i = i+1\n end do\nend program one_per_cent", "language": "Fortran", "metadata": {"date": 1588468823, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Fortran/s118424843.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s118424843", "user_id": "u506403362"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program one_per_cent\n implicit none\n integer :: i = 1\n integer(16) :: x, m = 100\n read(*,*) x\n do\n m = int(m*1.01,16)\n if (m >= x) then\n write(*,'(i0)') i\n stop\n end if\n i = i+1\n end do\nend program one_per_cent", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 238, "cpu_time_ms": 4, "memory_kb": 2844}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s718011057", "group_id": "codeNet:p02694", "input_text": "program bm\nimplicit none\ninteger(16)::X\ninteger(16)::M=100_16\ninteger::i=1\nread*,X\ndo\n M=M+(M/100_16)\n if(M>=X)then\n print\"(I0)\",i\n stop\n endif\n i=i+1\nend do\ncontains\nend program bm", "language": "Fortran", "metadata": {"date": 1588468728, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02694.html", "problem_id": "p02694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02694/input.txt", "sample_output_relpath": "derived/input_output/data/p02694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02694/Fortran/s718011057.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s718011057", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program bm\nimplicit none\ninteger(16)::X\ninteger(16)::M=100_16\ninteger::i=1\nread*,X\ndo\n M=M+(M/100_16)\n if(M>=X)then\n print\"(I0)\",i\n stop\n endif\n i=i+1\nend do\ncontains\nend program bm", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "sample_input": "103\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02694", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has a deposit of 100 yen (the currency of Japan) in AtCoder Bank.\n\nThe bank pays an annual interest rate of 1 % compounded annually. (A fraction of less than one yen is discarded.)\n\nAssuming that nothing other than the interest affects Takahashi's balance, in how many years does the balance reach X yen or above for the first time?\n\nConstraints\n\n101 \\le X \\le 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the number of years it takes for Takahashi's balance to reach X yen or above for the first time.\n\nSample Input 1\n\n103\n\nSample Output 1\n\n3\n\nThe balance after one year is 101 yen.\n\nThe balance after two years is 102 yen.\n\nThe balance after three years is 103 yen.\n\nThus, it takes three years for the balance to reach 103 yen or above.\n\nSample Input 2\n\n1000000000000000000\n\nSample Output 2\n\n3760\n\nSample Input 3\n\n1333333333\n\nSample Output 3\n\n1706", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 207, "cpu_time_ms": 6, "memory_kb": 2840}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s229155200", "group_id": "codeNet:p02695", "input_text": " module piyoMod\n implicit none\n integer(16) :: n,m,q,ans=0\n integer(16),allocatable :: abcd(:,:)\n \n contains\n recursive subroutine solve( cnt,array )\n implicit none\n integer(16),intent(in) :: cnt,array(:)\n integer(16) :: a(size(array)), i,buffer\n \n a = array\n if( cnt==1 )then\n do i = 1,m\n a(1) = i\n call solve( cnt+1,a )\n end do\n else if( cnt==n+1 )then\n \n !calc ans\n buffer = 0\n do i = 1,q\n if( a(abcd(i,2))-a(abcd(i,1))==abcd(i,3) )then\n buffer = buffer + abcd(i,4)\n end if\n end do\n ans = max( ans,buffer )\n \n else\n do i = a(cnt-1),m\n a(cnt) = i\n call solve( cnt+1,a )\n end do\n end if\n end subroutine\n \n \n end module\n \n PROGRAM ManyRequirments\n use piyoMod\n IMPLICIT NONE\n integer(16) :: i,dummy(10)\n \n read*,n,m,q\n allocate( abcd(q,4) )\n do i = 1,q\n read*,abcd(i,:)\n end do\n \n call solve(1_16,dummy(1:n))\n print*,ans\n \n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1589695573, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02695.html", "problem_id": "p02695", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02695/input.txt", "sample_output_relpath": "derived/input_output/data/p02695/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02695/Fortran/s229155200.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s229155200", "user_id": "u171356453"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": " module piyoMod\n implicit none\n integer(16) :: n,m,q,ans=0\n integer(16),allocatable :: abcd(:,:)\n \n contains\n recursive subroutine solve( cnt,array )\n implicit none\n integer(16),intent(in) :: cnt,array(:)\n integer(16) :: a(size(array)), i,buffer\n \n a = array\n if( cnt==1 )then\n do i = 1,m\n a(1) = i\n call solve( cnt+1,a )\n end do\n else if( cnt==n+1 )then\n \n !calc ans\n buffer = 0\n do i = 1,q\n if( a(abcd(i,2))-a(abcd(i,1))==abcd(i,3) )then\n buffer = buffer + abcd(i,4)\n end if\n end do\n ans = max( ans,buffer )\n \n else\n do i = a(cnt-1),m\n a(cnt) = i\n call solve( cnt+1,a )\n end do\n end if\n end subroutine\n \n \n end module\n \n PROGRAM ManyRequirments\n use piyoMod\n IMPLICIT NONE\n integer(16) :: i,dummy(10)\n \n read*,n,m,q\n allocate( abcd(q,4) )\n do i = 1,q\n read*,abcd(i,:)\n end do\n \n call solve(1_16,dummy(1:n))\n print*,ans\n \n \n \n \n END PROGRAM", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ).\n\nConsider a sequence A satisfying the following conditions:\n\nA is a sequence of N positive integers.\n\n1 \\leq A_1 \\leq A_2 \\le \\cdots \\leq A_N \\leq M.\n\nLet us define a score of this sequence as follows:\n\nThe score is the sum of d_i over all indices i such that A_{b_i} - A_{a_i} = c_i. (If there is no such i, the score is 0.)\n\nFind the maximum possible score of A.\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10\n\n1 \\leq M \\leq 10\n\n1 \\leq Q \\leq 50\n\n1 \\leq a_i < b_i \\leq N ( i = 1, 2, ..., Q )\n\n0 \\leq c_i \\leq M - 1 ( i = 1, 2, ..., Q )\n\n(a_i, b_i, c_i) \\neq (a_j, b_j, c_j) (where i \\neq j)\n\n1 \\leq d_i \\leq 10^5 ( i = 1, 2, ..., Q )\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\na_1 b_1 c_1 d_1\n:\na_Q b_Q c_Q d_Q\n\nOutput\n\nPrint the maximum possible score of A.\n\nSample Input 1\n\n3 4 3\n1 3 3 100\n1 2 2 10\n2 3 2 10\n\nSample Output 1\n\n110\n\nWhen A = \\{1, 3, 4\\}, its score is 110. Under these conditions, no sequence has a score greater than 110, so the answer is 110.\n\nSample Input 2\n\n4 6 10\n2 4 1 86568\n1 4 0 90629\n2 3 0 90310\n3 4 1 29211\n3 4 3 78537\n3 4 2 8580\n1 2 1 96263\n1 4 2 2156\n1 2 0 94325\n1 4 3 94328\n\nSample Output 2\n\n357500\n\nSample Input 3\n\n10 10 1\n1 10 9 1\n\nSample Output 3\n\n1", "sample_input": "3 4 3\n1 3 3 100\n1 2 2 10\n2 3 2 10\n"}, "reference_outputs": ["110\n"], "source_document_id": "p02695", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ).\n\nConsider a sequence A satisfying the following conditions:\n\nA is a sequence of N positive integers.\n\n1 \\leq A_1 \\leq A_2 \\le \\cdots \\leq A_N \\leq M.\n\nLet us define a score of this sequence as follows:\n\nThe score is the sum of d_i over all indices i such that A_{b_i} - A_{a_i} = c_i. (If there is no such i, the score is 0.)\n\nFind the maximum possible score of A.\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10\n\n1 \\leq M \\leq 10\n\n1 \\leq Q \\leq 50\n\n1 \\leq a_i < b_i \\leq N ( i = 1, 2, ..., Q )\n\n0 \\leq c_i \\leq M - 1 ( i = 1, 2, ..., Q )\n\n(a_i, b_i, c_i) \\neq (a_j, b_j, c_j) (where i \\neq j)\n\n1 \\leq d_i \\leq 10^5 ( i = 1, 2, ..., Q )\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\na_1 b_1 c_1 d_1\n:\na_Q b_Q c_Q d_Q\n\nOutput\n\nPrint the maximum possible score of A.\n\nSample Input 1\n\n3 4 3\n1 3 3 100\n1 2 2 10\n2 3 2 10\n\nSample Output 1\n\n110\n\nWhen A = \\{1, 3, 4\\}, its score is 110. Under these conditions, no sequence has a score greater than 110, so the answer is 110.\n\nSample Input 2\n\n4 6 10\n2 4 1 86568\n1 4 0 90629\n2 3 0 90310\n3 4 1 29211\n3 4 3 78537\n3 4 2 8580\n1 2 1 96263\n1 4 2 2156\n1 2 0 94325\n1 4 3 94328\n\nSample Output 2\n\n357500\n\nSample Input 3\n\n10 10 1\n1 10 9 1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1236, "cpu_time_ms": 30, "memory_kb": 2772}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s744330388", "group_id": "codeNet:p02695", "input_text": "program main\n \n implicit none\n integer :: nn, mm, qq, ii, tmp\n integer(8) :: tmpans, ans\n integer,allocatable :: a(:)\n integer,allocatable :: b(:)\n integer,allocatable :: c(:)\n integer(8),allocatable :: d(:)\n integer,allocatable :: aa(:)\n integer :: i,j,k,l,m,n,o,p,q,r,s\n \n read(*,*) nn, mm, qq\n allocate(a(1:qq))\n allocate(b(1:qq))\n allocate(c(1:qq))\n allocate(d(1:qq))\n allocate(aa(1:n))\n \n do i = 1, qq\n read(*,*) a(i), b(i), c(i), d(i)\n end do\n\n aa = 0 \n ans = 0\n do i = 1, mm\n aa(1) = i\n do j = 1, mm\n aa(2) = j\n if ( nn == 2 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do k = 1, mm\n aa(3) = k\n if ( nn == 3 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do l = 1, mm\n aa(4) = l\n if ( nn == 4 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do m = 1, mm\n aa(5) = m\n if ( nn == 5 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do n = 1, mm\n aa(6) = n\n if ( nn == 6 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do o = 1, mm\n aa(7) = o\n if ( nn == 7 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do p = 1, mm\n aa(8) = p\n if ( nn == 8 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do q = 1, mm\n aa(9) = q\n if ( nn == 9 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do r = 1, mm\n aa(10) = r\n if ( nn == 10 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end do\n \n print*, ans\n \n \nend program main\n", "language": "Fortran", "metadata": {"date": 1588473569, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02695.html", "problem_id": "p02695", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02695/input.txt", "sample_output_relpath": "derived/input_output/data/p02695/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02695/Fortran/s744330388.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s744330388", "user_id": "u675314298"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "program main\n \n implicit none\n integer :: nn, mm, qq, ii, tmp\n integer(8) :: tmpans, ans\n integer,allocatable :: a(:)\n integer,allocatable :: b(:)\n integer,allocatable :: c(:)\n integer(8),allocatable :: d(:)\n integer,allocatable :: aa(:)\n integer :: i,j,k,l,m,n,o,p,q,r,s\n \n read(*,*) nn, mm, qq\n allocate(a(1:qq))\n allocate(b(1:qq))\n allocate(c(1:qq))\n allocate(d(1:qq))\n allocate(aa(1:n))\n \n do i = 1, qq\n read(*,*) a(i), b(i), c(i), d(i)\n end do\n\n aa = 0 \n ans = 0\n do i = 1, mm\n aa(1) = i\n do j = 1, mm\n aa(2) = j\n if ( nn == 2 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do k = 1, mm\n aa(3) = k\n if ( nn == 3 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do l = 1, mm\n aa(4) = l\n if ( nn == 4 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do m = 1, mm\n aa(5) = m\n if ( nn == 5 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do n = 1, mm\n aa(6) = n\n if ( nn == 6 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do o = 1, mm\n aa(7) = o\n if ( nn == 7 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do p = 1, mm\n aa(8) = p\n if ( nn == 8 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do q = 1, mm\n aa(9) = q\n if ( nn == 9 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n do r = 1, mm\n aa(10) = r\n if ( nn == 10 ) then\n tmpans = 0\n do ii = 1, qq\n tmp = aa(b(ii))-aa(a(ii))\n if( tmp == c(ii) ) tmpans = tmpans + d(ii)\n end do\n if( tmpans >= ans ) ans = tmpans\n else \n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end if\n end do\n end do\n \n print*, ans\n \n \nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ).\n\nConsider a sequence A satisfying the following conditions:\n\nA is a sequence of N positive integers.\n\n1 \\leq A_1 \\leq A_2 \\le \\cdots \\leq A_N \\leq M.\n\nLet us define a score of this sequence as follows:\n\nThe score is the sum of d_i over all indices i such that A_{b_i} - A_{a_i} = c_i. (If there is no such i, the score is 0.)\n\nFind the maximum possible score of A.\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10\n\n1 \\leq M \\leq 10\n\n1 \\leq Q \\leq 50\n\n1 \\leq a_i < b_i \\leq N ( i = 1, 2, ..., Q )\n\n0 \\leq c_i \\leq M - 1 ( i = 1, 2, ..., Q )\n\n(a_i, b_i, c_i) \\neq (a_j, b_j, c_j) (where i \\neq j)\n\n1 \\leq d_i \\leq 10^5 ( i = 1, 2, ..., Q )\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\na_1 b_1 c_1 d_1\n:\na_Q b_Q c_Q d_Q\n\nOutput\n\nPrint the maximum possible score of A.\n\nSample Input 1\n\n3 4 3\n1 3 3 100\n1 2 2 10\n2 3 2 10\n\nSample Output 1\n\n110\n\nWhen A = \\{1, 3, 4\\}, its score is 110. Under these conditions, no sequence has a score greater than 110, so the answer is 110.\n\nSample Input 2\n\n4 6 10\n2 4 1 86568\n1 4 0 90629\n2 3 0 90310\n3 4 1 29211\n3 4 3 78537\n3 4 2 8580\n1 2 1 96263\n1 4 2 2156\n1 2 0 94325\n1 4 3 94328\n\nSample Output 2\n\n357500\n\nSample Input 3\n\n10 10 1\n1 10 9 1\n\nSample Output 3\n\n1", "sample_input": "3 4 3\n1 3 3 100\n1 2 2 10\n2 3 2 10\n"}, "reference_outputs": ["110\n"], "source_document_id": "p02695", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven are positive integers N, M, Q, and Q quadruples of integers ( a_i , b_i , c_i , d_i ).\n\nConsider a sequence A satisfying the following conditions:\n\nA is a sequence of N positive integers.\n\n1 \\leq A_1 \\leq A_2 \\le \\cdots \\leq A_N \\leq M.\n\nLet us define a score of this sequence as follows:\n\nThe score is the sum of d_i over all indices i such that A_{b_i} - A_{a_i} = c_i. (If there is no such i, the score is 0.)\n\nFind the maximum possible score of A.\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10\n\n1 \\leq M \\leq 10\n\n1 \\leq Q \\leq 50\n\n1 \\leq a_i < b_i \\leq N ( i = 1, 2, ..., Q )\n\n0 \\leq c_i \\leq M - 1 ( i = 1, 2, ..., Q )\n\n(a_i, b_i, c_i) \\neq (a_j, b_j, c_j) (where i \\neq j)\n\n1 \\leq d_i \\leq 10^5 ( i = 1, 2, ..., Q )\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\na_1 b_1 c_1 d_1\n:\na_Q b_Q c_Q d_Q\n\nOutput\n\nPrint the maximum possible score of A.\n\nSample Input 1\n\n3 4 3\n1 3 3 100\n1 2 2 10\n2 3 2 10\n\nSample Output 1\n\n110\n\nWhen A = \\{1, 3, 4\\}, its score is 110. Under these conditions, no sequence has a score greater than 110, so the answer is 110.\n\nSample Input 2\n\n4 6 10\n2 4 1 86568\n1 4 0 90629\n2 3 0 90310\n3 4 1 29211\n3 4 3 78537\n3 4 2 8580\n1 2 1 96263\n1 4 2 2156\n1 2 0 94325\n1 4 3 94328\n\nSample Output 2\n\n357500\n\nSample Input 3\n\n10 10 1\n1 10 9 1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4830, "cpu_time_ms": 2205, "memory_kb": 2800}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s041978528", "group_id": "codeNet:p02696", "input_text": "program ksfloor\n implicit none\n integer :: n,answer,i\n integer,allocatable ::s(:)\n real :: a,b\n \n read*,a,b,n\n allocate(s(0:n))\n \n do i=0,n\n s(i)=aint(a*i/b)-a*aint(i/b)\n end do\n\n answer=maxval(s)\n print*,answer\n\nend program ksfloor\n ", "language": "Fortran", "metadata": {"date": 1588473519, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02696.html", "problem_id": "p02696", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02696/input.txt", "sample_output_relpath": "derived/input_output/data/p02696/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02696/Fortran/s041978528.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s041978528", "user_id": "u882765852"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ksfloor\n implicit none\n integer :: n,answer,i\n integer,allocatable ::s(:)\n real :: a,b\n \n read*,a,b,n\n allocate(s(0:n))\n \n do i=0,n\n s(i)=aint(a*i/b)-a*aint(i/b)\n end do\n\n answer=maxval(s)\n print*,answer\n\nend program ksfloor\n ", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "sample_input": "5 7 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02696", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are integers A, B, and N.\n\nFind the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N.\n\nHere floor(t) denotes the greatest integer not greater than the real number t.\n\nConstraints\n\n1 ≤ A ≤ 10^{6}\n\n1 ≤ B ≤ 10^{12}\n\n1 ≤ N ≤ 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B N\n\nOutput\n\nPrint the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N, as an integer.\n\nSample Input 1\n\n5 7 4\n\nSample Output 1\n\n2\n\nWhen x=3, floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2. This is the maximum value possible.\n\nSample Input 2\n\n11 10 9\n\nSample Output 2\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 236, "cpu_time_ms": 6, "memory_kb": 3156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s077929548", "group_id": "codeNet:p02697", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,m,i,c,d\n\n read*, n,m\n c=0\n d=1\n do i=1,m\n print'(2(i0,1x))', c+1,d+1\n d=d+1\n end do\n \nend program name", "language": "Fortran", "metadata": {"date": 1588471006, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02697.html", "problem_id": "p02697", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02697/input.txt", "sample_output_relpath": "derived/input_output/data/p02697/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02697/Fortran/s077929548.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s077929548", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2 3\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,m,i,c,d\n\n read*, n,m\n c=0\n d=1\n do i=1,m\n print'(2(i0,1x))', c+1,d+1\n d=d+1\n end do\n \nend program name", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to hold a competition of one-to-one game called AtCoder Janken. (Janken is the Japanese name for Rock-paper-scissors.)\nN players will participate in this competition, and they are given distinct integers from 1 through N.\nThe arena has M playing fields for two players. You need to assign each playing field two distinct integers between 1 and N (inclusive).\nYou cannot assign the same integer to multiple playing fields.\nThe competition consists of N rounds, each of which proceeds as follows:\n\nFor each player, if there is a playing field that is assigned the player's integer, the player goes to that field and fight the other player who comes there.\n\nThen, each player adds 1 to its integer. If it becomes N+1, change it to 1.\n\nYou want to ensure that no player fights the same opponent more than once during the N rounds.\nPrint an assignment of integers to the playing fields satisfying this condition.\nIt can be proved that such an assignment always exists under the constraints given.\n\nConstraints\n\n1 \\leq M\n\nM \\times 2 +1 \\leq N \\leq 200000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint M lines in the format below.\nThe i-th line should contain the two integers a_i and b_i assigned to the i-th playing field.\n\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nSample Input 1\n\n4 1\n\nSample Output 1\n\n2 3\n\nLet us call the four players A, B, C, and D, and assume that they are initially given the integers 1, 2, 3, and 4, respectively.\n\nThe 1-st round is fought by B and C, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 2, 3, 4, and 1, respectively.\n\nThe 2-nd round is fought by A and B, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 3, 4, 1, and 2, respectively.\n\nThe 3-rd round is fought by D and A, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 4, 1, 2, and 3, respectively.\n\nThe 4-th round is fought by C and D, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 1, 2, 3, and 4, respectively.\n\nNo player fights the same opponent more than once during the four rounds, so this solution will be accepted.\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n1 6\n2 5\n3 4", "sample_input": "4 1\n"}, "reference_outputs": ["2 3\n"], "source_document_id": "p02697", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to hold a competition of one-to-one game called AtCoder Janken. (Janken is the Japanese name for Rock-paper-scissors.)\nN players will participate in this competition, and they are given distinct integers from 1 through N.\nThe arena has M playing fields for two players. You need to assign each playing field two distinct integers between 1 and N (inclusive).\nYou cannot assign the same integer to multiple playing fields.\nThe competition consists of N rounds, each of which proceeds as follows:\n\nFor each player, if there is a playing field that is assigned the player's integer, the player goes to that field and fight the other player who comes there.\n\nThen, each player adds 1 to its integer. If it becomes N+1, change it to 1.\n\nYou want to ensure that no player fights the same opponent more than once during the N rounds.\nPrint an assignment of integers to the playing fields satisfying this condition.\nIt can be proved that such an assignment always exists under the constraints given.\n\nConstraints\n\n1 \\leq M\n\nM \\times 2 +1 \\leq N \\leq 200000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint M lines in the format below.\nThe i-th line should contain the two integers a_i and b_i assigned to the i-th playing field.\n\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nSample Input 1\n\n4 1\n\nSample Output 1\n\n2 3\n\nLet us call the four players A, B, C, and D, and assume that they are initially given the integers 1, 2, 3, and 4, respectively.\n\nThe 1-st round is fought by B and C, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 2, 3, 4, and 1, respectively.\n\nThe 2-nd round is fought by A and B, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 3, 4, 1, and 2, respectively.\n\nThe 3-rd round is fought by D and A, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 4, 1, 2, and 3, respectively.\n\nThe 4-th round is fought by C and D, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 1, 2, 3, and 4, respectively.\n\nNo player fights the same opponent more than once during the four rounds, so this solution will be accepted.\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n1 6\n2 5\n3 4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 225, "cpu_time_ms": 46, "memory_kb": 2928}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s220856957", "group_id": "codeNet:p02697", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,m,i,c,d\n\n read*, n,m\n c=0\n d=1\n do i=1,m\n print'(2(i0,1x))', c+1,d+1\n c=modulo(c-1,n)\n d=d+1\n end do\n \nend program name", "language": "Fortran", "metadata": {"date": 1588470523, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02697.html", "problem_id": "p02697", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02697/input.txt", "sample_output_relpath": "derived/input_output/data/p02697/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02697/Fortran/s220856957.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s220856957", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2 3\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,m,i,c,d\n\n read*, n,m\n c=0\n d=1\n do i=1,m\n print'(2(i0,1x))', c+1,d+1\n c=modulo(c-1,n)\n d=d+1\n end do\n \nend program name", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are going to hold a competition of one-to-one game called AtCoder Janken. (Janken is the Japanese name for Rock-paper-scissors.)\nN players will participate in this competition, and they are given distinct integers from 1 through N.\nThe arena has M playing fields for two players. You need to assign each playing field two distinct integers between 1 and N (inclusive).\nYou cannot assign the same integer to multiple playing fields.\nThe competition consists of N rounds, each of which proceeds as follows:\n\nFor each player, if there is a playing field that is assigned the player's integer, the player goes to that field and fight the other player who comes there.\n\nThen, each player adds 1 to its integer. If it becomes N+1, change it to 1.\n\nYou want to ensure that no player fights the same opponent more than once during the N rounds.\nPrint an assignment of integers to the playing fields satisfying this condition.\nIt can be proved that such an assignment always exists under the constraints given.\n\nConstraints\n\n1 \\leq M\n\nM \\times 2 +1 \\leq N \\leq 200000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint M lines in the format below.\nThe i-th line should contain the two integers a_i and b_i assigned to the i-th playing field.\n\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nSample Input 1\n\n4 1\n\nSample Output 1\n\n2 3\n\nLet us call the four players A, B, C, and D, and assume that they are initially given the integers 1, 2, 3, and 4, respectively.\n\nThe 1-st round is fought by B and C, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 2, 3, 4, and 1, respectively.\n\nThe 2-nd round is fought by A and B, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 3, 4, 1, and 2, respectively.\n\nThe 3-rd round is fought by D and A, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 4, 1, 2, and 3, respectively.\n\nThe 4-th round is fought by C and D, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 1, 2, 3, and 4, respectively.\n\nNo player fights the same opponent more than once during the four rounds, so this solution will be accepted.\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n1 6\n2 5\n3 4", "sample_input": "4 1\n"}, "reference_outputs": ["2 3\n"], "source_document_id": "p02697", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are going to hold a competition of one-to-one game called AtCoder Janken. (Janken is the Japanese name for Rock-paper-scissors.)\nN players will participate in this competition, and they are given distinct integers from 1 through N.\nThe arena has M playing fields for two players. You need to assign each playing field two distinct integers between 1 and N (inclusive).\nYou cannot assign the same integer to multiple playing fields.\nThe competition consists of N rounds, each of which proceeds as follows:\n\nFor each player, if there is a playing field that is assigned the player's integer, the player goes to that field and fight the other player who comes there.\n\nThen, each player adds 1 to its integer. If it becomes N+1, change it to 1.\n\nYou want to ensure that no player fights the same opponent more than once during the N rounds.\nPrint an assignment of integers to the playing fields satisfying this condition.\nIt can be proved that such an assignment always exists under the constraints given.\n\nConstraints\n\n1 \\leq M\n\nM \\times 2 +1 \\leq N \\leq 200000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint M lines in the format below.\nThe i-th line should contain the two integers a_i and b_i assigned to the i-th playing field.\n\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nSample Input 1\n\n4 1\n\nSample Output 1\n\n2 3\n\nLet us call the four players A, B, C, and D, and assume that they are initially given the integers 1, 2, 3, and 4, respectively.\n\nThe 1-st round is fought by B and C, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 2, 3, 4, and 1, respectively.\n\nThe 2-nd round is fought by A and B, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 3, 4, 1, and 2, respectively.\n\nThe 3-rd round is fought by D and A, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 4, 1, 2, and 3, respectively.\n\nThe 4-th round is fought by C and D, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 1, 2, 3, and 4, respectively.\n\nNo player fights the same opponent more than once during the four rounds, so this solution will be accepted.\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n1 6\n2 5\n3 4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 249, "cpu_time_ms": 55, "memory_kb": 2924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s095189238", "group_id": "codeNet:p02701", "input_text": " program abc164c\n implicit none\n integer::n\n character(10),allocatable::s(:)\n integer::i,count\n\n read *, n\n allocate(s(n))\n do i=1,n\n read *,s(i)\n end do\n\n call sort_quick(1,n,n,s)\n\n count=1\n do i=1,n-1\n if (s(i)/=s(i+1)) count=count+1\n end do\n\n print *,count\n stop\n\n contains\n recursive subroutine sort_quick(left,right,n,array)\n ! split two group with the medium element as the standard, and sort the array at each section\n ! if want to sort the array of strings, change 'double precision' variables to 'character' variables\n implicit none\n integer,intent(in)::n,left,right\n character(10),intent(inout)::array(1:n)\n integer::i,j\n character(10)::s,w\n\n if (left.ge.right) return\n\n !第一要素を一時的に軸とし、大小のグループへ分ける\n s=array(left)\n i=left\n j=right+1\n\n do\n i=i+1\n do while (s.gt.array(i))\n i=i+1\n end do\n\n j=j-1\n do while (s.lt.array(j))\n j=j-1\n end do\n\n if (i.ge.j) exit\n !スワップ\n w=array(i)\n array(i)=array(j)\n array(j)=w\n end do\n\n !軸を正しい位置に入れる\n array(left)=array(j)\n array(j)=s\n\n call sort_quick(left, j-1,n,array) !左部分再帰\n call sort_quick( j+1,right,n,array) !右部分再帰\n\n return\n end subroutine sort_quick\n\n end program abc164c", "language": "Fortran", "metadata": {"date": 1588128628, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Fortran/s095189238.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s095189238", "user_id": "u792534719"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " program abc164c\n implicit none\n integer::n\n character(10),allocatable::s(:)\n integer::i,count\n\n read *, n\n allocate(s(n))\n do i=1,n\n read *,s(i)\n end do\n\n call sort_quick(1,n,n,s)\n\n count=1\n do i=1,n-1\n if (s(i)/=s(i+1)) count=count+1\n end do\n\n print *,count\n stop\n\n contains\n recursive subroutine sort_quick(left,right,n,array)\n ! split two group with the medium element as the standard, and sort the array at each section\n ! if want to sort the array of strings, change 'double precision' variables to 'character' variables\n implicit none\n integer,intent(in)::n,left,right\n character(10),intent(inout)::array(1:n)\n integer::i,j\n character(10)::s,w\n\n if (left.ge.right) return\n\n !第一要素を一時的に軸とし、大小のグループへ分ける\n s=array(left)\n i=left\n j=right+1\n\n do\n i=i+1\n do while (s.gt.array(i))\n i=i+1\n end do\n\n j=j-1\n do while (s.lt.array(j))\n j=j-1\n end do\n\n if (i.ge.j) exit\n !スワップ\n w=array(i)\n array(i)=array(j)\n array(j)=w\n end do\n\n !軸を正しい位置に入れる\n array(left)=array(j)\n array(j)=s\n\n call sort_quick(left, j-1,n,array) !左部分再帰\n call sort_quick( j+1,right,n,array) !右部分再帰\n\n return\n end subroutine sort_quick\n\n end program abc164c", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1731, "cpu_time_ms": 108, "memory_kb": 4828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s295432635", "group_id": "codeNet:p02701", "input_text": " program abc164c\n implicit none\n integer::n\n character(10),allocatable::s1(:),s2(:) !元の配列、ソート後の配列\n integer::i,j,count\n integer,parameter::p=100\n\n read *, n\n allocate(s1(n),s2(n))\n do i=1,n\n read *,s1(i)\n end do\n\n do i=1,p\n call sort_quick(n, s1, s2)\n end do\n\n count=1\n do i=1,n-1\n if (s2(i)==s2(i+1)) cycle\n count=count+1\n end do\n\n print *, count\n stop\n\n\n\n contains\n subroutine sort_quick(num, a, b)\n implicit none\n integer, intent(in) :: num\n character(10), intent(in):: a(num)\n character(10), intent(out) :: b(num)\n integer:: i, j\n character(10)::w\n\n ! 配列コピー\n b(:)=a(:)\n\n ! ソート処理\n call quick(1, num, num, b)\n end subroutine sort_quick\n\n recursive subroutine quick(left, right, num, a)\n implicit none\n integer, intent(in) :: left, right, num\n character(10), intent(inout) :: a(num)\n integer :: i, j\n character(10)::s, w\n\n if (left >= right) return\n\n ! 最左項を軸に. 軸より小さいグループ. 軸より大きいグループ.\n s = a(left)\n i = left\n j = right + 1\n do\n i = i + 1\n do while (a(i) < s)\n i = i + 1\n end do\n j = j - 1\n do while (a(j) > s)\n j = j - 1\n end do\n if (i >= j) exit\n ! スワップ\n w = a(i)\n a(i) = a(j)\n a(j) = w\n end do\n\n ! 軸を正しい位置に挿入\n a(left) = a(j)\n a(j) = s\n call quick(left, j - 1, num, a) ! 左部分列に対する再帰呼び出し\n call quick(j + 1, right, num, a) ! 右部分列に対する再帰呼び出し\n end subroutine quick\n\n end program abc164c", "language": "Fortran", "metadata": {"date": 1587955048, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Fortran/s295432635.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s295432635", "user_id": "u792534719"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " program abc164c\n implicit none\n integer::n\n character(10),allocatable::s1(:),s2(:) !元の配列、ソート後の配列\n integer::i,j,count\n integer,parameter::p=100\n\n read *, n\n allocate(s1(n),s2(n))\n do i=1,n\n read *,s1(i)\n end do\n\n do i=1,p\n call sort_quick(n, s1, s2)\n end do\n\n count=1\n do i=1,n-1\n if (s2(i)==s2(i+1)) cycle\n count=count+1\n end do\n\n print *, count\n stop\n\n\n\n contains\n subroutine sort_quick(num, a, b)\n implicit none\n integer, intent(in) :: num\n character(10), intent(in):: a(num)\n character(10), intent(out) :: b(num)\n integer:: i, j\n character(10)::w\n\n ! 配列コピー\n b(:)=a(:)\n\n ! ソート処理\n call quick(1, num, num, b)\n end subroutine sort_quick\n\n recursive subroutine quick(left, right, num, a)\n implicit none\n integer, intent(in) :: left, right, num\n character(10), intent(inout) :: a(num)\n integer :: i, j\n character(10)::s, w\n\n if (left >= right) return\n\n ! 最左項を軸に. 軸より小さいグループ. 軸より大きいグループ.\n s = a(left)\n i = left\n j = right + 1\n do\n i = i + 1\n do while (a(i) < s)\n i = i + 1\n end do\n j = j - 1\n do while (a(j) > s)\n j = j - 1\n end do\n if (i >= j) exit\n ! スワップ\n w = a(i)\n a(i) = a(j)\n a(j) = w\n end do\n\n ! 軸を正しい位置に挿入\n a(left) = a(j)\n a(j) = s\n call quick(left, j - 1, num, a) ! 左部分列に対する再帰呼び出し\n call quick(j + 1, right, num, a) ! 右部分列に対する再帰呼び出し\n end subroutine quick\n\n end program abc164c", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2092, "cpu_time_ms": 2205, "memory_kb": 6536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s230306835", "group_id": "codeNet:p02701", "input_text": "module treap\n implicit none\n type node\n type(node), pointer :: left => null(), right => null()\n character(10) :: key\n integer :: val\n integer :: pri ! min-heap\n integer :: cnt = 1\n end type node\n\n contains\n\n subroutine update(root)\n implicit none\n type(node), pointer, intent(in) :: root\n root%cnt = my_count(root%left) + my_count(root%right) + 1\n end subroutine update\n\n function my_count(root)\n implicit none\n type(node), pointer, intent(in) :: root\n integer :: my_count\n if (associated(root)) then\n my_count = root%cnt\n else\n my_count = 0\n end if\n end function my_count\n\n function rotate_ccw(root)\n implicit none\n type(node), pointer, intent(in) :: root\n type(node), pointer :: tmp, rotate_ccw\n if (.not. associated(root%right)) stop 1\n tmp => root%right\n root%right => tmp%left\n tmp%left => root\n rotate_ccw => tmp\n call update(root)\n call update(tmp)\n end function rotate_ccw\n\n function rotate_cw(root)\n implicit none\n type(node), pointer, intent(in) :: root\n type(node), pointer :: tmp, rotate_cw\n if (.not. associated(root%left)) stop 1\n tmp => root%left\n root%left => tmp%right\n tmp%right => root\n rotate_cw => tmp\n call update(root)\n call update(tmp)\n end function rotate_cw\n\n recursive function insert(root, key, val, pri) result(res)\n implicit none\n type(node), pointer, intent(in) :: root\n integer, intent(in) :: pri\n character(10), intent(in) :: key\n integer, intent(in) :: val\n type(node), pointer :: res\n\n if (.not. associated(root)) then\n allocate(res)\n res%key = key\n res%pri = pri\n res%val = val\n else\n res => root\n if (key > root%key) then\n root%right => insert(root%right, key, val, pri)\n call update(root)\n if (root%pri > root%right%pri) then\n res => rotate_ccw(res)\n end if\n else\n root%left => insert(root%left, key, val, pri)\n call update(root)\n if (root%pri > root%left%pri) then\n res => rotate_cw(res)\n end if\n end if\n end if\n end function insert\n\n recursive function erase(root, key) result(res)\n implicit none\n type(node), pointer, intent(in) :: root\n character(10), intent(in) :: key\n type(node), pointer :: res, tmp\n\n if (.not. associated(root)) then\n print *, \"Erase failed\"\n stop 1\n end if\n\n if (key < root%key) then\n root%left => erase(root%left, key)\n res => root\n else if (key > root%key) then\n root%right => erase(root%right, key)\n res => root\n else\n if ((.not. associated(root%left)) .or. (.not. associated(root%right))) then\n tmp => root\n if (.not. associated(root%left)) then\n res => root%right\n else\n res => root%left\n end if\n deallocate(tmp)\n else\n if (root%left%pri < root%right%pri) then\n res => rotate_ccw(root)\n res%left => erase(res%left, key)\n else\n res => rotate_cw(root)\n res%right => erase(res%right, key)\n end if\n end if\n end if\n if (associated(res)) call update(res)\n end function erase\n\n recursive function find_node(root, key) result(res)\n implicit none\n type(node), pointer, intent(in) :: root\n character(10), intent(in) :: key\n type(node), pointer :: res\n if (.not. associated(root)) then\n res => null()\n else if (root%key == key) then\n res => root\n else if (key < root%key) then\n res => find_node(root%left, key)\n else\n res => find_node(root%right, key)\n end if\n end function find_node\n\n recursive function kth_node(root, k) result(res)\n implicit none\n type(node), pointer, intent(in) :: root\n integer, intent(in) :: k\n type(node), pointer :: res\n if (.not. associated(root)) then\n res => null()\n else if (k <= my_count(root%left)) then\n res => kth_node(root%left, k)\n else if (k == my_count(root%left) + 1) then\n res => root\n else\n res => kth_node(root%right, k - my_count(root%left) - 1)\n end if\n end function kth_node\n\n recursive subroutine delete_all(root)\n implicit none\n type(node), pointer, intent(inout) :: root\n if (.not. associated(root)) return\n\n call delete_all(root%left)\n call delete_all(root%right)\n deallocate(root)\n nullify(root)\n end subroutine delete_all\n\n recursive subroutine inorder(root, keys, vals, counter)\n implicit none\n type(node), pointer, intent(in) :: root\n character(10), intent(inout) :: keys(:)\n integer, intent(inout) :: vals(:)\n integer, intent(inout) :: counter\n if (.not. associated(root)) return\n\n call inorder(root%left, keys, vals, counter)\n counter = counter + 1\n keys(counter) = root%key\n vals(counter) = root%val\n call inorder(root%right, keys, vals, counter)\n end subroutine inorder\nend module treap\n\nmodule dictionary\n use treap\n implicit none\n\n type dict\n type(node), pointer :: root => null()\n integer :: randstate = 1231767121\n ! contains\n ! final :: destruct_dict\n end type dict\n\n contains\n\n pure function xorshift32(i)\n implicit none\n integer(4), intent(in) :: i\n integer(4) :: xorshift32\n if (i == 0) then\n xorshift32 = 1231767121\n else\n xorshift32 = i\n end if\n xorshift32 = ieor(xorshift32, ishft(xorshift32, 13))\n xorshift32 = ieor(xorshift32, ishft(xorshift32, -17))\n xorshift32 = ieor(xorshift32, ishft(xorshift32, 15))\n end function xorshift32\n\n function get_val(t, key)\n implicit none\n type(dict), intent(in) :: t\n character(10), intent(in) :: key\n type(node), pointer :: nd\n integer :: get_val\n nd => find_node(t%root, key)\n if (.not. associated(nd)) then\n stop 105\n end if\n get_val = nd%val\n end function get_val\n\n function exists(t, key)\n implicit none\n type(dict), intent(in) :: t\n character(10), intent(in) :: key\n type(node), pointer :: nd\n logical :: exists\n nd => find_node(t%root, key)\n exists = (associated(nd))\n end function exists\n\n subroutine insert_or_assign(t, key, val)\n implicit none\n type(dict), intent(inout) :: t\n character(10), intent(in) :: key\n integer, intent(in) :: val\n type(node), pointer :: nd\n nd => find_node(t%root, key)\n if (associated(nd)) then\n nd%val = val\n else ! This implementation is not optimal\n t%root => insert(t%root, key, val, t%randstate)\n t%randstate = xorshift32(t%randstate)\n end if\n end subroutine insert_or_assign\n\n subroutine remove(t, key)\n implicit none\n type(dict), intent(inout) :: t\n character(10), intent(in) :: key\n t%root => erase(t%root, key)\n end subroutine remove\n\n function get_kth_key(t, k)\n implicit none\n type(dict), intent(in) :: t\n integer, intent(in) :: k\n type(node), pointer :: res\n character(10) :: get_kth_key\n if (k < 1 .or. k > my_count(t%root)) then\n print *, \"get_kth_key failed\"\n stop 2\n else\n res => kth_node(t%root, k)\n get_kth_key = res%key\n end if\n end function get_kth_key\n\n subroutine get_keys_vals(t, keys, vals, n)\n implicit none\n type(dict), intent(in) :: t\n integer, intent(in) :: n\n character(10), intent(out) :: keys(n)\n integer, intent(out) :: vals(n)\n integer :: counter\n if (my_count(t%root) /= n) stop 5\n counter = 0\n call inorder(t%root, keys, vals, counter)\n end subroutine get_keys_vals\n\n function get_size(t)\n implicit none\n type(dict), intent(in) :: t\n integer :: get_size\n get_size = my_count(t%root)\n end function get_size\n\n subroutine destruct_dict(t)\n implicit none\n type(dict), intent(inout) :: t\n call delete_all(t%root)\n end subroutine destruct_dict\n\nend module dictionary\n\nprogram main\n use dictionary\n implicit none\n integer :: n, i, cnts(200000), mc, k\n character(10) :: s(200000)\n type(dict) :: cnt\n\n read (*, *) n\n do i = 1, n\n read (*, *) s(i)\n if (exists(cnt, s(i))) then\n call insert_or_assign(cnt, s(i), 1 + get_val(cnt, s(i)))\n else\n call insert_or_assign(cnt, s(i), 1)\n end if\n end do\n k = get_size(cnt)\n write(*,*)k\nend program main\n", "language": "Fortran", "metadata": {"date": 1587953599, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Fortran/s230306835.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s230306835", "user_id": "u359178469"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "module treap\n implicit none\n type node\n type(node), pointer :: left => null(), right => null()\n character(10) :: key\n integer :: val\n integer :: pri ! min-heap\n integer :: cnt = 1\n end type node\n\n contains\n\n subroutine update(root)\n implicit none\n type(node), pointer, intent(in) :: root\n root%cnt = my_count(root%left) + my_count(root%right) + 1\n end subroutine update\n\n function my_count(root)\n implicit none\n type(node), pointer, intent(in) :: root\n integer :: my_count\n if (associated(root)) then\n my_count = root%cnt\n else\n my_count = 0\n end if\n end function my_count\n\n function rotate_ccw(root)\n implicit none\n type(node), pointer, intent(in) :: root\n type(node), pointer :: tmp, rotate_ccw\n if (.not. associated(root%right)) stop 1\n tmp => root%right\n root%right => tmp%left\n tmp%left => root\n rotate_ccw => tmp\n call update(root)\n call update(tmp)\n end function rotate_ccw\n\n function rotate_cw(root)\n implicit none\n type(node), pointer, intent(in) :: root\n type(node), pointer :: tmp, rotate_cw\n if (.not. associated(root%left)) stop 1\n tmp => root%left\n root%left => tmp%right\n tmp%right => root\n rotate_cw => tmp\n call update(root)\n call update(tmp)\n end function rotate_cw\n\n recursive function insert(root, key, val, pri) result(res)\n implicit none\n type(node), pointer, intent(in) :: root\n integer, intent(in) :: pri\n character(10), intent(in) :: key\n integer, intent(in) :: val\n type(node), pointer :: res\n\n if (.not. associated(root)) then\n allocate(res)\n res%key = key\n res%pri = pri\n res%val = val\n else\n res => root\n if (key > root%key) then\n root%right => insert(root%right, key, val, pri)\n call update(root)\n if (root%pri > root%right%pri) then\n res => rotate_ccw(res)\n end if\n else\n root%left => insert(root%left, key, val, pri)\n call update(root)\n if (root%pri > root%left%pri) then\n res => rotate_cw(res)\n end if\n end if\n end if\n end function insert\n\n recursive function erase(root, key) result(res)\n implicit none\n type(node), pointer, intent(in) :: root\n character(10), intent(in) :: key\n type(node), pointer :: res, tmp\n\n if (.not. associated(root)) then\n print *, \"Erase failed\"\n stop 1\n end if\n\n if (key < root%key) then\n root%left => erase(root%left, key)\n res => root\n else if (key > root%key) then\n root%right => erase(root%right, key)\n res => root\n else\n if ((.not. associated(root%left)) .or. (.not. associated(root%right))) then\n tmp => root\n if (.not. associated(root%left)) then\n res => root%right\n else\n res => root%left\n end if\n deallocate(tmp)\n else\n if (root%left%pri < root%right%pri) then\n res => rotate_ccw(root)\n res%left => erase(res%left, key)\n else\n res => rotate_cw(root)\n res%right => erase(res%right, key)\n end if\n end if\n end if\n if (associated(res)) call update(res)\n end function erase\n\n recursive function find_node(root, key) result(res)\n implicit none\n type(node), pointer, intent(in) :: root\n character(10), intent(in) :: key\n type(node), pointer :: res\n if (.not. associated(root)) then\n res => null()\n else if (root%key == key) then\n res => root\n else if (key < root%key) then\n res => find_node(root%left, key)\n else\n res => find_node(root%right, key)\n end if\n end function find_node\n\n recursive function kth_node(root, k) result(res)\n implicit none\n type(node), pointer, intent(in) :: root\n integer, intent(in) :: k\n type(node), pointer :: res\n if (.not. associated(root)) then\n res => null()\n else if (k <= my_count(root%left)) then\n res => kth_node(root%left, k)\n else if (k == my_count(root%left) + 1) then\n res => root\n else\n res => kth_node(root%right, k - my_count(root%left) - 1)\n end if\n end function kth_node\n\n recursive subroutine delete_all(root)\n implicit none\n type(node), pointer, intent(inout) :: root\n if (.not. associated(root)) return\n\n call delete_all(root%left)\n call delete_all(root%right)\n deallocate(root)\n nullify(root)\n end subroutine delete_all\n\n recursive subroutine inorder(root, keys, vals, counter)\n implicit none\n type(node), pointer, intent(in) :: root\n character(10), intent(inout) :: keys(:)\n integer, intent(inout) :: vals(:)\n integer, intent(inout) :: counter\n if (.not. associated(root)) return\n\n call inorder(root%left, keys, vals, counter)\n counter = counter + 1\n keys(counter) = root%key\n vals(counter) = root%val\n call inorder(root%right, keys, vals, counter)\n end subroutine inorder\nend module treap\n\nmodule dictionary\n use treap\n implicit none\n\n type dict\n type(node), pointer :: root => null()\n integer :: randstate = 1231767121\n ! contains\n ! final :: destruct_dict\n end type dict\n\n contains\n\n pure function xorshift32(i)\n implicit none\n integer(4), intent(in) :: i\n integer(4) :: xorshift32\n if (i == 0) then\n xorshift32 = 1231767121\n else\n xorshift32 = i\n end if\n xorshift32 = ieor(xorshift32, ishft(xorshift32, 13))\n xorshift32 = ieor(xorshift32, ishft(xorshift32, -17))\n xorshift32 = ieor(xorshift32, ishft(xorshift32, 15))\n end function xorshift32\n\n function get_val(t, key)\n implicit none\n type(dict), intent(in) :: t\n character(10), intent(in) :: key\n type(node), pointer :: nd\n integer :: get_val\n nd => find_node(t%root, key)\n if (.not. associated(nd)) then\n stop 105\n end if\n get_val = nd%val\n end function get_val\n\n function exists(t, key)\n implicit none\n type(dict), intent(in) :: t\n character(10), intent(in) :: key\n type(node), pointer :: nd\n logical :: exists\n nd => find_node(t%root, key)\n exists = (associated(nd))\n end function exists\n\n subroutine insert_or_assign(t, key, val)\n implicit none\n type(dict), intent(inout) :: t\n character(10), intent(in) :: key\n integer, intent(in) :: val\n type(node), pointer :: nd\n nd => find_node(t%root, key)\n if (associated(nd)) then\n nd%val = val\n else ! This implementation is not optimal\n t%root => insert(t%root, key, val, t%randstate)\n t%randstate = xorshift32(t%randstate)\n end if\n end subroutine insert_or_assign\n\n subroutine remove(t, key)\n implicit none\n type(dict), intent(inout) :: t\n character(10), intent(in) :: key\n t%root => erase(t%root, key)\n end subroutine remove\n\n function get_kth_key(t, k)\n implicit none\n type(dict), intent(in) :: t\n integer, intent(in) :: k\n type(node), pointer :: res\n character(10) :: get_kth_key\n if (k < 1 .or. k > my_count(t%root)) then\n print *, \"get_kth_key failed\"\n stop 2\n else\n res => kth_node(t%root, k)\n get_kth_key = res%key\n end if\n end function get_kth_key\n\n subroutine get_keys_vals(t, keys, vals, n)\n implicit none\n type(dict), intent(in) :: t\n integer, intent(in) :: n\n character(10), intent(out) :: keys(n)\n integer, intent(out) :: vals(n)\n integer :: counter\n if (my_count(t%root) /= n) stop 5\n counter = 0\n call inorder(t%root, keys, vals, counter)\n end subroutine get_keys_vals\n\n function get_size(t)\n implicit none\n type(dict), intent(in) :: t\n integer :: get_size\n get_size = my_count(t%root)\n end function get_size\n\n subroutine destruct_dict(t)\n implicit none\n type(dict), intent(inout) :: t\n call delete_all(t%root)\n end subroutine destruct_dict\n\nend module dictionary\n\nprogram main\n use dictionary\n implicit none\n integer :: n, i, cnts(200000), mc, k\n character(10) :: s(200000)\n type(dict) :: cnt\n\n read (*, *) n\n do i = 1, n\n read (*, *) s(i)\n if (exists(cnt, s(i))) then\n call insert_or_assign(cnt, s(i), 1 + get_val(cnt, s(i)))\n else\n call insert_or_assign(cnt, s(i), 1)\n end if\n end do\n k = get_size(cnt)\n write(*,*)k\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 8183, "cpu_time_ms": 301, "memory_kb": 13984}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s274020722", "group_id": "codeNet:p02701", "input_text": "program c1\n\n implicit none\n\n integer :: n,i,j,k,l\n character,allocatable :: s(:)*10\n\n read*,n\n\n allocate(s(n))\n\n read*,s\n\n k=n\n do i=1,n\n do j=1,n-i\n if(s(i+j)==s(i)) s(i+j)='0'\n end do\n end do\n \n do l=1,n\n if(s(l)=='0') k=k-1\n end do\n\n if(k==0) k=1\n\n print*,k\n\n\nend program c1\n \n ", "language": "Fortran", "metadata": {"date": 1587953144, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02701.html", "problem_id": "p02701", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02701/input.txt", "sample_output_relpath": "derived/input_output/data/p02701/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02701/Fortran/s274020722.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s274020722", "user_id": "u882765852"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program c1\n\n implicit none\n\n integer :: n,i,j,k,l\n character,allocatable :: s(:)*10\n\n read*,n\n\n allocate(s(n))\n\n read*,s\n\n k=n\n do i=1,n\n do j=1,n-i\n if(s(i+j)==s(i)) s(i+j)='0'\n end do\n end do\n \n do l=1,n\n if(s(l)=='0') k=k-1\n end do\n\n if(k==0) k=1\n\n print*,k\n\n\nend program c1\n \n ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "sample_input": "3\napple\norange\napple\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02701", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou drew lottery N times. In the i-th draw, you got an item of the kind represented by a string S_i.\n\nHow many kinds of items did you get?\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS_i consists of lowercase English letters and has a length between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint the number of kinds of items you got.\n\nSample Input 1\n\n3\napple\norange\napple\n\nSample Output 1\n\n2\n\nYou got two kinds of items: apple and orange.\n\nSample Input 2\n\n5\ngrape\ngrape\ngrape\ngrape\ngrape\n\nSample Output 2\n\n1\n\nSample Input 3\n\n4\naaaa\na\naaa\naa\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 2205, "memory_kb": 5148}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s035060515", "group_id": "codeNet:p02704", "input_text": "program i_hate_matrix_construction\n implicit none\n integer, parameter :: intkind = 16\n integer :: n, i, j, k\n integer, dimension(500) :: s = 0, t = 0, p = 0, q = 0, x = 0, y = 0\n integer(intkind), dimension(500) :: u = 0, v = 0\n integer(intkind), dimension(500, 500) :: a = 0\n read(*,*) n\n read(*,*) s(1:n)\n read(*,*) t(1:n)\n read(*,*) u(1:n)\n read(*,*) v(1:n)\n do k = 0, 64\n do i = 1, n\n p(i) = pattern(s(i), btest(u(i), k))\n q(i) = pattern(t(i), btest(v(i), k))\n end do\n x(1:n) = 0\n y(1:n) = 0\n do i = 1, n\n do j = 1, n\n if (p(i) + q(j) == 1) call halt()\n if (p(i) == 1 .or. q(j) == 1 .or. p(i) + q(j) == 6) then\n a(i, j) = ibset(a(i, j), k)\n x(i) = x(i) + 1\n y(j) = y(j) + 1\n end if\n end do\n end do\n j = 1\n do i = 1, n\n if (p(i) == 2 .and. x(i) == n) call halt()\n if (.not.(p(i) == 3 .and. x(i) == 0)) cycle\n do while (j <= n .and. .not.(q(j) == 2 .and. y(j) < n - 1))\n j = j + 1\n end do\n if (j > n) call halt()\n a(i, j) = ibset(a(i, j), k)\n x(i) = x(i) + 1\n y(j) = y(j) + 1\n end do\n i = 1\n do j = 1, n\n if (q(j) == 2 .and. y(j) == n) call halt()\n if (.not.(q(j) == 3 .and. y(j) == 0)) cycle\n do while (i <= n .and. .not.(p(i) == 2 .and. x(i) < n - 1))\n i = i + 1\n end do\n if (i > n) call halt()\n a(i, j) = ibset(a(i, j), k)\n x(i) = x(i) + 1\n y(j) = y(j) + 1\n end do\n end do\n do i = 1, n\n write(*,'(i0)',advance='no') a(i, 1)\n do j = 2, n\n write(*,'(x,i0)',advance='no') a(i, j)\n end do\n write(*,*)\n end do\ncontains\n integer function pattern(s, b) result(res)\n integer, intent(in) :: s\n logical, intent(in) :: b\n ! 0: all 0\n ! 1: all 1\n ! 2: any 0\n ! 3: any 1\n res = mod(2 * s + merge(0, 1, b) + 1, 4)\n end\n subroutine halt()\n write(*,'(i0)') -1\n stop\n end\nend program i_hate_matrix_construction", "language": "Fortran", "metadata": {"date": 1596618622, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02704.html", "problem_id": "p02704", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02704/input.txt", "sample_output_relpath": "derived/input_output/data/p02704/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02704/Fortran/s035060515.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s035060515", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1 1\n1 0\n", "input_to_evaluate": "program i_hate_matrix_construction\n implicit none\n integer, parameter :: intkind = 16\n integer :: n, i, j, k\n integer, dimension(500) :: s = 0, t = 0, p = 0, q = 0, x = 0, y = 0\n integer(intkind), dimension(500) :: u = 0, v = 0\n integer(intkind), dimension(500, 500) :: a = 0\n read(*,*) n\n read(*,*) s(1:n)\n read(*,*) t(1:n)\n read(*,*) u(1:n)\n read(*,*) v(1:n)\n do k = 0, 64\n do i = 1, n\n p(i) = pattern(s(i), btest(u(i), k))\n q(i) = pattern(t(i), btest(v(i), k))\n end do\n x(1:n) = 0\n y(1:n) = 0\n do i = 1, n\n do j = 1, n\n if (p(i) + q(j) == 1) call halt()\n if (p(i) == 1 .or. q(j) == 1 .or. p(i) + q(j) == 6) then\n a(i, j) = ibset(a(i, j), k)\n x(i) = x(i) + 1\n y(j) = y(j) + 1\n end if\n end do\n end do\n j = 1\n do i = 1, n\n if (p(i) == 2 .and. x(i) == n) call halt()\n if (.not.(p(i) == 3 .and. x(i) == 0)) cycle\n do while (j <= n .and. .not.(q(j) == 2 .and. y(j) < n - 1))\n j = j + 1\n end do\n if (j > n) call halt()\n a(i, j) = ibset(a(i, j), k)\n x(i) = x(i) + 1\n y(j) = y(j) + 1\n end do\n i = 1\n do j = 1, n\n if (q(j) == 2 .and. y(j) == n) call halt()\n if (.not.(q(j) == 3 .and. y(j) == 0)) cycle\n do while (i <= n .and. .not.(p(i) == 2 .and. x(i) < n - 1))\n i = i + 1\n end do\n if (i > n) call halt()\n a(i, j) = ibset(a(i, j), k)\n x(i) = x(i) + 1\n y(j) = y(j) + 1\n end do\n end do\n do i = 1, n\n write(*,'(i0)',advance='no') a(i, 1)\n do j = 2, n\n write(*,'(x,i0)',advance='no') a(i, j)\n end do\n write(*,*)\n end do\ncontains\n integer function pattern(s, b) result(res)\n integer, intent(in) :: s\n logical, intent(in) :: b\n ! 0: all 0\n ! 1: all 1\n ! 2: any 0\n ! 3: any 1\n res = mod(2 * s + merge(0, 1, b) + 1, 4)\n end\n subroutine halt()\n write(*,'(i0)') -1\n stop\n end\nend program i_hate_matrix_construction", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are an integer N and arrays S, T, U, and V, each of length N.\nConstruct an N×N matrix a that satisfy the following conditions:\n\na_{i,j} is an integer.\n\n0 \\leq a_{i,j} \\lt 2^{64}.\n\nIf S_{i} = 0, the bitwise AND of the elements in the i-th row is U_{i}.\n\nIf S_{i} = 1, the bitwise OR of the elements in the i-th row is U_{i}.\n\nIf T_{i} = 0, the bitwise AND of the elements in the i-th column is V_{i}.\n\nIf T_{i} = 1, the bitwise OR of the elements in the i-th column is V_{i}.\n\nHowever, there may be cases where no matrix satisfies the conditions.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 500\n\n0 \\leq S_{i} \\leq 1\n\n0 \\leq T_{i} \\leq 1\n\n0 \\leq U_{i} \\lt 2^{64}\n\n0 \\leq V_{i} \\lt 2^{64}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_{1} S_{2} ... S_{N}\nT_{1} T_{2} ... T_{N}\nU_{1} U_{2} ... U_{N}\nV_{1} V_{2} ... V_{N}\n\nOutput\n\nIf there exists a matrix that satisfies the conditions, print one such matrix in the following format:\n\na_{1,1} ... a_{1,N}\n:\na_{N,1} ... a_{N,N}\n\nNote that any matrix satisfying the conditions is accepted.\n\nIf no matrix satisfies the conditions, print -1.\n\nSample Input 1\n\n2\n0 1\n1 0\n1 1\n1 0\n\nSample Output 1\n\n1 1\n1 0\n\nIn Sample Input 1, we need to find a matrix such that:\n\nthe bitwise AND of the elements in the 1-st row is 1;\n\nthe bitwise OR of the elements in the 2-nd row is 1;\n\nthe bitwise OR of the elements in the 1-st column is 1;\n\nthe bitwise AND of the elements in the 2-nd column is 0.\n\nSample Input 2\n\n2\n1 1\n1 0\n15 15\n15 11\n\nSample Output 2\n\n15 11\n15 11", "sample_input": "2\n0 1\n1 0\n1 1\n1 0\n"}, "reference_outputs": ["1 1\n1 0\n"], "source_document_id": "p02704", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are an integer N and arrays S, T, U, and V, each of length N.\nConstruct an N×N matrix a that satisfy the following conditions:\n\na_{i,j} is an integer.\n\n0 \\leq a_{i,j} \\lt 2^{64}.\n\nIf S_{i} = 0, the bitwise AND of the elements in the i-th row is U_{i}.\n\nIf S_{i} = 1, the bitwise OR of the elements in the i-th row is U_{i}.\n\nIf T_{i} = 0, the bitwise AND of the elements in the i-th column is V_{i}.\n\nIf T_{i} = 1, the bitwise OR of the elements in the i-th column is V_{i}.\n\nHowever, there may be cases where no matrix satisfies the conditions.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 500\n\n0 \\leq S_{i} \\leq 1\n\n0 \\leq T_{i} \\leq 1\n\n0 \\leq U_{i} \\lt 2^{64}\n\n0 \\leq V_{i} \\lt 2^{64}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_{1} S_{2} ... S_{N}\nT_{1} T_{2} ... T_{N}\nU_{1} U_{2} ... U_{N}\nV_{1} V_{2} ... V_{N}\n\nOutput\n\nIf there exists a matrix that satisfies the conditions, print one such matrix in the following format:\n\na_{1,1} ... a_{1,N}\n:\na_{N,1} ... a_{N,N}\n\nNote that any matrix satisfying the conditions is accepted.\n\nIf no matrix satisfies the conditions, print -1.\n\nSample Input 1\n\n2\n0 1\n1 0\n1 1\n1 0\n\nSample Output 1\n\n1 1\n1 0\n\nIn Sample Input 1, we need to find a matrix such that:\n\nthe bitwise AND of the elements in the 1-st row is 1;\n\nthe bitwise OR of the elements in the 2-nd row is 1;\n\nthe bitwise OR of the elements in the 1-st column is 1;\n\nthe bitwise AND of the elements in the 2-nd column is 0.\n\nSample Input 2\n\n2\n1 1\n1 0\n15 15\n15 11\n\nSample Output 2\n\n15 11\n15 11", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1959, "cpu_time_ms": 203, "memory_kb": 9636}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s318191931", "group_id": "codeNet:p02706", "input_text": "program ABC163_B\n integer,allocatable::A(:)\n read(*,*)N,M\n allocate(A(M))\n read(*,*)A\n if(N >= sum(A)) then\n write(*,*)N-sum(A)\n else\n write(*,*)'-1'\n end if\nend program ABC163_B", "language": "Fortran", "metadata": {"date": 1587345430, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Fortran/s318191931.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s318191931", "user_id": "u359178469"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program ABC163_B\n integer,allocatable::A(:)\n read(*,*)N,M\n allocate(A(M))\n read(*,*)A\n if(N >= sum(A)) then\n write(*,*)N-sum(A)\n else\n write(*,*)'-1'\n end if\nend program ABC163_B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 193, "cpu_time_ms": 6, "memory_kb": 2968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s278027991", "group_id": "codeNet:p02706", "input_text": "program main\n implicit none\n integer n,m\n integer,allocatable::a(:)\n read(*,*) n,m\n allocate(a(m))\n read(*,*) a(1:m)\n n=n-sum(a(1:m))\n if(n>=0) write(*,*) n \n if(n<0) write(*,*) \"-1\"\nend program main\n\n", "language": "Fortran", "metadata": {"date": 1587345094, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02706.html", "problem_id": "p02706", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02706/input.txt", "sample_output_relpath": "derived/input_output/data/p02706/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02706/Fortran/s278027991.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s278027991", "user_id": "u440779866"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program main\n implicit none\n integer n,m\n integer,allocatable::a(:)\n read(*,*) n,m\n allocate(a(m))\n read(*,*) a(1:m)\n n=n-sum(a(1:m))\n if(n>=0) write(*,*) n \n if(n<0) write(*,*) \"-1\"\nend program main\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "sample_input": "41 2\n5 6\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02706", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N days of summer vacation.\n\nHis teacher gave him M summer assignments. It will take A_i days for him to do the i-th assignment.\n\nHe cannot do multiple assignments on the same day, or hang out on a day he does an assignment.\n\nWhat is the maximum number of days Takahashi can hang out during the vacation if he finishes all the assignments during this vacation?\n\nIf Takahashi cannot finish all the assignments during the vacation, print -1 instead.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\n1 \\leq M \\leq 10^4\n\n1 \\leq A_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 ... A_M\n\nOutput\n\nPrint the maximum number of days Takahashi can hang out during the vacation, or -1.\n\nSample Input 1\n\n41 2\n5 6\n\nSample Output 1\n\n30\n\nFor example, he can do the first assignment on the first 5 days, hang out on the next 30 days, and do the second assignment on the last 6 days of the vacation. In this way, he can safely spend 30 days hanging out.\n\nSample Input 2\n\n10 2\n5 6\n\nSample Output 2\n\n-1\n\nHe cannot finish his assignments.\n\nSample Input 3\n\n11 2\n5 6\n\nSample Output 3\n\n0\n\nHe can finish his assignments, but he will have no time to hang out.\n\nSample Input 4\n\n314 15\n9 26 5 35 8 9 79 3 23 8 46 2 6 43 3\n\nSample Output 4\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 228, "cpu_time_ms": 7, "memory_kb": 2872}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s628199995", "group_id": "codeNet:p02707", "input_text": "program main\ninteger :: n\ninteger,allocatable :: a(:),cnt(:)\n\nread(*,*)n\nallocate(a(n),cnt(n))\nread(*,*)a(1:n-1)\ncnt = 0\ndo i = 1,n\ncnt(a(i)) = cnt(a(i)) + 1\nend do\ndo i = 1,n\nwrite(*,*)cnt(i)\nend do\nend program main", "language": "Fortran", "metadata": {"date": 1589350357, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Fortran/s628199995.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s628199995", "user_id": "u850779832"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program main\ninteger :: n\ninteger,allocatable :: a(:),cnt(:)\n\nread(*,*)n\nallocate(a(n),cnt(n))\nread(*,*)a(1:n-1)\ncnt = 0\ndo i = 1,n\ncnt(a(i)) = cnt(a(i)) + 1\nend do\ndo i = 1,n\nwrite(*,*)cnt(i)\nend do\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 217, "cpu_time_ms": 83, "memory_kb": 5088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s972657263", "group_id": "codeNet:p02707", "input_text": "program main\n implicit none\n integer :: N\n integer,allocatable :: A(:)\n integer,allocatable :: out(:)\n integer :: i\n read(*,*) N\n allocate(A(N))\n read(*,*) A(2:)\n allocate(out(N))\n out(:) = 0\n do i = 2,N\n out(A(i)) = out(A(i)) + 1\n end do\n do i = 1,N\n write(*,'(i0)') out(i)\n end do\nend program main\n", "language": "Fortran", "metadata": {"date": 1589204048, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Fortran/s972657263.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s972657263", "user_id": "u886432251"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program main\n implicit none\n integer :: N\n integer,allocatable :: A(:)\n integer,allocatable :: out(:)\n integer :: i\n read(*,*) N\n allocate(A(N))\n read(*,*) A(2:)\n allocate(out(N))\n out(:) = 0\n do i = 2,N\n out(A(i)) = out(A(i)) + 1\n end do\n do i = 1,N\n write(*,'(i0)') out(i)\n end do\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 322, "cpu_time_ms": 89, "memory_kb": 4608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s409246752", "group_id": "codeNet:p02707", "input_text": "program main\n implicit none\n integer n,i,j,p\n integer,allocatable::a(:)\n read(*,*) n\n allocate(a(n))\n read(*,*) a(2:n)\n do i=1,n\n p=0\n do j=i+1,n\n if(a(j)-i>0) exit\n if(a(j)-i==0) p=p+1\n end do\n write(*,*) p \n end do\n deallocate(a)\nend program main\n", "language": "Fortran", "metadata": {"date": 1587350084, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Fortran/s409246752.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s409246752", "user_id": "u440779866"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program main\n implicit none\n integer n,i,j,p\n integer,allocatable::a(:)\n read(*,*) n\n allocate(a(n))\n read(*,*) a(2:n)\n do i=1,n\n p=0\n do j=i+1,n\n if(a(j)-i>0) exit\n if(a(j)-i==0) p=p+1\n end do\n write(*,*) p \n end do\n deallocate(a)\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 326, "cpu_time_ms": 2205, "memory_kb": 4316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s212118025", "group_id": "codeNet:p02707", "input_text": "program hello\nimplicit none\n\n\ninteger N,i,j\ninteger,allocatable,dimension(:)::A\ninteger,allocatable,dimension(:)::cont\n\nread*,N\nallocate(A(N-1),cont(N-1))\nread*,A\n\ndo j = 1,N\n cont(j) = 0\nend do\n\ndo i = 1,N\ndo j = 1,N\n\tif (A(i) == j) then \n \tcont(j) = cont(j) +1 \n endif\nend do\nend do\n\ndo i = 1,N\n\twrite(*,*)cont(i)\nend do\n\n\nend program Hello", "language": "Fortran", "metadata": {"date": 1587348344, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Fortran/s212118025.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s212118025", "user_id": "u960165318"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program hello\nimplicit none\n\n\ninteger N,i,j\ninteger,allocatable,dimension(:)::A\ninteger,allocatable,dimension(:)::cont\n\nread*,N\nallocate(A(N-1),cont(N-1))\nread*,A\n\ndo j = 1,N\n cont(j) = 0\nend do\n\ndo i = 1,N\ndo j = 1,N\n\tif (A(i) == j) then \n \tcont(j) = cont(j) +1 \n endif\nend do\nend do\n\ndo i = 1,N\n\twrite(*,*)cont(i)\nend do\n\n\nend program Hello", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 348, "cpu_time_ms": 2205, "memory_kb": 4756}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s941949274", "group_id": "codeNet:p02707", "input_text": "program sample\nimplicit none\ninteger(8) N,A(200000),B(200000),i\nread(*,*) N\nread(*,*) (A(i),i=2,N)\ndo i=2,N\nB(A(i))=B(A(i))+1\nend do\ndo i=1,N\nwrite(*,'(i0)') B(i)\nend do\n\nstop\nend program sample", "language": "Fortran", "metadata": {"date": 1587346672, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Fortran/s941949274.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s941949274", "user_id": "u457263576"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program sample\nimplicit none\ninteger(8) N,A(200000),B(200000),i\nread(*,*) N\nread(*,*) (A(i),i=2,N)\ndo i=2,N\nB(A(i))=B(A(i))+1\nend do\ndo i=1,N\nwrite(*,'(i0)') B(i)\nend do\n\nstop\nend program sample", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 194, "cpu_time_ms": 88, "memory_kb": 6256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s888913455", "group_id": "codeNet:p02707", "input_text": "program problemC\n implicit none\n\ninteger :: NMAX,n\ninteger, allocatable :: A(:), man(:)\n\nread(*,*) NMAX\n\nallocate(A(NMAX-1), man(NMAX))\n\nread(*,*) A\n\nman(:)=0\n\ndo n=1, NMAX-1\n man(A(n))=man(A(n))+1\nend do\n\ndo n=1,NMAX\n write(*,*) man(n)\nend do\n\n\n\n\n\n\n\n\ndeallocate(A,man)\n\nend program\n", "language": "Fortran", "metadata": {"date": 1587345831, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Fortran/s888913455.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s888913455", "user_id": "u192320506"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program problemC\n implicit none\n\ninteger :: NMAX,n\ninteger, allocatable :: A(:), man(:)\n\nread(*,*) NMAX\n\nallocate(A(NMAX-1), man(NMAX))\n\nread(*,*) A\n\nman(:)=0\n\ndo n=1, NMAX-1\n man(A(n))=man(A(n))+1\nend do\n\ndo n=1,NMAX\n write(*,*) man(n)\nend do\n\n\n\n\n\n\n\n\ndeallocate(A,man)\n\nend program\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 286, "cpu_time_ms": 79, "memory_kb": 5116}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s270094151", "group_id": "codeNet:p02707", "input_text": "program management\n implicit none\n integer :: n, a(200000) = -1, i, b(200000) = 0\n read(*,*) n\n read(*,*) a(2:n)\n do i = 2, n\n b(a(i)) = b(a(i))+1\n end do\n do i = 1, n\n write(*,'(i0)') b(i)\n end do\nend program management", "language": "Fortran", "metadata": {"date": 1587345800, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02707.html", "problem_id": "p02707", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02707/input.txt", "sample_output_relpath": "derived/input_output/data/p02707/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02707/Fortran/s270094151.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s270094151", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "program management\n implicit none\n integer :: n, a(200000) = -1, i, b(200000) = 0\n read(*,*) n\n read(*,*) a(2:n)\n do i = 2, n\n b(a(i)) = b(a(i))+1\n end do\n do i = 1, n\n write(*,'(i0)') b(i)\n end do\nend program management", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "sample_input": "5\n1 1 2 2\n"}, "reference_outputs": ["2\n2\n0\n0\n0\n"], "source_document_id": "p02707", "source_text": "Score : 300 points\n\nProblem Statement\n\nA company has N members, who are assigned ID numbers 1, ..., N.\n\nEvery member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.\n\nWhen a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.\n\nYou are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i < i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_2 ... A_N\n\nOutput\n\nFor each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.\n\nSample Input 1\n\n5\n1 1 2 2\n\nSample Output 1\n\n2\n2\n0\n0\n0\n\nThe member numbered 1 has two immediate subordinates: the members numbered 2 and 3.\n\nThe member numbered 2 has two immediate subordinates: the members numbered 4 and 5.\n\nThe members numbered 3, 4, and 5 do not have immediate subordinates.\n\nSample Input 2\n\n10\n1 1 1 1 1 1 1 1 1\n\nSample Output 2\n\n9\n0\n0\n0\n0\n0\n0\n0\n0\n0\n\nSample Input 3\n\n7\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n1\n1\n1\n1\n1\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 234, "cpu_time_ms": 88, "memory_kb": 4604}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s901960006", "group_id": "codeNet:p02708", "input_text": "program sum_of_large_numbers\n implicit none\n integer(8), parameter :: m = 1000000007_8, h = (m+1)/2, s = (m+1)/6\n integer(8) :: n, k, i\n read(*,*) n, k\n write(*,'(i0)') modulo(f(n+1)-f(k-1),m)\ncontains\n integer(8) function f(i)\n integer(8), intent(in) :: i\n f = i*mod((n+1)*mod(h*(i+1),m)-mod(s*mod((i+1)*(i*2+1),m),m)+1,m)\n end\nend program sum_of_large_numbers", "language": "Fortran", "metadata": {"date": 1587358362, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02708.html", "problem_id": "p02708", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02708/input.txt", "sample_output_relpath": "derived/input_output/data/p02708/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02708/Fortran/s901960006.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s901960006", "user_id": "u506403362"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program sum_of_large_numbers\n implicit none\n integer(8), parameter :: m = 1000000007_8, h = (m+1)/2, s = (m+1)/6\n integer(8) :: n, k, i\n read(*,*) n, k\n write(*,'(i0)') modulo(f(n+1)-f(k-1),m)\ncontains\n integer(8) function f(i)\n integer(8), intent(in) :: i\n f = i*mod((n+1)*mod(h*(i+1),m)-mod(s*mod((i+1)*(i*2+1),m),m)+1,m)\n end\nend program sum_of_large_numbers", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02708", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 374, "cpu_time_ms": 1, "memory_kb": 2864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s539905722", "group_id": "codeNet:p02708", "input_text": "program sum_of_large_numbers\n implicit none\n integer(8), parameter :: md = 1000000007_8\n integer :: n, k, i\n integer(8) :: x = 0, l = -1, r\n read(*,*) n, k\n r = n\n do i = 1, n+1\n if (i >= k) x = modulo(x+r-l,md)\n l = mod(l+i,md)\n r = mod(r+(n-i),md)\n end do\n write(*,'(i0)') x\nend program sum_of_large_numbers", "language": "Fortran", "metadata": {"date": 1587350977, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02708.html", "problem_id": "p02708", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02708/input.txt", "sample_output_relpath": "derived/input_output/data/p02708/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02708/Fortran/s539905722.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s539905722", "user_id": "u506403362"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program sum_of_large_numbers\n implicit none\n integer(8), parameter :: md = 1000000007_8\n integer :: n, k, i\n integer(8) :: x = 0, l = -1, r\n read(*,*) n, k\n r = n\n do i = 1, n+1\n if (i >= k) x = modulo(x+r-l,md)\n l = mod(l+i,md)\n r = mod(r+(n-i),md)\n end do\n write(*,'(i0)') x\nend program sum_of_large_numbers", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02708", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 327, "cpu_time_ms": 5, "memory_kb": 2924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s727458100", "group_id": "codeNet:p02708", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,k,l,r,ans,i\n integer(int64),parameter:: md=1000000007\n\n read*, n,k\n\n l=0\n r=n\n ans=0\n do i=1,n+1\n if (i >= k) ans=mod(ans+(r+1-l),md)\n l=l+i\n r=r+(n-i)\n end do\n print*, ans\nend program name", "language": "Fortran", "metadata": {"date": 1587348154, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02708.html", "problem_id": "p02708", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02708/input.txt", "sample_output_relpath": "derived/input_output/data/p02708/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02708/Fortran/s727458100.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s727458100", "user_id": "u234636620"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,k,l,r,ans,i\n integer(int64),parameter:: md=1000000007\n\n read*, n,k\n\n l=0\n r=n\n ans=0\n do i=1,n+1\n if (i >= k) ans=mod(ans+(r+1-l),md)\n l=l+i\n r=r+(n-i)\n end do\n print*, ans\nend program name", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02708", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 325, "cpu_time_ms": 5, "memory_kb": 2876}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s408123389", "group_id": "codeNet:p02708", "input_text": "program problemA\n implicit none\n\n\ninteger(8) :: N,K, a,b,c,d,ans\n\nread(*,*) N,K\n\nans=0\nif (K<=N) then\n do while (K<=N)\n call ex(N-1,a)\n b=2*N-K+1\n call ex(N-K+1,c)\n call ex(K-1,d)\n ans=ans+a*b/(c*d)\n K=K+1\n end do\nend if\n\nans=ans+1\n\nif (K==1) ans=ans+1\n\nwrite(*,*) mod(ans,10**9+7)\n\n\n\n\n\n\n\n\n\n\nstop\nend program\n\n\nsubroutine ex(n,k)\n implicit none\n\n integer(8), intent(in) :: n\n integer(8), intent(out) :: k\n integer(8) :: l, i\n\n l=1\n i=n\n\n do while (i>0)\n l=l*i\n i=i-1\n end do\n\n k=l\n\n return\nend subroutine ex\n", "language": "Fortran", "metadata": {"date": 1587347901, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02708.html", "problem_id": "p02708", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02708/input.txt", "sample_output_relpath": "derived/input_output/data/p02708/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02708/Fortran/s408123389.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s408123389", "user_id": "u192320506"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program problemA\n implicit none\n\n\ninteger(8) :: N,K, a,b,c,d,ans\n\nread(*,*) N,K\n\nans=0\nif (K<=N) then\n do while (K<=N)\n call ex(N-1,a)\n b=2*N-K+1\n call ex(N-K+1,c)\n call ex(K-1,d)\n ans=ans+a*b/(c*d)\n K=K+1\n end do\nend if\n\nans=ans+1\n\nif (K==1) ans=ans+1\n\nwrite(*,*) mod(ans,10**9+7)\n\n\n\n\n\n\n\n\n\n\nstop\nend program\n\n\nsubroutine ex(n,k)\n implicit none\n\n integer(8), intent(in) :: n\n integer(8), intent(out) :: k\n integer(8) :: l, i\n\n l=1\n i=n\n\n do while (i>0)\n l=l*i\n i=i-1\n end do\n\n k=l\n\n return\nend subroutine ex\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02708", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N+1 integers: 10^{100}, 10^{100}+1, ..., 10^{100}+N.\n\nWe will choose K or more of these integers. Find the number of possible values of the sum of the chosen numbers, modulo (10^9+7).\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq K \\leq N+1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible values of the sum, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nThe sum can take 10 values, as follows:\n\n(10^{100})+(10^{100}+1)=2\\times 10^{100}+1\n\n(10^{100})+(10^{100}+2)=2\\times 10^{100}+2\n\n(10^{100})+(10^{100}+3)=(10^{100}+1)+(10^{100}+2)=2\\times 10^{100}+3\n\n(10^{100}+1)+(10^{100}+3)=2\\times 10^{100}+4\n\n(10^{100}+2)+(10^{100}+3)=2\\times 10^{100}+5\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)=3\\times 10^{100}+3\n\n(10^{100})+(10^{100}+1)+(10^{100}+3)=3\\times 10^{100}+4\n\n(10^{100})+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+5\n\n(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=3\\times 10^{100}+6\n\n(10^{100})+(10^{100}+1)+(10^{100}+2)+(10^{100}+3)=4\\times 10^{100}+6\n\nSample Input 2\n\n200000 200001\n\nSample Output 2\n\n1\n\nWe must choose all of the integers, so the sum can take just 1 value.\n\nSample Input 3\n\n141421 35623\n\nSample Output 3\n\n220280457", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 545, "cpu_time_ms": 112, "memory_kb": 2968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s672342569", "group_id": "codeNet:p02712", "input_text": "program fizzbuzz\n \n implicit none\n integer(8) :: n,ans,i\n integer(8),allocatable :: a(:)\n\n read*,n\n allocate(a(n))\n ans=0\n \n \n do i=1,n\n if(mod(i,3)==0 .or. mod(i,5)==0) then \n a(i)=0\n else\n a(i)=i\n ! print*,a(i)\n end if\n ans=ans+a(i)\n end do \n \n\n print*,ans\n\nend program fizzbuzz", "language": "Fortran", "metadata": {"date": 1589047989, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Fortran/s672342569.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s672342569", "user_id": "u882765852"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "program fizzbuzz\n \n implicit none\n integer(8) :: n,ans,i\n integer(8),allocatable :: a(:)\n\n read*,n\n allocate(a(n))\n ans=0\n \n \n do i=1,n\n if(mod(i,3)==0 .or. mod(i,5)==0) then \n a(i)=0\n else\n a(i)=i\n ! print*,a(i)\n end if\n ans=ans+a(i)\n end do \n \n\n print*,ans\n\nend program fizzbuzz", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 300, "cpu_time_ms": 13, "memory_kb": 10436}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s210639260", "group_id": "codeNet:p02712", "input_text": " PROGRAM piyo\n IMPLICIT NONE\n integer(16) :: ans,n,i\n \n read*,n\n \n ans = 0\n do i = 1,n\n if( mod(i,3)/=0 .and. mod(i,5)/=0 )then\n ans = ans + i\n endif\n end do\n \n \n print*,ans\n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1586739927, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02712.html", "problem_id": "p02712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02712/input.txt", "sample_output_relpath": "derived/input_output/data/p02712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02712/Fortran/s210639260.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s210639260", "user_id": "u171356453"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": " PROGRAM piyo\n IMPLICIT NONE\n integer(16) :: ans,n,i\n \n read*,n\n \n ans = 0\n do i = 1,n\n if( mod(i,3)/=0 .and. mod(i,5)/=0 )then\n ans = ans + i\n endif\n end do\n \n \n print*,ans\n \n \n \n END PROGRAM", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "sample_input": "15\n"}, "reference_outputs": ["60\n"], "source_document_id": "p02712", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet us define the FizzBuzz sequence a_1,a_2,... as follows:\n\nIf both 3 and 5 divides i, a_i=\\mbox{FizzBuzz}.\n\nIf the above does not hold but 3 divides i, a_i=\\mbox{Fizz}.\n\nIf none of the above holds but 5 divides i, a_i=\\mbox{Buzz}.\n\nIf none of the above holds, a_i=i.\n\nFind the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the sum of all numbers among the first N terms of the FizzBuzz sequence.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n60\n\nThe first 15 terms of the FizzBuzz sequence are:\n\n1,2,\\mbox{Fizz},4,\\mbox{Buzz},\\mbox{Fizz},7,8,\\mbox{Fizz},\\mbox{Buzz},11,\\mbox{Fizz},13,14,\\mbox{FizzBuzz}\n\nAmong them, numbers are 1,2,4,7,8,11,13,14, and the sum of them is 60.\n\nSample Input 2\n\n1000000\n\nSample Output 2\n\n266666333332\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 295, "cpu_time_ms": 27, "memory_kb": 2764}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s435389146", "group_id": "codeNet:p02715", "input_text": "module module_sort\n implicit none\n private\n public int_heap_sort,real_heap_sort\n interface sort\n module procedure int_heap_sort, real_heap_sort\n end interface\n\n contains\n\n subroutine int_heap_down(a,node,las)\n implicit none\n integer(8) a(*),x\n integer(8) node,par,ch1,ch2,las\n par = node\n x = a(par); ch1 = par*2\n do while(ch1 <= las)\n ch2 = ch1+1\n if(ch2 <= las .and. a(ch1) < a(ch2)) ch1 = ch2\n if(a(ch1) > x) then\n a(par) = a(ch1); a(ch1) = x\n else \n exit\n end if\n par = ch1; ch1 = par*2\n end do\n end subroutine int_heap_down\n\n subroutine int_heap_sort(a,n)\n implicit none\n integer(8) a(*),x\n integer(8) n,i\n do i = n/2, 1, -1\n call int_heap_down(a,i,n)\n end do\n do i=n,2,-1\n x = a(i); a(i) = a(1); a(1) = x\n call int_heap_down(a,1_8,i-1)\n end do\n end subroutine int_heap_sort\n\n subroutine real_heap_down(a,node,las)\n implicit none\n real a(*), x\n integer(8) node,par,ch1,ch2,las\n par = node\n x = a(par); ch1 = par*2\n do while(ch1 <= las)\n ch2 = ch1+1\n if(ch2 <= las .and. a(ch1) < a(ch2)) ch1 = ch2\n if(a(ch1) > x) then\n a(par) = a(ch1); a(ch1) = x\n else \n exit\n end if\n par = ch1; ch1 = par*2\n end do\n end subroutine real_heap_down\n\n subroutine real_heap_sort(a,n)\n implicit none\n real a(*),x\n integer(8) n,i\n do i = n/2, 1, -1\n call real_heap_down(a,i,n)\n end do\n do i=n,2,-1\n x = a(i); a(i) = a(1); a(1) = x\n call real_heap_down(a,1_8,i-1)\n end do\n end subroutine real_heap_sort\n\nend module module_sort\n\nmodule module_deque\n implicit none\n private\n type deque_node\n type(deque_node) ,pointer:: prev => null(),next => null()\n integer(8) val\n end type deque_node\n\n type,public:: deque\n type(deque_node) ,pointer:: first => null(),last => null(), ptr => null()\n integer(8):: size=0\n contains\n procedure:: push_back => deque_push_back\n procedure:: push_front => deque_push_front\n procedure:: pop_back => deque_pop_back\n procedure:: pop_front => deque_pop_front\n end type deque\n\n contains\n\n subroutine deque_push_back(self,val)\n class(deque)::self\n integer(8)::val\n if(self%size == 0) then\n allocate(self%first)\n self%last => self%first\n self%first%val = val\n self%size = 1\n else\n allocate(self%last%next)\n self%last%next%prev => self%last\n self%last => self%last%next\n self%last%val = val\n self%size = self%size+1\n end if\n end subroutine deque_push_back\n\n subroutine deque_push_front(self,val)\n class(deque)::self\n integer(8)::val\n if(self%size == 0) then\n allocate(self%first)\n self%last => self%first\n self%first%val = val\n self%size = 1\n else\n allocate(self%first%prev)\n self%first%prev%next => self%first\n self%first => self%first%prev\n self%first%val = val\n self%size = self%size+1\n end if\n end subroutine deque_push_front\n\n subroutine deque_pop_back(self)\n class(deque)::self\n if(self%size == 0) then\n return\n else if(self%size == 1) then\n self%size = 0\n deallocate(self%last)\n self%last => null(); self%first => null()\n else\n self%last => self%last%prev\n deallocate(self%last%next)\n self%last%next => null()\n self%size = self%size-1\n end if\n end subroutine deque_pop_back\n\n subroutine deque_pop_front(self)\n class(deque)::self\n if(self%size == 0) then\n return\n else if(self%size == 1) then\n self%size = 0\n deallocate(self%first)\n self%last => null(); self%first => null()\n else\n self%first => self%first%next\n deallocate(self%first%prev)\n self%first%prev => null()\n self%size = self%size-1\n end if\n end subroutine deque_pop_front\n\nend module module_deque\n\nmodule module_RedBlackTree\n implicit none\n private\n integer(8),parameter :: red = 1,black = 0\n\n type RBT_Int_node\n type(RBT_Int_node),pointer :: par=>null(), left => null(),right => null()\n integer(8) :: key\n integer(8) :: val=0\n integer(8) :: color=red\n end type RBT_Int_node\n\n type RBT_Char_node\n type(RBT_Char_node),pointer :: par=>null(), left => null(),right => null()\n character(100) :: key\n integer(8) :: val=0\n integer(8) :: color=red\n end type RBT_Char_node\n\n type(RBT_Int_node) ,pointer,save :: rbt_int_nil\n type(RBT_Char_node) ,pointer,save :: rbt_char_nil\n\n type,public:: RedBlackTree_Int\n type(RBT_Int_node),pointer :: root => null()\n integer(8) :: size = 0\n contains\n procedure:: insert => Int_Insert\n procedure:: get_val => Int_Get\n procedure:: find => Int_Find\n procedure:: add => Int_Add\n procedure:: FixUp => Int_FixUp\n end type RedBlackTree_Int\n\n type,public:: RedBlackTree_Char\n type(RBT_Char_node),pointer :: root => null()\n integer(8) :: size = 0\n contains\n procedure:: insert => Char_Insert\n procedure:: get_val => Char_Get\n procedure:: find => Char_Find\n procedure:: add => Char_Add\n procedure:: FixUp => Char_FixUp\n end type RedBlackTree_Char\n\n contains\n\n subroutine Int_Init()\n implicit none\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n \n end subroutine Int_Init\n\n recursive function Int_Get(self,key) result(val)\n implicit none\n class(RedBlackTree_Int), intent(in) :: self\n integer(8) :: key\n integer(8) :: val\n type(RBT_Int_node),pointer :: u\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n\n if(.not.associated(self%root)) then\n val = -1 \n return\n end if\n\n u => Int_SearchTree(self%root,key)\n val = u%val\n return\n\n end function Int_Get\n\n recursive function Int_Find(self,key) result(res)\n implicit none\n class(RedBlackTree_Int), intent(in) :: self\n integer(8) :: key\n logical :: res\n type(RBT_Int_node),pointer :: u\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n\n if(.not.associated(self%root)) then\n res = .false.\n return\n end if\n\n u => Int_SearchTree(self%root,key)\n res = (.not.associated(u,rbt_int_nil))\n return\n\n end function Int_Find\n\n recursive subroutine Int_Add(self,key,val)\n implicit none\n class(RedBlackTree_Int), intent(inout) :: self\n integer(8) :: key\n type(RBT_Int_node),pointer :: u\n integer(8) :: val\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n\n if(.not.associated(self%root)) then\n call self%insert(key,val)\n return\n end if\n\n u => Int_SearchTree(self%root,key)\n if (associated(u,rbt_int_nil)) then\n call self%insert(key,val)\n else\n u%val = u%val+val \n end if\n return\n\n end subroutine Int_Add\n\n recursive function Int_SearchTree(u,key) result(res)\n implicit none\n type(RBT_Int_node), pointer :: u,res\n integer(8) :: key\n\n if(associated(u,rbt_int_nil)) then\n res => rbt_int_nil\n return\n end if\n\n if(key < u%key) then\n res => Int_SearchTree(u%left,key)\n return\n else if(key > u%key) then\n res => Int_SearchTree(u%right,key)\n return\n else\n res => u\n return\n end if\n\n end function Int_SearchTree\n\n subroutine Int_Insert(self,key,val)\n implicit none\n class(RedBlackTree_Int),intent(inout):: self\n integer(8),intent(in) :: key\n integer(8),intent(in) :: val\n type(RBT_Int_node),pointer,save :: now, u\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n\n !allocate new RBT_Int_node\n allocate(u)\n u%key = key; u%val = val\n u%left => rbt_int_nil; u%right => rbt_int_nil\n\n !insert new RBT_Int_node\n if(.not. associated(self%root)) then\n u%left => rbt_int_nil; u%right => rbt_int_nil; u%par => rbt_int_nil\n self%root => u\n self%root%color = black\n self%size = 1\n return\n else\n now => self%root\n if(.not.Insert_RBT_Int_node(u,now)) return\n end if\n\n !Fix Tree\n call self%FixUp(u)\n\n self%size = self%size+1\n \n end subroutine Int_Insert\n\n recursive function Insert_RBT_Int_node(u,now) result(added) \n implicit none\n type(RBT_Int_node), pointer:: u,now\n logical :: added\n \n if(u%key < now%key) then\n if(associated(now%left,rbt_int_nil)) then\n now%left => u\n u%par => now\n added = .true.\n else\n now => now%left\n added = Insert_RBT_Int_node(u,now)\n end if\n return\n else if(u%key > now%key) then\n if(associated(now%right,rbt_int_nil)) then\n now%right => u\n u%par => now\n added = .true.\n else\n now => now%right\n added = Insert_RBT_Int_node(u,now)\n end if\n return\n else\n added = .false.\n return\n end if\n\n end function Insert_RBT_Int_node \n\n subroutine Int_FixUp(self,u)\n implicit none\n class(RedBlackTree_Int),intent(inout) :: self\n type(RBT_Int_node),pointer,intent(inout) :: u\n type(RBT_Int_node),pointer :: w,g\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n\n nullify(w,g)\n do while(u%color == red)\n if(u%key == self%root%key) then\n u%color = black\n return\n end if\n w => u%par\n if(w%left%color == black) then\n call Int_FripLeft(w,self%root)\n u => w\n w => u%par\n end if\n if(w%color == black) return\n g => w%par\n if(g%right%color == black) then\n call Int_FripRight(g,self%root)\n return\n else\n call Int_PushBlack(g)\n u => g\n end if\n end do\n \n end subroutine Int_FixUp\n\n subroutine Int_PushBlack(u)\n implicit none\n type(RBT_Int_node), pointer:: u\n\n u%color = red; u%left%color = black; u%right%color = black; \n\n end subroutine Int_PushBlack\n\n subroutine Int_PullBlack(u)\n implicit none\n type(RBT_Int_node), pointer:: u\n\n u%color = black; u%left%color = red; u%right%color = red; \n\n end subroutine Int_PullBlack\n\n subroutine Int_FripLeft(u,root)\n implicit none\n type(RBT_Int_node), pointer, intent(inout) :: root\n type(RBT_Int_node), pointer :: u,w\n integer(8) :: tmp\n \n tmp = u%color; u%color = u%right%color; u%right%color = tmp\n\n w => u%right\n w%par => u%par\n if(.not.associated(u%par,rbt_int_nil)) then\n if(associated(w%par%left,u)) then\n w%par%left=>w\n else \n w%par%right=>w\n end if\n end if\n u%right => w%left\n if(.not.associated(u%right,rbt_int_nil))u%right%par => u\n u%par => w\n w%left => u\n if(associated(u,root)) then\n root => w\n root%par => rbt_int_nil\n end if\n\n end subroutine Int_FripLeft\n\n subroutine Int_FripRight(u,root)\n implicit none\n type(RBT_Int_node), pointer,intent(inout):: root\n type(RBT_Int_node), pointer :: u,w\n integer(8) :: tmp\n\n tmp = u%color; u%color = u%left%color; u%left%color = tmp\n\n w => u%left\n w%par => u%par\n if(.not.associated(u%par,rbt_int_nil)) then\n if(associated(w%par%left,u)) then\n w%par%left=>w\n else \n w%par%right=>w\n end if\n end if\n u%left => w%right\n if(.not.associated(u%left,rbt_int_nil))u%left%par => u\n u%par => w\n w%right => u\n if(associated(u,root)) then\n root => w\n root%par => rbt_int_nil\n end if\n\n end subroutine Int_FripRight\n\n subroutine Char_Init()\n implicit none\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n \n end subroutine Char_Init\n \n recursive function Char_Get(self,key) result(val)\n implicit none\n class(RedBlackTree_Char), intent(in) :: self\n Character(100) :: key\n integer(8) :: val\n type(RBT_Char_node),pointer :: u\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n\n if(.not.associated(self%root)) then\n val = -1\n return\n end if\n \n u => Char_SearchTree(self%root,key)\n val = u%val\n return\n \n end function Char_Get\n \n recursive function Char_Find(self,key) result(res)\n implicit none\n class(RedBlackTree_Char), intent(in) :: self\n Character(100) :: key\n logical :: res\n type(RBT_Char_node),pointer :: u\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n\n if(.not.associated(self%root)) then\n res = .false.\n return\n end if\n \n u => Char_SearchTree(self%root,key)\n res = (.not.associated(u,rbt_char_nil))\n return\n \n end function Char_Find\n \n recursive subroutine Char_Add(self,key,val)\n implicit none\n class(RedBlackTree_Char), intent(inout) :: self\n Character(100) :: key\n type(RBT_Char_node),pointer :: u\n integer(8) :: val\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n \n if(.not.associated(self%root)) then\n call self%insert(key,val)\n return\n end if\n \n u => Char_SearchTree(self%root,key)\n if (associated(u,rbt_char_nil)) then\n call self%insert(key,val)\n else\n u%val = u%val+val \n end if\n return\n \n end subroutine Char_Add\n \n recursive function Char_SearchTree(u,key) result(res)\n implicit none\n type(RBT_Char_node), pointer :: u,res\n Character(100) :: key\n \n if(associated(u,rbt_char_nil)) then\n res => rbt_char_nil\n return\n end if\n \n if(key < u%key) then\n res => Char_SearchTree(u%left,key)\n return\n else if(key > u%key) then\n res => Char_SearchTree(u%right,key)\n return\n else\n res => u\n return\n end if\n \n end function Char_SearchTree\n \n subroutine Char_Insert(self,key,val)\n implicit none\n class(RedBlackTree_Char),intent(inout) :: self\n Character(100),intent(in) :: key\n integer(8),intent(in) :: val\n type(RBT_Char_node),pointer,save :: now, u\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n \n !allocate new RBT_Char_node\n allocate(u)\n u%key = key; u%val = val\n u%left => rbt_char_nil; u%right => rbt_char_nil\n \n !insert new RBT_Char_node\n if(.not. associated(self%root)) then\n u%left => rbt_char_nil; u%right => rbt_char_nil; u%par => rbt_char_nil\n self%root => u\n self%root%color = black\n self%size = 1\n return\n else\n now => self%root\n if(.not.Insert_RBT_Char_node(u,now)) return\n end if\n \n !Fix Tree\n call self%FixUp(u)\n \n self%size = self%size+1\n \n end subroutine Char_Insert\n \n recursive function Insert_RBT_Char_node(u,now) result(added) \n implicit none\n type(RBT_Char_node), pointer:: u,now\n logical :: added\n \n if(u%key < now%key) then\n if(associated(now%left,rbt_char_nil)) then\n now%left => u\n u%par => now\n added = .true.\n else\n now => now%left\n added = Insert_RBT_Char_node(u,now)\n end if\n return\n else if(u%key > now%key) then\n if(associated(now%right,rbt_char_nil)) then\n now%right => u\n u%par => now\n added = .true.\n else\n now => now%right\n added = Insert_RBT_Char_node(u,now)\n end if\n return\n else\n added = .false.\n return\n end if\n \n end function Insert_RBT_Char_node \n \n subroutine Char_FixUp(self,u)\n implicit none\n class(RedBlackTree_Char),intent(inout) :: self\n type(RBT_Char_node),pointer,intent(inout) :: u\n type(RBT_Char_node),pointer :: w,g\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n \n nullify(w,g)\n do while(u%color == red)\n if(u%key == self%root%key) then\n u%color = black\n return\n end if\n w => u%par\n if(w%left%color == black) then\n call Char_FripLeft(w,self%root)\n u => w\n w => u%par\n end if\n if(w%color == black) return\n g => w%par\n if(g%right%color == black) then\n call Char_FripRight(g,self%root)\n return\n else\n call Char_PushBlack(g)\n u => g\n end if\n end do\n \n end subroutine Char_FixUp\n \n subroutine Char_PushBlack(u)\n implicit none\n type(RBT_Char_node), pointer:: u\n \n u%color = red; u%left%color = black; u%right%color = black; \n \n end subroutine Char_PushBlack\n \n subroutine Char_PullBlack(u)\n implicit none\n type(RBT_Char_node), pointer:: u\n \n u%color = black; u%left%color = red; u%right%color = red; \n \n end subroutine Char_PullBlack\n \n subroutine Char_FripLeft(u,root)\n implicit none\n type(RBT_Char_node), pointer, intent(inout) :: root\n type(RBT_Char_node), pointer :: u,w\n integer(8) :: tmp\n \n tmp = u%color; u%color = u%right%color; u%right%color = tmp\n \n w => u%right\n w%par => u%par\n if(.not.associated(u%par,rbt_char_nil)) then\n if(associated(w%par%left,u)) then\n w%par%left=>w\n else \n w%par%right=>w\n end if\n end if\n u%right => w%left\n if(.not.associated(u%right,rbt_char_nil))u%right%par => u\n u%par => w\n w%left => u\n if(associated(u,root)) then\n root => w\n root%par => rbt_char_nil\n end if\n \n end subroutine Char_FripLeft\n \n subroutine Char_FripRight(u,root)\n implicit none\n type(RBT_Char_node), pointer,intent(inout):: root\n type(RBT_Char_node), pointer :: u,w\n integer(8) :: tmp\n \n tmp = u%color; u%color = u%left%color; u%left%color = tmp\n \n w => u%left\n w%par => u%par\n if(.not.associated(u%par,rbt_char_nil)) then\n if(associated(w%par%left,u)) then\n w%par%left=>w\n else \n w%par%right=>w\n end if\n end if\n u%left => w%right\n if(.not.associated(u%left,rbt_char_nil))u%left%par => u\n u%par => w\n w%right => u\n if(associated(u,root)) then\n root => w\n root%par => rbt_char_nil\n end if\n \n end subroutine Char_FripRight\n\nend module module_RedBlackTree\n\nmodule module_MinHeap\n implicit none\n private\n type MH_node\n type(MH_node),pointer :: par=>null(), left => null(),right => null()\n integer(8) :: key,val\n integer(8) :: size\n end type MH_node\n type(MH_node) ,pointer,save :: heap_nil\n\n type,public:: MinHeap\n type(MH_node),pointer :: root,last\n contains\n procedure:: push => MinHeap_Insert_MH_node\n procedure:: pop => MinHeap_Pop_MH_node\n end type MinHeap\n\n contains\n\n subroutine MinHeap_Up(root,u)\n implicit none\n type(MH_node),pointer :: root,u\n integer(8) :: tmp\n\n do while(.not.associated(root,u))\n if(u%key < u%par%key) then\n tmp = u%key\n u%key = u%par%key\n u%par%key = tmp\n tmp = u%val\n u%val = u%par%val\n u%par%val = tmp\n u => u%par\n else\n return\n end if\n end do\n return\n\n end subroutine MinHeap_Up\n\n subroutine MinHeap_Down(root)\n implicit none\n type(MH_node),pointer:: root,u\n integer(8) :: tmp\n\n u => root\n do while(.not.associated(u%left,heap_nil))\n\n if(.not.associated(u%right,heap_nil)) then\n if (u%right%key < u%left%key .and. u%right%key < u%key) then\n tmp = u%key\n u%key = u%right%key\n u%right%key = tmp\n tmp = u%val\n u%val = u%right%val\n u%right%val = tmp\n u => u%right\n cycle\n end if\n end if\n if(u%left%key < u%key) then\n tmp = u%key\n u%key = u%left%key\n u%left%key = tmp\n tmp = u%val\n u%val = u%left%val\n u%left%val = tmp\n u => u%left\n cycle\n end if\n exit\n end do\n return\n\n end subroutine MinHeap_Down\n\n subroutine Update_Size(root,u,is_add)\n implicit none\n type(MH_node),pointer :: root,u\n logical :: is_add\n\n do while(.not.associated(root,u))\n if(is_add) then\n u%size = u%size+1\n else\n u%size = u%size-1\n end if\n u => u%par\n end do\n\n if(is_add) then\n u%size = u%size+1\n else\n u%size = u%size-1\n end if\n\n end subroutine Update_size\n\n subroutine MinHeap_Insert_MH_node(self,key,val)\n implicit none\n class(MinHeap) :: self\n type(MH_node),pointer :: u,now\n integer(8) :: key,val\n\n if(.not.associated(heap_nil)) allocate(heap_nil)\n u => null()\n allocate(u)\n u%key = key\n u%val = val\n u%left => heap_nil; u%right => heap_nil\n u%size = 1\n\n if(.not.associated(self%root)) then\n self%root => u\n self%root%par => heap_nil\n return\n end if\n\n now => self%root\n do\n now%size = now%size+1\n if(.not.associated(now%left,heap_nil)) then\n if(.not.associated(now%right,heap_nil)) then\n if(now%right%size < now%left%size) then\n now => now%right; cycle\n else\n now => now%left; cycle\n end if\n else\n now%right => u\n u%par => now\n exit\n end if\n else\n now%left => u\n u%par => now\n exit\n end if\n end do\n\n call MinHeap_Up(self%root,u)\n\n end subroutine MinHeap_Insert_MH_node\n\n subroutine MinHeap_Pop_MH_node(self)\n implicit none\n class(MinHeap) :: self\n type(MH_node),pointer :: u,now\n integer(8) :: tmp\n\n if(.not.associated(heap_nil)) allocate(heap_nil)\n if(.not.associated(self%root)) return\n\n now => self%root\n do\n now%size = now%size-1\n if(.not.associated(now%left,heap_nil)) then\n if(.not.associated(now%right,heap_nil)) then\n if(now%right%size >= now%left%size) then\n now => now%right; cycle\n else\n now => now%left; cycle\n end if\n else\n u => now%left\n tmp = u%key\n u%key = self%root%key\n self%root%key = tmp\n tmp = u%val\n u%val = self%root%val\n self%root%val = tmp\n now%left => heap_nil\n exit\n end if\n else if(associated(now,self%root)) then\n deallocate(self%root)\n return\n else\n u => now\n tmp = u%key\n u%key = self%root%key\n self%root%key = tmp\n tmp = u%val\n u%val = self%root%val\n self%root%val = tmp\n if(associated(now%par%left,now)) then\n now%par%left => heap_nil\n else\n now%par%right => heap_nil\n end if\n exit\n end if\n end do\n\n deallocate(u)\n\n call MinHeap_Down(self%root)\n\n end subroutine MinHeap_Pop_MH_node\n\nend module module_MinHeap\n\nrecursive function gcd(a,b) result(res)\n implicit none\n integer(8) :: a,b,res\n\n if(a < b) then\n res = gcd(b,a)\n return\n end if\n\n if(mod(a,b) == 0) then\n res = b\n return\n else \n res = gcd(b,mod(a,b))\n return\n end if\n\nend function gcd\n\nrecursive function mod_pow(a,b,modulo) result(res)\n implicit none\n integer(8) :: a,b,modulo,res\n\n if(b == 0) then\n res = 1\n return\n end if\n\n if(mod(b,2) == 1) then\n res = mod(a*mod_pow(a,b-1,modulo),modulo)\n else \n res = mod(mod_pow(a,b/2,modulo)**2,modulo)\n end if\n\n return\n\nend function mod_pow\n\nmodule global\n use module_sort\n use module_deque\n use module_RedBlackTree\n use module_MinHeap\n implicit none\n integer(8) :: N,K,memo(100005),exa(100005)\n integer(8) :: modulo = 1e9_8+7_8\nend module global\n\nprogram main\n use global\n implicit none\n integer(8) :: i,j,mod_pow,ans = 0\n \n read*, N, K \n\n do i = 1,K \n memo(i) = mod_pow(K/i,N,modulo)\n end do\n\n do i = K, 1, -1\n exa(i) = memo(i)\n do j = i*2, K, i\n exa(i) = mod(exa(i)+modulo-exa(j),modulo)\n end do\n ans = mod(ans+exa(i)*i,modulo)\n end do\n\n print '(i0)', ans\n \nend program main\n", "language": "Fortran", "metadata": {"date": 1586796732, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02715.html", "problem_id": "p02715", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02715/input.txt", "sample_output_relpath": "derived/input_output/data/p02715/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02715/Fortran/s435389146.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s435389146", "user_id": "u140450365"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "module module_sort\n implicit none\n private\n public int_heap_sort,real_heap_sort\n interface sort\n module procedure int_heap_sort, real_heap_sort\n end interface\n\n contains\n\n subroutine int_heap_down(a,node,las)\n implicit none\n integer(8) a(*),x\n integer(8) node,par,ch1,ch2,las\n par = node\n x = a(par); ch1 = par*2\n do while(ch1 <= las)\n ch2 = ch1+1\n if(ch2 <= las .and. a(ch1) < a(ch2)) ch1 = ch2\n if(a(ch1) > x) then\n a(par) = a(ch1); a(ch1) = x\n else \n exit\n end if\n par = ch1; ch1 = par*2\n end do\n end subroutine int_heap_down\n\n subroutine int_heap_sort(a,n)\n implicit none\n integer(8) a(*),x\n integer(8) n,i\n do i = n/2, 1, -1\n call int_heap_down(a,i,n)\n end do\n do i=n,2,-1\n x = a(i); a(i) = a(1); a(1) = x\n call int_heap_down(a,1_8,i-1)\n end do\n end subroutine int_heap_sort\n\n subroutine real_heap_down(a,node,las)\n implicit none\n real a(*), x\n integer(8) node,par,ch1,ch2,las\n par = node\n x = a(par); ch1 = par*2\n do while(ch1 <= las)\n ch2 = ch1+1\n if(ch2 <= las .and. a(ch1) < a(ch2)) ch1 = ch2\n if(a(ch1) > x) then\n a(par) = a(ch1); a(ch1) = x\n else \n exit\n end if\n par = ch1; ch1 = par*2\n end do\n end subroutine real_heap_down\n\n subroutine real_heap_sort(a,n)\n implicit none\n real a(*),x\n integer(8) n,i\n do i = n/2, 1, -1\n call real_heap_down(a,i,n)\n end do\n do i=n,2,-1\n x = a(i); a(i) = a(1); a(1) = x\n call real_heap_down(a,1_8,i-1)\n end do\n end subroutine real_heap_sort\n\nend module module_sort\n\nmodule module_deque\n implicit none\n private\n type deque_node\n type(deque_node) ,pointer:: prev => null(),next => null()\n integer(8) val\n end type deque_node\n\n type,public:: deque\n type(deque_node) ,pointer:: first => null(),last => null(), ptr => null()\n integer(8):: size=0\n contains\n procedure:: push_back => deque_push_back\n procedure:: push_front => deque_push_front\n procedure:: pop_back => deque_pop_back\n procedure:: pop_front => deque_pop_front\n end type deque\n\n contains\n\n subroutine deque_push_back(self,val)\n class(deque)::self\n integer(8)::val\n if(self%size == 0) then\n allocate(self%first)\n self%last => self%first\n self%first%val = val\n self%size = 1\n else\n allocate(self%last%next)\n self%last%next%prev => self%last\n self%last => self%last%next\n self%last%val = val\n self%size = self%size+1\n end if\n end subroutine deque_push_back\n\n subroutine deque_push_front(self,val)\n class(deque)::self\n integer(8)::val\n if(self%size == 0) then\n allocate(self%first)\n self%last => self%first\n self%first%val = val\n self%size = 1\n else\n allocate(self%first%prev)\n self%first%prev%next => self%first\n self%first => self%first%prev\n self%first%val = val\n self%size = self%size+1\n end if\n end subroutine deque_push_front\n\n subroutine deque_pop_back(self)\n class(deque)::self\n if(self%size == 0) then\n return\n else if(self%size == 1) then\n self%size = 0\n deallocate(self%last)\n self%last => null(); self%first => null()\n else\n self%last => self%last%prev\n deallocate(self%last%next)\n self%last%next => null()\n self%size = self%size-1\n end if\n end subroutine deque_pop_back\n\n subroutine deque_pop_front(self)\n class(deque)::self\n if(self%size == 0) then\n return\n else if(self%size == 1) then\n self%size = 0\n deallocate(self%first)\n self%last => null(); self%first => null()\n else\n self%first => self%first%next\n deallocate(self%first%prev)\n self%first%prev => null()\n self%size = self%size-1\n end if\n end subroutine deque_pop_front\n\nend module module_deque\n\nmodule module_RedBlackTree\n implicit none\n private\n integer(8),parameter :: red = 1,black = 0\n\n type RBT_Int_node\n type(RBT_Int_node),pointer :: par=>null(), left => null(),right => null()\n integer(8) :: key\n integer(8) :: val=0\n integer(8) :: color=red\n end type RBT_Int_node\n\n type RBT_Char_node\n type(RBT_Char_node),pointer :: par=>null(), left => null(),right => null()\n character(100) :: key\n integer(8) :: val=0\n integer(8) :: color=red\n end type RBT_Char_node\n\n type(RBT_Int_node) ,pointer,save :: rbt_int_nil\n type(RBT_Char_node) ,pointer,save :: rbt_char_nil\n\n type,public:: RedBlackTree_Int\n type(RBT_Int_node),pointer :: root => null()\n integer(8) :: size = 0\n contains\n procedure:: insert => Int_Insert\n procedure:: get_val => Int_Get\n procedure:: find => Int_Find\n procedure:: add => Int_Add\n procedure:: FixUp => Int_FixUp\n end type RedBlackTree_Int\n\n type,public:: RedBlackTree_Char\n type(RBT_Char_node),pointer :: root => null()\n integer(8) :: size = 0\n contains\n procedure:: insert => Char_Insert\n procedure:: get_val => Char_Get\n procedure:: find => Char_Find\n procedure:: add => Char_Add\n procedure:: FixUp => Char_FixUp\n end type RedBlackTree_Char\n\n contains\n\n subroutine Int_Init()\n implicit none\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n \n end subroutine Int_Init\n\n recursive function Int_Get(self,key) result(val)\n implicit none\n class(RedBlackTree_Int), intent(in) :: self\n integer(8) :: key\n integer(8) :: val\n type(RBT_Int_node),pointer :: u\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n\n if(.not.associated(self%root)) then\n val = -1 \n return\n end if\n\n u => Int_SearchTree(self%root,key)\n val = u%val\n return\n\n end function Int_Get\n\n recursive function Int_Find(self,key) result(res)\n implicit none\n class(RedBlackTree_Int), intent(in) :: self\n integer(8) :: key\n logical :: res\n type(RBT_Int_node),pointer :: u\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n\n if(.not.associated(self%root)) then\n res = .false.\n return\n end if\n\n u => Int_SearchTree(self%root,key)\n res = (.not.associated(u,rbt_int_nil))\n return\n\n end function Int_Find\n\n recursive subroutine Int_Add(self,key,val)\n implicit none\n class(RedBlackTree_Int), intent(inout) :: self\n integer(8) :: key\n type(RBT_Int_node),pointer :: u\n integer(8) :: val\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n\n if(.not.associated(self%root)) then\n call self%insert(key,val)\n return\n end if\n\n u => Int_SearchTree(self%root,key)\n if (associated(u,rbt_int_nil)) then\n call self%insert(key,val)\n else\n u%val = u%val+val \n end if\n return\n\n end subroutine Int_Add\n\n recursive function Int_SearchTree(u,key) result(res)\n implicit none\n type(RBT_Int_node), pointer :: u,res\n integer(8) :: key\n\n if(associated(u,rbt_int_nil)) then\n res => rbt_int_nil\n return\n end if\n\n if(key < u%key) then\n res => Int_SearchTree(u%left,key)\n return\n else if(key > u%key) then\n res => Int_SearchTree(u%right,key)\n return\n else\n res => u\n return\n end if\n\n end function Int_SearchTree\n\n subroutine Int_Insert(self,key,val)\n implicit none\n class(RedBlackTree_Int),intent(inout):: self\n integer(8),intent(in) :: key\n integer(8),intent(in) :: val\n type(RBT_Int_node),pointer,save :: now, u\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n\n !allocate new RBT_Int_node\n allocate(u)\n u%key = key; u%val = val\n u%left => rbt_int_nil; u%right => rbt_int_nil\n\n !insert new RBT_Int_node\n if(.not. associated(self%root)) then\n u%left => rbt_int_nil; u%right => rbt_int_nil; u%par => rbt_int_nil\n self%root => u\n self%root%color = black\n self%size = 1\n return\n else\n now => self%root\n if(.not.Insert_RBT_Int_node(u,now)) return\n end if\n\n !Fix Tree\n call self%FixUp(u)\n\n self%size = self%size+1\n \n end subroutine Int_Insert\n\n recursive function Insert_RBT_Int_node(u,now) result(added) \n implicit none\n type(RBT_Int_node), pointer:: u,now\n logical :: added\n \n if(u%key < now%key) then\n if(associated(now%left,rbt_int_nil)) then\n now%left => u\n u%par => now\n added = .true.\n else\n now => now%left\n added = Insert_RBT_Int_node(u,now)\n end if\n return\n else if(u%key > now%key) then\n if(associated(now%right,rbt_int_nil)) then\n now%right => u\n u%par => now\n added = .true.\n else\n now => now%right\n added = Insert_RBT_Int_node(u,now)\n end if\n return\n else\n added = .false.\n return\n end if\n\n end function Insert_RBT_Int_node \n\n subroutine Int_FixUp(self,u)\n implicit none\n class(RedBlackTree_Int),intent(inout) :: self\n type(RBT_Int_node),pointer,intent(inout) :: u\n type(RBT_Int_node),pointer :: w,g\n\n if(.not.associated(rbt_int_nil)) then\n allocate(rbt_int_nil)\n rbt_int_nil%color = black\n end if\n\n nullify(w,g)\n do while(u%color == red)\n if(u%key == self%root%key) then\n u%color = black\n return\n end if\n w => u%par\n if(w%left%color == black) then\n call Int_FripLeft(w,self%root)\n u => w\n w => u%par\n end if\n if(w%color == black) return\n g => w%par\n if(g%right%color == black) then\n call Int_FripRight(g,self%root)\n return\n else\n call Int_PushBlack(g)\n u => g\n end if\n end do\n \n end subroutine Int_FixUp\n\n subroutine Int_PushBlack(u)\n implicit none\n type(RBT_Int_node), pointer:: u\n\n u%color = red; u%left%color = black; u%right%color = black; \n\n end subroutine Int_PushBlack\n\n subroutine Int_PullBlack(u)\n implicit none\n type(RBT_Int_node), pointer:: u\n\n u%color = black; u%left%color = red; u%right%color = red; \n\n end subroutine Int_PullBlack\n\n subroutine Int_FripLeft(u,root)\n implicit none\n type(RBT_Int_node), pointer, intent(inout) :: root\n type(RBT_Int_node), pointer :: u,w\n integer(8) :: tmp\n \n tmp = u%color; u%color = u%right%color; u%right%color = tmp\n\n w => u%right\n w%par => u%par\n if(.not.associated(u%par,rbt_int_nil)) then\n if(associated(w%par%left,u)) then\n w%par%left=>w\n else \n w%par%right=>w\n end if\n end if\n u%right => w%left\n if(.not.associated(u%right,rbt_int_nil))u%right%par => u\n u%par => w\n w%left => u\n if(associated(u,root)) then\n root => w\n root%par => rbt_int_nil\n end if\n\n end subroutine Int_FripLeft\n\n subroutine Int_FripRight(u,root)\n implicit none\n type(RBT_Int_node), pointer,intent(inout):: root\n type(RBT_Int_node), pointer :: u,w\n integer(8) :: tmp\n\n tmp = u%color; u%color = u%left%color; u%left%color = tmp\n\n w => u%left\n w%par => u%par\n if(.not.associated(u%par,rbt_int_nil)) then\n if(associated(w%par%left,u)) then\n w%par%left=>w\n else \n w%par%right=>w\n end if\n end if\n u%left => w%right\n if(.not.associated(u%left,rbt_int_nil))u%left%par => u\n u%par => w\n w%right => u\n if(associated(u,root)) then\n root => w\n root%par => rbt_int_nil\n end if\n\n end subroutine Int_FripRight\n\n subroutine Char_Init()\n implicit none\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n \n end subroutine Char_Init\n \n recursive function Char_Get(self,key) result(val)\n implicit none\n class(RedBlackTree_Char), intent(in) :: self\n Character(100) :: key\n integer(8) :: val\n type(RBT_Char_node),pointer :: u\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n\n if(.not.associated(self%root)) then\n val = -1\n return\n end if\n \n u => Char_SearchTree(self%root,key)\n val = u%val\n return\n \n end function Char_Get\n \n recursive function Char_Find(self,key) result(res)\n implicit none\n class(RedBlackTree_Char), intent(in) :: self\n Character(100) :: key\n logical :: res\n type(RBT_Char_node),pointer :: u\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n\n if(.not.associated(self%root)) then\n res = .false.\n return\n end if\n \n u => Char_SearchTree(self%root,key)\n res = (.not.associated(u,rbt_char_nil))\n return\n \n end function Char_Find\n \n recursive subroutine Char_Add(self,key,val)\n implicit none\n class(RedBlackTree_Char), intent(inout) :: self\n Character(100) :: key\n type(RBT_Char_node),pointer :: u\n integer(8) :: val\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n \n if(.not.associated(self%root)) then\n call self%insert(key,val)\n return\n end if\n \n u => Char_SearchTree(self%root,key)\n if (associated(u,rbt_char_nil)) then\n call self%insert(key,val)\n else\n u%val = u%val+val \n end if\n return\n \n end subroutine Char_Add\n \n recursive function Char_SearchTree(u,key) result(res)\n implicit none\n type(RBT_Char_node), pointer :: u,res\n Character(100) :: key\n \n if(associated(u,rbt_char_nil)) then\n res => rbt_char_nil\n return\n end if\n \n if(key < u%key) then\n res => Char_SearchTree(u%left,key)\n return\n else if(key > u%key) then\n res => Char_SearchTree(u%right,key)\n return\n else\n res => u\n return\n end if\n \n end function Char_SearchTree\n \n subroutine Char_Insert(self,key,val)\n implicit none\n class(RedBlackTree_Char),intent(inout) :: self\n Character(100),intent(in) :: key\n integer(8),intent(in) :: val\n type(RBT_Char_node),pointer,save :: now, u\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n \n !allocate new RBT_Char_node\n allocate(u)\n u%key = key; u%val = val\n u%left => rbt_char_nil; u%right => rbt_char_nil\n \n !insert new RBT_Char_node\n if(.not. associated(self%root)) then\n u%left => rbt_char_nil; u%right => rbt_char_nil; u%par => rbt_char_nil\n self%root => u\n self%root%color = black\n self%size = 1\n return\n else\n now => self%root\n if(.not.Insert_RBT_Char_node(u,now)) return\n end if\n \n !Fix Tree\n call self%FixUp(u)\n \n self%size = self%size+1\n \n end subroutine Char_Insert\n \n recursive function Insert_RBT_Char_node(u,now) result(added) \n implicit none\n type(RBT_Char_node), pointer:: u,now\n logical :: added\n \n if(u%key < now%key) then\n if(associated(now%left,rbt_char_nil)) then\n now%left => u\n u%par => now\n added = .true.\n else\n now => now%left\n added = Insert_RBT_Char_node(u,now)\n end if\n return\n else if(u%key > now%key) then\n if(associated(now%right,rbt_char_nil)) then\n now%right => u\n u%par => now\n added = .true.\n else\n now => now%right\n added = Insert_RBT_Char_node(u,now)\n end if\n return\n else\n added = .false.\n return\n end if\n \n end function Insert_RBT_Char_node \n \n subroutine Char_FixUp(self,u)\n implicit none\n class(RedBlackTree_Char),intent(inout) :: self\n type(RBT_Char_node),pointer,intent(inout) :: u\n type(RBT_Char_node),pointer :: w,g\n \n if(.not.associated(rbt_char_nil)) then\n allocate(rbt_char_nil)\n rbt_char_nil%color = black\n end if\n \n nullify(w,g)\n do while(u%color == red)\n if(u%key == self%root%key) then\n u%color = black\n return\n end if\n w => u%par\n if(w%left%color == black) then\n call Char_FripLeft(w,self%root)\n u => w\n w => u%par\n end if\n if(w%color == black) return\n g => w%par\n if(g%right%color == black) then\n call Char_FripRight(g,self%root)\n return\n else\n call Char_PushBlack(g)\n u => g\n end if\n end do\n \n end subroutine Char_FixUp\n \n subroutine Char_PushBlack(u)\n implicit none\n type(RBT_Char_node), pointer:: u\n \n u%color = red; u%left%color = black; u%right%color = black; \n \n end subroutine Char_PushBlack\n \n subroutine Char_PullBlack(u)\n implicit none\n type(RBT_Char_node), pointer:: u\n \n u%color = black; u%left%color = red; u%right%color = red; \n \n end subroutine Char_PullBlack\n \n subroutine Char_FripLeft(u,root)\n implicit none\n type(RBT_Char_node), pointer, intent(inout) :: root\n type(RBT_Char_node), pointer :: u,w\n integer(8) :: tmp\n \n tmp = u%color; u%color = u%right%color; u%right%color = tmp\n \n w => u%right\n w%par => u%par\n if(.not.associated(u%par,rbt_char_nil)) then\n if(associated(w%par%left,u)) then\n w%par%left=>w\n else \n w%par%right=>w\n end if\n end if\n u%right => w%left\n if(.not.associated(u%right,rbt_char_nil))u%right%par => u\n u%par => w\n w%left => u\n if(associated(u,root)) then\n root => w\n root%par => rbt_char_nil\n end if\n \n end subroutine Char_FripLeft\n \n subroutine Char_FripRight(u,root)\n implicit none\n type(RBT_Char_node), pointer,intent(inout):: root\n type(RBT_Char_node), pointer :: u,w\n integer(8) :: tmp\n \n tmp = u%color; u%color = u%left%color; u%left%color = tmp\n \n w => u%left\n w%par => u%par\n if(.not.associated(u%par,rbt_char_nil)) then\n if(associated(w%par%left,u)) then\n w%par%left=>w\n else \n w%par%right=>w\n end if\n end if\n u%left => w%right\n if(.not.associated(u%left,rbt_char_nil))u%left%par => u\n u%par => w\n w%right => u\n if(associated(u,root)) then\n root => w\n root%par => rbt_char_nil\n end if\n \n end subroutine Char_FripRight\n\nend module module_RedBlackTree\n\nmodule module_MinHeap\n implicit none\n private\n type MH_node\n type(MH_node),pointer :: par=>null(), left => null(),right => null()\n integer(8) :: key,val\n integer(8) :: size\n end type MH_node\n type(MH_node) ,pointer,save :: heap_nil\n\n type,public:: MinHeap\n type(MH_node),pointer :: root,last\n contains\n procedure:: push => MinHeap_Insert_MH_node\n procedure:: pop => MinHeap_Pop_MH_node\n end type MinHeap\n\n contains\n\n subroutine MinHeap_Up(root,u)\n implicit none\n type(MH_node),pointer :: root,u\n integer(8) :: tmp\n\n do while(.not.associated(root,u))\n if(u%key < u%par%key) then\n tmp = u%key\n u%key = u%par%key\n u%par%key = tmp\n tmp = u%val\n u%val = u%par%val\n u%par%val = tmp\n u => u%par\n else\n return\n end if\n end do\n return\n\n end subroutine MinHeap_Up\n\n subroutine MinHeap_Down(root)\n implicit none\n type(MH_node),pointer:: root,u\n integer(8) :: tmp\n\n u => root\n do while(.not.associated(u%left,heap_nil))\n\n if(.not.associated(u%right,heap_nil)) then\n if (u%right%key < u%left%key .and. u%right%key < u%key) then\n tmp = u%key\n u%key = u%right%key\n u%right%key = tmp\n tmp = u%val\n u%val = u%right%val\n u%right%val = tmp\n u => u%right\n cycle\n end if\n end if\n if(u%left%key < u%key) then\n tmp = u%key\n u%key = u%left%key\n u%left%key = tmp\n tmp = u%val\n u%val = u%left%val\n u%left%val = tmp\n u => u%left\n cycle\n end if\n exit\n end do\n return\n\n end subroutine MinHeap_Down\n\n subroutine Update_Size(root,u,is_add)\n implicit none\n type(MH_node),pointer :: root,u\n logical :: is_add\n\n do while(.not.associated(root,u))\n if(is_add) then\n u%size = u%size+1\n else\n u%size = u%size-1\n end if\n u => u%par\n end do\n\n if(is_add) then\n u%size = u%size+1\n else\n u%size = u%size-1\n end if\n\n end subroutine Update_size\n\n subroutine MinHeap_Insert_MH_node(self,key,val)\n implicit none\n class(MinHeap) :: self\n type(MH_node),pointer :: u,now\n integer(8) :: key,val\n\n if(.not.associated(heap_nil)) allocate(heap_nil)\n u => null()\n allocate(u)\n u%key = key\n u%val = val\n u%left => heap_nil; u%right => heap_nil\n u%size = 1\n\n if(.not.associated(self%root)) then\n self%root => u\n self%root%par => heap_nil\n return\n end if\n\n now => self%root\n do\n now%size = now%size+1\n if(.not.associated(now%left,heap_nil)) then\n if(.not.associated(now%right,heap_nil)) then\n if(now%right%size < now%left%size) then\n now => now%right; cycle\n else\n now => now%left; cycle\n end if\n else\n now%right => u\n u%par => now\n exit\n end if\n else\n now%left => u\n u%par => now\n exit\n end if\n end do\n\n call MinHeap_Up(self%root,u)\n\n end subroutine MinHeap_Insert_MH_node\n\n subroutine MinHeap_Pop_MH_node(self)\n implicit none\n class(MinHeap) :: self\n type(MH_node),pointer :: u,now\n integer(8) :: tmp\n\n if(.not.associated(heap_nil)) allocate(heap_nil)\n if(.not.associated(self%root)) return\n\n now => self%root\n do\n now%size = now%size-1\n if(.not.associated(now%left,heap_nil)) then\n if(.not.associated(now%right,heap_nil)) then\n if(now%right%size >= now%left%size) then\n now => now%right; cycle\n else\n now => now%left; cycle\n end if\n else\n u => now%left\n tmp = u%key\n u%key = self%root%key\n self%root%key = tmp\n tmp = u%val\n u%val = self%root%val\n self%root%val = tmp\n now%left => heap_nil\n exit\n end if\n else if(associated(now,self%root)) then\n deallocate(self%root)\n return\n else\n u => now\n tmp = u%key\n u%key = self%root%key\n self%root%key = tmp\n tmp = u%val\n u%val = self%root%val\n self%root%val = tmp\n if(associated(now%par%left,now)) then\n now%par%left => heap_nil\n else\n now%par%right => heap_nil\n end if\n exit\n end if\n end do\n\n deallocate(u)\n\n call MinHeap_Down(self%root)\n\n end subroutine MinHeap_Pop_MH_node\n\nend module module_MinHeap\n\nrecursive function gcd(a,b) result(res)\n implicit none\n integer(8) :: a,b,res\n\n if(a < b) then\n res = gcd(b,a)\n return\n end if\n\n if(mod(a,b) == 0) then\n res = b\n return\n else \n res = gcd(b,mod(a,b))\n return\n end if\n\nend function gcd\n\nrecursive function mod_pow(a,b,modulo) result(res)\n implicit none\n integer(8) :: a,b,modulo,res\n\n if(b == 0) then\n res = 1\n return\n end if\n\n if(mod(b,2) == 1) then\n res = mod(a*mod_pow(a,b-1,modulo),modulo)\n else \n res = mod(mod_pow(a,b/2,modulo)**2,modulo)\n end if\n\n return\n\nend function mod_pow\n\nmodule global\n use module_sort\n use module_deque\n use module_RedBlackTree\n use module_MinHeap\n implicit none\n integer(8) :: N,K,memo(100005),exa(100005)\n integer(8) :: modulo = 1e9_8+7_8\nend module global\n\nprogram main\n use global\n implicit none\n integer(8) :: i,j,mod_pow,ans = 0\n \n read*, N, K \n\n do i = 1,K \n memo(i) = mod_pow(K/i,N,modulo)\n end do\n\n do i = K, 1, -1\n exa(i) = memo(i)\n do j = i*2, K, i\n exa(i) = mod(exa(i)+modulo-exa(j),modulo)\n end do\n ans = mod(ans+exa(i)*i,modulo)\n end do\n\n print '(i0)', ans\n \nend program main\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nConsider sequences \\{A_1,...,A_N\\} of length N consisting of integers between 1 and K (inclusive).\n\nThere are K^N such sequences. Find the sum of \\gcd(A_1, ..., A_N) over all of them.\n\nSince this sum can be enormous, print the value modulo (10^9+7).\n\nHere \\gcd(A_1, ..., A_N) denotes the greatest common divisor of A_1, ..., A_N.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the sum of \\gcd(A_1, ..., A_N) over all K^N sequences, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n\\gcd(1,1,1)+\\gcd(1,1,2)+\\gcd(1,2,1)+\\gcd(1,2,2)\n+\\gcd(2,1,1)+\\gcd(2,1,2)+\\gcd(2,2,1)+\\gcd(2,2,2)\n=1+1+1+1+1+1+1+2=9\n\nThus, the answer is 9.\n\nSample Input 2\n\n3 200\n\nSample Output 2\n\n10813692\n\nSample Input 3\n\n100000 100000\n\nSample Output 3\n\n742202979\n\nBe sure to print the sum modulo (10^9+7).", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02715", "source_text": "Score : 500 points\n\nProblem Statement\n\nConsider sequences \\{A_1,...,A_N\\} of length N consisting of integers between 1 and K (inclusive).\n\nThere are K^N such sequences. Find the sum of \\gcd(A_1, ..., A_N) over all of them.\n\nSince this sum can be enormous, print the value modulo (10^9+7).\n\nHere \\gcd(A_1, ..., A_N) denotes the greatest common divisor of A_1, ..., A_N.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the sum of \\gcd(A_1, ..., A_N) over all K^N sequences, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n\\gcd(1,1,1)+\\gcd(1,1,2)+\\gcd(1,2,1)+\\gcd(1,2,2)\n+\\gcd(2,1,1)+\\gcd(2,1,2)+\\gcd(2,2,1)+\\gcd(2,2,2)\n=1+1+1+1+1+1+1+2=9\n\nThus, the answer is 9.\n\nSample Input 2\n\n3 200\n\nSample Output 2\n\n10813692\n\nSample Input 3\n\n100000 100000\n\nSample Output 3\n\n742202979\n\nBe sure to print the sum modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 32415, "cpu_time_ms": 61, "memory_kb": 4324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s362325200", "group_id": "codeNet:p02715", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,k,i,j,ans\n integer(int64), allocatable:: gcn(:)\n integer(int64),parameter:: md = 1000000007\n\n read*, n,k\n allocate(gcn(k))\n\n do i=1,k\n gcn(i) = calc_rj(k/i, n)\n end do\n\n do i=k,1,-1\n j=2\n do while(i*j <= k)\n gcn(i) = gcn(i) - gcn(i*j)\n j=j+1\n end do\n end do\n\n ans=0\n do i=1,k\n ans=mod(ans+gcn(i)*i,md)\n end do\n\n print*, ans\n\ncontains\n function calc_rj(x,y) result(ret)\n integer(int64):: x,y,ret\n integer(int64):: num, nx\n ret = 1\n num = y\n nx = x\n do while(num > 0)\n if (btest(num,0)) then\n ret=mod(ret*nx,md)\n end if\n nx=mod(nx*nx,md)\n num=rshift(num,1)\n end do\n end function\nend program name \n", "language": "Fortran", "metadata": {"date": 1586795451, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02715.html", "problem_id": "p02715", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02715/input.txt", "sample_output_relpath": "derived/input_output/data/p02715/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02715/Fortran/s362325200.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s362325200", "user_id": "u234636620"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,k,i,j,ans\n integer(int64), allocatable:: gcn(:)\n integer(int64),parameter:: md = 1000000007\n\n read*, n,k\n allocate(gcn(k))\n\n do i=1,k\n gcn(i) = calc_rj(k/i, n)\n end do\n\n do i=k,1,-1\n j=2\n do while(i*j <= k)\n gcn(i) = gcn(i) - gcn(i*j)\n j=j+1\n end do\n end do\n\n ans=0\n do i=1,k\n ans=mod(ans+gcn(i)*i,md)\n end do\n\n print*, ans\n\ncontains\n function calc_rj(x,y) result(ret)\n integer(int64):: x,y,ret\n integer(int64):: num, nx\n ret = 1\n num = y\n nx = x\n do while(num > 0)\n if (btest(num,0)) then\n ret=mod(ret*nx,md)\n end if\n nx=mod(nx*nx,md)\n num=rshift(num,1)\n end do\n end function\nend program name \n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nConsider sequences \\{A_1,...,A_N\\} of length N consisting of integers between 1 and K (inclusive).\n\nThere are K^N such sequences. Find the sum of \\gcd(A_1, ..., A_N) over all of them.\n\nSince this sum can be enormous, print the value modulo (10^9+7).\n\nHere \\gcd(A_1, ..., A_N) denotes the greatest common divisor of A_1, ..., A_N.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the sum of \\gcd(A_1, ..., A_N) over all K^N sequences, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n\\gcd(1,1,1)+\\gcd(1,1,2)+\\gcd(1,2,1)+\\gcd(1,2,2)\n+\\gcd(2,1,1)+\\gcd(2,1,2)+\\gcd(2,2,1)+\\gcd(2,2,2)\n=1+1+1+1+1+1+1+2=9\n\nThus, the answer is 9.\n\nSample Input 2\n\n3 200\n\nSample Output 2\n\n10813692\n\nSample Input 3\n\n100000 100000\n\nSample Output 3\n\n742202979\n\nBe sure to print the sum modulo (10^9+7).", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02715", "source_text": "Score : 500 points\n\nProblem Statement\n\nConsider sequences \\{A_1,...,A_N\\} of length N consisting of integers between 1 and K (inclusive).\n\nThere are K^N such sequences. Find the sum of \\gcd(A_1, ..., A_N) over all of them.\n\nSince this sum can be enormous, print the value modulo (10^9+7).\n\nHere \\gcd(A_1, ..., A_N) denotes the greatest common divisor of A_1, ..., A_N.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the sum of \\gcd(A_1, ..., A_N) over all K^N sequences, modulo (10^9+7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n\\gcd(1,1,1)+\\gcd(1,1,2)+\\gcd(1,2,1)+\\gcd(1,2,2)\n+\\gcd(2,1,1)+\\gcd(2,1,2)+\\gcd(2,2,1)+\\gcd(2,2,2)\n=1+1+1+1+1+1+1+2=9\n\nThus, the answer is 9.\n\nSample Input 2\n\n3 200\n\nSample Output 2\n\n10813692\n\nSample Input 3\n\n100000 100000\n\nSample Output 3\n\n742202979\n\nBe sure to print the sum modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 896, "cpu_time_ms": 13, "memory_kb": 3584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s271153889", "group_id": "codeNet:p02719", "input_text": "program main\ninteger :: n,k,m\nread(*,*)n,k\n\nm = mod(n,k)\nif (abs(m-k) < n) then\nwrite(*,*)abs(m-k)\nelse\nwrite(*,*)m\nend if\nend program main", "language": "Fortran", "metadata": {"date": 1589598418, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Fortran/s271153889.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s271153889", "user_id": "u850779832"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\ninteger :: n,k,m\nread(*,*)n,k\n\nm = mod(n,k)\nif (abs(m-k) < n) then\nwrite(*,*)abs(m-k)\nelse\nwrite(*,*)m\nend if\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 139, "cpu_time_ms": 16, "memory_kb": 3120}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s315210236", "group_id": "codeNet:p02719", "input_text": "program main\n implicit none\n integer(8) :: n, k\n\n read(*,*) n, k\n if ( mod(n,k) < abs( mod(n,k) - k ) ) then\n print *, mod(n,k)\n else\n print *, abs( mod(n,k) - k )\n end if\n\nend program\n", "language": "Fortran", "metadata": {"date": 1586133329, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Fortran/s315210236.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s315210236", "user_id": "u353721260"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: n, k\n\n read(*,*) n, k\n if ( mod(n,k) < abs( mod(n,k) - k ) ) then\n print *, mod(n,k)\n else\n print *, abs( mod(n,k) - k )\n end if\n\nend program\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 241, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s890430152", "group_id": "codeNet:p02719", "input_text": "program main\n implicit none\n integer(8) n, k\n integer(8) nmin, i\n\n read *, n,k\n nmin = n\n\n do\n n = abs(n-k)\n if ( n <= nmin ) then\n nmin = n\n else if ( n > nmin ) then\n exit\n end if\n end do\n\n print *, nmin\n\nend program main", "language": "Fortran", "metadata": {"date": 1586050963, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02719.html", "problem_id": "p02719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02719/input.txt", "sample_output_relpath": "derived/input_output/data/p02719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02719/Fortran/s890430152.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s890430152", "user_id": "u353721260"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n integer(8) n, k\n integer(8) nmin, i\n\n read *, n,k\n nmin = n\n\n do\n n = abs(n-k)\n if ( n <= nmin ) then\n nmin = n\n else if ( n > nmin ) then\n exit\n end if\n end do\n\n print *, nmin\n\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "sample_input": "7 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02719", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven any integer x, Aoki can do the operation below.\n\nOperation: Replace x with the absolute difference of x and K.\n\nYou are given the initial value of an integer N. Find the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nConstraints\n\n0 ≤ N ≤ 10^{18}\n\n1 ≤ K ≤ 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the minimum possible value taken by N after Aoki does the operation zero or more times.\n\nSample Input 1\n\n7 4\n\nSample Output 1\n\n1\n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by N.\n\nSample Input 2\n\n2 6\n\nSample Output 2\n\n2\n\nN=2 after zero operations is the minimum.\n\nSample Input 3\n\n1000000000000000000 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 321, "cpu_time_ms": 2103, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s790312697", "group_id": "codeNet:p02721", "input_text": "program em\n implicit none\n integer::N,K,C\n character(3*10**5)::S,S1\n integer,allocatable,dimension(:)::M,U\n integer::i,j\n integer::num\n read*,N,K,C\n read*,S\n allocate(M(K))\n S1=S\n num=1\n do i=1,N\n if(S1(i:i)==\"o\")then \n M(num)=i\n num=num+1\n do j=1,C\n S1(i+j:i+j)=\"x\"\n end do\n if(Num>K)exit\n endif\n end do\n S1=S\n allocate(U(K))\n num=K\n do i=N,1,-1\n if(S1(i:i)==\"o\")then\n U(num)=i\n num=num-1\n if(NUM<=0)exit\n do j=1,C\n if(i-j<=0)exit\n S1(i-j:i-j)=\"x\"\n end do\n endif\n end do\n do i=1,K\n if(M(i)==U(i))print\"(I0)\",M(i)\n end do\n write(*,*)\ncontains\n\nend program em", "language": "Fortran", "metadata": {"date": 1586125077, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02721.html", "problem_id": "p02721", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02721/input.txt", "sample_output_relpath": "derived/input_output/data/p02721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02721/Fortran/s790312697.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s790312697", "user_id": "u598073939"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "program em\n implicit none\n integer::N,K,C\n character(3*10**5)::S,S1\n integer,allocatable,dimension(:)::M,U\n integer::i,j\n integer::num\n read*,N,K,C\n read*,S\n allocate(M(K))\n S1=S\n num=1\n do i=1,N\n if(S1(i:i)==\"o\")then \n M(num)=i\n num=num+1\n do j=1,C\n S1(i+j:i+j)=\"x\"\n end do\n if(Num>K)exit\n endif\n end do\n S1=S\n allocate(U(K))\n num=K\n do i=N,1,-1\n if(S1(i:i)==\"o\")then\n U(num)=i\n num=num-1\n if(NUM<=0)exit\n do j=1,C\n if(i-j<=0)exit\n S1(i-j:i-j)=\"x\"\n end do\n endif\n end do\n do i=1,K\n if(M(i)==U(i))print\"(I0)\",M(i)\n end do\n write(*,*)\ncontains\n\nend program em", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi has decided to work on K days of his choice from the N days starting with tomorrow.\n\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n\nAfter working for a day, he will refrain from working on the subsequent C days.\n\nIf the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.\n\nFind all days on which Takahashi is bound to work.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq N\n\n0 \\leq C \\leq N\n\nThe length of S is N.\n\nEach character of S is o or x.\n\nTakahashi can choose his workdays so that the conditions in Problem Statement are satisfied.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K C\nS\n\nOutput\n\nPrint all days on which Takahashi is bound to work in ascending order, one per line.\n\nSample Input 1\n\n11 3 2\nooxxxoxxxoo\n\nSample Output 1\n\n6\n\nTakahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.\n\nThere are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.\n\nThus, he is bound to work on Day 6.\n\nSample Input 2\n\n5 2 3\nooxoo\n\nSample Output 2\n\n1\n5\n\nThere is only one possible choice for his workdays: Day 1,5.\n\nSample Input 3\n\n5 1 0\nooooo\n\nSample Output 3\n\nThere may be no days on which he is bound to work.\n\nSample Input 4\n\n16 4 3\nooxxoxoxxxoxoxxo\n\nSample Output 4\n\n11\n16", "sample_input": "11 3 2\nooxxxoxxxoo\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02721", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi has decided to work on K days of his choice from the N days starting with tomorrow.\n\nYou are given an integer C and a string S. Takahashi will choose his workdays as follows:\n\nAfter working for a day, he will refrain from working on the subsequent C days.\n\nIf the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.\n\nFind all days on which Takahashi is bound to work.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq K \\leq N\n\n0 \\leq C \\leq N\n\nThe length of S is N.\n\nEach character of S is o or x.\n\nTakahashi can choose his workdays so that the conditions in Problem Statement are satisfied.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K C\nS\n\nOutput\n\nPrint all days on which Takahashi is bound to work in ascending order, one per line.\n\nSample Input 1\n\n11 3 2\nooxxxoxxxoo\n\nSample Output 1\n\n6\n\nTakahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.\n\nThere are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.\n\nThus, he is bound to work on Day 6.\n\nSample Input 2\n\n5 2 3\nooxoo\n\nSample Output 2\n\n1\n5\n\nThere is only one possible choice for his workdays: Day 1,5.\n\nSample Input 3\n\n5 1 0\nooooo\n\nSample Output 3\n\nThere may be no days on which he is bound to work.\n\nSample Input 4\n\n16 4 3\nooxxoxoxxxoxoxxo\n\nSample Output 4\n\n11\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 672, "cpu_time_ms": 79, "memory_kb": 3980}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s205992013", "group_id": "codeNet:p02723", "input_text": "program abc\n\timplicit none\n\tcharacter(len=6) :: fname\n character(len=1) :: a,b,c,d,e,f\n\n\tread(*,*) fname\n\tc = fname(3:3)\n\td = fname(4:4)\n\te = fname(5:5)\n\tf = fname(6:6)\n\n if(c == d .and. e == f) then\n \twrite(*,*) \"Yes\"\n else\n \twrite(*,*) \"No\"\n endif\n \nend program abc", "language": "Fortran", "metadata": {"date": 1585443988, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02723.html", "problem_id": "p02723", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02723/input.txt", "sample_output_relpath": "derived/input_output/data/p02723/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02723/Fortran/s205992013.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s205992013", "user_id": "u459127065"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program abc\n\timplicit none\n\tcharacter(len=6) :: fname\n character(len=1) :: a,b,c,d,e,f\n\n\tread(*,*) fname\n\tc = fname(3:3)\n\td = fname(4:4)\n\te = fname(5:5)\n\tf = fname(6:6)\n\n if(c == d .and. e == f) then\n \twrite(*,*) \"Yes\"\n else\n \twrite(*,*) \"No\"\n endif\n \nend program abc", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.\n\nGiven a string S, determine whether it is coffee-like.\n\nConstraints\n\nS is a string of length 6 consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is coffee-like, print Yes; otherwise, print No.\n\nSample Input 1\n\nsippuu\n\nSample Output 1\n\nYes\n\nIn sippuu, the 3-rd and 4-th characters are equal, and the 5-th and 6-th characters are also equal.\n\nSample Input 2\n\niphone\n\nSample Output 2\n\nNo\n\nSample Input 3\n\ncoffee\n\nSample Output 3\n\nYes", "sample_input": "sippuu\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02723", "source_text": "Score : 100 points\n\nProblem Statement\n\nA string of length 6 consisting of lowercase English letters is said to be coffee-like if and only if its 3-rd and 4-th characters are equal and its 5-th and 6-th characters are also equal.\n\nGiven a string S, determine whether it is coffee-like.\n\nConstraints\n\nS is a string of length 6 consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is coffee-like, print Yes; otherwise, print No.\n\nSample Input 1\n\nsippuu\n\nSample Output 1\n\nYes\n\nIn sippuu, the 3-rd and 4-th characters are equal, and the 5-th and 6-th characters are also equal.\n\nSample Input 2\n\niphone\n\nSample Output 2\n\nNo\n\nSample Input 3\n\ncoffee\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s705124293", "group_id": "codeNet:p02725", "input_text": "program main\n implicit none\n integer :: k, n, res\n integer, allocatable :: a(:)\n read (*, *) k, n\n allocate (a(0:n))\n read (*, *) a(1:n)\n a(0) = a(n) - k\n res = k - maxval(a(1:n) - a(0:n - 1))\n write (*, \"(i0)\") res\nend program main\n", "language": "Fortran", "metadata": {"date": 1585494564, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02725.html", "problem_id": "p02725", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02725/input.txt", "sample_output_relpath": "derived/input_output/data/p02725/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02725/Fortran/s705124293.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s705124293", "user_id": "u388927326"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main\n implicit none\n integer :: k, n, res\n integer, allocatable :: a(:)\n read (*, *) k, n\n allocate (a(0:n))\n read (*, *) a(1:n)\n a(0) = a(n) - k\n res = k - maxval(a(1:n) - a(0:n - 1))\n write (*, \"(i0)\") res\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a circular pond with a perimeter of K meters, and N houses around them.\n\nThe i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond.\n\nWhen traveling between these houses, you can only go around the pond.\n\nFind the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nConstraints\n\n2 \\leq K \\leq 10^6\n\n2 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_1 < ... < A_N < K\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK N\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nSample Input 1\n\n20 3\n5 10 15\n\nSample Output 1\n\n10\n\nIf you start at the 1-st house and go to the 2-nd and 3-rd houses in this order, the total distance traveled will be 10.\n\nSample Input 2\n\n20 3\n0 5 15\n\nSample Output 2\n\n10\n\nIf you start at the 2-nd house and go to the 1-st and 3-rd houses in this order, the total distance traveled will be 10.", "sample_input": "20 3\n5 10 15\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02725", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a circular pond with a perimeter of K meters, and N houses around them.\n\nThe i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond.\n\nWhen traveling between these houses, you can only go around the pond.\n\nFind the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nConstraints\n\n2 \\leq K \\leq 10^6\n\n2 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_1 < ... < A_N < K\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK N\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nSample Input 1\n\n20 3\n5 10 15\n\nSample Output 1\n\n10\n\nIf you start at the 1-st house and go to the 2-nd and 3-rd houses in this order, the total distance traveled will be 10.\n\nSample Input 2\n\n20 3\n0 5 15\n\nSample Output 2\n\n10\n\nIf you start at the 2-nd house and go to the 1-st and 3-rd houses in this order, the total distance traveled will be 10.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 242, "cpu_time_ms": 54, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s558088811", "group_id": "codeNet:p02725", "input_text": " MODULE qSortMod\n implicit none\n interface qSort\n module procedure :: i16qSort\n end interface\n contains\n \n pure recursive function i16qSort( a ) result( r )\n !ref\n !https://t.doujin-constant.net/\n !post/143374686394/fortranをより使いこなしたquick-sort\n !\n !left is smaller!\n implicit none\n integer(16),intent(in) :: a(:)\n integer(16) :: r( size(a) )\n !integer(16),allocatable :: r(:) !is OK\n integer(16) :: sample(3),len,i,j\n \n len = size(a)\n if( len>1 )then\n sample(1) = a(1)\n sample(2) = a(len/2)\n sample(3) = a(len)\n !select median\n do i = 1,2\n do j = 2,3\n if( sample(i)>sample(j) )then\n len = sample(i) !len is buffer\n sample(i) = sample(j)\n sample(j) = len\n end if\n end do\n end do\n \n r = [ qSort( pack( a(:),a(:)< sample(2) ) ), &\n pack( a(:),a(:)==sample(2) ) , &\n qSort( pack( a(:),a(:)> sample(2) ) ) ]\n else\n r = a\n end if\n end function i16qSort\n \n END MODULE qSortMod\n \n \n PROGRAM piyo\n use qSortMod\n IMPLICIT NONE\n integer(16) :: n,k\n integer(16),allocatable :: a(:)\n integer(16) :: ans,ant,post,i\n \n read*,k,n\n allocate( a(n) )\n read*,a\n \n a = qSort( a )\n \n if( n==2 )then\n print*,abs( a(2)-a(1) );stop\n end if\n \n \n ans = k\n do i = 1,n-1\n ans = min( ans,k-(a(i+1)-a(i)) )\n end do\n !i=n\n ans = min( ans,a(n)-a(1) )\n \n print*,ans\n \n !debugg\n ! print*,k,n\n ! print*,a\n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1585460270, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02725.html", "problem_id": "p02725", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02725/input.txt", "sample_output_relpath": "derived/input_output/data/p02725/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02725/Fortran/s558088811.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s558088811", "user_id": "u171356453"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": " MODULE qSortMod\n implicit none\n interface qSort\n module procedure :: i16qSort\n end interface\n contains\n \n pure recursive function i16qSort( a ) result( r )\n !ref\n !https://t.doujin-constant.net/\n !post/143374686394/fortranをより使いこなしたquick-sort\n !\n !left is smaller!\n implicit none\n integer(16),intent(in) :: a(:)\n integer(16) :: r( size(a) )\n !integer(16),allocatable :: r(:) !is OK\n integer(16) :: sample(3),len,i,j\n \n len = size(a)\n if( len>1 )then\n sample(1) = a(1)\n sample(2) = a(len/2)\n sample(3) = a(len)\n !select median\n do i = 1,2\n do j = 2,3\n if( sample(i)>sample(j) )then\n len = sample(i) !len is buffer\n sample(i) = sample(j)\n sample(j) = len\n end if\n end do\n end do\n \n r = [ qSort( pack( a(:),a(:)< sample(2) ) ), &\n pack( a(:),a(:)==sample(2) ) , &\n qSort( pack( a(:),a(:)> sample(2) ) ) ]\n else\n r = a\n end if\n end function i16qSort\n \n END MODULE qSortMod\n \n \n PROGRAM piyo\n use qSortMod\n IMPLICIT NONE\n integer(16) :: n,k\n integer(16),allocatable :: a(:)\n integer(16) :: ans,ant,post,i\n \n read*,k,n\n allocate( a(n) )\n read*,a\n \n a = qSort( a )\n \n if( n==2 )then\n print*,abs( a(2)-a(1) );stop\n end if\n \n \n ans = k\n do i = 1,n-1\n ans = min( ans,k-(a(i+1)-a(i)) )\n end do\n !i=n\n ans = min( ans,a(n)-a(1) )\n \n print*,ans\n \n !debugg\n ! print*,k,n\n ! print*,a\n \n \n END PROGRAM", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a circular pond with a perimeter of K meters, and N houses around them.\n\nThe i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond.\n\nWhen traveling between these houses, you can only go around the pond.\n\nFind the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nConstraints\n\n2 \\leq K \\leq 10^6\n\n2 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_1 < ... < A_N < K\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK N\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nSample Input 1\n\n20 3\n5 10 15\n\nSample Output 1\n\n10\n\nIf you start at the 1-st house and go to the 2-nd and 3-rd houses in this order, the total distance traveled will be 10.\n\nSample Input 2\n\n20 3\n0 5 15\n\nSample Output 2\n\n10\n\nIf you start at the 2-nd house and go to the 1-st and 3-rd houses in this order, the total distance traveled will be 10.", "sample_input": "20 3\n5 10 15\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02725", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a circular pond with a perimeter of K meters, and N houses around them.\n\nThe i-th house is built at a distance of A_i meters from the northmost point of the pond, measured clockwise around the pond.\n\nWhen traveling between these houses, you can only go around the pond.\n\nFind the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nConstraints\n\n2 \\leq K \\leq 10^6\n\n2 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_1 < ... < A_N < K\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK N\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum distance that needs to be traveled when you start at one of the houses and visit all the N houses.\n\nSample Input 1\n\n20 3\n5 10 15\n\nSample Output 1\n\n10\n\nIf you start at the 1-st house and go to the 2-nd and 3-rd houses in this order, the total distance traveled will be 10.\n\nSample Input 2\n\n20 3\n0 5 15\n\nSample Output 2\n\n10\n\nIf you start at the 2-nd house and go to the 1-st and 3-rd houses in this order, the total distance traveled will be 10.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1863, "cpu_time_ms": 207, "memory_kb": 14752}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s078113838", "group_id": "codeNet:p02726", "input_text": "program main\n implicit none\n integer :: n, x, y, i, j, dist, k\n integer, allocatable :: cnt(:)\n read (*, *) n, x, y\n allocate (cnt(n - 1))\n cnt(:) = 0\n do i = 1, n - 1\n do j = i + 1, n\n dist = j - i\n dist = min(dist, abs(j - y) + abs(i - x) + 1)\n dist = min(dist, abs(j - x) + abs(i - y) + 1)\n cnt(dist) = cnt(dist) + 1\n end do\n end do\n\n do k = 1, n - 1\n write (*, \"(i0)\") cnt(k)\n end do\nend program main\n", "language": "Fortran", "metadata": {"date": 1585495235, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02726.html", "problem_id": "p02726", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02726/input.txt", "sample_output_relpath": "derived/input_output/data/p02726/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02726/Fortran/s078113838.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s078113838", "user_id": "u388927326"}, "prompt_components": {"gold_output": "5\n4\n1\n0\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, x, y, i, j, dist, k\n integer, allocatable :: cnt(:)\n read (*, *) n, x, y\n allocate (cnt(n - 1))\n cnt(:) = 0\n do i = 1, n - 1\n do j = i + 1, n\n dist = j - i\n dist = min(dist, abs(j - y) + abs(i - x) + 1)\n dist = min(dist, abs(j - x) + abs(i - y) + 1)\n cnt(dist) = cnt(dist) + 1\n end do\n end do\n\n do k = 1, n - 1\n write (*, \"(i0)\") cnt(k)\n end do\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have an undirected graph G with N vertices numbered 1 to N and N edges as follows:\n\nFor each i=1,2,...,N-1, there is an edge between Vertex i and Vertex i+1.\n\nThere is an edge between Vertex X and Vertex Y.\n\nFor each k=1,2,...,N-1, solve the problem below:\n\nFind the number of pairs of integers (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j in G is k.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq X,Y \\leq N\n\nX+1 < Y\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X Y\n\nOutput\n\nFor each k=1, 2, ..., N-1 in this order, print a line containing the answer to the problem.\n\nSample Input 1\n\n5 2 4\n\nSample Output 1\n\n5\n4\n1\n0\n\nThe graph in this input is as follows:\n\nThere are five pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 1: (1,2)\\,,(2,3)\\,,(2,4)\\,,(3,4)\\,,(4,5).\n\nThere are four pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 2: (1,3)\\,,(1,4)\\,,(2,5)\\,,(3,5).\n\nThere is one pair (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 3: (1,5).\n\nThere are no pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 4.\n\nSample Input 2\n\n3 1 3\n\nSample Output 2\n\n3\n0\n\nThe graph in this input is as follows:\n\nSample Input 3\n\n7 3 7\n\nSample Output 3\n\n7\n8\n4\n2\n0\n0\n\nSample Input 4\n\n10 4 8\n\nSample Output 4\n\n10\n12\n10\n8\n4\n1\n0\n0\n0", "sample_input": "5 2 4\n"}, "reference_outputs": ["5\n4\n1\n0\n"], "source_document_id": "p02726", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have an undirected graph G with N vertices numbered 1 to N and N edges as follows:\n\nFor each i=1,2,...,N-1, there is an edge between Vertex i and Vertex i+1.\n\nThere is an edge between Vertex X and Vertex Y.\n\nFor each k=1,2,...,N-1, solve the problem below:\n\nFind the number of pairs of integers (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j in G is k.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq X,Y \\leq N\n\nX+1 < Y\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X Y\n\nOutput\n\nFor each k=1, 2, ..., N-1 in this order, print a line containing the answer to the problem.\n\nSample Input 1\n\n5 2 4\n\nSample Output 1\n\n5\n4\n1\n0\n\nThe graph in this input is as follows:\n\nThere are five pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 1: (1,2)\\,,(2,3)\\,,(2,4)\\,,(3,4)\\,,(4,5).\n\nThere are four pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 2: (1,3)\\,,(1,4)\\,,(2,5)\\,,(3,5).\n\nThere is one pair (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 3: (1,5).\n\nThere are no pairs (i,j) (1 \\leq i < j \\leq N) such that the shortest distance between Vertex i and Vertex j is 4.\n\nSample Input 2\n\n3 1 3\n\nSample Output 2\n\n3\n0\n\nThe graph in this input is as follows:\n\nSample Input 3\n\n7 3 7\n\nSample Output 3\n\n7\n8\n4\n2\n0\n0\n\nSample Input 4\n\n10 4 8\n\nSample Output 4\n\n10\n12\n10\n8\n4\n1\n0\n0\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 444, "cpu_time_ms": 8, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s376278206", "group_id": "codeNet:p02729", "input_text": "program atcoder322_1\n read(5,*)N,M\n if(N<=1) then\n K=0\n else\n K=N*(N-1)/2\n end if\n if(M<=1) then\n K=K+0\n else\n K=K+M*(M-1)/2\n end if\n write(6,*)M\nend program atcoder322_1", "language": "Fortran", "metadata": {"date": 1584925780, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02729.html", "problem_id": "p02729", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02729/input.txt", "sample_output_relpath": "derived/input_output/data/p02729/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02729/Fortran/s376278206.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s376278206", "user_id": "u359178469"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program atcoder322_1\n read(5,*)N,M\n if(N<=1) then\n K=0\n else\n K=N*(N-1)/2\n end if\n if(M<=1) then\n K=K+0\n else\n K=K+M*(M-1)/2\n end if\n write(6,*)M\nend program atcoder322_1", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have N+M balls, each of which has an integer written on it.\n\nIt is known that:\n\nThe numbers written on N of the balls are even.\n\nThe numbers written on M of the balls are odd.\n\nFind the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.\n\nIt can be shown that this count does not depend on the actual values written on the balls.\n\nConstraints\n\n0 \\leq N,M \\leq 100\n\n2 \\leq N+M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 1\n\nSample Output 1\n\n1\n\nFor example, let us assume that the numbers written on the three balls are 1,2,4.\n\nIf we choose the two balls with 1 and 2, the sum is odd;\n\nIf we choose the two balls with 1 and 4, the sum is odd;\n\nIf we choose the two balls with 2 and 4, the sum is even.\n\nThus, the answer is 1.\n\nSample Input 2\n\n4 3\n\nSample Output 2\n\n9\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n13 3\n\nSample Output 4\n\n81\n\nSample Input 5\n\n0 3\n\nSample Output 5\n\n3", "sample_input": "2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02729", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have N+M balls, each of which has an integer written on it.\n\nIt is known that:\n\nThe numbers written on N of the balls are even.\n\nThe numbers written on M of the balls are odd.\n\nFind the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.\n\nIt can be shown that this count does not depend on the actual values written on the balls.\n\nConstraints\n\n0 \\leq N,M \\leq 100\n\n2 \\leq N+M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 1\n\nSample Output 1\n\n1\n\nFor example, let us assume that the numbers written on the three balls are 1,2,4.\n\nIf we choose the two balls with 1 and 2, the sum is odd;\n\nIf we choose the two balls with 1 and 4, the sum is odd;\n\nIf we choose the two balls with 2 and 4, the sum is even.\n\nThus, the answer is 1.\n\nSample Input 2\n\n4 3\n\nSample Output 2\n\n9\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n13 3\n\nSample Output 4\n\n81\n\nSample Input 5\n\n0 3\n\nSample Output 5\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 194, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s756585509", "group_id": "codeNet:p02729", "input_text": "program am\n implicit none\n integer::N,M\n read*,N,M\n print\"(I0)\",(N*(N-1))/2+(M*(M-1))/2\nend program am", "language": "Fortran", "metadata": {"date": 1584925345, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02729.html", "problem_id": "p02729", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02729/input.txt", "sample_output_relpath": "derived/input_output/data/p02729/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02729/Fortran/s756585509.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s756585509", "user_id": "u598073939"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program am\n implicit none\n integer::N,M\n read*,N,M\n print\"(I0)\",(N*(N-1))/2+(M*(M-1))/2\nend program am", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have N+M balls, each of which has an integer written on it.\n\nIt is known that:\n\nThe numbers written on N of the balls are even.\n\nThe numbers written on M of the balls are odd.\n\nFind the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.\n\nIt can be shown that this count does not depend on the actual values written on the balls.\n\nConstraints\n\n0 \\leq N,M \\leq 100\n\n2 \\leq N+M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 1\n\nSample Output 1\n\n1\n\nFor example, let us assume that the numbers written on the three balls are 1,2,4.\n\nIf we choose the two balls with 1 and 2, the sum is odd;\n\nIf we choose the two balls with 1 and 4, the sum is odd;\n\nIf we choose the two balls with 2 and 4, the sum is even.\n\nThus, the answer is 1.\n\nSample Input 2\n\n4 3\n\nSample Output 2\n\n9\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n13 3\n\nSample Output 4\n\n81\n\nSample Input 5\n\n0 3\n\nSample Output 5\n\n3", "sample_input": "2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02729", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have N+M balls, each of which has an integer written on it.\n\nIt is known that:\n\nThe numbers written on N of the balls are even.\n\nThe numbers written on M of the balls are odd.\n\nFind the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even.\n\nIt can be shown that this count does not depend on the actual values written on the balls.\n\nConstraints\n\n0 \\leq N,M \\leq 100\n\n2 \\leq N+M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 1\n\nSample Output 1\n\n1\n\nFor example, let us assume that the numbers written on the three balls are 1,2,4.\n\nIf we choose the two balls with 1 and 2, the sum is odd;\n\nIf we choose the two balls with 1 and 4, the sum is odd;\n\nIf we choose the two balls with 2 and 4, the sum is even.\n\nThus, the answer is 1.\n\nSample Input 2\n\n4 3\n\nSample Output 2\n\n9\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n13 3\n\nSample Output 4\n\n81\n\nSample Input 5\n\n0 3\n\nSample Output 5\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 114, "cpu_time_ms": 6, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s980148293", "group_id": "codeNet:p02730", "input_text": "program main\n implicit none\n integer i, n, m, l, c, flag\n character s*99\n\n read(*,*) s\n n = len_trim(s)\n\n flag = 0\n\n do i = 1, (n-1)/2\n if(s(i:i) == s((n+1-i):(n+1-i))) then\n flag = 0\n else \n flag = 1\n end if\n end do\n\n\n if (flag == 0) then\n m = (n-1)/2\n\n do i = 1, m/2\n if(s(i:i) == s((m+1-i):(m+1-i))) then\n flag = 0\n else \n flag = 1\n end if\n end do\n end if\n \n if (flag == 0) then\n\n l = (n+3)/2\n c = 1\n\n do i = l, (n-l+1)/2+l\n if(s(i:i) == s((n+1-c):(n+1-c))) then\n flag = 0\n else \n flag = 1\n end if\n c = c + 1\n end do\n end if\n\n\n if (flag == 0) then\n write(*,*) \"Yes\"\n else\n write(*,*) \"No\"\n end if\n\nend program", "language": "Fortran", "metadata": {"date": 1584927289, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02730.html", "problem_id": "p02730", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02730/input.txt", "sample_output_relpath": "derived/input_output/data/p02730/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02730/Fortran/s980148293.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s980148293", "user_id": "u806372060"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n implicit none\n integer i, n, m, l, c, flag\n character s*99\n\n read(*,*) s\n n = len_trim(s)\n\n flag = 0\n\n do i = 1, (n-1)/2\n if(s(i:i) == s((n+1-i):(n+1-i))) then\n flag = 0\n else \n flag = 1\n end if\n end do\n\n\n if (flag == 0) then\n m = (n-1)/2\n\n do i = 1, m/2\n if(s(i:i) == s((m+1-i):(m+1-i))) then\n flag = 0\n else \n flag = 1\n end if\n end do\n end if\n \n if (flag == 0) then\n\n l = (n+3)/2\n c = 1\n\n do i = l, (n-l+1)/2+l\n if(s(i:i) == s((n+1-c):(n+1-c))) then\n flag = 0\n else \n flag = 1\n end if\n c = c + 1\n end do\n end if\n\n\n if (flag == 0) then\n write(*,*) \"Yes\"\n else\n write(*,*) \"No\"\n end if\n\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "sample_input": "akasaka\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02730", "source_text": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 903, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s341238514", "group_id": "codeNet:p02730", "input_text": "program example\n\timplicit none\n \n character(100) S,A,B\n integer :: N,i,countA=0,countB=0\n \n read(*,*) S\n \n S=adjustl(S)\n \n N=len_trim(S)\n \n A=S(1:(N-1)/2)\n \n B=S((N+3)/2:N)\n\n\tdo i=1,(N-1)/2\n \n \tif(A(i:i)==A(((N-1)/2)+1-i:((N-1)/2)+1-i)) then\n \tcountA=countA+1\n end if\n \n end do\n \n do i=(N+3)/2,N\n \n \tif(B(i:i)==B(N+((N+3)/2)-i:N+((N+3)/2)-i)) then\n \tcountB=countB+1\n end if\n \n end do\n \n if(countA==((N-1)/2) .and. countB==((N-1)/2)) then\n \twrite(*,*) \"Yes\"\n else\n \twrite(*,*) \"No\"\n \n end if\n \nend program", "language": "Fortran", "metadata": {"date": 1584926891, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02730.html", "problem_id": "p02730", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02730/input.txt", "sample_output_relpath": "derived/input_output/data/p02730/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02730/Fortran/s341238514.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s341238514", "user_id": "u374107737"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program example\n\timplicit none\n \n character(100) S,A,B\n integer :: N,i,countA=0,countB=0\n \n read(*,*) S\n \n S=adjustl(S)\n \n N=len_trim(S)\n \n A=S(1:(N-1)/2)\n \n B=S((N+3)/2:N)\n\n\tdo i=1,(N-1)/2\n \n \tif(A(i:i)==A(((N-1)/2)+1-i:((N-1)/2)+1-i)) then\n \tcountA=countA+1\n end if\n \n end do\n \n do i=(N+3)/2,N\n \n \tif(B(i:i)==B(N+((N+3)/2)-i:N+((N+3)/2)-i)) then\n \tcountB=countB+1\n end if\n \n end do\n \n if(countA==((N-1)/2) .and. countB==((N-1)/2)) then\n \twrite(*,*) \"Yes\"\n else\n \twrite(*,*) \"No\"\n \n end if\n \nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "sample_input": "akasaka\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02730", "source_text": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 629, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s228510292", "group_id": "codeNet:p02730", "input_text": "program ABC159B\n implicit none\n integer(8)::i,N,flg\n character(99)::S\n read*,S\n N=len_trim(S)\n flg=0\n\n do i=1,N/2\n if(S(i:i)/=S(N-i+1:N-i+1))flg=1\n end do\n\n do i=1,N/4\n if(S(i:i)/=S(N/2-i+1:N/2-i+1))flg=1\n if(S(N/2+1+i:N/2+1+i)/=S(N-i+1:N-i+1))flg=1\n end do\n if(flg==0)print'(A)',\"Yes\"\n if(flg==1)print'(A)',\"No\"\nend program ABC159B", "language": "Fortran", "metadata": {"date": 1584925887, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02730.html", "problem_id": "p02730", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02730/input.txt", "sample_output_relpath": "derived/input_output/data/p02730/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02730/Fortran/s228510292.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s228510292", "user_id": "u414699019"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program ABC159B\n implicit none\n integer(8)::i,N,flg\n character(99)::S\n read*,S\n N=len_trim(S)\n flg=0\n\n do i=1,N/2\n if(S(i:i)/=S(N-i+1:N-i+1))flg=1\n end do\n\n do i=1,N/4\n if(S(i:i)/=S(N/2-i+1:N/2-i+1))flg=1\n if(S(N/2+1+i:N/2+1+i)/=S(N-i+1:N-i+1))flg=1\n end do\n if(flg==0)print'(A)',\"Yes\"\n if(flg==1)print'(A)',\"No\"\nend program ABC159B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "sample_input": "akasaka\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02730", "source_text": "Score : 200 points\n\nProblem Statement\n\nA string S of an odd length is said to be a strong palindrome if and only if all of the following conditions are satisfied:\n\nS is a palindrome.\n\nLet N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome.\n\nThe string consisting of the (N+3)/2-st through N-th characters of S is a palindrome.\n\nDetermine whether S is a strong palindrome.\n\nConstraints\n\nS consists of lowercase English letters.\n\nThe length of S is an odd number between 3 and 99 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a strong palindrome, print Yes;\notherwise, print No.\n\nSample Input 1\n\nakasaka\n\nSample Output 1\n\nYes\n\nS is akasaka.\n\nThe string formed by the 1-st through the 3-rd characters is aka.\n\nThe string formed by the 5-th through the 7-th characters is aka.\nAll of these are palindromes, so S is a strong palindrome.\n\nSample Input 2\n\nlevel\n\nSample Output 2\n\nNo\n\nSample Input 3\n\natcoder\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 389, "cpu_time_ms": 3, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s130363987", "group_id": "codeNet:p02731", "input_text": "program max_volume\n implicit none\n integer n\n double precision m\n double precision :: maxv = 0.0\n read *, n\n m = dble(n)\n maxv = (m/3)**3\n print *, maxv\nend program ", "language": "Fortran", "metadata": {"date": 1598454037, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02731.html", "problem_id": "p02731", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02731/input.txt", "sample_output_relpath": "derived/input_output/data/p02731/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02731/Fortran/s130363987.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s130363987", "user_id": "u622206408"}, "prompt_components": {"gold_output": "1.000000000000\n", "input_to_evaluate": "program max_volume\n implicit none\n integer n\n double precision m\n double precision :: maxv = 0.0\n read *, n\n m = dble(n)\n maxv = (m/3)**3\n print *, maxv\nend program ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer L.\nFind the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n1 ≤ L ≤ 1000\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nPrint the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\nYour output is considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1.000000000000\n\nFor example, a rectangular cuboid whose dimensions are 0.8, 1, and 1.2 has a volume of 0.96.\n\nOn the other hand, if the dimensions are 1, 1, and 1, the volume of the rectangular cuboid is 1, which is greater.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n36926037.000000000000", "sample_input": "3\n"}, "reference_outputs": ["1.000000000000\n"], "source_document_id": "p02731", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer L.\nFind the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n1 ≤ L ≤ 1000\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nPrint the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\nYour output is considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1.000000000000\n\nFor example, a rectangular cuboid whose dimensions are 0.8, 1, and 1.2 has a volume of 0.96.\n\nOn the other hand, if the dimensions are 1, 1, and 1, the volume of the rectangular cuboid is 1, which is greater.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n36926037.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 192, "cpu_time_ms": 15, "memory_kb": 3000}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s656285420", "group_id": "codeNet:p02731", "input_text": " program c159\n integer L\n real*8 V\n\n read(*,*)L\n\n V = (L/3)**3 \n\n \n write(*,*)V\n \n \n end program c159\n\n\n ", "language": "Fortran", "metadata": {"date": 1586455431, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02731.html", "problem_id": "p02731", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02731/input.txt", "sample_output_relpath": "derived/input_output/data/p02731/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02731/Fortran/s656285420.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s656285420", "user_id": "u062754605"}, "prompt_components": {"gold_output": "1.000000000000\n", "input_to_evaluate": " program c159\n integer L\n real*8 V\n\n read(*,*)L\n\n V = (L/3)**3 \n\n \n write(*,*)V\n \n \n end program c159\n\n\n ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer L.\nFind the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n1 ≤ L ≤ 1000\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nPrint the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\nYour output is considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1.000000000000\n\nFor example, a rectangular cuboid whose dimensions are 0.8, 1, and 1.2 has a volume of 0.96.\n\nOn the other hand, if the dimensions are 1, 1, and 1, the volume of the rectangular cuboid is 1, which is greater.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n36926037.000000000000", "sample_input": "3\n"}, "reference_outputs": ["1.000000000000\n"], "source_document_id": "p02731", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a positive integer L.\nFind the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\n\nConstraints\n\n1 ≤ L ≤ 1000\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nPrint the maximum possible volume of a rectangular cuboid whose sum of the dimensions (not necessarily integers) is L.\nYour output is considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1.000000000000\n\nFor example, a rectangular cuboid whose dimensions are 0.8, 1, and 1.2 has a volume of 0.96.\n\nOn the other hand, if the dimensions are 1, 1, and 1, the volume of the rectangular cuboid is 1, which is greater.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n36926037.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 160, "cpu_time_ms": 9, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s588894450", "group_id": "codeNet:p02732", "input_text": "program atcoder322_D\n integer,dimension(200000) :: A,B\n read(5,*)N\n read(5,*)A(1:N)\n do I=1,N-1\n do J=I+1,N\n if(A(J)==A(I)) B(I)=B(I)+1\n end do\n do K=1,N \n write(6,*)sum(B)-B(K)\n end do\nend do\nend program atcoder322_D", "language": "Fortran", "metadata": {"date": 1584931040, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02732.html", "problem_id": "p02732", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02732/input.txt", "sample_output_relpath": "derived/input_output/data/p02732/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02732/Fortran/s588894450.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s588894450", "user_id": "u359178469"}, "prompt_components": {"gold_output": "2\n2\n3\n2\n3\n", "input_to_evaluate": "program atcoder322_D\n integer,dimension(200000) :: A,B\n read(5,*)N\n read(5,*)A(1:N)\n do I=1,N-1\n do J=I+1,N\n if(A(J)==A(I)) B(I)=B(I)+1\n end do\n do K=1,N \n write(6,*)sum(B)-B(K)\n end do\nend do\nend program atcoder322_D", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "sample_input": "5\n1 1 2 1 2\n"}, "reference_outputs": ["2\n2\n3\n2\n3\n"], "source_document_id": "p02732", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 253, "cpu_time_ms": 2103, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s081225926", "group_id": "codeNet:p02732", "input_text": "program main\n implicit none\n integer(8) n, m, sum\n integer(8), allocatable, dimension(:) :: a, b\n integer(8) i,k\n\n read(*,*) n\n allocate(a(n))\n allocate(b(n))\n read(*,*) a\n\n b = 0\n\n do i = 1, n\n b(a(i)) = b(a(i)) + 1\n end do\n\n sum = 0\n\n do i = 1, n\n if(b(i) > 1) then\n sum = sum + b(i)*(b(i)-1)/2\n end if\n end do\n\n do k = 1, n\n if (b(a(k)) > 2) then\n write(*,*) sum - b(a(k))*(b(a(k))-1)/2 + (b(a(k))-1)*(b(a(k))-2)/2\n else if (b(a(k)) == 2) then\n write(*,*) sum - 1\n else\n write(*,*) sum\n end if\n end do\n\n\nend program", "language": "Fortran", "metadata": {"date": 1584930383, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02732.html", "problem_id": "p02732", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02732/input.txt", "sample_output_relpath": "derived/input_output/data/p02732/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02732/Fortran/s081225926.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s081225926", "user_id": "u806372060"}, "prompt_components": {"gold_output": "2\n2\n3\n2\n3\n", "input_to_evaluate": "program main\n implicit none\n integer(8) n, m, sum\n integer(8), allocatable, dimension(:) :: a, b\n integer(8) i,k\n\n read(*,*) n\n allocate(a(n))\n allocate(b(n))\n read(*,*) a\n\n b = 0\n\n do i = 1, n\n b(a(i)) = b(a(i)) + 1\n end do\n\n sum = 0\n\n do i = 1, n\n if(b(i) > 1) then\n sum = sum + b(i)*(b(i)-1)/2\n end if\n end do\n\n do k = 1, n\n if (b(a(k)) > 2) then\n write(*,*) sum - b(a(k))*(b(a(k))-1)/2 + (b(a(k))-1)*(b(a(k))-2)/2\n else if (b(a(k)) == 2) then\n write(*,*) sum - 1\n else\n write(*,*) sum\n end if\n end do\n\n\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "sample_input": "5\n1 1 2 1 2\n"}, "reference_outputs": ["2\n2\n3\n2\n3\n"], "source_document_id": "p02732", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 659, "cpu_time_ms": 136, "memory_kb": 8192}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s161204766", "group_id": "codeNet:p02732", "input_text": "program main\n \n implicit none\n\n integer :: n\n integer, allocatable :: a(:), b(:), c(:)\n\n integer :: i,j, tmp\n integer(8) :: sumb\n\n read(*,*) n\n allocate( a(n) )\n allocate( b(n) )\n allocate( c(n) )\n read(*,*) a\n\n b = 0 \n c = 0 \n do i = 1, n\n c(a(i)) = c(a(i)) + 1\n end do\n sumb = 0\n do i = 1, n\n if( mod(c(i),2) == 0 ) then\n tmp = c(i) / 2\n b(i) = tmp*(c(i)-1)\n else\n tmp = (c(i)-1) / 2\n b(i) = c(i)*tmp\n end if\n sumb = sumb + b(i)\n end do\n\n do i = 1, n\n if( mod(c(a(i)),2) == 0 ) then\n tmp = (c(a(i))-2) / 2\n print*, sumb - b(a(i)) + tmp*(c(a(i))-1)\n else\n tmp = (c(a(i))-1) / 2\n print*, sumb - b(a(i)) + tmp*(c(a(i))-2)\n end if\n end do\n \n \nend program main\n", "language": "Fortran", "metadata": {"date": 1584930269, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02732.html", "problem_id": "p02732", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02732/input.txt", "sample_output_relpath": "derived/input_output/data/p02732/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02732/Fortran/s161204766.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s161204766", "user_id": "u675314298"}, "prompt_components": {"gold_output": "2\n2\n3\n2\n3\n", "input_to_evaluate": "program main\n \n implicit none\n\n integer :: n\n integer, allocatable :: a(:), b(:), c(:)\n\n integer :: i,j, tmp\n integer(8) :: sumb\n\n read(*,*) n\n allocate( a(n) )\n allocate( b(n) )\n allocate( c(n) )\n read(*,*) a\n\n b = 0 \n c = 0 \n do i = 1, n\n c(a(i)) = c(a(i)) + 1\n end do\n sumb = 0\n do i = 1, n\n if( mod(c(i),2) == 0 ) then\n tmp = c(i) / 2\n b(i) = tmp*(c(i)-1)\n else\n tmp = (c(i)-1) / 2\n b(i) = c(i)*tmp\n end if\n sumb = sumb + b(i)\n end do\n\n do i = 1, n\n if( mod(c(a(i)),2) == 0 ) then\n tmp = (c(a(i))-2) / 2\n print*, sumb - b(a(i)) + tmp*(c(a(i))-1)\n else\n tmp = (c(a(i))-1) / 2\n print*, sumb - b(a(i)) + tmp*(c(a(i))-2)\n end if\n end do\n \n \nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "sample_input": "5\n1 1 2 1 2\n"}, "reference_outputs": ["2\n2\n3\n2\n3\n"], "source_document_id": "p02732", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 749, "cpu_time_ms": 131, "memory_kb": 7424}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s832027963", "group_id": "codeNet:p02732", "input_text": "program main\n \n implicit none\n\n integer :: n\n integer, allocatable :: a(:), b(:), c(:)\n\n integer :: i,j\n integer(8) :: sumb\n\n read(*,*) n\n allocate( a(n) )\n allocate( b(n) )\n allocate( c(n) )\n read(*,*) a\n\n b = 0 \n c = 0 \n do i = 1, n\n c(a(i)) = c(a(i)) + 1\n end do\n sumb = 0\n do i = 1, n\n b(i) = c(i)*(c(i)-1)/2\n sumb = sumb + b(i)\n end do\n\n do i = 1, n\n print*, sumb - b(a(i)) + (c(a(i))-2)*(c(a(i))-1)/2\n end do\n \n \nend program main\n", "language": "Fortran", "metadata": {"date": 1584929965, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02732.html", "problem_id": "p02732", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02732/input.txt", "sample_output_relpath": "derived/input_output/data/p02732/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02732/Fortran/s832027963.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s832027963", "user_id": "u675314298"}, "prompt_components": {"gold_output": "2\n2\n3\n2\n3\n", "input_to_evaluate": "program main\n \n implicit none\n\n integer :: n\n integer, allocatable :: a(:), b(:), c(:)\n\n integer :: i,j\n integer(8) :: sumb\n\n read(*,*) n\n allocate( a(n) )\n allocate( b(n) )\n allocate( c(n) )\n read(*,*) a\n\n b = 0 \n c = 0 \n do i = 1, n\n c(a(i)) = c(a(i)) + 1\n end do\n sumb = 0\n do i = 1, n\n b(i) = c(i)*(c(i)-1)/2\n sumb = sumb + b(i)\n end do\n\n do i = 1, n\n print*, sumb - b(a(i)) + (c(a(i))-2)*(c(a(i))-1)/2\n end do\n \n \nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "sample_input": "5\n1 1 2 1 2\n"}, "reference_outputs": ["2\n2\n3\n2\n3\n"], "source_document_id": "p02732", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 474, "cpu_time_ms": 129, "memory_kb": 7680}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s353236310", "group_id": "codeNet:p02732", "input_text": "program main\n implicit none\n integer n, m, sum\n integer, allocatable, dimension(:) :: a, b\n integer i,k\n\n read(*,*) n\n allocate(a(n))\n allocate(b(n))\n read(*,*) a\n\n b = 0\n\n do i = 1, n\n b(a(i)) = b(a(i)) + 1\n end do\n\n sum = 0\n\n do i = 1, n\n if(b(i) > 1) then\n sum = sum + b(i)*(b(i)-1)/2\n end if\n end do\n\n do k = 1, n\n if (b(a(k)) > 2) then\n write(*,*) sum - b(a(k))*(b(a(k))-1)/2 + (b(a(k))-1)*(b(a(k))-2)/2\n else if (b(a(k)) == 2) then\n write(*,*) sum - 1\n else\n write(*,*) sum\n end if\n end do\n\n\nend program", "language": "Fortran", "metadata": {"date": 1584929485, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02732.html", "problem_id": "p02732", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02732/input.txt", "sample_output_relpath": "derived/input_output/data/p02732/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02732/Fortran/s353236310.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s353236310", "user_id": "u806372060"}, "prompt_components": {"gold_output": "2\n2\n3\n2\n3\n", "input_to_evaluate": "program main\n implicit none\n integer n, m, sum\n integer, allocatable, dimension(:) :: a, b\n integer i,k\n\n read(*,*) n\n allocate(a(n))\n allocate(b(n))\n read(*,*) a\n\n b = 0\n\n do i = 1, n\n b(a(i)) = b(a(i)) + 1\n end do\n\n sum = 0\n\n do i = 1, n\n if(b(i) > 1) then\n sum = sum + b(i)*(b(i)-1)/2\n end if\n end do\n\n do k = 1, n\n if (b(a(k)) > 2) then\n write(*,*) sum - b(a(k))*(b(a(k))-1)/2 + (b(a(k))-1)*(b(a(k))-2)/2\n else if (b(a(k)) == 2) then\n write(*,*) sum - 1\n else\n write(*,*) sum\n end if\n end do\n\n\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "sample_input": "5\n1 1 2 1 2\n"}, "reference_outputs": ["2\n2\n3\n2\n3\n"], "source_document_id": "p02732", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N balls. The i-th ball has an integer A_i written on it.\n\nFor each k=1, 2, ..., N, solve the following problem and print the answer.\n\nFind the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal.\n\nConstraints\n\n3 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFor each k=1,2,...,N, print a line containing the answer.\n\nSample Input 1\n\n5\n1 1 2 1 2\n\nSample Output 1\n\n2\n2\n3\n2\n3\n\nConsider the case k=1 for example. The numbers written on the remaining balls are 1,2,1,2.\n\nFrom these balls, there are two ways to choose two distinct balls so that the integers written on them are equal.\n\nThus, the answer for k=1 is 2.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n0\n0\n0\n\nNo two balls have equal numbers written on them.\n\nSample Input 3\n\n5\n3 3 3 3 3\n\nSample Output 3\n\n6\n6\n6\n6\n6\n\nAny two balls have equal numbers written on them.\n\nSample Input 4\n\n8\n1 2 1 4 2 1 4 1\n\nSample Output 4\n\n5\n7\n5\n7\n7\n5\n7\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 650, "cpu_time_ms": 126, "memory_kb": 4864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s101256910", "group_id": "codeNet:p02733", "input_text": "program main\n implicit none\n integer(8):: h=10,w=1000,k=1000\n integer(8):: i,j\n integer(8), allocatable:: c(:,:), now(:)\n integer(8), parameter:: inf = 1001001001\n character(1), allocatable:: s(:,:)\n read*, h,w,k\n \n allocate(s(w,h))\n\n block\n character(:), allocatable:: input_s\n allocate(character(w)::input_s)\n\n do i=1,h\n read*, input_s(:)\n do j=1,w\n s(j,i) = input_s(j:j)\n end do\n end do\n end block\n\n s(:,:) = '0'\n\n block\n integer(8):: div, g, ints, num\n integer(8):: ans = inf\n integer(8), allocatable:: id(:)\n logical:: emp, ok\n\n allocate(id(h))\n do div=1, lshift(1, h-1)\n g = 1\n\n do i=1, h\n id(i) = g\n if (and(rshift(div-1,i-1), 1) == 1) g=g+1\n end do\n\n allocate(c(w, maxval(id)))\n c(:,:) = 0\n\n do i=1,h\n do j=1,w\n read(s(j,i),'(i1)') ints\n c(j,id(i))=c(j,id(i))+ints\n end do \n end do\n\n ! ok=.true.\n ! do i=1,g\n ! do j=1,w\n ! if(c(j,i) > k) ok = .false.\n ! end do\n ! end do\n\n ! if (.not. ok) then\n ! deallocate(c)\n ! cycle\n ! end if\n\n allocate(now(g+1))\n ! num = g-1\n now(:) = 0\n ! do j=1,w\n ! if (.not. add(j,g)) then\n ! num=num+1\n ! now(:)=0\n ! emp = add(j,g)\n ! end if\n ! end do \n\n ans = min(ans,num)\n deallocate(c)\n deallocate(now)\n end do\n\n print*, ans\n end block\n\ncontains\nfunction add(j,g) result(ok)\n integer(8):: i,j,g\n logical:: ok\n\n do i=1,g\n now(i)=now(i)+c(j,i)\n end do\n\n ok=.true.\n do i=1,g+1\n if (now(i) > k) ok=.false.\n end do\nend function\n\nend program main", "language": "Fortran", "metadata": {"date": 1584979961, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02733.html", "problem_id": "p02733", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02733/input.txt", "sample_output_relpath": "derived/input_output/data/p02733/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02733/Fortran/s101256910.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s101256910", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer(8):: h=10,w=1000,k=1000\n integer(8):: i,j\n integer(8), allocatable:: c(:,:), now(:)\n integer(8), parameter:: inf = 1001001001\n character(1), allocatable:: s(:,:)\n read*, h,w,k\n \n allocate(s(w,h))\n\n block\n character(:), allocatable:: input_s\n allocate(character(w)::input_s)\n\n do i=1,h\n read*, input_s(:)\n do j=1,w\n s(j,i) = input_s(j:j)\n end do\n end do\n end block\n\n s(:,:) = '0'\n\n block\n integer(8):: div, g, ints, num\n integer(8):: ans = inf\n integer(8), allocatable:: id(:)\n logical:: emp, ok\n\n allocate(id(h))\n do div=1, lshift(1, h-1)\n g = 1\n\n do i=1, h\n id(i) = g\n if (and(rshift(div-1,i-1), 1) == 1) g=g+1\n end do\n\n allocate(c(w, maxval(id)))\n c(:,:) = 0\n\n do i=1,h\n do j=1,w\n read(s(j,i),'(i1)') ints\n c(j,id(i))=c(j,id(i))+ints\n end do \n end do\n\n ! ok=.true.\n ! do i=1,g\n ! do j=1,w\n ! if(c(j,i) > k) ok = .false.\n ! end do\n ! end do\n\n ! if (.not. ok) then\n ! deallocate(c)\n ! cycle\n ! end if\n\n allocate(now(g+1))\n ! num = g-1\n now(:) = 0\n ! do j=1,w\n ! if (.not. add(j,g)) then\n ! num=num+1\n ! now(:)=0\n ! emp = add(j,g)\n ! end if\n ! end do \n\n ans = min(ans,num)\n deallocate(c)\n deallocate(now)\n end do\n\n print*, ans\n end block\n\ncontains\nfunction add(j,g) result(ok)\n integer(8):: i,j,g\n logical:: ok\n\n do i=1,g\n now(i)=now(i)+c(j,i)\n end do\n\n ok=.true.\n do i=1,g+1\n if (now(i) > k) ok=.false.\n end do\nend function\n\nend program main", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\n\nThe square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.\n\nWe will cut the bar some number of times to divide it into some number of blocks. In each cut, we cut the whole bar by a line running along some boundaries of squares from end to end of the bar.\n\nHow many times do we need to cut the bar so that every block after the cuts has K or less white squares?\n\nConstraints\n\n1 \\leq H \\leq 10\n\n1 \\leq W \\leq 1000\n\n1 \\leq K \\leq H \\times W\n\nS_{i,j} is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nS_{1,1}S_{1,2}...S_{1,W}\n:\nS_{H,1}S_{H,2}...S_{H,W}\n\nOutput\n\nPrint the number of minimum times the bar needs to be cut so that every block after the cuts has K or less white squares.\n\nSample Input 1\n\n3 5 4\n11100\n10001\n00111\n\nSample Output 1\n\n2\n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and 4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the right.\n\nSample Input 2\n\n3 5 8\n11100\n10001\n00111\n\nSample Output 2\n\n0\n\nNo cut is needed.\n\nSample Input 3\n\n4 10 4\n1110010010\n1000101110\n0011101001\n1101000111\n\nSample Output 3\n\n3", "sample_input": "3 5 4\n11100\n10001\n00111\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02733", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\n\nThe square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.\n\nWe will cut the bar some number of times to divide it into some number of blocks. In each cut, we cut the whole bar by a line running along some boundaries of squares from end to end of the bar.\n\nHow many times do we need to cut the bar so that every block after the cuts has K or less white squares?\n\nConstraints\n\n1 \\leq H \\leq 10\n\n1 \\leq W \\leq 1000\n\n1 \\leq K \\leq H \\times W\n\nS_{i,j} is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nS_{1,1}S_{1,2}...S_{1,W}\n:\nS_{H,1}S_{H,2}...S_{H,W}\n\nOutput\n\nPrint the number of minimum times the bar needs to be cut so that every block after the cuts has K or less white squares.\n\nSample Input 1\n\n3 5 4\n11100\n10001\n00111\n\nSample Output 1\n\n2\n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and 4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the right.\n\nSample Input 2\n\n3 5 8\n11100\n10001\n00111\n\nSample Output 2\n\n0\n\nNo cut is needed.\n\nSample Input 3\n\n4 10 4\n1110010010\n1000101110\n0011101001\n1101000111\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2068, "cpu_time_ms": 2103, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s565585709", "group_id": "codeNet:p02733", "input_text": "program main\n implicit none\n integer(8):: h=10,w=1000,k=1000\n integer(8):: i,j\n integer(8), allocatable:: c(:,:), now(:)\n integer(8), parameter:: inf = 1001001001\n character(1), allocatable:: s(:,:)\n read*, h,w,k\n \n allocate(s(w,h))\n\n block\n character(:), allocatable:: input_s\n allocate(character(w)::input_s)\n\n do i=1,h\n read*, input_s(:)\n do j=1,w\n s(j,i) = input_s(j:j)\n end do\n end do\n end block\n\n s(:,:) = '0'\n\n block\n integer(8):: div, g, ints, num\n integer(8):: ans = inf\n integer(8), allocatable:: id(:)\n logical:: emp, ok\n\n allocate(id(h))\n do div=1, lshift(1, h-1)\n g = 1\n\n do i=1, h\n id(i) = g\n if (and(rshift(div-1,i-1), 1) == 1) g=g+1\n end do\n\n allocate(c(w, maxval(id)))\n c(:,:) = 0\n\n do i=1,h\n do j=1,w\n read(s(j,i),*) ints\n c(j,id(i))=c(j,id(i))+ints\n end do \n end do\n\n ok=.true.\n do i=1,g\n do j=1,w\n if(c(j,i) > k) ok = .false.\n end do\n end do\n\n if (.not. ok) then\n deallocate(c)\n cycle\n end if\n\n allocate(now(g+1))\n ! num = g-1\n ! now(:) = 0\n ! do j=1,w\n ! if (.not. add(j,g)) then\n ! num=num+1\n ! now(:)=0\n ! emp = add(j,g)\n ! end if\n ! end do \n\n ans = min(ans,num)\n deallocate(c)\n deallocate(now)\n end do\n\n print*, ans\n end block\n\ncontains\nfunction add(j,g) result(ok)\n integer(8):: i,j,g\n logical:: ok\n\n do i=1,g\n now(i)=now(i)+c(j,i)\n end do\n\n ok=.true.\n do i=1,g+1\n if (now(i) > k) ok=.false.\n end do\nend function\n\nend program main", "language": "Fortran", "metadata": {"date": 1584979670, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02733.html", "problem_id": "p02733", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02733/input.txt", "sample_output_relpath": "derived/input_output/data/p02733/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02733/Fortran/s565585709.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s565585709", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer(8):: h=10,w=1000,k=1000\n integer(8):: i,j\n integer(8), allocatable:: c(:,:), now(:)\n integer(8), parameter:: inf = 1001001001\n character(1), allocatable:: s(:,:)\n read*, h,w,k\n \n allocate(s(w,h))\n\n block\n character(:), allocatable:: input_s\n allocate(character(w)::input_s)\n\n do i=1,h\n read*, input_s(:)\n do j=1,w\n s(j,i) = input_s(j:j)\n end do\n end do\n end block\n\n s(:,:) = '0'\n\n block\n integer(8):: div, g, ints, num\n integer(8):: ans = inf\n integer(8), allocatable:: id(:)\n logical:: emp, ok\n\n allocate(id(h))\n do div=1, lshift(1, h-1)\n g = 1\n\n do i=1, h\n id(i) = g\n if (and(rshift(div-1,i-1), 1) == 1) g=g+1\n end do\n\n allocate(c(w, maxval(id)))\n c(:,:) = 0\n\n do i=1,h\n do j=1,w\n read(s(j,i),*) ints\n c(j,id(i))=c(j,id(i))+ints\n end do \n end do\n\n ok=.true.\n do i=1,g\n do j=1,w\n if(c(j,i) > k) ok = .false.\n end do\n end do\n\n if (.not. ok) then\n deallocate(c)\n cycle\n end if\n\n allocate(now(g+1))\n ! num = g-1\n ! now(:) = 0\n ! do j=1,w\n ! if (.not. add(j,g)) then\n ! num=num+1\n ! now(:)=0\n ! emp = add(j,g)\n ! end if\n ! end do \n\n ans = min(ans,num)\n deallocate(c)\n deallocate(now)\n end do\n\n print*, ans\n end block\n\ncontains\nfunction add(j,g) result(ok)\n integer(8):: i,j,g\n logical:: ok\n\n do i=1,g\n now(i)=now(i)+c(j,i)\n end do\n\n ok=.true.\n do i=1,g+1\n if (now(i) > k) ok=.false.\n end do\nend function\n\nend program main", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\n\nThe square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.\n\nWe will cut the bar some number of times to divide it into some number of blocks. In each cut, we cut the whole bar by a line running along some boundaries of squares from end to end of the bar.\n\nHow many times do we need to cut the bar so that every block after the cuts has K or less white squares?\n\nConstraints\n\n1 \\leq H \\leq 10\n\n1 \\leq W \\leq 1000\n\n1 \\leq K \\leq H \\times W\n\nS_{i,j} is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nS_{1,1}S_{1,2}...S_{1,W}\n:\nS_{H,1}S_{H,2}...S_{H,W}\n\nOutput\n\nPrint the number of minimum times the bar needs to be cut so that every block after the cuts has K or less white squares.\n\nSample Input 1\n\n3 5 4\n11100\n10001\n00111\n\nSample Output 1\n\n2\n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and 4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the right.\n\nSample Input 2\n\n3 5 8\n11100\n10001\n00111\n\nSample Output 2\n\n0\n\nNo cut is needed.\n\nSample Input 3\n\n4 10 4\n1110010010\n1000101110\n0011101001\n1101000111\n\nSample Output 3\n\n3", "sample_input": "3 5 4\n11100\n10001\n00111\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02733", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\n\nThe square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.\n\nWe will cut the bar some number of times to divide it into some number of blocks. In each cut, we cut the whole bar by a line running along some boundaries of squares from end to end of the bar.\n\nHow many times do we need to cut the bar so that every block after the cuts has K or less white squares?\n\nConstraints\n\n1 \\leq H \\leq 10\n\n1 \\leq W \\leq 1000\n\n1 \\leq K \\leq H \\times W\n\nS_{i,j} is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nS_{1,1}S_{1,2}...S_{1,W}\n:\nS_{H,1}S_{H,2}...S_{H,W}\n\nOutput\n\nPrint the number of minimum times the bar needs to be cut so that every block after the cuts has K or less white squares.\n\nSample Input 1\n\n3 5 4\n11100\n10001\n00111\n\nSample Output 1\n\n2\n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and 4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the right.\n\nSample Input 2\n\n3 5 8\n11100\n10001\n00111\n\nSample Output 2\n\n0\n\nNo cut is needed.\n\nSample Input 3\n\n4 10 4\n1110010010\n1000101110\n0011101001\n1101000111\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2045, "cpu_time_ms": 2103, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s663197064", "group_id": "codeNet:p02733", "input_text": " PROGRAM DividingChocolate\n IMPLICIT NONE\n integer :: h,w,k\n integer,allocatable :: choco(:,:)\n integer,allocatable :: memo1(:),memo2(:),counter2(:),this(:)\n character(1000) :: s\n integer :: i,j,buffer,piyo\n \n \n read*,h,w,k\n allocate( choco(h,w),memo1(h-1),memo2(w-1) )\n choco = 0\n memo1 = 0\n memo2 = 0\n do i = 1,h\n read*,s\n do j = 1,w\n if( s(j:j)=='1' )then\n choco(i,j) = 1\n end if\n end do\n end do\n \n !tate\n buffer = sum( choco(1,:) )\n do i = 2,h\n if( buffer+sum(choco(i,:))>k )then\n buffer = sum( choco(i,:) )\n memo1(i-1) = 1\n end if\n end do\n \n \n \n !yoko\n allocate( counter2(sum(memo1)),this(sum(memo1)) )\n counter2 = 0\n piyo = 1\n do i = 1,h\n counter2(piyo) = counter2(piyo) + choco(i,1)\n if(memo1(i)==1) piyo = piyo + 1\n end do\n this = 0\n do j = 2,w\n piyo = 1\n \n do i = 1,h\n this(piyo) = this(piyo) + choco(i,j)\n \n if(memo1(i)==1)then\n piyo = piyo + 1\n end if\n end do\n \n if( maxval(counter2+this)>k )then\n counter2 = this\n memo2(j-1) = 1\n end if\n end do\n \n print*,sum(memo1) + sum(memo2)\n \n \n !debugg\n ! print*,trim(s)\n ! do i = 1,h\n ! print*,choco(i,:)\n ! end do\n ! \n ! print*,memo1\n ! print*,memo2\n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1584931191, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02733.html", "problem_id": "p02733", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02733/input.txt", "sample_output_relpath": "derived/input_output/data/p02733/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02733/Fortran/s663197064.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s663197064", "user_id": "u171356453"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " PROGRAM DividingChocolate\n IMPLICIT NONE\n integer :: h,w,k\n integer,allocatable :: choco(:,:)\n integer,allocatable :: memo1(:),memo2(:),counter2(:),this(:)\n character(1000) :: s\n integer :: i,j,buffer,piyo\n \n \n read*,h,w,k\n allocate( choco(h,w),memo1(h-1),memo2(w-1) )\n choco = 0\n memo1 = 0\n memo2 = 0\n do i = 1,h\n read*,s\n do j = 1,w\n if( s(j:j)=='1' )then\n choco(i,j) = 1\n end if\n end do\n end do\n \n !tate\n buffer = sum( choco(1,:) )\n do i = 2,h\n if( buffer+sum(choco(i,:))>k )then\n buffer = sum( choco(i,:) )\n memo1(i-1) = 1\n end if\n end do\n \n \n \n !yoko\n allocate( counter2(sum(memo1)),this(sum(memo1)) )\n counter2 = 0\n piyo = 1\n do i = 1,h\n counter2(piyo) = counter2(piyo) + choco(i,1)\n if(memo1(i)==1) piyo = piyo + 1\n end do\n this = 0\n do j = 2,w\n piyo = 1\n \n do i = 1,h\n this(piyo) = this(piyo) + choco(i,j)\n \n if(memo1(i)==1)then\n piyo = piyo + 1\n end if\n end do\n \n if( maxval(counter2+this)>k )then\n counter2 = this\n memo2(j-1) = 1\n end if\n end do\n \n print*,sum(memo1) + sum(memo2)\n \n \n !debugg\n ! print*,trim(s)\n ! do i = 1,h\n ! print*,choco(i,:)\n ! end do\n ! \n ! print*,memo1\n ! print*,memo2\n \n END PROGRAM", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\n\nThe square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.\n\nWe will cut the bar some number of times to divide it into some number of blocks. In each cut, we cut the whole bar by a line running along some boundaries of squares from end to end of the bar.\n\nHow many times do we need to cut the bar so that every block after the cuts has K or less white squares?\n\nConstraints\n\n1 \\leq H \\leq 10\n\n1 \\leq W \\leq 1000\n\n1 \\leq K \\leq H \\times W\n\nS_{i,j} is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nS_{1,1}S_{1,2}...S_{1,W}\n:\nS_{H,1}S_{H,2}...S_{H,W}\n\nOutput\n\nPrint the number of minimum times the bar needs to be cut so that every block after the cuts has K or less white squares.\n\nSample Input 1\n\n3 5 4\n11100\n10001\n00111\n\nSample Output 1\n\n2\n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and 4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the right.\n\nSample Input 2\n\n3 5 8\n11100\n10001\n00111\n\nSample Output 2\n\n0\n\nNo cut is needed.\n\nSample Input 3\n\n4 10 4\n1110010010\n1000101110\n0011101001\n1101000111\n\nSample Output 3\n\n3", "sample_input": "3 5 4\n11100\n10001\n00111\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02733", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a chocolate bar partitioned into H horizontal rows and W vertical columns of squares.\n\nThe square (i, j) at the i-th row from the top and the j-th column from the left is dark if S_{i,j} is 0, and white if S_{i,j} is 1.\n\nWe will cut the bar some number of times to divide it into some number of blocks. In each cut, we cut the whole bar by a line running along some boundaries of squares from end to end of the bar.\n\nHow many times do we need to cut the bar so that every block after the cuts has K or less white squares?\n\nConstraints\n\n1 \\leq H \\leq 10\n\n1 \\leq W \\leq 1000\n\n1 \\leq K \\leq H \\times W\n\nS_{i,j} is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\nS_{1,1}S_{1,2}...S_{1,W}\n:\nS_{H,1}S_{H,2}...S_{H,W}\n\nOutput\n\nPrint the number of minimum times the bar needs to be cut so that every block after the cuts has K or less white squares.\n\nSample Input 1\n\n3 5 4\n11100\n10001\n00111\n\nSample Output 1\n\n2\n\nFor example, cutting between the 1-st and 2-nd rows and between the 3-rd and 4-th columns - as shown in the figure to the left - works.\n\nNote that we cannot cut the bar in the ways shown in the two figures to the right.\n\nSample Input 2\n\n3 5 8\n11100\n10001\n00111\n\nSample Output 2\n\n0\n\nNo cut is needed.\n\nSample Input 3\n\n4 10 4\n1110010010\n1000101110\n0011101001\n1101000111\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1557, "cpu_time_ms": 2103, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s285242465", "group_id": "codeNet:p02735", "input_text": "program AGC43_A\n integer::H,W\n character(100)::S\n integer,allocatable::maze(:,:),dp(:,:)\n integer::i,j,k,dx(2)=[-1,0],dy(2)=[0,-1]\n read(*,*)H,W\n allocate(maze(H,W),dp(H,W))\n maze=0\n do i=1,H\n read(*,*)S\n do j=1,W\n if(S(j:j)=='#') maze(i,j)=1\n end do\n end do\n dp=huge(i)/2\n dp(1,1)=maze(1,1)\n do i=1,H\n do j=1,W\n do k=1,2\n dp(i,j)=min(dp(i,j),dp(max(1,i+dx(k)),max(1,j+dy(k)))&\n +merge(1,0,maze(max(1,i+dx(k)),max(1,j+dy(k)))==0 .and. maze(i,j)==1))\n !merge(a,b,c)はcが真ならa,偽ならb\n end do\n end do\n end do\n write(*,*)dp(H,W)\nend program AGC43_A", "language": "Fortran", "metadata": {"date": 1590216583, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02735.html", "problem_id": "p02735", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02735/input.txt", "sample_output_relpath": "derived/input_output/data/p02735/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02735/Fortran/s285242465.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s285242465", "user_id": "u359178469"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program AGC43_A\n integer::H,W\n character(100)::S\n integer,allocatable::maze(:,:),dp(:,:)\n integer::i,j,k,dx(2)=[-1,0],dy(2)=[0,-1]\n read(*,*)H,W\n allocate(maze(H,W),dp(H,W))\n maze=0\n do i=1,H\n read(*,*)S\n do j=1,W\n if(S(j:j)=='#') maze(i,j)=1\n end do\n end do\n dp=huge(i)/2\n dp(1,1)=maze(1,1)\n do i=1,H\n do j=1,W\n do k=1,2\n dp(i,j)=min(dp(i,j),dp(max(1,i+dx(k)),max(1,j+dy(k)))&\n +merge(1,0,maze(max(1,i+dx(k)),max(1,j+dy(k)))==0 .and. maze(i,j)==1))\n !merge(a,b,c)はcが真ならa,偽ならb\n end do\n end do\n end do\n write(*,*)dp(H,W)\nend program AGC43_A", "problem_context": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "sample_input": "3 3\n.##\n.#.\n##.\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02735", "source_text": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 642, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s674450888", "group_id": "codeNet:p02735", "input_text": "program am\ninteger::H,W\ninteger,allocatable,dimension(:,:)::maze,DP\ncharacter(100)::S\ninteger::dx(2)=[-1,0],dy(2)=[0,-1]\ninteger::i,j,k\nread*,H,W\nallocate(maze(H,W))\nmaze=0\ndo i=1,H\n read*,S\n do j=1,W\n if(S(j:j)==\"#\")maze(i,j)=1\n end do\nend do\nallocate(DP(H,W))\nDP=huge(i)/2\nDP(1,1)=maze(1,1)\ndo i=1,H\n do j=1,W\n do k=1,2\n DP(i,j)=min(DP(i,j),&\n DP(max(1,i+dx(k)),max(1,j+dy(k)))+merge(1,0,maze(max(1,i+dx(k)),max(1,j+dy(k)))==0.and.maze(i,j)==1))\n end do\n end do\nend do\nprint\"(I0)\",DP(H,W)\nend program am", "language": "Fortran", "metadata": {"date": 1586732096, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02735.html", "problem_id": "p02735", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02735/input.txt", "sample_output_relpath": "derived/input_output/data/p02735/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02735/Fortran/s674450888.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s674450888", "user_id": "u598073939"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program am\ninteger::H,W\ninteger,allocatable,dimension(:,:)::maze,DP\ncharacter(100)::S\ninteger::dx(2)=[-1,0],dy(2)=[0,-1]\ninteger::i,j,k\nread*,H,W\nallocate(maze(H,W))\nmaze=0\ndo i=1,H\n read*,S\n do j=1,W\n if(S(j:j)==\"#\")maze(i,j)=1\n end do\nend do\nallocate(DP(H,W))\nDP=huge(i)/2\nDP(1,1)=maze(1,1)\ndo i=1,H\n do j=1,W\n do k=1,2\n DP(i,j)=min(DP(i,j),&\n DP(max(1,i+dx(k)),max(1,j+dy(k)))+merge(1,0,maze(max(1,i+dx(k)),max(1,j+dy(k)))==0.and.maze(i,j)==1))\n end do\n end do\nend do\nprint\"(I0)\",DP(H,W)\nend program am", "problem_context": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "sample_input": "3 3\n.##\n.#.\n##.\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02735", "source_text": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 563, "cpu_time_ms": 3, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s815369513", "group_id": "codeNet:p02735", "input_text": "module ch\n implicit none\n type char\n character(100) :: n\n end type char\n type(char),allocatable :: s(:)\nend module ch\nprogram main\n \n use ch, only : s\n implicit none\n \n integer :: h, w \n integer :: i, j\n integer,allocatable :: ss(:,:), sb(:,:)\n\n read(*,*) h, w\n allocate( s(h) )\n allocate( ss(h,w) )\n allocate( sb(h,w) )\n do i = 1, h\n read(*,*) s(i)%n\n end do\n \n ss = 0\n do i = 1, h\n do j = 1, w\n \n if( s(i)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) + 1\n end if\n \n if( i == 1 .and. j /= 1 ) then\n ss(i,j) = ss(i,j) + ss(i,j-1) \n if ( s(i)%n(j:j) == \"#\" .and. s(i)%n(j-1:j-1) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n\n if( i /= 1 .and. j == 1 ) then\n ss(i,j) = ss(i,j) + ss(i-1,j)\n if ( s(i)%n(j:j) == \"#\" .and. s(i-1)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n\n if( i /= 1 .and. j /= 1 ) then\n if( ss(i,j-1) <= ss(i-1,j) ) then \n ss(i,j) = ss(i,j) + ss(i,j-1) \n if ( s(i)%n(j:j) == \"#\" .and. s(i)%n(j-1:j-1) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n else\n ss(i,j) = ss(i,j) + ss(i-1,j)\n if ( s(i)%n(j:j) == \"#\" .and. s(i-1)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n end if\n\n end do\n end do\n \n !print*, ss(h,w)\n \n sb = 0\n do i = 1, h\n do j = 1, w\n \n if( s(i)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) + 1\n end if\n \n if( i == 1 .and. j /= 1 ) then\n sb(i,j) = sb(i,j) + sb(i,j-1) \n if ( s(i)%n(j:j) == \".\" .and. s(i)%n(j-1:j-1) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n \n if( i /= 1 .and. j == 1 ) then\n sb(i,j) = sb(i,j) + sb(i-1,j)\n if ( s(i)%n(j:j) == \".\" .and. s(i-1)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n \n if( i /= 1 .and. j /= 1 ) then\n if( sb(i,j-1) <= sb(i-1,j) ) then \n sb(i,j) = sb(i,j) + sb(i,j-1) \n if ( s(i)%n(j:j) == \".\" .and. s(i)%n(j-1:j-1) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n else\n sb(i,j) = sb(i,j) + sb(i-1,j)\n if ( s(i)%n(j:j) == \".\" .and. s(i-1)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n end if\n \n end do\n end do\n \n if( ss(h,w) <= (sb(h,w)+1)) then\n print*, ss(h,w)\n else\n print*, sb(h,w)+1\n end if\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1584847554, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02735.html", "problem_id": "p02735", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02735/input.txt", "sample_output_relpath": "derived/input_output/data/p02735/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02735/Fortran/s815369513.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s815369513", "user_id": "u675314298"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module ch\n implicit none\n type char\n character(100) :: n\n end type char\n type(char),allocatable :: s(:)\nend module ch\nprogram main\n \n use ch, only : s\n implicit none\n \n integer :: h, w \n integer :: i, j\n integer,allocatable :: ss(:,:), sb(:,:)\n\n read(*,*) h, w\n allocate( s(h) )\n allocate( ss(h,w) )\n allocate( sb(h,w) )\n do i = 1, h\n read(*,*) s(i)%n\n end do\n \n ss = 0\n do i = 1, h\n do j = 1, w\n \n if( s(i)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) + 1\n end if\n \n if( i == 1 .and. j /= 1 ) then\n ss(i,j) = ss(i,j) + ss(i,j-1) \n if ( s(i)%n(j:j) == \"#\" .and. s(i)%n(j-1:j-1) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n\n if( i /= 1 .and. j == 1 ) then\n ss(i,j) = ss(i,j) + ss(i-1,j)\n if ( s(i)%n(j:j) == \"#\" .and. s(i-1)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n\n if( i /= 1 .and. j /= 1 ) then\n if( ss(i,j-1) <= ss(i-1,j) ) then \n ss(i,j) = ss(i,j) + ss(i,j-1) \n if ( s(i)%n(j:j) == \"#\" .and. s(i)%n(j-1:j-1) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n else\n ss(i,j) = ss(i,j) + ss(i-1,j)\n if ( s(i)%n(j:j) == \"#\" .and. s(i-1)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n end if\n\n end do\n end do\n \n !print*, ss(h,w)\n \n sb = 0\n do i = 1, h\n do j = 1, w\n \n if( s(i)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) + 1\n end if\n \n if( i == 1 .and. j /= 1 ) then\n sb(i,j) = sb(i,j) + sb(i,j-1) \n if ( s(i)%n(j:j) == \".\" .and. s(i)%n(j-1:j-1) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n \n if( i /= 1 .and. j == 1 ) then\n sb(i,j) = sb(i,j) + sb(i-1,j)\n if ( s(i)%n(j:j) == \".\" .and. s(i-1)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n \n if( i /= 1 .and. j /= 1 ) then\n if( sb(i,j-1) <= sb(i-1,j) ) then \n sb(i,j) = sb(i,j) + sb(i,j-1) \n if ( s(i)%n(j:j) == \".\" .and. s(i)%n(j-1:j-1) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n else\n sb(i,j) = sb(i,j) + sb(i-1,j)\n if ( s(i)%n(j:j) == \".\" .and. s(i-1)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n end if\n \n end do\n end do\n \n if( ss(h,w) <= (sb(h,w)+1)) then\n print*, ss(h,w)\n else\n print*, sb(h,w)+1\n end if\n\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "sample_input": "3 3\n.##\n.#.\n##.\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02735", "source_text": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2587, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s757908881", "group_id": "codeNet:p02735", "input_text": "module ch\n implicit none\n type char\n character(100) :: n\n end type char\n type(char),allocatable :: s(:)\nend module ch\nprogram main\n \n use ch, only : s\n implicit none\n \n integer(8) :: h, w \n integer(8) :: i, j\n integer(8),allocatable :: ss(:,:), sb(:,:)\n\n read(*,*) h, w\n allocate( s(h) )\n allocate( ss(h,w) )\n allocate( sb(h,w) )\n do i = 1, h\n read(*,*) s(i)%n\n end do\n \n ss = 0\n do i = 1, h\n do j = 1, w\n \n if( s(i)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) + 1\n end if\n \n if( i == 1 .and. j /= 1 ) then\n ss(i,j) = ss(i,j) + ss(i,j-1) \n if ( s(i)%n(j:j) == \"#\" .and. s(i)%n(j-1:j-1) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n\n if( i /= 1 .and. j == 1 ) then\n ss(i,j) = ss(i,j) + ss(i-1,j)\n if ( s(i)%n(j:j) == \"#\" .and. s(i-1)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n\n if( i /= 1 .and. j /= 1 ) then\n if( ss(i,j-1) <= ss(i-1,j) ) then \n ss(i,j) = ss(i,j) + ss(i,j-1) \n if ( s(i)%n(j:j) == \"#\" .and. s(i)%n(j-1:j-1) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n else\n ss(i,j) = ss(i,j) + ss(i-1,j)\n if ( s(i)%n(j:j) == \"#\" .and. s(i-1)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n end if\n\n end do\n end do\n \n !print*, ss(h,w)\n \n sb = 0\n do i = 1, h\n do j = 1, w\n \n if( s(i)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) + 1\n end if\n \n if( i == 1 .and. j /= 1 ) then\n sb(i,j) = sb(i,j) + sb(i,j-1) \n if ( s(i)%n(j:j) == \".\" .and. s(i)%n(j-1:j-1) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n \n if( i /= 1 .and. j == 1 ) then\n sb(i,j) = sb(i,j) + sb(i-1,j)\n if ( s(i)%n(j:j) == \".\" .and. s(i-1)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n \n if( i /= 1 .and. j /= 1 ) then\n if( sb(i,j-1) <= sb(i-1,j) ) then \n sb(i,j) = sb(i,j) + sb(i,j-1) \n if ( s(i)%n(j:j) == \".\" .and. s(i)%n(j-1:j-1) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n else\n sb(i,j) = sb(i,j) + sb(i-1,j)\n if ( s(i)%n(j:j) == \".\" .and. s(i-1)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n end if\n \n end do\n end do\n \n if( ss(h,w) <= (sb(h,w)+1)) then\n print*, ss(h,w)\n else\n print*, sb(h,w)+1\n end if\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1584847021, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02735.html", "problem_id": "p02735", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02735/input.txt", "sample_output_relpath": "derived/input_output/data/p02735/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02735/Fortran/s757908881.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s757908881", "user_id": "u675314298"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module ch\n implicit none\n type char\n character(100) :: n\n end type char\n type(char),allocatable :: s(:)\nend module ch\nprogram main\n \n use ch, only : s\n implicit none\n \n integer(8) :: h, w \n integer(8) :: i, j\n integer(8),allocatable :: ss(:,:), sb(:,:)\n\n read(*,*) h, w\n allocate( s(h) )\n allocate( ss(h,w) )\n allocate( sb(h,w) )\n do i = 1, h\n read(*,*) s(i)%n\n end do\n \n ss = 0\n do i = 1, h\n do j = 1, w\n \n if( s(i)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) + 1\n end if\n \n if( i == 1 .and. j /= 1 ) then\n ss(i,j) = ss(i,j) + ss(i,j-1) \n if ( s(i)%n(j:j) == \"#\" .and. s(i)%n(j-1:j-1) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n\n if( i /= 1 .and. j == 1 ) then\n ss(i,j) = ss(i,j) + ss(i-1,j)\n if ( s(i)%n(j:j) == \"#\" .and. s(i-1)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n\n if( i /= 1 .and. j /= 1 ) then\n if( ss(i,j-1) <= ss(i-1,j) ) then \n ss(i,j) = ss(i,j) + ss(i,j-1) \n if ( s(i)%n(j:j) == \"#\" .and. s(i)%n(j-1:j-1) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n else\n ss(i,j) = ss(i,j) + ss(i-1,j)\n if ( s(i)%n(j:j) == \"#\" .and. s(i-1)%n(j:j) == \"#\" ) then\n ss(i,j) = ss(i,j) - 1 \n end if\n end if\n end if\n\n end do\n end do\n \n !print*, ss(h,w)\n \n sb = 0\n do i = 1, h\n do j = 1, w\n \n if( s(i)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) + 1\n end if\n \n if( i == 1 .and. j /= 1 ) then\n sb(i,j) = sb(i,j) + sb(i,j-1) \n if ( s(i)%n(j:j) == \".\" .and. s(i)%n(j-1:j-1) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n \n if( i /= 1 .and. j == 1 ) then\n sb(i,j) = sb(i,j) + sb(i-1,j)\n if ( s(i)%n(j:j) == \".\" .and. s(i-1)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n \n if( i /= 1 .and. j /= 1 ) then\n if( sb(i,j-1) <= sb(i-1,j) ) then \n sb(i,j) = sb(i,j) + sb(i,j-1) \n if ( s(i)%n(j:j) == \".\" .and. s(i)%n(j-1:j-1) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n else\n sb(i,j) = sb(i,j) + sb(i-1,j)\n if ( s(i)%n(j:j) == \".\" .and. s(i-1)%n(j:j) == \".\" ) then\n sb(i,j) = sb(i,j) - 1 \n end if\n end if\n end if\n \n end do\n end do\n \n if( ss(h,w) <= (sb(h,w)+1)) then\n print*, ss(h,w)\n else\n print*, sb(h,w)+1\n end if\n\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "sample_input": "3 3\n.##\n.#.\n##.\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02735", "source_text": "Score : 400 points\n\nProblem Statement\n\nConsider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left.\nEach square is painted black or white.\n\nThe grid is said to be good if and only if the following condition is satisfied:\n\nFrom (1, 1), we can reach (H, W) by moving one square right or down repeatedly, while always being on a white square.\n\nNote that (1, 1) and (H, W) must be white if the grid is good.\n\nYour task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.\n\nChoose four integers r_0, c_0, r_1, c_1(1 \\leq r_0 \\leq r_1 \\leq H, 1 \\leq c_0 \\leq c_1 \\leq W). For each pair r, c (r_0 \\leq r \\leq r_1, c_0 \\leq c \\leq c_1), invert the color of (r, c) - that is, from white to black and vice versa.\n\nConstraints\n\n2 \\leq H, W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{11} s_{12} \\cdots s_{1W}\ns_{21} s_{22} \\cdots s_{2W}\n\\vdots\ns_{H1} s_{H2} \\cdots s_{HW}\n\nHere s_{rc} represents the color of (r, c) - # stands for black, and . stands for white.\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3 3\n.##\n.#.\n##.\n\nSample Output 1\n\n1\n\nDo the operation with (r_0, c_0, r_1, c_1) = (2, 2, 2, 2) to change just the color of (2, 2), and we are done.\n\nSample Input 2\n\n2 2\n#.\n.#\n\nSample Output 2\n\n2\n\nSample Input 3\n\n4 4\n..##\n#...\n###.\n###.\n\nSample Output 3\n\n0\n\nNo operation may be needed.\n\nSample Input 4\n\n5 5\n.#.#.\n#.#.#\n.#.#.\n#.#.#\n.#.#.\n\nSample Output 4\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2596, "cpu_time_ms": 1, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s841890742", "group_id": "codeNet:p02736", "input_text": "program main\n implicit none\n integer n\n integer, allocatable, dimension(:) :: a\n integer, allocatable, dimension(:,:) :: x\n integer i, j, flag\n character s*1000000\n\n read(*,*) n\n read(*,*) s\n allocate(a(n))\n allocate(x(2,n))\n \n do i = 1,n\n read(s(i:i),*) a(i)\n end do\n\n do i = 1,n\n x(1,i) = a(i)\n end do\n\n do j = 2, n\n if(mod(j,2) == 0) then\n do i = 1, n+1-j\n x(2,i) = abs(x(1,i)-x(1,i+1))\n end do\n flag = 2\n else\n do i = 1, n+1-j\n x(1,i) = abs(x(2,i)-x(2,i+1))\n end do\n flag = 1\n end if\n end do\n\n if (flag == 1) then\n write(*,*) x(1,1)\n else if(flag == 2) then\n write(*,*) x(2,1)\n end if\n\nend program", "language": "Fortran", "metadata": {"date": 1584844534, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02736.html", "problem_id": "p02736", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02736/input.txt", "sample_output_relpath": "derived/input_output/data/p02736/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02736/Fortran/s841890742.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s841890742", "user_id": "u806372060"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n integer n\n integer, allocatable, dimension(:) :: a\n integer, allocatable, dimension(:,:) :: x\n integer i, j, flag\n character s*1000000\n\n read(*,*) n\n read(*,*) s\n allocate(a(n))\n allocate(x(2,n))\n \n do i = 1,n\n read(s(i:i),*) a(i)\n end do\n\n do i = 1,n\n x(1,i) = a(i)\n end do\n\n do j = 2, n\n if(mod(j,2) == 0) then\n do i = 1, n+1-j\n x(2,i) = abs(x(1,i)-x(1,i+1))\n end do\n flag = 2\n else\n do i = 1, n+1-j\n x(1,i) = abs(x(2,i)-x(2,i+1))\n end do\n flag = 1\n end if\n end do\n\n if (flag == 1) then\n write(*,*) x(1,1)\n else if(flag == 2) then\n write(*,*) x(2,1)\n end if\n\nend program", "problem_context": "Score : 700 points\n\nProblem Statement\n\nGiven is a sequence of N digits a_1a_2\\ldots a_N, where each element is 1, 2, or 3.\nLet x_{i,j} defined as follows:\n\nx_{1,j} := a_j \\quad (1 \\leq j \\leq N)\n\nx_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \\quad (2 \\leq i \\leq N and 1 \\leq j \\leq N+1-i)\n\nFind x_{N,1}.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\na_i = 1,2,3 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1a_2\\ldotsa_N\n\nOutput\n\nPrint x_{N,1}.\n\nSample Input 1\n\n4\n1231\n\nSample Output 1\n\n1\n\nx_{1,1},x_{1,2},x_{1,3},x_{1,4} are respectively 1,2,3,1.\n\nx_{2,1},x_{2,2},x_{2,3} are respectively |1-2| = 1,|2-3| = 1,|3-1| = 2.\n\nx_{3,1},x_{3,2} are respectively |1-1| = 0,|1-2| = 1.\n\nFinally, x_{4,1} = |0-1| = 1, so the answer is 1.\n\nSample Input 2\n\n10\n2311312312\n\nSample Output 2\n\n0", "sample_input": "4\n1231\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02736", "source_text": "Score : 700 points\n\nProblem Statement\n\nGiven is a sequence of N digits a_1a_2\\ldots a_N, where each element is 1, 2, or 3.\nLet x_{i,j} defined as follows:\n\nx_{1,j} := a_j \\quad (1 \\leq j \\leq N)\n\nx_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \\quad (2 \\leq i \\leq N and 1 \\leq j \\leq N+1-i)\n\nFind x_{N,1}.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\na_i = 1,2,3 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1a_2\\ldotsa_N\n\nOutput\n\nPrint x_{N,1}.\n\nSample Input 1\n\n4\n1231\n\nSample Output 1\n\n1\n\nx_{1,1},x_{1,2},x_{1,3},x_{1,4} are respectively 1,2,3,1.\n\nx_{2,1},x_{2,2},x_{2,3} are respectively |1-2| = 1,|2-3| = 1,|3-1| = 2.\n\nx_{3,1},x_{3,2} are respectively |1-1| = 0,|1-2| = 1.\n\nFinally, x_{4,1} = |0-1| = 1, so the answer is 1.\n\nSample Input 2\n\n10\n2311312312\n\nSample Output 2\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 806, "cpu_time_ms": 2104, "memory_kb": 14088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s099978745", "group_id": "codeNet:p02736", "input_text": "program example\n\timplicit none\n\n\tinteger(16) :: i=1,j=1,N\n integer(16),allocatable :: x(:,:),A(:)\n \n read(*,*) N\n \n allocate(x(N,N),A(N))\n\n\tdo\n\t\tread(*,\"(i1)\",advance=\"no\",end=100) A(i)\n \tx(1,j)=A(i)\n if (mod(j,2000)==0) then\n \tdeallocate(A)\n allocate(A(N))\n \ti=1\n j=j+1\n else\n \n \ti=i+1\n \tj=j+1\n \n end if\n \n end do\n\n100 do i=2,N\n \n \tdo j=1,N+1-i\n \n \tx(i,j)=abs(x(i-1,j)-x(i-1,j+1))\n \n end do\n \n end do\n \n write(*,*) x(N,1)\n\nend program", "language": "Fortran", "metadata": {"date": 1584844125, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02736.html", "problem_id": "p02736", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02736/input.txt", "sample_output_relpath": "derived/input_output/data/p02736/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02736/Fortran/s099978745.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s099978745", "user_id": "u374107737"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program example\n\timplicit none\n\n\tinteger(16) :: i=1,j=1,N\n integer(16),allocatable :: x(:,:),A(:)\n \n read(*,*) N\n \n allocate(x(N,N),A(N))\n\n\tdo\n\t\tread(*,\"(i1)\",advance=\"no\",end=100) A(i)\n \tx(1,j)=A(i)\n if (mod(j,2000)==0) then\n \tdeallocate(A)\n allocate(A(N))\n \ti=1\n j=j+1\n else\n \n \ti=i+1\n \tj=j+1\n \n end if\n \n end do\n\n100 do i=2,N\n \n \tdo j=1,N+1-i\n \n \tx(i,j)=abs(x(i-1,j)-x(i-1,j+1))\n \n end do\n \n end do\n \n write(*,*) x(N,1)\n\nend program", "problem_context": "Score : 700 points\n\nProblem Statement\n\nGiven is a sequence of N digits a_1a_2\\ldots a_N, where each element is 1, 2, or 3.\nLet x_{i,j} defined as follows:\n\nx_{1,j} := a_j \\quad (1 \\leq j \\leq N)\n\nx_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \\quad (2 \\leq i \\leq N and 1 \\leq j \\leq N+1-i)\n\nFind x_{N,1}.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\na_i = 1,2,3 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1a_2\\ldotsa_N\n\nOutput\n\nPrint x_{N,1}.\n\nSample Input 1\n\n4\n1231\n\nSample Output 1\n\n1\n\nx_{1,1},x_{1,2},x_{1,3},x_{1,4} are respectively 1,2,3,1.\n\nx_{2,1},x_{2,2},x_{2,3} are respectively |1-2| = 1,|2-3| = 1,|3-1| = 2.\n\nx_{3,1},x_{3,2} are respectively |1-1| = 0,|1-2| = 1.\n\nFinally, x_{4,1} = |0-1| = 1, so the answer is 1.\n\nSample Input 2\n\n10\n2311312312\n\nSample Output 2\n\n0", "sample_input": "4\n1231\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02736", "source_text": "Score : 700 points\n\nProblem Statement\n\nGiven is a sequence of N digits a_1a_2\\ldots a_N, where each element is 1, 2, or 3.\nLet x_{i,j} defined as follows:\n\nx_{1,j} := a_j \\quad (1 \\leq j \\leq N)\n\nx_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \\quad (2 \\leq i \\leq N and 1 \\leq j \\leq N+1-i)\n\nFind x_{N,1}.\n\nConstraints\n\n2 \\leq N \\leq 10^6\n\na_i = 1,2,3 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1a_2\\ldotsa_N\n\nOutput\n\nPrint x_{N,1}.\n\nSample Input 1\n\n4\n1231\n\nSample Output 1\n\n1\n\nx_{1,1},x_{1,2},x_{1,3},x_{1,4} are respectively 1,2,3,1.\n\nx_{2,1},x_{2,2},x_{2,3} are respectively |1-2| = 1,|2-3| = 1,|3-1| = 2.\n\nx_{3,1},x_{3,2} are respectively |1-1| = 0,|1-2| = 1.\n\nFinally, x_{4,1} = |0-1| = 1, so the answer is 1.\n\nSample Input 2\n\n10\n2311312312\n\nSample Output 2\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 603, "cpu_time_ms": 106, "memory_kb": 984}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s719698884", "group_id": "codeNet:p02742", "input_text": "program example\n\timplicit none\n\n\tinteger(8) H,W\n \n read(*,*) H,W\n \n if(W==1 .or. H==1) then\n \twrite(*,*) 1\n \n else if (mod(H,2)==0) then\n \twrite(*,*) W*(H/2)\n \n else\n\n \twrite(*,*) (W*(H/2))+(W/2)+mod(W,2)\n\n end if\n\nend program example", "language": "Fortran", "metadata": {"date": 1584236243, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02742.html", "problem_id": "p02742", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02742/input.txt", "sample_output_relpath": "derived/input_output/data/p02742/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02742/Fortran/s719698884.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s719698884", "user_id": "u374107737"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program example\n\timplicit none\n\n\tinteger(8) H,W\n \n read(*,*) H,W\n \n if(W==1 .or. H==1) then\n \twrite(*,*) 1\n \n else if (mod(H,2)==0) then\n \twrite(*,*) W*(H/2)\n \n else\n\n \twrite(*,*) (W*(H/2))+(W/2)+mod(W,2)\n\n end if\n\nend program example", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a board with H horizontal rows and W vertical columns of squares.\nThere is a bishop at the top-left square on this board.\nHow many squares can this bishop reach by zero or more movements?\n\nHere the bishop can only move diagonally.\nMore formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:\n\nr_1 + c_1 = r_2 + c_2\n\nr_1 - c_1 = r_2 - c_2\n\nFor example, in the following figure, the bishop can move to any of the red squares in one move:\n\nConstraints\n\n1 \\leq H, W \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH \\ W\n\nOutput\n\nPrint the number of squares the bishop can reach.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\n10\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n11\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 3\n\n1000000000 1000000000\n\nSample Output 3\n\n500000000000000000", "sample_input": "4 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02742", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a board with H horizontal rows and W vertical columns of squares.\nThere is a bishop at the top-left square on this board.\nHow many squares can this bishop reach by zero or more movements?\n\nHere the bishop can only move diagonally.\nMore formally, the bishop can move from the square at the r_1-th row (from the top) and the c_1-th column (from the left) to the square at the r_2-th row and the c_2-th column if and only if exactly one of the following holds:\n\nr_1 + c_1 = r_2 + c_2\n\nr_1 - c_1 = r_2 - c_2\n\nFor example, in the following figure, the bishop can move to any of the red squares in one move:\n\nConstraints\n\n1 \\leq H, W \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH \\ W\n\nOutput\n\nPrint the number of squares the bishop can reach.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\n10\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 2\n\n7 3\n\nSample Output 2\n\n11\n\nThe bishop can reach the cyan squares in the following figure:\n\nSample Input 3\n\n1000000000 1000000000\n\nSample Output 3\n\n500000000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 278, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s462200181", "group_id": "codeNet:p02750", "input_text": "module mod_two_dim_merge_sort\n implicit none\n integer, private, parameter :: intkind = 8\ncontains\n logical function less(a, b) result(res)\n integer(intkind), intent(in) :: a(:), b(:)\n real(8) :: a1, b1\n a1 = a(1) / real(a(2) + 1, 8)\n b1 = b(1) / real(b(2) + 1, 8)\n res = a1 > b1 .or. (a1 == b1 .and. a(2) >= b(2))\n end\n subroutine merge_sort(a)\n integer(intkind), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), &\n a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(intkind), intent(inout) :: a1(:, :), a2(:, :)\n integer(intkind) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (less(a1(i1, :), a2(i2, :))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\nend module mod_two_dim_merge_sort\nprogram manga_market\n use mod_two_dim_merge_sort\n implicit none\n integer(8), parameter :: inf = 3e18\n integer, parameter :: k = 30\n integer :: n, l, i, j, m = 0\n integer(8) :: t, r, tmp\n integer(8), allocatable :: c(:, :), dp(:, :), s(:)\n read(*,*) n, t\n allocate(c(n, 2))\n do i = 1, n\n read(*,*) c(i, :)\n end do\n call merge_sort(c(1:n, 1:2))\n l = n + 1\n do while (c(l - 1, 1) == 0)\n l = l - 1\n end do\n allocate(dp(0:k, 0:l - 1), s(0:n - l + 1))\n dp = inf\n dp(0, :) = 0\n do i = 1, l - 1\n do j = 1, min(k, i)\n dp(j, i) = dp(j, i - 1)\n if (dp(j - 1, i - 1) == inf) cycle\n tmp = dp(j - 1, i - 1) + 1\n dp(j, i) = min(dp(j, i), tmp + c(i, 1) * tmp + c(i, 2))\n end do\n end do\n s(0) = 0\n do i = n, l, -1\n s(n - i + 1) = s(n - i) + c(i, 2) + 1\n end do\n do i = 0, min(k, l - 1)\n r = t - dp(i, l - 1)\n if (r < 0) cycle\n do j = 0, n - l + 1\n if (s(j) > r) exit\n m = max(m, i + j)\n end do\n end do\n write(*,'(i0)') m\nend program manga_market", "language": "Fortran", "metadata": {"date": 1598388795, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02750.html", "problem_id": "p02750", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02750/input.txt", "sample_output_relpath": "derived/input_output/data/p02750/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02750/Fortran/s462200181.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s462200181", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "module mod_two_dim_merge_sort\n implicit none\n integer, private, parameter :: intkind = 8\ncontains\n logical function less(a, b) result(res)\n integer(intkind), intent(in) :: a(:), b(:)\n real(8) :: a1, b1\n a1 = a(1) / real(a(2) + 1, 8)\n b1 = b(1) / real(b(2) + 1, 8)\n res = a1 > b1 .or. (a1 == b1 .and. a(2) >= b(2))\n end\n subroutine merge_sort(a)\n integer(intkind), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), &\n a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(intkind), intent(inout) :: a1(:, :), a2(:, :)\n integer(intkind) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (less(a1(i1, :), a2(i2, :))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\nend module mod_two_dim_merge_sort\nprogram manga_market\n use mod_two_dim_merge_sort\n implicit none\n integer(8), parameter :: inf = 3e18\n integer, parameter :: k = 30\n integer :: n, l, i, j, m = 0\n integer(8) :: t, r, tmp\n integer(8), allocatable :: c(:, :), dp(:, :), s(:)\n read(*,*) n, t\n allocate(c(n, 2))\n do i = 1, n\n read(*,*) c(i, :)\n end do\n call merge_sort(c(1:n, 1:2))\n l = n + 1\n do while (c(l - 1, 1) == 0)\n l = l - 1\n end do\n allocate(dp(0:k, 0:l - 1), s(0:n - l + 1))\n dp = inf\n dp(0, :) = 0\n do i = 1, l - 1\n do j = 1, min(k, i)\n dp(j, i) = dp(j, i - 1)\n if (dp(j - 1, i - 1) == inf) cycle\n tmp = dp(j - 1, i - 1) + 1\n dp(j, i) = min(dp(j, i), tmp + c(i, 1) * tmp + c(i, 2))\n end do\n end do\n s(0) = 0\n do i = n, l, -1\n s(n - i + 1) = s(n - i) + c(i, 2) + 1\n end do\n do i = 0, min(k, l - 1)\n r = t - dp(i, l - 1)\n if (r < 0) cycle\n do j = 0, n - l + 1\n if (s(j) > r) exit\n m = max(m, i + j)\n end do\n end do\n write(*,'(i0)') m\nend program manga_market", "problem_context": "Score : 800 points\n\nProblem Statement\n\nThere are N stores called Store 1, Store 2, \\cdots, Store N. Takahashi, who is at his house at time 0, is planning to visit some of these stores.\n\nIt takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.\n\nIf Takahashi reaches Store i at time t, he can do shopping there after standing in a queue for a_i \\times t + b_i units of time. (We assume that it takes no time other than waiting.)\n\nAll the stores close at time T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.\n\nTakahashi does not do shopping more than once in the same store.\n\nFind the maximum number of times he can do shopping before time T + 0.5.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\n0 \\leq b_i \\leq 10^9\n\n0 \\leq T \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\na_1 b_1\na_2 b_2\n\\vdots\na_N b_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 7\n2 0\n3 2\n0 3\n\nSample Output 1\n\n2\n\nHere is one possible way to visit stores:\n\nFrom time 0 to time 1: in 1 unit of time, he travels from his house to Store 1.\n\nFrom time 1 to time 3: for 2 units of time, he stands in a queue for Store 1 to do shopping.\n\nFrom time 3 to time 4: in 1 unit of time, he travels from Store 1 to Store 3.\n\nFrom time 4 to time 7: for 3 units of time, he stands in a queue for Store 3 to do shopping.\n\nIn this way, he can do shopping twice before time 7.5.\n\nSample Input 2\n\n1 3\n0 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 21600\n2 14\n3 22\n1 3\n1 10\n1 9\n\nSample Output 3\n\n5\n\nSample Input 4\n\n7 57\n0 25\n3 10\n2 4\n5 15\n3 22\n2 14\n1 15\n\nSample Output 4\n\n3", "sample_input": "3 7\n2 0\n3 2\n0 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02750", "source_text": "Score : 800 points\n\nProblem Statement\n\nThere are N stores called Store 1, Store 2, \\cdots, Store N. Takahashi, who is at his house at time 0, is planning to visit some of these stores.\n\nIt takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.\n\nIf Takahashi reaches Store i at time t, he can do shopping there after standing in a queue for a_i \\times t + b_i units of time. (We assume that it takes no time other than waiting.)\n\nAll the stores close at time T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.\n\nTakahashi does not do shopping more than once in the same store.\n\nFind the maximum number of times he can do shopping before time T + 0.5.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\n0 \\leq b_i \\leq 10^9\n\n0 \\leq T \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\na_1 b_1\na_2 b_2\n\\vdots\na_N b_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 7\n2 0\n3 2\n0 3\n\nSample Output 1\n\n2\n\nHere is one possible way to visit stores:\n\nFrom time 0 to time 1: in 1 unit of time, he travels from his house to Store 1.\n\nFrom time 1 to time 3: for 2 units of time, he stands in a queue for Store 1 to do shopping.\n\nFrom time 3 to time 4: in 1 unit of time, he travels from Store 1 to Store 3.\n\nFrom time 4 to time 7: for 3 units of time, he stands in a queue for Store 3 to do shopping.\n\nIn this way, he can do shopping twice before time 7.5.\n\nSample Input 2\n\n1 3\n0 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 21600\n2 14\n3 22\n1 3\n1 10\n1 9\n\nSample Output 3\n\n5\n\nSample Input 4\n\n7 57\n0 25\n3 10\n2 4\n5 15\n3 22\n2 14\n1 15\n\nSample Output 4\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2441, "cpu_time_ms": 201, "memory_kb": 55236}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s414686092", "group_id": "codeNet:p02750", "input_text": "module mod_two_dim_merge_sort\n implicit none\n integer, private, parameter :: intkind = 8\ncontains\n logical function less(a, b) result(res)\n integer(intkind), intent(in) :: a(:), b(:)\n real(8) :: a1, b1\n a1 = a(1) / real(a(2) + 1, 8)\n b1 = b(1) / real(b(2) + 1, 8)\n res = a1 > b1 .or. (a1 == b1 .and. a(2) >= b(2))\n end\n subroutine merge_sort(a)\n integer(intkind), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), &\n a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(intkind), intent(inout) :: a1(:, :), a2(:, :)\n integer(intkind) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (less(a1(i1, :), a2(i2, :))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\nend module mod_two_dim_merge_sort\nprogram manga_market\n use mod_two_dim_merge_sort\n implicit none\n integer(8), parameter :: inf = 3e18\n integer :: n, l, i, j, m = 0, p, q, h\n integer(8) :: t, r\n integer(8), allocatable :: c(:, :), dp(:, :), s(:)\n read(*,*) n, t\n allocate(c(n, 2))\n do i = 1, n\n read(*,*) c(i, :)\n end do\n call merge_sort(c(1:n, 1:2))\n l = n + 1\n do while (c(l - 1, 1) == 0)\n l = l - 1\n end do\n allocate(dp(0:28, 0:l - 1), s(0:n - 1 + 1))\n dp = inf\n dp(0, :) = 0\n do i = 1, l - 1\n do j = 1, min(28, l - 1)\n dp(j, i) = dp(j, i - 1)\n if (dp(j - 1, i - 1) == inf) cycle\n dp(j, i) = min(dp(j, i), dp(j - 1, i - 1) + c(i, 1) * dp(j - 1, i - 1) + c(i, 2))\n end do\n end do\n s(0) = 0\n do i = n, l, -1\n s(n - i + 1) = s(n - i) + c(i, 2)\n end do\n do i = 0, min(28, l - 1)\n r = t - dp(i, l - 1)\n if (r < 0) cycle\n p = -1\n q = n - l + 1\n do while (q - p > 1)\n h = (p + q) / 2\n if (s(h) < r) then\n p = h\n else\n q = h\n end if\n end do\n m = max(m, i + q)\n end do\n write(*,'(i0)') m\nend program manga_market", "language": "Fortran", "metadata": {"date": 1598386270, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02750.html", "problem_id": "p02750", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02750/input.txt", "sample_output_relpath": "derived/input_output/data/p02750/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02750/Fortran/s414686092.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s414686092", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "module mod_two_dim_merge_sort\n implicit none\n integer, private, parameter :: intkind = 8\ncontains\n logical function less(a, b) result(res)\n integer(intkind), intent(in) :: a(:), b(:)\n real(8) :: a1, b1\n a1 = a(1) / real(a(2) + 1, 8)\n b1 = b(1) / real(b(2) + 1, 8)\n res = a1 > b1 .or. (a1 == b1 .and. a(2) >= b(2))\n end\n subroutine merge_sort(a)\n integer(intkind), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), &\n a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(intkind), intent(inout) :: a1(:, :), a2(:, :)\n integer(intkind) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (less(a1(i1, :), a2(i2, :))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\nend module mod_two_dim_merge_sort\nprogram manga_market\n use mod_two_dim_merge_sort\n implicit none\n integer(8), parameter :: inf = 3e18\n integer :: n, l, i, j, m = 0, p, q, h\n integer(8) :: t, r\n integer(8), allocatable :: c(:, :), dp(:, :), s(:)\n read(*,*) n, t\n allocate(c(n, 2))\n do i = 1, n\n read(*,*) c(i, :)\n end do\n call merge_sort(c(1:n, 1:2))\n l = n + 1\n do while (c(l - 1, 1) == 0)\n l = l - 1\n end do\n allocate(dp(0:28, 0:l - 1), s(0:n - 1 + 1))\n dp = inf\n dp(0, :) = 0\n do i = 1, l - 1\n do j = 1, min(28, l - 1)\n dp(j, i) = dp(j, i - 1)\n if (dp(j - 1, i - 1) == inf) cycle\n dp(j, i) = min(dp(j, i), dp(j - 1, i - 1) + c(i, 1) * dp(j - 1, i - 1) + c(i, 2))\n end do\n end do\n s(0) = 0\n do i = n, l, -1\n s(n - i + 1) = s(n - i) + c(i, 2)\n end do\n do i = 0, min(28, l - 1)\n r = t - dp(i, l - 1)\n if (r < 0) cycle\n p = -1\n q = n - l + 1\n do while (q - p > 1)\n h = (p + q) / 2\n if (s(h) < r) then\n p = h\n else\n q = h\n end if\n end do\n m = max(m, i + q)\n end do\n write(*,'(i0)') m\nend program manga_market", "problem_context": "Score : 800 points\n\nProblem Statement\n\nThere are N stores called Store 1, Store 2, \\cdots, Store N. Takahashi, who is at his house at time 0, is planning to visit some of these stores.\n\nIt takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.\n\nIf Takahashi reaches Store i at time t, he can do shopping there after standing in a queue for a_i \\times t + b_i units of time. (We assume that it takes no time other than waiting.)\n\nAll the stores close at time T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.\n\nTakahashi does not do shopping more than once in the same store.\n\nFind the maximum number of times he can do shopping before time T + 0.5.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\n0 \\leq b_i \\leq 10^9\n\n0 \\leq T \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\na_1 b_1\na_2 b_2\n\\vdots\na_N b_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 7\n2 0\n3 2\n0 3\n\nSample Output 1\n\n2\n\nHere is one possible way to visit stores:\n\nFrom time 0 to time 1: in 1 unit of time, he travels from his house to Store 1.\n\nFrom time 1 to time 3: for 2 units of time, he stands in a queue for Store 1 to do shopping.\n\nFrom time 3 to time 4: in 1 unit of time, he travels from Store 1 to Store 3.\n\nFrom time 4 to time 7: for 3 units of time, he stands in a queue for Store 3 to do shopping.\n\nIn this way, he can do shopping twice before time 7.5.\n\nSample Input 2\n\n1 3\n0 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 21600\n2 14\n3 22\n1 3\n1 10\n1 9\n\nSample Output 3\n\n5\n\nSample Input 4\n\n7 57\n0 25\n3 10\n2 4\n5 15\n3 22\n2 14\n1 15\n\nSample Output 4\n\n3", "sample_input": "3 7\n2 0\n3 2\n0 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02750", "source_text": "Score : 800 points\n\nProblem Statement\n\nThere are N stores called Store 1, Store 2, \\cdots, Store N. Takahashi, who is at his house at time 0, is planning to visit some of these stores.\n\nIt takes Takahashi one unit of time to travel from his house to one of the stores, or between any two stores.\n\nIf Takahashi reaches Store i at time t, he can do shopping there after standing in a queue for a_i \\times t + b_i units of time. (We assume that it takes no time other than waiting.)\n\nAll the stores close at time T + 0.5. If Takahashi is standing in a queue for some store then, he cannot do shopping there.\n\nTakahashi does not do shopping more than once in the same store.\n\nFind the maximum number of times he can do shopping before time T + 0.5.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\n0 \\leq b_i \\leq 10^9\n\n0 \\leq T \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\na_1 b_1\na_2 b_2\n\\vdots\na_N b_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 7\n2 0\n3 2\n0 3\n\nSample Output 1\n\n2\n\nHere is one possible way to visit stores:\n\nFrom time 0 to time 1: in 1 unit of time, he travels from his house to Store 1.\n\nFrom time 1 to time 3: for 2 units of time, he stands in a queue for Store 1 to do shopping.\n\nFrom time 3 to time 4: in 1 unit of time, he travels from Store 1 to Store 3.\n\nFrom time 4 to time 7: for 3 units of time, he stands in a queue for Store 3 to do shopping.\n\nIn this way, he can do shopping twice before time 7.5.\n\nSample Input 2\n\n1 3\n0 3\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 21600\n2 14\n3 22\n1 3\n1 10\n1 9\n\nSample Output 3\n\n5\n\nSample Input 4\n\n7 57\n0 25\n3 10\n2 4\n5 15\n3 22\n2 14\n1 15\n\nSample Output 4\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2512, "cpu_time_ms": 204, "memory_kb": 52288}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s410857668", "group_id": "codeNet:p02753", "input_text": "program main\n character(3) :: s\n integer(4) :: i\n\n read(*,*) s\n if ( s(1:1) == s(2:2) ) then\n\n if ( s(2:2) == s(3:3) ) then\n print *, 'No'\n else\n print *, 'Yes'\n end if\n else\n print *, 'Yes'\n end if\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1586711559, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02753.html", "problem_id": "p02753", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02753/input.txt", "sample_output_relpath": "derived/input_output/data/p02753/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02753/Fortran/s410857668.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s410857668", "user_id": "u353721260"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n character(3) :: s\n integer(4) :: i\n\n read(*,*) s\n if ( s(1:1) == s(2:2) ) then\n\n if ( s(2:2) == s(3:3) ) then\n print *, 'No'\n else\n print *, 'Yes'\n end if\n else\n print *, 'Yes'\n end if\n\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "sample_input": "ABA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02753", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 293, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s111515162", "group_id": "codeNet:p02753", "input_text": "program main\ninteger(16) :: n,a,b,c,d,e\nread *,n,a,b\n\nc = n/(a+b)\nd=mod(n,(a+b))\ne = c*a+min(d,a)\nprint '(i0)',e\n\nend", "language": "Fortran", "metadata": {"date": 1583776194, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02753.html", "problem_id": "p02753", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02753/input.txt", "sample_output_relpath": "derived/input_output/data/p02753/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02753/Fortran/s111515162.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s111515162", "user_id": "u158583803"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\ninteger(16) :: n,a,b,c,d,e\nread *,n,a,b\n\nc = n/(a+b)\nd=mod(n,(a+b))\ne = c*a+min(d,a)\nprint '(i0)',e\n\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "sample_input": "ABA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02753", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn AtCoder City, there are three stations numbered 1, 2, and 3.\n\nEach of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is A, Company A operates Station i; if S_i is B, Company B operates Station i.\n\nTo improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.\n\nDetermine if there is a pair of stations that will be connected by a bus service.\n\nConstraints\n\nEach character of S is A or B.\n\n|S| = 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.\n\nSample Input 1\n\nABA\n\nSample Output 1\n\nYes\n\nCompany A operates Station 1 and 3, while Company B operates Station 2.\n\nThere will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.\n\nSample Input 2\n\nBBA\n\nSample Output 2\n\nYes\n\nCompany B operates Station 1 and 2, while Company A operates Station 3.\n\nThere will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.\n\nSample Input 3\n\nBBB\n\nSample Output 3\n\nNo\n\nCompany B operates all the stations. Thus, there will be no bus service, so print No.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 117, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s266593521", "group_id": "codeNet:p02754", "input_text": "program prob2\n implicit none\n integer(16) :: n, a, b, ans\n\n read(*,*) n, a, b\n\n ans = n / (a + b)\n ans = a * ans\n\n ans = ans + min(mod(n, a+b), a)\n\n write(*,*) ans\n stop\nend program prob2\n", "language": "Fortran", "metadata": {"date": 1593824978, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02754.html", "problem_id": "p02754", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02754/input.txt", "sample_output_relpath": "derived/input_output/data/p02754/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02754/Fortran/s266593521.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s266593521", "user_id": "u961266059"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program prob2\n implicit none\n integer(16) :: n, a, b, ans\n\n read(*,*) n, a, b\n\n ans = n / (a + b)\n ans = a * ans\n\n ans = ans + min(mod(n, a+b), a)\n\n write(*,*) ans\n stop\nend program prob2\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\nPlace A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.\n\nHow many blue balls will be there among the first N balls in the row of balls made this way?\n\nConstraints\n\n1 \\leq N \\leq 10^{18}\n\nA, B \\geq 0\n\n0 < A + B \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of blue balls that will be there among the first N balls in the row of balls.\n\nSample Input 1\n\n8 3 4\n\nSample Output 1\n\n4\n\nLet b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.\n\nSample Input 2\n\n8 0 4\n\nSample Output 2\n\n0\n\nHe placed only red balls from the beginning.\n\nSample Input 3\n\n6 2 4\n\nSample Output 3\n\n2\n\nAmong bbrrrr, there are two blue balls.", "sample_input": "8 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02754", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\nPlace A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.\n\nHow many blue balls will be there among the first N balls in the row of balls made this way?\n\nConstraints\n\n1 \\leq N \\leq 10^{18}\n\nA, B \\geq 0\n\n0 < A + B \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of blue balls that will be there among the first N balls in the row of balls.\n\nSample Input 1\n\n8 3 4\n\nSample Output 1\n\n4\n\nLet b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.\n\nSample Input 2\n\n8 0 4\n\nSample Output 2\n\n0\n\nHe placed only red balls from the beginning.\n\nSample Input 3\n\n6 2 4\n\nSample Output 3\n\n2\n\nAmong bbrrrr, there are two blue balls.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 196, "cpu_time_ms": 12, "memory_kb": 2732}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s091542233", "group_id": "codeNet:p02754", "input_text": "program prob2\n implicit none\n integer(16)::n,a,b,c\n read(*,*) n,a,b\n\n c = a+b\n\n if(n <= a+b) then\n write(*,*) a\n else\n write(*,*) n - n/c * b\n end if \n\n stop\nend program", "language": "Fortran", "metadata": {"date": 1593824877, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02754.html", "problem_id": "p02754", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02754/input.txt", "sample_output_relpath": "derived/input_output/data/p02754/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02754/Fortran/s091542233.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s091542233", "user_id": "u841856382"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program prob2\n implicit none\n integer(16)::n,a,b,c\n read(*,*) n,a,b\n\n c = a+b\n\n if(n <= a+b) then\n write(*,*) a\n else\n write(*,*) n - n/c * b\n end if \n\n stop\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\nPlace A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.\n\nHow many blue balls will be there among the first N balls in the row of balls made this way?\n\nConstraints\n\n1 \\leq N \\leq 10^{18}\n\nA, B \\geq 0\n\n0 < A + B \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of blue balls that will be there among the first N balls in the row of balls.\n\nSample Input 1\n\n8 3 4\n\nSample Output 1\n\n4\n\nLet b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.\n\nSample Input 2\n\n8 0 4\n\nSample Output 2\n\n0\n\nHe placed only red balls from the beginning.\n\nSample Input 3\n\n6 2 4\n\nSample Output 3\n\n2\n\nAmong bbrrrr, there are two blue balls.", "sample_input": "8 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02754", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\nPlace A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.\n\nHow many blue balls will be there among the first N balls in the row of balls made this way?\n\nConstraints\n\n1 \\leq N \\leq 10^{18}\n\nA, B \\geq 0\n\n0 < A + B \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of blue balls that will be there among the first N balls in the row of balls.\n\nSample Input 1\n\n8 3 4\n\nSample Output 1\n\n4\n\nLet b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.\n\nSample Input 2\n\n8 0 4\n\nSample Output 2\n\n0\n\nHe placed only red balls from the beginning.\n\nSample Input 3\n\n6 2 4\n\nSample Output 3\n\n2\n\nAmong bbrrrr, there are two blue balls.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 207, "cpu_time_ms": 14, "memory_kb": 2768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s502050504", "group_id": "codeNet:p02754", "input_text": "program ABC158B\n implicit none\n integer(8)::A,B,N,ans\n read(5,*)N,A,B\n ans=A*(N/(A+B))+min(A,mod(N,A+B))\n print'(i0)',ans\nend program ABC158B", "language": "Fortran", "metadata": {"date": 1584197261, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02754.html", "problem_id": "p02754", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02754/input.txt", "sample_output_relpath": "derived/input_output/data/p02754/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02754/Fortran/s502050504.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s502050504", "user_id": "u414699019"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program ABC158B\n implicit none\n integer(8)::A,B,N,ans\n read(5,*)N,A,B\n ans=A*(N/(A+B))+min(A,mod(N,A+B))\n print'(i0)',ans\nend program ABC158B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\nPlace A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.\n\nHow many blue balls will be there among the first N balls in the row of balls made this way?\n\nConstraints\n\n1 \\leq N \\leq 10^{18}\n\nA, B \\geq 0\n\n0 < A + B \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of blue balls that will be there among the first N balls in the row of balls.\n\nSample Input 1\n\n8 3 4\n\nSample Output 1\n\n4\n\nLet b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.\n\nSample Input 2\n\n8 0 4\n\nSample Output 2\n\n0\n\nHe placed only red balls from the beginning.\n\nSample Input 3\n\n6 2 4\n\nSample Output 3\n\n2\n\nAmong bbrrrr, there are two blue balls.", "sample_input": "8 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02754", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\nPlace A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.\n\nHow many blue balls will be there among the first N balls in the row of balls made this way?\n\nConstraints\n\n1 \\leq N \\leq 10^{18}\n\nA, B \\geq 0\n\n0 < A + B \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of blue balls that will be there among the first N balls in the row of balls.\n\nSample Input 1\n\n8 3 4\n\nSample Output 1\n\n4\n\nLet b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.\n\nSample Input 2\n\n8 0 4\n\nSample Output 2\n\n0\n\nHe placed only red balls from the beginning.\n\nSample Input 3\n\n6 2 4\n\nSample Output 3\n\n2\n\nAmong bbrrrr, there are two blue balls.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 156, "cpu_time_ms": 4, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s797862335", "group_id": "codeNet:p02754", "input_text": "program example\n\timplicit none\n\n\tinteger(8) N,A,B,amari\n \n read(*,*)N,A,B\n \n if(A==0) then\n \twrite(*,*)\"0\"\n else\n \tamari=mod(N,A+B)\n \n if(amari<=A) then\n \twrite(*,*) (N*A/(A+B))+amari\n else\n \twrite(*,*) (N*A/(A+B))+A\n end if\n end if\n \nend program", "language": "Fortran", "metadata": {"date": 1583634137, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02754.html", "problem_id": "p02754", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02754/input.txt", "sample_output_relpath": "derived/input_output/data/p02754/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02754/Fortran/s797862335.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s797862335", "user_id": "u374107737"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program example\n\timplicit none\n\n\tinteger(8) N,A,B,amari\n \n read(*,*)N,A,B\n \n if(A==0) then\n \twrite(*,*)\"0\"\n else\n \tamari=mod(N,A+B)\n \n if(amari<=A) then\n \twrite(*,*) (N*A/(A+B))+amari\n else\n \twrite(*,*) (N*A/(A+B))+A\n end if\n end if\n \nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\nPlace A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.\n\nHow many blue balls will be there among the first N balls in the row of balls made this way?\n\nConstraints\n\n1 \\leq N \\leq 10^{18}\n\nA, B \\geq 0\n\n0 < A + B \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of blue balls that will be there among the first N balls in the row of balls.\n\nSample Input 1\n\n8 3 4\n\nSample Output 1\n\n4\n\nLet b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.\n\nSample Input 2\n\n8 0 4\n\nSample Output 2\n\n0\n\nHe placed only red balls from the beginning.\n\nSample Input 3\n\n6 2 4\n\nSample Output 3\n\n2\n\nAmong bbrrrr, there are two blue balls.", "sample_input": "8 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02754", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has many red balls and blue balls. Now, he will place them in a row.\n\nInitially, there is no ball placed.\n\nTakahashi, who is very patient, will do the following operation 10^{100} times:\n\nPlace A blue balls at the end of the row of balls already placed. Then, place B red balls at the end of the row.\n\nHow many blue balls will be there among the first N balls in the row of balls made this way?\n\nConstraints\n\n1 \\leq N \\leq 10^{18}\n\nA, B \\geq 0\n\n0 < A + B \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the number of blue balls that will be there among the first N balls in the row of balls.\n\nSample Input 1\n\n8 3 4\n\nSample Output 1\n\n4\n\nLet b denote a blue ball, and r denote a red ball. The first eight balls in the row will be bbbrrrrb, among which there are four blue balls.\n\nSample Input 2\n\n8 0 4\n\nSample Output 2\n\n0\n\nHe placed only red balls from the beginning.\n\nSample Input 3\n\n6 2 4\n\nSample Output 3\n\n2\n\nAmong bbrrrr, there are two blue balls.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 315, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s749149973", "group_id": "codeNet:p02755", "input_text": "program main\ninteger a,b,as,al,bs,bl\nread *,a,b\n \nas = int(100./8.*dble(a))\nal = int(100./8.*dble(a+0.999))\nbs = int(100./10.*dble(b))\nbl = int(100./10.*dble(b+0.999))\n \n \nprint *,as,al\nprint *,bs,bl\ndo i=as,al\n\tdo j=bs,bl\n \tif(i==j) then\n \tprint *,i\n stop\n end if\n end do\nend do\nprint *,-1 \n \nend", "language": "Fortran", "metadata": {"date": 1583780384, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02755.html", "problem_id": "p02755", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02755/input.txt", "sample_output_relpath": "derived/input_output/data/p02755/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02755/Fortran/s749149973.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s749149973", "user_id": "u158583803"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "program main\ninteger a,b,as,al,bs,bl\nread *,a,b\n \nas = int(100./8.*dble(a))\nal = int(100./8.*dble(a+0.999))\nbs = int(100./10.*dble(b))\nbl = int(100./10.*dble(b+0.999))\n \n \nprint *,as,al\nprint *,bs,bl\ndo i=as,al\n\tdo j=bs,bl\n \tif(i==j) then\n \tprint *,i\n stop\n end if\n end do\nend do\nprint *,-1 \n \nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFind the price of a product before tax such that, when the consumption tax rate is 8 percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)\n\nHere, the price before tax must be a positive integer, and the amount of consumption tax is rounded down to the nearest integer.\n\nIf multiple prices satisfy the condition, print the lowest such price; if no price satisfies the condition, print -1.\n\nConstraints\n\n1 \\leq A \\leq B \\leq 100\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf there is a price that satisfies the condition, print an integer representing the lowest such price; otherwise, print -1.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n25\n\nIf the price of a product before tax is 25 yen, the amount of consumption tax levied on it is:\n\nWhen the consumption tax rate is 8 percent: \\lfloor 25 \\times 0.08 \\rfloor = \\lfloor 2 \\rfloor = 2 yen.\n\nWhen the consumption tax rate is 10 percent: \\lfloor 25 \\times 0.1 \\rfloor = \\lfloor 2.5 \\rfloor = 2 yen.\n\nThus, the price of 25 yen satisfies the condition. There are other possible prices, such as 26 yen, but print the minimum such price, 25.\n\nSample Input 2\n\n8 10\n\nSample Output 2\n\n100\n\nIf the price of a product before tax is 100 yen, the amount of consumption tax levied on it is:\n\nWhen the consumption tax rate is 8 percent: \\lfloor 100 \\times 0.08 \\rfloor = 8 yen.\n\nWhen the consumption tax rate is 10 percent: \\lfloor 100 \\times 0.1 \\rfloor = 10 yen.\n\nSample Input 3\n\n19 99\n\nSample Output 3\n\n-1\n\nThere is no price before tax satisfying this condition, so print -1.", "sample_input": "2 2\n"}, "reference_outputs": ["25\n"], "source_document_id": "p02755", "source_text": "Score : 300 points\n\nProblem Statement\n\nFind the price of a product before tax such that, when the consumption tax rate is 8 percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)\n\nHere, the price before tax must be a positive integer, and the amount of consumption tax is rounded down to the nearest integer.\n\nIf multiple prices satisfy the condition, print the lowest such price; if no price satisfies the condition, print -1.\n\nConstraints\n\n1 \\leq A \\leq B \\leq 100\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf there is a price that satisfies the condition, print an integer representing the lowest such price; otherwise, print -1.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n25\n\nIf the price of a product before tax is 25 yen, the amount of consumption tax levied on it is:\n\nWhen the consumption tax rate is 8 percent: \\lfloor 25 \\times 0.08 \\rfloor = \\lfloor 2 \\rfloor = 2 yen.\n\nWhen the consumption tax rate is 10 percent: \\lfloor 25 \\times 0.1 \\rfloor = \\lfloor 2.5 \\rfloor = 2 yen.\n\nThus, the price of 25 yen satisfies the condition. There are other possible prices, such as 26 yen, but print the minimum such price, 25.\n\nSample Input 2\n\n8 10\n\nSample Output 2\n\n100\n\nIf the price of a product before tax is 100 yen, the amount of consumption tax levied on it is:\n\nWhen the consumption tax rate is 8 percent: \\lfloor 100 \\times 0.08 \\rfloor = 8 yen.\n\nWhen the consumption tax rate is 10 percent: \\lfloor 100 \\times 0.1 \\rfloor = 10 yen.\n\nSample Input 3\n\n19 99\n\nSample Output 3\n\n-1\n\nThere is no price before tax satisfying this condition, so print -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 335, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s658762119", "group_id": "codeNet:p02755", "input_text": "program main\ninteger a,b,as,al,bs,bl\nread *,a,b\n\nas = int(100./8.*dble(a))\nal = nint(100./8.*dble(a))\nbs = int(100./10.*dble(b))\nbl = nint(100./10.*dble(a))\n\ndo i=as,al\n\tdo j=bs,bl\n \tif(i==j) then\n \tprint *,i\n stop\n end if\n end do\nend do\nprint *,-1 \n\nend", "language": "Fortran", "metadata": {"date": 1583779779, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02755.html", "problem_id": "p02755", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02755/input.txt", "sample_output_relpath": "derived/input_output/data/p02755/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02755/Fortran/s658762119.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s658762119", "user_id": "u158583803"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "program main\ninteger a,b,as,al,bs,bl\nread *,a,b\n\nas = int(100./8.*dble(a))\nal = nint(100./8.*dble(a))\nbs = int(100./10.*dble(b))\nbl = nint(100./10.*dble(a))\n\ndo i=as,al\n\tdo j=bs,bl\n \tif(i==j) then\n \tprint *,i\n stop\n end if\n end do\nend do\nprint *,-1 \n\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFind the price of a product before tax such that, when the consumption tax rate is 8 percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)\n\nHere, the price before tax must be a positive integer, and the amount of consumption tax is rounded down to the nearest integer.\n\nIf multiple prices satisfy the condition, print the lowest such price; if no price satisfies the condition, print -1.\n\nConstraints\n\n1 \\leq A \\leq B \\leq 100\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf there is a price that satisfies the condition, print an integer representing the lowest such price; otherwise, print -1.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n25\n\nIf the price of a product before tax is 25 yen, the amount of consumption tax levied on it is:\n\nWhen the consumption tax rate is 8 percent: \\lfloor 25 \\times 0.08 \\rfloor = \\lfloor 2 \\rfloor = 2 yen.\n\nWhen the consumption tax rate is 10 percent: \\lfloor 25 \\times 0.1 \\rfloor = \\lfloor 2.5 \\rfloor = 2 yen.\n\nThus, the price of 25 yen satisfies the condition. There are other possible prices, such as 26 yen, but print the minimum such price, 25.\n\nSample Input 2\n\n8 10\n\nSample Output 2\n\n100\n\nIf the price of a product before tax is 100 yen, the amount of consumption tax levied on it is:\n\nWhen the consumption tax rate is 8 percent: \\lfloor 100 \\times 0.08 \\rfloor = 8 yen.\n\nWhen the consumption tax rate is 10 percent: \\lfloor 100 \\times 0.1 \\rfloor = 10 yen.\n\nSample Input 3\n\n19 99\n\nSample Output 3\n\n-1\n\nThere is no price before tax satisfying this condition, so print -1.", "sample_input": "2 2\n"}, "reference_outputs": ["25\n"], "source_document_id": "p02755", "source_text": "Score : 300 points\n\nProblem Statement\n\nFind the price of a product before tax such that, when the consumption tax rate is 8 percent and 10 percent, the amount of consumption tax levied on it is A yen and B yen, respectively. (Yen is the currency of Japan.)\n\nHere, the price before tax must be a positive integer, and the amount of consumption tax is rounded down to the nearest integer.\n\nIf multiple prices satisfy the condition, print the lowest such price; if no price satisfies the condition, print -1.\n\nConstraints\n\n1 \\leq A \\leq B \\leq 100\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf there is a price that satisfies the condition, print an integer representing the lowest such price; otherwise, print -1.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n25\n\nIf the price of a product before tax is 25 yen, the amount of consumption tax levied on it is:\n\nWhen the consumption tax rate is 8 percent: \\lfloor 25 \\times 0.08 \\rfloor = \\lfloor 2 \\rfloor = 2 yen.\n\nWhen the consumption tax rate is 10 percent: \\lfloor 25 \\times 0.1 \\rfloor = \\lfloor 2.5 \\rfloor = 2 yen.\n\nThus, the price of 25 yen satisfies the condition. There are other possible prices, such as 26 yen, but print the minimum such price, 25.\n\nSample Input 2\n\n8 10\n\nSample Output 2\n\n100\n\nIf the price of a product before tax is 100 yen, the amount of consumption tax levied on it is:\n\nWhen the consumption tax rate is 8 percent: \\lfloor 100 \\times 0.08 \\rfloor = 8 yen.\n\nWhen the consumption tax rate is 10 percent: \\lfloor 100 \\times 0.1 \\rfloor = 10 yen.\n\nSample Input 3\n\n19 99\n\nSample Output 3\n\n-1\n\nThere is no price before tax satisfying this condition, so print -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 292, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s528348712", "group_id": "codeNet:p02759", "input_text": "program ABC157_A\n read(5,*)N\n if(N/2*2==N) then\n write(6,*)N/2\n else\n write(6,*)N/2+1\n end if\nend program ABC157_A", "language": "Fortran", "metadata": {"date": 1586402829, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02759.html", "problem_id": "p02759", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02759/input.txt", "sample_output_relpath": "derived/input_output/data/p02759/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02759/Fortran/s528348712.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s528348712", "user_id": "u359178469"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program ABC157_A\n read(5,*)N\n if(N/2*2==N) then\n write(6,*)N/2\n else\n write(6,*)N/2+1\n end if\nend program ABC157_A", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.\n\nAt least how many sheets of paper does he need?\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n3\n\nBy printing the 1-st, 2-nd pages on the 1-st sheet, 3-rd and 4-th pages on the 2-nd sheet, and 5-th page on the 3-rd sheet, we can print all the data on 3 sheets of paper.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100\n\nSample Output 3\n\n50", "sample_input": "5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02759", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi wants to print a document with N pages double-sided, where two pages of data can be printed on one sheet of paper.\n\nAt least how many sheets of paper does he need?\n\nConstraints\n\nN is an integer.\n\n1 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n3\n\nBy printing the 1-st, 2-nd pages on the 1-st sheet, 3-rd and 4-th pages on the 2-nd sheet, and 5-th page on the 3-rd sheet, we can print all the data on 3 sheets of paper.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100\n\nSample Output 3\n\n50", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 126, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s615827237", "group_id": "codeNet:p02760", "input_text": "program sample\n implicit none\n \n integer(8) :: i,j,k,m,n,h,w,b\n \n integer(8),allocatable :: y(:)\n integer(8)::a(3,3),che(3,3)\n read(*,*) a\n read(*,*) n\n \n do i=1,n\n read(*,*)b\n do j=1,3\n do k=1,3\n\n if (b==a(j,k))then\n che(j,k)=1\n end if\n\n end do\n end do\n end do\n do i=1,3\n if (che(i,1)==1 .and. che(i,2)==1 .and. che(i,3)==1)then\n write(*,*)'Yes'\n stop\n end if\n end do\n do i=1,3\n if (che(1,i)==1 .and. che(2,i)==1 .and. che(3,i)==1)then\n write(*,*)'Yes'\n stop\n end if\n end do\n \n if (che(1,1)==1 .and. che(2,2)==1 .and. che(3,3)==1)then\n write(*,*)'Yes'\n stop\n end if\n \n\n if (che(1,3)==1 .and. che(2,2)==1 .and. che(3,1)==1)then\n write(*,*)'Yes'\n stop\n \n end if\n write(*,*)'No'\n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1592087760, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02760.html", "problem_id": "p02760", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02760/input.txt", "sample_output_relpath": "derived/input_output/data/p02760/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02760/Fortran/s615827237.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s615827237", "user_id": "u713568912"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program sample\n implicit none\n \n integer(8) :: i,j,k,m,n,h,w,b\n \n integer(8),allocatable :: y(:)\n integer(8)::a(3,3),che(3,3)\n read(*,*) a\n read(*,*) n\n \n do i=1,n\n read(*,*)b\n do j=1,3\n do k=1,3\n\n if (b==a(j,k))then\n che(j,k)=1\n end if\n\n end do\n end do\n end do\n do i=1,3\n if (che(i,1)==1 .and. che(i,2)==1 .and. che(i,3)==1)then\n write(*,*)'Yes'\n stop\n end if\n end do\n do i=1,3\n if (che(1,i)==1 .and. che(2,i)==1 .and. che(3,i)==1)then\n write(*,*)'Yes'\n stop\n end if\n end do\n \n if (che(1,1)==1 .and. che(2,2)==1 .and. che(3,3)==1)then\n write(*,*)'Yes'\n stop\n end if\n \n\n if (che(1,3)==1 .and. che(2,2)==1 .and. che(3,1)==1)then\n write(*,*)'Yes'\n stop\n \n end if\n write(*,*)'No'\n stop\nend program sample\n \n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\n\nDetermine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_{i, j} \\leq 100\n\nA_{i_1, j_1} \\neq A_{i_2, j_2} ((i_1, j_1) \\neq (i_2, j_2))\n\n1 \\leq N \\leq 10\n\n1 \\leq b_i \\leq 100\n\nb_i \\neq b_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_{1, 1} A_{1, 2} A_{1, 3}\nA_{2, 1} A_{2, 2} A_{2, 3}\nA_{3, 1} A_{3, 2} A_{3, 3}\nN\nb_1\n\\vdots\nb_N\n\nOutput\n\nIf we will have a bingo, print Yes; otherwise, print No.\n\nSample Input 1\n\n84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n\nSample Output 1\n\nYes\n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.\n\nSample Input 2\n\n41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17\n\nSample Output 2\n\nNo\n\nWe will mark nothing.\n\nSample Input 3\n\n60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n\nSample Output 3\n\nYes\n\nWe will mark all the squares.", "sample_input": "84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02760", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a bingo card with a 3\\times3 grid. The square at the i-th row from the top and the j-th column from the left contains the number A_{i, j}.\n\nThe MC will choose N numbers, b_1, b_2, \\cdots, b_N. If our bingo sheet contains some of those numbers, we will mark them on our sheet.\n\nDetermine whether we will have a bingo when the N numbers are chosen, that is, the sheet will contain three marked numbers in a row, column, or diagonal.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_{i, j} \\leq 100\n\nA_{i_1, j_1} \\neq A_{i_2, j_2} ((i_1, j_1) \\neq (i_2, j_2))\n\n1 \\leq N \\leq 10\n\n1 \\leq b_i \\leq 100\n\nb_i \\neq b_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_{1, 1} A_{1, 2} A_{1, 3}\nA_{2, 1} A_{2, 2} A_{2, 3}\nA_{3, 1} A_{3, 2} A_{3, 3}\nN\nb_1\n\\vdots\nb_N\n\nOutput\n\nIf we will have a bingo, print Yes; otherwise, print No.\n\nSample Input 1\n\n84 97 66\n79 89 11\n61 59 7\n7\n89\n7\n87\n79\n24\n84\n30\n\nSample Output 1\n\nYes\n\nWe will mark A_{1, 1}, A_{2, 1}, A_{2, 2}, A_{3, 3}, and complete the diagonal from the top-left to the bottom-right.\n\nSample Input 2\n\n41 7 46\n26 89 2\n78 92 8\n5\n6\n45\n16\n57\n17\n\nSample Output 2\n\nNo\n\nWe will mark nothing.\n\nSample Input 3\n\n60 88 34\n92 41 43\n65 73 48\n10\n60\n43\n88\n11\n48\n73\n65\n41\n92\n34\n\nSample Output 3\n\nYes\n\nWe will mark all the squares.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 980, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s591900527", "group_id": "codeNet:p02763", "input_text": "program main\n implicit none\n type arr_list\n integer :: N\n integer,allocatable :: point(:)\n end type arr_list\n type(arr_list),allocatable :: data(:)\n integer :: num(97:122)\n integer :: N, Q\n character(len=500000) :: S\n character(:),allocatable :: tmp\n character(len=1) :: c,b,c2\n integer,allocatable :: tmp2(:)\n integer :: a\n integer :: i,j, l,r\n integer :: out\n read(*,*) N\n read(*,*) S\n read(*,*) Q\n allocate(data(97:122))\n allocate(tmp2(0:N-1))\n data(:)%N = 0\n num(:) = 0\n do i = 1,N\n data(ichar(S(i:i)))%N = data(ichar(S(i:i)))%N+1\n end do\n do i = 97,122\n if (data(i)%N > 0) allocate(data(i)%point(0:data(i)%N-1))\n end do\n do i = 1,N\n data(ichar(S(i:i)))%point( num(ichar(S(i:i))) ) = i-1\n num(ichar(S(i:i))) = num(ichar(S(i:i))) + 1\n end do\n! do i = 97,97+4\n! write(*,*) data(i)%point\n! end do\n do i = 1, Q\n read(*,'(i1,1x,a,1x,a)') a,b,c\n if (a == 1) then\n backspace(5)\n !read(*,'(i1,1x,g0,1x,a)') a,j,c\n read(*,*) a,j,c\n c2 = S(j:j)\n call insert_delete(data,j-1,c,c2,tmp2)\n S(j:j) = c\n else\n backspace(5)\n! read(*,'(i1,1x,g0,1x,g0)') a,l,r\n read(*,*) a,l,r\n !tmp = S(l:r)\n !call count_char(S(l:r),out)\n call count_char(data,l-1,r-1,out)\n write(*,'(i0)') out\n !deallocate(tmp)\n end if\n\n end do\ncontains\n subroutine insert_delete(data,key,c,c2,tmp)\n implicit none\n type(arr_list),intent(inout) :: data(97:122)\n integer,intent(in) :: key ! key\n character,intent(in) :: c,c2 ! char\n integer :: tmp(:)\n integer :: i,i2\n integer :: j\n integer :: n\n\n i = ichar(c)\n i2 = ichar(c2)\n if ( i /= i2) then ! insert and delete\n if ( data(i)%N > 0) then\n j = found_point(data(i)%point(:),data(i)%n, key)\n else\n data(i)%N=data(i)%N+1\n allocate(data(i)%point(0:data(i)%N-1))\n data(i)%point(0:0) = key\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n !allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n !deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n return\n end if\n if ( j == data(i)%N) then ! out bound\n n = data(i)%n\n !allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i)%point(0:n-1)\n deallocate( data(i)%point )\n data(i)%n = data(i)%n + 1\n allocate( data(i)%point(0:data(i)%n-1) )\n data(i)%point(0:n-1) = tmp(0:n-1)\n data(i)%point(n) = key\n !deallocate(tmp)\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n !allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n !deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n return\n else\n n = data(i)%n\n !allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i)%point(0:n-1)\n deallocate( data(i)%point )\n data(i)%n = data(i)%n + 1\n allocate( data(i)%point(0:data(i)%n-1) )\n if ( j == 0 ) then\n data(i)%point(0:0) = key\n data(i)%point(j+1:) = tmp(0:n-1)\n else \n data(i)%point(0:j-1) = tmp(0:j-1)\n data(i)%point(j) = key\n data(i)%point(j+1:) = tmp(j:n-1)\n end if\n !deallocate(tmp)\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n !allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n !deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n end if\n end if\n return\n end subroutine insert_delete\n\n function found_point(a,n,key) result(ok)\n integer,intent(in) :: n\n integer,intent(in) :: a(0:n-1)\n integer,intent(in) :: key\n integer :: ng\n integer :: ok\n integer :: mid\n integer :: test\n ng = -1\n ok = n\n !do while( )\n test = 0\n do \n mid = (ok + ng)/2\n if (isOK(mid,key,a,n)) then\n ok = mid\n else\n ng = mid\n end if\n if (abs(ok-ng) <= 1) exit\n end do\n end function found_point\n\n \n function isOK (index, key,a,n) result(out)\n integer,intent(in):: n\n integer,intent(in) :: a(0:n-1)\n integer,intent(in) :: index, key\n logical :: out\n if ( a(index) >= key) then\n out = .true.\n else \n out = .false.\n end if\n end function isOK\n subroutine count_char(data,l,r,out)\n type(arr_list) :: data(97:122)\n integer :: l,r\n integer :: out\n integer :: N\n integer :: i, j, tmp\n out = 0\n do i = 97,122\n if ( data(i)%n > 0) then\n j = found_point(data(i)%point(:),data(i)%n,l)\n if ( j < data(i)%N) then\n if ( l<=data(i)%point(j) .and. data(i)%point(j) <= r) then\n out = out + 1\n end if\n!! if ( j+1 < data(i)%N) then\n!! if ( l<=data(i)%point(j) .and. data(i)%point(j) <= r) then\n!! out = out + 1\n!! cycle\n!! end if\n!! if ( data(i)%point(j) < l .and. data(i)%point(j+1) <= r) then\n!! out = out + 1\n!! end if\n!! else\n!! end if\n end if\n end if\n end do\n end subroutine count_char\n \n subroutine count_char2(S,out)\n character(*) :: S\n integer :: out\n integer :: N\n integer :: i, tmp\n integer :: c(97:122)\n N = len_trim(S)\n c(97:122) = 0\n do i = 1,N\n tmp = ichar(S(i:i))\n c (tmp) = c(tmp) + 1\n end do\n out = count(c /=0)\n end subroutine count_char2\nend program main\n", "language": "Fortran", "metadata": {"date": 1583172713, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02763.html", "problem_id": "p02763", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02763/input.txt", "sample_output_relpath": "derived/input_output/data/p02763/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02763/Fortran/s591900527.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s591900527", "user_id": "u886432251"}, "prompt_components": {"gold_output": "3\n1\n5\n", "input_to_evaluate": "program main\n implicit none\n type arr_list\n integer :: N\n integer,allocatable :: point(:)\n end type arr_list\n type(arr_list),allocatable :: data(:)\n integer :: num(97:122)\n integer :: N, Q\n character(len=500000) :: S\n character(:),allocatable :: tmp\n character(len=1) :: c,b,c2\n integer,allocatable :: tmp2(:)\n integer :: a\n integer :: i,j, l,r\n integer :: out\n read(*,*) N\n read(*,*) S\n read(*,*) Q\n allocate(data(97:122))\n allocate(tmp2(0:N-1))\n data(:)%N = 0\n num(:) = 0\n do i = 1,N\n data(ichar(S(i:i)))%N = data(ichar(S(i:i)))%N+1\n end do\n do i = 97,122\n if (data(i)%N > 0) allocate(data(i)%point(0:data(i)%N-1))\n end do\n do i = 1,N\n data(ichar(S(i:i)))%point( num(ichar(S(i:i))) ) = i-1\n num(ichar(S(i:i))) = num(ichar(S(i:i))) + 1\n end do\n! do i = 97,97+4\n! write(*,*) data(i)%point\n! end do\n do i = 1, Q\n read(*,'(i1,1x,a,1x,a)') a,b,c\n if (a == 1) then\n backspace(5)\n !read(*,'(i1,1x,g0,1x,a)') a,j,c\n read(*,*) a,j,c\n c2 = S(j:j)\n call insert_delete(data,j-1,c,c2,tmp2)\n S(j:j) = c\n else\n backspace(5)\n! read(*,'(i1,1x,g0,1x,g0)') a,l,r\n read(*,*) a,l,r\n !tmp = S(l:r)\n !call count_char(S(l:r),out)\n call count_char(data,l-1,r-1,out)\n write(*,'(i0)') out\n !deallocate(tmp)\n end if\n\n end do\ncontains\n subroutine insert_delete(data,key,c,c2,tmp)\n implicit none\n type(arr_list),intent(inout) :: data(97:122)\n integer,intent(in) :: key ! key\n character,intent(in) :: c,c2 ! char\n integer :: tmp(:)\n integer :: i,i2\n integer :: j\n integer :: n\n\n i = ichar(c)\n i2 = ichar(c2)\n if ( i /= i2) then ! insert and delete\n if ( data(i)%N > 0) then\n j = found_point(data(i)%point(:),data(i)%n, key)\n else\n data(i)%N=data(i)%N+1\n allocate(data(i)%point(0:data(i)%N-1))\n data(i)%point(0:0) = key\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n !allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n !deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n return\n end if\n if ( j == data(i)%N) then ! out bound\n n = data(i)%n\n !allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i)%point(0:n-1)\n deallocate( data(i)%point )\n data(i)%n = data(i)%n + 1\n allocate( data(i)%point(0:data(i)%n-1) )\n data(i)%point(0:n-1) = tmp(0:n-1)\n data(i)%point(n) = key\n !deallocate(tmp)\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n !allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n !deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n return\n else\n n = data(i)%n\n !allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i)%point(0:n-1)\n deallocate( data(i)%point )\n data(i)%n = data(i)%n + 1\n allocate( data(i)%point(0:data(i)%n-1) )\n if ( j == 0 ) then\n data(i)%point(0:0) = key\n data(i)%point(j+1:) = tmp(0:n-1)\n else \n data(i)%point(0:j-1) = tmp(0:j-1)\n data(i)%point(j) = key\n data(i)%point(j+1:) = tmp(j:n-1)\n end if\n !deallocate(tmp)\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n !allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n !deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n end if\n end if\n return\n end subroutine insert_delete\n\n function found_point(a,n,key) result(ok)\n integer,intent(in) :: n\n integer,intent(in) :: a(0:n-1)\n integer,intent(in) :: key\n integer :: ng\n integer :: ok\n integer :: mid\n integer :: test\n ng = -1\n ok = n\n !do while( )\n test = 0\n do \n mid = (ok + ng)/2\n if (isOK(mid,key,a,n)) then\n ok = mid\n else\n ng = mid\n end if\n if (abs(ok-ng) <= 1) exit\n end do\n end function found_point\n\n \n function isOK (index, key,a,n) result(out)\n integer,intent(in):: n\n integer,intent(in) :: a(0:n-1)\n integer,intent(in) :: index, key\n logical :: out\n if ( a(index) >= key) then\n out = .true.\n else \n out = .false.\n end if\n end function isOK\n subroutine count_char(data,l,r,out)\n type(arr_list) :: data(97:122)\n integer :: l,r\n integer :: out\n integer :: N\n integer :: i, j, tmp\n out = 0\n do i = 97,122\n if ( data(i)%n > 0) then\n j = found_point(data(i)%point(:),data(i)%n,l)\n if ( j < data(i)%N) then\n if ( l<=data(i)%point(j) .and. data(i)%point(j) <= r) then\n out = out + 1\n end if\n!! if ( j+1 < data(i)%N) then\n!! if ( l<=data(i)%point(j) .and. data(i)%point(j) <= r) then\n!! out = out + 1\n!! cycle\n!! end if\n!! if ( data(i)%point(j) < l .and. data(i)%point(j+1) <= r) then\n!! out = out + 1\n!! end if\n!! else\n!! end if\n end if\n end if\n end do\n end subroutine count_char\n \n subroutine count_char2(S,out)\n character(*) :: S\n integer :: out\n integer :: N\n integer :: i, tmp\n integer :: c(97:122)\n N = len_trim(S)\n c(97:122) = 0\n do i = 1,N\n tmp = ichar(S(i:i))\n c (tmp) = c(tmp) + 1\n end do\n out = count(c /=0)\n end subroutine count_char2\nend program main\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\n\nProcess Q queries of the following two types:\n\nType 1: change the i_q-th character of S to c_q. (Do nothing if the i_q-th character is already c_q.)\n\nType 2: answer the number of different characters occurring in the substring of S between the l_q-th and r_q-th characters (inclusive).\n\nConstraints\n\nN, Q, i_q, l_q, and r_q are integers.\n\nS is a string consisting of lowercase English letters.\n\nc_q is a lowercase English letter.\n\n1 \\leq N \\leq 500000\n\n1 \\leq Q \\leq 20000\n\n|S| = N\n\n1 \\leq i_q \\leq N\n\n1 \\leq l_q \\leq r_q \\leq N\n\nThere is at least one query of type 2 in each testcase.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nQ\nQuery_1\n\\vdots\nQuery_Q\n\nHere, Query_i in the 4-th through (Q+3)-th lines is one of the following:\n\n1 i_q c_q\n\n2 l_q r_q\n\nOutput\n\nFor each query of type 2, print a line containing the answer.\n\nSample Input 1\n\n7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n\nSample Output 1\n\n3\n1\n5\n\nIn the first query, cdbb contains three kinds of letters: b , c , and d, so we print 3.\n\nIn the second query, S is modified to abcdzbd.\n\nIn the third query, a contains one kind of letter: a, so we print 1.\n\nIn the fourth query, S is modified to abcazbd.\n\nIn the fifth query, S does not change and is still abcazbd.\n\nIn the sixth query, abcazbd contains five kinds of letters: a, b, c, d, and z, so we print 5.", "sample_input": "7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n"}, "reference_outputs": ["3\n1\n5\n"], "source_document_id": "p02763", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\n\nProcess Q queries of the following two types:\n\nType 1: change the i_q-th character of S to c_q. (Do nothing if the i_q-th character is already c_q.)\n\nType 2: answer the number of different characters occurring in the substring of S between the l_q-th and r_q-th characters (inclusive).\n\nConstraints\n\nN, Q, i_q, l_q, and r_q are integers.\n\nS is a string consisting of lowercase English letters.\n\nc_q is a lowercase English letter.\n\n1 \\leq N \\leq 500000\n\n1 \\leq Q \\leq 20000\n\n|S| = N\n\n1 \\leq i_q \\leq N\n\n1 \\leq l_q \\leq r_q \\leq N\n\nThere is at least one query of type 2 in each testcase.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nQ\nQuery_1\n\\vdots\nQuery_Q\n\nHere, Query_i in the 4-th through (Q+3)-th lines is one of the following:\n\n1 i_q c_q\n\n2 l_q r_q\n\nOutput\n\nFor each query of type 2, print a line containing the answer.\n\nSample Input 1\n\n7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n\nSample Output 1\n\n3\n1\n5\n\nIn the first query, cdbb contains three kinds of letters: b , c , and d, so we print 3.\n\nIn the second query, S is modified to abcdzbd.\n\nIn the third query, a contains one kind of letter: a, so we print 1.\n\nIn the fourth query, S is modified to abcazbd.\n\nIn the fifth query, S does not change and is still abcazbd.\n\nIn the sixth query, abcazbd contains five kinds of letters: a, b, c, d, and z, so we print 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6665, "cpu_time_ms": 2103, "memory_kb": 5308}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s782650500", "group_id": "codeNet:p02763", "input_text": "program main\n implicit none\n type arr_list\n integer :: N\n integer,allocatable :: point(:)\n end type arr_list\n type(arr_list),allocatable :: data(:)\n integer :: num(97:122)\n integer :: N, Q\n character(len=500000) :: S\n integer(2),allocatable :: S2(:)\n !character(:),allocatable :: tmp\n integer(2),allocatable :: tmp(:)\n character(len=1) :: c,b,c2\n integer :: a\n integer :: i,j, l,r\n integer :: out\n read(*,*) N\n read(*,*) S\n read(*,*) Q\n allocate(S2(N))\n do i = 1,N\n S2(i) = ichar(S(i:i))\n end do\n do i = 1, Q\n read(*,'(i1,1x,a,1x,a)') a,b,c\n if (a == 1) then\n backspace(5)\n !read(*,'(i1,1x,g0,1x,a)') a,j,c\n read(*,*) a,j,c\n S2(j:j) = ichar(c)\n else\n backspace(5)\n! read(*,'(i1,1x,g0,1x,g0)') a,l,r\n read(*,*) a,l,r\n !tmp = S(l:r)\n !call count_char(S(l:r),out)\n call count_char2(S2(l:r),out)\n write(*,'(i0)') out\n !deallocate(tmp)\n end if\n\n end do\ncontains\n subroutine count_char2(S,out)\n integer(2) :: S(:)\n integer :: out\n integer :: N\n integer :: i, tmp\n integer :: c(97:122)\n N = size(S)\n c(97:122) = 0\n do i = 1,N\n c (S(i)) = c(S(i)) + 1\n end do\n out = count(c /=0)\n end subroutine count_char2\nend program main\n", "language": "Fortran", "metadata": {"date": 1583168389, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02763.html", "problem_id": "p02763", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02763/input.txt", "sample_output_relpath": "derived/input_output/data/p02763/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02763/Fortran/s782650500.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s782650500", "user_id": "u886432251"}, "prompt_components": {"gold_output": "3\n1\n5\n", "input_to_evaluate": "program main\n implicit none\n type arr_list\n integer :: N\n integer,allocatable :: point(:)\n end type arr_list\n type(arr_list),allocatable :: data(:)\n integer :: num(97:122)\n integer :: N, Q\n character(len=500000) :: S\n integer(2),allocatable :: S2(:)\n !character(:),allocatable :: tmp\n integer(2),allocatable :: tmp(:)\n character(len=1) :: c,b,c2\n integer :: a\n integer :: i,j, l,r\n integer :: out\n read(*,*) N\n read(*,*) S\n read(*,*) Q\n allocate(S2(N))\n do i = 1,N\n S2(i) = ichar(S(i:i))\n end do\n do i = 1, Q\n read(*,'(i1,1x,a,1x,a)') a,b,c\n if (a == 1) then\n backspace(5)\n !read(*,'(i1,1x,g0,1x,a)') a,j,c\n read(*,*) a,j,c\n S2(j:j) = ichar(c)\n else\n backspace(5)\n! read(*,'(i1,1x,g0,1x,g0)') a,l,r\n read(*,*) a,l,r\n !tmp = S(l:r)\n !call count_char(S(l:r),out)\n call count_char2(S2(l:r),out)\n write(*,'(i0)') out\n !deallocate(tmp)\n end if\n\n end do\ncontains\n subroutine count_char2(S,out)\n integer(2) :: S(:)\n integer :: out\n integer :: N\n integer :: i, tmp\n integer :: c(97:122)\n N = size(S)\n c(97:122) = 0\n do i = 1,N\n c (S(i)) = c(S(i)) + 1\n end do\n out = count(c /=0)\n end subroutine count_char2\nend program main\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\n\nProcess Q queries of the following two types:\n\nType 1: change the i_q-th character of S to c_q. (Do nothing if the i_q-th character is already c_q.)\n\nType 2: answer the number of different characters occurring in the substring of S between the l_q-th and r_q-th characters (inclusive).\n\nConstraints\n\nN, Q, i_q, l_q, and r_q are integers.\n\nS is a string consisting of lowercase English letters.\n\nc_q is a lowercase English letter.\n\n1 \\leq N \\leq 500000\n\n1 \\leq Q \\leq 20000\n\n|S| = N\n\n1 \\leq i_q \\leq N\n\n1 \\leq l_q \\leq r_q \\leq N\n\nThere is at least one query of type 2 in each testcase.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nQ\nQuery_1\n\\vdots\nQuery_Q\n\nHere, Query_i in the 4-th through (Q+3)-th lines is one of the following:\n\n1 i_q c_q\n\n2 l_q r_q\n\nOutput\n\nFor each query of type 2, print a line containing the answer.\n\nSample Input 1\n\n7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n\nSample Output 1\n\n3\n1\n5\n\nIn the first query, cdbb contains three kinds of letters: b , c , and d, so we print 3.\n\nIn the second query, S is modified to abcdzbd.\n\nIn the third query, a contains one kind of letter: a, so we print 1.\n\nIn the fourth query, S is modified to abcazbd.\n\nIn the fifth query, S does not change and is still abcazbd.\n\nIn the sixth query, abcazbd contains five kinds of letters: a, b, c, d, and z, so we print 5.", "sample_input": "7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n"}, "reference_outputs": ["3\n1\n5\n"], "source_document_id": "p02763", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\n\nProcess Q queries of the following two types:\n\nType 1: change the i_q-th character of S to c_q. (Do nothing if the i_q-th character is already c_q.)\n\nType 2: answer the number of different characters occurring in the substring of S between the l_q-th and r_q-th characters (inclusive).\n\nConstraints\n\nN, Q, i_q, l_q, and r_q are integers.\n\nS is a string consisting of lowercase English letters.\n\nc_q is a lowercase English letter.\n\n1 \\leq N \\leq 500000\n\n1 \\leq Q \\leq 20000\n\n|S| = N\n\n1 \\leq i_q \\leq N\n\n1 \\leq l_q \\leq r_q \\leq N\n\nThere is at least one query of type 2 in each testcase.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nQ\nQuery_1\n\\vdots\nQuery_Q\n\nHere, Query_i in the 4-th through (Q+3)-th lines is one of the following:\n\n1 i_q c_q\n\n2 l_q r_q\n\nOutput\n\nFor each query of type 2, print a line containing the answer.\n\nSample Input 1\n\n7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n\nSample Output 1\n\n3\n1\n5\n\nIn the first query, cdbb contains three kinds of letters: b , c , and d, so we print 3.\n\nIn the second query, S is modified to abcdzbd.\n\nIn the third query, a contains one kind of letter: a, so we print 1.\n\nIn the fourth query, S is modified to abcazbd.\n\nIn the fifth query, S does not change and is still abcazbd.\n\nIn the sixth query, abcazbd contains five kinds of letters: a, b, c, d, and z, so we print 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1289, "cpu_time_ms": 2103, "memory_kb": 2400}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s788870934", "group_id": "codeNet:p02763", "input_text": "program main\n implicit none\n type arr_list\n integer :: N\n integer,allocatable :: point(:)\n end type arr_list\n type(arr_list),allocatable :: data(:)\n integer :: num(97:122)\n integer :: N, Q\n character(len=500000) :: S\n character(:),allocatable :: tmp\n character(len=1) :: c,b,c2\n integer :: a\n integer :: i,j, l,r\n integer :: out\n read(*,*) N\n read(*,*) S\n read(*,*) Q\n allocate(data(97:122))\n data(:)%N = 0\n num(:) = 0\n do i = 1,N\n data(ichar(S(i:i)))%N = data(ichar(S(i:i)))%N+1\n end do\n do i = 97,122\n if (data(i)%N > 0) allocate(data(i)%point(0:data(i)%N-1))\n end do\n do i = 1,N\n data(ichar(S(i:i)))%point( num(ichar(S(i:i))) ) = i-1\n num(ichar(S(i:i))) = num(ichar(S(i:i))) + 1\n end do\n! do i = 97,97+4\n! write(*,*) data(i)%point\n! end do\n do i = 1, Q\n read(*,'(i1,1x,a,1x,a)') a,b,c\n if (a == 1) then\n backspace(5)\n !read(*,'(i1,1x,g0,1x,a)') a,j,c\n read(*,*) a,j,c\n if (Q> 10000) then\n c2 = S(j:j)\n call insert_delete(data,j-1,c,c2)\n end if\n S(j:j) = c\n else\n backspace(5)\n! read(*,'(i1,1x,g0,1x,g0)') a,l,r\n read(*,*) a,l,r\n !tmp = S(l:r)\n !call count_char(S(l:r),out)\n if (Q> 10000) then\n call count_char(data,l-1,r-1,out)\n else\n tmp = S(l:r)\n call count_char2(tmp,out)\n deallocate(tmp)\n end if\n write(*,'(i0)') out\n !deallocate(tmp)\n end if\n\n end do\ncontains\n subroutine insert_delete(data,key,c,c2)\n implicit none\n type(arr_list) :: data(97:122)\n integer :: key ! key\n character :: c,c2 ! char\n integer,allocatable :: tmp(:)\n integer :: i,i2\n integer :: j\n integer :: n\n\n i = ichar(c)\n i2 = ichar(c2)\n if ( i /= i2) then ! insert and delete\n if (data(i)%N > 0) then\n j = found_point(data(i)%point(:),data(i)%n, key)\n else\n data(i)%N=data(i)%N+1\n allocate(data(i)%point(0:data(i)%N-1))\n data(i)%point(0:0) = key\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n return\n end if\n if ( j == data(i)%N) then ! out bound\n n = data(i)%n\n allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i)%point(0:n-1)\n deallocate( data(i)%point )\n data(i)%n = data(i)%n + 1\n allocate( data(i)%point(0:data(i)%n-1) )\n data(i)%point(0:n-1) = tmp(0:n-1)\n data(i)%point(n) = key\n deallocate(tmp)\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n return\n else\n n = data(i)%n\n allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i)%point(0:n-1)\n deallocate( data(i)%point )\n data(i)%n = data(i)%n + 1\n allocate( data(i)%point(0:data(i)%n-1) )\n if ( j == 0 ) then\n data(i)%point(0:0) = key\n data(i)%point(j+1:) = tmp(0:n-1)\n else \n data(i)%point(0:j-1) = tmp(0:j-1)\n data(i)%point(j) = key\n data(i)%point(j+1:) = tmp(j:n-1)\n end if\n deallocate(tmp)\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n end if\n end if\n return\n end subroutine insert_delete\n\n function found_point(a,n,key) result(ok)\n integer :: n\n integer :: a(0:n-1)\n integer :: key\n integer :: ng \n integer :: ok\n integer :: mid\n ng = -1\n ok = n\n do while( abs(ok-ng) > 1) \n mid = (ok + ng)/2\n if (isOK(mid,key,a,n)) then\n ok = mid\n else\n ng = mid\n end if\n end do\n end function found_point\n\n \n function isOK (index, key,a,n) result(out)\n integer :: n\n integer :: a(0:n-1)\n integer :: index, key\n logical :: out\n if ( a(index) >= key) then\n out = .true.\n else \n out = .false.\n end if\n end function isOK\n subroutine count_char(data,l,r,out)\n type(arr_list) :: data(97:122)\n integer :: l,r\n integer :: out\n integer :: N\n integer :: i, j, tmp\n out = 0\n do i = 97,122\n if ( data(i)%n > 0) then\n j = found_point(data(i)%point(:),data(i)%n,l)\n if ( j < data(i)%N) then\n if ( l<=data(i)%point(j) .and. data(i)%point(j) <= r) then\n out = out + 1\n end if\n!! if ( j+1 < data(i)%N) then\n!! if ( l<=data(i)%point(j) .and. data(i)%point(j) <= r) then\n!! out = out + 1\n!! cycle\n!! end if\n!! if ( data(i)%point(j) < l .and. data(i)%point(j+1) <= r) then\n!! out = out + 1\n!! end if\n!! else\n!! end if\n end if\n end if\n end do\n end subroutine count_char\n \n subroutine count_char2(S,out)\n character(*) :: S\n integer :: out\n integer :: N\n integer :: i, tmp\n integer :: c(97:122)\n N = len_trim(S)\n c(97:122) = 0\n do i = 1,N\n tmp = ichar(S(i:i))\n c (tmp) = c(tmp) + 1\n end do\n out = count(c /=0)\n end subroutine count_char2\nend program main\n", "language": "Fortran", "metadata": {"date": 1583167613, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02763.html", "problem_id": "p02763", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02763/input.txt", "sample_output_relpath": "derived/input_output/data/p02763/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02763/Fortran/s788870934.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s788870934", "user_id": "u886432251"}, "prompt_components": {"gold_output": "3\n1\n5\n", "input_to_evaluate": "program main\n implicit none\n type arr_list\n integer :: N\n integer,allocatable :: point(:)\n end type arr_list\n type(arr_list),allocatable :: data(:)\n integer :: num(97:122)\n integer :: N, Q\n character(len=500000) :: S\n character(:),allocatable :: tmp\n character(len=1) :: c,b,c2\n integer :: a\n integer :: i,j, l,r\n integer :: out\n read(*,*) N\n read(*,*) S\n read(*,*) Q\n allocate(data(97:122))\n data(:)%N = 0\n num(:) = 0\n do i = 1,N\n data(ichar(S(i:i)))%N = data(ichar(S(i:i)))%N+1\n end do\n do i = 97,122\n if (data(i)%N > 0) allocate(data(i)%point(0:data(i)%N-1))\n end do\n do i = 1,N\n data(ichar(S(i:i)))%point( num(ichar(S(i:i))) ) = i-1\n num(ichar(S(i:i))) = num(ichar(S(i:i))) + 1\n end do\n! do i = 97,97+4\n! write(*,*) data(i)%point\n! end do\n do i = 1, Q\n read(*,'(i1,1x,a,1x,a)') a,b,c\n if (a == 1) then\n backspace(5)\n !read(*,'(i1,1x,g0,1x,a)') a,j,c\n read(*,*) a,j,c\n if (Q> 10000) then\n c2 = S(j:j)\n call insert_delete(data,j-1,c,c2)\n end if\n S(j:j) = c\n else\n backspace(5)\n! read(*,'(i1,1x,g0,1x,g0)') a,l,r\n read(*,*) a,l,r\n !tmp = S(l:r)\n !call count_char(S(l:r),out)\n if (Q> 10000) then\n call count_char(data,l-1,r-1,out)\n else\n tmp = S(l:r)\n call count_char2(tmp,out)\n deallocate(tmp)\n end if\n write(*,'(i0)') out\n !deallocate(tmp)\n end if\n\n end do\ncontains\n subroutine insert_delete(data,key,c,c2)\n implicit none\n type(arr_list) :: data(97:122)\n integer :: key ! key\n character :: c,c2 ! char\n integer,allocatable :: tmp(:)\n integer :: i,i2\n integer :: j\n integer :: n\n\n i = ichar(c)\n i2 = ichar(c2)\n if ( i /= i2) then ! insert and delete\n if (data(i)%N > 0) then\n j = found_point(data(i)%point(:),data(i)%n, key)\n else\n data(i)%N=data(i)%N+1\n allocate(data(i)%point(0:data(i)%N-1))\n data(i)%point(0:0) = key\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n return\n end if\n if ( j == data(i)%N) then ! out bound\n n = data(i)%n\n allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i)%point(0:n-1)\n deallocate( data(i)%point )\n data(i)%n = data(i)%n + 1\n allocate( data(i)%point(0:data(i)%n-1) )\n data(i)%point(0:n-1) = tmp(0:n-1)\n data(i)%point(n) = key\n deallocate(tmp)\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n return\n else\n n = data(i)%n\n allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i)%point(0:n-1)\n deallocate( data(i)%point )\n data(i)%n = data(i)%n + 1\n allocate( data(i)%point(0:data(i)%n-1) )\n if ( j == 0 ) then\n data(i)%point(0:0) = key\n data(i)%point(j+1:) = tmp(0:n-1)\n else \n data(i)%point(0:j-1) = tmp(0:j-1)\n data(i)%point(j) = key\n data(i)%point(j+1:) = tmp(j:n-1)\n end if\n deallocate(tmp)\n !\n ! delete\n !\n n = data(i2)%n\n data(i2)%n = data(i2)%n - 1\n if ( data(i2)%n > 0) then\n j = found_point(data(i2)%point(:),n, key)\n allocate(tmp(0:n-1))\n tmp(0:n-1) = data(i2)%point(0:n-1)\n deallocate( data(i2)%point )\n allocate( data(i2)%point(0:data(i2)%n-1) )\n data(i2)%point(0:j-1) = tmp(0:j-1)\n data(i2)%point(j:) = tmp(j+1:n-1)\n deallocate(tmp)\n else\n deallocate( data(i2)%point )\n end if\n end if\n end if\n return\n end subroutine insert_delete\n\n function found_point(a,n,key) result(ok)\n integer :: n\n integer :: a(0:n-1)\n integer :: key\n integer :: ng \n integer :: ok\n integer :: mid\n ng = -1\n ok = n\n do while( abs(ok-ng) > 1) \n mid = (ok + ng)/2\n if (isOK(mid,key,a,n)) then\n ok = mid\n else\n ng = mid\n end if\n end do\n end function found_point\n\n \n function isOK (index, key,a,n) result(out)\n integer :: n\n integer :: a(0:n-1)\n integer :: index, key\n logical :: out\n if ( a(index) >= key) then\n out = .true.\n else \n out = .false.\n end if\n end function isOK\n subroutine count_char(data,l,r,out)\n type(arr_list) :: data(97:122)\n integer :: l,r\n integer :: out\n integer :: N\n integer :: i, j, tmp\n out = 0\n do i = 97,122\n if ( data(i)%n > 0) then\n j = found_point(data(i)%point(:),data(i)%n,l)\n if ( j < data(i)%N) then\n if ( l<=data(i)%point(j) .and. data(i)%point(j) <= r) then\n out = out + 1\n end if\n!! if ( j+1 < data(i)%N) then\n!! if ( l<=data(i)%point(j) .and. data(i)%point(j) <= r) then\n!! out = out + 1\n!! cycle\n!! end if\n!! if ( data(i)%point(j) < l .and. data(i)%point(j+1) <= r) then\n!! out = out + 1\n!! end if\n!! else\n!! end if\n end if\n end if\n end do\n end subroutine count_char\n \n subroutine count_char2(S,out)\n character(*) :: S\n integer :: out\n integer :: N\n integer :: i, tmp\n integer :: c(97:122)\n N = len_trim(S)\n c(97:122) = 0\n do i = 1,N\n tmp = ichar(S(i:i))\n c (tmp) = c(tmp) + 1\n end do\n out = count(c /=0)\n end subroutine count_char2\nend program main\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\n\nProcess Q queries of the following two types:\n\nType 1: change the i_q-th character of S to c_q. (Do nothing if the i_q-th character is already c_q.)\n\nType 2: answer the number of different characters occurring in the substring of S between the l_q-th and r_q-th characters (inclusive).\n\nConstraints\n\nN, Q, i_q, l_q, and r_q are integers.\n\nS is a string consisting of lowercase English letters.\n\nc_q is a lowercase English letter.\n\n1 \\leq N \\leq 500000\n\n1 \\leq Q \\leq 20000\n\n|S| = N\n\n1 \\leq i_q \\leq N\n\n1 \\leq l_q \\leq r_q \\leq N\n\nThere is at least one query of type 2 in each testcase.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nQ\nQuery_1\n\\vdots\nQuery_Q\n\nHere, Query_i in the 4-th through (Q+3)-th lines is one of the following:\n\n1 i_q c_q\n\n2 l_q r_q\n\nOutput\n\nFor each query of type 2, print a line containing the answer.\n\nSample Input 1\n\n7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n\nSample Output 1\n\n3\n1\n5\n\nIn the first query, cdbb contains three kinds of letters: b , c , and d, so we print 3.\n\nIn the second query, S is modified to abcdzbd.\n\nIn the third query, a contains one kind of letter: a, so we print 1.\n\nIn the fourth query, S is modified to abcazbd.\n\nIn the fifth query, S does not change and is still abcazbd.\n\nIn the sixth query, abcazbd contains five kinds of letters: a, b, c, d, and z, so we print 5.", "sample_input": "7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n"}, "reference_outputs": ["3\n1\n5\n"], "source_document_id": "p02763", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\n\nProcess Q queries of the following two types:\n\nType 1: change the i_q-th character of S to c_q. (Do nothing if the i_q-th character is already c_q.)\n\nType 2: answer the number of different characters occurring in the substring of S between the l_q-th and r_q-th characters (inclusive).\n\nConstraints\n\nN, Q, i_q, l_q, and r_q are integers.\n\nS is a string consisting of lowercase English letters.\n\nc_q is a lowercase English letter.\n\n1 \\leq N \\leq 500000\n\n1 \\leq Q \\leq 20000\n\n|S| = N\n\n1 \\leq i_q \\leq N\n\n1 \\leq l_q \\leq r_q \\leq N\n\nThere is at least one query of type 2 in each testcase.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nQ\nQuery_1\n\\vdots\nQuery_Q\n\nHere, Query_i in the 4-th through (Q+3)-th lines is one of the following:\n\n1 i_q c_q\n\n2 l_q r_q\n\nOutput\n\nFor each query of type 2, print a line containing the answer.\n\nSample Input 1\n\n7\nabcdbbd\n6\n2 3 6\n1 5 z\n2 1 1\n1 4 a\n1 7 d\n2 1 7\n\nSample Output 1\n\n3\n1\n5\n\nIn the first query, cdbb contains three kinds of letters: b , c , and d, so we print 3.\n\nIn the second query, S is modified to abcdzbd.\n\nIn the third query, a contains one kind of letter: a, so we print 1.\n\nIn the fourth query, S is modified to abcazbd.\n\nIn the fifth query, S does not change and is still abcazbd.\n\nIn the sixth query, abcazbd contains five kinds of letters: a, b, c, d, and z, so we print 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6634, "cpu_time_ms": 2103, "memory_kb": 7104}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s608558542", "group_id": "codeNet:p02765", "input_text": "program ABC156_A\n integer::R\n read(5,*)N,R\n if(N<10) then\n write(6,*)R+100*(10-N)\n else\n write(6,*)R\n end if\nend program ABC156_A\n", "language": "Fortran", "metadata": {"date": 1586483674, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02765.html", "problem_id": "p02765", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02765/input.txt", "sample_output_relpath": "derived/input_output/data/p02765/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02765/Fortran/s608558542.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s608558542", "user_id": "u359178469"}, "prompt_components": {"gold_output": "3719\n", "input_to_evaluate": "program ABC156_A\n integer::R\n read(5,*)N,R\n if(N<10) then\n write(6,*)R+100*(10-N)\n else\n write(6,*)R\n end if\nend program ABC156_A\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a member of a programming competition site, ButCoder.\n\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\n\nThe Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or more contests. Otherwise, the Displayed Rating will be their Inner Rating minus 100 \\times (10 - K) when the member has participated in K contests.\n\nTakahashi has participated in N contests, and his Displayed Rating is R. Find his Inner Rating.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq R \\leq 4111\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN R\n\nOutput\n\nPrint his Inner Rating.\n\nSample Input 1\n\n2 2919\n\nSample Output 1\n\n3719\n\nTakahashi has participated in 2 contests, which is less than 10, so his Displayed Rating is his Inner Rating minus 100 \\times (10 - 2) = 800.\n\nThus, Takahashi's Inner Rating is 2919 + 800 = 3719.\n\nSample Input 2\n\n22 3051\n\nSample Output 2\n\n3051", "sample_input": "2 2919\n"}, "reference_outputs": ["3719\n"], "source_document_id": "p02765", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a member of a programming competition site, ButCoder.\n\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\n\nThe Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or more contests. Otherwise, the Displayed Rating will be their Inner Rating minus 100 \\times (10 - K) when the member has participated in K contests.\n\nTakahashi has participated in N contests, and his Displayed Rating is R. Find his Inner Rating.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq R \\leq 4111\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN R\n\nOutput\n\nPrint his Inner Rating.\n\nSample Input 1\n\n2 2919\n\nSample Output 1\n\n3719\n\nTakahashi has participated in 2 contests, which is less than 10, so his Displayed Rating is his Inner Rating minus 100 \\times (10 - 2) = 800.\n\nThus, Takahashi's Inner Rating is 2919 + 800 = 3719.\n\nSample Input 2\n\n22 3051\n\nSample Output 2\n\n3051", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s625953141", "group_id": "codeNet:p02765", "input_text": "program main\n integer :: n,r\n integer :: ro,rc\n read *,n,r\n ro=r\n if(n<10)then\n rc=ro+100*(10-n)\n! print *,ro,rc\n else\n rc=ro\n end if\n print '(i0)',rc\n stop\nend program main", "language": "Fortran", "metadata": {"date": 1584013822, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02765.html", "problem_id": "p02765", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02765/input.txt", "sample_output_relpath": "derived/input_output/data/p02765/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02765/Fortran/s625953141.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s625953141", "user_id": "u158583803"}, "prompt_components": {"gold_output": "3719\n", "input_to_evaluate": "program main\n integer :: n,r\n integer :: ro,rc\n read *,n,r\n ro=r\n if(n<10)then\n rc=ro+100*(10-n)\n! print *,ro,rc\n else\n rc=ro\n end if\n print '(i0)',rc\n stop\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a member of a programming competition site, ButCoder.\n\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\n\nThe Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or more contests. Otherwise, the Displayed Rating will be their Inner Rating minus 100 \\times (10 - K) when the member has participated in K contests.\n\nTakahashi has participated in N contests, and his Displayed Rating is R. Find his Inner Rating.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq R \\leq 4111\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN R\n\nOutput\n\nPrint his Inner Rating.\n\nSample Input 1\n\n2 2919\n\nSample Output 1\n\n3719\n\nTakahashi has participated in 2 contests, which is less than 10, so his Displayed Rating is his Inner Rating minus 100 \\times (10 - 2) = 800.\n\nThus, Takahashi's Inner Rating is 2919 + 800 = 3719.\n\nSample Input 2\n\n22 3051\n\nSample Output 2\n\n3051", "sample_input": "2 2919\n"}, "reference_outputs": ["3719\n"], "source_document_id": "p02765", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a member of a programming competition site, ButCoder.\n\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\n\nThe Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or more contests. Otherwise, the Displayed Rating will be their Inner Rating minus 100 \\times (10 - K) when the member has participated in K contests.\n\nTakahashi has participated in N contests, and his Displayed Rating is R. Find his Inner Rating.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq R \\leq 4111\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN R\n\nOutput\n\nPrint his Inner Rating.\n\nSample Input 1\n\n2 2919\n\nSample Output 1\n\n3719\n\nTakahashi has participated in 2 contests, which is less than 10, so his Displayed Rating is his Inner Rating minus 100 \\times (10 - 2) = 800.\n\nThus, Takahashi's Inner Rating is 2919 + 800 = 3719.\n\nSample Input 2\n\n22 3051\n\nSample Output 2\n\n3051", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 221, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s798046211", "group_id": "codeNet:p02765", "input_text": "program test\nimplicit none\ninteger::N, R\nread*, N, R\n\tif(N>=10)then \n \tprint*,R\n else\n \tprint*,R+100*(10-N)\n end if\nend program test", "language": "Fortran", "metadata": {"date": 1582477236, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02765.html", "problem_id": "p02765", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02765/input.txt", "sample_output_relpath": "derived/input_output/data/p02765/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02765/Fortran/s798046211.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s798046211", "user_id": "u723571904"}, "prompt_components": {"gold_output": "3719\n", "input_to_evaluate": "program test\nimplicit none\ninteger::N, R\nread*, N, R\n\tif(N>=10)then \n \tprint*,R\n else\n \tprint*,R+100*(10-N)\n end if\nend program test", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a member of a programming competition site, ButCoder.\n\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\n\nThe Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or more contests. Otherwise, the Displayed Rating will be their Inner Rating minus 100 \\times (10 - K) when the member has participated in K contests.\n\nTakahashi has participated in N contests, and his Displayed Rating is R. Find his Inner Rating.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq R \\leq 4111\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN R\n\nOutput\n\nPrint his Inner Rating.\n\nSample Input 1\n\n2 2919\n\nSample Output 1\n\n3719\n\nTakahashi has participated in 2 contests, which is less than 10, so his Displayed Rating is his Inner Rating minus 100 \\times (10 - 2) = 800.\n\nThus, Takahashi's Inner Rating is 2919 + 800 = 3719.\n\nSample Input 2\n\n22 3051\n\nSample Output 2\n\n3051", "sample_input": "2 2919\n"}, "reference_outputs": ["3719\n"], "source_document_id": "p02765", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a member of a programming competition site, ButCoder.\n\nEach member of ButCoder is assigned two values: Inner Rating and Displayed Rating.\n\nThe Displayed Rating of a member is equal to their Inner Rating if the member has participated in 10 or more contests. Otherwise, the Displayed Rating will be their Inner Rating minus 100 \\times (10 - K) when the member has participated in K contests.\n\nTakahashi has participated in N contests, and his Displayed Rating is R. Find his Inner Rating.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq R \\leq 4111\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN R\n\nOutput\n\nPrint his Inner Rating.\n\nSample Input 1\n\n2 2919\n\nSample Output 1\n\n3719\n\nTakahashi has participated in 2 contests, which is less than 10, so his Displayed Rating is his Inner Rating minus 100 \\times (10 - 2) = 800.\n\nThus, Takahashi's Inner Rating is 2919 + 800 = 3719.\n\nSample Input 2\n\n22 3051\n\nSample Output 2\n\n3051", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 144, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s436949896", "group_id": "codeNet:p02766", "input_text": "program ABC156_B\n read(5,*)N,K\n M=1\n do while(N>=K)\n N=N/K\n M=M+1\n end do\n write(6,*)M\nend program ABC156_B", "language": "Fortran", "metadata": {"date": 1586484389, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02766.html", "problem_id": "p02766", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02766/input.txt", "sample_output_relpath": "derived/input_output/data/p02766/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02766/Fortran/s436949896.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s436949896", "user_id": "u359178469"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program ABC156_B\n read(5,*)N,K\n M=1\n do while(N>=K)\n N=N/K\n M=M+1\n end do\n write(6,*)M\nend program ABC156_B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\nNotes\n\nFor information on base-K representation, see Positional notation - Wikipedia.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^9\n\n2 \\leq K \\leq 10\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of digits that N has in base K.\n\nSample Input 1\n\n11 2\n\nSample Output 1\n\n4\n\nIn binary, 11 is represented as 1011.\n\nSample Input 2\n\n1010101 10\n\nSample Output 2\n\n7\n\nSample Input 3\n\n314159265 3\n\nSample Output 3\n\n18", "sample_input": "11 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02766", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\nNotes\n\nFor information on base-K representation, see Positional notation - Wikipedia.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^9\n\n2 \\leq K \\leq 10\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of digits that N has in base K.\n\nSample Input 1\n\n11 2\n\nSample Output 1\n\n4\n\nIn binary, 11 is represented as 1011.\n\nSample Input 2\n\n1010101 10\n\nSample Output 2\n\n7\n\nSample Input 3\n\n314159265 3\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 120, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s010962636", "group_id": "codeNet:p02766", "input_text": "program main\n implicit none\n integer N, K\n integer Nk\n integer keta\n integer i\n\n read *,N, K\n \n keta=0\n Nk=N\n do i=1,1000000000\n Nk=Nk/K\n keta =keta+1\n if (Nk0)then\n Check:Do \n digit = digit + 1\n N = N - M \n If (N <= 0) then\n Exit Check\n Elseif (N == 0) then\n digit = digit + 1\n Exit Check\n Endif\n M = M*K\n Enddo Check\n Endif\n\n Write(*,\"(I0)\") digit\n\n End Program\n", "language": "Fortran", "metadata": {"date": 1582427257, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02766.html", "problem_id": "p02766", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02766/input.txt", "sample_output_relpath": "derived/input_output/data/p02766/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02766/Fortran/s350189473.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s350189473", "user_id": "u718634931"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": " Program Main\n\n Implicit None\n Integer(8) :: N,K,M,digit\n\n N = 0\n K = 0\n digit = 1\n Read(*,*) N,K\n M = K\n N = N - M\n If (N == 0) digit = digit + 1 \n M = M*(K-1)\n If (N>0)then\n Check:Do \n digit = digit + 1\n N = N - M \n If (N <= 0) then\n Exit Check\n Elseif (N == 0) then\n digit = digit + 1\n Exit Check\n Endif\n M = M*K\n Enddo Check\n Endif\n\n Write(*,\"(I0)\") digit\n\n End Program\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\nNotes\n\nFor information on base-K representation, see Positional notation - Wikipedia.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^9\n\n2 \\leq K \\leq 10\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of digits that N has in base K.\n\nSample Input 1\n\n11 2\n\nSample Output 1\n\n4\n\nIn binary, 11 is represented as 1011.\n\nSample Input 2\n\n1010101 10\n\nSample Output 2\n\n7\n\nSample Input 3\n\n314159265 3\n\nSample Output 3\n\n18", "sample_input": "11 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02766", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\nNotes\n\nFor information on base-K representation, see Positional notation - Wikipedia.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^9\n\n2 \\leq K \\leq 10\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of digits that N has in base K.\n\nSample Input 1\n\n11 2\n\nSample Output 1\n\n4\n\nIn binary, 11 is represented as 1011.\n\nSample Input 2\n\n1010101 10\n\nSample Output 2\n\n7\n\nSample Input 3\n\n314159265 3\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 590, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s073603936", "group_id": "codeNet:p02766", "input_text": "program main\n implicit none\n integer(8) :: N, K\n integer(8):: digit\n\n read(*,*) N,K\n digit = 0\n do while( N > 0 )\n N = N/K\n digit = digit + 1\n end do\n write(*,'(i0)') digit\n stop\nend program main\n", "language": "Fortran", "metadata": {"date": 1582423444, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02766.html", "problem_id": "p02766", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02766/input.txt", "sample_output_relpath": "derived/input_output/data/p02766/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02766/Fortran/s073603936.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s073603936", "user_id": "u886432251"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: N, K\n integer(8):: digit\n\n read(*,*) N,K\n digit = 0\n do while( N > 0 )\n N = N/K\n digit = digit + 1\n end do\n write(*,'(i0)') digit\n stop\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\nNotes\n\nFor information on base-K representation, see Positional notation - Wikipedia.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^9\n\n2 \\leq K \\leq 10\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of digits that N has in base K.\n\nSample Input 1\n\n11 2\n\nSample Output 1\n\n4\n\nIn binary, 11 is represented as 1011.\n\nSample Input 2\n\n1010101 10\n\nSample Output 2\n\n7\n\nSample Input 3\n\n314159265 3\n\nSample Output 3\n\n18", "sample_input": "11 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02766", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of digits that N has in base K.\n\nNotes\n\nFor information on base-K representation, see Positional notation - Wikipedia.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^9\n\n2 \\leq K \\leq 10\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of digits that N has in base K.\n\nSample Input 1\n\n11 2\n\nSample Output 1\n\n4\n\nIn binary, 11 is represented as 1011.\n\nSample Input 2\n\n1010101 10\n\nSample Output 2\n\n7\n\nSample Input 3\n\n314159265 3\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 213, "cpu_time_ms": 5, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s919442132", "group_id": "codeNet:p02767", "input_text": "program rally\n implicit none\n integer n, i\n integer :: ansgt = 0, anslt = 0, ans = 0, sum = 0\n integer :: avelt = 0, avegt = 0, ave = 0, amari = 0\n integer,allocatable :: x(:)\n read *, n\n allocate(x(n))\n read *, x(:n)\n do i = 1, n\n sum = sum + x(i)\n end do\n amari = mod(sum, n)\n if(amari == 0)then\n ave = sum / n\n do i = 1, n\n ans = ans + (x(i) - ave)**2\n end do\n print *, ans\n else\n ave = sum / n\n avegt = ave + 1\n avelt = ave\n do i = 1, n\n ansgt = ansgt + (x(i) - avegt)**2\n anslt = anslt + (x(i) - avelt)**2\n end do\n if(ansgt < anslt)then\n print *, ansgt\n else\n print *, anslt\n end if\n end if\nend program", "language": "Fortran", "metadata": {"date": 1598476010, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02767.html", "problem_id": "p02767", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02767/input.txt", "sample_output_relpath": "derived/input_output/data/p02767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02767/Fortran/s919442132.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s919442132", "user_id": "u622206408"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program rally\n implicit none\n integer n, i\n integer :: ansgt = 0, anslt = 0, ans = 0, sum = 0\n integer :: avelt = 0, avegt = 0, ave = 0, amari = 0\n integer,allocatable :: x(:)\n read *, n\n allocate(x(n))\n read *, x(:n)\n do i = 1, n\n sum = sum + x(i)\n end do\n amari = mod(sum, n)\n if(amari == 0)then\n ave = sum / n\n do i = 1, n\n ans = ans + (x(i) - ave)**2\n end do\n print *, ans\n else\n ave = sum / n\n avegt = ave + 1\n avelt = ave\n do i = 1, n\n ansgt = ansgt + (x(i) - avegt)**2\n anslt = anslt + (x(i) - avelt)**2\n end do\n if(ansgt < anslt)then\n print *, ansgt\n else\n print *, anslt\n end if\n end if\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "sample_input": "2\n1 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 795, "cpu_time_ms": 7, "memory_kb": 2836}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s472028873", "group_id": "codeNet:p02767", "input_text": "program rally\n implicit none\n integer n, i\n integer :: ans = 0, ave = 0, amari = 0\n integer,allocatable :: x(:)\n read *, n\n allocate(x(n))\n read *, x(:n)\n do i = 1, n\n ave = ave + x(i)\n end do\n amari = mod(ave, n)\n if(amari .eq. 0)then\n ave = ave / n\n else\n ave = ave / n + 1\n end if\n do i = 1, n\n ans = ans + (x(i) - ave)**2\n end do\n print *, ans\nend program", "language": "Fortran", "metadata": {"date": 1598472807, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02767.html", "problem_id": "p02767", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02767/input.txt", "sample_output_relpath": "derived/input_output/data/p02767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02767/Fortran/s472028873.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s472028873", "user_id": "u622206408"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program rally\n implicit none\n integer n, i\n integer :: ans = 0, ave = 0, amari = 0\n integer,allocatable :: x(:)\n read *, n\n allocate(x(n))\n read *, x(:n)\n do i = 1, n\n ave = ave + x(i)\n end do\n amari = mod(ave, n)\n if(amari .eq. 0)then\n ave = ave / n\n else\n ave = ave / n + 1\n end if\n do i = 1, n\n ans = ans + (x(i) - ave)**2\n end do\n print *, ans\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "sample_input": "2\n1 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 435, "cpu_time_ms": 10, "memory_kb": 2832}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s771697948", "group_id": "codeNet:p02767", "input_text": "program rally\n implicit none\n integer :: n, x(100) = 0, i, p\n read(*,*) n\n read(*,*) x(1:n)\n p = sum(x(1:n))/n\n write(*,'(i0)') min(sum((x(1:n)-p)*(x(1:n)-p)),sum((x(1:n)-p-1)*(x(1:n)-p-1)))\nend program rally", "language": "Fortran", "metadata": {"date": 1590654545, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02767.html", "problem_id": "p02767", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02767/input.txt", "sample_output_relpath": "derived/input_output/data/p02767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02767/Fortran/s771697948.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s771697948", "user_id": "u506403362"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program rally\n implicit none\n integer :: n, x(100) = 0, i, p\n read(*,*) n\n read(*,*) x(1:n)\n p = sum(x(1:n))/n\n write(*,'(i0)') min(sum((x(1:n)-p)*(x(1:n)-p)),sum((x(1:n)-p-1)*(x(1:n)-p-1)))\nend program rally", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "sample_input": "2\n1 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people living on a number line.\n\nThe i-th person lives at coordinate X_i.\n\nYou are going to hold a meeting that all N people have to attend.\n\nThe meeting can be held at any integer coordinate. If you choose to hold the meeting at coordinate P, the i-th person will spend (X_i - P)^2 points of stamina to attend the meeting.\n\nFind the minimum total points of stamina the N people have to spend.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq X_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 X_2 ... X_N\n\nOutput\n\nPrint the minimum total stamina the N people have to spend.\n\nSample Input 1\n\n2\n1 4\n\nSample Output 1\n\n5\n\nAssume the meeting is held at coordinate 2. In this case, the first person will spend (1 - 2)^2 points of stamina, and the second person will spend (4 - 2)^2 = 4 points of stamina, for a total of 5 points of stamina. This is the minimum total stamina that the 2 people have to spend.\n\nNote that you can hold the meeting only at an integer coordinate.\n\nSample Input 2\n\n7\n14 14 2 13 56 2 37\n\nSample Output 2\n\n2354", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 214, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s490845688", "group_id": "codeNet:p02768", "input_text": "module Factwithmod\n implicit none\n integer(16),allocatable,dimension(:)::Kaijo,comb\n contains\nsubroutine initiationFactorial(maxnum,mo)\n implicit none\n integer(16)::maxnum\n integer(16)::mo\n integer(16)::i\n\n allocate(Kaijo(0:maxnum))\n Kaijo(0)=1\n do i=1,maxnum\n Kaijo(i)=mod(Kaijo(i-1)*i,mo)\n end do\nend subroutine\n\nsubroutine combination(n,maxnum,l)\nimplicit none\ninteger(16),intent(in)::n,maxnum,l\ninteger(16)::i\nallocate(comb(maxnum))\ncomb(1)=N\ndo i=2,maxnum\n comb(i)=comb(i-1)*(N-i+1)*inv(i,l)\n comb(i)=mod(comb(i),l)\nend do\nend subroutine\n\nfunction inv(K,L)\ninteger(16),intent(in)::k,l\ninteger(16) l2,y\ninteger(16) inv\ninv=1\nl2=l-2\ny=k\ndo\n if(mod(l2,2)==1)inv=mod(inv*y,l)\n y=mod(y*y,l)\n l2=l2/2\n if(l2==0)exit\nend do\nend function\n\nfunction permutation(n,k,mo)\nimplicit none\n integer(16)::n,k\n integer(16)::mo,permutation\n permutation=mod(Kaijo(N)*inv(Kaijo(N-K),mo),mo)\nend function\nend module Factwithmod\nprogram ABC156b\n use Factwithmod\n implicit none\n integer(16)::N\n integer(16)::a,b\n integer(16)::mo=10**9+7\n integer(16)::allc\n integer(16)::ans\n read*,N,a,b\n call initiationFactorial(N,mo)\n call combination(N,b,mo)\n allc=power_func(2_16,N,mo)-1_16\n ans=allc-comb(a)-comb(b)\n ans=mod(ans,mo)\n if(ans<0)ans=ans+mo\n print\"(i0)\",ans\ncontains\ninteger(16) function power_func(a,n,mo)\n integer(16)::a,n,mo\n integer(16)::l2,y\n power_func=1\n l2=N\n y=a\n do\n if(mod(l2,2)==1)power_func=mod(power_func*y,mo)\n y=mod(y*y,mo)\n l2=l2/2\n if(l2==0)exit\n end do\nend function power_func\nend program ABC156b", "language": "Fortran", "metadata": {"date": 1582406035, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02768.html", "problem_id": "p02768", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02768/input.txt", "sample_output_relpath": "derived/input_output/data/p02768/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02768/Fortran/s490845688.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s490845688", "user_id": "u598073939"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "module Factwithmod\n implicit none\n integer(16),allocatable,dimension(:)::Kaijo,comb\n contains\nsubroutine initiationFactorial(maxnum,mo)\n implicit none\n integer(16)::maxnum\n integer(16)::mo\n integer(16)::i\n\n allocate(Kaijo(0:maxnum))\n Kaijo(0)=1\n do i=1,maxnum\n Kaijo(i)=mod(Kaijo(i-1)*i,mo)\n end do\nend subroutine\n\nsubroutine combination(n,maxnum,l)\nimplicit none\ninteger(16),intent(in)::n,maxnum,l\ninteger(16)::i\nallocate(comb(maxnum))\ncomb(1)=N\ndo i=2,maxnum\n comb(i)=comb(i-1)*(N-i+1)*inv(i,l)\n comb(i)=mod(comb(i),l)\nend do\nend subroutine\n\nfunction inv(K,L)\ninteger(16),intent(in)::k,l\ninteger(16) l2,y\ninteger(16) inv\ninv=1\nl2=l-2\ny=k\ndo\n if(mod(l2,2)==1)inv=mod(inv*y,l)\n y=mod(y*y,l)\n l2=l2/2\n if(l2==0)exit\nend do\nend function\n\nfunction permutation(n,k,mo)\nimplicit none\n integer(16)::n,k\n integer(16)::mo,permutation\n permutation=mod(Kaijo(N)*inv(Kaijo(N-K),mo),mo)\nend function\nend module Factwithmod\nprogram ABC156b\n use Factwithmod\n implicit none\n integer(16)::N\n integer(16)::a,b\n integer(16)::mo=10**9+7\n integer(16)::allc\n integer(16)::ans\n read*,N,a,b\n call initiationFactorial(N,mo)\n call combination(N,b,mo)\n allc=power_func(2_16,N,mo)-1_16\n ans=allc-comb(a)-comb(b)\n ans=mod(ans,mo)\n if(ans<0)ans=ans+mo\n print\"(i0)\",ans\ncontains\ninteger(16) function power_func(a,n,mo)\n integer(16)::a,n,mo\n integer(16)::l2,y\n power_func=1\n l2=N\n y=a\n do\n if(mod(l2,2)==1)power_func=mod(power_func*y,mo)\n y=mod(y*y,mo)\n l2=l2/2\n if(l2==0)exit\n end do\nend function power_func\nend program ABC156b", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAkari has n kinds of flowers, one of each kind.\n\nShe is going to choose one or more of these flowers to make a bouquet.\n\nHowever, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b.\n\nHow many different bouquets are there that Akari can make?\n\nFind the count modulo (10^9 + 7).\n\nHere, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq n \\leq 10^9\n\n1 \\leq a < b \\leq \\textrm{min}(n, 2 \\times 10^5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn a b\n\nOutput\n\nPrint the number of bouquets that Akari can make, modulo (10^9 + 7). (If there are no such bouquets, print 0.)\n\nSample Input 1\n\n4 1 3\n\nSample Output 1\n\n7\n\nIn this case, Akari can choose 2 or 4 flowers to make the bouquet.\n\nThere are 6 ways to choose 2 out of the 4 flowers, and 1 way to choose 4, so there are a total of 7 different bouquets that Akari can make.\n\nSample Input 2\n\n1000000000 141421 173205\n\nSample Output 2\n\n34076506\n\nPrint the count modulo (10^9 + 7).", "sample_input": "4 1 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02768", "source_text": "Score : 400 points\n\nProblem Statement\n\nAkari has n kinds of flowers, one of each kind.\n\nShe is going to choose one or more of these flowers to make a bouquet.\n\nHowever, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b.\n\nHow many different bouquets are there that Akari can make?\n\nFind the count modulo (10^9 + 7).\n\nHere, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq n \\leq 10^9\n\n1 \\leq a < b \\leq \\textrm{min}(n, 2 \\times 10^5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn a b\n\nOutput\n\nPrint the number of bouquets that Akari can make, modulo (10^9 + 7). (If there are no such bouquets, print 0.)\n\nSample Input 1\n\n4 1 3\n\nSample Output 1\n\n7\n\nIn this case, Akari can choose 2 or 4 flowers to make the bouquet.\n\nThere are 6 ways to choose 2 out of the 4 flowers, and 1 way to choose 4, so there are a total of 7 different bouquets that Akari can make.\n\nSample Input 2\n\n1000000000 141421 173205\n\nSample Output 2\n\n34076506\n\nPrint the count modulo (10^9 + 7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1618, "cpu_time_ms": 2108, "memory_kb": 1588224}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s545809635", "group_id": "codeNet:p02770", "input_text": "program modularness\n implicit none\n integer :: k, q, d(0:5000) = 0, n, x, m, a, p, i, j\n read(*,*) k, q\n read(*,*) d(0:k - 1)\n do i = 1, q\n read(*,*) n, x, m\n p = 0\n x = mod(x, m)\n do j = 1, n - 1\n a = mod(x + d(mod(j - 1, k)), m)\n if (x < a) p = p + 1\n x = a\n end do\n write(*,'(i0)') p\n end do\nend program modularness", "language": "Fortran", "metadata": {"date": 1596070141, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02770.html", "problem_id": "p02770", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02770/input.txt", "sample_output_relpath": "derived/input_output/data/p02770/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02770/Fortran/s545809635.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s545809635", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program modularness\n implicit none\n integer :: k, q, d(0:5000) = 0, n, x, m, a, p, i, j\n read(*,*) k, q\n read(*,*) d(0:k - 1)\n do i = 1, q\n read(*,*) n, x, m\n p = 0\n x = mod(x, m)\n do j = 1, n - 1\n a = mod(x + d(mod(j - 1, k)), m)\n if (x < a) p = p + 1\n x = a\n end do\n write(*,'(i0)') p\n end do\nend program modularness", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a sequence of k numbers: d_0,d_1,...,d_{k - 1}.\n\nProcess the following q queries in order:\n\nThe i-th query contains three integers n_i, x_i, and m_i.\nLet a_0,a_1,...,a_{n_i - 1} be the following sequence of n_i numbers: \\begin{eqnarray} a_j = \\begin{cases} x_i & ( j = 0 ) \\\\ a_{j - 1} + d_{(j - 1)~\\textrm{mod}~k} & ( 0 < j \\leq n_i - 1 ) \\end{cases}\\end{eqnarray}\nPrint the number of j~(0 \\leq j < n_i - 1) such that (a_j~\\textrm{mod}~m_i) < (a_{j + 1}~\\textrm{mod}~m_i).\n\nHere (y~\\textrm{mod}~z) denotes the remainder of y divided by z, for two integers y and z~(z > 0).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq k, q \\leq 5000\n\n0 \\leq d_i \\leq 10^9\n\n2 \\leq n_i \\leq 10^9\n\n0 \\leq x_i \\leq 10^9\n\n2 \\leq m_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nk q\nd_0 d_1 ... d_{k - 1}\nn_1 x_1 m_1\nn_2 x_2 m_2\n:\nn_q x_q m_q\n\nOutput\n\nPrint q lines.\n\nThe i-th line should contain the response to the i-th query.\n\nSample Input 1\n\n3 1\n3 1 4\n5 3 2\n\nSample Output 1\n\n1\n\nFor the first query, the sequence {a_j} will be 3,6,7,11,14.\n\n(a_0~\\textrm{mod}~2) > (a_1~\\textrm{mod}~2)\n\n(a_1~\\textrm{mod}~2) < (a_2~\\textrm{mod}~2)\n\n(a_2~\\textrm{mod}~2) = (a_3~\\textrm{mod}~2)\n\n(a_3~\\textrm{mod}~2) > (a_4~\\textrm{mod}~2)\n\nThus, the response to this query should be 1.\n\nSample Input 2\n\n7 3\n27 18 28 18 28 46 1000000000\n1000000000 1 7\n1000000000 2 10\n1000000000 3 12\n\nSample Output 2\n\n224489796\n214285714\n559523809", "sample_input": "3 1\n3 1 4\n5 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02770", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a sequence of k numbers: d_0,d_1,...,d_{k - 1}.\n\nProcess the following q queries in order:\n\nThe i-th query contains three integers n_i, x_i, and m_i.\nLet a_0,a_1,...,a_{n_i - 1} be the following sequence of n_i numbers: \\begin{eqnarray} a_j = \\begin{cases} x_i & ( j = 0 ) \\\\ a_{j - 1} + d_{(j - 1)~\\textrm{mod}~k} & ( 0 < j \\leq n_i - 1 ) \\end{cases}\\end{eqnarray}\nPrint the number of j~(0 \\leq j < n_i - 1) such that (a_j~\\textrm{mod}~m_i) < (a_{j + 1}~\\textrm{mod}~m_i).\n\nHere (y~\\textrm{mod}~z) denotes the remainder of y divided by z, for two integers y and z~(z > 0).\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq k, q \\leq 5000\n\n0 \\leq d_i \\leq 10^9\n\n2 \\leq n_i \\leq 10^9\n\n0 \\leq x_i \\leq 10^9\n\n2 \\leq m_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nk q\nd_0 d_1 ... d_{k - 1}\nn_1 x_1 m_1\nn_2 x_2 m_2\n:\nn_q x_q m_q\n\nOutput\n\nPrint q lines.\n\nThe i-th line should contain the response to the i-th query.\n\nSample Input 1\n\n3 1\n3 1 4\n5 3 2\n\nSample Output 1\n\n1\n\nFor the first query, the sequence {a_j} will be 3,6,7,11,14.\n\n(a_0~\\textrm{mod}~2) > (a_1~\\textrm{mod}~2)\n\n(a_1~\\textrm{mod}~2) < (a_2~\\textrm{mod}~2)\n\n(a_2~\\textrm{mod}~2) = (a_3~\\textrm{mod}~2)\n\n(a_3~\\textrm{mod}~2) > (a_4~\\textrm{mod}~2)\n\nThus, the response to this query should be 1.\n\nSample Input 2\n\n7 3\n27 18 28 18 28 46 1000000000\n1000000000 1 7\n1000000000 2 10\n1000000000 3 12\n\nSample Output 2\n\n224489796\n214285714\n559523809", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 357, "cpu_time_ms": 2205, "memory_kb": 2964}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s046806113", "group_id": "codeNet:p02771", "input_text": "program sample\n\timplicit none\n integer :: A,B,C\n \n read(*,*) A,B,C\n \n if (A==B .or. A==C .or. B==C) then\n \tif (A==B .and. B==C) then\n \t\twrite(*,*) 'No'\n else\n \twrite(*,*) 'Yes'\n end if\n else \n \twrite(*,*) 'No'\n end if\n \n stop\nend program sample\n", "language": "Fortran", "metadata": {"date": 1592605833, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02771.html", "problem_id": "p02771", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02771/input.txt", "sample_output_relpath": "derived/input_output/data/p02771/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02771/Fortran/s046806113.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s046806113", "user_id": "u323210830"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program sample\n\timplicit none\n integer :: A,B,C\n \n read(*,*) A,B,C\n \n if (A==B .or. A==C .or. B==C) then\n \tif (A==B .and. B==C) then\n \t\twrite(*,*) 'No'\n else\n \twrite(*,*) 'Yes'\n end if\n else \n \twrite(*,*) 'No'\n end if\n \n stop\nend program sample\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "sample_input": "5 7 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02771", "source_text": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 302, "cpu_time_ms": 5, "memory_kb": 2860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s899771918", "group_id": "codeNet:p02771", "input_text": "program prob5\n implicit none\n integer :: a,b,c\n read(*,*) a,b,c\n\n if(a == b .and. b /= c) then\n write(*,*) \"Yes\"\n stop\n end if\n if(a == c .and. b /= c) then\n write(*,*) \"Yes\"\n stop\n end if\n if(c == b .and. a /= c) then\n write(*,*) \"Yes\"\n stop\n end if\n write(*,*) \"No\"\n\n stop\ncontains\nend program prob5", "language": "Fortran", "metadata": {"date": 1592604196, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02771.html", "problem_id": "p02771", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02771/input.txt", "sample_output_relpath": "derived/input_output/data/p02771/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02771/Fortran/s899771918.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s899771918", "user_id": "u478462004"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program prob5\n implicit none\n integer :: a,b,c\n read(*,*) a,b,c\n\n if(a == b .and. b /= c) then\n write(*,*) \"Yes\"\n stop\n end if\n if(a == c .and. b /= c) then\n write(*,*) \"Yes\"\n stop\n end if\n if(c == b .and. a /= c) then\n write(*,*) \"Yes\"\n stop\n end if\n write(*,*) \"No\"\n\n stop\ncontains\nend program prob5", "problem_context": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "sample_input": "5 7 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02771", "source_text": "Score: 100 points\n\nProblem Statement\n\nA triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.\n\nYou will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.\n\nConstraints\n\nA, B, and C are all integers between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the given triple is poor, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\nYes\n\nA and C are equal, but B is different from those two numbers, so this triple is poor.\n\nSample Input 2\n\n4 4 4\n\nSample Output 2\n\nNo\n\nA, B, and C are all equal, so this triple is not poor.\n\nSample Input 3\n\n4 9 6\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3 3 4\n\nSample Output 4\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 376, "cpu_time_ms": 6, "memory_kb": 2792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s864027121", "group_id": "codeNet:p02773", "input_text": "program poll\n implicit none\n integer :: n, i, a(200000) = 0, m\n character(10) :: s(200000)\n read(*,*) n\n do i = 1, n\n read(*,*) s(i)\n end do\n call quick_sort(s(1:n))\n a(1) = 1\n do i = 2, n\n if (s(i) == s(i-1)) then\n a(i) = a(i-1)+1\n else\n a(i) = 1\n end if\n end do\n m = maxval(a(1:n))\n do i = 1, n\n if (a(i) == m) write(*,'(a)') trim(s(i))\n end do\ncontains\n subroutine swap(a,b)\n character(10), intent(inout) :: a, b\n character(10) :: c\n c = a\n a = b\n b = c\n end\n recursive subroutine quick_sort(a)\n character(10), intent(inout) :: a(:)\n integer :: n, l, r\n character(10) :: p\n n = size(a)\n l = 1\n r = n\n p = a((n+1)/2)\n do\n do while (a(l) < p)\n l = l+1\n end do\n do while (a(r) > p)\n r = r-1\n end do\n if (l >= r) exit\n call swap(a(l),a(r))\n l = l+1\n r = r-1\n end do\n if (l-1 > 1) call quick_sort(a(1:l-1))\n if (n > r+1) call quick_sort(a(r+1:n))\n end\nend program poll", "language": "Fortran", "metadata": {"date": 1590711375, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Fortran/s864027121.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s864027121", "user_id": "u506403362"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "program poll\n implicit none\n integer :: n, i, a(200000) = 0, m\n character(10) :: s(200000)\n read(*,*) n\n do i = 1, n\n read(*,*) s(i)\n end do\n call quick_sort(s(1:n))\n a(1) = 1\n do i = 2, n\n if (s(i) == s(i-1)) then\n a(i) = a(i-1)+1\n else\n a(i) = 1\n end if\n end do\n m = maxval(a(1:n))\n do i = 1, n\n if (a(i) == m) write(*,'(a)') trim(s(i))\n end do\ncontains\n subroutine swap(a,b)\n character(10), intent(inout) :: a, b\n character(10) :: c\n c = a\n a = b\n b = c\n end\n recursive subroutine quick_sort(a)\n character(10), intent(inout) :: a(:)\n integer :: n, l, r\n character(10) :: p\n n = size(a)\n l = 1\n r = n\n p = a((n+1)/2)\n do\n do while (a(l) < p)\n l = l+1\n end do\n do while (a(r) > p)\n r = r-1\n end do\n if (l >= r) exit\n call swap(a(l),a(r))\n l = l+1\n r = r-1\n end do\n if (l-1 > 1) call quick_sort(a(1:l-1))\n if (n > r+1) call quick_sort(a(r+1:n))\n end\nend program poll", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1010, "cpu_time_ms": 205, "memory_kb": 4736}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s246272928", "group_id": "codeNet:p02773", "input_text": "program main\n implicit none\n integer :: n, i, cnt, maxs\n character(10), allocatable :: s(:)\n\n read *, n\n allocate( s(n) )\n do i = 1, n\n read *, s(i)\n end do\n\n call quicksort1( s, 1, n )\n\n cnt = 0\n maxs = 1\n do i = 1, n\n if ( s(i) == s(i+1) ) then\n cnt = cnt + 1\n else\n if ( maxs <= cnt ) then\n maxs = cnt\n end if \n cnt = 0\n end if\n end do\n\n cnt = 0\n do i = 1, n\n if ( maxs == 1 ) then\n print *, s(i)\n else\n if ( s(i) == s(i+1) ) then\n cnt = cnt + 1\n else\n if ( maxs == cnt ) then\n print *, s(i)\n end if \n cnt = 0\n end if\n end if\n end do\n\nend program main\nrecursive subroutine quicksort1( namec, first, last )\n\n implicit none\n character(10), intent(inout) :: namec(*)\n integer,intent(in)::first,last\n !\n ! Original\n ! https://gist.github.com/t-nissie/479f0f16966925fa29ea\n !\n character(100)::x,t\n integer::i,j\n\n x = namec((first+last)/2)\n i = first\n j = last\n do\n do while ( LGT( x, namec(i) ) )\n i=i+1\n end do\n do while ( LGT( namec(j), x ) )\n j=j-1\n end do\n if (i >= j) exit\n t = namec(i)\n namec(i) = namec(j)\n namec(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i-1) call quicksort1( namec, first, i-1 )\n if (j+1 < last) call quicksort1( namec, j+1 , last )\n\n return\n\nend subroutine quicksort1\n", "language": "Fortran", "metadata": {"date": 1588445733, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Fortran/s246272928.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s246272928", "user_id": "u353721260"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, i, cnt, maxs\n character(10), allocatable :: s(:)\n\n read *, n\n allocate( s(n) )\n do i = 1, n\n read *, s(i)\n end do\n\n call quicksort1( s, 1, n )\n\n cnt = 0\n maxs = 1\n do i = 1, n\n if ( s(i) == s(i+1) ) then\n cnt = cnt + 1\n else\n if ( maxs <= cnt ) then\n maxs = cnt\n end if \n cnt = 0\n end if\n end do\n\n cnt = 0\n do i = 1, n\n if ( maxs == 1 ) then\n print *, s(i)\n else\n if ( s(i) == s(i+1) ) then\n cnt = cnt + 1\n else\n if ( maxs == cnt ) then\n print *, s(i)\n end if \n cnt = 0\n end if\n end if\n end do\n\nend program main\nrecursive subroutine quicksort1( namec, first, last )\n\n implicit none\n character(10), intent(inout) :: namec(*)\n integer,intent(in)::first,last\n !\n ! Original\n ! https://gist.github.com/t-nissie/479f0f16966925fa29ea\n !\n character(100)::x,t\n integer::i,j\n\n x = namec((first+last)/2)\n i = first\n j = last\n do\n do while ( LGT( x, namec(i) ) )\n i=i+1\n end do\n do while ( LGT( namec(j), x ) )\n j=j-1\n end do\n if (i >= j) exit\n t = namec(i)\n namec(i) = namec(j)\n namec(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i-1) call quicksort1( namec, first, i-1 )\n if (j+1 < last) call quicksort1( namec, j+1 , last )\n\n return\n\nend subroutine quicksort1\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1534, "cpu_time_ms": 386, "memory_kb": 4480}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s069295280", "group_id": "codeNet:p02773", "input_text": "program test03_2\n implicit none\n integer N\n character(len=10),allocatable :: S(:)\n character(len=10),allocatable :: Smax(:)\n integer,allocatable :: Sk(:)\n integer :: kaisuu=1, maxkaisuu=0\n integer i, ii\n integer :: j=1\n integer :: yatta=0\n\n read *, N\n allocate(S(N))\n allocate(Sk(N))\n allocate(Smax(N))\n do i=1,N\n read *, S(i)\n! S(i)=trim(S(i))\n end do\n\nSmax='a'\nSk=1\n\n call quicksort1(S,1,N)\n\n do i=2,N\n if (S(i)==S(i-1)) then\n Sk(i)=Sk(i-1)+1\n!print *,i, S(i) ,Sk(i), 'yes'\n else\n Sk(i)=1\n!print *,i, S(i) ,Sk(i), 'no'\n end if\n !print *,i, S(i) ,Sk(i)\n end do\n\n yatta=MAXVAL(Sk) \n!print *, 'yatta=',yatta\n\n print *,''\n do i=1,N\n if ( Sk(i) == yatta ) then\n print '(A)', trim(S(i))\n end if\n end do\n\n!print *,''\n!print '(A)', S(1)\n\n\ncontains\nrecursive subroutine quicksort1(a, first, last)\n implicit none\n character(len=10),intent(inout)::a(*)\n integer,intent(in)::first,last\n\n character(len=10)::x,t\n integer::i,j\n\n x = a((first+last)/2)\n i = first\n j = last\n do \n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i)\n a(i) = a(j)\n a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i-1) call quicksort1(a, first, i-1)\n if (j+1 < last) call quicksort1(a, j+1, last)\n return\nend subroutine quicksort1\n\nendprogram test03_2\n", "language": "Fortran", "metadata": {"date": 1581931824, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Fortran/s069295280.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s069295280", "user_id": "u838994321"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "program test03_2\n implicit none\n integer N\n character(len=10),allocatable :: S(:)\n character(len=10),allocatable :: Smax(:)\n integer,allocatable :: Sk(:)\n integer :: kaisuu=1, maxkaisuu=0\n integer i, ii\n integer :: j=1\n integer :: yatta=0\n\n read *, N\n allocate(S(N))\n allocate(Sk(N))\n allocate(Smax(N))\n do i=1,N\n read *, S(i)\n! S(i)=trim(S(i))\n end do\n\nSmax='a'\nSk=1\n\n call quicksort1(S,1,N)\n\n do i=2,N\n if (S(i)==S(i-1)) then\n Sk(i)=Sk(i-1)+1\n!print *,i, S(i) ,Sk(i), 'yes'\n else\n Sk(i)=1\n!print *,i, S(i) ,Sk(i), 'no'\n end if\n !print *,i, S(i) ,Sk(i)\n end do\n\n yatta=MAXVAL(Sk) \n!print *, 'yatta=',yatta\n\n print *,''\n do i=1,N\n if ( Sk(i) == yatta ) then\n print '(A)', trim(S(i))\n end if\n end do\n\n!print *,''\n!print '(A)', S(1)\n\n\ncontains\nrecursive subroutine quicksort1(a, first, last)\n implicit none\n character(len=10),intent(inout)::a(*)\n integer,intent(in)::first,last\n\n character(len=10)::x,t\n integer::i,j\n\n x = a((first+last)/2)\n i = first\n j = last\n do \n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i)\n a(i) = a(j)\n a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i-1) call quicksort1(a, first, i-1)\n if (j+1 < last) call quicksort1(a, j+1, last)\n return\nend subroutine quicksort1\n\nendprogram test03_2\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1354, "cpu_time_ms": 205, "memory_kb": 6656}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s028534893", "group_id": "codeNet:p02773", "input_text": " module charaSort\n implicit none\n \n contains\n recursive function sort( s ) result( r )\n implicit none\n character(10),intent(in) :: s(:)\n character(10) :: r( size(s) )\n \n if( size(s)>1 )then\n r = [sort( pack(s, ss(1)) )]\n else\n r = s\n end if\n end function\n end module\n\n\n PROGRAM Poll\n use charaSort\n IMPLICIT NONE\n integer(16) :: n\n character(10),allocatable :: s(:)\n character(10),allocatable :: note1(:)\n integer(16) :: i,counter,piyo,c\n integer(16),allocatable :: note2(:)\n logical,allocatable :: flag(:)\n \n \n read*,n\n allocate( s(1:n) )\n allocate(note1(n),note2(n),flag(n))\n do i = 1,n\n read'(a)',s(i)\n end do\n \n \n counter = 1\n note1(1) = s(1)\n note2(:) = 0\n outer:do i = 2,n\n do c = 1,counter\n if( note1(c)==s(i) )then\n note2(c) = note2(c) + 1\n cycle\n end if\n end do\n counter = counter + 1\n note1(counter) = s(i)\n end do outer\n \n \n flag = note2==maxval(note2)\n piyo = count( flag )\n \n deallocate( note1 )\n allocate( note1(piyo) )\n \n note1 = pack( s,flag )\n note1 = sort( note1 )\n \n do i = 1,piyo\n print*,note1(i)\n end do\n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1581888516, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Fortran/s028534893.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s028534893", "user_id": "u171356453"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": " module charaSort\n implicit none\n \n contains\n recursive function sort( s ) result( r )\n implicit none\n character(10),intent(in) :: s(:)\n character(10) :: r( size(s) )\n \n if( size(s)>1 )then\n r = [sort( pack(s, ss(1)) )]\n else\n r = s\n end if\n end function\n end module\n\n\n PROGRAM Poll\n use charaSort\n IMPLICIT NONE\n integer(16) :: n\n character(10),allocatable :: s(:)\n character(10),allocatable :: note1(:)\n integer(16) :: i,counter,piyo,c\n integer(16),allocatable :: note2(:)\n logical,allocatable :: flag(:)\n \n \n read*,n\n allocate( s(1:n) )\n allocate(note1(n),note2(n),flag(n))\n do i = 1,n\n read'(a)',s(i)\n end do\n \n \n counter = 1\n note1(1) = s(1)\n note2(:) = 0\n outer:do i = 2,n\n do c = 1,counter\n if( note1(c)==s(i) )then\n note2(c) = note2(c) + 1\n cycle\n end if\n end do\n counter = counter + 1\n note1(counter) = s(i)\n end do outer\n \n \n flag = note2==maxval(note2)\n piyo = count( flag )\n \n deallocate( note1 )\n allocate( note1(piyo) )\n \n note1 = pack( s,flag )\n note1 = sort( note1 )\n \n do i = 1,piyo\n print*,note1(i)\n end do\n \n END PROGRAM", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1490, "cpu_time_ms": 2103, "memory_kb": 7424}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s626162290", "group_id": "codeNet:p02773", "input_text": " module charaSort\n implicit none\n \n contains\n recursive function sort( s ) result( r )\n implicit none\n character(10),intent(in) :: s(:)\n character(10) :: r( size(s) )\n \n if( size(s)>1 )then\n r = [sort( pack(s, ss(1)) )]\n else\n r = s\n end if\n end function\n end module\n\n\n PROGRAM Poll\n use charaSort\n IMPLICIT NONE\n integer(16) :: n\n character(10),allocatable :: s(:)\n character(10),allocatable :: note1(:)\n integer(16) :: i,counter\n integer(16),allocatable :: note2(:)\n logical,allocatable :: flag(:)\n \n \n read*,n\n allocate( s(1:n) )\n allocate(note1(n),note2(n),flag(n))\n do i = 1,n\n read*,s(i)\n end do\n \n s = sort(s)\n \n counter = 1\n note1(1) = s(1)\n note2(:) = 0\n do i = 2,n\n if(note1(counter)==s(i))then\n note2(counter) = note2(counter) + 1\n else\n counter = counter + 1\n note1(counter) = s(i)\n end if\n end do\n \n flag = note2==maxval(note2)\n \n do i = 1,counter\n if(flag(i))then\n print*,note1(i)\n end if\n end do\n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1581885991, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Fortran/s626162290.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s626162290", "user_id": "u171356453"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": " module charaSort\n implicit none\n \n contains\n recursive function sort( s ) result( r )\n implicit none\n character(10),intent(in) :: s(:)\n character(10) :: r( size(s) )\n \n if( size(s)>1 )then\n r = [sort( pack(s, ss(1)) )]\n else\n r = s\n end if\n end function\n end module\n\n\n PROGRAM Poll\n use charaSort\n IMPLICIT NONE\n integer(16) :: n\n character(10),allocatable :: s(:)\n character(10),allocatable :: note1(:)\n integer(16) :: i,counter\n integer(16),allocatable :: note2(:)\n logical,allocatable :: flag(:)\n \n \n read*,n\n allocate( s(1:n) )\n allocate(note1(n),note2(n),flag(n))\n do i = 1,n\n read*,s(i)\n end do\n \n s = sort(s)\n \n counter = 1\n note1(1) = s(1)\n note2(:) = 0\n do i = 2,n\n if(note1(counter)==s(i))then\n note2(counter) = note2(counter) + 1\n else\n counter = counter + 1\n note1(counter) = s(i)\n end if\n end do\n \n flag = note2==maxval(note2)\n \n do i = 1,counter\n if(flag(i))then\n print*,note1(i)\n end if\n end do\n \n END PROGRAM", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1336, "cpu_time_ms": 2131, "memory_kb": 468768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s277725223", "group_id": "codeNet:p02773", "input_text": " module charaSort\n implicit none\n \n contains\n recursive function sort( s ) result( r )\n implicit none\n character(10),intent(in) :: s(:)\n character(10) :: r( size(s) )\n \n if( size(s)>1 )then\n r = [sort( pack(s, ss(1)) )]\n else\n r = s\n end if\n end function\n end module\n\n\n PROGRAM Poll\n use charaSort\n IMPLICIT NONE\n integer(16) :: n\n character(10),allocatable :: s(:)\n character(10),allocatable :: note1(:)\n integer(16) :: i,counter\n integer(16),allocatable :: note2(:)\n logical,allocatable :: flag(:)\n \n \n read*,n\n allocate( s(1:n) )\n do i = 1,n\n read*,s(i)\n end do\n \n s = sort(s)\n allocate(note1(n),note2(n))\n counter = 1\n note1(1) = s(1)\n note2(:) = 0\n do i = 2,n\n if(note1(counter)==s(i))then\n note2(counter) = note2(counter) + 1\n else\n counter = counter + 1\n note1(counter) = s(i)\n end if\n end do\n \n \n allocate(flag(counter))\n flag = note2==maxval(note2)\n \n do i = 1,counter\n if(flag(i))then\n print*,note1(i)\n end if\n end do\n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1581885104, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02773.html", "problem_id": "p02773", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02773/input.txt", "sample_output_relpath": "derived/input_output/data/p02773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02773/Fortran/s277725223.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s277725223", "user_id": "u171356453"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": " module charaSort\n implicit none\n \n contains\n recursive function sort( s ) result( r )\n implicit none\n character(10),intent(in) :: s(:)\n character(10) :: r( size(s) )\n \n if( size(s)>1 )then\n r = [sort( pack(s, ss(1)) )]\n else\n r = s\n end if\n end function\n end module\n\n\n PROGRAM Poll\n use charaSort\n IMPLICIT NONE\n integer(16) :: n\n character(10),allocatable :: s(:)\n character(10),allocatable :: note1(:)\n integer(16) :: i,counter\n integer(16),allocatable :: note2(:)\n logical,allocatable :: flag(:)\n \n \n read*,n\n allocate( s(1:n) )\n do i = 1,n\n read*,s(i)\n end do\n \n s = sort(s)\n allocate(note1(n),note2(n))\n counter = 1\n note1(1) = s(1)\n note2(:) = 0\n do i = 2,n\n if(note1(counter)==s(i))then\n note2(counter) = note2(counter) + 1\n else\n counter = counter + 1\n note1(counter) = s(i)\n end if\n end do\n \n \n allocate(flag(counter))\n flag = note2==maxval(note2)\n \n do i = 1,counter\n if(flag(i))then\n print*,note1(i)\n end if\n end do\n \n END PROGRAM", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "sample_input": "7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n"}, "reference_outputs": ["beet\nvet\n"], "source_document_id": "p02773", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have N voting papers. The i-th vote (1 \\leq i \\leq N) has the string S_i written on it.\n\nPrint all strings that are written on the most number of votes, in lexicographical order.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nS_i (1 \\leq i \\leq N) are strings consisting of lowercase English letters.\n\nThe length of S_i (1 \\leq i \\leq N) is between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nPrint all strings in question in lexicographical order.\n\nSample Input 1\n\n7\nbeat\nvet\nbeet\nbed\nvet\nbet\nbeet\n\nSample Output 1\n\nbeet\nvet\n\nbeet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.\n\nSample Input 2\n\n8\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\nbuffalo\n\nSample Output 2\n\nbuffalo\n\nSample Input 3\n\n7\nbass\nbass\nkick\nkick\nbass\nkick\nkick\n\nSample Output 3\n\nkick\n\nSample Input 4\n\n4\nushi\ntapu\nnichia\nkun\n\nSample Output 4\n\nkun\nnichia\ntapu\nushi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1358, "cpu_time_ms": 2131, "memory_kb": 469868}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s696364983", "group_id": "codeNet:p02776", "input_text": "module mod_unweighted_graph\n implicit none\n type t_list\n integer, allocatable :: at(:, :)\n end type\n type unweighted_graph\n type(t_list), allocatable :: list(:)\n end type\n interface unweighted_graph\n module procedure :: newug0\n end interface unweighted_graph\ncontains\n type(unweighted_graph) function newug0(n, m, a, b, e, undirected) result(res)\n integer, intent(in) :: n, m, a(:), b(:), e(:)\n logical, optional, intent(in) :: undirected\n logical :: u\n integer :: c(n), i\n u = merge(undirected, .true., present(undirected))\n c = 0\n do i = 1, m\n c(a(i)) = c(a(i)) + 1\n if (u) c(b(i)) = c(b(i)) + 1\n end do\n allocate(res%list(n))\n do i = 1, n\n allocate(res%list(i)%at(c(i), 2))\n end do\n do i = m, 1, -1\n res%list(a(i))%at(c(a(i)), 1) = b(i)\n res%list(a(i))%at(c(a(i)), 2) = e(i)\n c(a(i)) = c(a(i)) - 1\n if (u) then\n res%list(b(i))%at(c(b(i)), 1) = a(i)\n res%list(b(i))%at(c(b(i)), 2) = e(i)\n c(b(i)) = c(b(i)) - 1\n end if\n end do\n end\nend module mod_unweighted_graph\nmodule mod_two_dim_merge_sort\n implicit none\n integer, private, parameter :: intkind = 4\ncontains\n logical function less(a, b) result(res)\n integer(intkind), intent(in) :: a(:), b(:)\n res = a(1) < b(1)\n end\n subroutine merge_sort(a)\n integer(intkind), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), &\n a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(intkind), intent(inout) :: a1(:, :), a2(:, :)\n integer(intkind) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (less(a1(i1, :), a2(i2, :))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\nend module mod_two_dim_merge_sort\nprogram perils_in_parallel\n use mod_unweighted_graph\n use mod_two_dim_merge_sort\n implicit none\n integer :: n, m, cnt = 0, i, j, l, r, p\n integer :: a(100000, 2) = 0, x(200000, 3) = 0, y(200000, 1) = 0, z(100001) = 0\n logical :: used(100000) = .false.\n type(unweighted_graph) :: g\n read(*,*) n, m\n do i = 1, n\n read(*,*) a(i, :)\n end do\n call merge_sort(a(1:n, :))\n z(1) = a(1, 2)\n do i = 2, n\n z(i) = xor(a(i, 2), a(i - 1, 2))\n end do\n z(n + 1) = a(n, 2)\n do i = 1, m\n j = cnt + 1\n read(*,*) x(j, 1:2)\n x(j, 3) = i\n if (x(j, 1) > a(n, 1)) cycle\n if (x(j, 2) < a(1, 1)) cycle\n l = 0\n r = n\n do while (r - l > 1)\n p = (l + r) / 2\n if (x(j, 1) <= a(p, 1)) then\n r = p\n else\n l = p\n end if\n end do\n x(j, 1) = r\n l = 1\n r = n + 1\n do while (r - l > 1)\n p = (l + r) / 2\n if (x(j, 2) >= a(p, 1)) then\n l = p\n else\n r = p\n end if\n end do\n x(j, 2) = r\n if (x(j, 1) < x(j, 2)) cnt = cnt + 1\n end do\n m = cnt\n g = unweighted_graph(n + 1, m, x(1:m, 1), x(1:m, 2), x(1:m, 3))\n p = 0\n do i = 1, n + 1\n if (used(i)) cycle\n if (btest(dfs(g, i), 0)) then\n write(*,'(i0)') -1\n stop\n end if\n end do\n write(*,'(i0)') p\n if (p > 0) then\n call merge_sort(y(1:p, :))\n write(*,'(i0)',advance='no') y(1, 1)\n do i = 2, p\n write(*,'(x,i0)',advance='no') y(i, 1)\n end do\n end if\n write(*,*)\ncontains\n recursive integer function dfs(this, v) result(res)\n type(unweighted_graph), intent(in) :: this\n integer, intent(in) :: v\n integer :: i, u, tmp\n used(v) = .true.\n res = z(v)\n do i = 1, size(this%list(v)%at, 1)\n u = this%list(v)%at(i, 1)\n if (used(u)) cycle\n tmp = dfs(this, u)\n if (btest(tmp, 0)) then\n p = p + 1\n y(p, 1) = this%list(v)%at(i, 2)\n end if\n res = xor(res, tmp)\n end do\n end\nend program perils_in_parallel", "language": "Fortran", "metadata": {"date": 1595904908, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02776.html", "problem_id": "p02776", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02776/input.txt", "sample_output_relpath": "derived/input_output/data/p02776/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02776/Fortran/s696364983.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s696364983", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n1 4\n", "input_to_evaluate": "module mod_unweighted_graph\n implicit none\n type t_list\n integer, allocatable :: at(:, :)\n end type\n type unweighted_graph\n type(t_list), allocatable :: list(:)\n end type\n interface unweighted_graph\n module procedure :: newug0\n end interface unweighted_graph\ncontains\n type(unweighted_graph) function newug0(n, m, a, b, e, undirected) result(res)\n integer, intent(in) :: n, m, a(:), b(:), e(:)\n logical, optional, intent(in) :: undirected\n logical :: u\n integer :: c(n), i\n u = merge(undirected, .true., present(undirected))\n c = 0\n do i = 1, m\n c(a(i)) = c(a(i)) + 1\n if (u) c(b(i)) = c(b(i)) + 1\n end do\n allocate(res%list(n))\n do i = 1, n\n allocate(res%list(i)%at(c(i), 2))\n end do\n do i = m, 1, -1\n res%list(a(i))%at(c(a(i)), 1) = b(i)\n res%list(a(i))%at(c(a(i)), 2) = e(i)\n c(a(i)) = c(a(i)) - 1\n if (u) then\n res%list(b(i))%at(c(b(i)), 1) = a(i)\n res%list(b(i))%at(c(b(i)), 2) = e(i)\n c(b(i)) = c(b(i)) - 1\n end if\n end do\n end\nend module mod_unweighted_graph\nmodule mod_two_dim_merge_sort\n implicit none\n integer, private, parameter :: intkind = 4\ncontains\n logical function less(a, b) result(res)\n integer(intkind), intent(in) :: a(:), b(:)\n res = a(1) < b(1)\n end\n subroutine merge_sort(a)\n integer(intkind), intent(inout) :: a(:, :)\n integer :: n, m, l, i, u\n n = size(a, 1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m / 2\n u = min(2 * i * l, n)\n call merger(a(2 * (i - 1) * l + 1:(2 * i - 1) * l, :), &\n a((2 * i - 1) * l + 1:u, :))\n end do\n l = 2 * l\n m = (m + 1) / 2\n end do\n end\n subroutine merger(a1, a2)\n integer(intkind), intent(inout) :: a1(:, :), a2(:, :)\n integer(intkind) :: a(size(a1, 1) + size(a2, 1), size(a1, 2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1, 1)\n n2 = size(a2, 1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (less(a1(i1, :), a2(i2, :))) then\n a(i1 + i2 - 1, :) = a1(i1, :)\n i1 = i1 + 1\n else\n a(i1 + i2 - 1, :) = a2(i2, :)\n i2 = i2 + 1\n end if\n end do\n if (i1 <= n1) then\n a(i1 + i2 - 1:n1 + n2, :) = a1(i1:n1, :)\n else\n a(i1 + i2 - 1:n1 + n2, :) = a2(i2:n2, :)\n end if\n a1 = a(1:n1, :)\n a2 = a(n1 + 1:n1 + n2, :)\n end\nend module mod_two_dim_merge_sort\nprogram perils_in_parallel\n use mod_unweighted_graph\n use mod_two_dim_merge_sort\n implicit none\n integer :: n, m, cnt = 0, i, j, l, r, p\n integer :: a(100000, 2) = 0, x(200000, 3) = 0, y(200000, 1) = 0, z(100001) = 0\n logical :: used(100000) = .false.\n type(unweighted_graph) :: g\n read(*,*) n, m\n do i = 1, n\n read(*,*) a(i, :)\n end do\n call merge_sort(a(1:n, :))\n z(1) = a(1, 2)\n do i = 2, n\n z(i) = xor(a(i, 2), a(i - 1, 2))\n end do\n z(n + 1) = a(n, 2)\n do i = 1, m\n j = cnt + 1\n read(*,*) x(j, 1:2)\n x(j, 3) = i\n if (x(j, 1) > a(n, 1)) cycle\n if (x(j, 2) < a(1, 1)) cycle\n l = 0\n r = n\n do while (r - l > 1)\n p = (l + r) / 2\n if (x(j, 1) <= a(p, 1)) then\n r = p\n else\n l = p\n end if\n end do\n x(j, 1) = r\n l = 1\n r = n + 1\n do while (r - l > 1)\n p = (l + r) / 2\n if (x(j, 2) >= a(p, 1)) then\n l = p\n else\n r = p\n end if\n end do\n x(j, 2) = r\n if (x(j, 1) < x(j, 2)) cnt = cnt + 1\n end do\n m = cnt\n g = unweighted_graph(n + 1, m, x(1:m, 1), x(1:m, 2), x(1:m, 3))\n p = 0\n do i = 1, n + 1\n if (used(i)) cycle\n if (btest(dfs(g, i), 0)) then\n write(*,'(i0)') -1\n stop\n end if\n end do\n write(*,'(i0)') p\n if (p > 0) then\n call merge_sort(y(1:p, :))\n write(*,'(i0)',advance='no') y(1, 1)\n do i = 2, p\n write(*,'(x,i0)',advance='no') y(i, 1)\n end do\n end if\n write(*,*)\ncontains\n recursive integer function dfs(this, v) result(res)\n type(unweighted_graph), intent(in) :: this\n integer, intent(in) :: v\n integer :: i, u, tmp\n used(v) = .true.\n res = z(v)\n do i = 1, size(this%list(v)%at, 1)\n u = this%list(v)%at(i, 1)\n if (used(u)) cycle\n tmp = dfs(this, u)\n if (btest(tmp, 0)) then\n p = p + 1\n y(p, 1) = this%list(v)%at(i, 2)\n end if\n res = xor(res, tmp)\n end do\n end\nend program perils_in_parallel", "problem_context": "Score: 600 points\n\nProblem Statement\n\nAfter being invaded by the Kingdom of AlDebaran, bombs are planted throughout our country, AtCoder Kingdom.\n\nFortunately, our military team called ABC has managed to obtain a device that is a part of the system controlling the bombs.\n\nThere are N bombs, numbered 1 to N, planted in our country. Bomb i is planted at the coordinate A_i. It is currently activated if B_i=1, and deactivated if B_i=0.\n\nThe device has M cords numbered 1 to M. If we cut Cord j, the states of all the bombs planted between the coordinates L_j and R_j (inclusive) will be switched - from activated to deactivated, and vice versa.\n\nDetermine whether it is possible to deactivate all the bombs at the same time. If the answer is yes, output a set of cords that should be cut.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nA_i are pairwise distinct.\n\nB_i is 0 or 1. (1 \\leq i \\leq N)\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq L_j \\leq R_j \\leq 10^9\\ (1 \\leq j \\leq M)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_N B_N\nL_1 R_1\n:\nL_M R_M\n\nOutput\n\nIf it is impossible to deactivate all the bombs at the same time, print -1. If it is possible to do so, print a set of cords that should be cut, as follows:\n\nk\nc_1 c_2 \\dots c_k\n\nHere, k is the number of cords (possibly 0), and c_1, c_2, \\dots, c_k represent the cords that should be cut. 1 \\leq c_1 < c_2 < \\dots < c_k \\leq M must hold.\n\nSample Input 1\n\n3 4\n5 1\n10 1\n8 0\n1 10\n4 5\n6 7\n8 9\n\nSample Output 1\n\n2\n1 4\n\nThere are two activated bombs at the coordinates 5, 10, and one deactivated bomb at the coordinate 8.\n\nCutting Cord 1 switches the states of all the bombs planted between the coordinates 1 and 10, that is, all of the three bombs.\n\nCutting Cord 4 switches the states of all the bombs planted between the coordinates 8 and 9, that is, Bomb 3.\n\nThus, we can deactivate all the bombs by cutting Cord 1 and Cord 4.\n\nSample Input 2\n\n4 2\n2 0\n3 1\n5 1\n7 0\n1 4\n4 7\n\nSample Output 2\n\n-1\n\nCutting any set of cords will not deactivate all the bombs at the same time.\n\nSample Input 3\n\n3 2\n5 0\n10 0\n8 0\n6 9\n66 99\n\nSample Output 3\n\n0\n\nAll the bombs are already deactivated, so we do not need to cut any cord.\n\nSample Input 4\n\n12 20\n536130100 1\n150049660 1\n79245447 1\n132551741 0\n89484841 1\n328129089 0\n623467741 0\n248785745 0\n421631475 0\n498966877 0\n43768791 1\n112237273 0\n21499042 142460201\n58176487 384985131\n88563042 144788076\n120198276 497115965\n134867387 563350571\n211946499 458996604\n233934566 297258009\n335674184 555985828\n414601661 520203502\n101135608 501051309\n90972258 300372385\n255474956 630621190\n436210625 517850028\n145652401 192476406\n377607297 520655694\n244404406 304034433\n112237273 359737255\n392593015 463983307\n150586788 504362212\n54772353 83124235\n\nSample Output 4\n\n5\n1 7 8 9 11\n\nIf there are multiple sets of cords that deactivate all the bombs when cut, any of them can be printed.", "sample_input": "3 4\n5 1\n10 1\n8 0\n1 10\n4 5\n6 7\n8 9\n"}, "reference_outputs": ["2\n1 4\n"], "source_document_id": "p02776", "source_text": "Score: 600 points\n\nProblem Statement\n\nAfter being invaded by the Kingdom of AlDebaran, bombs are planted throughout our country, AtCoder Kingdom.\n\nFortunately, our military team called ABC has managed to obtain a device that is a part of the system controlling the bombs.\n\nThere are N bombs, numbered 1 to N, planted in our country. Bomb i is planted at the coordinate A_i. It is currently activated if B_i=1, and deactivated if B_i=0.\n\nThe device has M cords numbered 1 to M. If we cut Cord j, the states of all the bombs planted between the coordinates L_j and R_j (inclusive) will be switched - from activated to deactivated, and vice versa.\n\nDetermine whether it is possible to deactivate all the bombs at the same time. If the answer is yes, output a set of cords that should be cut.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\\ (1 \\leq i \\leq N)\n\nA_i are pairwise distinct.\n\nB_i is 0 or 1. (1 \\leq i \\leq N)\n\n1 \\leq M \\leq 2 \\times 10^5\n\n1 \\leq L_j \\leq R_j \\leq 10^9\\ (1 \\leq j \\leq M)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_N B_N\nL_1 R_1\n:\nL_M R_M\n\nOutput\n\nIf it is impossible to deactivate all the bombs at the same time, print -1. If it is possible to do so, print a set of cords that should be cut, as follows:\n\nk\nc_1 c_2 \\dots c_k\n\nHere, k is the number of cords (possibly 0), and c_1, c_2, \\dots, c_k represent the cords that should be cut. 1 \\leq c_1 < c_2 < \\dots < c_k \\leq M must hold.\n\nSample Input 1\n\n3 4\n5 1\n10 1\n8 0\n1 10\n4 5\n6 7\n8 9\n\nSample Output 1\n\n2\n1 4\n\nThere are two activated bombs at the coordinates 5, 10, and one deactivated bomb at the coordinate 8.\n\nCutting Cord 1 switches the states of all the bombs planted between the coordinates 1 and 10, that is, all of the three bombs.\n\nCutting Cord 4 switches the states of all the bombs planted between the coordinates 8 and 9, that is, Bomb 3.\n\nThus, we can deactivate all the bombs by cutting Cord 1 and Cord 4.\n\nSample Input 2\n\n4 2\n2 0\n3 1\n5 1\n7 0\n1 4\n4 7\n\nSample Output 2\n\n-1\n\nCutting any set of cords will not deactivate all the bombs at the same time.\n\nSample Input 3\n\n3 2\n5 0\n10 0\n8 0\n6 9\n66 99\n\nSample Output 3\n\n0\n\nAll the bombs are already deactivated, so we do not need to cut any cord.\n\nSample Input 4\n\n12 20\n536130100 1\n150049660 1\n79245447 1\n132551741 0\n89484841 1\n328129089 0\n623467741 0\n248785745 0\n421631475 0\n498966877 0\n43768791 1\n112237273 0\n21499042 142460201\n58176487 384985131\n88563042 144788076\n120198276 497115965\n134867387 563350571\n211946499 458996604\n233934566 297258009\n335674184 555985828\n414601661 520203502\n101135608 501051309\n90972258 300372385\n255474956 630621190\n436210625 517850028\n145652401 192476406\n377607297 520655694\n244404406 304034433\n112237273 359737255\n392593015 463983307\n150586788 504362212\n54772353 83124235\n\nSample Output 4\n\n5\n1 7 8 9 11\n\nIf there are multiple sets of cords that deactivate all the bombs when cut, any of them can be printed.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4336, "cpu_time_ms": 240, "memory_kb": 26620}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s155098294", "group_id": "codeNet:p02777", "input_text": "program main\n implicit none\n\n integer :: a,b\n character(10) :: s,t,u\n\n read( *, * ) s, t\n read(*,*) a,b\n read(*,*) u\n\n if (u.eq.s) then\n a=a-1\n elseif(u.eq.t) then\n b=b-1\n endif\n\n print *,a,b\nend program main", "language": "Fortran", "metadata": {"date": 1581278678, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Fortran/s155098294.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s155098294", "user_id": "u878839832"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main\n implicit none\n\n integer :: a,b\n character(10) :: s,t,u\n\n read( *, * ) s, t\n read(*,*) a,b\n read(*,*) u\n\n if (u.eq.s) then\n a=a-1\n elseif(u.eq.t) then\n b=b-1\n endif\n\n print *,a,b\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 251, "cpu_time_ms": 6, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s433651178", "group_id": "codeNet:p02777", "input_text": "program main\nimplicit none\ninteger :: i, j, k, a, b\ncharacter(10) :: s, t, u\n\nread(*,*) s, t\nread(*,*) a, b\nread(*,*) u\nif( s == u ) then\n a = a-1\nelse\n b = b-1\nend if\nwrite(*,'(i0, a1, i0)') a,'', b\n\nend program main", "language": "Fortran", "metadata": {"date": 1581278585, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02777.html", "problem_id": "p02777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02777/input.txt", "sample_output_relpath": "derived/input_output/data/p02777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02777/Fortran/s433651178.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s433651178", "user_id": "u696547932"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: i, j, k, a, b\ncharacter(10) :: s, t, u\n\nread(*,*) s, t\nread(*,*) a, b\nread(*,*) u\nif( s == u ) then\n a = a-1\nelse\n b = b-1\nend if\nwrite(*,'(i0, a1, i0)') a,'', b\n\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "sample_input": "red blue\n3 4\nred\n"}, "reference_outputs": ["2 4\n"], "source_document_id": "p02777", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A balls with the string S written on each of them and B balls with the string T written on each of them.\n\nFrom these balls, Takahashi chooses one with the string U written on it and throws it away.\n\nFind the number of balls with the string S and balls with the string T that we have now.\n\nConstraints\n\nS, T, and U are strings consisting of lowercase English letters.\n\nThe lengths of S and T are each between 1 and 10 (inclusive).\n\nS \\not= T\n\nS=U or T=U.\n\n1 \\leq A,B \\leq 10\n\nA and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\nA B\nU\n\nOutput\n\nPrint the answer, with space in between.\n\nSample Input 1\n\nred blue\n3 4\nred\n\nSample Output 1\n\n2 4\n\nTakahashi chose a ball with red written on it and threw it away.\nNow we have two balls with the string S and four balls with the string T.\n\nSample Input 2\n\nred blue\n5 5\nblue\n\nSample Output 2\n\n5 4\n\nTakahashi chose a ball with blue written on it and threw it away.\nNow we have five balls with the string S and four balls with the string T.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 221, "cpu_time_ms": 4, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s396270912", "group_id": "codeNet:p02779", "input_text": "program abc65\n implicit none\n integer(8)::N,ia,ib,ic,j=1\n integer(8),allocatable::a(:)\n read(*,*)N\n allocate(a(N))\n read(*,*)(a(ia),ia=1,N)\n do ib=1,N-1\n do ic=ib+1,N\n if(a(ib)==a(ic))then\n j=0\n goto 1\n end if\n end do\n end do\n 1 if(j==0)then\n print'(a)',\"NO\"\n else\n print'(a)',\"YES\"\n end if\n deallocate(a)\nend program abc65", "language": "Fortran", "metadata": {"date": 1600523333, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02779.html", "problem_id": "p02779", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02779/input.txt", "sample_output_relpath": "derived/input_output/data/p02779/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02779/Fortran/s396270912.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s396270912", "user_id": "u897889420"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program abc65\n implicit none\n integer(8)::N,ia,ib,ic,j=1\n integer(8),allocatable::a(:)\n read(*,*)N\n allocate(a(N))\n read(*,*)(a(ia),ia=1,N)\n do ib=1,N-1\n do ic=ib+1,N\n if(a(ib)==a(ic))then\n j=0\n goto 1\n end if\n end do\n end do\n 1 if(j==0)then\n print'(a)',\"NO\"\n else\n print'(a)',\"YES\"\n end if\n deallocate(a)\nend program abc65", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "sample_input": "5\n2 6 1 4 5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02779", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 345, "cpu_time_ms": 2205, "memory_kb": 4696}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s190140419", "group_id": "codeNet:p02779", "input_text": "program DorN\n implicit none\n integer(8) n, i\n integer :: f = 0\n integer(8),allocatable :: a(:)\n read *, n\n allocate(a(n))\n read *, a(1:n)\n do i = 1, n-1\n if(a(i) .eq. a(i+1))then\n f = f + 1\n exit\n end if\n if(f .ge. 1)exit\n end do\n if(f .ge. 1)then\n print *, 'NO'\n else\n print *, 'YES'\n end if\nend program", "language": "Fortran", "metadata": {"date": 1599209247, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02779.html", "problem_id": "p02779", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02779/input.txt", "sample_output_relpath": "derived/input_output/data/p02779/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02779/Fortran/s190140419.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s190140419", "user_id": "u622206408"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program DorN\n implicit none\n integer(8) n, i\n integer :: f = 0\n integer(8),allocatable :: a(:)\n read *, n\n allocate(a(n))\n read *, a(1:n)\n do i = 1, n-1\n if(a(i) .eq. a(i+1))then\n f = f + 1\n exit\n end if\n if(f .ge. 1)exit\n end do\n if(f .ge. 1)then\n print *, 'NO'\n else\n print *, 'YES'\n end if\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "sample_input": "5\n2 6 1 4 5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02779", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 397, "cpu_time_ms": 62, "memory_kb": 4656}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s134718510", "group_id": "codeNet:p02779", "input_text": " Program Main\n\n Implicit None\n\n Integer, Allocatable :: A(:) \n Integer(8) :: i,j,N\n Logical :: eq\n\n eq = .False.\n N = 0\n Read(*,*) N\n Allocate (A(N)); A(:) = 0.0d0 \n Read(*,*)(A(i),i=1,N)\n\n Check:Do i = 1,N-1\n Do j = i+1,N\n If (A(i) == A(j)) then\n eq = .True.\n Exit Check\n Endif\n Enddo\n Enddo Check\n\n\n If (.not.eq) then\n Write(*,\"(a)\")\"YES\"\n Else\n Write(*,\"(a)\")\"NO\"\n Endif\n\n Deallocate(A)\n\n End Program\n", "language": "Fortran", "metadata": {"date": 1581281380, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02779.html", "problem_id": "p02779", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02779/input.txt", "sample_output_relpath": "derived/input_output/data/p02779/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02779/Fortran/s134718510.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s134718510", "user_id": "u718634931"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": " Program Main\n\n Implicit None\n\n Integer, Allocatable :: A(:) \n Integer(8) :: i,j,N\n Logical :: eq\n\n eq = .False.\n N = 0\n Read(*,*) N\n Allocate (A(N)); A(:) = 0.0d0 \n Read(*,*)(A(i),i=1,N)\n\n Check:Do i = 1,N-1\n Do j = i+1,N\n If (A(i) == A(j)) then\n eq = .True.\n Exit Check\n Endif\n Enddo\n Enddo Check\n\n\n If (.not.eq) then\n Write(*,\"(a)\")\"YES\"\n Else\n Write(*,\"(a)\")\"NO\"\n Endif\n\n Deallocate(A)\n\n End Program\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "sample_input": "5\n2 6 1 4 5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02779", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a sequence of integers A_1, A_2, ..., A_N.\nIf its elements are pairwise distinct, print YES; otherwise, print NO.\n\nConstraints\n\n2 ≤ N ≤ 200000\n\n1 ≤ A_i ≤ 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nIf the elements of the sequence are pairwise distinct, print YES; otherwise, print NO.\n\nSample Input 1\n\n5\n2 6 1 4 5\n\nSample Output 1\n\nYES\n\nThe elements are pairwise distinct.\n\nSample Input 2\n\n6\n4 1 3 1 6 2\n\nSample Output 2\n\nNO\n\nThe second and fourth elements are identical.\n\nSample Input 3\n\n2\n10000000 10000000\n\nSample Output 3\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 583, "cpu_time_ms": 2103, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s266889824", "group_id": "codeNet:p02779", "input_text": " MODULE qSortMod\n implicit none\n interface qSort\n module procedure :: i16qSort\n module procedure :: i4qSort\n end interface\n contains\n \n pure recursive function i16qSort( a ) result( r )\n !ref\n !https://t.doujin-constant.net/\n !post/143374686394/fortranをより使いこなしたquick-sort\n !\n !left is Bigger!\n implicit none\n integer(16),intent(in) :: a(:)\n integer(16) :: r( size(a) )\n !integer(16),allocatable :: r(:) !is OK\n \n if( size(a)>1 )then\n r = [ qSort( pack( a(:),a(:)> a(1) ) ), &\n pack( a(:),a(:)==a(1) ) , &\n qSort( pack( a(:),a(:)< a(1) ) ) ]\n else\n r = a\n end if\n end function i16qSort\n \n pure recursive function i4qSort( a ) result( r )\n implicit none\n integer(4),intent(in) :: a(:)\n integer(4) :: r( size(a) )\n \n if( size(a)>1 )then\n r=[qSort(pack(a,a>a(1))),pack(a,a==a(1)),qSort(pack(a,a1 )then\n r = [ qSort( pack( a(:),a(:)> a(1) ) ), &\n pack( a(:),a(:)==a(1) ) , &\n qSort( pack( a(:),a(:)< a(1) ) ) ]\n else\n r = a\n end if\n end function i16qSort\n \n pure recursive function i4qSort( a ) result( r )\n implicit none\n integer(4),intent(in) :: a(:)\n integer(4) :: r( size(a) )\n \n if( size(a)>1 )then\n r=[qSort(pack(a,a>a(1))),pack(a,a==a(1)),qSort(pack(a,a max_s) then\n max_s = s(i)\n l = i\n Endif\n Enddo\n\n Do i = l,l+K-1\n q = q + (Dble(p(i))+1.0d0)/2.0d0\n Enddo\n\n Write(*,\"(F0.7)\") q\n\n\n\n End Program\n", "language": "Fortran", "metadata": {"date": 1581284628, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Fortran/s247728111.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s247728111", "user_id": "u718634931"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": " Program Main\n\n Implicit None\n\n Real*8 :: q \n Integer, Allocatable :: p(:),s(:)\n Integer(8) :: i,j,N,K,max_s,l\n\n N = 0; K = 0; max_s = 0\n Read(*,*) N,K\n Allocate (p(N)); p(:) = 0\n Allocate (s(N)); s(:) = 0\n Read(*,*)(p(i),i=1,N)\n\n Do i = 1,N-K+1\n Do j = i,i+K-1\n s(i) = s(i) + p(j)\n Enddo\n If (s(i) > max_s) then\n max_s = s(i)\n l = i\n Endif\n Enddo\n\n Do i = l,l+K-1\n q = q + (Dble(p(i))+1.0d0)/2.0d0\n Enddo\n\n Write(*,\"(F0.7)\") q\n\n\n\n End Program\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 572, "cpu_time_ms": 2103, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s114584768", "group_id": "codeNet:p02780", "input_text": "program main\n implicit none\n integer(4):: n,k,i,j\n integer(4),allocatable:: p(:)\n real(8),allocatable:: s(:), ar(:)\n real(8):: ans=0\n read*, n, k\n allocate(p(n),s(0:n))\n read*, p(:)\n ! p(:) = [(i,i=1,n)]\n\n s(1:) = dble(p(:)-1)/2d0+1\n s(0) = 0\n do i=1,n\n s(i) = s(i) + s(i-1)\n end do\n\n\n do i=0,n-k+1\n ans = max(ans, s(i+k)-s(i))\n end do\n print*, ans\nend program main", "language": "Fortran", "metadata": {"date": 1581282714, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Fortran/s114584768.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s114584768", "user_id": "u234636620"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "program main\n implicit none\n integer(4):: n,k,i,j\n integer(4),allocatable:: p(:)\n real(8),allocatable:: s(:), ar(:)\n real(8):: ans=0\n read*, n, k\n allocate(p(n),s(0:n))\n read*, p(:)\n ! p(:) = [(i,i=1,n)]\n\n s(1:) = dble(p(:)-1)/2d0+1\n s(0) = 0\n do i=1,n\n s(i) = s(i) + s(i-1)\n end do\n\n\n do i=0,n-k+1\n ans = max(ans, s(i+k)-s(i))\n end do\n print*, ans\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 427, "cpu_time_ms": 46, "memory_kb": 3200}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s961445388", "group_id": "codeNet:p02780", "input_text": "program main\n implicit none\n integer(4):: n,k,i\n integer(4),allocatable:: p(:)\n real(8),allocatable:: s(:)\n real(8):: ans\n read*, n, k\n allocate(p(n))\n read*, p(:)\n\n call merge_sort(p(:),1,n)\n\n allocate(s(p(1)))\n s(1) = 1d0\n do i=2, p(1)\n s(i) = s(i-1)+dble(i)\n end do\n\n do i=1,p(1)\n s(i) = s(i)/dble(i)\n end do\n\n\n ans = 0\n\n do i=1,k\n ans = ans + s(p(i))\n end do\n print*, ans\n\ncontains\nrecursive subroutine merge_sort(ar,fst,lst)\n integer(4):: ar(:),fst,lst\n integer(4):: tmp, mdl\n if(lst-fst < 2) then\n if (ar(fst) < ar(lst)) then\n tmp = ar(fst)\n ar(fst) = ar(lst)\n ar(lst) = tmp\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n call merge_sort(ar(:), fst, mdl)\n call merge_sort(ar(:), mdl+1, lst)\n call merge(ar(:), fst, mdl, lst)\n\nend subroutine\n\nsubroutine merge(ar,fst,mdl,lst)\n integer(4)::ar(:),fst,mdl,lst\n integer(4):: l,r,t\n integer(4),pointer:: tmp(:)\n\n allocate(tmp(lst-fst+1))\n l=fst\n r=mdl+1\n t=1\n do while(l <= mdl .and. r <= lst)\n if (ar(l) > ar(r)) then\n tmp(t) = ar(l)\n l=l+1\n else\n tmp(t) = ar(r)\n r=r+1\n end if\n t=t+1\n end do\n \n if (r > lst) then\n tmp(t:) = ar(l:mdl)\n else\n tmp(t:) = ar(r:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\nend subroutine\nend program main", "language": "Fortran", "metadata": {"date": 1581281239, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Fortran/s961445388.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s961445388", "user_id": "u234636620"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "program main\n implicit none\n integer(4):: n,k,i\n integer(4),allocatable:: p(:)\n real(8),allocatable:: s(:)\n real(8):: ans\n read*, n, k\n allocate(p(n))\n read*, p(:)\n\n call merge_sort(p(:),1,n)\n\n allocate(s(p(1)))\n s(1) = 1d0\n do i=2, p(1)\n s(i) = s(i-1)+dble(i)\n end do\n\n do i=1,p(1)\n s(i) = s(i)/dble(i)\n end do\n\n\n ans = 0\n\n do i=1,k\n ans = ans + s(p(i))\n end do\n print*, ans\n\ncontains\nrecursive subroutine merge_sort(ar,fst,lst)\n integer(4):: ar(:),fst,lst\n integer(4):: tmp, mdl\n if(lst-fst < 2) then\n if (ar(fst) < ar(lst)) then\n tmp = ar(fst)\n ar(fst) = ar(lst)\n ar(lst) = tmp\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n call merge_sort(ar(:), fst, mdl)\n call merge_sort(ar(:), mdl+1, lst)\n call merge(ar(:), fst, mdl, lst)\n\nend subroutine\n\nsubroutine merge(ar,fst,mdl,lst)\n integer(4)::ar(:),fst,mdl,lst\n integer(4):: l,r,t\n integer(4),pointer:: tmp(:)\n\n allocate(tmp(lst-fst+1))\n l=fst\n r=mdl+1\n t=1\n do while(l <= mdl .and. r <= lst)\n if (ar(l) > ar(r)) then\n tmp(t) = ar(l)\n l=l+1\n else\n tmp(t) = ar(r)\n r=r+1\n end if\n t=t+1\n end do\n \n if (r > lst) then\n tmp(t:) = ar(l:mdl)\n else\n tmp(t:) = ar(r:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\nend subroutine\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1477, "cpu_time_ms": 67, "memory_kb": 2740}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s779975048", "group_id": "codeNet:p02780", "input_text": "program main\n\n implicit none\n\n integer :: n, k\n integer,allocatable :: p(:)\n real ,allocatable :: h(:)\n real ,allocatable :: sh(:)\n integer :: i, j \n \n read(*,*) n, k\n allocate( p(n) )\n allocate( h(n) )\n read(*,*) p\n\n h = 0e0 \n do i = 1, n\n do j = 1, p(i)\n h(i) = h(i) + j \n end do\n h(i) = h(i) / p(i) \n end do\n\n allocate( sh(n-k+1) )\n do i = 1, n-k+1\n sh(i) = sum( h(i:i+k-1) )\n end do\n \n print*, maxval( sh )\nend program main\n\nrecursive subroutine quicksort1(a, first, last)\n !call quicksort1( a, 1, n ) \n implicit none\n integer(8),intent(inout)::a(*)\n integer,intent(in)::first,last\n !\n ! Original\n ! https://gist.github.com/t-nissie/479f0f16966925fa29ea\n !\n integer(8)::x,t\n integer::i,j\n\n x = a((first+last)/2)\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i)\n a(i) = a(j)\n a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i-1) call quicksort1(a, first, i-1)\n if (j+1 < last) call quicksort1(a, j+1, last)\n\n return\nend subroutine quicksort1\n", "language": "Fortran", "metadata": {"date": 1581280297, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02780.html", "problem_id": "p02780", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02780/input.txt", "sample_output_relpath": "derived/input_output/data/p02780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02780/Fortran/s779975048.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s779975048", "user_id": "u675314298"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "program main\n\n implicit none\n\n integer :: n, k\n integer,allocatable :: p(:)\n real ,allocatable :: h(:)\n real ,allocatable :: sh(:)\n integer :: i, j \n \n read(*,*) n, k\n allocate( p(n) )\n allocate( h(n) )\n read(*,*) p\n\n h = 0e0 \n do i = 1, n\n do j = 1, p(i)\n h(i) = h(i) + j \n end do\n h(i) = h(i) / p(i) \n end do\n\n allocate( sh(n-k+1) )\n do i = 1, n-k+1\n sh(i) = sum( h(i:i+k-1) )\n end do\n \n print*, maxval( sh )\nend program main\n\nrecursive subroutine quicksort1(a, first, last)\n !call quicksort1( a, 1, n ) \n implicit none\n integer(8),intent(inout)::a(*)\n integer,intent(in)::first,last\n !\n ! Original\n ! https://gist.github.com/t-nissie/479f0f16966925fa29ea\n !\n integer(8)::x,t\n integer::i,j\n\n x = a((first+last)/2)\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i)\n a(i) = a(j)\n a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i-1) call quicksort1(a, first, i-1)\n if (j+1 < last) call quicksort1(a, j+1, last)\n\n return\nend subroutine quicksort1\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "sample_input": "5 3\n1 2 2 4 5\n"}, "reference_outputs": ["7.000000000000\n"], "source_document_id": "p02780", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.\n\nWe will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.\n\nConstraints\n\n1 ≤ K ≤ N ≤ 200000\n\n1 ≤ p_i ≤ 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\n\nOutput\n\nPrint the maximum possible value of the expected value of the sum of the numbers shown.\n\nYour output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n5 3\n1 2 2 4 5\n\nSample Output 1\n\n7.000000000000\n\nWhen we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.\n\nSample Input 2\n\n4 1\n6 6 6 6\n\nSample Output 2\n\n3.500000000000\n\nRegardless of which die we choose, the expected value of the number shown is 3.5.\n\nSample Input 3\n\n10 4\n17 13 13 12 15 20 10 13 17 11\n\nSample Output 3\n\n32.000000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1133, "cpu_time_ms": 2103, "memory_kb": 3200}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s003612245", "group_id": "codeNet:p02783", "input_text": "program prob9\n implicit none\n integer :: h,a\n read(*,*) h, a\n\n write(*,*) (h-1) / a + 1\n\n stop\ncontains\nend program prob9", "language": "Fortran", "metadata": {"date": 1592604431, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Fortran/s003612245.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s003612245", "user_id": "u478462004"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program prob9\n implicit none\n integer :: h,a\n read(*,*) h, a\n\n write(*,*) (h-1) / a + 1\n\n stop\ncontains\nend program prob9", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 136, "cpu_time_ms": 13, "memory_kb": 2820}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s664558959", "group_id": "codeNet:p02783", "input_text": "program main\n implicit none\n integer :: h, a\n read *, h, a\n print \"(i0)\", ceiling(h / dble(a))\nend program main\n", "language": "Fortran", "metadata": {"date": 1587574364, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Fortran/s664558959.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s664558959", "user_id": "u388927326"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n implicit none\n integer :: h, a\n read *, h, a\n print \"(i0)\", ceiling(h / dble(a))\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 116, "cpu_time_ms": 4, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s197863113", "group_id": "codeNet:p02783", "input_text": "program example\n\timplicit none\n\n\tinteger :: H,A,i=0\n \n read(*,*)H,A\n \n do \n \n \tif (H-A>0) then\n \tH=H-A\n i=i+1\n else\n \ti=i+1\n \texit\n end if\n end do\n \n write(*,*) i\n\nend program example", "language": "Fortran", "metadata": {"date": 1583597509, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Fortran/s197863113.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s197863113", "user_id": "u374107737"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program example\n\timplicit none\n\n\tinteger :: H,A,i=0\n \n read(*,*)H,A\n \n do \n \n \tif (H-A>0) then\n \tH=H-A\n i=i+1\n else\n \ti=i+1\n \texit\n end if\n end do\n \n write(*,*) i\n\nend program example", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 256, "cpu_time_ms": 4, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s132922169", "group_id": "codeNet:p02783", "input_text": "read*,i,j\nprint\"(i0)\",(i-1)/j+1\nend", "language": "Fortran", "metadata": {"date": 1582564384, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Fortran/s132922169.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s132922169", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "read*,i,j\nprint\"(i0)\",(i-1)/j+1\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 35, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s427519123", "group_id": "codeNet:p02783", "input_text": "program serval_monstar\n\nimplicit none\ninteger :: i\nreal(8) :: h,a\nread(*,*) h,a\ni = ceiling(h/a)\nwrite(*,*)i\n\nend program serval_monstar", "language": "Fortran", "metadata": {"date": 1580069771, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02783.html", "problem_id": "p02783", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02783/input.txt", "sample_output_relpath": "derived/input_output/data/p02783/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02783/Fortran/s427519123.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s427519123", "user_id": "u439212411"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program serval_monstar\n\nimplicit none\ninteger :: i\nreal(8) :: h,a\nread(*,*) h,a\ni = ceiling(h/a)\nwrite(*,*)i\n\nend program serval_monstar", "problem_context": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "sample_input": "10 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02783", "source_text": "Score : 100 points\n\nProblem Statement\n\nServal is fighting with a monster.\n\nThe health of the monster is H.\n\nIn one attack, Serval can decrease the monster's health by A.\nThere is no other way to decrease the monster's health.\n\nServal wins when the monster's health becomes 0 or below.\n\nFind the number of attacks Serval needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^4\n\n1 \\leq A \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH A\n\nOutput\n\nPrint the number of attacks Serval needs to make before winning.\n\nSample Input 1\n\n10 4\n\nSample Output 1\n\n3\n\nAfter one attack, the monster's health will be 6.\n\nAfter two attacks, the monster's health will be 2.\n\nAfter three attacks, the monster's health will be -2.\n\nThus, Serval needs to make three attacks to win.\n\nSample Input 2\n\n1 10000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10000 1\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 136, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s339873540", "group_id": "codeNet:p02785", "input_text": "program abc63\n implicit none\n integer(8)::N,K,ia,ib,ic,id,swap,c=0\n integer(8),allocatable::H(:)\n read(*,*)N,K\n allocate(H(N))\n read(*,*)(H(ia),ia=1,N)\n do ib=1,N-1\n do ic=1,N-ib\n if(H(ic)= j) exit\n t = a(i)\n a(i) = a(j)\n a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i-1) call quicksort1(a, first, i-1)\n if (j+1 < last) call quicksort1(a, j+1, last)\n\n return\nend subroutine quicksort1\n", "language": "Fortran", "metadata": {"date": 1588771779, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02785.html", "problem_id": "p02785", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02785/input.txt", "sample_output_relpath": "derived/input_output/data/p02785/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02785/Fortran/s188070309.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s188070309", "user_id": "u353721260"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program main\n implicit none\n integer(4) :: n, k, i\n integer(8), allocatable :: h(:)\n integer(16) :: cnt\n\n read *, n, k\n allocate( h(n) )\n read *, h\n\n call quicksort1(h,1,n)\n\n n=n-k\n cnt = 0\n do i = 1, n\n cnt = cnt+h(i)\n end do\n print *, cnt\n\nend program main\nrecursive subroutine quicksort1(a, first, last)\n implicit none\n integer(8),intent(inout)::a(*)\n integer,intent(in)::first,last\n !\n ! Original\n ! https://gist.github.com/t-nissie/479f0f16966925fa29ea\n !\n integer(8)::x,t\n integer::i,j\n\n x = a((first+last)/2)\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i)\n a(i) = a(j)\n a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i-1) call quicksort1(a, first, i-1)\n if (j+1 < last) call quicksort1(a, j+1, last)\n\n return\nend subroutine quicksort1\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFennec is fighting with N monsters.\n\nThe health of the i-th monster is H_i.\n\nFennec can do the following two actions:\n\nAttack: Fennec chooses one monster. That monster's health will decrease by 1.\n\nSpecial Move: Fennec chooses one monster. That monster's health will become 0.\n\nThere is no way other than Attack and Special Move to decrease the monsters' health.\n\nFennec wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 2 \\times 10^5\n\n1 \\leq H_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nH_1 ... H_N\n\nOutput\n\nPrint the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.\n\nSample Input 1\n\n3 1\n4 1 5\n\nSample Output 1\n\n5\n\nBy using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.\n\nSample Input 2\n\n8 9\n7 9 3 2 3 8 4 6\n\nSample Output 2\n\n0\n\nShe can use Special Move on all the monsters.\n\nSample Input 3\n\n3 0\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "sample_input": "3 1\n4 1 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02785", "source_text": "Score : 300 points\n\nProblem Statement\n\nFennec is fighting with N monsters.\n\nThe health of the i-th monster is H_i.\n\nFennec can do the following two actions:\n\nAttack: Fennec chooses one monster. That monster's health will decrease by 1.\n\nSpecial Move: Fennec chooses one monster. That monster's health will become 0.\n\nThere is no way other than Attack and Special Move to decrease the monsters' health.\n\nFennec wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 2 \\times 10^5\n\n1 \\leq H_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nH_1 ... H_N\n\nOutput\n\nPrint the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.\n\nSample Input 1\n\n3 1\n4 1 5\n\nSample Output 1\n\n5\n\nBy using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.\n\nSample Input 2\n\n8 9\n7 9 3 2 3 8 4 6\n\nSample Output 2\n\n0\n\nShe can use Special Move on all the monsters.\n\nSample Input 3\n\n3 0\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 961, "cpu_time_ms": 82, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s871339816", "group_id": "codeNet:p02785", "input_text": "program main\n implicit none\n integer :: n, i, k\n integer(8), allocatable :: h(:)\n read (*, *) n, k\n allocate (h(n))\n read (*, *) h(:)\n call quicksort(h)\n if (k >= n) then\n write (*, \"(i0)\") 0\n else\n write (*, \"(i0)\") sum(h(1:n - k))\n end if\n\n contains\n\n recursive subroutine quicksort(a)\n integer(8), intent(inout) :: a(:)\n integer(8) :: pivot, i, j, k, tmp, n\n real(4) :: r\n n = size(a)\n if (n <= 1) return\n i = 1\n j = n\n call random_number(r)\n k = 1 + floor(r * n)\n k = max(1, min(k, n))\n pivot = a(k)\n do\n do while (.not. pivot <= a(i))\n i = i + 1\n end do\n do while (.not. a(j) <= pivot)\n j = j - 1\n end do\n if (i >= j) exit\n tmp = a(i)\n a(i) = a(j)\n a(j) = tmp\n i = i + 1\n j = j - 1\n end do\n call quicksort(a(1:i - 1))\n call quicksort(a(j + 1:n))\n end subroutine quicksort\nend program main\n", "language": "Fortran", "metadata": {"date": 1582379317, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02785.html", "problem_id": "p02785", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02785/input.txt", "sample_output_relpath": "derived/input_output/data/p02785/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02785/Fortran/s871339816.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s871339816", "user_id": "u388927326"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, i, k\n integer(8), allocatable :: h(:)\n read (*, *) n, k\n allocate (h(n))\n read (*, *) h(:)\n call quicksort(h)\n if (k >= n) then\n write (*, \"(i0)\") 0\n else\n write (*, \"(i0)\") sum(h(1:n - k))\n end if\n\n contains\n\n recursive subroutine quicksort(a)\n integer(8), intent(inout) :: a(:)\n integer(8) :: pivot, i, j, k, tmp, n\n real(4) :: r\n n = size(a)\n if (n <= 1) return\n i = 1\n j = n\n call random_number(r)\n k = 1 + floor(r * n)\n k = max(1, min(k, n))\n pivot = a(k)\n do\n do while (.not. pivot <= a(i))\n i = i + 1\n end do\n do while (.not. a(j) <= pivot)\n j = j - 1\n end do\n if (i >= j) exit\n tmp = a(i)\n a(i) = a(j)\n a(j) = tmp\n i = i + 1\n j = j - 1\n end do\n call quicksort(a(1:i - 1))\n call quicksort(a(j + 1:n))\n end subroutine quicksort\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFennec is fighting with N monsters.\n\nThe health of the i-th monster is H_i.\n\nFennec can do the following two actions:\n\nAttack: Fennec chooses one monster. That monster's health will decrease by 1.\n\nSpecial Move: Fennec chooses one monster. That monster's health will become 0.\n\nThere is no way other than Attack and Special Move to decrease the monsters' health.\n\nFennec wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 2 \\times 10^5\n\n1 \\leq H_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nH_1 ... H_N\n\nOutput\n\nPrint the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.\n\nSample Input 1\n\n3 1\n4 1 5\n\nSample Output 1\n\n5\n\nBy using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.\n\nSample Input 2\n\n8 9\n7 9 3 2 3 8 4 6\n\nSample Output 2\n\n0\n\nShe can use Special Move on all the monsters.\n\nSample Input 3\n\n3 0\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "sample_input": "3 1\n4 1 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02785", "source_text": "Score : 300 points\n\nProblem Statement\n\nFennec is fighting with N monsters.\n\nThe health of the i-th monster is H_i.\n\nFennec can do the following two actions:\n\nAttack: Fennec chooses one monster. That monster's health will decrease by 1.\n\nSpecial Move: Fennec chooses one monster. That monster's health will become 0.\n\nThere is no way other than Attack and Special Move to decrease the monsters' health.\n\nFennec wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 2 \\times 10^5\n\n1 \\leq H_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nH_1 ... H_N\n\nOutput\n\nPrint the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.\n\nSample Input 1\n\n3 1\n4 1 5\n\nSample Output 1\n\n5\n\nBy using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.\n\nSample Input 2\n\n8 9\n7 9 3 2 3 8 4 6\n\nSample Output 2\n\n0\n\nShe can use Special Move on all the monsters.\n\nSample Input 3\n\n3 0\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 922, "cpu_time_ms": 88, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s597446434", "group_id": "codeNet:p02785", "input_text": "program main\n\n implicit none\n\n integer :: n, k, i, j\n integer(8),allocatable :: h(:)\n integer(8) :: sumh\n \n read(*,*) n,k\n allocate( h(n) )\n read(*,*) h\n call quicksort1( h, 1, n ) \n\n sumh = 0\n\n if( n - k > 0 ) then\n do i = 1 ,n-k\n sumh = sumh + h(i)\n end do\n end if\n\n write(*,*) sumh\n\nend program main\n\nrecursive subroutine quicksort1(a, first, last)\n implicit none\n integer(8),intent(inout)::a(*)\n integer,intent(in)::first,last\n !\n ! Original\n ! https://gist.github.com/t-nissie/479f0f16966925fa29ea\n !\n integer(8)::x,t\n integer::i,j\n\n x = a((first+last)/2)\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i)\n a(i) = a(j)\n a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i-1) call quicksort1(a, first, i-1)\n if (j+1 < last) call quicksort1(a, j+1, last)\n\n return\nend subroutine quicksort1\n", "language": "Fortran", "metadata": {"date": 1580223718, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02785.html", "problem_id": "p02785", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02785/input.txt", "sample_output_relpath": "derived/input_output/data/p02785/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02785/Fortran/s597446434.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s597446434", "user_id": "u675314298"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program main\n\n implicit none\n\n integer :: n, k, i, j\n integer(8),allocatable :: h(:)\n integer(8) :: sumh\n \n read(*,*) n,k\n allocate( h(n) )\n read(*,*) h\n call quicksort1( h, 1, n ) \n\n sumh = 0\n\n if( n - k > 0 ) then\n do i = 1 ,n-k\n sumh = sumh + h(i)\n end do\n end if\n\n write(*,*) sumh\n\nend program main\n\nrecursive subroutine quicksort1(a, first, last)\n implicit none\n integer(8),intent(inout)::a(*)\n integer,intent(in)::first,last\n !\n ! Original\n ! https://gist.github.com/t-nissie/479f0f16966925fa29ea\n !\n integer(8)::x,t\n integer::i,j\n\n x = a((first+last)/2)\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i)\n a(i) = a(j)\n a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i-1) call quicksort1(a, first, i-1)\n if (j+1 < last) call quicksort1(a, j+1, last)\n\n return\nend subroutine quicksort1\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFennec is fighting with N monsters.\n\nThe health of the i-th monster is H_i.\n\nFennec can do the following two actions:\n\nAttack: Fennec chooses one monster. That monster's health will decrease by 1.\n\nSpecial Move: Fennec chooses one monster. That monster's health will become 0.\n\nThere is no way other than Attack and Special Move to decrease the monsters' health.\n\nFennec wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 2 \\times 10^5\n\n1 \\leq H_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nH_1 ... H_N\n\nOutput\n\nPrint the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.\n\nSample Input 1\n\n3 1\n4 1 5\n\nSample Output 1\n\n5\n\nBy using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.\n\nSample Input 2\n\n8 9\n7 9 3 2 3 8 4 6\n\nSample Output 2\n\n0\n\nShe can use Special Move on all the monsters.\n\nSample Input 3\n\n3 0\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "sample_input": "3 1\n4 1 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02785", "source_text": "Score : 300 points\n\nProblem Statement\n\nFennec is fighting with N monsters.\n\nThe health of the i-th monster is H_i.\n\nFennec can do the following two actions:\n\nAttack: Fennec chooses one monster. That monster's health will decrease by 1.\n\nSpecial Move: Fennec chooses one monster. That monster's health will become 0.\n\nThere is no way other than Attack and Special Move to decrease the monsters' health.\n\nFennec wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 2 \\times 10^5\n\n1 \\leq H_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nH_1 ... H_N\n\nOutput\n\nPrint the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.\n\nSample Input 1\n\n3 1\n4 1 5\n\nSample Output 1\n\n5\n\nBy using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.\n\nSample Input 2\n\n8 9\n7 9 3 2 3 8 4 6\n\nSample Output 2\n\n0\n\nShe can use Special Move on all the monsters.\n\nSample Input 3\n\n3 0\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 961, "cpu_time_ms": 81, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s386475846", "group_id": "codeNet:p02785", "input_text": "!\n! The below module was made in reference to \n! https://ufcpp.net/study/algorithm/col_heap.html\n!\nmodule heappq\n \n implicit none\n integer(8),allocatable :: hp(:)\n\ncontains \nsubroutine heapinit(n)\n \n integer, intent(in) :: n\n\n allocate( hp(n) ); hp = 0\n\nend subroutine heapinit\n\nsubroutine heappush( newnp, newn )\n \n integer, intent(in) :: newn\n integer(8), intent(in) :: newnp\n integer :: i,ln\n integer(8) :: tmp\n \n ln = newn\n hp(ln) = newnp\n \n do while ( ln /= 1 )\n i = ln/2\n if ( hp(i) < hp(ln) ) then\n tmp = hp(ln) \n hp(ln) = hp(i) \n hp(i) = tmp \n end if\n ln = i\n end do\n\nend subroutine heappush\n \nend module heappq\n\nprogram main\n \n use heappq\n\n implicit none\n\n integer :: n, k, i, j\n integer(8),allocatable :: h(:)\n \n read(*,*) n,k\n allocate( h(n) )\n read(*,*) h\n\n if ( k >= n ) then \n print*, \"0\"\n else if ( k == 0 ) then\n print*, sum(h)\n else\n\n call heapinit(n) \n\n do i = 1, n\n call heappush( h(i), i )\n end do\n\n h = hp\n print*, h\n \n if( mod( k, 2 ) == 0 ) then\n print*, sum( h(1:k) ) \n else\n if( h(k) >= h(k+1)) then\n print*, sum( h(1:k) ) \n else\n print*, sum( h(1:k+1) ) - h(k) \n end if\n end if\n\n end if\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1580071683, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02785.html", "problem_id": "p02785", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02785/input.txt", "sample_output_relpath": "derived/input_output/data/p02785/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02785/Fortran/s386475846.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s386475846", "user_id": "u675314298"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "!\n! The below module was made in reference to \n! https://ufcpp.net/study/algorithm/col_heap.html\n!\nmodule heappq\n \n implicit none\n integer(8),allocatable :: hp(:)\n\ncontains \nsubroutine heapinit(n)\n \n integer, intent(in) :: n\n\n allocate( hp(n) ); hp = 0\n\nend subroutine heapinit\n\nsubroutine heappush( newnp, newn )\n \n integer, intent(in) :: newn\n integer(8), intent(in) :: newnp\n integer :: i,ln\n integer(8) :: tmp\n \n ln = newn\n hp(ln) = newnp\n \n do while ( ln /= 1 )\n i = ln/2\n if ( hp(i) < hp(ln) ) then\n tmp = hp(ln) \n hp(ln) = hp(i) \n hp(i) = tmp \n end if\n ln = i\n end do\n\nend subroutine heappush\n \nend module heappq\n\nprogram main\n \n use heappq\n\n implicit none\n\n integer :: n, k, i, j\n integer(8),allocatable :: h(:)\n \n read(*,*) n,k\n allocate( h(n) )\n read(*,*) h\n\n if ( k >= n ) then \n print*, \"0\"\n else if ( k == 0 ) then\n print*, sum(h)\n else\n\n call heapinit(n) \n\n do i = 1, n\n call heappush( h(i), i )\n end do\n\n h = hp\n print*, h\n \n if( mod( k, 2 ) == 0 ) then\n print*, sum( h(1:k) ) \n else\n if( h(k) >= h(k+1)) then\n print*, sum( h(1:k) ) \n else\n print*, sum( h(1:k+1) ) - h(k) \n end if\n end if\n\n end if\n\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFennec is fighting with N monsters.\n\nThe health of the i-th monster is H_i.\n\nFennec can do the following two actions:\n\nAttack: Fennec chooses one monster. That monster's health will decrease by 1.\n\nSpecial Move: Fennec chooses one monster. That monster's health will become 0.\n\nThere is no way other than Attack and Special Move to decrease the monsters' health.\n\nFennec wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 2 \\times 10^5\n\n1 \\leq H_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nH_1 ... H_N\n\nOutput\n\nPrint the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.\n\nSample Input 1\n\n3 1\n4 1 5\n\nSample Output 1\n\n5\n\nBy using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.\n\nSample Input 2\n\n8 9\n7 9 3 2 3 8 4 6\n\nSample Output 2\n\n0\n\nShe can use Special Move on all the monsters.\n\nSample Input 3\n\n3 0\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "sample_input": "3 1\n4 1 5\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02785", "source_text": "Score : 300 points\n\nProblem Statement\n\nFennec is fighting with N monsters.\n\nThe health of the i-th monster is H_i.\n\nFennec can do the following two actions:\n\nAttack: Fennec chooses one monster. That monster's health will decrease by 1.\n\nSpecial Move: Fennec chooses one monster. That monster's health will become 0.\n\nThere is no way other than Attack and Special Move to decrease the monsters' health.\n\nFennec wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 2 \\times 10^5\n\n1 \\leq H_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nH_1 ... H_N\n\nOutput\n\nPrint the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.\n\nSample Input 1\n\n3 1\n4 1 5\n\nSample Output 1\n\n5\n\nBy using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.\n\nSample Input 2\n\n8 9\n7 9 3 2 3 8 4 6\n\nSample Output 2\n\n0\n\nShe can use Special Move on all the monsters.\n\nSample Input 3\n\n3 0\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1273, "cpu_time_ms": 122, "memory_kb": 8576}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s855421863", "group_id": "codeNet:p02786", "input_text": "program main\n implicit none\n integer(8)::h, at_num, at_all\n read*,h\n at_num = 1\n at_all = 0\n do while(h > 1)\n at_all = at_all + at_num\n h = h / 2\n at_num = at_num * 2\n end do\n at_all = at_all + at_num\n\n print*, at_all\n\nend program main", "language": "Fortran", "metadata": {"date": 1580222366, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02786.html", "problem_id": "p02786", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02786/input.txt", "sample_output_relpath": "derived/input_output/data/p02786/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02786/Fortran/s855421863.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s855421863", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n implicit none\n integer(8)::h, at_num, at_all\n read*,h\n at_num = 1\n at_all = 0\n do while(h > 1)\n at_all = at_all + at_num\n h = h / 2\n at_num = at_num * 2\n end do\n at_all = at_all + at_num\n\n print*, at_all\n\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nCaracal is fighting with a monster.\n\nThe health of the monster is H.\n\nCaracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens:\n\nIf the monster's health is 1, it drops to 0.\n\nIf the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \\lfloor X/2 \\rfloor.\n\n(\\lfloor r \\rfloor denotes the greatest integer not exceeding r.)\n\nCaracal wins when the healths of all existing monsters become 0 or below.\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH\n\nOutput\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n3\n\nWhen Caracal attacks the initial monster, it disappears, and two monsters appear, each with the health of 1.\n\nThen, Caracal can attack each of these new monsters once and win with a total of three attacks.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n1000000000000\n\nSample Output 3\n\n1099511627775", "sample_input": "2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02786", "source_text": "Score : 400 points\n\nProblem Statement\n\nCaracal is fighting with a monster.\n\nThe health of the monster is H.\n\nCaracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens:\n\nIf the monster's health is 1, it drops to 0.\n\nIf the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \\lfloor X/2 \\rfloor.\n\n(\\lfloor r \\rfloor denotes the greatest integer not exceeding r.)\n\nCaracal wins when the healths of all existing monsters become 0 or below.\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH\n\nOutput\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n3\n\nWhen Caracal attacks the initial monster, it disappears, and two monsters appear, each with the health of 1.\n\nThen, Caracal can attack each of these new monsters once and win with a total of three attacks.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n1000000000000\n\nSample Output 3\n\n1099511627775", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 283, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s513901136", "group_id": "codeNet:p02786", "input_text": "program main\n\n implicit none\n\n integer(8) :: h, i, n, num\n \n read(*,*) h\n\n if( h == 1 ) then\n print*, \"0\"\n stop\n else if( h == 3 ) then\n print*, \"1\"\n stop\n end if\n\n n = 0 \n do \n h = int( h / 2, kind=8 )\n n = n + 1\n if( h < 2 ) exit\n end do\n\n num = 1\n do i = 1, n\n num = num + 2**i\n end do\n\n print*, num\n\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1580074926, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02786.html", "problem_id": "p02786", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02786/input.txt", "sample_output_relpath": "derived/input_output/data/p02786/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02786/Fortran/s513901136.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s513901136", "user_id": "u675314298"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n\n implicit none\n\n integer(8) :: h, i, n, num\n \n read(*,*) h\n\n if( h == 1 ) then\n print*, \"0\"\n stop\n else if( h == 3 ) then\n print*, \"1\"\n stop\n end if\n\n n = 0 \n do \n h = int( h / 2, kind=8 )\n n = n + 1\n if( h < 2 ) exit\n end do\n\n num = 1\n do i = 1, n\n num = num + 2**i\n end do\n\n print*, num\n\n\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nCaracal is fighting with a monster.\n\nThe health of the monster is H.\n\nCaracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens:\n\nIf the monster's health is 1, it drops to 0.\n\nIf the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \\lfloor X/2 \\rfloor.\n\n(\\lfloor r \\rfloor denotes the greatest integer not exceeding r.)\n\nCaracal wins when the healths of all existing monsters become 0 or below.\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH\n\nOutput\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n3\n\nWhen Caracal attacks the initial monster, it disappears, and two monsters appear, each with the health of 1.\n\nThen, Caracal can attack each of these new monsters once and win with a total of three attacks.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n1000000000000\n\nSample Output 3\n\n1099511627775", "sample_input": "2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02786", "source_text": "Score : 400 points\n\nProblem Statement\n\nCaracal is fighting with a monster.\n\nThe health of the monster is H.\n\nCaracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens:\n\nIf the monster's health is 1, it drops to 0.\n\nIf the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \\lfloor X/2 \\rfloor.\n\n(\\lfloor r \\rfloor denotes the greatest integer not exceeding r.)\n\nCaracal wins when the healths of all existing monsters become 0 or below.\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH\n\nOutput\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n3\n\nWhen Caracal attacks the initial monster, it disappears, and two monsters appear, each with the health of 1.\n\nThen, Caracal can attack each of these new monsters once and win with a total of three attacks.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n1000000000000\n\nSample Output 3\n\n1099511627775", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 365, "cpu_time_ms": 7, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s838545774", "group_id": "codeNet:p02786", "input_text": "program main\n\n implicit none\n\n integer(8) :: h, i, n, num\n \n read(*,*) h\n if( h == 1 ) then\n print*, \"0\"\n stop\n end if\n n = 0 \n do \n n = n + 1\n h = h / 2\n if( h <= 1 ) exit\n end do\n\n num = 1\n do i = 1, n\n num = num + 2**i\n end do\n\n print*, num\n\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1580074075, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02786.html", "problem_id": "p02786", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02786/input.txt", "sample_output_relpath": "derived/input_output/data/p02786/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02786/Fortran/s838545774.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s838545774", "user_id": "u675314298"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n\n implicit none\n\n integer(8) :: h, i, n, num\n \n read(*,*) h\n if( h == 1 ) then\n print*, \"0\"\n stop\n end if\n n = 0 \n do \n n = n + 1\n h = h / 2\n if( h <= 1 ) exit\n end do\n\n num = 1\n do i = 1, n\n num = num + 2**i\n end do\n\n print*, num\n\n\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nCaracal is fighting with a monster.\n\nThe health of the monster is H.\n\nCaracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens:\n\nIf the monster's health is 1, it drops to 0.\n\nIf the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \\lfloor X/2 \\rfloor.\n\n(\\lfloor r \\rfloor denotes the greatest integer not exceeding r.)\n\nCaracal wins when the healths of all existing monsters become 0 or below.\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH\n\nOutput\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n3\n\nWhen Caracal attacks the initial monster, it disappears, and two monsters appear, each with the health of 1.\n\nThen, Caracal can attack each of these new monsters once and win with a total of three attacks.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n1000000000000\n\nSample Output 3\n\n1099511627775", "sample_input": "2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02786", "source_text": "Score : 400 points\n\nProblem Statement\n\nCaracal is fighting with a monster.\n\nThe health of the monster is H.\n\nCaracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens:\n\nIf the monster's health is 1, it drops to 0.\n\nIf the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \\lfloor X/2 \\rfloor.\n\n(\\lfloor r \\rfloor denotes the greatest integer not exceeding r.)\n\nCaracal wins when the healths of all existing monsters become 0 or below.\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nConstraints\n\n1 \\leq H \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH\n\nOutput\n\nFind the minimum number of attacks Caracal needs to make before winning.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n3\n\nWhen Caracal attacks the initial monster, it disappears, and two monsters appear, each with the health of 1.\n\nThen, Caracal can attack each of these new monsters once and win with a total of three attacks.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n1000000000000\n\nSample Output 3\n\n1099511627775", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 299, "cpu_time_ms": 4, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s074283890", "group_id": "codeNet:p02788", "input_text": "program silver_fox_vs_monster\n implicit none\n integer(8), parameter :: inf = 1001001001001_8\n integer :: n, i, l, r, m\n integer(8) :: d, a, x(0:200001,2) = 0, y(0:200001,2) = 0, p1 = 0, p2 = 0, t\n read(*,*) n, d, a\n do i = 1, n\n read(*,*) x(i,:)\n end do\n call merge_sort(x(1:n,:))\n x(0,1) = -inf\n x(n+1,1) = inf\n y = x\n i = 1\n do while (i <= n)\n do while (x(i,2) <= 0 .and. i <= n)\n i = i+1\n end do\n if (i > n) exit\n l = i\n r = n+1\n do while (r-l > 1)\n m = (l+r)/2\n if (x(m,1) > x(i,1)+d*2) then\n r = m\n else\n l = m\n end if\n end do\n t = (x(i,2)+a-1)/a\n p1 = p1+t\n x(i:l,2) = x(i:l,2)-t*a\n end do\n x = y\n i = n\n do while (i >= 1)\n do while (x(i,2) <= 0 .and. i >= 1)\n i = i-1\n end do\n if (i < 1) exit\n l = 0\n r = i\n do while (r-l > 1)\n m = (l+r)/2\n if (x(m,1) < x(i,1)-d*2) then\n l = m\n else\n r = m\n end if\n end do\n t = (x(i,2)+a-1)/a\n p2 = p2+t\n x(r:i,2) = x(r:i,2)-t*a\n end do\n write(*,'(i0)') min(p1,p2)\ncontains\n subroutine merge_sort(a)\n integer(8), intent(inout) :: a(:,:)\n integer :: n, m, l, i, u\n n = size(a,1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m/2\n u = min(2*i*l,n)\n call merger(a(2*(i-1)*l+1:(2*i-1)*l,:),a((2*i-1)*l+1:u,:))\n end do\n l = 2*l\n m = (m+1)/2\n end do\n end\n subroutine merger(a1,a2)\n integer(8), intent(inout) :: a1(:,:), a2(:,:)\n integer(8) :: a(size(a1,1)+size(a2,1),size(a1,2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1,1)\n n2 = size(a2,1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (a1(i1,1) < a2(i2,1)) then\n a(i1+i2-1,:) = a1(i1,:)\n i1 = i1+1\n else\n a(i1+i2-1,:) = a2(i2,:)\n i2 = i2+1\n end if\n end do\n if (i1 <= n1) then\n a(i1+i2-1:n1+n2,:) = a1(i1:n1,:)\n else\n a(i1+i2-1:n1+n2,:) = a2(i2:n2,:)\n end if\n a1 = a(1:n1,:)\n a2 = a(n1+1:n1+n2,:)\n end\nend program silver_fox_vs_monster", "language": "Fortran", "metadata": {"date": 1580073523, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02788.html", "problem_id": "p02788", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02788/input.txt", "sample_output_relpath": "derived/input_output/data/p02788/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02788/Fortran/s074283890.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s074283890", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program silver_fox_vs_monster\n implicit none\n integer(8), parameter :: inf = 1001001001001_8\n integer :: n, i, l, r, m\n integer(8) :: d, a, x(0:200001,2) = 0, y(0:200001,2) = 0, p1 = 0, p2 = 0, t\n read(*,*) n, d, a\n do i = 1, n\n read(*,*) x(i,:)\n end do\n call merge_sort(x(1:n,:))\n x(0,1) = -inf\n x(n+1,1) = inf\n y = x\n i = 1\n do while (i <= n)\n do while (x(i,2) <= 0 .and. i <= n)\n i = i+1\n end do\n if (i > n) exit\n l = i\n r = n+1\n do while (r-l > 1)\n m = (l+r)/2\n if (x(m,1) > x(i,1)+d*2) then\n r = m\n else\n l = m\n end if\n end do\n t = (x(i,2)+a-1)/a\n p1 = p1+t\n x(i:l,2) = x(i:l,2)-t*a\n end do\n x = y\n i = n\n do while (i >= 1)\n do while (x(i,2) <= 0 .and. i >= 1)\n i = i-1\n end do\n if (i < 1) exit\n l = 0\n r = i\n do while (r-l > 1)\n m = (l+r)/2\n if (x(m,1) < x(i,1)-d*2) then\n l = m\n else\n r = m\n end if\n end do\n t = (x(i,2)+a-1)/a\n p2 = p2+t\n x(r:i,2) = x(r:i,2)-t*a\n end do\n write(*,'(i0)') min(p1,p2)\ncontains\n subroutine merge_sort(a)\n integer(8), intent(inout) :: a(:,:)\n integer :: n, m, l, i, u\n n = size(a,1)\n m = n\n l = 1\n do while (m > 1)\n do i = 1, m/2\n u = min(2*i*l,n)\n call merger(a(2*(i-1)*l+1:(2*i-1)*l,:),a((2*i-1)*l+1:u,:))\n end do\n l = 2*l\n m = (m+1)/2\n end do\n end\n subroutine merger(a1,a2)\n integer(8), intent(inout) :: a1(:,:), a2(:,:)\n integer(8) :: a(size(a1,1)+size(a2,1),size(a1,2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(a1,1)\n n2 = size(a2,1)\n do while (i1 <= n1 .and. i2 <= n2)\n if (a1(i1,1) < a2(i2,1)) then\n a(i1+i2-1,:) = a1(i1,:)\n i1 = i1+1\n else\n a(i1+i2-1,:) = a2(i2,:)\n i2 = i2+1\n end if\n end do\n if (i1 <= n1) then\n a(i1+i2-1:n1+n2,:) = a1(i1:n1,:)\n else\n a(i1+i2-1:n1+n2,:) = a2(i2:n2,:)\n end if\n a1 = a(1:n1,:)\n a2 = a(n1+1:n1+n2,:)\n end\nend program silver_fox_vs_monster", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSilver Fox is fighting with N monsters.\n\nThe monsters are standing in a row, and we can assume them to be standing on a number line. The i-th monster, standing at the coordinate X_i, has the health of H_i.\n\nSilver Fox can use bombs to attack the monsters.\nUsing a bomb at the coordinate x decreases the healths of all monsters between the coordinates x-D and x+D (inclusive) by A.\nThere is no way other than bombs to decrease the monster's health.\n\nSilver Fox wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of bombs needed to win.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq D \\leq 10^9\n\n1 \\leq A \\leq 10^9\n\n0 \\leq X_i \\leq 10^9\n\n1 \\leq H_i \\leq 10^9\n\nX_i are distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D A\nX_1 H_1\n:\nX_N H_N\n\nOutput\n\nPrint the minimum number of bombs needed to win.\n\nSample Input 1\n\n3 3 2\n1 2\n5 4\n9 2\n\nSample Output 1\n\n2\n\nFirst, let us use a bomb at the coordinate 4 to decrease the first and second monsters' health by 2.\n\nThen, use a bomb at the coordinate 6 to decrease the second and third monsters' health by 2.\n\nNow, all the monsters' healths are 0.\nWe cannot make all the monsters' health drop to 0 or below with just one bomb.\n\nSample Input 2\n\n9 4 1\n1 5\n2 4\n3 3\n4 2\n5 1\n6 2\n7 3\n8 4\n9 5\n\nSample Output 2\n\n5\n\nWe should use five bombs at the coordinate 5.\n\nSample Input 3\n\n3 0 1\n300000000 1000000000\n100000000 1000000000\n200000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "sample_input": "3 3 2\n1 2\n5 4\n9 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02788", "source_text": "Score : 600 points\n\nProblem Statement\n\nSilver Fox is fighting with N monsters.\n\nThe monsters are standing in a row, and we can assume them to be standing on a number line. The i-th monster, standing at the coordinate X_i, has the health of H_i.\n\nSilver Fox can use bombs to attack the monsters.\nUsing a bomb at the coordinate x decreases the healths of all monsters between the coordinates x-D and x+D (inclusive) by A.\nThere is no way other than bombs to decrease the monster's health.\n\nSilver Fox wins when all the monsters' healths become 0 or below.\n\nFind the minimum number of bombs needed to win.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq D \\leq 10^9\n\n1 \\leq A \\leq 10^9\n\n0 \\leq X_i \\leq 10^9\n\n1 \\leq H_i \\leq 10^9\n\nX_i are distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D A\nX_1 H_1\n:\nX_N H_N\n\nOutput\n\nPrint the minimum number of bombs needed to win.\n\nSample Input 1\n\n3 3 2\n1 2\n5 4\n9 2\n\nSample Output 1\n\n2\n\nFirst, let us use a bomb at the coordinate 4 to decrease the first and second monsters' health by 2.\n\nThen, use a bomb at the coordinate 6 to decrease the second and third monsters' health by 2.\n\nNow, all the monsters' healths are 0.\nWe cannot make all the monsters' health drop to 0 or below with just one bomb.\n\nSample Input 2\n\n9 4 1\n1 5\n2 4\n3 3\n4 2\n5 1\n6 2\n7 3\n8 4\n9 5\n\nSample Output 2\n\n5\n\nWe should use five bombs at the coordinate 5.\n\nSample Input 3\n\n3 0 1\n300000000 1000000000\n100000000 1000000000\n200000000 1000000000\n\nSample Output 3\n\n3000000000\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2042, "cpu_time_ms": 2103, "memory_kb": 8688}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s988297778", "group_id": "codeNet:p02789", "input_text": "program main\n implicit none\n integer :: n, m\n\n read *, n, m\n\n if ( n == m ) then\n print *, 'Yes'\n else\n print *, 'No'\n end if\nend program main\n\n", "language": "Fortran", "metadata": {"date": 1589025061, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02789.html", "problem_id": "p02789", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02789/input.txt", "sample_output_relpath": "derived/input_output/data/p02789/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02789/Fortran/s988297778.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s988297778", "user_id": "u353721260"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, m\n\n read *, n, m\n\n if ( n == m ) then\n print *, 'Yes'\n else\n print *, 'No'\n end if\nend program main\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.\n\nThe problem has N test cases, all of which must be passed to get an AC verdict.\n\nTakahashi's submission has passed M cases out of the N test cases.\n\nDetermine whether Takahashi's submission gets an AC.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq M \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nIf Takahashi's submission gets an AC, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\nYes\n\nAll three test cases have been passed, so his submission gets an AC.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\nNo\n\nOnly two out of the three test cases have been passed, so his submission does not get an AC.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\nYes", "sample_input": "3 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02789", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is participating in a programming contest, AXC001. He has just submitted his code to Problem A.\n\nThe problem has N test cases, all of which must be passed to get an AC verdict.\n\nTakahashi's submission has passed M cases out of the N test cases.\n\nDetermine whether Takahashi's submission gets an AC.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq M \\leq N\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nIf Takahashi's submission gets an AC, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\nYes\n\nAll three test cases have been passed, so his submission gets an AC.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\nNo\n\nOnly two out of the three test cases have been passed, so his submission does not get an AC.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 188, "cpu_time_ms": 4, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s415303515", "group_id": "codeNet:p02790", "input_text": "program comparing_strings\n implicit none\n integer :: a, b, i\n read(*,*) a, b\n do i = 1, max(a,b)\n write(*,'(i0)',advance='no') min(a,b)\n end do\n write(*,*)\nend program comparing_strings", "language": "Fortran", "metadata": {"date": 1590623016, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02790.html", "problem_id": "p02790", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02790/input.txt", "sample_output_relpath": "derived/input_output/data/p02790/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02790/Fortran/s415303515.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s415303515", "user_id": "u506403362"}, "prompt_components": {"gold_output": "3333\n", "input_to_evaluate": "program comparing_strings\n implicit none\n integer :: a, b, i\n read(*,*) a, b\n do i = 1, max(a,b)\n write(*,'(i0)',advance='no') min(a,b)\n end do\n write(*,*)\nend program comparing_strings", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?\n\nConstraints\n\n1 \\leq a \\leq 9\n\n1 \\leq b \\leq 9\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nPrint the lexicographically smaller of the two strings. (If the two strings are equal, print one of them.)\n\nSample Input 1\n\n4 3\n\nSample Output 1\n\n3333\n\nWe have two strings 444 and 3333. Between them, 3333 is the lexicographically smaller.\n\nSample Input 2\n\n7 7\n\nSample Output 2\n\n7777777", "sample_input": "4 3\n"}, "reference_outputs": ["3333\n"], "source_document_id": "p02790", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?\n\nConstraints\n\n1 \\leq a \\leq 9\n\n1 \\leq b \\leq 9\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nPrint the lexicographically smaller of the two strings. (If the two strings are equal, print one of them.)\n\nSample Input 1\n\n4 3\n\nSample Output 1\n\n3333\n\nWe have two strings 444 and 3333. Between them, 3333 is the lexicographically smaller.\n\nSample Input 2\n\n7 7\n\nSample Output 2\n\n7777777", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 194, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s603672218", "group_id": "codeNet:p02790", "input_text": "program test02\n implicit none\n!character a, b\n integer a, b\n integer i, ii, j, jj\n\n read(5,*) a, b\n\n if ( a < b ) then\n do i=1,b\n write (*,fmt='(i0)',advance='no') a\n end do\n else\n do j=1,a\n write (*,fmt='(i0)',advance='no') b\n end do\n end if\n\nendprogram test02\n", "language": "Fortran", "metadata": {"date": 1579685269, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02790.html", "problem_id": "p02790", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02790/input.txt", "sample_output_relpath": "derived/input_output/data/p02790/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02790/Fortran/s603672218.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s603672218", "user_id": "u838994321"}, "prompt_components": {"gold_output": "3333\n", "input_to_evaluate": "program test02\n implicit none\n!character a, b\n integer a, b\n integer i, ii, j, jj\n\n read(5,*) a, b\n\n if ( a < b ) then\n do i=1,b\n write (*,fmt='(i0)',advance='no') a\n end do\n else\n do j=1,a\n write (*,fmt='(i0)',advance='no') b\n end do\n end if\n\nendprogram test02\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?\n\nConstraints\n\n1 \\leq a \\leq 9\n\n1 \\leq b \\leq 9\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nPrint the lexicographically smaller of the two strings. (If the two strings are equal, print one of them.)\n\nSample Input 1\n\n4 3\n\nSample Output 1\n\n3333\n\nWe have two strings 444 and 3333. Between them, 3333 is the lexicographically smaller.\n\nSample Input 2\n\n7 7\n\nSample Output 2\n\n7777777", "sample_input": "4 3\n"}, "reference_outputs": ["3333\n"], "source_document_id": "p02790", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are 1-digit positive integers a and b. Consider these two strings: the concatenation of b copies of the digit a, and the concatenation of a copies of the digit b. Which of these is lexicographically smaller?\n\nConstraints\n\n1 \\leq a \\leq 9\n\n1 \\leq b \\leq 9\n\na and b are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nPrint the lexicographically smaller of the two strings. (If the two strings are equal, print one of them.)\n\nSample Input 1\n\n4 3\n\nSample Output 1\n\n3333\n\nWe have two strings 444 and 3333. Between them, 3333 is the lexicographically smaller.\n\nSample Input 2\n\n7 7\n\nSample Output 2\n\n7777777", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 268, "cpu_time_ms": 4, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s217537747", "group_id": "codeNet:p02791", "input_text": "program test03\n implicit none\n integer,allocatable :: a(:)\n integer N\n integer i, j, jj\n integer :: yesf=0\n integer :: no=0\n\n read(5,*) N\n allocate(a(N))\n\n read(5,*) (a(i), i=1,N)\n\n do j=1,N\n if ( j/=1 ) then\n do jj=1,j\n if ( a(jj-1) < a(j) ) then\n no = 1\n end if\n end do\n end if\n!print *,no\n if ( no==0 ) then\n yesf=yesf+1\n end if\n no=0\nend do\n\n write (*,fmt='(i0)') yesf\n\nendprogram test03\n", "language": "Fortran", "metadata": {"date": 1579687365, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02791.html", "problem_id": "p02791", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02791/input.txt", "sample_output_relpath": "derived/input_output/data/p02791/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02791/Fortran/s217537747.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s217537747", "user_id": "u838994321"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program test03\n implicit none\n integer,allocatable :: a(:)\n integer N\n integer i, j, jj\n integer :: yesf=0\n integer :: no=0\n\n read(5,*) N\n allocate(a(N))\n\n read(5,*) (a(i), i=1,N)\n\n do j=1,N\n if ( j/=1 ) then\n do jj=1,j\n if ( a(jj-1) < a(j) ) then\n no = 1\n end if\n end do\n end if\n!print *,no\n if ( no==0 ) then\n yesf=yesf+1\n end if\n no=0\nend do\n\n write (*,fmt='(i0)') yesf\n\nendprogram test03\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "sample_input": "5\n4 2 5 1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02791", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 409, "cpu_time_ms": 2103, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s156601418", "group_id": "codeNet:p02791", "input_text": "program B3\n implicit none\n\n integer :: n, i , j, cnt, min\n integer,allocatable,dimension(:) :: P\n\n read(*,*) n\n allocate(P(n))\n read(*,*) (P(j), j=1,n)\n\n cnt=1\n min=P(1)\n do i=2,n\n if(P(i).gt.min) goto 300\n ! do j = 1,i-1\n ! if(P(j).lt.P(i)) then\n ! goto 300\n ! endif\n ! enddo\n cnt=cnt+1\n min=P(i)\n300 continue \n enddo\n\n print *, cnt\n \nend program B3", "language": "Fortran", "metadata": {"date": 1579466548, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02791.html", "problem_id": "p02791", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02791/input.txt", "sample_output_relpath": "derived/input_output/data/p02791/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02791/Fortran/s156601418.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s156601418", "user_id": "u878839832"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program B3\n implicit none\n\n integer :: n, i , j, cnt, min\n integer,allocatable,dimension(:) :: P\n\n read(*,*) n\n allocate(P(n))\n read(*,*) (P(j), j=1,n)\n\n cnt=1\n min=P(1)\n do i=2,n\n if(P(i).gt.min) goto 300\n ! do j = 1,i-1\n ! if(P(j).lt.P(i)) then\n ! goto 300\n ! endif\n ! enddo\n cnt=cnt+1\n min=P(i)\n300 continue \n enddo\n\n print *, cnt\n \nend program B3", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "sample_input": "5\n4 2 5 1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02791", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 413, "cpu_time_ms": 53, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s971937966", "group_id": "codeNet:p02791", "input_text": "program B3\n implicit none\n\n integer :: n, i , j, cnt, min\n integer,allocatable,dimension(:) :: P\n\n read(*,*) n\n allocate(P(n))\n read(*,*) (P(j), j=1,n)\n\n cnt=1\n min=P(1)\n do i=2,n\n if(P(i).gt.min) goto 300\n do j = 1,i-1\n if(P(j).lt.P(i)) then\n goto 300\n endif\n enddo\n cnt=cnt+1\n min=P(i)\n300 continue \n enddo\n\n print *, cnt\n \nend program B3", "language": "Fortran", "metadata": {"date": 1579466437, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02791.html", "problem_id": "p02791", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02791/input.txt", "sample_output_relpath": "derived/input_output/data/p02791/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02791/Fortran/s971937966.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s971937966", "user_id": "u878839832"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program B3\n implicit none\n\n integer :: n, i , j, cnt, min\n integer,allocatable,dimension(:) :: P\n\n read(*,*) n\n allocate(P(n))\n read(*,*) (P(j), j=1,n)\n\n cnt=1\n min=P(1)\n do i=2,n\n if(P(i).gt.min) goto 300\n do j = 1,i-1\n if(P(j).lt.P(i)) then\n goto 300\n endif\n enddo\n cnt=cnt+1\n min=P(i)\n300 continue \n enddo\n\n print *, cnt\n \nend program B3", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "sample_input": "5\n4 2 5 1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02791", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a permutation P_1, \\ldots, P_N of 1, \\ldots, N.\nFind the number of integers i (1 \\leq i \\leq N) that satisfy the following condition:\n\nFor any integer j (1 \\leq j \\leq i), P_i \\leq P_j.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nP_1, \\ldots, P_N is a permutation of 1, \\ldots, N.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 ... P_N\n\nOutput\n\nPrint the number of integers i that satisfy the condition.\n\nSample Input 1\n\n5\n4 2 5 1 3\n\nSample Output 1\n\n3\n\ni=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.\n\nSimilarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.\n\nSample Input 2\n\n4\n4 3 2 1\n\nSample Output 2\n\n4\n\nAll integers i (1 \\leq i \\leq N) satisfy the condition.\n\nSample Input 3\n\n6\n1 2 3 4 5 6\n\nSample Output 3\n\n1\n\nOnly i=1 satisfies the condition.\n\nSample Input 4\n\n8\n5 7 4 2 6 8 1 3\n\nSample Output 4\n\n4\n\nSample Input 5\n\n1\n1\n\nSample Output 5\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 403, "cpu_time_ms": 2103, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s538961925", "group_id": "codeNet:p02792", "input_text": "program handstand2\n implicit none\n integer :: n, i, a, b\n integer(8) :: c(9,9) = 0, x = 0\n read(*,*) n\n do i = 1, n\n a = mod(i,10)\n if (a == 0) cycle\n b = i\n do while (b >= 10)\n b = b/10\n end do\n c(a,b) = c(a,b)+1\n end do\n do a = 1, 9\n do b = 1, 9\n x = x+c(a,b)*c(b,a)\n end do\n end do\n write(*,'(i0)') x\nend program handstand2", "language": "Fortran", "metadata": {"date": 1590624373, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02792.html", "problem_id": "p02792", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02792/input.txt", "sample_output_relpath": "derived/input_output/data/p02792/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02792/Fortran/s538961925.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s538961925", "user_id": "u506403362"}, "prompt_components": {"gold_output": "17\n", "input_to_evaluate": "program handstand2\n implicit none\n integer :: n, i, a, b\n integer(8) :: c(9,9) = 0, x = 0\n read(*,*) n\n do i = 1, n\n a = mod(i,10)\n if (a == 0) cycle\n b = i\n do while (b >= 10)\n b = b/10\n end do\n c(a,b) = c(a,b)+1\n end do\n do a = 1, 9\n do b = 1, 9\n x = x+c(a,b)*c(b,a)\n end do\n end do\n write(*,'(i0)') x\nend program handstand2", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N.\n\nFind the number of pairs (A, B) of positive integers not greater than N that satisfy the following condition:\n\nWhen A and B are written in base ten without leading zeros, the last digit of A is equal to the first digit of B, and the first digit of A is equal to the last digit of B.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n25\n\nSample Output 1\n\n17\n\nThe following 17 pairs satisfy the condition: (1,1), (1,11), (2,2), (2,22), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (11,1), (11,11), (12,21), (21,12), (22,2), and (22,22).\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100\n\nSample Output 3\n\n108\n\nSample Input 4\n\n2020\n\nSample Output 4\n\n40812\n\nSample Input 5\n\n200000\n\nSample Output 5\n\n400000008", "sample_input": "25\n"}, "reference_outputs": ["17\n"], "source_document_id": "p02792", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N.\n\nFind the number of pairs (A, B) of positive integers not greater than N that satisfy the following condition:\n\nWhen A and B are written in base ten without leading zeros, the last digit of A is equal to the first digit of B, and the first digit of A is equal to the last digit of B.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n25\n\nSample Output 1\n\n17\n\nThe following 17 pairs satisfy the condition: (1,1), (1,11), (2,2), (2,22), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (11,1), (11,11), (12,21), (21,12), (22,2), and (22,22).\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100\n\nSample Output 3\n\n108\n\nSample Input 4\n\n2020\n\nSample Output 4\n\n40812\n\nSample Input 5\n\n200000\n\nSample Output 5\n\n400000008", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 369, "cpu_time_ms": 5, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s788441090", "group_id": "codeNet:p02792", "input_text": "program ABC152D\n implicit none\n integer(8)::N,i,j,top,tail\n integer(8)::result=0\n integer(8),dimension(10,10)::C\n read(5,*)N\n C=0\n\n do i=1,N\n tail=mod(i,10)\n j=i\n top=i\n do\n j=j/10\n if(j==0)then\n exit\n end if\n top=j\n end do\n C(top+1,tail+1)=C(top+1,tail+1)+1\n end do\n\n do i=1,10\n do j=1,10\n result=result+C(i,j)*C(j,i)\n end do\n end do\n\n print'(i0)',result\nend program ABC152D", "language": "Fortran", "metadata": {"date": 1579514805, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02792.html", "problem_id": "p02792", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02792/input.txt", "sample_output_relpath": "derived/input_output/data/p02792/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02792/Fortran/s788441090.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s788441090", "user_id": "u414699019"}, "prompt_components": {"gold_output": "17\n", "input_to_evaluate": "program ABC152D\n implicit none\n integer(8)::N,i,j,top,tail\n integer(8)::result=0\n integer(8),dimension(10,10)::C\n read(5,*)N\n C=0\n\n do i=1,N\n tail=mod(i,10)\n j=i\n top=i\n do\n j=j/10\n if(j==0)then\n exit\n end if\n top=j\n end do\n C(top+1,tail+1)=C(top+1,tail+1)+1\n end do\n\n do i=1,10\n do j=1,10\n result=result+C(i,j)*C(j,i)\n end do\n end do\n\n print'(i0)',result\nend program ABC152D", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N.\n\nFind the number of pairs (A, B) of positive integers not greater than N that satisfy the following condition:\n\nWhen A and B are written in base ten without leading zeros, the last digit of A is equal to the first digit of B, and the first digit of A is equal to the last digit of B.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n25\n\nSample Output 1\n\n17\n\nThe following 17 pairs satisfy the condition: (1,1), (1,11), (2,2), (2,22), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (11,1), (11,11), (12,21), (21,12), (22,2), and (22,22).\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100\n\nSample Output 3\n\n108\n\nSample Input 4\n\n2020\n\nSample Output 4\n\n40812\n\nSample Input 5\n\n200000\n\nSample Output 5\n\n400000008", "sample_input": "25\n"}, "reference_outputs": ["17\n"], "source_document_id": "p02792", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N.\n\nFind the number of pairs (A, B) of positive integers not greater than N that satisfy the following condition:\n\nWhen A and B are written in base ten without leading zeros, the last digit of A is equal to the first digit of B, and the first digit of A is equal to the last digit of B.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n25\n\nSample Output 1\n\n17\n\nThe following 17 pairs satisfy the condition: (1,1), (1,11), (2,2), (2,22), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (11,1), (11,11), (12,21), (21,12), (22,2), and (22,22).\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100\n\nSample Output 3\n\n108\n\nSample Input 4\n\n2020\n\nSample Output 4\n\n40812\n\nSample Input 5\n\n200000\n\nSample Output 5\n\n400000008", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 534, "cpu_time_ms": 4, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s983088124", "group_id": "codeNet:p02792", "input_text": "program Handstand2\n\n implicit none\n\n integer N\n integer a, b\n real logA,logB\n integer intLogA, intLogB\n integer a1, a2, b1, b2\n integer :: count = 0\n\n read *, N\n do a = 1, N\n do b = 1, N\n logA = log10(real(a))\n logB = log10(real(b))\n intLogA = 10 ** int(logA)\n intLogB = 10 ** int(logB)\n logA = real(intLogA)\n logB = real(intLogB)\n a1 = a / logA\n a2 = mod(a,10)\n b1 = b / logB\n b2 = mod(b,10)\n if (a1 == b2 .and. a2 == b1) then\n ! print *,a,b\n count = count + 1\n end if\n end do\n end do\n\n print '(i0)', count\n\nend program\n", "language": "Fortran", "metadata": {"date": 1579466877, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02792.html", "problem_id": "p02792", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02792/input.txt", "sample_output_relpath": "derived/input_output/data/p02792/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02792/Fortran/s983088124.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s983088124", "user_id": "u772828662"}, "prompt_components": {"gold_output": "17\n", "input_to_evaluate": "program Handstand2\n\n implicit none\n\n integer N\n integer a, b\n real logA,logB\n integer intLogA, intLogB\n integer a1, a2, b1, b2\n integer :: count = 0\n\n read *, N\n do a = 1, N\n do b = 1, N\n logA = log10(real(a))\n logB = log10(real(b))\n intLogA = 10 ** int(logA)\n intLogB = 10 ** int(logB)\n logA = real(intLogA)\n logB = real(intLogB)\n a1 = a / logA\n a2 = mod(a,10)\n b1 = b / logB\n b2 = mod(b,10)\n if (a1 == b2 .and. a2 == b1) then\n ! print *,a,b\n count = count + 1\n end if\n end do\n end do\n\n print '(i0)', count\n\nend program\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N.\n\nFind the number of pairs (A, B) of positive integers not greater than N that satisfy the following condition:\n\nWhen A and B are written in base ten without leading zeros, the last digit of A is equal to the first digit of B, and the first digit of A is equal to the last digit of B.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n25\n\nSample Output 1\n\n17\n\nThe following 17 pairs satisfy the condition: (1,1), (1,11), (2,2), (2,22), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (11,1), (11,11), (12,21), (21,12), (22,2), and (22,22).\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100\n\nSample Output 3\n\n108\n\nSample Input 4\n\n2020\n\nSample Output 4\n\n40812\n\nSample Input 5\n\n200000\n\nSample Output 5\n\n400000008", "sample_input": "25\n"}, "reference_outputs": ["17\n"], "source_document_id": "p02792", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a positive integer N.\n\nFind the number of pairs (A, B) of positive integers not greater than N that satisfy the following condition:\n\nWhen A and B are written in base ten without leading zeros, the last digit of A is equal to the first digit of B, and the first digit of A is equal to the last digit of B.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n25\n\nSample Output 1\n\n17\n\nThe following 17 pairs satisfy the condition: (1,1), (1,11), (2,2), (2,22), (3,3), (4,4), (5,5), (6,6), (7,7), (8,8), (9,9), (11,1), (11,11), (12,21), (21,12), (22,2), and (22,22).\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100\n\nSample Output 3\n\n108\n\nSample Input 4\n\n2020\n\nSample Output 4\n\n40812\n\nSample Input 5\n\n200000\n\nSample Output 5\n\n400000008", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 612, "cpu_time_ms": 2103, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s405018203", "group_id": "codeNet:p02793", "input_text": "module mod_generate_fn\n private\ntype term\n integer(4):: factor,multiplier\nend type\ntype factorized_num\n type(term), pointer:: num(:)\nend type\n\npublic factorized_num, generate_fn, init_fn, calc_ldb, div_fn, multipl_fn\ncontains\nsubroutine generate_fn(x, fx)\n integer(4):: x, now_x\n type(factorized_num):: fx\n integer(4):: i\n\n now_x = x\n do i=2, nint(sqrt(real(x)))\n do while (mod(now_x, i) == 0)\n call add_factor_to_fn(fx, i)\n now_x = now_x / i\n end do\n end do\n\n if (now_x /= 1)then\n call add_factor_to_fn(fx, now_x)\n end if\n ! call print_fn(fx, 'pm')\nend subroutine\n\n\nsubroutine init_fn(fx)\n type(factorized_num):: fx\n allocate(fx%num(0))\nend subroutine\n\n\nsubroutine add_factor_to_fn(fx,pn)\n type(factorized_num):: fx, tmp\n integer(4):: now_size\n integer(4):: pn, i\n\n now_size = size(fx%num(:))\n do i=1, size(fx%num(:))\n if (fx%num(i)%factor == pn) then\n fx%num(i)%multiplier = fx%num(i)%multiplier + 1\n return\n end if\n end do\n ! not found num in fx%num(:)%factor--------------------\n call append_fn(fx, pn, 1)\nend subroutine\n\n\nsubroutine print_fn(fn, word)\n type(factorized_num):: fn\n integer:: i\n character(*):: word\n\n print\"(a5' : ----------------')\", word\n do i = 1, size(fn%num(:))\n print\"(i7' * 'i7)\", fn%num(i)%factor, fn%num(i)%multiplier\n end do\nend subroutine\n\n\nsubroutine calc_ldb(fldb, fn)\n type(factorized_num):: fldb, fn\n integer(4):: i,j\n integer(4):: fac, mul\n logical:: fac_exist\n \n do i=1,size(fn%num(:))\n fac = fn%num(i)%factor\n mul = fn%num(i)%multiplier\n fac_exist = .false.\n \n do j=1, size(fldb%num(:))\n if (fldb%num(j)%factor == fac)then\n fldb%num(j)%multiplier = max(fldb%num(j)%multiplier,mul)\n fac_exist = .true.\n exit\n end if\n end do\n\n if (.not. fac_exist) call append_fn(fldb,fac,mul)\n ! call print_fn(fldb,'ldb')\n end do\nend subroutine\n\nsubroutine div_fn(fx, fy, ret)\n type(factorized_num):: fx,fy,ret\n integer(4):: ix,iy, fy_size,fx_size, i\n call init_fn(ret)\n fx_size = size(fx%num(:))\n fy_size = size(fy%num(:))\n ix = 1\n iy = 1\n\n do while(ix <= fx_size .and. iy <= fy_size)\n if (fy%num(iy)%factor /= fx%num(ix)%factor) then\n \n block\n integer:: fac, mul\n fac = fx%num(ix)%factor\n mul = fx%num(ix)%multiplier\n call append_fn(ret,fac,mul)\n end block\n ix = ix+1\n else\n\n block\n integer(4):: fac, mul_x, mul_y\n fac = fx%num(ix)%factor\n mul_x = fx%num(ix)%multiplier\n mul_y = fy%num(iy)%multiplier\n call append_fn(ret, fac, mul_x-mul_y)\n end block\n ix = ix+1\n iy = iy+1\n end if\n end do\n \n do i = ix, fx_size; block\n integer:: fac, mul\n fac = fx%num(i)%factor\n mul = fx%num(i)%multiplier\n call append_fn(ret,fac,mul)\n end block;end do\n ! call print_fn(ret,'b')\n end subroutine\n\nsubroutine append_fn(fx, fac, mul)\n type(factorized_num):: fx,tmp\n integer(4):: now_size, fac, mul\n\n now_size = size(fx%num(:))\n allocate(tmp%num(now_size))\n tmp%num(:) = fx%num(:)\n deallocate(fx%num)\n allocate(fx%num(now_size+1))\n fx%num(:now_size) = tmp%num(:)\n deallocate(tmp%num)\n fx%num(now_size+1)%factor = fac\n fx%num(now_size+1)%multiplier = mul\nend subroutine\n\nfunction multipl_fn(fx) result(x)\n type(factorized_num):: fx\n integer(8):: x\n integer(4):: fx_size, i, fac, mul\n integer(4), parameter:: big = 1000000007\n\n fx_size = size(fx%num(:))\n x = 1\n do i=1, fx_size\n fac = fx%num(i)%factor\n mul = fx%num(i)%multiplier\n x = x*fac**mul\n if (x >= big) x = mod(x,big)\n end do\nend function\nend module\n\nprogram flatten\n use mod_generate_fn\n implicit none\n integer(4):: n, i\n integer(4), allocatable:: a(:)\n integer(4), parameter:: big = 1000000007\n integer(8) :: sumb,b\n type(factorized_num), allocatable:: fa(:)\n type(factorized_num):: fldb, fb\n\n read*, n\n allocate(a(n), fa(n))\n read*, a(:)\n\n call init_fn(fldb)\n \n do i = 1,n\n call init_fn(fa(i))\n call generate_fn(a(i), fa(i))\n call calc_ldb(fldb,fa(i))\n end do\n\n sumb = 0\n\n do i = 1,n\n call div_fn(fldb,fa(i),fb)\n b = multipl_fn(fb)\n sumb = sumb + b\n if (sumb >= big) sumb = mod(sumb,big)\n end do\n\n print*, sumb\nend program flatten", "language": "Fortran", "metadata": {"date": 1580327060, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02793.html", "problem_id": "p02793", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02793/input.txt", "sample_output_relpath": "derived/input_output/data/p02793/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02793/Fortran/s405018203.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s405018203", "user_id": "u234636620"}, "prompt_components": {"gold_output": "13\n", "input_to_evaluate": "module mod_generate_fn\n private\ntype term\n integer(4):: factor,multiplier\nend type\ntype factorized_num\n type(term), pointer:: num(:)\nend type\n\npublic factorized_num, generate_fn, init_fn, calc_ldb, div_fn, multipl_fn\ncontains\nsubroutine generate_fn(x, fx)\n integer(4):: x, now_x\n type(factorized_num):: fx\n integer(4):: i\n\n now_x = x\n do i=2, nint(sqrt(real(x)))\n do while (mod(now_x, i) == 0)\n call add_factor_to_fn(fx, i)\n now_x = now_x / i\n end do\n end do\n\n if (now_x /= 1)then\n call add_factor_to_fn(fx, now_x)\n end if\n ! call print_fn(fx, 'pm')\nend subroutine\n\n\nsubroutine init_fn(fx)\n type(factorized_num):: fx\n allocate(fx%num(0))\nend subroutine\n\n\nsubroutine add_factor_to_fn(fx,pn)\n type(factorized_num):: fx, tmp\n integer(4):: now_size\n integer(4):: pn, i\n\n now_size = size(fx%num(:))\n do i=1, size(fx%num(:))\n if (fx%num(i)%factor == pn) then\n fx%num(i)%multiplier = fx%num(i)%multiplier + 1\n return\n end if\n end do\n ! not found num in fx%num(:)%factor--------------------\n call append_fn(fx, pn, 1)\nend subroutine\n\n\nsubroutine print_fn(fn, word)\n type(factorized_num):: fn\n integer:: i\n character(*):: word\n\n print\"(a5' : ----------------')\", word\n do i = 1, size(fn%num(:))\n print\"(i7' * 'i7)\", fn%num(i)%factor, fn%num(i)%multiplier\n end do\nend subroutine\n\n\nsubroutine calc_ldb(fldb, fn)\n type(factorized_num):: fldb, fn\n integer(4):: i,j\n integer(4):: fac, mul\n logical:: fac_exist\n \n do i=1,size(fn%num(:))\n fac = fn%num(i)%factor\n mul = fn%num(i)%multiplier\n fac_exist = .false.\n \n do j=1, size(fldb%num(:))\n if (fldb%num(j)%factor == fac)then\n fldb%num(j)%multiplier = max(fldb%num(j)%multiplier,mul)\n fac_exist = .true.\n exit\n end if\n end do\n\n if (.not. fac_exist) call append_fn(fldb,fac,mul)\n ! call print_fn(fldb,'ldb')\n end do\nend subroutine\n\nsubroutine div_fn(fx, fy, ret)\n type(factorized_num):: fx,fy,ret\n integer(4):: ix,iy, fy_size,fx_size, i\n call init_fn(ret)\n fx_size = size(fx%num(:))\n fy_size = size(fy%num(:))\n ix = 1\n iy = 1\n\n do while(ix <= fx_size .and. iy <= fy_size)\n if (fy%num(iy)%factor /= fx%num(ix)%factor) then\n \n block\n integer:: fac, mul\n fac = fx%num(ix)%factor\n mul = fx%num(ix)%multiplier\n call append_fn(ret,fac,mul)\n end block\n ix = ix+1\n else\n\n block\n integer(4):: fac, mul_x, mul_y\n fac = fx%num(ix)%factor\n mul_x = fx%num(ix)%multiplier\n mul_y = fy%num(iy)%multiplier\n call append_fn(ret, fac, mul_x-mul_y)\n end block\n ix = ix+1\n iy = iy+1\n end if\n end do\n \n do i = ix, fx_size; block\n integer:: fac, mul\n fac = fx%num(i)%factor\n mul = fx%num(i)%multiplier\n call append_fn(ret,fac,mul)\n end block;end do\n ! call print_fn(ret,'b')\n end subroutine\n\nsubroutine append_fn(fx, fac, mul)\n type(factorized_num):: fx,tmp\n integer(4):: now_size, fac, mul\n\n now_size = size(fx%num(:))\n allocate(tmp%num(now_size))\n tmp%num(:) = fx%num(:)\n deallocate(fx%num)\n allocate(fx%num(now_size+1))\n fx%num(:now_size) = tmp%num(:)\n deallocate(tmp%num)\n fx%num(now_size+1)%factor = fac\n fx%num(now_size+1)%multiplier = mul\nend subroutine\n\nfunction multipl_fn(fx) result(x)\n type(factorized_num):: fx\n integer(8):: x\n integer(4):: fx_size, i, fac, mul\n integer(4), parameter:: big = 1000000007\n\n fx_size = size(fx%num(:))\n x = 1\n do i=1, fx_size\n fac = fx%num(i)%factor\n mul = fx%num(i)%multiplier\n x = x*fac**mul\n if (x >= big) x = mod(x,big)\n end do\nend function\nend module\n\nprogram flatten\n use mod_generate_fn\n implicit none\n integer(4):: n, i\n integer(4), allocatable:: a(:)\n integer(4), parameter:: big = 1000000007\n integer(8) :: sumb,b\n type(factorized_num), allocatable:: fa(:)\n type(factorized_num):: fldb, fb\n\n read*, n\n allocate(a(n), fa(n))\n read*, a(:)\n\n call init_fn(fldb)\n \n do i = 1,n\n call init_fn(fa(i))\n call generate_fn(a(i), fa(i))\n call calc_ldb(fldb,fa(i))\n end do\n\n sumb = 0\n\n do i = 1,n\n call div_fn(fldb,fa(i),fb)\n b = multipl_fn(fb)\n sumb = sumb + b\n if (sumb >= big) sumb = mod(sumb,big)\n end do\n\n print*, sumb\nend program flatten", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are N positive integers A_1,...,A_N.\n\nConsider positive integers B_1, ..., B_N that satisfy the following condition.\n\nCondition: For any i, j such that 1 \\leq i < j \\leq N, A_i B_i = A_j B_j holds.\n\nFind the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.\n\nSince the answer can be enormous, print the sum modulo (10^9 +7).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A_i \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nPrint the minimum possible value of B_1 + ... + B_N for B_1,...,B_N that satisfy the condition, modulo (10^9 +7).\n\nSample Input 1\n\n3\n2 3 4\n\nSample Output 1\n\n13\n\nLet B_1=6, B_2=4, and B_3=3, and the condition will be satisfied.\n\nSample Input 2\n\n5\n12 12 12 12 12\n\nSample Output 2\n\n5\n\nWe can let all B_i be 1.\n\nSample Input 3\n\n3\n1000000 999999 999998\n\nSample Output 3\n\n996989508\n\nPrint the sum modulo (10^9+7).", "sample_input": "3\n2 3 4\n"}, "reference_outputs": ["13\n"], "source_document_id": "p02793", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are N positive integers A_1,...,A_N.\n\nConsider positive integers B_1, ..., B_N that satisfy the following condition.\n\nCondition: For any i, j such that 1 \\leq i < j \\leq N, A_i B_i = A_j B_j holds.\n\nFind the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.\n\nSince the answer can be enormous, print the sum modulo (10^9 +7).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A_i \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nPrint the minimum possible value of B_1 + ... + B_N for B_1,...,B_N that satisfy the condition, modulo (10^9 +7).\n\nSample Input 1\n\n3\n2 3 4\n\nSample Output 1\n\n13\n\nLet B_1=6, B_2=4, and B_3=3, and the condition will be satisfied.\n\nSample Input 2\n\n5\n12 12 12 12 12\n\nSample Output 2\n\n5\n\nWe can let all B_i be 1.\n\nSample Input 3\n\n3\n1000000 999999 999998\n\nSample Output 3\n\n996989508\n\nPrint the sum modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4709, "cpu_time_ms": 2104, "memory_kb": 14848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s147696927", "group_id": "codeNet:p02793", "input_text": "module mod_tree_map\n implicit none\n\n type t_entry\n private\n integer :: key\n integer :: val\n end type t_entry\n\n type t_node\n private\n type(t_node), pointer :: left => null(), right => null()\n integer :: level = 1\n type(t_entry), pointer :: e => null()\n end type t_node\n\n type t_tree_map\n private\n type(t_node), pointer :: root => null()\n integer :: deflt = 0\n end type t_tree_map\n\ncontains\n\n function new_entry(key,val) result(e)\n integer, intent(in) :: key\n integer, intent(in) :: val\n type(t_entry), pointer :: e\n e => null()\n allocate(e)\n e%key = key\n e%val = val\n end\n\n function new_node(e) result(n)\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n n => null()\n allocate(n)\n n%e => e\n end\n\n integer function level(n)\n type(t_node), pointer, intent(in) :: n\n level = 0\n if (.not.associated(n)) return\n level = n%level\n end\n\n logical function is_leaf(n)\n type(t_node), pointer, intent(in) :: n\n is_leaf = associated(n) .and. .not.associated(n%left) .and. &\n & .not.associated(n%right)\n end\n\n recursive function tree_size(n) result(s)\n type(t_node), pointer, intent(in) :: n\n integer :: s\n s = 0\n if (.not.associated(n)) return\n s = 1+tree_size(n%left)+tree_size(n%right)\n end\n\n function skew(n) result(l)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: l\n l => n\n if (.not.(associated(n) .and. associated(n%left) .and. &\n & n%left%level == n%level)) return\n l => n%left\n n%left => l%right\n l%right => n\n end\n\n function split(n) result(r)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: r\n r => n\n if (.not.(associated(n) .and. associated(n%right) .and. &\n & associated(n%right%right) .and. n%right%right%level == n%level)) return\n r => n%right\n n%right => r%left\n r%left => n\n r%level = r%level+1\n end\n\n function predecessor(n) result(p)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: p\n p => null()\n if (.not.associated(n%left)) return\n p => n%left\n do while (associated(p%right))\n p => p%right\n end do\n end\n\n function successor(n) result(s)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: s\n s => null()\n if (.not.associated(n%right)) return\n s => n%right\n do while (associated(s%left))\n s => s%left\n end do\n end\n\n recursive function insert(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: t\n t => new_node(e)\n if (.not.associated(n)) return\n t => n\n if (e%key < t%e%key) then\n t%left => insert(t%left,e)\n else if (e%key > t%e%key) then\n t%right => insert(t%right,e)\n else\n t%e => e\n end if\n t => skew(t)\n t => split(t)\n end\n\n recursive function delete(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: t, l\n t => n\n if (.not.associated(n)) return\n if (e%key < t%e%key) then\n t%left => delete(t%left,e)\n else if (e%key > t%e%key) then\n t%right => delete(t%right,e)\n else\n if (is_leaf(t)) return\n if (.not.associated(t%left)) then\n l => successor(t)\n t%right => delete(t%right,l%e)\n t%e => l%e\n else\n l => predecessor(t)\n t%left => delete(t%left,l%e)\n t%e => l%e\n end if\n end if\n t => decrease_level(t)\n t => skew(t)\n t%right => skew(t%right)\n if (associated(t%right)) t%right%right => skew(t%right%right)\n t => split(t)\n t%right => split(t%right)\n end\n\n function decrease_level(n) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: t\n integer :: should_be\n t => n\n should_be = min(level(t%left),level(t%right))+1\n if (t%level > should_be) then\n t%level = should_be\n if (level(t%right) > should_be) t%right%level = should_be\n end if\n end\n\n recursive subroutine release_tree(t)\n type(t_node), pointer, intent(inout) :: t\n if (.not.associated(t)) return\n call release_tree(t%left)\n call release_tree(t%right)\n deallocate(t)\n end\n\n recursive subroutine get_keys_list(t,keys,num)\n type(t_node), pointer, intent(in) :: t\n integer, intent(inout) :: keys(:)\n integer, intent(inout) :: num\n if (.not.associated(t)) return\n call get_keys_list(t%left,keys,num)\n num = num+1\n keys(num) = t%e%key\n call get_keys_list(t%right,keys,num)\n end\n\n integer function size_of(map)\n type(t_tree_map), intent(in) :: map\n size_of = tree_size(map%root)\n end\n\n subroutine clear(map)\n type(t_tree_map), intent(inout) :: map\n call release_tree(map%root)\n map%root => null()\n end\n\n subroutine set_default(map,deflt)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: deflt\n map%deflt = deflt\n end\n\n subroutine put_entry(map,e)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n map%root => insert(map%root,e)\n end\n\n subroutine remove_entry(map,e)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n map%root => delete(map%root,e)\n end\n\n function get_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n\n function contain_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n logical :: ret\n ret = .false.\n n => map%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret = .true.\n return\n end if\n end do\n end\n\n function get_first_entry(map) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n if (.not.associated(n)) return\n do while (associated(n%left))\n n => n%left\n end do\n ret => n%e\n end\n\n function poll_first_entry(map) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n if (.not.associated(n)) return\n do while (associated(n%left))\n n => n%left\n end do\n ret => n%e\n map%root => delete(map%root,ret)\n end\n\n function get_last_entry(map) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n if (.not.associated(n)) return\n do while (associated(n%right))\n n => n%right\n end do\n ret => n%e\n end\n\n function poll_last_entry(map) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n if (.not.associated(n)) return\n do while (associated(n%right))\n n => n%right\n end do\n ret => n%e\n map%root => delete(map%root,ret)\n end\n\n function floor_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n if (.not.associated(ret)) then\n ret => n%e\n cycle\n end if\n if (e%key-ret%key > e%key-n%e%key) ret => n%e\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n\n function lower_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_entry), pointer :: ret\n ret => floor_entry(map,new_entry(e%key-1,0))\n end\n\n function ceiling_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n do while (associated(n))\n if (e%key < n%e%key) then\n if (.not.associated(ret)) then\n ret => n%e\n cycle\n end if\n if (e%key-ret%key < e%key-n%e%key) ret => n%e\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n\n function higher_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_entry), pointer :: ret\n ret => ceiling_entry(map,new_entry(e%key+1,0))\n end\n\n subroutine get_keys(map,keys,num)\n type(t_tree_map), intent(inout) :: map\n integer, intent(inout) :: keys(:)\n integer, intent(inout) :: num\n keys = 0\n num = 0\n call get_keys_list(map%root,keys,num)\n end\n\n subroutine put(map,key,val)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n integer, intent(in) :: val\n call put_entry(map,new_entry(key,val))\n end\n\n subroutine remove(map,key)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n call remove_entry(map,new_entry(key,0))\n end\n\n function get(map,key) result(val)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: val\n val = map%deflt\n tmp => get_entry(map,new_entry(key,0))\n if (.not.associated(tmp)) return\n val = tmp%val\n end\n\n logical function contain(map,key)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n contain = contain_entry(map,new_entry(key,0))\n end\n\n function get_first_key(map) result(key)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer :: tmp\n integer :: key\n key = map%deflt\n tmp => get_first_entry(map)\n if (.not.associated(tmp)) return\n key = tmp%key\n end\n\n function get_last_key(map) result(key)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer :: tmp\n integer :: key\n key = map%deflt\n tmp => get_last_entry(map)\n if (.not.associated(tmp)) return\n key = tmp%key\n end\n\n function floor_key(map,key) result(ret)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = map%deflt\n tmp => floor_entry(map,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n\n function lower_key(map,key) result(ret)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = map%deflt\n tmp => lower_entry(map,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n\n function ceiling_key(map,key) result(ret)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = map%deflt\n tmp => ceiling_entry(map,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n\n function higher_key(map,key) result(ret)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = map%deflt\n tmp => higher_entry(map,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n\nend module mod_tree_map\nprogram ABC152E\n use mod_tree_map\n implicit none\n integer::N\n integer,allocatable,dimension(:)::A\n type(t_tree_map),allocatable,dimension(:)::AYK\n type(t_tree_map)::KYK\n integer::NXT(10**6)\n integer::i,j,k,cnt,JIND\n integer(16)::PLUS,KAKE\n integer::ans=0,mo=10**9+7\n open(1,file='max_01', status='old')\n !read(1,*) N\n read*,N\n allocate(A(N),AYK(N))\n read*,A\n !read(1,*)A\n do i=1,N\n do j=2,int(sqrt(real(A(i))+1))\n if(mod(A(i),j)/=0)cycle\n cnt=0\n do while(mod(A(i),j)==0)\n cnt=cnt+1\n A(i)=A(i)/j\n end do\n if(cnt/=0)then\n call put(AYK(i),j,cnt)\n if(get(KYK,j)=mo)KAKE=mod(KAKE,mo)\n PLUS=PLUS*KAKE\n if(PLUS>=mo)PLUS=mod(PLUS,mo)\n JIND=JIND+1\n j=NXT(JIND)\n end do\n ANS=mod(ANS+PLUS,mo)\n end do\n print\"(i0)\",ANS\ncontains\nend program ABC152E", "language": "Fortran", "metadata": {"date": 1579476828, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02793.html", "problem_id": "p02793", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02793/input.txt", "sample_output_relpath": "derived/input_output/data/p02793/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02793/Fortran/s147696927.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s147696927", "user_id": "u598073939"}, "prompt_components": {"gold_output": "13\n", "input_to_evaluate": "module mod_tree_map\n implicit none\n\n type t_entry\n private\n integer :: key\n integer :: val\n end type t_entry\n\n type t_node\n private\n type(t_node), pointer :: left => null(), right => null()\n integer :: level = 1\n type(t_entry), pointer :: e => null()\n end type t_node\n\n type t_tree_map\n private\n type(t_node), pointer :: root => null()\n integer :: deflt = 0\n end type t_tree_map\n\ncontains\n\n function new_entry(key,val) result(e)\n integer, intent(in) :: key\n integer, intent(in) :: val\n type(t_entry), pointer :: e\n e => null()\n allocate(e)\n e%key = key\n e%val = val\n end\n\n function new_node(e) result(n)\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n n => null()\n allocate(n)\n n%e => e\n end\n\n integer function level(n)\n type(t_node), pointer, intent(in) :: n\n level = 0\n if (.not.associated(n)) return\n level = n%level\n end\n\n logical function is_leaf(n)\n type(t_node), pointer, intent(in) :: n\n is_leaf = associated(n) .and. .not.associated(n%left) .and. &\n & .not.associated(n%right)\n end\n\n recursive function tree_size(n) result(s)\n type(t_node), pointer, intent(in) :: n\n integer :: s\n s = 0\n if (.not.associated(n)) return\n s = 1+tree_size(n%left)+tree_size(n%right)\n end\n\n function skew(n) result(l)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: l\n l => n\n if (.not.(associated(n) .and. associated(n%left) .and. &\n & n%left%level == n%level)) return\n l => n%left\n n%left => l%right\n l%right => n\n end\n\n function split(n) result(r)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: r\n r => n\n if (.not.(associated(n) .and. associated(n%right) .and. &\n & associated(n%right%right) .and. n%right%right%level == n%level)) return\n r => n%right\n n%right => r%left\n r%left => n\n r%level = r%level+1\n end\n\n function predecessor(n) result(p)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: p\n p => null()\n if (.not.associated(n%left)) return\n p => n%left\n do while (associated(p%right))\n p => p%right\n end do\n end\n\n function successor(n) result(s)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: s\n s => null()\n if (.not.associated(n%right)) return\n s => n%right\n do while (associated(s%left))\n s => s%left\n end do\n end\n\n recursive function insert(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: t\n t => new_node(e)\n if (.not.associated(n)) return\n t => n\n if (e%key < t%e%key) then\n t%left => insert(t%left,e)\n else if (e%key > t%e%key) then\n t%right => insert(t%right,e)\n else\n t%e => e\n end if\n t => skew(t)\n t => split(t)\n end\n\n recursive function delete(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: t, l\n t => n\n if (.not.associated(n)) return\n if (e%key < t%e%key) then\n t%left => delete(t%left,e)\n else if (e%key > t%e%key) then\n t%right => delete(t%right,e)\n else\n if (is_leaf(t)) return\n if (.not.associated(t%left)) then\n l => successor(t)\n t%right => delete(t%right,l%e)\n t%e => l%e\n else\n l => predecessor(t)\n t%left => delete(t%left,l%e)\n t%e => l%e\n end if\n end if\n t => decrease_level(t)\n t => skew(t)\n t%right => skew(t%right)\n if (associated(t%right)) t%right%right => skew(t%right%right)\n t => split(t)\n t%right => split(t%right)\n end\n\n function decrease_level(n) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: t\n integer :: should_be\n t => n\n should_be = min(level(t%left),level(t%right))+1\n if (t%level > should_be) then\n t%level = should_be\n if (level(t%right) > should_be) t%right%level = should_be\n end if\n end\n\n recursive subroutine release_tree(t)\n type(t_node), pointer, intent(inout) :: t\n if (.not.associated(t)) return\n call release_tree(t%left)\n call release_tree(t%right)\n deallocate(t)\n end\n\n recursive subroutine get_keys_list(t,keys,num)\n type(t_node), pointer, intent(in) :: t\n integer, intent(inout) :: keys(:)\n integer, intent(inout) :: num\n if (.not.associated(t)) return\n call get_keys_list(t%left,keys,num)\n num = num+1\n keys(num) = t%e%key\n call get_keys_list(t%right,keys,num)\n end\n\n integer function size_of(map)\n type(t_tree_map), intent(in) :: map\n size_of = tree_size(map%root)\n end\n\n subroutine clear(map)\n type(t_tree_map), intent(inout) :: map\n call release_tree(map%root)\n map%root => null()\n end\n\n subroutine set_default(map,deflt)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: deflt\n map%deflt = deflt\n end\n\n subroutine put_entry(map,e)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n map%root => insert(map%root,e)\n end\n\n subroutine remove_entry(map,e)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n map%root => delete(map%root,e)\n end\n\n function get_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n\n function contain_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n logical :: ret\n ret = .false.\n n => map%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret = .true.\n return\n end if\n end do\n end\n\n function get_first_entry(map) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n if (.not.associated(n)) return\n do while (associated(n%left))\n n => n%left\n end do\n ret => n%e\n end\n\n function poll_first_entry(map) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n if (.not.associated(n)) return\n do while (associated(n%left))\n n => n%left\n end do\n ret => n%e\n map%root => delete(map%root,ret)\n end\n\n function get_last_entry(map) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n if (.not.associated(n)) return\n do while (associated(n%right))\n n => n%right\n end do\n ret => n%e\n end\n\n function poll_last_entry(map) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n if (.not.associated(n)) return\n do while (associated(n%right))\n n => n%right\n end do\n ret => n%e\n map%root => delete(map%root,ret)\n end\n\n function floor_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n if (.not.associated(ret)) then\n ret => n%e\n cycle\n end if\n if (e%key-ret%key > e%key-n%e%key) ret => n%e\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n\n function lower_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_entry), pointer :: ret\n ret => floor_entry(map,new_entry(e%key-1,0))\n end\n\n function ceiling_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => map%root\n do while (associated(n))\n if (e%key < n%e%key) then\n if (.not.associated(ret)) then\n ret => n%e\n cycle\n end if\n if (e%key-ret%key < e%key-n%e%key) ret => n%e\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n\n function higher_entry(map,e) result(ret)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer, intent(in) :: e\n type(t_entry), pointer :: ret\n ret => ceiling_entry(map,new_entry(e%key+1,0))\n end\n\n subroutine get_keys(map,keys,num)\n type(t_tree_map), intent(inout) :: map\n integer, intent(inout) :: keys(:)\n integer, intent(inout) :: num\n keys = 0\n num = 0\n call get_keys_list(map%root,keys,num)\n end\n\n subroutine put(map,key,val)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n integer, intent(in) :: val\n call put_entry(map,new_entry(key,val))\n end\n\n subroutine remove(map,key)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n call remove_entry(map,new_entry(key,0))\n end\n\n function get(map,key) result(val)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: val\n val = map%deflt\n tmp => get_entry(map,new_entry(key,0))\n if (.not.associated(tmp)) return\n val = tmp%val\n end\n\n logical function contain(map,key)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n contain = contain_entry(map,new_entry(key,0))\n end\n\n function get_first_key(map) result(key)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer :: tmp\n integer :: key\n key = map%deflt\n tmp => get_first_entry(map)\n if (.not.associated(tmp)) return\n key = tmp%key\n end\n\n function get_last_key(map) result(key)\n type(t_tree_map), intent(inout) :: map\n type(t_entry), pointer :: tmp\n integer :: key\n key = map%deflt\n tmp => get_last_entry(map)\n if (.not.associated(tmp)) return\n key = tmp%key\n end\n\n function floor_key(map,key) result(ret)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = map%deflt\n tmp => floor_entry(map,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n\n function lower_key(map,key) result(ret)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = map%deflt\n tmp => lower_entry(map,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n\n function ceiling_key(map,key) result(ret)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = map%deflt\n tmp => ceiling_entry(map,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n\n function higher_key(map,key) result(ret)\n type(t_tree_map), intent(inout) :: map\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = map%deflt\n tmp => higher_entry(map,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n\nend module mod_tree_map\nprogram ABC152E\n use mod_tree_map\n implicit none\n integer::N\n integer,allocatable,dimension(:)::A\n type(t_tree_map),allocatable,dimension(:)::AYK\n type(t_tree_map)::KYK\n integer::NXT(10**6)\n integer::i,j,k,cnt,JIND\n integer(16)::PLUS,KAKE\n integer::ans=0,mo=10**9+7\n open(1,file='max_01', status='old')\n !read(1,*) N\n read*,N\n allocate(A(N),AYK(N))\n read*,A\n !read(1,*)A\n do i=1,N\n do j=2,int(sqrt(real(A(i))+1))\n if(mod(A(i),j)/=0)cycle\n cnt=0\n do while(mod(A(i),j)==0)\n cnt=cnt+1\n A(i)=A(i)/j\n end do\n if(cnt/=0)then\n call put(AYK(i),j,cnt)\n if(get(KYK,j)=mo)KAKE=mod(KAKE,mo)\n PLUS=PLUS*KAKE\n if(PLUS>=mo)PLUS=mod(PLUS,mo)\n JIND=JIND+1\n j=NXT(JIND)\n end do\n ANS=mod(ANS+PLUS,mo)\n end do\n print\"(i0)\",ANS\ncontains\nend program ABC152E", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are N positive integers A_1,...,A_N.\n\nConsider positive integers B_1, ..., B_N that satisfy the following condition.\n\nCondition: For any i, j such that 1 \\leq i < j \\leq N, A_i B_i = A_j B_j holds.\n\nFind the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.\n\nSince the answer can be enormous, print the sum modulo (10^9 +7).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A_i \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nPrint the minimum possible value of B_1 + ... + B_N for B_1,...,B_N that satisfy the condition, modulo (10^9 +7).\n\nSample Input 1\n\n3\n2 3 4\n\nSample Output 1\n\n13\n\nLet B_1=6, B_2=4, and B_3=3, and the condition will be satisfied.\n\nSample Input 2\n\n5\n12 12 12 12 12\n\nSample Output 2\n\n5\n\nWe can let all B_i be 1.\n\nSample Input 3\n\n3\n1000000 999999 999998\n\nSample Output 3\n\n996989508\n\nPrint the sum modulo (10^9+7).", "sample_input": "3\n2 3 4\n"}, "reference_outputs": ["13\n"], "source_document_id": "p02793", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are N positive integers A_1,...,A_N.\n\nConsider positive integers B_1, ..., B_N that satisfy the following condition.\n\nCondition: For any i, j such that 1 \\leq i < j \\leq N, A_i B_i = A_j B_j holds.\n\nFind the minimum possible value of B_1 + ... + B_N for such B_1,...,B_N.\n\nSince the answer can be enormous, print the sum modulo (10^9 +7).\n\nConstraints\n\n1 \\leq N \\leq 10^4\n\n1 \\leq A_i \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\n\nOutput\n\nPrint the minimum possible value of B_1 + ... + B_N for B_1,...,B_N that satisfy the condition, modulo (10^9 +7).\n\nSample Input 1\n\n3\n2 3 4\n\nSample Output 1\n\n13\n\nLet B_1=6, B_2=4, and B_3=3, and the condition will be satisfied.\n\nSample Input 2\n\n5\n12 12 12 12 12\n\nSample Output 2\n\n5\n\nWe can let all B_i be 1.\n\nSample Input 3\n\n3\n1000000 999999 999998\n\nSample Output 3\n\n996989508\n\nPrint the sum modulo (10^9+7).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 13376, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s681363650", "group_id": "codeNet:p02796", "input_text": "program ap\n implicit none\n integer :: ans, larg, cnttai,in\n integer :: h, w , n, i, sumers, csum, err, j, jc(1)\n integer,allocatable,dimension(:) :: X, xmax, xmin\n integer,allocatable,dimension(:) :: L, cnt,ers\n integer,allocatable,dimension(:,:) :: taio\n\n read(*,*) n\n\n allocate( X(n) )\n allocate( L(n) )\n allocate( xmax(n) )\n allocate( xmin(n) )\n allocate( cnt(n) )\n allocate( ers(n) )\n allocate( taio(n,n) )\n \n do i=1,n\n read(*,*) X(i), L(i)\n xmax(i)=X(i)+L(i)\n xmin(i)=X(i)-L(i)\n enddo\n\n ers(:)=0\n cnt(:)=0\n sumers=0\n csum=0\n taio(:,:)=0\n do i=1,n\n do j=1,n\n if(i.eq.j) goto 300\n w=0\n if(xmax(i).gt.xmin(j).and.xmax(i).le.xmax(j)) then\n w=w+1\n endif\n if(xmin(i).lt.xmax(j).and.xmin(i).ge.xmin(j)) then\n w=w+1\n endif\n \n \n if(w.eq.2) then\n ers(j)=1\n taio(j,i)=1\n! print *, i, j\n elseif(w.eq.1) then\n taio(j,i)=1\n endif\n 300 continue\n enddo\n enddo\n do j=1,n\n do i=1,n\n csum=csum+taio(j,i)\n enddo\n enddo\n err=0\n\n do j=1,n\n if(ers(j).eq.1) then\n do i=1,n\n cnttai=cnttai+taio(j,i)\n enddo\n csum=csum-cnttai*2\n taio(j,:)=0\n taio(:,j)=0\n err=err+1\n endif\n enddo\n\n if(sum(taio).le.0) goto 400\n\n\n cnt(:)=0\n do j =1,n\n do i=1,n\n cnt(j)=cnt(j)+taio(j,i)\n enddo\n enddo\n \n do i=1,n\n\n cnt(:)=0\n do j =1,n\n do in=1,n\n cnt(j)=cnt(j)+taio(j,in)\n enddo\n enddo\n\n\n jc=maxloc(cnt)\n err=err+1\n! cnt(jc(1))=0\n taio(jc(i),:)=0\n taio(:,jc(i))=0\n do j =1,n\n do in=1,n\n larg=larg+taio(j,in)\n enddo\n enddo\n if(larg.le.0) goto 400\n\n enddo\n400 continue\n \n print *, n-err\n \nend program ap\n", "language": "Fortran", "metadata": {"date": 1579383931, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02796.html", "problem_id": "p02796", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02796/input.txt", "sample_output_relpath": "derived/input_output/data/p02796/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02796/Fortran/s681363650.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s681363650", "user_id": "u878839832"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program ap\n implicit none\n integer :: ans, larg, cnttai,in\n integer :: h, w , n, i, sumers, csum, err, j, jc(1)\n integer,allocatable,dimension(:) :: X, xmax, xmin\n integer,allocatable,dimension(:) :: L, cnt,ers\n integer,allocatable,dimension(:,:) :: taio\n\n read(*,*) n\n\n allocate( X(n) )\n allocate( L(n) )\n allocate( xmax(n) )\n allocate( xmin(n) )\n allocate( cnt(n) )\n allocate( ers(n) )\n allocate( taio(n,n) )\n \n do i=1,n\n read(*,*) X(i), L(i)\n xmax(i)=X(i)+L(i)\n xmin(i)=X(i)-L(i)\n enddo\n\n ers(:)=0\n cnt(:)=0\n sumers=0\n csum=0\n taio(:,:)=0\n do i=1,n\n do j=1,n\n if(i.eq.j) goto 300\n w=0\n if(xmax(i).gt.xmin(j).and.xmax(i).le.xmax(j)) then\n w=w+1\n endif\n if(xmin(i).lt.xmax(j).and.xmin(i).ge.xmin(j)) then\n w=w+1\n endif\n \n \n if(w.eq.2) then\n ers(j)=1\n taio(j,i)=1\n! print *, i, j\n elseif(w.eq.1) then\n taio(j,i)=1\n endif\n 300 continue\n enddo\n enddo\n do j=1,n\n do i=1,n\n csum=csum+taio(j,i)\n enddo\n enddo\n err=0\n\n do j=1,n\n if(ers(j).eq.1) then\n do i=1,n\n cnttai=cnttai+taio(j,i)\n enddo\n csum=csum-cnttai*2\n taio(j,:)=0\n taio(:,j)=0\n err=err+1\n endif\n enddo\n\n if(sum(taio).le.0) goto 400\n\n\n cnt(:)=0\n do j =1,n\n do i=1,n\n cnt(j)=cnt(j)+taio(j,i)\n enddo\n enddo\n \n do i=1,n\n\n cnt(:)=0\n do j =1,n\n do in=1,n\n cnt(j)=cnt(j)+taio(j,in)\n enddo\n enddo\n\n\n jc=maxloc(cnt)\n err=err+1\n! cnt(jc(1))=0\n taio(jc(i),:)=0\n taio(:,jc(i))=0\n do j =1,n\n do in=1,n\n larg=larg+taio(j,in)\n enddo\n enddo\n if(larg.le.0) goto 400\n\n enddo\n400 continue\n \n print *, n-err\n \nend program ap\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn a factory, there are N robots placed on a number line.\nRobot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative.\n\nWe want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect.\nHere, for each i (1 \\leq i \\leq N), the movable range of arms of Robot i is the part of the number line between the coordinates X_i - L_i and X_i + L_i, excluding the endpoints.\n\nFind the maximum number of robots that we can keep.\n\nConstraints\n\n1 \\leq N \\leq 100,000\n\n0 \\leq X_i \\leq 10^9 (1 \\leq i \\leq N)\n\n1 \\leq L_i \\leq 10^9 (1 \\leq i \\leq N)\n\nIf i \\neq j, X_i \\neq X_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 L_1\nX_2 L_2\n\\vdots\nX_N L_N\n\nOutput\n\nPrint the maximum number of robots that we can keep.\n\nSample Input 1\n\n4\n2 4\n4 3\n9 3\n100 5\n\nSample Output 1\n\n3\n\nBy removing Robot 2, we can keep the other three robots.\n\nSample Input 2\n\n2\n8 20\n1 10\n\nSample Output 2\n\n1\n\nSample Input 3\n\n5\n10 1\n2 1\n4 1\n6 1\n8 1\n\nSample Output 3\n\n5", "sample_input": "4\n2 4\n4 3\n9 3\n100 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02796", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn a factory, there are N robots placed on a number line.\nRobot i is placed at coordinate X_i and can extend its arms of length L_i in both directions, positive and negative.\n\nWe want to remove zero or more robots so that the movable ranges of arms of no two remaining robots intersect.\nHere, for each i (1 \\leq i \\leq N), the movable range of arms of Robot i is the part of the number line between the coordinates X_i - L_i and X_i + L_i, excluding the endpoints.\n\nFind the maximum number of robots that we can keep.\n\nConstraints\n\n1 \\leq N \\leq 100,000\n\n0 \\leq X_i \\leq 10^9 (1 \\leq i \\leq N)\n\n1 \\leq L_i \\leq 10^9 (1 \\leq i \\leq N)\n\nIf i \\neq j, X_i \\neq X_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX_1 L_1\nX_2 L_2\n\\vdots\nX_N L_N\n\nOutput\n\nPrint the maximum number of robots that we can keep.\n\nSample Input 1\n\n4\n2 4\n4 3\n9 3\n100 5\n\nSample Output 1\n\n3\n\nBy removing Robot 2, we can keep the other three robots.\n\nSample Input 2\n\n2\n8 20\n1 10\n\nSample Output 2\n\n1\n\nSample Input 3\n\n5\n10 1\n2 1\n4 1\n6 1\n8 1\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1846, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s167653341", "group_id": "codeNet:p02797", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,k,s\n integer(int32), allocatable:: ans(:)\n\n read*, n,k,s\n allocate(ans(n))\n ans(:) = 1000000000\n ans(1:k) = s\n print*, ans(:)\nend program name", "language": "Fortran", "metadata": {"date": 1587136490, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02797.html", "problem_id": "p02797", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02797/input.txt", "sample_output_relpath": "derived/input_output/data/p02797/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02797/Fortran/s167653341.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s167653341", "user_id": "u234636620"}, "prompt_components": {"gold_output": "1 2 3 4\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,k,s\n integer(int32), allocatable:: ans(:)\n\n read*, n,k,s\n allocate(ans(n))\n ans(:) = 1000000000\n ans(1:k) = s\n print*, ans(:)\nend program name", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are three integers N, K, and S.\n\nFind a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below.\nWe can prove that, under the conditions in Constraints, such a sequence always exists.\n\nThere are exactly K pairs (l, r) of integers such that 1 \\leq l \\leq r \\leq N and A_l + A_{l + 1} + \\cdots + A_r = S.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq K \\leq N\n\n1 \\leq S \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K S\n\nOutput\n\nPrint a sequence satisfying the condition, in the following format:\n\nA_1 A_2 ... A_N\n\nSample Input 1\n\n4 2 3\n\nSample Output 1\n\n1 2 3 4\n\nTwo pairs (l, r) = (1, 2) and (3, 3) satisfy the condition in the statement.\n\nSample Input 2\n\n5 3 100\n\nSample Output 2\n\n50 50 50 30 70", "sample_input": "4 2 3\n"}, "reference_outputs": ["1 2 3 4\n"], "source_document_id": "p02797", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are three integers N, K, and S.\n\nFind a sequence A_1, A_2, ..., A_N of N integers between 1 and 10^9 (inclusive) that satisfies the condition below.\nWe can prove that, under the conditions in Constraints, such a sequence always exists.\n\nThere are exactly K pairs (l, r) of integers such that 1 \\leq l \\leq r \\leq N and A_l + A_{l + 1} + \\cdots + A_r = S.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq K \\leq N\n\n1 \\leq S \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K S\n\nOutput\n\nPrint a sequence satisfying the condition, in the following format:\n\nA_1 A_2 ... A_N\n\nSample Input 1\n\n4 2 3\n\nSample Output 1\n\n1 2 3 4\n\nTwo pairs (l, r) = (1, 2) and (3, 3) satisfy the condition in the statement.\n\nSample Input 2\n\n5 3 100\n\nSample Output 2\n\n50 50 50 30 70", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 251, "cpu_time_ms": 28, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s379943530", "group_id": "codeNet:p02801", "input_text": "program next_alphabet\n implicit none\n character(1):: c\n character(26), parameter:: alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n integer:: i\n\n read*, c\n do i=1, 26\n if (alphabet(i:i) == c)then\n print*, alphabet(i+1:i+1)\n stop\n end if\n end do\nend program next_alphabet", "language": "Fortran", "metadata": {"date": 1580343555, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02801.html", "problem_id": "p02801", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02801/input.txt", "sample_output_relpath": "derived/input_output/data/p02801/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02801/Fortran/s379943530.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s379943530", "user_id": "u234636620"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "program next_alphabet\n implicit none\n character(1):: c\n character(26), parameter:: alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n integer:: i\n\n read*, c\n do i=1, 26\n if (alphabet(i:i) == c)then\n print*, alphabet(i+1:i+1)\n stop\n end if\n end do\nend program next_alphabet", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order.\n\nConstraints\n\nC is a lowercase English letter that is not z.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nC\n\nOutput\n\nPrint the letter that follows C in alphabetical order.\n\nSample Input 1\n\na\n\nSample Output 1\n\nb\n\na is followed by b.\n\nSample Input 2\n\ny\n\nSample Output 2\n\nz\n\ny is followed by z.", "sample_input": "a\n"}, "reference_outputs": ["b\n"], "source_document_id": "p02801", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order.\n\nConstraints\n\nC is a lowercase English letter that is not z.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nC\n\nOutput\n\nPrint the letter that follows C in alphabetical order.\n\nSample Input 1\n\na\n\nSample Output 1\n\nb\n\na is followed by b.\n\nSample Input 2\n\ny\n\nSample Output 2\n\nz\n\ny is followed by z.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 319, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s746326903", "group_id": "codeNet:p02802", "input_text": "program main\n implicit none\n integer(8) :: n, m, i, j, cor, pna, w\n integer(8), allocatable :: p(:)\n character(2), allocatable :: s(:)\n\n read(*,*) n, m\n allocate(p(m))\n allocate(s(m))\n do i = 1, m\n read(*,*) p(i), s(i)\n end do\n\n cor = 0\n pna = 0\n do i = 1, n\n w = 0\n do j = 1, m\n if(p(j) == i) then\n if(s(j) == 'WA') then\n w = w + 1\n else\n cor = cor + 1\n pna = pna + w\n exit\n end if\n end if\n end do\n end do\n\n write(*,*) cor, pna\nend program main\n\n \n", "language": "Fortran", "metadata": {"date": 1596246364, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02802.html", "problem_id": "p02802", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02802/input.txt", "sample_output_relpath": "derived/input_output/data/p02802/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02802/Fortran/s746326903.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s746326903", "user_id": "u979474608"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: n, m, i, j, cor, pna, w\n integer(8), allocatable :: p(:)\n character(2), allocatable :: s(:)\n\n read(*,*) n, m\n allocate(p(m))\n allocate(s(m))\n do i = 1, m\n read(*,*) p(i), s(i)\n end do\n\n cor = 0\n pna = 0\n do i = 1, n\n w = 0\n do j = 1, m\n if(p(j) == i) then\n if(s(j) == 'WA') then\n w = w + 1\n else\n cor = cor + 1\n pna = pna + w\n exit\n end if\n end if\n end do\n end do\n\n write(*,*) cor, pna\nend program main\n\n \n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "sample_input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p02802", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 582, "cpu_time_ms": 2205, "memory_kb": 3620}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s796431117", "group_id": "codeNet:p02802", "input_text": "program welcome_to_atcoder\n implicit none\n integer(4):: n, m, i, all_ac, all_pena\n integer(4), allocatable:: p(:),pena(:)\n character(2), allocatable:: s(:)\n logical, allocatable:: is_ac(:)\n read*, n, m\n allocate(p(m), s(m), is_ac(n), pena(n))\n do i=1, m\n read*, p(i),s(i)\n end do\n is_ac(:) = .false.\n pena(:) = 0\n do i=1, m\n if (s(i) == \"AC\") then\n is_ac(p(i)) = .true.\n else\n if (.not. is_ac(p(i))) pena(p(i)) = pena(p(i)) + 1\n end if\n end do\n\n all_ac = 0\n all_pena = 0\n\n do i=1, n\n if (is_ac(i)) then\n all_ac = all_ac + 1\n all_pena = all_pena + pena(i) \n end if \n end do\n\n print\"(i01xi0)\", all_ac, all_pena\n\n \nend program welcome_to_atcoder", "language": "Fortran", "metadata": {"date": 1580367768, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02802.html", "problem_id": "p02802", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02802/input.txt", "sample_output_relpath": "derived/input_output/data/p02802/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02802/Fortran/s796431117.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s796431117", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "program welcome_to_atcoder\n implicit none\n integer(4):: n, m, i, all_ac, all_pena\n integer(4), allocatable:: p(:),pena(:)\n character(2), allocatable:: s(:)\n logical, allocatable:: is_ac(:)\n read*, n, m\n allocate(p(m), s(m), is_ac(n), pena(n))\n do i=1, m\n read*, p(i),s(i)\n end do\n is_ac(:) = .false.\n pena(:) = 0\n do i=1, m\n if (s(i) == \"AC\") then\n is_ac(p(i)) = .true.\n else\n if (.not. is_ac(p(i))) pena(p(i)) = pena(p(i)) + 1\n end if\n end do\n\n all_ac = 0\n all_pena = 0\n\n do i=1, n\n if (is_ac(i)) then\n all_ac = all_ac + 1\n all_pena = all_pena + pena(i) \n end if \n end do\n\n print\"(i01xi0)\", all_ac, all_pena\n\n \nend program welcome_to_atcoder", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "sample_input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p02802", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 791, "cpu_time_ms": 52, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s470722591", "group_id": "codeNet:p02802", "input_text": "program test03\n implicit none\n integer N, M\n integer i\n integer,allocatable :: AC(:)\n integer,allocatable :: WA(:)\n integer Nnum\n character Nkek*2\n integer :: allAC=0, allWA=0\n\n\n read *, N, M\n allocate(AC(N))\n allocate(WA(N))\n AC=0; WA=0\n\n do i=1,M\n read *, Nnum, Nkek\n if ( Nkek == 'AC' ) then\n AC(Nnum)=1\n else\n if ( AC(Nnum) == 0 ) then\n WA(Nnum)=WA(Nnum)+1\n end if\n end if\n end do\n\n do i=1,N\n allAC=allAC+AC(i)\n if ( AC(i) == 1 ) then\n allWA=allWA+WA(i)\n end if\n end do\n\n print '(i0,A,i0)', allAC, ' ',allWA\n\nendprogram test03\n", "language": "Fortran", "metadata": {"date": 1579729114, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02802.html", "problem_id": "p02802", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02802/input.txt", "sample_output_relpath": "derived/input_output/data/p02802/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02802/Fortran/s470722591.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s470722591", "user_id": "u838994321"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "program test03\n implicit none\n integer N, M\n integer i\n integer,allocatable :: AC(:)\n integer,allocatable :: WA(:)\n integer Nnum\n character Nkek*2\n integer :: allAC=0, allWA=0\n\n\n read *, N, M\n allocate(AC(N))\n allocate(WA(N))\n AC=0; WA=0\n\n do i=1,M\n read *, Nnum, Nkek\n if ( Nkek == 'AC' ) then\n AC(Nnum)=1\n else\n if ( AC(Nnum) == 0 ) then\n WA(Nnum)=WA(Nnum)+1\n end if\n end if\n end do\n\n do i=1,N\n allAC=allAC+AC(i)\n if ( AC(i) == 1 ) then\n allWA=allWA+WA(i)\n end if\n end do\n\n print '(i0,A,i0)', allAC, ' ',allWA\n\nendprogram test03\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "sample_input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p02802", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 548, "cpu_time_ms": 52, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s773941213", "group_id": "codeNet:p02802", "input_text": "program main\nimplicit none\ninteger i,j,k,m,n,n_answer,n_penalty\ninteger,allocatable :: p(:),S(:)\ncharacter(2) chr\nread(*,*) n,m\nallocate(p(m))\nallocate(S(m))\nS(:)=0\ndo i=1,m\n read(*,*) p(i),chr\n if (chr=='AC') then\n S(i)=1\n else if (chr=='WA') then\n S(i)=2\n end if\nend do\nn_answer=0; n_penalty=0\ndo i=1,n\n do j=1,m\n !write(*,*) 'i,j',i,j\n if(p(j)==i .and. S(j)==1) then\n n_answer = n_answer + 1\n do k=1,j-1\n if(p(k)==i) then\n if (S(k)==2) then\n n_penalty = n_penalty + 1\n end if\n end if\n !write(*,*) 'k,pen',k,n_penalty\n end do\n exit\n end if\n end do\nend do\nwrite(*,'(i0,a,i0)') n_answer,' ',n_penalty\nend program main", "language": "Fortran", "metadata": {"date": 1579405493, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02802.html", "problem_id": "p02802", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02802/input.txt", "sample_output_relpath": "derived/input_output/data/p02802/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02802/Fortran/s773941213.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s773941213", "user_id": "u172620302"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "program main\nimplicit none\ninteger i,j,k,m,n,n_answer,n_penalty\ninteger,allocatable :: p(:),S(:)\ncharacter(2) chr\nread(*,*) n,m\nallocate(p(m))\nallocate(S(m))\nS(:)=0\ndo i=1,m\n read(*,*) p(i),chr\n if (chr=='AC') then\n S(i)=1\n else if (chr=='WA') then\n S(i)=2\n end if\nend do\nn_answer=0; n_penalty=0\ndo i=1,n\n do j=1,m\n !write(*,*) 'i,j',i,j\n if(p(j)==i .and. S(j)==1) then\n n_answer = n_answer + 1\n do k=1,j-1\n if(p(k)==i) then\n if (S(k)==2) then\n n_penalty = n_penalty + 1\n end if\n end if\n !write(*,*) 'k,pen',k,n_penalty\n end do\n exit\n end if\n end do\nend do\nwrite(*,'(i0,a,i0)') n_answer,' ',n_penalty\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "sample_input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p02802", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 729, "cpu_time_ms": 2103, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s001507346", "group_id": "codeNet:p02802", "input_text": "program main\n\n implicit none\n\n integer :: n, m, i, j\n integer(8) :: nac, nwa\n integer,allocatable :: p(:), jj(:)\n character(2),allocatable :: s(:)\n \n read(*,*) n, m\n allocate( p(m) )\n allocate( s(m) )\n allocate( jj(n) ); jj = 0\n\n do i = 1, m \n read(*,*) p(i), s(i)\n end do\n\n do i = 1, m \n if ( s(i) == \"AC\" .and. jj( p(i) ) == 0 ) then\n nac = nac + 1\n jj( p(i) ) = jj( p(i) ) + 1\n else if ( s(i) == \"WA\" .and. jj( p(i) ) == 0 ) then\n nwa = nwa + 1\n end if\n end do\n\n print*, nac, nwa\n \nend program main\n", "language": "Fortran", "metadata": {"date": 1578885829, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02802.html", "problem_id": "p02802", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02802/input.txt", "sample_output_relpath": "derived/input_output/data/p02802/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02802/Fortran/s001507346.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s001507346", "user_id": "u675314298"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "program main\n\n implicit none\n\n integer :: n, m, i, j\n integer(8) :: nac, nwa\n integer,allocatable :: p(:), jj(:)\n character(2),allocatable :: s(:)\n \n read(*,*) n, m\n allocate( p(m) )\n allocate( s(m) )\n allocate( jj(n) ); jj = 0\n\n do i = 1, m \n read(*,*) p(i), s(i)\n end do\n\n do i = 1, m \n if ( s(i) == \"AC\" .and. jj( p(i) ) == 0 ) then\n nac = nac + 1\n jj( p(i) ) = jj( p(i) ) + 1\n else if ( s(i) == \"WA\" .and. jj( p(i) ) == 0 ) then\n nwa = nwa + 1\n end if\n end do\n\n print*, nac, nwa\n \nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "sample_input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p02802", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 549, "cpu_time_ms": 52, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s862672919", "group_id": "codeNet:p02802", "input_text": "program main\n\n implicit none\n\n integer :: n, m, i, j, nac, nwa\n integer,allocatable :: p(:)\n character(2),allocatable :: s(:)\n \n read(*,*) n, m\n allocate( p(m) )\n allocate( s(m) )\n\n do i = 1, m \n read(*,*) p(i), s(i)\n end do\n \n nac = 0; nwa = 0 \n do j = 1, n \n do i = 1, m \n if ( s(i) == \"WA\" .and. j == p(i) ) then\n nwa = nwa + 1\n! print*, j, i, nwa, nac \n end if\n if ( s(i) == \"AC\" .and. j == p(i) ) then\n nac = nac + 1\n! print*, j, i, nwa, nac \n exit\n end if\n end do\n end do\n\n print*, nac, nwa\n\n \nend program main\n", "language": "Fortran", "metadata": {"date": 1578882566, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02802.html", "problem_id": "p02802", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02802/input.txt", "sample_output_relpath": "derived/input_output/data/p02802/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02802/Fortran/s862672919.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s862672919", "user_id": "u675314298"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "program main\n\n implicit none\n\n integer :: n, m, i, j, nac, nwa\n integer,allocatable :: p(:)\n character(2),allocatable :: s(:)\n \n read(*,*) n, m\n allocate( p(m) )\n allocate( s(m) )\n\n do i = 1, m \n read(*,*) p(i), s(i)\n end do\n \n nac = 0; nwa = 0 \n do j = 1, n \n do i = 1, m \n if ( s(i) == \"WA\" .and. j == p(i) ) then\n nwa = nwa + 1\n! print*, j, i, nwa, nac \n end if\n if ( s(i) == \"AC\" .and. j == p(i) ) then\n nac = nac + 1\n! print*, j, i, nwa, nac \n exit\n end if\n end do\n end do\n\n print*, nac, nwa\n\n \nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "sample_input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p02802", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 598, "cpu_time_ms": 2103, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s576807280", "group_id": "codeNet:p02802", "input_text": "program welcome_to_atcoder\n implicit none\n integer :: n, m, p, wa(100000) = 0, i, a = 0, w = 0\n logical :: ac(100000) = .false.\n character(1) :: s\n read(*,*) n, m\n do i = 1, m\n read(*,*) p, s\n ac(p) = ac(p) .or. s == \"A\"\n if (ac(p)) cycle\n wa(p) = wa(p)+1\n end do\n do i = 1, n\n if (ac(i)) then\n a = a+1\n w = w+wa(i)\n end if\n end do\n write(*,'(i0,x,i0)') a, w\nend program welcome_to_atcoder", "language": "Fortran", "metadata": {"date": 1578881472, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02802.html", "problem_id": "p02802", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02802/input.txt", "sample_output_relpath": "derived/input_output/data/p02802/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02802/Fortran/s576807280.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s576807280", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "program welcome_to_atcoder\n implicit none\n integer :: n, m, p, wa(100000) = 0, i, a = 0, w = 0\n logical :: ac(100000) = .false.\n character(1) :: s\n read(*,*) n, m\n do i = 1, m\n read(*,*) p, s\n ac(p) = ac(p) .or. s == \"A\"\n if (ac(p)) cycle\n wa(p) = wa(p)+1\n end do\n do i = 1, n\n if (ac(i)) then\n a = a+1\n w = w+wa(i)\n end if\n end do\n write(*,'(i0,x,i0)') a, w\nend program welcome_to_atcoder", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "sample_input": "2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p02802", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi participated in a contest on AtCoder.\n\nThe contest had N problems.\n\nTakahashi made M submissions during the contest.\n\nThe i-th submission was made for the p_i-th problem and received the verdict S_i (AC or WA).\n\nThe number of Takahashi's correct answers is the number of problems on which he received an AC once or more.\n\nThe number of Takahashi's penalties is the sum of the following count for the problems on which he received an AC once or more: the number of WAs received before receiving an AC for the first time on that problem.\n\nFind the numbers of Takahashi's correct answers and penalties.\n\nConstraints\n\nN, M, and p_i are integers.\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq 10^5\n\n1 \\leq p_i \\leq N\n\nS_i is AC or WA.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 S_1\n:\np_M S_M\n\nOutput\n\nPrint the number of Takahashi's correct answers and the number of Takahashi's penalties.\n\nSample Input 1\n\n2 5\n1 WA\n1 AC\n2 WA\n2 AC\n2 WA\n\nSample Output 1\n\n2 2\n\nIn his second submission, he received an AC on the first problem for the first time. Before this, he received one WA on this problem.\n\nIn his fourth submission, he received an AC on the second problem for the first time. Before this, he received one WA on this problem.\n\nThus, he has two correct answers and two penalties.\n\nSample Input 2\n\n100000 3\n7777 AC\n7777 AC\n7777 AC\n\nSample Output 2\n\n1 0\n\nNote that it is pointless to get an AC more than once on the same problem.\n\nSample Input 3\n\n6 0\n\nSample Output 3\n\n0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 427, "cpu_time_ms": 52, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s479788424", "group_id": "codeNet:p02803", "input_text": "program ABC151D\n implicit none\n integer::H,W\n character(20)::S\n integer,allocatable,dimension(:,:)::maze\n integer,allocatable,dimension(:,:)::Route\n integer::i,j\n integer::ans\n read*,H,W\n allocate(maze(H,W))\n maze=0\n do i=1,H\n read*,S\n do j=1,W\n if(S(j:j)==\".\")maze(i,j)=1\n end do\n end do\n allocate(Route(point(H,W),point(H,W)))\n Route=1000\n do i=1,W\n if(maze(geti(i),getj(i))==1)then\n Route(i,i)=0\n if(i/=1)then\n if(maze(geti(i),getj(i)-1)==1)then\n Route(i,i-1)=1\n Route(i-1,i)=1\n endif\n endif\n endif\n end do\n do i=W+1,H*W\n if(maze(geti(i),getj(i))==1)then\n Route(i,i)=0\n if(geti(i)/=1)then\n if(maze(geti(i),getj(i)-1)==1)then\n Route(i,i-1)=1\n Route(i-1,i)=1\n endif\n endif\n if(maze(geti(i)-1,getj(i))==1)then\n Route(i,i-W)=1\n Route(i-W,i)=1\n endif\n endif\n end do\n call Warshall_Floyd(H*W,Route)\n ans=0\n do i=1,H*W\n do j=1,H*W\n if(Route(i,j)/=1000)ans=max(ans,Route(i,j))\n end do\n end do\n print\"(i0)\",ans\ncontains\nfunction point(i,j)\n integer::i,j\n integer::point\n point=(i-1)*W+j\nend function\nfunction geti(i)\n integer::i\n integer::geti\n geti=(i-1)/W +1\nend function\nfunction getj(i)\n integer::i\n integer::getj\n getj=mod(i-1,W)+1\nend function\nsubroutine Warshall_Floyd(n,Route)\n !nは頂点の数、Routeは全ての経路の長さを記録したもの\n !以下の型宣言は場合に応じて変えること\n implicit none\n integer, intent(in) :: n\n integer, intent(inout) :: Route(n, n)\n integer :: i, j, k\n\n do k = 1, n\n do i = 1, n\n do j = 1, n\n Route(j, i) = min( Route(j, i), Route(j, k) + Route(k, i))\n end do\n end do\n end do\nend subroutine Warshall_Floyd\nend program ABC151D", "language": "Fortran", "metadata": {"date": 1578883411, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02803.html", "problem_id": "p02803", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02803/input.txt", "sample_output_relpath": "derived/input_output/data/p02803/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02803/Fortran/s479788424.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s479788424", "user_id": "u598073939"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program ABC151D\n implicit none\n integer::H,W\n character(20)::S\n integer,allocatable,dimension(:,:)::maze\n integer,allocatable,dimension(:,:)::Route\n integer::i,j\n integer::ans\n read*,H,W\n allocate(maze(H,W))\n maze=0\n do i=1,H\n read*,S\n do j=1,W\n if(S(j:j)==\".\")maze(i,j)=1\n end do\n end do\n allocate(Route(point(H,W),point(H,W)))\n Route=1000\n do i=1,W\n if(maze(geti(i),getj(i))==1)then\n Route(i,i)=0\n if(i/=1)then\n if(maze(geti(i),getj(i)-1)==1)then\n Route(i,i-1)=1\n Route(i-1,i)=1\n endif\n endif\n endif\n end do\n do i=W+1,H*W\n if(maze(geti(i),getj(i))==1)then\n Route(i,i)=0\n if(geti(i)/=1)then\n if(maze(geti(i),getj(i)-1)==1)then\n Route(i,i-1)=1\n Route(i-1,i)=1\n endif\n endif\n if(maze(geti(i)-1,getj(i))==1)then\n Route(i,i-W)=1\n Route(i-W,i)=1\n endif\n endif\n end do\n call Warshall_Floyd(H*W,Route)\n ans=0\n do i=1,H*W\n do j=1,H*W\n if(Route(i,j)/=1000)ans=max(ans,Route(i,j))\n end do\n end do\n print\"(i0)\",ans\ncontains\nfunction point(i,j)\n integer::i,j\n integer::point\n point=(i-1)*W+j\nend function\nfunction geti(i)\n integer::i\n integer::geti\n geti=(i-1)/W +1\nend function\nfunction getj(i)\n integer::i\n integer::getj\n getj=mod(i-1,W)+1\nend function\nsubroutine Warshall_Floyd(n,Route)\n !nは頂点の数、Routeは全ての経路の長さを記録したもの\n !以下の型宣言は場合に応じて変えること\n implicit none\n integer, intent(in) :: n\n integer, intent(inout) :: Route(n, n)\n integer :: i, j, k\n\n do k = 1, n\n do i = 1, n\n do j = 1, n\n Route(j, i) = min( Route(j, i), Route(j, k) + Route(k, i))\n end do\n end do\n end do\nend subroutine Warshall_Floyd\nend program ABC151D", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a maze, which is a grid of H \\times W squares with H horizontal rows and W vertical columns.\n\nThe square at the i-th row from the top and the j-th column is a \"wall\" square if S_{ij} is #, and a \"road\" square if S_{ij} is ..\n\nFrom a road square, you can move to a horizontally or vertically adjacent road square.\n\nYou cannot move out of the maze, move to a wall square, or move diagonally.\n\nTakahashi will choose a starting square and a goal square, which can be any road squares, and give the maze to Aoki.\n\nAoki will then travel from the starting square to the goal square, in the minimum number of moves required.\n\nIn this situation, find the maximum possible number of moves Aoki has to make.\n\nConstraints\n\n1 \\leq H,W \\leq 20\n\nS_{ij} is . or #.\n\nS contains at least two occurrences of ..\n\nAny road square can be reached from any road square in zero or more moves.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_{11}...S_{1W}\n:\nS_{H1}...S_{HW}\n\nOutput\n\nPrint the maximum possible number of moves Aoki has to make.\n\nSample Input 1\n\n3 3\n...\n...\n...\n\nSample Output 1\n\n4\n\nIf Takahashi chooses the top-left square as the starting square and the bottom-right square as the goal square, Aoki has to make four moves.\n\nSample Input 2\n\n3 5\n...#.\n.#.#.\n.#...\n\nSample Output 2\n\n10\n\nIf Takahashi chooses the bottom-left square as the starting square and the top-right square as the goal square, Aoki has to make ten moves.", "sample_input": "3 3\n...\n...\n...\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02803", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a maze, which is a grid of H \\times W squares with H horizontal rows and W vertical columns.\n\nThe square at the i-th row from the top and the j-th column is a \"wall\" square if S_{ij} is #, and a \"road\" square if S_{ij} is ..\n\nFrom a road square, you can move to a horizontally or vertically adjacent road square.\n\nYou cannot move out of the maze, move to a wall square, or move diagonally.\n\nTakahashi will choose a starting square and a goal square, which can be any road squares, and give the maze to Aoki.\n\nAoki will then travel from the starting square to the goal square, in the minimum number of moves required.\n\nIn this situation, find the maximum possible number of moves Aoki has to make.\n\nConstraints\n\n1 \\leq H,W \\leq 20\n\nS_{ij} is . or #.\n\nS contains at least two occurrences of ..\n\nAny road square can be reached from any road square in zero or more moves.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_{11}...S_{1W}\n:\nS_{H1}...S_{HW}\n\nOutput\n\nPrint the maximum possible number of moves Aoki has to make.\n\nSample Input 1\n\n3 3\n...\n...\n...\n\nSample Output 1\n\n4\n\nIf Takahashi chooses the top-left square as the starting square and the bottom-right square as the goal square, Aoki has to make four moves.\n\nSample Input 2\n\n3 5\n...#.\n.#.#.\n.#...\n\nSample Output 2\n\n10\n\nIf Takahashi chooses the bottom-left square as the starting square and the top-right square as the goal square, Aoki has to make ten moves.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2064, "cpu_time_ms": 69, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s033879710", "group_id": "codeNet:p02805", "input_text": "program fff\nimplicit none\n\ninteger :: n, i, j, k, co\nreal(8) :: z1, res\nreal(8),allocatable,dimension(:) :: x, y\nreal(8),allocatable,dimension(:,:) :: z\n\nread*, n\nallocate(x(n),y(n))\ndo i = 1, n\nread*, x(i), y(i)\nend do\n\nif (n==2) then\nprint*, ((x(1)-x(2))**2 + (y(1)-y(2))**2)*1/2\nreturn\nend if\n\nallocate(z(4,n*(n-1)*(n-2)/6))\n\nco = 0\nz = 0.0D0\ndo i = 1, n\n\tdo j = i+1, n\n \tdo k = j+1, n\n co = co + 1\n z(1,co) = ((x(i)-x(j))**2 + (y(i)-y(j))**2)**0.5D0\n\t\tz(2,co) = ((x(j)-x(k))**2 + (y(j)-y(k))**2)**0.5D0\n z(3,co) = ((x(k)-x(i))**2 + (y(k)-y(i))**2)**0.5D0\n z1 = (z(1,co)+z(2,co)+z(3,co))*0.5D0\n z(4,co) = (z1*(z1-z(1,co))*(z1-z(2,co))*(z1-z(3,co)))**0.5D0\n\t\tz(4,co) = z(1,co)*z(2,co)*z(3,co)/(4*z(4,co))\n\t\t\tif (z(1,co)*(2**0.5)>z(2,co)+z(3,co)) z(4,co) = z(1,co)*0.5 \n\t\t\tif (z(2,co)*(2**0.5)>z(3,co)+z(1,co)) z(4,co) = z(2,co)*0.5 \n\t\t\tif (z(3,co)*(2**0.5)>z(1,co)+z(2,co)) z(4,co) = z(3,co)*0.5 \n end do\n end do\nend do\n\nres = 0.0D0\ndo i = 1, (n*(n-1)*(n-2)/6)\n\tif (resz(2,co)+z(3,co)) z(4,co) = z(1,co)*0.5 \n\t\t\tif (z(2,co)*(2**0.5)>z(3,co)+z(1,co)) z(4,co) = z(2,co)*0.5 \n\t\t\tif (z(3,co)*(2**0.5)>z(1,co)+z(2,co)) z(4,co) = z(3,co)*0.5 \n end do\n end do\nend do\n\nres = 0.0D0\ndo i = 1, (n*(n-1)*(n-2)/6)\n\tif (res= x ) then\n print *, 'Yes'\n else\n print *, 'No'\n end if\n \n endprogram test01", "language": "Fortran", "metadata": {"date": 1581288570, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02811.html", "problem_id": "p02811", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02811/input.txt", "sample_output_relpath": "derived/input_output/data/p02811/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02811/Fortran/s848871476.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s848871476", "user_id": "u838994321"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program test01\nimplicit none\n integer k, x, gou\n \n read *, k, x\n \n gou = 500 * k\n if ( gou >= x ) then\n print *, 'Yes'\n else\n print *, 'No'\n end if\n \n endprogram test01", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "sample_input": "2 900\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02811", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has K 500-yen coins. (Yen is the currency of Japan.)\nIf these coins add up to X yen or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n1 \\leq X \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nIf the coins add up to X yen or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 900\n\nSample Output 1\n\nYes\n\nTwo 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.\n\nSample Input 2\n\n1 501\n\nSample Output 2\n\nNo\n\nOne 500-yen coin is worth 500 yen, which is less than X = 501 yen.\n\nSample Input 3\n\n4 2000\n\nSample Output 3\n\nYes\n\nFour 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 170, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s692893639", "group_id": "codeNet:p02812", "input_text": "program countabc\n implicit none\n integer :: n,l,ans,i\n character::s\n \n read*,n,s \n l=len_trim(s)\n \n ans=0\n do i=1,l-2\n if(s(i:i+2)=='ABC') ans=ans+1\n end do\n\n print*,ans\n\nend program countabc\n \n \n ", "language": "Fortran", "metadata": {"date": 1588535421, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02812.html", "problem_id": "p02812", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02812/input.txt", "sample_output_relpath": "derived/input_output/data/p02812/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02812/Fortran/s692893639.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s692893639", "user_id": "u882765852"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program countabc\n implicit none\n integer :: n,l,ans,i\n character::s\n \n read*,n,s \n l=len_trim(s)\n \n ans=0\n do i=1,l-2\n if(s(i:i+2)=='ABC') ans=ans+1\n end do\n\n print*,ans\n\nend program countabc\n \n \n ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "sample_input": "10\nZABCDBABCQ\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02812", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S of length N consisting of uppercase English letters.\n\nHow many times does ABC occur in S as contiguous subsequences (see Sample Inputs and Outputs)?\n\nConstraints\n\n3 \\leq N \\leq 50\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint number of occurrences of ABC in S as contiguous subsequences.\n\nSample Input 1\n\n10\nZABCDBABCQ\n\nSample Output 1\n\n2\n\nTwo contiguous subsequences of S are equal to ABC: the 2-nd through 4-th characters, and the 7-th through 9-th characters.\n\nSample Input 2\n\n19\nTHREEONEFOURONEFIVE\n\nSample Output 2\n\n0\n\nNo contiguous subsequences of S are equal to ABC.\n\nSample Input 3\n\n33\nABCCABCBABCCABACBCBBABCBCBCBCABCB\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 211, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s298017372", "group_id": "codeNet:p02813", "input_text": "program speedrun\nimplicit none\ninteger::N\ninteger,allocatable,dimension(:)::P,Q\ninteger,allocatable,dimension(:)::Perm,DID\ninteger::i\ninteger::a=0,b=0\nread*,N\nallocate(P(N),Q(N),Perm(0:N),DID(1:N))\nread*,P\nread*,Q\nPerm=1\ndo i=1,N\n Perm(i)=Perm(i-1)*i\nend do\nDID=0\ndo i=1,N\n a=a+Perm(N-i)*(P(i)-sum(DID(1:P(i)))+1)\n DID(P(i))=1\nend do\nDID=0\ndo i=1,N\n b=b+Perm(N-i)*(Q(i)-sum(DID(1:Q(i)))+1)\n DID(Q(i))=1\nend do\nprint\"(i0)\",abs(a-b)\nend program speedrun", "language": "Fortran", "metadata": {"date": 1578719750, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02813.html", "problem_id": "p02813", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02813/input.txt", "sample_output_relpath": "derived/input_output/data/p02813/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02813/Fortran/s298017372.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s298017372", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program speedrun\nimplicit none\ninteger::N\ninteger,allocatable,dimension(:)::P,Q\ninteger,allocatable,dimension(:)::Perm,DID\ninteger::i\ninteger::a=0,b=0\nread*,N\nallocate(P(N),Q(N),Perm(0:N),DID(1:N))\nread*,P\nread*,Q\nPerm=1\ndo i=1,N\n Perm(i)=Perm(i-1)*i\nend do\nDID=0\ndo i=1,N\n a=a+Perm(N-i)*(P(i)-sum(DID(1:P(i)))+1)\n DID(P(i))=1\nend do\nDID=0\ndo i=1,N\n b=b+Perm(N-i)*(Q(i)-sum(DID(1:Q(i)))+1)\n DID(Q(i))=1\nend do\nprint\"(i0)\",abs(a-b)\nend program speedrun", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two permutations P and Q of size N (that is, P and Q are both rearrangements of (1,~2,~...,~N)).\n\nThere are N! possible permutations of size N. Among them, let P and Q be the a-th and b-th lexicographically smallest permutations, respectively. Find |a - b|.\n\nNotes\n\nFor two sequences X and Y, X is said to be lexicographically smaller than Y if and only if there exists an integer k such that X_i = Y_i~(1 \\leq i < k) and X_k < Y_k.\n\nConstraints\n\n2 \\leq N \\leq 8\n\nP and Q are permutations of size N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 P_2 ... P_N\nQ_1 Q_2 ... Q_N\n\nOutput\n\nPrint |a - b|.\n\nSample Input 1\n\n3\n1 3 2\n3 1 2\n\nSample Output 1\n\n3\n\nThere are 6 permutations of size 3: (1,~2,~3), (1,~3,~2), (2,~1,~3), (2,~3,~1), (3,~1,~2), and (3,~2,~1). Among them, (1,~3,~2) and (3,~1,~2) come 2-nd and 5-th in lexicographical order, so the answer is |2 - 5| = 3.\n\nSample Input 2\n\n8\n7 3 5 4 2 1 6 8\n3 8 2 5 4 6 7 1\n\nSample Output 2\n\n17517\n\nSample Input 3\n\n3\n1 2 3\n1 2 3\n\nSample Output 3\n\n0", "sample_input": "3\n1 3 2\n3 1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02813", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two permutations P and Q of size N (that is, P and Q are both rearrangements of (1,~2,~...,~N)).\n\nThere are N! possible permutations of size N. Among them, let P and Q be the a-th and b-th lexicographically smallest permutations, respectively. Find |a - b|.\n\nNotes\n\nFor two sequences X and Y, X is said to be lexicographically smaller than Y if and only if there exists an integer k such that X_i = Y_i~(1 \\leq i < k) and X_k < Y_k.\n\nConstraints\n\n2 \\leq N \\leq 8\n\nP and Q are permutations of size N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 P_2 ... P_N\nQ_1 Q_2 ... Q_N\n\nOutput\n\nPrint |a - b|.\n\nSample Input 1\n\n3\n1 3 2\n3 1 2\n\nSample Output 1\n\n3\n\nThere are 6 permutations of size 3: (1,~2,~3), (1,~3,~2), (2,~1,~3), (2,~3,~1), (3,~1,~2), and (3,~2,~1). Among them, (1,~3,~2) and (3,~1,~2) come 2-nd and 5-th in lexicographical order, so the answer is |2 - 5| = 3.\n\nSample Input 2\n\n8\n7 3 5 4 2 1 6 8\n3 8 2 5 4 6 7 1\n\nSample Output 2\n\n17517\n\nSample Input 3\n\n3\n1 2 3\n1 2 3\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 466, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s118907732", "group_id": "codeNet:p02813", "input_text": "program count_order\n implicit none\n integer :: n, p(8) = 0, q(8) = 0, i\n integer :: a = 0, b = 0\n integer :: x(8) = (/1,2,3,4,5,6,7,8/)\n read(*,*) n\n read(*,*) p(1:n)\n read(*,*) q(1:n)\n call perm(x(1:n),[integer::])\n write(*,'(i0)') abs(a-b)\ncontains\n recursive subroutine perm(lin, lout)\n integer, intent(in) :: lin(:), lout(:)\n integer :: i\n if (size(lin) == 0) then\n a = a+cmp(p,lout)\n b = b+cmp(q,lout)\n else\n do i = 1, size(lin)\n call perm(pack(lin, lin /= lin(i)), [lout, lin(i)])\n end do\n end if\n end\n integer function cmp(x,y)\n integer, intent(in) :: x(:), y(:)\n integer :: i\n cmp = 0\n do i = 1, n\n if (x(i) > y(i)) then\n cmp = 1\n return\n else if (x(i) < y(i)) then\n return\n end if\n end do\n end\nend program count_order", "language": "Fortran", "metadata": {"date": 1578711587, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02813.html", "problem_id": "p02813", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02813/input.txt", "sample_output_relpath": "derived/input_output/data/p02813/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02813/Fortran/s118907732.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s118907732", "user_id": "u506403362"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program count_order\n implicit none\n integer :: n, p(8) = 0, q(8) = 0, i\n integer :: a = 0, b = 0\n integer :: x(8) = (/1,2,3,4,5,6,7,8/)\n read(*,*) n\n read(*,*) p(1:n)\n read(*,*) q(1:n)\n call perm(x(1:n),[integer::])\n write(*,'(i0)') abs(a-b)\ncontains\n recursive subroutine perm(lin, lout)\n integer, intent(in) :: lin(:), lout(:)\n integer :: i\n if (size(lin) == 0) then\n a = a+cmp(p,lout)\n b = b+cmp(q,lout)\n else\n do i = 1, size(lin)\n call perm(pack(lin, lin /= lin(i)), [lout, lin(i)])\n end do\n end if\n end\n integer function cmp(x,y)\n integer, intent(in) :: x(:), y(:)\n integer :: i\n cmp = 0\n do i = 1, n\n if (x(i) > y(i)) then\n cmp = 1\n return\n else if (x(i) < y(i)) then\n return\n end if\n end do\n end\nend program count_order", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have two permutations P and Q of size N (that is, P and Q are both rearrangements of (1,~2,~...,~N)).\n\nThere are N! possible permutations of size N. Among them, let P and Q be the a-th and b-th lexicographically smallest permutations, respectively. Find |a - b|.\n\nNotes\n\nFor two sequences X and Y, X is said to be lexicographically smaller than Y if and only if there exists an integer k such that X_i = Y_i~(1 \\leq i < k) and X_k < Y_k.\n\nConstraints\n\n2 \\leq N \\leq 8\n\nP and Q are permutations of size N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 P_2 ... P_N\nQ_1 Q_2 ... Q_N\n\nOutput\n\nPrint |a - b|.\n\nSample Input 1\n\n3\n1 3 2\n3 1 2\n\nSample Output 1\n\n3\n\nThere are 6 permutations of size 3: (1,~2,~3), (1,~3,~2), (2,~1,~3), (2,~3,~1), (3,~1,~2), and (3,~2,~1). Among them, (1,~3,~2) and (3,~1,~2) come 2-nd and 5-th in lexicographical order, so the answer is |2 - 5| = 3.\n\nSample Input 2\n\n8\n7 3 5 4 2 1 6 8\n3 8 2 5 4 6 7 1\n\nSample Output 2\n\n17517\n\nSample Input 3\n\n3\n1 2 3\n1 2 3\n\nSample Output 3\n\n0", "sample_input": "3\n1 3 2\n3 1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02813", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have two permutations P and Q of size N (that is, P and Q are both rearrangements of (1,~2,~...,~N)).\n\nThere are N! possible permutations of size N. Among them, let P and Q be the a-th and b-th lexicographically smallest permutations, respectively. Find |a - b|.\n\nNotes\n\nFor two sequences X and Y, X is said to be lexicographically smaller than Y if and only if there exists an integer k such that X_i = Y_i~(1 \\leq i < k) and X_k < Y_k.\n\nConstraints\n\n2 \\leq N \\leq 8\n\nP and Q are permutations of size N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nP_1 P_2 ... P_N\nQ_1 Q_2 ... Q_N\n\nOutput\n\nPrint |a - b|.\n\nSample Input 1\n\n3\n1 3 2\n3 1 2\n\nSample Output 1\n\n3\n\nThere are 6 permutations of size 3: (1,~2,~3), (1,~3,~2), (2,~1,~3), (2,~3,~1), (3,~1,~2), and (3,~2,~1). Among them, (1,~3,~2) and (3,~1,~2) come 2-nd and 5-th in lexicographical order, so the answer is |2 - 5| = 3.\n\nSample Input 2\n\n8\n7 3 5 4 2 1 6 8\n3 8 2 5 4 6 7 1\n\nSample Output 2\n\n17517\n\nSample Input 3\n\n3\n1 2 3\n1 2 3\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 832, "cpu_time_ms": 25, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s724951540", "group_id": "codeNet:p02814", "input_text": "program speedrun\nimplicit none\ninteger(16)::N,M\ninteger(16),allocatable,dimension(:)::a\ninteger(16)::D,T\nlogical::Check2\ninteger(16)::i\nread*,N,M\nallocate(a(N))\nread*,A\nD=1_16\ndo\n if(mod(a(1),2_16**(D+1_16))/=0_16)exit\n D=D+1_16\nend do\nCheck2=.true.\ndo i=1,N\n if(mod(A(i),2**D)/=0.or.mod(A(I),2**(D+1_16))==0_16)Check2=.false.\nend do\nT=(A(1)/2)*(A(2)/2)/gcd(A(1)/2,A(2)/2)\ndo i=3,N\n T=T*(A(i)/2)/gcd(T,A(i)/2)\nend do\nprint\"(i0)\",merge((M/T+1)/2,0_16,Check2)\ncontains\ninteger(16) recursive function gcd(a, b)result(res)\n integer(16), intent(in)::a, b\n res=merge(b, gcd(b, mod(a, b)),mod(a, b)==0)\nend function\nend program speedrun", "language": "Fortran", "metadata": {"date": 1578722168, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02814.html", "problem_id": "p02814", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02814/input.txt", "sample_output_relpath": "derived/input_output/data/p02814/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02814/Fortran/s724951540.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s724951540", "user_id": "u598073939"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program speedrun\nimplicit none\ninteger(16)::N,M\ninteger(16),allocatable,dimension(:)::a\ninteger(16)::D,T\nlogical::Check2\ninteger(16)::i\nread*,N,M\nallocate(a(N))\nread*,A\nD=1_16\ndo\n if(mod(a(1),2_16**(D+1_16))/=0_16)exit\n D=D+1_16\nend do\nCheck2=.true.\ndo i=1,N\n if(mod(A(i),2**D)/=0.or.mod(A(I),2**(D+1_16))==0_16)Check2=.false.\nend do\nT=(A(1)/2)*(A(2)/2)/gcd(A(1)/2,A(2)/2)\ndo i=3,N\n T=T*(A(i)/2)/gcd(T,A(i)/2)\nend do\nprint\"(i0)\",merge((M/T+1)/2,0_16,Check2)\ncontains\ninteger(16) recursive function gcd(a, b)result(res)\n integer(16), intent(in)::a, b\n res=merge(b, gcd(b, mod(a, b)),mod(a, b)==0)\nend function\nend program speedrun", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.\n\nLet a semi-common multiple of A be a positive integer X that satisfies the following condition for every k (1 \\leq k \\leq N):\n\nThere exists a non-negative integer p such that X= a_k \\times (p+0.5).\n\nFind the number of semi-common multiples of A among the integers between 1 and M (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^9\n\n2 \\leq a_i \\leq 10^9\n\na_i is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of semi-common multiples of A among the integers between 1 and M (inclusive).\n\nSample Input 1\n\n2 50\n6 10\n\nSample Output 1\n\n2\n\n15 = 6 \\times 2.5\n\n15 = 10 \\times 1.5\n\n45 = 6 \\times 7.5\n\n45 = 10 \\times 4.5\n\nThus, 15 and 45 are semi-common multiples of A. There are no other semi-common multiples of A between 1 and 50, so the answer is 2.\n\nSample Input 2\n\n3 100\n14 22 40\n\nSample Output 2\n\n0\n\nThe answer can be 0.\n\nSample Input 3\n\n5 1000000000\n6 6 2 6 2\n\nSample Output 3\n\n166666667", "sample_input": "2 50\n6 10\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02814", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.\n\nLet a semi-common multiple of A be a positive integer X that satisfies the following condition for every k (1 \\leq k \\leq N):\n\nThere exists a non-negative integer p such that X= a_k \\times (p+0.5).\n\nFind the number of semi-common multiples of A among the integers between 1 and M (inclusive).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^9\n\n2 \\leq a_i \\leq 10^9\n\na_i is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of semi-common multiples of A among the integers between 1 and M (inclusive).\n\nSample Input 1\n\n2 50\n6 10\n\nSample Output 1\n\n2\n\n15 = 6 \\times 2.5\n\n15 = 10 \\times 1.5\n\n45 = 6 \\times 7.5\n\n45 = 10 \\times 4.5\n\nThus, 15 and 45 are semi-common multiples of A. There are no other semi-common multiples of A between 1 and 50, so the answer is 2.\n\nSample Input 2\n\n3 100\n14 22 40\n\nSample Output 2\n\n0\n\nThe answer can be 0.\n\nSample Input 3\n\n5 1000000000\n6 6 2 6 2\n\nSample Output 3\n\n166666667", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 643, "cpu_time_ms": 80, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s246689312", "group_id": "codeNet:p02817", "input_text": "program a\n\timplicit none\n character(100) :: S, T\n character(200) :: ans\n \n read(*, *) S, T\n ans = trim(T) // trim(S)\n print *, trim(ans)\nend program a", "language": "Fortran", "metadata": {"date": 1578950600, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02817.html", "problem_id": "p02817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02817/input.txt", "sample_output_relpath": "derived/input_output/data/p02817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02817/Fortran/s246689312.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s246689312", "user_id": "u161693347"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "program a\n\timplicit none\n character(100) :: S, T\n character(200) :: ans\n \n read(*, *) S, T\n ans = trim(T) // trim(S)\n print *, trim(ans)\nend program a", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "sample_input": "oder atc\n"}, "reference_outputs": ["atcoder\n"], "source_document_id": "p02817", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are two strings S and T consisting of lowercase English letters. Concatenate T and S in this order, without space in between, and print the resulting string.\n\nConstraints\n\nS and T are strings consisting of lowercase English letters.\n\nThe lengths of S and T are between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS T\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\noder atc\n\nSample Output 1\n\natcoder\n\nWhen S = oder and T = atc, concatenating T and S in this order results in atcoder.\n\nSample Input 2\n\nhumu humu\n\nSample Output 2\n\nhumuhumu", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 168, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s802378251", "group_id": "codeNet:p02818", "input_text": "program ABC149B\n implicit none\n integer(16) A,B,K\n read*,A,B,K\n if(A>=K)then\n A=A-K\n else\n B=max(B-(K-A),0_16)\n A=0\n endif\n print\"(i0,A,i0)\",A,\" \",B\nend program ABC149B", "language": "Fortran", "metadata": {"date": 1577667940, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02818.html", "problem_id": "p02818", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02818/input.txt", "sample_output_relpath": "derived/input_output/data/p02818/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02818/Fortran/s802378251.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s802378251", "user_id": "u598073939"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "program ABC149B\n implicit none\n integer(16) A,B,K\n read*,A,B,K\n if(A>=K)then\n A=A-K\n else\n B=max(B-(K-A),0_16)\n A=0\n endif\n print\"(i0,A,i0)\",A,\" \",B\nend program ABC149B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "sample_input": "2 3 3\n"}, "reference_outputs": ["0 2\n"], "source_document_id": "p02818", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has A cookies, and Aoki has B cookies.\nTakahashi will do the following action K times:\n\nIf Takahashi has one or more cookies, eat one of his cookies.\n\nOtherwise, if Aoki has one or more cookies, eat one of Aoki's cookies.\n\nIf they both have no cookies, do nothing.\n\nIn the end, how many cookies will Takahashi and Aoki have, respectively?\n\nConstraints\n\n0 \\leq A \\leq 10^{12}\n\n0 \\leq B \\leq 10^{12}\n\n0 \\leq K \\leq 10^{12}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the numbers of Takahashi's and Aoki's cookies after K actions.\n\nSample Input 1\n\n2 3 3\n\nSample Output 1\n\n0 2\n\nTakahashi will do the following:\n\nHe has two cookies, so he eats one of them.\n\nNow he has one cookie left, and he eats it.\n\nNow he has no cookies left, but Aoki has three, so Takahashi eats one of them.\n\nThus, in the end, Takahashi will have 0 cookies, and Aoki will have 2.\n\nSample Input 2\n\n500000000000 500000000000 1000000000000\n\nSample Output 2\n\n0 0\n\nWatch out for overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 210, "cpu_time_ms": 5, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s112212275", "group_id": "codeNet:p02819", "input_text": "program ABC149C\n implicit none\n real::n\n integer::i,Flag\n read*,n\n Flag = 1\n if(n==2) then\n print*,int(n)\n stop\n end if\n if (mod(int(n),2) == 0) then\n n = n + 1\n end if\n do\n Flag = 1\n if (n <= 10) then\n do i = 3,int(n)\n if (mod(int(n),i) == 0) then\n Flag = 0\n end if\n end do\n else\n do i = 3,int(sqrt(n)),2\n if (mod(int(n),i) == 0) then\n Flag = 0\n end if\n end do\n end if\n if (Flag == 1) then\n print*,int(n)\n stop\n else\n n = n + 1\n end if\n end do\nend program ABC149C\n", "language": "Fortran", "metadata": {"date": 1577693832, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02819.html", "problem_id": "p02819", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02819/input.txt", "sample_output_relpath": "derived/input_output/data/p02819/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02819/Fortran/s112212275.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s112212275", "user_id": "u740284863"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "program ABC149C\n implicit none\n real::n\n integer::i,Flag\n read*,n\n Flag = 1\n if(n==2) then\n print*,int(n)\n stop\n end if\n if (mod(int(n),2) == 0) then\n n = n + 1\n end if\n do\n Flag = 1\n if (n <= 10) then\n do i = 3,int(n)\n if (mod(int(n),i) == 0) then\n Flag = 0\n end if\n end do\n else\n do i = 3,int(sqrt(n)),2\n if (mod(int(n),i) == 0) then\n Flag = 0\n end if\n end do\n end if\n if (Flag == 1) then\n print*,int(n)\n stop\n else\n n = n + 1\n end if\n end do\nend program ABC149C\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "sample_input": "20\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02819", "source_text": "Score: 300 points\n\nProblem Statement\n\nFind the minimum prime number greater than or equal to X.\n\nNotes\n\nA prime number is an integer greater than 1 that cannot be evenly divided by any positive integer except 1 and itself.\n\nFor example, 2, 3, and 5 are prime numbers, while 4 and 6 are not.\n\nConstraints\n\n2 \\le X \\le 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the minimum prime number greater than or equal to X.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n23\n\nThe minimum prime number greater than or equal to 20 is 23.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nX itself can be a prime number.\n\nSample Input 3\n\n99992\n\nSample Output 3\n\n100003", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 743, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s285135590", "group_id": "codeNet:p02820", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64)::n,k,r,s,p,i,ans\n character(:),allocatable:: t\n logical,allocatable:: w(:)\n\n read*, n,k\n read*, r,s,p\n allocate(character(n):: t)\n read*, t\n allocate(w(n))\n\n ans=0\n do i=1,k\n ans=ans+win(t(i:i))\n end do\n w(1:k) = .true.\n w(k+1:) = .false.\n do i=k+1,n\n if (t(i:i)==t(i-k:i-k) .and. w(i-k)) cycle\n ans=ans+win(t(i:i))\n w(i) = .true.\n end do\n print'(i0)', ans\n\ncontains\n function win(ss) result(ret)\n character(1):: ss\n integer(int64):: ret\n\n if (ss=='r') then\n ret = p\n else if (ss=='p') then\n ret = s\n else\n ret = r\n end if\n end function\nend program name", "language": "Fortran", "metadata": {"date": 1587668965, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02820.html", "problem_id": "p02820", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02820/input.txt", "sample_output_relpath": "derived/input_output/data/p02820/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02820/Fortran/s285135590.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s285135590", "user_id": "u234636620"}, "prompt_components": {"gold_output": "27\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64)::n,k,r,s,p,i,ans\n character(:),allocatable:: t\n logical,allocatable:: w(:)\n\n read*, n,k\n read*, r,s,p\n allocate(character(n):: t)\n read*, t\n allocate(w(n))\n\n ans=0\n do i=1,k\n ans=ans+win(t(i:i))\n end do\n w(1:k) = .true.\n w(k+1:) = .false.\n do i=k+1,n\n if (t(i:i)==t(i-k:i-k) .and. w(i-k)) cycle\n ans=ans+win(t(i:i))\n w(i) = .true.\n end do\n print'(i0)', ans\n\ncontains\n function win(ss) result(ret)\n character(1):: ss\n integer(int64):: ret\n\n if (ss=='r') then\n ret = p\n else if (ss=='p') then\n ret = s\n else\n ret = r\n end if\n end function\nend program name", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAt an arcade, Takahashi is playing a game called RPS Battle, which is played as follows:\n\nThe player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)\n\nEach time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):\n\nR points for winning with Rock;\n\nS points for winning with Scissors;\n\nP points for winning with Paper.\n\nHowever, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)\n\nBefore the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.\n\nThe information Takahashi obtained is given as a string T. If the i-th character of T (1 \\leq i \\leq N) is r, the machine will play Rock in the i-th round. Similarly, p and s stand for Paper and Scissors, respectively.\n\nWhat is the maximum total score earned in the game by adequately choosing the hand to play in each round?\n\nNotes\n\nIn this problem, Rock Paper Scissors can be thought of as a two-player game, in which each player simultaneously forms Rock, Paper, or Scissors with a hand.\n\nIf a player chooses Rock and the other chooses Scissors, the player choosing Rock wins;\n\nif a player chooses Scissors and the other chooses Paper, the player choosing Scissors wins;\n\nif a player chooses Paper and the other chooses Rock, the player choosing Paper wins;\n\nif both players play the same hand, it is a draw.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N-1\n\n1 \\leq R,S,P \\leq 10^4\n\nN,K,R,S, and P are all integers.\n\n|T| = N\n\nT consists of r, p, and s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nR S P\nT\n\nOutput\n\nPrint the maximum total score earned in the game.\n\nSample Input 1\n\n5 2\n8 7 6\nrsrpr\n\nSample Output 1\n\n27\n\nThe machine will play {Rock, Scissors, Rock, Paper, Rock}.\n\nWe can, for example, play {Paper, Rock, Rock, Scissors, Paper} against it to earn 27 points.\nWe cannot earn more points, so the answer is 27.\n\nSample Input 2\n\n7 1\n100 10 1\nssssppr\n\nSample Output 2\n\n211\n\nSample Input 3\n\n30 5\n325 234 123\nrspsspspsrpspsppprpsprpssprpsr\n\nSample Output 3\n\n4996", "sample_input": "5 2\n8 7 6\nrsrpr\n"}, "reference_outputs": ["27\n"], "source_document_id": "p02820", "source_text": "Score : 400 points\n\nProblem Statement\n\nAt an arcade, Takahashi is playing a game called RPS Battle, which is played as follows:\n\nThe player plays N rounds of Rock Paper Scissors against the machine. (See Notes for the description of Rock Paper Scissors. A draw also counts as a round.)\n\nEach time the player wins a round, depending on which hand he/she uses, he/she earns the following score (no points for a draw or a loss):\n\nR points for winning with Rock;\n\nS points for winning with Scissors;\n\nP points for winning with Paper.\n\nHowever, in the i-th round, the player cannot use the hand he/she used in the (i-K)-th round. (In the first K rounds, the player can use any hand.)\n\nBefore the start of the game, the machine decides the hand it will play in each round. With supernatural power, Takahashi managed to read all of those hands.\n\nThe information Takahashi obtained is given as a string T. If the i-th character of T (1 \\leq i \\leq N) is r, the machine will play Rock in the i-th round. Similarly, p and s stand for Paper and Scissors, respectively.\n\nWhat is the maximum total score earned in the game by adequately choosing the hand to play in each round?\n\nNotes\n\nIn this problem, Rock Paper Scissors can be thought of as a two-player game, in which each player simultaneously forms Rock, Paper, or Scissors with a hand.\n\nIf a player chooses Rock and the other chooses Scissors, the player choosing Rock wins;\n\nif a player chooses Scissors and the other chooses Paper, the player choosing Scissors wins;\n\nif a player chooses Paper and the other chooses Rock, the player choosing Paper wins;\n\nif both players play the same hand, it is a draw.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N-1\n\n1 \\leq R,S,P \\leq 10^4\n\nN,K,R,S, and P are all integers.\n\n|T| = N\n\nT consists of r, p, and s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nR S P\nT\n\nOutput\n\nPrint the maximum total score earned in the game.\n\nSample Input 1\n\n5 2\n8 7 6\nrsrpr\n\nSample Output 1\n\n27\n\nThe machine will play {Rock, Scissors, Rock, Paper, Rock}.\n\nWe can, for example, play {Paper, Rock, Rock, Scissors, Paper} against it to earn 27 points.\nWe cannot earn more points, so the answer is 27.\n\nSample Input 2\n\n7 1\n100 10 1\nssssppr\n\nSample Output 2\n\n211\n\nSample Input 3\n\n30 5\n325 234 123\nrspsspspsrpspsppprpsprpssprpsr\n\nSample Output 3\n\n4996", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 794, "cpu_time_ms": 3, "memory_kb": 1000}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s799771576", "group_id": "codeNet:p02821", "input_text": "module mod_fft\n implicit none\n integer, parameter :: intkind = 8, realkind = 16, cmpkind = 16\n real(realkind), parameter :: pi = acos(-1.0_realkind), dpi = 2.0_realkind * pi\ncontains\n function convolve(a, na, b, nb) result(res)\n integer, intent(in) :: na, nb\n integer(intkind), intent(in) :: a(0:na), b(0:nb)\n integer :: p, i\n integer(intkind) :: res(0:na + nb)\n complex(cmpkind), allocatable :: fa(:), fb(:), f(:)\n p = find_pow2(na + nb + 1)\n allocate(fa(p), fb(p), f(p))\n call init(a, na, fa, p)\n call dft(fa, p)\n call init(b, nb, fb, p)\n call dft(fb, p)\n f = fa * fb\n call dft(f, p, .true.)\n res = nint(real(f(1:na + nb + 1), realkind), intkind)\n end\n integer function find_pow2(n) result(res)\n integer, intent(in) :: n\n res = n - 1\n res = or(res, rshift(res, 1))\n res = or(res, rshift(res, 2))\n res = or(res, rshift(res, 4))\n res = or(res, rshift(res, 8))\n res = or(res, rshift(res, 16))\n res = res + 1\n end\n subroutine init(a, n, f, p)\n integer, intent(in) :: n, p\n integer(intkind), intent(in) :: a(0:n)\n complex(cmpkind), intent(out) :: f(p)\n integer :: i\n f(1:n + 1) = cmplx(real(a(0:n), realkind), 0.0_realkind, cmpkind)\n f(n + 2:p) = cmplx(0.0_realkind, 0.0_realkind, cmpkind)\n end\n subroutine dft(f, p, inverse)\n integer, intent(in) :: p\n complex(cmpkind), intent(inout) :: f(p)\n logical, optional, intent(in) :: inverse\n logical :: inv\n inv = merge(inverse, .false., present(inverse))\n call fftdft(f, p, inv)\n if (inv) f = f / real(p, realkind)\n end\n recursive subroutine fftdft(f, p, inverse)\n integer, intent(in) :: p\n complex(cmpkind), intent(inout) :: f(p)\n logical, intent(in) :: inverse\n real(realkind) :: theta\n complex(cmpkind) :: f1(p / 2), f2(p / 2), z, pz\n integer :: i\n if (p == 1) return\n f1 = f(1:p:2)\n call fftdft(f1, p / 2, inverse)\n f2 = f(2:p:2)\n call fftdft(f2, p / 2, inverse)\n theta = merge(-1.0_realkind, 1.0_realkind, inverse) * dpi / real(p, realkind)\n z = exp(cmplx(0.0_realkind, theta, cmpkind))\n pz = cmplx(1.0_realkind, 0.0_realkind, cmpkind)\n do i = 1, p / 2\n f(i) = f1(i) + pz * f2(i)\n f(i + p / 2) = f1(i) - pz * f2(i)\n pz = pz * z\n end do\n end\nend module mod_fft\nprogram handshake\n use mod_fft\n implicit none\n integer :: n, i, maxa\n integer, dimension(100000) :: a\n integer(8) :: m, cnt = 0, x = 0\n integer(intkind), dimension(0:100000) :: p = 0, q = 0\n integer(intkind), dimension(0:200000) :: c = 0\n read(*,*) n, m\n read(*,*) a(1:n)\n maxa = maxval(a(1:n))\n do i = 1, n\n p(a(i)) = p(a(i)) + 1\n end do\n q = p\n c(0:2 * maxa) = convolve(p, maxa, q, maxa)\n do i = 2 * maxa, 0, -1\n if (c(i) + cnt >= m) then\n x = x + (m - cnt) * i\n exit\n else\n x = x + c(i) * i\n cnt = cnt + c(i)\n end if\n end do\n write(*,'(i0)') x\nend program handshake", "language": "Fortran", "metadata": {"date": 1594355740, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02821.html", "problem_id": "p02821", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02821/input.txt", "sample_output_relpath": "derived/input_output/data/p02821/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02821/Fortran/s799771576.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s799771576", "user_id": "u506403362"}, "prompt_components": {"gold_output": "202\n", "input_to_evaluate": "module mod_fft\n implicit none\n integer, parameter :: intkind = 8, realkind = 16, cmpkind = 16\n real(realkind), parameter :: pi = acos(-1.0_realkind), dpi = 2.0_realkind * pi\ncontains\n function convolve(a, na, b, nb) result(res)\n integer, intent(in) :: na, nb\n integer(intkind), intent(in) :: a(0:na), b(0:nb)\n integer :: p, i\n integer(intkind) :: res(0:na + nb)\n complex(cmpkind), allocatable :: fa(:), fb(:), f(:)\n p = find_pow2(na + nb + 1)\n allocate(fa(p), fb(p), f(p))\n call init(a, na, fa, p)\n call dft(fa, p)\n call init(b, nb, fb, p)\n call dft(fb, p)\n f = fa * fb\n call dft(f, p, .true.)\n res = nint(real(f(1:na + nb + 1), realkind), intkind)\n end\n integer function find_pow2(n) result(res)\n integer, intent(in) :: n\n res = n - 1\n res = or(res, rshift(res, 1))\n res = or(res, rshift(res, 2))\n res = or(res, rshift(res, 4))\n res = or(res, rshift(res, 8))\n res = or(res, rshift(res, 16))\n res = res + 1\n end\n subroutine init(a, n, f, p)\n integer, intent(in) :: n, p\n integer(intkind), intent(in) :: a(0:n)\n complex(cmpkind), intent(out) :: f(p)\n integer :: i\n f(1:n + 1) = cmplx(real(a(0:n), realkind), 0.0_realkind, cmpkind)\n f(n + 2:p) = cmplx(0.0_realkind, 0.0_realkind, cmpkind)\n end\n subroutine dft(f, p, inverse)\n integer, intent(in) :: p\n complex(cmpkind), intent(inout) :: f(p)\n logical, optional, intent(in) :: inverse\n logical :: inv\n inv = merge(inverse, .false., present(inverse))\n call fftdft(f, p, inv)\n if (inv) f = f / real(p, realkind)\n end\n recursive subroutine fftdft(f, p, inverse)\n integer, intent(in) :: p\n complex(cmpkind), intent(inout) :: f(p)\n logical, intent(in) :: inverse\n real(realkind) :: theta\n complex(cmpkind) :: f1(p / 2), f2(p / 2), z, pz\n integer :: i\n if (p == 1) return\n f1 = f(1:p:2)\n call fftdft(f1, p / 2, inverse)\n f2 = f(2:p:2)\n call fftdft(f2, p / 2, inverse)\n theta = merge(-1.0_realkind, 1.0_realkind, inverse) * dpi / real(p, realkind)\n z = exp(cmplx(0.0_realkind, theta, cmpkind))\n pz = cmplx(1.0_realkind, 0.0_realkind, cmpkind)\n do i = 1, p / 2\n f(i) = f1(i) + pz * f2(i)\n f(i + p / 2) = f1(i) - pz * f2(i)\n pz = pz * z\n end do\n end\nend module mod_fft\nprogram handshake\n use mod_fft\n implicit none\n integer :: n, i, maxa\n integer, dimension(100000) :: a\n integer(8) :: m, cnt = 0, x = 0\n integer(intkind), dimension(0:100000) :: p = 0, q = 0\n integer(intkind), dimension(0:200000) :: c = 0\n read(*,*) n, m\n read(*,*) a(1:n)\n maxa = maxval(a(1:n))\n do i = 1, n\n p(a(i)) = p(a(i)) + 1\n end do\n q = p\n c(0:2 * maxa) = convolve(p, maxa, q, maxa)\n do i = 2 * maxa, 0, -1\n if (c(i) + cnt >= m) then\n x = x + (m - cnt) * i\n exit\n else\n x = x + c(i) * i\n cnt = cnt + c(i)\n end if\n end do\n write(*,'(i0)') x\nend program handshake", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi has come to a party as a special guest.\nThere are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.\n\nTakahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness be 0).\nA handshake will be performed as follows:\n\nTakahashi chooses one (ordinary) guest x for his left hand and another guest y for his right hand (x and y can be the same).\n\nThen, he shakes the left hand of Guest x and the right hand of Guest y simultaneously to increase the happiness by A_x+A_y.\n\nHowever, Takahashi should not perform the same handshake more than once. Formally, the following condition must hold:\n\nAssume that, in the k-th handshake, Takahashi shakes the left hand of Guest x_k and the right hand of Guest y_k. Then, there is no pair p, q (1 \\leq p < q \\leq M) such that (x_p,y_p)=(x_q,y_q).\n\nWhat is the maximum possible happiness after M handshakes?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq N^2\n\n1 \\leq A_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible happiness after M handshakes.\n\nSample Input 1\n\n5 3\n10 14 19 34 33\n\nSample Output 1\n\n202\n\nLet us say that Takahashi performs the following handshakes:\n\nIn the first handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 4.\n\nIn the second handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 5.\n\nIn the third handshake, Takahashi shakes the left hand of Guest 5 and the right hand of Guest 4.\n\nThen, we will have the happiness of (34+34)+(34+33)+(33+34)=202.\n\nWe cannot achieve the happiness of 203 or greater, so the answer is 202.\n\nSample Input 2\n\n9 14\n1 3 5 110 24 21 34 5 3\n\nSample Output 2\n\n1837\n\nSample Input 3\n\n9 73\n67597 52981 5828 66249 75177 64141 40773 79105 16076\n\nSample Output 3\n\n8128170", "sample_input": "5 3\n10 14 19 34 33\n"}, "reference_outputs": ["202\n"], "source_document_id": "p02821", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi has come to a party as a special guest.\nThere are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.\n\nTakahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness be 0).\nA handshake will be performed as follows:\n\nTakahashi chooses one (ordinary) guest x for his left hand and another guest y for his right hand (x and y can be the same).\n\nThen, he shakes the left hand of Guest x and the right hand of Guest y simultaneously to increase the happiness by A_x+A_y.\n\nHowever, Takahashi should not perform the same handshake more than once. Formally, the following condition must hold:\n\nAssume that, in the k-th handshake, Takahashi shakes the left hand of Guest x_k and the right hand of Guest y_k. Then, there is no pair p, q (1 \\leq p < q \\leq M) such that (x_p,y_p)=(x_q,y_q).\n\nWhat is the maximum possible happiness after M handshakes?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq N^2\n\n1 \\leq A_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible happiness after M handshakes.\n\nSample Input 1\n\n5 3\n10 14 19 34 33\n\nSample Output 1\n\n202\n\nLet us say that Takahashi performs the following handshakes:\n\nIn the first handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 4.\n\nIn the second handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 5.\n\nIn the third handshake, Takahashi shakes the left hand of Guest 5 and the right hand of Guest 4.\n\nThen, we will have the happiness of (34+34)+(34+33)+(33+34)=202.\n\nWe cannot achieve the happiness of 203 or greater, so the answer is 202.\n\nSample Input 2\n\n9 14\n1 3 5 110 24 21 34 5 3\n\nSample Output 2\n\n1837\n\nSample Input 3\n\n9 73\n67597 52981 5828 66249 75177 64141 40773 79105 16076\n\nSample Output 3\n\n8128170", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2905, "cpu_time_ms": 2206, "memory_kb": 41264}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s603739626", "group_id": "codeNet:p02821", "input_text": "program ABC149E\n implicit none\n integer(16)::N,M\n integer(16),allocatable,dimension(:)::A,R\n integer(16)::ans,OK,NG,MD,tmp\n integer(16)::i,j\n read*,N,M\n allocate(A(N))\n read*,A\n call heapsort(N,A)\n allocate(R(200000+1))\n R=0\n do i=1,N\n R(A(i))=R(A(i))+1\n end do\n do i=2*10**5,1,-1\n R(i)=R(i)+R(i+1)\n end do\n \n OK=0;NG=A(N)*2+1\n MD=(OK+NG)/2\n do while(NG-OK>1)\n if(CNT(MD)>=M)then\n OK=MD\n else\n NG=MD\n endif\n MD=(OK+NG)/2\n end do\n\n ans=0\n do i=1,N\n if(A(i)>=OK)then\n tmp=N\n else\n tmp=R(MD-A(i))\n endif\n ans=ans+tmp*A(i)*2\n end do\n print\"(i0)\",ans-MD*(cnt(OK)-M)\ncontains\ninteger(16) function cnt(MID)\n integer(16),intent(in)::MID\n integer(16)::ii\n cnt=0\n do ii=1,N\n if(MID>A(ii))then\n cnt=cnt+R(MID-A(ii))\n else\n cnt=cnt+N\n endif\n end do\nend function\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16)::i,k,j,l\n integer(16):: t\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend program ABC149E", "language": "Fortran", "metadata": {"date": 1577684137, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02821.html", "problem_id": "p02821", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02821/input.txt", "sample_output_relpath": "derived/input_output/data/p02821/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02821/Fortran/s603739626.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s603739626", "user_id": "u598073939"}, "prompt_components": {"gold_output": "202\n", "input_to_evaluate": "program ABC149E\n implicit none\n integer(16)::N,M\n integer(16),allocatable,dimension(:)::A,R\n integer(16)::ans,OK,NG,MD,tmp\n integer(16)::i,j\n read*,N,M\n allocate(A(N))\n read*,A\n call heapsort(N,A)\n allocate(R(200000+1))\n R=0\n do i=1,N\n R(A(i))=R(A(i))+1\n end do\n do i=2*10**5,1,-1\n R(i)=R(i)+R(i+1)\n end do\n \n OK=0;NG=A(N)*2+1\n MD=(OK+NG)/2\n do while(NG-OK>1)\n if(CNT(MD)>=M)then\n OK=MD\n else\n NG=MD\n endif\n MD=(OK+NG)/2\n end do\n\n ans=0\n do i=1,N\n if(A(i)>=OK)then\n tmp=N\n else\n tmp=R(MD-A(i))\n endif\n ans=ans+tmp*A(i)*2\n end do\n print\"(i0)\",ans-MD*(cnt(OK)-M)\ncontains\ninteger(16) function cnt(MID)\n integer(16),intent(in)::MID\n integer(16)::ii\n cnt=0\n do ii=1,N\n if(MID>A(ii))then\n cnt=cnt+R(MID-A(ii))\n else\n cnt=cnt+N\n endif\n end do\nend function\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16)::i,k,j,l\n integer(16):: t\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend program ABC149E", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi has come to a party as a special guest.\nThere are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.\n\nTakahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness be 0).\nA handshake will be performed as follows:\n\nTakahashi chooses one (ordinary) guest x for his left hand and another guest y for his right hand (x and y can be the same).\n\nThen, he shakes the left hand of Guest x and the right hand of Guest y simultaneously to increase the happiness by A_x+A_y.\n\nHowever, Takahashi should not perform the same handshake more than once. Formally, the following condition must hold:\n\nAssume that, in the k-th handshake, Takahashi shakes the left hand of Guest x_k and the right hand of Guest y_k. Then, there is no pair p, q (1 \\leq p < q \\leq M) such that (x_p,y_p)=(x_q,y_q).\n\nWhat is the maximum possible happiness after M handshakes?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq N^2\n\n1 \\leq A_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible happiness after M handshakes.\n\nSample Input 1\n\n5 3\n10 14 19 34 33\n\nSample Output 1\n\n202\n\nLet us say that Takahashi performs the following handshakes:\n\nIn the first handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 4.\n\nIn the second handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 5.\n\nIn the third handshake, Takahashi shakes the left hand of Guest 5 and the right hand of Guest 4.\n\nThen, we will have the happiness of (34+34)+(34+33)+(33+34)=202.\n\nWe cannot achieve the happiness of 203 or greater, so the answer is 202.\n\nSample Input 2\n\n9 14\n1 3 5 110 24 21 34 5 3\n\nSample Output 2\n\n1837\n\nSample Input 3\n\n9 73\n67597 52981 5828 66249 75177 64141 40773 79105 16076\n\nSample Output 3\n\n8128170", "sample_input": "5 3\n10 14 19 34 33\n"}, "reference_outputs": ["202\n"], "source_document_id": "p02821", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi has come to a party as a special guest.\nThere are N ordinary guests at the party. The i-th ordinary guest has a power of A_i.\n\nTakahashi has decided to perform M handshakes to increase the happiness of the party (let the current happiness be 0).\nA handshake will be performed as follows:\n\nTakahashi chooses one (ordinary) guest x for his left hand and another guest y for his right hand (x and y can be the same).\n\nThen, he shakes the left hand of Guest x and the right hand of Guest y simultaneously to increase the happiness by A_x+A_y.\n\nHowever, Takahashi should not perform the same handshake more than once. Formally, the following condition must hold:\n\nAssume that, in the k-th handshake, Takahashi shakes the left hand of Guest x_k and the right hand of Guest y_k. Then, there is no pair p, q (1 \\leq p < q \\leq M) such that (x_p,y_p)=(x_q,y_q).\n\nWhat is the maximum possible happiness after M handshakes?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq N^2\n\n1 \\leq A_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible happiness after M handshakes.\n\nSample Input 1\n\n5 3\n10 14 19 34 33\n\nSample Output 1\n\n202\n\nLet us say that Takahashi performs the following handshakes:\n\nIn the first handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 4.\n\nIn the second handshake, Takahashi shakes the left hand of Guest 4 and the right hand of Guest 5.\n\nIn the third handshake, Takahashi shakes the left hand of Guest 5 and the right hand of Guest 4.\n\nThen, we will have the happiness of (34+34)+(34+33)+(33+34)=202.\n\nWe cannot achieve the happiness of 203 or greater, so the answer is 202.\n\nSample Input 2\n\n9 14\n1 3 5 110 24 21 34 5 3\n\nSample Output 2\n\n1837\n\nSample Input 3\n\n9 73\n67597 52981 5828 66249 75177 64141 40773 79105 16076\n\nSample Output 3\n\n8128170", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1791, "cpu_time_ms": 59, "memory_kb": 5504}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s741717410", "group_id": "codeNet:p02823", "input_text": "program sample\n implicit none\n character(100)::s,t\n integer(8) :: i,j,k,m,n\n integer(8)::a,b,c,d\n integer(8),allocatable::x(:),y(:)\n \n read(*,*) n,a,b\n if(mod(b-a,2)==0)then\n write(*,*)(b-a)/2\n stop\n elseif(b==n .or.a==1)then\n\n write(*,*)(b-a+1)/2\n elseif(2*n-b+1B-1) then\n \n \twrite(*,*) B-1q0\n \n else\n \twrite(*,*) N-A\n end if\n end if\n\nend program example", "language": "Fortran", "metadata": {"date": 1584486972, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02823.html", "problem_id": "p02823", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02823/input.txt", "sample_output_relpath": "derived/input_output/data/p02823/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02823/Fortran/s994138553.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s994138553", "user_id": "u374107737"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program example\n\timplicit none\n \n integer(16) A,B,N\n \n read(*,*) N,A,B\n \n if(mod(B-A,2)==0) then\n \n \twrite(*,*) (B-A)/2q0\n \n else\n \tif(N-A>B-1) then\n \n \twrite(*,*) B-1q0\n \n else\n \twrite(*,*) N-A\n end if\n end if\n\nend program example", "problem_context": "Score : 300 points\n\nProblem Statement\n\n2N players are running a competitive table tennis training on N tables numbered from 1 to N.\n\nThe training consists of rounds.\nIn each round, the players form N pairs, one pair per table.\nIn each pair, competitors play a match against each other.\nAs a result, one of them wins and the other one loses.\n\nThe winner of the match on table X plays on table X-1 in the next round,\nexcept for the winner of the match on table 1 who stays at table 1.\n\nSimilarly, the loser of the match on table X plays on table X+1 in the next round,\nexcept for the loser of the match on table N who stays at table N.\n\nTwo friends are playing their first round matches on distinct tables A and B.\nLet's assume that the friends are strong enough to win or lose any match at will.\nWhat is the smallest number of rounds after which the friends can get to play a match against each other?\n\nConstraints\n\n2 \\leq N \\leq 10^{18}\n\n1 \\leq A < B \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the smallest number of rounds after which the friends can get to play a match against each other.\n\nSample Input 1\n\n5 2 4\n\nSample Output 1\n\n1\n\nIf the first friend loses their match and the second friend wins their match, they will both move to table 3 and play each other in the next round.\n\nSample Input 2\n\n5 2 3\n\nSample Output 2\n\n2\n\nIf both friends win two matches in a row, they will both move to table 1.", "sample_input": "5 2 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02823", "source_text": "Score : 300 points\n\nProblem Statement\n\n2N players are running a competitive table tennis training on N tables numbered from 1 to N.\n\nThe training consists of rounds.\nIn each round, the players form N pairs, one pair per table.\nIn each pair, competitors play a match against each other.\nAs a result, one of them wins and the other one loses.\n\nThe winner of the match on table X plays on table X-1 in the next round,\nexcept for the winner of the match on table 1 who stays at table 1.\n\nSimilarly, the loser of the match on table X plays on table X+1 in the next round,\nexcept for the loser of the match on table N who stays at table N.\n\nTwo friends are playing their first round matches on distinct tables A and B.\nLet's assume that the friends are strong enough to win or lose any match at will.\nWhat is the smallest number of rounds after which the friends can get to play a match against each other?\n\nConstraints\n\n2 \\leq N \\leq 10^{18}\n\n1 \\leq A < B \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the smallest number of rounds after which the friends can get to play a match against each other.\n\nSample Input 1\n\n5 2 4\n\nSample Output 1\n\n1\n\nIf the first friend loses their match and the second friend wins their match, they will both move to table 3 and play each other in the next round.\n\nSample Input 2\n\n5 2 3\n\nSample Output 2\n\n2\n\nIf both friends win two matches in a row, they will both move to table 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 318, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s587270740", "group_id": "codeNet:p02823", "input_text": " PROGRAM tableTennisTraining\n IMPLICIT NONE\n integer(16) :: n,a,b\n integer(16) :: sub,ans,sma,big,ans1,ansn\n \n read*,n,a,b\n \n \n \n sub = abs( a-b )\n if( mod(sub,2)==0 )then\n ans = sub/2\n else\n sma = min(a,b)\n big = max(a,b)\n \n ans1 = (sma-1) + 1 + (big-1-(sma-1+1))/2\n ansn = (n-big) + 1 + (n-(sma+(n-big)+1))/2\n ans = min(ans1,ansn)\n endif\n \n \n \n print*,ans\n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1577591247, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02823.html", "problem_id": "p02823", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02823/input.txt", "sample_output_relpath": "derived/input_output/data/p02823/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02823/Fortran/s587270740.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s587270740", "user_id": "u171356453"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": " PROGRAM tableTennisTraining\n IMPLICIT NONE\n integer(16) :: n,a,b\n integer(16) :: sub,ans,sma,big,ans1,ansn\n \n read*,n,a,b\n \n \n \n sub = abs( a-b )\n if( mod(sub,2)==0 )then\n ans = sub/2\n else\n sma = min(a,b)\n big = max(a,b)\n \n ans1 = (sma-1) + 1 + (big-1-(sma-1+1))/2\n ansn = (n-big) + 1 + (n-(sma+(n-big)+1))/2\n ans = min(ans1,ansn)\n endif\n \n \n \n print*,ans\n \n \n END PROGRAM", "problem_context": "Score : 300 points\n\nProblem Statement\n\n2N players are running a competitive table tennis training on N tables numbered from 1 to N.\n\nThe training consists of rounds.\nIn each round, the players form N pairs, one pair per table.\nIn each pair, competitors play a match against each other.\nAs a result, one of them wins and the other one loses.\n\nThe winner of the match on table X plays on table X-1 in the next round,\nexcept for the winner of the match on table 1 who stays at table 1.\n\nSimilarly, the loser of the match on table X plays on table X+1 in the next round,\nexcept for the loser of the match on table N who stays at table N.\n\nTwo friends are playing their first round matches on distinct tables A and B.\nLet's assume that the friends are strong enough to win or lose any match at will.\nWhat is the smallest number of rounds after which the friends can get to play a match against each other?\n\nConstraints\n\n2 \\leq N \\leq 10^{18}\n\n1 \\leq A < B \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the smallest number of rounds after which the friends can get to play a match against each other.\n\nSample Input 1\n\n5 2 4\n\nSample Output 1\n\n1\n\nIf the first friend loses their match and the second friend wins their match, they will both move to table 3 and play each other in the next round.\n\nSample Input 2\n\n5 2 3\n\nSample Output 2\n\n2\n\nIf both friends win two matches in a row, they will both move to table 1.", "sample_input": "5 2 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02823", "source_text": "Score : 300 points\n\nProblem Statement\n\n2N players are running a competitive table tennis training on N tables numbered from 1 to N.\n\nThe training consists of rounds.\nIn each round, the players form N pairs, one pair per table.\nIn each pair, competitors play a match against each other.\nAs a result, one of them wins and the other one loses.\n\nThe winner of the match on table X plays on table X-1 in the next round,\nexcept for the winner of the match on table 1 who stays at table 1.\n\nSimilarly, the loser of the match on table X plays on table X+1 in the next round,\nexcept for the loser of the match on table N who stays at table N.\n\nTwo friends are playing their first round matches on distinct tables A and B.\nLet's assume that the friends are strong enough to win or lose any match at will.\nWhat is the smallest number of rounds after which the friends can get to play a match against each other?\n\nConstraints\n\n2 \\leq N \\leq 10^{18}\n\n1 \\leq A < B \\leq N\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint the smallest number of rounds after which the friends can get to play a match against each other.\n\nSample Input 1\n\n5 2 4\n\nSample Output 1\n\n1\n\nIf the first friend loses their match and the second friend wins their match, they will both move to table 3 and play each other in the next round.\n\nSample Input 2\n\n5 2 3\n\nSample Output 2\n\n2\n\nIf both friends win two matches in a row, they will both move to table 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 523, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s439724422", "group_id": "codeNet:p02829", "input_text": "program sample\n\timplicit none\n integer :: x,y\n \n read(*,*) x\n read(*,*) y\n \n if (x==1 .and. y==2) then\n \twrite(*,*) 3\n else if (x==1 .and. y==3) then\n \twrite(*,*) 2\n else if (x==2 .and. y==1) then\n \twrite(*,*) 3 \n else if (x==2 .and. y==3) then\n \twrite(*,*) 1 \n else if (x==3 .and. y==1) then\n \twrite(*,*) 2 \n else if (x==3 .and. y==2) then\n \twrite(*,*) 1 \n\tend if\n\n stop\nend program sample", "language": "Fortran", "metadata": {"date": 1592629669, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02829.html", "problem_id": "p02829", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02829/input.txt", "sample_output_relpath": "derived/input_output/data/p02829/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02829/Fortran/s439724422.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s439724422", "user_id": "u323210830"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program sample\n\timplicit none\n integer :: x,y\n \n read(*,*) x\n read(*,*) y\n \n if (x==1 .and. y==2) then\n \twrite(*,*) 3\n else if (x==1 .and. y==3) then\n \twrite(*,*) 2\n else if (x==2 .and. y==1) then\n \twrite(*,*) 3 \n else if (x==2 .and. y==3) then\n \twrite(*,*) 1 \n else if (x==3 .and. y==1) then\n \twrite(*,*) 2 \n else if (x==3 .and. y==2) then\n \twrite(*,*) 1 \n\tend if\n\n stop\nend program sample", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi is solving quizzes. He has easily solved all but the last one.\n\nThe last quiz has three choices: 1, 2, and 3.\n\nWith his supernatural power, Takahashi has found out that the choices A and B are both wrong.\n\nPrint the correct choice for this problem.\n\nConstraints\n\nEach of the numbers A and B is 1, 2, or 3.\n\nA and B are different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint the correct choice.\n\nSample Input 1\n\n3\n1\n\nSample Output 1\n\n2\n\nWhen we know 3 and 1 are both wrong, the correct choice is 2.\n\nSample Input 2\n\n1\n2\n\nSample Output 2\n\n3", "sample_input": "3\n1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02829", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi is solving quizzes. He has easily solved all but the last one.\n\nThe last quiz has three choices: 1, 2, and 3.\n\nWith his supernatural power, Takahashi has found out that the choices A and B are both wrong.\n\nPrint the correct choice for this problem.\n\nConstraints\n\nEach of the numbers A and B is 1, 2, or 3.\n\nA and B are different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint the correct choice.\n\nSample Input 1\n\n3\n1\n\nSample Output 1\n\n2\n\nWhen we know 3 and 1 are both wrong, the correct choice is 2.\n\nSample Input 2\n\n1\n2\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 472, "cpu_time_ms": 6, "memory_kb": 2776}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s013488354", "group_id": "codeNet:p02829", "input_text": "program main\n \n implicit none !8 57\n integer :: a, b\n\n read(*,*) a\n read(*,*) b\n \n print*, 6-a-b\nend program main\n", "language": "Fortran", "metadata": {"date": 1579658378, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02829.html", "problem_id": "p02829", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02829/input.txt", "sample_output_relpath": "derived/input_output/data/p02829/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02829/Fortran/s013488354.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s013488354", "user_id": "u675314298"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n \n implicit none !8 57\n integer :: a, b\n\n read(*,*) a\n read(*,*) b\n \n print*, 6-a-b\nend program main\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi is solving quizzes. He has easily solved all but the last one.\n\nThe last quiz has three choices: 1, 2, and 3.\n\nWith his supernatural power, Takahashi has found out that the choices A and B are both wrong.\n\nPrint the correct choice for this problem.\n\nConstraints\n\nEach of the numbers A and B is 1, 2, or 3.\n\nA and B are different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint the correct choice.\n\nSample Input 1\n\n3\n1\n\nSample Output 1\n\n2\n\nWhen we know 3 and 1 are both wrong, the correct choice is 2.\n\nSample Input 2\n\n1\n2\n\nSample Output 2\n\n3", "sample_input": "3\n1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02829", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi is solving quizzes. He has easily solved all but the last one.\n\nThe last quiz has three choices: 1, 2, and 3.\n\nWith his supernatural power, Takahashi has found out that the choices A and B are both wrong.\n\nPrint the correct choice for this problem.\n\nConstraints\n\nEach of the numbers A and B is 1, 2, or 3.\n\nA and B are different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint the correct choice.\n\nSample Input 1\n\n3\n1\n\nSample Output 1\n\n2\n\nWhen we know 3 and 1 are both wrong, the correct choice is 2.\n\nSample Input 2\n\n1\n2\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s806686368", "group_id": "codeNet:p02829", "input_text": "program main\n implicit none\n \n integer :: a,b\n read(*,*)a,b\n \n if ((a == 1) .and. (b == 2)) then\n write(*,*)3\n else if ((a == 1) .and. (b == 3)) then\n write(*,*)2\n else if ((a == 2) .and. (b == 1)) then\n write(*,*)3\n else if ((a == 2) .and. (b == 3)) then\n write(*,*)1\n else if ((a == 3) .and. (b == 1)) then\n write(*,*)2\n else if ((a == 3) .and. (b == 2)) then\n write(*,*)1\n end if\nend program main", "language": "Fortran", "metadata": {"date": 1577136089, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02829.html", "problem_id": "p02829", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02829/input.txt", "sample_output_relpath": "derived/input_output/data/p02829/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02829/Fortran/s806686368.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s806686368", "user_id": "u287431190"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n \n integer :: a,b\n read(*,*)a,b\n \n if ((a == 1) .and. (b == 2)) then\n write(*,*)3\n else if ((a == 1) .and. (b == 3)) then\n write(*,*)2\n else if ((a == 2) .and. (b == 1)) then\n write(*,*)3\n else if ((a == 2) .and. (b == 3)) then\n write(*,*)1\n else if ((a == 3) .and. (b == 1)) then\n write(*,*)2\n else if ((a == 3) .and. (b == 2)) then\n write(*,*)1\n end if\nend program main", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi is solving quizzes. He has easily solved all but the last one.\n\nThe last quiz has three choices: 1, 2, and 3.\n\nWith his supernatural power, Takahashi has found out that the choices A and B are both wrong.\n\nPrint the correct choice for this problem.\n\nConstraints\n\nEach of the numbers A and B is 1, 2, or 3.\n\nA and B are different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint the correct choice.\n\nSample Input 1\n\n3\n1\n\nSample Output 1\n\n2\n\nWhen we know 3 and 1 are both wrong, the correct choice is 2.\n\nSample Input 2\n\n1\n2\n\nSample Output 2\n\n3", "sample_input": "3\n1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02829", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi is solving quizzes. He has easily solved all but the last one.\n\nThe last quiz has three choices: 1, 2, and 3.\n\nWith his supernatural power, Takahashi has found out that the choices A and B are both wrong.\n\nPrint the correct choice for this problem.\n\nConstraints\n\nEach of the numbers A and B is 1, 2, or 3.\n\nA and B are different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint the correct choice.\n\nSample Input 1\n\n3\n1\n\nSample Output 1\n\n2\n\nWhen we know 3 and 1 are both wrong, the correct choice is 2.\n\nSample Input 2\n\n1\n2\n\nSample Output 2\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 429, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s965677899", "group_id": "codeNet:p02830", "input_text": "program ABC148B\n integer N\n character(100) S,T\n character(200) ans\n read*,N\n read*,S,T\n ans=\"\"\n do i=1,N\n ans(2*i-1:2*i-1)=S(i:i)\n ans(2*i:2*i)=T(i:i)\n end do\n print\"(A)\",trim(ans)\nend program", "language": "Fortran", "metadata": {"date": 1577066771, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02830.html", "problem_id": "p02830", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02830/input.txt", "sample_output_relpath": "derived/input_output/data/p02830/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02830/Fortran/s965677899.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s965677899", "user_id": "u598073939"}, "prompt_components": {"gold_output": "icpc\n", "input_to_evaluate": "program ABC148B\n integer N\n character(100) S,T\n character(200) ans\n read*,N\n read*,S,T\n ans=\"\"\n do i=1,N\n ans(2*i-1:2*i-1)=S(i:i)\n ans(2*i:2*i)=T(i:i)\n end do\n print\"(A)\",trim(ans)\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second character of S, the second character of T, ..., the N-th character of S, the N-th character of T. Print this new string.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|S| = |T| = N\n\nS and T are strings consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS T\n\nOutput\n\nPrint the string formed.\n\nSample Input 1\n\n2\nip cc\n\nSample Output 1\n\nicpc\n\nSample Input 2\n\n8\nhmhmnknk uuuuuuuu\n\nSample Output 2\n\nhumuhumunukunuku\n\nSample Input 3\n\n5\naaaaa aaaaa\n\nSample Output 3\n\naaaaaaaaaa", "sample_input": "2\nip cc\n"}, "reference_outputs": ["icpc\n"], "source_document_id": "p02830", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are strings s and t of length N each, both consisting of lowercase English letters.\n\nLet us form a new string by alternating the characters of S and the characters of T, as follows: the first character of S, the first character of T, the second character of S, the second character of T, ..., the N-th character of S, the N-th character of T. Print this new string.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|S| = |T| = N\n\nS and T are strings consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS T\n\nOutput\n\nPrint the string formed.\n\nSample Input 1\n\n2\nip cc\n\nSample Output 1\n\nicpc\n\nSample Input 2\n\n8\nhmhmnknk uuuuuuuu\n\nSample Output 2\n\nhumuhumunukunuku\n\nSample Input 3\n\n5\naaaaa aaaaa\n\nSample Output 3\n\naaaaaaaaaa", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s932412188", "group_id": "codeNet:p02831", "input_text": "program main\n implicit none\n integer(8) :: a, b, mab, ans\n\n read *, a, b\n\n call gcd(a,b,mab)\n\n ans = a * b\n ans = ans/mab\n\n print *, ans\n\n contains\n\n subroutine gcd(m,n,j)\n implicit none\n integer(8), intent(in) :: m, n\n integer(8), intent(out) :: j\n integer(8) :: l, x, y\n\n x = m\n y = n\n do \n l = mod(x,y)\n if ( l == 0 ) exit\n x = y\n y = l\n end do\n j = y\n\n end subroutine gcd\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1589728649, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02831.html", "problem_id": "p02831", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02831/input.txt", "sample_output_relpath": "derived/input_output/data/p02831/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02831/Fortran/s932412188.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s932412188", "user_id": "u353721260"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: a, b, mab, ans\n\n read *, a, b\n\n call gcd(a,b,mab)\n\n ans = a * b\n ans = ans/mab\n\n print *, ans\n\n contains\n\n subroutine gcd(m,n,j)\n implicit none\n integer(8), intent(in) :: m, n\n integer(8), intent(out) :: j\n integer(8) :: l, x, y\n\n x = m\n y = n\n do \n l = mod(x,y)\n if ( l == 0 ) exit\n x = y\n y = l\n end do\n j = y\n\n end subroutine gcd\n\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "sample_input": "2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02831", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 543, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s824641012", "group_id": "codeNet:p02831", "input_text": "program main\n\n implicit none\n\n integer(8) :: i, j , ii, jj\n integer(8) :: ij, k, tmp, jjtmp\n\n read(*,*) i, j\n\n if( i > j ) then\n ii = i\n jj = j\n else\n ii = j\n jj = i\n end if\n\n do\n tmp = int( mod(ii,jj) )\n if( tmp == 0 ) then\n jjtmp = jj\n exit\n end if\n ii = jj\n jj = tmp\n end do\n\n tmp = i*j/jjtmp\n !tmp = int( i*j/jjtmp )\n write( 6, \"(1p,I20)\") tmp\n !print*, tmp\n\nend program main", "language": "Fortran", "metadata": {"date": 1577072129, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02831.html", "problem_id": "p02831", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02831/input.txt", "sample_output_relpath": "derived/input_output/data/p02831/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02831/Fortran/s824641012.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s824641012", "user_id": "u675314298"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "program main\n\n implicit none\n\n integer(8) :: i, j , ii, jj\n integer(8) :: ij, k, tmp, jjtmp\n\n read(*,*) i, j\n\n if( i > j ) then\n ii = i\n jj = j\n else\n ii = j\n jj = i\n end if\n\n do\n tmp = int( mod(ii,jj) )\n if( tmp == 0 ) then\n jjtmp = jj\n exit\n end if\n ii = jj\n jj = tmp\n end do\n\n tmp = i*j/jjtmp\n !tmp = int( i*j/jjtmp )\n write( 6, \"(1p,I20)\") tmp\n !print*, tmp\n\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "sample_input": "2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02831", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 431, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s510101708", "group_id": "codeNet:p02831", "input_text": " PROGRAM snack\n IMPLICIT NONE\n integer(16) :: a,b\n integer(16) :: big,sma,piyo,gcd,lcm\n \n read*,a,b\n \n big = max( a,b )\n sma = min( a,b )\n \n do while( .true. )\n if( mod(big,sma)==0 ) exit\n piyo = sma\n sma = mod( big,sma )\n big = piyo\n end do\n gcd = sma\n \n lcm = a*b/gcd\n \n print*,lcm\n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1577067642, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02831.html", "problem_id": "p02831", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02831/input.txt", "sample_output_relpath": "derived/input_output/data/p02831/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02831/Fortran/s510101708.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s510101708", "user_id": "u171356453"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": " PROGRAM snack\n IMPLICIT NONE\n integer(16) :: a,b\n integer(16) :: big,sma,piyo,gcd,lcm\n \n read*,a,b\n \n big = max( a,b )\n sma = min( a,b )\n \n do while( .true. )\n if( mod(big,sma)==0 ) exit\n piyo = sma\n sma = mod( big,sma )\n big = piyo\n end do\n gcd = sma\n \n lcm = a*b/gcd\n \n print*,lcm\n \n END PROGRAM", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "sample_input": "2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02831", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is organizing a party.\n\nAt the party, each guest will receive one or more snack pieces.\n\nTakahashi predicts that the number of guests at this party will be A or B.\n\nFind the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.\n\nWe assume that a piece cannot be divided and distributed to multiple guests.\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n6\n\nWhen we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.\n\nSample Input 2\n\n123 456\n\nSample Output 2\n\n18696\n\nSample Input 3\n\n100000 99999\n\nSample Output 3\n\n9999900000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 421, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s004307112", "group_id": "codeNet:p02832", "input_text": " PROGRAM brickBreak\n IMPLICIT NONE\n integer(16) :: n\n integer(16),allocatable :: a(:)\n integer(16) :: i,j,skip\n \n read*,n\n allocate( a(n) )\n read*,a\n \n \n \n j = 1\n skip = 0\n do i = 1,n\n if( a(i)==j )then\n j = j + 1\n else\n skip = skip + 1\n end if\n end do\n \n if( j==1 .and. skip==n )then\n print*,'-1'\n else\n print*,skip\n end if\n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1577068190, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Fortran/s004307112.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s004307112", "user_id": "u171356453"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": " PROGRAM brickBreak\n IMPLICIT NONE\n integer(16) :: n\n integer(16),allocatable :: a(:)\n integer(16) :: i,j,skip\n \n read*,n\n allocate( a(n) )\n read*,a\n \n \n \n j = 1\n skip = 0\n do i = 1,n\n if( a(i)==j )then\n j = j + 1\n else\n skip = skip + 1\n end if\n end do\n \n if( j==1 .and. skip==n )then\n print*,'-1'\n else\n print*,skip\n end if\n \n \n \n END PROGRAM", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 516, "cpu_time_ms": 70, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s118407510", "group_id": "codeNet:p02832", "input_text": "program ABC148D\n integer N\n integer,allocatable,dimension(:)::A\n integer::num\n read*,N\n allocate(A(N))\n read*,A\n num=1\n do i=1,N\n if(A(i)==num)then\n num=num+1\n endif\n end do\n print\"(i0)\",merge(N-num+1,-1,num/=1)\n contains\nend program", "language": "Fortran", "metadata": {"date": 1577067377, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02832.html", "problem_id": "p02832", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02832/input.txt", "sample_output_relpath": "derived/input_output/data/p02832/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02832/Fortran/s118407510.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s118407510", "user_id": "u598073939"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program ABC148D\n integer N\n integer,allocatable,dimension(:)::A\n integer::num\n read*,N\n allocate(A(N))\n read*,A\n num=1\n do i=1,N\n if(A(i)==num)then\n num=num+1\n endif\n end do\n print\"(i0)\",merge(N-num+1,-1,num/=1)\n contains\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "sample_input": "3\n2 1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02832", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N bricks arranged in a row from left to right.\n\nThe i-th brick from the left (1 \\leq i \\leq N) has an integer a_i written on it.\n\nAmong them, you can break at most N-1 bricks of your choice.\n\nLet us say there are K bricks remaining. Snuke will be satisfied if, for each integer i (1 \\leq i \\leq K), the i-th of those brick from the left has the integer i written on it.\n\nFind the minimum number of bricks you need to break to satisfy Snuke's desire. If his desire is unsatisfiable, print -1 instead.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 200000\n\n1 \\leq a_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of bricks that need to be broken to satisfy Snuke's desire, or print -1 if his desire is unsatisfiable.\n\nSample Input 1\n\n3\n2 1 2\n\nSample Output 1\n\n1\n\nIf we break the leftmost brick, the remaining bricks have integers 1 and 2 written on them from left to right, in which case Snuke will be satisfied.\n\nSample Input 2\n\n3\n2 2 2\n\nSample Output 2\n\n-1\n\nIn this case, there is no way to break some of the bricks to satisfy Snuke's desire.\n\nSample Input 3\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n7\n\nSample Input 4\n\n1\n1\n\nSample Output 4\n\n0\n\nThere may be no need to break the bricks at all.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 291, "cpu_time_ms": 52, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s107312044", "group_id": "codeNet:p02833", "input_text": "program double_factorization\n implicit none\n integer(kind=8) :: n\n integer(kind=8) :: ans\n\n read(*, *) n\n ans = min(g2(n, 2), g2(n, 5))\n print *, ans\n\n\ncontains\n recursive integer(kind=8) function g1(n, p) result(res)\n implicit none\n integer(kind=8), intent(in) :: n\n integer(kind=4), intent(in) :: p\n \n if(n == 0) then\n res = 0\n else\n res = n/p + g1(n/p, p)\n endif\n \n end function g1\n\n recursive integer(kind=8) function g2(n, p) result(res)\n implicit none\n integer(kind=8), intent(in) :: n\n integer(kind=4), intent(in) :: p\n\n res = 0\n\n if(mod(n, 2) == 1) then\n res = g1(n, p) - g2(n-1, p)\n else\n res = g1(n/2, p)\n\n if(p == 2) then\n res = res + n/2\n endif\n endif\n\n end function g2\n\nend program double_factorization", "language": "Fortran", "metadata": {"date": 1577226559, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02833.html", "problem_id": "p02833", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02833/input.txt", "sample_output_relpath": "derived/input_output/data/p02833/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02833/Fortran/s107312044.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s107312044", "user_id": "u161693347"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program double_factorization\n implicit none\n integer(kind=8) :: n\n integer(kind=8) :: ans\n\n read(*, *) n\n ans = min(g2(n, 2), g2(n, 5))\n print *, ans\n\n\ncontains\n recursive integer(kind=8) function g1(n, p) result(res)\n implicit none\n integer(kind=8), intent(in) :: n\n integer(kind=4), intent(in) :: p\n \n if(n == 0) then\n res = 0\n else\n res = n/p + g1(n/p, p)\n endif\n \n end function g1\n\n recursive integer(kind=8) function g2(n, p) result(res)\n implicit none\n integer(kind=8), intent(in) :: n\n integer(kind=4), intent(in) :: p\n\n res = 0\n\n if(mod(n, 2) == 1) then\n res = g1(n, p) - g2(n-1, p)\n else\n res = g1(n/2, p)\n\n if(p == 2) then\n res = res + n/2\n endif\n endif\n\n end function g2\n\nend program double_factorization", "problem_context": "Score : 500 points\n\nProblem Statement\n\nFor an integer n not less than 0, let us define f(n) as follows:\n\nf(n) = 1 (if n < 2)\n\nf(n) = n f(n-2) (if n \\geq 2)\n\nGiven is an integer N. Find the number of trailing zeros in the decimal notation of f(N).\n\nConstraints\n\n0 \\leq N \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of trailing zeros in the decimal notation of f(N).\n\nSample Input 1\n\n12\n\nSample Output 1\n\n1\n\nf(12) = 12 × 10 × 8 × 6 × 4 × 2 = 46080, which has one trailing zero.\n\nSample Input 2\n\n5\n\nSample Output 2\n\n0\n\nf(5) = 5 × 3 × 1 = 15, which has no trailing zeros.\n\nSample Input 3\n\n1000000000000000000\n\nSample Output 3\n\n124999999999999995", "sample_input": "12\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02833", "source_text": "Score : 500 points\n\nProblem Statement\n\nFor an integer n not less than 0, let us define f(n) as follows:\n\nf(n) = 1 (if n < 2)\n\nf(n) = n f(n-2) (if n \\geq 2)\n\nGiven is an integer N. Find the number of trailing zeros in the decimal notation of f(N).\n\nConstraints\n\n0 \\leq N \\leq 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of trailing zeros in the decimal notation of f(N).\n\nSample Input 1\n\n12\n\nSample Output 1\n\n1\n\nf(12) = 12 × 10 × 8 × 6 × 4 × 2 = 46080, which has one trailing zero.\n\nSample Input 2\n\n5\n\nSample Output 2\n\n0\n\nf(5) = 5 × 3 × 1 = 15, which has no trailing zeros.\n\nSample Input 3\n\n1000000000000000000\n\nSample Output 3\n\n124999999999999995", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 926, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s489749445", "group_id": "codeNet:p02836", "input_text": "program speedrun\n implicit none\n character(100)::S\n integer::ANS=0,L\n integer::i\n read*,S\n L=len_trim(S)\n do i=1,L/2\n if(S(i:i)/=S(L-i+1:L-i+1))ANS=ANS+1\n end do\n print\"(i0)\",ANS\nend program speedrun", "language": "Fortran", "metadata": {"date": 1578679973, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02836.html", "problem_id": "p02836", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02836/input.txt", "sample_output_relpath": "derived/input_output/data/p02836/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02836/Fortran/s489749445.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s489749445", "user_id": "u598073939"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program speedrun\n implicit none\n character(100)::S\n integer::ANS=0,L\n integer::i\n read*,S\n L=len_trim(S)\n do i=1,L/2\n if(S(i:i)/=S(L-i+1:L-i+1))ANS=ANS+1\n end do\n print\"(i0)\",ANS\nend program speedrun", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.\n\nGiven is a string S. Find the minimum number of hugs needed to make S palindromic.\n\nConstraints\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of hugs needed to make S palindromic.\n\nSample Input 1\n\nredcoder\n\nSample Output 1\n\n1\n\nFor example, we can change the fourth character to o and get a palindrome redooder.\n\nSample Input 2\n\nvvvvvv\n\nSample Output 2\n\n0\n\nWe might need no hugs at all.\n\nSample Input 3\n\nabcdabc\n\nSample Output 3\n\n2", "sample_input": "redcoder\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02836", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves palindromes. Non-palindromic strings are unacceptable to him. Each time he hugs a string, he can change one of its characters to any character of his choice.\n\nGiven is a string S. Find the minimum number of hugs needed to make S palindromic.\n\nConstraints\n\nS is a string consisting of lowercase English letters.\n\nThe length of S is between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of hugs needed to make S palindromic.\n\nSample Input 1\n\nredcoder\n\nSample Output 1\n\n1\n\nFor example, we can change the fourth character to o and get a palindrome redooder.\n\nSample Input 2\n\nvvvvvv\n\nSample Output 2\n\n0\n\nWe might need no hugs at all.\n\nSample Input 3\n\nabcdabc\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s345187410", "group_id": "codeNet:p02839", "input_text": "program balanced_path\n implicit none\n integer :: h, w, i, j, a(80,80) = 0, b(80) = 0, x = 1000000000\n read(*,*) h, w\n do i = 1, h\n read(*,*) a(i,1:w)\n end do\n do i = 1, h\n read(*,*) b(1:w)\n a(i,1:w) = a(i,1:w)-b(1:w)\n end do\n call dfs(1,1,a(1,1))\n write(*,'(i0)') x\ncontains\n recursive subroutine dfs(i,j,d)\n integer, intent(in) :: i, j, d\n if (i == h .and. j == w) then\n x = min(x,abs(d))\n return\n end if\n if (i < h) then\n call dfs(i+1,j,d+a(i+1,j))\n call dfs(i+1,j,d-a(i+1,j))\n end if\n if (j < w) then\n call dfs(i,j+1,d+a(i,j+1))\n call dfs(i,j+1,d-a(i,j+1))\n end if\n end\nend program balanced_path", "language": "Fortran", "metadata": {"date": 1575861252, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02839.html", "problem_id": "p02839", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02839/input.txt", "sample_output_relpath": "derived/input_output/data/p02839/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02839/Fortran/s345187410.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s345187410", "user_id": "u506403362"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program balanced_path\n implicit none\n integer :: h, w, i, j, a(80,80) = 0, b(80) = 0, x = 1000000000\n read(*,*) h, w\n do i = 1, h\n read(*,*) a(i,1:w)\n end do\n do i = 1, h\n read(*,*) b(1:w)\n a(i,1:w) = a(i,1:w)-b(1:w)\n end do\n call dfs(1,1,a(1,1))\n write(*,'(i0)') x\ncontains\n recursive subroutine dfs(i,j,d)\n integer, intent(in) :: i, j, d\n if (i == h .and. j == w) then\n x = min(x,abs(d))\n return\n end if\n if (i < h) then\n call dfs(i+1,j,d+a(i+1,j))\n call dfs(i+1,j,d-a(i+1,j))\n end if\n if (j < w) then\n call dfs(i,j+1,d+a(i,j+1))\n call dfs(i,j+1,d-a(i,j+1))\n end if\n end\nend program balanced_path", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a grid with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left.\n\nThe square (i, j) has two numbers A_{ij} and B_{ij} written on it.\n\nFirst, for each square, Takahashi paints one of the written numbers red and the other blue.\n\nThen, he travels from the square (1, 1) to the square (H, W). In one move, he can move from a square (i, j) to the square (i+1, j) or the square (i, j+1). He must not leave the grid.\n\nLet the unbalancedness be the absolute difference of the sum of red numbers and the sum of blue numbers written on the squares along Takahashi's path, including the squares (1, 1) and (H, W).\n\nTakahashi wants to make the unbalancedness as small as possible by appropriately painting the grid and traveling on it.\n\nFind the minimum unbalancedness possible.\n\nConstraints\n\n2 \\leq H \\leq 80\n\n2 \\leq W \\leq 80\n\n0 \\leq A_{ij} \\leq 80\n\n0 \\leq B_{ij} \\leq 80\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nA_{11} A_{12} \\ldots A_{1W}\n:\nA_{H1} A_{H2} \\ldots A_{HW}\nB_{11} B_{12} \\ldots B_{1W}\n:\nB_{H1} B_{H2} \\ldots B_{HW}\n\nOutput\n\nPrint the minimum unbalancedness possible.\n\nSample Input 1\n\n2 2\n1 2\n3 4\n3 4\n2 1\n\nSample Output 1\n\n0\n\nBy painting the grid and traveling on it as shown in the figure below, the sum of red numbers and the sum of blue numbers are 3+3+1=7 and 1+2+4=7, respectively, for the unbalancedness of 0.\n\nSample Input 2\n\n2 3\n1 10 80\n80 10 1\n1 2 3\n4 5 6\n\nSample Output 2\n\n2", "sample_input": "2 2\n1 2\n3 4\n3 4\n2 1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02839", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a grid with H horizontal rows and W vertical columns. Let (i,j) denote the square at the i-th row from the top and the j-th column from the left.\n\nThe square (i, j) has two numbers A_{ij} and B_{ij} written on it.\n\nFirst, for each square, Takahashi paints one of the written numbers red and the other blue.\n\nThen, he travels from the square (1, 1) to the square (H, W). In one move, he can move from a square (i, j) to the square (i+1, j) or the square (i, j+1). He must not leave the grid.\n\nLet the unbalancedness be the absolute difference of the sum of red numbers and the sum of blue numbers written on the squares along Takahashi's path, including the squares (1, 1) and (H, W).\n\nTakahashi wants to make the unbalancedness as small as possible by appropriately painting the grid and traveling on it.\n\nFind the minimum unbalancedness possible.\n\nConstraints\n\n2 \\leq H \\leq 80\n\n2 \\leq W \\leq 80\n\n0 \\leq A_{ij} \\leq 80\n\n0 \\leq B_{ij} \\leq 80\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nA_{11} A_{12} \\ldots A_{1W}\n:\nA_{H1} A_{H2} \\ldots A_{HW}\nB_{11} B_{12} \\ldots B_{1W}\n:\nB_{H1} B_{H2} \\ldots B_{HW}\n\nOutput\n\nPrint the minimum unbalancedness possible.\n\nSample Input 1\n\n2 2\n1 2\n3 4\n3 4\n2 1\n\nSample Output 1\n\n0\n\nBy painting the grid and traveling on it as shown in the figure below, the sum of red numbers and the sum of blue numbers are 3+3+1=7 and 1+2+4=7, respectively, for the unbalancedness of 0.\n\nSample Input 2\n\n2 3\n1 10 80\n80 10 1\n1 2 3\n4 5 6\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 669, "cpu_time_ms": 2103, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s367649653", "group_id": "codeNet:p02841", "input_text": "read*,i1,i2\nread*,i3,i4\nprint\"(i0)\",merge(0,1,i1==i3)\nend", "language": "Fortran", "metadata": {"date": 1577506984, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02841.html", "problem_id": "p02841", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02841/input.txt", "sample_output_relpath": "derived/input_output/data/p02841/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02841/Fortran/s367649653.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s367649653", "user_id": "u598073939"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "read*,i1,i2\nread*,i3,i4\nprint\"(i0)\",merge(0,1,i1==i3)\nend", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019.\n\nIntegers M_1, D_1, M_2, and D_2 will be given as input.\n\nIt is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1.\n\nDetermine whether the date 2019-M_1-D_1 is the last day of a month.\n\nConstraints\n\nBoth 2019-M_1-D_1 and 2019-M_2-D_2 are valid dates in the Gregorian calendar.\n\nThe date 2019-M_2-D_2 follows 2019-M_1-D_1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM_1 D_1\nM_2 D_2\n\nOutput\n\nIf the date 2019-M_1-D_1 is the last day of a month, print 1; otherwise, print 0.\n\nSample Input 1\n\n11 16\n11 17\n\nSample Output 1\n\n0\n\nNovember 16 is not the last day of a month.\n\nSample Input 2\n\n11 30\n12 1\n\nSample Output 2\n\n1\n\nNovember 30 is the last day of November.", "sample_input": "11 16\n11 17\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02841", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn this problem, a date is written as Y-M-D. For example, 2019-11-30 means November 30, 2019.\n\nIntegers M_1, D_1, M_2, and D_2 will be given as input.\n\nIt is known that the date 2019-M_2-D_2 follows 2019-M_1-D_1.\n\nDetermine whether the date 2019-M_1-D_1 is the last day of a month.\n\nConstraints\n\nBoth 2019-M_1-D_1 and 2019-M_2-D_2 are valid dates in the Gregorian calendar.\n\nThe date 2019-M_2-D_2 follows 2019-M_1-D_1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM_1 D_1\nM_2 D_2\n\nOutput\n\nIf the date 2019-M_1-D_1 is the last day of a month, print 1; otherwise, print 0.\n\nSample Input 1\n\n11 16\n11 17\n\nSample Output 1\n\n0\n\nNovember 16 is not the last day of a month.\n\nSample Input 2\n\n11 30\n12 1\n\nSample Output 2\n\n1\n\nNovember 30 is the last day of November.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 57, "cpu_time_ms": 3, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s333927078", "group_id": "codeNet:p02842", "input_text": "program sumitrust2019b\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,i\n\n read*, n\n do i=1,n\n if (int(i*1.08d0) == n) then\n print'(i0)', i\n stop\n end if\n end do\n print'(a)', ':('\nend program sumitrust2019b", "language": "Fortran", "metadata": {"date": 1589508430, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02842.html", "problem_id": "p02842", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02842/input.txt", "sample_output_relpath": "derived/input_output/data/p02842/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02842/Fortran/s333927078.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s333927078", "user_id": "u234636620"}, "prompt_components": {"gold_output": "400\n", "input_to_evaluate": "program sumitrust2019b\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,i\n\n read*, n\n do i=1,n\n if (int(i*1.08d0) == n) then\n print'(i0)', i\n stop\n end if\n end do\n print'(a)', ':('\nend program sumitrust2019b", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "sample_input": "432\n"}, "reference_outputs": ["400\n"], "source_document_id": "p02842", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 284, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s991531537", "group_id": "codeNet:p02842", "input_text": " PROGRAM taxRate\n IMPLICIT NONE\n integer :: n\n integer :: i,x\n \n read*,n\n \n do i = 1,n\n x = i * 108 / 100\n if( x==n ) goto 100\n end do\n \n \n print'(a)',':('\n RETURN\n \n 100 continue\n print*,i\n \n \n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1575252446, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02842.html", "problem_id": "p02842", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02842/input.txt", "sample_output_relpath": "derived/input_output/data/p02842/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02842/Fortran/s991531537.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s991531537", "user_id": "u171356453"}, "prompt_components": {"gold_output": "400\n", "input_to_evaluate": " PROGRAM taxRate\n IMPLICIT NONE\n integer :: n\n integer :: i,x\n \n read*,n\n \n do i = 1,n\n x = i * 108 / 100\n if( x==n ) goto 100\n end do\n \n \n print'(a)',':('\n RETURN\n \n 100 continue\n print*,i\n \n \n \n \n \n END PROGRAM", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "sample_input": "432\n"}, "reference_outputs": ["400\n"], "source_document_id": "p02842", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi bought a piece of apple pie at ABC Confiserie. According to his memory, he paid N yen (the currency of Japan) for it.\n\nThe consumption tax rate for foods in this shop is 8 percent. That is, to buy an apple pie priced at X yen before tax, you have to pay X \\times 1.08 yen (rounded down to the nearest integer).\n\nTakahashi forgot the price of his apple pie before tax, X, and wants to know it again. Write a program that takes N as input and finds X. We assume X is an integer.\n\nIf there are multiple possible values for X, find any one of them. Also, Takahashi's memory of N, the amount he paid, may be incorrect. If no value could be X, report that fact.\n\nConstraints\n\n1 \\leq N \\leq 50000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there are values that could be X, the price of the apple pie before tax, print any one of them.\n\nIf there are multiple such values, printing any one of them will be accepted.\n\nIf no value could be X, print :(.\n\nSample Input 1\n\n432\n\nSample Output 1\n\n400\n\nIf the apple pie is priced at 400 yen before tax, you have to pay 400 \\times 1.08 = 432 yen to buy one.\n\nOtherwise, the amount you have to pay will not be 432 yen.\n\nSample Input 2\n\n1079\n\nSample Output 2\n\n:(\n\nThere is no possible price before tax for which you have to pay 1079 yen with tax.\n\nSample Input 3\n\n1001\n\nSample Output 3\n\n927\n\nIf the apple pie is priced 927 yen before tax, by rounding down 927 \\times 1.08 = 1001.16, you have to pay 1001 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 332, "cpu_time_ms": 7, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s347747882", "group_id": "codeNet:p02845", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: i,n,ans=1\n integer(int64),parameter:: md = 1000000007\n integer(int64), allocatable:: a(:)\n\n read*, n\n allocate(a(n))\n read*, a(:)\n\n block; integer:: i1=0, i2=0, i3=0\n do i=1,n\n if (i1 == i2 .and. i2 == i3) then\n ans=mod(ans*3, md)\n i1=i1+1\n else if (i1 == i2 .and. a(i) == i1) then\n ans=mod(ans*2, md)\n i1=i1+1\n else if (i2 == i3 .and. a(i) == i2) then\n ans=mod(ans*2, md)\n i2=i2+1\n else\n if (a(i) == i1) then\n i1=i1+1\n else if(a(i) == i2) then\n i2=i2+1\n else if (a(i) == i3) then\n i3=i3+1\n else\n print'(i0)', 0\n stop\n end if\n end if\n end do\n end block\n print'(i0)', ans\nend program main", "language": "Fortran", "metadata": {"date": 1597709353, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02845.html", "problem_id": "p02845", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02845/input.txt", "sample_output_relpath": "derived/input_output/data/p02845/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02845/Fortran/s347747882.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s347747882", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: i,n,ans=1\n integer(int64),parameter:: md = 1000000007\n integer(int64), allocatable:: a(:)\n\n read*, n\n allocate(a(n))\n read*, a(:)\n\n block; integer:: i1=0, i2=0, i3=0\n do i=1,n\n if (i1 == i2 .and. i2 == i3) then\n ans=mod(ans*3, md)\n i1=i1+1\n else if (i1 == i2 .and. a(i) == i1) then\n ans=mod(ans*2, md)\n i1=i1+1\n else if (i2 == i3 .and. a(i) == i2) then\n ans=mod(ans*2, md)\n i2=i2+1\n else\n if (a(i) == i1) then\n i1=i1+1\n else if(a(i) == i2) then\n i2=i2+1\n else if (a(i) == i3) then\n i3=i3+1\n else\n print'(i0)', 0\n stop\n end if\n end if\n end do\n end block\n print'(i0)', ans\nend program main", "problem_context": "Score: 500 points\n\nProblem Statement\n\nN people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green.\n\nThe person numbered i says:\n\n\"In front of me, exactly A_i people are wearing hats with the same color as mine.\"\n\nAssuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats.\n\nSince the count can be enormous, compute it modulo 1000000007.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\n0 \\leq A_i \\leq N-1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_N\n\nOutput\n\nPrint the number of possible combinations of colors of the N people's hats, modulo 1000000007.\n\nSample Input 1\n\n6\n0 1 2 3 4 5\n\nSample Output 1\n\n3\n\nWe have three possible combinations, as follows:\n\nRed, Red, Red, Red, Red, Red\n\nBlue, Blue, Blue, Blue, Blue, Blue\n\nGreen, Green, Green, Green, Green, Green\n\nSample Input 2\n\n3\n0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n54\n0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17\n\nSample Output 3\n\n115295190", "sample_input": "6\n0 1 2 3 4 5\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02845", "source_text": "Score: 500 points\n\nProblem Statement\n\nN people are standing in a queue, numbered 1, 2, 3, ..., N from front to back. Each person wears a hat, which is red, blue, or green.\n\nThe person numbered i says:\n\n\"In front of me, exactly A_i people are wearing hats with the same color as mine.\"\n\nAssuming that all these statements are correct, find the number of possible combinations of colors of the N people's hats.\n\nSince the count can be enormous, compute it modulo 1000000007.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\n0 \\leq A_i \\leq N-1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 A_3 ... A_N\n\nOutput\n\nPrint the number of possible combinations of colors of the N people's hats, modulo 1000000007.\n\nSample Input 1\n\n6\n0 1 2 3 4 5\n\nSample Output 1\n\n3\n\nWe have three possible combinations, as follows:\n\nRed, Red, Red, Red, Red, Red\n\nBlue, Blue, Blue, Blue, Blue, Blue\n\nGreen, Green, Green, Green, Green, Green\n\nSample Input 2\n\n3\n0 0 0\n\nSample Output 2\n\n6\n\nSample Input 3\n\n54\n0 0 1 0 1 2 1 2 3 2 3 3 4 4 5 4 6 5 7 8 5 6 6 7 7 8 8 9 9 10 10 11 9 12 10 13 14 11 11 12 12 13 13 14 14 15 15 15 16 16 16 17 17 17\n\nSample Output 3\n\n115295190", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1029, "cpu_time_ms": 37, "memory_kb": 3916}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s053736243", "group_id": "codeNet:p02846", "input_text": " PROGRAM run\n IMPLICIT NONE\n INTEGER(16) :: a1,a2,b1,b2,t1,t2\n INTEGER(16) :: iter,sub,len1,len2,s,l,pos1,pos2\n INTEGER(16) :: piyo,i,ans\n \n read*,t1,t2\n read*,a1,a2\n read*,b1,b2\n \n do while( .true. )\n if( mod(t1,2)==0.and.mod(t2,2)==0.and.&\n mod(a1,2)==0.and.mod(a2,2)==0.and. &\n mod(b1,2)==0.and.mod(b2,2)==0 )then\n \n a1 = a1/2;a2 = a2/2;\n b1 = b1/2;b2 = b2/2;\n t1 = t1/2;t2 = t2/2;\n else\n exit\n end if\n end do\n \n \n len1 = t1*a1 + t2*a2\n len2 = t1*b1 + t2*b2\n s = min( len1,len2 )\n l = max( len1,len2 )\n \n sub = l - s\n \n if( sub==0 )then\n print*,'infinity'\n stop\n end if\n iter = s / sub + 1\n \n pos1 = 0;pos2 = 0;ans = 0\n piyo = 3\n do i = 1,iter\n pos1 = pos1 + t1*a1\n pos2 = pos2 + t1*b1\n if( pos2 > pos1 )then\n if(piyo==1) ans = ans + 1\n piyo = 2\n else\n if(piyo==2) ans = ans + 1\n piyo = 1\n end if\n \n \n pos1 = pos1 + t2*a2\n pos2 = pos2 + t2*b2\n if( pos2 > pos1 )then\n if(piyo==1) ans = ans + 1\n piyo = 2\n else\n if(piyo==2) ans = ans + 1\n piyo = 1\n end if\n end do\n \n print*,ans\n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1575257558, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02846.html", "problem_id": "p02846", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02846/input.txt", "sample_output_relpath": "derived/input_output/data/p02846/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02846/Fortran/s053736243.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s053736243", "user_id": "u171356453"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": " PROGRAM run\n IMPLICIT NONE\n INTEGER(16) :: a1,a2,b1,b2,t1,t2\n INTEGER(16) :: iter,sub,len1,len2,s,l,pos1,pos2\n INTEGER(16) :: piyo,i,ans\n \n read*,t1,t2\n read*,a1,a2\n read*,b1,b2\n \n do while( .true. )\n if( mod(t1,2)==0.and.mod(t2,2)==0.and.&\n mod(a1,2)==0.and.mod(a2,2)==0.and. &\n mod(b1,2)==0.and.mod(b2,2)==0 )then\n \n a1 = a1/2;a2 = a2/2;\n b1 = b1/2;b2 = b2/2;\n t1 = t1/2;t2 = t2/2;\n else\n exit\n end if\n end do\n \n \n len1 = t1*a1 + t2*a2\n len2 = t1*b1 + t2*b2\n s = min( len1,len2 )\n l = max( len1,len2 )\n \n sub = l - s\n \n if( sub==0 )then\n print*,'infinity'\n stop\n end if\n iter = s / sub + 1\n \n pos1 = 0;pos2 = 0;ans = 0\n piyo = 3\n do i = 1,iter\n pos1 = pos1 + t1*a1\n pos2 = pos2 + t1*b1\n if( pos2 > pos1 )then\n if(piyo==1) ans = ans + 1\n piyo = 2\n else\n if(piyo==2) ans = ans + 1\n piyo = 1\n end if\n \n \n pos1 = pos1 + t2*a2\n pos2 = pos2 + t2*b2\n if( pos2 > pos1 )then\n if(piyo==1) ans = ans + 1\n piyo = 2\n else\n if(piyo==2) ans = ans + 1\n piyo = 1\n end if\n end do\n \n print*,ans\n \n \n \n END PROGRAM", "problem_context": "Score: 600 points\n\nProblem Statement\n\nTakahashi and Aoki are training for long-distance races in an infinitely long straight course running from west to east.\n\nThey start simultaneously at the same point and moves as follows towards the east:\n\nTakahashi runs A_1 meters per minute for the first T_1 minutes, then runs at A_2 meters per minute for the subsequent T_2 minutes, and alternates between these two modes forever.\n\nAoki runs B_1 meters per minute for the first T_1 minutes, then runs at B_2 meters per minute for the subsequent T_2 minutes, and alternates between these two modes forever.\n\nHow many times will Takahashi and Aoki meet each other, that is, come to the same point? We do not count the start of the run. If they meet infinitely many times, report that fact.\n\nConstraints\n\n1 \\leq T_i \\leq 100000\n\n1 \\leq A_i \\leq 10^{10}\n\n1 \\leq B_i \\leq 10^{10}\n\nA_1 \\neq B_1\n\nA_2 \\neq B_2\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT_1 T_2\nA_1 A_2\nB_1 B_2\n\nOutput\n\nPrint the number of times Takahashi and Aoki will meet each other.\n\nIf they meet infinitely many times, print infinity instead.\n\nSample Input 1\n\n1 2\n10 10\n12 4\n\nSample Output 1\n\n1\n\nThey will meet just once, \\frac{4}{3} minutes after they start, at \\frac{40}{3} meters from where they start.\n\nSample Input 2\n\n100 1\n101 101\n102 1\n\nSample Output 2\n\ninfinity\n\nThey will meet 101, 202, 303, 404, 505, 606, ... minutes after they start, that is, they will meet infinitely many times.\n\nSample Input 3\n\n12000 15700\n3390000000 3810000000\n5550000000 2130000000\n\nSample Output 3\n\n113\n\nThe values in input may not fit into a 32-bit integer type.", "sample_input": "1 2\n10 10\n12 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02846", "source_text": "Score: 600 points\n\nProblem Statement\n\nTakahashi and Aoki are training for long-distance races in an infinitely long straight course running from west to east.\n\nThey start simultaneously at the same point and moves as follows towards the east:\n\nTakahashi runs A_1 meters per minute for the first T_1 minutes, then runs at A_2 meters per minute for the subsequent T_2 minutes, and alternates between these two modes forever.\n\nAoki runs B_1 meters per minute for the first T_1 minutes, then runs at B_2 meters per minute for the subsequent T_2 minutes, and alternates between these two modes forever.\n\nHow many times will Takahashi and Aoki meet each other, that is, come to the same point? We do not count the start of the run. If they meet infinitely many times, report that fact.\n\nConstraints\n\n1 \\leq T_i \\leq 100000\n\n1 \\leq A_i \\leq 10^{10}\n\n1 \\leq B_i \\leq 10^{10}\n\nA_1 \\neq B_1\n\nA_2 \\neq B_2\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT_1 T_2\nA_1 A_2\nB_1 B_2\n\nOutput\n\nPrint the number of times Takahashi and Aoki will meet each other.\n\nIf they meet infinitely many times, print infinity instead.\n\nSample Input 1\n\n1 2\n10 10\n12 4\n\nSample Output 1\n\n1\n\nThey will meet just once, \\frac{4}{3} minutes after they start, at \\frac{40}{3} meters from where they start.\n\nSample Input 2\n\n100 1\n101 101\n102 1\n\nSample Output 2\n\ninfinity\n\nThey will meet 101, 202, 303, 404, 505, 606, ... minutes after they start, that is, they will meet infinitely many times.\n\nSample Input 3\n\n12000 15700\n3390000000 3810000000\n5550000000 2130000000\n\nSample Output 3\n\n113\n\nThe values in input may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1426, "cpu_time_ms": 2103, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s678242747", "group_id": "codeNet:p02847", "input_text": "program prob80\n implicit none\n character(3) :: s\n character(3) :: t(7)\n integer :: i\n read(*,*) s\n t = (/\"SUN\",\"MON\",\"TUE\",\"WED\",\"THU\",\"FRI\",\"SAT\"/)\n\n do i = 1, 7\n if(t(i) == s) then\n write(*,*) 8-i\n end if\n end do\n\n stop\ncontains\nend program prob80", "language": "Fortran", "metadata": {"date": 1592634602, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02847.html", "problem_id": "p02847", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02847/input.txt", "sample_output_relpath": "derived/input_output/data/p02847/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02847/Fortran/s678242747.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s678242747", "user_id": "u478462004"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program prob80\n implicit none\n character(3) :: s\n character(3) :: t(7)\n integer :: i\n read(*,*) s\n t = (/\"SUN\",\"MON\",\"TUE\",\"WED\",\"THU\",\"FRI\",\"SAT\"/)\n\n do i = 1, 7\n if(t(i) == s) then\n write(*,*) 8-i\n end if\n end do\n\n stop\ncontains\nend program prob80", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "sample_input": "SAT\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02847", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 301, "cpu_time_ms": 7, "memory_kb": 2748}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s460035463", "group_id": "codeNet:p02847", "input_text": "program main\n implicit none\n integer(4):: i\n character(3), parameter:: week(7) = [\"SUN\", \"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\"]\n character(3):: input_week\n read*, input_week\n\n do i = 1, 6\n if (week(i) == input_week) print*, week(i+1)\n end do\n\n print*, week(1)\n\n\n\nend program main", "language": "Fortran", "metadata": {"date": 1575568930, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02847.html", "problem_id": "p02847", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02847/input.txt", "sample_output_relpath": "derived/input_output/data/p02847/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02847/Fortran/s460035463.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s460035463", "user_id": "u234636620"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n integer(4):: i\n character(3), parameter:: week(7) = [\"SUN\", \"MON\", \"TUE\", \"WED\", \"THU\", \"FRI\", \"SAT\"]\n character(3):: input_week\n read*, input_week\n\n do i = 1, 6\n if (week(i) == input_week) print*, week(i+1)\n end do\n\n print*, week(1)\n\n\n\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "sample_input": "SAT\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02847", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 313, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s066129205", "group_id": "codeNet:p02847", "input_text": "program a\n\tcharacter(len=3) :: day\n read '(a)', day\n \n if (day == 'MON') then\n \tprint '(i0)', 6\n else if (day == 'TUE') then\n \tprint '(i0)', 5\n else if (day == 'WED') then\n \tprint '(i0)', 4\n else if (day == 'THU') then\n \tprint '(i0)', 3\n else if (day == 'FRI') then\n \tprint '(i0)', 2\n else if (day == 'SAT') then\n \tprint '(i0)', 1\n else if (day == 'SUN') then\n \tprint '(i0)', 7\n end if\n\nend program a", "language": "Fortran", "metadata": {"date": 1575496510, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02847.html", "problem_id": "p02847", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02847/input.txt", "sample_output_relpath": "derived/input_output/data/p02847/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02847/Fortran/s066129205.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s066129205", "user_id": "u631277801"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program a\n\tcharacter(len=3) :: day\n read '(a)', day\n \n if (day == 'MON') then\n \tprint '(i0)', 6\n else if (day == 'TUE') then\n \tprint '(i0)', 5\n else if (day == 'WED') then\n \tprint '(i0)', 4\n else if (day == 'THU') then\n \tprint '(i0)', 3\n else if (day == 'FRI') then\n \tprint '(i0)', 2\n else if (day == 'SAT') then\n \tprint '(i0)', 1\n else if (day == 'SUN') then\n \tprint '(i0)', 7\n end if\n\nend program a", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "sample_input": "SAT\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02847", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is a string S representing the day of the week today.\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT, for Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.\n\nAfter how many days is the next Sunday (tomorrow or later)?\n\nConstraints\n\nS is SUN, MON, TUE, WED, THU, FRI, or SAT.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of days before the next Sunday.\n\nSample Input 1\n\nSAT\n\nSample Output 1\n\n1\n\nIt is Saturday today, and tomorrow will be Sunday.\n\nSample Input 2\n\nSUN\n\nSample Output 2\n\n7\n\nIt is Sunday today, and seven days later, it will be Sunday again.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 451, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s792728607", "group_id": "codeNet:p02848", "input_text": "program rot_b\n implicit none\n integer(4):: n, i, j\n character(10000):: s, ns\n character(52), parameter:: alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'\n read*, n\n read*, s\n do i=1,len_trim(s)\n do j=1, 26\n if (alphabet(j:j) == s(i:i))then\n ns(i:i) = alphabet(j+n:j+n)\n end if\n end do\n end do\n print\"(a)\", trim(ns(1:len_trim(s)))\nend program rot_b", "language": "Fortran", "metadata": {"date": 1581047536, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02848.html", "problem_id": "p02848", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02848/input.txt", "sample_output_relpath": "derived/input_output/data/p02848/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02848/Fortran/s792728607.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s792728607", "user_id": "u234636620"}, "prompt_components": {"gold_output": "CDEZAB\n", "input_to_evaluate": "program rot_b\n implicit none\n integer(4):: n, i, j\n character(10000):: s, ns\n character(52), parameter:: alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'\n read*, n\n read*, s\n do i=1,len_trim(s)\n do j=1, 26\n if (alphabet(j:j) == s(i:i))then\n ns(i:i) = alphabet(j+n:j+n)\n end if\n end do\n end do\n print\"(a)\", trim(ns(1:len_trim(s)))\nend program rot_b", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "sample_input": "2\nABCXYZ\n"}, "reference_outputs": ["CDEZAB\n"], "source_document_id": "p02848", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a string S consisting of uppercase English letters. Additionally, an integer N will be given.\n\nShift each character of S by N in alphabetical order (see below), and print the resulting string.\n\nWe assume that A follows Z. For example, shifting A by 2 results in C (A \\to B \\to C), and shifting Y by 3 results in B (Y \\to Z \\to A \\to B).\n\nConstraints\n\n0 \\leq N \\leq 26\n\n1 \\leq |S| \\leq 10^4\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the string resulting from shifting each character of S by N in alphabetical order.\n\nSample Input 1\n\n2\nABCXYZ\n\nSample Output 1\n\nCDEZAB\n\nNote that A follows Z.\n\nSample Input 2\n\n0\nABCXYZ\n\nSample Output 2\n\nABCXYZ\n\nSample Input 3\n\n13\nABCDEFGHIJKLMNOPQRSTUVWXYZ\n\nSample Output 3\n\nNOPQRSTUVWXYZABCDEFGHIJKLM", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 442, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s769230775", "group_id": "codeNet:p02853", "input_text": "program sample\n implicit none\n \n integer(8) :: i,j,m,n,x,y\n real(8)::a,b\n \n \n read(*,*) x,y\n m=0\n if (x==1)then\n m=m+300000\n if (y==1)then\n m=m+400000\n end if\n end if\n if (x==2)then\n m=m+200000\n end if\n if (x==3)then\n m=m+100000\n end if\n if (y==1)then\n m=m+300000\n end if\n if (y==2)then\n m=m+200000\n end if\n if (y==3)then\n m=m+100000\n end if\n write(*,*) m\n \n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1592615182, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02853.html", "problem_id": "p02853", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02853/input.txt", "sample_output_relpath": "derived/input_output/data/p02853/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02853/Fortran/s769230775.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s769230775", "user_id": "u713568912"}, "prompt_components": {"gold_output": "1000000\n", "input_to_evaluate": "program sample\n implicit none\n \n integer(8) :: i,j,m,n,x,y\n real(8)::a,b\n \n \n read(*,*) x,y\n m=0\n if (x==1)then\n m=m+300000\n if (y==1)then\n m=m+400000\n end if\n end if\n if (x==2)then\n m=m+200000\n end if\n if (x==3)then\n m=m+100000\n end if\n if (y==1)then\n m=m+300000\n end if\n if (y==2)then\n m=m+200000\n end if\n if (y==3)then\n m=m+100000\n end if\n write(*,*) m\n \n stop\nend program sample\n \n\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nWe held two competitions: Coding Contest and Robot Maneuver.\n\nIn each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen.\n\nDISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver.\nFind the total amount of money he earned.\n\nConstraints\n\n1 \\leq X \\leq 205\n\n1 \\leq Y \\leq 205\n\nX and Y are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the amount of money DISCO-Kun earned, as an integer.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n1000000\n\nIn this case, he earned 300000 yen in Coding Contest and another 300000 yen in Robot Maneuver. Furthermore, as he won both competitions, he got an additional 400000 yen.\nIn total, he made 300000 + 300000 + 400000 = 1000000 yen.\n\nSample Input 2\n\n3 101\n\nSample Output 2\n\n100000\n\nIn this case, he earned 100000 yen in Coding Contest.\n\nSample Input 3\n\n4 4\n\nSample Output 3\n\n0\n\nIn this case, unfortunately, he was the highest-ranked contestant without prize money in both competitions.", "sample_input": "1 1\n"}, "reference_outputs": ["1000000\n"], "source_document_id": "p02853", "source_text": "Score: 100 points\n\nProblem Statement\n\nWe held two competitions: Coding Contest and Robot Maneuver.\n\nIn each competition, the contestants taking the 3-rd, 2-nd, and 1-st places receive 100000, 200000, and 300000 yen (the currency of Japan), respectively. Furthermore, a contestant taking the first place in both competitions receives an additional 400000 yen.\n\nDISCO-Kun took the X-th place in Coding Contest and the Y-th place in Robot Maneuver.\nFind the total amount of money he earned.\n\nConstraints\n\n1 \\leq X \\leq 205\n\n1 \\leq Y \\leq 205\n\nX and Y are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the amount of money DISCO-Kun earned, as an integer.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n1000000\n\nIn this case, he earned 300000 yen in Coding Contest and another 300000 yen in Robot Maneuver. Furthermore, as he won both competitions, he got an additional 400000 yen.\nIn total, he made 300000 + 300000 + 400000 = 1000000 yen.\n\nSample Input 2\n\n3 101\n\nSample Output 2\n\n100000\n\nIn this case, he earned 100000 yen in Coding Contest.\n\nSample Input 3\n\n4 4\n\nSample Output 3\n\n0\n\nIn this case, unfortunately, he was the highest-ranked contestant without prize money in both competitions.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 517, "cpu_time_ms": 9, "memory_kb": 2828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s695022578", "group_id": "codeNet:p02855", "input_text": "program ddcc2020qualc\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: h,w,k\n integer(int32):: i,num,x,y,endy,endx\n integer(int32), allocatable:: a(:,:)\n character(:),allocatable:: s(:)\n\n read*, h,w,k\n allocate(character(w):: s(h))\n allocate(a(w,h), source=0)\n do i=1,h\n read*, s(i)\n end do\n num = 1\n endy = 0\n do y=1,h\n endx=0\n do x=1,w\n if (s(y)(x:x) == '#') then\n a(endx+1:x,endy+1:y) = num\n endx = x\n num=num+1\n end if\n end do\n if (endx < w .and. endy < h)then\n a(endx+1:w,endy+1:y) = num-1\n end if\n if (endx /= 0) endy=y \n end do\n\n do i=1,h\n print'(*(i0,1x))', a(:,i)\n end do\nend program ddcc2020qualc", "language": "Fortran", "metadata": {"date": 1591231420, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02855.html", "problem_id": "p02855", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02855/input.txt", "sample_output_relpath": "derived/input_output/data/p02855/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02855/Fortran/s695022578.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s695022578", "user_id": "u234636620"}, "prompt_components": {"gold_output": "1 2 2\n1 3 4\n5 5 4\n", "input_to_evaluate": "program ddcc2020qualc\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: h,w,k\n integer(int32):: i,num,x,y,endy,endx\n integer(int32), allocatable:: a(:,:)\n character(:),allocatable:: s(:)\n\n read*, h,w,k\n allocate(character(w):: s(h))\n allocate(a(w,h), source=0)\n do i=1,h\n read*, s(i)\n end do\n num = 1\n endy = 0\n do y=1,h\n endx=0\n do x=1,w\n if (s(y)(x:x) == '#') then\n a(endx+1:x,endy+1:y) = num\n endx = x\n num=num+1\n end if\n end do\n if (endx < w .and. endy < h)then\n a(endx+1:w,endy+1:y) = num-1\n end if\n if (endx /= 0) endy=y \n end do\n\n do i=1,h\n print'(*(i0,1x))', a(:,i)\n end do\nend program ddcc2020qualc", "problem_context": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "sample_input": "3 3 5\n#.#\n.#.\n#.#\n"}, "reference_outputs": ["1 2 2\n1 3 4\n5 5 4\n"], "source_document_id": "p02855", "source_text": "Score: 400 points\n\nProblem Statement\n\nChokudai made a rectangular cake for contestants in DDCC 2020 Finals.\n\nThe cake has H - 1 horizontal notches and W - 1 vertical notches, which divide the cake into H \\times W equal sections. K of these sections has a strawberry on top of each of them.\n\nThe positions of the strawberries are given to you as H \\times W characters s_{i, j} (1 \\leq i \\leq H, 1 \\leq j \\leq W). If s_{i, j} is #, the section at the i-th row from the top and the j-th column from the left contains a strawberry; if s_{i, j} is ., the section does not contain one. There are exactly K occurrences of #s.\n\nTakahashi wants to cut this cake into K pieces and serve them to the contestants. Each of these pieces must satisfy the following conditions:\n\nHas a rectangular shape.\n\nContains exactly one strawberry.\n\nOne possible way to cut the cake is shown below:\n\nFind one way to cut the cake and satisfy the condition. We can show that this is always possible, regardless of the number and positions of the strawberries.\n\nConstraints\n\n1 \\leq H \\leq 300\n\n1 \\leq W \\leq 300\n\n1 \\leq K \\leq H \\times W\n\ns_{i, j} is # or ..\n\nThere are exactly K occurrences of # in s.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\ns_{1, 1} s_{1, 2} \\cdots s_{1, W}\ns_{2, 1} s_{2, 2} \\cdots s_{2, W}\n:\ns_{H, 1} s_{H, 2} \\cdots s_{H, W}\n\nOutput\n\nAssign the numbers 1, 2, 3, \\dots, K to the K pieces obtained after the cut, in any order. Then, let a_{i, j} be the number representing the piece containing the section at the i-th row from the top and the j-th column from the left of the cake. Output should be in the following format:\n\na_{1, 1} \\ a_{1, 2} \\ \\cdots \\ a_{1, W}\na_{2, 1} \\ a_{2, 2} \\ \\cdots \\ a_{2, W}\n:\na_{H, 1} \\ a_{H, 2} \\ \\cdots \\ a_{H, W}\n\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3 3 5\n#.#\n.#.\n#.#\n\nSample Output 1\n\n1 2 2\n1 3 4\n5 5 4\n\nOne way to cut this cake is shown below:\n\nSample Input 2\n\n3 7 7\n#...#.#\n..#...#\n.#..#..\n\nSample Output 2\n\n1 1 2 2 3 4 4\n6 6 2 2 3 5 5\n6 6 7 7 7 7 7\n\nOne way to cut this cake is shown below:\n\nSample Input 3\n\n13 21 106\n.....................\n.####.####.####.####.\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n..#.#..#.#.#....#....\n.####.####.####.####.\n.....................\n.####.####.####.####.\n....#.#..#....#.#..#.\n.####.#..#.####.#..#.\n.#....#..#.#....#..#.\n.####.####.####.####.\n.....................\n\nSample Output 3\n\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 23 34 45 45 60 71 82 93 93 2 13 24 35 35 17 28 39 50 50\n12 12 56 89 89 89 60 104 82 31 31 46 13 24 35 35 61 61 39 50 50\n12 12 67 67 100 100 60 9 9 42 42 57 13 24 6 72 72 72 72 72 72\n12 12 78 5 5 5 20 20 20 53 68 68 90 24 6 83 83 83 83 83 83\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n16 16 27 38 49 49 64 75 86 97 79 79 90 101 6 94 94 105 10 21 21\n32 32 43 54 65 65 80 11 106 95 22 22 33 44 55 55 70 1 96 85 85\n32 32 43 54 76 76 91 11 106 84 84 4 99 66 66 66 81 1 96 74 74\n14 14 3 98 87 87 102 11 73 73 73 4 99 88 77 77 92 92 63 63 63\n25 25 3 98 87 87 7 29 62 62 62 15 99 88 77 77 103 19 30 52 52\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41\n36 36 47 58 69 69 18 29 40 51 51 26 37 48 59 59 8 19 30 41 41", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 809, "cpu_time_ms": 23, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s462325889", "group_id": "codeNet:p02856", "input_text": "program DISCO2020yD\ninteger::M\ninteger::d,c\ninteger bonus\ninteger(16)::ans\nread*,M\nans=0\nbonus=0\ndo i=1,M\n read*,d,c\n bonus=bonus+d*c\n ans=ans+c+bonus/10\n bonus=mod(bonus,10)\nend do\nprint\"(i0)\",ans-1\nend", "language": "Fortran", "metadata": {"date": 1574565078, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02856.html", "problem_id": "p02856", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02856/input.txt", "sample_output_relpath": "derived/input_output/data/p02856/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02856/Fortran/s462325889.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s462325889", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program DISCO2020yD\ninteger::M\ninteger::d,c\ninteger bonus\ninteger(16)::ans\nread*,M\nans=0\nbonus=0\ndo i=1,M\n read*,d,c\n bonus=bonus+d*c\n ans=ans+c+bonus/10\n bonus=mod(bonus,10)\nend do\nprint\"(i0)\",ans-1\nend", "problem_context": "Score: 500 points\n\nProblem Statement\n\nN programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals.\n\nThe preliminary stage consists of several rounds, which will take place as follows:\n\nAll the N contestants will participate in the first round.\n\nWhen X contestants participate in some round, the number of contestants advancing to the next round will be decided as follows:\n\nThe organizer will choose two consecutive digits in the decimal notation of X, and replace them with the sum of these digits. The number resulted will be the number of contestants advancing to the next round.\n\nFor example, when X = 2378, the number of contestants advancing to the next round will be 578 (if 2 and 3 are chosen), 2108 (if 3 and 7 are chosen), or 2315 (if 7 and 8 are chosen).\n\nWhen X = 100, the number of contestants advancing to the next round will be 10, no matter which two digits are chosen.\n\nThe preliminary stage ends when 9 or fewer contestants remain.\n\nRingo, the chief organizer, wants to hold as many rounds as possible.\nFind the maximum possible number of rounds in the preliminary stage.\n\nSince the number of contestants, N, can be enormous, it is given to you as two integer sequences d_1, \\ldots, d_M and c_1, \\ldots, c_M, which means the following: the decimal notation of N consists of c_1 + c_2 + \\ldots + c_M digits, whose first c_1 digits are all d_1, the following c_2 digits are all d_2, \\ldots, and the last c_M digits are all d_M.\n\nConstraints\n\n1 \\leq M \\leq 200000\n\n0 \\leq d_i \\leq 9\n\nd_1 \\neq 0\n\nd_i \\neq d_{i+1}\n\nc_i \\geq 1\n\n2 \\leq c_1 + \\ldots + c_M \\leq 10^{15}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM\nd_1 c_1\nd_2 c_2\n:\nd_M c_M\n\nOutput\n\nPrint the maximum possible number of rounds in the preliminary stage.\n\nSample Input 1\n\n2\n2 2\n9 1\n\nSample Output 1\n\n3\n\nIn this case, N = 229 contestants will participate in the first round. One possible progression of the preliminary stage is as follows:\n\n229 contestants participate in Round 1, 49 contestants participate in Round 2, 13 contestants participate in Round 3, and 4 contestants advance to the finals.\n\nHere, three rounds take place in the preliminary stage, which is the maximum possible number.\n\nSample Input 2\n\n3\n1 1\n0 8\n7 1\n\nSample Output 2\n\n9\n\nIn this case, 1000000007 will participate in the first round.", "sample_input": "2\n2 2\n9 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02856", "source_text": "Score: 500 points\n\nProblem Statement\n\nN programmers are going to participate in the preliminary stage of DDCC 20XX. Due to the size of the venue, however, at most 9 contestants can participate in the finals.\n\nThe preliminary stage consists of several rounds, which will take place as follows:\n\nAll the N contestants will participate in the first round.\n\nWhen X contestants participate in some round, the number of contestants advancing to the next round will be decided as follows:\n\nThe organizer will choose two consecutive digits in the decimal notation of X, and replace them with the sum of these digits. The number resulted will be the number of contestants advancing to the next round.\n\nFor example, when X = 2378, the number of contestants advancing to the next round will be 578 (if 2 and 3 are chosen), 2108 (if 3 and 7 are chosen), or 2315 (if 7 and 8 are chosen).\n\nWhen X = 100, the number of contestants advancing to the next round will be 10, no matter which two digits are chosen.\n\nThe preliminary stage ends when 9 or fewer contestants remain.\n\nRingo, the chief organizer, wants to hold as many rounds as possible.\nFind the maximum possible number of rounds in the preliminary stage.\n\nSince the number of contestants, N, can be enormous, it is given to you as two integer sequences d_1, \\ldots, d_M and c_1, \\ldots, c_M, which means the following: the decimal notation of N consists of c_1 + c_2 + \\ldots + c_M digits, whose first c_1 digits are all d_1, the following c_2 digits are all d_2, \\ldots, and the last c_M digits are all d_M.\n\nConstraints\n\n1 \\leq M \\leq 200000\n\n0 \\leq d_i \\leq 9\n\nd_1 \\neq 0\n\nd_i \\neq d_{i+1}\n\nc_i \\geq 1\n\n2 \\leq c_1 + \\ldots + c_M \\leq 10^{15}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM\nd_1 c_1\nd_2 c_2\n:\nd_M c_M\n\nOutput\n\nPrint the maximum possible number of rounds in the preliminary stage.\n\nSample Input 1\n\n2\n2 2\n9 1\n\nSample Output 1\n\n3\n\nIn this case, N = 229 contestants will participate in the first round. One possible progression of the preliminary stage is as follows:\n\n229 contestants participate in Round 1, 49 contestants participate in Round 2, 13 contestants participate in Round 3, and 4 contestants advance to the finals.\n\nHere, three rounds take place in the preliminary stage, which is the maximum possible number.\n\nSample Input 2\n\n3\n1 1\n0 8\n7 1\n\nSample Output 2\n\n9\n\nIn this case, 1000000007 will participate in the first round.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 207, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s874297344", "group_id": "codeNet:p02858", "input_text": "integer(16)::mo = 10**9 + 7\ninteger h, w, t\ninteger gh,gw\ninteger(16) ans\nread*,h,w,t\ngh = gcd(h, t)\ngw = gcd(w, t)\nh =h/ gh\nw =w/ gw\nans = mod((power(2_16, h) + power(2_16, w) - 1_16 + mo),mo)\nans = mod((ans + power(2_16,gcd(h, w)) - 2_16 + mo),mo) \nprint\"(i0)\",power(ans, gh * gw)\ncontains\ninteger(16) function power(x,y)\ninteger(16) x,k\ninteger y,l2\npower=1\nl2=y\nk=x\ndo\n if(mod(l2,2)==1)power=mod(power*k,mo)\n k=mod(k*k,mo)\n l2=l2/2\n if(l2==0)exit\nend do\nend function\ninteger recursive function gcd(a, b)result(res)\n integer, intent(in)::a, b\n res=merge(b, gcd(b, mod(a, b)),mod(a, b)==0)\nend function\nend \n", "language": "Fortran", "metadata": {"date": 1574671972, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02858.html", "problem_id": "p02858", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02858/input.txt", "sample_output_relpath": "derived/input_output/data/p02858/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02858/Fortran/s874297344.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s874297344", "user_id": "u598073939"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "integer(16)::mo = 10**9 + 7\ninteger h, w, t\ninteger gh,gw\ninteger(16) ans\nread*,h,w,t\ngh = gcd(h, t)\ngw = gcd(w, t)\nh =h/ gh\nw =w/ gw\nans = mod((power(2_16, h) + power(2_16, w) - 1_16 + mo),mo)\nans = mod((ans + power(2_16,gcd(h, w)) - 2_16 + mo),mo) \nprint\"(i0)\",power(ans, gh * gw)\ncontains\ninteger(16) function power(x,y)\ninteger(16) x,k\ninteger y,l2\npower=1\nl2=y\nk=x\ndo\n if(mod(l2,2)==1)power=mod(power*k,mo)\n k=mod(k*k,mo)\n l2=l2/2\n if(l2==0)exit\nend do\nend function\ninteger recursive function gcd(a, b)result(res)\n integer, intent(in)::a, b\n res=merge(b, gcd(b, mod(a, b)),mod(a, b)==0)\nend function\nend \n", "problem_context": "Score: 900 points\n\nProblem Statement\n\nIn 2937, DISCO creates a new universe called DISCOSMOS to celebrate its 1000-th anniversary.\n\nDISCOSMOS can be described as an H \\times W grid. Let (i, j) (1 \\leq i \\leq H, 1 \\leq j \\leq W) denote the square at the i-th row from the top and the j-th column from the left.\n\nAt time 0, one robot will be placed onto each square. Each robot is one of the following three types:\n\nType-H: Does not move at all.\n\nType-R: If a robot of this type is in (i, j) at time t, it will be in (i, j+1) at time t+1. If it is in (i, W) at time t, however, it will be instead in (i, 1) at time t+1. (The robots do not collide with each other.)\n\nType-D: If a robot of this type is in (i, j) at time t, it will be in (i+1, j) at time t+1. If it is in (H, j) at time t, however, it will be instead in (1, j) at time t+1.\n\nThere are 3^{H \\times W} possible ways to place these robots. In how many of them will every square be occupied by one robot at times 0, T, 2T, 3T, 4T, and all subsequent multiples of T?\n\nSince the count can be enormous, compute it modulo (10^9 + 7).\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq T \\leq 10^9\n\nH, W, T are all integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W T\n\nOutput\n\nPrint the number of ways to place the robots that satisfy the condition, modulo (10^9 + 7).\n\nSample Input 1\n\n2 2 1\n\nSample Output 1\n\n9\n\nShown below are some of the ways to place the robots that satisfy the condition, where ., >, and v stand for Type-H, Type-R, and Type-D, respectively:\n\n>> .. vv\n.. .. vv\n\nSample Input 2\n\n869 120 1001\n\nSample Output 2\n\n672919729", "sample_input": "2 2 1\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02858", "source_text": "Score: 900 points\n\nProblem Statement\n\nIn 2937, DISCO creates a new universe called DISCOSMOS to celebrate its 1000-th anniversary.\n\nDISCOSMOS can be described as an H \\times W grid. Let (i, j) (1 \\leq i \\leq H, 1 \\leq j \\leq W) denote the square at the i-th row from the top and the j-th column from the left.\n\nAt time 0, one robot will be placed onto each square. Each robot is one of the following three types:\n\nType-H: Does not move at all.\n\nType-R: If a robot of this type is in (i, j) at time t, it will be in (i, j+1) at time t+1. If it is in (i, W) at time t, however, it will be instead in (i, 1) at time t+1. (The robots do not collide with each other.)\n\nType-D: If a robot of this type is in (i, j) at time t, it will be in (i+1, j) at time t+1. If it is in (H, j) at time t, however, it will be instead in (1, j) at time t+1.\n\nThere are 3^{H \\times W} possible ways to place these robots. In how many of them will every square be occupied by one robot at times 0, T, 2T, 3T, 4T, and all subsequent multiples of T?\n\nSince the count can be enormous, compute it modulo (10^9 + 7).\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq T \\leq 10^9\n\nH, W, T are all integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W T\n\nOutput\n\nPrint the number of ways to place the robots that satisfy the condition, modulo (10^9 + 7).\n\nSample Input 1\n\n2 2 1\n\nSample Output 1\n\n9\n\nShown below are some of the ways to place the robots that satisfy the condition, where ., >, and v stand for Type-H, Type-R, and Type-D, respectively:\n\n>> .. vv\n.. .. vv\n\nSample Input 2\n\n869 120 1001\n\nSample Output 2\n\n672919729", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 616, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s953886698", "group_id": "codeNet:p02859", "input_text": "! 2019.11.16\n!\n program answer\n implicit none\n integer :: r\n read(*,*) r\n write(*,*) r**2\n end program answer\n", "language": "Fortran", "metadata": {"date": 1573956189, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02859.html", "problem_id": "p02859", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02859/input.txt", "sample_output_relpath": "derived/input_output/data/p02859/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02859/Fortran/s953886698.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s953886698", "user_id": "u954587078"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "! 2019.11.16\n!\n program answer\n implicit none\n integer :: r\n read(*,*) r\n write(*,*) r**2\n end program answer\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer r.\n\nHow many times is the area of a circle of radius r larger than the area of a circle of radius 1?\n\nIt can be proved that the answer is always an integer under the constraints given.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint the area of a circle of radius r, divided by the area of a circle of radius 1, as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n4\n\nThe area of a circle of radius 2 is 4 times larger than the area of a circle of radius 1.\n\nNote that output must be an integer - for example, 4.0 will not be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n10000", "sample_input": "2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02859", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer r.\n\nHow many times is the area of a circle of radius r larger than the area of a circle of radius 1?\n\nIt can be proved that the answer is always an integer under the constraints given.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint the area of a circle of radius r, divided by the area of a circle of radius 1, as an integer.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n4\n\nThe area of a circle of radius 2 is 4 times larger than the area of a circle of radius 1.\n\nNote that output must be an integer - for example, 4.0 will not be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 140, "cpu_time_ms": 6, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s030592045", "group_id": "codeNet:p02861", "input_text": "program main\n\n implicit none\n integer :: i,j,n \n integer, allocatable :: x(:), y(:)\n real :: dis, tmp\n \n read(*,*) n \n allocate( x(n) )\n allocate( y(n) )\n\n do i = 1, n\n read(*,*) x(i), y(i) \n end do\n \n dis = 0e0\n do i = 1, n\n do j = 1, n\n if ( j == i ) cycle\n tmp = (x(i) - x(j))**2e0 + (y(i) - y(j))**2e0\n dis = dis + sqrt( tmp ) \n end do\n end do\n do i = 1, n\n dis = dis / real( i )\n end do\n print*, dis\n\n deallocate( x )\n deallocate( y )\nend program main\n", "language": "Fortran", "metadata": {"date": 1574226519, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02861.html", "problem_id": "p02861", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02861/input.txt", "sample_output_relpath": "derived/input_output/data/p02861/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02861/Fortran/s030592045.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s030592045", "user_id": "u675314298"}, "prompt_components": {"gold_output": "2.2761423749\n", "input_to_evaluate": "program main\n\n implicit none\n integer :: i,j,n \n integer, allocatable :: x(:), y(:)\n real :: dis, tmp\n \n read(*,*) n \n allocate( x(n) )\n allocate( y(n) )\n\n do i = 1, n\n read(*,*) x(i), y(i) \n end do\n \n dis = 0e0\n do i = 1, n\n do j = 1, n\n if ( j == i ) cycle\n tmp = (x(i) - x(j))**2e0 + (y(i) - y(j))**2e0\n dis = dis + sqrt( tmp ) \n end do\n end do\n do i = 1, n\n dis = dis / real( i )\n end do\n print*, dis\n\n deallocate( x )\n deallocate( y )\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \\sqrt{\\left(x_i-x_j\\right)^2+\\left(y_i-y_j\\right)^2}.\n\nThere are N! possible paths to visit all of these towns once. Let the length of a path be the distance covered when we start at the first town in the path, visit the second, third, \\dots, towns, and arrive at the last town (assume that we travel in a straight line from a town to another). Compute the average length of these N! paths.\n\nConstraints\n\n2 \\leq N \\leq 8\n\n-1000 \\leq x_i \\leq 1000\n\n-1000 \\leq y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) (if i \\neq j)\n\n(Added 21:12 JST) All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the average length of the paths.\nYour output will be judges as correct when the absolute difference from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n3\n0 0\n1 0\n0 1\n\nSample Output 1\n\n2.2761423749\n\nThere are six paths to visit the towns: 1 → 2 → 3, 1 → 3 → 2, 2 → 1 → 3, 2 → 3 → 1, 3 → 1 → 2, and 3 → 2 → 1.\n\nThe length of the path 1 → 2 → 3 is \\sqrt{\\left(0-1\\right)^2+\\left(0-0\\right)^2} + \\sqrt{\\left(1-0\\right)^2+\\left(0-1\\right)^2} = 1+\\sqrt{2}.\n\nBy calculating the lengths of the other paths in this way, we see that the average length of all routes is:\n\n\\frac{\\left(1+\\sqrt{2}\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)}{6} = 2.276142...\n\nSample Input 2\n\n2\n-879 981\n-866 890\n\nSample Output 2\n\n91.9238815543\n\nThere are two paths to visit the towns: 1 → 2 and 2 → 1. These paths have the same length.\n\nSample Input 3\n\n8\n-406 10\n512 859\n494 362\n-955 -475\n128 553\n-986 -885\n763 77\n449 310\n\nSample Output 3\n\n7641.9817824387", "sample_input": "3\n0 0\n1 0\n0 1\n"}, "reference_outputs": ["2.2761423749\n"], "source_document_id": "p02861", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N towns in a coordinate plane. Town i is located at coordinates (x_i, y_i). The distance between Town i and Town j is \\sqrt{\\left(x_i-x_j\\right)^2+\\left(y_i-y_j\\right)^2}.\n\nThere are N! possible paths to visit all of these towns once. Let the length of a path be the distance covered when we start at the first town in the path, visit the second, third, \\dots, towns, and arrive at the last town (assume that we travel in a straight line from a town to another). Compute the average length of these N! paths.\n\nConstraints\n\n2 \\leq N \\leq 8\n\n-1000 \\leq x_i \\leq 1000\n\n-1000 \\leq y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) (if i \\neq j)\n\n(Added 21:12 JST) All values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the average length of the paths.\nYour output will be judges as correct when the absolute difference from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n3\n0 0\n1 0\n0 1\n\nSample Output 1\n\n2.2761423749\n\nThere are six paths to visit the towns: 1 → 2 → 3, 1 → 3 → 2, 2 → 1 → 3, 2 → 3 → 1, 3 → 1 → 2, and 3 → 2 → 1.\n\nThe length of the path 1 → 2 → 3 is \\sqrt{\\left(0-1\\right)^2+\\left(0-0\\right)^2} + \\sqrt{\\left(1-0\\right)^2+\\left(0-1\\right)^2} = 1+\\sqrt{2}.\n\nBy calculating the lengths of the other paths in this way, we see that the average length of all routes is:\n\n\\frac{\\left(1+\\sqrt{2}\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)+\\left(2\\right)+\\left(1+\\sqrt{2}\\right)}{6} = 2.276142...\n\nSample Input 2\n\n2\n-879 981\n-866 890\n\nSample Output 2\n\n91.9238815543\n\nThere are two paths to visit the towns: 1 → 2 and 2 → 1. These paths have the same length.\n\nSample Input 3\n\n8\n-406 10\n512 859\n494 362\n-955 -475\n128 553\n-986 -885\n763 77\n449 310\n\nSample Output 3\n\n7641.9817824387", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 503, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s333972667", "group_id": "codeNet:p02862", "input_text": "program knight\n implicit none\n integer(4)::x, y\n integer(4):: i, d\n read*, x, y\n\n if (mod(x+y,3) /= 0) then\n print*, 0\n stop\n end if\n\n d = (x+y)/3\n x = x - d\n y = y - d\n\n if (x < 0 .or. y < 0) then\n print*, 0\n stop\n end if\n\n if (x==0 .or. y==0) then\n print*, 1\n end if\n\n print*, nikou(x+y, x)\n\n contains\n function nikou(a,b) result(ret)\n integer(4):: a,b\n integer(8):: ret\n integer(8), parameter:: md = 1000000007\n integer(8), allocatable:: fi(:), i_fi(:)\n \n allocate(fi(a), i_fi(a))\n fi(1) = 1\n\n do i=2,a\n fi(i) = mod(fi(i-1)*i, md)\n end do\n\n do i=1,max(b,a-b)\n i_fi(i) = inv((fi(i)),md)\n end do\n\n ret = mod(mod(fi(a)*i_fi(b),md)*i_fi(a-b),md)\n end function\n \n\n function inv(x, md) result(ret)\n integer(8):: x, md, ret, power\n power = md-2\n ret = 1\n do while(power > 0)\n if (btest(power,0)) ret=mod(ret*x,md)\n x=mod(x*x,md)\n power = rshift(power,1)\n end do\n\n end function\nend program knight", "language": "Fortran", "metadata": {"date": 1581144827, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02862.html", "problem_id": "p02862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02862/input.txt", "sample_output_relpath": "derived/input_output/data/p02862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02862/Fortran/s333972667.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s333972667", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program knight\n implicit none\n integer(4)::x, y\n integer(4):: i, d\n read*, x, y\n\n if (mod(x+y,3) /= 0) then\n print*, 0\n stop\n end if\n\n d = (x+y)/3\n x = x - d\n y = y - d\n\n if (x < 0 .or. y < 0) then\n print*, 0\n stop\n end if\n\n if (x==0 .or. y==0) then\n print*, 1\n end if\n\n print*, nikou(x+y, x)\n\n contains\n function nikou(a,b) result(ret)\n integer(4):: a,b\n integer(8):: ret\n integer(8), parameter:: md = 1000000007\n integer(8), allocatable:: fi(:), i_fi(:)\n \n allocate(fi(a), i_fi(a))\n fi(1) = 1\n\n do i=2,a\n fi(i) = mod(fi(i-1)*i, md)\n end do\n\n do i=1,max(b,a-b)\n i_fi(i) = inv((fi(i)),md)\n end do\n\n ret = mod(mod(fi(a)*i_fi(b),md)*i_fi(a-b),md)\n end function\n \n\n function inv(x, md) result(ret)\n integer(8):: x, md, ret, power\n power = md-2\n ret = 1\n do while(power > 0)\n if (btest(power,0)) ret=mod(ret*x,md)\n x=mod(x*x,md)\n power = rshift(power,1)\n end do\n\n end function\nend program knight", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a knight - the chess piece - at the origin (0, 0) of a two-dimensional grid.\n\nWhen the knight is at the square (i, j), it can be moved to either (i+1,j+2) or (i+2, j+1).\n\nIn how many ways can the knight reach the square (X, Y)?\n\nFind the number of ways modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq X \\leq 10^6\n\n1 \\leq Y \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the number of ways for the knight to reach (X, Y) from (0, 0), modulo 10^9 + 7.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\n2\n\nThere are two ways: (0,0) \\to (1,2) \\to (3,3) and (0,0) \\to (2,1) \\to (3,3).\n\nSample Input 2\n\n2 2\n\nSample Output 2\n\n0\n\nThe knight cannot reach (2,2).\n\nSample Input 3\n\n999999 999999\n\nSample Output 3\n\n151840682\n\nPrint the number of ways modulo 10^9 + 7.", "sample_input": "3 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02862", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a knight - the chess piece - at the origin (0, 0) of a two-dimensional grid.\n\nWhen the knight is at the square (i, j), it can be moved to either (i+1,j+2) or (i+2, j+1).\n\nIn how many ways can the knight reach the square (X, Y)?\n\nFind the number of ways modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq X \\leq 10^6\n\n1 \\leq Y \\leq 10^6\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the number of ways for the knight to reach (X, Y) from (0, 0), modulo 10^9 + 7.\n\nSample Input 1\n\n3 3\n\nSample Output 1\n\n2\n\nThere are two ways: (0,0) \\to (1,2) \\to (3,3) and (0,0) \\to (2,1) \\to (3,3).\n\nSample Input 2\n\n2 2\n\nSample Output 2\n\n0\n\nThe knight cannot reach (2,2).\n\nSample Input 3\n\n999999 999999\n\nSample Output 3\n\n151840682\n\nPrint the number of ways modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1160, "cpu_time_ms": 69, "memory_kb": 9984}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s823203484", "group_id": "codeNet:p02863", "input_text": "program abc145e\ntype data\n integer::A,B\nend type\ninteger N,T\ntype(data),allocatable::menu(:)\ninteger,allocatable::DP(:,:)\ninteger ans\nread*,N,T\nallocate(dp(0:N,0:T))\nallocate(menu(N))\ndo i=1,N\n read*,menu(i)%A,menu(i)%B\nend do\nans=0\ndo ii=1,N\n DP=0\n do i = 1,N\n do j = 0,T\n if (j >= menu(i)%A.and. (.not.(i==ii)))then\n dp(i+1,j) = max(dp(i,J-menu(i)%A) +menu(i)%B, dp(i,j))\n else\n dp(i+1,j) = dp(i,j)\n endif\n end do\n end do\n ans=max(ans,DP(N,T-1)+menu(ii)%B)\nend do\nprint\"(i0)\",ans\nend program", "language": "Fortran", "metadata": {"date": 1573962567, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02863.html", "problem_id": "p02863", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02863/input.txt", "sample_output_relpath": "derived/input_output/data/p02863/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02863/Fortran/s823203484.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s823203484", "user_id": "u598073939"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "program abc145e\ntype data\n integer::A,B\nend type\ninteger N,T\ntype(data),allocatable::menu(:)\ninteger,allocatable::DP(:,:)\ninteger ans\nread*,N,T\nallocate(dp(0:N,0:T))\nallocate(menu(N))\ndo i=1,N\n read*,menu(i)%A,menu(i)%B\nend do\nans=0\ndo ii=1,N\n DP=0\n do i = 1,N\n do j = 0,T\n if (j >= menu(i)%A.and. (.not.(i==ii)))then\n dp(i+1,j) = max(dp(i,J-menu(i)%A) +menu(i)%B, dp(i,j))\n else\n dp(i+1,j) = dp(i,j)\n endif\n end do\n end do\n ans=max(ans,DP(N,T-1)+menu(ii)%B)\nend do\nprint\"(i0)\",ans\nend program", "problem_context": "Score : 500 points\n\nProblem Statement\n\nTakahashi is at an all-you-can-eat restaurant.\n\nThe restaurant offers N kinds of dishes. It takes A_i minutes to eat the i-th dish, whose deliciousness is B_i.\n\nThe restaurant has the following rules:\n\nYou can only order one dish at a time. The dish ordered will be immediately served and ready to eat.\n\nYou cannot order the same kind of dish more than once.\n\nUntil you finish eating the dish already served, you cannot order a new dish.\n\nAfter T-0.5 minutes from the first order, you can no longer place a new order, but you can continue eating the dish already served.\n\nLet Takahashi's happiness be the sum of the deliciousness of the dishes he eats in this restaurant.\n\nWhat is the maximum possible happiness achieved by making optimal choices?\n\nConstraints\n\n2 \\leq N \\leq 3000\n\n1 \\leq T \\leq 3000\n\n1 \\leq A_i \\leq 3000\n\n1 \\leq B_i \\leq 3000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the maximum possible happiness Takahashi can achieve.\n\nSample Input 1\n\n2 60\n10 10\n100 100\n\nSample Output 1\n\n110\n\nBy ordering the first and second dishes in this order, Takahashi's happiness will be 110.\n\nNote that, if we manage to order a dish in time, we can spend any amount of time to eat it.\n\nSample Input 2\n\n3 60\n10 10\n10 20\n10 30\n\nSample Output 2\n\n60\n\nTakahashi can eat all the dishes within 60 minutes.\n\nSample Input 3\n\n3 60\n30 10\n30 20\n30 30\n\nSample Output 3\n\n50\n\nBy ordering the second and third dishes in this order, Takahashi's happiness will be 50.\n\nWe cannot order three dishes, in whatever order we place them.\n\nSample Input 4\n\n10 100\n15 23\n20 18\n13 17\n24 12\n18 29\n19 27\n23 21\n18 20\n27 15\n22 25\n\nSample Output 4\n\n145", "sample_input": "2 60\n10 10\n100 100\n"}, "reference_outputs": ["110\n"], "source_document_id": "p02863", "source_text": "Score : 500 points\n\nProblem Statement\n\nTakahashi is at an all-you-can-eat restaurant.\n\nThe restaurant offers N kinds of dishes. It takes A_i minutes to eat the i-th dish, whose deliciousness is B_i.\n\nThe restaurant has the following rules:\n\nYou can only order one dish at a time. The dish ordered will be immediately served and ready to eat.\n\nYou cannot order the same kind of dish more than once.\n\nUntil you finish eating the dish already served, you cannot order a new dish.\n\nAfter T-0.5 minutes from the first order, you can no longer place a new order, but you can continue eating the dish already served.\n\nLet Takahashi's happiness be the sum of the deliciousness of the dishes he eats in this restaurant.\n\nWhat is the maximum possible happiness achieved by making optimal choices?\n\nConstraints\n\n2 \\leq N \\leq 3000\n\n1 \\leq T \\leq 3000\n\n1 \\leq A_i \\leq 3000\n\n1 \\leq B_i \\leq 3000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the maximum possible happiness Takahashi can achieve.\n\nSample Input 1\n\n2 60\n10 10\n100 100\n\nSample Output 1\n\n110\n\nBy ordering the first and second dishes in this order, Takahashi's happiness will be 110.\n\nNote that, if we manage to order a dish in time, we can spend any amount of time to eat it.\n\nSample Input 2\n\n3 60\n10 10\n10 20\n10 30\n\nSample Output 2\n\n60\n\nTakahashi can eat all the dishes within 60 minutes.\n\nSample Input 3\n\n3 60\n30 10\n30 20\n30 30\n\nSample Output 3\n\n50\n\nBy ordering the second and third dishes in this order, Takahashi's happiness will be 50.\n\nWe cannot order three dishes, in whatever order we place them.\n\nSample Input 4\n\n10 100\n15 23\n20 18\n13 17\n24 12\n18 29\n19 27\n23 21\n18 20\n27 15\n22 25\n\nSample Output 4\n\n145", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 586, "cpu_time_ms": 2104, "memory_kb": 35456}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s063331486", "group_id": "codeNet:p02873", "input_text": "program AGC40\n character(500000)::S\n integer(8),allocatable::A(:)\n read(*,*)S\n N=len_trim(S)+1\n allocate(A(N))\n A=500000\n if(S(1:1)=='<') A(1)=0\n if(S(N-1:N-1)=='>') A(N)=0\n do i=1,N-1\n if(S(i:i)=='>' .and. S(i+1:i+1)=='<') A(i+1)=0\n end do\n do i=1,N-1\n if(S(i:i)=='<') A(i+1)=A(i)+1\n end do\n do i=N,2,-1\n if(S(i-1:i-1)=='>' .and. (A(i-1)==500000 .or. A(i-1)<=A(i))) A(i-1)=A(i)+1 \n end do\n write(*,*)sum(A)\nend program AGC40", "language": "Fortran", "metadata": {"date": 1590220959, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02873.html", "problem_id": "p02873", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02873/input.txt", "sample_output_relpath": "derived/input_output/data/p02873/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02873/Fortran/s063331486.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s063331486", "user_id": "u359178469"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program AGC40\n character(500000)::S\n integer(8),allocatable::A(:)\n read(*,*)S\n N=len_trim(S)+1\n allocate(A(N))\n A=500000\n if(S(1:1)=='<') A(1)=0\n if(S(N-1:N-1)=='>') A(N)=0\n do i=1,N-1\n if(S(i:i)=='>' .and. S(i+1:i+1)=='<') A(i+1)=0\n end do\n do i=1,N-1\n if(S(i:i)=='<') A(i+1)=A(i)+1\n end do\n do i=N,2,-1\n if(S(i-1:i-1)=='>' .and. (A(i-1)==500000 .or. A(i-1)<=A(i))) A(i-1)=A(i)+1 \n end do\n write(*,*)sum(A)\nend program AGC40", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S of length N-1.\nEach character in S is < or >.\n\nA sequence of N non-negative integers, a_1,a_2,\\cdots,a_N, is said to be good when the following condition is satisfied for all i (1 \\leq i \\leq N-1):\n\nIf S_i= <: a_i: a_i>a_{i+1}\n\nFind the minimum possible sum of the elements of a good sequence of N non-negative integers.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^5\n\nS is a string of length N-1 consisting of < and >.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nFind the minimum possible sum of the elements of a good sequence of N non-negative integers.\n\nSample Input 1\n\n<>>\n\nSample Output 1\n\n3\n\na=(0,2,1,0) is a good sequence whose sum is 3.\nThere is no good sequence whose sum is less than 3.\n\nSample Input 2\n\n<>>><<><<<<<>>><\n\nSample Output 2\n\n28", "sample_input": "<>>\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02873", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S of length N-1.\nEach character in S is < or >.\n\nA sequence of N non-negative integers, a_1,a_2,\\cdots,a_N, is said to be good when the following condition is satisfied for all i (1 \\leq i \\leq N-1):\n\nIf S_i= <: a_i: a_i>a_{i+1}\n\nFind the minimum possible sum of the elements of a good sequence of N non-negative integers.\n\nConstraints\n\n2 \\leq N \\leq 5 \\times 10^5\n\nS is a string of length N-1 consisting of < and >.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nFind the minimum possible sum of the elements of a good sequence of N non-negative integers.\n\nSample Input 1\n\n<>>\n\nSample Output 1\n\n3\n\na=(0,2,1,0) is a good sequence whose sum is 3.\nThere is no good sequence whose sum is less than 3.\n\nSample Input 2\n\n<>>><<><<<<<>>><\n\nSample Output 2\n\n28", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 459, "cpu_time_ms": 17, "memory_kb": 5216}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s288366155", "group_id": "codeNet:p02880", "input_text": "program abc144b\n implicit none\n integer :: N, i\n\n read(*,*) N\n\n do i = 1, 9\n if (mod(N,i) == 0) then\n if (N/i <= 9) then\n write(*,*) \"YES\"\n stop\n end if\n end if\n end do\n\n write(*,*) \"NO\"\n\nend program abc144b\n", "language": "Fortran", "metadata": {"date": 1572454243, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02880.html", "problem_id": "p02880", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02880/input.txt", "sample_output_relpath": "derived/input_output/data/p02880/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02880/Fortran/s288366155.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s288366155", "user_id": "u210113718"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program abc144b\n implicit none\n integer :: N, i\n\n read(*,*) N\n\n do i = 1, 9\n if (mod(N,i) == 0) then\n if (N/i <= 9) then\n write(*,*) \"YES\"\n stop\n end if\n end if\n end do\n\n write(*,*) \"NO\"\n\nend program abc144b\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "sample_input": "10\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02880", "source_text": "Score : 200 points\n\nProblem Statement\n\nHaving learned the multiplication table, Takahashi can multiply two integers between 1 and 9 (inclusive) together.\n\nGiven an integer N, determine whether N can be represented as the product of two integers between 1 and 9. If it can, print Yes; if it cannot, print No.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf N can be represented as the product of two integers between 1 and 9 (inclusive), print Yes; if it cannot, print No.\n\nSample Input 1\n\n10\n\nSample Output 1\n\nYes\n\n10 can be represented as, for example, 2 \\times 5.\n\nSample Input 2\n\n50\n\nSample Output 2\n\nNo\n\n50 cannot be represented as the product of two integers between 1 and 9.\n\nSample Input 3\n\n81\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 268, "cpu_time_ms": 3, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s297639035", "group_id": "codeNet:p02881", "input_text": "program A320B\n implicit none\n integer(8)::N,ans,i,Ns\n read*,N\n Ns=int(sqrt(real(N)))+1\n ans=N\n do i=1,Ns\n if(mod(N,i)==0)ans=min(ans,i+N/i-2)\n end do\n\n print'(i0)',ans\nend program A320B", "language": "Fortran", "metadata": {"date": 1584704342, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02881.html", "problem_id": "p02881", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02881/input.txt", "sample_output_relpath": "derived/input_output/data/p02881/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02881/Fortran/s297639035.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s297639035", "user_id": "u414699019"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program A320B\n implicit none\n integer(8)::N,ans,i,Ns\n read*,N\n Ns=int(sqrt(real(N)))+1\n ans=N\n do i=1,Ns\n if(mod(N,i)==0)ans=min(ans,i+N/i-2)\n end do\n\n print'(i0)',ans\nend program A320B", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "sample_input": "10\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02881", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is standing on a multiplication table with infinitely many rows and columns.\n\nThe square (i,j) contains the integer i \\times j. Initially, Takahashi is standing at (1,1).\n\nIn one move, he can move from (i,j) to either (i+1,j) or (i,j+1).\n\nGiven an integer N, find the minimum number of moves needed to reach a square that contains N.\n\nConstraints\n\n2 \\leq N \\leq 10^{12}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum number of moves needed to reach a square that contains the integer N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n5\n\n(2,5) can be reached in five moves. We cannot reach a square that contains 10 in less than five moves.\n\nSample Input 2\n\n50\n\nSample Output 2\n\n13\n\n(5, 10) can be reached in 13 moves.\n\nSample Input 3\n\n10000000019\n\nSample Output 3\n\n10000000018\n\nBoth input and output may be enormous.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 216, "cpu_time_ms": 11, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s052960876", "group_id": "codeNet:p02882", "input_text": " PROGRAM waterBottle\n IMPLICIT NONE\n REAL(8) :: a,b,x\n REAL(8) :: theta,V\n REAL(8) :: pi = 3.141592653589793238\n \n READ*,a,b,x\n \n V = a*a*b\n if( x>=V/2. )THEN\n ! theta = atan( a**3/(2.*x) )\n theta = atan( a**2/2./(a*b-x/a) )\n ELSE\n !theta = atan( 2./(b*b)*(a*b-x/a) )\n theta = atan( 2.*x/(b**2*a) )\n END IF\n \n print*, 90.-theta*180./pi\n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1572229736, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02882.html", "problem_id": "p02882", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02882/input.txt", "sample_output_relpath": "derived/input_output/data/p02882/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02882/Fortran/s052960876.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s052960876", "user_id": "u171356453"}, "prompt_components": {"gold_output": "45.0000000000\n", "input_to_evaluate": " PROGRAM waterBottle\n IMPLICIT NONE\n REAL(8) :: a,b,x\n REAL(8) :: theta,V\n REAL(8) :: pi = 3.141592653589793238\n \n READ*,a,b,x\n \n V = a*a*b\n if( x>=V/2. )THEN\n ! theta = atan( a**3/(2.*x) )\n theta = atan( a**2/2./(a*b-x/a) )\n ELSE\n !theta = atan( 2./(b*b)*(a*b-x/a) )\n theta = atan( 2.*x/(b**2*a) )\n END IF\n \n print*, 90.-theta*180./pi\n \n \n END PROGRAM", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a water bottle with the shape of a rectangular prism whose base is a square of side a~\\mathrm{cm} and whose height is b~\\mathrm{cm}. (The thickness of the bottle can be ignored.)\n\nWe will pour x~\\mathrm{cm}^3 of water into the bottle, and gradually tilt the bottle around one of the sides of the base.\n\nWhen will the water be spilled? More formally, find the maximum angle in which we can tilt the bottle without spilling any water.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq a \\leq 100\n\n1 \\leq b \\leq 100\n\n1 \\leq x \\leq a^2b\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the maximum angle in which we can tilt the bottle without spilling any water, in degrees.\nYour output will be judged as correct when the absolute or relative error from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n2 2 4\n\nSample Output 1\n\n45.0000000000\n\nThis bottle has a cubic shape, and it is half-full. The water gets spilled when we tilt the bottle more than 45 degrees.\n\nSample Input 2\n\n12 21 10\n\nSample Output 2\n\n89.7834636934\n\nThis bottle is almost empty. When the water gets spilled, the bottle is nearly horizontal.\n\nSample Input 3\n\n3 1 8\n\nSample Output 3\n\n4.2363947991\n\nThis bottle is almost full. When the water gets spilled, the bottle is still nearly vertical.", "sample_input": "2 2 4\n"}, "reference_outputs": ["45.0000000000\n"], "source_document_id": "p02882", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a water bottle with the shape of a rectangular prism whose base is a square of side a~\\mathrm{cm} and whose height is b~\\mathrm{cm}. (The thickness of the bottle can be ignored.)\n\nWe will pour x~\\mathrm{cm}^3 of water into the bottle, and gradually tilt the bottle around one of the sides of the base.\n\nWhen will the water be spilled? More formally, find the maximum angle in which we can tilt the bottle without spilling any water.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq a \\leq 100\n\n1 \\leq b \\leq 100\n\n1 \\leq x \\leq a^2b\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the maximum angle in which we can tilt the bottle without spilling any water, in degrees.\nYour output will be judged as correct when the absolute or relative error from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n2 2 4\n\nSample Output 1\n\n45.0000000000\n\nThis bottle has a cubic shape, and it is half-full. The water gets spilled when we tilt the bottle more than 45 degrees.\n\nSample Input 2\n\n12 21 10\n\nSample Output 2\n\n89.7834636934\n\nThis bottle is almost empty. When the water gets spilled, the bottle is nearly horizontal.\n\nSample Input 3\n\n3 1 8\n\nSample Output 3\n\n4.2363947991\n\nThis bottle is almost full. When the water gets spilled, the bottle is still nearly vertical.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 465, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s886779406", "group_id": "codeNet:p02883", "input_text": "program problemE\n implicit none\n\n integer, parameter :: double = selected_real_kind ( 9 )\n integer, parameter :: i8 = selected_int_kind ( 18 )\n real ( kind = double ), parameter :: pi = 3.141592653589790_double\n\n integer ( kind = i8 ) :: N, K, i, j, tmp, ans, min\n integer ( kind = i8 ), allocatable, dimension ( : ) :: A, F, AF\n\n read *, N, K\n\n allocate ( A ( 1:N ) )\n allocate ( F ( 1:N ) )\n allocate ( AF ( 1:N ) )\n \n read *, A ( : )\n read *, F ( : )\n \n do j = 1, N\n do i = 1, N - 1\n if ( A ( i ) > A ( i + 1 ) ) then\n tmp = A ( i )\n A ( i ) = A ( i + 1 )\n A ( i + 1 ) = tmp\n end if\n end do\n end do\n \n do j = 1, N\n do i = 1, N - 1\n if ( F ( i ) < F ( i + 1 ) ) then\n tmp = F ( i )\n F ( i ) = F ( i + 1 )\n F ( i + 1 ) = tmp\n end if\n end do\n end do\n \n do i = 1, K\n AF ( 1:N ) = A ( 1:N ) * F ( 1:N )\n if ( sum ( AF ( 1:N ) ) == 0 ) then\n exit\n end if\n A ( maxloc ( AF ( 1:N ) ) ) = A ( maxloc ( AF ( 1:N ) ) ) - 1\n end do\n AF ( 1:N ) = A ( 1:N ) * F ( 1:N )\n\n do i = 1, N\n write ( *, \" ( i3 ) \", advance = \"no\" ) A ( i )\n end do\n print *, \"\"\n\n do i = 1, N\n write ( *, \" ( i3 ) \", advance = \"no\" ) F ( i )\n end do\n print *, \"\"\n\n do i = 1, N\n write ( *, \" ( i3 ) \", advance = \"no\" ) AF ( i )\n end do\n print *, \"\"\n \n ans = maxval ( AF ( 1:N ) )\n print *, ans\n \nend program problemE\n", "language": "Fortran", "metadata": {"date": 1572476065, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02883.html", "problem_id": "p02883", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02883/input.txt", "sample_output_relpath": "derived/input_output/data/p02883/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02883/Fortran/s886779406.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s886779406", "user_id": "u731648631"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program problemE\n implicit none\n\n integer, parameter :: double = selected_real_kind ( 9 )\n integer, parameter :: i8 = selected_int_kind ( 18 )\n real ( kind = double ), parameter :: pi = 3.141592653589790_double\n\n integer ( kind = i8 ) :: N, K, i, j, tmp, ans, min\n integer ( kind = i8 ), allocatable, dimension ( : ) :: A, F, AF\n\n read *, N, K\n\n allocate ( A ( 1:N ) )\n allocate ( F ( 1:N ) )\n allocate ( AF ( 1:N ) )\n \n read *, A ( : )\n read *, F ( : )\n \n do j = 1, N\n do i = 1, N - 1\n if ( A ( i ) > A ( i + 1 ) ) then\n tmp = A ( i )\n A ( i ) = A ( i + 1 )\n A ( i + 1 ) = tmp\n end if\n end do\n end do\n \n do j = 1, N\n do i = 1, N - 1\n if ( F ( i ) < F ( i + 1 ) ) then\n tmp = F ( i )\n F ( i ) = F ( i + 1 )\n F ( i + 1 ) = tmp\n end if\n end do\n end do\n \n do i = 1, K\n AF ( 1:N ) = A ( 1:N ) * F ( 1:N )\n if ( sum ( AF ( 1:N ) ) == 0 ) then\n exit\n end if\n A ( maxloc ( AF ( 1:N ) ) ) = A ( maxloc ( AF ( 1:N ) ) ) - 1\n end do\n AF ( 1:N ) = A ( 1:N ) * F ( 1:N )\n\n do i = 1, N\n write ( *, \" ( i3 ) \", advance = \"no\" ) A ( i )\n end do\n print *, \"\"\n\n do i = 1, N\n write ( *, \" ( i3 ) \", advance = \"no\" ) F ( i )\n end do\n print *, \"\"\n\n do i = 1, N\n write ( *, \" ( i3 ) \", advance = \"no\" ) AF ( i )\n end do\n print *, \"\"\n \n ans = maxval ( AF ( 1:N ) )\n print *, ans\n \nend program problemE\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nTakahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The consumption coefficient of Member i is A_i.\n\nIn the contest, N foods numbered 1 through N will be presented, and the difficulty of Food i is F_i. The details of the contest are as follows:\n\nA team should assign one member to each food, and should not assign the same member to multiple foods.\n\nIt will take x \\times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.\n\nThe score of a team is the longest time it takes for an individual member to finish the food.\n\nBefore the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.\n\nWhat is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 10^{18}\n\n1 \\leq A_i \\leq 10^6\\ (1 \\leq i \\leq N)\n\n1 \\leq F_i \\leq 10^6\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\nF_1 F_2 ... F_N\n\nOutput\n\nPrint the minimum possible score of the team.\n\nSample Input 1\n\n3 5\n4 2 1\n2 3 1\n\nSample Output 1\n\n2\n\nThey can achieve the score of 2, as follows:\n\nMember 1 does 4 sets of training and eats Food 2 in (4-4) \\times 3 = 0 seconds.\n\nMember 2 does 1 set of training and eats Food 3 in (2-1) \\times 1 = 1 second.\n\nMember 3 does 0 sets of training and eats Food 1 in (1-0) \\times 2 = 2 seconds.\n\nThey cannot achieve a score of less than 2, so the answer is 2.\n\nSample Input 2\n\n3 8\n4 2 1\n2 3 1\n\nSample Output 2\n\n0\n\nThey can choose not to do exactly K sets of training.\n\nSample Input 3\n\n11 14\n3 1 4 1 5 9 2 6 5 3 5\n8 9 7 9 3 2 3 8 4 6 2\n\nSample Output 3\n\n12", "sample_input": "3 5\n4 2 1\n2 3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02883", "source_text": "Score: 500 points\n\nProblem Statement\n\nTakahashi will take part in an eating contest. Teams of N members will compete in this contest, and Takahashi's team consists of N players numbered 1 through N from youngest to oldest. The consumption coefficient of Member i is A_i.\n\nIn the contest, N foods numbered 1 through N will be presented, and the difficulty of Food i is F_i. The details of the contest are as follows:\n\nA team should assign one member to each food, and should not assign the same member to multiple foods.\n\nIt will take x \\times y seconds for a member to finish the food, where x is the consumption coefficient of the member and y is the difficulty of the dish.\n\nThe score of a team is the longest time it takes for an individual member to finish the food.\n\nBefore the contest, Takahashi's team decided to do some training. In one set of training, a member can reduce his/her consumption coefficient by 1, as long as it does not go below 0. However, for financial reasons, the N members can do at most K sets of training in total.\n\nWhat is the minimum possible score of the team, achieved by choosing the amounts of members' training and allocating the dishes optimally?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq K \\leq 10^{18}\n\n1 \\leq A_i \\leq 10^6\\ (1 \\leq i \\leq N)\n\n1 \\leq F_i \\leq 10^6\\ (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\nF_1 F_2 ... F_N\n\nOutput\n\nPrint the minimum possible score of the team.\n\nSample Input 1\n\n3 5\n4 2 1\n2 3 1\n\nSample Output 1\n\n2\n\nThey can achieve the score of 2, as follows:\n\nMember 1 does 4 sets of training and eats Food 2 in (4-4) \\times 3 = 0 seconds.\n\nMember 2 does 1 set of training and eats Food 3 in (2-1) \\times 1 = 1 second.\n\nMember 3 does 0 sets of training and eats Food 1 in (1-0) \\times 2 = 2 seconds.\n\nThey cannot achieve a score of less than 2, so the answer is 2.\n\nSample Input 2\n\n3 8\n4 2 1\n2 3 1\n\nSample Output 2\n\n0\n\nThey can choose not to do exactly K sets of training.\n\nSample Input 3\n\n11 14\n3 1 4 1 5 9 2 6 5 3 5\n8 9 7 9 3 2 3 8 4 6 2\n\nSample Output 3\n\n12", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1520, "cpu_time_ms": 2103, "memory_kb": 6016}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s860104469", "group_id": "codeNet:p02886", "input_text": "program abc143b\n implicit none\n\n integer :: N, i, count, j\n integer, allocatable :: d(:)\n\n read(*,*) N\n allocate(d(N))\n read(*,*) d(:)\n\n count = 0\n\n do i = 1, N-1\n do j = i+1, N\n count = count + d(i)*d(j)\n end do\n enddo\n write(*,*) count\n\nend program abc143b\n", "language": "Fortran", "metadata": {"date": 1571689959, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02886.html", "problem_id": "p02886", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02886/input.txt", "sample_output_relpath": "derived/input_output/data/p02886/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02886/Fortran/s860104469.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s860104469", "user_id": "u210113718"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "program abc143b\n implicit none\n\n integer :: N, i, count, j\n integer, allocatable :: d(:)\n\n read(*,*) N\n allocate(d(N))\n read(*,*) d(:)\n\n count = 0\n\n do i = 1, N-1\n do j = i+1, N\n count = count + d(i)*d(j)\n end do\n enddo\n write(*,*) count\n\nend program abc143b\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIt's now the season of TAKOYAKI FESTIVAL!\n\nThis year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The deliciousness of the i-th takoyaki is d_i.\n\nAs is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \\times y health points.\n\nThere are \\frac{N \\times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \\frac{N \\times (N - 1)}{2} values.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 50\n\n0 \\leq d_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the sum of the health points restored from eating two takoyaki over all possible choices of two takoyaki from the N takoyaki served.\n\nSample Input 1\n\n3\n3 1 2\n\nSample Output 1\n\n11\n\nThere are three possible choices:\n\nEat the first and second takoyaki. You will restore 3 health points.\n\nEat the second and third takoyaki. You will restore 2 health points.\n\nEat the first and third takoyaki. You will restore 6 health points.\n\nThe sum of these values is 11.\n\nSample Input 2\n\n7\n5 0 7 8 3 3 2\n\nSample Output 2\n\n312", "sample_input": "3\n3 1 2\n"}, "reference_outputs": ["11\n"], "source_document_id": "p02886", "source_text": "Score : 200 points\n\nProblem Statement\n\nIt's now the season of TAKOYAKI FESTIVAL!\n\nThis year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The deliciousness of the i-th takoyaki is d_i.\n\nAs is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \\times y health points.\n\nThere are \\frac{N \\times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \\frac{N \\times (N - 1)}{2} values.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 50\n\n0 \\leq d_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the sum of the health points restored from eating two takoyaki over all possible choices of two takoyaki from the N takoyaki served.\n\nSample Input 1\n\n3\n3 1 2\n\nSample Output 1\n\n11\n\nThere are three possible choices:\n\nEat the first and second takoyaki. You will restore 3 health points.\n\nEat the second and third takoyaki. You will restore 2 health points.\n\nEat the first and third takoyaki. You will restore 6 health points.\n\nThe sum of these values is 11.\n\nSample Input 2\n\n7\n5 0 7 8 3 3 2\n\nSample Output 2\n\n312", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 297, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s363164313", "group_id": "codeNet:p02894", "input_text": "program incenters\n implicit none\n real(8), parameter :: pi = 3.14159265358979d0\n integer :: n, l, t, i, j, k, m = 0\n real(8) :: v(3000,2) = 0.d0, c(2) = 0.d0, s(0:3000,2) = 0.d0, tmp(2)\n real(8) :: di, dj, dk\n character(48) :: sx, sy\n read(*,*) n, l\n do i = 1, n\n read(*,*) t\n v(i,1) = cos(2.d0*pi*real(t,8)/real(l,8))\n v(i,2) = sin(2.d0*pi*real(t,8)/real(l,8))\n s(i,:) = s(i-1,:)+v(i,:)\n end do\n do i = 1, n-2\n do j = i+1, n-1\n if (m > 1000000) then\n tmp = s(n,:)-s(j,:)\n di = d(v(j,:),tmp/real(n-j,8))\n dj = d(tmp/real(n-j,8),v(i,:))\n dk = d(v(i,:),v(j,:))\n c = c+(real(n-j,8)*(di*v(i,:)+dj*v(j,:))+dk*tmp)/(di+dj+dk)\n else\n do k = j+1, n\n m = m+1\n di = d(v(j,:),v(k,:))\n dj = d(v(k,:),v(i,:))\n dk = d(v(i,:),v(j,:))\n c = c+(di*v(i,:)+dj*v(j,:)+dk*v(k,:))/(di+dj+dk)\n end do\n end if\n end do\n end do\n c = 6.d0*c/(real(n,8)*real(n-1,8)*real(n-2,8))\n write(sx,'(f32.16)') c(1)\n write(sy,'(f32.16)') c(2)\n write(*,'(a,x,a)') trim(adjustl(sx)), trim(adjustl(sy))\ncontains\n real(8) function d(v1,v2)\n real(8), intent(in) :: v1(2), v2(2)\n d = sqrt(dot_product(v1-v2,v1-v2))\n end\nend program incenters", "language": "Fortran", "metadata": {"date": 1570333272, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02894.html", "problem_id": "p02894", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02894/input.txt", "sample_output_relpath": "derived/input_output/data/p02894/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02894/Fortran/s363164313.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s363164313", "user_id": "u506403362"}, "prompt_components": {"gold_output": "0.414213562373095 -0.000000000000000\n", "input_to_evaluate": "program incenters\n implicit none\n real(8), parameter :: pi = 3.14159265358979d0\n integer :: n, l, t, i, j, k, m = 0\n real(8) :: v(3000,2) = 0.d0, c(2) = 0.d0, s(0:3000,2) = 0.d0, tmp(2)\n real(8) :: di, dj, dk\n character(48) :: sx, sy\n read(*,*) n, l\n do i = 1, n\n read(*,*) t\n v(i,1) = cos(2.d0*pi*real(t,8)/real(l,8))\n v(i,2) = sin(2.d0*pi*real(t,8)/real(l,8))\n s(i,:) = s(i-1,:)+v(i,:)\n end do\n do i = 1, n-2\n do j = i+1, n-1\n if (m > 1000000) then\n tmp = s(n,:)-s(j,:)\n di = d(v(j,:),tmp/real(n-j,8))\n dj = d(tmp/real(n-j,8),v(i,:))\n dk = d(v(i,:),v(j,:))\n c = c+(real(n-j,8)*(di*v(i,:)+dj*v(j,:))+dk*tmp)/(di+dj+dk)\n else\n do k = j+1, n\n m = m+1\n di = d(v(j,:),v(k,:))\n dj = d(v(k,:),v(i,:))\n dk = d(v(i,:),v(j,:))\n c = c+(di*v(i,:)+dj*v(j,:)+dk*v(k,:))/(di+dj+dk)\n end do\n end if\n end do\n end do\n c = 6.d0*c/(real(n,8)*real(n-1,8)*real(n-2,8))\n write(sx,'(f32.16)') c(1)\n write(sy,'(f32.16)') c(2)\n write(*,'(a,x,a)') trim(adjustl(sx)), trim(adjustl(sy))\ncontains\n real(8) function d(v1,v2)\n real(8), intent(in) :: v1(2), v2(2)\n d = sqrt(dot_product(v1-v2,v1-v2))\n end\nend program incenters", "problem_context": "Score : 1000 points\n\nProblem Statement\n\nGiven are N points on the circumference of a circle centered at (0,0) in an xy-plane.\nThe coordinates of the i-th point are (\\cos(\\frac{2\\pi T_i}{L}),\\sin(\\frac{2\\pi T_i}{L})).\n\nThree distinct points will be chosen uniformly at random from these N points.\nFind the expected x- and y-coordinates of the center of the circle inscribed in the triangle formed by the chosen points.\n\nConstraints\n\n3 \\leq N \\leq 3000\n\nN \\leq L \\leq 10^9\n\n0 \\leq T_i \\leq L-1\n\nT_i=K )THEN\n ans = ans + 1\n END IF\n END DO\n \n \n print'(I0)',ans\n \n \n \n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1569720159, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02898.html", "problem_id": "p02898", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02898/input.txt", "sample_output_relpath": "derived/input_output/data/p02898/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02898/Fortran/s035401631.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s035401631", "user_id": "u171356453"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " PROGRAM rollerCoaster\n IMPLICIT NONE\n INTEGER :: N, K\n INTEGER,ALLOCATABLE :: h(:)\n INTEGER :: ans\n \n INTEGER :: i\n \n READ*,N ,K\n ALLOCATE( h(N) )\n READ*,h(:)\n \n ans = 0\n \n DO i = 1,N\n IF( h(i)>=K )THEN\n ans = ans + 1\n END IF\n END DO\n \n \n print'(I0)',ans\n \n \n \n \n \n \n END PROGRAM", "problem_context": "Score : 200 points\n\nProblem Statement\n\nN friends of Takahashi has come to a theme park.\n\nTo ride the most popular roller coaster in the park, you must be at least K centimeters tall.\n\nThe i-th friend is h_i centimeters tall.\n\nHow many of the Takahashi's friends can ride the roller coaster?\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le K \\le 500\n\n1 \\le h_i \\le 500\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the number of people among the Takahashi's friends who can ride the roller coaster.\n\nSample Input 1\n\n4 150\n150 140 100 200\n\nSample Output 1\n\n2\n\nTwo of them can ride the roller coaster: the first and fourth friends.\n\nSample Input 2\n\n1 500\n499\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 1\n100 200 300 400 500\n\nSample Output 3\n\n5", "sample_input": "4 150\n150 140 100 200\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02898", "source_text": "Score : 200 points\n\nProblem Statement\n\nN friends of Takahashi has come to a theme park.\n\nTo ride the most popular roller coaster in the park, you must be at least K centimeters tall.\n\nThe i-th friend is h_i centimeters tall.\n\nHow many of the Takahashi's friends can ride the roller coaster?\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le K \\le 500\n\n1 \\le h_i \\le 500\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1 h_2 \\ldots h_N\n\nOutput\n\nPrint the number of people among the Takahashi's friends who can ride the roller coaster.\n\nSample Input 1\n\n4 150\n150 140 100 200\n\nSample Output 1\n\n2\n\nTwo of them can ride the roller coaster: the first and fourth friends.\n\nSample Input 2\n\n1 500\n499\n\nSample Output 2\n\n0\n\nSample Input 3\n\n5 1\n100 200 300 400 500\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 433, "cpu_time_ms": 21, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s582548444", "group_id": "codeNet:p02899", "input_text": "program main\n implicit none\n \n integer :: n, a(100000), i, b(100000), j\n \n read(*,*)n\n read(*,*)(a(i),i = 1, n)\n \n do i = 1, n\n do j = 1, n\n if (a(j) == i) then\n b(i) = j\n exit\n end if\n end do\n end do\n write(*,*)(b(i),i = 1, n)\nend program main", "language": "Fortran", "metadata": {"date": 1570317507, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02899.html", "problem_id": "p02899", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02899/input.txt", "sample_output_relpath": "derived/input_output/data/p02899/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02899/Fortran/s582548444.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s582548444", "user_id": "u287431190"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "program main\n implicit none\n \n integer :: n, a(100000), i, b(100000), j\n \n read(*,*)n\n read(*,*)(a(i),i = 1, n)\n \n do i = 1, n\n do j = 1, n\n if (a(j) == i) then\n b(i) = j\n exit\n end if\n end do\n end do\n write(*,*)(b(i),i = 1, n)\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "sample_input": "3\n2 3 1\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02899", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 284, "cpu_time_ms": 2103, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s564733027", "group_id": "codeNet:p02899", "input_text": "program main\n implicit none\n integer N,i\n integer,allocatable::A(:),B(:)\n \n read(*,*) N\n allocate(A(N),B(N))\n \n read(*,*) A\n do i=1,N\n B(A(i)) = i\n end do\n \n write(*,*) B\nend program main", "language": "Fortran", "metadata": {"date": 1569722047, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02899.html", "problem_id": "p02899", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02899/input.txt", "sample_output_relpath": "derived/input_output/data/p02899/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02899/Fortran/s564733027.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s564733027", "user_id": "u671401989"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "program main\n implicit none\n integer N,i\n integer,allocatable::A(:),B(:)\n \n read(*,*) N\n allocate(A(N),B(N))\n \n read(*,*) A\n do i=1,N\n B(A(i)) = i\n end do\n \n write(*,*) B\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "sample_input": "3\n2 3 1\n"}, "reference_outputs": ["3 1 2\n"], "source_document_id": "p02899", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is a teacher responsible for a class of N students.\n\nThe students are given distinct student numbers from 1 to N.\n\nToday, all the students entered the classroom at different times.\n\nAccording to Takahashi's record, there were A_i students in the classroom when student number i entered the classroom (including student number i).\n\nFrom these records, reconstruct the order in which the students entered the classroom.\n\nConstraints\n\n1 \\le N \\le 10^5\n\n1 \\le A_i \\le N\n\nA_i \\neq A_j (i \\neq j)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint the student numbers of the students in the order the students entered the classroom.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n3 1 2\n\nFirst, student number 3 entered the classroom.\n\nThen, student number 1 entered the classroom.\n\nFinally, student number 2 entered the classroom.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 2 3 4 5\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n8 2 4 5 6 7 3 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 188, "cpu_time_ms": 41, "memory_kb": 3328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s100007751", "group_id": "codeNet:p02900", "input_text": "program abc142\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: a,b,g,div,divmax,cnt,ans\n\n read*, a,b\n g = gcd(a,b)\n divmax = ceiling(sqrt(dble(g)))\n ans=1\n do div=2,divmax\n cnt=1\n if (mod(g,div) == 0) ans=ans+1\n do while(mod(g,div)==0)\n g=g/div\n cnt=cnt+1\n end do\n end do\n if (g>1)ans=ans+1\n print'(i0)', ans\ncontains\n function lcm(x,y) result(ret)\n integer(int64):: x,y,ret\n ret=x*y/gcd(x,y)\n end function\n recursive function gcd(x,y) result(ret)\n integer(int64):: x,y,ret\n \n if (mod(x,y) == 0) then\n ret = y\n return\n end if\n \n ret = gcd(y,mod(x,y))\n end function\nend program abc142", "language": "Fortran", "metadata": {"date": 1589748426, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02900.html", "problem_id": "p02900", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02900/input.txt", "sample_output_relpath": "derived/input_output/data/p02900/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02900/Fortran/s100007751.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s100007751", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program abc142\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: a,b,g,div,divmax,cnt,ans\n\n read*, a,b\n g = gcd(a,b)\n divmax = ceiling(sqrt(dble(g)))\n ans=1\n do div=2,divmax\n cnt=1\n if (mod(g,div) == 0) ans=ans+1\n do while(mod(g,div)==0)\n g=g/div\n cnt=cnt+1\n end do\n end do\n if (g>1)ans=ans+1\n print'(i0)', ans\ncontains\n function lcm(x,y) result(ret)\n integer(int64):: x,y,ret\n ret=x*y/gcd(x,y)\n end function\n recursive function gcd(x,y) result(ret)\n integer(int64):: x,y,ret\n \n if (mod(x,y) == 0) then\n ret = y\n return\n end if\n \n ret = gcd(y,mod(x,y))\n end function\nend program abc142", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are positive integers A and B.\n\nLet us choose some number of positive common divisors of A and B.\n\nHere, any two of the chosen divisors must be coprime.\n\nAt most, how many divisors can we choose?\n\nDefinition of common divisor\n\nAn integer d is said to be a common divisor of integers x and y when d divides both x and y.\n\nDefinition of being coprime\n\nIntegers x and y are said to be coprime when x and y have no positive common divisors other than 1.\n\nDefinition of dividing\n\nAn integer x is said to divide another integer y when there exists an integer \\alpha such that y = \\alpha x.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of divisors that can be chosen to satisfy the condition.\n\nSample Input 1\n\n12 18\n\nSample Output 1\n\n3\n\n12 and 18 have the following positive common divisors: 1, 2, 3, and 6.\n\n1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.\n\nSample Input 2\n\n420 660\n\nSample Output 2\n\n4\n\nSample Input 3\n\n1 2019\n\nSample Output 3\n\n1\n\n1 and 2019 have no positive common divisors other than 1.", "sample_input": "12 18\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02900", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are positive integers A and B.\n\nLet us choose some number of positive common divisors of A and B.\n\nHere, any two of the chosen divisors must be coprime.\n\nAt most, how many divisors can we choose?\n\nDefinition of common divisor\n\nAn integer d is said to be a common divisor of integers x and y when d divides both x and y.\n\nDefinition of being coprime\n\nIntegers x and y are said to be coprime when x and y have no positive common divisors other than 1.\n\nDefinition of dividing\n\nAn integer x is said to divide another integer y when there exists an integer \\alpha such that y = \\alpha x.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of divisors that can be chosen to satisfy the condition.\n\nSample Input 1\n\n12 18\n\nSample Output 1\n\n3\n\n12 and 18 have the following positive common divisors: 1, 2, 3, and 6.\n\n1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.\n\nSample Input 2\n\n420 660\n\nSample Output 2\n\n4\n\nSample Input 3\n\n1 2019\n\nSample Output 3\n\n1\n\n1 and 2019 have no positive common divisors other than 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 767, "cpu_time_ms": 11, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s101970665", "group_id": "codeNet:p02900", "input_text": "program main\n implicit none\n integer(8) i,A,B,ans,d\n integer div(5699)\n read(*, *)A,B\n !read(*, *) (L(i), i = 1,N)\n div = (/2,&\n3,&\n5,&\n7,&\n11,&\n13,&\n17,&\n19,&\n23,&\n29,&\n31,&\n37,&\n41,&\n43,&\n47,&\n53,&\n59,&\n61,&\n67,&\n71,&\n73,&\n79,&\n83,&\n89,&\n97,&\n101,&\n103,&\n107,&\n109,&\n113,&\n127,&\n131,&\n137,&\n139,&\n149,&\n151,&\n157,&\n163,&\n167,&\n173,&\n179,&\n181,&\n191,&\n193,&\n197,&\n199,&\n211,&\n223,&\n227,&\n229,&\n233,&\n239,&\n241,&\n251,&\n257,&\n263,&\n269,&\n271,&\n277,&\n281,&\n283,&\n293,&\n307,&\n311,&\n313,&\n317,&\n331,&\n337,&\n347,&\n349,&\n353,&\n359,&\n367,&\n373,&\n379,&\n383,&\n389,&\n397,&\n401,&\n409,&\n419,&\n421,&\n431,&\n433,&\n439,&\n443,&\n449,&\n457,&\n461,&\n463,&\n467,&\n479,&\n487,&\n491,&\n499,&\n503,&\n509,&\n521,&\n523,&\n541,&\n547,&\n557,&\n563,&\n569,&\n571,&\n577,&\n587,&\n593,&\n599,&\n601,&\n607,&\n613,&\n617,&\n619,&\n631,&\n641,&\n643,&\n647,&\n653,&\n659,&\n661,&\n673,&\n677,&\n683,&\n691,&\n701,&\n709,&\n719,&\n727,&\n733,&\n739,&\n743,&\n751,&\n757,&\n761,&\n769,&\n773,&\n787,&\n797,&\n809,&\n811,&\n821,&\n823,&\n827,&\n829,&\n839,&\n853,&\n857,&\n859,&\n863,&\n877,&\n881,&\n883,&\n887,&\n907,&\n911,&\n919,&\n929,&\n937,&\n941,&\n947,&\n953,&\n967,&\n971,&\n977,&\n983,&\n991,&\n997,&\n1009,&\n1013,&\n1019,&\n1021,&\n1031,&\n1033,&\n1039,&\n1049,&\n1051,&\n1061,&\n1063,&\n1069,&\n1087,&\n1091,&\n1093,&\n1097,&\n1103,&\n1109,&\n1117,&\n1123,&\n1129,&\n1151,&\n1153,&\n1163,&\n1171,&\n1181,&\n1187,&\n1193,&\n1201,&\n1213,&\n1217,&\n1223,&\n1229,&\n1231,&\n1237,&\n1249,&\n1259,&\n1277,&\n1279,&\n1283,&\n1289,&\n1291,&\n1297,&\n1301,&\n1303,&\n1307,&\n1319,&\n1321,&\n1327,&\n1361,&\n1367,&\n1373,&\n1381,&\n1399,&\n1409,&\n1423,&\n1427,&\n1429,&\n1433,&\n1439,&\n1447,&\n1451,&\n1453,&\n1459,&\n1471,&\n1481,&\n1483,&\n1487,&\n1489,&\n1493,&\n1499,&\n1511,&\n1523,&\n1531,&\n1543,&\n1549,&\n1553,&\n1559,&\n1567,&\n1571,&\n1579,&\n1583,&\n1597,&\n1601,&\n1607,&\n1609,&\n1613,&\n1619,&\n1621,&\n1627,&\n1637,&\n1657,&\n1663,&\n1667,&\n1669,&\n1693,&\n1697,&\n1699,&\n1709,&\n1721,&\n1723,&\n1733,&\n1741,&\n1747,&\n1753,&\n1759,&\n1777,&\n1783,&\n1787,&\n1789,&\n1801,&\n1811,&\n1823,&\n1831,&\n1847,&\n1861,&\n1867,&\n1871,&\n1873,&\n1877,&\n1879,&\n1889,&\n1901,&\n1907,&\n1913,&\n1931,&\n1933,&\n1949,&\n1951,&\n1973,&\n1979,&\n1987,&\n1993,&\n1997,&\n1999,&\n2003,&\n2011,&\n2017,&\n2027,&\n2029,&\n2039,&\n2053,&\n2063,&\n2069,&\n2081,&\n2083,&\n2087,&\n2089,&\n2099,&\n2111,&\n2113,&\n2129,&\n2131,&\n2137,&\n2141,&\n2143,&\n2153,&\n2161,&\n2179,&\n2203,&\n2207,&\n2213,&\n2221,&\n2237,&\n2239,&\n2243,&\n2251,&\n2267,&\n2269,&\n2273,&\n2281,&\n2287,&\n2293,&\n2297,&\n2309,&\n2311,&\n2333,&\n2339,&\n2341,&\n2347,&\n2351,&\n2357,&\n2371,&\n2377,&\n2381,&\n2383,&\n2389,&\n2393,&\n2399,&\n2411,&\n2417,&\n2423,&\n2437,&\n2441,&\n2447,&\n2459,&\n2467,&\n2473,&\n2477,&\n2503,&\n2521,&\n2531,&\n2539,&\n2543,&\n2549,&\n2551,&\n2557,&\n2579,&\n2591,&\n2593,&\n2609,&\n2617,&\n2621,&\n2633,&\n2647,&\n2657,&\n2659,&\n2663,&\n2671,&\n2677,&\n2683,&\n2687,&\n2689,&\n2693,&\n2699,&\n2707,&\n2711,&\n2713,&\n2719,&\n2729,&\n2731,&\n2741,&\n2749,&\n2753,&\n2767,&\n2777,&\n2789,&\n2791,&\n2797,&\n2801,&\n2803,&\n2819,&\n2833,&\n2837,&\n2843,&\n2851,&\n2857,&\n2861,&\n2879,&\n2887,&\n2897,&\n2903,&\n2909,&\n2917,&\n2927,&\n2939,&\n2953,&\n2957,&\n2963,&\n2969,&\n2971,&\n2999,&\n3001,&\n3011,&\n3019,&\n3023,&\n3037,&\n3041,&\n3049,&\n3061,&\n3067,&\n3079,&\n3083,&\n3089,&\n3109,&\n3119,&\n3121,&\n3137,&\n3163,&\n3167,&\n3169,&\n3181,&\n3187,&\n3191,&\n3203,&\n3209,&\n3217,&\n3221,&\n3229,&\n3251,&\n3253,&\n3257,&\n3259,&\n3271,&\n3299,&\n3301,&\n3307,&\n3313,&\n3319,&\n3323,&\n3329,&\n3331,&\n3343,&\n3347,&\n3359,&\n3361,&\n3371,&\n3373,&\n3389,&\n3391,&\n3407,&\n3413,&\n3433,&\n3449,&\n3457,&\n3461,&\n3463,&\n3467,&\n3469,&\n3491,&\n3499,&\n3511,&\n3517,&\n3527,&\n3529,&\n3533,&\n3539,&\n3541,&\n3547,&\n3557,&\n3559,&\n3571,&\n3581,&\n3583,&\n3593,&\n3607,&\n3613,&\n3617,&\n3623,&\n3631,&\n3637,&\n3643,&\n3659,&\n3671,&\n3673,&\n3677,&\n3691,&\n3697,&\n3701,&\n3709,&\n3719,&\n3727,&\n3733,&\n3739,&\n3761,&\n3767,&\n3769,&\n3779,&\n3793,&\n3797,&\n3803,&\n3821,&\n3823,&\n3833,&\n3847,&\n3851,&\n3853,&\n3863,&\n3877,&\n3881,&\n3889,&\n3907,&\n3911,&\n3917,&\n3919,&\n3923,&\n3929,&\n3931,&\n3943,&\n3947,&\n3967,&\n3989,&\n4001,&\n4003,&\n4007,&\n4013,&\n4019,&\n4021,&\n4027,&\n4049,&\n4051,&\n4057,&\n4073,&\n4079,&\n4091,&\n4093,&\n4099,&\n4111,&\n4127,&\n4129,&\n4133,&\n4139,&\n4153,&\n4157,&\n4159,&\n4177,&\n4201,&\n4211,&\n4217,&\n4219,&\n4229,&\n4231,&\n4241,&\n4243,&\n4253,&\n4259,&\n4261,&\n4271,&\n4273,&\n4283,&\n4289,&\n4297,&\n4327,&\n4337,&\n4339,&\n4349,&\n4357,&\n4363,&\n4373,&\n4391,&\n4397,&\n4409,&\n4421,&\n4423,&\n4441,&\n4447,&\n4451,&\n4457,&\n4463,&\n4481,&\n4483,&\n4493,&\n4507,&\n4513,&\n4517,&\n4519,&\n4523,&\n4547,&\n4549,&\n4561,&\n4567,&\n4583,&\n4591,&\n4597,&\n4603,&\n4621,&\n4637,&\n4639,&\n4643,&\n4649,&\n4651,&\n4657,&\n4663,&\n4673,&\n4679,&\n4691,&\n4703,&\n4721,&\n4723,&\n4729,&\n4733,&\n4751,&\n4759,&\n4783,&\n4787,&\n4789,&\n4793,&\n4799,&\n4801,&\n4813,&\n4817,&\n4831,&\n4861,&\n4871,&\n4877,&\n4889,&\n4903,&\n4909,&\n4919,&\n4931,&\n4933,&\n4937,&\n4943,&\n4951,&\n4957,&\n4967,&\n4969,&\n4973,&\n4987,&\n4993,&\n4999,&\n5003,&\n5009,&\n5011,&\n5021,&\n5023,&\n5039,&\n5051,&\n5059,&\n5077,&\n5081,&\n5087,&\n5099,&\n5101,&\n5107,&\n5113,&\n5119,&\n5147,&\n5153,&\n5167,&\n5171,&\n5179,&\n5189,&\n5197,&\n5209,&\n5227,&\n5231,&\n5233,&\n5237,&\n5261,&\n5273,&\n5279,&\n5281,&\n5297,&\n5303,&\n5309,&\n5323,&\n5333,&\n5347,&\n5351,&\n5381,&\n5387,&\n5393,&\n5399,&\n5407,&\n5413,&\n5417,&\n5419,&\n5431,&\n5437,&\n5441,&\n5443,&\n5449,&\n5471,&\n5477,&\n5479,&\n5483,&\n5501,&\n5503,&\n5507,&\n5519,&\n5521,&\n5527,&\n5531,&\n5557,&\n5563,&\n5569,&\n5573,&\n5581,&\n5591,&\n5623,&\n5639,&\n5641,&\n5647,&\n5651,&\n5653,&\n5657,&\n5659,&\n5669,&\n5683,&\n5689,&\n5693,&\n5701,&\n5711,&\n5717,&\n5737,&\n5741,&\n5743,&\n5749,&\n5779,&\n5783,&\n5791,&\n5801,&\n5807,&\n5813,&\n5821,&\n5827,&\n5839,&\n5843,&\n5849,&\n5851,&\n5857,&\n5861,&\n5867,&\n5869,&\n5879,&\n5881,&\n5897,&\n5903,&\n5923,&\n5927,&\n5939,&\n5953,&\n5981,&\n5987,&\n6007,&\n6011,&\n6029,&\n6037,&\n6043,&\n6047,&\n6053,&\n6067,&\n6073,&\n6079,&\n6089,&\n6091,&\n6101,&\n6113,&\n6121,&\n6131,&\n6133,&\n6143,&\n6151,&\n6163,&\n6173,&\n6197,&\n6199,&\n6203,&\n6211,&\n6217,&\n6221,&\n6229,&\n6247,&\n6257,&\n6263,&\n6269,&\n6271,&\n6277,&\n6287,&\n6299,&\n6301,&\n6311,&\n6317,&\n6323,&\n6329,&\n6337,&\n6343,&\n6353,&\n6359,&\n6361,&\n6367,&\n6373,&\n6379,&\n6389,&\n6397,&\n6421,&\n6427,&\n6449,&\n6451,&\n6469,&\n6473,&\n6481,&\n6491,&\n6521,&\n6529,&\n6547,&\n6551,&\n6553,&\n6563,&\n6569,&\n6571,&\n6577,&\n6581,&\n6599,&\n6607,&\n6619,&\n6637,&\n6653,&\n6659,&\n6661,&\n6673,&\n6679,&\n6689,&\n6691,&\n6701,&\n6703,&\n6709,&\n6719,&\n6733,&\n6737,&\n6761,&\n6763,&\n6779,&\n6781,&\n6791,&\n6793,&\n6803,&\n6823,&\n6827,&\n6829,&\n6833,&\n6841,&\n6857,&\n6863,&\n6869,&\n6871,&\n6883,&\n6899,&\n6907,&\n6911,&\n6917,&\n6947,&\n6949,&\n6959,&\n6961,&\n6967,&\n6971,&\n6977,&\n6983,&\n6991,&\n6997,&\n7001,&\n7013,&\n7019,&\n7027,&\n7039,&\n7043,&\n7057,&\n7069,&\n7079,&\n7103,&\n7109,&\n7121,&\n7127,&\n7129,&\n7151,&\n7159,&\n7177,&\n7187,&\n7193,&\n7207,&\n7211,&\n7213,&\n7219,&\n7229,&\n7237,&\n7243,&\n7247,&\n7253,&\n7283,&\n7297,&\n7307,&\n7309,&\n7321,&\n7331,&\n7333,&\n7349,&\n7351,&\n7369,&\n7393,&\n7411,&\n7417,&\n7433,&\n7451,&\n7457,&\n7459,&\n7477,&\n7481,&\n7487,&\n7489,&\n7499,&\n7507,&\n7517,&\n7523,&\n7529,&\n7537,&\n7541,&\n7547,&\n7549,&\n7559,&\n7561,&\n7573,&\n7577,&\n7583,&\n7589,&\n7591,&\n7603,&\n7607,&\n7621,&\n7639,&\n7643,&\n7649,&\n7669,&\n7673,&\n7681,&\n7687,&\n7691,&\n7699,&\n7703,&\n7717,&\n7723,&\n7727,&\n7741,&\n7753,&\n7757,&\n7759,&\n7789,&\n7793,&\n7817,&\n7823,&\n7829,&\n7841,&\n7853,&\n7867,&\n7873,&\n7877,&\n7879,&\n7883,&\n7901,&\n7907,&\n7919,&\n7927,&\n7933,&\n7937,&\n7949,&\n7951,&\n7963,&\n7993,&\n8009,&\n8011,&\n8017,&\n8039,&\n8053,&\n8059,&\n8069,&\n8081,&\n8087,&\n8089,&\n8093,&\n8101,&\n8111,&\n8117,&\n8123,&\n8147,&\n8161,&\n8167,&\n8171,&\n8179,&\n8191,&\n8209,&\n8219,&\n8221,&\n8231,&\n8233,&\n8237,&\n8243,&\n8263,&\n8269,&\n8273,&\n8287,&\n8291,&\n8293,&\n8297,&\n8311,&\n8317,&\n8329,&\n8353,&\n8363,&\n8369,&\n8377,&\n8387,&\n8389,&\n8419,&\n8423,&\n8429,&\n8431,&\n8443,&\n8447,&\n8461,&\n8467,&\n8501,&\n8513,&\n8521,&\n8527,&\n8537,&\n8539,&\n8543,&\n8563,&\n8573,&\n8581,&\n8597,&\n8599,&\n8609,&\n8623,&\n8627,&\n8629,&\n8641,&\n8647,&\n8663,&\n8669,&\n8677,&\n8681,&\n8689,&\n8693,&\n8699,&\n8707,&\n8713,&\n8719,&\n8731,&\n8737,&\n8741,&\n8747,&\n8753,&\n8761,&\n8779,&\n8783,&\n8803,&\n8807,&\n8819,&\n8821,&\n8831,&\n8837,&\n8839,&\n8849,&\n8861,&\n8863,&\n8867,&\n8887,&\n8893,&\n8923,&\n8929,&\n8933,&\n8941,&\n8951,&\n8963,&\n8969,&\n8971,&\n8999,&\n9001,&\n9007,&\n9011,&\n9013,&\n9029,&\n9041,&\n9043,&\n9049,&\n9059,&\n9067,&\n9091,&\n9103,&\n9109,&\n9127,&\n9133,&\n9137,&\n9151,&\n9157,&\n9161,&\n9173,&\n9181,&\n9187,&\n9199,&\n9203,&\n9209,&\n9221,&\n9227,&\n9239,&\n9241,&\n9257,&\n9277,&\n9281,&\n9283,&\n9293,&\n9311,&\n9319,&\n9323,&\n9337,&\n9341,&\n9343,&\n9349,&\n9371,&\n9377,&\n9391,&\n9397,&\n9403,&\n9413,&\n9419,&\n9421,&\n9431,&\n9433,&\n9437,&\n9439,&\n9461,&\n9463,&\n9467,&\n9473,&\n9479,&\n9491,&\n9497,&\n9511,&\n9521,&\n9533,&\n9539,&\n9547,&\n9551,&\n9587,&\n9601,&\n9613,&\n9619,&\n9623,&\n9629,&\n9631,&\n9643,&\n9649,&\n9661,&\n9677,&\n9679,&\n9689,&\n9697,&\n9719,&\n9721,&\n9733,&\n9739,&\n9743,&\n9749,&\n9767,&\n9769,&\n9781,&\n9787,&\n9791,&\n9803,&\n9811,&\n9817,&\n9829,&\n9833,&\n9839,&\n9851,&\n9857,&\n9859,&\n9871,&\n9883,&\n9887,&\n9901,&\n9907,&\n9923,&\n9929,&\n9931,&\n9941,&\n9949,&\n9967,&\n9973,&\n10007,&\n10009,&\n10037,&\n10039,&\n10061,&\n10067,&\n10069,&\n10079,&\n10091,&\n10093,&\n10099,&\n10103,&\n10111,&\n10133,&\n10139,&\n10141,&\n10151,&\n10159,&\n10163,&\n10169,&\n10177,&\n10181,&\n10193,&\n10211,&\n10223,&\n10243,&\n10247,&\n10253,&\n10259,&\n10267,&\n10271,&\n10273,&\n10289,&\n10301,&\n10303,&\n10313,&\n10321,&\n10331,&\n10333,&\n10337,&\n10343,&\n10357,&\n10369,&\n10391,&\n10399,&\n10427,&\n10429,&\n10433,&\n10453,&\n10457,&\n10459,&\n10463,&\n10477,&\n10487,&\n10499,&\n10501,&\n10513,&\n10529,&\n10531,&\n10559,&\n10567,&\n10589,&\n10597,&\n10601,&\n10607,&\n10613,&\n10627,&\n10631,&\n10639,&\n10651,&\n10657,&\n10663,&\n10667,&\n10687,&\n10691,&\n10709,&\n10711,&\n10723,&\n10729,&\n10733,&\n10739,&\n10753,&\n10771,&\n10781,&\n10789,&\n10799,&\n10831,&\n10837,&\n10847,&\n10853,&\n10859,&\n10861,&\n10867,&\n10883,&\n10889,&\n10891,&\n10903,&\n10909,&\n10937,&\n10939,&\n10949,&\n10957,&\n10973,&\n10979,&\n10987,&\n10993,&\n11003,&\n11027,&\n11047,&\n11057,&\n11059,&\n11069,&\n11071,&\n11083,&\n11087,&\n11093,&\n11113,&\n11117,&\n11119,&\n11131,&\n11149,&\n11159,&\n11161,&\n11171,&\n11173,&\n11177,&\n11197,&\n11213,&\n11239,&\n11243,&\n11251,&\n11257,&\n11261,&\n11273,&\n11279,&\n11287,&\n11299,&\n11311,&\n11317,&\n11321,&\n11329,&\n11351,&\n11353,&\n11369,&\n11383,&\n11393,&\n11399,&\n11411,&\n11423,&\n11437,&\n11443,&\n11447,&\n11467,&\n11471,&\n11483,&\n11489,&\n11491,&\n11497,&\n11503,&\n11519,&\n11527,&\n11549,&\n11551,&\n11579,&\n11587,&\n11593,&\n11597,&\n11617,&\n11621,&\n11633,&\n11657,&\n11677,&\n11681,&\n11689,&\n11699,&\n11701,&\n11717,&\n11719,&\n11731,&\n11743,&\n11777,&\n11779,&\n11783,&\n11789,&\n11801,&\n11807,&\n11813,&\n11821,&\n11827,&\n11831,&\n11833,&\n11839,&\n11863,&\n11867,&\n11887,&\n11897,&\n11903,&\n11909,&\n11923,&\n11927,&\n11933,&\n11939,&\n11941,&\n11953,&\n11959,&\n11969,&\n11971,&\n11981,&\n11987,&\n12007,&\n12011,&\n12037,&\n12041,&\n12043,&\n12049,&\n12071,&\n12073,&\n12097,&\n12101,&\n12107,&\n12109,&\n12113,&\n12119,&\n12143,&\n12149,&\n12157,&\n12161,&\n12163,&\n12197,&\n12203,&\n12211,&\n12227,&\n12239,&\n12241,&\n12251,&\n12253,&\n12263,&\n12269,&\n12277,&\n12281,&\n12289,&\n12301,&\n12323,&\n12329,&\n12343,&\n12347,&\n12373,&\n12377,&\n12379,&\n12391,&\n12401,&\n12409,&\n12413,&\n12421,&\n12433,&\n12437,&\n12451,&\n12457,&\n12473,&\n12479,&\n12487,&\n12491,&\n12497,&\n12503,&\n12511,&\n12517,&\n12527,&\n12539,&\n12541,&\n12547,&\n12553,&\n12569,&\n12577,&\n12583,&\n12589,&\n12601,&\n12611,&\n12613,&\n12619,&\n12637,&\n12641,&\n12647,&\n12653,&\n12659,&\n12671,&\n12689,&\n12697,&\n12703,&\n12713,&\n12721,&\n12739,&\n12743,&\n12757,&\n12763,&\n12781,&\n12791,&\n12799,&\n12809,&\n12821,&\n12823,&\n12829,&\n12841,&\n12853,&\n12889,&\n12893,&\n12899,&\n12907,&\n12911,&\n12917,&\n12919,&\n12923,&\n12941,&\n12953,&\n12959,&\n12967,&\n12973,&\n12979,&\n12983,&\n13001,&\n13003,&\n13007,&\n13009,&\n13033,&\n13037,&\n13043,&\n13049,&\n13063,&\n13093,&\n13099,&\n13103,&\n13109,&\n13121,&\n13127,&\n13147,&\n13151,&\n13159,&\n13163,&\n13171,&\n13177,&\n13183,&\n13187,&\n13217,&\n13219,&\n13229,&\n13241,&\n13249,&\n13259,&\n13267,&\n13291,&\n13297,&\n13309,&\n13313,&\n13327,&\n13331,&\n13337,&\n13339,&\n13367,&\n13381,&\n13397,&\n13399,&\n13411,&\n13417,&\n13421,&\n13441,&\n13451,&\n13457,&\n13463,&\n13469,&\n13477,&\n13487,&\n13499,&\n13513,&\n13523,&\n13537,&\n13553,&\n13567,&\n13577,&\n13591,&\n13597,&\n13613,&\n13619,&\n13627,&\n13633,&\n13649,&\n13669,&\n13679,&\n13681,&\n13687,&\n13691,&\n13693,&\n13697,&\n13709,&\n13711,&\n13721,&\n13723,&\n13729,&\n13751,&\n13757,&\n13759,&\n13763,&\n13781,&\n13789,&\n13799,&\n13807,&\n13829,&\n13831,&\n13841,&\n13859,&\n13873,&\n13877,&\n13879,&\n13883,&\n13901,&\n13903,&\n13907,&\n13913,&\n13921,&\n13931,&\n13933,&\n13963,&\n13967,&\n13997,&\n13999,&\n14009,&\n14011,&\n14029,&\n14033,&\n14051,&\n14057,&\n14071,&\n14081,&\n14083,&\n14087,&\n14107,&\n14143,&\n14149,&\n14153,&\n14159,&\n14173,&\n14177,&\n14197,&\n14207,&\n14221,&\n14243,&\n14249,&\n14251,&\n14281,&\n14293,&\n14303,&\n14321,&\n14323,&\n14327,&\n14341,&\n14347,&\n14369,&\n14387,&\n14389,&\n14401,&\n14407,&\n14411,&\n14419,&\n14423,&\n14431,&\n14437,&\n14447,&\n14449,&\n14461,&\n14479,&\n14489,&\n14503,&\n14519,&\n14533,&\n14537,&\n14543,&\n14549,&\n14551,&\n14557,&\n14561,&\n14563,&\n14591,&\n14593,&\n14621,&\n14627,&\n14629,&\n14633,&\n14639,&\n14653,&\n14657,&\n14669,&\n14683,&\n14699,&\n14713,&\n14717,&\n14723,&\n14731,&\n14737,&\n14741,&\n14747,&\n14753,&\n14759,&\n14767,&\n14771,&\n14779,&\n14783,&\n14797,&\n14813,&\n14821,&\n14827,&\n14831,&\n14843,&\n14851,&\n14867,&\n14869,&\n14879,&\n14887,&\n14891,&\n14897,&\n14923,&\n14929,&\n14939,&\n14947,&\n14951,&\n14957,&\n14969,&\n14983,&\n15013,&\n15017,&\n15031,&\n15053,&\n15061,&\n15073,&\n15077,&\n15083,&\n15091,&\n15101,&\n15107,&\n15121,&\n15131,&\n15137,&\n15139,&\n15149,&\n15161,&\n15173,&\n15187,&\n15193,&\n15199,&\n15217,&\n15227,&\n15233,&\n15241,&\n15259,&\n15263,&\n15269,&\n15271,&\n15277,&\n15287,&\n15289,&\n15299,&\n15307,&\n15313,&\n15319,&\n15329,&\n15331,&\n15349,&\n15359,&\n15361,&\n15373,&\n15377,&\n15383,&\n15391,&\n15401,&\n15413,&\n15427,&\n15439,&\n15443,&\n15451,&\n15461,&\n15467,&\n15473,&\n15493,&\n15497,&\n15511,&\n15527,&\n15541,&\n15551,&\n15559,&\n15569,&\n15581,&\n15583,&\n15601,&\n15607,&\n15619,&\n15629,&\n15641,&\n15643,&\n15647,&\n15649,&\n15661,&\n15667,&\n15671,&\n15679,&\n15683,&\n15727,&\n15731,&\n15733,&\n15737,&\n15739,&\n15749,&\n15761,&\n15767,&\n15773,&\n15787,&\n15791,&\n15797,&\n15803,&\n15809,&\n15817,&\n15823,&\n15859,&\n15877,&\n15881,&\n15887,&\n15889,&\n15901,&\n15907,&\n15913,&\n15919,&\n15923,&\n15937,&\n15959,&\n15971,&\n15973,&\n15991,&\n16001,&\n16007,&\n16033,&\n16057,&\n16061,&\n16063,&\n16067,&\n16069,&\n16073,&\n16087,&\n16091,&\n16097,&\n16103,&\n16111,&\n16127,&\n16139,&\n16141,&\n16183,&\n16187,&\n16189,&\n16193,&\n16217,&\n16223,&\n16229,&\n16231,&\n16249,&\n16253,&\n16267,&\n16273,&\n16301,&\n16319,&\n16333,&\n16339,&\n16349,&\n16361,&\n16363,&\n16369,&\n16381,&\n16411,&\n16417,&\n16421,&\n16427,&\n16433,&\n16447,&\n16451,&\n16453,&\n16477,&\n16481,&\n16487,&\n16493,&\n16519,&\n16529,&\n16547,&\n16553,&\n16561,&\n16567,&\n16573,&\n16603,&\n16607,&\n16619,&\n16631,&\n16633,&\n16649,&\n16651,&\n16657,&\n16661,&\n16673,&\n16691,&\n16693,&\n16699,&\n16703,&\n16729,&\n16741,&\n16747,&\n16759,&\n16763,&\n16787,&\n16811,&\n16823,&\n16829,&\n16831,&\n16843,&\n16871,&\n16879,&\n16883,&\n16889,&\n16901,&\n16903,&\n16921,&\n16927,&\n16931,&\n16937,&\n16943,&\n16963,&\n16979,&\n16981,&\n16987,&\n16993,&\n17011,&\n17021,&\n17027,&\n17029,&\n17033,&\n17041,&\n17047,&\n17053,&\n17077,&\n17093,&\n17099,&\n17107,&\n17117,&\n17123,&\n17137,&\n17159,&\n17167,&\n17183,&\n17189,&\n17191,&\n17203,&\n17207,&\n17209,&\n17231,&\n17239,&\n17257,&\n17291,&\n17293,&\n17299,&\n17317,&\n17321,&\n17327,&\n17333,&\n17341,&\n17351,&\n17359,&\n17377,&\n17383,&\n17387,&\n17389,&\n17393,&\n17401,&\n17417,&\n17419,&\n17431,&\n17443,&\n17449,&\n17467,&\n17471,&\n17477,&\n17483,&\n17489,&\n17491,&\n17497,&\n17509,&\n17519,&\n17539,&\n17551,&\n17569,&\n17573,&\n17579,&\n17581,&\n17597,&\n17599,&\n17609,&\n17623,&\n17627,&\n17657,&\n17659,&\n17669,&\n17681,&\n17683,&\n17707,&\n17713,&\n17729,&\n17737,&\n17747,&\n17749,&\n17761,&\n17783,&\n17789,&\n17791,&\n17807,&\n17827,&\n17837,&\n17839,&\n17851,&\n17863,&\n17881,&\n17891,&\n17903,&\n17909,&\n17911,&\n17921,&\n17923,&\n17929,&\n17939,&\n17957,&\n17959,&\n17971,&\n17977,&\n17981,&\n17987,&\n17989,&\n18013,&\n18041,&\n18043,&\n18047,&\n18049,&\n18059,&\n18061,&\n18077,&\n18089,&\n18097,&\n18119,&\n18121,&\n18127,&\n18131,&\n18133,&\n18143,&\n18149,&\n18169,&\n18181,&\n18191,&\n18199,&\n18211,&\n18217,&\n18223,&\n18229,&\n18233,&\n18251,&\n18253,&\n18257,&\n18269,&\n18287,&\n18289,&\n18301,&\n18307,&\n18311,&\n18313,&\n18329,&\n18341,&\n18353,&\n18367,&\n18371,&\n18379,&\n18397,&\n18401,&\n18413,&\n18427,&\n18433,&\n18439,&\n18443,&\n18451,&\n18457,&\n18461,&\n18481,&\n18493,&\n18503,&\n18517,&\n18521,&\n18523,&\n18539,&\n18541,&\n18553,&\n18583,&\n18587,&\n18593,&\n18617,&\n18637,&\n18661,&\n18671,&\n18679,&\n18691,&\n18701,&\n18713,&\n18719,&\n18731,&\n18743,&\n18749,&\n18757,&\n18773,&\n18787,&\n18793,&\n18797,&\n18803,&\n18839,&\n18859,&\n18869,&\n18899,&\n18911,&\n18913,&\n18917,&\n18919,&\n18947,&\n18959,&\n18973,&\n18979,&\n19001,&\n19009,&\n19013,&\n19031,&\n19037,&\n19051,&\n19069,&\n19073,&\n19079,&\n19081,&\n19087,&\n19121,&\n19139,&\n19141,&\n19157,&\n19163,&\n19181,&\n19183,&\n19207,&\n19211,&\n19213,&\n19219,&\n19231,&\n19237,&\n19249,&\n19259,&\n19267,&\n19273,&\n19289,&\n19301,&\n19309,&\n19319,&\n19333,&\n19373,&\n19379,&\n19381,&\n19387,&\n19391,&\n19403,&\n19417,&\n19421,&\n19423,&\n19427,&\n19429,&\n19433,&\n19441,&\n19447,&\n19457,&\n19463,&\n19469,&\n19471,&\n19477,&\n19483,&\n19489,&\n19501,&\n19507,&\n19531,&\n19541,&\n19543,&\n19553,&\n19559,&\n19571,&\n19577,&\n19583,&\n19597,&\n19603,&\n19609,&\n19661,&\n19681,&\n19687,&\n19697,&\n19699,&\n19709,&\n19717,&\n19727,&\n19739,&\n19751,&\n19753,&\n19759,&\n19763,&\n19777,&\n19793,&\n19801,&\n19813,&\n19819,&\n19841,&\n19843,&\n19853,&\n19861,&\n19867,&\n19889,&\n19891,&\n19913,&\n19919,&\n19927,&\n19937,&\n19949,&\n19961,&\n19963,&\n19973,&\n19979,&\n19991,&\n19993,&\n19997,&\n20011,&\n20021,&\n20023,&\n20029,&\n20047,&\n20051,&\n20063,&\n20071,&\n20089,&\n20101,&\n20107,&\n20113,&\n20117,&\n20123,&\n20129,&\n20143,&\n20147,&\n20149,&\n20161,&\n20173,&\n20177,&\n20183,&\n20201,&\n20219,&\n20231,&\n20233,&\n20249,&\n20261,&\n20269,&\n20287,&\n20297,&\n20323,&\n20327,&\n20333,&\n20341,&\n20347,&\n20353,&\n20357,&\n20359,&\n20369,&\n20389,&\n20393,&\n20399,&\n20407,&\n20411,&\n20431,&\n20441,&\n20443,&\n20477,&\n20479,&\n20483,&\n20507,&\n20509,&\n20521,&\n20533,&\n20543,&\n20549,&\n20551,&\n20563,&\n20593,&\n20599,&\n20611,&\n20627,&\n20639,&\n20641,&\n20663,&\n20681,&\n20693,&\n20707,&\n20717,&\n20719,&\n20731,&\n20743,&\n20747,&\n20749,&\n20753,&\n20759,&\n20771,&\n20773,&\n20789,&\n20807,&\n20809,&\n20849,&\n20857,&\n20873,&\n20879,&\n20887,&\n20897,&\n20899,&\n20903,&\n20921,&\n20929,&\n20939,&\n20947,&\n20959,&\n20963,&\n20981,&\n20983,&\n21001,&\n21011,&\n21013,&\n21017,&\n21019,&\n21023,&\n21031,&\n21059,&\n21061,&\n21067,&\n21089,&\n21101,&\n21107,&\n21121,&\n21139,&\n21143,&\n21149,&\n21157,&\n21163,&\n21169,&\n21179,&\n21187,&\n21191,&\n21193,&\n21211,&\n21221,&\n21227,&\n21247,&\n21269,&\n21277,&\n21283,&\n21313,&\n21317,&\n21319,&\n21323,&\n21341,&\n21347,&\n21377,&\n21379,&\n21383,&\n21391,&\n21397,&\n21401,&\n21407,&\n21419,&\n21433,&\n21467,&\n21481,&\n21487,&\n21491,&\n21493,&\n21499,&\n21503,&\n21517,&\n21521,&\n21523,&\n21529,&\n21557,&\n21559,&\n21563,&\n21569,&\n21577,&\n21587,&\n21589,&\n21599,&\n21601,&\n21611,&\n21613,&\n21617,&\n21647,&\n21649,&\n21661,&\n21673,&\n21683,&\n21701,&\n21713,&\n21727,&\n21737,&\n21739,&\n21751,&\n21757,&\n21767,&\n21773,&\n21787,&\n21799,&\n21803,&\n21817,&\n21821,&\n21839,&\n21841,&\n21851,&\n21859,&\n21863,&\n21871,&\n21881,&\n21893,&\n21911,&\n21929,&\n21937,&\n21943,&\n21961,&\n21977,&\n21991,&\n21997,&\n22003,&\n22013,&\n22027,&\n22031,&\n22037,&\n22039,&\n22051,&\n22063,&\n22067,&\n22073,&\n22079,&\n22091,&\n22093,&\n22109,&\n22111,&\n22123,&\n22129,&\n22133,&\n22147,&\n22153,&\n22157,&\n22159,&\n22171,&\n22189,&\n22193,&\n22229,&\n22247,&\n22259,&\n22271,&\n22273,&\n22277,&\n22279,&\n22283,&\n22291,&\n22303,&\n22307,&\n22343,&\n22349,&\n22367,&\n22369,&\n22381,&\n22391,&\n22397,&\n22409,&\n22433,&\n22441,&\n22447,&\n22453,&\n22469,&\n22481,&\n22483,&\n22501,&\n22511,&\n22531,&\n22541,&\n22543,&\n22549,&\n22567,&\n22571,&\n22573,&\n22613,&\n22619,&\n22621,&\n22637,&\n22639,&\n22643,&\n22651,&\n22669,&\n22679,&\n22691,&\n22697,&\n22699,&\n22709,&\n22717,&\n22721,&\n22727,&\n22739,&\n22741,&\n22751,&\n22769,&\n22777,&\n22783,&\n22787,&\n22807,&\n22811,&\n22817,&\n22853,&\n22859,&\n22861,&\n22871,&\n22877,&\n22901,&\n22907,&\n22921,&\n22937,&\n22943,&\n22961,&\n22963,&\n22973,&\n22993,&\n23003,&\n23011,&\n23017,&\n23021,&\n23027,&\n23029,&\n23039,&\n23041,&\n23053,&\n23057,&\n23059,&\n23063,&\n23071,&\n23081,&\n23087,&\n23099,&\n23117,&\n23131,&\n23143,&\n23159,&\n23167,&\n23173,&\n23189,&\n23197,&\n23201,&\n23203,&\n23209,&\n23227,&\n23251,&\n23269,&\n23279,&\n23291,&\n23293,&\n23297,&\n23311,&\n23321,&\n23327,&\n23333,&\n23339,&\n23357,&\n23369,&\n23371,&\n23399,&\n23417,&\n23431,&\n23447,&\n23459,&\n23473,&\n23497,&\n23509,&\n23531,&\n23537,&\n23539,&\n23549,&\n23557,&\n23561,&\n23563,&\n23567,&\n23581,&\n23593,&\n23599,&\n23603,&\n23609,&\n23623,&\n23627,&\n23629,&\n23633,&\n23663,&\n23669,&\n23671,&\n23677,&\n23687,&\n23689,&\n23719,&\n23741,&\n23743,&\n23747,&\n23753,&\n23761,&\n23767,&\n23773,&\n23789,&\n23801,&\n23813,&\n23819,&\n23827,&\n23831,&\n23833,&\n23857,&\n23869,&\n23873,&\n23879,&\n23887,&\n23893,&\n23899,&\n23909,&\n23911,&\n23917,&\n23929,&\n23957,&\n23971,&\n23977,&\n23981,&\n23993,&\n24001,&\n24007,&\n24019,&\n24023,&\n24029,&\n24043,&\n24049,&\n24061,&\n24071,&\n24077,&\n24083,&\n24091,&\n24097,&\n24103,&\n24107,&\n24109,&\n24113,&\n24121,&\n24133,&\n24137,&\n24151,&\n24169,&\n24179,&\n24181,&\n24197,&\n24203,&\n24223,&\n24229,&\n24239,&\n24247,&\n24251,&\n24281,&\n24317,&\n24329,&\n24337,&\n24359,&\n24371,&\n24373,&\n24379,&\n24391,&\n24407,&\n24413,&\n24419,&\n24421,&\n24439,&\n24443,&\n24469,&\n24473,&\n24481,&\n24499,&\n24509,&\n24517,&\n24527,&\n24533,&\n24547,&\n24551,&\n24571,&\n24593,&\n24611,&\n24623,&\n24631,&\n24659,&\n24671,&\n24677,&\n24683,&\n24691,&\n24697,&\n24709,&\n24733,&\n24749,&\n24763,&\n24767,&\n24781,&\n24793,&\n24799,&\n24809,&\n24821,&\n24841,&\n24847,&\n24851,&\n24859,&\n24877,&\n24889,&\n24907,&\n24917,&\n24919,&\n24923,&\n24943,&\n24953,&\n24967,&\n24971,&\n24977,&\n24979,&\n24989,&\n25013,&\n25031,&\n25033,&\n25037,&\n25057,&\n25073,&\n25087,&\n25097,&\n25111,&\n25117,&\n25121,&\n25127,&\n25147,&\n25153,&\n25163,&\n25169,&\n25171,&\n25183,&\n25189,&\n25219,&\n25229,&\n25237,&\n25243,&\n25247,&\n25253,&\n25261,&\n25301,&\n25303,&\n25307,&\n25309,&\n25321,&\n25339,&\n25343,&\n25349,&\n25357,&\n25367,&\n25373,&\n25391,&\n25409,&\n25411,&\n25423,&\n25439,&\n25447,&\n25453,&\n25457,&\n25463,&\n25469,&\n25471,&\n25523,&\n25537,&\n25541,&\n25561,&\n25577,&\n25579,&\n25583,&\n25589,&\n25601,&\n25603,&\n25609,&\n25621,&\n25633,&\n25639,&\n25643,&\n25657,&\n25667,&\n25673,&\n25679,&\n25693,&\n25703,&\n25717,&\n25733,&\n25741,&\n25747,&\n25759,&\n25763,&\n25771,&\n25793,&\n25799,&\n25801,&\n25819,&\n25841,&\n25847,&\n25849,&\n25867,&\n25873,&\n25889,&\n25903,&\n25913,&\n25919,&\n25931,&\n25933,&\n25939,&\n25943,&\n25951,&\n25969,&\n25981,&\n25997,&\n25999,&\n26003,&\n26017,&\n26021,&\n26029,&\n26041,&\n26053,&\n26083,&\n26099,&\n26107,&\n26111,&\n26113,&\n26119,&\n26141,&\n26153,&\n26161,&\n26171,&\n26177,&\n26183,&\n26189,&\n26203,&\n26209,&\n26227,&\n26237,&\n26249,&\n26251,&\n26261,&\n26263,&\n26267,&\n26293,&\n26297,&\n26309,&\n26317,&\n26321,&\n26339,&\n26347,&\n26357,&\n26371,&\n26387,&\n26393,&\n26399,&\n26407,&\n26417,&\n26423,&\n26431,&\n26437,&\n26449,&\n26459,&\n26479,&\n26489,&\n26497,&\n26501,&\n26513,&\n26539,&\n26557,&\n26561,&\n26573,&\n26591,&\n26597,&\n26627,&\n26633,&\n26641,&\n26647,&\n26669,&\n26681,&\n26683,&\n26687,&\n26693,&\n26699,&\n26701,&\n26711,&\n26713,&\n26717,&\n26723,&\n26729,&\n26731,&\n26737,&\n26759,&\n26777,&\n26783,&\n26801,&\n26813,&\n26821,&\n26833,&\n26839,&\n26849,&\n26861,&\n26863,&\n26879,&\n26881,&\n26891,&\n26893,&\n26903,&\n26921,&\n26927,&\n26947,&\n26951,&\n26953,&\n26959,&\n26981,&\n26987,&\n26993,&\n27011,&\n27017,&\n27031,&\n27043,&\n27059,&\n27061,&\n27067,&\n27073,&\n27077,&\n27091,&\n27103,&\n27107,&\n27109,&\n27127,&\n27143,&\n27179,&\n27191,&\n27197,&\n27211,&\n27239,&\n27241,&\n27253,&\n27259,&\n27271,&\n27277,&\n27281,&\n27283,&\n27299,&\n27329,&\n27337,&\n27361,&\n27367,&\n27397,&\n27407,&\n27409,&\n27427,&\n27431,&\n27437,&\n27449,&\n27457,&\n27479,&\n27481,&\n27487,&\n27509,&\n27527,&\n27529,&\n27539,&\n27541,&\n27551,&\n27581,&\n27583,&\n27611,&\n27617,&\n27631,&\n27647,&\n27653,&\n27673,&\n27689,&\n27691,&\n27697,&\n27701,&\n27733,&\n27737,&\n27739,&\n27743,&\n27749,&\n27751,&\n27763,&\n27767,&\n27773,&\n27779,&\n27791,&\n27793,&\n27799,&\n27803,&\n27809,&\n27817,&\n27823,&\n27827,&\n27847,&\n27851,&\n27883,&\n27893,&\n27901,&\n27917,&\n27919,&\n27941,&\n27943,&\n27947,&\n27953,&\n27961,&\n27967,&\n27983,&\n27997,&\n28001,&\n28019,&\n28027,&\n28031,&\n28051,&\n28057,&\n28069,&\n28081,&\n28087,&\n28097,&\n28099,&\n28109,&\n28111,&\n28123,&\n28151,&\n28163,&\n28181,&\n28183,&\n28201,&\n28211,&\n28219,&\n28229,&\n28277,&\n28279,&\n28283,&\n28289,&\n28297,&\n28307,&\n28309,&\n28319,&\n28349,&\n28351,&\n28387,&\n28393,&\n28403,&\n28409,&\n28411,&\n28429,&\n28433,&\n28439,&\n28447,&\n28463,&\n28477,&\n28493,&\n28499,&\n28513,&\n28517,&\n28537,&\n28541,&\n28547,&\n28549,&\n28559,&\n28571,&\n28573,&\n28579,&\n28591,&\n28597,&\n28603,&\n28607,&\n28619,&\n28621,&\n28627,&\n28631,&\n28643,&\n28649,&\n28657,&\n28661,&\n28663,&\n28669,&\n28687,&\n28697,&\n28703,&\n28711,&\n28723,&\n28729,&\n28751,&\n28753,&\n28759,&\n28771,&\n28789,&\n28793,&\n28807,&\n28813,&\n28817,&\n28837,&\n28843,&\n28859,&\n28867,&\n28871,&\n28879,&\n28901,&\n28909,&\n28921,&\n28927,&\n28933,&\n28949,&\n28961,&\n28979,&\n29009,&\n29017,&\n29021,&\n29023,&\n29027,&\n29033,&\n29059,&\n29063,&\n29077,&\n29101,&\n29123,&\n29129,&\n29131,&\n29137,&\n29147,&\n29153,&\n29167,&\n29173,&\n29179,&\n29191,&\n29201,&\n29207,&\n29209,&\n29221,&\n29231,&\n29243,&\n29251,&\n29269,&\n29287,&\n29297,&\n29303,&\n29311,&\n29327,&\n29333,&\n29339,&\n29347,&\n29363,&\n29383,&\n29387,&\n29389,&\n29399,&\n29401,&\n29411,&\n29423,&\n29429,&\n29437,&\n29443,&\n29453,&\n29473,&\n29483,&\n29501,&\n29527,&\n29531,&\n29537,&\n29567,&\n29569,&\n29573,&\n29581,&\n29587,&\n29599,&\n29611,&\n29629,&\n29633,&\n29641,&\n29663,&\n29669,&\n29671,&\n29683,&\n29717,&\n29723,&\n29741,&\n29753,&\n29759,&\n29761,&\n29789,&\n29803,&\n29819,&\n29833,&\n29837,&\n29851,&\n29863,&\n29867,&\n29873,&\n29879,&\n29881,&\n29917,&\n29921,&\n29927,&\n29947,&\n29959,&\n29983,&\n29989,&\n30011,&\n30013,&\n30029,&\n30047,&\n30059,&\n30071,&\n30089,&\n30091,&\n30097,&\n30103,&\n30109,&\n30113,&\n30119,&\n30133,&\n30137,&\n30139,&\n30161,&\n30169,&\n30181,&\n30187,&\n30197,&\n30203,&\n30211,&\n30223,&\n30241,&\n30253,&\n30259,&\n30269,&\n30271,&\n30293,&\n30307,&\n30313,&\n30319,&\n30323,&\n30341,&\n30347,&\n30367,&\n30389,&\n30391,&\n30403,&\n30427,&\n30431,&\n30449,&\n30467,&\n30469,&\n30491,&\n30493,&\n30497,&\n30509,&\n30517,&\n30529,&\n30539,&\n30553,&\n30557,&\n30559,&\n30577,&\n30593,&\n30631,&\n30637,&\n30643,&\n30649,&\n30661,&\n30671,&\n30677,&\n30689,&\n30697,&\n30703,&\n30707,&\n30713,&\n30727,&\n30757,&\n30763,&\n30773,&\n30781,&\n30803,&\n30809,&\n30817,&\n30829,&\n30839,&\n30841,&\n30851,&\n30853,&\n30859,&\n30869,&\n30871,&\n30881,&\n30893,&\n30911,&\n30931,&\n30937,&\n30941,&\n30949,&\n30971,&\n30977,&\n30983,&\n31013,&\n31019,&\n31033,&\n31039,&\n31051,&\n31063,&\n31069,&\n31079,&\n31081,&\n31091,&\n31121,&\n31123,&\n31139,&\n31147,&\n31151,&\n31153,&\n31159,&\n31177,&\n31181,&\n31183,&\n31189,&\n31193,&\n31219,&\n31223,&\n31231,&\n31237,&\n31247,&\n31249,&\n31253,&\n31259,&\n31267,&\n31271,&\n31277,&\n31307,&\n31319,&\n31321,&\n31327,&\n31333,&\n31337,&\n31357,&\n31379,&\n31387,&\n31391,&\n31393,&\n31397,&\n31469,&\n31477,&\n31481,&\n31489,&\n31511,&\n31513,&\n31517,&\n31531,&\n31541,&\n31543,&\n31547,&\n31567,&\n31573,&\n31583,&\n31601,&\n31607,&\n31627,&\n31643,&\n31649,&\n31657,&\n31663,&\n31667,&\n31687,&\n31699,&\n31721,&\n31723,&\n31727,&\n31729,&\n31741,&\n31751,&\n31769,&\n31771,&\n31793,&\n31799,&\n31817,&\n31847,&\n31849,&\n31859,&\n31873,&\n31883,&\n31891,&\n31907,&\n31957,&\n31963,&\n31973,&\n31981,&\n31991,&\n32003,&\n32009,&\n32027,&\n32029,&\n32051,&\n32057,&\n32059,&\n32063,&\n32069,&\n32077,&\n32083,&\n32089,&\n32099,&\n32117,&\n32119,&\n32141,&\n32143,&\n32159,&\n32173,&\n32183,&\n32189,&\n32191,&\n32203,&\n32213,&\n32233,&\n32237,&\n32251,&\n32257,&\n32261,&\n32297,&\n32299,&\n32303,&\n32309,&\n32321,&\n32323,&\n32327,&\n32341,&\n32353,&\n32359,&\n32363,&\n32369,&\n32371,&\n32377,&\n32381,&\n32401,&\n32411,&\n32413,&\n32423,&\n32429,&\n32441,&\n32443,&\n32467,&\n32479,&\n32491,&\n32497,&\n32503,&\n32507,&\n32531,&\n32533,&\n32537,&\n32561,&\n32563,&\n32569,&\n32573,&\n32579,&\n32587,&\n32603,&\n32609,&\n32611,&\n32621,&\n32633,&\n32647,&\n32653,&\n32687,&\n32693,&\n32707,&\n32713,&\n32717,&\n32719,&\n32749,&\n32771,&\n32779,&\n32783,&\n32789,&\n32797,&\n32801,&\n32803,&\n32831,&\n32833,&\n32839,&\n32843,&\n32869,&\n32887,&\n32909,&\n32911,&\n32917,&\n32933,&\n32939,&\n32941,&\n32957,&\n32969,&\n32971,&\n32983,&\n32987,&\n32993,&\n32999,&\n33013,&\n33023,&\n33029,&\n33037,&\n33049,&\n33053,&\n33071,&\n33073,&\n33083,&\n33091,&\n33107,&\n33113,&\n33119,&\n33149,&\n33151,&\n33161,&\n33179,&\n33181,&\n33191,&\n33199,&\n33203,&\n33211,&\n33223,&\n33247,&\n33287,&\n33289,&\n33301,&\n33311,&\n33317,&\n33329,&\n33331,&\n33343,&\n33347,&\n33349,&\n33353,&\n33359,&\n33377,&\n33391,&\n33403,&\n33409,&\n33413,&\n33427,&\n33457,&\n33461,&\n33469,&\n33479,&\n33487,&\n33493,&\n33503,&\n33521,&\n33529,&\n33533,&\n33547,&\n33563,&\n33569,&\n33577,&\n33581,&\n33587,&\n33589,&\n33599,&\n33601,&\n33613,&\n33617,&\n33619,&\n33623,&\n33629,&\n33637,&\n33641,&\n33647,&\n33679,&\n33703,&\n33713,&\n33721,&\n33739,&\n33749,&\n33751,&\n33757,&\n33767,&\n33769,&\n33773,&\n33791,&\n33797,&\n33809,&\n33811,&\n33827,&\n33829,&\n33851,&\n33857,&\n33863,&\n33871,&\n33889,&\n33893,&\n33911,&\n33923,&\n33931,&\n33937,&\n33941,&\n33961,&\n33967,&\n33997,&\n34019,&\n34031,&\n34033,&\n34039,&\n34057,&\n34061,&\n34123,&\n34127,&\n34129,&\n34141,&\n34147,&\n34157,&\n34159,&\n34171,&\n34183,&\n34211,&\n34213,&\n34217,&\n34231,&\n34253,&\n34259,&\n34261,&\n34267,&\n34273,&\n34283,&\n34297,&\n34301,&\n34303,&\n34313,&\n34319,&\n34327,&\n34337,&\n34351,&\n34361,&\n34367,&\n34369,&\n34381,&\n34403,&\n34421,&\n34429,&\n34439,&\n34457,&\n34469,&\n34471,&\n34483,&\n34487,&\n34499,&\n34501,&\n34511,&\n34513,&\n34519,&\n34537,&\n34543,&\n34549,&\n34583,&\n34589,&\n34591,&\n34603,&\n34607,&\n34613,&\n34631,&\n34649,&\n34651,&\n34667,&\n34673,&\n34679,&\n34687,&\n34693,&\n34703,&\n34721,&\n34729,&\n34739,&\n34747,&\n34757,&\n34759,&\n34763,&\n34781,&\n34807,&\n34819,&\n34841,&\n34843,&\n34847,&\n34849,&\n34871,&\n34877,&\n34883,&\n34897,&\n34913,&\n34919,&\n34939,&\n34949,&\n34961,&\n34963,&\n34981,&\n35023,&\n35027,&\n35051,&\n35053,&\n35059,&\n35069,&\n35081,&\n35083,&\n35089,&\n35099,&\n35107,&\n35111,&\n35117,&\n35129,&\n35141,&\n35149,&\n35153,&\n35159,&\n35171,&\n35201,&\n35221,&\n35227,&\n35251,&\n35257,&\n35267,&\n35279,&\n35281,&\n35291,&\n35311,&\n35317,&\n35323,&\n35327,&\n35339,&\n35353,&\n35363,&\n35381,&\n35393,&\n35401,&\n35407,&\n35419,&\n35423,&\n35437,&\n35447,&\n35449,&\n35461,&\n35491,&\n35507,&\n35509,&\n35521,&\n35527,&\n35531,&\n35533,&\n35537,&\n35543,&\n35569,&\n35573,&\n35591,&\n35593,&\n35597,&\n35603,&\n35617,&\n35671,&\n35677,&\n35729,&\n35731,&\n35747,&\n35753,&\n35759,&\n35771,&\n35797,&\n35801,&\n35803,&\n35809,&\n35831,&\n35837,&\n35839,&\n35851,&\n35863,&\n35869,&\n35879,&\n35897,&\n35899,&\n35911,&\n35923,&\n35933,&\n35951,&\n35963,&\n35969,&\n35977,&\n35983,&\n35993,&\n35999,&\n36007,&\n36011,&\n36013,&\n36017,&\n36037,&\n36061,&\n36067,&\n36073,&\n36083,&\n36097,&\n36107,&\n36109,&\n36131,&\n36137,&\n36151,&\n36161,&\n36187,&\n36191,&\n36209,&\n36217,&\n36229,&\n36241,&\n36251,&\n36263,&\n36269,&\n36277,&\n36293,&\n36299,&\n36307,&\n36313,&\n36319,&\n36341,&\n36343,&\n36353,&\n36373,&\n36383,&\n36389,&\n36433,&\n36451,&\n36457,&\n36467,&\n36469,&\n36473,&\n36479,&\n36493,&\n36497,&\n36523,&\n36527,&\n36529,&\n36541,&\n36551,&\n36559,&\n36563,&\n36571,&\n36583,&\n36587,&\n36599,&\n36607,&\n36629,&\n36637,&\n36643,&\n36653,&\n36671,&\n36677,&\n36683,&\n36691,&\n36697,&\n36709,&\n36713,&\n36721,&\n36739,&\n36749,&\n36761,&\n36767,&\n36779,&\n36781,&\n36787,&\n36791,&\n36793,&\n36809,&\n36821,&\n36833,&\n36847,&\n36857,&\n36871,&\n36877,&\n36887,&\n36899,&\n36901,&\n36913,&\n36919,&\n36923,&\n36929,&\n36931,&\n36943,&\n36947,&\n36973,&\n36979,&\n36997,&\n37003,&\n37013,&\n37019,&\n37021,&\n37039,&\n37049,&\n37057,&\n37061,&\n37087,&\n37097,&\n37117,&\n37123,&\n37139,&\n37159,&\n37171,&\n37181,&\n37189,&\n37199,&\n37201,&\n37217,&\n37223,&\n37243,&\n37253,&\n37273,&\n37277,&\n37307,&\n37309,&\n37313,&\n37321,&\n37337,&\n37339,&\n37357,&\n37361,&\n37363,&\n37369,&\n37379,&\n37397,&\n37409,&\n37423,&\n37441,&\n37447,&\n37463,&\n37483,&\n37489,&\n37493,&\n37501,&\n37507,&\n37511,&\n37517,&\n37529,&\n37537,&\n37547,&\n37549,&\n37561,&\n37567,&\n37571,&\n37573,&\n37579,&\n37589,&\n37591,&\n37607,&\n37619,&\n37633,&\n37643,&\n37649,&\n37657,&\n37663,&\n37691,&\n37693,&\n37699,&\n37717,&\n37747,&\n37781,&\n37783,&\n37799,&\n37811,&\n37813,&\n37831,&\n37847,&\n37853,&\n37861,&\n37871,&\n37879,&\n37889,&\n37897,&\n37907,&\n37951,&\n37957,&\n37963,&\n37967,&\n37987,&\n37991,&\n37993,&\n37997,&\n38011,&\n38039,&\n38047,&\n38053,&\n38069,&\n38083,&\n38113,&\n38119,&\n38149,&\n38153,&\n38167,&\n38177,&\n38183,&\n38189,&\n38197,&\n38201,&\n38219,&\n38231,&\n38237,&\n38239,&\n38261,&\n38273,&\n38281,&\n38287,&\n38299,&\n38303,&\n38317,&\n38321,&\n38327,&\n38329,&\n38333,&\n38351,&\n38371,&\n38377,&\n38393,&\n38431,&\n38447,&\n38449,&\n38453,&\n38459,&\n38461,&\n38501,&\n38543,&\n38557,&\n38561,&\n38567,&\n38569,&\n38593,&\n38603,&\n38609,&\n38611,&\n38629,&\n38639,&\n38651,&\n38653,&\n38669,&\n38671,&\n38677,&\n38693,&\n38699,&\n38707,&\n38711,&\n38713,&\n38723,&\n38729,&\n38737,&\n38747,&\n38749,&\n38767,&\n38783,&\n38791,&\n38803,&\n38821,&\n38833,&\n38839,&\n38851,&\n38861,&\n38867,&\n38873,&\n38891,&\n38903,&\n38917,&\n38921,&\n38923,&\n38933,&\n38953,&\n38959,&\n38971,&\n38977,&\n38993,&\n39019,&\n39023,&\n39041,&\n39043,&\n39047,&\n39079,&\n39089,&\n39097,&\n39103,&\n39107,&\n39113,&\n39119,&\n39133,&\n39139,&\n39157,&\n39161,&\n39163,&\n39181,&\n39191,&\n39199,&\n39209,&\n39217,&\n39227,&\n39229,&\n39233,&\n39239,&\n39241,&\n39251,&\n39293,&\n39301,&\n39313,&\n39317,&\n39323,&\n39341,&\n39343,&\n39359,&\n39367,&\n39371,&\n39373,&\n39383,&\n39397,&\n39409,&\n39419,&\n39439,&\n39443,&\n39451,&\n39461,&\n39499,&\n39503,&\n39509,&\n39511,&\n39521,&\n39541,&\n39551,&\n39563,&\n39569,&\n39581,&\n39607,&\n39619,&\n39623,&\n39631,&\n39659,&\n39667,&\n39671,&\n39679,&\n39703,&\n39709,&\n39719,&\n39727,&\n39733,&\n39749,&\n39761,&\n39769,&\n39779,&\n39791,&\n39799,&\n39821,&\n39827,&\n39829,&\n39839,&\n39841,&\n39847,&\n39857,&\n39863,&\n39869,&\n39877,&\n39883,&\n39887,&\n39901,&\n39929,&\n39937,&\n39953,&\n39971,&\n39979,&\n39983,&\n39989,&\n40009,&\n40013,&\n40031,&\n40037,&\n40039,&\n40063,&\n40087,&\n40093,&\n40099,&\n40111,&\n40123,&\n40127,&\n40129,&\n40151,&\n40153,&\n40163,&\n40169,&\n40177,&\n40189,&\n40193,&\n40213,&\n40231,&\n40237,&\n40241,&\n40253,&\n40277,&\n40283,&\n40289,&\n40343,&\n40351,&\n40357,&\n40361,&\n40387,&\n40423,&\n40427,&\n40429,&\n40433,&\n40459,&\n40471,&\n40483,&\n40487,&\n40493,&\n40499,&\n40507,&\n40519,&\n40529,&\n40531,&\n40543,&\n40559,&\n40577,&\n40583,&\n40591,&\n40597,&\n40609,&\n40627,&\n40637,&\n40639,&\n40693,&\n40697,&\n40699,&\n40709,&\n40739,&\n40751,&\n40759,&\n40763,&\n40771,&\n40787,&\n40801,&\n40813,&\n40819,&\n40823,&\n40829,&\n40841,&\n40847,&\n40849,&\n40853,&\n40867,&\n40879,&\n40883,&\n40897,&\n40903,&\n40927,&\n40933,&\n40939,&\n40949,&\n40961,&\n40973,&\n40993,&\n41011,&\n41017,&\n41023,&\n41039,&\n41047,&\n41051,&\n41057,&\n41077,&\n41081,&\n41113,&\n41117,&\n41131,&\n41141,&\n41143,&\n41149,&\n41161,&\n41177,&\n41179,&\n41183,&\n41189,&\n41201,&\n41203,&\n41213,&\n41221,&\n41227,&\n41231,&\n41233,&\n41243,&\n41257,&\n41263,&\n41269,&\n41281,&\n41299,&\n41333,&\n41341,&\n41351,&\n41357,&\n41381,&\n41387,&\n41389,&\n41399,&\n41411,&\n41413,&\n41443,&\n41453,&\n41467,&\n41479,&\n41491,&\n41507,&\n41513,&\n41519,&\n41521,&\n41539,&\n41543,&\n41549,&\n41579,&\n41593,&\n41597,&\n41603,&\n41609,&\n41611,&\n41617,&\n41621,&\n41627,&\n41641,&\n41647,&\n41651,&\n41659,&\n41669,&\n41681,&\n41687,&\n41719,&\n41729,&\n41737,&\n41759,&\n41761,&\n41771,&\n41777,&\n41801,&\n41809,&\n41813,&\n41843,&\n41849,&\n41851,&\n41863,&\n41879,&\n41887,&\n41893,&\n41897,&\n41903,&\n41911,&\n41927,&\n41941,&\n41947,&\n41953,&\n41957,&\n41959,&\n41969,&\n41981,&\n41983,&\n41999,&\n42013,&\n42017,&\n42019,&\n42023,&\n42043,&\n42061,&\n42071,&\n42073,&\n42083,&\n42089,&\n42101,&\n42131,&\n42139,&\n42157,&\n42169,&\n42179,&\n42181,&\n42187,&\n42193,&\n42197,&\n42209,&\n42221,&\n42223,&\n42227,&\n42239,&\n42257,&\n42281,&\n42283,&\n42293,&\n42299,&\n42307,&\n42323,&\n42331,&\n42337,&\n42349,&\n42359,&\n42373,&\n42379,&\n42391,&\n42397,&\n42403,&\n42407,&\n42409,&\n42433,&\n42437,&\n42443,&\n42451,&\n42457,&\n42461,&\n42463,&\n42467,&\n42473,&\n42487,&\n42491,&\n42499,&\n42509,&\n42533,&\n42557,&\n42569,&\n42571,&\n42577,&\n42589,&\n42611,&\n42641,&\n42643,&\n42649,&\n42667,&\n42677,&\n42683,&\n42689,&\n42697,&\n42701,&\n42703,&\n42709,&\n42719,&\n42727,&\n42737,&\n42743,&\n42751,&\n42767,&\n42773,&\n42787,&\n42793,&\n42797,&\n42821,&\n42829,&\n42839,&\n42841,&\n42853,&\n42859,&\n42863,&\n42899,&\n42901,&\n42923,&\n42929,&\n42937,&\n42943,&\n42953,&\n42961,&\n42967,&\n42979,&\n42989,&\n43003,&\n43013,&\n43019,&\n43037,&\n43049,&\n43051,&\n43063,&\n43067,&\n43093,&\n43103,&\n43117,&\n43133,&\n43151,&\n43159,&\n43177,&\n43189,&\n43201,&\n43207,&\n43223,&\n43237,&\n43261,&\n43271,&\n43283,&\n43291,&\n43313,&\n43319,&\n43321,&\n43331,&\n43391,&\n43397,&\n43399,&\n43403,&\n43411,&\n43427,&\n43441,&\n43451,&\n43457,&\n43481,&\n43487,&\n43499,&\n43517,&\n43541,&\n43543,&\n43573,&\n43577,&\n43579,&\n43591,&\n43597,&\n43607,&\n43609,&\n43613,&\n43627,&\n43633,&\n43649,&\n43651,&\n43661,&\n43669,&\n43691,&\n43711,&\n43717,&\n43721,&\n43753,&\n43759,&\n43777,&\n43781,&\n43783,&\n43787,&\n43789,&\n43793,&\n43801,&\n43853,&\n43867,&\n43889,&\n43891,&\n43913,&\n43933,&\n43943,&\n43951,&\n43961,&\n43963,&\n43969,&\n43973,&\n43987,&\n43991,&\n43997,&\n44017,&\n44021,&\n44027,&\n44029,&\n44041,&\n44053,&\n44059,&\n44071,&\n44087,&\n44089,&\n44101,&\n44111,&\n44119,&\n44123,&\n44129,&\n44131,&\n44159,&\n44171,&\n44179,&\n44189,&\n44201,&\n44203,&\n44207,&\n44221,&\n44249,&\n44257,&\n44263,&\n44267,&\n44269,&\n44273,&\n44279,&\n44281,&\n44293,&\n44351,&\n44357,&\n44371,&\n44381,&\n44383,&\n44389,&\n44417,&\n44449,&\n44453,&\n44483,&\n44491,&\n44497,&\n44501,&\n44507,&\n44519,&\n44531,&\n44533,&\n44537,&\n44543,&\n44549,&\n44563,&\n44579,&\n44587,&\n44617,&\n44621,&\n44623,&\n44633,&\n44641,&\n44647,&\n44651,&\n44657,&\n44683,&\n44687,&\n44699,&\n44701,&\n44711,&\n44729,&\n44741,&\n44753,&\n44771,&\n44773,&\n44777,&\n44789,&\n44797,&\n44809,&\n44819,&\n44839,&\n44843,&\n44851,&\n44867,&\n44879,&\n44887,&\n44893,&\n44909,&\n44917,&\n44927,&\n44939,&\n44953,&\n44959,&\n44963,&\n44971,&\n44983,&\n44987,&\n45007,&\n45013,&\n45053,&\n45061,&\n45077,&\n45083,&\n45119,&\n45121,&\n45127,&\n45131,&\n45137,&\n45139,&\n45161,&\n45179,&\n45181,&\n45191,&\n45197,&\n45233,&\n45247,&\n45259,&\n45263,&\n45281,&\n45289,&\n45293,&\n45307,&\n45317,&\n45319,&\n45329,&\n45337,&\n45341,&\n45343,&\n45361,&\n45377,&\n45389,&\n45403,&\n45413,&\n45427,&\n45433,&\n45439,&\n45481,&\n45491,&\n45497,&\n45503,&\n45523,&\n45533,&\n45541,&\n45553,&\n45557,&\n45569,&\n45587,&\n45589,&\n45599,&\n45613,&\n45631,&\n45641,&\n45659,&\n45667,&\n45673,&\n45677,&\n45691,&\n45697,&\n45707,&\n45737,&\n45751,&\n45757,&\n45763,&\n45767,&\n45779,&\n45817,&\n45821,&\n45823,&\n45827,&\n45833,&\n45841,&\n45853,&\n45863,&\n45869,&\n45887,&\n45893,&\n45943,&\n45949,&\n45953,&\n45959,&\n45971,&\n45979,&\n45989,&\n46021,&\n46027,&\n46049,&\n46051,&\n46061,&\n46073,&\n46091,&\n46093,&\n46099,&\n46103,&\n46133,&\n46141,&\n46147,&\n46153,&\n46171,&\n46181,&\n46183,&\n46187,&\n46199,&\n46219,&\n46229,&\n46237,&\n46261,&\n46271,&\n46273,&\n46279,&\n46301,&\n46307,&\n46309,&\n46327,&\n46337,&\n46349,&\n46351,&\n46381,&\n46399,&\n46411,&\n46439,&\n46441,&\n46447,&\n46451,&\n46457,&\n46471,&\n46477,&\n46489,&\n46499,&\n46507,&\n46511,&\n46523,&\n46549,&\n46559,&\n46567,&\n46573,&\n46589,&\n46591,&\n46601,&\n46619,&\n46633,&\n46639,&\n46643,&\n46649,&\n46663,&\n46679,&\n46681,&\n46687,&\n46691,&\n46703,&\n46723,&\n46727,&\n46747,&\n46751,&\n46757,&\n46769,&\n46771,&\n46807,&\n46811,&\n46817,&\n46819,&\n46829,&\n46831,&\n46853,&\n46861,&\n46867,&\n46877,&\n46889,&\n46901,&\n46919,&\n46933,&\n46957,&\n46993,&\n46997,&\n47017,&\n47041,&\n47051,&\n47057,&\n47059,&\n47087,&\n47093,&\n47111,&\n47119,&\n47123,&\n47129,&\n47137,&\n47143,&\n47147,&\n47149,&\n47161,&\n47189,&\n47207,&\n47221,&\n47237,&\n47251,&\n47269,&\n47279,&\n47287,&\n47293,&\n47297,&\n47303,&\n47309,&\n47317,&\n47339,&\n47351,&\n47353,&\n47363,&\n47381,&\n47387,&\n47389,&\n47407,&\n47417,&\n47419,&\n47431,&\n47441,&\n47459,&\n47491,&\n47497,&\n47501,&\n47507,&\n47513,&\n47521,&\n47527,&\n47533,&\n47543,&\n47563,&\n47569,&\n47581,&\n47591,&\n47599,&\n47609,&\n47623,&\n47629,&\n47639,&\n47653,&\n47657,&\n47659,&\n47681,&\n47699,&\n47701,&\n47711,&\n47713,&\n47717,&\n47737,&\n47741,&\n47743,&\n47777,&\n47779,&\n47791,&\n47797,&\n47807,&\n47809,&\n47819,&\n47837,&\n47843,&\n47857,&\n47869,&\n47881,&\n47903,&\n47911,&\n47917,&\n47933,&\n47939,&\n47947,&\n47951,&\n47963,&\n47969,&\n47977,&\n47981,&\n48017,&\n48023,&\n48029,&\n48049,&\n48073,&\n48079,&\n48091,&\n48109,&\n48119,&\n48121,&\n48131,&\n48157,&\n48163,&\n48179,&\n48187,&\n48193,&\n48197,&\n48221,&\n48239,&\n48247,&\n48259,&\n48271,&\n48281,&\n48299,&\n48311,&\n48313,&\n48337,&\n48341,&\n48353,&\n48371,&\n48383,&\n48397,&\n48407,&\n48409,&\n48413,&\n48437,&\n48449,&\n48463,&\n48473,&\n48479,&\n48481,&\n48487,&\n48491,&\n48497,&\n48523,&\n48527,&\n48533,&\n48539,&\n48541,&\n48563,&\n48571,&\n48589,&\n48593,&\n48611,&\n48619,&\n48623,&\n48647,&\n48649,&\n48661,&\n48673,&\n48677,&\n48679,&\n48731,&\n48733,&\n48751,&\n48757,&\n48761,&\n48767,&\n48779,&\n48781,&\n48787,&\n48799,&\n48809,&\n48817,&\n48821,&\n48823,&\n48847,&\n48857,&\n48859,&\n48869,&\n48871,&\n48883,&\n48889,&\n48907,&\n48947,&\n48953,&\n48973,&\n48989,&\n48991,&\n49003,&\n49009,&\n49019,&\n49031,&\n49033,&\n49037,&\n49043,&\n49057,&\n49069,&\n49081,&\n49103,&\n49109,&\n49117,&\n49121,&\n49123,&\n49139,&\n49157,&\n49169,&\n49171,&\n49177,&\n49193,&\n49199,&\n49201,&\n49207,&\n49211,&\n49223,&\n49253,&\n49261,&\n49277,&\n49279,&\n49297,&\n49307,&\n49331,&\n49333,&\n49339,&\n49363,&\n49367,&\n49369,&\n49391,&\n49393,&\n49409,&\n49411,&\n49417,&\n49429,&\n49433,&\n49451,&\n49459,&\n49463,&\n49477,&\n49481,&\n49499,&\n49523,&\n49529,&\n49531,&\n49537,&\n49547,&\n49549,&\n49559,&\n49597,&\n49603,&\n49613,&\n49627,&\n49633,&\n49639,&\n49663,&\n49667,&\n49669,&\n49681,&\n49697,&\n49711,&\n49727,&\n49739,&\n49741,&\n49747,&\n49757,&\n49783,&\n49787,&\n49789,&\n49801,&\n49807,&\n49811,&\n49823,&\n49831,&\n49843,&\n49853,&\n49871,&\n49877,&\n49891,&\n49919,&\n49921,&\n49927,&\n49937,&\n49939,&\n49943,&\n49957,&\n49991,&\n49993,&\n49999,&\n50021,&\n50023,&\n50033,&\n50047,&\n50051,&\n50053,&\n50069,&\n50077,&\n50087,&\n50093,&\n50101,&\n50111,&\n50119,&\n50123,&\n50129,&\n50131,&\n50147,&\n50153,&\n50159,&\n50177,&\n50207,&\n50221,&\n50227,&\n50231,&\n50261,&\n50263,&\n50273,&\n50287,&\n50291,&\n50311,&\n50321,&\n50329,&\n50333,&\n50341,&\n50359,&\n50363,&\n50377,&\n50383,&\n50387,&\n50411,&\n50417,&\n50423,&\n50441,&\n50459,&\n50461,&\n50497,&\n50503,&\n50513,&\n50527,&\n50539,&\n50543,&\n50549,&\n50551,&\n50581,&\n50587,&\n50591,&\n50593,&\n50599,&\n50627,&\n50647,&\n50651,&\n50671,&\n50683,&\n50707,&\n50723,&\n50741,&\n50753,&\n50767,&\n50773,&\n50777,&\n50789,&\n50821,&\n50833,&\n50839,&\n50849,&\n50857,&\n50867,&\n50873,&\n50891,&\n50893,&\n50909,&\n50923,&\n50929,&\n50951,&\n50957,&\n50969,&\n50971,&\n50989,&\n50993,&\n51001,&\n51031,&\n51043,&\n51047,&\n51059,&\n51061,&\n51071,&\n51109,&\n51131,&\n51133,&\n51137,&\n51151,&\n51157,&\n51169,&\n51193,&\n51197,&\n51199,&\n51203,&\n51217,&\n51229,&\n51239,&\n51241,&\n51257,&\n51263,&\n51283,&\n51287,&\n51307,&\n51329,&\n51341,&\n51343,&\n51347,&\n51349,&\n51361,&\n51383,&\n51407,&\n51413,&\n51419,&\n51421,&\n51427,&\n51431,&\n51437,&\n51439,&\n51449,&\n51461,&\n51473,&\n51479,&\n51481,&\n51487,&\n51503,&\n51511,&\n51517,&\n51521,&\n51539,&\n51551,&\n51563,&\n51577,&\n51581,&\n51593,&\n51599,&\n51607,&\n51613,&\n51631,&\n51637,&\n51647,&\n51659,&\n51673,&\n51679,&\n51683,&\n51691,&\n51713,&\n51719,&\n51721,&\n51749,&\n51767,&\n51769,&\n51787,&\n51797,&\n51803,&\n51817,&\n51827,&\n51829,&\n51839,&\n51853,&\n51859,&\n51869,&\n51871,&\n51893,&\n51899,&\n51907,&\n51913,&\n51929,&\n51941,&\n51949,&\n51971,&\n51973,&\n51977,&\n51991,&\n52009,&\n52021,&\n52027,&\n52051,&\n52057,&\n52067,&\n52069,&\n52081,&\n52103,&\n52121,&\n52127,&\n52147,&\n52153,&\n52163,&\n52177,&\n52181,&\n52183,&\n52189,&\n52201,&\n52223,&\n52237,&\n52249,&\n52253,&\n52259,&\n52267,&\n52289,&\n52291,&\n52301,&\n52313,&\n52321,&\n52361,&\n52363,&\n52369,&\n52379,&\n52387,&\n52391,&\n52433,&\n52453,&\n52457,&\n52489,&\n52501,&\n52511,&\n52517,&\n52529,&\n52541,&\n52543,&\n52553,&\n52561,&\n52567,&\n52571,&\n52579,&\n52583,&\n52609,&\n52627,&\n52631,&\n52639,&\n52667,&\n52673,&\n52691,&\n52697,&\n52709,&\n52711,&\n52721,&\n52727,&\n52733,&\n52747,&\n52757,&\n52769,&\n52783,&\n52807,&\n52813,&\n52817,&\n52837,&\n52859,&\n52861,&\n52879,&\n52883,&\n52889,&\n52901,&\n52903,&\n52919,&\n52937,&\n52951,&\n52957,&\n52963,&\n52967,&\n52973,&\n52981,&\n52999,&\n53003,&\n53017,&\n53047,&\n53051,&\n53069,&\n53077,&\n53087,&\n53089,&\n53093,&\n53101,&\n53113,&\n53117,&\n53129,&\n53147,&\n53149,&\n53161,&\n53171,&\n53173,&\n53189,&\n53197,&\n53201,&\n53231,&\n53233,&\n53239,&\n53267,&\n53269,&\n53279,&\n53281,&\n53299,&\n53309,&\n53323,&\n53327,&\n53353,&\n53359,&\n53377,&\n53381,&\n53401,&\n53407,&\n53411,&\n53419,&\n53437,&\n53441,&\n53453,&\n53479,&\n53503,&\n53507,&\n53527,&\n53549,&\n53551,&\n53569,&\n53591,&\n53593,&\n53597,&\n53609,&\n53611,&\n53617,&\n53623,&\n53629,&\n53633,&\n53639,&\n53653,&\n53657,&\n53681,&\n53693,&\n53699,&\n53717,&\n53719,&\n53731,&\n53759,&\n53773,&\n53777,&\n53783,&\n53791,&\n53813,&\n53819,&\n53831,&\n53849,&\n53857,&\n53861,&\n53881,&\n53887,&\n53891,&\n53897,&\n53899,&\n53917,&\n53923,&\n53927,&\n53939,&\n53951,&\n53959,&\n53987,&\n53993,&\n54001,&\n54011,&\n54013,&\n54037,&\n54049,&\n54059,&\n54083,&\n54091,&\n54101,&\n54121,&\n54133,&\n54139,&\n54151,&\n54163,&\n54167,&\n54181,&\n54193,&\n54217,&\n54251,&\n54269,&\n54277,&\n54287,&\n54293,&\n54311,&\n54319,&\n54323,&\n54331,&\n54347,&\n54361,&\n54367,&\n54371,&\n54377,&\n54401,&\n54403,&\n54409,&\n54413,&\n54419,&\n54421,&\n54437,&\n54443,&\n54449,&\n54469,&\n54493,&\n54497,&\n54499,&\n54503,&\n54517,&\n54521,&\n54539,&\n54541,&\n54547,&\n54559,&\n54563,&\n54577,&\n54581,&\n54583,&\n54601,&\n54617,&\n54623,&\n54629,&\n54631,&\n54647,&\n54667,&\n54673,&\n54679,&\n54709,&\n54713,&\n54721,&\n54727,&\n54751,&\n54767,&\n54773,&\n54779,&\n54787,&\n54799,&\n54829,&\n54833,&\n54851,&\n54869,&\n54877,&\n54881,&\n54907,&\n54917,&\n54919,&\n54941,&\n54949,&\n54959,&\n54973,&\n54979,&\n54983,&\n55001,&\n55009,&\n55021,&\n55049,&\n55051,&\n55057,&\n55061,&\n55073,&\n55079,&\n55103,&\n55109,&\n55117,&\n55127,&\n55147,&\n55163,&\n55171,&\n55201,&\n55207,&\n55213,&\n55217,&\n55219,&\n55229,&\n55243,&\n55249,&\n55259,&\n55291,&\n55313,&\n55331,&\n55333,&\n55337,&\n55339,&\n55343,&\n55351,&\n55373,&\n55381,&\n55399,&\n55411,&\n55439,&\n55441,&\n55457,&\n55469,&\n55487,&\n55501,&\n55511,&\n55529,&\n55541,&\n55547,&\n55579,&\n55589,&\n55603,&\n55609,&\n55619,&\n55621,&\n55631,&\n55633,&\n55639,&\n55661,&\n55663,&\n55667,&\n55673,&\n55681,&\n55691,&\n55697,&\n55711,&\n55717,&\n55721,&\n55733,&\n55763,&\n55787,&\n55793,&\n55799,&\n55807,&\n55813,&\n55817,&\n55819,&\n55823,&\n55829,&\n55837,&\n55843,&\n55849,&\n55871,&\n55889,&\n55897,&\n55901,&\n55903,&\n55921,&\n55927,&\n55931,&\n55933,&\n55949,&\n55967,&\n55987,&\n55997,&\n56003,&\n56009,&\n56039,&\n56041,&\n56053,&\n56081,&\n56087,&\n56093,&\n56099,&\n56101,&\n56113,&\n56123,&\n56131,&\n56149,&\n56167,&\n56171&\n/)\n ans = 1\n d = div(i)\n do i = 1,5699\n d = div(i)\n if (mod(A,d)==0 .and. mod(B,d)==0) then\n ans = ans + 1\n end if\n end do\n\n write(*, *) ans\nend program main\n", "language": "Fortran", "metadata": {"date": 1569724774, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02900.html", "problem_id": "p02900", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02900/input.txt", "sample_output_relpath": "derived/input_output/data/p02900/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02900/Fortran/s101970665.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s101970665", "user_id": "u050276949"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n implicit none\n integer(8) i,A,B,ans,d\n integer div(5699)\n read(*, *)A,B\n !read(*, *) (L(i), i = 1,N)\n div = (/2,&\n3,&\n5,&\n7,&\n11,&\n13,&\n17,&\n19,&\n23,&\n29,&\n31,&\n37,&\n41,&\n43,&\n47,&\n53,&\n59,&\n61,&\n67,&\n71,&\n73,&\n79,&\n83,&\n89,&\n97,&\n101,&\n103,&\n107,&\n109,&\n113,&\n127,&\n131,&\n137,&\n139,&\n149,&\n151,&\n157,&\n163,&\n167,&\n173,&\n179,&\n181,&\n191,&\n193,&\n197,&\n199,&\n211,&\n223,&\n227,&\n229,&\n233,&\n239,&\n241,&\n251,&\n257,&\n263,&\n269,&\n271,&\n277,&\n281,&\n283,&\n293,&\n307,&\n311,&\n313,&\n317,&\n331,&\n337,&\n347,&\n349,&\n353,&\n359,&\n367,&\n373,&\n379,&\n383,&\n389,&\n397,&\n401,&\n409,&\n419,&\n421,&\n431,&\n433,&\n439,&\n443,&\n449,&\n457,&\n461,&\n463,&\n467,&\n479,&\n487,&\n491,&\n499,&\n503,&\n509,&\n521,&\n523,&\n541,&\n547,&\n557,&\n563,&\n569,&\n571,&\n577,&\n587,&\n593,&\n599,&\n601,&\n607,&\n613,&\n617,&\n619,&\n631,&\n641,&\n643,&\n647,&\n653,&\n659,&\n661,&\n673,&\n677,&\n683,&\n691,&\n701,&\n709,&\n719,&\n727,&\n733,&\n739,&\n743,&\n751,&\n757,&\n761,&\n769,&\n773,&\n787,&\n797,&\n809,&\n811,&\n821,&\n823,&\n827,&\n829,&\n839,&\n853,&\n857,&\n859,&\n863,&\n877,&\n881,&\n883,&\n887,&\n907,&\n911,&\n919,&\n929,&\n937,&\n941,&\n947,&\n953,&\n967,&\n971,&\n977,&\n983,&\n991,&\n997,&\n1009,&\n1013,&\n1019,&\n1021,&\n1031,&\n1033,&\n1039,&\n1049,&\n1051,&\n1061,&\n1063,&\n1069,&\n1087,&\n1091,&\n1093,&\n1097,&\n1103,&\n1109,&\n1117,&\n1123,&\n1129,&\n1151,&\n1153,&\n1163,&\n1171,&\n1181,&\n1187,&\n1193,&\n1201,&\n1213,&\n1217,&\n1223,&\n1229,&\n1231,&\n1237,&\n1249,&\n1259,&\n1277,&\n1279,&\n1283,&\n1289,&\n1291,&\n1297,&\n1301,&\n1303,&\n1307,&\n1319,&\n1321,&\n1327,&\n1361,&\n1367,&\n1373,&\n1381,&\n1399,&\n1409,&\n1423,&\n1427,&\n1429,&\n1433,&\n1439,&\n1447,&\n1451,&\n1453,&\n1459,&\n1471,&\n1481,&\n1483,&\n1487,&\n1489,&\n1493,&\n1499,&\n1511,&\n1523,&\n1531,&\n1543,&\n1549,&\n1553,&\n1559,&\n1567,&\n1571,&\n1579,&\n1583,&\n1597,&\n1601,&\n1607,&\n1609,&\n1613,&\n1619,&\n1621,&\n1627,&\n1637,&\n1657,&\n1663,&\n1667,&\n1669,&\n1693,&\n1697,&\n1699,&\n1709,&\n1721,&\n1723,&\n1733,&\n1741,&\n1747,&\n1753,&\n1759,&\n1777,&\n1783,&\n1787,&\n1789,&\n1801,&\n1811,&\n1823,&\n1831,&\n1847,&\n1861,&\n1867,&\n1871,&\n1873,&\n1877,&\n1879,&\n1889,&\n1901,&\n1907,&\n1913,&\n1931,&\n1933,&\n1949,&\n1951,&\n1973,&\n1979,&\n1987,&\n1993,&\n1997,&\n1999,&\n2003,&\n2011,&\n2017,&\n2027,&\n2029,&\n2039,&\n2053,&\n2063,&\n2069,&\n2081,&\n2083,&\n2087,&\n2089,&\n2099,&\n2111,&\n2113,&\n2129,&\n2131,&\n2137,&\n2141,&\n2143,&\n2153,&\n2161,&\n2179,&\n2203,&\n2207,&\n2213,&\n2221,&\n2237,&\n2239,&\n2243,&\n2251,&\n2267,&\n2269,&\n2273,&\n2281,&\n2287,&\n2293,&\n2297,&\n2309,&\n2311,&\n2333,&\n2339,&\n2341,&\n2347,&\n2351,&\n2357,&\n2371,&\n2377,&\n2381,&\n2383,&\n2389,&\n2393,&\n2399,&\n2411,&\n2417,&\n2423,&\n2437,&\n2441,&\n2447,&\n2459,&\n2467,&\n2473,&\n2477,&\n2503,&\n2521,&\n2531,&\n2539,&\n2543,&\n2549,&\n2551,&\n2557,&\n2579,&\n2591,&\n2593,&\n2609,&\n2617,&\n2621,&\n2633,&\n2647,&\n2657,&\n2659,&\n2663,&\n2671,&\n2677,&\n2683,&\n2687,&\n2689,&\n2693,&\n2699,&\n2707,&\n2711,&\n2713,&\n2719,&\n2729,&\n2731,&\n2741,&\n2749,&\n2753,&\n2767,&\n2777,&\n2789,&\n2791,&\n2797,&\n2801,&\n2803,&\n2819,&\n2833,&\n2837,&\n2843,&\n2851,&\n2857,&\n2861,&\n2879,&\n2887,&\n2897,&\n2903,&\n2909,&\n2917,&\n2927,&\n2939,&\n2953,&\n2957,&\n2963,&\n2969,&\n2971,&\n2999,&\n3001,&\n3011,&\n3019,&\n3023,&\n3037,&\n3041,&\n3049,&\n3061,&\n3067,&\n3079,&\n3083,&\n3089,&\n3109,&\n3119,&\n3121,&\n3137,&\n3163,&\n3167,&\n3169,&\n3181,&\n3187,&\n3191,&\n3203,&\n3209,&\n3217,&\n3221,&\n3229,&\n3251,&\n3253,&\n3257,&\n3259,&\n3271,&\n3299,&\n3301,&\n3307,&\n3313,&\n3319,&\n3323,&\n3329,&\n3331,&\n3343,&\n3347,&\n3359,&\n3361,&\n3371,&\n3373,&\n3389,&\n3391,&\n3407,&\n3413,&\n3433,&\n3449,&\n3457,&\n3461,&\n3463,&\n3467,&\n3469,&\n3491,&\n3499,&\n3511,&\n3517,&\n3527,&\n3529,&\n3533,&\n3539,&\n3541,&\n3547,&\n3557,&\n3559,&\n3571,&\n3581,&\n3583,&\n3593,&\n3607,&\n3613,&\n3617,&\n3623,&\n3631,&\n3637,&\n3643,&\n3659,&\n3671,&\n3673,&\n3677,&\n3691,&\n3697,&\n3701,&\n3709,&\n3719,&\n3727,&\n3733,&\n3739,&\n3761,&\n3767,&\n3769,&\n3779,&\n3793,&\n3797,&\n3803,&\n3821,&\n3823,&\n3833,&\n3847,&\n3851,&\n3853,&\n3863,&\n3877,&\n3881,&\n3889,&\n3907,&\n3911,&\n3917,&\n3919,&\n3923,&\n3929,&\n3931,&\n3943,&\n3947,&\n3967,&\n3989,&\n4001,&\n4003,&\n4007,&\n4013,&\n4019,&\n4021,&\n4027,&\n4049,&\n4051,&\n4057,&\n4073,&\n4079,&\n4091,&\n4093,&\n4099,&\n4111,&\n4127,&\n4129,&\n4133,&\n4139,&\n4153,&\n4157,&\n4159,&\n4177,&\n4201,&\n4211,&\n4217,&\n4219,&\n4229,&\n4231,&\n4241,&\n4243,&\n4253,&\n4259,&\n4261,&\n4271,&\n4273,&\n4283,&\n4289,&\n4297,&\n4327,&\n4337,&\n4339,&\n4349,&\n4357,&\n4363,&\n4373,&\n4391,&\n4397,&\n4409,&\n4421,&\n4423,&\n4441,&\n4447,&\n4451,&\n4457,&\n4463,&\n4481,&\n4483,&\n4493,&\n4507,&\n4513,&\n4517,&\n4519,&\n4523,&\n4547,&\n4549,&\n4561,&\n4567,&\n4583,&\n4591,&\n4597,&\n4603,&\n4621,&\n4637,&\n4639,&\n4643,&\n4649,&\n4651,&\n4657,&\n4663,&\n4673,&\n4679,&\n4691,&\n4703,&\n4721,&\n4723,&\n4729,&\n4733,&\n4751,&\n4759,&\n4783,&\n4787,&\n4789,&\n4793,&\n4799,&\n4801,&\n4813,&\n4817,&\n4831,&\n4861,&\n4871,&\n4877,&\n4889,&\n4903,&\n4909,&\n4919,&\n4931,&\n4933,&\n4937,&\n4943,&\n4951,&\n4957,&\n4967,&\n4969,&\n4973,&\n4987,&\n4993,&\n4999,&\n5003,&\n5009,&\n5011,&\n5021,&\n5023,&\n5039,&\n5051,&\n5059,&\n5077,&\n5081,&\n5087,&\n5099,&\n5101,&\n5107,&\n5113,&\n5119,&\n5147,&\n5153,&\n5167,&\n5171,&\n5179,&\n5189,&\n5197,&\n5209,&\n5227,&\n5231,&\n5233,&\n5237,&\n5261,&\n5273,&\n5279,&\n5281,&\n5297,&\n5303,&\n5309,&\n5323,&\n5333,&\n5347,&\n5351,&\n5381,&\n5387,&\n5393,&\n5399,&\n5407,&\n5413,&\n5417,&\n5419,&\n5431,&\n5437,&\n5441,&\n5443,&\n5449,&\n5471,&\n5477,&\n5479,&\n5483,&\n5501,&\n5503,&\n5507,&\n5519,&\n5521,&\n5527,&\n5531,&\n5557,&\n5563,&\n5569,&\n5573,&\n5581,&\n5591,&\n5623,&\n5639,&\n5641,&\n5647,&\n5651,&\n5653,&\n5657,&\n5659,&\n5669,&\n5683,&\n5689,&\n5693,&\n5701,&\n5711,&\n5717,&\n5737,&\n5741,&\n5743,&\n5749,&\n5779,&\n5783,&\n5791,&\n5801,&\n5807,&\n5813,&\n5821,&\n5827,&\n5839,&\n5843,&\n5849,&\n5851,&\n5857,&\n5861,&\n5867,&\n5869,&\n5879,&\n5881,&\n5897,&\n5903,&\n5923,&\n5927,&\n5939,&\n5953,&\n5981,&\n5987,&\n6007,&\n6011,&\n6029,&\n6037,&\n6043,&\n6047,&\n6053,&\n6067,&\n6073,&\n6079,&\n6089,&\n6091,&\n6101,&\n6113,&\n6121,&\n6131,&\n6133,&\n6143,&\n6151,&\n6163,&\n6173,&\n6197,&\n6199,&\n6203,&\n6211,&\n6217,&\n6221,&\n6229,&\n6247,&\n6257,&\n6263,&\n6269,&\n6271,&\n6277,&\n6287,&\n6299,&\n6301,&\n6311,&\n6317,&\n6323,&\n6329,&\n6337,&\n6343,&\n6353,&\n6359,&\n6361,&\n6367,&\n6373,&\n6379,&\n6389,&\n6397,&\n6421,&\n6427,&\n6449,&\n6451,&\n6469,&\n6473,&\n6481,&\n6491,&\n6521,&\n6529,&\n6547,&\n6551,&\n6553,&\n6563,&\n6569,&\n6571,&\n6577,&\n6581,&\n6599,&\n6607,&\n6619,&\n6637,&\n6653,&\n6659,&\n6661,&\n6673,&\n6679,&\n6689,&\n6691,&\n6701,&\n6703,&\n6709,&\n6719,&\n6733,&\n6737,&\n6761,&\n6763,&\n6779,&\n6781,&\n6791,&\n6793,&\n6803,&\n6823,&\n6827,&\n6829,&\n6833,&\n6841,&\n6857,&\n6863,&\n6869,&\n6871,&\n6883,&\n6899,&\n6907,&\n6911,&\n6917,&\n6947,&\n6949,&\n6959,&\n6961,&\n6967,&\n6971,&\n6977,&\n6983,&\n6991,&\n6997,&\n7001,&\n7013,&\n7019,&\n7027,&\n7039,&\n7043,&\n7057,&\n7069,&\n7079,&\n7103,&\n7109,&\n7121,&\n7127,&\n7129,&\n7151,&\n7159,&\n7177,&\n7187,&\n7193,&\n7207,&\n7211,&\n7213,&\n7219,&\n7229,&\n7237,&\n7243,&\n7247,&\n7253,&\n7283,&\n7297,&\n7307,&\n7309,&\n7321,&\n7331,&\n7333,&\n7349,&\n7351,&\n7369,&\n7393,&\n7411,&\n7417,&\n7433,&\n7451,&\n7457,&\n7459,&\n7477,&\n7481,&\n7487,&\n7489,&\n7499,&\n7507,&\n7517,&\n7523,&\n7529,&\n7537,&\n7541,&\n7547,&\n7549,&\n7559,&\n7561,&\n7573,&\n7577,&\n7583,&\n7589,&\n7591,&\n7603,&\n7607,&\n7621,&\n7639,&\n7643,&\n7649,&\n7669,&\n7673,&\n7681,&\n7687,&\n7691,&\n7699,&\n7703,&\n7717,&\n7723,&\n7727,&\n7741,&\n7753,&\n7757,&\n7759,&\n7789,&\n7793,&\n7817,&\n7823,&\n7829,&\n7841,&\n7853,&\n7867,&\n7873,&\n7877,&\n7879,&\n7883,&\n7901,&\n7907,&\n7919,&\n7927,&\n7933,&\n7937,&\n7949,&\n7951,&\n7963,&\n7993,&\n8009,&\n8011,&\n8017,&\n8039,&\n8053,&\n8059,&\n8069,&\n8081,&\n8087,&\n8089,&\n8093,&\n8101,&\n8111,&\n8117,&\n8123,&\n8147,&\n8161,&\n8167,&\n8171,&\n8179,&\n8191,&\n8209,&\n8219,&\n8221,&\n8231,&\n8233,&\n8237,&\n8243,&\n8263,&\n8269,&\n8273,&\n8287,&\n8291,&\n8293,&\n8297,&\n8311,&\n8317,&\n8329,&\n8353,&\n8363,&\n8369,&\n8377,&\n8387,&\n8389,&\n8419,&\n8423,&\n8429,&\n8431,&\n8443,&\n8447,&\n8461,&\n8467,&\n8501,&\n8513,&\n8521,&\n8527,&\n8537,&\n8539,&\n8543,&\n8563,&\n8573,&\n8581,&\n8597,&\n8599,&\n8609,&\n8623,&\n8627,&\n8629,&\n8641,&\n8647,&\n8663,&\n8669,&\n8677,&\n8681,&\n8689,&\n8693,&\n8699,&\n8707,&\n8713,&\n8719,&\n8731,&\n8737,&\n8741,&\n8747,&\n8753,&\n8761,&\n8779,&\n8783,&\n8803,&\n8807,&\n8819,&\n8821,&\n8831,&\n8837,&\n8839,&\n8849,&\n8861,&\n8863,&\n8867,&\n8887,&\n8893,&\n8923,&\n8929,&\n8933,&\n8941,&\n8951,&\n8963,&\n8969,&\n8971,&\n8999,&\n9001,&\n9007,&\n9011,&\n9013,&\n9029,&\n9041,&\n9043,&\n9049,&\n9059,&\n9067,&\n9091,&\n9103,&\n9109,&\n9127,&\n9133,&\n9137,&\n9151,&\n9157,&\n9161,&\n9173,&\n9181,&\n9187,&\n9199,&\n9203,&\n9209,&\n9221,&\n9227,&\n9239,&\n9241,&\n9257,&\n9277,&\n9281,&\n9283,&\n9293,&\n9311,&\n9319,&\n9323,&\n9337,&\n9341,&\n9343,&\n9349,&\n9371,&\n9377,&\n9391,&\n9397,&\n9403,&\n9413,&\n9419,&\n9421,&\n9431,&\n9433,&\n9437,&\n9439,&\n9461,&\n9463,&\n9467,&\n9473,&\n9479,&\n9491,&\n9497,&\n9511,&\n9521,&\n9533,&\n9539,&\n9547,&\n9551,&\n9587,&\n9601,&\n9613,&\n9619,&\n9623,&\n9629,&\n9631,&\n9643,&\n9649,&\n9661,&\n9677,&\n9679,&\n9689,&\n9697,&\n9719,&\n9721,&\n9733,&\n9739,&\n9743,&\n9749,&\n9767,&\n9769,&\n9781,&\n9787,&\n9791,&\n9803,&\n9811,&\n9817,&\n9829,&\n9833,&\n9839,&\n9851,&\n9857,&\n9859,&\n9871,&\n9883,&\n9887,&\n9901,&\n9907,&\n9923,&\n9929,&\n9931,&\n9941,&\n9949,&\n9967,&\n9973,&\n10007,&\n10009,&\n10037,&\n10039,&\n10061,&\n10067,&\n10069,&\n10079,&\n10091,&\n10093,&\n10099,&\n10103,&\n10111,&\n10133,&\n10139,&\n10141,&\n10151,&\n10159,&\n10163,&\n10169,&\n10177,&\n10181,&\n10193,&\n10211,&\n10223,&\n10243,&\n10247,&\n10253,&\n10259,&\n10267,&\n10271,&\n10273,&\n10289,&\n10301,&\n10303,&\n10313,&\n10321,&\n10331,&\n10333,&\n10337,&\n10343,&\n10357,&\n10369,&\n10391,&\n10399,&\n10427,&\n10429,&\n10433,&\n10453,&\n10457,&\n10459,&\n10463,&\n10477,&\n10487,&\n10499,&\n10501,&\n10513,&\n10529,&\n10531,&\n10559,&\n10567,&\n10589,&\n10597,&\n10601,&\n10607,&\n10613,&\n10627,&\n10631,&\n10639,&\n10651,&\n10657,&\n10663,&\n10667,&\n10687,&\n10691,&\n10709,&\n10711,&\n10723,&\n10729,&\n10733,&\n10739,&\n10753,&\n10771,&\n10781,&\n10789,&\n10799,&\n10831,&\n10837,&\n10847,&\n10853,&\n10859,&\n10861,&\n10867,&\n10883,&\n10889,&\n10891,&\n10903,&\n10909,&\n10937,&\n10939,&\n10949,&\n10957,&\n10973,&\n10979,&\n10987,&\n10993,&\n11003,&\n11027,&\n11047,&\n11057,&\n11059,&\n11069,&\n11071,&\n11083,&\n11087,&\n11093,&\n11113,&\n11117,&\n11119,&\n11131,&\n11149,&\n11159,&\n11161,&\n11171,&\n11173,&\n11177,&\n11197,&\n11213,&\n11239,&\n11243,&\n11251,&\n11257,&\n11261,&\n11273,&\n11279,&\n11287,&\n11299,&\n11311,&\n11317,&\n11321,&\n11329,&\n11351,&\n11353,&\n11369,&\n11383,&\n11393,&\n11399,&\n11411,&\n11423,&\n11437,&\n11443,&\n11447,&\n11467,&\n11471,&\n11483,&\n11489,&\n11491,&\n11497,&\n11503,&\n11519,&\n11527,&\n11549,&\n11551,&\n11579,&\n11587,&\n11593,&\n11597,&\n11617,&\n11621,&\n11633,&\n11657,&\n11677,&\n11681,&\n11689,&\n11699,&\n11701,&\n11717,&\n11719,&\n11731,&\n11743,&\n11777,&\n11779,&\n11783,&\n11789,&\n11801,&\n11807,&\n11813,&\n11821,&\n11827,&\n11831,&\n11833,&\n11839,&\n11863,&\n11867,&\n11887,&\n11897,&\n11903,&\n11909,&\n11923,&\n11927,&\n11933,&\n11939,&\n11941,&\n11953,&\n11959,&\n11969,&\n11971,&\n11981,&\n11987,&\n12007,&\n12011,&\n12037,&\n12041,&\n12043,&\n12049,&\n12071,&\n12073,&\n12097,&\n12101,&\n12107,&\n12109,&\n12113,&\n12119,&\n12143,&\n12149,&\n12157,&\n12161,&\n12163,&\n12197,&\n12203,&\n12211,&\n12227,&\n12239,&\n12241,&\n12251,&\n12253,&\n12263,&\n12269,&\n12277,&\n12281,&\n12289,&\n12301,&\n12323,&\n12329,&\n12343,&\n12347,&\n12373,&\n12377,&\n12379,&\n12391,&\n12401,&\n12409,&\n12413,&\n12421,&\n12433,&\n12437,&\n12451,&\n12457,&\n12473,&\n12479,&\n12487,&\n12491,&\n12497,&\n12503,&\n12511,&\n12517,&\n12527,&\n12539,&\n12541,&\n12547,&\n12553,&\n12569,&\n12577,&\n12583,&\n12589,&\n12601,&\n12611,&\n12613,&\n12619,&\n12637,&\n12641,&\n12647,&\n12653,&\n12659,&\n12671,&\n12689,&\n12697,&\n12703,&\n12713,&\n12721,&\n12739,&\n12743,&\n12757,&\n12763,&\n12781,&\n12791,&\n12799,&\n12809,&\n12821,&\n12823,&\n12829,&\n12841,&\n12853,&\n12889,&\n12893,&\n12899,&\n12907,&\n12911,&\n12917,&\n12919,&\n12923,&\n12941,&\n12953,&\n12959,&\n12967,&\n12973,&\n12979,&\n12983,&\n13001,&\n13003,&\n13007,&\n13009,&\n13033,&\n13037,&\n13043,&\n13049,&\n13063,&\n13093,&\n13099,&\n13103,&\n13109,&\n13121,&\n13127,&\n13147,&\n13151,&\n13159,&\n13163,&\n13171,&\n13177,&\n13183,&\n13187,&\n13217,&\n13219,&\n13229,&\n13241,&\n13249,&\n13259,&\n13267,&\n13291,&\n13297,&\n13309,&\n13313,&\n13327,&\n13331,&\n13337,&\n13339,&\n13367,&\n13381,&\n13397,&\n13399,&\n13411,&\n13417,&\n13421,&\n13441,&\n13451,&\n13457,&\n13463,&\n13469,&\n13477,&\n13487,&\n13499,&\n13513,&\n13523,&\n13537,&\n13553,&\n13567,&\n13577,&\n13591,&\n13597,&\n13613,&\n13619,&\n13627,&\n13633,&\n13649,&\n13669,&\n13679,&\n13681,&\n13687,&\n13691,&\n13693,&\n13697,&\n13709,&\n13711,&\n13721,&\n13723,&\n13729,&\n13751,&\n13757,&\n13759,&\n13763,&\n13781,&\n13789,&\n13799,&\n13807,&\n13829,&\n13831,&\n13841,&\n13859,&\n13873,&\n13877,&\n13879,&\n13883,&\n13901,&\n13903,&\n13907,&\n13913,&\n13921,&\n13931,&\n13933,&\n13963,&\n13967,&\n13997,&\n13999,&\n14009,&\n14011,&\n14029,&\n14033,&\n14051,&\n14057,&\n14071,&\n14081,&\n14083,&\n14087,&\n14107,&\n14143,&\n14149,&\n14153,&\n14159,&\n14173,&\n14177,&\n14197,&\n14207,&\n14221,&\n14243,&\n14249,&\n14251,&\n14281,&\n14293,&\n14303,&\n14321,&\n14323,&\n14327,&\n14341,&\n14347,&\n14369,&\n14387,&\n14389,&\n14401,&\n14407,&\n14411,&\n14419,&\n14423,&\n14431,&\n14437,&\n14447,&\n14449,&\n14461,&\n14479,&\n14489,&\n14503,&\n14519,&\n14533,&\n14537,&\n14543,&\n14549,&\n14551,&\n14557,&\n14561,&\n14563,&\n14591,&\n14593,&\n14621,&\n14627,&\n14629,&\n14633,&\n14639,&\n14653,&\n14657,&\n14669,&\n14683,&\n14699,&\n14713,&\n14717,&\n14723,&\n14731,&\n14737,&\n14741,&\n14747,&\n14753,&\n14759,&\n14767,&\n14771,&\n14779,&\n14783,&\n14797,&\n14813,&\n14821,&\n14827,&\n14831,&\n14843,&\n14851,&\n14867,&\n14869,&\n14879,&\n14887,&\n14891,&\n14897,&\n14923,&\n14929,&\n14939,&\n14947,&\n14951,&\n14957,&\n14969,&\n14983,&\n15013,&\n15017,&\n15031,&\n15053,&\n15061,&\n15073,&\n15077,&\n15083,&\n15091,&\n15101,&\n15107,&\n15121,&\n15131,&\n15137,&\n15139,&\n15149,&\n15161,&\n15173,&\n15187,&\n15193,&\n15199,&\n15217,&\n15227,&\n15233,&\n15241,&\n15259,&\n15263,&\n15269,&\n15271,&\n15277,&\n15287,&\n15289,&\n15299,&\n15307,&\n15313,&\n15319,&\n15329,&\n15331,&\n15349,&\n15359,&\n15361,&\n15373,&\n15377,&\n15383,&\n15391,&\n15401,&\n15413,&\n15427,&\n15439,&\n15443,&\n15451,&\n15461,&\n15467,&\n15473,&\n15493,&\n15497,&\n15511,&\n15527,&\n15541,&\n15551,&\n15559,&\n15569,&\n15581,&\n15583,&\n15601,&\n15607,&\n15619,&\n15629,&\n15641,&\n15643,&\n15647,&\n15649,&\n15661,&\n15667,&\n15671,&\n15679,&\n15683,&\n15727,&\n15731,&\n15733,&\n15737,&\n15739,&\n15749,&\n15761,&\n15767,&\n15773,&\n15787,&\n15791,&\n15797,&\n15803,&\n15809,&\n15817,&\n15823,&\n15859,&\n15877,&\n15881,&\n15887,&\n15889,&\n15901,&\n15907,&\n15913,&\n15919,&\n15923,&\n15937,&\n15959,&\n15971,&\n15973,&\n15991,&\n16001,&\n16007,&\n16033,&\n16057,&\n16061,&\n16063,&\n16067,&\n16069,&\n16073,&\n16087,&\n16091,&\n16097,&\n16103,&\n16111,&\n16127,&\n16139,&\n16141,&\n16183,&\n16187,&\n16189,&\n16193,&\n16217,&\n16223,&\n16229,&\n16231,&\n16249,&\n16253,&\n16267,&\n16273,&\n16301,&\n16319,&\n16333,&\n16339,&\n16349,&\n16361,&\n16363,&\n16369,&\n16381,&\n16411,&\n16417,&\n16421,&\n16427,&\n16433,&\n16447,&\n16451,&\n16453,&\n16477,&\n16481,&\n16487,&\n16493,&\n16519,&\n16529,&\n16547,&\n16553,&\n16561,&\n16567,&\n16573,&\n16603,&\n16607,&\n16619,&\n16631,&\n16633,&\n16649,&\n16651,&\n16657,&\n16661,&\n16673,&\n16691,&\n16693,&\n16699,&\n16703,&\n16729,&\n16741,&\n16747,&\n16759,&\n16763,&\n16787,&\n16811,&\n16823,&\n16829,&\n16831,&\n16843,&\n16871,&\n16879,&\n16883,&\n16889,&\n16901,&\n16903,&\n16921,&\n16927,&\n16931,&\n16937,&\n16943,&\n16963,&\n16979,&\n16981,&\n16987,&\n16993,&\n17011,&\n17021,&\n17027,&\n17029,&\n17033,&\n17041,&\n17047,&\n17053,&\n17077,&\n17093,&\n17099,&\n17107,&\n17117,&\n17123,&\n17137,&\n17159,&\n17167,&\n17183,&\n17189,&\n17191,&\n17203,&\n17207,&\n17209,&\n17231,&\n17239,&\n17257,&\n17291,&\n17293,&\n17299,&\n17317,&\n17321,&\n17327,&\n17333,&\n17341,&\n17351,&\n17359,&\n17377,&\n17383,&\n17387,&\n17389,&\n17393,&\n17401,&\n17417,&\n17419,&\n17431,&\n17443,&\n17449,&\n17467,&\n17471,&\n17477,&\n17483,&\n17489,&\n17491,&\n17497,&\n17509,&\n17519,&\n17539,&\n17551,&\n17569,&\n17573,&\n17579,&\n17581,&\n17597,&\n17599,&\n17609,&\n17623,&\n17627,&\n17657,&\n17659,&\n17669,&\n17681,&\n17683,&\n17707,&\n17713,&\n17729,&\n17737,&\n17747,&\n17749,&\n17761,&\n17783,&\n17789,&\n17791,&\n17807,&\n17827,&\n17837,&\n17839,&\n17851,&\n17863,&\n17881,&\n17891,&\n17903,&\n17909,&\n17911,&\n17921,&\n17923,&\n17929,&\n17939,&\n17957,&\n17959,&\n17971,&\n17977,&\n17981,&\n17987,&\n17989,&\n18013,&\n18041,&\n18043,&\n18047,&\n18049,&\n18059,&\n18061,&\n18077,&\n18089,&\n18097,&\n18119,&\n18121,&\n18127,&\n18131,&\n18133,&\n18143,&\n18149,&\n18169,&\n18181,&\n18191,&\n18199,&\n18211,&\n18217,&\n18223,&\n18229,&\n18233,&\n18251,&\n18253,&\n18257,&\n18269,&\n18287,&\n18289,&\n18301,&\n18307,&\n18311,&\n18313,&\n18329,&\n18341,&\n18353,&\n18367,&\n18371,&\n18379,&\n18397,&\n18401,&\n18413,&\n18427,&\n18433,&\n18439,&\n18443,&\n18451,&\n18457,&\n18461,&\n18481,&\n18493,&\n18503,&\n18517,&\n18521,&\n18523,&\n18539,&\n18541,&\n18553,&\n18583,&\n18587,&\n18593,&\n18617,&\n18637,&\n18661,&\n18671,&\n18679,&\n18691,&\n18701,&\n18713,&\n18719,&\n18731,&\n18743,&\n18749,&\n18757,&\n18773,&\n18787,&\n18793,&\n18797,&\n18803,&\n18839,&\n18859,&\n18869,&\n18899,&\n18911,&\n18913,&\n18917,&\n18919,&\n18947,&\n18959,&\n18973,&\n18979,&\n19001,&\n19009,&\n19013,&\n19031,&\n19037,&\n19051,&\n19069,&\n19073,&\n19079,&\n19081,&\n19087,&\n19121,&\n19139,&\n19141,&\n19157,&\n19163,&\n19181,&\n19183,&\n19207,&\n19211,&\n19213,&\n19219,&\n19231,&\n19237,&\n19249,&\n19259,&\n19267,&\n19273,&\n19289,&\n19301,&\n19309,&\n19319,&\n19333,&\n19373,&\n19379,&\n19381,&\n19387,&\n19391,&\n19403,&\n19417,&\n19421,&\n19423,&\n19427,&\n19429,&\n19433,&\n19441,&\n19447,&\n19457,&\n19463,&\n19469,&\n19471,&\n19477,&\n19483,&\n19489,&\n19501,&\n19507,&\n19531,&\n19541,&\n19543,&\n19553,&\n19559,&\n19571,&\n19577,&\n19583,&\n19597,&\n19603,&\n19609,&\n19661,&\n19681,&\n19687,&\n19697,&\n19699,&\n19709,&\n19717,&\n19727,&\n19739,&\n19751,&\n19753,&\n19759,&\n19763,&\n19777,&\n19793,&\n19801,&\n19813,&\n19819,&\n19841,&\n19843,&\n19853,&\n19861,&\n19867,&\n19889,&\n19891,&\n19913,&\n19919,&\n19927,&\n19937,&\n19949,&\n19961,&\n19963,&\n19973,&\n19979,&\n19991,&\n19993,&\n19997,&\n20011,&\n20021,&\n20023,&\n20029,&\n20047,&\n20051,&\n20063,&\n20071,&\n20089,&\n20101,&\n20107,&\n20113,&\n20117,&\n20123,&\n20129,&\n20143,&\n20147,&\n20149,&\n20161,&\n20173,&\n20177,&\n20183,&\n20201,&\n20219,&\n20231,&\n20233,&\n20249,&\n20261,&\n20269,&\n20287,&\n20297,&\n20323,&\n20327,&\n20333,&\n20341,&\n20347,&\n20353,&\n20357,&\n20359,&\n20369,&\n20389,&\n20393,&\n20399,&\n20407,&\n20411,&\n20431,&\n20441,&\n20443,&\n20477,&\n20479,&\n20483,&\n20507,&\n20509,&\n20521,&\n20533,&\n20543,&\n20549,&\n20551,&\n20563,&\n20593,&\n20599,&\n20611,&\n20627,&\n20639,&\n20641,&\n20663,&\n20681,&\n20693,&\n20707,&\n20717,&\n20719,&\n20731,&\n20743,&\n20747,&\n20749,&\n20753,&\n20759,&\n20771,&\n20773,&\n20789,&\n20807,&\n20809,&\n20849,&\n20857,&\n20873,&\n20879,&\n20887,&\n20897,&\n20899,&\n20903,&\n20921,&\n20929,&\n20939,&\n20947,&\n20959,&\n20963,&\n20981,&\n20983,&\n21001,&\n21011,&\n21013,&\n21017,&\n21019,&\n21023,&\n21031,&\n21059,&\n21061,&\n21067,&\n21089,&\n21101,&\n21107,&\n21121,&\n21139,&\n21143,&\n21149,&\n21157,&\n21163,&\n21169,&\n21179,&\n21187,&\n21191,&\n21193,&\n21211,&\n21221,&\n21227,&\n21247,&\n21269,&\n21277,&\n21283,&\n21313,&\n21317,&\n21319,&\n21323,&\n21341,&\n21347,&\n21377,&\n21379,&\n21383,&\n21391,&\n21397,&\n21401,&\n21407,&\n21419,&\n21433,&\n21467,&\n21481,&\n21487,&\n21491,&\n21493,&\n21499,&\n21503,&\n21517,&\n21521,&\n21523,&\n21529,&\n21557,&\n21559,&\n21563,&\n21569,&\n21577,&\n21587,&\n21589,&\n21599,&\n21601,&\n21611,&\n21613,&\n21617,&\n21647,&\n21649,&\n21661,&\n21673,&\n21683,&\n21701,&\n21713,&\n21727,&\n21737,&\n21739,&\n21751,&\n21757,&\n21767,&\n21773,&\n21787,&\n21799,&\n21803,&\n21817,&\n21821,&\n21839,&\n21841,&\n21851,&\n21859,&\n21863,&\n21871,&\n21881,&\n21893,&\n21911,&\n21929,&\n21937,&\n21943,&\n21961,&\n21977,&\n21991,&\n21997,&\n22003,&\n22013,&\n22027,&\n22031,&\n22037,&\n22039,&\n22051,&\n22063,&\n22067,&\n22073,&\n22079,&\n22091,&\n22093,&\n22109,&\n22111,&\n22123,&\n22129,&\n22133,&\n22147,&\n22153,&\n22157,&\n22159,&\n22171,&\n22189,&\n22193,&\n22229,&\n22247,&\n22259,&\n22271,&\n22273,&\n22277,&\n22279,&\n22283,&\n22291,&\n22303,&\n22307,&\n22343,&\n22349,&\n22367,&\n22369,&\n22381,&\n22391,&\n22397,&\n22409,&\n22433,&\n22441,&\n22447,&\n22453,&\n22469,&\n22481,&\n22483,&\n22501,&\n22511,&\n22531,&\n22541,&\n22543,&\n22549,&\n22567,&\n22571,&\n22573,&\n22613,&\n22619,&\n22621,&\n22637,&\n22639,&\n22643,&\n22651,&\n22669,&\n22679,&\n22691,&\n22697,&\n22699,&\n22709,&\n22717,&\n22721,&\n22727,&\n22739,&\n22741,&\n22751,&\n22769,&\n22777,&\n22783,&\n22787,&\n22807,&\n22811,&\n22817,&\n22853,&\n22859,&\n22861,&\n22871,&\n22877,&\n22901,&\n22907,&\n22921,&\n22937,&\n22943,&\n22961,&\n22963,&\n22973,&\n22993,&\n23003,&\n23011,&\n23017,&\n23021,&\n23027,&\n23029,&\n23039,&\n23041,&\n23053,&\n23057,&\n23059,&\n23063,&\n23071,&\n23081,&\n23087,&\n23099,&\n23117,&\n23131,&\n23143,&\n23159,&\n23167,&\n23173,&\n23189,&\n23197,&\n23201,&\n23203,&\n23209,&\n23227,&\n23251,&\n23269,&\n23279,&\n23291,&\n23293,&\n23297,&\n23311,&\n23321,&\n23327,&\n23333,&\n23339,&\n23357,&\n23369,&\n23371,&\n23399,&\n23417,&\n23431,&\n23447,&\n23459,&\n23473,&\n23497,&\n23509,&\n23531,&\n23537,&\n23539,&\n23549,&\n23557,&\n23561,&\n23563,&\n23567,&\n23581,&\n23593,&\n23599,&\n23603,&\n23609,&\n23623,&\n23627,&\n23629,&\n23633,&\n23663,&\n23669,&\n23671,&\n23677,&\n23687,&\n23689,&\n23719,&\n23741,&\n23743,&\n23747,&\n23753,&\n23761,&\n23767,&\n23773,&\n23789,&\n23801,&\n23813,&\n23819,&\n23827,&\n23831,&\n23833,&\n23857,&\n23869,&\n23873,&\n23879,&\n23887,&\n23893,&\n23899,&\n23909,&\n23911,&\n23917,&\n23929,&\n23957,&\n23971,&\n23977,&\n23981,&\n23993,&\n24001,&\n24007,&\n24019,&\n24023,&\n24029,&\n24043,&\n24049,&\n24061,&\n24071,&\n24077,&\n24083,&\n24091,&\n24097,&\n24103,&\n24107,&\n24109,&\n24113,&\n24121,&\n24133,&\n24137,&\n24151,&\n24169,&\n24179,&\n24181,&\n24197,&\n24203,&\n24223,&\n24229,&\n24239,&\n24247,&\n24251,&\n24281,&\n24317,&\n24329,&\n24337,&\n24359,&\n24371,&\n24373,&\n24379,&\n24391,&\n24407,&\n24413,&\n24419,&\n24421,&\n24439,&\n24443,&\n24469,&\n24473,&\n24481,&\n24499,&\n24509,&\n24517,&\n24527,&\n24533,&\n24547,&\n24551,&\n24571,&\n24593,&\n24611,&\n24623,&\n24631,&\n24659,&\n24671,&\n24677,&\n24683,&\n24691,&\n24697,&\n24709,&\n24733,&\n24749,&\n24763,&\n24767,&\n24781,&\n24793,&\n24799,&\n24809,&\n24821,&\n24841,&\n24847,&\n24851,&\n24859,&\n24877,&\n24889,&\n24907,&\n24917,&\n24919,&\n24923,&\n24943,&\n24953,&\n24967,&\n24971,&\n24977,&\n24979,&\n24989,&\n25013,&\n25031,&\n25033,&\n25037,&\n25057,&\n25073,&\n25087,&\n25097,&\n25111,&\n25117,&\n25121,&\n25127,&\n25147,&\n25153,&\n25163,&\n25169,&\n25171,&\n25183,&\n25189,&\n25219,&\n25229,&\n25237,&\n25243,&\n25247,&\n25253,&\n25261,&\n25301,&\n25303,&\n25307,&\n25309,&\n25321,&\n25339,&\n25343,&\n25349,&\n25357,&\n25367,&\n25373,&\n25391,&\n25409,&\n25411,&\n25423,&\n25439,&\n25447,&\n25453,&\n25457,&\n25463,&\n25469,&\n25471,&\n25523,&\n25537,&\n25541,&\n25561,&\n25577,&\n25579,&\n25583,&\n25589,&\n25601,&\n25603,&\n25609,&\n25621,&\n25633,&\n25639,&\n25643,&\n25657,&\n25667,&\n25673,&\n25679,&\n25693,&\n25703,&\n25717,&\n25733,&\n25741,&\n25747,&\n25759,&\n25763,&\n25771,&\n25793,&\n25799,&\n25801,&\n25819,&\n25841,&\n25847,&\n25849,&\n25867,&\n25873,&\n25889,&\n25903,&\n25913,&\n25919,&\n25931,&\n25933,&\n25939,&\n25943,&\n25951,&\n25969,&\n25981,&\n25997,&\n25999,&\n26003,&\n26017,&\n26021,&\n26029,&\n26041,&\n26053,&\n26083,&\n26099,&\n26107,&\n26111,&\n26113,&\n26119,&\n26141,&\n26153,&\n26161,&\n26171,&\n26177,&\n26183,&\n26189,&\n26203,&\n26209,&\n26227,&\n26237,&\n26249,&\n26251,&\n26261,&\n26263,&\n26267,&\n26293,&\n26297,&\n26309,&\n26317,&\n26321,&\n26339,&\n26347,&\n26357,&\n26371,&\n26387,&\n26393,&\n26399,&\n26407,&\n26417,&\n26423,&\n26431,&\n26437,&\n26449,&\n26459,&\n26479,&\n26489,&\n26497,&\n26501,&\n26513,&\n26539,&\n26557,&\n26561,&\n26573,&\n26591,&\n26597,&\n26627,&\n26633,&\n26641,&\n26647,&\n26669,&\n26681,&\n26683,&\n26687,&\n26693,&\n26699,&\n26701,&\n26711,&\n26713,&\n26717,&\n26723,&\n26729,&\n26731,&\n26737,&\n26759,&\n26777,&\n26783,&\n26801,&\n26813,&\n26821,&\n26833,&\n26839,&\n26849,&\n26861,&\n26863,&\n26879,&\n26881,&\n26891,&\n26893,&\n26903,&\n26921,&\n26927,&\n26947,&\n26951,&\n26953,&\n26959,&\n26981,&\n26987,&\n26993,&\n27011,&\n27017,&\n27031,&\n27043,&\n27059,&\n27061,&\n27067,&\n27073,&\n27077,&\n27091,&\n27103,&\n27107,&\n27109,&\n27127,&\n27143,&\n27179,&\n27191,&\n27197,&\n27211,&\n27239,&\n27241,&\n27253,&\n27259,&\n27271,&\n27277,&\n27281,&\n27283,&\n27299,&\n27329,&\n27337,&\n27361,&\n27367,&\n27397,&\n27407,&\n27409,&\n27427,&\n27431,&\n27437,&\n27449,&\n27457,&\n27479,&\n27481,&\n27487,&\n27509,&\n27527,&\n27529,&\n27539,&\n27541,&\n27551,&\n27581,&\n27583,&\n27611,&\n27617,&\n27631,&\n27647,&\n27653,&\n27673,&\n27689,&\n27691,&\n27697,&\n27701,&\n27733,&\n27737,&\n27739,&\n27743,&\n27749,&\n27751,&\n27763,&\n27767,&\n27773,&\n27779,&\n27791,&\n27793,&\n27799,&\n27803,&\n27809,&\n27817,&\n27823,&\n27827,&\n27847,&\n27851,&\n27883,&\n27893,&\n27901,&\n27917,&\n27919,&\n27941,&\n27943,&\n27947,&\n27953,&\n27961,&\n27967,&\n27983,&\n27997,&\n28001,&\n28019,&\n28027,&\n28031,&\n28051,&\n28057,&\n28069,&\n28081,&\n28087,&\n28097,&\n28099,&\n28109,&\n28111,&\n28123,&\n28151,&\n28163,&\n28181,&\n28183,&\n28201,&\n28211,&\n28219,&\n28229,&\n28277,&\n28279,&\n28283,&\n28289,&\n28297,&\n28307,&\n28309,&\n28319,&\n28349,&\n28351,&\n28387,&\n28393,&\n28403,&\n28409,&\n28411,&\n28429,&\n28433,&\n28439,&\n28447,&\n28463,&\n28477,&\n28493,&\n28499,&\n28513,&\n28517,&\n28537,&\n28541,&\n28547,&\n28549,&\n28559,&\n28571,&\n28573,&\n28579,&\n28591,&\n28597,&\n28603,&\n28607,&\n28619,&\n28621,&\n28627,&\n28631,&\n28643,&\n28649,&\n28657,&\n28661,&\n28663,&\n28669,&\n28687,&\n28697,&\n28703,&\n28711,&\n28723,&\n28729,&\n28751,&\n28753,&\n28759,&\n28771,&\n28789,&\n28793,&\n28807,&\n28813,&\n28817,&\n28837,&\n28843,&\n28859,&\n28867,&\n28871,&\n28879,&\n28901,&\n28909,&\n28921,&\n28927,&\n28933,&\n28949,&\n28961,&\n28979,&\n29009,&\n29017,&\n29021,&\n29023,&\n29027,&\n29033,&\n29059,&\n29063,&\n29077,&\n29101,&\n29123,&\n29129,&\n29131,&\n29137,&\n29147,&\n29153,&\n29167,&\n29173,&\n29179,&\n29191,&\n29201,&\n29207,&\n29209,&\n29221,&\n29231,&\n29243,&\n29251,&\n29269,&\n29287,&\n29297,&\n29303,&\n29311,&\n29327,&\n29333,&\n29339,&\n29347,&\n29363,&\n29383,&\n29387,&\n29389,&\n29399,&\n29401,&\n29411,&\n29423,&\n29429,&\n29437,&\n29443,&\n29453,&\n29473,&\n29483,&\n29501,&\n29527,&\n29531,&\n29537,&\n29567,&\n29569,&\n29573,&\n29581,&\n29587,&\n29599,&\n29611,&\n29629,&\n29633,&\n29641,&\n29663,&\n29669,&\n29671,&\n29683,&\n29717,&\n29723,&\n29741,&\n29753,&\n29759,&\n29761,&\n29789,&\n29803,&\n29819,&\n29833,&\n29837,&\n29851,&\n29863,&\n29867,&\n29873,&\n29879,&\n29881,&\n29917,&\n29921,&\n29927,&\n29947,&\n29959,&\n29983,&\n29989,&\n30011,&\n30013,&\n30029,&\n30047,&\n30059,&\n30071,&\n30089,&\n30091,&\n30097,&\n30103,&\n30109,&\n30113,&\n30119,&\n30133,&\n30137,&\n30139,&\n30161,&\n30169,&\n30181,&\n30187,&\n30197,&\n30203,&\n30211,&\n30223,&\n30241,&\n30253,&\n30259,&\n30269,&\n30271,&\n30293,&\n30307,&\n30313,&\n30319,&\n30323,&\n30341,&\n30347,&\n30367,&\n30389,&\n30391,&\n30403,&\n30427,&\n30431,&\n30449,&\n30467,&\n30469,&\n30491,&\n30493,&\n30497,&\n30509,&\n30517,&\n30529,&\n30539,&\n30553,&\n30557,&\n30559,&\n30577,&\n30593,&\n30631,&\n30637,&\n30643,&\n30649,&\n30661,&\n30671,&\n30677,&\n30689,&\n30697,&\n30703,&\n30707,&\n30713,&\n30727,&\n30757,&\n30763,&\n30773,&\n30781,&\n30803,&\n30809,&\n30817,&\n30829,&\n30839,&\n30841,&\n30851,&\n30853,&\n30859,&\n30869,&\n30871,&\n30881,&\n30893,&\n30911,&\n30931,&\n30937,&\n30941,&\n30949,&\n30971,&\n30977,&\n30983,&\n31013,&\n31019,&\n31033,&\n31039,&\n31051,&\n31063,&\n31069,&\n31079,&\n31081,&\n31091,&\n31121,&\n31123,&\n31139,&\n31147,&\n31151,&\n31153,&\n31159,&\n31177,&\n31181,&\n31183,&\n31189,&\n31193,&\n31219,&\n31223,&\n31231,&\n31237,&\n31247,&\n31249,&\n31253,&\n31259,&\n31267,&\n31271,&\n31277,&\n31307,&\n31319,&\n31321,&\n31327,&\n31333,&\n31337,&\n31357,&\n31379,&\n31387,&\n31391,&\n31393,&\n31397,&\n31469,&\n31477,&\n31481,&\n31489,&\n31511,&\n31513,&\n31517,&\n31531,&\n31541,&\n31543,&\n31547,&\n31567,&\n31573,&\n31583,&\n31601,&\n31607,&\n31627,&\n31643,&\n31649,&\n31657,&\n31663,&\n31667,&\n31687,&\n31699,&\n31721,&\n31723,&\n31727,&\n31729,&\n31741,&\n31751,&\n31769,&\n31771,&\n31793,&\n31799,&\n31817,&\n31847,&\n31849,&\n31859,&\n31873,&\n31883,&\n31891,&\n31907,&\n31957,&\n31963,&\n31973,&\n31981,&\n31991,&\n32003,&\n32009,&\n32027,&\n32029,&\n32051,&\n32057,&\n32059,&\n32063,&\n32069,&\n32077,&\n32083,&\n32089,&\n32099,&\n32117,&\n32119,&\n32141,&\n32143,&\n32159,&\n32173,&\n32183,&\n32189,&\n32191,&\n32203,&\n32213,&\n32233,&\n32237,&\n32251,&\n32257,&\n32261,&\n32297,&\n32299,&\n32303,&\n32309,&\n32321,&\n32323,&\n32327,&\n32341,&\n32353,&\n32359,&\n32363,&\n32369,&\n32371,&\n32377,&\n32381,&\n32401,&\n32411,&\n32413,&\n32423,&\n32429,&\n32441,&\n32443,&\n32467,&\n32479,&\n32491,&\n32497,&\n32503,&\n32507,&\n32531,&\n32533,&\n32537,&\n32561,&\n32563,&\n32569,&\n32573,&\n32579,&\n32587,&\n32603,&\n32609,&\n32611,&\n32621,&\n32633,&\n32647,&\n32653,&\n32687,&\n32693,&\n32707,&\n32713,&\n32717,&\n32719,&\n32749,&\n32771,&\n32779,&\n32783,&\n32789,&\n32797,&\n32801,&\n32803,&\n32831,&\n32833,&\n32839,&\n32843,&\n32869,&\n32887,&\n32909,&\n32911,&\n32917,&\n32933,&\n32939,&\n32941,&\n32957,&\n32969,&\n32971,&\n32983,&\n32987,&\n32993,&\n32999,&\n33013,&\n33023,&\n33029,&\n33037,&\n33049,&\n33053,&\n33071,&\n33073,&\n33083,&\n33091,&\n33107,&\n33113,&\n33119,&\n33149,&\n33151,&\n33161,&\n33179,&\n33181,&\n33191,&\n33199,&\n33203,&\n33211,&\n33223,&\n33247,&\n33287,&\n33289,&\n33301,&\n33311,&\n33317,&\n33329,&\n33331,&\n33343,&\n33347,&\n33349,&\n33353,&\n33359,&\n33377,&\n33391,&\n33403,&\n33409,&\n33413,&\n33427,&\n33457,&\n33461,&\n33469,&\n33479,&\n33487,&\n33493,&\n33503,&\n33521,&\n33529,&\n33533,&\n33547,&\n33563,&\n33569,&\n33577,&\n33581,&\n33587,&\n33589,&\n33599,&\n33601,&\n33613,&\n33617,&\n33619,&\n33623,&\n33629,&\n33637,&\n33641,&\n33647,&\n33679,&\n33703,&\n33713,&\n33721,&\n33739,&\n33749,&\n33751,&\n33757,&\n33767,&\n33769,&\n33773,&\n33791,&\n33797,&\n33809,&\n33811,&\n33827,&\n33829,&\n33851,&\n33857,&\n33863,&\n33871,&\n33889,&\n33893,&\n33911,&\n33923,&\n33931,&\n33937,&\n33941,&\n33961,&\n33967,&\n33997,&\n34019,&\n34031,&\n34033,&\n34039,&\n34057,&\n34061,&\n34123,&\n34127,&\n34129,&\n34141,&\n34147,&\n34157,&\n34159,&\n34171,&\n34183,&\n34211,&\n34213,&\n34217,&\n34231,&\n34253,&\n34259,&\n34261,&\n34267,&\n34273,&\n34283,&\n34297,&\n34301,&\n34303,&\n34313,&\n34319,&\n34327,&\n34337,&\n34351,&\n34361,&\n34367,&\n34369,&\n34381,&\n34403,&\n34421,&\n34429,&\n34439,&\n34457,&\n34469,&\n34471,&\n34483,&\n34487,&\n34499,&\n34501,&\n34511,&\n34513,&\n34519,&\n34537,&\n34543,&\n34549,&\n34583,&\n34589,&\n34591,&\n34603,&\n34607,&\n34613,&\n34631,&\n34649,&\n34651,&\n34667,&\n34673,&\n34679,&\n34687,&\n34693,&\n34703,&\n34721,&\n34729,&\n34739,&\n34747,&\n34757,&\n34759,&\n34763,&\n34781,&\n34807,&\n34819,&\n34841,&\n34843,&\n34847,&\n34849,&\n34871,&\n34877,&\n34883,&\n34897,&\n34913,&\n34919,&\n34939,&\n34949,&\n34961,&\n34963,&\n34981,&\n35023,&\n35027,&\n35051,&\n35053,&\n35059,&\n35069,&\n35081,&\n35083,&\n35089,&\n35099,&\n35107,&\n35111,&\n35117,&\n35129,&\n35141,&\n35149,&\n35153,&\n35159,&\n35171,&\n35201,&\n35221,&\n35227,&\n35251,&\n35257,&\n35267,&\n35279,&\n35281,&\n35291,&\n35311,&\n35317,&\n35323,&\n35327,&\n35339,&\n35353,&\n35363,&\n35381,&\n35393,&\n35401,&\n35407,&\n35419,&\n35423,&\n35437,&\n35447,&\n35449,&\n35461,&\n35491,&\n35507,&\n35509,&\n35521,&\n35527,&\n35531,&\n35533,&\n35537,&\n35543,&\n35569,&\n35573,&\n35591,&\n35593,&\n35597,&\n35603,&\n35617,&\n35671,&\n35677,&\n35729,&\n35731,&\n35747,&\n35753,&\n35759,&\n35771,&\n35797,&\n35801,&\n35803,&\n35809,&\n35831,&\n35837,&\n35839,&\n35851,&\n35863,&\n35869,&\n35879,&\n35897,&\n35899,&\n35911,&\n35923,&\n35933,&\n35951,&\n35963,&\n35969,&\n35977,&\n35983,&\n35993,&\n35999,&\n36007,&\n36011,&\n36013,&\n36017,&\n36037,&\n36061,&\n36067,&\n36073,&\n36083,&\n36097,&\n36107,&\n36109,&\n36131,&\n36137,&\n36151,&\n36161,&\n36187,&\n36191,&\n36209,&\n36217,&\n36229,&\n36241,&\n36251,&\n36263,&\n36269,&\n36277,&\n36293,&\n36299,&\n36307,&\n36313,&\n36319,&\n36341,&\n36343,&\n36353,&\n36373,&\n36383,&\n36389,&\n36433,&\n36451,&\n36457,&\n36467,&\n36469,&\n36473,&\n36479,&\n36493,&\n36497,&\n36523,&\n36527,&\n36529,&\n36541,&\n36551,&\n36559,&\n36563,&\n36571,&\n36583,&\n36587,&\n36599,&\n36607,&\n36629,&\n36637,&\n36643,&\n36653,&\n36671,&\n36677,&\n36683,&\n36691,&\n36697,&\n36709,&\n36713,&\n36721,&\n36739,&\n36749,&\n36761,&\n36767,&\n36779,&\n36781,&\n36787,&\n36791,&\n36793,&\n36809,&\n36821,&\n36833,&\n36847,&\n36857,&\n36871,&\n36877,&\n36887,&\n36899,&\n36901,&\n36913,&\n36919,&\n36923,&\n36929,&\n36931,&\n36943,&\n36947,&\n36973,&\n36979,&\n36997,&\n37003,&\n37013,&\n37019,&\n37021,&\n37039,&\n37049,&\n37057,&\n37061,&\n37087,&\n37097,&\n37117,&\n37123,&\n37139,&\n37159,&\n37171,&\n37181,&\n37189,&\n37199,&\n37201,&\n37217,&\n37223,&\n37243,&\n37253,&\n37273,&\n37277,&\n37307,&\n37309,&\n37313,&\n37321,&\n37337,&\n37339,&\n37357,&\n37361,&\n37363,&\n37369,&\n37379,&\n37397,&\n37409,&\n37423,&\n37441,&\n37447,&\n37463,&\n37483,&\n37489,&\n37493,&\n37501,&\n37507,&\n37511,&\n37517,&\n37529,&\n37537,&\n37547,&\n37549,&\n37561,&\n37567,&\n37571,&\n37573,&\n37579,&\n37589,&\n37591,&\n37607,&\n37619,&\n37633,&\n37643,&\n37649,&\n37657,&\n37663,&\n37691,&\n37693,&\n37699,&\n37717,&\n37747,&\n37781,&\n37783,&\n37799,&\n37811,&\n37813,&\n37831,&\n37847,&\n37853,&\n37861,&\n37871,&\n37879,&\n37889,&\n37897,&\n37907,&\n37951,&\n37957,&\n37963,&\n37967,&\n37987,&\n37991,&\n37993,&\n37997,&\n38011,&\n38039,&\n38047,&\n38053,&\n38069,&\n38083,&\n38113,&\n38119,&\n38149,&\n38153,&\n38167,&\n38177,&\n38183,&\n38189,&\n38197,&\n38201,&\n38219,&\n38231,&\n38237,&\n38239,&\n38261,&\n38273,&\n38281,&\n38287,&\n38299,&\n38303,&\n38317,&\n38321,&\n38327,&\n38329,&\n38333,&\n38351,&\n38371,&\n38377,&\n38393,&\n38431,&\n38447,&\n38449,&\n38453,&\n38459,&\n38461,&\n38501,&\n38543,&\n38557,&\n38561,&\n38567,&\n38569,&\n38593,&\n38603,&\n38609,&\n38611,&\n38629,&\n38639,&\n38651,&\n38653,&\n38669,&\n38671,&\n38677,&\n38693,&\n38699,&\n38707,&\n38711,&\n38713,&\n38723,&\n38729,&\n38737,&\n38747,&\n38749,&\n38767,&\n38783,&\n38791,&\n38803,&\n38821,&\n38833,&\n38839,&\n38851,&\n38861,&\n38867,&\n38873,&\n38891,&\n38903,&\n38917,&\n38921,&\n38923,&\n38933,&\n38953,&\n38959,&\n38971,&\n38977,&\n38993,&\n39019,&\n39023,&\n39041,&\n39043,&\n39047,&\n39079,&\n39089,&\n39097,&\n39103,&\n39107,&\n39113,&\n39119,&\n39133,&\n39139,&\n39157,&\n39161,&\n39163,&\n39181,&\n39191,&\n39199,&\n39209,&\n39217,&\n39227,&\n39229,&\n39233,&\n39239,&\n39241,&\n39251,&\n39293,&\n39301,&\n39313,&\n39317,&\n39323,&\n39341,&\n39343,&\n39359,&\n39367,&\n39371,&\n39373,&\n39383,&\n39397,&\n39409,&\n39419,&\n39439,&\n39443,&\n39451,&\n39461,&\n39499,&\n39503,&\n39509,&\n39511,&\n39521,&\n39541,&\n39551,&\n39563,&\n39569,&\n39581,&\n39607,&\n39619,&\n39623,&\n39631,&\n39659,&\n39667,&\n39671,&\n39679,&\n39703,&\n39709,&\n39719,&\n39727,&\n39733,&\n39749,&\n39761,&\n39769,&\n39779,&\n39791,&\n39799,&\n39821,&\n39827,&\n39829,&\n39839,&\n39841,&\n39847,&\n39857,&\n39863,&\n39869,&\n39877,&\n39883,&\n39887,&\n39901,&\n39929,&\n39937,&\n39953,&\n39971,&\n39979,&\n39983,&\n39989,&\n40009,&\n40013,&\n40031,&\n40037,&\n40039,&\n40063,&\n40087,&\n40093,&\n40099,&\n40111,&\n40123,&\n40127,&\n40129,&\n40151,&\n40153,&\n40163,&\n40169,&\n40177,&\n40189,&\n40193,&\n40213,&\n40231,&\n40237,&\n40241,&\n40253,&\n40277,&\n40283,&\n40289,&\n40343,&\n40351,&\n40357,&\n40361,&\n40387,&\n40423,&\n40427,&\n40429,&\n40433,&\n40459,&\n40471,&\n40483,&\n40487,&\n40493,&\n40499,&\n40507,&\n40519,&\n40529,&\n40531,&\n40543,&\n40559,&\n40577,&\n40583,&\n40591,&\n40597,&\n40609,&\n40627,&\n40637,&\n40639,&\n40693,&\n40697,&\n40699,&\n40709,&\n40739,&\n40751,&\n40759,&\n40763,&\n40771,&\n40787,&\n40801,&\n40813,&\n40819,&\n40823,&\n40829,&\n40841,&\n40847,&\n40849,&\n40853,&\n40867,&\n40879,&\n40883,&\n40897,&\n40903,&\n40927,&\n40933,&\n40939,&\n40949,&\n40961,&\n40973,&\n40993,&\n41011,&\n41017,&\n41023,&\n41039,&\n41047,&\n41051,&\n41057,&\n41077,&\n41081,&\n41113,&\n41117,&\n41131,&\n41141,&\n41143,&\n41149,&\n41161,&\n41177,&\n41179,&\n41183,&\n41189,&\n41201,&\n41203,&\n41213,&\n41221,&\n41227,&\n41231,&\n41233,&\n41243,&\n41257,&\n41263,&\n41269,&\n41281,&\n41299,&\n41333,&\n41341,&\n41351,&\n41357,&\n41381,&\n41387,&\n41389,&\n41399,&\n41411,&\n41413,&\n41443,&\n41453,&\n41467,&\n41479,&\n41491,&\n41507,&\n41513,&\n41519,&\n41521,&\n41539,&\n41543,&\n41549,&\n41579,&\n41593,&\n41597,&\n41603,&\n41609,&\n41611,&\n41617,&\n41621,&\n41627,&\n41641,&\n41647,&\n41651,&\n41659,&\n41669,&\n41681,&\n41687,&\n41719,&\n41729,&\n41737,&\n41759,&\n41761,&\n41771,&\n41777,&\n41801,&\n41809,&\n41813,&\n41843,&\n41849,&\n41851,&\n41863,&\n41879,&\n41887,&\n41893,&\n41897,&\n41903,&\n41911,&\n41927,&\n41941,&\n41947,&\n41953,&\n41957,&\n41959,&\n41969,&\n41981,&\n41983,&\n41999,&\n42013,&\n42017,&\n42019,&\n42023,&\n42043,&\n42061,&\n42071,&\n42073,&\n42083,&\n42089,&\n42101,&\n42131,&\n42139,&\n42157,&\n42169,&\n42179,&\n42181,&\n42187,&\n42193,&\n42197,&\n42209,&\n42221,&\n42223,&\n42227,&\n42239,&\n42257,&\n42281,&\n42283,&\n42293,&\n42299,&\n42307,&\n42323,&\n42331,&\n42337,&\n42349,&\n42359,&\n42373,&\n42379,&\n42391,&\n42397,&\n42403,&\n42407,&\n42409,&\n42433,&\n42437,&\n42443,&\n42451,&\n42457,&\n42461,&\n42463,&\n42467,&\n42473,&\n42487,&\n42491,&\n42499,&\n42509,&\n42533,&\n42557,&\n42569,&\n42571,&\n42577,&\n42589,&\n42611,&\n42641,&\n42643,&\n42649,&\n42667,&\n42677,&\n42683,&\n42689,&\n42697,&\n42701,&\n42703,&\n42709,&\n42719,&\n42727,&\n42737,&\n42743,&\n42751,&\n42767,&\n42773,&\n42787,&\n42793,&\n42797,&\n42821,&\n42829,&\n42839,&\n42841,&\n42853,&\n42859,&\n42863,&\n42899,&\n42901,&\n42923,&\n42929,&\n42937,&\n42943,&\n42953,&\n42961,&\n42967,&\n42979,&\n42989,&\n43003,&\n43013,&\n43019,&\n43037,&\n43049,&\n43051,&\n43063,&\n43067,&\n43093,&\n43103,&\n43117,&\n43133,&\n43151,&\n43159,&\n43177,&\n43189,&\n43201,&\n43207,&\n43223,&\n43237,&\n43261,&\n43271,&\n43283,&\n43291,&\n43313,&\n43319,&\n43321,&\n43331,&\n43391,&\n43397,&\n43399,&\n43403,&\n43411,&\n43427,&\n43441,&\n43451,&\n43457,&\n43481,&\n43487,&\n43499,&\n43517,&\n43541,&\n43543,&\n43573,&\n43577,&\n43579,&\n43591,&\n43597,&\n43607,&\n43609,&\n43613,&\n43627,&\n43633,&\n43649,&\n43651,&\n43661,&\n43669,&\n43691,&\n43711,&\n43717,&\n43721,&\n43753,&\n43759,&\n43777,&\n43781,&\n43783,&\n43787,&\n43789,&\n43793,&\n43801,&\n43853,&\n43867,&\n43889,&\n43891,&\n43913,&\n43933,&\n43943,&\n43951,&\n43961,&\n43963,&\n43969,&\n43973,&\n43987,&\n43991,&\n43997,&\n44017,&\n44021,&\n44027,&\n44029,&\n44041,&\n44053,&\n44059,&\n44071,&\n44087,&\n44089,&\n44101,&\n44111,&\n44119,&\n44123,&\n44129,&\n44131,&\n44159,&\n44171,&\n44179,&\n44189,&\n44201,&\n44203,&\n44207,&\n44221,&\n44249,&\n44257,&\n44263,&\n44267,&\n44269,&\n44273,&\n44279,&\n44281,&\n44293,&\n44351,&\n44357,&\n44371,&\n44381,&\n44383,&\n44389,&\n44417,&\n44449,&\n44453,&\n44483,&\n44491,&\n44497,&\n44501,&\n44507,&\n44519,&\n44531,&\n44533,&\n44537,&\n44543,&\n44549,&\n44563,&\n44579,&\n44587,&\n44617,&\n44621,&\n44623,&\n44633,&\n44641,&\n44647,&\n44651,&\n44657,&\n44683,&\n44687,&\n44699,&\n44701,&\n44711,&\n44729,&\n44741,&\n44753,&\n44771,&\n44773,&\n44777,&\n44789,&\n44797,&\n44809,&\n44819,&\n44839,&\n44843,&\n44851,&\n44867,&\n44879,&\n44887,&\n44893,&\n44909,&\n44917,&\n44927,&\n44939,&\n44953,&\n44959,&\n44963,&\n44971,&\n44983,&\n44987,&\n45007,&\n45013,&\n45053,&\n45061,&\n45077,&\n45083,&\n45119,&\n45121,&\n45127,&\n45131,&\n45137,&\n45139,&\n45161,&\n45179,&\n45181,&\n45191,&\n45197,&\n45233,&\n45247,&\n45259,&\n45263,&\n45281,&\n45289,&\n45293,&\n45307,&\n45317,&\n45319,&\n45329,&\n45337,&\n45341,&\n45343,&\n45361,&\n45377,&\n45389,&\n45403,&\n45413,&\n45427,&\n45433,&\n45439,&\n45481,&\n45491,&\n45497,&\n45503,&\n45523,&\n45533,&\n45541,&\n45553,&\n45557,&\n45569,&\n45587,&\n45589,&\n45599,&\n45613,&\n45631,&\n45641,&\n45659,&\n45667,&\n45673,&\n45677,&\n45691,&\n45697,&\n45707,&\n45737,&\n45751,&\n45757,&\n45763,&\n45767,&\n45779,&\n45817,&\n45821,&\n45823,&\n45827,&\n45833,&\n45841,&\n45853,&\n45863,&\n45869,&\n45887,&\n45893,&\n45943,&\n45949,&\n45953,&\n45959,&\n45971,&\n45979,&\n45989,&\n46021,&\n46027,&\n46049,&\n46051,&\n46061,&\n46073,&\n46091,&\n46093,&\n46099,&\n46103,&\n46133,&\n46141,&\n46147,&\n46153,&\n46171,&\n46181,&\n46183,&\n46187,&\n46199,&\n46219,&\n46229,&\n46237,&\n46261,&\n46271,&\n46273,&\n46279,&\n46301,&\n46307,&\n46309,&\n46327,&\n46337,&\n46349,&\n46351,&\n46381,&\n46399,&\n46411,&\n46439,&\n46441,&\n46447,&\n46451,&\n46457,&\n46471,&\n46477,&\n46489,&\n46499,&\n46507,&\n46511,&\n46523,&\n46549,&\n46559,&\n46567,&\n46573,&\n46589,&\n46591,&\n46601,&\n46619,&\n46633,&\n46639,&\n46643,&\n46649,&\n46663,&\n46679,&\n46681,&\n46687,&\n46691,&\n46703,&\n46723,&\n46727,&\n46747,&\n46751,&\n46757,&\n46769,&\n46771,&\n46807,&\n46811,&\n46817,&\n46819,&\n46829,&\n46831,&\n46853,&\n46861,&\n46867,&\n46877,&\n46889,&\n46901,&\n46919,&\n46933,&\n46957,&\n46993,&\n46997,&\n47017,&\n47041,&\n47051,&\n47057,&\n47059,&\n47087,&\n47093,&\n47111,&\n47119,&\n47123,&\n47129,&\n47137,&\n47143,&\n47147,&\n47149,&\n47161,&\n47189,&\n47207,&\n47221,&\n47237,&\n47251,&\n47269,&\n47279,&\n47287,&\n47293,&\n47297,&\n47303,&\n47309,&\n47317,&\n47339,&\n47351,&\n47353,&\n47363,&\n47381,&\n47387,&\n47389,&\n47407,&\n47417,&\n47419,&\n47431,&\n47441,&\n47459,&\n47491,&\n47497,&\n47501,&\n47507,&\n47513,&\n47521,&\n47527,&\n47533,&\n47543,&\n47563,&\n47569,&\n47581,&\n47591,&\n47599,&\n47609,&\n47623,&\n47629,&\n47639,&\n47653,&\n47657,&\n47659,&\n47681,&\n47699,&\n47701,&\n47711,&\n47713,&\n47717,&\n47737,&\n47741,&\n47743,&\n47777,&\n47779,&\n47791,&\n47797,&\n47807,&\n47809,&\n47819,&\n47837,&\n47843,&\n47857,&\n47869,&\n47881,&\n47903,&\n47911,&\n47917,&\n47933,&\n47939,&\n47947,&\n47951,&\n47963,&\n47969,&\n47977,&\n47981,&\n48017,&\n48023,&\n48029,&\n48049,&\n48073,&\n48079,&\n48091,&\n48109,&\n48119,&\n48121,&\n48131,&\n48157,&\n48163,&\n48179,&\n48187,&\n48193,&\n48197,&\n48221,&\n48239,&\n48247,&\n48259,&\n48271,&\n48281,&\n48299,&\n48311,&\n48313,&\n48337,&\n48341,&\n48353,&\n48371,&\n48383,&\n48397,&\n48407,&\n48409,&\n48413,&\n48437,&\n48449,&\n48463,&\n48473,&\n48479,&\n48481,&\n48487,&\n48491,&\n48497,&\n48523,&\n48527,&\n48533,&\n48539,&\n48541,&\n48563,&\n48571,&\n48589,&\n48593,&\n48611,&\n48619,&\n48623,&\n48647,&\n48649,&\n48661,&\n48673,&\n48677,&\n48679,&\n48731,&\n48733,&\n48751,&\n48757,&\n48761,&\n48767,&\n48779,&\n48781,&\n48787,&\n48799,&\n48809,&\n48817,&\n48821,&\n48823,&\n48847,&\n48857,&\n48859,&\n48869,&\n48871,&\n48883,&\n48889,&\n48907,&\n48947,&\n48953,&\n48973,&\n48989,&\n48991,&\n49003,&\n49009,&\n49019,&\n49031,&\n49033,&\n49037,&\n49043,&\n49057,&\n49069,&\n49081,&\n49103,&\n49109,&\n49117,&\n49121,&\n49123,&\n49139,&\n49157,&\n49169,&\n49171,&\n49177,&\n49193,&\n49199,&\n49201,&\n49207,&\n49211,&\n49223,&\n49253,&\n49261,&\n49277,&\n49279,&\n49297,&\n49307,&\n49331,&\n49333,&\n49339,&\n49363,&\n49367,&\n49369,&\n49391,&\n49393,&\n49409,&\n49411,&\n49417,&\n49429,&\n49433,&\n49451,&\n49459,&\n49463,&\n49477,&\n49481,&\n49499,&\n49523,&\n49529,&\n49531,&\n49537,&\n49547,&\n49549,&\n49559,&\n49597,&\n49603,&\n49613,&\n49627,&\n49633,&\n49639,&\n49663,&\n49667,&\n49669,&\n49681,&\n49697,&\n49711,&\n49727,&\n49739,&\n49741,&\n49747,&\n49757,&\n49783,&\n49787,&\n49789,&\n49801,&\n49807,&\n49811,&\n49823,&\n49831,&\n49843,&\n49853,&\n49871,&\n49877,&\n49891,&\n49919,&\n49921,&\n49927,&\n49937,&\n49939,&\n49943,&\n49957,&\n49991,&\n49993,&\n49999,&\n50021,&\n50023,&\n50033,&\n50047,&\n50051,&\n50053,&\n50069,&\n50077,&\n50087,&\n50093,&\n50101,&\n50111,&\n50119,&\n50123,&\n50129,&\n50131,&\n50147,&\n50153,&\n50159,&\n50177,&\n50207,&\n50221,&\n50227,&\n50231,&\n50261,&\n50263,&\n50273,&\n50287,&\n50291,&\n50311,&\n50321,&\n50329,&\n50333,&\n50341,&\n50359,&\n50363,&\n50377,&\n50383,&\n50387,&\n50411,&\n50417,&\n50423,&\n50441,&\n50459,&\n50461,&\n50497,&\n50503,&\n50513,&\n50527,&\n50539,&\n50543,&\n50549,&\n50551,&\n50581,&\n50587,&\n50591,&\n50593,&\n50599,&\n50627,&\n50647,&\n50651,&\n50671,&\n50683,&\n50707,&\n50723,&\n50741,&\n50753,&\n50767,&\n50773,&\n50777,&\n50789,&\n50821,&\n50833,&\n50839,&\n50849,&\n50857,&\n50867,&\n50873,&\n50891,&\n50893,&\n50909,&\n50923,&\n50929,&\n50951,&\n50957,&\n50969,&\n50971,&\n50989,&\n50993,&\n51001,&\n51031,&\n51043,&\n51047,&\n51059,&\n51061,&\n51071,&\n51109,&\n51131,&\n51133,&\n51137,&\n51151,&\n51157,&\n51169,&\n51193,&\n51197,&\n51199,&\n51203,&\n51217,&\n51229,&\n51239,&\n51241,&\n51257,&\n51263,&\n51283,&\n51287,&\n51307,&\n51329,&\n51341,&\n51343,&\n51347,&\n51349,&\n51361,&\n51383,&\n51407,&\n51413,&\n51419,&\n51421,&\n51427,&\n51431,&\n51437,&\n51439,&\n51449,&\n51461,&\n51473,&\n51479,&\n51481,&\n51487,&\n51503,&\n51511,&\n51517,&\n51521,&\n51539,&\n51551,&\n51563,&\n51577,&\n51581,&\n51593,&\n51599,&\n51607,&\n51613,&\n51631,&\n51637,&\n51647,&\n51659,&\n51673,&\n51679,&\n51683,&\n51691,&\n51713,&\n51719,&\n51721,&\n51749,&\n51767,&\n51769,&\n51787,&\n51797,&\n51803,&\n51817,&\n51827,&\n51829,&\n51839,&\n51853,&\n51859,&\n51869,&\n51871,&\n51893,&\n51899,&\n51907,&\n51913,&\n51929,&\n51941,&\n51949,&\n51971,&\n51973,&\n51977,&\n51991,&\n52009,&\n52021,&\n52027,&\n52051,&\n52057,&\n52067,&\n52069,&\n52081,&\n52103,&\n52121,&\n52127,&\n52147,&\n52153,&\n52163,&\n52177,&\n52181,&\n52183,&\n52189,&\n52201,&\n52223,&\n52237,&\n52249,&\n52253,&\n52259,&\n52267,&\n52289,&\n52291,&\n52301,&\n52313,&\n52321,&\n52361,&\n52363,&\n52369,&\n52379,&\n52387,&\n52391,&\n52433,&\n52453,&\n52457,&\n52489,&\n52501,&\n52511,&\n52517,&\n52529,&\n52541,&\n52543,&\n52553,&\n52561,&\n52567,&\n52571,&\n52579,&\n52583,&\n52609,&\n52627,&\n52631,&\n52639,&\n52667,&\n52673,&\n52691,&\n52697,&\n52709,&\n52711,&\n52721,&\n52727,&\n52733,&\n52747,&\n52757,&\n52769,&\n52783,&\n52807,&\n52813,&\n52817,&\n52837,&\n52859,&\n52861,&\n52879,&\n52883,&\n52889,&\n52901,&\n52903,&\n52919,&\n52937,&\n52951,&\n52957,&\n52963,&\n52967,&\n52973,&\n52981,&\n52999,&\n53003,&\n53017,&\n53047,&\n53051,&\n53069,&\n53077,&\n53087,&\n53089,&\n53093,&\n53101,&\n53113,&\n53117,&\n53129,&\n53147,&\n53149,&\n53161,&\n53171,&\n53173,&\n53189,&\n53197,&\n53201,&\n53231,&\n53233,&\n53239,&\n53267,&\n53269,&\n53279,&\n53281,&\n53299,&\n53309,&\n53323,&\n53327,&\n53353,&\n53359,&\n53377,&\n53381,&\n53401,&\n53407,&\n53411,&\n53419,&\n53437,&\n53441,&\n53453,&\n53479,&\n53503,&\n53507,&\n53527,&\n53549,&\n53551,&\n53569,&\n53591,&\n53593,&\n53597,&\n53609,&\n53611,&\n53617,&\n53623,&\n53629,&\n53633,&\n53639,&\n53653,&\n53657,&\n53681,&\n53693,&\n53699,&\n53717,&\n53719,&\n53731,&\n53759,&\n53773,&\n53777,&\n53783,&\n53791,&\n53813,&\n53819,&\n53831,&\n53849,&\n53857,&\n53861,&\n53881,&\n53887,&\n53891,&\n53897,&\n53899,&\n53917,&\n53923,&\n53927,&\n53939,&\n53951,&\n53959,&\n53987,&\n53993,&\n54001,&\n54011,&\n54013,&\n54037,&\n54049,&\n54059,&\n54083,&\n54091,&\n54101,&\n54121,&\n54133,&\n54139,&\n54151,&\n54163,&\n54167,&\n54181,&\n54193,&\n54217,&\n54251,&\n54269,&\n54277,&\n54287,&\n54293,&\n54311,&\n54319,&\n54323,&\n54331,&\n54347,&\n54361,&\n54367,&\n54371,&\n54377,&\n54401,&\n54403,&\n54409,&\n54413,&\n54419,&\n54421,&\n54437,&\n54443,&\n54449,&\n54469,&\n54493,&\n54497,&\n54499,&\n54503,&\n54517,&\n54521,&\n54539,&\n54541,&\n54547,&\n54559,&\n54563,&\n54577,&\n54581,&\n54583,&\n54601,&\n54617,&\n54623,&\n54629,&\n54631,&\n54647,&\n54667,&\n54673,&\n54679,&\n54709,&\n54713,&\n54721,&\n54727,&\n54751,&\n54767,&\n54773,&\n54779,&\n54787,&\n54799,&\n54829,&\n54833,&\n54851,&\n54869,&\n54877,&\n54881,&\n54907,&\n54917,&\n54919,&\n54941,&\n54949,&\n54959,&\n54973,&\n54979,&\n54983,&\n55001,&\n55009,&\n55021,&\n55049,&\n55051,&\n55057,&\n55061,&\n55073,&\n55079,&\n55103,&\n55109,&\n55117,&\n55127,&\n55147,&\n55163,&\n55171,&\n55201,&\n55207,&\n55213,&\n55217,&\n55219,&\n55229,&\n55243,&\n55249,&\n55259,&\n55291,&\n55313,&\n55331,&\n55333,&\n55337,&\n55339,&\n55343,&\n55351,&\n55373,&\n55381,&\n55399,&\n55411,&\n55439,&\n55441,&\n55457,&\n55469,&\n55487,&\n55501,&\n55511,&\n55529,&\n55541,&\n55547,&\n55579,&\n55589,&\n55603,&\n55609,&\n55619,&\n55621,&\n55631,&\n55633,&\n55639,&\n55661,&\n55663,&\n55667,&\n55673,&\n55681,&\n55691,&\n55697,&\n55711,&\n55717,&\n55721,&\n55733,&\n55763,&\n55787,&\n55793,&\n55799,&\n55807,&\n55813,&\n55817,&\n55819,&\n55823,&\n55829,&\n55837,&\n55843,&\n55849,&\n55871,&\n55889,&\n55897,&\n55901,&\n55903,&\n55921,&\n55927,&\n55931,&\n55933,&\n55949,&\n55967,&\n55987,&\n55997,&\n56003,&\n56009,&\n56039,&\n56041,&\n56053,&\n56081,&\n56087,&\n56093,&\n56099,&\n56101,&\n56113,&\n56123,&\n56131,&\n56149,&\n56167,&\n56171&\n/)\n ans = 1\n d = div(i)\n do i = 1,5699\n d = div(i)\n if (mod(A,d)==0 .and. mod(B,d)==0) then\n ans = ans + 1\n end if\n end do\n\n write(*, *) ans\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven are positive integers A and B.\n\nLet us choose some number of positive common divisors of A and B.\n\nHere, any two of the chosen divisors must be coprime.\n\nAt most, how many divisors can we choose?\n\nDefinition of common divisor\n\nAn integer d is said to be a common divisor of integers x and y when d divides both x and y.\n\nDefinition of being coprime\n\nIntegers x and y are said to be coprime when x and y have no positive common divisors other than 1.\n\nDefinition of dividing\n\nAn integer x is said to divide another integer y when there exists an integer \\alpha such that y = \\alpha x.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of divisors that can be chosen to satisfy the condition.\n\nSample Input 1\n\n12 18\n\nSample Output 1\n\n3\n\n12 and 18 have the following positive common divisors: 1, 2, 3, and 6.\n\n1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.\n\nSample Input 2\n\n420 660\n\nSample Output 2\n\n4\n\nSample Input 3\n\n1 2019\n\nSample Output 3\n\n1\n\n1 and 2019 have no positive common divisors other than 1.", "sample_input": "12 18\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02900", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven are positive integers A and B.\n\nLet us choose some number of positive common divisors of A and B.\n\nHere, any two of the chosen divisors must be coprime.\n\nAt most, how many divisors can we choose?\n\nDefinition of common divisor\n\nAn integer d is said to be a common divisor of integers x and y when d divides both x and y.\n\nDefinition of being coprime\n\nIntegers x and y are said to be coprime when x and y have no positive common divisors other than 1.\n\nDefinition of dividing\n\nAn integer x is said to divide another integer y when there exists an integer \\alpha such that y = \\alpha x.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of divisors that can be chosen to satisfy the condition.\n\nSample Input 1\n\n12 18\n\nSample Output 1\n\n3\n\n12 and 18 have the following positive common divisors: 1, 2, 3, and 6.\n\n1 and 2 are coprime, 2 and 3 are coprime, and 3 and 1 are coprime, so we can choose 1, 2, and 3, which achieve the maximum result.\n\nSample Input 2\n\n420 660\n\nSample Output 2\n\n4\n\nSample Input 3\n\n1 2019\n\nSample Output 3\n\n1\n\n1 and 2019 have no positive common divisors other than 1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 44472, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s560576391", "group_id": "codeNet:p02903", "input_text": "program zero_one_matrix\n implicit none\n integer :: h, w, a, b, x(1000,1000) = 0, i, j\n read(*,*) h, w, a, b\n if (a == 0) a = w\n if (b == 0) b = h\n x(1:b,1:a) = 1\n x(b+1:h,a+1:w) = 1\n do i = 1, h\n do j = 1, w\n write(*,'(i0)',advance='no') x(i,j)\n end do\n write(*,*)\n end do\nend program zero_one_matrix", "language": "Fortran", "metadata": {"date": 1569120668, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02903.html", "problem_id": "p02903", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02903/input.txt", "sample_output_relpath": "derived/input_output/data/p02903/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02903/Fortran/s560576391.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s560576391", "user_id": "u506403362"}, "prompt_components": {"gold_output": "100\n010\n001\n", "input_to_evaluate": "program zero_one_matrix\n implicit none\n integer :: h, w, a, b, x(1000,1000) = 0, i, j\n read(*,*) h, w, a, b\n if (a == 0) a = w\n if (b == 0) b = h\n x(1:b,1:a) = 1\n x(b+1:h,a+1:w) = 1\n do i = 1, h\n do j = 1, w\n write(*,'(i0)',advance='no') x(i,j)\n end do\n write(*,*)\n end do\nend program zero_one_matrix", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a square grid with H rows and W columns.\nSnuke wants to write 0 or 1 in each of the squares.\nHere, all of the following conditions have to be satisfied:\n\nFor every row, the smaller of the following is A: the number of 0s contained in the row, and the number of 1s contained in the row. (If these two numbers are equal, “the smaller” should be read as “either”.)\n\nFor every column, the smaller of the following is B: the number of 0s contained in the column, and the number of 1s contained in the column.\n\nDetermine if these conditions can be satisfied by writing 0 or 1 in each of the squares. If the answer is yes, show one way to fill the squares so that the conditions are satisfied.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\n0 \\leq A\n\n2 \\times A \\leq W\n\n0 \\leq B\n\n2 \\times B \\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W A B\n\nOutput\n\nIf the conditions cannot be satisfied by writing 0 or 1 in each of the squares, print -1.\n\nIf the conditions can be satisfied, print one way to fill the squares so that the conditions are satisfied, in the following format:\n\ns_{11}s_{12}\\cdots s_{1W}\ns_{21}s_{22}\\cdots s_{2W}\n\\vdots\ns_{H1}s_{H2}\\cdots s_{HW}\n\nHere s_{ij} is the digit written in the square at the i-th row from the top and the j-th column from the left in the grid.\n\nIf multiple solutions exist, printing any of them will be accepted.\n\nSample Input 1\n\n3 3 1 1\n\nSample Output 1\n\n100\n010\n001\n\nEvery row contains two 0s and one 1, so the first condition is satisfied.\nAlso, every column contains two 0s and one 1, so the second condition is satisfied.\n\nSample Input 2\n\n1 5 2 0\n\nSample Output 2\n\n01010", "sample_input": "3 3 1 1\n"}, "reference_outputs": ["100\n010\n001\n"], "source_document_id": "p02903", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a square grid with H rows and W columns.\nSnuke wants to write 0 or 1 in each of the squares.\nHere, all of the following conditions have to be satisfied:\n\nFor every row, the smaller of the following is A: the number of 0s contained in the row, and the number of 1s contained in the row. (If these two numbers are equal, “the smaller” should be read as “either”.)\n\nFor every column, the smaller of the following is B: the number of 0s contained in the column, and the number of 1s contained in the column.\n\nDetermine if these conditions can be satisfied by writing 0 or 1 in each of the squares. If the answer is yes, show one way to fill the squares so that the conditions are satisfied.\n\nConstraints\n\n1 \\leq H,W \\leq 1000\n\n0 \\leq A\n\n2 \\times A \\leq W\n\n0 \\leq B\n\n2 \\times B \\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W A B\n\nOutput\n\nIf the conditions cannot be satisfied by writing 0 or 1 in each of the squares, print -1.\n\nIf the conditions can be satisfied, print one way to fill the squares so that the conditions are satisfied, in the following format:\n\ns_{11}s_{12}\\cdots s_{1W}\ns_{21}s_{22}\\cdots s_{2W}\n\\vdots\ns_{H1}s_{H2}\\cdots s_{HW}\n\nHere s_{ij} is the digit written in the square at the i-th row from the top and the j-th column from the left in the grid.\n\nIf multiple solutions exist, printing any of them will be accepted.\n\nSample Input 1\n\n3 3 1 1\n\nSample Output 1\n\n100\n010\n001\n\nEvery row contains two 0s and one 1, so the first condition is satisfied.\nAlso, every column contains two 0s and one 1, so the second condition is satisfied.\n\nSample Input 2\n\n1 5 2 0\n\nSample Output 2\n\n01010", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 323, "cpu_time_ms": 270, "memory_kb": 5120}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s011923590", "group_id": "codeNet:p02906", "input_text": "module mod_tree_set\n implicit none\n type t_node\n private\n type(t_node), pointer :: left => null(), right => null()\n integer :: level = 1\n integer :: e = 0\n end type\n type t_tree_set\n private\n type(t_node), pointer :: root => null()\n integer :: deflt = -1\n contains\n procedure :: size => size_of\n procedure :: clear => clear\n procedure :: add => add\n procedure :: remove => remove\n procedure :: contain => contain\n procedure :: first => firste\n procedure :: poll_first => poll_first\n procedure :: last => laste\n procedure :: poll_last => poll_last\n procedure :: floor => floore\n procedure :: lower => lowere\n procedure :: ceiling => ceilinge\n procedure :: higher => highere\n procedure :: element_list => element_list\n end type\ncontains\n function new_node(e) result(n)\n integer, intent(in) :: e\n type(t_node), pointer :: n\n n => null()\n allocate(n)\n n%e = e\n end\n integer function level(n)\n type(t_node), pointer, intent(in) :: n\n level = 0\n if (.not.associated(n)) return\n level = n%level\n end\n logical function is_leaf(n)\n type(t_node), pointer, intent(in) :: n\n is_leaf = associated(n) .and. .not.associated(n%left) .and. &\n & .not.associated(n%right)\n end\n recursive function tree_size(n) result(s)\n type(t_node), pointer, intent(in) :: n\n integer :: s\n s = 0\n if (.not.associated(n)) return\n s = 1+tree_size(n%left)+tree_size(n%right)\n end\n function skew(n) result(l)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: l\n l => n\n if (.not.(associated(n) .and. associated(n%left) .and. &\n & n%left%level == n%level)) return\n l => n%left\n n%left => l%right\n l%right => n\n end\n function split(n) result(r)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: r\n r => n\n if (.not.(associated(n) .and. associated(n%right) .and. &\n & associated(n%right%right) .and. n%right%right%level == n%level)) return\n r => n%right\n n%right => r%left\n r%left => n\n r%level = r%level+1\n end\n function predecessor(n) result(p)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: p\n p => null()\n if (.not.associated(n%left)) return\n p => n%left\n do while (associated(p%right))\n p => p%right\n end do\n end\n function successor(n) result(s)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: s\n s => null()\n if (.not.associated(n%right)) return\n s => n%right\n do while (associated(s%left))\n s => s%left\n end do\n end\n recursive function insert(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n integer, intent(in) :: e\n type(t_node), pointer :: t\n t => new_node(e)\n if (.not.associated(n)) return\n t => n\n if (e < t%e) then\n t%left => insert(t%left,e)\n else if (e > t%e) then\n t%right => insert(t%right,e)\n end if\n t => skew(t)\n t => split(t)\n end\n recursive function delete(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n integer, intent(in) :: e\n type(t_node), pointer :: t, l\n t => n\n if (.not.associated(n)) return\n if (e < t%e) then\n t%left => delete(t%left,e)\n else if (e > t%e) then\n t%right => delete(t%right,e)\n else\n if (is_leaf(t)) then\n t => null()\n return\n end if\n if (.not.associated(t%left)) then\n l => successor(t)\n t%right => delete(t%right,l%e)\n t%e = l%e\n else\n l => predecessor(t)\n t%left => delete(t%left,l%e)\n t%e = l%e\n end if\n end if\n t => decrease_level(t)\n t => skew(t)\n t%right => skew(t%right)\n if (associated(t%right)) t%right%right => skew(t%right%right)\n t => split(t)\n t%right => split(t%right)\n end\n function decrease_level(n) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: t\n integer :: should_be\n t => n\n should_be = min(level(t%left),level(t%right))+1\n if (t%level > should_be) then\n t%level = should_be\n if (level(t%right) > should_be) t%right%level = should_be\n end if\n end\n recursive subroutine release_tree(t)\n type(t_node), pointer, intent(inout) :: t\n if (.not.associated(t)) return\n call release_tree(t%left)\n call release_tree(t%right)\n deallocate(t)\n end\n recursive subroutine get_element(t,es,num)\n type(t_node), pointer, intent(in) :: t\n integer, intent(inout) :: es(:)\n integer, intent(inout) :: num\n if (.not.associated(t)) return\n call get_element(t%left,es,num)\n num = num+1\n es(num) = t%e\n call get_element(t%right,es,num)\n end\n integer function size_of(this)\n class(t_tree_set), intent(in) :: this\n size_of = tree_size(this%root)\n end\n subroutine clear(this)\n class(t_tree_set), intent(inout) :: this\n call release_tree(this%root)\n this%root => null()\n end\n subroutine set_default(this,deflt)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: deflt\n this%deflt = deflt\n end\n subroutine add(this,e)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n this%root => insert(this%root,e)\n end\n subroutine remove(this,e)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n this%root => delete(this%root,e)\n end\n function contain(this,e) result(ret)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n type(t_node), pointer :: n\n logical :: ret\n ret = .false.\n n => this%root\n do while (associated(n))\n if (e < n%e) then\n n => n%left\n else if (e > n%e) then\n n => n%right\n else\n ret = .true.\n return\n end if\n end do\n end\n function firste(this) result(ret)\n class(t_tree_set), intent(inout) :: this\n type(t_node), pointer :: n\n integer :: ret\n ret = this%deflt\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%left))\n n => n%left\n end do\n ret = n%e\n end\n function poll_first(this) result(ret)\n class(t_tree_set), intent(inout) :: this\n type(t_node), pointer :: n\n integer :: ret\n ret = firste(this)\n if (ret /= this%deflt) this%root => delete(this%root,ret)\n end\n function laste(this) result(ret)\n class(t_tree_set), intent(inout) :: this\n type(t_node), pointer :: n\n integer :: ret\n ret = this%deflt\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%right))\n n => n%right\n end do\n ret = n%e\n end\n function poll_last(this) result(ret)\n class(t_tree_set), intent(inout) :: this\n type(t_node), pointer :: n\n integer :: ret\n ret = laste(this)\n if (ret /= this%deflt) this%root => delete(this%root,ret)\n end\n function floore(this,e) result(ret)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n type(t_node), pointer :: n\n integer :: ret\n ret = this%deflt\n n => this%root\n do while (associated(n))\n if (e < n%e) then\n n => n%left\n else if (e > n%e) then\n if (ret == this%deflt) ret = n%e\n if (e-ret > e-n%e) ret = n%e\n n => n%right\n else\n ret = n%e\n return\n end if\n end do\n end\n function lowere(this,e) result(ret)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n integer :: ret\n ret = floore(this,e-1)\n end\n function ceilinge(this,e) result(ret)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n type(t_node), pointer :: n\n integer :: ret\n ret = this%deflt\n n => this%root\n do while (associated(n))\n if (e < n%e) then\n if (ret == this%deflt) ret = n%e\n if (e-ret < e-n%e) ret = n%e\n n => n%left\n else if (e > n%e) then\n n => n%right\n else\n ret = n%e\n return\n end if\n end do\n end\n function highere(this,e) result(ret)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n integer :: ret\n ret = ceilinge(this,e+1)\n end\n subroutine element_list(this,es,num)\n class(t_tree_set), intent(inout) :: this\n integer, intent(out) :: es(:)\n integer, intent(out) :: num\n num = 0\n call get_element(this%root,es,num)\n end\nend module mod_tree_set\nmodule mod_union_find\n implicit none\n type union_find\n integer :: n = 0\n integer, pointer :: par(:), rnk(:), siz(:) => null()\n contains\n procedure :: init => inituf\n procedure :: release => releaseuf\n procedure :: find => find\n procedure :: same => same\n procedure :: unite => unite\n procedure :: size => size_of\n end type\n interface union_find\n module procedure :: newuf\n end interface union_find\ncontains\n function newuf(n) result(ret)\n integer, intent(in) :: n\n type(union_find) :: ret\n integer :: i\n ret%n = n\n allocate(ret%par(n),ret%rnk(n),ret%siz(n))\n ret%rnk = 0\n ret%siz = 1\n ret%par = [(i,i=1,n)]\n end\n subroutine inituf(this,n)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: n\n integer :: i\n if (this%n /= n) then\n if (this%n /= 0) deallocate(this%par,this%rnk,this%siz)\n allocate(this%par(n),this%rnk(n),this%siz(n))\n end if\n this%n = n\n this%rnk = 0\n this%siz = 1\n this%par = [(i,i=1,n)]\n end\n subroutine releaseuf(this)\n class(union_find), intent(inout) :: this\n if (this%n /= 0) deallocate(this%par,this%rnk,this%siz)\n this%n = 0\n end\n recursive function find(this,i) result(ret)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i\n integer :: ret\n if (this%par(i) /= i) this%par(i) = find(this,this%par(i))\n ret = this%par(i)\n end\n logical function same(this,i,j)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i, j\n same = find(this,i) == find(this,j)\n end\n subroutine unite(this,i,j)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i, j\n integer :: x, y\n x = find(this,i)\n y = find(this,j)\n if (x == y) return\n if (this%rnk(x) < this%rnk(y)) then\n this%par(x) = y\n this%siz(y) = this%siz(y)+this%siz(x)\n else\n this%par(y) = x\n this%siz(x) = this%siz(x)+this%siz(y)\n if (this%rnk(x) == this%rnk(y)) this%rnk(x) = this%rnk(x)+1\n end if\n end\n integer function size_of(this,i)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i\n size_of = this%siz(find(this,i))\n end\nend module mod_union_find\nprogram unique_path\n use mod_tree_set\n use mod_union_find\n implicit none\n type(t_tree_set) :: set\n type(union_find) :: uf\n integer :: n, m, q, a(100000) = 0, b(100000) = 0, c(100000) = 0, k, i\n read(*,*) n, m, q\n uf = union_find(n)\n do i = 1, q\n read(*,*) a(i), b(i), c(i)\n a(i) = a(i)+1\n b(i) = b(i)+1\n if (c(i) == 0) call uf%unite(a(i),b(i))\n end do\n if (m == n-1) then\n if (any(c(1:q) == 1)) then\n write(*,'(a)') \"No\"\n else\n write(*,'(a)') \"Yes\"\n end if\n stop\n end if\n do i = 1, q\n if (c(i) == 1 .and. uf%same(a(i),b(i))) then\n write(*,'(a)') \"No\"\n stop\n end if\n end do\n do i = 1, n\n call set%add(uf%find(i))\n end do\n k = set%size()\n if (int(m,8) <= int(n,8)+int(k,8)*(int(k,8)-3_8)/2_8) then\n write(*,'(a)') \"Yes\"\n else\n write(*,'(a)') \"No\"\n end if\nend program unique_path", "language": "Fortran", "metadata": {"date": 1569298574, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02906.html", "problem_id": "p02906", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02906/input.txt", "sample_output_relpath": "derived/input_output/data/p02906/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02906/Fortran/s011923590.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s011923590", "user_id": "u506403362"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "module mod_tree_set\n implicit none\n type t_node\n private\n type(t_node), pointer :: left => null(), right => null()\n integer :: level = 1\n integer :: e = 0\n end type\n type t_tree_set\n private\n type(t_node), pointer :: root => null()\n integer :: deflt = -1\n contains\n procedure :: size => size_of\n procedure :: clear => clear\n procedure :: add => add\n procedure :: remove => remove\n procedure :: contain => contain\n procedure :: first => firste\n procedure :: poll_first => poll_first\n procedure :: last => laste\n procedure :: poll_last => poll_last\n procedure :: floor => floore\n procedure :: lower => lowere\n procedure :: ceiling => ceilinge\n procedure :: higher => highere\n procedure :: element_list => element_list\n end type\ncontains\n function new_node(e) result(n)\n integer, intent(in) :: e\n type(t_node), pointer :: n\n n => null()\n allocate(n)\n n%e = e\n end\n integer function level(n)\n type(t_node), pointer, intent(in) :: n\n level = 0\n if (.not.associated(n)) return\n level = n%level\n end\n logical function is_leaf(n)\n type(t_node), pointer, intent(in) :: n\n is_leaf = associated(n) .and. .not.associated(n%left) .and. &\n & .not.associated(n%right)\n end\n recursive function tree_size(n) result(s)\n type(t_node), pointer, intent(in) :: n\n integer :: s\n s = 0\n if (.not.associated(n)) return\n s = 1+tree_size(n%left)+tree_size(n%right)\n end\n function skew(n) result(l)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: l\n l => n\n if (.not.(associated(n) .and. associated(n%left) .and. &\n & n%left%level == n%level)) return\n l => n%left\n n%left => l%right\n l%right => n\n end\n function split(n) result(r)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: r\n r => n\n if (.not.(associated(n) .and. associated(n%right) .and. &\n & associated(n%right%right) .and. n%right%right%level == n%level)) return\n r => n%right\n n%right => r%left\n r%left => n\n r%level = r%level+1\n end\n function predecessor(n) result(p)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: p\n p => null()\n if (.not.associated(n%left)) return\n p => n%left\n do while (associated(p%right))\n p => p%right\n end do\n end\n function successor(n) result(s)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: s\n s => null()\n if (.not.associated(n%right)) return\n s => n%right\n do while (associated(s%left))\n s => s%left\n end do\n end\n recursive function insert(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n integer, intent(in) :: e\n type(t_node), pointer :: t\n t => new_node(e)\n if (.not.associated(n)) return\n t => n\n if (e < t%e) then\n t%left => insert(t%left,e)\n else if (e > t%e) then\n t%right => insert(t%right,e)\n end if\n t => skew(t)\n t => split(t)\n end\n recursive function delete(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n integer, intent(in) :: e\n type(t_node), pointer :: t, l\n t => n\n if (.not.associated(n)) return\n if (e < t%e) then\n t%left => delete(t%left,e)\n else if (e > t%e) then\n t%right => delete(t%right,e)\n else\n if (is_leaf(t)) then\n t => null()\n return\n end if\n if (.not.associated(t%left)) then\n l => successor(t)\n t%right => delete(t%right,l%e)\n t%e = l%e\n else\n l => predecessor(t)\n t%left => delete(t%left,l%e)\n t%e = l%e\n end if\n end if\n t => decrease_level(t)\n t => skew(t)\n t%right => skew(t%right)\n if (associated(t%right)) t%right%right => skew(t%right%right)\n t => split(t)\n t%right => split(t%right)\n end\n function decrease_level(n) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: t\n integer :: should_be\n t => n\n should_be = min(level(t%left),level(t%right))+1\n if (t%level > should_be) then\n t%level = should_be\n if (level(t%right) > should_be) t%right%level = should_be\n end if\n end\n recursive subroutine release_tree(t)\n type(t_node), pointer, intent(inout) :: t\n if (.not.associated(t)) return\n call release_tree(t%left)\n call release_tree(t%right)\n deallocate(t)\n end\n recursive subroutine get_element(t,es,num)\n type(t_node), pointer, intent(in) :: t\n integer, intent(inout) :: es(:)\n integer, intent(inout) :: num\n if (.not.associated(t)) return\n call get_element(t%left,es,num)\n num = num+1\n es(num) = t%e\n call get_element(t%right,es,num)\n end\n integer function size_of(this)\n class(t_tree_set), intent(in) :: this\n size_of = tree_size(this%root)\n end\n subroutine clear(this)\n class(t_tree_set), intent(inout) :: this\n call release_tree(this%root)\n this%root => null()\n end\n subroutine set_default(this,deflt)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: deflt\n this%deflt = deflt\n end\n subroutine add(this,e)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n this%root => insert(this%root,e)\n end\n subroutine remove(this,e)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n this%root => delete(this%root,e)\n end\n function contain(this,e) result(ret)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n type(t_node), pointer :: n\n logical :: ret\n ret = .false.\n n => this%root\n do while (associated(n))\n if (e < n%e) then\n n => n%left\n else if (e > n%e) then\n n => n%right\n else\n ret = .true.\n return\n end if\n end do\n end\n function firste(this) result(ret)\n class(t_tree_set), intent(inout) :: this\n type(t_node), pointer :: n\n integer :: ret\n ret = this%deflt\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%left))\n n => n%left\n end do\n ret = n%e\n end\n function poll_first(this) result(ret)\n class(t_tree_set), intent(inout) :: this\n type(t_node), pointer :: n\n integer :: ret\n ret = firste(this)\n if (ret /= this%deflt) this%root => delete(this%root,ret)\n end\n function laste(this) result(ret)\n class(t_tree_set), intent(inout) :: this\n type(t_node), pointer :: n\n integer :: ret\n ret = this%deflt\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%right))\n n => n%right\n end do\n ret = n%e\n end\n function poll_last(this) result(ret)\n class(t_tree_set), intent(inout) :: this\n type(t_node), pointer :: n\n integer :: ret\n ret = laste(this)\n if (ret /= this%deflt) this%root => delete(this%root,ret)\n end\n function floore(this,e) result(ret)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n type(t_node), pointer :: n\n integer :: ret\n ret = this%deflt\n n => this%root\n do while (associated(n))\n if (e < n%e) then\n n => n%left\n else if (e > n%e) then\n if (ret == this%deflt) ret = n%e\n if (e-ret > e-n%e) ret = n%e\n n => n%right\n else\n ret = n%e\n return\n end if\n end do\n end\n function lowere(this,e) result(ret)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n integer :: ret\n ret = floore(this,e-1)\n end\n function ceilinge(this,e) result(ret)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n type(t_node), pointer :: n\n integer :: ret\n ret = this%deflt\n n => this%root\n do while (associated(n))\n if (e < n%e) then\n if (ret == this%deflt) ret = n%e\n if (e-ret < e-n%e) ret = n%e\n n => n%left\n else if (e > n%e) then\n n => n%right\n else\n ret = n%e\n return\n end if\n end do\n end\n function highere(this,e) result(ret)\n class(t_tree_set), intent(inout) :: this\n integer, intent(in) :: e\n integer :: ret\n ret = ceilinge(this,e+1)\n end\n subroutine element_list(this,es,num)\n class(t_tree_set), intent(inout) :: this\n integer, intent(out) :: es(:)\n integer, intent(out) :: num\n num = 0\n call get_element(this%root,es,num)\n end\nend module mod_tree_set\nmodule mod_union_find\n implicit none\n type union_find\n integer :: n = 0\n integer, pointer :: par(:), rnk(:), siz(:) => null()\n contains\n procedure :: init => inituf\n procedure :: release => releaseuf\n procedure :: find => find\n procedure :: same => same\n procedure :: unite => unite\n procedure :: size => size_of\n end type\n interface union_find\n module procedure :: newuf\n end interface union_find\ncontains\n function newuf(n) result(ret)\n integer, intent(in) :: n\n type(union_find) :: ret\n integer :: i\n ret%n = n\n allocate(ret%par(n),ret%rnk(n),ret%siz(n))\n ret%rnk = 0\n ret%siz = 1\n ret%par = [(i,i=1,n)]\n end\n subroutine inituf(this,n)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: n\n integer :: i\n if (this%n /= n) then\n if (this%n /= 0) deallocate(this%par,this%rnk,this%siz)\n allocate(this%par(n),this%rnk(n),this%siz(n))\n end if\n this%n = n\n this%rnk = 0\n this%siz = 1\n this%par = [(i,i=1,n)]\n end\n subroutine releaseuf(this)\n class(union_find), intent(inout) :: this\n if (this%n /= 0) deallocate(this%par,this%rnk,this%siz)\n this%n = 0\n end\n recursive function find(this,i) result(ret)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i\n integer :: ret\n if (this%par(i) /= i) this%par(i) = find(this,this%par(i))\n ret = this%par(i)\n end\n logical function same(this,i,j)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i, j\n same = find(this,i) == find(this,j)\n end\n subroutine unite(this,i,j)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i, j\n integer :: x, y\n x = find(this,i)\n y = find(this,j)\n if (x == y) return\n if (this%rnk(x) < this%rnk(y)) then\n this%par(x) = y\n this%siz(y) = this%siz(y)+this%siz(x)\n else\n this%par(y) = x\n this%siz(x) = this%siz(x)+this%siz(y)\n if (this%rnk(x) == this%rnk(y)) this%rnk(x) = this%rnk(x)+1\n end if\n end\n integer function size_of(this,i)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i\n size_of = this%siz(find(this,i))\n end\nend module mod_union_find\nprogram unique_path\n use mod_tree_set\n use mod_union_find\n implicit none\n type(t_tree_set) :: set\n type(union_find) :: uf\n integer :: n, m, q, a(100000) = 0, b(100000) = 0, c(100000) = 0, k, i\n read(*,*) n, m, q\n uf = union_find(n)\n do i = 1, q\n read(*,*) a(i), b(i), c(i)\n a(i) = a(i)+1\n b(i) = b(i)+1\n if (c(i) == 0) call uf%unite(a(i),b(i))\n end do\n if (m == n-1) then\n if (any(c(1:q) == 1)) then\n write(*,'(a)') \"No\"\n else\n write(*,'(a)') \"Yes\"\n end if\n stop\n end if\n do i = 1, q\n if (c(i) == 1 .and. uf%same(a(i),b(i))) then\n write(*,'(a)') \"No\"\n stop\n end if\n end do\n do i = 1, n\n call set%add(uf%find(i))\n end do\n k = set%size()\n if (int(m,8) <= int(n,8)+int(k,8)*(int(k,8)-3_8)/2_8) then\n write(*,'(a)') \"Yes\"\n else\n write(*,'(a)') \"No\"\n end if\nend program unique_path", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke's mother gave Snuke an undirected graph consisting of N vertices numbered 0 to N-1 and M edges.\nThis graph was connected and contained no parallel edges or self-loops.\n\nOne day, Snuke broke this graph.\nFortunately, he remembered Q clues about the graph.\nThe i-th clue (0 \\leq i \\leq Q-1) is represented as integers A_i,B_i,C_i and means the following:\n\nIf C_i=0: there was exactly one simple path (a path that never visits the same vertex twice) from Vertex A_i to B_i.\n\nIf C_i=1: there were two or more simple paths from Vertex A_i to B_i.\n\nSnuke is not sure if his memory is correct, and worried whether there is a graph that matches these Q clues.\nDetermine if there exists a graph that matches Snuke's memory.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\nN-1 \\leq M \\leq N \\times (N-1)/2\n\n1 \\leq Q \\leq 10^5\n\n0 \\leq A_i,B_i \\leq N-1\n\nA_i \\neq B_i\n\n0 \\leq C_i \\leq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nA_0 B_0 C_0\nA_1 B_1 C_1\n\\vdots\nA_{Q-1} B_{Q-1} C_{Q-1}\n\nOutput\n\nIf there exists a graph that matches Snuke's memory, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 5 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 1\n\nYes\n\nFor example, consider a graph with edges (0,1),(1,2),(1,4),(2,3),(2,4). This graph matches the clues.\n\nSample Input 2\n\n4 4 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 9 9\n7 6 0\n4 5 1\n9 7 0\n2 9 0\n2 3 0\n4 1 0\n8 0 0\n9 1 0\n3 0 0\n\nSample Output 3\n\nNo", "sample_input": "5 5 3\n0 1 0\n1 2 1\n2 3 0\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02906", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke's mother gave Snuke an undirected graph consisting of N vertices numbered 0 to N-1 and M edges.\nThis graph was connected and contained no parallel edges or self-loops.\n\nOne day, Snuke broke this graph.\nFortunately, he remembered Q clues about the graph.\nThe i-th clue (0 \\leq i \\leq Q-1) is represented as integers A_i,B_i,C_i and means the following:\n\nIf C_i=0: there was exactly one simple path (a path that never visits the same vertex twice) from Vertex A_i to B_i.\n\nIf C_i=1: there were two or more simple paths from Vertex A_i to B_i.\n\nSnuke is not sure if his memory is correct, and worried whether there is a graph that matches these Q clues.\nDetermine if there exists a graph that matches Snuke's memory.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\nN-1 \\leq M \\leq N \\times (N-1)/2\n\n1 \\leq Q \\leq 10^5\n\n0 \\leq A_i,B_i \\leq N-1\n\nA_i \\neq B_i\n\n0 \\leq C_i \\leq 1\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nA_0 B_0 C_0\nA_1 B_1 C_1\n\\vdots\nA_{Q-1} B_{Q-1} C_{Q-1}\n\nOutput\n\nIf there exists a graph that matches Snuke's memory, print Yes; otherwise, print No.\n\nSample Input 1\n\n5 5 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 1\n\nYes\n\nFor example, consider a graph with edges (0,1),(1,2),(1,4),(2,3),(2,4). This graph matches the clues.\n\nSample Input 2\n\n4 4 3\n0 1 0\n1 2 1\n2 3 0\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 9 9\n7 6 0\n4 5 1\n9 7 0\n2 9 0\n2 3 0\n4 1 0\n8 0 0\n9 1 0\n3 0 0\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 11339, "cpu_time_ms": 183, "memory_kb": 73976}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s211756314", "group_id": "codeNet:p02909", "input_text": "program sample\n\tcharacter(len=1) :: a\n \n read(*,*) a\n \n if (a=='S') then\n \twrite(*,*) 'Cloudy'\n else if (a=='C') then\n \twrite(*,*) 'Rainy'\n else\n \twrite(*,*) 'Sunny'\n end if\n stop\nend program sample", "language": "Fortran", "metadata": {"date": 1592632908, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02909.html", "problem_id": "p02909", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02909/input.txt", "sample_output_relpath": "derived/input_output/data/p02909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02909/Fortran/s211756314.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s211756314", "user_id": "u323210830"}, "prompt_components": {"gold_output": "Cloudy\n", "input_to_evaluate": "program sample\n\tcharacter(len=1) :: a\n \n read(*,*) a\n \n if (a=='S') then\n \twrite(*,*) 'Cloudy'\n else if (a=='C') then\n \twrite(*,*) 'Rainy'\n else\n \twrite(*,*) 'Sunny'\n end if\n stop\nend program sample", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "sample_input": "Sunny\n"}, "reference_outputs": ["Cloudy\n"], "source_document_id": "p02909", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 231, "cpu_time_ms": 6, "memory_kb": 2652}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s477346928", "group_id": "codeNet:p02909", "input_text": "character(10) S\nread*,S\nif(trim(S)==\"Sunny\")print\"(A)\",\"Cloudy\"\nif(trim(S)==\"Cloudy\")print\"(A)\",\"Rainy\"\nif(trim(S)==\"Rainy\")print\"(A)\",\"Sunny\"\nend", "language": "Fortran", "metadata": {"date": 1568595758, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02909.html", "problem_id": "p02909", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02909/input.txt", "sample_output_relpath": "derived/input_output/data/p02909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02909/Fortran/s477346928.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s477346928", "user_id": "u598073939"}, "prompt_components": {"gold_output": "Cloudy\n", "input_to_evaluate": "character(10) S\nread*,S\nif(trim(S)==\"Sunny\")print\"(A)\",\"Cloudy\"\nif(trim(S)==\"Cloudy\")print\"(A)\",\"Rainy\"\nif(trim(S)==\"Rainy\")print\"(A)\",\"Sunny\"\nend", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "sample_input": "Sunny\n"}, "reference_outputs": ["Cloudy\n"], "source_document_id": "p02909", "source_text": "Score: 100 points\n\nProblem Statement\n\nThe weather in Takahashi's town changes day by day, in the following cycle: Sunny, Cloudy, Rainy, Sunny, Cloudy, Rainy, ...\n\nGiven is a string S representing the weather in the town today. Predict the weather tomorrow.\n\nConstraints\n\nS is Sunny, Cloudy, or Rainy.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint a string representing the expected weather tomorrow, in the same format in which input is given.\n\nSample Input 1\n\nSunny\n\nSample Output 1\n\nCloudy\n\nIn Takahashi's town, a sunny day is followed by a cloudy day.\n\nSample Input 2\n\nRainy\n\nSample Output 2\n\nSunny", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 146, "cpu_time_ms": 7, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s425645213", "group_id": "codeNet:p02910", "input_text": "program test\nimplicit none\ninteger::i,n,check\ncharacter::S*100\ncheck=0\nread*,S\nS=trim(S)\nn=len(S)\ndo i=1,n\n\tif(mod(i,2)==1)then\n \tif(S(i:i)=='L')then\n \tcheck=check+1\n else \n \tcheck=check\n end if\n else \n \tif(S(i:i)=='R')then\n \tcheck=check+1\n else \n \tcheck=check\n end if\n end if\nend do\nif(check==0)then \n\tprint*,'Yes'\nelse \n\tprint*,'No'\nend if\nend program test", "language": "Fortran", "metadata": {"date": 1568596522, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02910.html", "problem_id": "p02910", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02910/input.txt", "sample_output_relpath": "derived/input_output/data/p02910/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02910/Fortran/s425645213.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s425645213", "user_id": "u723571904"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program test\nimplicit none\ninteger::i,n,check\ncharacter::S*100\ncheck=0\nread*,S\nS=trim(S)\nn=len(S)\ndo i=1,n\n\tif(mod(i,2)==1)then\n \tif(S(i:i)=='L')then\n \tcheck=check+1\n else \n \tcheck=check\n end if\n else \n \tif(S(i:i)=='R')then\n \tcheck=check+1\n else \n \tcheck=check\n end if\n end if\nend do\nif(check==0)then \n\tprint*,'Yes'\nelse \n\tprint*,'No'\nend if\nend program test", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi will do a tap dance. The dance is described by a string S where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.\n\nS is said to be easily playable if and only if it satisfies both of the following conditions:\n\nEvery character in an odd position (1-st, 3-rd, 5-th, \\ldots) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th, \\ldots) is L, U, or D.\n\nYour task is to print Yes if S is easily playable, and No otherwise.\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nEach character of S is L, R, U, or D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Yes if S is easily playable, and No otherwise.\n\nSample Input 1\n\nRUDLUDR\n\nSample Output 1\n\nYes\n\nEvery character in an odd position (1-st, 3-rd, 5-th, 7-th) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th) is L, U, or D.\n\nThus, S is easily playable.\n\nSample Input 2\n\nDULL\n\nSample Output 2\n\nNo\n\nThe 3-rd character is not R, U, nor D, so S is not easily playable.\n\nSample Input 3\n\nUUUUUUUUUUUUUUU\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nULURU\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nRDULULDURURLRDULRLR\n\nSample Output 5\n\nYes", "sample_input": "RUDLUDR\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02910", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi will do a tap dance. The dance is described by a string S where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.\n\nS is said to be easily playable if and only if it satisfies both of the following conditions:\n\nEvery character in an odd position (1-st, 3-rd, 5-th, \\ldots) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th, \\ldots) is L, U, or D.\n\nYour task is to print Yes if S is easily playable, and No otherwise.\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nEach character of S is L, R, U, or D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Yes if S is easily playable, and No otherwise.\n\nSample Input 1\n\nRUDLUDR\n\nSample Output 1\n\nYes\n\nEvery character in an odd position (1-st, 3-rd, 5-th, 7-th) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th) is L, U, or D.\n\nThus, S is easily playable.\n\nSample Input 2\n\nDULL\n\nSample Output 2\n\nNo\n\nThe 3-rd character is not R, U, nor D, so S is not easily playable.\n\nSample Input 3\n\nUUUUUUUUUUUUUUU\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nULURU\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nRDULULDURURLRDULRLR\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 432, "cpu_time_ms": 5, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s866109825", "group_id": "codeNet:p02910", "input_text": "program main\n\n implicit none\n character(len=100) S\n integer :: lnS, i\n\n read(*,*) S\n\n lnS = len(trim(S))\n\n ! check odd\n do i = 1,lnS,2\n if ( S(i:i) == \"L\") then\n write(*,'(a)') \"No\"\n stop\n end if\n end do\n ! check even\n do i = 2,lnS,2\n if ( S(i:i) == \"R\") then\n write(*,'(a)') \"No\"\n stop\n end if\n end do\n\n write(*,'(a)') \"Yes\"\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1568596141, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02910.html", "problem_id": "p02910", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02910/input.txt", "sample_output_relpath": "derived/input_output/data/p02910/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02910/Fortran/s866109825.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s866109825", "user_id": "u886432251"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n\n implicit none\n character(len=100) S\n integer :: lnS, i\n\n read(*,*) S\n\n lnS = len(trim(S))\n\n ! check odd\n do i = 1,lnS,2\n if ( S(i:i) == \"L\") then\n write(*,'(a)') \"No\"\n stop\n end if\n end do\n ! check even\n do i = 2,lnS,2\n if ( S(i:i) == \"R\") then\n write(*,'(a)') \"No\"\n stop\n end if\n end do\n\n write(*,'(a)') \"Yes\"\n\nend program main\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi will do a tap dance. The dance is described by a string S where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.\n\nS is said to be easily playable if and only if it satisfies both of the following conditions:\n\nEvery character in an odd position (1-st, 3-rd, 5-th, \\ldots) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th, \\ldots) is L, U, or D.\n\nYour task is to print Yes if S is easily playable, and No otherwise.\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nEach character of S is L, R, U, or D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Yes if S is easily playable, and No otherwise.\n\nSample Input 1\n\nRUDLUDR\n\nSample Output 1\n\nYes\n\nEvery character in an odd position (1-st, 3-rd, 5-th, 7-th) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th) is L, U, or D.\n\nThus, S is easily playable.\n\nSample Input 2\n\nDULL\n\nSample Output 2\n\nNo\n\nThe 3-rd character is not R, U, nor D, so S is not easily playable.\n\nSample Input 3\n\nUUUUUUUUUUUUUUU\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nULURU\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nRDULULDURURLRDULRLR\n\nSample Output 5\n\nYes", "sample_input": "RUDLUDR\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02910", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi will do a tap dance. The dance is described by a string S where each character is L, R, U, or D. These characters indicate the positions on which Takahashi should step. He will follow these instructions one by one in order, starting with the first character.\n\nS is said to be easily playable if and only if it satisfies both of the following conditions:\n\nEvery character in an odd position (1-st, 3-rd, 5-th, \\ldots) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th, \\ldots) is L, U, or D.\n\nYour task is to print Yes if S is easily playable, and No otherwise.\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nEach character of S is L, R, U, or D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Yes if S is easily playable, and No otherwise.\n\nSample Input 1\n\nRUDLUDR\n\nSample Output 1\n\nYes\n\nEvery character in an odd position (1-st, 3-rd, 5-th, 7-th) is R, U, or D.\n\nEvery character in an even position (2-nd, 4-th, 6-th) is L, U, or D.\n\nThus, S is easily playable.\n\nSample Input 2\n\nDULL\n\nSample Output 2\n\nNo\n\nThe 3-rd character is not R, U, nor D, so S is not easily playable.\n\nSample Input 3\n\nUUUUUUUUUUUUUUU\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nULURU\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nRDULULDURURLRDULRLR\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 400, "cpu_time_ms": 9, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s358171341", "group_id": "codeNet:p02911", "input_text": " program answer\n implicit none\n integer(4) :: N, K, Q\n integer(4),allocatable,dimension(:) :: A,num\n integer(4) :: i\n read(*,*) N,K,Q\n allocate(A(N),num(Q))\n num=0\n do i=1,N\n A(i) = 0\n end do\n do i=1,Q\n read(*,*) num(i)\n A(num(i)) = A(num(i)) + 1\n end do\n do i=1,N\n if( (Q-A(i)) < K) then\n write(*,'(A)') 'Yse'\n else\n write(*,'(A)') 'No'\n end if\n end do\n stop\n end program answer", "language": "Fortran", "metadata": {"date": 1568598220, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02911.html", "problem_id": "p02911", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02911/input.txt", "sample_output_relpath": "derived/input_output/data/p02911/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02911/Fortran/s358171341.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s358171341", "user_id": "u954587078"}, "prompt_components": {"gold_output": "No\nNo\nYes\nNo\nNo\nNo\n", "input_to_evaluate": " program answer\n implicit none\n integer(4) :: N, K, Q\n integer(4),allocatable,dimension(:) :: A,num\n integer(4) :: i\n read(*,*) N,K,Q\n allocate(A(N),num(Q))\n num=0\n do i=1,N\n A(i) = 0\n end do\n do i=1,Q\n read(*,*) num(i)\n A(num(i)) = A(num(i)) + 1\n end do\n do i=1,N\n if( (Q-A(i)) < K) then\n write(*,'(A)') 'Yse'\n else\n write(*,'(A)') 'No'\n end if\n end do\n stop\n end program answer", "problem_context": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "sample_input": "6 3 4\n3\n1\n3\n2\n"}, "reference_outputs": ["No\nNo\nYes\nNo\nNo\nNo\n"], "source_document_id": "p02911", "source_text": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 519, "cpu_time_ms": 59, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s058728505", "group_id": "codeNet:p02911", "input_text": " program answer\n implicit none\n integer(4) :: N, K, Q\n integer(4),allocatable,dimension(:) :: A\n integer(4) :: i,num\n read(*,*) N,K,Q\n allocate(A(N))\n num=0\n do i=1,N\n A(i) = 0\n end do\n do i=1,Q\n read(*,*) num\n A(num) = A(num) + 1\n num=0\n end do\n if( N < 2 .or. K < 1 .or. Q < 1 ) stop\n do i=1,N\n if( (Q-A(i)) < K) then\n write(*,'(A)') 'Yse'\n else\n write(*,'(A)') 'No'\n end if\n end do\n stop\n end program answer", "language": "Fortran", "metadata": {"date": 1568598013, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02911.html", "problem_id": "p02911", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02911/input.txt", "sample_output_relpath": "derived/input_output/data/p02911/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02911/Fortran/s058728505.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s058728505", "user_id": "u954587078"}, "prompt_components": {"gold_output": "No\nNo\nYes\nNo\nNo\nNo\n", "input_to_evaluate": " program answer\n implicit none\n integer(4) :: N, K, Q\n integer(4),allocatable,dimension(:) :: A\n integer(4) :: i,num\n read(*,*) N,K,Q\n allocate(A(N))\n num=0\n do i=1,N\n A(i) = 0\n end do\n do i=1,Q\n read(*,*) num\n A(num) = A(num) + 1\n num=0\n end do\n if( N < 2 .or. K < 1 .or. Q < 1 ) stop\n do i=1,N\n if( (Q-A(i)) < K) then\n write(*,'(A)') 'Yse'\n else\n write(*,'(A)') 'No'\n end if\n end do\n stop\n end program answer", "problem_context": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "sample_input": "6 3 4\n3\n1\n3\n2\n"}, "reference_outputs": ["No\nNo\nYes\nNo\nNo\nNo\n"], "source_document_id": "p02911", "source_text": "Score: 300 points\n\nProblem Statement\n\nTakahashi has decided to hold fastest-finger-fast quiz games. Kizahashi, who is in charge of making the scoreboard, is struggling to write the program that manages the players' scores in a game, which proceeds as follows.\n\nA game is played by N players, numbered 1 to N. At the beginning of a game, each player has K points.\n\nWhen a player correctly answers a question, each of the other N-1 players receives minus one (-1) point. There is no other factor that affects the players' scores.\n\nAt the end of a game, the players with 0 points or lower are eliminated, and the remaining players survive.\n\nIn the last game, the players gave a total of Q correct answers, the i-th of which was given by Player A_i.\nFor Kizahashi, write a program that determines whether each of the N players survived this game.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq A_i \\leq N\\ (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K Q\nA_1\nA_2\n.\n.\n.\nA_Q\n\nOutput\n\nPrint N lines. The i-th line should contain Yes if Player i survived the game, and No otherwise.\n\nSample Input 1\n\n6 3 4\n3\n1\n3\n2\n\nSample Output 1\n\nNo\nNo\nYes\nNo\nNo\nNo\n\nIn the beginning, the players' scores are (3, 3, 3, 3, 3, 3).\n\nPlayer 3 correctly answers a question. The players' scores are now (2, 2, 3, 2, 2, 2).\n\nPlayer 1 correctly answers a question. The players' scores are now (2, 1, 2, 1, 1, 1).\n\nPlayer 3 correctly answers a question. The players' scores are now (1, 0, 2, 0, 0, 0).\n\nPlayer 2 correctly answers a question. The players' scores are now (0, 0, 1, -1, -1, -1).\n\nPlayers 1, 2, 4, 5 and 6, who have 0 points or lower, are eliminated, and Player 3 survives this game.\n\nSample Input 2\n\n6 5 4\n3\n1\n3\n2\n\nSample Output 2\n\nYes\nYes\nYes\nYes\nYes\nYes\n\nSample Input 3\n\n10 13 15\n3\n1\n4\n1\n5\n9\n2\n6\n5\n3\n5\n8\n9\n7\n9\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nYes\nNo\nNo\nNo\nYes\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 562, "cpu_time_ms": 58, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s493508224", "group_id": "codeNet:p02917", "input_text": "program abc140c\n integer :: n, a(100)\n read *, n, a(:n-1)\n print *, sum(merge(a(2:n-1),a(:n-2),a(2:n-1)s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_C\n\n ! contained s and s are below\n contains\n\n subroutine task_C\n\n ! variables for this \n integer(INT64) :: len_sequence_A\n integer(INT64) :: val_sum_sequence_A\n\n ! arrays for this \n integer(INT64), dimension(:), allocatable :: val_sequence_B\n\n ! support variables for this \n integer :: itr\n\n ! STEP.01\n ! read out the given data\n ! (the length of the sequence B)\n read(unit=INPUT_UNIT, fmt=*) len_sequence_A\n\n ! STEP.02\n ! allocate the arrays to store the given data\n allocate( val_sequence_B(1:len_sequence_A - 1) )\n\n ! STEP.03\n ! read out the given data\n ! (the values of the sequence B)\n read(unit=INPUT_UNIT, fmt=*) val_sequence_B(:)\n\n ! STEP.04\n ! calculate the answer of this task\n val_sum_sequence_A &!\n = val_sequence_B(len_sequence_A - 1) &!\n + val_sequence_B(1)\n\n do itr = len_sequence_A - 1, 2, -1\n val_sum_sequence_A = val_sum_sequence_A + min(val_sequence_B(itr), val_sequence_B(itr - 1))\n end do\n\n ! STEP.05\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') val_sum_sequence_A\n\n ! STEP.06\n ! deallocate the arrays to store the given data\n deallocate( val_sequence_B )\n\n ! STEP.END\n return\n\n end subroutine task_C\n\nend module ABC140\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC140\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_C\n\nend program main", "language": "Fortran", "metadata": {"date": 1567906578, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02917.html", "problem_id": "p02917", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02917/input.txt", "sample_output_relpath": "derived/input_output/data/p02917/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02917/Fortran/s759645246.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s759645246", "user_id": "u484703930"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "module ABC140\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_C\n\n ! contained s and s are below\n contains\n\n subroutine task_C\n\n ! variables for this \n integer(INT64) :: len_sequence_A\n integer(INT64) :: val_sum_sequence_A\n\n ! arrays for this \n integer(INT64), dimension(:), allocatable :: val_sequence_B\n\n ! support variables for this \n integer :: itr\n\n ! STEP.01\n ! read out the given data\n ! (the length of the sequence B)\n read(unit=INPUT_UNIT, fmt=*) len_sequence_A\n\n ! STEP.02\n ! allocate the arrays to store the given data\n allocate( val_sequence_B(1:len_sequence_A - 1) )\n\n ! STEP.03\n ! read out the given data\n ! (the values of the sequence B)\n read(unit=INPUT_UNIT, fmt=*) val_sequence_B(:)\n\n ! STEP.04\n ! calculate the answer of this task\n val_sum_sequence_A &!\n = val_sequence_B(len_sequence_A - 1) &!\n + val_sequence_B(1)\n\n do itr = len_sequence_A - 1, 2, -1\n val_sum_sequence_A = val_sum_sequence_A + min(val_sequence_B(itr), val_sequence_B(itr - 1))\n end do\n\n ! STEP.05\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') val_sum_sequence_A\n\n ! STEP.06\n ! deallocate the arrays to store the given data\n deallocate( val_sequence_B )\n\n ! STEP.END\n return\n\n end subroutine task_C\n\nend module ABC140\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC140\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_C\n\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is an integer sequence A of length N whose values are unknown.\n\nGiven is an integer sequence B of length N-1 which is known to satisfy the following:\n\nB_i \\geq \\max(A_i, A_{i+1})\n\nFind the maximum possible sum of the elements of A.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n0 \\leq B_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nB_1 B_2 ... B_{N-1}\n\nOutput\n\nPrint the maximum possible sum of the elements of A.\n\nSample Input 1\n\n3\n2 5\n\nSample Output 1\n\n9\n\nA can be, for example, ( 2 , 1 , 5 ), ( -1 , -2 , -3 ), or ( 2 , 2 , 5 ). Among those candidates, A = ( 2 , 2 , 5 ) has the maximum possible sum.\n\nSample Input 2\n\n2\n3\n\nSample Output 2\n\n6\n\nSample Input 3\n\n6\n0 153 10 10 23\n\nSample Output 3\n\n53", "sample_input": "3\n2 5\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02917", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is an integer sequence A of length N whose values are unknown.\n\nGiven is an integer sequence B of length N-1 which is known to satisfy the following:\n\nB_i \\geq \\max(A_i, A_{i+1})\n\nFind the maximum possible sum of the elements of A.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n0 \\leq B_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nB_1 B_2 ... B_{N-1}\n\nOutput\n\nPrint the maximum possible sum of the elements of A.\n\nSample Input 1\n\n3\n2 5\n\nSample Output 1\n\n9\n\nA can be, for example, ( 2 , 1 , 5 ), ( -1 , -2 , -3 ), or ( 2 , 2 , 5 ). Among those candidates, A = ( 2 , 2 , 5 ) has the maximum possible sum.\n\nSample Input 2\n\n2\n3\n\nSample Output 2\n\n6\n\nSample Input 3\n\n6\n0 153 10 10 23\n\nSample Output 3\n\n53", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1750, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s292324412", "group_id": "codeNet:p02918", "input_text": "program prob6\n implicit none\n integer :: N, K, i, a, b, ans\n character(100005) :: S\n read(*,*) N, K, S\n \n ans = 0\n do i = 2, N-1\n if(S(i:i) == 'L')then\n if(S(i-1:i-1) == 'L')then\n ans = ans + 1\n end if\n end if\n if(S(i:i) == 'R')then\n if(S(i+1:i+1) == 'R')then\n ans = ans + 1\n end if\n end if\n end do\n if(S(1:1) == 'R')then\n if(S(2:2) == 'R')then\n ans = ans + 1\n end if\n end if\n if(S(N:N) == 'L')then\n if(S(N-1:N-1) == 'L')then\n ans = ans + 1\n end if\n end if\n\n a = 0\n b = 0\n do i = 1, N-1\n if(S(i:i) == 'L' .and. S(i+1:i+1) == 'R')then\n a = a + 1\n end if\n if(S(i:i) == 'R' .and. S(i+1:i+1) == 'L')then\n b = b + 1\n end if\n end do\n ans = ans + 2 * min(a, min(b, K))\n if(K > min(a, b)) then\n ans = ans + K - min(a, b)\n end if\n ans = min(ans, N-1)\n\n write(*,*) ans\n\n stop\ncontains\nend program prob6", "language": "Fortran", "metadata": {"date": 1595641911, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02918.html", "problem_id": "p02918", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02918/input.txt", "sample_output_relpath": "derived/input_output/data/p02918/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02918/Fortran/s292324412.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s292324412", "user_id": "u478462004"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program prob6\n implicit none\n integer :: N, K, i, a, b, ans\n character(100005) :: S\n read(*,*) N, K, S\n \n ans = 0\n do i = 2, N-1\n if(S(i:i) == 'L')then\n if(S(i-1:i-1) == 'L')then\n ans = ans + 1\n end if\n end if\n if(S(i:i) == 'R')then\n if(S(i+1:i+1) == 'R')then\n ans = ans + 1\n end if\n end if\n end do\n if(S(1:1) == 'R')then\n if(S(2:2) == 'R')then\n ans = ans + 1\n end if\n end if\n if(S(N:N) == 'L')then\n if(S(N-1:N-1) == 'L')then\n ans = ans + 1\n end if\n end if\n\n a = 0\n b = 0\n do i = 1, N-1\n if(S(i:i) == 'L' .and. S(i+1:i+1) == 'R')then\n a = a + 1\n end if\n if(S(i:i) == 'R' .and. S(i+1:i+1) == 'L')then\n b = b + 1\n end if\n end do\n ans = ans + 2 * min(a, min(b, K))\n if(K > min(a, b)) then\n ans = ans + K - min(a, b)\n end if\n ans = min(ans, N-1)\n\n write(*,*) ans\n\n stop\ncontains\nend program prob6", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing in a queue from west to east.\n\nGiven is a string S of length N representing the directions of the people.\nThe i-th person from the west is facing west if the i-th character of S is L, and east if that character of S is R.\n\nA person is happy if the person in front of him/her is facing the same direction.\nIf no person is standing in front of a person, however, he/she is not happy.\n\nYou can perform the following operation any number of times between 0 and K (inclusive):\n\nOperation: Choose integers l and r such that 1 \\leq l \\leq r \\leq N, and rotate by 180 degrees the part of the queue: the l-th, (l+1)-th, ..., r-th persons. That is, for each i = 0, 1, ..., r-l, the (l + i)-th person from the west will stand the (r - i)-th from the west after the operation, facing east if he/she is facing west now, and vice versa.\n\nWhat is the maximum possible number of happy people you can have?\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\n|S| = N\n\nEach character of S is L or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of happy people after at most K operations.\n\nSample Input 1\n\n6 1\nLRLRRL\n\nSample Output 1\n\n3\n\nIf we choose (l, r) = (2, 5), we have LLLRLL, where the 2-nd, 3-rd, and 6-th persons from the west are happy.\n\nSample Input 2\n\n13 3\nLRRLRLRRLRLLR\n\nSample Output 2\n\n9\n\nSample Input 3\n\n10 1\nLLLLLRRRRR\n\nSample Output 3\n\n9\n\nSample Input 4\n\n9 2\nRRRLRLRLL\n\nSample Output 4\n\n7", "sample_input": "6 1\nLRLRRL\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02918", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing in a queue from west to east.\n\nGiven is a string S of length N representing the directions of the people.\nThe i-th person from the west is facing west if the i-th character of S is L, and east if that character of S is R.\n\nA person is happy if the person in front of him/her is facing the same direction.\nIf no person is standing in front of a person, however, he/she is not happy.\n\nYou can perform the following operation any number of times between 0 and K (inclusive):\n\nOperation: Choose integers l and r such that 1 \\leq l \\leq r \\leq N, and rotate by 180 degrees the part of the queue: the l-th, (l+1)-th, ..., r-th persons. That is, for each i = 0, 1, ..., r-l, the (l + i)-th person from the west will stand the (r - i)-th from the west after the operation, facing east if he/she is facing west now, and vice versa.\n\nWhat is the maximum possible number of happy people you can have?\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\n|S| = N\n\nEach character of S is L or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of happy people after at most K operations.\n\nSample Input 1\n\n6 1\nLRLRRL\n\nSample Output 1\n\n3\n\nIf we choose (l, r) = (2, 5), we have LLLRLL, where the 2-nd, 3-rd, and 6-th persons from the west are happy.\n\nSample Input 2\n\n13 3\nLRRLRLRRLRLLR\n\nSample Output 2\n\n9\n\nSample Input 3\n\n10 1\nLLLLLRRRRR\n\nSample Output 3\n\n9\n\nSample Input 4\n\n9 2\nRRRLRLRLL\n\nSample Output 4\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1067, "cpu_time_ms": 11, "memory_kb": 3096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s006202767", "group_id": "codeNet:p02918", "input_text": "program main\n implicit none\n integer:: n, k, i, j, l,r\n integer,allocatable:: cnum(:)\n character(10**5):: s\n integer:: hap\n hap = 0\n read*, n, k\n read*, s\n \n allocate(cnum(n+2))\n\n do i = 2, n+1\n if(s(i-1:i-1) == 'L')then\n cnum(i) = -1\n else\n cnum(i) = 1\n endif\n enddo\n cnum(1) = -1\n cnum(n+2) = 1\n ! print*, cnum\n do i = 2, n\n if (cnum(i) == cnum(i+1))then\n hap = hap + 1\n ! print*, i\n endif\n enddo\n\n\n\n l = 0\n r = 0\n do i=1,n+2\n if (cnum(i) == cnum(i+1))cycle\n if(cnum(i) == -1)then\n ! print*, 'l'\n l = l + 1\n endif\n\n if(cnum(i) == 1)then\n ! print*, 'r'\n r = r + 1\n endif\n enddo\n\n \n\n\n print*,hap + min(k,min(l,r))*2\n \n\nend program", "language": "Fortran", "metadata": {"date": 1567911948, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02918.html", "problem_id": "p02918", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02918/input.txt", "sample_output_relpath": "derived/input_output/data/p02918/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02918/Fortran/s006202767.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s006202767", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n implicit none\n integer:: n, k, i, j, l,r\n integer,allocatable:: cnum(:)\n character(10**5):: s\n integer:: hap\n hap = 0\n read*, n, k\n read*, s\n \n allocate(cnum(n+2))\n\n do i = 2, n+1\n if(s(i-1:i-1) == 'L')then\n cnum(i) = -1\n else\n cnum(i) = 1\n endif\n enddo\n cnum(1) = -1\n cnum(n+2) = 1\n ! print*, cnum\n do i = 2, n\n if (cnum(i) == cnum(i+1))then\n hap = hap + 1\n ! print*, i\n endif\n enddo\n\n\n\n l = 0\n r = 0\n do i=1,n+2\n if (cnum(i) == cnum(i+1))cycle\n if(cnum(i) == -1)then\n ! print*, 'l'\n l = l + 1\n endif\n\n if(cnum(i) == 1)then\n ! print*, 'r'\n r = r + 1\n endif\n enddo\n\n \n\n\n print*,hap + min(k,min(l,r))*2\n \n\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing in a queue from west to east.\n\nGiven is a string S of length N representing the directions of the people.\nThe i-th person from the west is facing west if the i-th character of S is L, and east if that character of S is R.\n\nA person is happy if the person in front of him/her is facing the same direction.\nIf no person is standing in front of a person, however, he/she is not happy.\n\nYou can perform the following operation any number of times between 0 and K (inclusive):\n\nOperation: Choose integers l and r such that 1 \\leq l \\leq r \\leq N, and rotate by 180 degrees the part of the queue: the l-th, (l+1)-th, ..., r-th persons. That is, for each i = 0, 1, ..., r-l, the (l + i)-th person from the west will stand the (r - i)-th from the west after the operation, facing east if he/she is facing west now, and vice versa.\n\nWhat is the maximum possible number of happy people you can have?\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\n|S| = N\n\nEach character of S is L or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of happy people after at most K operations.\n\nSample Input 1\n\n6 1\nLRLRRL\n\nSample Output 1\n\n3\n\nIf we choose (l, r) = (2, 5), we have LLLRLL, where the 2-nd, 3-rd, and 6-th persons from the west are happy.\n\nSample Input 2\n\n13 3\nLRRLRLRRLRLLR\n\nSample Output 2\n\n9\n\nSample Input 3\n\n10 1\nLLLLLRRRRR\n\nSample Output 3\n\n9\n\nSample Input 4\n\n9 2\nRRRLRLRLL\n\nSample Output 4\n\n7", "sample_input": "6 1\nLRLRRL\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02918", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing in a queue from west to east.\n\nGiven is a string S of length N representing the directions of the people.\nThe i-th person from the west is facing west if the i-th character of S is L, and east if that character of S is R.\n\nA person is happy if the person in front of him/her is facing the same direction.\nIf no person is standing in front of a person, however, he/she is not happy.\n\nYou can perform the following operation any number of times between 0 and K (inclusive):\n\nOperation: Choose integers l and r such that 1 \\leq l \\leq r \\leq N, and rotate by 180 degrees the part of the queue: the l-th, (l+1)-th, ..., r-th persons. That is, for each i = 0, 1, ..., r-l, the (l + i)-th person from the west will stand the (r - i)-th from the west after the operation, facing east if he/she is facing west now, and vice versa.\n\nWhat is the maximum possible number of happy people you can have?\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\n|S| = N\n\nEach character of S is L or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of happy people after at most K operations.\n\nSample Input 1\n\n6 1\nLRLRRL\n\nSample Output 1\n\n3\n\nIf we choose (l, r) = (2, 5), we have LLLRLL, where the 2-nd, 3-rd, and 6-th persons from the west are happy.\n\nSample Input 2\n\n13 3\nLRRLRLRRLRLLR\n\nSample Output 2\n\n9\n\nSample Input 3\n\n10 1\nLLLLLRRRRR\n\nSample Output 3\n\n9\n\nSample Input 4\n\n9 2\nRRRLRLRLL\n\nSample Output 4\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 860, "cpu_time_ms": 3, "memory_kb": 932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s430027444", "group_id": "codeNet:p02918", "input_text": "program main\n implicit none\n integer:: n, k, i, j, l,r\n integer,allocatable:: cnum(:)\n character(10**5):: s\n integer:: hap\n hap = 0\n read*, n, k\n read*, s\n \n allocate(cnum(n+1))\n\n do i = 1, n\n if(s(i:i) == 'L')then\n cnum(i) = -1\n else\n cnum(i) = 1\n endif\n enddo\n\n do i = 1,n-1\n if (cnum(i) == cnum(i+1)) hap = hap + 1\n enddo\n\n\n cnum(n+1) = cnum(1)*-1\n l = 0\n r = 0\n do i=1,n\n if (k <= 0)exit\n if (cnum(i) == cnum(i+1))cycle\n if(cnum(i) == -1)then\n ! print*, 'l'\n l = l + 1\n\n endif\n if (k <= 0)exit\n if(cnum(i) == 1)then\n ! print*, 'r'\n r = r + 1\n\n\n endif\n enddo\n\n \n\n\n print*, hap + min(k,min(l,r))*2\n \n\nend program", "language": "Fortran", "metadata": {"date": 1567910434, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02918.html", "problem_id": "p02918", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02918/input.txt", "sample_output_relpath": "derived/input_output/data/p02918/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02918/Fortran/s430027444.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s430027444", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n implicit none\n integer:: n, k, i, j, l,r\n integer,allocatable:: cnum(:)\n character(10**5):: s\n integer:: hap\n hap = 0\n read*, n, k\n read*, s\n \n allocate(cnum(n+1))\n\n do i = 1, n\n if(s(i:i) == 'L')then\n cnum(i) = -1\n else\n cnum(i) = 1\n endif\n enddo\n\n do i = 1,n-1\n if (cnum(i) == cnum(i+1)) hap = hap + 1\n enddo\n\n\n cnum(n+1) = cnum(1)*-1\n l = 0\n r = 0\n do i=1,n\n if (k <= 0)exit\n if (cnum(i) == cnum(i+1))cycle\n if(cnum(i) == -1)then\n ! print*, 'l'\n l = l + 1\n\n endif\n if (k <= 0)exit\n if(cnum(i) == 1)then\n ! print*, 'r'\n r = r + 1\n\n\n endif\n enddo\n\n \n\n\n print*, hap + min(k,min(l,r))*2\n \n\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing in a queue from west to east.\n\nGiven is a string S of length N representing the directions of the people.\nThe i-th person from the west is facing west if the i-th character of S is L, and east if that character of S is R.\n\nA person is happy if the person in front of him/her is facing the same direction.\nIf no person is standing in front of a person, however, he/she is not happy.\n\nYou can perform the following operation any number of times between 0 and K (inclusive):\n\nOperation: Choose integers l and r such that 1 \\leq l \\leq r \\leq N, and rotate by 180 degrees the part of the queue: the l-th, (l+1)-th, ..., r-th persons. That is, for each i = 0, 1, ..., r-l, the (l + i)-th person from the west will stand the (r - i)-th from the west after the operation, facing east if he/she is facing west now, and vice versa.\n\nWhat is the maximum possible number of happy people you can have?\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\n|S| = N\n\nEach character of S is L or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of happy people after at most K operations.\n\nSample Input 1\n\n6 1\nLRLRRL\n\nSample Output 1\n\n3\n\nIf we choose (l, r) = (2, 5), we have LLLRLL, where the 2-nd, 3-rd, and 6-th persons from the west are happy.\n\nSample Input 2\n\n13 3\nLRRLRLRRLRLLR\n\nSample Output 2\n\n9\n\nSample Input 3\n\n10 1\nLLLLLRRRRR\n\nSample Output 3\n\n9\n\nSample Input 4\n\n9 2\nRRRLRLRLL\n\nSample Output 4\n\n7", "sample_input": "6 1\nLRLRRL\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02918", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing in a queue from west to east.\n\nGiven is a string S of length N representing the directions of the people.\nThe i-th person from the west is facing west if the i-th character of S is L, and east if that character of S is R.\n\nA person is happy if the person in front of him/her is facing the same direction.\nIf no person is standing in front of a person, however, he/she is not happy.\n\nYou can perform the following operation any number of times between 0 and K (inclusive):\n\nOperation: Choose integers l and r such that 1 \\leq l \\leq r \\leq N, and rotate by 180 degrees the part of the queue: the l-th, (l+1)-th, ..., r-th persons. That is, for each i = 0, 1, ..., r-l, the (l + i)-th person from the west will stand the (r - i)-th from the west after the operation, facing east if he/she is facing west now, and vice versa.\n\nWhat is the maximum possible number of happy people you can have?\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\n|S| = N\n\nEach character of S is L or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of happy people after at most K operations.\n\nSample Input 1\n\n6 1\nLRLRRL\n\nSample Output 1\n\n3\n\nIf we choose (l, r) = (2, 5), we have LLLRLL, where the 2-nd, 3-rd, and 6-th persons from the west are happy.\n\nSample Input 2\n\n13 3\nLRRLRLRRLRLLR\n\nSample Output 2\n\n9\n\nSample Input 3\n\n10 1\nLLLLLRRRRR\n\nSample Output 3\n\n9\n\nSample Input 4\n\n9 2\nRRRLRLRLL\n\nSample Output 4\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 823, "cpu_time_ms": 3, "memory_kb": 932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s434148666", "group_id": "codeNet:p02921", "input_text": "program tenki\n implicit none\n integer :: i, cnt = 0\n character s(3), t(3)\n read *, s(1:3)\n read *, t(1:3)\n do i = 1, 3\n if(s(i) .eq. t(i))then\n cnt = cnt + 1\n end if\n end do\n print *, cnt\nend program", "language": "Fortran", "metadata": {"date": 1599231643, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02921.html", "problem_id": "p02921", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02921/input.txt", "sample_output_relpath": "derived/input_output/data/p02921/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02921/Fortran/s434148666.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s434148666", "user_id": "u622206408"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program tenki\n implicit none\n integer :: i, cnt = 0\n character s(3), t(3)\n read *, s(1:3)\n read *, t(1:3)\n do i = 1, 3\n if(s(i) .eq. t(i))then\n cnt = cnt + 1\n end if\n end do\n print *, cnt\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given a string S of length 3 representing the weather forecast for three days in the past.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nYou will also be given a string T of length 3 representing the actual weather on those three days.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the actual weather on the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nPrint the number of days for which the forecast was correct.\n\nConstraints\n\nS and T are strings of length 3 each.\n\nS and T consist of S, C, and R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the number of days for which the forecast was correct.\n\nSample Input 1\n\nCSS\nCSR\n\nSample Output 1\n\n2\n\nFor the first day, it was forecast to be cloudy, and it was indeed cloudy.\n\nFor the second day, it was forecast to be sunny, and it was indeed sunny.\n\nFor the third day, it was forecast to be sunny, but it was rainy.\n\nThus, the forecast was correct for two days in this case.\n\nSample Input 2\n\nSSR\nSSR\n\nSample Output 2\n\n3\n\nSample Input 3\n\nRRR\nSSS\n\nSample Output 3\n\n0", "sample_input": "CSS\nCSR\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02921", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given a string S of length 3 representing the weather forecast for three days in the past.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nYou will also be given a string T of length 3 representing the actual weather on those three days.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the actual weather on the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nPrint the number of days for which the forecast was correct.\n\nConstraints\n\nS and T are strings of length 3 each.\n\nS and T consist of S, C, and R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the number of days for which the forecast was correct.\n\nSample Input 1\n\nCSS\nCSR\n\nSample Output 1\n\n2\n\nFor the first day, it was forecast to be cloudy, and it was indeed cloudy.\n\nFor the second day, it was forecast to be sunny, and it was indeed sunny.\n\nFor the third day, it was forecast to be sunny, but it was rainy.\n\nThus, the forecast was correct for two days in this case.\n\nSample Input 2\n\nSSR\nSSR\n\nSample Output 2\n\n3\n\nSample Input 3\n\nRRR\nSSS\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 248, "cpu_time_ms": 11, "memory_kb": 3152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s555373492", "group_id": "codeNet:p02921", "input_text": "implicit none\ninteger :: i, j\ncharacter(3) :: s, t\n\nread(*,*) s\nread(*,*) t\n\nj=0\n\ndo i = 1, 3\nif (s(i:i)==t(i:i)) then\nj = j + 1\nend if\nend do\n\nwrite(*,'(i0)') j\n\nend program", "language": "Fortran", "metadata": {"date": 1568614695, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02921.html", "problem_id": "p02921", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02921/input.txt", "sample_output_relpath": "derived/input_output/data/p02921/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02921/Fortran/s555373492.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s555373492", "user_id": "u039189422"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "implicit none\ninteger :: i, j\ncharacter(3) :: s, t\n\nread(*,*) s\nread(*,*) t\n\nj=0\n\ndo i = 1, 3\nif (s(i:i)==t(i:i)) then\nj = j + 1\nend if\nend do\n\nwrite(*,'(i0)') j\n\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou will be given a string S of length 3 representing the weather forecast for three days in the past.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nYou will also be given a string T of length 3 representing the actual weather on those three days.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the actual weather on the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nPrint the number of days for which the forecast was correct.\n\nConstraints\n\nS and T are strings of length 3 each.\n\nS and T consist of S, C, and R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the number of days for which the forecast was correct.\n\nSample Input 1\n\nCSS\nCSR\n\nSample Output 1\n\n2\n\nFor the first day, it was forecast to be cloudy, and it was indeed cloudy.\n\nFor the second day, it was forecast to be sunny, and it was indeed sunny.\n\nFor the third day, it was forecast to be sunny, but it was rainy.\n\nThus, the forecast was correct for two days in this case.\n\nSample Input 2\n\nSSR\nSSR\n\nSample Output 2\n\n3\n\nSample Input 3\n\nRRR\nSSS\n\nSample Output 3\n\n0", "sample_input": "CSS\nCSR\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02921", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou will be given a string S of length 3 representing the weather forecast for three days in the past.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the forecast for the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nYou will also be given a string T of length 3 representing the actual weather on those three days.\n\nThe i-th character (1 \\leq i \\leq 3) of S represents the actual weather on the i-th day. S, C, and R stand for sunny, cloudy, and rainy, respectively.\n\nPrint the number of days for which the forecast was correct.\n\nConstraints\n\nS and T are strings of length 3 each.\n\nS and T consist of S, C, and R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nPrint the number of days for which the forecast was correct.\n\nSample Input 1\n\nCSS\nCSR\n\nSample Output 1\n\n2\n\nFor the first day, it was forecast to be cloudy, and it was indeed cloudy.\n\nFor the second day, it was forecast to be sunny, and it was indeed sunny.\n\nFor the third day, it was forecast to be sunny, but it was rainy.\n\nThus, the forecast was correct for two days in this case.\n\nSample Input 2\n\nSSR\nSSR\n\nSample Output 2\n\n3\n\nSample Input 3\n\nRRR\nSSS\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 174, "cpu_time_ms": 7, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s160843347", "group_id": "codeNet:p02922", "input_text": "program sample\n implicit none\n real(8)::x,y,z\n integer(8) :: a,b,c,i,j,m,n,k,a1,b1,c1\n \n \n \n read(*,*) a,b\n n=0\n do while (a*n-n+1s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_B\n\n ! contained s and s are below\n contains\n\n subroutine task_B\n\n ! variables for this \n integer(INT32) :: num_strip_needed\n integer(INT32) :: num_socket_strip\n integer(INT32) :: num_socket_needed\n integer(INT32) :: num_socket_total\n\n ! support variables for this \n integer(INT32) :: itr\n\n ! STEP.01\n ! read out the given data\n read(unit=INPUT_UNIT, fmt=*) num_socket_strip, num_socket_needed\n\n ! STEP.02\n ! initialize the variables for this \n num_strip_needed = 0_INT32\n num_socket_total = 1_INT32\n\n ! STEP.03\n ! calculate the answer of this task\n do while (num_socket_total .lt. num_socket_needed)\n num_strip_needed = num_strip_needed + 1_INT32\n num_socket_total = num_socket_total + num_socket_strip - 1_INT32\n end do\n\n ! STEP.03\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') num_strip_needed\n\n ! STEP.END\n return\n\n end subroutine task_B\n\nend module ABC139\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC139\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_B\n\nend program main", "language": "Fortran", "metadata": {"date": 1567365493, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02922.html", "problem_id": "p02922", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02922/input.txt", "sample_output_relpath": "derived/input_output/data/p02922/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02922/Fortran/s347757535.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s347757535", "user_id": "u484703930"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "module ABC139\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_B\n\n ! contained s and s are below\n contains\n\n subroutine task_B\n\n ! variables for this \n integer(INT32) :: num_strip_needed\n integer(INT32) :: num_socket_strip\n integer(INT32) :: num_socket_needed\n integer(INT32) :: num_socket_total\n\n ! support variables for this \n integer(INT32) :: itr\n\n ! STEP.01\n ! read out the given data\n read(unit=INPUT_UNIT, fmt=*) num_socket_strip, num_socket_needed\n\n ! STEP.02\n ! initialize the variables for this \n num_strip_needed = 0_INT32\n num_socket_total = 1_INT32\n\n ! STEP.03\n ! calculate the answer of this task\n do while (num_socket_total .lt. num_socket_needed)\n num_strip_needed = num_strip_needed + 1_INT32\n num_socket_total = num_socket_total + num_socket_strip - 1_INT32\n end do\n\n ! STEP.03\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') num_strip_needed\n\n ! STEP.END\n return\n\n end subroutine task_B\n\nend module ABC139\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC139\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_B\n\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi's house has only one socket.\n\nTakahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.\n\nOne power strip with A sockets can extend one empty socket into A empty sockets.\n\nFind the minimum number of power strips required.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of power strips required.\n\nSample Input 1\n\n4 10\n\nSample Output 1\n\n3\n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\nSample Input 2\n\n8 9\n\nSample Output 2\n\n2\n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\nSample Input 3\n\n8 8\n\nSample Output 3\n\n1", "sample_input": "4 10\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02922", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi's house has only one socket.\n\nTakahashi wants to extend it with some number of power strips, each with A sockets, into B or more empty sockets.\n\nOne power strip with A sockets can extend one empty socket into A empty sockets.\n\nFind the minimum number of power strips required.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq A \\leq 20\n\n1 \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the minimum number of power strips required.\n\nSample Input 1\n\n4 10\n\nSample Output 1\n\n3\n\n3 power strips, each with 4 sockets, extend the socket into 10 empty sockets.\n\nSample Input 2\n\n8 9\n\nSample Output 2\n\n2\n\n2 power strips, each with 8 sockets, extend the socket into 15 empty sockets.\n\nSample Input 3\n\n8 8\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1442, "cpu_time_ms": 6, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s814779761", "group_id": "codeNet:p02923", "input_text": "program answer\n implicit none\n integer :: N, i, j, count, a, b\n integer, allocatable :: H(:), s(:), d(:)\n read(*,*) N\n allocate(H(N))\n read(*,*) H\n allocate(s(N))\n \n s(:)=0 \n count=0\n do i = 1, n-1\n if(H(i)= h(j+1)) then\n k = k + 1\n else\n exit\n end if\n end do\n if (k > he) then\n he = k\n end if\n if (he >= (n-i-1)) then\n exit\n end if\n end do\n \n write(*,'(i0)')he\nend program main", "language": "Fortran", "metadata": {"date": 1574266575, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Fortran/s447199959.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s447199959", "user_id": "u287431190"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n \n integer ::i,j,n,h(100000)=0,k,he=0\n read(*,*)n\n read(*,*)(h(i),i= 1,n)\n \n do i = 1, n-1\n k = 0\n do j = i, n-1\n if (h(j) >= h(j+1)) then\n k = k + 1\n else\n exit\n end if\n end do\n if (k > he) then\n he = k\n end if\n if (he >= (n-i-1)) then\n exit\n end if\n end do\n \n write(*,'(i0)')he\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 394, "cpu_time_ms": 586, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s075938509", "group_id": "codeNet:p02923", "input_text": "program main\ninteger :: i,n,cnt=0,big=0\ninteger,allocatable :: h(:)\n\nread *,n\nallocate(h(n))\nread *,h\n\ndo i = 1,n-1\ncnt = 0\nif (big >= n/2) exit\ndo j = i,n-1\nif (h(j)>=h(j+1)) then\ncnt = cnt + 1\nelse\nexit\nend if\nend do\nbig = max(cnt,big)\nend do\n\nprint *,big\n\nend program", "language": "Fortran", "metadata": {"date": 1567370239, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02923.html", "problem_id": "p02923", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02923/input.txt", "sample_output_relpath": "derived/input_output/data/p02923/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02923/Fortran/s075938509.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s075938509", "user_id": "u850779832"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\ninteger :: i,n,cnt=0,big=0\ninteger,allocatable :: h(:)\n\nread *,n\nallocate(h(n))\nread *,h\n\ndo i = 1,n-1\ncnt = 0\nif (big >= n/2) exit\ndo j = i,n-1\nif (h(j)>=h(j+1)) then\ncnt = cnt + 1\nelse\nexit\nend if\nend do\nbig = max(cnt,big)\nend do\n\nprint *,big\n\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "sample_input": "5\n10 4 8 7 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02923", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N squares arranged in a row from left to right.\n\nThe height of the i-th square from the left is H_i.\n\nYou will land on a square of your choice, then repeat moving to the adjacent square on the right as long as the height of the next square is not greater than that of the current square.\n\nFind the maximum number of times you can move.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq H_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the maximum number of times you can move.\n\nSample Input 1\n\n5\n10 4 8 7 3\n\nSample Output 1\n\n2\n\nBy landing on the third square from the left, you can move to the right twice.\n\nSample Input 2\n\n7\n4 4 5 6 6 5 5\n\nSample Output 2\n\n3\n\nBy landing on the fourth square from the left, you can move to the right three times.\n\nSample Input 3\n\n4\n1 2 3 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 270, "cpu_time_ms": 667, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s289740021", "group_id": "codeNet:p02924", "input_text": "module ABC139\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_C\n\n ! contained s and s are below\n contains\n\n subroutine task_C\n\n ! variables for this \n integer(INT64) :: len_sequence\n\n ! STEP.01\n ! read out the given data (the number of squares)\n read(unit=INPUT_UNIT, fmt=*) len_sequence\n\n ! STEP.02\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') (len_sequence - 1_INT64) * len_sequence / 2_INT64\n\n ! STEP.END\n return\n\n end subroutine task_C\n\nend module ABC139\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC139\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_C\n\nend program main", "language": "Fortran", "metadata": {"date": 1567367641, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02924.html", "problem_id": "p02924", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02924/input.txt", "sample_output_relpath": "derived/input_output/data/p02924/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02924/Fortran/s289740021.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s289740021", "user_id": "u484703930"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module ABC139\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_C\n\n ! contained s and s are below\n contains\n\n subroutine task_C\n\n ! variables for this \n integer(INT64) :: len_sequence\n\n ! STEP.01\n ! read out the given data (the number of squares)\n read(unit=INPUT_UNIT, fmt=*) len_sequence\n\n ! STEP.02\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') (len_sequence - 1_INT64) * len_sequence / 2_INT64\n\n ! STEP.END\n return\n\n end subroutine task_C\n\nend module ABC139\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC139\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_C\n\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "sample_input": "2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02924", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 907, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s050350348", "group_id": "codeNet:p02924", "input_text": "program test\nimplicit none\ninteger(8)::N\nread*,N\nprint*,N*(N-1)/2\nend program", "language": "Fortran", "metadata": {"date": 1567366974, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02924.html", "problem_id": "p02924", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02924/input.txt", "sample_output_relpath": "derived/input_output/data/p02924/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02924/Fortran/s050350348.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s050350348", "user_id": "u723571904"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program test\nimplicit none\ninteger(8)::N\nread*,N\nprint*,N*(N-1)/2\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "sample_input": "2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02924", "source_text": "Score : 400 points\n\nProblem Statement\n\nFor an integer N, we will choose a permutation \\{P_1, P_2, ..., P_N\\} of \\{1, 2, ..., N\\}.\n\nThen, for each i=1,2,...,N, let M_i be the remainder when i is divided by P_i.\n\nFind the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible value of M_1 + M_2 + \\cdots + M_N.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1\n\nWhen the permutation \\{P_1, P_2\\} = \\{2, 1\\} is chosen, M_1 + M_2 = 1 + 0 = 1.\n\nSample Input 2\n\n13\n\nSample Output 2\n\n78\n\nSample Input 3\n\n1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 77, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s361599469", "group_id": "codeNet:p02925", "input_text": "program league\n implicit none\n integer :: n, a(1000,1000) = 0, i, j, l, k(1000) = 1, m = 0\n logical :: used(1000) = .false., change\n read(*,*) n\n do i = 1, n\n read(*,*) a(i,1:n-1)\n end do\n do while (any(k(1:n) < n))\n m = m+1\n used(1:n) = k(1:n) == n\n change = .false.\n do i = 1, n\n if (used(i)) cycle\n j = a(i,k(i))\n if (used(j)) cycle\n if (a(j,k(j)) == i) then\n k(i) = k(i)+1\n k(j) = k(j)+1\n used(i) = .true.\n used(j) = .true.\n change = .true.\n end if\n end do\n if (.not.change) then\n m = -1\n exit\n end if\n end do\n write(*,'(i0)') m\nend program league", "language": "Fortran", "metadata": {"date": 1567367385, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02925.html", "problem_id": "p02925", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02925/input.txt", "sample_output_relpath": "derived/input_output/data/p02925/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02925/Fortran/s361599469.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s361599469", "user_id": "u506403362"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program league\n implicit none\n integer :: n, a(1000,1000) = 0, i, j, l, k(1000) = 1, m = 0\n logical :: used(1000) = .false., change\n read(*,*) n\n do i = 1, n\n read(*,*) a(i,1:n-1)\n end do\n do while (any(k(1:n) < n))\n m = m+1\n used(1:n) = k(1:n) == n\n change = .false.\n do i = 1, n\n if (used(i)) cycle\n j = a(i,k(i))\n if (used(j)) cycle\n if (a(j,k(j)) == i) then\n k(i) = k(i)+1\n k(j) = k(j)+1\n used(i) = .true.\n used(j) = .true.\n change = .true.\n end if\n end do\n if (.not.change) then\n m = -1\n exit\n end if\n end do\n write(*,'(i0)') m\nend program league", "problem_context": "Score : 500 points\n\nProblem Statement\n\nN players will participate in a tennis tournament. We will call them Player 1, Player 2, \\ldots, Player N.\n\nThe tournament is round-robin format, and there will be N(N-1)/2 matches in total.\nIs it possible to schedule these matches so that all of the following conditions are satisfied? If the answer is yes, also find the minimum number of days required.\n\nEach player plays at most one matches in a day.\n\nEach player i (1 \\leq i \\leq N) plays one match against Player A_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} in this order.\n\nConstraints\n\n3 \\leq N \\leq 1000\n\n1 \\leq A_{i, j} \\leq N\n\nA_{i, j} \\neq i\n\nA_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} \\ldots A_{1, N-1}\nA_{2, 1} A_{2, 2} \\ldots A_{2, N-1}\n:\nA_{N, 1} A_{N, 2} \\ldots A_{N, N-1}\n\nOutput\n\nIf it is possible to schedule all the matches so that all of the conditions are satisfied, print the minimum number of days required; if it is impossible, print -1.\n\nSample Input 1\n\n3\n2 3\n1 3\n1 2\n\nSample Output 1\n\n3\n\nAll the conditions can be satisfied if the matches are scheduled for three days as follows:\n\nDay 1: Player 1 vs Player 2\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 2 vs Player 3\n\nThis is the minimum number of days required.\n\nSample Input 2\n\n4\n2 3 4\n1 3 4\n4 1 2\n3 1 2\n\nSample Output 2\n\n4\n\nAll the conditions can be satisfied if the matches are scheduled for four days as follows:\n\nDay 1: Player 1 vs Player 2, Player 3 vs Player 4\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 1 vs Player 4, Player 2 vs Player 3\n\nDay 4: Player 2 vs Player 4\n\nThis is the minimum number of days required.\n\nSample Input 3\n\n3\n2 3\n3 1\n1 2\n\nSample Output 3\n\n-1\n\nAny scheduling of the matches violates some condition.", "sample_input": "3\n2 3\n1 3\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02925", "source_text": "Score : 500 points\n\nProblem Statement\n\nN players will participate in a tennis tournament. We will call them Player 1, Player 2, \\ldots, Player N.\n\nThe tournament is round-robin format, and there will be N(N-1)/2 matches in total.\nIs it possible to schedule these matches so that all of the following conditions are satisfied? If the answer is yes, also find the minimum number of days required.\n\nEach player plays at most one matches in a day.\n\nEach player i (1 \\leq i \\leq N) plays one match against Player A_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} in this order.\n\nConstraints\n\n3 \\leq N \\leq 1000\n\n1 \\leq A_{i, j} \\leq N\n\nA_{i, j} \\neq i\n\nA_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} \\ldots A_{1, N-1}\nA_{2, 1} A_{2, 2} \\ldots A_{2, N-1}\n:\nA_{N, 1} A_{N, 2} \\ldots A_{N, N-1}\n\nOutput\n\nIf it is possible to schedule all the matches so that all of the conditions are satisfied, print the minimum number of days required; if it is impossible, print -1.\n\nSample Input 1\n\n3\n2 3\n1 3\n1 2\n\nSample Output 1\n\n3\n\nAll the conditions can be satisfied if the matches are scheduled for three days as follows:\n\nDay 1: Player 1 vs Player 2\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 2 vs Player 3\n\nThis is the minimum number of days required.\n\nSample Input 2\n\n4\n2 3 4\n1 3 4\n4 1 2\n3 1 2\n\nSample Output 2\n\n4\n\nAll the conditions can be satisfied if the matches are scheduled for four days as follows:\n\nDay 1: Player 1 vs Player 2, Player 3 vs Player 4\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 1 vs Player 4, Player 2 vs Player 3\n\nDay 4: Player 2 vs Player 4\n\nThis is the minimum number of days required.\n\nSample Input 3\n\n3\n2 3\n3 1\n1 2\n\nSample Output 3\n\n-1\n\nAny scheduling of the matches violates some condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 654, "cpu_time_ms": 1713, "memory_kb": 4096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s254558939", "group_id": "codeNet:p02925", "input_text": "program main\n implicit none\n integer i,N,fin,pin,ans,j,con\n integer,allocatable :: A(:,:),B(:),tired(:)\n read(*, *) N\n allocate(A(N,N))\n allocate(B(N))\n allocate(tired(N))\n do j= 1,N\n read(*, *) (A(j,i), i = 1,N-1)\n A(j,N) = 0\n end do\n B = 1\n tired = 0\n pin = 0\n fin = 1\n ans = 1\n do\n do i = 1,N\n con = A(i,B(i))\n if (con > 0) then\n if (A(con,B(con)) == i .and. tired(con) == 0 .and. tired(i) == 0) then\n B(i) = B(i) + 1\n B(con) = B(con) + 1\n tired(con) = 1\n tired(i) = 1\n pin = 1\n end if\n end if\n end do\n if (pin == 0) then\n ans = -1\n exit\n elseif (sum(B) == N**2) then\n exit\n else\n ans = ans + 1\n tired = 0\n pin = 0\n end if\n end do\n \n write(*, *) ans\nend program main\n", "language": "Fortran", "metadata": {"date": 1567367261, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02925.html", "problem_id": "p02925", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02925/input.txt", "sample_output_relpath": "derived/input_output/data/p02925/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02925/Fortran/s254558939.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s254558939", "user_id": "u050276949"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n implicit none\n integer i,N,fin,pin,ans,j,con\n integer,allocatable :: A(:,:),B(:),tired(:)\n read(*, *) N\n allocate(A(N,N))\n allocate(B(N))\n allocate(tired(N))\n do j= 1,N\n read(*, *) (A(j,i), i = 1,N-1)\n A(j,N) = 0\n end do\n B = 1\n tired = 0\n pin = 0\n fin = 1\n ans = 1\n do\n do i = 1,N\n con = A(i,B(i))\n if (con > 0) then\n if (A(con,B(con)) == i .and. tired(con) == 0 .and. tired(i) == 0) then\n B(i) = B(i) + 1\n B(con) = B(con) + 1\n tired(con) = 1\n tired(i) = 1\n pin = 1\n end if\n end if\n end do\n if (pin == 0) then\n ans = -1\n exit\n elseif (sum(B) == N**2) then\n exit\n else\n ans = ans + 1\n tired = 0\n pin = 0\n end if\n end do\n \n write(*, *) ans\nend program main\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nN players will participate in a tennis tournament. We will call them Player 1, Player 2, \\ldots, Player N.\n\nThe tournament is round-robin format, and there will be N(N-1)/2 matches in total.\nIs it possible to schedule these matches so that all of the following conditions are satisfied? If the answer is yes, also find the minimum number of days required.\n\nEach player plays at most one matches in a day.\n\nEach player i (1 \\leq i \\leq N) plays one match against Player A_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} in this order.\n\nConstraints\n\n3 \\leq N \\leq 1000\n\n1 \\leq A_{i, j} \\leq N\n\nA_{i, j} \\neq i\n\nA_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} \\ldots A_{1, N-1}\nA_{2, 1} A_{2, 2} \\ldots A_{2, N-1}\n:\nA_{N, 1} A_{N, 2} \\ldots A_{N, N-1}\n\nOutput\n\nIf it is possible to schedule all the matches so that all of the conditions are satisfied, print the minimum number of days required; if it is impossible, print -1.\n\nSample Input 1\n\n3\n2 3\n1 3\n1 2\n\nSample Output 1\n\n3\n\nAll the conditions can be satisfied if the matches are scheduled for three days as follows:\n\nDay 1: Player 1 vs Player 2\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 2 vs Player 3\n\nThis is the minimum number of days required.\n\nSample Input 2\n\n4\n2 3 4\n1 3 4\n4 1 2\n3 1 2\n\nSample Output 2\n\n4\n\nAll the conditions can be satisfied if the matches are scheduled for four days as follows:\n\nDay 1: Player 1 vs Player 2, Player 3 vs Player 4\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 1 vs Player 4, Player 2 vs Player 3\n\nDay 4: Player 2 vs Player 4\n\nThis is the minimum number of days required.\n\nSample Input 3\n\n3\n2 3\n3 1\n1 2\n\nSample Output 3\n\n-1\n\nAny scheduling of the matches violates some condition.", "sample_input": "3\n2 3\n1 3\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02925", "source_text": "Score : 500 points\n\nProblem Statement\n\nN players will participate in a tennis tournament. We will call them Player 1, Player 2, \\ldots, Player N.\n\nThe tournament is round-robin format, and there will be N(N-1)/2 matches in total.\nIs it possible to schedule these matches so that all of the following conditions are satisfied? If the answer is yes, also find the minimum number of days required.\n\nEach player plays at most one matches in a day.\n\nEach player i (1 \\leq i \\leq N) plays one match against Player A_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} in this order.\n\nConstraints\n\n3 \\leq N \\leq 1000\n\n1 \\leq A_{i, j} \\leq N\n\nA_{i, j} \\neq i\n\nA_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} \\ldots A_{1, N-1}\nA_{2, 1} A_{2, 2} \\ldots A_{2, N-1}\n:\nA_{N, 1} A_{N, 2} \\ldots A_{N, N-1}\n\nOutput\n\nIf it is possible to schedule all the matches so that all of the conditions are satisfied, print the minimum number of days required; if it is impossible, print -1.\n\nSample Input 1\n\n3\n2 3\n1 3\n1 2\n\nSample Output 1\n\n3\n\nAll the conditions can be satisfied if the matches are scheduled for three days as follows:\n\nDay 1: Player 1 vs Player 2\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 2 vs Player 3\n\nThis is the minimum number of days required.\n\nSample Input 2\n\n4\n2 3 4\n1 3 4\n4 1 2\n3 1 2\n\nSample Output 2\n\n4\n\nAll the conditions can be satisfied if the matches are scheduled for four days as follows:\n\nDay 1: Player 1 vs Player 2, Player 3 vs Player 4\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 1 vs Player 4, Player 2 vs Player 3\n\nDay 4: Player 2 vs Player 4\n\nThis is the minimum number of days required.\n\nSample Input 3\n\n3\n2 3\n3 1\n1 2\n\nSample Output 3\n\n-1\n\nAny scheduling of the matches violates some condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 818, "cpu_time_ms": 1732, "memory_kb": 4096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s097724981", "group_id": "codeNet:p02925", "input_text": "integer N\ninteger,allocatable,dimension(:,:)::A\ninteger,allocatable,dimension(:)::B,Anum\ninteger aite\nlogical nogame\nread*,N\nallocate(A(N,N-1),B(N),Anum(N))\nAnum=1\ndo i=1,N\n read*,A(i,:)\nend do\ndo i=1,N*N\n nogame=.true.\n B=0\n do j=1,N\n if(B(j)==0.and.Anum(J)/=N)then\n aite=A(J,Anum(J))\n if(A(aite,Anum(aite))==J.and.B(aite)==0)then\n Anum(j)=Anum(j)+1\n Anum(aite)=Anum(aite)+1\n nogame=.false.\n B(j)=1;B(aite)=1\n endif\n endif\n end do\n if(minval(Anum)==N)then\n print\"(i0)\",i\n stop\n endif\n if(nogame)then\n print\"(i0)\",-1\n stop\n endif\nend do\nend", "language": "Fortran", "metadata": {"date": 1567367245, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02925.html", "problem_id": "p02925", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02925/input.txt", "sample_output_relpath": "derived/input_output/data/p02925/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02925/Fortran/s097724981.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s097724981", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "integer N\ninteger,allocatable,dimension(:,:)::A\ninteger,allocatable,dimension(:)::B,Anum\ninteger aite\nlogical nogame\nread*,N\nallocate(A(N,N-1),B(N),Anum(N))\nAnum=1\ndo i=1,N\n read*,A(i,:)\nend do\ndo i=1,N*N\n nogame=.true.\n B=0\n do j=1,N\n if(B(j)==0.and.Anum(J)/=N)then\n aite=A(J,Anum(J))\n if(A(aite,Anum(aite))==J.and.B(aite)==0)then\n Anum(j)=Anum(j)+1\n Anum(aite)=Anum(aite)+1\n nogame=.false.\n B(j)=1;B(aite)=1\n endif\n endif\n end do\n if(minval(Anum)==N)then\n print\"(i0)\",i\n stop\n endif\n if(nogame)then\n print\"(i0)\",-1\n stop\n endif\nend do\nend", "problem_context": "Score : 500 points\n\nProblem Statement\n\nN players will participate in a tennis tournament. We will call them Player 1, Player 2, \\ldots, Player N.\n\nThe tournament is round-robin format, and there will be N(N-1)/2 matches in total.\nIs it possible to schedule these matches so that all of the following conditions are satisfied? If the answer is yes, also find the minimum number of days required.\n\nEach player plays at most one matches in a day.\n\nEach player i (1 \\leq i \\leq N) plays one match against Player A_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} in this order.\n\nConstraints\n\n3 \\leq N \\leq 1000\n\n1 \\leq A_{i, j} \\leq N\n\nA_{i, j} \\neq i\n\nA_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} \\ldots A_{1, N-1}\nA_{2, 1} A_{2, 2} \\ldots A_{2, N-1}\n:\nA_{N, 1} A_{N, 2} \\ldots A_{N, N-1}\n\nOutput\n\nIf it is possible to schedule all the matches so that all of the conditions are satisfied, print the minimum number of days required; if it is impossible, print -1.\n\nSample Input 1\n\n3\n2 3\n1 3\n1 2\n\nSample Output 1\n\n3\n\nAll the conditions can be satisfied if the matches are scheduled for three days as follows:\n\nDay 1: Player 1 vs Player 2\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 2 vs Player 3\n\nThis is the minimum number of days required.\n\nSample Input 2\n\n4\n2 3 4\n1 3 4\n4 1 2\n3 1 2\n\nSample Output 2\n\n4\n\nAll the conditions can be satisfied if the matches are scheduled for four days as follows:\n\nDay 1: Player 1 vs Player 2, Player 3 vs Player 4\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 1 vs Player 4, Player 2 vs Player 3\n\nDay 4: Player 2 vs Player 4\n\nThis is the minimum number of days required.\n\nSample Input 3\n\n3\n2 3\n3 1\n1 2\n\nSample Output 3\n\n-1\n\nAny scheduling of the matches violates some condition.", "sample_input": "3\n2 3\n1 3\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02925", "source_text": "Score : 500 points\n\nProblem Statement\n\nN players will participate in a tennis tournament. We will call them Player 1, Player 2, \\ldots, Player N.\n\nThe tournament is round-robin format, and there will be N(N-1)/2 matches in total.\nIs it possible to schedule these matches so that all of the following conditions are satisfied? If the answer is yes, also find the minimum number of days required.\n\nEach player plays at most one matches in a day.\n\nEach player i (1 \\leq i \\leq N) plays one match against Player A_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} in this order.\n\nConstraints\n\n3 \\leq N \\leq 1000\n\n1 \\leq A_{i, j} \\leq N\n\nA_{i, j} \\neq i\n\nA_{i, 1}, A_{i, 2}, \\ldots, A_{i, N-1} are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} \\ldots A_{1, N-1}\nA_{2, 1} A_{2, 2} \\ldots A_{2, N-1}\n:\nA_{N, 1} A_{N, 2} \\ldots A_{N, N-1}\n\nOutput\n\nIf it is possible to schedule all the matches so that all of the conditions are satisfied, print the minimum number of days required; if it is impossible, print -1.\n\nSample Input 1\n\n3\n2 3\n1 3\n1 2\n\nSample Output 1\n\n3\n\nAll the conditions can be satisfied if the matches are scheduled for three days as follows:\n\nDay 1: Player 1 vs Player 2\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 2 vs Player 3\n\nThis is the minimum number of days required.\n\nSample Input 2\n\n4\n2 3 4\n1 3 4\n4 1 2\n3 1 2\n\nSample Output 2\n\n4\n\nAll the conditions can be satisfied if the matches are scheduled for four days as follows:\n\nDay 1: Player 1 vs Player 2, Player 3 vs Player 4\n\nDay 2: Player 1 vs Player 3\n\nDay 3: Player 1 vs Player 4, Player 2 vs Player 3\n\nDay 4: Player 2 vs Player 4\n\nThis is the minimum number of days required.\n\nSample Input 3\n\n3\n2 3\n3 1\n1 2\n\nSample Output 3\n\n-1\n\nAny scheduling of the matches violates some condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 610, "cpu_time_ms": 1944, "memory_kb": 4096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s018565725", "group_id": "codeNet:p02926", "input_text": "module ABC139\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n type coordinate\n real(REAL64), public :: x\n real(REAL64), public :: y\n real(REAL64), public :: distance\n end type coordinate\n\n ! accessibility of s and s in this \n public :: task_F\n\n ! contained s and s are below\n contains\n\n subroutine task_F\n\n ! variables for this \n integer(INT32) :: num_engines\n real(REAL64) :: x_max, x_read, x_trial\n real(REAL64) :: y_max, y_read, y_trial\n real(REAL64) :: distance_max\n real(REAL64) :: distance_trial\n\n ! support variables for this \n integer(INT32) :: itr\n\n ! STEP.01\n ! read out the given data (the number of engines)\n read(unit=INPUT_UNIT, fmt=*) num_engines\n\n ! STEP.02\n ! initialize the variables for this \n distance_max = 0.0_REAL64\n x_max = 0.0_REAL64\n y_max = 0.0_REAL64\n x_trial = 0.0_REAL64\n y_trial = 0.0_REAL64\n\n ! STEP.03\n ! calculate the answer of this task\n do itr = 1, num_engines, 1\n\n ! read out the given data (the movement by the each engine)\n read(unit=INPUT_UNIT, fmt=*) x_read, y_read\n\n x_trial = x_trial + x_read\n y_trial = y_trial + y_read\n distance_trial = sqrt(x_trial * x_trial + y_trial * y_trial)\n\n if (distance_trial .gt. distance_max) then\n x_max = x_trial\n y_max = y_trial\n distance_max = distance_trial\n end if\n\n end do\n\n ! STEP.04\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(ES23.15e3)', advance='yes') distance_max\n\n ! STEP.END\n return\n\n end subroutine task_F\n\nend module ABC139\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC139\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_F\n\nend program main", "language": "Fortran", "metadata": {"date": 1567370331, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02926.html", "problem_id": "p02926", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02926/input.txt", "sample_output_relpath": "derived/input_output/data/p02926/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02926/Fortran/s018565725.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s018565725", "user_id": "u484703930"}, "prompt_components": {"gold_output": "10.000000000000000000000000000000000000000000000000\n", "input_to_evaluate": "module ABC139\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n type coordinate\n real(REAL64), public :: x\n real(REAL64), public :: y\n real(REAL64), public :: distance\n end type coordinate\n\n ! accessibility of s and s in this \n public :: task_F\n\n ! contained s and s are below\n contains\n\n subroutine task_F\n\n ! variables for this \n integer(INT32) :: num_engines\n real(REAL64) :: x_max, x_read, x_trial\n real(REAL64) :: y_max, y_read, y_trial\n real(REAL64) :: distance_max\n real(REAL64) :: distance_trial\n\n ! support variables for this \n integer(INT32) :: itr\n\n ! STEP.01\n ! read out the given data (the number of engines)\n read(unit=INPUT_UNIT, fmt=*) num_engines\n\n ! STEP.02\n ! initialize the variables for this \n distance_max = 0.0_REAL64\n x_max = 0.0_REAL64\n y_max = 0.0_REAL64\n x_trial = 0.0_REAL64\n y_trial = 0.0_REAL64\n\n ! STEP.03\n ! calculate the answer of this task\n do itr = 1, num_engines, 1\n\n ! read out the given data (the movement by the each engine)\n read(unit=INPUT_UNIT, fmt=*) x_read, y_read\n\n x_trial = x_trial + x_read\n y_trial = y_trial + y_read\n distance_trial = sqrt(x_trial * x_trial + y_trial * y_trial)\n\n if (distance_trial .gt. distance_max) then\n x_max = x_trial\n y_max = y_trial\n distance_max = distance_trial\n end if\n\n end do\n\n ! STEP.04\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(ES23.15e3)', advance='yes') distance_max\n\n ! STEP.END\n return\n\n end subroutine task_F\n\nend module ABC139\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC139\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_F\n\nend program main", "problem_context": "Score: 600 points\n\nProblem Statement\n\nE869120 is initially standing at the origin (0, 0) in a two-dimensional plane.\n\nHe has N engines, which can be used as follows:\n\nWhen E869120 uses the i-th engine, his X- and Y-coordinate change by x_i and y_i, respectively. In other words, if E869120 uses the i-th engine from coordinates (X, Y), he will move to the coordinates (X + x_i, Y + y_i).\n\nE869120 can use these engines in any order, but each engine can be used at most once. He may also choose not to use some of the engines.\n\nHe wants to go as far as possible from the origin.\nLet (X, Y) be his final coordinates. Find the maximum possible value of \\sqrt{X^2 + Y^2}, the distance from the origin.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n-1 \\ 000 \\ 000 \\leq x_i \\leq 1 \\ 000 \\ 000\n\n-1 \\ 000 \\ 000 \\leq y_i \\leq 1 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\nx_2 y_2\n: :\nx_N y_N\n\nOutput\n\nPrint the maximum possible final distance from the origin, as a real value.\nYour output is considered correct when the relative or absolute error from the true answer is at most 10^{-10}.\n\nSample Input 1\n\n3\n0 10\n5 -5\n-5 -5\n\nSample Output 1\n\n10.000000000000000000000000000000000000000000000000\n\nThe final distance from the origin can be 10 if we use the engines in one of the following three ways:\n\nUse Engine 1 to move to (0, 10).\n\nUse Engine 2 to move to (5, -5), and then use Engine 3 to move to (0, -10).\n\nUse Engine 3 to move to (-5, -5), and then use Engine 2 to move to (0, -10).\n\nThe distance cannot be greater than 10, so the maximum possible distance is 10.\n\nSample Input 2\n\n5\n1 1\n1 0\n0 1\n-1 0\n0 -1\n\nSample Output 2\n\n2.828427124746190097603377448419396157139343750753\n\nThe maximum possible final distance is 2 \\sqrt{2} = 2.82842....\nOne of the ways to achieve it is:\n\nUse Engine 1 to move to (1, 1), and then use Engine 2 to move to (2, 1), and finally use Engine 3 to move to (2, 2).\n\nSample Input 3\n\n5\n1 1\n2 2\n3 3\n4 4\n5 5\n\nSample Output 3\n\n21.213203435596425732025330863145471178545078130654\n\nIf we use all the engines in the order 1 \\rightarrow 2 \\rightarrow 3 \\rightarrow 4 \\rightarrow 5, we will end up at (15, 15), with the distance 15 \\sqrt{2} = 21.2132... from the origin.\n\nSample Input 4\n\n3\n0 0\n0 1\n1 0\n\nSample Output 4\n\n1.414213562373095048801688724209698078569671875376\n\nThere can be useless engines with (x_i, y_i) = (0, 0).\n\nSample Input 5\n\n1\n90447 91000\n\nSample Output 5\n\n128303.000000000000000000000000000000000000000000000000\n\nNote that there can be only one engine.\n\nSample Input 6\n\n2\n96000 -72000\n-72000 54000\n\nSample Output 6\n\n120000.000000000000000000000000000000000000000000000000\n\nThere can be only two engines, too.\n\nSample Input 7\n\n10\n1 2\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n17 18\n19 20\n\nSample Output 7\n\n148.660687473185055226120082139313966514489855137208", "sample_input": "3\n0 10\n5 -5\n-5 -5\n"}, "reference_outputs": ["10.000000000000000000000000000000000000000000000000\n"], "source_document_id": "p02926", "source_text": "Score: 600 points\n\nProblem Statement\n\nE869120 is initially standing at the origin (0, 0) in a two-dimensional plane.\n\nHe has N engines, which can be used as follows:\n\nWhen E869120 uses the i-th engine, his X- and Y-coordinate change by x_i and y_i, respectively. In other words, if E869120 uses the i-th engine from coordinates (X, Y), he will move to the coordinates (X + x_i, Y + y_i).\n\nE869120 can use these engines in any order, but each engine can be used at most once. He may also choose not to use some of the engines.\n\nHe wants to go as far as possible from the origin.\nLet (X, Y) be his final coordinates. Find the maximum possible value of \\sqrt{X^2 + Y^2}, the distance from the origin.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n-1 \\ 000 \\ 000 \\leq x_i \\leq 1 \\ 000 \\ 000\n\n-1 \\ 000 \\ 000 \\leq y_i \\leq 1 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\nx_2 y_2\n: :\nx_N y_N\n\nOutput\n\nPrint the maximum possible final distance from the origin, as a real value.\nYour output is considered correct when the relative or absolute error from the true answer is at most 10^{-10}.\n\nSample Input 1\n\n3\n0 10\n5 -5\n-5 -5\n\nSample Output 1\n\n10.000000000000000000000000000000000000000000000000\n\nThe final distance from the origin can be 10 if we use the engines in one of the following three ways:\n\nUse Engine 1 to move to (0, 10).\n\nUse Engine 2 to move to (5, -5), and then use Engine 3 to move to (0, -10).\n\nUse Engine 3 to move to (-5, -5), and then use Engine 2 to move to (0, -10).\n\nThe distance cannot be greater than 10, so the maximum possible distance is 10.\n\nSample Input 2\n\n5\n1 1\n1 0\n0 1\n-1 0\n0 -1\n\nSample Output 2\n\n2.828427124746190097603377448419396157139343750753\n\nThe maximum possible final distance is 2 \\sqrt{2} = 2.82842....\nOne of the ways to achieve it is:\n\nUse Engine 1 to move to (1, 1), and then use Engine 2 to move to (2, 1), and finally use Engine 3 to move to (2, 2).\n\nSample Input 3\n\n5\n1 1\n2 2\n3 3\n4 4\n5 5\n\nSample Output 3\n\n21.213203435596425732025330863145471178545078130654\n\nIf we use all the engines in the order 1 \\rightarrow 2 \\rightarrow 3 \\rightarrow 4 \\rightarrow 5, we will end up at (15, 15), with the distance 15 \\sqrt{2} = 21.2132... from the origin.\n\nSample Input 4\n\n3\n0 0\n0 1\n1 0\n\nSample Output 4\n\n1.414213562373095048801688724209698078569671875376\n\nThere can be useless engines with (x_i, y_i) = (0, 0).\n\nSample Input 5\n\n1\n90447 91000\n\nSample Output 5\n\n128303.000000000000000000000000000000000000000000000000\n\nNote that there can be only one engine.\n\nSample Input 6\n\n2\n96000 -72000\n-72000 54000\n\nSample Output 6\n\n120000.000000000000000000000000000000000000000000000000\n\nThere can be only two engines, too.\n\nSample Input 7\n\n10\n1 2\n3 4\n5 6\n7 8\n9 10\n11 12\n13 14\n15 16\n17 18\n19 20\n\nSample Output 7\n\n148.660687473185055226120082139313966514489855137208", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2002, "cpu_time_ms": 8, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s082196211", "group_id": "codeNet:p02928", "input_text": "program kadai\n implicit none\n integer :: n,k\n integer,allocatable :: a(:)\n integer :: i,j\n integer(8) :: big,eq\n integer(8) :: num1,num2,num\n integer(8) :: small\n integer(8) :: kari\n\n read(*,*) n,k\n allocate(a(n))\n read(*,*) a\n\n num=0\n big=0\n small=0\n kari=0\n eq=0\n\n do i=1,n-1\n do j=i+1,n\n if (a(i)>a(j)) then\n big=big+1\n end if\n if (a(i)a(j)) then\n big=big+1\n end if\n if (a(i) B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "sample_input": "2 2\n2 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02928", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1199, "cpu_time_ms": 7, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s085587581", "group_id": "codeNet:p02928", "input_text": "program kadai\n implicit none\n integer :: n,k\n integer,allocatable :: a(:)\n integer :: i,j\n integer(8) :: big\n integer(8) :: num1,num2,num\n integer(8) :: small\n integer(8) :: kari\n\n read(*,*) n,k\n allocate(a(n))\n read(*,*) a\n\n num=0\n big=0\n small=0\n kari=0\n\n do i=1,n-1\n do j=i+1,n\n if (a(i)>a(j)) then\n big=big+1\n end if\n if (a(i)a(j)) then\n big=big+1\n end if\n if (a(i) B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "sample_input": "2 2\n2 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02928", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 990, "cpu_time_ms": 6, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s582036835", "group_id": "codeNet:p02928", "input_text": "program kadai\n implicit none\n integer :: n,k\n integer,allocatable :: a(:)\n integer :: i,j\n integer(8) :: big\n integer(8) :: num1,num2,num\n integer(8) :: small\n integer(8) :: kari\n\n read(*,*) n,k\n allocate(a(n))\n read(*,*) a\n\n num=0\n big=0\n small=0\n kari=0\n\n do i=1,n-1\n do j=i+1,n\n if (a(i)>a(j)) then\n big=big+1\n end if\n if (a(i)a(j)) then\n big=big+1\n end if\n if (a(i) B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "sample_input": "2 2\n2 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02928", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 932, "cpu_time_ms": 6, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s505469068", "group_id": "codeNet:p02928", "input_text": "integer(16) N,K,i,j\ninteger(16),allocatable,dimension(:)::A,B,C\ninteger(16) cnt\ninteger(16) ans\nread*,N,K\nallocate(A(N),B(N),C(N))\nread*,A\ndo i=1,N\n cnt=0\n do j=i+1,N\n if(A(i)>A(j))cnt=cnt+1\n end do\n B(i)=cnt\nend do\ndo i=1,N\n cnt=0\n do j=1,N\n if(A(i)>A(j))cnt=cnt+1\n end do\n C(i)=cnt\nend do\nans=0\ndo i=1,N\n ans=mod(ans+B(i)*K,10**9+7)\n ans=mod(ans+C(i)*((K-1)*K)/2,10**9+7)\nend do\nprint\"(i0)\",ans\nend", "language": "Fortran", "metadata": {"date": 1566697148, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02928.html", "problem_id": "p02928", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02928/input.txt", "sample_output_relpath": "derived/input_output/data/p02928/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02928/Fortran/s505469068.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s505469068", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "integer(16) N,K,i,j\ninteger(16),allocatable,dimension(:)::A,B,C\ninteger(16) cnt\ninteger(16) ans\nread*,N,K\nallocate(A(N),B(N),C(N))\nread*,A\ndo i=1,N\n cnt=0\n do j=i+1,N\n if(A(i)>A(j))cnt=cnt+1\n end do\n B(i)=cnt\nend do\ndo i=1,N\n cnt=0\n do j=1,N\n if(A(i)>A(j))cnt=cnt+1\n end do\n C(i)=cnt\nend do\nans=0\ndo i=1,N\n ans=mod(ans+B(i)*K,10**9+7)\n ans=mod(ans+C(i)*((K-1)*K)/2,10**9+7)\nend do\nprint\"(i0)\",ans\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "sample_input": "2 2\n2 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02928", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 416, "cpu_time_ms": 29, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s039154054", "group_id": "codeNet:p02928", "input_text": "integer(8) N,K,i\ninteger(8),allocatable,dimension(:)::A,B,C\ninteger(8) cnt\ninteger(8) ans\nread*,N,K\nallocate(A(N),B(N),C(N))\nread*,A\ndo i=1,N\n cnt=0\n do j=i+1,N\n if(A(i)>A(j))cnt=cnt+1\n end do\n B(i)=cnt\nend do\ndo i=1,N\n cnt=0\n do j=1,N\n if(A(i)>A(j))cnt=cnt+1\n end do\n C(i)=cnt\nend do\nans=0\ndo i=1,N\n ans=mod(ans+B(i)*K,10**9+7)\n ans=mod(ans+C(i)*((K-1)*K)/2,10**9+7)\nend do\nprint\"(i0)\",ans\nend", "language": "Fortran", "metadata": {"date": 1566696708, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02928.html", "problem_id": "p02928", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02928/input.txt", "sample_output_relpath": "derived/input_output/data/p02928/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02928/Fortran/s039154054.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s039154054", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "integer(8) N,K,i\ninteger(8),allocatable,dimension(:)::A,B,C\ninteger(8) cnt\ninteger(8) ans\nread*,N,K\nallocate(A(N),B(N),C(N))\nread*,A\ndo i=1,N\n cnt=0\n do j=i+1,N\n if(A(i)>A(j))cnt=cnt+1\n end do\n B(i)=cnt\nend do\ndo i=1,N\n cnt=0\n do j=1,N\n if(A(i)>A(j))cnt=cnt+1\n end do\n C(i)=cnt\nend do\nans=0\ndo i=1,N\n ans=mod(ans+B(i)*K,10**9+7)\n ans=mod(ans+C(i)*((K-1)*K)/2,10**9+7)\nend do\nprint\"(i0)\",ans\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "sample_input": "2 2\n2 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02928", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a sequence of N integers A~=~A_0,~A_1,~...,~A_{N - 1}.\n\nLet B be a sequence of K \\times N integers obtained by concatenating K copies of A. For example, if A~=~1,~3,~2 and K~=~2, B~=~1,~3,~2,~1,~3,~2.\n\nFind the inversion number of B, modulo 10^9 + 7.\n\nHere the inversion number of B is defined as the number of ordered pairs of integers (i,~j)~(0 \\leq i < j \\leq K \\times N - 1) such that B_i > B_j.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq K \\leq 10^9\n\n1 \\leq A_i \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_0 A_1 ... A_{N - 1}\n\nOutput\n\nPrint the inversion number of B, modulo 10^9 + 7.\n\nSample Input 1\n\n2 2\n2 1\n\nSample Output 1\n\n3\n\nIn this case, B~=~2,~1,~2,~1. We have:\n\nB_0 > B_1\n\nB_0 > B_3\n\nB_2 > B_3\n\nThus, the inversion number of B is 3.\n\nSample Input 2\n\n3 5\n1 1 1\n\nSample Output 2\n\n0\n\nA may contain multiple occurrences of the same number.\n\nSample Input 3\n\n10 998244353\n10 9 8 7 5 6 3 4 2 1\n\nSample Output 3\n\n185297239\n\nBe sure to print the output modulo 10^9 + 7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 410, "cpu_time_ms": 5, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s654326032", "group_id": "codeNet:p02929", "input_text": "module mod_modint\n implicit none\n integer(8) :: modulus = 1000000007_8\n ! integer(8) :: modulus = 998244353_8\n ! integer(8) :: modulus = 1000000009_8\n\n type modint\n private\n integer(8) :: num\n contains\n procedure :: get => getnum\n end type\n\n interface change_modulus\n module procedure :: change_modulus64, change_modulus32\n end interface change_modulus\n\n interface modint\n module procedure :: newm, newi\n end interface modint\n\n interface assignment(=)\n module procedure :: setm, seti64, seti32\n end interface assignment(=)\n\n interface operator(+)\n module procedure :: posm, addmm, addmi64, addmi32, addi64m, addi32m\n end interface operator(+)\n\n interface operator(-)\n module procedure :: negm, submm, submi64, submi32, subi64m, subi32m\n end interface operator(-)\n\n interface operator(*)\n module procedure :: mulmm, mulmi64, mulmi32, muli64m, muli32m\n end interface operator(*)\n\n interface operator(/)\n module procedure :: divmm, divmi64, divmi32, divi64m, divi32m\n end interface operator(/)\n\n interface operator(**)\n module procedure :: powmi64, powmi32\n end interface operator(**)\n\n interface inv\n module procedure :: invm\n end interface inv\n\ncontains\n\n subroutine change_modulus64(newmod)\n integer(8), intent(in) :: newmod\n if (newmod == 0_8) then\n write(*,'(a)') \"Error: Invalid value (newmod == 0). (modint, change_modulus64)\"\n stop\n end if\n modulus = newmod\n end\n\n subroutine change_modulus32(newmod)\n integer, intent(in) :: newmod\n if (newmod == 0) then\n write(*,'(a)') \"Error: Invalid value (newmod == 0). (modint, change_modulus32)\"\n stop\n end if\n modulus = int(newmod,8)\n end\n\n integer(8) function getnum(this)\n class(modint), intent(in) :: this\n getnum = this%num\n end\n\n pure elemental type(modint) function newm()\n newm%num = 0_8\n end\n\n pure elemental subroutine setm(x,y)\n type(modint), intent(inout) :: x\n type(modint), intent(in) :: y\n x%num = y%num\n end\n\n pure elemental function posm(x) result(n)\n type(modint), intent(in) :: x\n type(modint) :: n\n n%num = x%num\n end\n\n pure elemental function negm(x) result(n)\n type(modint), intent(in) :: x\n type(modint) :: n\n n%num = modulus-x%num\n end\n\n pure elemental function addmm(x,y) result(n)\n type(modint), intent(in) :: x, y\n type(modint) :: n\n n%num = x%num+y%num\n if (n%num >= modulus) n%num = n%num-modulus\n end\n\n pure elemental function submm(x,y) result(n)\n type(modint), intent(in) :: x, y\n type(modint) :: n\n n%num = x%num-y%num\n if (n%num < 0_8) n%num = n%num+modulus\n end\n\n pure elemental function mulmm(x,y) result(n)\n type(modint), intent(in) :: x, y\n type(modint) :: n\n n%num = mod(x%num*y%num,modulus)\n end\n\n impure elemental function invm(x) result(n)\n type(modint), intent(in) :: x\n type(modint) :: n\n integer(8) :: a, b, c, q, r, v\n a = x%num\n if (a == 0_8) then\n write(*,'(a)') \"Error: Division by zero (x == 0). (modint, invm)\"\n stop\n end if\n b = modulus\n c = 0_8\n v = 1_8\n do while (b /= 0_8)\n q = a/b\n r = mod(a,b)\n a = b\n b = r\n r = c\n c = v-c*q\n v = r\n end do\n n%num = modulo(v,modulus)\n end\n\n impure elemental function divmm(x,y) result(n)\n type(modint), intent(in) :: x, y\n type(modint) :: n\n n = mulmm(x,invm(y))\n end\n\n !##########################################################################\n !##################### overload with (normal) integer #####################\n !##########################################################################\n\n impure elemental type(modint) function newi(i)\n class(*), intent(in) :: i\n select type(i)\n type is (integer(8))\n newi%num = i\n type is (integer)\n newi%num = int(i,8)\n type is (integer(2))\n newi%num = int(i,8)\n type is (integer(1))\n newi%num = int(i,8)\n class default\n write(*,'(a)') \"Error: Invalid value (i is not integer). (modint, newi)\"\n stop\n end select\n newi%num = modulo(newi%num,modulus)\n end\n\n impure elemental subroutine seti64(x,i)\n type(modint), intent(inout) :: x\n integer(8), intent(in) :: i\n call setm(x,newi(i))\n end\n\n impure elemental subroutine seti32(x,i)\n type(modint), intent(inout) :: x\n integer, intent(in) :: i\n call setm(x,newi(i))\n end\n\n impure elemental function addmi64(x,i) result(n)\n type(modint), intent(in) :: x\n integer(8), intent(in) :: i\n type(modint) :: n\n n = addmm(x,newi(i))\n end\n\n impure elemental function addmi32(x,i) result(n)\n type(modint), intent(in) :: x\n integer, intent(in) :: i\n type(modint) :: n\n n = addmm(x,newi(i))\n end\n\n impure elemental function addi64m(i,y) result(n)\n integer(8), intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = addmm(newi(i),y)\n end\n\n impure elemental function addi32m(i,y) result(n)\n integer, intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = addmm(newi(i),y)\n end\n\n impure elemental function submi64(x,i) result(n)\n type(modint), intent(in) :: x\n integer(8), intent(in) :: i\n type(modint) :: n\n n = submm(x,newi(i))\n end\n\n impure elemental function submi32(x,i) result(n)\n type(modint), intent(in) :: x\n integer, intent(in) :: i\n type(modint) :: n\n n = submm(x,newi(i))\n end\n\n impure elemental function subi64m(i,y) result(n)\n integer(8), intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = submm(newi(i),y)\n end\n\n impure elemental function subi32m(i,y) result(n)\n integer, intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = submm(newi(i),y)\n end\n\n impure elemental function mulmi64(x,i) result(n)\n type(modint), intent(in) :: x\n integer(8), intent(in) :: i\n type(modint) :: n\n n = mulmm(x,newi(i))\n end\n\n impure elemental function mulmi32(x,i) result(n)\n type(modint), intent(in) :: x\n integer, intent(in) :: i\n type(modint) :: n\n n = mulmm(x,newi(i))\n end\n\n impure elemental function muli64m(i,y) result(n)\n integer(8), intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = mulmm(newi(i),y)\n end\n\n impure elemental function muli32m(i,y) result(n)\n integer, intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = mulmm(newi(i),y)\n end\n\n impure elemental function divmi64(x,i) result(n)\n type(modint), intent(in) :: x\n integer(8), intent(in) :: i\n type(modint) :: n\n n = divmm(x,newi(i))\n end\n\n impure elemental function divmi32(x,i) result(n)\n type(modint), intent(in) :: x\n integer, intent(in) :: i\n type(modint) :: n\n n = divmm(x,newi(i))\n end\n\n impure elemental function divi64m(i,y) result(n)\n integer(8), intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = divmm(newi(i),y)\n end\n\n impure elemental function divi32m(i,y) result(n)\n integer, intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = divmm(newi(i),y)\n end\n\n impure elemental function powmi64(x,i) result(n)\n type(modint), intent(in) :: x\n integer(8), intent(in) :: i\n type(modint) :: n, p\n integer(8) :: m\n n = newi(1_8)\n p = x\n m = i\n if (i < 0_8) then\n p = invm(x)\n m = abs(i)\n end if\n do while (m > 0_8)\n if (btest(m,0)) n = mulmm(p,n)\n p = mulmm(p,p)\n m = rshift(m,1)\n end do\n end\n\n impure elemental function powmi32(x,i) result(n)\n type(modint), intent(in) :: x\n integer, intent(in) :: i\n type(modint) :: n, p\n integer :: m\n n = newi(1_8)\n p = x\n m = i\n if (i < 0) then\n p = invm(x)\n m = abs(i)\n end if\n do while (m > 0)\n if (btest(m,0)) n = mulmm(p,n)\n p = mulmm(p,p)\n m = rshift(m,1)\n end do\n end\n\nend module mod_modint\n\nprogram cell_inversion\n use mod_modint\n implicit none\n integer :: n, a(200000) = 0, i, l(0:200001) = 0, r(0:200001) = 0\n character(200000) :: s\n type(modint) :: ans\n read(*,*) n\n read(*,*) s\n do i = 1, 2*n\n if (s(i:i) == \"B\") a(i) = 1\n if (mod(i-1,2) == a(i)) then\n l(i) = l(i)+1\n else\n r(i) = r(i)+1\n end if\n end do\n do i = 1, 2*n\n r(i) = r(i)+r(i-1)\n end do\n do i = 2*n, 1, -1\n l(i) = l(i)+l(i+1)\n end do\n ans = 1\n do i = 1, 2*n\n if (mod(i-1,2) == a(i)) then\n ans = ans*r(i)\n else\n ans = ans*l(i)\n end if\n end do\n ans = ans/modint(2)**(2*n-2)\n write(*,'(i0)') modulo(ans%get(),modulus)\nend program cell_inversion", "language": "Fortran", "metadata": {"date": 1566700730, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02929.html", "problem_id": "p02929", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02929/input.txt", "sample_output_relpath": "derived/input_output/data/p02929/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02929/Fortran/s654326032.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s654326032", "user_id": "u506403362"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "module mod_modint\n implicit none\n integer(8) :: modulus = 1000000007_8\n ! integer(8) :: modulus = 998244353_8\n ! integer(8) :: modulus = 1000000009_8\n\n type modint\n private\n integer(8) :: num\n contains\n procedure :: get => getnum\n end type\n\n interface change_modulus\n module procedure :: change_modulus64, change_modulus32\n end interface change_modulus\n\n interface modint\n module procedure :: newm, newi\n end interface modint\n\n interface assignment(=)\n module procedure :: setm, seti64, seti32\n end interface assignment(=)\n\n interface operator(+)\n module procedure :: posm, addmm, addmi64, addmi32, addi64m, addi32m\n end interface operator(+)\n\n interface operator(-)\n module procedure :: negm, submm, submi64, submi32, subi64m, subi32m\n end interface operator(-)\n\n interface operator(*)\n module procedure :: mulmm, mulmi64, mulmi32, muli64m, muli32m\n end interface operator(*)\n\n interface operator(/)\n module procedure :: divmm, divmi64, divmi32, divi64m, divi32m\n end interface operator(/)\n\n interface operator(**)\n module procedure :: powmi64, powmi32\n end interface operator(**)\n\n interface inv\n module procedure :: invm\n end interface inv\n\ncontains\n\n subroutine change_modulus64(newmod)\n integer(8), intent(in) :: newmod\n if (newmod == 0_8) then\n write(*,'(a)') \"Error: Invalid value (newmod == 0). (modint, change_modulus64)\"\n stop\n end if\n modulus = newmod\n end\n\n subroutine change_modulus32(newmod)\n integer, intent(in) :: newmod\n if (newmod == 0) then\n write(*,'(a)') \"Error: Invalid value (newmod == 0). (modint, change_modulus32)\"\n stop\n end if\n modulus = int(newmod,8)\n end\n\n integer(8) function getnum(this)\n class(modint), intent(in) :: this\n getnum = this%num\n end\n\n pure elemental type(modint) function newm()\n newm%num = 0_8\n end\n\n pure elemental subroutine setm(x,y)\n type(modint), intent(inout) :: x\n type(modint), intent(in) :: y\n x%num = y%num\n end\n\n pure elemental function posm(x) result(n)\n type(modint), intent(in) :: x\n type(modint) :: n\n n%num = x%num\n end\n\n pure elemental function negm(x) result(n)\n type(modint), intent(in) :: x\n type(modint) :: n\n n%num = modulus-x%num\n end\n\n pure elemental function addmm(x,y) result(n)\n type(modint), intent(in) :: x, y\n type(modint) :: n\n n%num = x%num+y%num\n if (n%num >= modulus) n%num = n%num-modulus\n end\n\n pure elemental function submm(x,y) result(n)\n type(modint), intent(in) :: x, y\n type(modint) :: n\n n%num = x%num-y%num\n if (n%num < 0_8) n%num = n%num+modulus\n end\n\n pure elemental function mulmm(x,y) result(n)\n type(modint), intent(in) :: x, y\n type(modint) :: n\n n%num = mod(x%num*y%num,modulus)\n end\n\n impure elemental function invm(x) result(n)\n type(modint), intent(in) :: x\n type(modint) :: n\n integer(8) :: a, b, c, q, r, v\n a = x%num\n if (a == 0_8) then\n write(*,'(a)') \"Error: Division by zero (x == 0). (modint, invm)\"\n stop\n end if\n b = modulus\n c = 0_8\n v = 1_8\n do while (b /= 0_8)\n q = a/b\n r = mod(a,b)\n a = b\n b = r\n r = c\n c = v-c*q\n v = r\n end do\n n%num = modulo(v,modulus)\n end\n\n impure elemental function divmm(x,y) result(n)\n type(modint), intent(in) :: x, y\n type(modint) :: n\n n = mulmm(x,invm(y))\n end\n\n !##########################################################################\n !##################### overload with (normal) integer #####################\n !##########################################################################\n\n impure elemental type(modint) function newi(i)\n class(*), intent(in) :: i\n select type(i)\n type is (integer(8))\n newi%num = i\n type is (integer)\n newi%num = int(i,8)\n type is (integer(2))\n newi%num = int(i,8)\n type is (integer(1))\n newi%num = int(i,8)\n class default\n write(*,'(a)') \"Error: Invalid value (i is not integer). (modint, newi)\"\n stop\n end select\n newi%num = modulo(newi%num,modulus)\n end\n\n impure elemental subroutine seti64(x,i)\n type(modint), intent(inout) :: x\n integer(8), intent(in) :: i\n call setm(x,newi(i))\n end\n\n impure elemental subroutine seti32(x,i)\n type(modint), intent(inout) :: x\n integer, intent(in) :: i\n call setm(x,newi(i))\n end\n\n impure elemental function addmi64(x,i) result(n)\n type(modint), intent(in) :: x\n integer(8), intent(in) :: i\n type(modint) :: n\n n = addmm(x,newi(i))\n end\n\n impure elemental function addmi32(x,i) result(n)\n type(modint), intent(in) :: x\n integer, intent(in) :: i\n type(modint) :: n\n n = addmm(x,newi(i))\n end\n\n impure elemental function addi64m(i,y) result(n)\n integer(8), intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = addmm(newi(i),y)\n end\n\n impure elemental function addi32m(i,y) result(n)\n integer, intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = addmm(newi(i),y)\n end\n\n impure elemental function submi64(x,i) result(n)\n type(modint), intent(in) :: x\n integer(8), intent(in) :: i\n type(modint) :: n\n n = submm(x,newi(i))\n end\n\n impure elemental function submi32(x,i) result(n)\n type(modint), intent(in) :: x\n integer, intent(in) :: i\n type(modint) :: n\n n = submm(x,newi(i))\n end\n\n impure elemental function subi64m(i,y) result(n)\n integer(8), intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = submm(newi(i),y)\n end\n\n impure elemental function subi32m(i,y) result(n)\n integer, intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = submm(newi(i),y)\n end\n\n impure elemental function mulmi64(x,i) result(n)\n type(modint), intent(in) :: x\n integer(8), intent(in) :: i\n type(modint) :: n\n n = mulmm(x,newi(i))\n end\n\n impure elemental function mulmi32(x,i) result(n)\n type(modint), intent(in) :: x\n integer, intent(in) :: i\n type(modint) :: n\n n = mulmm(x,newi(i))\n end\n\n impure elemental function muli64m(i,y) result(n)\n integer(8), intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = mulmm(newi(i),y)\n end\n\n impure elemental function muli32m(i,y) result(n)\n integer, intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = mulmm(newi(i),y)\n end\n\n impure elemental function divmi64(x,i) result(n)\n type(modint), intent(in) :: x\n integer(8), intent(in) :: i\n type(modint) :: n\n n = divmm(x,newi(i))\n end\n\n impure elemental function divmi32(x,i) result(n)\n type(modint), intent(in) :: x\n integer, intent(in) :: i\n type(modint) :: n\n n = divmm(x,newi(i))\n end\n\n impure elemental function divi64m(i,y) result(n)\n integer(8), intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = divmm(newi(i),y)\n end\n\n impure elemental function divi32m(i,y) result(n)\n integer, intent(in) :: i\n type(modint), intent(in) :: y\n type(modint) :: n\n n = divmm(newi(i),y)\n end\n\n impure elemental function powmi64(x,i) result(n)\n type(modint), intent(in) :: x\n integer(8), intent(in) :: i\n type(modint) :: n, p\n integer(8) :: m\n n = newi(1_8)\n p = x\n m = i\n if (i < 0_8) then\n p = invm(x)\n m = abs(i)\n end if\n do while (m > 0_8)\n if (btest(m,0)) n = mulmm(p,n)\n p = mulmm(p,p)\n m = rshift(m,1)\n end do\n end\n\n impure elemental function powmi32(x,i) result(n)\n type(modint), intent(in) :: x\n integer, intent(in) :: i\n type(modint) :: n, p\n integer :: m\n n = newi(1_8)\n p = x\n m = i\n if (i < 0) then\n p = invm(x)\n m = abs(i)\n end if\n do while (m > 0)\n if (btest(m,0)) n = mulmm(p,n)\n p = mulmm(p,p)\n m = rshift(m,1)\n end do\n end\n\nend module mod_modint\n\nprogram cell_inversion\n use mod_modint\n implicit none\n integer :: n, a(200000) = 0, i, l(0:200001) = 0, r(0:200001) = 0\n character(200000) :: s\n type(modint) :: ans\n read(*,*) n\n read(*,*) s\n do i = 1, 2*n\n if (s(i:i) == \"B\") a(i) = 1\n if (mod(i-1,2) == a(i)) then\n l(i) = l(i)+1\n else\n r(i) = r(i)+1\n end if\n end do\n do i = 1, 2*n\n r(i) = r(i)+r(i-1)\n end do\n do i = 2*n, 1, -1\n l(i) = l(i)+l(i+1)\n end do\n ans = 1\n do i = 1, 2*n\n if (mod(i-1,2) == a(i)) then\n ans = ans*r(i)\n else\n ans = ans*l(i)\n end if\n end do\n ans = ans/modint(2)**(2*n-2)\n write(*,'(i0)') modulo(ans%get(),modulus)\nend program cell_inversion", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are 2N squares arranged from left to right. You are given a string of length 2N representing the color of each of the squares.\n\nThe color of the i-th square from the left is black if the i-th character of S is B, and white if that character is W.\n\nYou will perform the following operation exactly N times: choose two distinct squares, then invert the colors of these squares and the squares between them. Here, to invert the color of a square is to make it white if it is black, and vice versa.\n\nThroughout this process, you cannot choose the same square twice or more. That is, each square has to be chosen exactly once.\n\nFind the number of ways to make all the squares white at the end of the process, modulo 10^9+7.\n\nTwo ways to make the squares white are considered different if and only if there exists i (1 \\leq i \\leq N) such that the pair of the squares chosen in the i-th operation is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = 2N\n\nEach character of S is B or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of ways to make all the squares white at the end of the process, modulo 10^9+7. If there are no such ways, print 0.\n\nSample Input 1\n\n2\nBWWB\n\nSample Output 1\n\n4\n\nThere are four ways to make all the squares white, as follows:\n\nChoose Squares 1, 3 in the first operation, and choose Squares 2, 4 in the second operation.\n\nChoose Squares 2, 4 in the first operation, and choose Squares 1, 3 in the second operation.\n\nChoose Squares 1, 4 in the first operation, and choose Squares 2, 3 in the second operation.\n\nChoose Squares 2, 3 in the first operation, and choose Squares 1, 4 in the second operation.\n\nSample Input 2\n\n4\nBWBBWWWB\n\nSample Output 2\n\n288\n\nSample Input 3\n\n5\nWWWWWWWWWW\n\nSample Output 3\n\n0", "sample_input": "2\nBWWB\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02929", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are 2N squares arranged from left to right. You are given a string of length 2N representing the color of each of the squares.\n\nThe color of the i-th square from the left is black if the i-th character of S is B, and white if that character is W.\n\nYou will perform the following operation exactly N times: choose two distinct squares, then invert the colors of these squares and the squares between them. Here, to invert the color of a square is to make it white if it is black, and vice versa.\n\nThroughout this process, you cannot choose the same square twice or more. That is, each square has to be chosen exactly once.\n\nFind the number of ways to make all the squares white at the end of the process, modulo 10^9+7.\n\nTwo ways to make the squares white are considered different if and only if there exists i (1 \\leq i \\leq N) such that the pair of the squares chosen in the i-th operation is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = 2N\n\nEach character of S is B or W.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of ways to make all the squares white at the end of the process, modulo 10^9+7. If there are no such ways, print 0.\n\nSample Input 1\n\n2\nBWWB\n\nSample Output 1\n\n4\n\nThere are four ways to make all the squares white, as follows:\n\nChoose Squares 1, 3 in the first operation, and choose Squares 2, 4 in the second operation.\n\nChoose Squares 2, 4 in the first operation, and choose Squares 1, 3 in the second operation.\n\nChoose Squares 1, 4 in the first operation, and choose Squares 2, 3 in the second operation.\n\nChoose Squares 2, 3 in the first operation, and choose Squares 1, 4 in the second operation.\n\nSample Input 2\n\n4\nBWBBWWWB\n\nSample Output 2\n\n288\n\nSample Input 3\n\n5\nWWWWWWWWWW\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 8555, "cpu_time_ms": 13, "memory_kb": 3084}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s421675465", "group_id": "codeNet:p02934", "input_text": "program bbb\n\nimplicit none\ninteger :: n, i\nreal(8),allocatable,dimension(:) :: a\n\nread*, n\nallocate(a(n))\nread*, a\n\ndo i=1,n\na(i) = 1/a(i)\nend do\n\nwrite(*,'(f0.14)') 1/sum(a)\n\nend program", "language": "Fortran", "metadata": {"date": 1568648049, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02934.html", "problem_id": "p02934", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02934/input.txt", "sample_output_relpath": "derived/input_output/data/p02934/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02934/Fortran/s421675465.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s421675465", "user_id": "u039189422"}, "prompt_components": {"gold_output": "7.5\n", "input_to_evaluate": "program bbb\n\nimplicit none\ninteger :: n, i\nreal(8),allocatable,dimension(:) :: a\n\nread*, n\nallocate(a(n))\nread*, a\n\ndo i=1,n\na(i) = 1/a(i)\nend do\n\nwrite(*,'(f0.14)') 1/sum(a)\n\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\n\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the value of \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10 30\n\nSample Output 1\n\n7.5\n\n\\frac{1}{\\frac{1}{10} + \\frac{1}{30}} = \\frac{1}{\\frac{4}{30}} = \\frac{30}{4} = 7.5.\n\nPrinting 7.50001, 7.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n200 200 200\n\nSample Output 2\n\n66.66666666666667\n\n\\frac{1}{\\frac{1}{200} + \\frac{1}{200} + \\frac{1}{200}} = \\frac{1}{\\frac{3}{200}} = \\frac{200}{3} = 66.6666....\n\nPrinting 6.66666e+1 and so on will also be accepted.\n\nSample Input 3\n\n1\n1000\n\nSample Output 3\n\n1000\n\n\\frac{1}{\\frac{1}{1000}} = 1000.\n\nPrinting +1000.0 and so on will also be accepted.", "sample_input": "2\n10 30\n"}, "reference_outputs": ["7.5\n"], "source_document_id": "p02934", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\n\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the value of \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10 30\n\nSample Output 1\n\n7.5\n\n\\frac{1}{\\frac{1}{10} + \\frac{1}{30}} = \\frac{1}{\\frac{4}{30}} = \\frac{30}{4} = 7.5.\n\nPrinting 7.50001, 7.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n200 200 200\n\nSample Output 2\n\n66.66666666666667\n\n\\frac{1}{\\frac{1}{200} + \\frac{1}{200} + \\frac{1}{200}} = \\frac{1}{\\frac{3}{200}} = \\frac{200}{3} = 66.6666....\n\nPrinting 6.66666e+1 and so on will also be accepted.\n\nSample Input 3\n\n1\n1000\n\nSample Output 3\n\n1000\n\n\\frac{1}{\\frac{1}{1000}} = 1000.\n\nPrinting +1000.0 and so on will also be accepted.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 187, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s291502570", "group_id": "codeNet:p02934", "input_text": "program main\n implicit none\n\n integer :: n, a(100),i\n real :: s = 0.0\n\n read(*,*)n\n read(*,*)(a(i),i=1, n)\n\n do i = 1, n\n s = s + 1.d0/real(a(i))\n end do\n write(*,*)s\n\nend program main", "language": "Fortran", "metadata": {"date": 1566310538, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02934.html", "problem_id": "p02934", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02934/input.txt", "sample_output_relpath": "derived/input_output/data/p02934/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02934/Fortran/s291502570.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s291502570", "user_id": "u287431190"}, "prompt_components": {"gold_output": "7.5\n", "input_to_evaluate": "program main\n implicit none\n\n integer :: n, a(100),i\n real :: s = 0.0\n\n read(*,*)n\n read(*,*)(a(i),i=1, n)\n\n do i = 1, n\n s = s + 1.d0/real(a(i))\n end do\n write(*,*)s\n\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\n\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the value of \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10 30\n\nSample Output 1\n\n7.5\n\n\\frac{1}{\\frac{1}{10} + \\frac{1}{30}} = \\frac{1}{\\frac{4}{30}} = \\frac{30}{4} = 7.5.\n\nPrinting 7.50001, 7.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n200 200 200\n\nSample Output 2\n\n66.66666666666667\n\n\\frac{1}{\\frac{1}{200} + \\frac{1}{200} + \\frac{1}{200}} = \\frac{1}{\\frac{3}{200}} = \\frac{200}{3} = 66.6666....\n\nPrinting 6.66666e+1 and so on will also be accepted.\n\nSample Input 3\n\n1\n1000\n\nSample Output 3\n\n1000\n\n\\frac{1}{\\frac{1}{1000}} = 1000.\n\nPrinting +1000.0 and so on will also be accepted.", "sample_input": "2\n10 30\n"}, "reference_outputs": ["7.5\n"], "source_document_id": "p02934", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is a sequence of N integers A_1, \\ldots, A_N.\n\nFind the (multiplicative) inverse of the sum of the inverses of these numbers, \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 \\ldots A_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the value of \\frac{1}{\\frac{1}{A_1} + \\ldots + \\frac{1}{A_N}}.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10 30\n\nSample Output 1\n\n7.5\n\n\\frac{1}{\\frac{1}{10} + \\frac{1}{30}} = \\frac{1}{\\frac{4}{30}} = \\frac{30}{4} = 7.5.\n\nPrinting 7.50001, 7.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n200 200 200\n\nSample Output 2\n\n66.66666666666667\n\n\\frac{1}{\\frac{1}{200} + \\frac{1}{200} + \\frac{1}{200}} = \\frac{1}{\\frac{3}{200}} = \\frac{200}{3} = 66.6666....\n\nPrinting 6.66666e+1 and so on will also be accepted.\n\nSample Input 3\n\n1\n1000\n\nSample Output 3\n\n1000\n\n\\frac{1}{\\frac{1}{1000}} = 1000.\n\nPrinting +1000.0 and so on will also be accepted.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 195, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s856969460", "group_id": "codeNet:p02935", "input_text": "program ccc\n\nimplicit none\ninteger :: n, i\nreal(8) :: res\nreal(8),allocatable, dimension(:) :: v\n\nread*, n\nallocate(v(n))\nread*, v\n\ncall heapsort(n,v)\n\nv(1) = v(1)/((2.0D0)**(n-1))\nres= v(1)\n\ndo i=2,n\nv(i) = v(i)/((2.0D0)**(n-i+1))\nres = res + v(i)\nend do\n\nwrite(*,'(f0.14)') res\n\nend program\n\n\nsubroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n double precision,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n double precision :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n\n return\nend subroutine heapsort", "language": "Fortran", "metadata": {"date": 1568649260, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02935.html", "problem_id": "p02935", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02935/input.txt", "sample_output_relpath": "derived/input_output/data/p02935/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02935/Fortran/s856969460.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s856969460", "user_id": "u039189422"}, "prompt_components": {"gold_output": "3.5\n", "input_to_evaluate": "program ccc\n\nimplicit none\ninteger :: n, i\nreal(8) :: res\nreal(8),allocatable, dimension(:) :: v\n\nread*, n\nallocate(v(n))\nread*, v\n\ncall heapsort(n,v)\n\nv(1) = v(1)/((2.0D0)**(n-1))\nres= v(1)\n\ndo i=2,n\nv(i) = v(i)/((2.0D0)**(n-i+1))\nres = res + v(i)\nend do\n\nwrite(*,'(f0.14)') res\n\nend program\n\n\nsubroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n double precision,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n double precision :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n\n return\nend subroutine heapsort", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \\leq i \\leq N) is v_i.\n\nWhen you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.\n\nAfter you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.\n\nConstraints\n\n2 \\leq N \\leq 50\n\n1 \\leq v_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nv_1 v_2 \\ldots v_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n3 4\n\nSample Output 1\n\n3.5\n\nIf you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5.\n\nPrinting 3.50001, 3.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n500 300 200\n\nSample Output 2\n\n375\n\nYou start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:\n\nUse the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400. The next composition will use this ingredient and the ingredient of value 200, resulting in an ingredient of value (400 + 200) / 2 = 300.\n\nUse the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350. The next composition will use this ingredient and the ingredient of value 300, resulting in an ingredient of value (350 + 300) / 2 = 325.\n\nUse the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250. The next composition will use this ingredient and the ingredient of value 500, resulting in an ingredient of value (250 + 500) / 2 = 375.\n\nThus, the maximum possible value of the last ingredient remaining is 375.\n\nPrinting 375.0 and so on will also be accepted.\n\nSample Input 3\n\n5\n138 138 138 138 138\n\nSample Output 3\n\n138", "sample_input": "2\n3 4\n"}, "reference_outputs": ["3.5\n"], "source_document_id": "p02935", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \\leq i \\leq N) is v_i.\n\nWhen you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.\n\nAfter you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.\n\nConstraints\n\n2 \\leq N \\leq 50\n\n1 \\leq v_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nv_1 v_2 \\ldots v_N\n\nOutput\n\nPrint a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.\n\nYour output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n3 4\n\nSample Output 1\n\n3.5\n\nIf you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5.\n\nPrinting 3.50001, 3.49999, and so on will also be accepted.\n\nSample Input 2\n\n3\n500 300 200\n\nSample Output 2\n\n375\n\nYou start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:\n\nUse the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400. The next composition will use this ingredient and the ingredient of value 200, resulting in an ingredient of value (400 + 200) / 2 = 300.\n\nUse the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350. The next composition will use this ingredient and the ingredient of value 300, resulting in an ingredient of value (350 + 300) / 2 = 325.\n\nUse the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250. The next composition will use this ingredient and the ingredient of value 500, resulting in an ingredient of value (250 + 500) / 2 = 375.\n\nThus, the maximum possible value of the last ingredient remaining is 375.\n\nPrinting 375.0 and so on will also be accepted.\n\nSample Input 3\n\n5\n138 138 138 138 138\n\nSample Output 3\n\n138", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1118, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s949881577", "group_id": "codeNet:p02937", "input_text": "program main\n implicit none\n integer(8) i,ns,nt,judge,ans,j,c2\n character(10**5) s,t\n character c1\n read(*, *)s, t\n ns = len(trim(s))\n nt = len(trim(t))\n ans = 1\n c2 = 1\n judge = 1\n do i = 1,nt\n c1 = t(i:i)\n do j = 1,ns+1\n ans = ans + 1\n c2 = c2 + 1\n if (c2 == ns + 1) then\n c2 = 1\n end if \n if (j == ns + 1) then\n judge = 0\n exit\n elseif (s(c2:c2) == c1) then\n exit\n end if\n end do\n if (judge == 0) then\n exit\n end if\n end do\n !read(*, *) (L(i), i = 1,N)\n if (judge == 0) then\n write(*, *) -1\n else\n write(*, *) ans\n end if\nend program main\n", "language": "Fortran", "metadata": {"date": 1566180969, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02937.html", "problem_id": "p02937", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02937/input.txt", "sample_output_relpath": "derived/input_output/data/p02937/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02937/Fortran/s949881577.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s949881577", "user_id": "u050276949"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main\n implicit none\n integer(8) i,ns,nt,judge,ans,j,c2\n character(10**5) s,t\n character c1\n read(*, *)s, t\n ns = len(trim(s))\n nt = len(trim(t))\n ans = 1\n c2 = 1\n judge = 1\n do i = 1,nt\n c1 = t(i:i)\n do j = 1,ns+1\n ans = ans + 1\n c2 = c2 + 1\n if (c2 == ns + 1) then\n c2 = 1\n end if \n if (j == ns + 1) then\n judge = 0\n exit\n elseif (s(c2:c2) == c1) then\n exit\n end if\n end do\n if (judge == 0) then\n exit\n end if\n end do\n !read(*, *) (L(i), i = 1,N)\n if (judge == 0) then\n write(*, *) -1\n else\n write(*, *) ans\n end if\nend program main\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\nLet s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{s'}_i (the first i characters in s').\n\nNotes\n\nA subsequence of a string a is a string obtained by deleting zero or more characters from a and concatenating the remaining characters without changing the relative order. For example, the subsequences of contest include net, c, and contest.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\n1 \\leq |t| \\leq 10^5\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print -1.\n\nSample Input 1\n\ncontest\nson\n\nSample Output 1\n\n10\n\nt = son is a subsequence of the string contestcon (the first 10 characters in s' = contestcontestcontest...), so i = 10 satisfies the condition.\n\nOn the other hand, t is not a subsequence of the string contestco (the first 9 characters in s'), so i = 9 does not satisfy the condition.\n\nSimilarly, any integer less than 9 does not satisfy the condition, either. Thus, the minimum integer i satisfying the condition is 10.\n\nSample Input 2\n\ncontest\nprogramming\n\nSample Output 2\n\n-1\n\nt = programming is not a substring of s' = contestcontestcontest.... Thus, there is no integer i satisfying the condition.\n\nSample Input 3\n\ncontest\nsentence\n\nSample Output 3\n\n33\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "contest\nson\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02937", "source_text": "Score : 500 points\n\nProblem Statement\n\nGiven are two strings s and t consisting of lowercase English letters. Determine if there exists an integer i satisfying the following condition, and find the minimum such i if it exists.\n\nLet s' be the concatenation of 10^{100} copies of s. t is a subsequence of the string {s'}_1{s'}_2\\ldots{s'}_i (the first i characters in s').\n\nNotes\n\nA subsequence of a string a is a string obtained by deleting zero or more characters from a and concatenating the remaining characters without changing the relative order. For example, the subsequences of contest include net, c, and contest.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\n1 \\leq |t| \\leq 10^5\n\ns and t consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nt\n\nOutput\n\nIf there exists an integer i satisfying the following condition, print the minimum such i; otherwise, print -1.\n\nSample Input 1\n\ncontest\nson\n\nSample Output 1\n\n10\n\nt = son is a subsequence of the string contestcon (the first 10 characters in s' = contestcontestcontest...), so i = 10 satisfies the condition.\n\nOn the other hand, t is not a subsequence of the string contestco (the first 9 characters in s'), so i = 9 does not satisfy the condition.\n\nSimilarly, any integer less than 9 does not satisfy the condition, either. Thus, the minimum integer i satisfying the condition is 10.\n\nSample Input 2\n\ncontest\nprogramming\n\nSample Output 2\n\n-1\n\nt = programming is not a substring of s' = contestcontestcontest.... Thus, there is no integer i satisfying the condition.\n\nSample Input 3\n\ncontest\nsentence\n\nSample Output 3\n\n33\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 647, "cpu_time_ms": 2107, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s778395541", "group_id": "codeNet:p02939", "input_text": "program prob2\n implicit none\n integer::i, l, cnt, k, j\n character(len=200005)::S\n character(len=2)::a\n read(*,*) S\n l = len_trim(S)\n\n a = S(1:1)\n cnt = 1\n i = 2\n do while(i <= l)\n k = len_trim(a)\n if(k > 1) then\n a = S(i:i)\n i = i+1\n cnt = cnt + 1\n else\n if(S(i:i) .ne. a(1:1)) then\n a = S(i:i)\n i = i+1\n else if(i /= l) then\n a = S(i:i+1)\n i = i+2\n else\n exit\n end if\n cnt = cnt + 1\n end if\n end do\n\n write(*,*) cnt\n stop\nend program prob2", "language": "Fortran", "metadata": {"date": 1592061669, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02939.html", "problem_id": "p02939", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02939/input.txt", "sample_output_relpath": "derived/input_output/data/p02939/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02939/Fortran/s778395541.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s778395541", "user_id": "u841856382"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program prob2\n implicit none\n integer::i, l, cnt, k, j\n character(len=200005)::S\n character(len=2)::a\n read(*,*) S\n l = len_trim(S)\n\n a = S(1:1)\n cnt = 1\n i = 2\n do while(i <= l)\n k = len_trim(a)\n if(k > 1) then\n a = S(i:i)\n i = i+1\n cnt = cnt + 1\n else\n if(S(i:i) .ne. a(1:1)) then\n a = S(i:i)\n i = i+1\n else if(i /= l) then\n a = S(i:i+1)\n i = i+2\n else\n exit\n end if\n cnt = cnt + 1\n end if\n end do\n\n write(*,*) cnt\n stop\nend program prob2", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition:\n\nThere exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \\neq S_{i+1} (1 \\leq i \\leq K-1).\n\nHere S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this order.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum positive integer K that satisfies the condition.\n\nSample Input 1\n\naabbaa\n\nSample Output 1\n\n4\n\nWe can, for example, divide S into four strings aa, b, ba, and a.\n\nSample Input 2\n\naaaccacabaababc\n\nSample Output 2\n\n12", "sample_input": "aabbaa\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02939", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is a string S consisting of lowercase English letters. Find the maximum positive integer K that satisfies the following condition:\n\nThere exists a partition of S into K non-empty strings S=S_1S_2...S_K such that S_i \\neq S_{i+1} (1 \\leq i \\leq K-1).\n\nHere S_1S_2...S_K represents the concatenation of S_1,S_2,...,S_K in this order.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum positive integer K that satisfies the condition.\n\nSample Input 1\n\naabbaa\n\nSample Output 1\n\n4\n\nWe can, for example, divide S into four strings aa, b, ba, and a.\n\nSample Input 2\n\naaaccacabaababc\n\nSample Output 2\n\n12", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 670, "cpu_time_ms": 6, "memory_kb": 1212}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s982395601", "group_id": "codeNet:p02945", "input_text": "module ABC137\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_A\n\n ! contained s and s are below\n contains\n\n subroutine task_A (A, B)\n\n ! arguments for this \n integer(INT16), intent(in) :: A, B\n\n ! STEP.01\n ! calculate & output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') maxval( [A + B, A - B, A * B] )\n\n ! STEP.END\n return\n\n end subroutine task_A\n\nend module ABC137\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC137\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! variables for this \n integer(INT16) :: A, B\n\n ! STEP.01\n ! read out the given data\n read(unit=INPUT_UNIT, fmt=*) A, B\n\n ! STEP.02\n ! calculate & output the answer of this task\n call task_A (A, B)\n\nend program main", "language": "Fortran", "metadata": {"date": 1565522482, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02945.html", "problem_id": "p02945", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02945/input.txt", "sample_output_relpath": "derived/input_output/data/p02945/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02945/Fortran/s982395601.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s982395601", "user_id": "u484703930"}, "prompt_components": {"gold_output": "-10\n", "input_to_evaluate": "module ABC137\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_A\n\n ! contained s and s are below\n contains\n\n subroutine task_A (A, B)\n\n ! arguments for this \n integer(INT16), intent(in) :: A, B\n\n ! STEP.01\n ! calculate & output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') maxval( [A + B, A - B, A * B] )\n\n ! STEP.END\n return\n\n end subroutine task_A\n\nend module ABC137\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC137\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! variables for this \n integer(INT16) :: A, B\n\n ! STEP.01\n ! read out the given data\n read(unit=INPUT_UNIT, fmt=*) A, B\n\n ! STEP.02\n ! calculate & output the answer of this task\n call task_A (A, B)\n\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have two integers: A and B.\n\nPrint the largest number among A + B, A - B, and A \\times B.\n\nConstraints\n\nAll values in input are integers.\n\n-100 \\leq A,\\ B \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the largest number among A + B, A - B, and A \\times B.\n\nSample Input 1\n\n-13 3\n\nSample Output 1\n\n-10\n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is -10.\n\nSample Input 2\n\n1 -33\n\nSample Output 2\n\n34\n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\nSample Input 3\n\n13 3\n\nSample Output 3\n\n39\n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39.", "sample_input": "-13 3\n"}, "reference_outputs": ["-10\n"], "source_document_id": "p02945", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have two integers: A and B.\n\nPrint the largest number among A + B, A - B, and A \\times B.\n\nConstraints\n\nAll values in input are integers.\n\n-100 \\leq A,\\ B \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the largest number among A + B, A - B, and A \\times B.\n\nSample Input 1\n\n-13 3\n\nSample Output 1\n\n-10\n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is -10.\n\nSample Input 2\n\n1 -33\n\nSample Output 2\n\n34\n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\nSample Input 3\n\n13 3\n\nSample Output 3\n\n39\n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1000, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s855851287", "group_id": "codeNet:p02945", "input_text": "program abc136a\n implicit none\n integer :: a, b\n\n read(*,*) a, b\n write(*,*) max( a+b, a-b, a*b)\n\nend program\n", "language": "Fortran", "metadata": {"date": 1565485421, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02945.html", "problem_id": "p02945", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02945/input.txt", "sample_output_relpath": "derived/input_output/data/p02945/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02945/Fortran/s855851287.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s855851287", "user_id": "u210113718"}, "prompt_components": {"gold_output": "-10\n", "input_to_evaluate": "program abc136a\n implicit none\n integer :: a, b\n\n read(*,*) a, b\n write(*,*) max( a+b, a-b, a*b)\n\nend program\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have two integers: A and B.\n\nPrint the largest number among A + B, A - B, and A \\times B.\n\nConstraints\n\nAll values in input are integers.\n\n-100 \\leq A,\\ B \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the largest number among A + B, A - B, and A \\times B.\n\nSample Input 1\n\n-13 3\n\nSample Output 1\n\n-10\n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is -10.\n\nSample Input 2\n\n1 -33\n\nSample Output 2\n\n34\n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\nSample Input 3\n\n13 3\n\nSample Output 3\n\n39\n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39.", "sample_input": "-13 3\n"}, "reference_outputs": ["-10\n"], "source_document_id": "p02945", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have two integers: A and B.\n\nPrint the largest number among A + B, A - B, and A \\times B.\n\nConstraints\n\nAll values in input are integers.\n\n-100 \\leq A,\\ B \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the largest number among A + B, A - B, and A \\times B.\n\nSample Input 1\n\n-13 3\n\nSample Output 1\n\n-10\n\nThe largest number among A + B = -10, A - B = -16, and A \\times B = -39 is -10.\n\nSample Input 2\n\n1 -33\n\nSample Output 2\n\n34\n\nThe largest number among A + B = -32, A - B = 34, and A \\times B = -33 is 34.\n\nSample Input 3\n\n13 3\n\nSample Output 3\n\n39\n\nThe largest number among A + B = 16, A - B = 10, and A \\times B = 39 is 39.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 118, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s121576611", "group_id": "codeNet:p02946", "input_text": "program kadai\nimplicit none\ninteger :: k,x\ninteger :: i,j,l,n\ninteger,allocatable :: ans(:)\n\nread(*,*) k,x\n\ni=x-k+1\nj=x+k-1\n\nallocate(ans(2*k-1))\nn=1\ndo l=i,j\n ans(n)=l\n n=n+1\nend do\n\nwrite(*,*) ans\nstop\n\nend program kadai\n", "language": "Fortran", "metadata": {"date": 1565485768, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02946.html", "problem_id": "p02946", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02946/input.txt", "sample_output_relpath": "derived/input_output/data/p02946/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02946/Fortran/s121576611.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s121576611", "user_id": "u286754585"}, "prompt_components": {"gold_output": "5 6 7 8 9\n", "input_to_evaluate": "program kadai\nimplicit none\ninteger :: k,x\ninteger :: i,j,l,n\ninteger,allocatable :: ans(:)\n\nread(*,*) k,x\n\ni=x-k+1\nj=x+k-1\n\nallocate(ans(2*k-1))\nn=1\ndo l=i,j\n ans(n)=l\n n=n+1\nend do\n\nwrite(*,*) ans\nstop\n\nend program kadai\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are 2000001 stones placed on a number line. The coordinates of these stones are -1000000, -999999, -999998, \\ldots, 999999, 1000000.\n\nAmong them, some K consecutive stones are painted black, and the others are painted white.\n\nAdditionally, we know that the stone at coordinate X is painted black.\n\nPrint all coordinates that potentially contain a stone painted black, in ascending order.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n0 \\leq X \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nPrint all coordinates that potentially contain a stone painted black, in ascending order, with spaces in between.\n\nSample Input 1\n\n3 7\n\nSample Output 1\n\n5 6 7 8 9\n\nWe know that there are three stones painted black, and the stone at coordinate 7 is painted black. There are three possible cases:\n\nThe three stones painted black are placed at coordinates 5, 6, and 7.\n\nThe three stones painted black are placed at coordinates 6, 7, and 8.\n\nThe three stones painted black are placed at coordinates 7, 8, and 9.\n\nThus, five coordinates potentially contain a stone painted black: 5, 6, 7, 8, and 9.\n\nSample Input 2\n\n4 0\n\nSample Output 2\n\n-3 -2 -1 0 1 2 3\n\nNegative coordinates can also contain a stone painted black.\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n100", "sample_input": "3 7\n"}, "reference_outputs": ["5 6 7 8 9\n"], "source_document_id": "p02946", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are 2000001 stones placed on a number line. The coordinates of these stones are -1000000, -999999, -999998, \\ldots, 999999, 1000000.\n\nAmong them, some K consecutive stones are painted black, and the others are painted white.\n\nAdditionally, we know that the stone at coordinate X is painted black.\n\nPrint all coordinates that potentially contain a stone painted black, in ascending order.\n\nConstraints\n\n1 \\leq K \\leq 100\n\n0 \\leq X \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK X\n\nOutput\n\nPrint all coordinates that potentially contain a stone painted black, in ascending order, with spaces in between.\n\nSample Input 1\n\n3 7\n\nSample Output 1\n\n5 6 7 8 9\n\nWe know that there are three stones painted black, and the stone at coordinate 7 is painted black. There are three possible cases:\n\nThe three stones painted black are placed at coordinates 5, 6, and 7.\n\nThe three stones painted black are placed at coordinates 6, 7, and 8.\n\nThe three stones painted black are placed at coordinates 7, 8, and 9.\n\nThus, five coordinates potentially contain a stone painted black: 5, 6, 7, 8, and 9.\n\nSample Input 2\n\n4 0\n\nSample Output 2\n\n-3 -2 -1 0 1 2 3\n\nNegative coordinates can also contain a stone painted black.\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n100", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 235, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s808490312", "group_id": "codeNet:p02947", "input_text": "program prob4\n implicit none\n integer::i, j, l, n, tmp\n integer(8)::ans\n integer, dimension(10)::c\n integer, allocatable::p(:,:)\n character(len=10)::S\n read(*,*) n\n allocate(p(n,10))\n do i = 1, n\n read(*,*) S\n c = 0\n do j = 1,10\n c(j) = ichar(S(j:j)) - ichar('a') + 1\n end do\n call heapsort(10,c)\n p(i,:) = c\n end do\n call lsort(n,p)\n ans = 0\n tmp = 0\n do i = 2,n\n do j = 1, 10\n if(p(i,j) .ne. p(i-1,j)) then\n tmp = 0\n exit\n else if(j == 10) then\n tmp = tmp + 1\n ans = ans + tmp\n end if\n end do\n end do\n write(*,*) ans\n stop\ncontains\n subroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n double precision :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n \n return\n end subroutine heapsort\n\n subroutine lsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(n,10)\n \n integer ::i,k,j,l,m,mode\n integer::t(10)\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L,:)\n else\n t=array(k,:)\n array(k,:)=array(1,:)\n k=k-1\n if(k.eq.1) then\n array(1,:)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n do m = 1, 10\n if(array(j,m).lt.array(j+1,m))j=j+1\n exit\n end do\n endif\n mode = 0\n do m = 1, 10\n if(t(m).lt.array(j,m)) then\n mode = 1\n exit\n end if\n end do\n if (mode==1)then\n array(i,:)=array(j,:)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i,:)=t\n enddo\n \n return\n end subroutine lsort\nend program", "language": "Fortran", "metadata": {"date": 1596322137, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Fortran/s808490312.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s808490312", "user_id": "u841856382"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program prob4\n implicit none\n integer::i, j, l, n, tmp\n integer(8)::ans\n integer, dimension(10)::c\n integer, allocatable::p(:,:)\n character(len=10)::S\n read(*,*) n\n allocate(p(n,10))\n do i = 1, n\n read(*,*) S\n c = 0\n do j = 1,10\n c(j) = ichar(S(j:j)) - ichar('a') + 1\n end do\n call heapsort(10,c)\n p(i,:) = c\n end do\n call lsort(n,p)\n ans = 0\n tmp = 0\n do i = 2,n\n do j = 1, 10\n if(p(i,j) .ne. p(i-1,j)) then\n tmp = 0\n exit\n else if(j == 10) then\n tmp = tmp + 1\n ans = ans + tmp\n end if\n end do\n end do\n write(*,*) ans\n stop\ncontains\n subroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n double precision :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n \n return\n end subroutine heapsort\n\n subroutine lsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(n,10)\n \n integer ::i,k,j,l,m,mode\n integer::t(10)\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L,:)\n else\n t=array(k,:)\n array(k,:)=array(1,:)\n k=k-1\n if(k.eq.1) then\n array(1,:)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n do m = 1, 10\n if(array(j,m).lt.array(j+1,m))j=j+1\n exit\n end do\n endif\n mode = 0\n do m = 1, 10\n if(t(m).lt.array(j,m)) then\n mode = 1\n exit\n end if\n end do\n if (mode==1)then\n array(i,:)=array(j,:)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i,:)=t\n enddo\n \n return\n end subroutine lsort\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3339, "cpu_time_ms": 83, "memory_kb": 6608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s965089700", "group_id": "codeNet:p02947", "input_text": "program main\ninteger,allocatable :: a(:,:)\ninteger :: tmp(10)\ncharacter,allocatable :: s(:)\ninteger :: n,i,j,ans = 0\n\nread *,n\nallocate(a(n,10),s(n))\nread *,s\n\ndo i = 1,n\ndo j = 1,10\na(i,j) = ichar(s(i)(j:j))\nend do\nend do\n\ndo i = 1,n\ncall quicksort(a(i,:),1,10)\nend do\n\ndo i = 1,n-1\ndo j = i+1, n\ntmp = abs(a(i,:) - a(j,:))\nif (maxval(tmp) == 0) ans = ans +1\nend do\nend do\n\nprint *,ans\n\ncontains\nrecursive subroutine quicksort(a, first, last)\n implicit none\n integer :: a(*)\n integer first, last\n integer i, j\n real*8 x, t\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i); a(i) = a(j); a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort(a, first, i - 1)\n if (j + 1 < last) call quicksort(a, j + 1, last)\nend subroutine quicksort\nend program", "language": "Fortran", "metadata": {"date": 1567384181, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Fortran/s965089700.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s965089700", "user_id": "u850779832"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\ninteger,allocatable :: a(:,:)\ninteger :: tmp(10)\ncharacter,allocatable :: s(:)\ninteger :: n,i,j,ans = 0\n\nread *,n\nallocate(a(n,10),s(n))\nread *,s\n\ndo i = 1,n\ndo j = 1,10\na(i,j) = ichar(s(i)(j:j))\nend do\nend do\n\ndo i = 1,n\ncall quicksort(a(i,:),1,10)\nend do\n\ndo i = 1,n-1\ndo j = i+1, n\ntmp = abs(a(i,:) - a(j,:))\nif (maxval(tmp) == 0) ans = ans +1\nend do\nend do\n\nprint *,ans\n\ncontains\nrecursive subroutine quicksort(a, first, last)\n implicit none\n integer :: a(*)\n integer first, last\n integer i, j\n real*8 x, t\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i); a(i) = a(j); a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort(a, first, i - 1)\n if (j + 1 < last) call quicksort(a, j + 1, last)\nend subroutine quicksort\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 924, "cpu_time_ms": 2103, "memory_kb": 4864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s467109591", "group_id": "codeNet:p02947", "input_text": "program main\ninteger,allocatable :: a(:,:)\ninteger :: tmp(10)\ncharacter,allocatable :: s(:)\ninteger :: n,i,j,ans = 0\n\nread *,n\nallocate(a(n,10),s(n))\nread *,s\n\ndo i = 1,n\ndo j = 1,10\na(i,j) = ichar(s(i)(j:j))\nend do\nend do\n\ndo i = 1,n\ncall quicksort(a(i,:),1,10)\nend do\n\ndo i = 1,n-1\ndo j = i+1, n\ntmp = abs(a(i,:) - a(j,:))\nprint *,tmp\nif (maxval(tmp) == 0) ans = ans +1\nend do\nend do\n\nprint *,ans\n\ncontains\nrecursive subroutine quicksort(a, first, last)\n implicit none\n integer :: a(*)\n integer first, last\n integer i, j\n real*8 x, t\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i); a(i) = a(j); a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort(a, first, i - 1)\n if (j + 1 < last) call quicksort(a, j + 1, last)\nend subroutine quicksort\nend program", "language": "Fortran", "metadata": {"date": 1567306790, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Fortran/s467109591.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s467109591", "user_id": "u850779832"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\ninteger,allocatable :: a(:,:)\ninteger :: tmp(10)\ncharacter,allocatable :: s(:)\ninteger :: n,i,j,ans = 0\n\nread *,n\nallocate(a(n,10),s(n))\nread *,s\n\ndo i = 1,n\ndo j = 1,10\na(i,j) = ichar(s(i)(j:j))\nend do\nend do\n\ndo i = 1,n\ncall quicksort(a(i,:),1,10)\nend do\n\ndo i = 1,n-1\ndo j = i+1, n\ntmp = abs(a(i,:) - a(j,:))\nprint *,tmp\nif (maxval(tmp) == 0) ans = ans +1\nend do\nend do\n\nprint *,ans\n\ncontains\nrecursive subroutine quicksort(a, first, last)\n implicit none\n integer :: a(*)\n integer first, last\n integer i, j\n real*8 x, t\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i); a(i) = a(j); a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort(a, first, i - 1)\n if (j + 1 < last) call quicksort(a, j + 1, last)\nend subroutine quicksort\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 936, "cpu_time_ms": 1229, "memory_kb": 136404}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s926239857", "group_id": "codeNet:p02947", "input_text": "program main\ninteger,allocatable :: a(:,:)\ninteger :: tmp(10)\ncharacter,allocatable :: s(:)\ninteger :: n,i,j,ans = 0\n\nread *,n\nallocate(a(n,10),s(n))\nread *,s\n\ndo i = 1,n\ndo j = 1,10\na(i,j) = ichar(s(i)(j:j))\nend do\nend do\n\ndo i = 1,n\ncall quicksort(a(i,:),1,10)\nend do\n\ndo i = 1,n-1\ndo j = i+1, n\ntmp = a(i,:) - a(j,:) \nif (maxval(tmp) == 0) ans = ans +1\nend do\nend do\n\nprint *,ans\ncontains\nrecursive subroutine quicksort(a, first, last)\n implicit none\n integer :: a(*)\n integer first, last\n integer i, j\n real*8 x, t\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i); a(i) = a(j); a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort(a, first, i - 1)\n if (j + 1 < last) call quicksort(a, j + 1, last)\nend subroutine quicksort\nend program", "language": "Fortran", "metadata": {"date": 1567306458, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Fortran/s926239857.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s926239857", "user_id": "u850779832"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\ninteger,allocatable :: a(:,:)\ninteger :: tmp(10)\ncharacter,allocatable :: s(:)\ninteger :: n,i,j,ans = 0\n\nread *,n\nallocate(a(n,10),s(n))\nread *,s\n\ndo i = 1,n\ndo j = 1,10\na(i,j) = ichar(s(i)(j:j))\nend do\nend do\n\ndo i = 1,n\ncall quicksort(a(i,:),1,10)\nend do\n\ndo i = 1,n-1\ndo j = i+1, n\ntmp = a(i,:) - a(j,:) \nif (maxval(tmp) == 0) ans = ans +1\nend do\nend do\n\nprint *,ans\ncontains\nrecursive subroutine quicksort(a, first, last)\n implicit none\n integer :: a(*)\n integer first, last\n integer i, j\n real*8 x, t\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i); a(i) = a(j); a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort(a, first, i - 1)\n if (j + 1 < last) call quicksort(a, j + 1, last)\nend subroutine quicksort\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 919, "cpu_time_ms": 2104, "memory_kb": 4864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s450909260", "group_id": "codeNet:p02947", "input_text": "module ABC137\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_C\n private :: sort_string\n private :: isEqual\n\n ! constants for this \n integer(INT8), parameter, private :: len_string = 10_INT32\n\n ! s for this \n type data_task\n character(len=len_string, kind=1), public :: string\n integer(INT64), public :: times\n end type data_task\n\n ! contained s and s are below\n contains\n\n subroutine sort_string (str_target)\n\n ! arguments for this \n character(len=len_string, kind=1), intent(inout) :: str_target\n\n ! variables for this \n character(len=1, kind=1) :: buffer\n\n ! support variables for this \n integer(INT8) :: itr1, itr2\n\n do itr1 = 1_INT8, len_string - 1_INT8, 1_INT8\n do itr2 = itr1 + 1_INT8, len_string, 1_INT8\n if ( str_target(itr1:itr1) .gt. str_target(itr2:itr2) ) then\n buffer = str_target(itr1:itr1)\n str_target(itr1:itr1) = str_target(itr2:itr2)\n str_target(itr2:itr2) = buffer\n end if\n end do\n end do\n\n ! STEP.END\n return\n\n end subroutine sort_string\n\n pure function isEqual (str1, str2) result(stat)\n\n ! arguments for this \n character(len=*, kind=1), intent(in) :: str1\n character(len=*, kind=1), intent(in) :: str2\n\n ! return value of this \n logical :: stat\n \n stat = lge(str1, str2) .and. lle(str1, str2)\n return\n\n end function isEqual\n\n subroutine task_C\n\n ! variables for this \n integer(INT32) :: num_string\n integer(INT64) :: num_anagram\n\n ! arrays for this \n type(data_task), allocatable :: given_data(:)\n\n ! support variables for this \n integer(INT32) :: itr, itr_origin, itr_target\n\n ! STEP.01\n ! read out the given data\n\n ! STEP.01.01\n ! read out the number of given strings\n read(unit=INPUT_UNIT, fmt=*) num_string\n\n ! STEP.01.02\n ! allocate the array to store the given strings\n allocate( given_data(1:num_string) )\n\n ! STEP.01.03\n ! read out the given strings\n do itr = 1_INT32, num_string, 1_INT32\n read(unit=INPUT_UNIT, fmt='(A)') given_data(itr)%string\n end do\n\n ! STEP.02\n ! calcualte the answer of this task\n\n ! STEP.02.01\n ! initialize the variables\n num_anagram = 0_INT64\n given_data(:)%times = 0_INT64\n\n ! STEP.02.02\n ! count up the number of anagram\n do itr_origin = 1_INT32, num_string, 1_INT32\n \n ! sort the each given string\n call sort_string( given_data(itr_origin)%string )\n\n do itr_target = 1_INT32, itr_origin - 1_INT32, 1_INT32\n if ( isEqual( given_data(itr_origin)%string, given_data(itr_target)%string ) ) then\n given_data(itr_target)%times = 1_INT64 + given_data(itr_target)%times\n num_anagram = num_anagram + given_data(itr_target)%times\n exit\n end if\n end do\n\n print '(10(1X,I0))', num_anagram, given_data(:)%times\n\n end do\n\n ! STEP.03\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') num_anagram\n\n ! STEP.04\n ! deallocate the array to store the given strings\n deallocate( given_data )\n\n ! STEP.END\n return\n\n end subroutine task_C\n\nend module ABC137\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC137\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_C\n\nend program main", "language": "Fortran", "metadata": {"date": 1565526723, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Fortran/s450909260.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s450909260", "user_id": "u484703930"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module ABC137\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_C\n private :: sort_string\n private :: isEqual\n\n ! constants for this \n integer(INT8), parameter, private :: len_string = 10_INT32\n\n ! s for this \n type data_task\n character(len=len_string, kind=1), public :: string\n integer(INT64), public :: times\n end type data_task\n\n ! contained s and s are below\n contains\n\n subroutine sort_string (str_target)\n\n ! arguments for this \n character(len=len_string, kind=1), intent(inout) :: str_target\n\n ! variables for this \n character(len=1, kind=1) :: buffer\n\n ! support variables for this \n integer(INT8) :: itr1, itr2\n\n do itr1 = 1_INT8, len_string - 1_INT8, 1_INT8\n do itr2 = itr1 + 1_INT8, len_string, 1_INT8\n if ( str_target(itr1:itr1) .gt. str_target(itr2:itr2) ) then\n buffer = str_target(itr1:itr1)\n str_target(itr1:itr1) = str_target(itr2:itr2)\n str_target(itr2:itr2) = buffer\n end if\n end do\n end do\n\n ! STEP.END\n return\n\n end subroutine sort_string\n\n pure function isEqual (str1, str2) result(stat)\n\n ! arguments for this \n character(len=*, kind=1), intent(in) :: str1\n character(len=*, kind=1), intent(in) :: str2\n\n ! return value of this \n logical :: stat\n \n stat = lge(str1, str2) .and. lle(str1, str2)\n return\n\n end function isEqual\n\n subroutine task_C\n\n ! variables for this \n integer(INT32) :: num_string\n integer(INT64) :: num_anagram\n\n ! arrays for this \n type(data_task), allocatable :: given_data(:)\n\n ! support variables for this \n integer(INT32) :: itr, itr_origin, itr_target\n\n ! STEP.01\n ! read out the given data\n\n ! STEP.01.01\n ! read out the number of given strings\n read(unit=INPUT_UNIT, fmt=*) num_string\n\n ! STEP.01.02\n ! allocate the array to store the given strings\n allocate( given_data(1:num_string) )\n\n ! STEP.01.03\n ! read out the given strings\n do itr = 1_INT32, num_string, 1_INT32\n read(unit=INPUT_UNIT, fmt='(A)') given_data(itr)%string\n end do\n\n ! STEP.02\n ! calcualte the answer of this task\n\n ! STEP.02.01\n ! initialize the variables\n num_anagram = 0_INT64\n given_data(:)%times = 0_INT64\n\n ! STEP.02.02\n ! count up the number of anagram\n do itr_origin = 1_INT32, num_string, 1_INT32\n \n ! sort the each given string\n call sort_string( given_data(itr_origin)%string )\n\n do itr_target = 1_INT32, itr_origin - 1_INT32, 1_INT32\n if ( isEqual( given_data(itr_origin)%string, given_data(itr_target)%string ) ) then\n given_data(itr_target)%times = 1_INT64 + given_data(itr_target)%times\n num_anagram = num_anagram + given_data(itr_target)%times\n exit\n end if\n end do\n\n print '(10(1X,I0))', num_anagram, given_data(:)%times\n\n end do\n\n ! STEP.03\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') num_anagram\n\n ! STEP.04\n ! deallocate the array to store the given strings\n deallocate( given_data )\n\n ! STEP.END\n return\n\n end subroutine task_C\n\nend module ABC137\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC137\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_C\n\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3682, "cpu_time_ms": 2103, "memory_kb": 34944}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s854455606", "group_id": "codeNet:p02947", "input_text": "implicit none\ninteger :: n,i,j,k,ans\ncharacter(10) :: s\ninteger(16),allocatable :: p(:)\nlogical :: flg\n\nread *,n\nallocate(p(n))\n\np(:) = 0\ndo i = 1,n\n read *,s\n flg = .true.\n do j = 2, 10\n if (s(j:j) /= s(1:1)) then\n flg = .false.\n exit\n endif\n enddo\n if (flg) then\n p(i) = 1\n endif\n do j = 1, 10\n if (s(j:j) == 'a') then \n k = 1\n else if (s(j:j) == 'b') then \n k = 2\n else if (s(j:j) == 'c') then \n k = 3\n else if (s(j:j) == 'd') then \n k = 4\n else if (s(j:j) == 'e') then \n k = 5\n else if (s(j:j) == 'f') then \n k = 6\n else if (s(j:j) == 'g') then \n k = 7\n else if (s(j:j) == 'h') then \n k = 8\n else if (s(j:j) == 'i') then \n k = 9\n else if (s(j:j) == 'j') then \n k = 10\n else if (s(j:j) == 'k') then \n k = 11\n else if (s(j:j) == 'l') then \n k = 12\n else if (s(j:j) == 'm') then \n k = 13\n else if (s(j:j) == 'n') then \n k = 14\n else if (s(j:j) == 'o') then \n k = 15\n else if (s(j:j) == 'p') then \n k = 16\n else if (s(j:j) == 'q') then \n k = 17\n else if (s(j:j) == 'r') then \n k = 18\n else if (s(j:j) == 's') then \n k = 19\n else if (s(j:j) == 't') then \n k = 20\n else if (s(j:j) == 'u') then \n k = 21\n else if (s(j:j) == 'v') then \n k = 22\n else if (s(j:j) == 'w') then \n k = 23\n else if (s(j:j) == 'x') then \n k = 24\n else if (s(j:j) == 'y') then \n k = 25\n else if (s(j:j) == 'z') then \n k = 26\n endif\n p(i) = p(i) + 10**k\n enddo\nenddo\n\ncall cs11(n,p)\n\nans = 0\ndo i = 1, n-1\n do j = i+1, n\n if (p(i) == p(j)) then\n ans = ans + 1\n else\n exit\n endif\n enddo\nenddo\n\nprint '(i0)',ans\n\ncontains\n\nsubroutine cs11(Ncomb,a)\n integer, intent(in) :: Ncomb\n integer(16), intent(inout) :: a(Ncomb)\n integer(16) :: icomb, jcomb,rswp\n logical :: flg_swp\n\n icomb = Ncomb\n flg_swp = .false.\n do while (icomb > 1 .or. flg_swp)\n icomb = (icomb * 10) / 13\n if (icomb < 1) then\n icomb = 1\n else if (icomb == 9 .or. icomb == 10) then \n icomb = 11\n endif\n flg_swp = .false.\n do jcomb = 1, Ncomb-icomb\n if (a(jcomb) > a(jcomb+icomb)) then\n rswp = a(jcomb) \n a(jcomb) = a(jcomb+icomb)\n a(jcomb+icomb) = rswp\n flg_swp = .true.\n endif\n enddo\n enddo\nendsubroutine cs11\nend", "language": "Fortran", "metadata": {"date": 1565489702, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Fortran/s854455606.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s854455606", "user_id": "u193540507"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "implicit none\ninteger :: n,i,j,k,ans\ncharacter(10) :: s\ninteger(16),allocatable :: p(:)\nlogical :: flg\n\nread *,n\nallocate(p(n))\n\np(:) = 0\ndo i = 1,n\n read *,s\n flg = .true.\n do j = 2, 10\n if (s(j:j) /= s(1:1)) then\n flg = .false.\n exit\n endif\n enddo\n if (flg) then\n p(i) = 1\n endif\n do j = 1, 10\n if (s(j:j) == 'a') then \n k = 1\n else if (s(j:j) == 'b') then \n k = 2\n else if (s(j:j) == 'c') then \n k = 3\n else if (s(j:j) == 'd') then \n k = 4\n else if (s(j:j) == 'e') then \n k = 5\n else if (s(j:j) == 'f') then \n k = 6\n else if (s(j:j) == 'g') then \n k = 7\n else if (s(j:j) == 'h') then \n k = 8\n else if (s(j:j) == 'i') then \n k = 9\n else if (s(j:j) == 'j') then \n k = 10\n else if (s(j:j) == 'k') then \n k = 11\n else if (s(j:j) == 'l') then \n k = 12\n else if (s(j:j) == 'm') then \n k = 13\n else if (s(j:j) == 'n') then \n k = 14\n else if (s(j:j) == 'o') then \n k = 15\n else if (s(j:j) == 'p') then \n k = 16\n else if (s(j:j) == 'q') then \n k = 17\n else if (s(j:j) == 'r') then \n k = 18\n else if (s(j:j) == 's') then \n k = 19\n else if (s(j:j) == 't') then \n k = 20\n else if (s(j:j) == 'u') then \n k = 21\n else if (s(j:j) == 'v') then \n k = 22\n else if (s(j:j) == 'w') then \n k = 23\n else if (s(j:j) == 'x') then \n k = 24\n else if (s(j:j) == 'y') then \n k = 25\n else if (s(j:j) == 'z') then \n k = 26\n endif\n p(i) = p(i) + 10**k\n enddo\nenddo\n\ncall cs11(n,p)\n\nans = 0\ndo i = 1, n-1\n do j = i+1, n\n if (p(i) == p(j)) then\n ans = ans + 1\n else\n exit\n endif\n enddo\nenddo\n\nprint '(i0)',ans\n\ncontains\n\nsubroutine cs11(Ncomb,a)\n integer, intent(in) :: Ncomb\n integer(16), intent(inout) :: a(Ncomb)\n integer(16) :: icomb, jcomb,rswp\n logical :: flg_swp\n\n icomb = Ncomb\n flg_swp = .false.\n do while (icomb > 1 .or. flg_swp)\n icomb = (icomb * 10) / 13\n if (icomb < 1) then\n icomb = 1\n else if (icomb == 9 .or. icomb == 10) then \n icomb = 11\n endif\n flg_swp = .false.\n do jcomb = 1, Ncomb-icomb\n if (a(jcomb) > a(jcomb+icomb)) then\n rswp = a(jcomb) \n a(jcomb) = a(jcomb+icomb)\n a(jcomb+icomb) = rswp\n flg_swp = .true.\n endif\n enddo\n enddo\nendsubroutine cs11\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2602, "cpu_time_ms": 2103, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s057018280", "group_id": "codeNet:p02947", "input_text": "program green_bin\n implicit none\n integer :: n, c(100000,26) = 0, i, j, k\n logical :: used(100000) = .false.\n character(10) :: s\n integer(8) :: ans = 0_8, m\n read(*,*) n\n do i = 1, n\n read(*,*) s\n do j = 1, 10\n k = ichar(s(j:j))-96\n c(i,k) = c(i,k)+1\n end do\n end do\n do i = 1, n\n if (used(i)) cycle\n m = 0_8\n do j = i, n\n if (used(j)) cycle\n if (all(c(i,:) == c(j,:))) then\n used(j) = .true.\n m = m+1_8\n end if\n end do\n ans = ans+m*(m-1_8)/2_8\n end do\n write(*,'(i0)') ans\nend program green_bin", "language": "Fortran", "metadata": {"date": 1565485876, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02947.html", "problem_id": "p02947", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02947/input.txt", "sample_output_relpath": "derived/input_output/data/p02947/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02947/Fortran/s057018280.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s057018280", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program green_bin\n implicit none\n integer :: n, c(100000,26) = 0, i, j, k\n logical :: used(100000) = .false.\n character(10) :: s\n integer(8) :: ans = 0_8, m\n read(*,*) n\n do i = 1, n\n read(*,*) s\n do j = 1, 10\n k = ichar(s(j:j))-96\n c(i,k) = c(i,k)+1\n end do\n end do\n do i = 1, n\n if (used(i)) cycle\n m = 0_8\n do j = i, n\n if (used(j)) cycle\n if (all(c(i,:) == c(j,:))) then\n used(j) = .true.\n m = m+1_8\n end if\n end do\n ans = ans+m*(m-1_8)/2_8\n end do\n write(*,'(i0)') ans\nend program green_bin", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "sample_input": "3\nacornistnt\npeanutbomb\nconstraint\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02947", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will call a string obtained by arranging the characters contained in a string a in some order, an anagram of a.\n\nFor example, greenbin is an anagram of beginner. As seen here, when the same character occurs multiple times, that character must be used that number of times.\n\nGiven are N strings s_1, s_2, \\ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\ns_i is a string of length 10.\n\nEach character in s_i is a lowercase English letter.\n\ns_1, s_2, \\ldots, s_N are all distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\n\nOutput\n\nPrint the number of pairs of integers i, j (1 \\leq i < j \\leq N) such that s_i is an anagram of s_j.\n\nSample Input 1\n\n3\nacornistnt\npeanutbomb\nconstraint\n\nSample Output 1\n\n1\n\ns_1 = acornistnt is an anagram of s_3 = constraint. There are no other pairs i, j such that s_i is an anagram of s_j, so the answer is 1.\n\nSample Input 2\n\n2\noneplustwo\nninemodsix\n\nSample Output 2\n\n0\n\nIf there is no pair i, j such that s_i is an anagram of s_j, print 0.\n\nSample Input 3\n\n5\nabaaaaaaaa\noneplustwo\naaaaaaaaba\ntwoplusone\naaaabaaaaa\n\nSample Output 3\n\n4\n\nNote that the answer may not fit into a 32-bit integer type, though we cannot put such a case here.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 569, "cpu_time_ms": 2103, "memory_kb": 10752}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s448697097", "group_id": "codeNet:p02948", "input_text": "module mod_priority_queue\n private swap\n type pq\n integer(4):: i=0\n integer(4),pointer:: n(:) => null()\n end type\n\ncontains\nsubroutine append(que,x)\n type(pq):: que\n integer(4):: x\n\n que%i = que%i+1\n if ( .not. associated(que%n)) allocate(que%n(1))\n if (que%i >= size(que%n(:))) then\n block; integer(4), pointer:: tmp(:)\n allocate(tmp(que%i))\n tmp(:) = que%n(:)\n deallocate(que%n)\n allocate(que%n(que%i*2))\n que%n(:que%i) = tmp(:)\n deallocate(tmp)\n end block\n end if\n que%n(que%i) = x\n\n block\n integer(4):: self, p\n self = que%i\n\n do while(self >= 2)\n p = self/2\n if (que%n(p) > que%n(self)) exit\n call swap(que%n(p), que%n(self))\n self = p\n end do\n end block\n\nend subroutine\n\n\nfunction pop(que) result(ret)\n type(pq):: que\n integer(4):: ret\n integer(4),pointer:: tmp(:)\n ret = que%n(1)\n que%n(1) = que%n(que%i)\n que%i=que%i-1\n\n block\n integer:: self, c1, c2\n self = 1\n c1=self*2\n c2=self*2+1\n\n do while(c1 <= que%i)\n\n if (c2 <= que%i .and. que%n(c2) > que%n(c1)) c1 = c2\n if (que%n(c1) < que%n(self)) exit\n call swap(que%n(c1), que%n(self))\n self = c1\n c1 = self*2\n c2 = self*2+1\n end do\n end block\nend function\n\nsubroutine swap(a,b)\n integer(4):: a, b, tmp\n tmp = a\n a = b\n b = tmp\nend subroutine\nend module\n\n\nprogram summer_vacation\n use mod_priority_queue\n implicit none\n integer(4):: n,m\n integer(4):: i,j,k\n integer(4),allocatable:: a(:), b(:)\n integer(8):: ans=0\n type(pq):: que\n\n read*,n,m\n allocate(a(n),b(n))\n do i=1,n\n read*,a(i),b(i)\n end do\n call merge_sort(a(:),b(:),1,n)\n j=1\n\n\n do i=1, m\n do while (a(j) == i)\n call append(que,b(j))\n j=j+1\n end do\n if (que%i > 0) ans = ans + pop(que)\n end do\n\n print*, ans\n \n\ncontains\nrecursive subroutine merge_sort(a,b,fst,lst)\n integer(4):: a(:),b(:),fst,lst,mdl\n\n if (lst-fst < 2) then\n if(a(lst) < a(fst)) then\n call swap(a(:), fst,lst)\n call swap(b(:), fst,lst)\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n call merge_sort(a(:),b(:),fst,mdl)\n call merge_sort(a(:),b(:),mdl+1,lst)\n call merge_(a(:),b(:),fst,mdl,lst)\nend subroutine\n\nsubroutine merge_(a,b,fst,mdl,lst)\n integer(4):: a(:),b(:),fst,mdl,lst\n integer(4),pointer:: ta(:),tb(:)\n integer(4):: it,il,ir\n\n allocate(ta(lst-fst+1), tb(lst-fst+1))\n it=1; il=fst; ir=mdl+1\n\n do while(il <= mdl .and. ir <= lst)\n if (a(il) <= a(ir)) then\n ta(it) = a(il)\n tb(it) = b(il)\n il=il+1\n else\n ta(it) = a(ir)\n tb(it) = b(ir)\n ir=ir+1\n end if\n it=it+1 \n end do\n\n if (ir > lst) then\n ta(it:) = a(il:mdl)\n tb(it:) = b(il:mdl)\n else\n ta(it:) = a(ir:lst)\n tb(it:) = b(ir:lst)\n end if\n a(fst:lst) = ta(:)\n b(fst:lst) = tb(:)\n deallocate(ta,tb)\nend subroutine\n\nsubroutine swap(ar,x,y)\n integer(4):: ar(:), x, y, tmp\n tmp = ar(x)\n ar(x) = ar(y)\n ar(y) = tmp\nend subroutine\n\nend program summer_vacation", "language": "Fortran", "metadata": {"date": 1581568419, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02948.html", "problem_id": "p02948", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02948/input.txt", "sample_output_relpath": "derived/input_output/data/p02948/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02948/Fortran/s448697097.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s448697097", "user_id": "u234636620"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "module mod_priority_queue\n private swap\n type pq\n integer(4):: i=0\n integer(4),pointer:: n(:) => null()\n end type\n\ncontains\nsubroutine append(que,x)\n type(pq):: que\n integer(4):: x\n\n que%i = que%i+1\n if ( .not. associated(que%n)) allocate(que%n(1))\n if (que%i >= size(que%n(:))) then\n block; integer(4), pointer:: tmp(:)\n allocate(tmp(que%i))\n tmp(:) = que%n(:)\n deallocate(que%n)\n allocate(que%n(que%i*2))\n que%n(:que%i) = tmp(:)\n deallocate(tmp)\n end block\n end if\n que%n(que%i) = x\n\n block\n integer(4):: self, p\n self = que%i\n\n do while(self >= 2)\n p = self/2\n if (que%n(p) > que%n(self)) exit\n call swap(que%n(p), que%n(self))\n self = p\n end do\n end block\n\nend subroutine\n\n\nfunction pop(que) result(ret)\n type(pq):: que\n integer(4):: ret\n integer(4),pointer:: tmp(:)\n ret = que%n(1)\n que%n(1) = que%n(que%i)\n que%i=que%i-1\n\n block\n integer:: self, c1, c2\n self = 1\n c1=self*2\n c2=self*2+1\n\n do while(c1 <= que%i)\n\n if (c2 <= que%i .and. que%n(c2) > que%n(c1)) c1 = c2\n if (que%n(c1) < que%n(self)) exit\n call swap(que%n(c1), que%n(self))\n self = c1\n c1 = self*2\n c2 = self*2+1\n end do\n end block\nend function\n\nsubroutine swap(a,b)\n integer(4):: a, b, tmp\n tmp = a\n a = b\n b = tmp\nend subroutine\nend module\n\n\nprogram summer_vacation\n use mod_priority_queue\n implicit none\n integer(4):: n,m\n integer(4):: i,j,k\n integer(4),allocatable:: a(:), b(:)\n integer(8):: ans=0\n type(pq):: que\n\n read*,n,m\n allocate(a(n),b(n))\n do i=1,n\n read*,a(i),b(i)\n end do\n call merge_sort(a(:),b(:),1,n)\n j=1\n\n\n do i=1, m\n do while (a(j) == i)\n call append(que,b(j))\n j=j+1\n end do\n if (que%i > 0) ans = ans + pop(que)\n end do\n\n print*, ans\n \n\ncontains\nrecursive subroutine merge_sort(a,b,fst,lst)\n integer(4):: a(:),b(:),fst,lst,mdl\n\n if (lst-fst < 2) then\n if(a(lst) < a(fst)) then\n call swap(a(:), fst,lst)\n call swap(b(:), fst,lst)\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n call merge_sort(a(:),b(:),fst,mdl)\n call merge_sort(a(:),b(:),mdl+1,lst)\n call merge_(a(:),b(:),fst,mdl,lst)\nend subroutine\n\nsubroutine merge_(a,b,fst,mdl,lst)\n integer(4):: a(:),b(:),fst,mdl,lst\n integer(4),pointer:: ta(:),tb(:)\n integer(4):: it,il,ir\n\n allocate(ta(lst-fst+1), tb(lst-fst+1))\n it=1; il=fst; ir=mdl+1\n\n do while(il <= mdl .and. ir <= lst)\n if (a(il) <= a(ir)) then\n ta(it) = a(il)\n tb(it) = b(il)\n il=il+1\n else\n ta(it) = a(ir)\n tb(it) = b(ir)\n ir=ir+1\n end if\n it=it+1 \n end do\n\n if (ir > lst) then\n ta(it:) = a(il:mdl)\n tb(it:) = b(il:mdl)\n else\n ta(it:) = a(ir:lst)\n tb(it:) = b(ir:lst)\n end if\n a(fst:lst) = ta(:)\n b(fst:lst) = tb(:)\n deallocate(ta,tb)\nend subroutine\n\nsubroutine swap(ar,x,y)\n integer(4):: ar(:), x, y, tmp\n tmp = ar(x)\n ar(x) = ar(y)\n ar(y) = tmp\nend subroutine\n\nend program summer_vacation", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "sample_input": "3 4\n4 3\n4 1\n2 2\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02948", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3388, "cpu_time_ms": 85, "memory_kb": 2020}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s946532541", "group_id": "codeNet:p02948", "input_text": "module mod_priority_queue\n implicit none\n type t_priority_queue\n private\n integer :: num = 0 !中に入ってる物の数\n integer, pointer :: heap(:) => null()!pqの容量\n contains\n procedure :: offer => offer\n procedure :: clear => clear\n procedure :: poll => poll\n procedure :: peek => peek\n procedure :: size => size_of\n end type t_priority_queue\n \ncontains\n\n subroutine offer(pq,item)\n class(t_priority_queue), intent(inout) :: pq\n integer, intent(in) :: item\n integer :: n, i, t\n integer, allocatable :: tmp(:)\n if (.not.associated(pq%heap)) allocate(pq%heap(1))\n \n !いっぱいいっぱいのときには拡張している\n if (pq%num == size(pq%heap)) then\n allocate(tmp(pq%num))\n tmp = pq%heap\n deallocate(pq%heap)\n allocate(pq%heap(2*pq%num))\n pq%heap(1:pq%num) = tmp\n deallocate(tmp)\n end if\n \n pq%num = pq%num+1\n pq%heap(pq%num) = item\n n = pq%num\n do while (n > 1)\n i = n/2\n if (pq%heap(n) > pq%heap(i)) then\n t = pq%heap(n)\n pq%heap(n) = pq%heap(i)\n pq%heap(i) = t\n end if\n n = i\n end do\n return\n end subroutine offer\n \n subroutine clear(pq)\n class(t_priority_queue), intent(inout) :: pq\n if (associated(pq%heap)) deallocate(pq%heap)\n pq%num = 0\n return\n end subroutine clear\n\n function poll(pq) result(item)\n class(t_priority_queue), intent(inout) :: pq\n integer :: item, n, i, j, tmp\n n = pq%num\n item = pq%heap(1)\n pq%heap(1) = pq%heap(n)\n pq%num = pq%num-1\n i = 1\n do while (2*i < n)\n j = 2*i\n if (j+1 < n .and. pq%heap(j+1) > pq%heap(j)) j = j+1\n if (pq%heap(j) > pq%heap(i)) then\n tmp = pq%heap(j)\n pq%heap(j) = pq%heap(i)\n pq%heap(i) = tmp\n end if\n i = j\n end do\n end function poll\n \n function peek(pq) result(item)\n class(t_priority_queue), intent(inout) :: pq\n integer :: item\n item = pq%heap(1)\n end function peek\n \n integer function size_of(pq)\n class(t_priority_queue), intent(in) :: pq\n size_of = pq%num\n end function size_of\nend module mod_priority_queue\n\nuse mod_priority_queue\ninteger N,M,K\ninteger,allocatable,dimension(:)::A,B\ntype(t_priority_queue) :: pq\ninteger(16) ans\nread*,N,M\nallocate(A(N),B(N))\ndo i=1,N\n read*,A(i),B(i)\nend do\n\ncall HeapsortPair(N,A,B)\n\nans=0;k=1\ndo i=1,M\n do while(K<=N .and. A(K)<=i)\n call offer(pq,B(K))\n K=K+1\n end do\n ans=ans+poll(pq)\nend do\n\nprint\"(i0)\",ans\n\ncontains\n\nsubroutine HeapsortPair(n,array,array2)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n),array2(1:n)\n integer::i,k,j,l\n integer:: t,t2\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n t2=array2(L)\n else\n t=array(k)\n t2=array2(k)\n array(k)=array(1)\n array2(k)=array2(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n array2(1)=t2\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n array2(i)=array2(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n array2(i)=t2\n enddo\n return\nend subroutine HeapsortPair\n\nend", "language": "Fortran", "metadata": {"date": 1567310423, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02948.html", "problem_id": "p02948", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02948/input.txt", "sample_output_relpath": "derived/input_output/data/p02948/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02948/Fortran/s946532541.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s946532541", "user_id": "u598073939"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "module mod_priority_queue\n implicit none\n type t_priority_queue\n private\n integer :: num = 0 !中に入ってる物の数\n integer, pointer :: heap(:) => null()!pqの容量\n contains\n procedure :: offer => offer\n procedure :: clear => clear\n procedure :: poll => poll\n procedure :: peek => peek\n procedure :: size => size_of\n end type t_priority_queue\n \ncontains\n\n subroutine offer(pq,item)\n class(t_priority_queue), intent(inout) :: pq\n integer, intent(in) :: item\n integer :: n, i, t\n integer, allocatable :: tmp(:)\n if (.not.associated(pq%heap)) allocate(pq%heap(1))\n \n !いっぱいいっぱいのときには拡張している\n if (pq%num == size(pq%heap)) then\n allocate(tmp(pq%num))\n tmp = pq%heap\n deallocate(pq%heap)\n allocate(pq%heap(2*pq%num))\n pq%heap(1:pq%num) = tmp\n deallocate(tmp)\n end if\n \n pq%num = pq%num+1\n pq%heap(pq%num) = item\n n = pq%num\n do while (n > 1)\n i = n/2\n if (pq%heap(n) > pq%heap(i)) then\n t = pq%heap(n)\n pq%heap(n) = pq%heap(i)\n pq%heap(i) = t\n end if\n n = i\n end do\n return\n end subroutine offer\n \n subroutine clear(pq)\n class(t_priority_queue), intent(inout) :: pq\n if (associated(pq%heap)) deallocate(pq%heap)\n pq%num = 0\n return\n end subroutine clear\n\n function poll(pq) result(item)\n class(t_priority_queue), intent(inout) :: pq\n integer :: item, n, i, j, tmp\n n = pq%num\n item = pq%heap(1)\n pq%heap(1) = pq%heap(n)\n pq%num = pq%num-1\n i = 1\n do while (2*i < n)\n j = 2*i\n if (j+1 < n .and. pq%heap(j+1) > pq%heap(j)) j = j+1\n if (pq%heap(j) > pq%heap(i)) then\n tmp = pq%heap(j)\n pq%heap(j) = pq%heap(i)\n pq%heap(i) = tmp\n end if\n i = j\n end do\n end function poll\n \n function peek(pq) result(item)\n class(t_priority_queue), intent(inout) :: pq\n integer :: item\n item = pq%heap(1)\n end function peek\n \n integer function size_of(pq)\n class(t_priority_queue), intent(in) :: pq\n size_of = pq%num\n end function size_of\nend module mod_priority_queue\n\nuse mod_priority_queue\ninteger N,M,K\ninteger,allocatable,dimension(:)::A,B\ntype(t_priority_queue) :: pq\ninteger(16) ans\nread*,N,M\nallocate(A(N),B(N))\ndo i=1,N\n read*,A(i),B(i)\nend do\n\ncall HeapsortPair(N,A,B)\n\nans=0;k=1\ndo i=1,M\n do while(K<=N .and. A(K)<=i)\n call offer(pq,B(K))\n K=K+1\n end do\n ans=ans+poll(pq)\nend do\n\nprint\"(i0)\",ans\n\ncontains\n\nsubroutine HeapsortPair(n,array,array2)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n),array2(1:n)\n integer::i,k,j,l\n integer:: t,t2\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n t2=array2(L)\n else\n t=array(k)\n t2=array2(k)\n array(k)=array(1)\n array2(k)=array2(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n array2(1)=t2\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n array2(i)=array2(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n array2(i)=t2\n enddo\n return\nend subroutine HeapsortPair\n\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "sample_input": "3 4\n4 3\n4 1\n2 2\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02948", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N one-off jobs available. If you take the i-th job and complete it, you will earn the reward of B_i after A_i days from the day you do it.\n\nYou can take and complete at most one of these jobs in a day.\n\nHowever, you cannot retake a job that you have already done.\n\nFind the maximum total reward that you can earn no later than M days from today.\n\nYou can already start working today.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i \\leq 10^5\n\n1 \\leq B_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the maximum total reward that you can earn no later than M days from today.\n\nSample Input 1\n\n3 4\n4 3\n4 1\n2 2\n\nSample Output 1\n\n5\n\nYou can earn the total reward of 5 by taking the jobs as follows:\n\nTake and complete the first job today. You will earn the reward of 3 after four days from today.\n\nTake and complete the third job tomorrow. You will earn the reward of 2 after two days from tomorrow, that is, after three days from today.\n\nSample Input 2\n\n5 3\n1 2\n1 3\n1 4\n2 1\n2 3\n\nSample Output 2\n\n10\n\nSample Input 3\n\n1 1\n2 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3445, "cpu_time_ms": 170, "memory_kb": 1808}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s545181114", "group_id": "codeNet:p02951", "input_text": "program Main\n\tImplicit none\n Integer::A,B,C\n read(*,*) A,B,C\n C=C-(A-B)\n IF(C<0)THEN\n \tC=0\n END IF\n write(*,*) C\nend program Main", "language": "Fortran", "metadata": {"date": 1594595022, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02951.html", "problem_id": "p02951", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02951/input.txt", "sample_output_relpath": "derived/input_output/data/p02951/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02951/Fortran/s545181114.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s545181114", "user_id": "u455586058"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program Main\n\tImplicit none\n Integer::A,B,C\n read(*,*) A,B,C\n C=C-(A-B)\n IF(C<0)THEN\n \tC=0\n END IF\n write(*,*) C\nend program Main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "sample_input": "6 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02951", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 150, "cpu_time_ms": 10, "memory_kb": 2828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s325536863", "group_id": "codeNet:p02951", "input_text": "program main\n implicit none\n\n integer :: a, b ,c\n\n read *, a, b, c\n\n print *, c - ( a - b )\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1565396406, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02951.html", "problem_id": "p02951", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02951/input.txt", "sample_output_relpath": "derived/input_output/data/p02951/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02951/Fortran/s325536863.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s325536863", "user_id": "u731648631"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n\n integer :: a, b ,c\n\n read *, a, b, c\n\n print *, c - ( a - b )\n\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "sample_input": "6 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02951", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 114, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s967615150", "group_id": "codeNet:p02951", "input_text": "module ABC136\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_A\n \n contains\n \n subroutine task_A (volume_Container1_max, volume_Container1_contained, volume_Container2_contained)\n\n ! arguments for this \n integer(INT8), intent(in) :: volume_Container1_max\n integer(INT8), intent(in) :: volume_Container1_contained\n integer(INT8), intent(in) :: volume_Container2_contained\n\n ! variables for this \n integer(INT8) :: volume_Container1_receivable\n integer(INT8) :: volume_remained\n\n volume_Container1_receivable = volume_Container1_max - volume_Container1_contained\n\n if (volume_Container1_receivable .ge. volume_Container2_contained) then\n volume_remained = 0_INT8\n else\n volume_remained = volume_Container2_contained - volume_Container1_receivable\n end if\n\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') volume_remained\n \n ! STEP.END\n return\n\n end subroutine task_A\n\nend module ABC136\n\nprogram main\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n use, non_intrinsic :: ABC136\n\n ! variables for this \n integer(INT8) :: A\n integer(INT8) :: B\n integer(INT8) :: C\n\n read(unit=INPUT_UNIT, fmt=*) A, B, C\n \n call task_A (A, B, C)\n\nend program main", "language": "Fortran", "metadata": {"date": 1564967317, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02951.html", "problem_id": "p02951", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02951/input.txt", "sample_output_relpath": "derived/input_output/data/p02951/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02951/Fortran/s967615150.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s967615150", "user_id": "u484703930"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module ABC136\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_A\n \n contains\n \n subroutine task_A (volume_Container1_max, volume_Container1_contained, volume_Container2_contained)\n\n ! arguments for this \n integer(INT8), intent(in) :: volume_Container1_max\n integer(INT8), intent(in) :: volume_Container1_contained\n integer(INT8), intent(in) :: volume_Container2_contained\n\n ! variables for this \n integer(INT8) :: volume_Container1_receivable\n integer(INT8) :: volume_remained\n\n volume_Container1_receivable = volume_Container1_max - volume_Container1_contained\n\n if (volume_Container1_receivable .ge. volume_Container2_contained) then\n volume_remained = 0_INT8\n else\n volume_remained = volume_Container2_contained - volume_Container1_receivable\n end if\n\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') volume_remained\n \n ! STEP.END\n return\n\n end subroutine task_A\n\nend module ABC136\n\nprogram main\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n use, non_intrinsic :: ABC136\n\n ! variables for this \n integer(INT8) :: A\n integer(INT8) :: B\n integer(INT8) :: C\n\n read(unit=INPUT_UNIT, fmt=*) A, B, C\n \n call task_A (A, B, C)\n\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "sample_input": "6 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02951", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have two bottles for holding water.\n\nBottle 1 can hold up to A milliliters of water, and now it contains B milliliters of water.\n\nBottle 2 contains C milliliters of water.\n\nWe will transfer water from Bottle 2 to Bottle 1 as much as possible.\n\nHow much amount of water will remain in Bottle 2?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq B \\leq A \\leq 20\n\n1 \\leq C \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the integer representing the amount of water, in milliliters, that will remain in Bottle 2.\n\nSample Input 1\n\n6 4 3\n\nSample Output 1\n\n1\n\nWe will transfer two milliliters of water from Bottle 2 to Bottle 1, and one milliliter of water will remain in Bottle 2.\n\nSample Input 2\n\n8 3 9\n\nSample Output 2\n\n4\n\nSample Input 3\n\n12 3 7\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1430, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s015735732", "group_id": "codeNet:p02952", "input_text": "program main\n implicit none\n\n integer :: n, odd\n \n read *, n\n\n! select case ( n )\n! \n! case ( 1:9 )\n! odd = n\n! case ( 10:99 )\n! odd = 9\n! case ( 100:999 )\n! odd = 9 + n - 99\n! case ( 1000:9999 )\n! odd = 9 + 900\n! case ( 10000:99999 )\n! odd = 9 + 900 + n - 9999\n! case ( 100000:999999 )\n! odd = 9 + 900 + 90000\n! \n! end select\n!\n\n if ( n <= 9 ) then\n odd = n\n else if ( 10 <= n .and. n <= 99 ) then\n odd = 9\n else if ( 100 <= n .and. n <= 999 ) then\n odd = 9 + n - 99\n else if ( 1000 <= n .and. n <= 9999 ) then\n odd = 9 + 900\n else if ( 10000 <= n .and. n <= 99999 ) then\n odd = 9 + 900 + n - 9999\n else if ( 100000 <= n .and. n <= 999999 ) then\n odd = 9 + 900 + 90000\n \n end if\n \n print *, odd\n \nend program main\n", "language": "Fortran", "metadata": {"date": 1566236099, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02952.html", "problem_id": "p02952", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02952/input.txt", "sample_output_relpath": "derived/input_output/data/p02952/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02952/Fortran/s015735732.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s015735732", "user_id": "u731648631"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program main\n implicit none\n\n integer :: n, odd\n \n read *, n\n\n! select case ( n )\n! \n! case ( 1:9 )\n! odd = n\n! case ( 10:99 )\n! odd = 9\n! case ( 100:999 )\n! odd = 9 + n - 99\n! case ( 1000:9999 )\n! odd = 9 + 900\n! case ( 10000:99999 )\n! odd = 9 + 900 + n - 9999\n! case ( 100000:999999 )\n! odd = 9 + 900 + 90000\n! \n! end select\n!\n\n if ( n <= 9 ) then\n odd = n\n else if ( 10 <= n .and. n <= 99 ) then\n odd = 9\n else if ( 100 <= n .and. n <= 999 ) then\n odd = 9 + n - 99\n else if ( 1000 <= n .and. n <= 9999 ) then\n odd = 9 + 900\n else if ( 10000 <= n .and. n <= 99999 ) then\n odd = 9 + 900 + n - 9999\n else if ( 100000 <= n .and. n <= 999999 ) then\n odd = 9 + 900 + 90000\n \n end if\n \n print *, odd\n \nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "sample_input": "11\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02952", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 812, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s347751089", "group_id": "codeNet:p02952", "input_text": "program main\n implicit none\n integer*8 N,i,j,k\n read(*,*) N\n k = 0\n j = 1\n do i=1,N\n if(j>N) exit\n if(10 <= j .and. j < 100) then \n j = 100\n else if(1000 <= j .and. j < 10000) then\n j = 10000\n else if(j >= 100000) then\n exit\n else\n j = j+1\n k = k+1\n end if\n end do\n write(*,*) k \nend program main", "language": "Fortran", "metadata": {"date": 1564971756, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02952.html", "problem_id": "p02952", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02952/input.txt", "sample_output_relpath": "derived/input_output/data/p02952/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02952/Fortran/s347751089.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s347751089", "user_id": "u671401989"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program main\n implicit none\n integer*8 N,i,j,k\n read(*,*) N\n k = 0\n j = 1\n do i=1,N\n if(j>N) exit\n if(10 <= j .and. j < 100) then \n j = 100\n else if(1000 <= j .and. j < 10000) then\n j = 10000\n else if(j >= 100000) then\n exit\n else\n j = j+1\n k = k+1\n end if\n end do\n write(*,*) k \nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "sample_input": "11\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02952", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 313, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s122975353", "group_id": "codeNet:p02952", "input_text": "program nn\n implicit none\n integer :: N,digi,i\n integer :: alle\n\n read(*,*) N\n\n digi=int(log(N*1.0)/log(10.0))+1\n alle=0\n! write(*,*) digi \n if(mod(digi,2).eq.0) then\n do i=1,digi/2\n alle=alle+9*100**(i-1)\n! write(*,*) alle \n enddo\n else\n do i=1,digi/2\n alle=alle+9*100**(i-1)\n enddo\n alle=alle+N-(10**(digi-1))+1\n endif\n\n write(*,'(i0)') int(alle)\nend program nn", "language": "Fortran", "metadata": {"date": 1564968667, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02952.html", "problem_id": "p02952", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02952/input.txt", "sample_output_relpath": "derived/input_output/data/p02952/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02952/Fortran/s122975353.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s122975353", "user_id": "u613124399"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program nn\n implicit none\n integer :: N,digi,i\n integer :: alle\n\n read(*,*) N\n\n digi=int(log(N*1.0)/log(10.0))+1\n alle=0\n! write(*,*) digi \n if(mod(digi,2).eq.0) then\n do i=1,digi/2\n alle=alle+9*100**(i-1)\n! write(*,*) alle \n enddo\n else\n do i=1,digi/2\n alle=alle+9*100**(i-1)\n enddo\n alle=alle+N-(10**(digi-1))+1\n endif\n\n write(*,'(i0)') int(alle)\nend program nn", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "sample_input": "11\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02952", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 530, "cpu_time_ms": 4, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s503191123", "group_id": "codeNet:p02952", "input_text": "implicit none\n\ninteger :: n, m\ninteger :: i\n\nread *, n\n\nm = 0\ndo i = 1, n\n if (i < 10) then\n m = m + 1\n cycle\n else if (99 < i .and. i < 1000) then\n m = m + 1\n cycle\n else if (9999 < i .and. i < 100000) then\n m = m + 1\n cycle\n endif\nenddo\n\nwrite(6,'(i0)') m\n\nstop\nend", "language": "Fortran", "metadata": {"date": 1564967318, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02952.html", "problem_id": "p02952", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02952/input.txt", "sample_output_relpath": "derived/input_output/data/p02952/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02952/Fortran/s503191123.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s503191123", "user_id": "u193540507"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "implicit none\n\ninteger :: n, m\ninteger :: i\n\nread *, n\n\nm = 0\ndo i = 1, n\n if (i < 10) then\n m = m + 1\n cycle\n else if (99 < i .and. i < 1000) then\n m = m + 1\n cycle\n else if (9999 < i .and. i < 100000) then\n m = m + 1\n cycle\n endif\nenddo\n\nwrite(6,'(i0)') m\n\nstop\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "sample_input": "11\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02952", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is an integer N. Find the number of positive integers less than or equal to N that have an odd number of digits (in base ten without leading zeros).\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of positive integers less than or equal to N that have an odd number of digits.\n\nSample Input 1\n\n11\n\nSample Output 1\n\n9\n\nAmong the positive integers less than or equal to 11, nine integers have an odd number of digits: 1, 2, \\ldots, 9.\n\nSample Input 2\n\n136\n\nSample Output 2\n\n46\n\nIn addition to 1, 2, \\ldots, 9, another 37 integers also have an odd number of digits: 100, 101, \\ldots, 136.\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n90909", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 305, "cpu_time_ms": 6, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s198853410", "group_id": "codeNet:p02954", "input_text": "program abc136d\n use,intrinsic :: iso_fortran_env\n implicit none\n character(100000):: s\n integer(int32):: n,i,f,l,m\n integer(int32), allocatable:: ans(:)\n logical,allocatable:: col(:), sep(:)\n\n read*, s\n n = len_trim(s)\n allocate(col(n-1), sep(0:n), ans(n))\n col(:) = .false.\n sep(:) = .false.\n sep(0) = .true.; sep(n) = .true.\n\n do i=1,n-1\n if (s(i:i+1) == 'RL') then\n col(i) = .true.\n else if (s(i:i+1) == 'LR') then\n sep(i) = .true.\n end if\n end do\n ! print*, col(:)\n ! print*, sep(1:n-1)\n f=1\n ans(:) = 0\n do i=1,n-1\n if (col(i)) then\n m = i\n else if (sep(i)) then\n l = i\n ! print*, '---',f,l\n if (mod(f,2) /= mod(l,2)) then\n ans(m:m+1) = (l-f+1)/2\n ! print*, ans(m:m+1)\n else if (mod(f,2) /= mod(m,2)) then\n ans(m) = (l-f+1)/2\n ans(m+1) = (l-f+1) - ans(m)\n ! print*, ans(m:m+1)\n else\n ans(m+1) = (l-f+1)/2\n ans(m) = (l-f+1) - ans(m+1)\n ! print*, ans(m:m+1)\n end if\n f = l+1\n end if\n end do\n\n l=n\n i=n\n ! print*, '---',f,l\n if (mod(f,2) /= mod(l,2)) then\n ans(m:m+1) = (l-f+1)/2\n ! print*, ans(m:m+1)\n else if (mod(f,2) == mod(m,2)) then\n ans(m) = (l-f+1)/2\n ans(m+1) = (l-f+1) - ans(m)\n ! print*, ans(m:m+1)\n else\n ans(m+1) = (l-f+1)/2\n ans(m) = (l-f+1) - ans(m+1)\n ! print*, ans(m:m+1)\n end if \n\n print*, ans(:)\nend program abc136d", "language": "Fortran", "metadata": {"date": 1589436010, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02954.html", "problem_id": "p02954", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02954/input.txt", "sample_output_relpath": "derived/input_output/data/p02954/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02954/Fortran/s198853410.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s198853410", "user_id": "u234636620"}, "prompt_components": {"gold_output": "0 1 2 1 1\n", "input_to_evaluate": "program abc136d\n use,intrinsic :: iso_fortran_env\n implicit none\n character(100000):: s\n integer(int32):: n,i,f,l,m\n integer(int32), allocatable:: ans(:)\n logical,allocatable:: col(:), sep(:)\n\n read*, s\n n = len_trim(s)\n allocate(col(n-1), sep(0:n), ans(n))\n col(:) = .false.\n sep(:) = .false.\n sep(0) = .true.; sep(n) = .true.\n\n do i=1,n-1\n if (s(i:i+1) == 'RL') then\n col(i) = .true.\n else if (s(i:i+1) == 'LR') then\n sep(i) = .true.\n end if\n end do\n ! print*, col(:)\n ! print*, sep(1:n-1)\n f=1\n ans(:) = 0\n do i=1,n-1\n if (col(i)) then\n m = i\n else if (sep(i)) then\n l = i\n ! print*, '---',f,l\n if (mod(f,2) /= mod(l,2)) then\n ans(m:m+1) = (l-f+1)/2\n ! print*, ans(m:m+1)\n else if (mod(f,2) /= mod(m,2)) then\n ans(m) = (l-f+1)/2\n ans(m+1) = (l-f+1) - ans(m)\n ! print*, ans(m:m+1)\n else\n ans(m+1) = (l-f+1)/2\n ans(m) = (l-f+1) - ans(m+1)\n ! print*, ans(m:m+1)\n end if\n f = l+1\n end if\n end do\n\n l=n\n i=n\n ! print*, '---',f,l\n if (mod(f,2) /= mod(l,2)) then\n ans(m:m+1) = (l-f+1)/2\n ! print*, ans(m:m+1)\n else if (mod(f,2) == mod(m,2)) then\n ans(m) = (l-f+1)/2\n ans(m+1) = (l-f+1) - ans(m)\n ! print*, ans(m:m+1)\n else\n ans(m+1) = (l-f+1)/2\n ans(m) = (l-f+1) - ans(m+1)\n ! print*, ans(m:m+1)\n end if \n\n print*, ans(:)\nend program abc136d", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of L and R.\n\nLet N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left.\n\nThe character written on the leftmost square is always R, and the character written on the rightmost square is always L.\n\nInitially, one child is standing on each square.\n\nEach child will perform the move below 10^{100} times:\n\nMove one square in the direction specified by the character written in the square on which the child is standing. L denotes left, and R denotes right.\n\nFind the number of children standing on each square after the children performed the moves.\n\nConstraints\n\nS is a string of length between 2 and 10^5 (inclusive).\n\nEach character of S is L or R.\n\nThe first and last characters of S are R and L, respectively.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of children standing on each square after the children performed the moves, in order from left to right.\n\nSample Input 1\n\nRRLRL\n\nSample Output 1\n\n0 1 2 1 1\n\nAfter each child performed one move, the number of children standing on each square is 0, 2, 1, 1, 1 from left to right.\n\nAfter each child performed two moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nAfter each child performed 10^{100} moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nSample Input 2\n\nRRLLLLRLRRLL\n\nSample Output 2\n\n0 3 3 0 0 0 1 1 0 2 2 0\n\nSample Input 3\n\nRRRLLRLLRRRLLLLL\n\nSample Output 3\n\n0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0", "sample_input": "RRLRL\n"}, "reference_outputs": ["0 1 2 1 1\n"], "source_document_id": "p02954", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of L and R.\n\nLet N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left.\n\nThe character written on the leftmost square is always R, and the character written on the rightmost square is always L.\n\nInitially, one child is standing on each square.\n\nEach child will perform the move below 10^{100} times:\n\nMove one square in the direction specified by the character written in the square on which the child is standing. L denotes left, and R denotes right.\n\nFind the number of children standing on each square after the children performed the moves.\n\nConstraints\n\nS is a string of length between 2 and 10^5 (inclusive).\n\nEach character of S is L or R.\n\nThe first and last characters of S are R and L, respectively.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of children standing on each square after the children performed the moves, in order from left to right.\n\nSample Input 1\n\nRRLRL\n\nSample Output 1\n\n0 1 2 1 1\n\nAfter each child performed one move, the number of children standing on each square is 0, 2, 1, 1, 1 from left to right.\n\nAfter each child performed two moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nAfter each child performed 10^{100} moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nSample Input 2\n\nRRLLLLRLRRLL\n\nSample Output 2\n\n0 3 3 0 0 0 1 1 0 2 2 0\n\nSample Input 3\n\nRRRLLRLLRRRLLLLL\n\nSample Output 3\n\n0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1649, "cpu_time_ms": 20, "memory_kb": 4864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s278888795", "group_id": "codeNet:p02954", "input_text": "program abc136d\n use,intrinsic :: iso_fortran_env\n implicit none\n character(100000):: s\n integer(int32):: n,i,f,l,m\n integer(int32), allocatable:: ans(:)\n logical,allocatable:: col(:), sep(:)\n\n read*, s\n n = len_trim(s)\n allocate(col(n-1), sep(0:n), ans(n))\n col(:) = .false.\n sep(:) = .false.\n sep(0) = .true.; sep(n) = .true.\n\n do i=1,n-1\n if (s(i:i+1) == 'RL') then\n col(i) = .true.\n else if (s(i:i+1) == 'LR') then\n sep(i) = .true.\n end if\n end do\n ! print*, col(:)\n ! print*, sep(1:n-1)\n f=1\n ans(:) = 0\n do i=1,n-1\n if (col(i)) then\n m = i\n else if (sep(i)) then\n l = i\n ! print*, '---',f,l\n if (mod(f,2) /= mod(l,2)) then\n ans(m:m+1) = (l-f+1+1)/2\n ! print*, ans(m:m+1)\n else if (mod(f,2) /= mod(m,2)) then\n ans(m) = (l-f+1)/2\n ans(m+1) = (l-f+1) - ans(m)\n ! print*, ans(m:m+1)\n else\n ans(m+1) = (l-f+1)/2\n ans(m) = (l-f+1) - ans(m+1)\n ! print*, ans(m:m+1)\n end if\n f = l+1\n end if\n end do\n\n l=n\n i=n\n ! print*, '---',f,l\n if (mod(f,2) /= mod(l,2)) then\n ans(m:m+1) = (l-f+1)/2\n ! print*, ans(m:m+1)\n else if (mod(f,2) == mod(m,2)) then\n ans(m) = (l-f+1)/2\n ans(m+1) = (l-f+1) - ans(m)\n ! print*, ans(m:m+1)\n else\n ans(m+1) = (l-f+1)/2\n ans(m) = (l-f+1) - ans(m+1)\n ! print*, ans(m:m+1)\n end if \n\n print'(100000(i0,1x))', ans(:)\nend program abc136d", "language": "Fortran", "metadata": {"date": 1589435438, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02954.html", "problem_id": "p02954", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02954/input.txt", "sample_output_relpath": "derived/input_output/data/p02954/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02954/Fortran/s278888795.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s278888795", "user_id": "u234636620"}, "prompt_components": {"gold_output": "0 1 2 1 1\n", "input_to_evaluate": "program abc136d\n use,intrinsic :: iso_fortran_env\n implicit none\n character(100000):: s\n integer(int32):: n,i,f,l,m\n integer(int32), allocatable:: ans(:)\n logical,allocatable:: col(:), sep(:)\n\n read*, s\n n = len_trim(s)\n allocate(col(n-1), sep(0:n), ans(n))\n col(:) = .false.\n sep(:) = .false.\n sep(0) = .true.; sep(n) = .true.\n\n do i=1,n-1\n if (s(i:i+1) == 'RL') then\n col(i) = .true.\n else if (s(i:i+1) == 'LR') then\n sep(i) = .true.\n end if\n end do\n ! print*, col(:)\n ! print*, sep(1:n-1)\n f=1\n ans(:) = 0\n do i=1,n-1\n if (col(i)) then\n m = i\n else if (sep(i)) then\n l = i\n ! print*, '---',f,l\n if (mod(f,2) /= mod(l,2)) then\n ans(m:m+1) = (l-f+1+1)/2\n ! print*, ans(m:m+1)\n else if (mod(f,2) /= mod(m,2)) then\n ans(m) = (l-f+1)/2\n ans(m+1) = (l-f+1) - ans(m)\n ! print*, ans(m:m+1)\n else\n ans(m+1) = (l-f+1)/2\n ans(m) = (l-f+1) - ans(m+1)\n ! print*, ans(m:m+1)\n end if\n f = l+1\n end if\n end do\n\n l=n\n i=n\n ! print*, '---',f,l\n if (mod(f,2) /= mod(l,2)) then\n ans(m:m+1) = (l-f+1)/2\n ! print*, ans(m:m+1)\n else if (mod(f,2) == mod(m,2)) then\n ans(m) = (l-f+1)/2\n ans(m+1) = (l-f+1) - ans(m)\n ! print*, ans(m:m+1)\n else\n ans(m+1) = (l-f+1)/2\n ans(m) = (l-f+1) - ans(m+1)\n ! print*, ans(m:m+1)\n end if \n\n print'(100000(i0,1x))', ans(:)\nend program abc136d", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of L and R.\n\nLet N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left.\n\nThe character written on the leftmost square is always R, and the character written on the rightmost square is always L.\n\nInitially, one child is standing on each square.\n\nEach child will perform the move below 10^{100} times:\n\nMove one square in the direction specified by the character written in the square on which the child is standing. L denotes left, and R denotes right.\n\nFind the number of children standing on each square after the children performed the moves.\n\nConstraints\n\nS is a string of length between 2 and 10^5 (inclusive).\n\nEach character of S is L or R.\n\nThe first and last characters of S are R and L, respectively.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of children standing on each square after the children performed the moves, in order from left to right.\n\nSample Input 1\n\nRRLRL\n\nSample Output 1\n\n0 1 2 1 1\n\nAfter each child performed one move, the number of children standing on each square is 0, 2, 1, 1, 1 from left to right.\n\nAfter each child performed two moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nAfter each child performed 10^{100} moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nSample Input 2\n\nRRLLLLRLRRLL\n\nSample Output 2\n\n0 3 3 0 0 0 1 1 0 2 2 0\n\nSample Input 3\n\nRRRLLRLLRRRLLLLL\n\nSample Output 3\n\n0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0", "sample_input": "RRLRL\n"}, "reference_outputs": ["0 1 2 1 1\n"], "source_document_id": "p02954", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S consisting of L and R.\n\nLet N be the length of S. There are N squares arranged from left to right, and the i-th character of S from the left is written on the i-th square from the left.\n\nThe character written on the leftmost square is always R, and the character written on the rightmost square is always L.\n\nInitially, one child is standing on each square.\n\nEach child will perform the move below 10^{100} times:\n\nMove one square in the direction specified by the character written in the square on which the child is standing. L denotes left, and R denotes right.\n\nFind the number of children standing on each square after the children performed the moves.\n\nConstraints\n\nS is a string of length between 2 and 10^5 (inclusive).\n\nEach character of S is L or R.\n\nThe first and last characters of S are R and L, respectively.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of children standing on each square after the children performed the moves, in order from left to right.\n\nSample Input 1\n\nRRLRL\n\nSample Output 1\n\n0 1 2 1 1\n\nAfter each child performed one move, the number of children standing on each square is 0, 2, 1, 1, 1 from left to right.\n\nAfter each child performed two moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nAfter each child performed 10^{100} moves, the number of children standing on each square is 0, 1, 2, 1, 1 from left to right.\n\nSample Input 2\n\nRRLLLLRLRRLL\n\nSample Output 2\n\n0 3 3 0 0 0 1 1 0 2 2 0\n\nSample Input 3\n\nRRRLLRLLRRRLLLLL\n\nSample Output 3\n\n0 0 3 2 0 2 1 0 0 0 4 4 0 0 0 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1667, "cpu_time_ms": 21, "memory_kb": 4328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s489181928", "group_id": "codeNet:p02955", "input_text": "program max_gcd\n implicit none\n integer :: n, a(500) = 0, s, d(100000) = 0, num = 0, i, j, x(500) = 0\n integer(8) :: k, m, p, q\n read(*,*) n, k\n read(*,*) a(1:n)\n s = sum(a(1:n))\n do i = 1, s\n if (i*i > s) exit\n if (mod(s,i) /= 0) cycle\n num = num+1\n d(num) = i\n if (s/i /= i) then\n num = num+1\n d(num) = s/i\n end if\n end do\n call quick_sort(d(1:num))\n do i = num, 1, -1\n x(1:n) = mod(a(1:n),d(i))\n call quick_sort(x(1:n))\n m = 1e18\n q = sum(int(d(i)-x(1:n),8))\n p = 0_8\n do j = 1, n\n if (x(j) == 0) cycle\n p = p+int(x(j),8)\n q = q-int(d(i)-x(j),8)\n m = min(m,max(p,q))\n end do\n if (m <= k) then\n write(*,'(i0)') d(i)\n stop\n end if\n end do\n stop\ncontains\n recursive subroutine quick_sort(a)\n implicit none\n integer, intent(inout) :: a(:)\n integer :: p, c\n integer :: n, l, r, m\n n = size(a)\n l = 1\n r = n\n m = (l+r)/2\n p = a(l)+a(m)+a(r)-max(a(l),a(m),a(r))-min(a(l),a(m),a(r))\n do\n do while (a(l) < p)\n l = l+1\n end do\n do while (a(r) > p)\n r = r-1\n end do\n if (l >= r) exit\n c = a(l)\n a(l) = a(r)\n a(r) = c\n l = l+1\n r = r-1\n end do\n if (l > 2) call quick_sort(a(1:l-1))\n if (n > r+1) call quick_sort(a(r+1:n))\n end subroutine quick_sort\nend program max_gcd", "language": "Fortran", "metadata": {"date": 1564981135, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02955.html", "problem_id": "p02955", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02955/input.txt", "sample_output_relpath": "derived/input_output/data/p02955/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02955/Fortran/s489181928.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s489181928", "user_id": "u506403362"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program max_gcd\n implicit none\n integer :: n, a(500) = 0, s, d(100000) = 0, num = 0, i, j, x(500) = 0\n integer(8) :: k, m, p, q\n read(*,*) n, k\n read(*,*) a(1:n)\n s = sum(a(1:n))\n do i = 1, s\n if (i*i > s) exit\n if (mod(s,i) /= 0) cycle\n num = num+1\n d(num) = i\n if (s/i /= i) then\n num = num+1\n d(num) = s/i\n end if\n end do\n call quick_sort(d(1:num))\n do i = num, 1, -1\n x(1:n) = mod(a(1:n),d(i))\n call quick_sort(x(1:n))\n m = 1e18\n q = sum(int(d(i)-x(1:n),8))\n p = 0_8\n do j = 1, n\n if (x(j) == 0) cycle\n p = p+int(x(j),8)\n q = q-int(d(i)-x(j),8)\n m = min(m,max(p,q))\n end do\n if (m <= k) then\n write(*,'(i0)') d(i)\n stop\n end if\n end do\n stop\ncontains\n recursive subroutine quick_sort(a)\n implicit none\n integer, intent(inout) :: a(:)\n integer :: p, c\n integer :: n, l, r, m\n n = size(a)\n l = 1\n r = n\n m = (l+r)/2\n p = a(l)+a(m)+a(r)-max(a(l),a(m),a(r))-min(a(l),a(m),a(r))\n do\n do while (a(l) < p)\n l = l+1\n end do\n do while (a(r) > p)\n r = r-1\n end do\n if (l >= r) exit\n c = a(l)\n a(l) = a(r)\n a(r) = c\n l = l+1\n r = r-1\n end do\n if (l > 2) call quick_sort(a(1:l-1))\n if (n > r+1) call quick_sort(a(r+1:n))\n end subroutine quick_sort\nend program max_gcd", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a sequence of N integers: A_1, A_2, \\cdots, A_N.\n\nYou can perform the following operation between 0 and K times (inclusive):\n\nChoose two integers i and j such that i \\neq j, each between 1 and N (inclusive). Add 1 to A_i and -1 to A_j, possibly producing a negative element.\n\nCompute the maximum possible positive integer that divides every element of A after the operations. Here a positive integer x divides an integer y if and only if there exists an integer z such that y = xz.\n\nConstraints\n\n2 \\leq N \\leq 500\n\n1 \\leq A_i \\leq 10^6\n\n0 \\leq K \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\cdots A_{N-1} A_{N}\n\nOutput\n\nPrint the maximum possible positive integer that divides every element of A after the operations.\n\nSample Input 1\n\n2 3\n8 20\n\nSample Output 1\n\n7\n\n7 will divide every element of A if, for example, we perform the following operation:\n\nChoose i = 2, j = 1. A becomes (7, 21).\n\nWe cannot reach the situation where 8 or greater integer divides every element of A.\n\nSample Input 2\n\n2 10\n3 5\n\nSample Output 2\n\n8\n\nConsider performing the following five operations:\n\nChoose i = 2, j = 1. A becomes (2, 6).\n\nChoose i = 2, j = 1. A becomes (1, 7).\n\nChoose i = 2, j = 1. A becomes (0, 8).\n\nChoose i = 2, j = 1. A becomes (-1, 9).\n\nChoose i = 1, j = 2. A becomes (0, 8).\n\nThen, 0 = 8 \\times 0 and 8 = 8 \\times 1, so 8 divides every element of A. We cannot reach the situation where 9 or greater integer divides every element of A.\n\nSample Input 3\n\n4 5\n10 1 2 22\n\nSample Output 3\n\n7\n\nSample Input 4\n\n8 7\n1 7 5 6 8 2 6 5\n\nSample Output 4\n\n5", "sample_input": "2 3\n8 20\n"}, "reference_outputs": ["7\n"], "source_document_id": "p02955", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a sequence of N integers: A_1, A_2, \\cdots, A_N.\n\nYou can perform the following operation between 0 and K times (inclusive):\n\nChoose two integers i and j such that i \\neq j, each between 1 and N (inclusive). Add 1 to A_i and -1 to A_j, possibly producing a negative element.\n\nCompute the maximum possible positive integer that divides every element of A after the operations. Here a positive integer x divides an integer y if and only if there exists an integer z such that y = xz.\n\nConstraints\n\n2 \\leq N \\leq 500\n\n1 \\leq A_i \\leq 10^6\n\n0 \\leq K \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 \\cdots A_{N-1} A_{N}\n\nOutput\n\nPrint the maximum possible positive integer that divides every element of A after the operations.\n\nSample Input 1\n\n2 3\n8 20\n\nSample Output 1\n\n7\n\n7 will divide every element of A if, for example, we perform the following operation:\n\nChoose i = 2, j = 1. A becomes (7, 21).\n\nWe cannot reach the situation where 8 or greater integer divides every element of A.\n\nSample Input 2\n\n2 10\n3 5\n\nSample Output 2\n\n8\n\nConsider performing the following five operations:\n\nChoose i = 2, j = 1. A becomes (2, 6).\n\nChoose i = 2, j = 1. A becomes (1, 7).\n\nChoose i = 2, j = 1. A becomes (0, 8).\n\nChoose i = 2, j = 1. A becomes (-1, 9).\n\nChoose i = 1, j = 2. A becomes (0, 8).\n\nThen, 0 = 8 \\times 0 and 8 = 8 \\times 1, so 8 divides every element of A. We cannot reach the situation where 9 or greater integer divides every element of A.\n\nSample Input 3\n\n4 5\n10 1 2 22\n\nSample Output 3\n\n7\n\nSample Input 4\n\n8 7\n1 7 5 6 8 2 6 5\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1361, "cpu_time_ms": 27, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s341025943", "group_id": "codeNet:p02957", "input_text": "program main\n\timplicit none\n integer::a,b\n read(*,*)a,b\n if(mod(a,2)/=mod(b,2))then\n \twrite(*,*) 'IMPOSSIBLE'\n else\n \twrite(*,*) (a+b)/2\n end if\n stop\nend program main\n ", "language": "Fortran", "metadata": {"date": 1592638529, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02957.html", "problem_id": "p02957", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02957/input.txt", "sample_output_relpath": "derived/input_output/data/p02957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02957/Fortran/s341025943.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s341025943", "user_id": "u884601206"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program main\n\timplicit none\n integer::a,b\n read(*,*)a,b\n if(mod(a,2)/=mod(b,2))then\n \twrite(*,*) 'IMPOSSIBLE'\n else\n \twrite(*,*) (a+b)/2\n end if\n stop\nend program main\n ", "problem_context": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "sample_input": "2 16\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02957", "source_text": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 196, "cpu_time_ms": 12, "memory_kb": 2832}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s073882324", "group_id": "codeNet:p02957", "input_text": "program main\n implicit none\n integer n\n integer a,b\n integer alice, bob\n integer, allocatable :: card(:)\n\n read*, a, b\n if (mod(a+b, 2) == 0)then\n print'(i0)', (a+b) /2\n else\n print'(a)', 'IMPOSSIBLE'\n endif\n\n \nend program main", "language": "Fortran", "metadata": {"date": 1564276432, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02957.html", "problem_id": "p02957", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02957/input.txt", "sample_output_relpath": "derived/input_output/data/p02957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02957/Fortran/s073882324.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s073882324", "user_id": "u234636620"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program main\n implicit none\n integer n\n integer a,b\n integer alice, bob\n integer, allocatable :: card(:)\n\n read*, a, b\n if (mod(a+b, 2) == 0)then\n print'(i0)', (a+b) /2\n else\n print'(a)', 'IMPOSSIBLE'\n endif\n\n \nend program main", "problem_context": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "sample_input": "2 16\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02957", "source_text": "Score: 100 points\n\nProblem Statement\n\nWe have two distinct integers A and B.\n\nPrint the integer K such that |A - K| = |B - K|.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A,\\ B \\leq 10^9\n\nA and B are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the integer K satisfying the condition.\n\nIf such an integer does not exist, print IMPOSSIBLE instead.\n\nSample Input 1\n\n2 16\n\nSample Output 1\n\n9\n\n|2 - 9| = 7 and |16 - 9| = 7, so 9 satisfies the condition.\n\nSample Input 2\n\n0 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo integer satisfies the condition.\n\nSample Input 3\n\n998244353 99824435\n\nSample Output 3\n\n549034394", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 269, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s032638539", "group_id": "codeNet:p02958", "input_text": "program main\n implicit none\n integer :: i, j, n\n logical :: ans\n integer, allocatable :: p(:), q(:)\n\n read *, n \n allocate (p(n), q(n))\n read *, p\n q(:) = p(:)\n if (minval(q(2:n) - q(1:n-1)) > 0) ans = .true.\n do i = 1, n\n do j = i+1, n\n q(:) = p(:)\n q(i) = p(j)\n q(j) = p(i)\n if (minval(q(2:n) - q(1:n-1)) == 1 .and. maxval(q(2:n) - q(1:n-2)) == 1) ans = .true.\n end do\n end do\n if (ans) then\n print '(a)', 'YES'\n else\n print '(a)', 'NO'\n end if\nend program", "language": "Fortran", "metadata": {"date": 1564277606, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02958.html", "problem_id": "p02958", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02958/input.txt", "sample_output_relpath": "derived/input_output/data/p02958/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02958/Fortran/s032638539.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s032638539", "user_id": "u282360873"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program main\n implicit none\n integer :: i, j, n\n logical :: ans\n integer, allocatable :: p(:), q(:)\n\n read *, n \n allocate (p(n), q(n))\n read *, p\n q(:) = p(:)\n if (minval(q(2:n) - q(1:n-1)) > 0) ans = .true.\n do i = 1, n\n do j = i+1, n\n q(:) = p(:)\n q(i) = p(j)\n q(j) = p(i)\n if (minval(q(2:n) - q(1:n-1)) == 1 .and. maxval(q(2:n) - q(1:n-2)) == 1) ans = .true.\n end do\n end do\n if (ans) then\n print '(a)', 'YES'\n else\n print '(a)', 'NO'\n end if\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a sequence p = {p_1,\\ p_2,\\ ...,\\ p_N} which is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nYou can perform the following operation at most once: choose integers i and j (1 \\leq i < j \\leq N), and swap p_i and p_j. Note that you can also choose not to perform it.\n\nPrint YES if you can sort p in ascending order in this way, and NO otherwise.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 50\n\np is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nPrint YES if you can sort p in ascending order in the way stated in the problem statement, and NO otherwise.\n\nSample Input 1\n\n5\n5 2 3 4 1\n\nSample Output 1\n\nYES\n\nYou can sort p in ascending order by swapping p_1 and p_5.\n\nSample Input 2\n\n5\n2 4 3 5 1\n\nSample Output 2\n\nNO\n\nIn this case, swapping any two elements does not sort p in ascending order.\n\nSample Input 3\n\n7\n1 2 3 4 5 6 7\n\nSample Output 3\n\nYES\n\np is already sorted in ascending order, so no operation is needed.", "sample_input": "5\n5 2 3 4 1\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02958", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a sequence p = {p_1,\\ p_2,\\ ...,\\ p_N} which is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nYou can perform the following operation at most once: choose integers i and j (1 \\leq i < j \\leq N), and swap p_i and p_j. Note that you can also choose not to perform it.\n\nPrint YES if you can sort p in ascending order in this way, and NO otherwise.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 50\n\np is a permutation of {1,\\ 2,\\ ...,\\ N}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nPrint YES if you can sort p in ascending order in the way stated in the problem statement, and NO otherwise.\n\nSample Input 1\n\n5\n5 2 3 4 1\n\nSample Output 1\n\nYES\n\nYou can sort p in ascending order by swapping p_1 and p_5.\n\nSample Input 2\n\n5\n2 4 3 5 1\n\nSample Output 2\n\nNO\n\nIn this case, swapping any two elements does not sort p in ascending order.\n\nSample Input 3\n\n7\n1 2 3 4 5 6 7\n\nSample Output 3\n\nYES\n\np is already sorted in ascending order, so no operation is needed.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 504, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s870065667", "group_id": "codeNet:p02959", "input_text": "program main\n implicit none\n integer(8) :: n, i, res, kill\n integer(8), allocatable :: a(:), b(:)\n read (*, *) n\n allocate (a(n + 1), b(n))\n read (*, *) a\n read (*, *) b\n res = 0\n do i = 1, n\n kill = min(a(i), b(i))\n res = res + kill\n b(i) = b(i) - kill\n kill = min(a(i + 1), b(i))\n res = res + kill\n a(i + 1) = a(i + 1) - kill\n end do\n write (*, \"(i0)\") res\nend program main\n", "language": "Fortran", "metadata": {"date": 1583463239, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02959.html", "problem_id": "p02959", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02959/input.txt", "sample_output_relpath": "derived/input_output/data/p02959/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02959/Fortran/s870065667.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s870065667", "user_id": "u388927326"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: n, i, res, kill\n integer(8), allocatable :: a(:), b(:)\n read (*, *) n\n allocate (a(n + 1), b(n))\n read (*, *) a\n read (*, *) b\n res = 0\n do i = 1, n\n kill = min(a(i), b(i))\n res = res + kill\n b(i) = b(i) - kill\n kill = min(a(i + 1), b(i))\n res = res + kill\n a(i + 1) = a(i + 1) - kill\n end do\n write (*, \"(i0)\") res\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N+1 towns. The i-th town is being attacked by A_i monsters.\n\nWe have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters.\n\nWhat is the maximum total number of monsters the heroes can cooperate to defeat?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N+1}\nB_1 B_2 ... B_N\n\nOutput\n\nPrint the maximum total number of monsters the heroes can defeat.\n\nSample Input 1\n\n2\n3 5 2\n4 5\n\nSample Output 1\n\n9\n\nIf the heroes choose the monsters to defeat as follows, they can defeat nine monsters in total, which is the maximum result.\n\nThe first hero defeats two monsters attacking the first town and two monsters attacking the second town.\n\nThe second hero defeats three monsters attacking the second town and two monsters attacking the third town.\n\nSample Input 2\n\n3\n5 6 3 8\n5 100 8\n\nSample Output 2\n\n22\n\nSample Input 3\n\n2\n100 1 1\n1 100\n\nSample Output 3\n\n3", "sample_input": "2\n3 5 2\n4 5\n"}, "reference_outputs": ["9\n"], "source_document_id": "p02959", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N+1 towns. The i-th town is being attacked by A_i monsters.\n\nWe have N heroes. The i-th hero can defeat monsters attacking the i-th or (i+1)-th town, for a total of at most B_i monsters.\n\nWhat is the maximum total number of monsters the heroes can cooperate to defeat?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N+1}\nB_1 B_2 ... B_N\n\nOutput\n\nPrint the maximum total number of monsters the heroes can defeat.\n\nSample Input 1\n\n2\n3 5 2\n4 5\n\nSample Output 1\n\n9\n\nIf the heroes choose the monsters to defeat as follows, they can defeat nine monsters in total, which is the maximum result.\n\nThe first hero defeats two monsters attacking the first town and two monsters attacking the second town.\n\nThe second hero defeats three monsters attacking the second town and two monsters attacking the third town.\n\nSample Input 2\n\n3\n5 6 3 8\n5 100 8\n\nSample Output 2\n\n22\n\nSample Input 3\n\n2\n100 1 1\n1 100\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 405, "cpu_time_ms": 68, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s629769277", "group_id": "codeNet:p02960", "input_text": "program main\n implicit none\n integer i, j, k\n integer n_len, tg, pop\n integer :: mod_ = 10**9+7\n integer, allocatable :: dp(:),old_dp(:)\n character(10**5):: S\n\n read*, S\n n_len = len_trim(S)\n allocate(dp(0:12), old_dp(0:12))\n dp(0:12) = 0\n dp(0) = 1\n old_dp(0:12) = 0\n \n do i=1, n_len\n old_dp(0:12) = dp(0:12)\n dp(0:12) = 0\n\n if(S(i:i) == \"?\")then\n do j = 0,9\n do k=0,12\n pop = mod(k*10+j,13)\n dp(pop) = dp(pop) + old_dp(k)\n dp(pop) = mod(dp(pop),mod_)\n enddo\n enddo\n\n else\n read(S(i:i),*) tg\n do k=0,12\n pop = mod(k*10+tg,13)\n dp(pop) = dp(pop) + old_dp(k)\n dp(pop) = mod(dp(pop),mod_)\n enddo\n endif\n\n enddo\n\nprint'(i0)', dp(5)\n\nstop\nend program main", "language": "Fortran", "metadata": {"date": 1564379905, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02960.html", "problem_id": "p02960", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02960/input.txt", "sample_output_relpath": "derived/input_output/data/p02960/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02960/Fortran/s629769277.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s629769277", "user_id": "u234636620"}, "prompt_components": {"gold_output": "768\n", "input_to_evaluate": "program main\n implicit none\n integer i, j, k\n integer n_len, tg, pop\n integer :: mod_ = 10**9+7\n integer, allocatable :: dp(:),old_dp(:)\n character(10**5):: S\n\n read*, S\n n_len = len_trim(S)\n allocate(dp(0:12), old_dp(0:12))\n dp(0:12) = 0\n dp(0) = 1\n old_dp(0:12) = 0\n \n do i=1, n_len\n old_dp(0:12) = dp(0:12)\n dp(0:12) = 0\n\n if(S(i:i) == \"?\")then\n do j = 0,9\n do k=0,12\n pop = mod(k*10+j,13)\n dp(pop) = dp(pop) + old_dp(k)\n dp(pop) = mod(dp(pop),mod_)\n enddo\n enddo\n\n else\n read(S(i:i),*) tg\n do k=0,12\n pop = mod(k*10+tg,13)\n dp(pop) = dp(pop) + old_dp(k)\n dp(pop) = mod(dp(pop),mod_)\n enddo\n endif\n\n enddo\n\nprint'(i0)', dp(5)\n\nstop\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S. Each character in S is either a digit (0, ..., 9) or ?.\n\nAmong the integers obtained by replacing each occurrence of ? with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0.\n\nSince the answer can be enormous, print the count modulo 10^9+7.\n\nConstraints\n\nS is a string consisting of digits (0, ..., 9) and ?.\n\n1 \\leq |S| \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of integers satisfying the condition, modulo 10^9+7.\n\nSample Input 1\n\n??2??5\n\nSample Output 1\n\n768\n\nFor example, 482305, 002865, and 972665 satisfy the condition.\n\nSample Input 2\n\n?44\n\nSample Output 2\n\n1\n\nOnly 044 satisfies the condition.\n\nSample Input 3\n\n7?4\n\nSample Output 3\n\n0\n\nWe may not be able to produce an integer satisfying the condition.\n\nSample Input 4\n\n?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76???\n\nSample Output 4\n\n153716888", "sample_input": "??2??5\n"}, "reference_outputs": ["768\n"], "source_document_id": "p02960", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is a string S. Each character in S is either a digit (0, ..., 9) or ?.\n\nAmong the integers obtained by replacing each occurrence of ? with a digit, how many have a remainder of 5 when divided by 13? An integer may begin with 0.\n\nSince the answer can be enormous, print the count modulo 10^9+7.\n\nConstraints\n\nS is a string consisting of digits (0, ..., 9) and ?.\n\n1 \\leq |S| \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the number of integers satisfying the condition, modulo 10^9+7.\n\nSample Input 1\n\n??2??5\n\nSample Output 1\n\n768\n\nFor example, 482305, 002865, and 972665 satisfy the condition.\n\nSample Input 2\n\n?44\n\nSample Output 2\n\n1\n\nOnly 044 satisfies the condition.\n\nSample Input 3\n\n7?4\n\nSample Output 3\n\n0\n\nWe may not be able to produce an integer satisfying the condition.\n\nSample Input 4\n\n?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76???\n\nSample Output 4\n\n153716888", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 918, "cpu_time_ms": 58, "memory_kb": 700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s531602009", "group_id": "codeNet:p02963", "input_text": "program main\n implicit none\n integer i,j,k, limit, limit2\n double precision x1y2, x2y1\n double precision :: s,x1,y1,x2,y2\n \n x1 = 0.d0\n y1 = 0.d0\n x2 = 0.d0\n y2 = 0.d0\n\n read*, s\n if(s>1.d18)then\n stop 's is too large'\n endif\n \n\n x1y2 = s\n x2y1 = 0\n do\n limit = int(dble(x1y2)/1d9) + 1\n limit2 = int(dble(x2y1)/1d9) + 1\n do i = limit, 1000000000\n if (mod(x1y2,real(i)) == 0)then\n x1 = i\n y2 = x1y2/i\n do j = limit2,1000000000\n if(mod(x2y1, real(j)) == 0) then\n x2 = j\n y1 = x2y1/j\n call output()\n endif\n enddo\n endif\n enddo\n x1y2 = x1y2 + 1\n x2y1 = s - x1y2\n enddo\n\n\ncontains\n subroutine output()\n implicit none\n character(:), allocatable :: format_output\n \n format_output = '(i0,1x, i0,1x, i0,1x, i0,1x, i0,1x, i0)'\n print format_output, 0, 0, int(x1), int(y1), int(x2), int(y2)\n stop\n end subroutine output\nend program main", "language": "Fortran", "metadata": {"date": 1564102846, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02963.html", "problem_id": "p02963", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02963/input.txt", "sample_output_relpath": "derived/input_output/data/p02963/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02963/Fortran/s531602009.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s531602009", "user_id": "u234636620"}, "prompt_components": {"gold_output": "1 0 2 2 0 1\n", "input_to_evaluate": "program main\n implicit none\n integer i,j,k, limit, limit2\n double precision x1y2, x2y1\n double precision :: s,x1,y1,x2,y2\n \n x1 = 0.d0\n y1 = 0.d0\n x2 = 0.d0\n y2 = 0.d0\n\n read*, s\n if(s>1.d18)then\n stop 's is too large'\n endif\n \n\n x1y2 = s\n x2y1 = 0\n do\n limit = int(dble(x1y2)/1d9) + 1\n limit2 = int(dble(x2y1)/1d9) + 1\n do i = limit, 1000000000\n if (mod(x1y2,real(i)) == 0)then\n x1 = i\n y2 = x1y2/i\n do j = limit2,1000000000\n if(mod(x2y1, real(j)) == 0) then\n x2 = j\n y1 = x2y1/j\n call output()\n endif\n enddo\n endif\n enddo\n x1y2 = x1y2 + 1\n x2y1 = s - x1y2\n enddo\n\n\ncontains\n subroutine output()\n implicit none\n character(:), allocatable :: format_output\n \n format_output = '(i0,1x, i0,1x, i0,1x, i0,1x, i0,1x, i0)'\n print format_output, 0, 0, int(x1), int(y1), int(x2), int(y2)\n stop\n end subroutine output\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:\n\n0 \\leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \\leq 10^9\n\nThe area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2.\n\nWe can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.\n\nConstraints\n\n1 \\leq S \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 0 2 2 0 1\n\nThe area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2.\nPrinting 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n0 0 10 0 0 10\n\nSample Input 3\n\n311114770564041497\n\nSample Output 3\n\n314159265 358979323 846264338 327950288 419716939 937510582", "sample_input": "3\n"}, "reference_outputs": ["1 0 2 2 0 1\n"], "source_document_id": "p02963", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:\n\n0 \\leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \\leq 10^9\n\nThe area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2.\n\nWe can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.\n\nConstraints\n\n1 \\leq S \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 0 2 2 0 1\n\nThe area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2.\nPrinting 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n0 0 10 0 0 10\n\nSample Input 3\n\n311114770564041497\n\nSample Output 3\n\n314159265 358979323 846264338 327950288 419716939 937510582", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1162, "cpu_time_ms": 2103, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s888747343", "group_id": "codeNet:p02963", "input_text": "program triangle\n implicit none\n integer(8) :: s, h, w, a, b, d\n integer(8) :: x1, y1, x2, y2, x3, y3, i\n read(*,*) s\n x1 = 0_8\n y1 = 0_8\n h = int(ceiling(sqrt(real(s,8))),8)\n w = h\n d = h*w-s\n a = 0_8\n b = 0_8\n if (d > 0_8) then\n a = int(floor(sqrt(real(d,8))),8)\n do while (a < d)\n if (mod(d,a) == 0_8) exit\n a = a+1_8\n end do\n b = d/a\n end if\n x2 = a\n y2 = h\n x3 = w\n y3 = b\n write(*,'(i0,x,i0,x,i0,x,i0,x,i0,x,i0)') x1, y1, x2, y2, x3, y3\n stop\nend program triangle", "language": "Fortran", "metadata": {"date": 1563758744, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02963.html", "problem_id": "p02963", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02963/input.txt", "sample_output_relpath": "derived/input_output/data/p02963/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02963/Fortran/s888747343.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s888747343", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1 0 2 2 0 1\n", "input_to_evaluate": "program triangle\n implicit none\n integer(8) :: s, h, w, a, b, d\n integer(8) :: x1, y1, x2, y2, x3, y3, i\n read(*,*) s\n x1 = 0_8\n y1 = 0_8\n h = int(ceiling(sqrt(real(s,8))),8)\n w = h\n d = h*w-s\n a = 0_8\n b = 0_8\n if (d > 0_8) then\n a = int(floor(sqrt(real(d,8))),8)\n do while (a < d)\n if (mod(d,a) == 0_8) exit\n a = a+1_8\n end do\n b = d/a\n end if\n x2 = a\n y2 = h\n x3 = w\n y3 = b\n write(*,'(i0,x,i0,x,i0,x,i0,x,i0,x,i0)') x1, y1, x2, y2, x3, y3\n stop\nend program triangle", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:\n\n0 \\leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \\leq 10^9\n\nThe area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2.\n\nWe can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.\n\nConstraints\n\n1 \\leq S \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 0 2 2 0 1\n\nThe area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2.\nPrinting 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n0 0 10 0 0 10\n\nSample Input 3\n\n311114770564041497\n\nSample Output 3\n\n314159265 358979323 846264338 327950288 419716939 937510582", "sample_input": "3\n"}, "reference_outputs": ["1 0 2 2 0 1\n"], "source_document_id": "p02963", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind a combination of six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfies all of the following conditions:\n\n0 \\leq X_1,Y_1,X_2,Y_2,X_3,Y_3 \\leq 10^9\n\nThe area of the triangle in a two-dimensional plane whose vertices are (X_1,Y_1),(X_2,Y_2), and (X_3,Y_3) is S/2.\n\nWe can prove that there always exist six integers that satisfy the conditions under the constraints of this problem.\n\nConstraints\n\n1 \\leq S \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint six integers X_1,Y_1,X_2,Y_2,X_3, and Y_3 that satisfy the conditions, in this order, with spaces in between.\nIf multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 0 2 2 0 1\n\nThe area of the triangle in a two-dimensional plane whose vertices are (1,0),(2,2), and (0,1) is 3/2.\nPrinting 3 0 3 1 0 1 or 1 0 0 1 2 2 will also be accepted.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n0 0 10 0 0 10\n\nSample Input 3\n\n311114770564041497\n\nSample Output 3\n\n314159265 358979323 846264338 327950288 419716939 937510582", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 510, "cpu_time_ms": 2103, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s283276549", "group_id": "codeNet:p02969", "input_text": "program dodecagon\n implicit none\n integer(4):: r\n \n read*, r\n print*, 3*r*r\nend program dodecagon", "language": "Fortran", "metadata": {"date": 1581569063, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02969.html", "problem_id": "p02969", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02969/input.txt", "sample_output_relpath": "derived/input_output/data/p02969/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02969/Fortran/s283276549.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s283276549", "user_id": "u234636620"}, "prompt_components": {"gold_output": "48\n", "input_to_evaluate": "program dodecagon\n implicit none\n integer(4):: r\n \n read*, r\n print*, 3*r*r\nend program dodecagon", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIt is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.\n\nGiven an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nr is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint an integer representing the area of the regular dodecagon.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n48\n\nThe area of the regular dodecagon is 3 \\times 4^2 = 48.\n\nSample Input 2\n\n15\n\nSample Output 2\n\n675\n\nSample Input 3\n\n80\n\nSample Output 3\n\n19200", "sample_input": "4\n"}, "reference_outputs": ["48\n"], "source_document_id": "p02969", "source_text": "Score : 100 points\n\nProblem Statement\n\nIt is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.\n\nGiven an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nr is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint an integer representing the area of the regular dodecagon.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n48\n\nThe area of the regular dodecagon is 3 \\times 4^2 = 48.\n\nSample Input 2\n\n15\n\nSample Output 2\n\n675\n\nSample Input 3\n\n80\n\nSample Output 3\n\n19200", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 112, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s161510939", "group_id": "codeNet:p02969", "input_text": "Program main\n implicit none\n integer :: r\n read(*,*) r\n write(*,'(i0)') 3*r*r\n stop\nend program main", "language": "Fortran", "metadata": {"date": 1563670875, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02969.html", "problem_id": "p02969", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02969/input.txt", "sample_output_relpath": "derived/input_output/data/p02969/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02969/Fortran/s161510939.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s161510939", "user_id": "u886432251"}, "prompt_components": {"gold_output": "48\n", "input_to_evaluate": "Program main\n implicit none\n integer :: r\n read(*,*) r\n write(*,'(i0)') 3*r*r\n stop\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIt is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.\n\nGiven an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nr is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint an integer representing the area of the regular dodecagon.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n48\n\nThe area of the regular dodecagon is 3 \\times 4^2 = 48.\n\nSample Input 2\n\n15\n\nSample Output 2\n\n675\n\nSample Input 3\n\n80\n\nSample Output 3\n\n19200", "sample_input": "4\n"}, "reference_outputs": ["48\n"], "source_document_id": "p02969", "source_text": "Score : 100 points\n\nProblem Statement\n\nIt is known that the area of a regular dodecagon inscribed in a circle of radius a is 3a^2.\n\nGiven an integer r, find the area of a regular dodecagon inscribed in a circle of radius r.\n\nConstraints\n\n1 \\leq r \\leq 100\n\nr is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr\n\nOutput\n\nPrint an integer representing the area of the regular dodecagon.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n48\n\nThe area of the regular dodecagon is 3 \\times 4^2 = 48.\n\nSample Input 2\n\n15\n\nSample Output 2\n\n675\n\nSample Input 3\n\n80\n\nSample Output 3\n\n19200", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 105, "cpu_time_ms": 7, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s726030548", "group_id": "codeNet:p02970", "input_text": "!!!**********************************************************************\nprogram main\n!!!********************************************************************** \n\n integer :: n, d, x\n real :: a\n ! character ::\n \n!!!----------------------------------------------------------------------\n\n read ( unit = *, fmt = * ) n, d\n\n \n a = ceiling ( real ( 2 * d + 1 ) / real ( n ) )\n\n x = 0\n \n do\n\n if ( real ( x ) < a ) then\n\n x = x + 1\n \n else\n\n x = x + 1\n\n exit\n \n end if\n \n\n end do\n \n \n print \"(i0)\", x \n \n!!!********************************************************************** \nend program main\n!!!**********************************************************************\n", "language": "Fortran", "metadata": {"date": 1563675801, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02970.html", "problem_id": "p02970", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02970/input.txt", "sample_output_relpath": "derived/input_output/data/p02970/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02970/Fortran/s726030548.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s726030548", "user_id": "u485252122"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "!!!**********************************************************************\nprogram main\n!!!********************************************************************** \n\n integer :: n, d, x\n real :: a\n ! character ::\n \n!!!----------------------------------------------------------------------\n\n read ( unit = *, fmt = * ) n, d\n\n \n a = ceiling ( real ( 2 * d + 1 ) / real ( n ) )\n\n x = 0\n \n do\n\n if ( real ( x ) < a ) then\n\n x = x + 1\n \n else\n\n x = x + 1\n\n exit\n \n end if\n \n\n end do\n \n \n print \"(i0)\", x \n \n!!!********************************************************************** \nend program main\n!!!**********************************************************************\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N apple trees in a row. People say that one of them will bear golden apples.\n\nWe want to deploy some number of inspectors so that each of these trees will be inspected.\n\nEach inspector will be deployed under one of the trees. For convenience, we will assign numbers from 1 through N to the trees. An inspector deployed under the i-th tree (1 \\leq i \\leq N) will inspect the trees with numbers between i-D and i+D (inclusive).\n\nFind the minimum number of inspectors that we need to deploy to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq D \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\n\nOutput\n\nPrint the minimum number of inspectors that we need to deploy to achieve the objective.\n\nSample Input 1\n\n6 2\n\nSample Output 1\n\n2\n\nWe can achieve the objective by, for example, placing an inspector under Tree 3 and Tree 4.\n\nSample Input 2\n\n14 3\n\nSample Output 2\n\n2\n\nSample Input 3\n\n20 4\n\nSample Output 3\n\n3", "sample_input": "6 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02970", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N apple trees in a row. People say that one of them will bear golden apples.\n\nWe want to deploy some number of inspectors so that each of these trees will be inspected.\n\nEach inspector will be deployed under one of the trees. For convenience, we will assign numbers from 1 through N to the trees. An inspector deployed under the i-th tree (1 \\leq i \\leq N) will inspect the trees with numbers between i-D and i+D (inclusive).\n\nFind the minimum number of inspectors that we need to deploy to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq D \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\n\nOutput\n\nPrint the minimum number of inspectors that we need to deploy to achieve the objective.\n\nSample Input 1\n\n6 2\n\nSample Output 1\n\n2\n\nWe can achieve the objective by, for example, placing an inspector under Tree 3 and Tree 4.\n\nSample Input 2\n\n14 3\n\nSample Output 2\n\n2\n\nSample Input 3\n\n20 4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 742, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s219373656", "group_id": "codeNet:p02970", "input_text": "program main\n implicit none\n integer i,N,D\n !read(*, *) (L(i), i = 1,N)\n read(*, *)N,D\n i = 2*D + 1\n i = N/i + 1\n\n\n write(*, *) i\nend program main\n", "language": "Fortran", "metadata": {"date": 1563671001, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02970.html", "problem_id": "p02970", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02970/input.txt", "sample_output_relpath": "derived/input_output/data/p02970/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02970/Fortran/s219373656.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s219373656", "user_id": "u050276949"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer i,N,D\n !read(*, *) (L(i), i = 1,N)\n read(*, *)N,D\n i = 2*D + 1\n i = N/i + 1\n\n\n write(*, *) i\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N apple trees in a row. People say that one of them will bear golden apples.\n\nWe want to deploy some number of inspectors so that each of these trees will be inspected.\n\nEach inspector will be deployed under one of the trees. For convenience, we will assign numbers from 1 through N to the trees. An inspector deployed under the i-th tree (1 \\leq i \\leq N) will inspect the trees with numbers between i-D and i+D (inclusive).\n\nFind the minimum number of inspectors that we need to deploy to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq D \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\n\nOutput\n\nPrint the minimum number of inspectors that we need to deploy to achieve the objective.\n\nSample Input 1\n\n6 2\n\nSample Output 1\n\n2\n\nWe can achieve the objective by, for example, placing an inspector under Tree 3 and Tree 4.\n\nSample Input 2\n\n14 3\n\nSample Output 2\n\n2\n\nSample Input 3\n\n20 4\n\nSample Output 3\n\n3", "sample_input": "6 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02970", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N apple trees in a row. People say that one of them will bear golden apples.\n\nWe want to deploy some number of inspectors so that each of these trees will be inspected.\n\nEach inspector will be deployed under one of the trees. For convenience, we will assign numbers from 1 through N to the trees. An inspector deployed under the i-th tree (1 \\leq i \\leq N) will inspect the trees with numbers between i-D and i+D (inclusive).\n\nFind the minimum number of inspectors that we need to deploy to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq D \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\n\nOutput\n\nPrint the minimum number of inspectors that we need to deploy to achieve the objective.\n\nSample Input 1\n\n6 2\n\nSample Output 1\n\n2\n\nWe can achieve the objective by, for example, placing an inspector under Tree 3 and Tree 4.\n\nSample Input 2\n\n14 3\n\nSample Output 2\n\n2\n\nSample Input 3\n\n20 4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 154, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s451798448", "group_id": "codeNet:p02971", "input_text": "integer N\ninteger,allocatable,dimension(:)::A\ninteger premax,maxnum,cnt\nread*,N\nallocate(A(N))\ndo i=1,N\n read*,A(i)\nend do\npremax=0\nmaxnum=A(1)\ncnt=1\ndo i=2,N\n if(A(i)>maxnum)then\n premax=maxnum\n maxnum=A(i)\n cnt=1\n else if(A(i)==maxnum)then\n cnt=2\n else if(A(i)>=premax)then\n premax=A(i)\n endif\nend do\ndo i=1,N\n if(A(i)/=maxnum.or.cnt==2)then\n print\"(i0)\",maxnum\n else\n print\"(i0)\",premax\n endif\nend do\nend\n", "language": "Fortran", "metadata": {"date": 1563672921, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02971.html", "problem_id": "p02971", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02971/input.txt", "sample_output_relpath": "derived/input_output/data/p02971/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02971/Fortran/s451798448.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s451798448", "user_id": "u598073939"}, "prompt_components": {"gold_output": "4\n3\n4\n", "input_to_evaluate": "integer N\ninteger,allocatable,dimension(:)::A\ninteger premax,maxnum,cnt\nread*,N\nallocate(A(N))\ndo i=1,N\n read*,A(i)\nend do\npremax=0\nmaxnum=A(1)\ncnt=1\ndo i=2,N\n if(A(i)>maxnum)then\n premax=maxnum\n maxnum=A(i)\n cnt=1\n else if(A(i)==maxnum)then\n cnt=2\n else if(A(i)>=premax)then\n premax=A(i)\n endif\nend do\ndo i=1,N\n if(A(i)/=maxnum.or.cnt==2)then\n print\"(i0)\",maxnum\n else\n print\"(i0)\",premax\n endif\nend do\nend\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of length N: A_1, A_2, ..., A_N.\nFor each integer i between 1 and N (inclusive), answer the following question:\n\nFind the maximum value among the N-1 elements other than A_i in the sequence.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 200000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint N lines. The i-th line (1 \\leq i \\leq N) should contain the maximum value among the N-1 elements other than A_i in the sequence.\n\nSample Input 1\n\n3\n1\n4\n3\n\nSample Output 1\n\n4\n3\n4\n\nThe maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n\nThe maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n\nThe maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\nSample Input 2\n\n2\n5\n5\n\nSample Output 2\n\n5\n5", "sample_input": "3\n1\n4\n3\n"}, "reference_outputs": ["4\n3\n4\n"], "source_document_id": "p02971", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of length N: A_1, A_2, ..., A_N.\nFor each integer i between 1 and N (inclusive), answer the following question:\n\nFind the maximum value among the N-1 elements other than A_i in the sequence.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 200000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint N lines. The i-th line (1 \\leq i \\leq N) should contain the maximum value among the N-1 elements other than A_i in the sequence.\n\nSample Input 1\n\n3\n1\n4\n3\n\nSample Output 1\n\n4\n3\n4\n\nThe maximum value among the two elements other than A_1, that is, A_2 = 4 and A_3 = 3, is 4.\n\nThe maximum value among the two elements other than A_2, that is, A_1 = 1 and A_3 = 3, is 3.\n\nThe maximum value among the two elements other than A_3, that is, A_1 = 1 and A_2 = 4, is 4.\n\nSample Input 2\n\n2\n5\n5\n\nSample Output 2\n\n5\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 437, "cpu_time_ms": 151, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s826878622", "group_id": "codeNet:p02972", "input_text": "program preparing_boxes\n implicit none\n integer(4):: n, i, j\n integer(4), allocatable:: a(:), b(:), d(:)\n \n\n read*, n\n allocate(a(n), b(n),d(n))\n read*, a(:)\n do i=n, 1\n if (a(i) > 1)then\n print*, -1\n stop\n else if (a(i) == 1) then\n b(i) = 1\n do j=2,nint(sqrt(dble(i)))\n if (mod(i,j) == 0) a(i/j)=a(i/j)-1\n end do\n end if\n end do\n\n print*, sum(b(:))\n do i=1,n\n if (b(i)==1) print*, i \n end do\nend program preparing_boxes", "language": "Fortran", "metadata": {"date": 1581664334, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02972.html", "problem_id": "p02972", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02972/input.txt", "sample_output_relpath": "derived/input_output/data/p02972/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02972/Fortran/s826878622.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s826878622", "user_id": "u234636620"}, "prompt_components": {"gold_output": "1\n1\n", "input_to_evaluate": "program preparing_boxes\n implicit none\n integer(4):: n, i, j\n integer(4), allocatable:: a(:), b(:), d(:)\n \n\n read*, n\n allocate(a(n), b(n),d(n))\n read*, a(:)\n do i=n, 1\n if (a(i) > 1)then\n print*, -1\n stop\n else if (a(i) == 1) then\n b(i) = 1\n do j=2,nint(sqrt(dble(i)))\n if (mod(i,j) == 0) a(i/j)=a(i/j)-1\n end do\n end if\n end do\n\n print*, sum(b(:))\n do i=1,n\n if (b(i)==1) print*, i \n end do\nend program preparing_boxes", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "sample_input": "3\n1 0 0\n"}, "reference_outputs": ["1\n1\n"], "source_document_id": "p02972", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 554, "cpu_time_ms": 33, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s340957098", "group_id": "codeNet:p02972", "input_text": "program preparing_boxes\n implicit none\n integer :: n, a(200000) = 0, b(200000) = 0, c(200000) = 1, m = 0, s, i\n read(*,*) n\n read(*,*) a(1:n)\n do i = n, 1, -1\n s = sum(c(i:n:i))\n if (mod(s,2) /= a(i)) c(i) = 0\n end do\n do i = 1, n\n if (c(i) == 1) then\n m = m+1\n b(m) = i\n end if\n end do\n write(*,'(i0)') m\n if (m > 0) then\n write(*,'(i0)',advance='no') b(1)\n do i = 2, m\n write(*,'(x,i0)',advance='no') b(i)\n end do\n write(*,*)\n end if\n stop\nend program preparing_boxes", "language": "Fortran", "metadata": {"date": 1563736314, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02972.html", "problem_id": "p02972", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02972/input.txt", "sample_output_relpath": "derived/input_output/data/p02972/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02972/Fortran/s340957098.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s340957098", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1\n1\n", "input_to_evaluate": "program preparing_boxes\n implicit none\n integer :: n, a(200000) = 0, b(200000) = 0, c(200000) = 1, m = 0, s, i\n read(*,*) n\n read(*,*) a(1:n)\n do i = n, 1, -1\n s = sum(c(i:n:i))\n if (mod(s,2) /= a(i)) c(i) = 0\n end do\n do i = 1, n\n if (c(i) == 1) then\n m = m+1\n b(m) = i\n end if\n end do\n write(*,'(i0)') m\n if (m > 0) then\n write(*,'(i0)',advance='no') b(1)\n do i = 2, m\n write(*,'(x,i0)',advance='no') b(i)\n end do\n write(*,*)\n end if\n stop\nend program preparing_boxes", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "sample_input": "3\n1 0 0\n"}, "reference_outputs": ["1\n1\n"], "source_document_id": "p02972", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N empty boxes arranged in a row from left to right.\nThe integer i is written on the i-th box from the left (1 \\leq i \\leq N).\n\nFor each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.\n\nWe say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:\n\nFor every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.\n\nDoes there exist a good set of choices? If the answer is yes, find one good set of choices.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\na_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf a good set of choices does not exist, print -1.\n\nIf a good set of choices exists, print one such set of choices in the following format:\n\nM\nb_1 b_2 ... b_M\n\nwhere M denotes the number of boxes that will contain a ball, and b_1,\\ b_2,\\ ...,\\ b_M are the integers written on these boxes, in any order.\n\nSample Input 1\n\n3\n1 0 0\n\nSample Output 1\n\n1\n1\n\nConsider putting a ball only in the box with 1 written on it.\n\nThere are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.\n\nThere is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.\n\nThere is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.\n\nThus, the condition is satisfied, so this set of choices is good.\n\nSample Input 2\n\n5\n0 0 0 0 0\n\nSample Output 2\n\n0\n\nPutting nothing in the boxes can be a good set of choices.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 520, "cpu_time_ms": 88, "memory_kb": 3200}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s470958194", "group_id": "codeNet:p02975", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,i,t\n integer(int32), allocatable:: a(:)\n\n read*, n\n\n if (mod(n,3) /= 0) then\n print'(a)', 'No'\n stop\n end if\n\n allocate(a(n))\n read*, a(:)\n call merge_sort(a,1,n)\n\n if (a(n)==0) then\n print'(a)', 'Yes'\n stop\n end if\n\n if (a(n/3) == 0 .and. a(n/3+1) > 0 .and. a(n/3+1) == a(n)) then\n print'(a)', 'Yes'\n stop\n end if\n\n if (a(1)==(a(n/3)) .and. a(n/3+1)==a(2*n/3) .and. a(2*n/3+1)==a(n))then\n if (xor(xor(a(1),a(n/3+1)),a(2*n/3+1)) == 0) then\n print'(a)', 'Yes'\n stop\n end if\n end if\n\n print'(a)', 'No'\ncontains\n recursive subroutine merge_sort(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call merge_sort(ar, fst, mdl)\n call merge_sort(ar, mdl+1, lst)\n call merge_(ar, fst, mdl, lst)\n end subroutine\n\n subroutine merge_(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n subroutine swap(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\nend program name", "language": "Fortran", "metadata": {"date": 1588040160, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02975.html", "problem_id": "p02975", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02975/input.txt", "sample_output_relpath": "derived/input_output/data/p02975/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02975/Fortran/s470958194.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s470958194", "user_id": "u234636620"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,i,t\n integer(int32), allocatable:: a(:)\n\n read*, n\n\n if (mod(n,3) /= 0) then\n print'(a)', 'No'\n stop\n end if\n\n allocate(a(n))\n read*, a(:)\n call merge_sort(a,1,n)\n\n if (a(n)==0) then\n print'(a)', 'Yes'\n stop\n end if\n\n if (a(n/3) == 0 .and. a(n/3+1) > 0 .and. a(n/3+1) == a(n)) then\n print'(a)', 'Yes'\n stop\n end if\n\n if (a(1)==(a(n/3)) .and. a(n/3+1)==a(2*n/3) .and. a(2*n/3+1)==a(n))then\n if (xor(xor(a(1),a(n/3+1)),a(2*n/3+1)) == 0) then\n print'(a)', 'Yes'\n stop\n end if\n end if\n\n print'(a)', 'No'\ncontains\n recursive subroutine merge_sort(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call merge_sort(ar, fst, mdl)\n call merge_sort(ar, mdl+1, lst)\n call merge_(ar, fst, mdl, lst)\n end subroutine\n\n subroutine merge_(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n subroutine swap(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\nend program name", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N hats. The i-th hat has an integer a_i written on it.\n\nThere are N camels standing in a circle.\nSnuke will put one of his hats on each of these camels.\n\nIf there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print Yes; otherwise, print No.\n\nThe bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.\n\nWhat is XOR?\n\nThe bitwise XOR x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n of n non-negative integers x_1, x_2, \\ldots, x_n is defined as follows:\n\n- When x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3 \\oplus 5 = 6.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^{5}\n\n0 \\leq a_i \\leq 10^{9}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\nYes\n\nIf we put the hats with 1, 2, and 3 in this order, clockwise, the condition will be satisfied for every camel, so the answer is Yes.\n\nSample Input 2\n\n4\n1 2 4 8\n\nSample Output 2\n\nNo\n\nThere is no such way to distribute the hats; the answer is No.", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02975", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N hats. The i-th hat has an integer a_i written on it.\n\nThere are N camels standing in a circle.\nSnuke will put one of his hats on each of these camels.\n\nIf there exists a way to distribute the hats to the camels such that the following condition is satisfied for every camel, print Yes; otherwise, print No.\n\nThe bitwise XOR of the numbers written on the hats on both adjacent camels is equal to the number on the hat on itself.\n\nWhat is XOR?\n\nThe bitwise XOR x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n of n non-negative integers x_1, x_2, \\ldots, x_n is defined as follows:\n\n- When x_1 \\oplus x_2 \\oplus \\ldots \\oplus x_n is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if the number of integers among x_1, x_2, \\ldots, x_n whose binary representations have 1 in the 2^k's place is odd, and 0 if that count is even.\n\nFor example, 3 \\oplus 5 = 6.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^{5}\n\n0 \\leq a_i \\leq 10^{9}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 \\ldots a_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\nYes\n\nIf we put the hats with 1, 2, and 3 in this order, clockwise, the condition will be satisfied for every camel, so the answer is Yes.\n\nSample Input 2\n\n4\n1 2 4 8\n\nSample Output 2\n\nNo\n\nThere is no such way to distribute the hats; the answer is No.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2125, "cpu_time_ms": 40, "memory_kb": 1724}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s392614907", "group_id": "codeNet:p02981", "input_text": "read *,n,m,l\nprint *,min(m*n,l)\nend", "language": "Fortran", "metadata": {"date": 1588027926, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02981.html", "problem_id": "p02981", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02981/input.txt", "sample_output_relpath": "derived/input_output/data/p02981/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02981/Fortran/s392614907.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s392614907", "user_id": "u310855433"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "read *,n,m,l\nprint *,min(m*n,l)\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nN of us are going on a trip, by train or taxi.\n\nThe train will cost each of us A yen (the currency of Japan).\n\nThe taxi will cost us a total of B yen.\n\nHow much is our minimum total travel expense?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq A \\leq 50\n\n1 \\leq B \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint an integer representing the minimum total travel expense.\n\nSample Input 1\n\n4 2 9\n\nSample Output 1\n\n8\n\nThe train will cost us 4 \\times 2 = 8 yen, and the taxi will cost us 9 yen, so the minimum total travel expense is 8 yen.\n\nSample Input 2\n\n4 2 7\n\nSample Output 2\n\n7\n\nSample Input 3\n\n4 2 8\n\nSample Output 3\n\n8", "sample_input": "4 2 9\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02981", "source_text": "Score : 100 points\n\nProblem Statement\n\nN of us are going on a trip, by train or taxi.\n\nThe train will cost each of us A yen (the currency of Japan).\n\nThe taxi will cost us a total of B yen.\n\nHow much is our minimum total travel expense?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq A \\leq 50\n\n1 \\leq B \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint an integer representing the minimum total travel expense.\n\nSample Input 1\n\n4 2 9\n\nSample Output 1\n\n8\n\nThe train will cost us 4 \\times 2 = 8 yen, and the taxi will cost us 9 yen, so the minimum total travel expense is 8 yen.\n\nSample Input 2\n\n4 2 7\n\nSample Output 2\n\n7\n\nSample Input 3\n\n4 2 8\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 35, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s139523782", "group_id": "codeNet:p02981", "input_text": "program aaa\n\nimplicit none\ninteger :: n, a, b\nread*, n, a, b\n\nwrite(*,'(i0)') min(a*n,b)\n\nend program", "language": "Fortran", "metadata": {"date": 1569956719, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02981.html", "problem_id": "p02981", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02981/input.txt", "sample_output_relpath": "derived/input_output/data/p02981/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02981/Fortran/s139523782.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s139523782", "user_id": "u039189422"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program aaa\n\nimplicit none\ninteger :: n, a, b\nread*, n, a, b\n\nwrite(*,'(i0)') min(a*n,b)\n\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nN of us are going on a trip, by train or taxi.\n\nThe train will cost each of us A yen (the currency of Japan).\n\nThe taxi will cost us a total of B yen.\n\nHow much is our minimum total travel expense?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq A \\leq 50\n\n1 \\leq B \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint an integer representing the minimum total travel expense.\n\nSample Input 1\n\n4 2 9\n\nSample Output 1\n\n8\n\nThe train will cost us 4 \\times 2 = 8 yen, and the taxi will cost us 9 yen, so the minimum total travel expense is 8 yen.\n\nSample Input 2\n\n4 2 7\n\nSample Output 2\n\n7\n\nSample Input 3\n\n4 2 8\n\nSample Output 3\n\n8", "sample_input": "4 2 9\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02981", "source_text": "Score : 100 points\n\nProblem Statement\n\nN of us are going on a trip, by train or taxi.\n\nThe train will cost each of us A yen (the currency of Japan).\n\nThe taxi will cost us a total of B yen.\n\nHow much is our minimum total travel expense?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq A \\leq 50\n\n1 \\leq B \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nPrint an integer representing the minimum total travel expense.\n\nSample Input 1\n\n4 2 9\n\nSample Output 1\n\n8\n\nThe train will cost us 4 \\times 2 = 8 yen, and the taxi will cost us 9 yen, so the minimum total travel expense is 8 yen.\n\nSample Input 2\n\n4 2 7\n\nSample Output 2\n\n7\n\nSample Input 3\n\n4 2 8\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 101, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s934816303", "group_id": "codeNet:p02984", "input_text": "program abc133d\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n, i\n integer(int32), allocatable:: a(:), ans(:)\n\n read*, n\n allocate(a(n))\n allocate(ans(n))\n read*, a(:)\n\n ans(1) = (sum(a(1:n:2)) - sum(a(2:n:2)))\n ans(n) = 2*a(n) - ans(1)\n do i=n-1,2,-1\n ans(i) = 2*a(i) - ans(i+1)\n end do\n print'(*(i0,1x))', ans(:)\nend program abc133d", "language": "Fortran", "metadata": {"date": 1591211381, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02984.html", "problem_id": "p02984", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02984/input.txt", "sample_output_relpath": "derived/input_output/data/p02984/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02984/Fortran/s934816303.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s934816303", "user_id": "u234636620"}, "prompt_components": {"gold_output": "4 0 4\n", "input_to_evaluate": "program abc133d\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n, i\n integer(int32), allocatable:: a(:), ans(:)\n\n read*, n\n allocate(a(n))\n allocate(ans(n))\n read*, a(:)\n\n ans(1) = (sum(a(1:n:2)) - sum(a(2:n:2)))\n ans(n) = 2*a(n) - ans(1)\n do i=n-1,2,-1\n ans(i) = 2*a(i) - ans(i+1)\n end do\n print'(*(i0,1x))', ans(:)\nend program abc133d", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "sample_input": "3\n2 2 4\n"}, "reference_outputs": ["4 0 4\n"], "source_document_id": "p02984", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 402, "cpu_time_ms": 68, "memory_kb": 3712}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s386081940", "group_id": "codeNet:p02984", "input_text": "program abc133d\n implicit none\n\n integer :: N, r1, i\n integer, allocatable :: a(:), r(:)\n\n read(*,*) N\n allocate( a(0:N), r(n))\n read(*,*) a(1:N)\n\n a(0) = a(N)\n r = 0\n r1 = 0\n do i = 1, n-2, 2\n r1 = r1 + a(i) - a(i+1)\n enddo\n r1 = r1 + a(n)\n\n r(1) = r1\n\n do i = n, 2, -1\n if (i == n) then\n r(n) = 2*a(n) - r(1)\n cycle\n else\n r(i) = 2*a(i) - r(i+1)\n end if\n enddo\n\n print *, r(:)\nend program abc133d\n", "language": "Fortran", "metadata": {"date": 1562553350, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02984.html", "problem_id": "p02984", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02984/input.txt", "sample_output_relpath": "derived/input_output/data/p02984/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02984/Fortran/s386081940.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s386081940", "user_id": "u210113718"}, "prompt_components": {"gold_output": "4 0 4\n", "input_to_evaluate": "program abc133d\n implicit none\n\n integer :: N, r1, i\n integer, allocatable :: a(:), r(:)\n\n read(*,*) N\n allocate( a(0:N), r(n))\n read(*,*) a(1:N)\n\n a(0) = a(N)\n r = 0\n r1 = 0\n do i = 1, n-2, 2\n r1 = r1 + a(i) - a(i+1)\n enddo\n r1 = r1 + a(n)\n\n r(1) = r1\n\n do i = n, 2, -1\n if (i == n) then\n r(n) = 2*a(n) - r(1)\n cycle\n else\n r(i) = 2*a(i) - r(i+1)\n end if\n enddo\n\n print *, r(:)\nend program abc133d\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "sample_input": "3\n2 2 4\n"}, "reference_outputs": ["4 0 4\n"], "source_document_id": "p02984", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 475, "cpu_time_ms": 61, "memory_kb": 3328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s912993112", "group_id": "codeNet:p02984", "input_text": "module ABC133\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_D\n\n ! variables for this \n integer(INT32), private :: num_mountain\n\n ! arrays for this \n integer(INT32), dimension(:), allocatable, private :: solution\n\n ! contained s and s are below\n contains\n\n subroutine task_D\n\n ! support variables for this \n integer(INT32) :: itr\n\n ! STEP.01\n ! read out given data (1/2)\n read(unit=INPUT_UNIT, fmt=*) num_mountain\n\n ! STEP.02\n ! allocate the array to store the given data & the answer of this task\n allocate( solution(1:num_mountain) )\n\n ! STEP.03\n ! read out given data (2/2)\n read(unit=INPUT_UNIT, fmt=*) solution(:)\n\n ! STEP.04\n ! calculate the answer of this task\n solution(:) = solution(:) * 2_INT32\n\n do itr = 2, num_mountain - 1, 1\n solution(itr) = solution(itr) - solution(itr - 1)\n end do\n\n if ( mod(num_mountain, 2_INT32) .eq. 0_INT32 ) then\n solution(num_mountain) = solution(num_mountain) - solution(num_mountain - 1)\n else\n solution(num_mountain) = solution(num_mountain) + solution(num_mountain - 1)\n end if\n\n solution(num_mountain) = solution(num_mountain) / 2_INT32\n\n solution(num_mountain - 1) = solution(num_mountain) - solution(num_mountain - 1)\n\n do itr = 1, num_mountain - 2, 1\n if ( mod(itr, 2_INT32) .eq. 0_INT32 ) then\n solution(itr) = solution(itr) + solution(num_mountain - 1)\n else\n solution(itr) = solution(itr) - solution(num_mountain - 1)\n end if\n end do\n\n ! STEP.05\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='no') solution(num_mountain - 1)\n\n do itr = 2, num_mountain - 1, 1\n write(unit=OUTPUT_UNIT, fmt='(1X,I0)', advance='no') solution(itr - 1)\n end do\n\n write(unit=OUTPUT_UNIT, fmt='(1X,I0)', advance='no') solution(num_mountain)\n\n ! STEP.06\n ! deallocate the array to store the given data & the answer of this task\n deallocate( solution )\n\n ! STEP.END\n return\n\n end subroutine task_D\n\nend module ABC133\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC133\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_D\n\nend program main", "language": "Fortran", "metadata": {"date": 1562553176, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02984.html", "problem_id": "p02984", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02984/input.txt", "sample_output_relpath": "derived/input_output/data/p02984/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02984/Fortran/s912993112.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s912993112", "user_id": "u484703930"}, "prompt_components": {"gold_output": "4 0 4\n", "input_to_evaluate": "module ABC133\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_D\n\n ! variables for this \n integer(INT32), private :: num_mountain\n\n ! arrays for this \n integer(INT32), dimension(:), allocatable, private :: solution\n\n ! contained s and s are below\n contains\n\n subroutine task_D\n\n ! support variables for this \n integer(INT32) :: itr\n\n ! STEP.01\n ! read out given data (1/2)\n read(unit=INPUT_UNIT, fmt=*) num_mountain\n\n ! STEP.02\n ! allocate the array to store the given data & the answer of this task\n allocate( solution(1:num_mountain) )\n\n ! STEP.03\n ! read out given data (2/2)\n read(unit=INPUT_UNIT, fmt=*) solution(:)\n\n ! STEP.04\n ! calculate the answer of this task\n solution(:) = solution(:) * 2_INT32\n\n do itr = 2, num_mountain - 1, 1\n solution(itr) = solution(itr) - solution(itr - 1)\n end do\n\n if ( mod(num_mountain, 2_INT32) .eq. 0_INT32 ) then\n solution(num_mountain) = solution(num_mountain) - solution(num_mountain - 1)\n else\n solution(num_mountain) = solution(num_mountain) + solution(num_mountain - 1)\n end if\n\n solution(num_mountain) = solution(num_mountain) / 2_INT32\n\n solution(num_mountain - 1) = solution(num_mountain) - solution(num_mountain - 1)\n\n do itr = 1, num_mountain - 2, 1\n if ( mod(itr, 2_INT32) .eq. 0_INT32 ) then\n solution(itr) = solution(itr) + solution(num_mountain - 1)\n else\n solution(itr) = solution(itr) - solution(num_mountain - 1)\n end if\n end do\n\n ! STEP.05\n ! output the answer of this task\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='no') solution(num_mountain - 1)\n\n do itr = 2, num_mountain - 1, 1\n write(unit=OUTPUT_UNIT, fmt='(1X,I0)', advance='no') solution(itr - 1)\n end do\n\n write(unit=OUTPUT_UNIT, fmt='(1X,I0)', advance='no') solution(num_mountain)\n\n ! STEP.06\n ! deallocate the array to store the given data & the answer of this task\n deallocate( solution )\n\n ! STEP.END\n return\n\n end subroutine task_D\n\nend module ABC133\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC133\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_D\n\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "sample_input": "3\n2 2 4\n"}, "reference_outputs": ["4 0 4\n"], "source_document_id": "p02984", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2426, "cpu_time_ms": 87, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s778719908", "group_id": "codeNet:p02984", "input_text": "program main\n implicit none\n integer(8) i,N,n_min,j,t1\n integer(8),allocatable :: A(:)\n integer(8),allocatable :: rain(:)\n integer(8),allocatable :: V(:,:)\n read(*, *) N\n allocate(A(N))\n allocate(rain(N))\n allocate(V(N,N))\n read(*, *) (A(i), i = 1,N)\n V = 1\n do i = 1,N\n do j = 1,(N-1)/2\n if (i+2*j-1>N) then\n t1 = i+2*j-1-N\n else \n t1 = i+2*j-1\n end if\n V(i,t1) = -1\n end do\n end do\n rain = 0\n do i = 1,N\n do j = 1,N\n rain(i) = rain(i) + A(j)*V(i,j)\n end do\n end do\n write(*,*) rain\nend program main\n", "language": "Fortran", "metadata": {"date": 1562552665, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02984.html", "problem_id": "p02984", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02984/input.txt", "sample_output_relpath": "derived/input_output/data/p02984/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02984/Fortran/s778719908.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s778719908", "user_id": "u050276949"}, "prompt_components": {"gold_output": "4 0 4\n", "input_to_evaluate": "program main\n implicit none\n integer(8) i,N,n_min,j,t1\n integer(8),allocatable :: A(:)\n integer(8),allocatable :: rain(:)\n integer(8),allocatable :: V(:,:)\n read(*, *) N\n allocate(A(N))\n allocate(rain(N))\n allocate(V(N,N))\n read(*, *) (A(i), i = 1,N)\n V = 1\n do i = 1,N\n do j = 1,(N-1)/2\n if (i+2*j-1>N) then\n t1 = i+2*j-1-N\n else \n t1 = i+2*j-1\n end if\n V(i,t1) = -1\n end do\n end do\n rain = 0\n do i = 1,N\n do j = 1,N\n rain(i) = rain(i) + A(j)*V(i,j)\n end do\n end do\n write(*,*) rain\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "sample_input": "3\n2 2 4\n"}, "reference_outputs": ["4 0 4\n"], "source_document_id": "p02984", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.\n\nBetween these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \\leq i \\leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).\n\nWhen Mountain i (1 \\leq i \\leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).\n\nOne day, each of the mountains received a non-negative even number of liters of rain.\n\nAs a result, Dam i (1 \\leq i \\leq N) accumulated a total of A_i liters of water.\n\nFind the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10^5-1\n\nN is an odd number.\n\n0 \\leq A_i \\leq 10^9\n\nThe situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.\n\nSample Input 1\n\n3\n2 2 4\n\nSample Output 1\n\n4 0 4\n\nIf we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:\n\nDam 1 should have accumulated \\frac{4}{2} + \\frac{0}{2} = 2 liters of water.\n\nDam 2 should have accumulated \\frac{0}{2} + \\frac{4}{2} = 2 liters of water.\n\nDam 3 should have accumulated \\frac{4}{2} + \\frac{4}{2} = 4 liters of water.\n\nSample Input 2\n\n5\n3 8 7 5 5\n\nSample Output 2\n\n2 4 12 2 8\n\nSample Input 3\n\n3\n1000000000 1000000000 0\n\nSample Output 3\n\n0 2000000000 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 569, "cpu_time_ms": 185, "memory_kb": 148096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s796586472", "group_id": "codeNet:p02987", "input_text": "program main\n implicit none\n\n character a,b,c,d\n\n read(*,*)a,b,c,d\n if ((a == b) .and.(c == d)) then\n\twrite(*,*)\"Yes\"\n else if ((a == c) .and.(b == d)) then\n\twrite(*,*)\"Yes\"\n else if ((a == d) .and.(b == c)) then\n\twrite(*,*)\"Yes\"\n else if ((b == c) .and.(a == d)) then\n\twrite(*,*)\"Yes\"\n else if ((b == d) .and.(a == c)) then\n\twrite(*,*)\"Yes\"\n else if ((c == d) .and.(a == b)) then\n\twrite(*,*)\"Yes\"\n else\n\twrite(*,*)\"No\"\n end if\n\nend program main", "language": "Fortran", "metadata": {"date": 1567293507, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02987.html", "problem_id": "p02987", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02987/input.txt", "sample_output_relpath": "derived/input_output/data/p02987/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02987/Fortran/s796586472.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s796586472", "user_id": "u287431190"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n implicit none\n\n character a,b,c,d\n\n read(*,*)a,b,c,d\n if ((a == b) .and.(c == d)) then\n\twrite(*,*)\"Yes\"\n else if ((a == c) .and.(b == d)) then\n\twrite(*,*)\"Yes\"\n else if ((a == d) .and.(b == c)) then\n\twrite(*,*)\"Yes\"\n else if ((b == c) .and.(a == d)) then\n\twrite(*,*)\"Yes\"\n else if ((b == d) .and.(a == c)) then\n\twrite(*,*)\"Yes\"\n else if ((c == d) .and.(a == b)) then\n\twrite(*,*)\"Yes\"\n else\n\twrite(*,*)\"No\"\n end if\n\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "sample_input": "ASSA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02987", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 456, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s098600120", "group_id": "codeNet:p02987", "input_text": "program abc132a\n implicit none\n character(4) :: s\n integer :: i, m\n logical :: flag=.false.\n\n read(*,*) s\n\n if (s(1:1) == s(2:2) .and. s(3:3) == s(4:4)) then\n flag=.True.\n else if (s(1:1) == s(3:3) .and. s(2:2) == s(4:4)) then\n flag=.True.\n else if (s(1:1) == s(4:4) .and. s(2:2) == s(3:3)) then\n flag=.True.\n endif\n\n if (flag) then\n print *, 'Yes'\n else\n print *, 'No'\n endif\n\nend program abc132a\n", "language": "Fortran", "metadata": {"date": 1561857066, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02987.html", "problem_id": "p02987", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02987/input.txt", "sample_output_relpath": "derived/input_output/data/p02987/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02987/Fortran/s098600120.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s098600120", "user_id": "u210113718"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program abc132a\n implicit none\n character(4) :: s\n integer :: i, m\n logical :: flag=.false.\n\n read(*,*) s\n\n if (s(1:1) == s(2:2) .and. s(3:3) == s(4:4)) then\n flag=.True.\n else if (s(1:1) == s(3:3) .and. s(2:2) == s(4:4)) then\n flag=.True.\n else if (s(1:1) == s(4:4) .and. s(2:2) == s(3:3)) then\n flag=.True.\n endif\n\n if (flag) then\n print *, 'Yes'\n else\n print *, 'No'\n endif\n\nend program abc132a\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "sample_input": "ASSA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02987", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 425, "cpu_time_ms": 9, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s843432214", "group_id": "codeNet:p02987", "input_text": "program fa\n implicit none\n integer ::i,j\n character(len=4) :: S\n\n read(*,*) S\n\n if((S(1:1).eq.S(2:2)).and.(S(3:3).eq.S(4:4)).and.(S(2:2).ne.S(3:3))) then\n write(*,'(a)') 'Yes'\n elseif((S(3:3).eq.S(2:2)).and.(S(3:3).ne.S(4:4)).and.(S(1:1).eq.S(4:4))) then\n write(*,'(a)') 'Yes'\n elseif((S(4:4).eq.S(2:2)).and.(S(3:3).ne.S(4:4)).and.(S(1:1).eq.S(3:3))) then\n write(*,'(a)') 'Yes'\n else\n write(*,'(a)') 'No'\n endif\n\n\n\nend program fa", "language": "Fortran", "metadata": {"date": 1561857061, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02987.html", "problem_id": "p02987", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02987/input.txt", "sample_output_relpath": "derived/input_output/data/p02987/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02987/Fortran/s843432214.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s843432214", "user_id": "u613124399"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program fa\n implicit none\n integer ::i,j\n character(len=4) :: S\n\n read(*,*) S\n\n if((S(1:1).eq.S(2:2)).and.(S(3:3).eq.S(4:4)).and.(S(2:2).ne.S(3:3))) then\n write(*,'(a)') 'Yes'\n elseif((S(3:3).eq.S(2:2)).and.(S(3:3).ne.S(4:4)).and.(S(1:1).eq.S(4:4))) then\n write(*,'(a)') 'Yes'\n elseif((S(4:4).eq.S(2:2)).and.(S(3:3).ne.S(4:4)).and.(S(1:1).eq.S(3:3))) then\n write(*,'(a)') 'Yes'\n else\n write(*,'(a)') 'No'\n endif\n\n\n\nend program fa", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "sample_input": "ASSA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02987", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 442, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s763222195", "group_id": "codeNet:p02987", "input_text": "program test\nimplicit none\ncharacter::S*4\nread*,S\nif('S(1:1)'=='S(2:2)' .and. 'S(3:3)'=='S(4:4)' .and. 'S(1:1)'/='S(3:3)') then \nprint*,'Yes'\nelse if ('S(1:1)'=='S(3:3)' .and. 'S(2:2)'=='S(4:4)' .and. 'S(2:2)'/='S(3:3)') then\nprint*,'Yes'\nelse if('S(1:1)'=='S(4:4)' .and. 'S(3:3)'=='S(2:2)' .and. 'S(1:1)'/='S(3:3)') then\nprint*,'Yes'\nelse \nprint*,'No'\nend if\nend program test", "language": "Fortran", "metadata": {"date": 1561856978, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02987.html", "problem_id": "p02987", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02987/input.txt", "sample_output_relpath": "derived/input_output/data/p02987/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02987/Fortran/s763222195.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s763222195", "user_id": "u723571904"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program test\nimplicit none\ncharacter::S*4\nread*,S\nif('S(1:1)'=='S(2:2)' .and. 'S(3:3)'=='S(4:4)' .and. 'S(1:1)'/='S(3:3)') then \nprint*,'Yes'\nelse if ('S(1:1)'=='S(3:3)' .and. 'S(2:2)'=='S(4:4)' .and. 'S(2:2)'/='S(3:3)') then\nprint*,'Yes'\nelse if('S(1:1)'=='S(4:4)' .and. 'S(3:3)'=='S(2:2)' .and. 'S(1:1)'/='S(3:3)') then\nprint*,'Yes'\nelse \nprint*,'No'\nend if\nend program test", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "sample_input": "ASSA\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02987", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a 4-character string S consisting of uppercase English letters.\nDetermine if S consists of exactly two kinds of characters which both appear twice in S.\n\nConstraints\n\nThe length of S is 4.\n\nS consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S consists of exactly two kinds of characters which both appear twice in S, print Yes; otherwise, print No.\n\nSample Input 1\n\nASSA\n\nSample Output 1\n\nYes\n\nS consists of A and S which both appear twice in S.\n\nSample Input 2\n\nSTOP\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nFFEE\n\nSample Output 3\n\nYes\n\nSample Input 4\n\nFREE\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 376, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s296308101", "group_id": "codeNet:p02988", "input_text": "integer :: n,p(20)\ninteger :: i,ans\n\nread*,n\nread*,p(1:n)\n\nans = 0\n\ndo i = 2,n-1\n if( p(i-1) p(i + 1) .and. p(i + 1) > p(i + 2))) res = res + 1\n end do\n write (*, \"(i0)\") res\nend program main\n", "language": "Fortran", "metadata": {"date": 1583007104, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02988.html", "problem_id": "p02988", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02988/input.txt", "sample_output_relpath": "derived/input_output/data/p02988/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02988/Fortran/s309889507.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s309889507", "user_id": "u388927326"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, i, res\n integer, allocatable :: p(:)\n read (*, *) n\n allocate (p(n))\n read (*, *) p(:)\n res = 0\n do i = 1, n - 2\n if ((p(i) < p(i + 1) .and. p(i + 1) < p(i + 2)) .or. (p(i) > p(i + 1) .and. p(i + 1) > p(i + 2))) res = res + 1\n end do\n write (*, \"(i0)\") res\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n}.\n\nPrint the number of elements p_i (1 < i < n) that satisfy the following condition:\n\np_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq n \\leq 20\n\np is a permutation of {1,\\ 2,\\ ...,\\ n}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\np_1 p_2 ... p_n\n\nOutput\n\nPrint the number of elements p_i (1 < i < n) that satisfy the condition.\n\nSample Input 1\n\n5\n1 3 5 4 2\n\nSample Output 1\n\n2\n\np_2 = 3 is the second smallest number among p_1 = 1, p_2 = 3, and p_3 = 5. Also, p_4 = 4 is the second smallest number among p_3 = 5, p_4 = 4, and p_5 = 2. These two elements satisfy the condition.\n\nSample Input 2\n\n9\n9 6 3 2 5 8 7 4 1\n\nSample Output 2\n\n5", "sample_input": "5\n1 3 5 4 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02988", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n}.\n\nPrint the number of elements p_i (1 < i < n) that satisfy the following condition:\n\np_i is the second smallest number among the three numbers p_{i - 1}, p_i, and p_{i + 1}.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq n \\leq 20\n\np is a permutation of {1,\\ 2,\\ ...,\\ n}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\np_1 p_2 ... p_n\n\nOutput\n\nPrint the number of elements p_i (1 < i < n) that satisfy the condition.\n\nSample Input 1\n\n5\n1 3 5 4 2\n\nSample Output 1\n\n2\n\np_2 = 3 is the second smallest number among p_1 = 1, p_2 = 3, and p_3 = 5. Also, p_4 = 4 is the second smallest number among p_3 = 5, p_4 = 4, and p_5 = 2. These two elements satisfy the condition.\n\nSample Input 2\n\n9\n9 6 3 2 5 8 7 4 1\n\nSample Output 2\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 330, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s623016921", "group_id": "codeNet:p02989", "input_text": "program main\n implicit none\n integer i,N,al,av\n integer,allocatable :: d(:)\n !read(*, *) (L(i), i = 1,N)\n read(*, *) N\n allocate(d(N))\n read(*, *) (d(i), i = 1,N)\n call qsort(d)\n write(*, *) abs(d(N/2)-d(N/2+1)) + 1\n\n contains\n\n recursive subroutine qsort(a)\n implicit none\n integer,intent(inout) :: a(:)\n integer :: start,ed,i,j,toobig,toosmall,pv\n\n n = size(a)\n start = 1\n ed = n\n pv = a((start+ed)/2)\n i = start\n j = ed\n do\n !pv = a((start+ed)/2)\n !i = start\n !j = ed\n do\n if (a(i) < pv) then\n i = i+1\n else\n exit\n end if\n end do\n do\n if(a(j) > pv) then\n j = j-1\n else\n exit\n end if\n end do\n if (i >= j) then\n exit\n else\n toobig = a(i)\n toosmall = a(j)\n a(j) = toobig\n a(i) = toosmall\n i = i + 1\n j = j - 1\n end if\n end do\n if (i-1 > start) then\n call qsort(a(1:i-1))\n end if\n if (j+1 < ed) then\n call qsort(a(j+1:n))\n end if\n end subroutine qsort\n \nend program main\n", "language": "Fortran", "metadata": {"date": 1562547480, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02989.html", "problem_id": "p02989", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02989/input.txt", "sample_output_relpath": "derived/input_output/data/p02989/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02989/Fortran/s623016921.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s623016921", "user_id": "u050276949"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer i,N,al,av\n integer,allocatable :: d(:)\n !read(*, *) (L(i), i = 1,N)\n read(*, *) N\n allocate(d(N))\n read(*, *) (d(i), i = 1,N)\n call qsort(d)\n write(*, *) abs(d(N/2)-d(N/2+1)) + 1\n\n contains\n\n recursive subroutine qsort(a)\n implicit none\n integer,intent(inout) :: a(:)\n integer :: start,ed,i,j,toobig,toosmall,pv\n\n n = size(a)\n start = 1\n ed = n\n pv = a((start+ed)/2)\n i = start\n j = ed\n do\n !pv = a((start+ed)/2)\n !i = start\n !j = ed\n do\n if (a(i) < pv) then\n i = i+1\n else\n exit\n end if\n end do\n do\n if(a(j) > pv) then\n j = j-1\n else\n exit\n end if\n end do\n if (i >= j) then\n exit\n else\n toobig = a(i)\n toosmall = a(j)\n a(j) = toobig\n a(i) = toosmall\n i = i + 1\n j = j - 1\n end if\n end do\n if (i-1 > start) then\n call qsort(a(1:i-1))\n end if\n if (j+1 < ed) then\n call qsort(a(j+1:n))\n end if\n end subroutine qsort\n \nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "sample_input": "6\n9 1 4 4 6 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02989", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1055, "cpu_time_ms": 26, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s285554238", "group_id": "codeNet:p02989", "input_text": "module UIntegerSort\n implicit none\n \n private\n \n public QuickSortInteger\n \ncontains\n \n !!\n ! ピボット値の取得\n !\n subroutine GetPivotIntegerValue(array, n, a, b, pivot_value)\n integer, intent(inout) :: array(:), pivot_value\n integer, intent(in) :: n, a, b\n \n pivot_value = array((a + b) / 2)\n end subroutine\n \n !!\n ! ピボット値に従って値を分離\n !\n subroutine GetPartitionInteger(array, n, a, b, pivot)\n integer, intent(inout) :: array(:)\n integer, intent(in) :: n, a, b\n integer, intent(out) :: pivot\n \n integer :: buffer, pivot_value\n integer :: l, r\n \n if (a == b) then\n pivot = 0\n return\n end if\n \n call GetPivotIntegerValue(array, n, a, b, pivot_value)\n \n l = a\n r = b\n \n do while(.true.)\n do while(array(l) < pivot_value)\n if (l >= b) exit\n l = l + 1\n end do\n \n do while(pivot_value < array(r))\n if (r <= a) exit\n r = r - 1\n end do\n \n if(r <= l) exit\n \n buffer = array(l)\n array(l) = array(r)\n array(r) = buffer\n \n l = l + 1\n r = r - 1\n end do\n \n pivot = r\n end subroutine\n \n !!\n ! 配列の一部分をソートする。\n !\n recursive subroutine QuickSortIntegerSubarray(array, n, a, b)\n integer, intent(inout) :: array(:)\n integer, intent(in) :: n, a, b\n \n integer :: pivot\n \n call GetPartitionInteger(array, n, a, b, pivot)\n if (pivot /= 0) then\n call QuickSortIntegerSubarray(array, n, a, pivot)\n call QuickSortIntegerSubarray(array, n, pivot + 1, b)\n end if\n end subroutine\n \n !!\n ! 配列全体をソートする\n !\n subroutine QuickSortInteger(array, n)\n integer :: array(:)\n integer :: n\n \n call QuickSortIntegerSubarray(array, n, 1, n)\n end subroutine\n \nend module\n \nprogram TestIntegerSort\n use UIntegerSort\n \n implicit none\n integer,allocatable::a(:)\n integer :: N,i\n read*,N\n allocate(a(N))\n read(*,*)(a(i),i=1,N)\n call QuickSortInteger(a, N)\n print *, a(N/2+1)-a(N)\nend program", "language": "Fortran", "metadata": {"date": 1561862250, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02989.html", "problem_id": "p02989", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02989/input.txt", "sample_output_relpath": "derived/input_output/data/p02989/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02989/Fortran/s285554238.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s285554238", "user_id": "u723571904"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "module UIntegerSort\n implicit none\n \n private\n \n public QuickSortInteger\n \ncontains\n \n !!\n ! ピボット値の取得\n !\n subroutine GetPivotIntegerValue(array, n, a, b, pivot_value)\n integer, intent(inout) :: array(:), pivot_value\n integer, intent(in) :: n, a, b\n \n pivot_value = array((a + b) / 2)\n end subroutine\n \n !!\n ! ピボット値に従って値を分離\n !\n subroutine GetPartitionInteger(array, n, a, b, pivot)\n integer, intent(inout) :: array(:)\n integer, intent(in) :: n, a, b\n integer, intent(out) :: pivot\n \n integer :: buffer, pivot_value\n integer :: l, r\n \n if (a == b) then\n pivot = 0\n return\n end if\n \n call GetPivotIntegerValue(array, n, a, b, pivot_value)\n \n l = a\n r = b\n \n do while(.true.)\n do while(array(l) < pivot_value)\n if (l >= b) exit\n l = l + 1\n end do\n \n do while(pivot_value < array(r))\n if (r <= a) exit\n r = r - 1\n end do\n \n if(r <= l) exit\n \n buffer = array(l)\n array(l) = array(r)\n array(r) = buffer\n \n l = l + 1\n r = r - 1\n end do\n \n pivot = r\n end subroutine\n \n !!\n ! 配列の一部分をソートする。\n !\n recursive subroutine QuickSortIntegerSubarray(array, n, a, b)\n integer, intent(inout) :: array(:)\n integer, intent(in) :: n, a, b\n \n integer :: pivot\n \n call GetPartitionInteger(array, n, a, b, pivot)\n if (pivot /= 0) then\n call QuickSortIntegerSubarray(array, n, a, pivot)\n call QuickSortIntegerSubarray(array, n, pivot + 1, b)\n end if\n end subroutine\n \n !!\n ! 配列全体をソートする\n !\n subroutine QuickSortInteger(array, n)\n integer :: array(:)\n integer :: n\n \n call QuickSortIntegerSubarray(array, n, 1, n)\n end subroutine\n \nend module\n \nprogram TestIntegerSort\n use UIntegerSort\n \n implicit none\n integer,allocatable::a(:)\n integer :: N,i\n read*,N\n allocate(a(N))\n read(*,*)(a(i),i=1,N)\n call QuickSortInteger(a, N)\n print *, a(N/2+1)-a(N)\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "sample_input": "6\n9 1 4 4 6 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02989", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2032, "cpu_time_ms": 36, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s568134727", "group_id": "codeNet:p02989", "input_text": "program main\nimplicit none\ncharacter*16 :: a\ninteger :: n,i,j,x,y,z,m\ninteger,allocatable :: p(:)\n\nread(*,*)n\nallocate(p(n))\nread(*, *)(p(i), i = 1,n)\ncall quicksort(p,1,n)\n\nz=0\n\nz = p(n/2+1) - p(n/2)\n\nwrite(*,*) z\n\ncontains \n\nrecursive subroutine quicksort(a, first, last)\n implicit none\n integer a(*)\n integer first, last\n integer i, j\n real*8 x, t\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i); a(i) = a(j); a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort(a, first, i - 1)\n if (j + 1 < last) call quicksort(a, j + 1, last)\nend subroutine quicksort\nend program main", "language": "Fortran", "metadata": {"date": 1561861440, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02989.html", "problem_id": "p02989", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02989/input.txt", "sample_output_relpath": "derived/input_output/data/p02989/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02989/Fortran/s568134727.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s568134727", "user_id": "u850779832"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\nimplicit none\ncharacter*16 :: a\ninteger :: n,i,j,x,y,z,m\ninteger,allocatable :: p(:)\n\nread(*,*)n\nallocate(p(n))\nread(*, *)(p(i), i = 1,n)\ncall quicksort(p,1,n)\n\nz=0\n\nz = p(n/2+1) - p(n/2)\n\nwrite(*,*) z\n\ncontains \n\nrecursive subroutine quicksort(a, first, last)\n implicit none\n integer a(*)\n integer first, last\n integer i, j\n real*8 x, t\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i); a(i) = a(j); a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort(a, first, i - 1)\n if (j + 1 < last) call quicksort(a, j + 1, last)\nend subroutine quicksort\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "sample_input": "6\n9 1 4 4 6 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02989", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi made N problems for competitive programming.\nThe problems are numbered 1 to N, and the difficulty of Problem i is represented as an integer d_i (the higher, the harder).\n\nHe is dividing the problems into two categories by choosing an integer K, as follows:\n\nA problem with difficulty K or higher will be for ARCs.\n\nA problem with difficulty lower than K will be for ABCs.\n\nHow many choices of the integer K make the number of problems for ARCs and the number of problems for ABCs the same?\n\nProblem Statement\n\n2 \\leq N \\leq 10^5\n\nN is an even number.\n\n1 \\leq d_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1 d_2 ... d_N\n\nOutput\n\nPrint the number of choices of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 1\n\n6\n9 1 4 4 6 7\n\nSample Output 1\n\n2\n\nIf we choose K=5 or 6, Problem 1, 5, and 6 will be for ARCs, Problem 2, 3, and 4 will be for ABCs, and the objective is achieved.\nThus, the answer is 2.\n\nSample Input 2\n\n8\n9 1 14 5 5 4 4 14\n\nSample Output 2\n\n0\n\nThere may be no choice of the integer K that make the number of problems for ARCs and the number of problems for ABCs the same.\n\nSample Input 3\n\n14\n99592 10342 29105 78532 83018 11639 92015 77204 30914 21912 34519 80835 100000 1\n\nSample Output 3\n\n42685", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 757, "cpu_time_ms": 35, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s873152233", "group_id": "codeNet:p02989", "input_text": "program main\n\timplicit none\n integer::N,i,ans,r,b,k\n integer, allocatable :: a(:)\n read(*,*) N\n allocate(a(N))\n read(*, *)(a(i), i = 1,N)\n ans=0\n\tr=0\n b=0\n k=1\n do while(r>=b)\n\t\tr=0\n b=0\n \tdo i=1,N\n \tif(a(i)=b)\n\t\tr=0\n b=0\n \tdo i=1,N\n \tif(a(i)=0 .and. minval1<=0) then\n \twrite(*,*) sum1\n else if (minval1>0) then\n \twrite(*,*) sum1-minval1\n else\n \twrite(*,*) sum1-maxval1\n end if\n \n deallocate(a)\n \n stop\nend program sample", "language": "Fortran", "metadata": {"date": 1590371197, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02994.html", "problem_id": "p02994", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02994/input.txt", "sample_output_relpath": "derived/input_output/data/p02994/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02994/Fortran/s930898641.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s930898641", "user_id": "u323210830"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "program sample\n\timplicit none\n integer :: x,y,i,sum1,maxval1,minval1\n integer, allocatable :: a(:)\n \n read(*,*) x,y\n \n allocate(a(x))\n \n do i=1,x\n a(i)=y+i-1\n end do\n \n write(*,*) a\n \n sum1=sum(a)\n maxval1=maxval(a)\n\tminval1=minval(a)\n \n if (maxval1 >=0 .and. minval1<=0) then\n \twrite(*,*) sum1\n else if (minval1>0) then\n \twrite(*,*) sum1-minval1\n else\n \twrite(*,*) sum1-maxval1\n end if\n \n deallocate(a)\n \n stop\nend program sample", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "sample_input": "5 2\n"}, "reference_outputs": ["18\n"], "source_document_id": "p02994", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 514, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s815141676", "group_id": "codeNet:p02994", "input_text": "program BiiteEating\n implicit none\n integer(4)::n, l, i\n integer(4),allocatable:: t(:)\n\n read*, n,l\n\n allocate(t(n))\n\n do i=1,n\n t(i) = l+i-1\n end do\n\n if (t(1) < 0 .and. t(n) > 0) then\n print'(i0)', sum(t)\n else if (t(1) > 0) then\n print'(i0)', sum(t) - t(1)\n else\n print'(i0)', sum(t) - t(n)\n end if\n\nend program BiiteEating", "language": "Fortran", "metadata": {"date": 1585149432, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02994.html", "problem_id": "p02994", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02994/input.txt", "sample_output_relpath": "derived/input_output/data/p02994/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02994/Fortran/s815141676.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s815141676", "user_id": "u234636620"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "program BiiteEating\n implicit none\n integer(4)::n, l, i\n integer(4),allocatable:: t(:)\n\n read*, n,l\n\n allocate(t(n))\n\n do i=1,n\n t(i) = l+i-1\n end do\n\n if (t(1) < 0 .and. t(n) > 0) then\n print'(i0)', sum(t)\n else if (t(1) > 0) then\n print'(i0)', sum(t) - t(1)\n else\n print'(i0)', sum(t) - t(n)\n end if\n\nend program BiiteEating", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "sample_input": "5 2\n"}, "reference_outputs": ["18\n"], "source_document_id": "p02994", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 387, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s756882461", "group_id": "codeNet:p02994", "input_text": "program pie\n implicit none\n integer ::N,L,ful,kake,i,sa\n integer :: tabe\n\n read(*,*) N,L\n ful=L*N+N*(N-1)/2\n sa=abs(L*N)\n do i=1,N\n kake=ful-L-(i-1)\n if(abs(kake-ful).lt.sa) then\n sa=abs(kake-ful)\n tabe=kake\n endif\n enddo\n write(*,'(i0)') tabe\n\nend program pie\n", "language": "Fortran", "metadata": {"date": 1561252406, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02994.html", "problem_id": "p02994", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02994/input.txt", "sample_output_relpath": "derived/input_output/data/p02994/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02994/Fortran/s756882461.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s756882461", "user_id": "u613124399"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "program pie\n implicit none\n integer ::N,L,ful,kake,i,sa\n integer :: tabe\n\n read(*,*) N,L\n ful=L*N+N*(N-1)/2\n sa=abs(L*N)\n do i=1,N\n kake=ful-L-(i-1)\n if(abs(kake-ful).lt.sa) then\n sa=abs(kake-ful)\n tabe=kake\n endif\n enddo\n write(*,'(i0)') tabe\n\nend program pie\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "sample_input": "5 2\n"}, "reference_outputs": ["18\n"], "source_document_id": "p02994", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have N apples, called Apple 1, Apple 2, Apple 3, ..., Apple N. The flavor of Apple i is L+i-1, which can be negative.\n\nYou can make an apple pie using one or more of the apples. The flavor of the apple pie will be the sum of the flavors of the apples used.\n\nYou planned to make an apple pie using all of the apples, but being hungry tempts you to eat one of them, which can no longer be used to make the apple pie.\n\nYou want to make an apple pie that is as similar as possible to the one that you planned to make. Thus, you will choose the apple to eat so that the flavor of the apple pie made of the remaining N-1 apples will have the smallest possible absolute difference from the flavor of the apple pie made of all the N apples.\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you choose the apple to eat as above.\n\nWe can prove that this value is uniquely determined.\n\nConstraints\n\n2 \\leq N \\leq 200\n\n-100 \\leq L \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN L\n\nOutput\n\nFind the flavor of the apple pie made of the remaining N-1 apples when you optimally choose the apple to eat.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n18\n\nThe flavors of Apple 1, 2, 3, 4, and 5 are 2, 3, 4, 5, and 6, respectively. The optimal choice is to eat Apple 1, so the answer is 3+4+5+6=18.\n\nSample Input 2\n\n3 -1\n\nSample Output 2\n\n0\n\nThe flavors of Apple 1, 2, and 3 are -1, 0, and 1, respectively. The optimal choice is to eat Apple 2, so the answer is (-1)+1=0.\n\nSample Input 3\n\n30 -50\n\nSample Output 3\n\n-1044", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 296, "cpu_time_ms": 5, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s731426414", "group_id": "codeNet:p02995", "input_text": "program ccc\n\nimplicit none\ninteger(8) :: a, b, c, d, cd, ans\n\nread*, a, b, c, d\ncall lcm(c,d,cd)\n\nans=b/c+b/d-b/cd\nans=ans-(a-1)/c-(a-1)/d+(a-1)/cd\nans=(b-a+1)-ans\nwrite(*,'(i0)') ans\nend program\n\nsubroutine lcm(a,b,res)\ninteger(8) :: aa, bb, a, b, dumy, i, m, res\n\naa=a\nbb=b\n\nif(a b(i)) then\n print'(a)','No'\n stop\n else\n time=time+a(i)\n end if\n end do\n print'(a)', 'Yes'\ncontains\n recursive subroutine double_sort(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap(ar1(fst), ar1(lst))\n call swap(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call double_sort(ar1,ar2,fst,mdl)\n call double_sort(ar1,ar2,mdl+1,lst)\n call double_merge_(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine double_merge_(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n \n subroutine swap(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\nend program name", "language": "Fortran", "metadata": {"date": 1587125697, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02996.html", "problem_id": "p02996", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02996/input.txt", "sample_output_relpath": "derived/input_output/data/p02996/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02996/Fortran/s451950390.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s451950390", "user_id": "u234636620"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,i,time=0\n integer(int32), allocatable:: a(:),b(:)\n\n read*, n\n allocate(a(n),b(n))\n do i = 1, n\n read*, a(i),b(i)\n end do\n call double_sort(b,a,1,n)\n\n do i=1,n\n if (time+a(i) > b(i)) then\n print'(a)','No'\n stop\n else\n time=time+a(i)\n end if\n end do\n print'(a)', 'Yes'\ncontains\n recursive subroutine double_sort(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap(ar1(fst), ar1(lst))\n call swap(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call double_sort(ar1,ar2,fst,mdl)\n call double_sort(ar1,ar2,mdl+1,lst)\n call double_merge_(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine double_merge_(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n \n subroutine swap(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\nend program name", "problem_context": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "sample_input": "5\n2 4\n1 9\n1 8\n4 9\n3 12\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02996", "source_text": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2189, "cpu_time_ms": 173, "memory_kb": 3544}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s241536462", "group_id": "codeNet:p02996", "input_text": "program main\nimplicit none\ninteger :: n\ninteger , allocatable :: a(:), b(:)\ninteger :: i, j, s\n\nread(*,*) n\nallocate( a(n) )\nallocate( b(n) )\ndo i = 1, n\n read(*,*) a(i), b(i)\nend do\ncall quicksort2(n, b, a, 1, n)\ns = 0.\ndo i = 1, n\n s = s + a(i)\n if(s .gt. b(i) ) then\n write(*,*) 'No'\n stop\n end if\nend do\nwrite(*,*) 'Yes'\n\nstop\ncontains\n\nrecursive subroutine quicksort2(n, a, b, first, last)\n implicit none\n integer :: a(n), b(n)\n integer :: first, last\n integer :: i, j, n\n integer :: x, y, t, s\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i)\n a(i) = a(j)\n a(j) = t\n s = b(i)\n b(i) = b(j)\n b(j) = s\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort2(n, a, b, first, i - 1)\n if (j + 1 < last) call quicksort2(n, a, b, j + 1, last)\nend subroutine quicksort2\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1565461980, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02996.html", "problem_id": "p02996", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02996/input.txt", "sample_output_relpath": "derived/input_output/data/p02996/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02996/Fortran/s241536462.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s241536462", "user_id": "u696547932"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: n\ninteger , allocatable :: a(:), b(:)\ninteger :: i, j, s\n\nread(*,*) n\nallocate( a(n) )\nallocate( b(n) )\ndo i = 1, n\n read(*,*) a(i), b(i)\nend do\ncall quicksort2(n, b, a, 1, n)\ns = 0.\ndo i = 1, n\n s = s + a(i)\n if(s .gt. b(i) ) then\n write(*,*) 'No'\n stop\n end if\nend do\nwrite(*,*) 'Yes'\n\nstop\ncontains\n\nrecursive subroutine quicksort2(n, a, b, first, last)\n implicit none\n integer :: a(n), b(n)\n integer :: first, last\n integer :: i, j, n\n integer :: x, y, t, s\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i)\n a(i) = a(j)\n a(j) = t\n s = b(i)\n b(i) = b(j)\n b(j) = s\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort2(n, a, b, first, i - 1)\n if (j + 1 < last) call quicksort2(n, a, b, j + 1, last)\nend subroutine quicksort2\n\nend program main\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "sample_input": "5\n2 4\n1 9\n1 8\n4 9\n3 12\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02996", "source_text": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 985, "cpu_time_ms": 146, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s258263508", "group_id": "codeNet:p02996", "input_text": "program main\nimplicit none\ninteger :: n\ninteger , allocatable :: a(:), b(:)\ninteger :: i, j\n\nread(*,*) n\nallocate( a(n) )\nallocate( b(n) )\ndo i = 1, n\n read(*,*) a(i), b(i)\nend do\ncall heapsort(n, b, a)\ndo i = 1, n\n if(sum(a(1:i)) .gt. b(i) ) then\n write(*,*) 'No'\n stop\n end if\nend do\nwrite(*,*) 'Yes'\n\nstop\ncontains\nsubroutine heapsort(n,aa,bb)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: aa(n), bb(n)\n integer ::i,k,j,l\n integer :: t, s\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=aa(L)\n s =bb(l)\n else\n t=aa(k)\n aa(k) =aa(1)\n s = bb(k)\n bb(k) = bb(1)\n k=k-1\n if(k.eq.1) then\n aa(1) = t\n bb(1) = s\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(aa(j).lt.aa(j+1))j=j+1\n end if\n if (t.lt.aa(j))then\n aa(i)=aa(j)\n bb(i)=bb(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n aa(i)=t\n bb(i)=s\n end do\nend subroutine heapsort\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1561233359, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02996.html", "problem_id": "p02996", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02996/input.txt", "sample_output_relpath": "derived/input_output/data/p02996/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02996/Fortran/s258263508.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s258263508", "user_id": "u696547932"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: n\ninteger , allocatable :: a(:), b(:)\ninteger :: i, j\n\nread(*,*) n\nallocate( a(n) )\nallocate( b(n) )\ndo i = 1, n\n read(*,*) a(i), b(i)\nend do\ncall heapsort(n, b, a)\ndo i = 1, n\n if(sum(a(1:i)) .gt. b(i) ) then\n write(*,*) 'No'\n stop\n end if\nend do\nwrite(*,*) 'Yes'\n\nstop\ncontains\nsubroutine heapsort(n,aa,bb)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: aa(n), bb(n)\n integer ::i,k,j,l\n integer :: t, s\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=aa(L)\n s =bb(l)\n else\n t=aa(k)\n aa(k) =aa(1)\n s = bb(k)\n bb(k) = bb(1)\n k=k-1\n if(k.eq.1) then\n aa(1) = t\n bb(1) = s\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(aa(j).lt.aa(j+1))j=j+1\n end if\n if (t.lt.aa(j))then\n aa(i)=aa(j)\n bb(i)=bb(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n aa(i)=t\n bb(i)=s\n end do\nend subroutine heapsort\n\nend program main\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "sample_input": "5\n2 4\n1 9\n1 8\n4 9\n3 12\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02996", "source_text": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1153, "cpu_time_ms": 2103, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s859227253", "group_id": "codeNet:p02996", "input_text": "program main\nimplicit none\ninteger :: n\ninteger , allocatable :: a(:), b(:), c(:), d(:)\ninteger :: i, j\n\nread(*,*) n\nallocate( a(n) )\nallocate( b(n) )\nallocate( c(n) )\nallocate( d(n) )\ndo i = 1, n\n read(*,*) a(i), b(i)\nend do\ncall bubble(n, b, a, d, c)\ndo i = 1, n\n\n j = n+1-i\n if( sum(c(1:j)) .gt. d(j))then\n write(*,*) 'No'\n stop\n end if\nend do\nwrite(*,*) 'Yes'\nstop\ncontains\n subroutine bubble(n,a,b,aa,bb)\n implicit none\n integer , intent(in) :: n, a(n), b(n)\n integer , intent(out) :: aa(n), bb(n)\n integer :: i, j\n integer :: t, s\n\n aa = a\n bb = b\n do i = 1, n-1\n do j = i+1 , n\n if(aa(i).gt.aa(j))then\n t = aa(i)\n aa(i) = aa(j)\n aa(j) = t\n s = bb(i)\n bb(i) = bb(j)\n bb(j) = s\n end if\n end do\n end do\n end subroutine bubble\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1561232434, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02996.html", "problem_id": "p02996", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02996/input.txt", "sample_output_relpath": "derived/input_output/data/p02996/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02996/Fortran/s859227253.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s859227253", "user_id": "u696547932"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: n\ninteger , allocatable :: a(:), b(:), c(:), d(:)\ninteger :: i, j\n\nread(*,*) n\nallocate( a(n) )\nallocate( b(n) )\nallocate( c(n) )\nallocate( d(n) )\ndo i = 1, n\n read(*,*) a(i), b(i)\nend do\ncall bubble(n, b, a, d, c)\ndo i = 1, n\n\n j = n+1-i\n if( sum(c(1:j)) .gt. d(j))then\n write(*,*) 'No'\n stop\n end if\nend do\nwrite(*,*) 'Yes'\nstop\ncontains\n subroutine bubble(n,a,b,aa,bb)\n implicit none\n integer , intent(in) :: n, a(n), b(n)\n integer , intent(out) :: aa(n), bb(n)\n integer :: i, j\n integer :: t, s\n\n aa = a\n bb = b\n do i = 1, n-1\n do j = i+1 , n\n if(aa(i).gt.aa(j))then\n t = aa(i)\n aa(i) = aa(j)\n aa(j) = t\n s = bb(i)\n bb(i) = bb(j)\n bb(j) = s\n end if\n end do\n end do\n end subroutine bubble\n\nend program main\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "sample_input": "5\n2 4\n1 9\n1 8\n4 9\n3 12\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02996", "source_text": "Score: 400 points\n\nProblem Statement\n\nKizahashi, who was appointed as the administrator of ABC at National Problem Workshop in the Kingdom of AtCoder, got too excited and took on too many jobs.\n\nLet the current time be time 0. Kizahashi has N jobs numbered 1 to N.\n\nIt takes A_i units of time for Kizahashi to complete Job i. The deadline for Job i is time B_i, and he must complete the job before or at this time.\n\nKizahashi cannot work on two or more jobs simultaneously, but when he completes a job, he can start working on another immediately.\n\nCan Kizahashi complete all the jobs in time? If he can, print Yes; if he cannot, print No.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i, B_i \\leq 10^9 (1 \\leq i \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n.\n.\n.\nA_N B_N\n\nOutput\n\nIf Kizahashi can complete all the jobs in time, print Yes; if he cannot, print No.\n\nSample Input 1\n\n5\n2 4\n1 9\n1 8\n4 9\n3 12\n\nSample Output 1\n\nYes\n\nHe can complete all the jobs in time by, for example, doing them in the following order:\n\nDo Job 2 from time 0 to 1.\n\nDo Job 1 from time 1 to 3.\n\nDo Job 4 from time 3 to 7.\n\nDo Job 3 from time 7 to 8.\n\nDo Job 5 from time 8 to 11.\n\nNote that it is fine to complete Job 3 exactly at the deadline, time 8.\n\nSample Input 2\n\n3\n334 1000\n334 1000\n334 1000\n\nSample Output 2\n\nNo\n\nHe cannot complete all the jobs in time, no matter what order he does them in.\n\nSample Input 3\n\n30\n384 8895\n1725 9791\n170 1024\n4 11105\n2 6\n578 1815\n702 3352\n143 5141\n1420 6980\n24 1602\n849 999\n76 7586\n85 5570\n444 4991\n719 11090\n470 10708\n1137 4547\n455 9003\n110 9901\n15 8578\n368 3692\n104 1286\n3 4\n366 12143\n7 6649\n610 2374\n152 7324\n4 7042\n292 11386\n334 5720\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 897, "cpu_time_ms": 2103, "memory_kb": 3328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s903911220", "group_id": "codeNet:p02997", "input_text": "integer N,K\ninteger cnt\nread*,N,K\nif(K>(N-1)*(N-2)/2)then\n print\"(i0)\",-1\n stop\nendif\n\nprint\"(i0)\",(N-1) +((N-1)*(N-2)/2 - K)\ndo i=1,n-1\n print\"(i0,A,i0)\",i,\" \",N\nend do\n\ncnt=0\ndo i=1,n-2\n do j=i+1,n-1\n print\"(i0,A,i0)\",i,\" \",j\n cnt=cnt+1\n if( cnt==(N-1)*(N-2)/2 -K )then\n stop\n end if\n end do\nend do\nend", "language": "Fortran", "metadata": {"date": 1561234259, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02997.html", "problem_id": "p02997", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02997/input.txt", "sample_output_relpath": "derived/input_output/data/p02997/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02997/Fortran/s903911220.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s903911220", "user_id": "u598073939"}, "prompt_components": {"gold_output": "5\n4 3\n1 2\n3 1\n4 5\n2 3\n", "input_to_evaluate": "integer N,K\ninteger cnt\nread*,N,K\nif(K>(N-1)*(N-2)/2)then\n print\"(i0)\",-1\n stop\nendif\n\nprint\"(i0)\",(N-1) +((N-1)*(N-2)/2 - K)\ndo i=1,n-1\n print\"(i0,A,i0)\",i,\" \",N\nend do\n\ncnt=0\ndo i=1,n-2\n do j=i+1,n-1\n print\"(i0,A,i0)\",i,\" \",j\n cnt=cnt+1\n if( cnt==(N-1)*(N-2)/2 -K )then\n stop\n end if\n end do\nend do\nend", "problem_context": "Score: 500 points\n\nProblem Statement\n\nDoes there exist an undirected graph with N vertices satisfying the following conditions?\n\nThe graph is simple and connected.\n\nThe vertices are numbered 1, 2, ..., N.\n\nLet M be the number of edges in the graph. The edges are numbered 1, 2, ..., M, the length of each edge is 1, and Edge i connects Vertex u_i and Vertex v_i.\n\nThere are exactly K pairs of vertices (i,\\ j)\\ (i < j) such that the shortest distance between them is 2.\n\nIf there exists such a graph, construct an example.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n0 \\leq K \\leq \\frac{N(N - 1)}{2}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nIf there does not exist an undirected graph with N vertices satisfying the conditions, print -1.\n\nIf there exists such a graph, print an example in the following format (refer to Problem Statement for what the symbols stand for):\n\nM\nu_1 v_1\n:\nu_M v_M\n\nIf there exist multiple graphs satisfying the conditions, any of them will be accepted.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n5\n4 3\n1 2\n3 1\n4 5\n2 3\n\nThis graph has three pairs of vertices such that the shortest distance between them is 2: (1,\\ 4), (2,\\ 4), and (3,\\ 5). Thus, the condition is satisfied.\n\nSample Input 2\n\n5 8\n\nSample Output 2\n\n-1\n\nThere is no graph satisfying the conditions.", "sample_input": "5 3\n"}, "reference_outputs": ["5\n4 3\n1 2\n3 1\n4 5\n2 3\n"], "source_document_id": "p02997", "source_text": "Score: 500 points\n\nProblem Statement\n\nDoes there exist an undirected graph with N vertices satisfying the following conditions?\n\nThe graph is simple and connected.\n\nThe vertices are numbered 1, 2, ..., N.\n\nLet M be the number of edges in the graph. The edges are numbered 1, 2, ..., M, the length of each edge is 1, and Edge i connects Vertex u_i and Vertex v_i.\n\nThere are exactly K pairs of vertices (i,\\ j)\\ (i < j) such that the shortest distance between them is 2.\n\nIf there exists such a graph, construct an example.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n0 \\leq K \\leq \\frac{N(N - 1)}{2}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nIf there does not exist an undirected graph with N vertices satisfying the conditions, print -1.\n\nIf there exists such a graph, print an example in the following format (refer to Problem Statement for what the symbols stand for):\n\nM\nu_1 v_1\n:\nu_M v_M\n\nIf there exist multiple graphs satisfying the conditions, any of them will be accepted.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n5\n4 3\n1 2\n3 1\n4 5\n2 3\n\nThis graph has three pairs of vertices such that the shortest distance between them is 2: (1,\\ 4), (2,\\ 4), and (3,\\ 5). Thus, the condition is satisfied.\n\nSample Input 2\n\n5 8\n\nSample Output 2\n\n-1\n\nThere is no graph satisfying the conditions.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 326, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s014111778", "group_id": "codeNet:p02998", "input_text": "module mod_t_item\n implicit none\n type :: t_item\n integer :: pos\n end type t_item\n private\n public :: t_item, itemize\ncontains\n function itemize(pos) result(i)\n implicit none\n integer :: pos\n type(t_item) :: i\n i%pos = pos\n return\n end function itemize\nend module mod_t_item\nmodule mod_t_list\n use mod_t_item\n implicit none\n type :: t_list\n integer :: vol\n type(t_item), pointer :: arr(:)\n end type t_list\n private\n public :: t_list, init_list, release_list, push_back\n public :: pop_back, get_at, size_of_list\ncontains\n subroutine init_list(list)\n implicit none\n type(t_list), intent(inout) :: list\n allocate(list%arr(1))\n list%vol = 0\n return\n end subroutine init_list\n subroutine release_list(list)\n implicit none\n type(t_list), intent(inout) :: list\n if (associated(list%arr)) deallocate(list%arr)\n return\n end subroutine release_list\n subroutine push_back(list,item)\n implicit none\n type(t_list), intent(inout) :: list\n type(t_item), intent(in) :: item\n type(t_item), allocatable :: tmp(:)\n if (size(list%arr).eq.list%vol) then\n allocate(tmp(list%vol))\n tmp = list%arr\n deallocate(list%arr)\n allocate(list%arr(2*list%vol))\n list%arr(1:list%vol) = tmp\n deallocate(tmp)\n end if\n list%vol = list%vol+1\n list%arr(list%vol) = item\n return\n end subroutine push_back\n function pop_back(list) result(item)\n implicit none\n type(t_list), intent(inout) :: list\n type(t_item) :: item\n item = list%arr(list%vol)\n list%vol = list%vol-1\n return\n end function pop_back\n function get_at(list,i) result(item)\n implicit none\n type(t_list), intent(in) :: list\n integer, intent(in) :: i\n type(t_item) :: item\n item = list%arr(i)\n return\n end function get_at\n function size_of_list(list) result(s)\n implicit none\n type(t_list), intent(in) :: list\n integer :: s\n s = list%vol\n return\n end function size_of_list\nend module mod_t_list\nmodule mod_t_graph\n use mod_t_item\n use mod_t_list\n implicit none\n logical, allocatable :: used(:)\n type :: t_graph\n type(t_list), pointer :: edges(:)\n end type t_graph\n private\n public :: used\n public :: t_graph, init_graph, release_graph, add_edge, add, dfs\ncontains\n subroutine init_graph(graph,n)\n implicit none\n type(t_graph), intent(inout) :: graph\n integer, intent(in) :: n\n integer :: i\n allocate(used(n))\n used = .false.\n allocate(graph%edges(n))\n do i = 1, n\n call init_list(graph%edges(i))\n end do\n return\n end subroutine init_graph\n subroutine release_graph(graph)\n implicit none\n type(t_graph), intent(inout) :: graph\n integer :: n, i\n deallocate(used)\n n = size(graph%edges)\n do i = 1, n\n call release_list(graph%edges(i))\n end do\n deallocate(graph%edges)\n return\n end subroutine release_graph\n subroutine add_edge(graph,i,edge)\n implicit none\n type(t_graph), intent(inout) :: graph\n type(t_item), intent(in) :: edge\n integer, intent(in) :: i\n call push_back(graph%edges(i),edge)\n return\n end subroutine add_edge\n subroutine add(graph,i,pos)\n implicit none\n type(t_graph), intent(inout) :: graph\n integer, intent(in) :: i, pos\n call push_back(graph%edges(i),itemize(pos))\n return\n end subroutine add\n recursive subroutine dfs(graph,v,x,y)\n implicit none\n type(t_graph), intent(inout) :: graph\n type(t_item) :: e\n integer :: v, x, y, l, i\n if (used(v)) return\n used(v) = .true.\n if (v.gt.100000) then\n y = y+1\n else\n x = x+1\n end if\n l = size_of_list(graph%edges(v))\n if (l.eq.0) return\n do i = 1, l\n e = get_at(graph%edges(v),i)\n call dfs(graph,e%pos,x,y)\n end do\n return\n end subroutine dfs\nend module mod_t_graph\nprogram must_be_rectangular\n use mod_t_graph\n implicit none\n type(t_graph) :: graph\n integer :: n, x, y, i\n integer(8) :: m\n call init_graph(graph,200000)\n read(*,*) n\n do i = 1, n\n read(*,*) x, y\n call add(graph,x,100000+y)\n call add(graph,100000+y,x)\n end do\n m = 0_8\n do i = 1, 200000\n if (used(i)) cycle\n x = 0\n y = 0\n call dfs(graph,i,x,y)\n m = m+int(x,8)*int(y,8)\n end do\n write(*,'(i0)') m-int(n,8)\n call release_graph(graph)\n stop\nend program must_be_rectangular", "language": "Fortran", "metadata": {"date": 1561243945, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02998.html", "problem_id": "p02998", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02998/input.txt", "sample_output_relpath": "derived/input_output/data/p02998/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02998/Fortran/s014111778.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s014111778", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module mod_t_item\n implicit none\n type :: t_item\n integer :: pos\n end type t_item\n private\n public :: t_item, itemize\ncontains\n function itemize(pos) result(i)\n implicit none\n integer :: pos\n type(t_item) :: i\n i%pos = pos\n return\n end function itemize\nend module mod_t_item\nmodule mod_t_list\n use mod_t_item\n implicit none\n type :: t_list\n integer :: vol\n type(t_item), pointer :: arr(:)\n end type t_list\n private\n public :: t_list, init_list, release_list, push_back\n public :: pop_back, get_at, size_of_list\ncontains\n subroutine init_list(list)\n implicit none\n type(t_list), intent(inout) :: list\n allocate(list%arr(1))\n list%vol = 0\n return\n end subroutine init_list\n subroutine release_list(list)\n implicit none\n type(t_list), intent(inout) :: list\n if (associated(list%arr)) deallocate(list%arr)\n return\n end subroutine release_list\n subroutine push_back(list,item)\n implicit none\n type(t_list), intent(inout) :: list\n type(t_item), intent(in) :: item\n type(t_item), allocatable :: tmp(:)\n if (size(list%arr).eq.list%vol) then\n allocate(tmp(list%vol))\n tmp = list%arr\n deallocate(list%arr)\n allocate(list%arr(2*list%vol))\n list%arr(1:list%vol) = tmp\n deallocate(tmp)\n end if\n list%vol = list%vol+1\n list%arr(list%vol) = item\n return\n end subroutine push_back\n function pop_back(list) result(item)\n implicit none\n type(t_list), intent(inout) :: list\n type(t_item) :: item\n item = list%arr(list%vol)\n list%vol = list%vol-1\n return\n end function pop_back\n function get_at(list,i) result(item)\n implicit none\n type(t_list), intent(in) :: list\n integer, intent(in) :: i\n type(t_item) :: item\n item = list%arr(i)\n return\n end function get_at\n function size_of_list(list) result(s)\n implicit none\n type(t_list), intent(in) :: list\n integer :: s\n s = list%vol\n return\n end function size_of_list\nend module mod_t_list\nmodule mod_t_graph\n use mod_t_item\n use mod_t_list\n implicit none\n logical, allocatable :: used(:)\n type :: t_graph\n type(t_list), pointer :: edges(:)\n end type t_graph\n private\n public :: used\n public :: t_graph, init_graph, release_graph, add_edge, add, dfs\ncontains\n subroutine init_graph(graph,n)\n implicit none\n type(t_graph), intent(inout) :: graph\n integer, intent(in) :: n\n integer :: i\n allocate(used(n))\n used = .false.\n allocate(graph%edges(n))\n do i = 1, n\n call init_list(graph%edges(i))\n end do\n return\n end subroutine init_graph\n subroutine release_graph(graph)\n implicit none\n type(t_graph), intent(inout) :: graph\n integer :: n, i\n deallocate(used)\n n = size(graph%edges)\n do i = 1, n\n call release_list(graph%edges(i))\n end do\n deallocate(graph%edges)\n return\n end subroutine release_graph\n subroutine add_edge(graph,i,edge)\n implicit none\n type(t_graph), intent(inout) :: graph\n type(t_item), intent(in) :: edge\n integer, intent(in) :: i\n call push_back(graph%edges(i),edge)\n return\n end subroutine add_edge\n subroutine add(graph,i,pos)\n implicit none\n type(t_graph), intent(inout) :: graph\n integer, intent(in) :: i, pos\n call push_back(graph%edges(i),itemize(pos))\n return\n end subroutine add\n recursive subroutine dfs(graph,v,x,y)\n implicit none\n type(t_graph), intent(inout) :: graph\n type(t_item) :: e\n integer :: v, x, y, l, i\n if (used(v)) return\n used(v) = .true.\n if (v.gt.100000) then\n y = y+1\n else\n x = x+1\n end if\n l = size_of_list(graph%edges(v))\n if (l.eq.0) return\n do i = 1, l\n e = get_at(graph%edges(v),i)\n call dfs(graph,e%pos,x,y)\n end do\n return\n end subroutine dfs\nend module mod_t_graph\nprogram must_be_rectangular\n use mod_t_graph\n implicit none\n type(t_graph) :: graph\n integer :: n, x, y, i\n integer(8) :: m\n call init_graph(graph,200000)\n read(*,*) n\n do i = 1, n\n read(*,*) x, y\n call add(graph,x,100000+y)\n call add(graph,100000+y,x)\n end do\n m = 0_8\n do i = 1, 200000\n if (used(i)) cycle\n x = 0\n y = 0\n call dfs(graph,i,x,y)\n m = m+int(x,8)*int(y,8)\n end do\n write(*,'(i0)') m-int(n,8)\n call release_graph(graph)\n stop\nend program must_be_rectangular", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere are N dots in a two-dimensional plane. The coordinates of the i-th dot are (x_i, y_i).\n\nWe will repeat the following operation as long as possible:\n\nChoose four integers a, b, c, d (a \\neq c, b \\neq d) such that there are dots at exactly three of the positions (a, b), (a, d), (c, b) and (c, d), and add a dot at the remaining position.\n\nWe can prove that we can only do this operation a finite number of times. Find the maximum number of times we can do the operation.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq x_i, y_i \\leq 10^5\n\nIf i \\neq j, x_i \\neq x_j or y_i \\neq y_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the maximum number of times we can do the operation.\n\nSample Input 1\n\n3\n1 1\n5 1\n5 5\n\nSample Output 1\n\n1\n\nBy choosing a = 1, b = 1, c = 5, d = 5, we can add a dot at (1, 5). We cannot do the operation any more, so the maximum number of operations is 1.\n\nSample Input 2\n\n2\n10 10\n20 20\n\nSample Output 2\n\n0\n\nThere are only two dots, so we cannot do the operation at all.\n\nSample Input 3\n\n9\n1 1\n2 1\n3 1\n4 1\n5 1\n1 2\n1 3\n1 4\n1 5\n\nSample Output 3\n\n16\n\nWe can do the operation for all choices of the form a = 1, b = 1, c = i, d = j (2 \\leq i,j \\leq 5), and no more. Thus, the maximum number of operations is 16.", "sample_input": "3\n1 1\n5 1\n5 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02998", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere are N dots in a two-dimensional plane. The coordinates of the i-th dot are (x_i, y_i).\n\nWe will repeat the following operation as long as possible:\n\nChoose four integers a, b, c, d (a \\neq c, b \\neq d) such that there are dots at exactly three of the positions (a, b), (a, d), (c, b) and (c, d), and add a dot at the remaining position.\n\nWe can prove that we can only do this operation a finite number of times. Find the maximum number of times we can do the operation.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq x_i, y_i \\leq 10^5\n\nIf i \\neq j, x_i \\neq x_j or y_i \\neq y_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the maximum number of times we can do the operation.\n\nSample Input 1\n\n3\n1 1\n5 1\n5 5\n\nSample Output 1\n\n1\n\nBy choosing a = 1, b = 1, c = 5, d = 5, we can add a dot at (1, 5). We cannot do the operation any more, so the maximum number of operations is 1.\n\nSample Input 2\n\n2\n10 10\n20 20\n\nSample Output 2\n\n0\n\nThere are only two dots, so we cannot do the operation at all.\n\nSample Input 3\n\n9\n1 1\n2 1\n3 1\n4 1\n5 1\n1 2\n1 3\n1 4\n1 5\n\nSample Output 3\n\n16\n\nWe can do the operation for all choices of the form a = 1, b = 1, c = i, d = j (2 \\leq i,j \\leq 5), and no more. Thus, the maximum number of operations is 16.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4322, "cpu_time_ms": 100, "memory_kb": 23040}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s238501617", "group_id": "codeNet:p02999", "input_text": "program main\n\timplicit none\n integer::a,b\n read(*,*)a,b\n if(a>=b)then\n \twrite(*,*) 10\n else\n \twrite(*,*) 0\n end if\n stop\nend program main\n\n", "language": "Fortran", "metadata": {"date": 1592610643, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p02999.html", "problem_id": "p02999", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02999/input.txt", "sample_output_relpath": "derived/input_output/data/p02999/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02999/Fortran/s238501617.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s238501617", "user_id": "u884601206"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program main\n\timplicit none\n integer::a,b\n read(*,*)a,b\n if(a>=b)then\n \twrite(*,*) 10\n else\n \twrite(*,*) 0\n end if\n stop\nend program main\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nX and A are integers between 0 and 9 (inclusive).\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nConstraints\n\n0 \\leq X, A \\leq 9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A\n\nOutput\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\n3 is less than 5, so we should print 0.\n\nSample Input 2\n\n7 5\n\nSample Output 2\n\n10\n\n7 is not less than 5, so we should print 10.\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n10\n\n6 is not less than 6, so we should print 10.", "sample_input": "3 5\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02999", "source_text": "Score : 100 points\n\nProblem Statement\n\nX and A are integers between 0 and 9 (inclusive).\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nConstraints\n\n0 \\leq X, A \\leq 9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A\n\nOutput\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\n3 is less than 5, so we should print 0.\n\nSample Input 2\n\n7 5\n\nSample Output 2\n\n10\n\n7 is not less than 5, so we should print 10.\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n10\n\n6 is not less than 6, so we should print 10.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 163, "cpu_time_ms": 7, "memory_kb": 2788}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s474405264", "group_id": "codeNet:p02999", "input_text": "program main\ninteger::x,a\nread*,x,a\nif(x < a) then\nprint*,'0'\nelse\nprint*,'10'\nend if\nend program main", "language": "Fortran", "metadata": {"date": 1568035813, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02999.html", "problem_id": "p02999", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02999/input.txt", "sample_output_relpath": "derived/input_output/data/p02999/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02999/Fortran/s474405264.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s474405264", "user_id": "u129978636"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program main\ninteger::x,a\nread*,x,a\nif(x < a) then\nprint*,'0'\nelse\nprint*,'10'\nend if\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nX and A are integers between 0 and 9 (inclusive).\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nConstraints\n\n0 \\leq X, A \\leq 9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A\n\nOutput\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\n3 is less than 5, so we should print 0.\n\nSample Input 2\n\n7 5\n\nSample Output 2\n\n10\n\n7 is not less than 5, so we should print 10.\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n10\n\n6 is not less than 6, so we should print 10.", "sample_input": "3 5\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02999", "source_text": "Score : 100 points\n\nProblem Statement\n\nX and A are integers between 0 and 9 (inclusive).\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nConstraints\n\n0 \\leq X, A \\leq 9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A\n\nOutput\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\n3 is less than 5, so we should print 0.\n\nSample Input 2\n\n7 5\n\nSample Output 2\n\n10\n\n7 is not less than 5, so we should print 10.\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n10\n\n6 is not less than 6, so we should print 10.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 102, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s097624600", "group_id": "codeNet:p02999", "input_text": "program ABC\n integer x, a\n read*, x, a\n if (x < a) then\n print\"(i0)\", 0\n else\n print\"(i0)\", 10\n endif\nend", "language": "Fortran", "metadata": {"date": 1561680051, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02999.html", "problem_id": "p02999", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02999/input.txt", "sample_output_relpath": "derived/input_output/data/p02999/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02999/Fortran/s097624600.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s097624600", "user_id": "u394482932"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program ABC\n integer x, a\n read*, x, a\n if (x < a) then\n print\"(i0)\", 0\n else\n print\"(i0)\", 10\n endif\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nX and A are integers between 0 and 9 (inclusive).\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nConstraints\n\n0 \\leq X, A \\leq 9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A\n\nOutput\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\n3 is less than 5, so we should print 0.\n\nSample Input 2\n\n7 5\n\nSample Output 2\n\n10\n\n7 is not less than 5, so we should print 10.\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n10\n\n6 is not less than 6, so we should print 10.", "sample_input": "3 5\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02999", "source_text": "Score : 100 points\n\nProblem Statement\n\nX and A are integers between 0 and 9 (inclusive).\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nConstraints\n\n0 \\leq X, A \\leq 9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A\n\nOutput\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\n3 is less than 5, so we should print 0.\n\nSample Input 2\n\n7 5\n\nSample Output 2\n\n10\n\n7 is not less than 5, so we should print 10.\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n10\n\n6 is not less than 6, so we should print 10.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 134, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s594318005", "group_id": "codeNet:p02999", "input_text": "program name\n implicit none\n\n integer :: x, a\n\n read *, x, a\n if(x < a) write(*, fmt='(a)') \"0\"\n if(x >= a) write(*, fmt='(a)') \"10\"\n\n stop\n\nend program name", "language": "Fortran", "metadata": {"date": 1560754747, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p02999.html", "problem_id": "p02999", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02999/input.txt", "sample_output_relpath": "derived/input_output/data/p02999/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02999/Fortran/s594318005.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s594318005", "user_id": "u485409442"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program name\n implicit none\n\n integer :: x, a\n\n read *, x, a\n if(x < a) write(*, fmt='(a)') \"0\"\n if(x >= a) write(*, fmt='(a)') \"10\"\n\n stop\n\nend program name", "problem_context": "Score : 100 points\n\nProblem Statement\n\nX and A are integers between 0 and 9 (inclusive).\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nConstraints\n\n0 \\leq X, A \\leq 9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A\n\nOutput\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\n3 is less than 5, so we should print 0.\n\nSample Input 2\n\n7 5\n\nSample Output 2\n\n10\n\n7 is not less than 5, so we should print 10.\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n10\n\n6 is not less than 6, so we should print 10.", "sample_input": "3 5\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02999", "source_text": "Score : 100 points\n\nProblem Statement\n\nX and A are integers between 0 and 9 (inclusive).\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nConstraints\n\n0 \\leq X, A \\leq 9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A\n\nOutput\n\nIf X is less than A, print 0; if X is not less than A, print 10.\n\nSample Input 1\n\n3 5\n\nSample Output 1\n\n0\n\n3 is less than 5, so we should print 0.\n\nSample Input 2\n\n7 5\n\nSample Output 2\n\n10\n\n7 is not less than 5, so we should print 10.\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n10\n\n6 is not less than 6, so we should print 10.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 175, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s723962495", "group_id": "codeNet:p03000", "input_text": "program main\n implicit none\n integer N,X,L(100),D,i\n read(*, *) N, X\n read(*, *) (L(i), i = 1,N)\n D = 0\n do i = 1,N\n D = D+L(i)\n if (D>X) then\n write(*, *) i\n exit\n else if(i == N) then\n write(*, *) i\n exit\n end if\n end do\nend program main\n", "language": "Fortran", "metadata": {"date": 1560712271, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03000.html", "problem_id": "p03000", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03000/input.txt", "sample_output_relpath": "derived/input_output/data/p03000/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03000/Fortran/s723962495.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s723962495", "user_id": "u050276949"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer N,X,L(100),D,i\n read(*, *) N, X\n read(*, *) (L(i), i = 1,N)\n D = 0\n do i = 1,N\n D = D+L(i)\n if (D>X) then\n write(*, *) i\n exit\n else if(i == N) then\n write(*, *) i\n exit\n end if\n end do\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \\leq i \\leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.\n\nHow many times will the ball make a bounce where the coordinate is at most X?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 100\n\n1 \\leq X \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nL_1 L_2 ... L_{N-1} L_N\n\nOutput\n\nPrint the number of times the ball will make a bounce where the coordinate is at most X.\n\nSample Input 1\n\n3 6\n3 4 5\n\nSample Output 1\n\n2\n\nThe ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.\n\nSample Input 2\n\n4 9\n3 3 3 3\n\nSample Output 2\n\n4\n\nThe ball will make a bounce at the coordinates 0, 3, 6, 9 and 12, among which four are less than or equal to 9.", "sample_input": "3 6\n3 4 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03000", "source_text": "Score : 200 points\n\nProblem Statement\n\nA ball will bounce along a number line, making N + 1 bounces. It will make the first bounce at coordinate D_1 = 0, and the i-th bounce (2 \\leq i \\leq N+1) at coordinate D_i = D_{i-1} + L_{i-1}.\n\nHow many times will the ball make a bounce where the coordinate is at most X?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq L_i \\leq 100\n\n1 \\leq X \\leq 10000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\nL_1 L_2 ... L_{N-1} L_N\n\nOutput\n\nPrint the number of times the ball will make a bounce where the coordinate is at most X.\n\nSample Input 1\n\n3 6\n3 4 5\n\nSample Output 1\n\n2\n\nThe ball will make a bounce at the coordinates 0, 3, 7 and 12, among which two are less than or equal to 6.\n\nSample Input 2\n\n4 9\n3 3 3 3\n\nSample Output 2\n\n4\n\nThe ball will make a bounce at the coordinates 0, 3, 6, 9 and 12, among which four are less than or equal to 9.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 279, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s606737918", "group_id": "codeNet:p03001", "input_text": "program prob5\n implicit none\n integer(16) :: W, H, x, y\n character(len=100) :: S\n read(*,*) W, H, x, y\n\n write(S,'(f44.20)') real(W, kind=16)*real(H, kind=16)/2.0_8\n\n write(*,'(a)',advance='no') trim(adjustl(S))\n\n\n if(2*x == W .and. 2*y == H) then\n write(*,*) ' 1'\n else\n write(*,*) ' 0'\n end if\n\n stop\ncontains\nend program prob5", "language": "Fortran", "metadata": {"date": 1593200517, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s606737918.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s606737918", "user_id": "u478462004"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program prob5\n implicit none\n integer(16) :: W, H, x, y\n character(len=100) :: S\n read(*,*) W, H, x, y\n\n write(S,'(f44.20)') real(W, kind=16)*real(H, kind=16)/2.0_8\n\n write(*,'(a)',advance='no') trim(adjustl(S))\n\n\n if(2*x == W .and. 2*y == H) then\n write(*,*) ' 1'\n else\n write(*,*) ' 0'\n end if\n\n stop\ncontains\nend program prob5", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 373, "cpu_time_ms": 5, "memory_kb": 2892}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s720874489", "group_id": "codeNet:p03001", "input_text": "program prob5\n implicit none\n integer(8) :: W, H, x, y\n character(len=100) :: S\n read(*,*) W, H, x, y\n\n write(S,'(f24.12)') real(W, kind=8)*real(H, kind=8)/2.0_8\n\n write(*,'(a)',advance='no') trim(adjustl(S))\n\n if(W==0 .or. H==0) then\n write(*,*) ' 0'\n stop\n end if\n if( mod(W, 2) == 0 .and. mod(H, 2) == 0 .and. x == W/2 .and. y == H/2) then\n write(*,*) ' 1'\n else\n write(*,*) ' 0'\n end if\n\n stop\ncontains\nend program prob5", "language": "Fortran", "metadata": {"date": 1593200214, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s720874489.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s720874489", "user_id": "u478462004"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program prob5\n implicit none\n integer(8) :: W, H, x, y\n character(len=100) :: S\n read(*,*) W, H, x, y\n\n write(S,'(f24.12)') real(W, kind=8)*real(H, kind=8)/2.0_8\n\n write(*,'(a)',advance='no') trim(adjustl(S))\n\n if(W==0 .or. H==0) then\n write(*,*) ' 0'\n stop\n end if\n if( mod(W, 2) == 0 .and. mod(H, 2) == 0 .and. x == W/2 .and. y == H/2) then\n write(*,*) ' 1'\n else\n write(*,*) ' 0'\n end if\n\n stop\ncontains\nend program prob5", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 488, "cpu_time_ms": 5, "memory_kb": 3032}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s986863179", "group_id": "codeNet:p03001", "input_text": "program main\n implicit none\n integer(8) :: w, h, x, y, fuku\n real(8) :: half_area\n read (*, *) w, h, x, y\n half_area = w * h * 0.5\n if (x * 2 == w .and. y * 2 == h) then\n fuku = 1\n else\n fuku = 0\n end if\n write (*, \"(f0.1, ' ', i0)\") half_area, fuku\nend program main\n", "language": "Fortran", "metadata": {"date": 1583444658, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s986863179.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s986863179", "user_id": "u388927326"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: w, h, x, y, fuku\n real(8) :: half_area\n read (*, *) w, h, x, y\n half_area = w * h * 0.5\n if (x * 2 == w .and. y * 2 == h) then\n fuku = 1\n else\n fuku = 0\n end if\n write (*, \"(f0.1, ' ', i0)\") half_area, fuku\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 282, "cpu_time_ms": 6, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s239906006", "group_id": "codeNet:p03001", "input_text": "program cut\n implicit none\n integer(8) :: w, h, x, y, s1, s2, ans, equality\n read *, w, h, x, y\n equality = 0\n s1 = minval((/x, w-x/))*h\n s2 = minval((/y, h-y/))*w \n ans = minval((/s1, s2/))\n if (s1 == s2) equality = 1 \n print '(i0,a,i0)', ans,\" \", equality\n stop\nend program cut\n", "language": "Fortran", "metadata": {"date": 1562327724, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s239906006.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s239906006", "user_id": "u121479332"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program cut\n implicit none\n integer(8) :: w, h, x, y, s1, s2, ans, equality\n read *, w, h, x, y\n equality = 0\n s1 = minval((/x, w-x/))*h\n s2 = minval((/y, h-y/))*w \n ans = minval((/s1, s2/))\n if (s1 == s2) equality = 1 \n print '(i0,a,i0)', ans,\" \", equality\n stop\nend program cut\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 290, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s820531142", "group_id": "codeNet:p03001", "input_text": "integer(8) W,H,x,y\nreal(16) ans\nread*,W,H,x,y\nans=W*H/2.0\nprint\"(f0.10,A,i0)\",ans,\" \",merge(1,0,2*x==w .and. 2*y==H)\nend\n", "language": "Fortran", "metadata": {"date": 1562060139, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s820531142.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s820531142", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "integer(8) W,H,x,y\nreal(16) ans\nread*,W,H,x,y\nans=W*H/2.0\nprint\"(f0.10,A,i0)\",ans,\" \",merge(1,0,2*x==w .and. 2*y==H)\nend\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s311868311", "group_id": "codeNet:p03001", "input_text": "program main\n implicit none\n integer :: x, y, w, h\n real :: area\n integer :: flag\n\n read(*,*) w, h, x, y\n area = w*h/2.0\n\n if (mod(w,2)/=0 .or. mod(h,2)/=0) then\n flag = 0\n else \n if (x == w/2 .and. y == h/2) then\n flag = 1\n else\n flag = 0\n endif\n endif\n\n write(*,*) area, flag\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1561274072, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s311868311.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s311868311", "user_id": "u210113718"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program main\n implicit none\n integer :: x, y, w, h\n real :: area\n integer :: flag\n\n read(*,*) w, h, x, y\n area = w*h/2.0\n\n if (mod(w,2)/=0 .or. mod(h,2)/=0) then\n flag = 0\n else \n if (x == w/2 .and. y == h/2) then\n flag = 1\n else\n flag = 0\n endif\n endif\n\n write(*,*) area, flag\n\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 329, "cpu_time_ms": 2, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s403853527", "group_id": "codeNet:p03001", "input_text": "program main\n implicit none\n integer :: x, y, w, h\n real :: area\n integer :: flag\n\n read(*,*) w, h, x, y\n area = w*h/2.0\n\n if (mod(w,2)/=0 .or. mod(h,2)/=0) then\n flag = 0\n else \n if (x == w/2 .and. y == h/2) then\n flag = 1\n else\n flag = 0\n endif\n endif\n\n write(*,*) area, flag\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1561273843, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s403853527.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s403853527", "user_id": "u210113718"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program main\n implicit none\n integer :: x, y, w, h\n real :: area\n integer :: flag\n\n read(*,*) w, h, x, y\n area = w*h/2.0\n\n if (mod(w,2)/=0 .or. mod(h,2)/=0) then\n flag = 0\n else \n if (x == w/2 .and. y == h/2) then\n flag = 1\n else\n flag = 0\n endif\n endif\n\n write(*,*) area, flag\n\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 329, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s548444466", "group_id": "codeNet:p03001", "input_text": "program abc130c\n integer :: w, h, x, y\n read *, w, h, x, y\n print *, real(w)*real(h)/2, merge(1,0,x*2==w.and.y*2==h)\nend program abc130c\n", "language": "Fortran", "metadata": {"date": 1560720256, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s548444466.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s548444466", "user_id": "u081445141"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program abc130c\n integer :: w, h, x, y\n read *, w, h, x, y\n print *, real(w)*real(h)/2, merge(1,0,x*2==w.and.y*2==h)\nend program abc130c\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 140, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s340195615", "group_id": "codeNet:p03001", "input_text": "program kadai\nimplicit none\ninteger :: w,h,x,y\nreal(8) :: ans\nreal(8) :: down,up,left,right\n\nread(*,*) w,h,x,y\n\nif (mod(h,2)==0 .and. y==h/2) then\n w=real(w,8)\n h=real(h,8)\n ans=w*h/2.0_8\n if (mod(w,2)==0 .and. x==w/2) then\n write(*,*) ans,1\n stop\n end if\n write(*,*) ans,0\n stop\nend if\n\nif (mod(w,2)==0 .and. x==w/2) then\n w=real(w,8)\n h=real(h,8)\n ans=w*h/2.0_8\n write(*,*) ans,0\n stop\nend if\n\nx=real(x,8)\nw=real(w,8)\nh=real(h,8)\ny=real(y,8)\ndown=x-(w-2.0_8*x)*y/(h-2.0_8*y)\nup=x+(w-2.0_8*x)*(h-y)/(h-2.0_8*y)\nif (down<=w .and. down>=0) then\n ans=(up+down)*h/2.0_8\n if (ans>w*h/2.0_8) then\n ans=w*h-ans\n end if\n write(*,*) ans,0\n !write(*,*) up,down\n stop\nend if\n\nif (down>w .or. down<0) then\n right=y+(h-2.0_8*y)*(w-x)/(w-2.0_8*x)\n left=y-(h-2.0_8*y)*x/(w-2.0_8*x)\n ans=w*(right+left)/2.0_8\n if (ans>w*h/2.0_8) then\n ans=w*h-ans\n ! write(*,*) \"bbbb\"\n end if\n write(*,*) ans,0\n stop\nend if\n\nend program kadai\n\n", "language": "Fortran", "metadata": {"date": 1560715992, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s340195615.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s340195615", "user_id": "u286754585"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program kadai\nimplicit none\ninteger :: w,h,x,y\nreal(8) :: ans\nreal(8) :: down,up,left,right\n\nread(*,*) w,h,x,y\n\nif (mod(h,2)==0 .and. y==h/2) then\n w=real(w,8)\n h=real(h,8)\n ans=w*h/2.0_8\n if (mod(w,2)==0 .and. x==w/2) then\n write(*,*) ans,1\n stop\n end if\n write(*,*) ans,0\n stop\nend if\n\nif (mod(w,2)==0 .and. x==w/2) then\n w=real(w,8)\n h=real(h,8)\n ans=w*h/2.0_8\n write(*,*) ans,0\n stop\nend if\n\nx=real(x,8)\nw=real(w,8)\nh=real(h,8)\ny=real(y,8)\ndown=x-(w-2.0_8*x)*y/(h-2.0_8*y)\nup=x+(w-2.0_8*x)*(h-y)/(h-2.0_8*y)\nif (down<=w .and. down>=0) then\n ans=(up+down)*h/2.0_8\n if (ans>w*h/2.0_8) then\n ans=w*h-ans\n end if\n write(*,*) ans,0\n !write(*,*) up,down\n stop\nend if\n\nif (down>w .or. down<0) then\n right=y+(h-2.0_8*y)*(w-x)/(w-2.0_8*x)\n left=y-(h-2.0_8*y)*x/(w-2.0_8*x)\n ans=w*(right+left)/2.0_8\n if (ans>w*h/2.0_8) then\n ans=w*h-ans\n ! write(*,*) \"bbbb\"\n end if\n write(*,*) ans,0\n stop\nend if\n\nend program kadai\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1024, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s705175758", "group_id": "codeNet:p03001", "input_text": "program cutting\nimplicit none\ninteger w, h, x, y\ninteger res\nreal(4) ss, ww, hh, xx, yy, mm, nn ,ms\nread*, w, h, x, y\nxx=x\nyy=y\nww=w\nww=ww/2\nhh=h\nhh=h/2\nif((xx.eq.ww).and.(yy.eq.hh)) then \nres=1\nelse if ((xx.ne.ww).or.(yy.ne.hh)) then\nres=0\nend if\nss=w*h\nss=ss/2\nss=w*h-ss\nmm=max(ww,hh)\nnn=min(ww,hh)\nmm=mm-1\nms=mm*nn\nif(((ss-ms)/ss).lt.(0.00001)) then\nres=1\nend if\nprint*, ss, res\nend program", "language": "Fortran", "metadata": {"date": 1560715936, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s705175758.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s705175758", "user_id": "u039189422"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program cutting\nimplicit none\ninteger w, h, x, y\ninteger res\nreal(4) ss, ww, hh, xx, yy, mm, nn ,ms\nread*, w, h, x, y\nxx=x\nyy=y\nww=w\nww=ww/2\nhh=h\nhh=h/2\nif((xx.eq.ww).and.(yy.eq.hh)) then \nres=1\nelse if ((xx.ne.ww).or.(yy.ne.hh)) then\nres=0\nend if\nss=w*h\nss=ss/2\nss=w*h-ss\nmm=max(ww,hh)\nnn=min(ww,hh)\nmm=mm-1\nms=mm*nn\nif(((ss-ms)/ss).lt.(0.00001)) then\nres=1\nend if\nprint*, ss, res\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 393, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s361984800", "group_id": "codeNet:p03001", "input_text": "program cutting\nimplicit none\ninteger w, h, x, y\ninteger res\nreal s, ww, hh\nread*, w, h, x, y\nww=w\nww=ww/2\nhh=h\nhh=h/2\nif((x.eq.ww).and.(y.eq.hh)) then \nres=1\nelse if ((x.ne.ww).or.(y.ne.hh)) then\nres=0\nend if\ns=w*h\ns=s/2\ns=w*h-s\nprint*, s, res\nend program", "language": "Fortran", "metadata": {"date": 1560714931, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s361984800.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s361984800", "user_id": "u039189422"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program cutting\nimplicit none\ninteger w, h, x, y\ninteger res\nreal s, ww, hh\nread*, w, h, x, y\nww=w\nww=ww/2\nhh=h\nhh=h/2\nif((x.eq.ww).and.(y.eq.hh)) then \nres=1\nelse if ((x.ne.ww).or.(y.ne.hh)) then\nres=0\nend if\ns=w*h\ns=s/2\ns=w*h-s\nprint*, s, res\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 256, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s992541483", "group_id": "codeNet:p03001", "input_text": "program main\n implicit none\n real(8) W,H,x,y,ans1\n integer ans2 \n read(*, *)W,H,x,y\n ans1 = W*H*0.5\n if(2*x == W .and. 2*y == H) then\n ans2 = 1\n else\n ans2 = 0\n end if\n write(* ,*)ans1,ans2\nend program main\n", "language": "Fortran", "metadata": {"date": 1560712785, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03001.html", "problem_id": "p03001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03001/input.txt", "sample_output_relpath": "derived/input_output/data/p03001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03001/Fortran/s992541483.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s992541483", "user_id": "u050276949"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "program main\n implicit none\n real(8) W,H,x,y,ans1\n integer ans2 \n read(*, *)W,H,x,y\n ans1 = W*H*0.5\n if(2*x == W .and. 2*y == H) then\n ans2 = 1\n else\n ans2 = 0\n end if\n write(* ,*)ans1,ans2\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "sample_input": "2 3 1 2\n"}, "reference_outputs": ["3.000000 0\n"], "source_document_id": "p03001", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a rectangle in a coordinate plane. The coordinates of the four vertices are (0,0), (W,0), (W,H), and (0,H).\nYou are given a point (x,y) which is within the rectangle or on its border. We will draw a straight line passing through (x,y) to cut the rectangle into two parts. Find the maximum possible area of the part whose area is not larger than that of the other. Additionally, determine if there are multiple ways to cut the rectangle and achieve that maximum.\n\nConstraints\n\n1 \\leq W,H \\leq 10^9\n\n0\\leq x\\leq W\n\n0\\leq y\\leq H\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nW H x y\n\nOutput\n\nPrint the maximum possible area of the part whose area is not larger than that of the other, followed by 1 if there are multiple ways to cut the rectangle and achieve that maximum, and 0 otherwise.\n\nThe area printed will be judged correct when its absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n2 3 1 2\n\nSample Output 1\n\n3.000000 0\n\nThe line x=1 gives the optimal cut, and no other line does.\n\nSample Input 2\n\n2 2 1 1\n\nSample Output 2\n\n2.000000 1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 222, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s024590830", "group_id": "codeNet:p03003", "input_text": "module mod_mint\n implicit none\n integer(8) :: modul\n type :: mint\n integer(8) :: n\n end type mint\n interface assignment(=)\n module procedure assign1, assign2, assign3_1, assign3_2, assign4_1, assign4_2\n end interface assignment(=)\n interface operator(+)\n module procedure add0, add1_1, add1_2, add2_1, add2_2\n end interface operator(+)\n interface operator(-)\n module procedure sub0, sub1_1, sub1_2, sub2_1, sub2_2\n end interface operator(-)\n interface operator(*)\n module procedure mul0, mul1_1, mul1_2, mul2_1, mul2_2\n end interface operator(*)\n interface operator(/)\n module procedure div0, div1_1, div1_2, div2_1, div2_2\n end interface operator(/)\n interface operator(**)\n module procedure pow1_1, pow1_2\n end interface operator(**)\n private\n public :: mint\n public :: init, show, inv\n public :: assignment(=), operator(+), operator(-)\n public :: operator(*), operator(/), operator(**)\ncontains\n subroutine init(m)\n implicit none\n integer(8), intent(in) :: m\n modul = m\n return\n end subroutine init\n subroutine show(a)\n implicit none\n type(mint), intent(in) :: a\n write(*,'(i0)') a%n\n return\n end subroutine show\n subroutine assign1(a,b)\n implicit none\n type(mint), intent(inout) :: a\n integer(8), intent(in) :: b\n integer(8) :: c\n c = b\n do while (c.lt.0_8)\n c = c + modul\n end do\n a%n = mod(c,modul)\n return\n end subroutine assign1\n subroutine assign2(a,b)\n implicit none\n type(mint), intent(inout) :: a\n integer, intent(in) :: b\n call assign1(a,int(b,8))\n return\n end subroutine assign2\n subroutine assign3_1(a,b)\n implicit none\n type(mint), intent(inout) :: a(:)\n integer(8), intent(in) :: b\n integer :: n, i\n n = size(a)\n do i = 1, n\n call assign1(a(i),b)\n end do\n return\n end subroutine assign3_1\n subroutine assign3_2(a,b)\n implicit none\n type(mint), intent(inout) :: a(:)\n integer, intent(in) :: b\n call assign3_1(a,int(b,8))\n return\n end subroutine assign3_2\n subroutine assign4_1(a,b)\n implicit none\n type(mint), intent(inout) :: a(:,:)\n integer(8), intent(in) :: b\n integer :: n, i\n n = size(a(:,1))\n do i = 1, n\n call assign3_1(a(i,:),b)\n end do\n return\n end subroutine assign4_1\n subroutine assign4_2(a,b)\n implicit none\n type(mint), intent(inout) :: a(:,:)\n integer, intent(in) :: b\n call assign4_1(a,int(b,8))\n return\n end subroutine assign4_2\n function add0(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a, b\n type(mint) :: r\n r%n = mod(a%n+b%n,modul)\n return\n end function add0\n function add1_1(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer(8), intent(in) :: b\n type(mint) :: r\n call assign1(r,b)\n r = add0(a,r)\n return\n end function add1_1\n function add1_2(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer, intent(in) :: b\n type(mint) :: r\n call assign2(r,b)\n r = add0(a,r)\n return\n end function add1_2\n function add2_1(a,b) result(r)\n implicit none\n integer(8), intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign1(r,a)\n r = add0(r,b)\n return\n end function add2_1\n function add2_2(a,b) result(r)\n implicit none\n integer, intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign2(r,a)\n r = add0(r,b)\n return\n end function add2_2\n function sub0(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a, b\n type(mint) :: r\n r%n = mod(modul+a%n-b%n,modul)\n return\n end function sub0\n function sub1_1(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer(8), intent(in) :: b\n type(mint) :: r\n call assign1(r,b)\n r = sub0(a,r)\n return\n end function sub1_1\n function sub1_2(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer, intent(in) :: b\n type(mint) :: r\n call assign2(r,b)\n r = sub0(a,r)\n return\n end function sub1_2\n function sub2_1(a,b) result(r)\n implicit none\n integer(8), intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign1(r,a)\n r = sub0(r,b)\n return\n end function sub2_1\n function sub2_2(a,b) result(r)\n implicit none\n integer, intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign2(r,a)\n r = sub0(r,b)\n return\n end function sub2_2\n function mul0(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a, b\n type(mint) :: r\n r%n = mod(a%n*b%n,modul)\n return\n end function mul0\n function mul1_1(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer(8), intent(in) :: b\n type(mint) :: r\n call assign1(r,b)\n r = mul0(a,r)\n return\n end function mul1_1\n function mul1_2(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer, intent(in) :: b\n type(mint) :: r\n call assign2(r,b)\n r = mul0(a,r)\n return\n end function mul1_2\n function mul2_1(a,b) result(r)\n implicit none\n integer(8), intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign1(r,a)\n r = mul0(r,b)\n return\n end function mul2_1\n function mul2_2(a,b) result(r)\n implicit none\n integer, intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign2(r,a)\n r = mul0(r,b)\n return\n end function mul2_2\n function div0(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a, b\n type(mint) :: r\n r = mul0(a,inv(b))\n return\n end function div0\n function div1_1(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer(8), intent(in) :: b\n type(mint) :: r\n call assign1(r,b)\n r = div0(a,r)\n return\n end function div1_1\n function div1_2(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer, intent(in) :: b\n type(mint) :: r\n call assign2(r,b)\n r = div0(a,r)\n return\n end function div1_2\n function div2_1(a,b) result(r)\n implicit none\n integer(8), intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign1(r,a)\n r = div0(r,b)\n return\n end function div2_1\n function div2_2(a,b) result(r)\n implicit none\n integer, intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign2(r,a)\n r = div0(r,b)\n return\n end function div2_2\n function inv(n) result(m)\n implicit none\n type(mint), intent(in) :: n\n type(mint) :: m\n integer(8) :: a, b, x, y, t, q\n a = n%n\n b = modul\n x = 0\n y = 1\n do while(b.ne.0_8)\n q = a/b\n t = b\n b = mod(a,b)\n a = t\n t = y\n y = x\n x = t-q*x\n end do\n call assign1(m,y)\n return\n end function inv\n recursive function pow1_1(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer(8), intent(in) :: b\n type(mint) :: r\n if (b.eq.0_8) then\n call assign2(r,1)\n return\n end if\n if (mod(b,2_8).eq.0_8) then\n r = pow1_1(a,b/2_8)\n r = mul0(r,r)\n return\n end if\n r = mul0(a,pow1_1(a,b-1_8))\n return\n end function pow1_1\n function pow1_2(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer, intent(in) :: b\n type(mint) :: r\n r = pow1_1(a,int(b,8))\n return\n end function pow1_2\nend module mod_mint\nprogram common_subsequence\n use mod_mint\n implicit none\n integer :: n, m, s(2000), t(2000), i, j\n type(mint) :: dp(0:2000,0:2000)\n call init(1000000007_8)\n s = 0\n t = 0\n dp = 0\n read(*,*) n, m\n read(*,*) s(1:n)\n read(*,*) t(1:m)\n do i = 1, n\n do j = 1, m\n if (s(i).eq.t(j)) then\n dp(i,j) = 1+dp(i,j-1)+dp(i-1,j)\n else\n dp(i,j) = dp(i,j-1)+dp(i-1,j)-dp(i-1,j-1)\n end if\n end do\n end do\n call show(dp(n,m)+1)\n stop\nend program common_subsequence", "language": "Fortran", "metadata": {"date": 1560740986, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03003.html", "problem_id": "p03003", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03003/input.txt", "sample_output_relpath": "derived/input_output/data/p03003/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03003/Fortran/s024590830.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s024590830", "user_id": "u506403362"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "module mod_mint\n implicit none\n integer(8) :: modul\n type :: mint\n integer(8) :: n\n end type mint\n interface assignment(=)\n module procedure assign1, assign2, assign3_1, assign3_2, assign4_1, assign4_2\n end interface assignment(=)\n interface operator(+)\n module procedure add0, add1_1, add1_2, add2_1, add2_2\n end interface operator(+)\n interface operator(-)\n module procedure sub0, sub1_1, sub1_2, sub2_1, sub2_2\n end interface operator(-)\n interface operator(*)\n module procedure mul0, mul1_1, mul1_2, mul2_1, mul2_2\n end interface operator(*)\n interface operator(/)\n module procedure div0, div1_1, div1_2, div2_1, div2_2\n end interface operator(/)\n interface operator(**)\n module procedure pow1_1, pow1_2\n end interface operator(**)\n private\n public :: mint\n public :: init, show, inv\n public :: assignment(=), operator(+), operator(-)\n public :: operator(*), operator(/), operator(**)\ncontains\n subroutine init(m)\n implicit none\n integer(8), intent(in) :: m\n modul = m\n return\n end subroutine init\n subroutine show(a)\n implicit none\n type(mint), intent(in) :: a\n write(*,'(i0)') a%n\n return\n end subroutine show\n subroutine assign1(a,b)\n implicit none\n type(mint), intent(inout) :: a\n integer(8), intent(in) :: b\n integer(8) :: c\n c = b\n do while (c.lt.0_8)\n c = c + modul\n end do\n a%n = mod(c,modul)\n return\n end subroutine assign1\n subroutine assign2(a,b)\n implicit none\n type(mint), intent(inout) :: a\n integer, intent(in) :: b\n call assign1(a,int(b,8))\n return\n end subroutine assign2\n subroutine assign3_1(a,b)\n implicit none\n type(mint), intent(inout) :: a(:)\n integer(8), intent(in) :: b\n integer :: n, i\n n = size(a)\n do i = 1, n\n call assign1(a(i),b)\n end do\n return\n end subroutine assign3_1\n subroutine assign3_2(a,b)\n implicit none\n type(mint), intent(inout) :: a(:)\n integer, intent(in) :: b\n call assign3_1(a,int(b,8))\n return\n end subroutine assign3_2\n subroutine assign4_1(a,b)\n implicit none\n type(mint), intent(inout) :: a(:,:)\n integer(8), intent(in) :: b\n integer :: n, i\n n = size(a(:,1))\n do i = 1, n\n call assign3_1(a(i,:),b)\n end do\n return\n end subroutine assign4_1\n subroutine assign4_2(a,b)\n implicit none\n type(mint), intent(inout) :: a(:,:)\n integer, intent(in) :: b\n call assign4_1(a,int(b,8))\n return\n end subroutine assign4_2\n function add0(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a, b\n type(mint) :: r\n r%n = mod(a%n+b%n,modul)\n return\n end function add0\n function add1_1(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer(8), intent(in) :: b\n type(mint) :: r\n call assign1(r,b)\n r = add0(a,r)\n return\n end function add1_1\n function add1_2(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer, intent(in) :: b\n type(mint) :: r\n call assign2(r,b)\n r = add0(a,r)\n return\n end function add1_2\n function add2_1(a,b) result(r)\n implicit none\n integer(8), intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign1(r,a)\n r = add0(r,b)\n return\n end function add2_1\n function add2_2(a,b) result(r)\n implicit none\n integer, intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign2(r,a)\n r = add0(r,b)\n return\n end function add2_2\n function sub0(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a, b\n type(mint) :: r\n r%n = mod(modul+a%n-b%n,modul)\n return\n end function sub0\n function sub1_1(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer(8), intent(in) :: b\n type(mint) :: r\n call assign1(r,b)\n r = sub0(a,r)\n return\n end function sub1_1\n function sub1_2(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer, intent(in) :: b\n type(mint) :: r\n call assign2(r,b)\n r = sub0(a,r)\n return\n end function sub1_2\n function sub2_1(a,b) result(r)\n implicit none\n integer(8), intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign1(r,a)\n r = sub0(r,b)\n return\n end function sub2_1\n function sub2_2(a,b) result(r)\n implicit none\n integer, intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign2(r,a)\n r = sub0(r,b)\n return\n end function sub2_2\n function mul0(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a, b\n type(mint) :: r\n r%n = mod(a%n*b%n,modul)\n return\n end function mul0\n function mul1_1(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer(8), intent(in) :: b\n type(mint) :: r\n call assign1(r,b)\n r = mul0(a,r)\n return\n end function mul1_1\n function mul1_2(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer, intent(in) :: b\n type(mint) :: r\n call assign2(r,b)\n r = mul0(a,r)\n return\n end function mul1_2\n function mul2_1(a,b) result(r)\n implicit none\n integer(8), intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign1(r,a)\n r = mul0(r,b)\n return\n end function mul2_1\n function mul2_2(a,b) result(r)\n implicit none\n integer, intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign2(r,a)\n r = mul0(r,b)\n return\n end function mul2_2\n function div0(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a, b\n type(mint) :: r\n r = mul0(a,inv(b))\n return\n end function div0\n function div1_1(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer(8), intent(in) :: b\n type(mint) :: r\n call assign1(r,b)\n r = div0(a,r)\n return\n end function div1_1\n function div1_2(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer, intent(in) :: b\n type(mint) :: r\n call assign2(r,b)\n r = div0(a,r)\n return\n end function div1_2\n function div2_1(a,b) result(r)\n implicit none\n integer(8), intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign1(r,a)\n r = div0(r,b)\n return\n end function div2_1\n function div2_2(a,b) result(r)\n implicit none\n integer, intent(in) :: a\n type(mint), intent(in) :: b\n type(mint) :: r\n call assign2(r,a)\n r = div0(r,b)\n return\n end function div2_2\n function inv(n) result(m)\n implicit none\n type(mint), intent(in) :: n\n type(mint) :: m\n integer(8) :: a, b, x, y, t, q\n a = n%n\n b = modul\n x = 0\n y = 1\n do while(b.ne.0_8)\n q = a/b\n t = b\n b = mod(a,b)\n a = t\n t = y\n y = x\n x = t-q*x\n end do\n call assign1(m,y)\n return\n end function inv\n recursive function pow1_1(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer(8), intent(in) :: b\n type(mint) :: r\n if (b.eq.0_8) then\n call assign2(r,1)\n return\n end if\n if (mod(b,2_8).eq.0_8) then\n r = pow1_1(a,b/2_8)\n r = mul0(r,r)\n return\n end if\n r = mul0(a,pow1_1(a,b-1_8))\n return\n end function pow1_1\n function pow1_2(a,b) result(r)\n implicit none\n type(mint), intent(in) :: a\n integer, intent(in) :: b\n type(mint) :: r\n r = pow1_1(a,int(b,8))\n return\n end function pow1_2\nend module mod_mint\nprogram common_subsequence\n use mod_mint\n implicit none\n integer :: n, m, s(2000), t(2000), i, j\n type(mint) :: dp(0:2000,0:2000)\n call init(1000000007_8)\n s = 0\n t = 0\n dp = 0\n read(*,*) n, m\n read(*,*) s(1:n)\n read(*,*) t(1:m)\n do i = 1, n\n do j = 1, m\n if (s(i).eq.t(j)) then\n dp(i,j) = 1+dp(i,j-1)+dp(i-1,j)\n else\n dp(i,j) = dp(i,j-1)+dp(i-1,j)-dp(i-1,j-1)\n end if\n end do\n end do\n call show(dp(n,m)+1)\n stop\nend program common_subsequence", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given two integer sequences S and T of length N and M, respectively, both consisting of integers between 1 and 10^5 (inclusive).\n\nIn how many pairs of a subsequence of S and a subsequence of T do the two subsequences are the same in content?\n\nHere the subsequence of A is a sequence obtained by removing zero or more elements from A and concatenating the remaining elements without changing the order.\n\nFor both S and T, we distinguish two subsequences if the sets of the indices of the removed elements are different, even if the subsequences are the same in content.\n\nSince the answer can be tremendous, print the number modulo 10^9+7.\n\nConstraints\n\n1 \\leq N, M \\leq 2 \\times 10^3\n\nThe length of S is N.\n\nThe length of T is M.\n\n1 \\leq S_i, T_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nS_1 S_2 ... S_{N-1} S_{N}\nT_1 T_2 ... T_{M-1} T_{M}\n\nOutput\n\nPrint the number of pairs of a subsequence of S and a subsequence of T such that the subsequences are the same in content, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n1 3\n3 1\n\nSample Output 1\n\n3\n\nS has four subsequences: (), (1), (3), (1, 3).\n\nT has four subsequences: (), (3), (1), (3, 1).\n\nThere are 1 \\times 1 pair of subsequences in which the subsequences are both (), 1 \\times 1 pair of subsequences in which the subsequences are both (1), and 1 \\times 1 pair of subsequences in which the subsequences are both (3), for a total of three pairs.\n\nSample Input 2\n\n2 2\n1 1\n1 1\n\nSample Output 2\n\n6\n\nS has four subsequences: (), (1), (1), (1, 1).\n\nT has four subsequences: (), (1), (1), (1, 1).\n\nThere are 1 \\times 1 pair of subsequences in which the subsequences are both (), 2 \\times 2 pairs of subsequences in which the subsequences are both (1), and 1 \\times 1 pair of subsequences in which the subsequences are both (1,1), for a total of six pairs.\nNote again that we distinguish two subsequences if the sets of the indices of the removed elements are different, even if the subsequences are the same in content.\n\nSample Input 3\n\n4 4\n3 4 5 6\n3 4 5 6\n\nSample Output 3\n\n16\n\nSample Input 4\n\n10 9\n9 6 5 7 5 9 8 5 6 7\n8 6 8 5 5 7 9 9 7\n\nSample Output 4\n\n191\n\nSample Input 5\n\n20 20\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n\nSample Output 5\n\n846527861\n\nBe sure to print the number modulo 10^9+7.", "sample_input": "2 2\n1 3\n3 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03003", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given two integer sequences S and T of length N and M, respectively, both consisting of integers between 1 and 10^5 (inclusive).\n\nIn how many pairs of a subsequence of S and a subsequence of T do the two subsequences are the same in content?\n\nHere the subsequence of A is a sequence obtained by removing zero or more elements from A and concatenating the remaining elements without changing the order.\n\nFor both S and T, we distinguish two subsequences if the sets of the indices of the removed elements are different, even if the subsequences are the same in content.\n\nSince the answer can be tremendous, print the number modulo 10^9+7.\n\nConstraints\n\n1 \\leq N, M \\leq 2 \\times 10^3\n\nThe length of S is N.\n\nThe length of T is M.\n\n1 \\leq S_i, T_i \\leq 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nS_1 S_2 ... S_{N-1} S_{N}\nT_1 T_2 ... T_{M-1} T_{M}\n\nOutput\n\nPrint the number of pairs of a subsequence of S and a subsequence of T such that the subsequences are the same in content, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n1 3\n3 1\n\nSample Output 1\n\n3\n\nS has four subsequences: (), (1), (3), (1, 3).\n\nT has four subsequences: (), (3), (1), (3, 1).\n\nThere are 1 \\times 1 pair of subsequences in which the subsequences are both (), 1 \\times 1 pair of subsequences in which the subsequences are both (1), and 1 \\times 1 pair of subsequences in which the subsequences are both (3), for a total of three pairs.\n\nSample Input 2\n\n2 2\n1 1\n1 1\n\nSample Output 2\n\n6\n\nS has four subsequences: (), (1), (1), (1, 1).\n\nT has four subsequences: (), (1), (1), (1, 1).\n\nThere are 1 \\times 1 pair of subsequences in which the subsequences are both (), 2 \\times 2 pairs of subsequences in which the subsequences are both (1), and 1 \\times 1 pair of subsequences in which the subsequences are both (1,1), for a total of six pairs.\nNote again that we distinguish two subsequences if the sets of the indices of the removed elements are different, even if the subsequences are the same in content.\n\nSample Input 3\n\n4 4\n3 4 5 6\n3 4 5 6\n\nSample Output 3\n\n16\n\nSample Input 4\n\n10 9\n9 6 5 7 5 9 8 5 6 7\n8 6 8 5 5 7 9 9 7\n\nSample Output 4\n\n191\n\nSample Input 5\n\n20 20\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n\nSample Output 5\n\n846527861\n\nBe sure to print the number modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 7889, "cpu_time_ms": 167, "memory_kb": 31488}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s543688923", "group_id": "codeNet:p03005", "input_text": "program prob41\n implicit none\n integer :: n,k\n read(*,*) n,k\n if(k /= 1) then\n write(*,*) n-k\n else\n write(*,*) \"0\"\n end if\n stop\ncontains\nend program prob41", "language": "Fortran", "metadata": {"date": 1592630845, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03005.html", "problem_id": "p03005", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03005/input.txt", "sample_output_relpath": "derived/input_output/data/p03005/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03005/Fortran/s543688923.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s543688923", "user_id": "u478462004"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program prob41\n implicit none\n integer :: n,k\n read(*,*) n,k\n if(k /= 1) then\n write(*,*) n-k\n else\n write(*,*) \"0\"\n end if\n stop\ncontains\nend program prob41", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is distributing N balls to K persons.\n\nIf each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?\n\nConstraints\n\n1 \\leq K \\leq N \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the maximum possible difference in the number of balls received.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n1\n\nThe only way to distribute three balls to two persons so that each of them receives at least one ball is to give one ball to one person and give two balls to the other person.\n\nThus, the maximum possible difference in the number of balls received is 1.\n\nSample Input 2\n\n3 1\n\nSample Output 2\n\n0\n\nWe have no choice but to give three balls to the only person, in which case the difference in the number of balls received is 0.\n\nSample Input 3\n\n8 5\n\nSample Output 3\n\n3\n\nFor example, if we give 1, 4, 1, 1, 1 balls to the five persons, the number of balls received between the person with the most balls and the person with the fewest balls would be 3, which is the maximum result.", "sample_input": "3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03005", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is distributing N balls to K persons.\n\nIf each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?\n\nConstraints\n\n1 \\leq K \\leq N \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the maximum possible difference in the number of balls received.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n1\n\nThe only way to distribute three balls to two persons so that each of them receives at least one ball is to give one ball to one person and give two balls to the other person.\n\nThus, the maximum possible difference in the number of balls received is 1.\n\nSample Input 2\n\n3 1\n\nSample Output 2\n\n0\n\nWe have no choice but to give three balls to the only person, in which case the difference in the number of balls received is 0.\n\nSample Input 3\n\n8 5\n\nSample Output 3\n\n3\n\nFor example, if we give 1, 4, 1, 1, 1 balls to the five persons, the number of balls received between the person with the most balls and the person with the fewest balls would be 3, which is the maximum result.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 192, "cpu_time_ms": 6, "memory_kb": 2852}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s948800531", "group_id": "codeNet:p03005", "input_text": "integer N\ninteger,allocatable,dimension(:)::X\ninteger(8),allocatable,dimension(:)::ansx,ansy\ninteger(8)minuscnt,tmp\nread*,N\nallocate(X(N))\nallocate(ansx(N-1),ansy(N-1))\nread*,X\ncall heapsort(N,X)\n\nminuscnt=0\ndo i=1,N\n if(x(i)<0)minuscnt=minuscnt+1\nend do\n\nif(minuscnt>=1.and. N-minuscnt>=1)then\n ansx(1)=X(1)\n ansy(1)=X(N-1)\n do i=2,(N-minuscnt)-2\n ansx(i)=ansx(i-1)-ansy(i-1)\n ansy(i)=ansy(minuscnt+i)\n end do\n ansy(N-minuscnt-1)=ansx(N-minuscnt-2)-ansy(N-minuscnt-2)\n ansx(N-minuscnt-1)=X(N)\n do i=N-minuscnt,N-1\n ansx(i)=ansx(i-1)+ansy(i-1)\n ansy(i)=ansy(N+1-i+1)\n end do\nelse\n ansx(1)=X(1)\n ansy(1)=X(N-1)\n do i=2,N-2\n ansx(i)=ansx(i-1)-ansy(i-1)\n ansy(i)=X(i)\n end do\n ansx(N-1)=X(N)\n ansy(N-1)=ansx(N-2)-ansy(N-2)\nend if\n\nans=ansx(N-1)-ansy(N-1)\nif(ans<0)then\n tmp=ansx(N-1)\n ansx(N-1)=ansy(N-1)\n ansy(N-1)=tmp\n ans=-ans\nendif\n\nprint\"(i0)\",ansx(N-1)-ansy(N-1)\ndo i=1,N-1\n print\"(i0,A,i0)\",ansx(i),\" \",ansy(i)\nend do\ncontains\n\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n integer::i,k,j,l\n integer:: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend\n", "language": "Fortran", "metadata": {"date": 1560655510, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03005.html", "problem_id": "p03005", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03005/input.txt", "sample_output_relpath": "derived/input_output/data/p03005/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03005/Fortran/s948800531.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s948800531", "user_id": "u598073939"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "integer N\ninteger,allocatable,dimension(:)::X\ninteger(8),allocatable,dimension(:)::ansx,ansy\ninteger(8)minuscnt,tmp\nread*,N\nallocate(X(N))\nallocate(ansx(N-1),ansy(N-1))\nread*,X\ncall heapsort(N,X)\n\nminuscnt=0\ndo i=1,N\n if(x(i)<0)minuscnt=minuscnt+1\nend do\n\nif(minuscnt>=1.and. N-minuscnt>=1)then\n ansx(1)=X(1)\n ansy(1)=X(N-1)\n do i=2,(N-minuscnt)-2\n ansx(i)=ansx(i-1)-ansy(i-1)\n ansy(i)=ansy(minuscnt+i)\n end do\n ansy(N-minuscnt-1)=ansx(N-minuscnt-2)-ansy(N-minuscnt-2)\n ansx(N-minuscnt-1)=X(N)\n do i=N-minuscnt,N-1\n ansx(i)=ansx(i-1)+ansy(i-1)\n ansy(i)=ansy(N+1-i+1)\n end do\nelse\n ansx(1)=X(1)\n ansy(1)=X(N-1)\n do i=2,N-2\n ansx(i)=ansx(i-1)-ansy(i-1)\n ansy(i)=X(i)\n end do\n ansx(N-1)=X(N)\n ansy(N-1)=ansx(N-2)-ansy(N-2)\nend if\n\nans=ansx(N-1)-ansy(N-1)\nif(ans<0)then\n tmp=ansx(N-1)\n ansx(N-1)=ansy(N-1)\n ansy(N-1)=tmp\n ans=-ans\nendif\n\nprint\"(i0)\",ansx(N-1)-ansy(N-1)\ndo i=1,N-1\n print\"(i0,A,i0)\",ansx(i),\" \",ansy(i)\nend do\ncontains\n\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n integer::i,k,j,l\n integer:: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is distributing N balls to K persons.\n\nIf each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?\n\nConstraints\n\n1 \\leq K \\leq N \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the maximum possible difference in the number of balls received.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n1\n\nThe only way to distribute three balls to two persons so that each of them receives at least one ball is to give one ball to one person and give two balls to the other person.\n\nThus, the maximum possible difference in the number of balls received is 1.\n\nSample Input 2\n\n3 1\n\nSample Output 2\n\n0\n\nWe have no choice but to give three balls to the only person, in which case the difference in the number of balls received is 0.\n\nSample Input 3\n\n8 5\n\nSample Output 3\n\n3\n\nFor example, if we give 1, 4, 1, 1, 1 balls to the five persons, the number of balls received between the person with the most balls and the person with the fewest balls would be 3, which is the maximum result.", "sample_input": "3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03005", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is distributing N balls to K persons.\n\nIf each person has to receive at least one ball, what is the maximum possible difference in the number of balls received between the person with the most balls and the person with the fewest balls?\n\nConstraints\n\n1 \\leq K \\leq N \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the maximum possible difference in the number of balls received.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n1\n\nThe only way to distribute three balls to two persons so that each of them receives at least one ball is to give one ball to one person and give two balls to the other person.\n\nThus, the maximum possible difference in the number of balls received is 1.\n\nSample Input 2\n\n3 1\n\nSample Output 2\n\n0\n\nWe have no choice but to give three balls to the only person, in which case the difference in the number of balls received is 0.\n\nSample Input 3\n\n8 5\n\nSample Output 3\n\n3\n\nFor example, if we give 1, 4, 1, 1, 1 balls to the five persons, the number of balls received between the person with the most balls and the person with the fewest balls would be 3, which is the maximum result.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1741, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s416982382", "group_id": "codeNet:p03006", "input_text": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\n\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\nprogram diverta2019_2_b\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int32):: n,i,j,p,q,cost\n integer(int32), allocatable:: x(:), y(:)\n\n read*, n\n allocate(x(n), y(n))\n\n do i=1,n\n read*, x(i), y(i)\n end do\n cost = 1000\n do i=1,n-1\n do j=i+1,n\n p = x(j)-x(i)\n q = y(j)-y(i)\n cost = min(cost, calc_cost(p,q)) \n end do\n end do\n print'(i0)', cost\ncontains\n function calc_cost(p,q) result(ret)\n integer(int32):: p,q,ret\n integer(int32):: i,j\n ret = n\n\n do i=1,n-1\n do j=1,n\n if (x(j)-x(i) == p .and. y(j)-y(i) == q)ret=ret-1\n end do\n end do\n end function\nend program diverta2019_2_b", "language": "Fortran", "metadata": {"date": 1591319569, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03006.html", "problem_id": "p03006", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03006/input.txt", "sample_output_relpath": "derived/input_output/data/p03006/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03006/Fortran/s416982382.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s416982382", "user_id": "u234636620"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\n\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\nprogram diverta2019_2_b\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int32):: n,i,j,p,q,cost\n integer(int32), allocatable:: x(:), y(:)\n\n read*, n\n allocate(x(n), y(n))\n\n do i=1,n\n read*, x(i), y(i)\n end do\n cost = 1000\n do i=1,n-1\n do j=i+1,n\n p = x(j)-x(i)\n q = y(j)-y(i)\n cost = min(cost, calc_cost(p,q)) \n end do\n end do\n print'(i0)', cost\ncontains\n function calc_cost(p,q) result(ret)\n integer(int32):: p,q,ret\n integer(int32):: i,j\n ret = n\n\n do i=1,n-1\n do j=1,n\n if (x(j)-x(i) == p .and. y(j)-y(i) == q)ret=ret-1\n end do\n end do\n end function\nend program diverta2019_2_b", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).\n\nWe will collect all of these balls, by choosing two integers p and q such that p \\neq 0 or q \\neq 0 and then repeating the following operation:\n\nChoose a ball remaining in the plane and collect it. Let (a, b) be the coordinates of this ball. If we collected a ball at coordinates (a - p, b - q) in the previous operation, the cost of this operation is 0. Otherwise, including when this is the first time to do this operation, the cost of this operation is 1.\n\nFind the minimum total cost required to collect all the balls when we optimally choose p and q.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n|x_i|, |y_i| \\leq 10^9\n\nIf i \\neq j, x_i \\neq x_j or y_i \\neq y_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the minimum total cost required to collect all the balls.\n\nSample Input 1\n\n2\n1 1\n2 2\n\nSample Output 1\n\n1\n\nIf we choose p = 1, q = 1, we can collect all the balls at a cost of 1 by collecting them in the order (1, 1), (2, 2).\n\nSample Input 2\n\n3\n1 4\n4 6\n7 8\n\nSample Output 2\n\n1\n\nIf we choose p = -3, q = -2, we can collect all the balls at a cost of 1 by collecting them in the order (7, 8), (4, 6), (1, 4).\n\nSample Input 3\n\n4\n1 1\n1 2\n2 1\n2 2\n\nSample Output 3\n\n2", "sample_input": "2\n1 1\n2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03006", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).\n\nWe will collect all of these balls, by choosing two integers p and q such that p \\neq 0 or q \\neq 0 and then repeating the following operation:\n\nChoose a ball remaining in the plane and collect it. Let (a, b) be the coordinates of this ball. If we collected a ball at coordinates (a - p, b - q) in the previous operation, the cost of this operation is 0. Otherwise, including when this is the first time to do this operation, the cost of this operation is 1.\n\nFind the minimum total cost required to collect all the balls when we optimally choose p and q.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n|x_i|, |y_i| \\leq 10^9\n\nIf i \\neq j, x_i \\neq x_j or y_i \\neq y_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the minimum total cost required to collect all the balls.\n\nSample Input 1\n\n2\n1 1\n2 2\n\nSample Output 1\n\n1\n\nIf we choose p = 1, q = 1, we can collect all the balls at a cost of 1 by collecting them in the order (1, 1), (2, 2).\n\nSample Input 2\n\n3\n1 4\n4 6\n7 8\n\nSample Output 2\n\n1\n\nIf we choose p = -3, q = -2, we can collect all the balls at a cost of 1 by collecting them in the order (7, 8), (4, 6), (1, 4).\n\nSample Input 3\n\n4\n1 1\n1 2\n2 1\n2 2\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6942, "cpu_time_ms": 6, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s744144361", "group_id": "codeNet:p03006", "input_text": "program picking_up\n implicit none\n integer :: n, x(50), y(50), i, j, k, l, p, q, m, t\n x = 0\n y = 0\n read(*,*) n\n do i = 1, n\n read(*,*) x(i), y(i)\n end do\n m = 0\n do i = 1, n\n do j = 1, n\n if (j.eq.i) cycle\n p = x(i)-x(j)\n q = y(i)-y(j)\n t = 0\n do k = 1, n\n do l = 1, n\n if ((x(k)-x(l).eq.p).and.(y(k)-y(l).eq.q)) t = t+1\n end do\n end do\n if (m.lt.t) m = t\n end do\n end do\n write(*,'(i0)') n-m\n stop\nend program picking_up", "language": "Fortran", "metadata": {"date": 1560656497, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03006.html", "problem_id": "p03006", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03006/input.txt", "sample_output_relpath": "derived/input_output/data/p03006/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03006/Fortran/s744144361.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s744144361", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program picking_up\n implicit none\n integer :: n, x(50), y(50), i, j, k, l, p, q, m, t\n x = 0\n y = 0\n read(*,*) n\n do i = 1, n\n read(*,*) x(i), y(i)\n end do\n m = 0\n do i = 1, n\n do j = 1, n\n if (j.eq.i) cycle\n p = x(i)-x(j)\n q = y(i)-y(j)\n t = 0\n do k = 1, n\n do l = 1, n\n if ((x(k)-x(l).eq.p).and.(y(k)-y(l).eq.q)) t = t+1\n end do\n end do\n if (m.lt.t) m = t\n end do\n end do\n write(*,'(i0)') n-m\n stop\nend program picking_up", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).\n\nWe will collect all of these balls, by choosing two integers p and q such that p \\neq 0 or q \\neq 0 and then repeating the following operation:\n\nChoose a ball remaining in the plane and collect it. Let (a, b) be the coordinates of this ball. If we collected a ball at coordinates (a - p, b - q) in the previous operation, the cost of this operation is 0. Otherwise, including when this is the first time to do this operation, the cost of this operation is 1.\n\nFind the minimum total cost required to collect all the balls when we optimally choose p and q.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n|x_i|, |y_i| \\leq 10^9\n\nIf i \\neq j, x_i \\neq x_j or y_i \\neq y_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the minimum total cost required to collect all the balls.\n\nSample Input 1\n\n2\n1 1\n2 2\n\nSample Output 1\n\n1\n\nIf we choose p = 1, q = 1, we can collect all the balls at a cost of 1 by collecting them in the order (1, 1), (2, 2).\n\nSample Input 2\n\n3\n1 4\n4 6\n7 8\n\nSample Output 2\n\n1\n\nIf we choose p = -3, q = -2, we can collect all the balls at a cost of 1 by collecting them in the order (7, 8), (4, 6), (1, 4).\n\nSample Input 3\n\n4\n1 1\n1 2\n2 1\n2 2\n\nSample Output 3\n\n2", "sample_input": "2\n1 1\n2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03006", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N balls in a two-dimensional plane. The i-th ball is at coordinates (x_i, y_i).\n\nWe will collect all of these balls, by choosing two integers p and q such that p \\neq 0 or q \\neq 0 and then repeating the following operation:\n\nChoose a ball remaining in the plane and collect it. Let (a, b) be the coordinates of this ball. If we collected a ball at coordinates (a - p, b - q) in the previous operation, the cost of this operation is 0. Otherwise, including when this is the first time to do this operation, the cost of this operation is 1.\n\nFind the minimum total cost required to collect all the balls when we optimally choose p and q.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n|x_i|, |y_i| \\leq 10^9\n\nIf i \\neq j, x_i \\neq x_j or y_i \\neq y_j.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the minimum total cost required to collect all the balls.\n\nSample Input 1\n\n2\n1 1\n2 2\n\nSample Output 1\n\n1\n\nIf we choose p = 1, q = 1, we can collect all the balls at a cost of 1 by collecting them in the order (1, 1), (2, 2).\n\nSample Input 2\n\n3\n1 4\n4 6\n7 8\n\nSample Output 2\n\n1\n\nIf we choose p = -3, q = -2, we can collect all the balls at a cost of 1 by collecting them in the order (7, 8), (4, 6), (1, 4).\n\nSample Input 3\n\n4\n1 1\n1 2\n2 1\n2 2\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 500, "cpu_time_ms": 8, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s150170532", "group_id": "codeNet:p03007", "input_text": "program prob6\n implicit none\n integer, allocatable::a(:), ans(:,:)\n integer::n, i, j\n read(*,*) n\n allocate(a(n),ans(n,2))\n read(*,*) a\n call hsort(n,1,1,a)\n if(a(n) <= 0) then\n do i = 1, n-1\n ans(i,1) = a(n)\n ans(i,2) = a(n-1)\n a(n) = a(n) - a(n-1)\n end do\n else if(a(1) >= 0 .and. a(n) >= 0) then\n do i = 1, n-2\n ans(i,1) = a(1)\n ans(i,2) = a(i+1)\n a(1) = a(1) - a(i+1)\n end do\n ans(n-1,1) = a(n)\n ans(n-1,2) = a(1)\n a(n) = a(n) - a(1)\n else\n do i = 1, n\n if(a(i) >= 0) then\n do j = i, n-1\n ans(j-i+1,1) = a(1)\n ans(j-i+1,2) = a(j)\n a(1) = a(1) - a(j)\n end do\n do j = 1, i-1\n ans(n-i+j,1) = a(n)\n ans(n-i+j,2) = a(j)\n a(n) = a(n) - a(j)\n end do\n exit\n end if\n end do\n end if\n write(*,*) a(n)\n do i = 1, n-1\n write(*,*) ans(i,1), ans(i,2)\n end do\n deallocate(a, ans)\n stop\ncontains\n ! n行m列の配列をp列目でsort\n ! 1次元配列ならm=p=1\n subroutine hsort(n,m,p,array)\n implicit none\n integer,intent(in)::n, m, p\n integer,intent(inout)::array(n,m)\n\n integer ::i,k,j,l\n integer::t(m)\n\n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n end if\n if(n.eq.1)return\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L,:)\n else\n t=array(k,:)\n array(k,:)=array(1,:)\n k=k-1\n if(k.eq.1) then\n array(1,:)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j,p).lt.array(j+1,p))j=j+1\n end if\n if (t(p).lt.array(j,p))then\n array(i,:)=array(j,:)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i,:)=t\n end do\n\n return\n end subroutine hsort\nend program", "language": "Fortran", "metadata": {"date": 1598059705, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03007.html", "problem_id": "p03007", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03007/input.txt", "sample_output_relpath": "derived/input_output/data/p03007/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03007/Fortran/s150170532.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s150170532", "user_id": "u841856382"}, "prompt_components": {"gold_output": "4\n-1 1\n2 -2\n", "input_to_evaluate": "program prob6\n implicit none\n integer, allocatable::a(:), ans(:,:)\n integer::n, i, j\n read(*,*) n\n allocate(a(n),ans(n,2))\n read(*,*) a\n call hsort(n,1,1,a)\n if(a(n) <= 0) then\n do i = 1, n-1\n ans(i,1) = a(n)\n ans(i,2) = a(n-1)\n a(n) = a(n) - a(n-1)\n end do\n else if(a(1) >= 0 .and. a(n) >= 0) then\n do i = 1, n-2\n ans(i,1) = a(1)\n ans(i,2) = a(i+1)\n a(1) = a(1) - a(i+1)\n end do\n ans(n-1,1) = a(n)\n ans(n-1,2) = a(1)\n a(n) = a(n) - a(1)\n else\n do i = 1, n\n if(a(i) >= 0) then\n do j = i, n-1\n ans(j-i+1,1) = a(1)\n ans(j-i+1,2) = a(j)\n a(1) = a(1) - a(j)\n end do\n do j = 1, i-1\n ans(n-i+j,1) = a(n)\n ans(n-i+j,2) = a(j)\n a(n) = a(n) - a(j)\n end do\n exit\n end if\n end do\n end if\n write(*,*) a(n)\n do i = 1, n-1\n write(*,*) ans(i,1), ans(i,2)\n end do\n deallocate(a, ans)\n stop\ncontains\n ! n行m列の配列をp列目でsort\n ! 1次元配列ならm=p=1\n subroutine hsort(n,m,p,array)\n implicit none\n integer,intent(in)::n, m, p\n integer,intent(inout)::array(n,m)\n\n integer ::i,k,j,l\n integer::t(m)\n\n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n end if\n if(n.eq.1)return\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L,:)\n else\n t=array(k,:)\n array(k,:)=array(1,:)\n k=k-1\n if(k.eq.1) then\n array(1,:)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j,p).lt.array(j+1,p))j=j+1\n end if\n if (t(p).lt.array(j,p))then\n array(i,:)=array(j,:)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i,:)=t\n end do\n\n return\n end subroutine hsort\nend program", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on a blackboard.\n\nWe will repeat the following operation N-1 times so that we have only one integer on the blackboard.\n\nChoose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.\n\nFind the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-10^4 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.\n\nHere x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.\n\nIf there are multiple sequences of operations that maximize the final integer, any of them will be accepted.\n\nM\nx_1 y_1\n:\nx_{N-1} y_{N-1}\n\nSample Input 1\n\n3\n1 -1 2\n\nSample Output 1\n\n4\n-1 1\n2 -2\n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers written on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of integers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater integer, so the answer is 4.\n\nSample Input 2\n\n3\n1 1 1\n\nSample Output 2\n\n1\n1 1\n1 0", "sample_input": "3\n1 -1 2\n"}, "reference_outputs": ["4\n-1 1\n2 -2\n"], "source_document_id": "p03007", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on a blackboard.\n\nWe will repeat the following operation N-1 times so that we have only one integer on the blackboard.\n\nChoose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.\n\nFind the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-10^4 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.\n\nHere x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.\n\nIf there are multiple sequences of operations that maximize the final integer, any of them will be accepted.\n\nM\nx_1 y_1\n:\nx_{N-1} y_{N-1}\n\nSample Input 1\n\n3\n1 -1 2\n\nSample Output 1\n\n4\n-1 1\n2 -2\n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers written on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of integers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater integer, so the answer is 4.\n\nSample Input 2\n\n3\n1 1 1\n\nSample Output 2\n\n1\n1 1\n1 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2294, "cpu_time_ms": 93, "memory_kb": 4692}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s235321106", "group_id": "codeNet:p03007", "input_text": "program prob6\n implicit none\n integer, allocatable::a(:), ans(:,:)\n integer::n, i, j\n read(*,*) n\n allocate(a(n),ans(n,2))\n read(*,*) a\n call hsort(n,1,1,a)\n if(a(n) <= 0) then\n do i = 1, n-1\n ans(i,1) = a(n)\n ans(i,2) = a(n-1)\n a(n) = a(n) - a(n-1)\n end do\n else if(a(n) >= 0) then\n do i = 1, n-2\n ans(i,1) = a(1)\n ans(i,2) = a(i+1)\n a(1) = a(1) - a(i+1)\n end do\n ans(n-1,1) = a(n)\n ans(n-1,2) = a(1)\n a(n) = a(n) - a(1)\n else\n do i = 1, n\n if(a(i) >= 0) then\n do j = i, n-1\n ans(j-i+1,1) = a(1)\n ans(j-i+1,2) = a(j)\n a(1) = a(1) - a(j)\n end do\n do j = 1, i-1\n ans(n-i+j,1) = a(n)\n ans(n-i+j,2) = a(j)\n a(n) = a(n) - a(j)\n end do\n exit\n end if\n end do\n end if\n write(*,*) a(n)\n do i = 1, n-1\n write(*,*) ans(i,1), ans(i,2)\n end do\n deallocate(a, ans)\n stop\ncontains\n ! n行m列の配列をp列目でsort\n ! 1次元配列ならm=p=1\n subroutine hsort(n,m,p,array)\n implicit none\n integer,intent(in)::n, m, p\n integer,intent(inout)::array(n,m)\n\n integer ::i,k,j,l\n integer::t(m)\n\n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n end if\n if(n.eq.1)return\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L,:)\n else\n t=array(k,:)\n array(k,:)=array(1,:)\n k=k-1\n if(k.eq.1) then\n array(1,:)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j,p).lt.array(j+1,p))j=j+1\n end if\n if (t(p).lt.array(j,p))then\n array(i,:)=array(j,:)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i,:)=t\n end do\n\n return\n end subroutine hsort\nend program", "language": "Fortran", "metadata": {"date": 1598059543, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03007.html", "problem_id": "p03007", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03007/input.txt", "sample_output_relpath": "derived/input_output/data/p03007/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03007/Fortran/s235321106.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s235321106", "user_id": "u841856382"}, "prompt_components": {"gold_output": "4\n-1 1\n2 -2\n", "input_to_evaluate": "program prob6\n implicit none\n integer, allocatable::a(:), ans(:,:)\n integer::n, i, j\n read(*,*) n\n allocate(a(n),ans(n,2))\n read(*,*) a\n call hsort(n,1,1,a)\n if(a(n) <= 0) then\n do i = 1, n-1\n ans(i,1) = a(n)\n ans(i,2) = a(n-1)\n a(n) = a(n) - a(n-1)\n end do\n else if(a(n) >= 0) then\n do i = 1, n-2\n ans(i,1) = a(1)\n ans(i,2) = a(i+1)\n a(1) = a(1) - a(i+1)\n end do\n ans(n-1,1) = a(n)\n ans(n-1,2) = a(1)\n a(n) = a(n) - a(1)\n else\n do i = 1, n\n if(a(i) >= 0) then\n do j = i, n-1\n ans(j-i+1,1) = a(1)\n ans(j-i+1,2) = a(j)\n a(1) = a(1) - a(j)\n end do\n do j = 1, i-1\n ans(n-i+j,1) = a(n)\n ans(n-i+j,2) = a(j)\n a(n) = a(n) - a(j)\n end do\n exit\n end if\n end do\n end if\n write(*,*) a(n)\n do i = 1, n-1\n write(*,*) ans(i,1), ans(i,2)\n end do\n deallocate(a, ans)\n stop\ncontains\n ! n行m列の配列をp列目でsort\n ! 1次元配列ならm=p=1\n subroutine hsort(n,m,p,array)\n implicit none\n integer,intent(in)::n, m, p\n integer,intent(inout)::array(n,m)\n\n integer ::i,k,j,l\n integer::t(m)\n\n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n end if\n if(n.eq.1)return\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L,:)\n else\n t=array(k,:)\n array(k,:)=array(1,:)\n k=k-1\n if(k.eq.1) then\n array(1,:)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j,p).lt.array(j+1,p))j=j+1\n end if\n if (t(p).lt.array(j,p))then\n array(i,:)=array(j,:)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i,:)=t\n end do\n\n return\n end subroutine hsort\nend program", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on a blackboard.\n\nWe will repeat the following operation N-1 times so that we have only one integer on the blackboard.\n\nChoose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.\n\nFind the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-10^4 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.\n\nHere x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.\n\nIf there are multiple sequences of operations that maximize the final integer, any of them will be accepted.\n\nM\nx_1 y_1\n:\nx_{N-1} y_{N-1}\n\nSample Input 1\n\n3\n1 -1 2\n\nSample Output 1\n\n4\n-1 1\n2 -2\n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers written on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of integers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater integer, so the answer is 4.\n\nSample Input 2\n\n3\n1 1 1\n\nSample Output 2\n\n1\n1 1\n1 0", "sample_input": "3\n1 -1 2\n"}, "reference_outputs": ["4\n-1 1\n2 -2\n"], "source_document_id": "p03007", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on a blackboard.\n\nWe will repeat the following operation N-1 times so that we have only one integer on the blackboard.\n\nChoose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.\n\nFind the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-10^4 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.\n\nHere x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.\n\nIf there are multiple sequences of operations that maximize the final integer, any of them will be accepted.\n\nM\nx_1 y_1\n:\nx_{N-1} y_{N-1}\n\nSample Input 1\n\n3\n1 -1 2\n\nSample Output 1\n\n4\n-1 1\n2 -2\n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers written on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of integers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater integer, so the answer is 4.\n\nSample Input 2\n\n3\n1 1 1\n\nSample Output 2\n\n1\n1 1\n1 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2278, "cpu_time_ms": 88, "memory_kb": 4692}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s080804724", "group_id": "codeNet:p03007", "input_text": "integer N\ninteger,allocatable,dimension(:)::X\ninteger,allocatable,dimension(:)::ansx,ansy\ninteger ans\nread*,N\nallocate(X(N))\nread*,X\ncall heapsort(N,X)\n\nallocate(ansx(N-1),ansy(N-1))\nif(mod(N,2)==1)then\n ansx(1)=x(1)\n ansy(1)=x(N)\n do i=2,N-1\n if(mod(i,2)==0)then\n ansx(i)=x(1+i/2)\n else\n ansx(i)=x(N-i/2)\n endif\n ansy(i)=ansx(i-1)-ansy(i-1)\n end do\nelse\n ansx(1)=x(N)\n ansy(1)=x(1)\n do i=2,N-1\n if(mod(i,2)==0)then\n ansx(i)=x(N-i/2)\n else\n ansx(i)=x(1+i/2)\n endif\n ansy(i)=ansx(i-1)-ansy(i-1)\n end do\nendif\n\nans=ansx(N-1)-ansy(N-1)\n\nprint\"(i0)\",ans\ndo i=1,N-1\n print\"(i0,A,i0)\",ansx(i),\" \",ansy(i)\nend do\ncontains\n\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n integer::i,k,j,l\n integer:: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend", "language": "Fortran", "metadata": {"date": 1560649869, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03007.html", "problem_id": "p03007", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03007/input.txt", "sample_output_relpath": "derived/input_output/data/p03007/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03007/Fortran/s080804724.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s080804724", "user_id": "u598073939"}, "prompt_components": {"gold_output": "4\n-1 1\n2 -2\n", "input_to_evaluate": "integer N\ninteger,allocatable,dimension(:)::X\ninteger,allocatable,dimension(:)::ansx,ansy\ninteger ans\nread*,N\nallocate(X(N))\nread*,X\ncall heapsort(N,X)\n\nallocate(ansx(N-1),ansy(N-1))\nif(mod(N,2)==1)then\n ansx(1)=x(1)\n ansy(1)=x(N)\n do i=2,N-1\n if(mod(i,2)==0)then\n ansx(i)=x(1+i/2)\n else\n ansx(i)=x(N-i/2)\n endif\n ansy(i)=ansx(i-1)-ansy(i-1)\n end do\nelse\n ansx(1)=x(N)\n ansy(1)=x(1)\n do i=2,N-1\n if(mod(i,2)==0)then\n ansx(i)=x(N-i/2)\n else\n ansx(i)=x(1+i/2)\n endif\n ansy(i)=ansx(i-1)-ansy(i-1)\n end do\nendif\n\nans=ansx(N-1)-ansy(N-1)\n\nprint\"(i0)\",ans\ndo i=1,N-1\n print\"(i0,A,i0)\",ansx(i),\" \",ansy(i)\nend do\ncontains\n\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n integer::i,k,j,l\n integer:: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on a blackboard.\n\nWe will repeat the following operation N-1 times so that we have only one integer on the blackboard.\n\nChoose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.\n\nFind the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-10^4 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.\n\nHere x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.\n\nIf there are multiple sequences of operations that maximize the final integer, any of them will be accepted.\n\nM\nx_1 y_1\n:\nx_{N-1} y_{N-1}\n\nSample Input 1\n\n3\n1 -1 2\n\nSample Output 1\n\n4\n-1 1\n2 -2\n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers written on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of integers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater integer, so the answer is 4.\n\nSample Input 2\n\n3\n1 1 1\n\nSample Output 2\n\n1\n1 1\n1 0", "sample_input": "3\n1 -1 2\n"}, "reference_outputs": ["4\n-1 1\n2 -2\n"], "source_document_id": "p03007", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, written on a blackboard.\n\nWe will repeat the following operation N-1 times so that we have only one integer on the blackboard.\n\nChoose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.\n\nFind the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-10^4 \\leq A_i \\leq 10^4\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value M of the final integer on the blackboard, and a sequence of operations x_i, y_i that maximizes the final integer, in the format below.\n\nHere x_i and y_i represent the integers x and y chosen in the i-th operation, respectively.\n\nIf there are multiple sequences of operations that maximize the final integer, any of them will be accepted.\n\nM\nx_1 y_1\n:\nx_{N-1} y_{N-1}\n\nSample Input 1\n\n3\n1 -1 2\n\nSample Output 1\n\n4\n-1 1\n2 -2\n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers written on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of integers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater integer, so the answer is 4.\n\nSample Input 2\n\n3\n1 1 1\n\nSample Output 2\n\n1\n1 1\n1 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1429, "cpu_time_ms": 106, "memory_kb": 3584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s785299138", "group_id": "codeNet:p03010", "input_text": "integer(8)::a(9)=(/1,2,4,7,12,20,29,38,52/),f(10)=0\nread(*,*)n\nf(3)=1\ndo i=4,n\n f(i)=f(i-1)*(a(i-2)+a(i-3)+1)\nenddo\ndo i=1,n\n do j=1,n\n write(*,*)merge(0_8,f(max(i,j))*a(min(i,j))+1,i==j)\n enddo\nenddo\nend", "language": "Fortran", "metadata": {"date": 1592109740, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03010.html", "problem_id": "p03010", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03010/input.txt", "sample_output_relpath": "derived/input_output/data/p03010/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03010/Fortran/s785299138.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s785299138", "user_id": "u506403362"}, "prompt_components": {"gold_output": "0 6 15\n6 0 21\n15 21 0\n", "input_to_evaluate": "integer(8)::a(9)=(/1,2,4,7,12,20,29,38,52/),f(10)=0\nread(*,*)n\nf(3)=1\ndo i=4,n\n f(i)=f(i-1)*(a(i-2)+a(i-3)+1)\nenddo\ndo i=1,n\n do j=1,n\n write(*,*)merge(0_8,f(max(i,j))*a(min(i,j))+1,i==j)\n enddo\nenddo\nend", "problem_context": "Score : 900 points\n\nProblem Statement\n\nDiverta City is a new city consisting of N towns numbered 1, 2, ..., N.\n\nThe mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided.\n\nA Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once.\nThe reversal of a Hamiltonian path is considered the same as the original Hamiltonian path.\n\nThere are N! / 2 Hamiltonian paths. Ringo wants all these paths to have distinct total lengths (the sum of the lengths of the roads on a path), to make the city diverse.\n\nFind one such set of the lengths of the roads, under the following conditions:\n\nThe length of each road must be a positive integer.\n\nThe maximum total length of a Hamiltonian path must be at most 10^{11}.\n\nConstraints\n\nN is a integer between 2 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint a set of the lengths of the roads that meets the objective, in the following format:\n\nw_{1, 1} \\ w_{1, 2} \\ w_{1, 3} \\ ... \\ w_{1, N}\nw_{2, 1} \\ w_{2, 2} \\ w_{2, 3} \\ ... \\ w_{2, N}\n: : :\nw_{N, 1} \\ w_{N, 2} \\ w_{N, 3} \\ ... \\ w_{N, N}\n\nwhere w_{i, j} is the length of the road connecting Town i and Town j, which must satisfy the following conditions:\n\nw_{i, i} = 0\n\nw_{i, j} = w_{j, i} \\ (i \\neq j)\n\n1 \\leq w_{i, j} \\leq 10^{11} \\ (i \\neq j)\n\nIf there are multiple sets of lengths of the roads that meet the objective, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n0 6 15\n6 0 21\n15 21 0\n\nThere are three Hamiltonian paths. The total lengths of these paths are as follows:\n\n1 → 2 → 3: The total length is 6 + 21 = 27.\n\n1 → 3 → 2: The total length is 15 + 21 = 36.\n\n2 → 1 → 3: The total length is 6 + 15 = 21.\n\nThey are distinct, so the objective is met.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0\n\nThere are 12 Hamiltonian paths, with distinct total lengths.", "sample_input": "3\n"}, "reference_outputs": ["0 6 15\n6 0 21\n15 21 0\n"], "source_document_id": "p03010", "source_text": "Score : 900 points\n\nProblem Statement\n\nDiverta City is a new city consisting of N towns numbered 1, 2, ..., N.\n\nThe mayor Ringo is planning to connect every pair of two different towns with a bidirectional road. The length of each road is undecided.\n\nA Hamiltonian path is a path that starts at one of the towns and visits each of the other towns exactly once.\nThe reversal of a Hamiltonian path is considered the same as the original Hamiltonian path.\n\nThere are N! / 2 Hamiltonian paths. Ringo wants all these paths to have distinct total lengths (the sum of the lengths of the roads on a path), to make the city diverse.\n\nFind one such set of the lengths of the roads, under the following conditions:\n\nThe length of each road must be a positive integer.\n\nThe maximum total length of a Hamiltonian path must be at most 10^{11}.\n\nConstraints\n\nN is a integer between 2 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint a set of the lengths of the roads that meets the objective, in the following format:\n\nw_{1, 1} \\ w_{1, 2} \\ w_{1, 3} \\ ... \\ w_{1, N}\nw_{2, 1} \\ w_{2, 2} \\ w_{2, 3} \\ ... \\ w_{2, N}\n: : :\nw_{N, 1} \\ w_{N, 2} \\ w_{N, 3} \\ ... \\ w_{N, N}\n\nwhere w_{i, j} is the length of the road connecting Town i and Town j, which must satisfy the following conditions:\n\nw_{i, i} = 0\n\nw_{i, j} = w_{j, i} \\ (i \\neq j)\n\n1 \\leq w_{i, j} \\leq 10^{11} \\ (i \\neq j)\n\nIf there are multiple sets of lengths of the roads that meet the objective, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n0 6 15\n6 0 21\n15 21 0\n\nThere are three Hamiltonian paths. The total lengths of these paths are as follows:\n\n1 → 2 → 3: The total length is 6 + 21 = 27.\n\n1 → 3 → 2: The total length is 15 + 21 = 36.\n\n2 → 1 → 3: The total length is 6 + 15 = 21.\n\nThey are distinct, so the objective is met.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n0 111 157 193\n111 0 224 239\n157 224 0 258\n193 239 258 0\n\nThere are 12 Hamiltonian paths, with distinct total lengths.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 205, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s584455944", "group_id": "codeNet:p03011", "input_text": "program Airplane\n implicit none\n integer(4):: p,q,r\n read*, p,q,r\n print*, p+q+r - max(max(p,q),r)\nend program Airplane", "language": "Fortran", "metadata": {"date": 1585416815, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03011.html", "problem_id": "p03011", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03011/input.txt", "sample_output_relpath": "derived/input_output/data/p03011/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03011/Fortran/s584455944.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s584455944", "user_id": "u234636620"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program Airplane\n implicit none\n integer(4):: p,q,r\n read*, p,q,r\n print*, p+q+r - max(max(p,q),r)\nend program Airplane", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are three airports A, B and C, and flights between each pair of airports in both directions.\n\nA one-way flight between airports A and B takes P hours, a one-way flight between airports B and C takes Q hours, and a one-way flight between airports C and A takes R hours.\n\nConsider a route where we start at one of the airports, fly to another airport and then fly to the other airport.\n\nWhat is the minimum possible sum of the flight times?\n\nConstraints\n\n1 \\leq P,Q,R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nP Q R\n\nOutput\n\nPrint the minimum possible sum of the flight times.\n\nSample Input 1\n\n1 3 4\n\nSample Output 1\n\n4\n\nThe sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n\nThe sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n\nThe sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n\nThe sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n\nThe sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n\nThe sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\nSample Input 2\n\n3 2 3\n\nSample Output 2\n\n5", "sample_input": "1 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03011", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are three airports A, B and C, and flights between each pair of airports in both directions.\n\nA one-way flight between airports A and B takes P hours, a one-way flight between airports B and C takes Q hours, and a one-way flight between airports C and A takes R hours.\n\nConsider a route where we start at one of the airports, fly to another airport and then fly to the other airport.\n\nWhat is the minimum possible sum of the flight times?\n\nConstraints\n\n1 \\leq P,Q,R \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nP Q R\n\nOutput\n\nPrint the minimum possible sum of the flight times.\n\nSample Input 1\n\n1 3 4\n\nSample Output 1\n\n4\n\nThe sum of the flight times in the route A \\rightarrow B \\rightarrow C: 1 + 3 = 4 hours\n\nThe sum of the flight times in the route A \\rightarrow C \\rightarrow C: 4 + 3 = 7 hours\n\nThe sum of the flight times in the route B \\rightarrow A \\rightarrow C: 1 + 4 = 5 hours\n\nThe sum of the flight times in the route B \\rightarrow C \\rightarrow A: 3 + 4 = 7 hours\n\nThe sum of the flight times in the route C \\rightarrow A \\rightarrow B: 4 + 1 = 5 hours\n\nThe sum of the flight times in the route C \\rightarrow B \\rightarrow A: 3 + 1 = 4 hours\n\nThe minimum of these is 4 hours.\n\nSample Input 2\n\n3 2 3\n\nSample Output 2\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 131, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s135526385", "group_id": "codeNet:p03012", "input_text": "program Balance\n implicit none\n integer(4):: n, mi, i\n integer(4),allocatable:: w(:)\n\n read*, n\n allocate(w(n))\n read*, w(:)\n\n mi = 100000\n\n do i=1,n-1\n mi = min(mi, abs(sum(w(1:i))-sum(w(i+1:n))))\n end do\n\n print*, mi\n \nend program Balance", "language": "Fortran", "metadata": {"date": 1585417173, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03012.html", "problem_id": "p03012", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03012/input.txt", "sample_output_relpath": "derived/input_output/data/p03012/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03012/Fortran/s135526385.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s135526385", "user_id": "u234636620"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program Balance\n implicit none\n integer(4):: n, mi, i\n integer(4),allocatable:: w(:)\n\n read*, n\n allocate(w(n))\n read*, w(:)\n\n mi = 100000\n\n do i=1,n-1\n mi = min(mi, abs(sum(w(1:i))-sum(w(i+1:n))))\n end do\n\n print*, mi\n \nend program Balance", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N weights indexed 1 to N. The \bmass of the weight indexed i is W_i.\n\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be the sum of the masses of the weights in the latter group.\n\nConsider all possible such divisions and find the minimum possible absolute difference of S_1 and S_2.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq W_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1 W_2 ... W_{N-1} W_N\n\nOutput\n\nPrint the minimum possible absolute difference of S_1 and S_2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n0\n\nIf T = 2, S_1 = 1 + 2 = 3 and S_2 = 3, with the absolute difference of 0.\n\nSample Input 2\n\n4\n1 3 1 1\n\nSample Output 2\n\n2\n\nIf T = 2, S_1 = 1 + 3 = 4 and S_2 = 1 + 1 = 2, with the absolute difference of 2. We cannot have a smaller absolute difference.\n\nSample Input 3\n\n8\n27 23 76 2 3 5 62 52\n\nSample Output 3\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03012", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N weights indexed 1 to N. The \bmass of the weight indexed i is W_i.\n\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be the sum of the masses of the weights in the latter group.\n\nConsider all possible such divisions and find the minimum possible absolute difference of S_1 and S_2.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq W_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1 W_2 ... W_{N-1} W_N\n\nOutput\n\nPrint the minimum possible absolute difference of S_1 and S_2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n0\n\nIf T = 2, S_1 = 1 + 2 = 3 and S_2 = 3, with the absolute difference of 0.\n\nSample Input 2\n\n4\n1 3 1 1\n\nSample Output 2\n\n2\n\nIf T = 2, S_1 = 1 + 3 = 4 and S_2 = 1 + 1 = 2, with the absolute difference of 2. We cannot have a smaller absolute difference.\n\nSample Input 3\n\n8\n27 23 76 2 3 5 62 52\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 280, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s126265911", "group_id": "codeNet:p03012", "input_text": "program main\n implicit none\n integer :: n, w(100), s1, s2, i, j, k, ms\n \n\n read(*,*)n\n read(*,*)(w(i),i = 1, n)\n ms = 1000000\n \n do j = 1, k-1\n s1 = 0\n s2 = 0\n do i = 1, j\n s1 = s1 + w(i)\n end do\n do i = j+1, n\n s2 = s2 + w(i)\n end do\n ms = min(ms, abs(s1-s2))\n end do\n\n write(*,*)ms\nend program main", "language": "Fortran", "metadata": {"date": 1570452421, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03012.html", "problem_id": "p03012", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03012/input.txt", "sample_output_relpath": "derived/input_output/data/p03012/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03012/Fortran/s126265911.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s126265911", "user_id": "u287431190"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, w(100), s1, s2, i, j, k, ms\n \n\n read(*,*)n\n read(*,*)(w(i),i = 1, n)\n ms = 1000000\n \n do j = 1, k-1\n s1 = 0\n s2 = 0\n do i = 1, j\n s1 = s1 + w(i)\n end do\n do i = j+1, n\n s2 = s2 + w(i)\n end do\n ms = min(ms, abs(s1-s2))\n end do\n\n write(*,*)ms\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N weights indexed 1 to N. The \bmass of the weight indexed i is W_i.\n\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be the sum of the masses of the weights in the latter group.\n\nConsider all possible such divisions and find the minimum possible absolute difference of S_1 and S_2.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq W_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1 W_2 ... W_{N-1} W_N\n\nOutput\n\nPrint the minimum possible absolute difference of S_1 and S_2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n0\n\nIf T = 2, S_1 = 1 + 2 = 3 and S_2 = 3, with the absolute difference of 0.\n\nSample Input 2\n\n4\n1 3 1 1\n\nSample Output 2\n\n2\n\nIf T = 2, S_1 = 1 + 3 = 4 and S_2 = 1 + 1 = 2, with the absolute difference of 2. We cannot have a smaller absolute difference.\n\nSample Input 3\n\n8\n27 23 76 2 3 5 62 52\n\nSample Output 3\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03012", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N weights indexed 1 to N. The \bmass of the weight indexed i is W_i.\n\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be the sum of the masses of the weights in the latter group.\n\nConsider all possible such divisions and find the minimum possible absolute difference of S_1 and S_2.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq W_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1 W_2 ... W_{N-1} W_N\n\nOutput\n\nPrint the minimum possible absolute difference of S_1 and S_2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n0\n\nIf T = 2, S_1 = 1 + 2 = 3 and S_2 = 3, with the absolute difference of 0.\n\nSample Input 2\n\n4\n1 3 1 1\n\nSample Output 2\n\n2\n\nIf T = 2, S_1 = 1 + 3 = 4 and S_2 = 1 + 1 = 2, with the absolute difference of 2. We cannot have a smaller absolute difference.\n\nSample Input 3\n\n8\n27 23 76 2 3 5 62 52\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 379, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s218948873", "group_id": "codeNet:p03012", "input_text": "integer N\ninteger,allocatable,dimension(:)::P\ninteger mae,ushiro\ninteger ans\nread*,N\nallocate(P(N))\nread*,P\nmae=0\nushiro=sum(P)\nans=huge(ans)\ndo i=1,N\n mae=mae+p(i)\n ushiro=ushiro-p(i)\n ans=min(ans,abs(mae-ushiro))\nend do\nprint\"(I0)\",ans\nend", "language": "Fortran", "metadata": {"date": 1560128865, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03012.html", "problem_id": "p03012", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03012/input.txt", "sample_output_relpath": "derived/input_output/data/p03012/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03012/Fortran/s218948873.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s218948873", "user_id": "u598073939"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "integer N\ninteger,allocatable,dimension(:)::P\ninteger mae,ushiro\ninteger ans\nread*,N\nallocate(P(N))\nread*,P\nmae=0\nushiro=sum(P)\nans=huge(ans)\ndo i=1,N\n mae=mae+p(i)\n ushiro=ushiro-p(i)\n ans=min(ans,abs(mae-ushiro))\nend do\nprint\"(I0)\",ans\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N weights indexed 1 to N. The \bmass of the weight indexed i is W_i.\n\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be the sum of the masses of the weights in the latter group.\n\nConsider all possible such divisions and find the minimum possible absolute difference of S_1 and S_2.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq W_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1 W_2 ... W_{N-1} W_N\n\nOutput\n\nPrint the minimum possible absolute difference of S_1 and S_2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n0\n\nIf T = 2, S_1 = 1 + 2 = 3 and S_2 = 3, with the absolute difference of 0.\n\nSample Input 2\n\n4\n1 3 1 1\n\nSample Output 2\n\n2\n\nIf T = 2, S_1 = 1 + 3 = 4 and S_2 = 1 + 1 = 2, with the absolute difference of 2. We cannot have a smaller absolute difference.\n\nSample Input 3\n\n8\n27 23 76 2 3 5 62 52\n\nSample Output 3\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03012", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N weights indexed 1 to N. The \bmass of the weight indexed i is W_i.\n\nWe will divide these weights into two groups: the weights with indices not greater than T, and those with indices greater than T, for some integer 1 \\leq T < N. Let S_1 be the sum of the masses of the weights in the former group, and S_2 be the sum of the masses of the weights in the latter group.\n\nConsider all possible such divisions and find the minimum possible absolute difference of S_1 and S_2.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq W_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nW_1 W_2 ... W_{N-1} W_N\n\nOutput\n\nPrint the minimum possible absolute difference of S_1 and S_2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n0\n\nIf T = 2, S_1 = 1 + 2 = 3 and S_2 = 3, with the absolute difference of 0.\n\nSample Input 2\n\n4\n1 3 1 1\n\nSample Output 2\n\n2\n\nIf T = 2, S_1 = 1 + 3 = 4 and S_2 = 1 + 1 = 2, with the absolute difference of 2. We cannot have a smaller absolute difference.\n\nSample Input 3\n\n8\n27 23 76 2 3 5 62 52\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 244, "cpu_time_ms": 6, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s889616659", "group_id": "codeNet:p03013", "input_text": " PROGRAM TypicalStairs\n IMPLICIT NONE\n integer(16) :: n,m,a(10**5)\n integer(16) :: i,pattern(-1:10**5),aCnt=1\n \n read*,n,m\n do i = 1,m\n read*,a(i)\n end do\n \n pattern = 0\n !i=1\n if( a(aCnt)==1 )then\n pattern(1) = 0\n aCnt = aCnt + 1\n else\n pattern(1) = 1\n end if\n \n !i=2\n if( a(aCnt)==2 )then\n pattern(2) = 0\n aCnt = aCnt + 1\n else\n pattern(2) = pattern(1) + 1\n end if\n \n do i = 3,n\n if( a(aCnt)==i )then\n pattern(i) = 0\n aCnt = aCnt + 1\n else\n pattern(i) = pattern(i-2) + pattern(i-1)\n pattern(i) = mod(pattern(i),10**9+7)\n end if\n end do\n \n print*,pattern(n)\n ! print*,pattern(1:n)\n \n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1589434532, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03013.html", "problem_id": "p03013", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03013/input.txt", "sample_output_relpath": "derived/input_output/data/p03013/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03013/Fortran/s889616659.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s889616659", "user_id": "u171356453"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": " PROGRAM TypicalStairs\n IMPLICIT NONE\n integer(16) :: n,m,a(10**5)\n integer(16) :: i,pattern(-1:10**5),aCnt=1\n \n read*,n,m\n do i = 1,m\n read*,a(i)\n end do\n \n pattern = 0\n !i=1\n if( a(aCnt)==1 )then\n pattern(1) = 0\n aCnt = aCnt + 1\n else\n pattern(1) = 1\n end if\n \n !i=2\n if( a(aCnt)==2 )then\n pattern(2) = 0\n aCnt = aCnt + 1\n else\n pattern(2) = pattern(1) + 1\n end if\n \n do i = 3,n\n if( a(aCnt)==i )then\n pattern(i) = 0\n aCnt = aCnt + 1\n else\n pattern(i) = pattern(i-2) + pattern(i-1)\n pattern(i) = mod(pattern(i),10**9+7)\n end if\n end do\n \n print*,pattern(n)\n ! print*,pattern(1:n)\n \n \n \n \n END PROGRAM", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "sample_input": "6 1\n3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03013", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 857, "cpu_time_ms": 44, "memory_kb": 5892}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s473882662", "group_id": "codeNet:p03013", "input_text": "program ccc\n\nimplicit none\n\ninteger :: n, m, i\ninteger,allocatable,dimension(:) :: a, dp\n\nread*, n, m\nallocate(a(m))\nallocate(dp(0:n))\nif(m/=0) then\nread*, a\nelse\na=0\nend if\n\ndp=1\n\ndo i=1,m\ndp(a(i))=0\nend do\n\ndo i=2,n\nif(dp(i)==1) then \ndp(i)=mod(dp(i-2)+dp(i-1),1000000007)\nend if\nend do\n\nwrite(*,'(i0)') dp(n)\n\nend program", "language": "Fortran", "metadata": {"date": 1570302245, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03013.html", "problem_id": "p03013", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03013/input.txt", "sample_output_relpath": "derived/input_output/data/p03013/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03013/Fortran/s473882662.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s473882662", "user_id": "u039189422"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program ccc\n\nimplicit none\n\ninteger :: n, m, i\ninteger,allocatable,dimension(:) :: a, dp\n\nread*, n, m\nallocate(a(m))\nallocate(dp(0:n))\nif(m/=0) then\nread*, a\nelse\na=0\nend if\n\ndp=1\n\ndo i=1,m\ndp(a(i))=0\nend do\n\ndo i=2,n\nif(dp(i)==1) then \ndp(i)=mod(dp(i-2)+dp(i-1),1000000007)\nend if\nend do\n\nwrite(*,'(i0)') dp(n)\n\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "sample_input": "6 1\n3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03013", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 324, "cpu_time_ms": 26, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s813125115", "group_id": "codeNet:p03013", "input_text": "program main\n integer(16) n,m,i,p\n integer(16), allocatable :: a(:),pat(:)\n \n p=0\n read(*,*) n,m\n if(m==0)then\n p=-1\n end if\n \n if(p==0)then\n allocate(a(1:m),pat(1:n+2))\n read(*,*) a\n do i=1,n\n pat(i)=0\n end do\n \n pat(a(1)+1)=-1\n do i=2,m\n if(a(i)==a(i-1)+1)then\n p=-1\n exit\n end if\n pat(a(i)+1) = -1\n end do\n \n pat(1)=1\n if(p==0)then\n do i=1,n\n if(pat(i)/=-1)then\n if(pat(i+1)/=-1)then\n pat(i+1)=mod(pat(i+1)+pat(i),1000000007)\n end if\n if(pat(i+2)/=-1)then\n pat(i+2)=mod(pat(i+2)+pat(i),1000000007)\n end if\n end if\n end do\n end if\n end if\n \n write(*,*) pat(n+1)\nend program main", "language": "Fortran", "metadata": {"date": 1560169282, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03013.html", "problem_id": "p03013", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03013/input.txt", "sample_output_relpath": "derived/input_output/data/p03013/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03013/Fortran/s813125115.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s813125115", "user_id": "u671401989"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main\n integer(16) n,m,i,p\n integer(16), allocatable :: a(:),pat(:)\n \n p=0\n read(*,*) n,m\n if(m==0)then\n p=-1\n end if\n \n if(p==0)then\n allocate(a(1:m),pat(1:n+2))\n read(*,*) a\n do i=1,n\n pat(i)=0\n end do\n \n pat(a(1)+1)=-1\n do i=2,m\n if(a(i)==a(i-1)+1)then\n p=-1\n exit\n end if\n pat(a(i)+1) = -1\n end do\n \n pat(1)=1\n if(p==0)then\n do i=1,n\n if(pat(i)/=-1)then\n if(pat(i+1)/=-1)then\n pat(i+1)=mod(pat(i+1)+pat(i),1000000007)\n end if\n if(pat(i+2)/=-1)then\n pat(i+2)=mod(pat(i+2)+pat(i),1000000007)\n end if\n end if\n end do\n end if\n end if\n \n write(*,*) pat(n+1)\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "sample_input": "6 1\n3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03013", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 642, "cpu_time_ms": 98, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s010967128", "group_id": "codeNet:p03013", "input_text": "module ABC129\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_C\n\n ! contained s and s are below\n contains\n\n subroutine task_C\n\n ! variables for this \n integer(INT32) :: num_stairs_total\n integer(INT32) :: num_stairs_broken\n integer(INT64) :: sum_ways\n\n ! arrays for this \n integer(INT32), allocatable :: index_broken_stair(:)\n integer(INT64), allocatable :: list_sum_ways(:)\n\n ! support variables for this \n integer(INT32) :: itr\n\n ! STEP.01\n ! read out the number of total & broken stairs\n read(unit=INPUT_UNIT, fmt=*) num_stairs_total, num_stairs_broken\n\n ! STEP.02\n ! allocate the array to store ...\n ! 1. the indexes of broken stairs\n ! 2. how many are there to climb up to the `itr`-th step\n allocate( index_broken_stair(1:num_stairs_broken) )\n allocate( list_sum_ways (1:num_stairs_total ) )\n\n ! STEP.03\n ! read out indexes of broken stairs\n do itr = 1_INT32, num_stairs_broken, 1_INT32\n read(unit=INPUT_UNIT, fmt=*) index_broken_stair(itr)\n end do\n\n ! STEP.04\n ! check which step can not be stepped\n list_sum_ways(1) = 1_INT64\n list_sum_ways(2) = 2_INT64\n list_sum_ways(3:num_stairs_total) = -1_INT64\n\n do itr = 1_INT32, num_stairs_broken, 1_INT32\n list_sum_ways( index_broken_stair(itr) ) = 0_INT64\n end do\n\n ! STEP.05\n ! calculate how many are there to climb up to the top step\n do itr = 3_INT32, num_stairs_total, 1_INT32\n if ( list_sum_ways(itr) .eq. 0_INT64 ) then\n continue\n else\n list_sum_ways(itr) = list_sum_ways(itr-2) + list_sum_ways(itr-1)\n end if\n end do\n\n if ( sum_ways .ne. 0_INT64 ) sum_ways = mod( list_sum_ways(num_stairs_total), 1000000007_INT64 )\n\n ! STEP.06\n ! output how many are there to climb up to the top step\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') sum_ways\n\n ! STEP.07\n ! deallocate the array to store the indexes of broken stairs\n deallocate( index_broken_stair )\n deallocate( list_sum_ways )\n\n ! STEP.END\n return\n\n end subroutine task_C\n\nend module ABC129\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC129\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_C\n\nend program main", "language": "Fortran", "metadata": {"date": 1560135812, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03013.html", "problem_id": "p03013", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03013/input.txt", "sample_output_relpath": "derived/input_output/data/p03013/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03013/Fortran/s010967128.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s010967128", "user_id": "u484703930"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "module ABC129\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_C\n\n ! contained s and s are below\n contains\n\n subroutine task_C\n\n ! variables for this \n integer(INT32) :: num_stairs_total\n integer(INT32) :: num_stairs_broken\n integer(INT64) :: sum_ways\n\n ! arrays for this \n integer(INT32), allocatable :: index_broken_stair(:)\n integer(INT64), allocatable :: list_sum_ways(:)\n\n ! support variables for this \n integer(INT32) :: itr\n\n ! STEP.01\n ! read out the number of total & broken stairs\n read(unit=INPUT_UNIT, fmt=*) num_stairs_total, num_stairs_broken\n\n ! STEP.02\n ! allocate the array to store ...\n ! 1. the indexes of broken stairs\n ! 2. how many are there to climb up to the `itr`-th step\n allocate( index_broken_stair(1:num_stairs_broken) )\n allocate( list_sum_ways (1:num_stairs_total ) )\n\n ! STEP.03\n ! read out indexes of broken stairs\n do itr = 1_INT32, num_stairs_broken, 1_INT32\n read(unit=INPUT_UNIT, fmt=*) index_broken_stair(itr)\n end do\n\n ! STEP.04\n ! check which step can not be stepped\n list_sum_ways(1) = 1_INT64\n list_sum_ways(2) = 2_INT64\n list_sum_ways(3:num_stairs_total) = -1_INT64\n\n do itr = 1_INT32, num_stairs_broken, 1_INT32\n list_sum_ways( index_broken_stair(itr) ) = 0_INT64\n end do\n\n ! STEP.05\n ! calculate how many are there to climb up to the top step\n do itr = 3_INT32, num_stairs_total, 1_INT32\n if ( list_sum_ways(itr) .eq. 0_INT64 ) then\n continue\n else\n list_sum_ways(itr) = list_sum_ways(itr-2) + list_sum_ways(itr-1)\n end if\n end do\n\n if ( sum_ways .ne. 0_INT64 ) sum_ways = mod( list_sum_ways(num_stairs_total), 1000000007_INT64 )\n\n ! STEP.06\n ! output how many are there to climb up to the top step\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') sum_ways\n\n ! STEP.07\n ! deallocate the array to store the indexes of broken stairs\n deallocate( index_broken_stair )\n deallocate( list_sum_ways )\n\n ! STEP.END\n return\n\n end subroutine task_C\n\nend module ABC129\n\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC129\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_C\n\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "sample_input": "6 1\n3\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03013", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a staircase with N steps. Takahashi is now standing at the foot of the stairs, that is, on the 0-th step.\nHe can climb up one or two steps at a time.\n\nHowever, the treads of the a_1-th, a_2-th, a_3-th, \\ldots, a_M-th steps are broken, so it is dangerous to set foot on those steps.\n\nHow many are there to climb up to the top step, that is, the N-th step, without setting foot on the broken steps?\nFind the count modulo 1\\ 000\\ 000\\ 007.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq M \\leq N-1\n\n1 \\leq a_1 < a_2 < ... < a_M \\leq N-1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1\na_2\n.\n.\n.\na_M\n\nOutput\n\nPrint the number of ways to climb up the stairs under the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n6 1\n3\n\nSample Output 1\n\n4\n\nThere are four ways to climb up the stairs, as follows:\n\n0 \\to 1 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 1 \\to 2 \\to 4 \\to 6\n\n0 \\to 2 \\to 4 \\to 5 \\to 6\n\n0 \\to 2 \\to 4 \\to 6\n\nSample Input 2\n\n10 2\n4\n5\n\nSample Output 2\n\n0\n\nThere may be no way to climb up the stairs without setting foot on the broken steps.\n\nSample Input 3\n\n100 5\n1\n23\n45\n67\n89\n\nSample Output 3\n\n608200469\n\nBe sure to print the count modulo 1\\ 000\\ 000\\ 007.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2521, "cpu_time_ms": 35, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s151493606", "group_id": "codeNet:p03014", "input_text": "implicit none\n\ninteger :: h,w\ncharacter(2000) :: s\nlogical,allocatable :: map(:,:)\ninteger,allocatable :: n(:,:)\ninteger :: i,j,k\n\nread *,h,w\nallocate(map(h,w))\nmap(:,:) = .false.\ndo i = 1, h\n read *,s\n do j = 1, w\n if (s(j:j) == '#') then\n map(i,j) = .true.\n endif\n enddo\nenddo\n\nallocate(n(h,w))\nn(:,:) = 0\n\ndo i = 1, h\n j = 1\n k = 0\n do while (j <= w)\n if (map(i,j)) then\n if (k > 0) then\n n(i,k:j-1) = j-k\n endif\n k = 0\n else\n if (k == 0) then\n k = j\n endif\n endif\n j = j + 1\n enddo\n if (k > 0) then\n n(i,k:w) = w - k + 1\n endif\nenddo\n\ndo j = 1, w\n i = 1\n k = 0\n do while (i <= h)\n if (map(i,j)) then\n if (k > 0) then\n n(k:i-1,j) = n(k:i-1,j) + i-k\n endif\n k = 0\n else\n if (k == 0) then\n k = i\n endif\n endif\n i = i + 1\n enddo\n if (k > 0) then\n n(k:h,j) = n(k:h,j) + h - k + 1\n endif\nenddo\n\nn(:,:) = n(:,:) - 1\n\nprint '(i0)',maxval(n)\n\nstop\nend", "language": "Fortran", "metadata": {"date": 1565349451, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03014.html", "problem_id": "p03014", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03014/input.txt", "sample_output_relpath": "derived/input_output/data/p03014/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03014/Fortran/s151493606.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s151493606", "user_id": "u193540507"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "implicit none\n\ninteger :: h,w\ncharacter(2000) :: s\nlogical,allocatable :: map(:,:)\ninteger,allocatable :: n(:,:)\ninteger :: i,j,k\n\nread *,h,w\nallocate(map(h,w))\nmap(:,:) = .false.\ndo i = 1, h\n read *,s\n do j = 1, w\n if (s(j:j) == '#') then\n map(i,j) = .true.\n endif\n enddo\nenddo\n\nallocate(n(h,w))\nn(:,:) = 0\n\ndo i = 1, h\n j = 1\n k = 0\n do while (j <= w)\n if (map(i,j)) then\n if (k > 0) then\n n(i,k:j-1) = j-k\n endif\n k = 0\n else\n if (k == 0) then\n k = j\n endif\n endif\n j = j + 1\n enddo\n if (k > 0) then\n n(i,k:w) = w - k + 1\n endif\nenddo\n\ndo j = 1, w\n i = 1\n k = 0\n do while (i <= h)\n if (map(i,j)) then\n if (k > 0) then\n n(k:i-1,j) = n(k:i-1,j) + i-k\n endif\n k = 0\n else\n if (k == 0) then\n k = i\n endif\n endif\n i = i + 1\n enddo\n if (k > 0) then\n n(k:h,j) = n(k:h,j) + h - k + 1\n endif\nenddo\n\nn(:,:) = n(:,:) - 1\n\nprint '(i0)',maxval(n)\n\nstop\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "sample_input": "4 6\n#..#..\n.....#\n....#.\n#.#...\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03014", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere is a grid with H horizontal rows and W vertical columns, and there are obstacles on some of the squares.\n\nSnuke is going to choose one of the squares not occupied by an obstacle and place a lamp on it.\nThe lamp placed on the square will emit straight beams of light in four cardinal directions: up, down, left, and right.\nIn each direction, the beam will continue traveling until it hits a square occupied by an obstacle or it hits the border of the grid. It will light all the squares on the way, including the square on which the lamp is placed, but not the square occupied by an obstacle.\n\nSnuke wants to maximize the number of squares lighted by the lamp.\n\nYou are given H strings S_i (1 \\leq i \\leq H), each of length W. If the j-th character (1 \\leq j \\leq W) of S_i is #, there is an obstacle on the square at the i-th row from the top and the j-th column from the left; if that character is ., there is no obstacle on that square.\n\nFind the maximum possible number of squares lighted by the lamp.\n\nConstraints\n\n1 \\leq H \\leq 2,000\n\n1 \\leq W \\leq 2,000\n\nS_i is a string of length W consisting of # and ..\n\n. occurs at least once in one of the strings S_i (1 \\leq i \\leq H).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\n:\nS_H\n\nOutput\n\nPrint the maximum possible number of squares lighted by the lamp.\n\nSample Input 1\n\n4 6\n#..#..\n.....#\n....#.\n#.#...\n\nSample Output 1\n\n8\n\nIf Snuke places the lamp on the square at the second row from the top and the second column from the left, it will light the following squares: the first through fifth squares from the left in the second row, and the first through fourth squares from the top in the second column, for a total of eight squares.\n\nSample Input 2\n\n8 8\n..#...#.\n....#...\n##......\n..###..#\n...#..#.\n##....#.\n#...#...\n###.#..#\n\nSample Output 2\n\n13", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1068, "cpu_time_ms": 130, "memory_kb": 31488}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s902322914", "group_id": "codeNet:p03017", "input_text": "program kenken\n implicit none\n integer n, a, b, c, d\n integer i, p, q, r, sum\n character(20000) s\n read*, n, a, b, c, d\n read*, s\n p=0\n q=0\n r=0\n sum=0\n \n if (c < d) then\n \n do i=b, d-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"No\"\n return\n end if\n end do\n s(d:d)=\"#\"\n do i=a, c-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"No\"\n return\n end if\n end do\n print*, \"Yes\"\n return\n end if\n \n if (c > d) then\n \n do i=b,d-2\n p=index(s(i:i),\".\")\n q=index(s(i+1:i+1),\".\")\n r=index(s(i+2:i+2),\".\")\n if((p+q+r).eq.3) then\n sum = i+1\n p=0\n q=0\n r=0\n end if\n end do\n \n if(sum.ne.0) then\n s(sum:sum)=\"#\"\n do i=a, c-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"NO\"\n return\n end if\n end do\n s(c:c)=\"#\"\n do i=b, d-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"NO\"\n print*, sum\n return\n end if\n end do\n print*, \"Yes\"\n return\n end if\n \n if (sum.eq.0) then\n do i=b, d-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"No\"\n return\n end if\n end do\n s(d:d)=\"#\"\n do i=a, c-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"No\"\n return\n end if\n end do\n print*, \"Yes\"\n return\n end if\n end if\nend program", "language": "Fortran", "metadata": {"date": 1559527089, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03017.html", "problem_id": "p03017", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03017/input.txt", "sample_output_relpath": "derived/input_output/data/p03017/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03017/Fortran/s902322914.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s902322914", "user_id": "u039189422"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program kenken\n implicit none\n integer n, a, b, c, d\n integer i, p, q, r, sum\n character(20000) s\n read*, n, a, b, c, d\n read*, s\n p=0\n q=0\n r=0\n sum=0\n \n if (c < d) then\n \n do i=b, d-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"No\"\n return\n end if\n end do\n s(d:d)=\"#\"\n do i=a, c-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"No\"\n return\n end if\n end do\n print*, \"Yes\"\n return\n end if\n \n if (c > d) then\n \n do i=b,d-2\n p=index(s(i:i),\".\")\n q=index(s(i+1:i+1),\".\")\n r=index(s(i+2:i+2),\".\")\n if((p+q+r).eq.3) then\n sum = i+1\n p=0\n q=0\n r=0\n end if\n end do\n \n if(sum.ne.0) then\n s(sum:sum)=\"#\"\n do i=a, c-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"NO\"\n return\n end if\n end do\n s(c:c)=\"#\"\n do i=b, d-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"NO\"\n print*, sum\n return\n end if\n end do\n print*, \"Yes\"\n return\n end if\n \n if (sum.eq.0) then\n do i=b, d-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"No\"\n return\n end if\n end do\n s(d:d)=\"#\"\n do i=a, c-1\n p=index(s(i:i),\"#\")\n q=index(s(i+1:i+1),\"#\")\n if ((p+q).eq.2) then\n print*, \"No\"\n return\n end if\n end do\n print*, \"Yes\"\n return\n end if\n end if\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "sample_input": "7 1 3 6 7\n.#..#..\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03017", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares arranged in a row, numbered 1, 2, ..., N from left to right.\nYou are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.\n\nIn the beginning, Snuke stands on Square A, and Fnuke stands on Square B.\n\nYou can repeat the following operation any number of times:\n\nChoose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.\n\nYou want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.\n\nDetermine whether this is possible.\n\nConstraints\n\n4 \\leq N \\leq 200\\ 000\n\nS is a string of length N consisting of . and #.\n\n1 \\leq A, B, C, D \\leq N\n\nSquare A, B, C and D do not contain a rock.\n\nA, B, C and D are all different.\n\nA < B\n\nA < C\n\nB < D\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\nS\n\nOutput\n\nPrint Yes if the objective is achievable, and No if it is not.\n\nSample Input 1\n\n7 1 3 6 7\n.#..#..\n\nSample Output 1\n\nYes\n\nThe objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)\n\nA#B.#..\n\nA#.B#..\n\n.#AB#..\n\n.#A.#B.\n\n.#.A#B.\n\n.#.A#.B\n\n.#..#AB\n\nSample Input 2\n\n7 1 3 7 6\n.#..#..\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n15 1 3 15 13\n...#.#...#.#...\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1396, "cpu_time_ms": 101, "memory_kb": 1000}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s255237977", "group_id": "codeNet:p03023", "input_text": "program sample\n\timplicit none\n real(8) :: N\n \n read(*,*) N\n \n\twrite(*,*) 180*(N-2)\n\n\tstop\nend program sample\n\n", "language": "Fortran", "metadata": {"date": 1592630919, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03023.html", "problem_id": "p03023", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03023/input.txt", "sample_output_relpath": "derived/input_output/data/p03023/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03023/Fortran/s255237977.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s255237977", "user_id": "u323210830"}, "prompt_components": {"gold_output": "180\n", "input_to_evaluate": "program sample\n\timplicit none\n real(8) :: N\n \n read(*,*) N\n \n\twrite(*,*) 180*(N-2)\n\n\tstop\nend program sample\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint an integer representing the sum of the interior angles of a regular polygon with N sides.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n180\n\nThe sum of the interior angles of a regular triangle is 180 degrees.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n17640", "sample_input": "3\n"}, "reference_outputs": ["180\n"], "source_document_id": "p03023", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint an integer representing the sum of the interior angles of a regular polygon with N sides.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n180\n\nThe sum of the interior angles of a regular triangle is 180 degrees.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n17640", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 6, "memory_kb": 3000}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s348835750", "group_id": "codeNet:p03023", "input_text": "program main\n\timplicit none\n integer::a\n read(*,*)a\n write(*,*) 180*(a-2)\n stop\nend program main", "language": "Fortran", "metadata": {"date": 1592629754, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03023.html", "problem_id": "p03023", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03023/input.txt", "sample_output_relpath": "derived/input_output/data/p03023/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03023/Fortran/s348835750.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s348835750", "user_id": "u884601206"}, "prompt_components": {"gold_output": "180\n", "input_to_evaluate": "program main\n\timplicit none\n integer::a\n read(*,*)a\n write(*,*) 180*(a-2)\n stop\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint an integer representing the sum of the interior angles of a regular polygon with N sides.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n180\n\nThe sum of the interior angles of a regular triangle is 180 degrees.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n17640", "sample_input": "3\n"}, "reference_outputs": ["180\n"], "source_document_id": "p03023", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven an integer N not less than 3, find the sum of the interior angles of a regular polygon with N sides.\n\nPrint the answer in degrees, but do not print units.\n\nConstraints\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint an integer representing the sum of the interior angles of a regular polygon with N sides.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n180\n\nThe sum of the interior angles of a regular triangle is 180 degrees.\n\nSample Input 2\n\n100\n\nSample Output 2\n\n17640", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 108, "cpu_time_ms": 5, "memory_kb": 2828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s650094730", "group_id": "codeNet:p03024", "input_text": "program siax\n implicit none\n integer :: N,l,i\n\n real(8) :: c,d,e\n character(len=15) :: S\n read(*,*) S\n l=0\n do i=1,len_trim(S)\n if(S(i:i).eq.'o') then\n l=l+1\n endif\n enddo\n if((15-len_trim(S)+l).lt.8) then\n write(*,'(a)') 'NO'\n else\n write(*,'(a)') 'YES'\n endif\n! write(*,'(i0)') l \nend program siax\n\n", "language": "Fortran", "metadata": {"date": 1559437923, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03024.html", "problem_id": "p03024", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03024/input.txt", "sample_output_relpath": "derived/input_output/data/p03024/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03024/Fortran/s650094730.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s650094730", "user_id": "u613124399"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program siax\n implicit none\n integer :: N,l,i\n\n real(8) :: c,d,e\n character(len=15) :: S\n read(*,*) S\n l=0\n do i=1,len_trim(S)\n if(S(i:i).eq.'o') then\n l=l+1\n endif\n enddo\n if((15-len_trim(S)+l).lt.8) then\n write(*,'(a)') 'NO'\n else\n write(*,'(a)') 'YES'\n endif\n! write(*,'(i0)') l \nend program siax\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is competing in a sumo tournament.\nThe tournament lasts for 15 days, during which he performs in one match per day.\nIf he wins 8 or more matches, he can also participate in the next tournament.\n\nThe matches for the first k days have finished.\nYou are given the results of Takahashi's matches as a string S consisting of o and x.\nIf the i-th character in S is o, it means that Takahashi won the match on the i-th day; if that character is x, it means that Takahashi lost the match on the i-th day.\n\nPrint YES if there is a possibility that Takahashi can participate in the next tournament, and print NO if there is no such possibility.\n\nConstraints\n\n1 \\leq k \\leq 15\n\nS is a string of length k consisting of o and x.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint YES if there is a possibility that Takahashi can participate in the next tournament, and print NO otherwise.\n\nSample Input 1\n\noxoxoxoxoxoxox\n\nSample Output 1\n\nYES\n\nTakahashi has 7 wins and 7 losses before the last match. If he wins that match, he will have 8 wins.\n\nSample Input 2\n\nxxxxxxxx\n\nSample Output 2\n\nNO", "sample_input": "oxoxoxoxoxoxox\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03024", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is competing in a sumo tournament.\nThe tournament lasts for 15 days, during which he performs in one match per day.\nIf he wins 8 or more matches, he can also participate in the next tournament.\n\nThe matches for the first k days have finished.\nYou are given the results of Takahashi's matches as a string S consisting of o and x.\nIf the i-th character in S is o, it means that Takahashi won the match on the i-th day; if that character is x, it means that Takahashi lost the match on the i-th day.\n\nPrint YES if there is a possibility that Takahashi can participate in the next tournament, and print NO if there is no such possibility.\n\nConstraints\n\n1 \\leq k \\leq 15\n\nS is a string of length k consisting of o and x.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint YES if there is a possibility that Takahashi can participate in the next tournament, and print NO otherwise.\n\nSample Input 1\n\noxoxoxoxoxoxox\n\nSample Output 1\n\nYES\n\nTakahashi has 7 wins and 7 losses before the last match. If he wins that match, he will have 8 wins.\n\nSample Input 2\n\nxxxxxxxx\n\nSample Output 2\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 468, "cpu_time_ms": 7, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s008722336", "group_id": "codeNet:p03026", "input_text": "! fenwic treeでバグらない要注意\n\nmodule vector_int32_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n type,public:: vector_int32\n integer(int32),allocatable:: array(:)\n integer(int32),private:: l=0\n contains\n procedure:: push_back=>vec_push_back, insert=>vec_insert\n procedure:: pop_back=>vec_pop_back, pop=>vec_pop, erase => vec_erase\n procedure:: at=>vec_at, back=>vec_back, head=>vec_head\n procedure:: size=>vec_size, to_array=>vec_to_array\n end type\ncontains\n pure function vec_size(vec) result(ret)\n class(vector_int32),intent(in):: vec\n integer(int32):: ret\n\n ret = vec%l\n end function\n\n\n pure subroutine check_array_allocation(vec)\n type(vector_int32),intent(inout):: vec\n\n if (.not. allocated(vec%array)) allocate(vec%array(1))\n end subroutine\n\n\n function vec_at(vec,i) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32):: i,ret\n\n call check_array_allocation(vec)\n ret = vec%array(i)\n end function\n\n\n function vec_back(vec) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32):: ret\n \n ret = vec%at(vec%l)\n end function\n\n\n function vec_head(vec) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32):: ret\n \n ret = vec%at(1)\n end function\n\n\n pure subroutine vec_append_array(vec,l,r)\n type(vector_int32),intent(inout):: vec\n integer(int32),intent(in):: l,r\n integer(int32),allocatable:: tmp(:)\n \n allocate(tmp(l:2*r))\n tmp(l:r) = vec%array(l:r)\n call move_alloc(tmp, vec%array)\n end subroutine\n\n\n pure subroutine vec_reduce_array(vec,l,r)\n type(vector_int32),intent(inout):: vec\n integer(int32),intent(in):: l,r\n integer(int32),allocatable:: tmp(:)\n \n allocate(tmp(l:r/2))\n tmp(l:r/2) = vec%array(l:r/2)\n call move_alloc(tmp, vec%array)\n end subroutine\n\n\n pure subroutine check_allocation_size(vec)\n type(vector_int32),intent(inout):: vec\n integer(int32):: len_alloc\n\n call check_array_allocation(vec)\n len_alloc = size(vec%array)\n if (vec%l >= len_alloc) then\n call vec_append_array(vec,1,len_alloc)\n else if (vec%l <= len_alloc/2) then\n call vec_reduce_array(vec,1,len_alloc)\n end if\n end subroutine\n\n\n pure subroutine vec_push_back(vec, v)\n class(vector_int32),intent(inout):: vec\n integer(int32),intent(in):: v\n\n vec%l=vec%l+1\n call check_allocation_size(vec)\n vec%array(vec%l) = v\n end subroutine\n\n\n pure subroutine vec_insert(vec,i,v)\n class(vector_int32),intent(inout):: vec\n integer(int32),intent(in)::i, v\n\n vec%l=vec%l+1\n call check_allocation_size(vec)\n vec%array(i+1:vec%l+1) = vec%array(i:vec%l)\n vec%array(i) = v\n end subroutine\n\n\n function vec_pop_back(vec) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32):: ret\n\n ret = vec%back()\n vec%l=vec%l-1\n call check_allocation_size(vec)\n end function\n\n\n function vec_pop(vec,i) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32),intent(in):: i\n integer(int32):: ret\n\n ret = vec%at(i)\n vec%l=vec%l-1\n vec%array(i:vec%l) = vec%array(i+1:vec%l+1)\n call check_allocation_size(vec)\n end function\n\n\n subroutine vec_erase(vec,i)\n class(vector_int32):: vec\n integer(int32),intent(in):: i\n integer(int32):: dmp\n\n dmp = vec%pop(i)\n end subroutine\n\n\n function vec_to_array(vec) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32):: ret(1:vec%l)\n\n call check_array_allocation(vec)\n ret = vec%array(1:vec%l)\n end function\nend module\n\n\nmodule merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort\n\n interface merge_sort\n module procedure ms32, ms64\n end interface\ncontains\n recursive subroutine ms32(ar)\n integer(int32),intent(inout):: ar(:)\n integer(int32):: m\n\n if (size(ar) <= 1) then\n return\n else\n m = size(ar)/2\n call ms32(ar(:m)); call ms32(ar(m+1:))\n call sub_ms32(ar)\n end if\n end subroutine\n\n\n subroutine sub_ms32(ar)\n integer(int32),intent(inout):: ar(:)\n integer(int32):: tmp(1:size(ar))\n integer(int32):: m,l,r,i\n \n tmp(:) = ar(:)\n m = size(ar)/2; l=1;r=m+1\n do i=1,size(ar)\n if (m < l) then\n ar(i:)=tmp(r:); return \n else if (size(ar) < r) then\n ar(i:)=tmp(l:m); return\n else\n if (tmp(l) <= tmp(r)) then\n ar(i) = tmp(l); l=l+1\n else\n ar(i) = tmp(r); r=r+1\n end if\n end if\n end do\n end subroutine\n\n\n recursive subroutine ms64(ar)\n integer(int64),intent(inout):: ar(:)\n integer(int32):: m\n\n if (size(ar) <= 1) then\n return\n else\n m = size(ar)/2\n call ms64(ar(:m)); call ms64(ar(m+1:))\n call sub_ms64(ar)\n end if\n end subroutine\n\n\n subroutine sub_ms64(ar)\n integer(int64),intent(inout):: ar(:)\n integer(int64):: tmp(1:size(ar))\n integer(int32):: m,l,r,i\n \n tmp(:) = ar(:)\n m = size(ar)/2; l=1;r=m+1\n do i=1,size(ar)\n if (m < l) then\n ar(i:)=tmp(r:); return\n else if (size(ar) < r) then\n ar(i:)=tmp(l:r); return\n else\n if (tmp(l) <= tmp(r)) then\n ar(i) = tmp(l); l=l+1\n else\n ar(i) = tmp(r); r=r+1\n end if\n end if\n end do\n end subroutine\nend module\n\n\n! ar1のソート順序でar2もソートする。\nmodule double_merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: double_merge_sort\n\n interface double_merge_sort\n module procedure dms32, dms64\n end interface\ncontains\n recursive subroutine dms32(ar1, ar2)\n integer(int32),intent(inout):: ar1(:), ar2(:)\n integer(int32):: m\n\n if (size(ar1) <= 1) then\n return\n else\n m = size(ar1)/2\n call dms32(ar1(:m), ar2(:m))\n call dms32(ar1(m+1:), ar2(m+1:))\n call sub_ms32(ar1,ar2)\n end if\n end subroutine\n\n\n subroutine sub_ms32(ar1, ar2)\n integer(int32),intent(inout):: ar1(:), ar2(:)\n integer(int32):: tmp1(1:size(ar1)), tmp2(1:size(ar2))\n integer(int32):: m,l,r,i\n\n m=size(ar1)/2; l=1; r=m+1\n tmp1(:)=ar1(:); tmp2(:)=ar2(:)\n\n do i=1,size(ar1)\n if (m < l) then\n ar1(i:) = tmp1(r:)\n ar2(i:) = tmp2(r:)\n return\n else if (size(ar1) < r) then\n ar1(i:) = tmp1(l:m)\n ar2(i:) = tmp2(l:m)\n return\n else\n if (tmp1(l) <= tmp1(r)) then\n ar1(i) = tmp1(l)\n ar2(i) = tmp2(l)\n l=l+1\n else\n ar1(i) = tmp1(r)\n ar2(i) = tmp2(r)\n r=r+1\n end if\n end if\n end do\n end subroutine\n\n\n recursive subroutine dms64(ar1, ar2)\n integer(int64),intent(inout):: ar1(:), ar2(:)\n integer(int32):: m\n\n if (size(ar1) <= 1) then\n return\n else\n m = size(ar1)/2\n call dms64(ar1(:m), ar2(:m))\n call dms64(ar1(m+1:), ar2(m+1:))\n call sub_ms64(ar1,ar2)\n end if\n end subroutine\n\n\n subroutine sub_ms64(ar1, ar2)\n integer(int64),intent(inout):: ar1(:), ar2(:)\n integer(int64):: tmp1(1:size(ar1)), tmp2(1:size(ar2))\n integer(int32):: m,l,r,i\n\n m=size(ar1)/2; l=1; r=m+1\n tmp1(:)=ar1(:); tmp2(:)=ar2(:)\n\n do i=1,size(ar1)\n if (m < l) then\n ar1(i:) = tmp1(r:)\n ar2(i:) = tmp2(r:)\n return\n else if (size(ar1) < r) then\n ar1(i:) = tmp1(l:m)\n ar2(i:) = tmp2(l:m)\n return\n else\n if (tmp1(l) <= tmp1(r)) then\n ar1(i) = tmp1(l)\n ar2(i) = tmp2(l)\n l=l+1\n else\n ar1(i) = tmp1(r)\n ar2(i) = tmp2(r)\n r=r+1\n end if\n end if\n end do\n end subroutine\nend module\n\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use vector_int32_mod\n use merge_sort_mod\n use double_merge_sort_mod\n implicit none\n integer(int32):: n,a,b,i\n integer(int32), allocatable:: c(:), ne(:), d(:), leaf(:), ind(:), ans(:)\n type(vector_int32),allocatable:: g(:)\n\n read*, n\n allocate(ne(n),source=0)\n allocate(d(n),source=n+100)\n allocate(g(n))\n\n do i=1,n-1\n read*, a,b\n call g(a)%push_back(b)\n call g(b)%push_back(a)\n ne(a)=ne(a)+1\n ne(b)=ne(b)+1\n end do\n\n allocate(c(n))\n read*, c(:)\n call merge_sort(c)\n \n allocate(ind, source=[(i,i=1,n)])\n allocate(leaf, source=pack(ind,ne==1))\n do i=1,size(leaf)\n d(leaf(i)) = 0\n call dfs(leaf(i))\n end do\n\n call double_merge_sort(d, ind)\n\n allocate(ans(n))\n do i=1,n\n ans(ind(i))=c(i)\n end do\n print'(i0)', sum(c(1:size(c)-1))\n print'(*(i0,1x))', ans(:)\ncontains\n recursive subroutine dfs(ind)\n integer(int32):: ind,i,t\n\n do i=1,g(ind)%size()\n ! print'(*(i0,1x))', d(:)\n t = g(ind)%at(i)\n if (d(t) <= d(ind)+1) cycle\n d(t)=d(ind)+1\n call dfs(t)\n end do\n end subroutine\nend program main", "language": "Fortran", "metadata": {"date": 1601446977, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03026.html", "problem_id": "p03026", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03026/input.txt", "sample_output_relpath": "derived/input_output/data/p03026/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03026/Fortran/s008722336.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s008722336", "user_id": "u234636620"}, "prompt_components": {"gold_output": "10\n1 2 3 4 5\n", "input_to_evaluate": "! fenwic treeでバグらない要注意\n\nmodule vector_int32_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n type,public:: vector_int32\n integer(int32),allocatable:: array(:)\n integer(int32),private:: l=0\n contains\n procedure:: push_back=>vec_push_back, insert=>vec_insert\n procedure:: pop_back=>vec_pop_back, pop=>vec_pop, erase => vec_erase\n procedure:: at=>vec_at, back=>vec_back, head=>vec_head\n procedure:: size=>vec_size, to_array=>vec_to_array\n end type\ncontains\n pure function vec_size(vec) result(ret)\n class(vector_int32),intent(in):: vec\n integer(int32):: ret\n\n ret = vec%l\n end function\n\n\n pure subroutine check_array_allocation(vec)\n type(vector_int32),intent(inout):: vec\n\n if (.not. allocated(vec%array)) allocate(vec%array(1))\n end subroutine\n\n\n function vec_at(vec,i) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32):: i,ret\n\n call check_array_allocation(vec)\n ret = vec%array(i)\n end function\n\n\n function vec_back(vec) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32):: ret\n \n ret = vec%at(vec%l)\n end function\n\n\n function vec_head(vec) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32):: ret\n \n ret = vec%at(1)\n end function\n\n\n pure subroutine vec_append_array(vec,l,r)\n type(vector_int32),intent(inout):: vec\n integer(int32),intent(in):: l,r\n integer(int32),allocatable:: tmp(:)\n \n allocate(tmp(l:2*r))\n tmp(l:r) = vec%array(l:r)\n call move_alloc(tmp, vec%array)\n end subroutine\n\n\n pure subroutine vec_reduce_array(vec,l,r)\n type(vector_int32),intent(inout):: vec\n integer(int32),intent(in):: l,r\n integer(int32),allocatable:: tmp(:)\n \n allocate(tmp(l:r/2))\n tmp(l:r/2) = vec%array(l:r/2)\n call move_alloc(tmp, vec%array)\n end subroutine\n\n\n pure subroutine check_allocation_size(vec)\n type(vector_int32),intent(inout):: vec\n integer(int32):: len_alloc\n\n call check_array_allocation(vec)\n len_alloc = size(vec%array)\n if (vec%l >= len_alloc) then\n call vec_append_array(vec,1,len_alloc)\n else if (vec%l <= len_alloc/2) then\n call vec_reduce_array(vec,1,len_alloc)\n end if\n end subroutine\n\n\n pure subroutine vec_push_back(vec, v)\n class(vector_int32),intent(inout):: vec\n integer(int32),intent(in):: v\n\n vec%l=vec%l+1\n call check_allocation_size(vec)\n vec%array(vec%l) = v\n end subroutine\n\n\n pure subroutine vec_insert(vec,i,v)\n class(vector_int32),intent(inout):: vec\n integer(int32),intent(in)::i, v\n\n vec%l=vec%l+1\n call check_allocation_size(vec)\n vec%array(i+1:vec%l+1) = vec%array(i:vec%l)\n vec%array(i) = v\n end subroutine\n\n\n function vec_pop_back(vec) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32):: ret\n\n ret = vec%back()\n vec%l=vec%l-1\n call check_allocation_size(vec)\n end function\n\n\n function vec_pop(vec,i) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32),intent(in):: i\n integer(int32):: ret\n\n ret = vec%at(i)\n vec%l=vec%l-1\n vec%array(i:vec%l) = vec%array(i+1:vec%l+1)\n call check_allocation_size(vec)\n end function\n\n\n subroutine vec_erase(vec,i)\n class(vector_int32):: vec\n integer(int32),intent(in):: i\n integer(int32):: dmp\n\n dmp = vec%pop(i)\n end subroutine\n\n\n function vec_to_array(vec) result(ret)\n class(vector_int32),intent(inout):: vec\n integer(int32):: ret(1:vec%l)\n\n call check_array_allocation(vec)\n ret = vec%array(1:vec%l)\n end function\nend module\n\n\nmodule merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort\n\n interface merge_sort\n module procedure ms32, ms64\n end interface\ncontains\n recursive subroutine ms32(ar)\n integer(int32),intent(inout):: ar(:)\n integer(int32):: m\n\n if (size(ar) <= 1) then\n return\n else\n m = size(ar)/2\n call ms32(ar(:m)); call ms32(ar(m+1:))\n call sub_ms32(ar)\n end if\n end subroutine\n\n\n subroutine sub_ms32(ar)\n integer(int32),intent(inout):: ar(:)\n integer(int32):: tmp(1:size(ar))\n integer(int32):: m,l,r,i\n \n tmp(:) = ar(:)\n m = size(ar)/2; l=1;r=m+1\n do i=1,size(ar)\n if (m < l) then\n ar(i:)=tmp(r:); return \n else if (size(ar) < r) then\n ar(i:)=tmp(l:m); return\n else\n if (tmp(l) <= tmp(r)) then\n ar(i) = tmp(l); l=l+1\n else\n ar(i) = tmp(r); r=r+1\n end if\n end if\n end do\n end subroutine\n\n\n recursive subroutine ms64(ar)\n integer(int64),intent(inout):: ar(:)\n integer(int32):: m\n\n if (size(ar) <= 1) then\n return\n else\n m = size(ar)/2\n call ms64(ar(:m)); call ms64(ar(m+1:))\n call sub_ms64(ar)\n end if\n end subroutine\n\n\n subroutine sub_ms64(ar)\n integer(int64),intent(inout):: ar(:)\n integer(int64):: tmp(1:size(ar))\n integer(int32):: m,l,r,i\n \n tmp(:) = ar(:)\n m = size(ar)/2; l=1;r=m+1\n do i=1,size(ar)\n if (m < l) then\n ar(i:)=tmp(r:); return\n else if (size(ar) < r) then\n ar(i:)=tmp(l:r); return\n else\n if (tmp(l) <= tmp(r)) then\n ar(i) = tmp(l); l=l+1\n else\n ar(i) = tmp(r); r=r+1\n end if\n end if\n end do\n end subroutine\nend module\n\n\n! ar1のソート順序でar2もソートする。\nmodule double_merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: double_merge_sort\n\n interface double_merge_sort\n module procedure dms32, dms64\n end interface\ncontains\n recursive subroutine dms32(ar1, ar2)\n integer(int32),intent(inout):: ar1(:), ar2(:)\n integer(int32):: m\n\n if (size(ar1) <= 1) then\n return\n else\n m = size(ar1)/2\n call dms32(ar1(:m), ar2(:m))\n call dms32(ar1(m+1:), ar2(m+1:))\n call sub_ms32(ar1,ar2)\n end if\n end subroutine\n\n\n subroutine sub_ms32(ar1, ar2)\n integer(int32),intent(inout):: ar1(:), ar2(:)\n integer(int32):: tmp1(1:size(ar1)), tmp2(1:size(ar2))\n integer(int32):: m,l,r,i\n\n m=size(ar1)/2; l=1; r=m+1\n tmp1(:)=ar1(:); tmp2(:)=ar2(:)\n\n do i=1,size(ar1)\n if (m < l) then\n ar1(i:) = tmp1(r:)\n ar2(i:) = tmp2(r:)\n return\n else if (size(ar1) < r) then\n ar1(i:) = tmp1(l:m)\n ar2(i:) = tmp2(l:m)\n return\n else\n if (tmp1(l) <= tmp1(r)) then\n ar1(i) = tmp1(l)\n ar2(i) = tmp2(l)\n l=l+1\n else\n ar1(i) = tmp1(r)\n ar2(i) = tmp2(r)\n r=r+1\n end if\n end if\n end do\n end subroutine\n\n\n recursive subroutine dms64(ar1, ar2)\n integer(int64),intent(inout):: ar1(:), ar2(:)\n integer(int32):: m\n\n if (size(ar1) <= 1) then\n return\n else\n m = size(ar1)/2\n call dms64(ar1(:m), ar2(:m))\n call dms64(ar1(m+1:), ar2(m+1:))\n call sub_ms64(ar1,ar2)\n end if\n end subroutine\n\n\n subroutine sub_ms64(ar1, ar2)\n integer(int64),intent(inout):: ar1(:), ar2(:)\n integer(int64):: tmp1(1:size(ar1)), tmp2(1:size(ar2))\n integer(int32):: m,l,r,i\n\n m=size(ar1)/2; l=1; r=m+1\n tmp1(:)=ar1(:); tmp2(:)=ar2(:)\n\n do i=1,size(ar1)\n if (m < l) then\n ar1(i:) = tmp1(r:)\n ar2(i:) = tmp2(r:)\n return\n else if (size(ar1) < r) then\n ar1(i:) = tmp1(l:m)\n ar2(i:) = tmp2(l:m)\n return\n else\n if (tmp1(l) <= tmp1(r)) then\n ar1(i) = tmp1(l)\n ar2(i) = tmp2(l)\n l=l+1\n else\n ar1(i) = tmp1(r)\n ar2(i) = tmp2(r)\n r=r+1\n end if\n end if\n end do\n end subroutine\nend module\n\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use vector_int32_mod\n use merge_sort_mod\n use double_merge_sort_mod\n implicit none\n integer(int32):: n,a,b,i\n integer(int32), allocatable:: c(:), ne(:), d(:), leaf(:), ind(:), ans(:)\n type(vector_int32),allocatable:: g(:)\n\n read*, n\n allocate(ne(n),source=0)\n allocate(d(n),source=n+100)\n allocate(g(n))\n\n do i=1,n-1\n read*, a,b\n call g(a)%push_back(b)\n call g(b)%push_back(a)\n ne(a)=ne(a)+1\n ne(b)=ne(b)+1\n end do\n\n allocate(c(n))\n read*, c(:)\n call merge_sort(c)\n \n allocate(ind, source=[(i,i=1,n)])\n allocate(leaf, source=pack(ind,ne==1))\n do i=1,size(leaf)\n d(leaf(i)) = 0\n call dfs(leaf(i))\n end do\n\n call double_merge_sort(d, ind)\n\n allocate(ans(n))\n do i=1,n\n ans(ind(i))=c(i)\n end do\n print'(i0)', sum(c(1:size(c)-1))\n print'(*(i0,1x))', ans(:)\ncontains\n recursive subroutine dfs(ind)\n integer(int32):: ind,i,t\n\n do i=1,g(ind)%size()\n ! print'(*(i0,1x))', d(:)\n t = g(ind)%at(i)\n if (d(t) <= d(ind)+1) cycle\n d(t)=d(ind)+1\n call dfs(t)\n end do\n end subroutine\nend program main", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a tree with N vertices 1,2,\\ldots,N, and positive integers c_1,c_2,\\ldots,c_N.\nThe i-th edge in the tree (1 \\leq i \\leq N-1) connects Vertex a_i and Vertex b_i.\n\nWe will write a positive integer on each vertex in T and calculate our score as follows:\n\nOn each edge, write the smaller of the integers written on the two endpoints.\n\nLet our score be the sum of the integers written on all the edges.\n\nFind the maximum possible score when we write each of c_1,c_2,\\ldots,c_N on one vertex in T, and show one way to achieve it. If an integer occurs multiple times in c_1,c_2,\\ldots,c_N, we must use it that number of times.\n\nConstraints\n\n1 \\leq N \\leq 10000\n\n1 \\leq a_i,b_i \\leq N\n\n1 \\leq c_i \\leq 10^5\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\n:\na_{N-1} b_{N-1}\nc_1 \\ldots c_N\n\nOutput\n\nUse the following format:\n\nM\nd_1 \\ldots d_N\n\nwhere M is the maximum possible score, and d_i is the integer to write on Vertex i.\nd_1,d_2,\\ldots,d_N must be a permutation of c_1,c_2,\\ldots,c_N.\nIf there are multiple ways to achieve the maximum score, any of them will be accepted.\n\nSample Input 1\n\n5\n1 2\n2 3\n3 4\n4 5\n1 2 3 4 5\n\nSample Output 1\n\n10\n1 2 3 4 5\n\nIf we write 1,2,3,4,5 on Vertex 1,2,3,4,5, respectively, the integers written on the four edges will be 1,2,3,4, for the score of 10. This is the maximum possible score.\n\nSample Input 2\n\n5\n1 2\n1 3\n1 4\n1 5\n3141 59 26 53 59\n\nSample Output 2\n\n197\n59 26 3141 59 53\n\nc_1,c_2,\\ldots,c_N may not be pairwise distinct.", "sample_input": "5\n1 2\n2 3\n3 4\n4 5\n1 2 3 4 5\n"}, "reference_outputs": ["10\n1 2 3 4 5\n"], "source_document_id": "p03026", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a tree with N vertices 1,2,\\ldots,N, and positive integers c_1,c_2,\\ldots,c_N.\nThe i-th edge in the tree (1 \\leq i \\leq N-1) connects Vertex a_i and Vertex b_i.\n\nWe will write a positive integer on each vertex in T and calculate our score as follows:\n\nOn each edge, write the smaller of the integers written on the two endpoints.\n\nLet our score be the sum of the integers written on all the edges.\n\nFind the maximum possible score when we write each of c_1,c_2,\\ldots,c_N on one vertex in T, and show one way to achieve it. If an integer occurs multiple times in c_1,c_2,\\ldots,c_N, we must use it that number of times.\n\nConstraints\n\n1 \\leq N \\leq 10000\n\n1 \\leq a_i,b_i \\leq N\n\n1 \\leq c_i \\leq 10^5\n\nThe given graph is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\n:\na_{N-1} b_{N-1}\nc_1 \\ldots c_N\n\nOutput\n\nUse the following format:\n\nM\nd_1 \\ldots d_N\n\nwhere M is the maximum possible score, and d_i is the integer to write on Vertex i.\nd_1,d_2,\\ldots,d_N must be a permutation of c_1,c_2,\\ldots,c_N.\nIf there are multiple ways to achieve the maximum score, any of them will be accepted.\n\nSample Input 1\n\n5\n1 2\n2 3\n3 4\n4 5\n1 2 3 4 5\n\nSample Output 1\n\n10\n1 2 3 4 5\n\nIf we write 1,2,3,4,5 on Vertex 1,2,3,4,5, respectively, the integers written on the four edges will be 1,2,3,4, for the score of 10. This is the maximum possible score.\n\nSample Input 2\n\n5\n1 2\n1 3\n1 4\n1 5\n3141 59 26 53 59\n\nSample Output 2\n\n197\n59 26 3141 59 53\n\nc_1,c_2,\\ldots,c_N may not be pairwise distinct.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 10151, "cpu_time_ms": 28, "memory_kb": 5100}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s356467408", "group_id": "codeNet:p03029", "input_text": "integer a,b\nread*, a,b\nprint*, (3*a+b)/2\nend", "language": "Fortran", "metadata": {"date": 1571901802, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03029.html", "problem_id": "p03029", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03029/input.txt", "sample_output_relpath": "derived/input_output/data/p03029/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03029/Fortran/s356467408.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s356467408", "user_id": "u244203620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "integer a,b\nread*, a,b\nprint*, (3*a+b)/2\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "sample_input": "1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03029", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 44, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s116883541", "group_id": "codeNet:p03029", "input_text": "program applepie\ninteger::a,p,c\nread*,a,p\nprint*,(a*3+p)/2\nend program applepie", "language": "Fortran", "metadata": {"date": 1568059832, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03029.html", "problem_id": "p03029", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03029/input.txt", "sample_output_relpath": "derived/input_output/data/p03029/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03029/Fortran/s116883541.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s116883541", "user_id": "u129978636"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program applepie\ninteger::a,p,c\nread*,a,p\nprint*,(a*3+p)/2\nend program applepie", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "sample_input": "1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03029", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have A apples and P pieces of apple.\n\nWe can cut an apple into three pieces of apple, and make one apple pie by simmering two pieces of apple in a pan.\n\nFind the maximum number of apple pies we can make with what we have now.\n\nConstraints\n\nAll values in input are integers.\n\n0 \\leq A, P \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA P\n\nOutput\n\nPrint the maximum number of apple pies we can make with what we have.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n3\n\nWe can first make one apple pie by simmering two of the three pieces of apple. Then, we can make two more by simmering the remaining piece and three more pieces obtained by cutting the whole apple.\n\nSample Input 2\n\n0 1\n\nSample Output 2\n\n0\n\nWe cannot make an apple pie in this case, unfortunately.\n\nSample Input 3\n\n32 21\n\nSample Output 3\n\n58", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 79, "cpu_time_ms": 4, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s314604933", "group_id": "codeNet:p03030", "input_text": " module piyo\n implicit none\n \n type rest\n character(10) :: s\n integer :: p,num\n end type\n \n contains\n subroutine sortS( r )\n implicit none\n type(rest),intent(inout) :: r(:)\n type(rest) :: buffer\n integer :: i,k,len\n \n len = size(r)\n \n do i = 1,len-1\n do k = i+1,len\n if( r(i)%s(:)>r(k)%s(:) )then\n buffer = r(i)\n r(i) = r(k)\n r(k) = buffer\n end if\n end do\n end do\n end subroutine\n \n function sortP( r ) result( res )\n implicit none\n type(rest) :: r(:)\n type(rest) :: buffer\n type(rest),allocatable :: res(:)\n integer :: i,k,len\n \n len = size(r)\n \n do i = 1,len-1\n do k = i+1,len\n if( r(i)%p=n )then\n exit\n end if\n end do\n \n \n \n ! print *,n\n ! do i = 1,n\n ! print*,restaurant(i)\n ! end do\n \n do i = 1,n\n print*,restaurant(i)%num\n end do\n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1589085583, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03030.html", "problem_id": "p03030", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03030/input.txt", "sample_output_relpath": "derived/input_output/data/p03030/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03030/Fortran/s314604933.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s314604933", "user_id": "u171356453"}, "prompt_components": {"gold_output": "3\n4\n6\n1\n5\n2\n", "input_to_evaluate": " module piyo\n implicit none\n \n type rest\n character(10) :: s\n integer :: p,num\n end type\n \n contains\n subroutine sortS( r )\n implicit none\n type(rest),intent(inout) :: r(:)\n type(rest) :: buffer\n integer :: i,k,len\n \n len = size(r)\n \n do i = 1,len-1\n do k = i+1,len\n if( r(i)%s(:)>r(k)%s(:) )then\n buffer = r(i)\n r(i) = r(k)\n r(k) = buffer\n end if\n end do\n end do\n end subroutine\n \n function sortP( r ) result( res )\n implicit none\n type(rest) :: r(:)\n type(rest) :: buffer\n type(rest),allocatable :: res(:)\n integer :: i,k,len\n \n len = size(r)\n \n do i = 1,len-1\n do k = i+1,len\n if( r(i)%p=n )then\n exit\n end if\n end do\n \n \n \n ! print *,n\n ! do i = 1,n\n ! print*,restaurant(i)\n ! end do\n \n do i = 1,n\n print*,restaurant(i)%num\n end do\n \n END PROGRAM", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have decided to write a book introducing good restaurants.\nThere are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i.\nNo two restaurants have the same score.\n\nYou want to introduce the restaurants in the following order:\n\nThe restaurants are arranged in lexicographical order of the names of their cities.\n\nIf there are multiple restaurants in the same city, they are arranged in descending order of score.\n\nPrint the identification numbers of the restaurants in the order they are introduced in the book.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nS is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\n0 ≤ P_i ≤ 100\n\nP_i is an integer.\n\nP_i ≠ P_j (1 ≤ i < j ≤ N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 P_1\n:\nS_N P_N\n\nOutput\n\nPrint N lines. The i-th line (1 ≤ i ≤ N) should contain the identification number of the restaurant that is introduced i-th in the book.\n\nSample Input 1\n\n6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40\n\nSample Output 1\n\n3\n4\n6\n1\n5\n2\n\nThe lexicographical order of the names of the three cities is kazan < khabarovsk < moscow. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order 3,4,6,1,5,2.\n\nSample Input 2\n\n10\nyakutsk 10\nyakutsk 20\nyakutsk 30\nyakutsk 40\nyakutsk 50\nyakutsk 60\nyakutsk 70\nyakutsk 80\nyakutsk 90\nyakutsk 100\n\nSample Output 2\n\n10\n9\n8\n7\n6\n5\n4\n3\n2\n1", "sample_input": "6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40\n"}, "reference_outputs": ["3\n4\n6\n1\n5\n2\n"], "source_document_id": "p03030", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have decided to write a book introducing good restaurants.\nThere are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i.\nNo two restaurants have the same score.\n\nYou want to introduce the restaurants in the following order:\n\nThe restaurants are arranged in lexicographical order of the names of their cities.\n\nIf there are multiple restaurants in the same city, they are arranged in descending order of score.\n\nPrint the identification numbers of the restaurants in the order they are introduced in the book.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nS is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\n0 ≤ P_i ≤ 100\n\nP_i is an integer.\n\nP_i ≠ P_j (1 ≤ i < j ≤ N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 P_1\n:\nS_N P_N\n\nOutput\n\nPrint N lines. The i-th line (1 ≤ i ≤ N) should contain the identification number of the restaurant that is introduced i-th in the book.\n\nSample Input 1\n\n6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40\n\nSample Output 1\n\n3\n4\n6\n1\n5\n2\n\nThe lexicographical order of the names of the three cities is kazan < khabarovsk < moscow. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order 3,4,6,1,5,2.\n\nSample Input 2\n\n10\nyakutsk 10\nyakutsk 20\nyakutsk 30\nyakutsk 40\nyakutsk 50\nyakutsk 60\nyakutsk 70\nyakutsk 80\nyakutsk 90\nyakutsk 100\n\nSample Output 2\n\n10\n9\n8\n7\n6\n5\n4\n3\n2\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2026, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s412081657", "group_id": "codeNet:p03030", "input_text": "program main\nImplicit None\n\tinteger i,N\n\tinteger,allocatable :: P(:)\n\tcharacter(10) s(:)\n\tallocatable :: s\n\t\n\tread*,N\n\tallocate(S(N),P(N))\n\t\n\tdo i=1,N\n\t\tread*,S(i),P(i)\n\tend do\n\n\tdo i=1,N\n\t\twrite(6,'(i0,x,i0)') S(i),P(i)\n\tend do\n!wakannai\t\nend program main", "language": "Fortran", "metadata": {"date": 1558923183, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03030.html", "problem_id": "p03030", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03030/input.txt", "sample_output_relpath": "derived/input_output/data/p03030/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03030/Fortran/s412081657.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s412081657", "user_id": "u398472825"}, "prompt_components": {"gold_output": "3\n4\n6\n1\n5\n2\n", "input_to_evaluate": "program main\nImplicit None\n\tinteger i,N\n\tinteger,allocatable :: P(:)\n\tcharacter(10) s(:)\n\tallocatable :: s\n\t\n\tread*,N\n\tallocate(S(N),P(N))\n\t\n\tdo i=1,N\n\t\tread*,S(i),P(i)\n\tend do\n\n\tdo i=1,N\n\t\twrite(6,'(i0,x,i0)') S(i),P(i)\n\tend do\n!wakannai\t\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have decided to write a book introducing good restaurants.\nThere are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i.\nNo two restaurants have the same score.\n\nYou want to introduce the restaurants in the following order:\n\nThe restaurants are arranged in lexicographical order of the names of their cities.\n\nIf there are multiple restaurants in the same city, they are arranged in descending order of score.\n\nPrint the identification numbers of the restaurants in the order they are introduced in the book.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nS is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\n0 ≤ P_i ≤ 100\n\nP_i is an integer.\n\nP_i ≠ P_j (1 ≤ i < j ≤ N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 P_1\n:\nS_N P_N\n\nOutput\n\nPrint N lines. The i-th line (1 ≤ i ≤ N) should contain the identification number of the restaurant that is introduced i-th in the book.\n\nSample Input 1\n\n6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40\n\nSample Output 1\n\n3\n4\n6\n1\n5\n2\n\nThe lexicographical order of the names of the three cities is kazan < khabarovsk < moscow. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order 3,4,6,1,5,2.\n\nSample Input 2\n\n10\nyakutsk 10\nyakutsk 20\nyakutsk 30\nyakutsk 40\nyakutsk 50\nyakutsk 60\nyakutsk 70\nyakutsk 80\nyakutsk 90\nyakutsk 100\n\nSample Output 2\n\n10\n9\n8\n7\n6\n5\n4\n3\n2\n1", "sample_input": "6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40\n"}, "reference_outputs": ["3\n4\n6\n1\n5\n2\n"], "source_document_id": "p03030", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have decided to write a book introducing good restaurants.\nThere are N restaurants that you want to introduce: Restaurant 1, Restaurant 2, ..., Restaurant N. Restaurant i is in city S_i, and your assessment score of that restaurant on a 100-point scale is P_i.\nNo two restaurants have the same score.\n\nYou want to introduce the restaurants in the following order:\n\nThe restaurants are arranged in lexicographical order of the names of their cities.\n\nIf there are multiple restaurants in the same city, they are arranged in descending order of score.\n\nPrint the identification numbers of the restaurants in the order they are introduced in the book.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nS is a string of length between 1 and 10 (inclusive) consisting of lowercase English letters.\n\n0 ≤ P_i ≤ 100\n\nP_i is an integer.\n\nP_i ≠ P_j (1 ≤ i < j ≤ N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 P_1\n:\nS_N P_N\n\nOutput\n\nPrint N lines. The i-th line (1 ≤ i ≤ N) should contain the identification number of the restaurant that is introduced i-th in the book.\n\nSample Input 1\n\n6\nkhabarovsk 20\nmoscow 10\nkazan 50\nkazan 35\nmoscow 60\nkhabarovsk 40\n\nSample Output 1\n\n3\n4\n6\n1\n5\n2\n\nThe lexicographical order of the names of the three cities is kazan < khabarovsk < moscow. For each of these cities, the restaurants in it are introduced in descending order of score. Thus, the restaurants are introduced in the order 3,4,6,1,5,2.\n\nSample Input 2\n\n10\nyakutsk 10\nyakutsk 20\nyakutsk 30\nyakutsk 40\nyakutsk 50\nyakutsk 60\nyakutsk 70\nyakutsk 80\nyakutsk 90\nyakutsk 100\n\nSample Output 2\n\n10\n9\n8\n7\n6\n5\n4\n3\n2\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 256, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s493443694", "group_id": "codeNet:p03031", "input_text": "integer N,M\ninteger,allocatable,dimension(:)::k,p\ninteger,allocatable,dimension(:,:)::S\ninteger reader(10)\ninteger check,on,l,b\ninteger ans\nread*,N,M\nallocate(k(M),p(M),S(M,10))\n\nS=0\ndo i=1,M\n reader=0\n read*,k(i),reader(1:k(i))\n do j=1,k(i)\n S(i,reader(j))=1\n end do\nend do\nread*,p\n\nans=0\ndo i=0,2**N\n check=0\n do j=1,M\n b=i\n on=0\n do l=1,N+1\n if(and(b,1)==1)on=mod(on+S(j,l),2)\n b=rshift(b,1)\n end do\n if(on/=p(j))check=1\n end do\n if(check==0)ans=ans+1\nend do\nprint\"(i0)\",ans\nend", "language": "Fortran", "metadata": {"date": 1558931651, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03031.html", "problem_id": "p03031", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03031/input.txt", "sample_output_relpath": "derived/input_output/data/p03031/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03031/Fortran/s493443694.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s493443694", "user_id": "u598073939"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "integer N,M\ninteger,allocatable,dimension(:)::k,p\ninteger,allocatable,dimension(:,:)::S\ninteger reader(10)\ninteger check,on,l,b\ninteger ans\nread*,N,M\nallocate(k(M),p(M),S(M,10))\n\nS=0\ndo i=1,M\n reader=0\n read*,k(i),reader(1:k(i))\n do j=1,k(i)\n S(i,reader(j))=1\n end do\nend do\nread*,p\n\nans=0\ndo i=0,2**N\n check=0\n do j=1,M\n b=i\n on=0\n do l=1,N+1\n if(and(b,1)==1)on=mod(on+S(j,l),2)\n b=rshift(b,1)\n end do\n if(on/=p(j))check=1\n end do\n if(check==0)ans=ans+1\nend do\nprint\"(i0)\",ans\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "sample_input": "2 2\n2 1 2\n1 2\n0 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03031", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 517, "cpu_time_ms": 3, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s975825282", "group_id": "codeNet:p03031", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: n,m,i,max=0,l,count=0,h,j,on,check=0\ninteger(16),allocatable :: k(:),s(:,:),p(:),sw(:)\n\nread*, n,m\nallocate(k(m),s(m,10),p(m),sw(n))\ns = 0\ndo i = 1, m, 1\n read*, k(i),s(i,1:k(i))\nend do\nread*, p(1:m)\n\ndo i = 1, n\n max = max + 2**(i-1)\nend do\n\ndo i = 0, max, 1\n check = 0\n l = i\n sw = 0\n do j = 1, n, 1\n sw(j) = mod(l,2)\n l = l/2\n end do\n do j = 1, m, 1\n on = 0\n do h = 1, k(j), 1\n if ( sw(s(j,h)) == 1 ) then\n on = on + 1\n end if\n end do\n if ( mod(on,2) /= p(j) ) then\n check = 1\n exit\n end if\n end do\n if ( check == 0 ) then\n count = count + 1\n end if\nend do\n\nprint'(i0)', count\n\nEND PROGRAM ATCODER", "language": "Fortran", "metadata": {"date": 1558924955, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03031.html", "problem_id": "p03031", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03031/input.txt", "sample_output_relpath": "derived/input_output/data/p03031/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03031/Fortran/s975825282.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s975825282", "user_id": "u454557108"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: n,m,i,max=0,l,count=0,h,j,on,check=0\ninteger(16),allocatable :: k(:),s(:,:),p(:),sw(:)\n\nread*, n,m\nallocate(k(m),s(m,10),p(m),sw(n))\ns = 0\ndo i = 1, m, 1\n read*, k(i),s(i,1:k(i))\nend do\nread*, p(1:m)\n\ndo i = 1, n\n max = max + 2**(i-1)\nend do\n\ndo i = 0, max, 1\n check = 0\n l = i\n sw = 0\n do j = 1, n, 1\n sw(j) = mod(l,2)\n l = l/2\n end do\n do j = 1, m, 1\n on = 0\n do h = 1, k(j), 1\n if ( sw(s(j,h)) == 1 ) then\n on = on + 1\n end if\n end do\n if ( mod(on,2) /= p(j) ) then\n check = 1\n exit\n end if\n end do\n if ( check == 0 ) then\n count = count + 1\n end if\nend do\n\nprint'(i0)', count\n\nEND PROGRAM ATCODER", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "sample_input": "2 2\n2 1 2\n1 2\n0 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03031", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N switches with \"on\" and \"off\" state, and M bulbs. The switches are numbered 1 to N, and the bulbs are numbered 1 to M.\n\nBulb i is connected to k_i switches: Switch s_{i1}, s_{i2}, ..., and s_{ik_i}. It is lighted when the number of switches that are \"on\" among these switches is congruent to p_i modulo 2.\n\nHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\n\nConstraints\n\n1 \\leq N, M \\leq 10\n\n1 \\leq k_i \\leq N\n\n1 \\leq s_{ij} \\leq N\n\ns_{ia} \\neq s_{ib} (a \\neq b)\n\np_i is 0 or 1.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nk_1 s_{11} s_{12} ... s_{1k_1}\n:\nk_M s_{M1} s_{M2} ... s_{Mk_M}\np_1 p_2 ... p_M\n\nOutput\n\nPrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\n\nSample Input 1\n\n2 2\n2 1 2\n1 2\n0 1\n\nSample Output 1\n\n1\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nThere are four possible combinations of states of (Switch 1, Switch 2): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print 1.\n\nSample Input 2\n\n2 3\n2 1 2\n1 1\n1 2\n0 0 1\n\nSample Output 2\n\n0\n\nBulb 1 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1 and 2.\n\nBulb 2 is lighted when there is an even number of switches that are \"on\" among the following: Switch 1.\n\nBulb 3 is lighted when there is an odd number of switches that are \"on\" among the following: Switch 2.\n\nSwitch 1 has to be \"off\" to light Bulb 2 and Switch 2 has to be \"on\" to light Bulb 3, but then Bulb 1 will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print 0.\n\nSample Input 3\n\n5 2\n3 1 2 5\n2 2 3\n1 0\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 708, "cpu_time_ms": 2, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s616860086", "group_id": "codeNet:p03033", "input_text": "program roadwork\n implicit none\n integer :: n, q, stx(200000,3), d, i, k, x, m, u\n stx = 0\n read(*,*) n, q\n do i = 1, n\n read(*,*) stx(i,1:3)\n end do\n call merge_sort(n,stx(1:n,1:3),3)\n m = m\n do k = 1, q\n read(*,*) d\n x = -1\n u = 0\n do i = m, n\n if ((stx(i,1).le.stx(i,3)+d).and.(stx(i,3)+d.lt.stx(i,2))) then\n x = stx(i,3)\n exit\n else if (stx(i,3)+d.ge.stx(i,2)) then\n stx(i,3) = -1\n u = u + 1\n end if\n end do\n m = m + u\n write(*,'(i0)') x\n if (u.gt.0) call merge_sort(n,stx(1:n,1:3),3)\n end do\n stop\ncontains\n subroutine merge_sort(n,c,idx)\n implicit none\n integer, intent(in) :: n, idx\n integer, intent(inout) :: c(n,3)\n integer :: number, length, i, ubnd\n number = n\n length = 1\n do while (number.gt.1)\n do i = 1, number/2\n ubnd = min(2*i*length,n)\n call merge(c(2*(i-1)*length+1:(2*i-1)*length,:),c((2*i-1)*length+1:ubnd,:),idx)\n end do\n length = 2*length\n number = (number+1)/2\n end do\n return\n end subroutine merge_sort\n subroutine merge(c1,c2,idx)\n implicit none\n integer, intent(inout) :: c1(:,:), c2(:,:)\n integer, intent(in) :: idx\n integer :: c(size(c1(:,1))+size(c2(:,1)),size(c1(1,:)))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(c1(:,1))\n n2 = size(c2(:,1))\n do while ((i1.le.n1).and.(i2.le.n2))\n if (c1(i1,idx).le.c2(i2,idx)) then\n c(i1+i2-1,:) = c1(i1,:)\n i1 = i1+1\n else\n c(i1+i2-1,:) = c2(i2,:)\n i2 = i2+1\n end if\n end do\n if (i1.le.n1) then\n c(i1+i2-1:n1+n2,:) = c1(i1:n1,:)\n else if (i2.le.n2) then\n c(i1+i2-1:n1+n2,:) = c2(i2:n2,:)\n end if\n c1 = c(1:n1,:)\n c2 = c(n1+1:n1+n2,:)\n return\n end subroutine merge\nend program roadwork", "language": "Fortran", "metadata": {"date": 1558925269, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03033.html", "problem_id": "p03033", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03033/input.txt", "sample_output_relpath": "derived/input_output/data/p03033/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03033/Fortran/s616860086.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s616860086", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n2\n10\n-1\n13\n-1\n", "input_to_evaluate": "program roadwork\n implicit none\n integer :: n, q, stx(200000,3), d, i, k, x, m, u\n stx = 0\n read(*,*) n, q\n do i = 1, n\n read(*,*) stx(i,1:3)\n end do\n call merge_sort(n,stx(1:n,1:3),3)\n m = m\n do k = 1, q\n read(*,*) d\n x = -1\n u = 0\n do i = m, n\n if ((stx(i,1).le.stx(i,3)+d).and.(stx(i,3)+d.lt.stx(i,2))) then\n x = stx(i,3)\n exit\n else if (stx(i,3)+d.ge.stx(i,2)) then\n stx(i,3) = -1\n u = u + 1\n end if\n end do\n m = m + u\n write(*,'(i0)') x\n if (u.gt.0) call merge_sort(n,stx(1:n,1:3),3)\n end do\n stop\ncontains\n subroutine merge_sort(n,c,idx)\n implicit none\n integer, intent(in) :: n, idx\n integer, intent(inout) :: c(n,3)\n integer :: number, length, i, ubnd\n number = n\n length = 1\n do while (number.gt.1)\n do i = 1, number/2\n ubnd = min(2*i*length,n)\n call merge(c(2*(i-1)*length+1:(2*i-1)*length,:),c((2*i-1)*length+1:ubnd,:),idx)\n end do\n length = 2*length\n number = (number+1)/2\n end do\n return\n end subroutine merge_sort\n subroutine merge(c1,c2,idx)\n implicit none\n integer, intent(inout) :: c1(:,:), c2(:,:)\n integer, intent(in) :: idx\n integer :: c(size(c1(:,1))+size(c2(:,1)),size(c1(1,:)))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(c1(:,1))\n n2 = size(c2(:,1))\n do while ((i1.le.n1).and.(i2.le.n2))\n if (c1(i1,idx).le.c2(i2,idx)) then\n c(i1+i2-1,:) = c1(i1,:)\n i1 = i1+1\n else\n c(i1+i2-1,:) = c2(i2,:)\n i2 = i2+1\n end if\n end do\n if (i1.le.n1) then\n c(i1+i2-1:n1+n2,:) = c1(i1:n1,:)\n else if (i2.le.n2) then\n c(i1+i2-1:n1+n2,:) = c2(i2:n2,:)\n end if\n c1 = c(1:n1,:)\n c2 = c(n1+1:n1+n2,:)\n return\n end subroutine merge\nend program roadwork", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is an infinitely long street that runs west to east, which we consider as a number line.\n\nThere are N roadworks scheduled on this street.\nThe i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.\n\nQ people are standing at coordinate 0. The i-th person will start the coordinate 0 at time D_i, continue to walk with speed 1 in the positive direction and stop walking when reaching a blocked point.\n\nFind the distance each of the Q people will walk.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q \\leq 2 \\times 10^5\n\n0 \\leq S_i < T_i \\leq 10^9\n\n1 \\leq X_i \\leq 10^9\n\n0 \\leq D_1 < D_2 < ... < D_Q \\leq 10^9\n\nIf i \\neq j and X_i = X_j, the intervals [S_i, T_i) and [S_j, T_j) do not overlap.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS_1 T_1 X_1\n:\nS_N T_N X_N\nD_1\n:\nD_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the distance the i-th person will walk or -1 if that person walks forever.\n\nSample Input 1\n\n4 6\n1 3 2\n7 13 10\n18 20 13\n3 4 2\n0\n1\n2\n3\n5\n8\n\nSample Output 1\n\n2\n2\n10\n-1\n13\n-1\n\nThe first person starts coordinate 0 at time 0 and stops walking at coordinate 2 when reaching a point blocked by the first roadwork at time 2.\n\nThe second person starts coordinate 0 at time 1 and reaches coordinate 2 at time 3. The first roadwork has ended, but the fourth roadwork has begun, so this person also stops walking at coordinate 2.\n\nThe fourth and sixth persons encounter no roadworks while walking, so they walk forever. The output for these cases is -1.", "sample_input": "4 6\n1 3 2\n7 13 10\n18 20 13\n3 4 2\n0\n1\n2\n3\n5\n8\n"}, "reference_outputs": ["2\n2\n10\n-1\n13\n-1\n"], "source_document_id": "p03033", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is an infinitely long street that runs west to east, which we consider as a number line.\n\nThere are N roadworks scheduled on this street.\nThe i-th roadwork blocks the point at coordinate X_i from time S_i - 0.5 to time T_i - 0.5.\n\nQ people are standing at coordinate 0. The i-th person will start the coordinate 0 at time D_i, continue to walk with speed 1 in the positive direction and stop walking when reaching a blocked point.\n\nFind the distance each of the Q people will walk.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, Q \\leq 2 \\times 10^5\n\n0 \\leq S_i < T_i \\leq 10^9\n\n1 \\leq X_i \\leq 10^9\n\n0 \\leq D_1 < D_2 < ... < D_Q \\leq 10^9\n\nIf i \\neq j and X_i = X_j, the intervals [S_i, T_i) and [S_j, T_j) do not overlap.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS_1 T_1 X_1\n:\nS_N T_N X_N\nD_1\n:\nD_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the distance the i-th person will walk or -1 if that person walks forever.\n\nSample Input 1\n\n4 6\n1 3 2\n7 13 10\n18 20 13\n3 4 2\n0\n1\n2\n3\n5\n8\n\nSample Output 1\n\n2\n2\n10\n-1\n13\n-1\n\nThe first person starts coordinate 0 at time 0 and stops walking at coordinate 2 when reaching a point blocked by the first roadwork at time 2.\n\nThe second person starts coordinate 0 at time 1 and reaches coordinate 2 at time 3. The first roadwork has ended, but the fourth roadwork has begun, so this person also stops walking at coordinate 2.\n\nThe fourth and sixth persons encounter no roadworks while walking, so they walk forever. The output for these cases is -1.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1811, "cpu_time_ms": 2104, "memory_kb": 7984}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s376302021", "group_id": "codeNet:p03035", "input_text": "program prob26\n implicit none\n integer :: a,b\n read(*,*) a,b\n if(a <= 5) then\n write(*,*) \"0\"\n else if( a<= 12) then\n write(*,*) b/2\n else\n write(*,*) b\n end if\n\n\n stop\ncontains\nend program prob26", "language": "Fortran", "metadata": {"date": 1592629527, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03035.html", "problem_id": "p03035", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03035/input.txt", "sample_output_relpath": "derived/input_output/data/p03035/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03035/Fortran/s376302021.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s376302021", "user_id": "u478462004"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "program prob26\n implicit none\n integer :: a,b\n read(*,*) a,b\n if(a <= 5) then\n write(*,*) \"0\"\n else if( a<= 12) then\n write(*,*) b/2\n else\n write(*,*) b\n end if\n\n\n stop\ncontains\nend program prob26", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi, who is A years old, is riding a Ferris wheel.\n\nIt costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)\n\nFind the cost of the Ferris wheel for Takahashi.\n\nConstraints\n\n0 ≤ A ≤ 100\n\n2 ≤ B ≤ 1000\n\nB is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the cost of the Ferris wheel for Takahashi.\n\nSample Input 1\n\n30 100\n\nSample Output 1\n\n100\n\nTakahashi is 30 years old now, and the cost of the Ferris wheel is 100 yen.\n\nSample Input 2\n\n12 100\n\nSample Output 2\n\n50\n\nTakahashi is 12 years old, and the cost of the Ferris wheel is the half of 100 yen, that is, 50 yen.\n\nSample Input 3\n\n0 100\n\nSample Output 3\n\n0\n\nTakahashi is 0 years old, and he can ride the Ferris wheel for free.", "sample_input": "30 100\n"}, "reference_outputs": ["100\n"], "source_document_id": "p03035", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi, who is A years old, is riding a Ferris wheel.\n\nIt costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)\n\nFind the cost of the Ferris wheel for Takahashi.\n\nConstraints\n\n0 ≤ A ≤ 100\n\n2 ≤ B ≤ 1000\n\nB is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the cost of the Ferris wheel for Takahashi.\n\nSample Input 1\n\n30 100\n\nSample Output 1\n\n100\n\nTakahashi is 30 years old now, and the cost of the Ferris wheel is 100 yen.\n\nSample Input 2\n\n12 100\n\nSample Output 2\n\n50\n\nTakahashi is 12 years old, and the cost of the Ferris wheel is the half of 100 yen, that is, 50 yen.\n\nSample Input 3\n\n0 100\n\nSample Output 3\n\n0\n\nTakahashi is 0 years old, and he can ride the Ferris wheel for free.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 241, "cpu_time_ms": 5, "memory_kb": 2796}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s872642674", "group_id": "codeNet:p03035", "input_text": "program main\nImplicit None\n\tinteger i,N,M,count,Lmax,Rmin\n\tinteger,allocatable :: L(:),R(:)\n\tread(5,*) N,M\n\tallocate(L(M),R(M))\n\tLmax=0\t;Rmin=N\n\t\n\tdo i=1,M\n\t\tread(5,*) L(i),R(i)\n\t\tif(L(i).ge.Lmax)\tLmax=L(i)\n\t\tif(R(i).le.Rmin)\tRmin=R(i)\n\tend do\n\tcount=Rmin-Lmax+1\n\twrite(6,'(i0)') count\n\nend program main", "language": "Fortran", "metadata": {"date": 1558915122, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03035.html", "problem_id": "p03035", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03035/input.txt", "sample_output_relpath": "derived/input_output/data/p03035/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03035/Fortran/s872642674.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s872642674", "user_id": "u398472825"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "program main\nImplicit None\n\tinteger i,N,M,count,Lmax,Rmin\n\tinteger,allocatable :: L(:),R(:)\n\tread(5,*) N,M\n\tallocate(L(M),R(M))\n\tLmax=0\t;Rmin=N\n\t\n\tdo i=1,M\n\t\tread(5,*) L(i),R(i)\n\t\tif(L(i).ge.Lmax)\tLmax=L(i)\n\t\tif(R(i).le.Rmin)\tRmin=R(i)\n\tend do\n\tcount=Rmin-Lmax+1\n\twrite(6,'(i0)') count\n\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi, who is A years old, is riding a Ferris wheel.\n\nIt costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)\n\nFind the cost of the Ferris wheel for Takahashi.\n\nConstraints\n\n0 ≤ A ≤ 100\n\n2 ≤ B ≤ 1000\n\nB is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the cost of the Ferris wheel for Takahashi.\n\nSample Input 1\n\n30 100\n\nSample Output 1\n\n100\n\nTakahashi is 30 years old now, and the cost of the Ferris wheel is 100 yen.\n\nSample Input 2\n\n12 100\n\nSample Output 2\n\n50\n\nTakahashi is 12 years old, and the cost of the Ferris wheel is the half of 100 yen, that is, 50 yen.\n\nSample Input 3\n\n0 100\n\nSample Output 3\n\n0\n\nTakahashi is 0 years old, and he can ride the Ferris wheel for free.", "sample_input": "30 100\n"}, "reference_outputs": ["100\n"], "source_document_id": "p03035", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi, who is A years old, is riding a Ferris wheel.\n\nIt costs B yen (B is an even number) to ride the Ferris wheel if you are 13 years old or older, but children between 6 and 12 years old (inclusive) can ride it for half the cost, and children who are 5 years old or younger are free of charge. (Yen is the currency of Japan.)\n\nFind the cost of the Ferris wheel for Takahashi.\n\nConstraints\n\n0 ≤ A ≤ 100\n\n2 ≤ B ≤ 1000\n\nB is an even number.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the cost of the Ferris wheel for Takahashi.\n\nSample Input 1\n\n30 100\n\nSample Output 1\n\n100\n\nTakahashi is 30 years old now, and the cost of the Ferris wheel is 100 yen.\n\nSample Input 2\n\n12 100\n\nSample Output 2\n\n50\n\nTakahashi is 12 years old, and the cost of the Ferris wheel is the half of 100 yen, that is, 50 yen.\n\nSample Input 3\n\n0 100\n\nSample Output 3\n\n0\n\nTakahashi is 0 years old, and he can ride the Ferris wheel for free.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 303, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s200373487", "group_id": "codeNet:p03036", "input_text": "program main\n implicit none\n integer(8) :: r, d, x, i\n read (*, *) r, d, x\n do i = 1, 10\n x = r * x - d\n write(*, \"(i0)\") x\n end do\nend program main\n", "language": "Fortran", "metadata": {"date": 1582258710, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03036.html", "problem_id": "p03036", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03036/input.txt", "sample_output_relpath": "derived/input_output/data/p03036/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03036/Fortran/s200373487.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s200373487", "user_id": "u388927326"}, "prompt_components": {"gold_output": "30\n50\n90\n170\n330\n650\n1290\n2570\n5130\n10250\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: r, d, x, i\n read (*, *) r, d, x\n do i = 1, 10\n x = r * x - d\n write(*, \"(i0)\") x\n end do\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThe development of algae in a pond is as follows.\n\nLet the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:\n\nx_{i+1} = rx_i - D\n\nYou are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.\n\nConstraints\n\n2 ≤ r ≤ 5\n\n1 ≤ D ≤ 100\n\nD < x_{2000} ≤ 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr D x_{2000}\n\nOutput\n\nPrint 10 lines. The i-th line (1 ≤ i ≤ 10) should contain x_{2000+i} as an integer.\n\nSample Input 1\n\n2 10 20\n\nSample Output 1\n\n30\n50\n90\n170\n330\n650\n1290\n2570\n5130\n10250\n\nFor example, x_{2001} = rx_{2000} - D = 2 \\times 20 - 10 = 30 and x_{2002} = rx_{2001} - D = 2 \\times 30 - 10 = 50.\n\nSample Input 2\n\n4 40 60\n\nSample Output 2\n\n200\n760\n3000\n11960\n47800\n191160\n764600\n3058360\n12233400\n48933560", "sample_input": "2 10 20\n"}, "reference_outputs": ["30\n50\n90\n170\n330\n650\n1290\n2570\n5130\n10250\n"], "source_document_id": "p03036", "source_text": "Score : 200 points\n\nProblem Statement\n\nThe development of algae in a pond is as follows.\n\nLet the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:\n\nx_{i+1} = rx_i - D\n\nYou are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.\n\nConstraints\n\n2 ≤ r ≤ 5\n\n1 ≤ D ≤ 100\n\nD < x_{2000} ≤ 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr D x_{2000}\n\nOutput\n\nPrint 10 lines. The i-th line (1 ≤ i ≤ 10) should contain x_{2000+i} as an integer.\n\nSample Input 1\n\n2 10 20\n\nSample Output 1\n\n30\n50\n90\n170\n330\n650\n1290\n2570\n5130\n10250\n\nFor example, x_{2001} = rx_{2000} - D = 2 \\times 20 - 10 = 30 and x_{2002} = rx_{2001} - D = 2 \\times 30 - 10 = 50.\n\nSample Input 2\n\n4 40 60\n\nSample Output 2\n\n200\n760\n3000\n11960\n47800\n191160\n764600\n3058360\n12233400\n48933560", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 160, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s620296678", "group_id": "codeNet:p03036", "input_text": "program n1\n implicit none\n integer :: r,d,x2000,x200x,i\n\n read(*,*) r,d,x2000\n x200x=x2000\n do i=1,10\n x200x=r*x200x-d\n write(*,'(i0)') x200x\n enddo\n\n\n\n\n\nend program n1\n\n\n", "language": "Fortran", "metadata": {"date": 1558832822, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03036.html", "problem_id": "p03036", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03036/input.txt", "sample_output_relpath": "derived/input_output/data/p03036/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03036/Fortran/s620296678.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s620296678", "user_id": "u613124399"}, "prompt_components": {"gold_output": "30\n50\n90\n170\n330\n650\n1290\n2570\n5130\n10250\n", "input_to_evaluate": "program n1\n implicit none\n integer :: r,d,x2000,x200x,i\n\n read(*,*) r,d,x2000\n x200x=x2000\n do i=1,10\n x200x=r*x200x-d\n write(*,'(i0)') x200x\n enddo\n\n\n\n\n\nend program n1\n\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThe development of algae in a pond is as follows.\n\nLet the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:\n\nx_{i+1} = rx_i - D\n\nYou are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.\n\nConstraints\n\n2 ≤ r ≤ 5\n\n1 ≤ D ≤ 100\n\nD < x_{2000} ≤ 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr D x_{2000}\n\nOutput\n\nPrint 10 lines. The i-th line (1 ≤ i ≤ 10) should contain x_{2000+i} as an integer.\n\nSample Input 1\n\n2 10 20\n\nSample Output 1\n\n30\n50\n90\n170\n330\n650\n1290\n2570\n5130\n10250\n\nFor example, x_{2001} = rx_{2000} - D = 2 \\times 20 - 10 = 30 and x_{2002} = rx_{2001} - D = 2 \\times 30 - 10 = 50.\n\nSample Input 2\n\n4 40 60\n\nSample Output 2\n\n200\n760\n3000\n11960\n47800\n191160\n764600\n3058360\n12233400\n48933560", "sample_input": "2 10 20\n"}, "reference_outputs": ["30\n50\n90\n170\n330\n650\n1290\n2570\n5130\n10250\n"], "source_document_id": "p03036", "source_text": "Score : 200 points\n\nProblem Statement\n\nThe development of algae in a pond is as follows.\n\nLet the total weight of the algae at the beginning of the year i be x_i gram. For i≥2000, the following formula holds:\n\nx_{i+1} = rx_i - D\n\nYou are given r, D and x_{2000}. Calculate x_{2001}, ..., x_{2010} and print them in order.\n\nConstraints\n\n2 ≤ r ≤ 5\n\n1 ≤ D ≤ 100\n\nD < x_{2000} ≤ 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr D x_{2000}\n\nOutput\n\nPrint 10 lines. The i-th line (1 ≤ i ≤ 10) should contain x_{2000+i} as an integer.\n\nSample Input 1\n\n2 10 20\n\nSample Output 1\n\n30\n50\n90\n170\n330\n650\n1290\n2570\n5130\n10250\n\nFor example, x_{2001} = rx_{2000} - D = 2 \\times 20 - 10 = 30 and x_{2002} = rx_{2001} - D = 2 \\times 30 - 10 = 50.\n\nSample Input 2\n\n4 40 60\n\nSample Output 2\n\n200\n760\n3000\n11960\n47800\n191160\n764600\n3058360\n12233400\n48933560", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 185, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s593607604", "group_id": "codeNet:p03037", "input_text": "program ccc\nimplicit none\n\ninteger :: n, m, i, lmax, rmin, res\ninteger,allocatable,dimension(:) :: l, r\n\nread*, n, m\nallocate(l(m),r(m))\ndo i=1,m\nread*, l(i), r(i)\nend do\n\nlmax=maxval(l)\nrmin=minval(r)\n\nres=rmin-lmax+1\n\nif(res<0) then\nwrite(*,'(i0)') 0\nreturn\nend if\nwrite(*,'(i0)') res\n\nend program", "language": "Fortran", "metadata": {"date": 1570392220, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03037.html", "problem_id": "p03037", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03037/input.txt", "sample_output_relpath": "derived/input_output/data/p03037/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03037/Fortran/s593607604.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s593607604", "user_id": "u039189422"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ccc\nimplicit none\n\ninteger :: n, m, i, lmax, rmin, res\ninteger,allocatable,dimension(:) :: l, r\n\nread*, n, m\nallocate(l(m),r(m))\ndo i=1,m\nread*, l(i), r(i)\nend do\n\nlmax=maxval(l)\nrmin=minval(r)\n\nres=rmin-lmax+1\n\nif(res<0) then\nwrite(*,'(i0)') 0\nreturn\nend if\nwrite(*,'(i0)') res\n\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N ID cards, and there are M gates.\n\nWe can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.\n\nHow many of the ID cards allow us to pass all the gates alone?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1\nL_2 R_2\n\\vdots\nL_M R_M\n\nOutput\n\nPrint the number of ID cards that allow us to pass all the gates alone.\n\nSample Input 1\n\n4 2\n1 3\n2 4\n\nSample Output 1\n\n2\n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\nThe first ID card does not allow us to pass the second gate.\n\nThe second ID card allows us to pass all the gates.\n\nThe third ID card allows us to pass all the gates.\n\nThe fourth ID card does not allow us to pass the first gate.\n\nSample Input 2\n\n10 3\n3 6\n5 7\n6 9\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100000 1\n1 100000\n\nSample Output 3\n\n100000", "sample_input": "4 2\n1 3\n2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03037", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N ID cards, and there are M gates.\n\nWe can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.\n\nHow many of the ID cards allow us to pass all the gates alone?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1\nL_2 R_2\n\\vdots\nL_M R_M\n\nOutput\n\nPrint the number of ID cards that allow us to pass all the gates alone.\n\nSample Input 1\n\n4 2\n1 3\n2 4\n\nSample Output 1\n\n2\n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\nThe first ID card does not allow us to pass the second gate.\n\nThe second ID card allows us to pass all the gates.\n\nThe third ID card allows us to pass all the gates.\n\nThe fourth ID card does not allow us to pass the first gate.\n\nSample Input 2\n\n10 3\n3 6\n5 7\n6 9\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100000 1\n1 100000\n\nSample Output 3\n\n100000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 299, "cpu_time_ms": 60, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s957803245", "group_id": "codeNet:p03037", "input_text": "program prison\n integer N, M, i, j, res\n integer :: X(10**5) = 0\n integer,allocatable,dimension(:) :: A\n integer,allocatable,dimension(:) :: B\n res = 0\n read(*,*) N, M\n allocate(A(M))\n allocate(B(M))\n do 100 i=1,M\n read(*,*) A(i), B(i)\n do 200 j=A(i), B(i)\n X(j) = X(j) +1\n 200 continue\n 100 continue\n do 1000 i=1, B(M)\n if (X(i).eq.M) then\n res = res + 1\n end if\n 1000 continue\n write(*,*) res\nend program", "language": "Fortran", "metadata": {"date": 1558834452, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03037.html", "problem_id": "p03037", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03037/input.txt", "sample_output_relpath": "derived/input_output/data/p03037/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03037/Fortran/s957803245.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s957803245", "user_id": "u039189422"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program prison\n integer N, M, i, j, res\n integer :: X(10**5) = 0\n integer,allocatable,dimension(:) :: A\n integer,allocatable,dimension(:) :: B\n res = 0\n read(*,*) N, M\n allocate(A(M))\n allocate(B(M))\n do 100 i=1,M\n read(*,*) A(i), B(i)\n do 200 j=A(i), B(i)\n X(j) = X(j) +1\n 200 continue\n 100 continue\n do 1000 i=1, B(M)\n if (X(i).eq.M) then\n res = res + 1\n end if\n 1000 continue\n write(*,*) res\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N ID cards, and there are M gates.\n\nWe can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.\n\nHow many of the ID cards allow us to pass all the gates alone?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1\nL_2 R_2\n\\vdots\nL_M R_M\n\nOutput\n\nPrint the number of ID cards that allow us to pass all the gates alone.\n\nSample Input 1\n\n4 2\n1 3\n2 4\n\nSample Output 1\n\n2\n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\nThe first ID card does not allow us to pass the second gate.\n\nThe second ID card allows us to pass all the gates.\n\nThe third ID card allows us to pass all the gates.\n\nThe fourth ID card does not allow us to pass the first gate.\n\nSample Input 2\n\n10 3\n3 6\n5 7\n6 9\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100000 1\n1 100000\n\nSample Output 3\n\n100000", "sample_input": "4 2\n1 3\n2 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03037", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N ID cards, and there are M gates.\n\nWe can pass the i-th gate if we have one of the following ID cards: the L_i-th, (L_i+1)-th, ..., and R_i-th ID cards.\n\nHow many of the ID cards allow us to pass all the gates alone?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i \\leq R_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1\nL_2 R_2\n\\vdots\nL_M R_M\n\nOutput\n\nPrint the number of ID cards that allow us to pass all the gates alone.\n\nSample Input 1\n\n4 2\n1 3\n2 4\n\nSample Output 1\n\n2\n\nTwo ID cards allow us to pass all the gates alone, as follows:\n\nThe first ID card does not allow us to pass the second gate.\n\nThe second ID card allows us to pass all the gates.\n\nThe third ID card allows us to pass all the gates.\n\nThe fourth ID card does not allow us to pass the first gate.\n\nSample Input 2\n\n10 3\n3 6\n5 7\n6 9\n\nSample Output 2\n\n1\n\nSample Input 3\n\n100000 1\n1 100000\n\nSample Output 3\n\n100000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 419, "cpu_time_ms": 2103, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s997960196", "group_id": "codeNet:p03038", "input_text": "program sample\n implicit none\n integer(8) :: i,j,k,m,n,ans\n integer(8)::a,b,c,d\n integer(8),allocatable::x(:),y(:),z(:)\n \n read(*,*) n,m\n allocate(x(n),y(m),z(m))\n read(*,*)x\n do i=1,m\n read(*,*)y(i),z(i)\n end do\n\n call msort(x)\n if(m>1)then\n call m2sort(z,y)\n end if\n a=n\n b=m\n c=n\n ans=0\n d=0\n do j=1,n\n if(x(a)>=z(b))then\n ans=ans+x(a)\n c=c-1\n a=a-1\n if(c==0)then\n exit\n endif\n elseif(c<=y(b))then\n ans=ans+z(b)*c\n exit\n elseif(b==1)then\n ans=ans+z(b)*y(b)\n c=c-y(b)\n b=b-1\n \n do i=1,c\n ans=ans+x(a)\n a=a+1\n end do\n exit\n else\n ans=ans+z(b)*y(b)\n c=c-y(b)\n b=b-1 \n \n endif\n end do\n write(*,*)ans \n stop\n contains\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n \n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n \n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n \n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n \n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n \n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n \n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\n\n recursive subroutine m2sort(x,y)\n implicit none\n integer(8), intent(inout) :: x(:),y(:)\n \n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:),tmp2(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n \n mid = n / 2\n call m2sort(x(:mid),y(:mid))\n call m2sort(x(mid+1:),y(mid+1:))\n \n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n),tmp2(n))\n tmp(:) = x(:)\n tmp2(:)=y(:)\n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n tmp2(k) = y(mid + n - k + 1)\n end do\n \n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n \n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n y(k)=tmp2(i)\n i = i + 1\n else\n x(k) = tmp(j)\n y(k)=tmp2(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp,tmp2)\n return\n end subroutine m2sort\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1597604818, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Fortran/s997960196.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s997960196", "user_id": "u713568912"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program sample\n implicit none\n integer(8) :: i,j,k,m,n,ans\n integer(8)::a,b,c,d\n integer(8),allocatable::x(:),y(:),z(:)\n \n read(*,*) n,m\n allocate(x(n),y(m),z(m))\n read(*,*)x\n do i=1,m\n read(*,*)y(i),z(i)\n end do\n\n call msort(x)\n if(m>1)then\n call m2sort(z,y)\n end if\n a=n\n b=m\n c=n\n ans=0\n d=0\n do j=1,n\n if(x(a)>=z(b))then\n ans=ans+x(a)\n c=c-1\n a=a-1\n if(c==0)then\n exit\n endif\n elseif(c<=y(b))then\n ans=ans+z(b)*c\n exit\n elseif(b==1)then\n ans=ans+z(b)*y(b)\n c=c-y(b)\n b=b-1\n \n do i=1,c\n ans=ans+x(a)\n a=a+1\n end do\n exit\n else\n ans=ans+z(b)*y(b)\n c=c-y(b)\n b=b-1 \n \n endif\n end do\n write(*,*)ans \n stop\n contains\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n \n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n \n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n \n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n \n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n \n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n \n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\n\n recursive subroutine m2sort(x,y)\n implicit none\n integer(8), intent(inout) :: x(:),y(:)\n \n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:),tmp2(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n \n mid = n / 2\n call m2sort(x(:mid),y(:mid))\n call m2sort(x(mid+1:),y(mid+1:))\n \n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n),tmp2(n))\n tmp(:) = x(:)\n tmp2(:)=y(:)\n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n tmp2(k) = y(mid + n - k + 1)\n end do\n \n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n \n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n y(k)=tmp2(i)\n i = i + 1\n else\n x(k) = tmp(j)\n y(k)=tmp2(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp,tmp2)\n return\n end subroutine m2sort\nend program sample\n \n\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3641, "cpu_time_ms": 178, "memory_kb": 6912}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s763080811", "group_id": "codeNet:p03038", "input_text": "program main\nimplicit none\ninteger(8) :: i, j, k\ninteger(8) :: n, m, nn\ninteger(8), allocatable :: a(:), b(:), c(:), d(:)\n\nread(*,*) n, m\nallocate( a(n), b(m), c(m) )\nread(*,*) a\ndo i = 1, m\n read(*,*) b(i), c(i)\nend do\nnn = n + sum(b)\nallocate( d(nn) )\nd(1:n) = a(1:n)\nk = n\ndo i = 1, m\n do j = k+1,k+b(i)\n d(j) = c(i)\n end do\n k = k+b(i)\nend do\ncall heapsort( nn, d )\nwrite(*,'(i0)') sum(d(nn-n+1:nn))\n\nstop\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer(8),intent(in) :: n\n integer(8),intent(inout) :: array(1:n)\n \n integer(8) ::i,k,j,l\n integer(8) :: t\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n end do\nend subroutine heapsort\nend program main\n", "language": "Fortran", "metadata": {"date": 1563314129, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Fortran/s763080811.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s763080811", "user_id": "u696547932"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program main\nimplicit none\ninteger(8) :: i, j, k\ninteger(8) :: n, m, nn\ninteger(8), allocatable :: a(:), b(:), c(:), d(:)\n\nread(*,*) n, m\nallocate( a(n), b(m), c(m) )\nread(*,*) a\ndo i = 1, m\n read(*,*) b(i), c(i)\nend do\nnn = n + sum(b)\nallocate( d(nn) )\nd(1:n) = a(1:n)\nk = n\ndo i = 1, m\n do j = k+1,k+b(i)\n d(j) = c(i)\n end do\n k = k+b(i)\nend do\ncall heapsort( nn, d )\nwrite(*,'(i0)') sum(d(nn-n+1:nn))\n\nstop\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer(8),intent(in) :: n\n integer(8),intent(inout) :: array(1:n)\n \n integer(8) ::i,k,j,l\n integer(8) :: t\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n end do\nend subroutine heapsort\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1176, "cpu_time_ms": 2126, "memory_kb": 787328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s617114274", "group_id": "codeNet:p03038", "input_text": "program main\nimplicit none\ninteger(8) :: i, j, k\ninteger(8) :: n, m, nn\ninteger(8), allocatable :: a(:), b(:), c(:), d(:)\n\nread(*,*) n, m\nallocate( a(n), b(m), c(m) )\nread(*,*) a\ndo i = 1, m\n read(*,*) b(i), c(i)\nend do\nnn = n + sum(b)\nallocate( d(nn) )\nd(1:n) = a(1:n)\nk = n\ndo i = 1, m\n do j = k+1,k+b(i)\n d(j) = c(i)\n end do\n k = k+b(i)\nend do\ncall heapsort( nn, d )\nwrite(*,'(i0)') sum(d(nn-n+1:nn))\n\nstop\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer(8),intent(in) :: n\n integer(8),intent(inout) :: array(1:n)\n \n integer(8) ::i,k,j,l\n integer(8) :: t\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n end do\nend subroutine heapsort\nend program main\n", "language": "Fortran", "metadata": {"date": 1563313766, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Fortran/s617114274.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s617114274", "user_id": "u696547932"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program main\nimplicit none\ninteger(8) :: i, j, k\ninteger(8) :: n, m, nn\ninteger(8), allocatable :: a(:), b(:), c(:), d(:)\n\nread(*,*) n, m\nallocate( a(n), b(m), c(m) )\nread(*,*) a\ndo i = 1, m\n read(*,*) b(i), c(i)\nend do\nnn = n + sum(b)\nallocate( d(nn) )\nd(1:n) = a(1:n)\nk = n\ndo i = 1, m\n do j = k+1,k+b(i)\n d(j) = c(i)\n end do\n k = k+b(i)\nend do\ncall heapsort( nn, d )\nwrite(*,'(i0)') sum(d(nn-n+1:nn))\n\nstop\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer(8),intent(in) :: n\n integer(8),intent(inout) :: array(1:n)\n \n integer(8) ::i,k,j,l\n integer(8) :: t\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n end do\nend subroutine heapsort\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1176, "cpu_time_ms": 2111, "memory_kb": 787328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s430779602", "group_id": "codeNet:p03038", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: i,j,n,m,k,ans=0,count\ninteger(16),allocatable :: a(:),b(:),c(:),d(:),i_d(:),index(:)\n\nread*, n,m \nallocate(a(n),b(m),c(m))\nread*, a(1:n)\ndo i = 1, m, 1\n read*, b(i),c(i)\nend do\n\nallocate(d(n+m),i_d(n+m),index(n+m))\ni_d = 1\n\ndo i = 1, n+m, 1\n if ( i >= n+1 ) then\n d(i) = c(i-n)\n i_d(i) = b(i-n)\n else\n d(i) = a(i)\n end if\nend do\n\ncall heapsort2(n+m,d,index)\n\ncount = n\ndo i = n+m, m+1, -1\n if ( count - i_d(index(i)) <= 0 ) then\n ans = ans + count*d(i)\n exit\n end if\n ans = ans + i_d(index(i))*d(i)\n count = count - i_d(index(i))\nend do\n\nprint'(i0)', ans\n\ncontains\n subroutine heapsort2(n,array,turn)\n implicit none\n integer(16),intent(in)::n\n integer(16),intent(out)::turn(1:n)\n integer(16),intent(inout)::array(1:n)\n \n integer::i,k,j,l,m\n double precision::t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n\n do i=1,N\n turn(i)=i\n enddo\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(l)\n m=turn(l)\n else\n t=array(k)\n m=turn(k)\n array(k)=array(1)\n turn(k)=turn(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n turn(1)=m\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n turn(i)=turn(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n turn(i)=m\n enddo\n\n return\n end subroutine heapsort2\n\n\nEND PROGRAM ATCODER", "language": "Fortran", "metadata": {"date": 1558840355, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Fortran/s430779602.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s430779602", "user_id": "u454557108"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: i,j,n,m,k,ans=0,count\ninteger(16),allocatable :: a(:),b(:),c(:),d(:),i_d(:),index(:)\n\nread*, n,m \nallocate(a(n),b(m),c(m))\nread*, a(1:n)\ndo i = 1, m, 1\n read*, b(i),c(i)\nend do\n\nallocate(d(n+m),i_d(n+m),index(n+m))\ni_d = 1\n\ndo i = 1, n+m, 1\n if ( i >= n+1 ) then\n d(i) = c(i-n)\n i_d(i) = b(i-n)\n else\n d(i) = a(i)\n end if\nend do\n\ncall heapsort2(n+m,d,index)\n\ncount = n\ndo i = n+m, m+1, -1\n if ( count - i_d(index(i)) <= 0 ) then\n ans = ans + count*d(i)\n exit\n end if\n ans = ans + i_d(index(i))*d(i)\n count = count - i_d(index(i))\nend do\n\nprint'(i0)', ans\n\ncontains\n subroutine heapsort2(n,array,turn)\n implicit none\n integer(16),intent(in)::n\n integer(16),intent(out)::turn(1:n)\n integer(16),intent(inout)::array(1:n)\n \n integer::i,k,j,l,m\n double precision::t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n\n do i=1,N\n turn(i)=i\n enddo\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(l)\n m=turn(l)\n else\n t=array(k)\n m=turn(k)\n array(k)=array(1)\n turn(k)=turn(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n turn(1)=m\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n turn(i)=turn(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n turn(i)=m\n enddo\n\n return\n end subroutine heapsort2\n\n\nEND PROGRAM ATCODER", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1681, "cpu_time_ms": 177, "memory_kb": 14848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s783488794", "group_id": "codeNet:p03038", "input_text": "program main\nimplicit none\ninteger*8 :: n, m\ninteger*8 , allocatable :: a(:), b(:), c(:)\ninteger*8 :: i, j, k\n\nread(*,*) n, m\nallocate( a(n) )\nallocate( b(m) )\nallocate( c(m) )\nread(*,*) a\ndo j = 1, m\n call heapsort(n,a)\n read(*,*) b(j), c(j)\n do k = 1, b(j)\n if( a(k) .ge. c(j) ) exit\n a(k) = c(j)\n end do\nend do\nwrite(*,'(i0)') sum(a)\n \nstop\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer*8,intent(in) :: n\n integer*8,intent(inout) :: array(1:n)\n \n integer*8 ::i,k,j,l\n integer*8 :: t\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n end do\nend subroutine heapsort\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1558836131, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Fortran/s783488794.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s783488794", "user_id": "u696547932"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program main\nimplicit none\ninteger*8 :: n, m\ninteger*8 , allocatable :: a(:), b(:), c(:)\ninteger*8 :: i, j, k\n\nread(*,*) n, m\nallocate( a(n) )\nallocate( b(m) )\nallocate( c(m) )\nread(*,*) a\ndo j = 1, m\n call heapsort(n,a)\n read(*,*) b(j), c(j)\n do k = 1, b(j)\n if( a(k) .ge. c(j) ) exit\n a(k) = c(j)\n end do\nend do\nwrite(*,'(i0)') sum(a)\n \nstop\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer*8,intent(in) :: n\n integer*8,intent(inout) :: array(1:n)\n \n integer*8 ::i,k,j,l\n integer*8 :: t\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n end do\nend subroutine heapsort\n\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1117, "cpu_time_ms": 2107, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s647161482", "group_id": "codeNet:p03038", "input_text": "integer(16),allocatable,dimension(:)::A\ninteger(16),allocatable,dimension(:)::B\ninteger(16),allocatable,dimension(:)::C\ninteger(16) N,M\ninteger cindex\nread*,N,M\nallocate(A(N),B(M),C(M))\nread*,A\ncall heapsort(N,A)\ndo i=1,M\n read*,B(i),C(i)\nend do\ncall neoheapsort(M,C,B)\ncindex=M\ndo i=1,N\n if(C(cindex)>A(i))then\n A(i)=C(cindex)\n B(cindex)=B(cindex)-1\n if(B(cindex)==0)cindex=cindex-1\n if(cindex==0)exit\n else\n exit\n endif\nend do\nprint\"(I0)\",sum(A)\n\ncontains\n\nsubroutine neoheapsort(n,array,b)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16),intent(inout) :: b(1:n)\n integer(16)::i,k,j,l\n integer(16):: t,tb\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n tb=b(l)\n else\n t=array(k)\n tb=b(k)\n array(k)=array(1)\n b(k)=b(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n b(1)=tb\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n b(i)=b(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n b(i)=tb\n enddo\n return\nend subroutine neoheapsort\n\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16)::i,k,j,l\n integer(16):: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend", "language": "Fortran", "metadata": {"date": 1558835195, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Fortran/s647161482.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s647161482", "user_id": "u598073939"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "integer(16),allocatable,dimension(:)::A\ninteger(16),allocatable,dimension(:)::B\ninteger(16),allocatable,dimension(:)::C\ninteger(16) N,M\ninteger cindex\nread*,N,M\nallocate(A(N),B(M),C(M))\nread*,A\ncall heapsort(N,A)\ndo i=1,M\n read*,B(i),C(i)\nend do\ncall neoheapsort(M,C,B)\ncindex=M\ndo i=1,N\n if(C(cindex)>A(i))then\n A(i)=C(cindex)\n B(cindex)=B(cindex)-1\n if(B(cindex)==0)cindex=cindex-1\n if(cindex==0)exit\n else\n exit\n endif\nend do\nprint\"(I0)\",sum(A)\n\ncontains\n\nsubroutine neoheapsort(n,array,b)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16),intent(inout) :: b(1:n)\n integer(16)::i,k,j,l\n integer(16):: t,tb\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n tb=b(l)\n else\n t=array(k)\n tb=b(k)\n array(k)=array(1)\n b(k)=b(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n b(1)=tb\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n b(i)=b(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n b(i)=tb\n enddo\n return\nend subroutine neoheapsort\n\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16)::i,k,j,l\n integer(16):: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2192, "cpu_time_ms": 162, "memory_kb": 5504}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s345959994", "group_id": "codeNet:p03038", "input_text": "integer(16),allocatable,dimension(:)::A\ninteger(16),allocatable,dimension(:)::B\ninteger(16),allocatable,dimension(:)::C\ninteger(16) N,M\ninteger cindex\nread*,N,M\nallocate(A(N),B(M),C(M))\nread*,A\ncall heapsort(N,A)\ndo i=1,M\n read*,B(i),C(i)\nend do\ncall neoheapsort(M,C,B)\ncindex=1\ndo i=1,N\n if(C(cindex)>A(i))then\n A(i)=C(cindex)\n B(cindex)=B(cindex)-1\n if(B(cindex)==0)cindex=cindex+1\n if(cindex>M)exit\n else\n exit\n endif\nend do\nprint\"(I0)\",sum(A)\n\ncontains\n\nsubroutine neoheapsort(n,array,b)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16),intent(inout) :: b(1:n)\n integer(16)::i,k,j,l\n integer(16):: t,tb\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n tb=b(l)\n else\n t=array(k)\n tb=b(k)\n array(k)=array(1)\n b(k)=b(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n b(1)=tb\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n b(i)=b(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n b(i)=tb\n enddo\n return\nend subroutine neoheapsort\n\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16)::i,k,j,l\n integer(16):: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend", "language": "Fortran", "metadata": {"date": 1558834967, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Fortran/s345959994.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s345959994", "user_id": "u598073939"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "integer(16),allocatable,dimension(:)::A\ninteger(16),allocatable,dimension(:)::B\ninteger(16),allocatable,dimension(:)::C\ninteger(16) N,M\ninteger cindex\nread*,N,M\nallocate(A(N),B(M),C(M))\nread*,A\ncall heapsort(N,A)\ndo i=1,M\n read*,B(i),C(i)\nend do\ncall neoheapsort(M,C,B)\ncindex=1\ndo i=1,N\n if(C(cindex)>A(i))then\n A(i)=C(cindex)\n B(cindex)=B(cindex)-1\n if(B(cindex)==0)cindex=cindex+1\n if(cindex>M)exit\n else\n exit\n endif\nend do\nprint\"(I0)\",sum(A)\n\ncontains\n\nsubroutine neoheapsort(n,array,b)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16),intent(inout) :: b(1:n)\n integer(16)::i,k,j,l\n integer(16):: t,tb\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n tb=b(l)\n else\n t=array(k)\n tb=b(k)\n array(k)=array(1)\n b(k)=b(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n b(1)=tb\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n b(i)=b(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n b(i)=tb\n enddo\n return\nend subroutine neoheapsort\n\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16)::i,k,j,l\n integer(16):: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2191, "cpu_time_ms": 161, "memory_kb": 5504}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s078628766", "group_id": "codeNet:p03038", "input_text": "program main\nimplicit none\ninteger :: n, m\ninteger , allocatable :: a(:), b(:), c(:)\ninteger :: i, j, k\n\nread(*,*) n, m\nallocate( a(n) )\nallocate( b(m) )\nallocate( c(m) )\nread(*,*) a(1:n)\ncall heapsort( n, a )\ndo j = 1, m\n read(*,*) b(j), c(j)\n do k = 1, b(j)\n if( a(k) .le.c(j) ) then\n a(k) = c(j)\n end if\n end do\n call heapsort( n,a )\nend do\nwrite(*,'(i0)') sum(a)\n \nstop\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n integer :: t\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n end do\nend subroutine heapsort\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1558833833, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03038.html", "problem_id": "p03038", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03038/input.txt", "sample_output_relpath": "derived/input_output/data/p03038/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03038/Fortran/s078628766.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s078628766", "user_id": "u696547932"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: n, m\ninteger , allocatable :: a(:), b(:), c(:)\ninteger :: i, j, k\n\nread(*,*) n, m\nallocate( a(n) )\nallocate( b(m) )\nallocate( c(m) )\nread(*,*) a(1:n)\ncall heapsort( n, a )\ndo j = 1, m\n read(*,*) b(j), c(j)\n do k = 1, b(j)\n if( a(k) .le.c(j) ) then\n a(k) = c(j)\n end if\n end do\n call heapsort( n,a )\nend do\nwrite(*,'(i0)') sum(a)\n \nstop\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n integer :: t\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n end do\nend subroutine heapsort\n\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3 2\n5 1 4\n2 3\n1 5\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03038", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N cards. On the i-th card, an integer A_i is written.\n\nFor each j = 1, 2, ..., M in this order, you will perform the following operation once:\n\nOperation: Choose at most B_j cards (possibly zero). Replace the integer written on each chosen card with C_j.\n\nFind the maximum possible sum of the integers written on the N cards after the M operations.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i, C_i \\leq 10^9\n\n1 \\leq B_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nB_1 C_1\nB_2 C_2\n\\vdots\nB_M C_M\n\nOutput\n\nPrint the maximum possible sum of the integers written on the N cards after the M operations.\n\nSample Input 1\n\n3 2\n5 1 4\n2 3\n1 5\n\nSample Output 1\n\n14\n\nBy replacing the integer on the second card with 5, the sum of the integers written on the three cards becomes 5 + 5 + 4 = 14, which is the maximum result.\n\nSample Input 2\n\n10 3\n1 8 5 7 100 4 52 33 13 5\n3 10\n4 30\n1 4\n\nSample Output 2\n\n338\n\nSample Input 3\n\n3 2\n100 100 100\n3 99\n3 99\n\nSample Output 3\n\n300\n\nSample Input 4\n\n11 3\n1 1 1 1 1 1 1 1 1 1 1\n3 1000000000\n4 1000000000\n3 1000000000\n\nSample Output 4\n\n10000000001\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1144, "cpu_time_ms": 2107, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s771662521", "group_id": "codeNet:p03039", "input_text": "integer(16) N,M,K\ninteger(16) waruno\ninteger(16) ans,tmp,i,j,com\nread*,N,M,K\nwaruno=10**9+7\ncom=combination(N*M-2,K-2,waruno)\nans=0\ndo i=0,M-1\n do j=0,N-1\n tmp=mod((i+j)*(M-i)*(N-j)*com*merge(1,2,i*j==0),waruno)\n ans=mod(ans+tmp,waruno)\n end do\nend do\nprint\"(i0)\",ans\n\ncontains\n\nfunction combination(n,k,l)\nimplicit none\ninteger(16),intent(in)::n,k,l\ninteger(16) combination,i\ninteger(16),allocatable,dimension(:)::Kaijo\n\n!まず最初に階乗について計算します\nallocate(Kaijo(0:N))\nKaijo(0)=1\ndo i=1,N\n Kaijo(i)=mod(Kaijo(i-1)*i,l)\nend do\n\n!そこから階乗を使ってコンビネーションを計算します\n!invはmod 10**9+7の下での逆数です\ncombination=mod(Kaijo(N)*inv(Kaijo(K),l)*inv(Kaijo(N-K),l),l)\n\nend function combination\n\nfunction inv(K,L)\ninteger(16),intent(in)::k,l\ninteger(16) l2,y\ninteger(16) inv\n!フェルマーの小定理から-1乗とは10**9+7-2乗だよねということで\n!10**9+7-2乗を計算します\n\n!計算に使うのは繰り返し二乗法\ninv=1\nl2=l-2\ny=k\ndo\n if(and(l2,1)==1)inv=mod(inv*y,l)\n y=mod(y*y,l)\n l2=rshift(l2,1)\n if(l2==0)exit\nend do\nend function inv\nend", "language": "Fortran", "metadata": {"date": 1558878675, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03039.html", "problem_id": "p03039", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03039/input.txt", "sample_output_relpath": "derived/input_output/data/p03039/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03039/Fortran/s771662521.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s771662521", "user_id": "u598073939"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "integer(16) N,M,K\ninteger(16) waruno\ninteger(16) ans,tmp,i,j,com\nread*,N,M,K\nwaruno=10**9+7\ncom=combination(N*M-2,K-2,waruno)\nans=0\ndo i=0,M-1\n do j=0,N-1\n tmp=mod((i+j)*(M-i)*(N-j)*com*merge(1,2,i*j==0),waruno)\n ans=mod(ans+tmp,waruno)\n end do\nend do\nprint\"(i0)\",ans\n\ncontains\n\nfunction combination(n,k,l)\nimplicit none\ninteger(16),intent(in)::n,k,l\ninteger(16) combination,i\ninteger(16),allocatable,dimension(:)::Kaijo\n\n!まず最初に階乗について計算します\nallocate(Kaijo(0:N))\nKaijo(0)=1\ndo i=1,N\n Kaijo(i)=mod(Kaijo(i-1)*i,l)\nend do\n\n!そこから階乗を使ってコンビネーションを計算します\n!invはmod 10**9+7の下での逆数です\ncombination=mod(Kaijo(N)*inv(Kaijo(K),l)*inv(Kaijo(N-K),l),l)\n\nend function combination\n\nfunction inv(K,L)\ninteger(16),intent(in)::k,l\ninteger(16) l2,y\ninteger(16) inv\n!フェルマーの小定理から-1乗とは10**9+7-2乗だよねということで\n!10**9+7-2乗を計算します\n\n!計算に使うのは繰り返し二乗法\ninv=1\nl2=l-2\ny=k\ndo\n if(and(l2,1)==1)inv=mod(inv*y,l)\n y=mod(y*y,l)\n l2=rshift(l2,1)\n if(l2==0)exit\nend do\nend function inv\nend", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a grid of squares with N rows and M columns. Let (i, j) denote the square at the i-th row from the top and j-th column from the left. We will choose K of the squares and put a piece on each of them.\n\nIf we place the K pieces on squares (x_1, y_1), (x_2, y_2), ..., and (x_K, y_K), the cost of this arrangement is computed as:\n\n\\sum_{i=1}^{K-1} \\sum_{j=i+1}^K (|x_i - x_j| + |y_i - y_j|)\n\nFind the sum of the costs of all possible arrangements of the pieces. Since this value can be tremendous, print it modulo 10^9+7.\n\nWe consider two arrangements of the pieces different if and only if there is a square that contains a piece in one of the arrangements but not in the other.\n\nConstraints\n\n2 \\leq N \\times M \\leq 2 \\times 10^5\n\n2 \\leq K \\leq N \\times M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nPrint the sum of the costs of all possible arrangements of the pieces, modulo 10^9+7.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\n8\n\nThere are six possible arrangements of the pieces, as follows:\n\n((1,1),(1,2)), with the cost |1-1|+|1-2| = 1\n\n((1,1),(2,1)), with the cost |1-2|+|1-1| = 1\n\n((1,1),(2,2)), with the cost |1-2|+|1-2| = 2\n\n((1,2),(2,1)), with the cost |1-2|+|2-1| = 2\n\n((1,2),(2,2)), with the cost |1-2|+|2-2| = 1\n\n((2,1),(2,2)), with the cost |2-2|+|1-2| = 1\n\nThe sum of these costs is 8.\n\nSample Input 2\n\n4 5 4\n\nSample Output 2\n\n87210\n\nSample Input 3\n\n100 100 5000\n\nSample Output 3\n\n817260251\n\nBe sure to print the sum modulo 10^9+7.", "sample_input": "2 2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03039", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a grid of squares with N rows and M columns. Let (i, j) denote the square at the i-th row from the top and j-th column from the left. We will choose K of the squares and put a piece on each of them.\n\nIf we place the K pieces on squares (x_1, y_1), (x_2, y_2), ..., and (x_K, y_K), the cost of this arrangement is computed as:\n\n\\sum_{i=1}^{K-1} \\sum_{j=i+1}^K (|x_i - x_j| + |y_i - y_j|)\n\nFind the sum of the costs of all possible arrangements of the pieces. Since this value can be tremendous, print it modulo 10^9+7.\n\nWe consider two arrangements of the pieces different if and only if there is a square that contains a piece in one of the arrangements but not in the other.\n\nConstraints\n\n2 \\leq N \\times M \\leq 2 \\times 10^5\n\n2 \\leq K \\leq N \\times M\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nPrint the sum of the costs of all possible arrangements of the pieces, modulo 10^9+7.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\n8\n\nThere are six possible arrangements of the pieces, as follows:\n\n((1,1),(1,2)), with the cost |1-1|+|1-2| = 1\n\n((1,1),(2,1)), with the cost |1-2|+|1-1| = 1\n\n((1,1),(2,2)), with the cost |1-2|+|1-2| = 2\n\n((1,2),(2,1)), with the cost |1-2|+|2-1| = 2\n\n((1,2),(2,2)), with the cost |1-2|+|2-2| = 1\n\n((2,1),(2,2)), with the cost |2-2|+|1-2| = 1\n\nThe sum of these costs is 8.\n\nSample Input 2\n\n4 5 4\n\nSample Output 2\n\n87210\n\nSample Input 3\n\n100 100 5000\n\nSample Output 3\n\n817260251\n\nBe sure to print the sum modulo 10^9+7.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1138, "cpu_time_ms": 14, "memory_kb": 3328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s244639814", "group_id": "codeNet:p03044", "input_text": "program main\n implicit none\n integer :: n, i, mi\n integer, allocatable :: a(:)\n read (*, *) n\n allocate (a(n))\n read (*, *) (a(i), i = 1, n)\n mi = 999999\n do i = 1, n\n mi = min(mi, fact_of_two(a(i)))\n end do\n write (*, \"(i0)\") mi\n deallocate (a)\n contains\n\n function fact_of_two(i)\n implicit none\n integer :: i, j, fact_of_two\n do j = 0, 100\n if (mod(i, 2 ** j) /= 0) then\n exit\n end if\n end do\n if (j < 1) stop 1\n fact_of_two = j - 1\n end function fact_of_two\nend program main\n", "language": "Fortran", "metadata": {"date": 1585705742, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03044.html", "problem_id": "p03044", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03044/input.txt", "sample_output_relpath": "derived/input_output/data/p03044/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03044/Fortran/s244639814.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s244639814", "user_id": "u388927326"}, "prompt_components": {"gold_output": "0\n0\n1\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, i, mi\n integer, allocatable :: a(:)\n read (*, *) n\n allocate (a(n))\n read (*, *) (a(i), i = 1, n)\n mi = 999999\n do i = 1, n\n mi = min(mi, fact_of_two(a(i)))\n end do\n write (*, \"(i0)\") mi\n deallocate (a)\n contains\n\n function fact_of_two(i)\n implicit none\n integer :: i, j, fact_of_two\n do j = 0, 100\n if (mod(i, 2 ** j) /= 0) then\n exit\n end if\n end do\n if (j < 1) stop 1\n fact_of_two = j - 1\n end function fact_of_two\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a tree with N vertices numbered 1 to N.\nThe i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i.\nYour objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:\n\nFor any two vertices painted in the same color, the distance between them is an even number.\n\nFind a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq u_i < v_i \\leq N\n\n1 \\leq w_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nu_1 v_1 w_1\nu_2 v_2 w_2\n.\n.\n.\nu_{N - 1} v_{N - 1} w_{N - 1}\n\nOutput\n\nPrint a coloring of the vertices that satisfies the condition, in N lines.\nThe i-th line should contain 0 if Vertex i is painted white and 1 if it is painted black.\n\nIf there are multiple colorings that satisfy the condition, any of them will be accepted.\n\nSample Input 1\n\n3\n1 2 2\n2 3 1\n\nSample Output 1\n\n0\n0\n1\n\nSample Input 2\n\n5\n2 5 2\n2 3 10\n1 3 8\n3 4 2\n\nSample Output 2\n\n1\n0\n1\n0\n1", "sample_input": "3\n1 2 2\n2 3 1\n"}, "reference_outputs": ["0\n0\n1\n"], "source_document_id": "p03044", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a tree with N vertices numbered 1 to N.\nThe i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i.\nYour objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:\n\nFor any two vertices painted in the same color, the distance between them is an even number.\n\nFind a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq u_i < v_i \\leq N\n\n1 \\leq w_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nu_1 v_1 w_1\nu_2 v_2 w_2\n.\n.\n.\nu_{N - 1} v_{N - 1} w_{N - 1}\n\nOutput\n\nPrint a coloring of the vertices that satisfies the condition, in N lines.\nThe i-th line should contain 0 if Vertex i is painted white and 1 if it is painted black.\n\nIf there are multiple colorings that satisfy the condition, any of them will be accepted.\n\nSample Input 1\n\n3\n1 2 2\n2 3 1\n\nSample Output 1\n\n0\n0\n1\n\nSample Input 2\n\n5\n2 5 2\n2 3 10\n1 3 8\n3 4 2\n\nSample Output 2\n\n1\n0\n1\n0\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 530, "cpu_time_ms": 32, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s587297455", "group_id": "codeNet:p03044", "input_text": "program kadai\nimplicit none\n\ninteger :: in\ninteger,allocatable :: u(:),v(:),w(:),flag(:),a(:)\ninteger :: i,j\nread(*,*) in\n\nallocate(u(in))\nallocate(v(in))\nallocate(w(in))\nallocate(flag(in))\nallocate(a(in))\n\ndo i=1,in-1\nread(*,*) u(i),v(i),w(i)\na(i)=0\nend do\na(in)=0\n\ndo j=1,in-1\nif(u(i)==j) then\nif(mod(w(i),2)==0) then\na(u(i))=1\na(v(i))=1\nend if\nend if\nend do\n\ndo i=1,in\nwrite(*,*) a(i)\nend do\n\n\n\n\nend program kadai", "language": "Fortran", "metadata": {"date": 1558319958, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03044.html", "problem_id": "p03044", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03044/input.txt", "sample_output_relpath": "derived/input_output/data/p03044/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03044/Fortran/s587297455.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s587297455", "user_id": "u286754585"}, "prompt_components": {"gold_output": "0\n0\n1\n", "input_to_evaluate": "program kadai\nimplicit none\n\ninteger :: in\ninteger,allocatable :: u(:),v(:),w(:),flag(:),a(:)\ninteger :: i,j\nread(*,*) in\n\nallocate(u(in))\nallocate(v(in))\nallocate(w(in))\nallocate(flag(in))\nallocate(a(in))\n\ndo i=1,in-1\nread(*,*) u(i),v(i),w(i)\na(i)=0\nend do\na(in)=0\n\ndo j=1,in-1\nif(u(i)==j) then\nif(mod(w(i),2)==0) then\na(u(i))=1\na(v(i))=1\nend if\nend if\nend do\n\ndo i=1,in\nwrite(*,*) a(i)\nend do\n\n\n\n\nend program kadai", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a tree with N vertices numbered 1 to N.\nThe i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i.\nYour objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:\n\nFor any two vertices painted in the same color, the distance between them is an even number.\n\nFind a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq u_i < v_i \\leq N\n\n1 \\leq w_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nu_1 v_1 w_1\nu_2 v_2 w_2\n.\n.\n.\nu_{N - 1} v_{N - 1} w_{N - 1}\n\nOutput\n\nPrint a coloring of the vertices that satisfies the condition, in N lines.\nThe i-th line should contain 0 if Vertex i is painted white and 1 if it is painted black.\n\nIf there are multiple colorings that satisfy the condition, any of them will be accepted.\n\nSample Input 1\n\n3\n1 2 2\n2 3 1\n\nSample Output 1\n\n0\n0\n1\n\nSample Input 2\n\n5\n2 5 2\n2 3 10\n1 3 8\n3 4 2\n\nSample Output 2\n\n1\n0\n1\n0\n1", "sample_input": "3\n1 2 2\n2 3 1\n"}, "reference_outputs": ["0\n0\n1\n"], "source_document_id": "p03044", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a tree with N vertices numbered 1 to N.\nThe i-th edge in the tree connects Vertex u_i and Vertex v_i, and its length is w_i.\nYour objective is to paint each vertex in the tree white or black (it is fine to paint all vertices the same color) so that the following condition is satisfied:\n\nFor any two vertices painted in the same color, the distance between them is an even number.\n\nFind a coloring of the vertices that satisfies the condition and print it. It can be proved that at least one such coloring exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq u_i < v_i \\leq N\n\n1 \\leq w_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nu_1 v_1 w_1\nu_2 v_2 w_2\n.\n.\n.\nu_{N - 1} v_{N - 1} w_{N - 1}\n\nOutput\n\nPrint a coloring of the vertices that satisfies the condition, in N lines.\nThe i-th line should contain 0 if Vertex i is painted white and 1 if it is painted black.\n\nIf there are multiple colorings that satisfy the condition, any of them will be accepted.\n\nSample Input 1\n\n3\n1 2 2\n2 3 1\n\nSample Output 1\n\n0\n0\n1\n\nSample Input 2\n\n5\n2 5 2\n2 3 10\n1 3 8\n3 4 2\n\nSample Output 2\n\n1\n0\n1\n0\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 422, "cpu_time_ms": 108, "memory_kb": 3072}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s363192451", "group_id": "codeNet:p03047", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: n,i,j,count=0,count_a=0,count_b=0\ncharacter(len=10),allocatable :: s(:)\n\nread*, n\nallocate(s(n))\nread*, s(1:n)\n\ndo i = 1, n\n do j = 1, len_trim(s(i))-1\n if ( s(i)(j:j+1) == 'AB' ) then\n count = count + 1\n end if\n end do\n if ( s(i)(1:1) == 'B' ) then\n count_b = count_b + 1\n end if \n if ( s(i)(len_trim(s(i)):len_trim(s(i))) == 'A' ) then\n count_a = count_a + 1\n end if\nend do\n\nprint'(i0)', count + min(count_a,count_b)\n\nEND PROGRAM ATCODER\n", "language": "Fortran", "metadata": {"date": 1557628581, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03047.html", "problem_id": "p03047", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03047/input.txt", "sample_output_relpath": "derived/input_output/data/p03047/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03047/Fortran/s363192451.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s363192451", "user_id": "u454557108"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: n,i,j,count=0,count_a=0,count_b=0\ncharacter(len=10),allocatable :: s(:)\n\nread*, n\nallocate(s(n))\nread*, s(1:n)\n\ndo i = 1, n\n do j = 1, len_trim(s(i))-1\n if ( s(i)(j:j+1) == 'AB' ) then\n count = count + 1\n end if\n end do\n if ( s(i)(1:1) == 'B' ) then\n count_b = count_b + 1\n end if \n if ( s(i)(len_trim(s(i)):len_trim(s(i))) == 'A' ) then\n count_a = count_a + 1\n end if\nend do\n\nprint'(i0)', count + min(count_a,count_b)\n\nEND PROGRAM ATCODER\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has N integers: 1,2,\\ldots,N.\nHe will choose K of them and give those to Takahashi.\n\nHow many ways are there to choose K consecutive integers?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq K \\leq N \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n2\n\nThere are two ways to choose two consecutive integers: (1,2) and (2,3).\n\nSample Input 2\n\n13 3\n\nSample Output 2\n\n11", "sample_input": "3 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03047", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has N integers: 1,2,\\ldots,N.\nHe will choose K of them and give those to Takahashi.\n\nHow many ways are there to choose K consecutive integers?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq K \\leq N \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n2\n\nThere are two ways to choose two consecutive integers: (1,2) and (2,3).\n\nSample Input 2\n\n13 3\n\nSample Output 2\n\n11", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 522, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s105843198", "group_id": "codeNet:p03047", "input_text": "program divertaA\n\tinteger N, K, X\n read(*, *) N, K\n X = N - K +1\n print '(i0)', X\nend program", "language": "Fortran", "metadata": {"date": 1557624077, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03047.html", "problem_id": "p03047", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03047/input.txt", "sample_output_relpath": "derived/input_output/data/p03047/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03047/Fortran/s105843198.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s105843198", "user_id": "u039189422"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program divertaA\n\tinteger N, K, X\n read(*, *) N, K\n X = N - K +1\n print '(i0)', X\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has N integers: 1,2,\\ldots,N.\nHe will choose K of them and give those to Takahashi.\n\nHow many ways are there to choose K consecutive integers?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq K \\leq N \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n2\n\nThere are two ways to choose two consecutive integers: (1,2) and (2,3).\n\nSample Input 2\n\n13 3\n\nSample Output 2\n\n11", "sample_input": "3 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03047", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has N integers: 1,2,\\ldots,N.\nHe will choose K of them and give those to Takahashi.\n\nHow many ways are there to choose K consecutive integers?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq K \\leq N \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n2\n\nThere are two ways to choose two consecutive integers: (1,2) and (2,3).\n\nSample Input 2\n\n13 3\n\nSample Output 2\n\n11", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 102, "cpu_time_ms": 4, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s385836656", "group_id": "codeNet:p03047", "input_text": "integer N,K\nread*,N,K\nprint\"(i0)\",N-K+1\nend", "language": "Fortran", "metadata": {"date": 1557623782, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03047.html", "problem_id": "p03047", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03047/input.txt", "sample_output_relpath": "derived/input_output/data/p03047/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03047/Fortran/s385836656.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s385836656", "user_id": "u598073939"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "integer N,K\nread*,N,K\nprint\"(i0)\",N-K+1\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has N integers: 1,2,\\ldots,N.\nHe will choose K of them and give those to Takahashi.\n\nHow many ways are there to choose K consecutive integers?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq K \\leq N \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n2\n\nThere are two ways to choose two consecutive integers: (1,2) and (2,3).\n\nSample Input 2\n\n13 3\n\nSample Output 2\n\n11", "sample_input": "3 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03047", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has N integers: 1,2,\\ldots,N.\nHe will choose K of them and give those to Takahashi.\n\nHow many ways are there to choose K consecutive integers?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq K \\leq N \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n2\n\nThere are two ways to choose two consecutive integers: (1,2) and (2,3).\n\nSample Input 2\n\n13 3\n\nSample Output 2\n\n11", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 43, "cpu_time_ms": 10, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s912566093", "group_id": "codeNet:p03048", "input_text": "program main\n implicit none\n integer :: i, j, k, r, g, b, n, cnt = 0\n \n read *, r, g, b, n \n do i = 0, int(n/r)\n do j = 0, int(n/g)\n if (mod(n - r*i + g*j, b) == 0) cnt = cnt + 1\n end do\n end do\n \n print '(i0)', cnt\nend program", "language": "Fortran", "metadata": {"date": 1557696625, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03048.html", "problem_id": "p03048", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03048/input.txt", "sample_output_relpath": "derived/input_output/data/p03048/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03048/Fortran/s912566093.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s912566093", "user_id": "u282360873"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main\n implicit none\n integer :: i, j, k, r, g, b, n, cnt = 0\n \n read *, r, g, b, n \n do i = 0, int(n/r)\n do j = 0, int(n/g)\n if (mod(n - r*i + g*j, b) == 0) cnt = cnt + 1\n end do\n end do\n \n print '(i0)', cnt\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:\n\nRed boxes, each containing R red balls\n\nGreen boxes, each containing G green balls\n\nBlue boxes, each containing B blue balls\n\nSnuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.\nHow many triples of non-negative integers (r,g,b) achieve this?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq R,G,B,N \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR G B N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 3 4\n\nSample Output 1\n\n4\n\nFour triples achieve the objective, as follows:\n\n(4,0,0)\n\n(2,1,0)\n\n(1,0,1)\n\n(0,2,0)\n\nSample Input 2\n\n13 1 4 3000\n\nSample Output 2\n\n87058", "sample_input": "1 2 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03048", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:\n\nRed boxes, each containing R red balls\n\nGreen boxes, each containing G green balls\n\nBlue boxes, each containing B blue balls\n\nSnuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.\nHow many triples of non-negative integers (r,g,b) achieve this?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq R,G,B,N \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR G B N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 3 4\n\nSample Output 1\n\n4\n\nFour triples achieve the objective, as follows:\n\n(4,0,0)\n\n(2,1,0)\n\n(1,0,1)\n\n(0,2,0)\n\nSample Input 2\n\n13 1 4 3000\n\nSample Output 2\n\n87058", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 244, "cpu_time_ms": 27, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s938388667", "group_id": "codeNet:p03048", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger :: r,g,b,n,x,y,z,max_r,max_g,max_b,i,j,count=0\n\nread*, r,g,b,n\n\nmax_r = n/r ; max_g = n/g ; max_b = n/b\n\ndo i = 0, max_r, 1\n do j = 0, max_g, 1\n x = i ; y = j ; z = (n - x*r - y*g)/b\n if ( mod(n - x*r - y*g,b) == 0 .and. z >=0 .and. z <= max_b ) then\n count = count + 1\n end if\n end do\nend do\n\nprint'(i0)', count\n\nEND PROGRAM ATCODER", "language": "Fortran", "metadata": {"date": 1557624400, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03048.html", "problem_id": "p03048", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03048/input.txt", "sample_output_relpath": "derived/input_output/data/p03048/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03048/Fortran/s938388667.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s938388667", "user_id": "u454557108"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger :: r,g,b,n,x,y,z,max_r,max_g,max_b,i,j,count=0\n\nread*, r,g,b,n\n\nmax_r = n/r ; max_g = n/g ; max_b = n/b\n\ndo i = 0, max_r, 1\n do j = 0, max_g, 1\n x = i ; y = j ; z = (n - x*r - y*g)/b\n if ( mod(n - x*r - y*g,b) == 0 .and. z >=0 .and. z <= max_b ) then\n count = count + 1\n end if\n end do\nend do\n\nprint'(i0)', count\n\nEND PROGRAM ATCODER", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:\n\nRed boxes, each containing R red balls\n\nGreen boxes, each containing G green balls\n\nBlue boxes, each containing B blue balls\n\nSnuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.\nHow many triples of non-negative integers (r,g,b) achieve this?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq R,G,B,N \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR G B N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 3 4\n\nSample Output 1\n\n4\n\nFour triples achieve the objective, as follows:\n\n(4,0,0)\n\n(2,1,0)\n\n(1,0,1)\n\n(0,2,0)\n\nSample Input 2\n\n13 1 4 3000\n\nSample Output 2\n\n87058", "sample_input": "1 2 3 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03048", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:\n\nRed boxes, each containing R red balls\n\nGreen boxes, each containing G green balls\n\nBlue boxes, each containing B blue balls\n\nSnuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.\nHow many triples of non-negative integers (r,g,b) achieve this?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq R,G,B,N \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR G B N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 3 4\n\nSample Output 1\n\n4\n\nFour triples achieve the objective, as follows:\n\n(4,0,0)\n\n(2,1,0)\n\n(1,0,1)\n\n(0,2,0)\n\nSample Input 2\n\n13 1 4 3000\n\nSample Output 2\n\n87058", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 389, "cpu_time_ms": 33, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s688216726", "group_id": "codeNet:p03049", "input_text": "program prob3\n implicit none\n integer::N, i, l, ans, a, b, c, j\n character(len=10)::s\n\n ans = 0\n a = 0\n b = 0\n read(*,*) N\n do j = 1, N\n read(*,*) s\n l = len_trim(s)\n do i = 1, l-1\n if(s(i:i) .eq. \"A\" .and. s(i+1:i+1) .eq. \"B\") then\n ans = ans + 1\n end if\n end do\n if(s(1:1) .eq. \"B\")then\n b = b+1\n end if\n if(s(l:l) .eq. \"A\")then\n a = a+1\n end if\n end do\n ans = ans + min(a,b)\n write(*,*) ans\n\n stop\nend program", "language": "Fortran", "metadata": {"date": 1593009479, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03049.html", "problem_id": "p03049", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03049/input.txt", "sample_output_relpath": "derived/input_output/data/p03049/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03049/Fortran/s688216726.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s688216726", "user_id": "u841856382"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program prob3\n implicit none\n integer::N, i, l, ans, a, b, c, j\n character(len=10)::s\n\n ans = 0\n a = 0\n b = 0\n read(*,*) N\n do j = 1, N\n read(*,*) s\n l = len_trim(s)\n do i = 1, l-1\n if(s(i:i) .eq. \"A\" .and. s(i+1:i+1) .eq. \"B\") then\n ans = ans + 1\n end if\n end do\n if(s(1:1) .eq. \"B\")then\n b = b+1\n end if\n if(s(l:l) .eq. \"A\")then\n a = a+1\n end if\n end do\n ans = ans + min(a,b)\n write(*,*) ans\n\n stop\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "sample_input": "3\nABCA\nXBAZ\nBAD\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03049", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 563, "cpu_time_ms": 15, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s668820193", "group_id": "codeNet:p03049", "input_text": "program main\n implicit none\n integer :: i, j, n, lt, cnt = 0, a = 0, b = 0, ab = 0\n character*10 :: s\n\n read *, n\n do i = 1, n\n read *, s\n lt = len_trim(s)\n if ((s(1:1) /= 'B') .and. (s(lt:lt) == 'A')) a = a + 1\n if ((s(1:1) == 'B') .and. (s(lt:lt) /= 'A')) b = b + 1\n if ((s(1:1) == 'B') .and. (s(lt:lt) == 'A')) ab = ab + 1\n do j = 1, lt\n if (s(j: j+1) == 'AB') cnt = cnt + 1\n end do\n end do\n if (a > b) then\n print '(i0)', cnt + b + ab\n else if (b > a) then\n print '(i0)', cnt + a + ab\n else\n print '(i0)', cnt + a + max(0, ab-1)\n end if\nend program", "language": "Fortran", "metadata": {"date": 1557626047, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03049.html", "problem_id": "p03049", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03049/input.txt", "sample_output_relpath": "derived/input_output/data/p03049/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03049/Fortran/s668820193.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s668820193", "user_id": "u282360873"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer :: i, j, n, lt, cnt = 0, a = 0, b = 0, ab = 0\n character*10 :: s\n\n read *, n\n do i = 1, n\n read *, s\n lt = len_trim(s)\n if ((s(1:1) /= 'B') .and. (s(lt:lt) == 'A')) a = a + 1\n if ((s(1:1) == 'B') .and. (s(lt:lt) /= 'A')) b = b + 1\n if ((s(1:1) == 'B') .and. (s(lt:lt) == 'A')) ab = ab + 1\n do j = 1, lt\n if (s(j: j+1) == 'AB') cnt = cnt + 1\n end do\n end do\n if (a > b) then\n print '(i0)', cnt + b + ab\n else if (b > a) then\n print '(i0)', cnt + a + ab\n else\n print '(i0)', cnt + a + max(0, ab-1)\n end if\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "sample_input": "3\nABCA\nXBAZ\nBAD\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03049", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has N strings. The i-th string is s_i.\n\nLet us concatenate these strings into one string after arranging them in some order.\nFind the maximum possible number of occurrences of AB in the resulting string.\n\nConstraints\n\n1 \\leq N \\leq 10^{4}\n\n2 \\leq |s_i| \\leq 10\n\ns_i consists of uppercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\n\\vdots\ns_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\nABCA\nXBAZ\nBAD\n\nSample Output 1\n\n2\n\nFor example, if we concatenate ABCA, BAD and XBAZ in this order, the resulting string ABCABADXBAZ has two occurrences of AB.\n\nSample Input 2\n\n9\nBEWPVCRWH\nZZNQYIJX\nBAVREA\nPA\nHJMYITEOX\nBCJHMRMNK\nBP\nQVFABZ\nPRGKSPUNA\n\nSample Output 2\n\n4\n\nSample Input 3\n\n7\nRABYBBE\nJOZ\nBMHQUVA\nBPA\nISU\nMCMABAOBHZ\nSZMEHMA\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 597, "cpu_time_ms": 8, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s199621352", "group_id": "codeNet:p03050", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: n,i,s_n,ans=0\n\nread*, n\n\ns_n = ceiling(sqrt(real(n,8)),16)\n\ndo i = 1, s_n, 1\n if ( mod(n,i) == 0 ) then\n if ( i /= 1 ) then\n if ( mod(n,i-1) == n/(i-1) ) then\n ans = ans + (i-1)\n end if\n end if\n if ( n/i /= 1 ) then\n if ( mod(n,n/i-1) == n/(n/i-1) ) then\n ans = ans + (n/i-1)\n end if\n end if\n end if\nend do\n\nprint'(i0)', ans\n\nEND PROGRAM ATCODER", "language": "Fortran", "metadata": {"date": 1557681129, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03050.html", "problem_id": "p03050", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03050/input.txt", "sample_output_relpath": "derived/input_output/data/p03050/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03050/Fortran/s199621352.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s199621352", "user_id": "u454557108"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: n,i,s_n,ans=0\n\nread*, n\n\ns_n = ceiling(sqrt(real(n,8)),16)\n\ndo i = 1, s_n, 1\n if ( mod(n,i) == 0 ) then\n if ( i /= 1 ) then\n if ( mod(n,i-1) == n/(i-1) ) then\n ans = ans + (i-1)\n end if\n end if\n if ( n/i /= 1 ) then\n if ( mod(n,n/i-1) == n/(n/i-1) ) then\n ans = ans + (n/i-1)\n end if\n end if\n end if\nend do\n\nprint'(i0)', ans\n\nEND PROGRAM ATCODER", "problem_context": "Score : 500 points\n\nProblem Statement\n\nSnuke received a positive integer N from Takahashi.\nA positive integer m is called a favorite number when the following condition is satisfied:\n\nThe quotient and remainder of N divided by m are equal, that is, \\lfloor \\frac{N}{m} \\rfloor = N \\bmod m holds.\n\nFind all favorite numbers and print the sum of those.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n10\n\nThere are two favorite numbers: 3 and 7. Print the sum of these, 10.\n\nSample Input 2\n\n1000000000000\n\nSample Output 2\n\n2499686339916\n\nWatch out for overflow.", "sample_input": "8\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03050", "source_text": "Score : 500 points\n\nProblem Statement\n\nSnuke received a positive integer N from Takahashi.\nA positive integer m is called a favorite number when the following condition is satisfied:\n\nThe quotient and remainder of N divided by m are equal, that is, \\lfloor \\frac{N}{m} \\rfloor = N \\bmod m holds.\n\nFind all favorite numbers and print the sum of those.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n10\n\nThere are two favorite numbers: 3 and 7. Print the sum of these, 10.\n\nSample Input 2\n\n1000000000000\n\nSample Output 2\n\n2499686339916\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 439, "cpu_time_ms": 17, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s679085637", "group_id": "codeNet:p03050", "input_text": "program main\nImplicit None\n\tinteger(8)::n,a=1,p=0\n\t\n\tread*,n\n\t\n\tdo\n\t\tif((n/a-1) < a) exit\n\t\tif(mod(n,a) == 0)then\n\t\t\tif((n/a-1) > a) p = p + n/a-1\n\t\tendif\n\t\ta = a+1\n\tenddo\n\tprint\"(i0)\",p\nend program main", "language": "Fortran", "metadata": {"date": 1557625232, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03050.html", "problem_id": "p03050", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03050/input.txt", "sample_output_relpath": "derived/input_output/data/p03050/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03050/Fortran/s679085637.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s679085637", "user_id": "u900266249"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main\nImplicit None\n\tinteger(8)::n,a=1,p=0\n\t\n\tread*,n\n\t\n\tdo\n\t\tif((n/a-1) < a) exit\n\t\tif(mod(n,a) == 0)then\n\t\t\tif((n/a-1) > a) p = p + n/a-1\n\t\tendif\n\t\ta = a+1\n\tenddo\n\tprint\"(i0)\",p\nend program main", "problem_context": "Score : 500 points\n\nProblem Statement\n\nSnuke received a positive integer N from Takahashi.\nA positive integer m is called a favorite number when the following condition is satisfied:\n\nThe quotient and remainder of N divided by m are equal, that is, \\lfloor \\frac{N}{m} \\rfloor = N \\bmod m holds.\n\nFind all favorite numbers and print the sum of those.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n10\n\nThere are two favorite numbers: 3 and 7. Print the sum of these, 10.\n\nSample Input 2\n\n1000000000000\n\nSample Output 2\n\n2499686339916\n\nWatch out for overflow.", "sample_input": "8\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03050", "source_text": "Score : 500 points\n\nProblem Statement\n\nSnuke received a positive integer N from Takahashi.\nA positive integer m is called a favorite number when the following condition is satisfied:\n\nThe quotient and remainder of N divided by m are equal, that is, \\lfloor \\frac{N}{m} \\rfloor = N \\bmod m holds.\n\nFind all favorite numbers and print the sum of those.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n10\n\nThere are two favorite numbers: 3 and 7. Print the sum of these, 10.\n\nSample Input 2\n\n1000000000000\n\nSample Output 2\n\n2499686339916\n\nWatch out for overflow.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 203, "cpu_time_ms": 21, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s975693702", "group_id": "codeNet:p03059", "input_text": "program main\n\timplicit none\n integer::a,b,c\n read(*,*)a,b,c\n write(*,*) (c/a)*b\n stop\nend program main\n", "language": "Fortran", "metadata": {"date": 1592636618, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03059.html", "problem_id": "p03059", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03059/input.txt", "sample_output_relpath": "derived/input_output/data/p03059/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03059/Fortran/s975693702.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s975693702", "user_id": "u884601206"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main\n\timplicit none\n integer::a,b,c\n read(*,*)a,b,c\n write(*,*) (c/a)*b\n stop\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\n\nFind the total number of biscuits produced within T + 0.5 seconds after activation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, T \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B T\n\nOutput\n\nPrint the total number of biscuits produced within T + 0.5 seconds after activation.\n\nSample Input 1\n\n3 5 7\n\nSample Output 1\n\n10\n\nFive biscuits will be produced three seconds after activation.\n\nAnother five biscuits will be produced six seconds after activation.\n\nThus, a total of ten biscuits will be produced within 7.5 seconds after activation.\n\nSample Input 2\n\n3 2 9\n\nSample Output 2\n\n6\n\nSample Input 3\n\n20 20 19\n\nSample Output 3\n\n0", "sample_input": "3 5 7\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03059", "source_text": "Score : 100 points\n\nProblem Statement\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\n\nFind the total number of biscuits produced within T + 0.5 seconds after activation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, T \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B T\n\nOutput\n\nPrint the total number of biscuits produced within T + 0.5 seconds after activation.\n\nSample Input 1\n\n3 5 7\n\nSample Output 1\n\n10\n\nFive biscuits will be produced three seconds after activation.\n\nAnother five biscuits will be produced six seconds after activation.\n\nThus, a total of ten biscuits will be produced within 7.5 seconds after activation.\n\nSample Input 2\n\n3 2 9\n\nSample Output 2\n\n6\n\nSample Input 3\n\n20 20 19\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 115, "cpu_time_ms": 6, "memory_kb": 2792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s869138474", "group_id": "codeNet:p03059", "input_text": "integer a,b,c\nread*, a,b,c\nprint*, c/a*b\nend", "language": "Fortran", "metadata": {"date": 1571901333, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03059.html", "problem_id": "p03059", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03059/input.txt", "sample_output_relpath": "derived/input_output/data/p03059/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03059/Fortran/s869138474.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s869138474", "user_id": "u244203620"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "integer a,b,c\nread*, a,b,c\nprint*, c/a*b\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\n\nFind the total number of biscuits produced within T + 0.5 seconds after activation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, T \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B T\n\nOutput\n\nPrint the total number of biscuits produced within T + 0.5 seconds after activation.\n\nSample Input 1\n\n3 5 7\n\nSample Output 1\n\n10\n\nFive biscuits will be produced three seconds after activation.\n\nAnother five biscuits will be produced six seconds after activation.\n\nThus, a total of ten biscuits will be produced within 7.5 seconds after activation.\n\nSample Input 2\n\n3 2 9\n\nSample Output 2\n\n6\n\nSample Input 3\n\n20 20 19\n\nSample Output 3\n\n0", "sample_input": "3 5 7\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03059", "source_text": "Score : 100 points\n\nProblem Statement\n\nA biscuit making machine produces B biscuits at the following moments: A seconds, 2A seconds, 3A seconds and each subsequent multiple of A seconds after activation.\n\nFind the total number of biscuits produced within T + 0.5 seconds after activation.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B, T \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B T\n\nOutput\n\nPrint the total number of biscuits produced within T + 0.5 seconds after activation.\n\nSample Input 1\n\n3 5 7\n\nSample Output 1\n\n10\n\nFive biscuits will be produced three seconds after activation.\n\nAnother five biscuits will be produced six seconds after activation.\n\nThus, a total of ten biscuits will be produced within 7.5 seconds after activation.\n\nSample Input 2\n\n3 2 9\n\nSample Output 2\n\n6\n\nSample Input 3\n\n20 20 19\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 44, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s102692923", "group_id": "codeNet:p03060", "input_text": "integer :: n,i,ans=0\ninteger,allocatable :: v(:),c(:)\n\nread*,n\nallocate( v(n),c(n) )\nread*,v\nread*,c\n\ndo i = 1,n\n if( v(i)>=c(i) )then\n ans = ans + v(i) - c(i)\n end if\nend do\nprint*,ans\nend\n", "language": "Fortran", "metadata": {"date": 1600056310, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03060.html", "problem_id": "p03060", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03060/input.txt", "sample_output_relpath": "derived/input_output/data/p03060/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03060/Fortran/s102692923.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s102692923", "user_id": "u171356453"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "integer :: n,i,ans=0\ninteger,allocatable :: v(:),c(:)\n\nread*,n\nallocate( v(n),c(n) )\nread*,v\nread*,c\n\ndo i = 1,n\n if( v(i)>=c(i) )then\n ans = ans + v(i) - c(i)\n end if\nend do\nprint*,ans\nend\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.\n\nFind the maximum possible value of X-Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq C_i, V_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nV_1 V_2 ... V_N\nC_1 C_2 ... C_N\n\nOutput\n\nPrint the maximum possible value of X-Y.\n\nSample Input 1\n\n3\n10 2 5\n6 3 4\n\nSample Output 1\n\n5\n\nIf we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.\nWe have X-Y = 5 here, which is the maximum possible value.\n\nSample Input 2\n\n4\n13 21 6 19\n11 30 6 15\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1\n1\n50\n\nSample Output 3\n\n0", "sample_input": "3\n10 2 5\n6 3 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03060", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.\n\nFind the maximum possible value of X-Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq C_i, V_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nV_1 V_2 ... V_N\nC_1 C_2 ... C_N\n\nOutput\n\nPrint the maximum possible value of X-Y.\n\nSample Input 1\n\n3\n10 2 5\n6 3 4\n\nSample Output 1\n\n5\n\nIf we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.\nWe have X-Y = 5 here, which is the maximum possible value.\n\nSample Input 2\n\n4\n13 21 6 19\n11 30 6 15\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1\n1\n50\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 195, "cpu_time_ms": 14, "memory_kb": 2768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s354937695", "group_id": "codeNet:p03060", "input_text": "program rss\n implicit none\n integer :: N,i,val\n integer,allocatable :: V(:),C(:)\n\n read(*,*) N\n allocate(V(N))\n allocate(C(N))\n\n read(*,*) V\n read(*,*) C\n val=0\n do i=1,N\n if(V(i).gt.C(i)) then\n val=val+(V(i)-C(i))\n endif\n enddo\n write(*,'(i0)') val\n deallocate(V)\n deallocate(C)\n\n\n\nend program rss\n\n", "language": "Fortran", "metadata": {"date": 1556413508, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03060.html", "problem_id": "p03060", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03060/input.txt", "sample_output_relpath": "derived/input_output/data/p03060/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03060/Fortran/s354937695.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s354937695", "user_id": "u613124399"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program rss\n implicit none\n integer :: N,i,val\n integer,allocatable :: V(:),C(:)\n\n read(*,*) N\n allocate(V(N))\n allocate(C(N))\n\n read(*,*) V\n read(*,*) C\n val=0\n do i=1,N\n if(V(i).gt.C(i)) then\n val=val+(V(i)-C(i))\n endif\n enddo\n write(*,'(i0)') val\n deallocate(V)\n deallocate(C)\n\n\n\nend program rss\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.\n\nFind the maximum possible value of X-Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq C_i, V_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nV_1 V_2 ... V_N\nC_1 C_2 ... C_N\n\nOutput\n\nPrint the maximum possible value of X-Y.\n\nSample Input 1\n\n3\n10 2 5\n6 3 4\n\nSample Output 1\n\n5\n\nIf we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.\nWe have X-Y = 5 here, which is the maximum possible value.\n\nSample Input 2\n\n4\n13 21 6 19\n11 30 6 15\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1\n1\n50\n\nSample Output 3\n\n0", "sample_input": "3\n10 2 5\n6 3 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03060", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N gems. The value of the i-th gem is V_i.\n\nYou will choose some of these gems, possibly all or none, and get them.\n\nHowever, you need to pay a cost of C_i to get the i-th gem.\n\nLet X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.\n\nFind the maximum possible value of X-Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq C_i, V_i \\leq 50\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nV_1 V_2 ... V_N\nC_1 C_2 ... C_N\n\nOutput\n\nPrint the maximum possible value of X-Y.\n\nSample Input 1\n\n3\n10 2 5\n6 3 4\n\nSample Output 1\n\n5\n\nIf we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.\nWe have X-Y = 5 here, which is the maximum possible value.\n\nSample Input 2\n\n4\n13 21 6 19\n11 30 6 15\n\nSample Output 2\n\n6\n\nSample Input 3\n\n1\n1\n50\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 329, "cpu_time_ms": 7, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s133190474", "group_id": "codeNet:p03062", "input_text": "integer(16) n\ninteger(16),allocatable,dimension(:)::a\ninteger check\ninteger zero\nread*,N\nallocate(a(N))\nread*,a\ncheck=2\nzero=1\ndo i=1,N\n if(a(i)==0)zero=0\n if(a(i)<0)then\n check=check+1\n a(i)=-a(i)\n end if\nend do\nprint\"(I0)\",sum(a)-2*minval(a)*zero*merge(0,1,mod(check,2)==0)\nend", "language": "Fortran", "metadata": {"date": 1556418571, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03062.html", "problem_id": "p03062", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03062/input.txt", "sample_output_relpath": "derived/input_output/data/p03062/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03062/Fortran/s133190474.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s133190474", "user_id": "u598073939"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "integer(16) n\ninteger(16),allocatable,dimension(:)::a\ninteger check\ninteger zero\nread*,N\nallocate(a(N))\nread*,a\ncheck=2\nzero=1\ndo i=1,N\n if(a(i)==0)zero=0\n if(a(i)<0)then\n check=check+1\n a(i)=-a(i)\n end if\nend do\nprint\"(I0)\",sum(a)-2*minval(a)*zero*merge(0,1,mod(check,2)==0)\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "3\n-10 5 -4\n"}, "reference_outputs": ["19\n"], "source_document_id": "p03062", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N integers, A_1, A_2, ..., A_N, arranged in a row in this order.\n\nYou can perform the following operation on this integer sequence any number of times:\n\nOperation: Choose an integer i satisfying 1 \\leq i \\leq N-1. Multiply both A_i and A_{i+1} by -1.\n\nLet B_1, B_2, ..., B_N be the integer sequence after your operations.\n\nFind the maximum possible value of B_1 + B_2 + ... + B_N.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible value of B_1 + B_2 + ... + B_N.\n\nSample Input 1\n\n3\n-10 5 -4\n\nSample Output 1\n\n19\n\nIf we perform the operation as follows:\n\nChoose 1 as i, which changes the sequence to 10, -5, -4.\n\nChoose 2 as i, which changes the sequence to 10, 5, 4.\n\nwe have B_1 = 10, B_2 = 5, B_3 = 4. The sum here, B_1 + B_2 + B_3 = 10 + 5 + 4 = 19, is the maximum possible result.\n\nSample Input 2\n\n5\n10 -4 -8 -11 3\n\nSample Output 2\n\n30\n\nSample Input 3\n\n11\n-1000000000 1000000000 -1000000000 1000000000 -1000000000 0 1000000000 -1000000000 1000000000 -1000000000 1000000000\n\nSample Output 3\n\n10000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 45, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s617334795", "group_id": "codeNet:p03067", "input_text": "Program Tenka2019A\n\ninteger a,b,c\n\nread(*,*) a,b,c\n\nif (a= c)) flag = .true.\n if ((a >= c) .and. (b <= c)) flag = .true.\n\n if (flag) then\n print '(a)', 'Yes'\n else\n print '(a)', 'No'\n end if\n\nend program", "language": "Fortran", "metadata": {"date": 1555808766, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03067.html", "problem_id": "p03067", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03067/input.txt", "sample_output_relpath": "derived/input_output/data/p03067/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03067/Fortran/s102354857.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s102354857", "user_id": "u282360873"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n implicit none\n integer :: a, b, c\n logical :: flag = .false.\n read *, a, b, c\n\n if ((a <= c) .and. (b >= c)) flag = .true.\n if ((a >= c) .and. (b <= c)) flag = .true.\n\n if (flag) then\n print '(a)', 'Yes'\n else\n print '(a)', 'No'\n end if\n\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "sample_input": "3 8 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03067", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 278, "cpu_time_ms": 4, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s549419531", "group_id": "codeNet:p03067", "input_text": "program otw\n implicit none\n integer :: a,b,c\n\n read(*,*) a,b,c\n\n if((a-c)*(b-c).lt.0) then\n write(*,'(a)') 'Yes'\n else\n write(*,'(a)') 'No'\n endif\n\n\nend program otw", "language": "Fortran", "metadata": {"date": 1555808671, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03067.html", "problem_id": "p03067", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03067/input.txt", "sample_output_relpath": "derived/input_output/data/p03067/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03067/Fortran/s549419531.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s549419531", "user_id": "u613124399"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program otw\n implicit none\n integer :: a,b,c\n\n read(*,*) a,b,c\n\n if((a-c)*(b-c).lt.0) then\n write(*,'(a)') 'Yes'\n else\n write(*,'(a)') 'No'\n endif\n\n\nend program otw", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "sample_input": "3 8 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03067", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 178, "cpu_time_ms": 5, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s298937618", "group_id": "codeNet:p03067", "input_text": "program main\n implicit none\n integer A, B, C\n read(*, *) A, B, C\n if (CA .and. C>B) then\n write(*,'(A)') 'No'\n else\n write(*,'(A)') 'Yes'\n end if\nend program main\n", "language": "Fortran", "metadata": {"date": 1555808656, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03067.html", "problem_id": "p03067", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03067/input.txt", "sample_output_relpath": "derived/input_output/data/p03067/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03067/Fortran/s298937618.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s298937618", "user_id": "u050276949"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n implicit none\n integer A, B, C\n read(*, *) A, B, C\n if (CA .and. C>B) then\n write(*,'(A)') 'No'\n else\n write(*,'(A)') 'Yes'\n end if\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "sample_input": "3 8 5\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03067", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are three houses on a number line: House 1, 2 and 3, with coordinates A, B and C, respectively.\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nConstraints\n\n0\\leq A,B,C\\leq 100\n\nA, B and C are distinct integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint Yes if we pass the coordinate of House 3 on the straight way from House 1 to House 2 without making a detour, and print No otherwise.\n\nSample Input 1\n\n3 8 5\n\nSample Output 1\n\nYes\n\nWe pass the coordinate 5 on the straight way from the house at coordinate 3 to the house at coordinate 8.\n\nSample Input 2\n\n7 3 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n10 2 4\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n31 41 59\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 230, "cpu_time_ms": 4, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s036306985", "group_id": "codeNet:p03068", "input_text": "program main\n implicit none\n\n integer N,K,i\n character*80 S,e\n read(*,*) N,S,K\n e(1:1) = S(K:K)\n do i=1,N\n if(S(i:i) /= e(1:1)) then\n S(i:i) = '*'\n end if\n end do\n\n write(*,*) S \nend program main", "language": "Fortran", "metadata": {"date": 1555812359, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03068.html", "problem_id": "p03068", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03068/input.txt", "sample_output_relpath": "derived/input_output/data/p03068/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03068/Fortran/s036306985.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s036306985", "user_id": "u671401989"}, "prompt_components": {"gold_output": "*rr*r\n", "input_to_evaluate": "program main\n implicit none\n\n integer N,K,i\n character*80 S,e\n read(*,*) N,S,K\n e(1:1) = S(K:K)\n do i=1,N\n if(S(i:i) /= e(1:1)) then\n S(i:i) = '*'\n end if\n end do\n\n write(*,*) S \nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters, and an integer K.\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nConstraints\n\n1 \\leq K \\leq N\\leq 10\n\nS is a string of length N consisting of lowercase English letters.\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nK\n\nOutput\n\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nSample Input 1\n\n5\nerror\n2\n\nSample Output 1\n\n*rr*r\n\nThe second character of S is r. When we replace every character in error that differs from r with *, we get the string *rr*r.\n\nSample Input 2\n\n6\neleven\n5\n\nSample Output 2\n\ne*e*e*\n\nSample Input 3\n\n9\neducation\n7\n\nSample Output 3\n\n******i**", "sample_input": "5\nerror\n2\n"}, "reference_outputs": ["*rr*r\n"], "source_document_id": "p03068", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters, and an integer K.\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nConstraints\n\n1 \\leq K \\leq N\\leq 10\n\nS is a string of length N consisting of lowercase English letters.\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\nK\n\nOutput\n\nPrint the string obtained by replacing every character in S that differs from the K-th character of S, with *.\n\nSample Input 1\n\n5\nerror\n2\n\nSample Output 1\n\n*rr*r\n\nThe second character of S is r. When we replace every character in error that differs from r with *, we get the string *rr*r.\n\nSample Input 2\n\n6\neleven\n5\n\nSample Output 2\n\ne*e*e*\n\nSample Input 3\n\n9\neducation\n7\n\nSample Output 3\n\n******i**", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 201, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s373269679", "group_id": "codeNet:p03069", "input_text": "program prob3\n implicit none\n integer::N,i,j,l,w,b\n character(len=200005)::S\n read(*,*) N, S\n l = len_trim(S)\n w = 0\n b = 0\n do i = 1, l\n if(S(i:i) .eq. \".\") then\n j = i\n end if\n end do\n do i = 1, j\n if(S(i:i) .eq. \".\") then\n w = w + 1\n else\n b = b + 1\n end if\n end do\n write(*,*) min(w,b)\n stop\nend program", "language": "Fortran", "metadata": {"date": 1594387478, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Fortran/s373269679.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s373269679", "user_id": "u841856382"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program prob3\n implicit none\n integer::N,i,j,l,w,b\n character(len=200005)::S\n read(*,*) N, S\n l = len_trim(S)\n w = 0\n b = 0\n do i = 1, l\n if(S(i:i) .eq. \".\") then\n j = i\n end if\n end do\n do i = 1, j\n if(S(i:i) .eq. \".\") then\n w = w + 1\n else\n b = b + 1\n end if\n end do\n write(*,*) min(w,b)\n stop\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 414, "cpu_time_ms": 115, "memory_kb": 3308}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s902634579", "group_id": "codeNet:p03069", "input_text": "integer(16) N\ncharacter(2*10**5) S\ninteger(16) kcnt,scnt,i\ninteger ans\nread*,N,S\nkcnt=0\nscnt=0\ndo i=1,N\n if(S(i:i)==\".\")scnt=scnt+1\nend do\nans=min(scnt,N-scnt)\ndo i=1,N\n if(S(i:i)==\"#\")kcnt=kcnt+1\n if(S(i:i)==\".\")scnt=scnt-1\n if(S(i:i)/=S(i+1:i+1))then\n ans=min(ans,scnt+kcnt)\n endif\nend do\nprint\"(I0)\",ans\nend", "language": "Fortran", "metadata": {"date": 1555815259, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Fortran/s902634579.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s902634579", "user_id": "u598073939"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "integer(16) N\ncharacter(2*10**5) S\ninteger(16) kcnt,scnt,i\ninteger ans\nread*,N,S\nkcnt=0\nscnt=0\ndo i=1,N\n if(S(i:i)==\".\")scnt=scnt+1\nend do\nans=min(scnt,N-scnt)\ndo i=1,N\n if(S(i:i)==\"#\")kcnt=kcnt+1\n if(S(i:i)==\".\")scnt=scnt-1\n if(S(i:i)/=S(i+1:i+1))then\n ans=min(ans,scnt+kcnt)\n endif\nend do\nprint\"(I0)\",ans\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 318, "cpu_time_ms": 6, "memory_kb": 1084}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s332373490", "group_id": "codeNet:p03069", "input_text": "program main\n implicit none\n integer(8) N, nd, ns, i, firsts, nd2,ans, finald, ns2\n !integer loc(4) loc2(4) !left ., left #, right ., right #\n character(2*(10**5)) S\n read(*, *) N\n read(*, *) S\n nd = 0\n ns = 0\n firsts = N\n finald = 1\n ns2 = 0\n nd2 = 0\n do i = 1,N\n if (S(i:i) == '.') then\n nd = nd + 1\n else\n ns = ns + 1\n end if\n end do\n !if (ns /= 0) then\n do i = 1,N\n if (S(i:i) == '#') then\n firsts = i\n exit\n end if\n end do\n\n do i = firsts,N\n if (S(i:i) == '.') then\n nd2 = nd2 + 1\n end if\n end do\n\n !end if\n !if (nd /= 0) then\n do i = 1,N\n if (S(i:i) == '.') then\n finald = i\n end if\n end do\n do i = 1,finald\n if (S(i:i) == '#') then\n ns2 = ns2 + 1\n end if\n end do\n\n \n ans = min(nd, ns, nd2, ns2)\n write(*,'(i0)') ans\nend program main\n", "language": "Fortran", "metadata": {"date": 1555814353, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Fortran/s332373490.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s332373490", "user_id": "u050276949"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n integer(8) N, nd, ns, i, firsts, nd2,ans, finald, ns2\n !integer loc(4) loc2(4) !left ., left #, right ., right #\n character(2*(10**5)) S\n read(*, *) N\n read(*, *) S\n nd = 0\n ns = 0\n firsts = N\n finald = 1\n ns2 = 0\n nd2 = 0\n do i = 1,N\n if (S(i:i) == '.') then\n nd = nd + 1\n else\n ns = ns + 1\n end if\n end do\n !if (ns /= 0) then\n do i = 1,N\n if (S(i:i) == '#') then\n firsts = i\n exit\n end if\n end do\n\n do i = firsts,N\n if (S(i:i) == '.') then\n nd2 = nd2 + 1\n end if\n end do\n\n !end if\n !if (nd /= 0) then\n do i = 1,N\n if (S(i:i) == '.') then\n finald = i\n end if\n end do\n do i = 1,finald\n if (S(i:i) == '#') then\n ns2 = ns2 + 1\n end if\n end do\n\n \n ans = min(nd, ns, nd2, ns2)\n write(*,'(i0)') ans\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 898, "cpu_time_ms": 6, "memory_kb": 1084}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s127586496", "group_id": "codeNet:p03069", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger :: n,ans_b=0,ans_w=0,i\ncharacter(len=2*10**5) :: s\n\nread*, n,s\n\ndo i = 1, n\n if ( s(i:i) == '#' ) then\n ans_b = ans_b + 1\n else\n ans_w = ans_w + 1\n end if\nend do\n\nprint'(i0)', min(ans_b,ans_w)\n\nEND PROGRAM ATCODER", "language": "Fortran", "metadata": {"date": 1555809445, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03069.html", "problem_id": "p03069", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03069/input.txt", "sample_output_relpath": "derived/input_output/data/p03069/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03069/Fortran/s127586496.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s127586496", "user_id": "u454557108"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger :: n,ans_b=0,ans_w=0,i\ncharacter(len=2*10**5) :: s\n\nread*, n,s\n\ndo i = 1, n\n if ( s(i:i) == '#' ) then\n ans_b = ans_b + 1\n else\n ans_w = ans_w + 1\n end if\nend do\n\nprint'(i0)', min(ans_b,ans_w)\n\nEND PROGRAM ATCODER", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "sample_input": "3\n#.#\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03069", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N stones arranged in a row. Every stone is painted white or black.\nA string S represents the color of the stones. The i-th stone from the left is white if the i-th character of S is ., and the stone is black if the character is #.\n\nTakahashi wants to change the colors of some stones to black or white so that there will be no white stone immediately to the right of a black stone.\nFind the minimum number of stones that needs to be recolored.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\nS is a string of length N consisting of . and #.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the minimum number of stones that needs to be recolored.\n\nSample Input 1\n\n3\n#.#\n\nSample Output 1\n\n1\n\nIt is enough to change the color of the first stone to white.\n\nSample Input 2\n\n5\n#.##.\n\nSample Output 2\n\n2\n\nSample Input 3\n\n9\n.........\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 262, "cpu_time_ms": 5, "memory_kb": 1084}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s154924984", "group_id": "codeNet:p03071", "input_text": "program main\n implicit none\n integer A, B\n read(*, *) A, B\n if (A < B) then\n write(*, '(i0)') 2*B - 1\n else if (A > B) then\n write(*, '(i0)') 2*A - 1\n else\n write(*, '(i0)') A + B\n end if\nend program main", "language": "Fortran", "metadata": {"date": 1555182259, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03071.html", "problem_id": "p03071", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03071/input.txt", "sample_output_relpath": "derived/input_output/data/p03071/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03071/Fortran/s154924984.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s154924984", "user_id": "u050276949"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program main\n implicit none\n integer A, B\n read(*, *) A, B\n if (A < B) then\n write(*, '(i0)') 2*B - 1\n else if (A > B) then\n write(*, '(i0)') 2*A - 1\n else\n write(*, '(i0)') A + B\n end if\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are two buttons, one of size A and one of size B.\n\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\n\nYou will press a button twice. Here, you can press the same button twice, or press both buttons once.\n\nAt most how many coins can you get?\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq A, B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of coins you can get.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n9\n\nYou can get 5 + 4 = 9 coins by pressing the button of size 5 twice, and this is the maximum result.\n\nSample Input 2\n\n3 4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n12", "sample_input": "5 3\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03071", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are two buttons, one of size A and one of size B.\n\nWhen you press a button of size X, you get X coins and the size of that button decreases by 1.\n\nYou will press a button twice. Here, you can press the same button twice, or press both buttons once.\n\nAt most how many coins can you get?\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq A, B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the maximum number of coins you can get.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n9\n\nYou can get 5 + 4 = 9 coins by pressing the button of size 5 twice, and this is the maximum result.\n\nSample Input 2\n\n3 4\n\nSample Output 2\n\n7\n\nSample Input 3\n\n6 6\n\nSample Output 3\n\n12", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 220, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s014419829", "group_id": "codeNet:p03072", "input_text": "program main\n implicit none\n integer :: n, i, res\n integer, allocatable :: h(:)\n read (*, *) n\n allocate (h(n))\n read (*, *) h(:)\n res = 1\n do i = 2, n\n if (h(i) >= maxval(h(1:i - 1))) then\n res = res + 1\n end if\n end do\n write (*, \"(i0)\") res\nend program main\n", "language": "Fortran", "metadata": {"date": 1555282986, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03072.html", "problem_id": "p03072", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03072/input.txt", "sample_output_relpath": "derived/input_output/data/p03072/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03072/Fortran/s014419829.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s014419829", "user_id": "u388927326"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, i, res\n integer, allocatable :: h(:)\n read (*, *) n\n allocate (h(n))\n read (*, *) h(:)\n res = 1\n do i = 2, n\n if (h(i) >= maxval(h(1:i - 1))) then\n res = res + 1\n end if\n end do\n write (*, \"(i0)\") res\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N mountains ranging from east to west, and an ocean to the west.\n\nAt the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.\n\nThe height of the i-th mountain from the west is H_i.\n\nYou can certainly see the ocean from the inn at the top of the westmost mountain.\n\nFor the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \\leq H_i, H_2 \\leq H_i, ..., and H_{i-1} \\leq H_i.\n\nFrom how many of these N inns can you see the ocean?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq H_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the number of inns from which you can see the ocean.\n\nSample Input 1\n\n4\n6 5 6 8\n\nSample Output 1\n\n3\n\nYou can see the ocean from the first, third and fourth inns from the west.\n\nSample Input 2\n\n5\n4 5 3 5 4\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5\n9 5 6 8 4\n\nSample Output 3\n\n1", "sample_input": "4\n6 5 6 8\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03072", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N mountains ranging from east to west, and an ocean to the west.\n\nAt the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.\n\nThe height of the i-th mountain from the west is H_i.\n\nYou can certainly see the ocean from the inn at the top of the westmost mountain.\n\nFor the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \\leq H_i, H_2 \\leq H_i, ..., and H_{i-1} \\leq H_i.\n\nFrom how many of these N inns can you see the ocean?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq H_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the number of inns from which you can see the ocean.\n\nSample Input 1\n\n4\n6 5 6 8\n\nSample Output 1\n\n3\n\nYou can see the ocean from the first, third and fourth inns from the west.\n\nSample Input 2\n\n5\n4 5 3 5 4\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5\n9 5 6 8 4\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 282, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s256846394", "group_id": "codeNet:p03072", "input_text": "program great_ocean_view\n implicit none\n integer :: n, h(0:20), i, m\n h = 0\n read(*,*) n\n read(*,*) h(1:n)\n m = 0\n do i = 1, n\n if (h(i).ge.maxval(h(0:i-1))) m = m + 1\n end do\n write(*,'(i0)') m\n stop\nend program great_ocean_view", "language": "Fortran", "metadata": {"date": 1555253517, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03072.html", "problem_id": "p03072", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03072/input.txt", "sample_output_relpath": "derived/input_output/data/p03072/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03072/Fortran/s256846394.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s256846394", "user_id": "u506403362"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program great_ocean_view\n implicit none\n integer :: n, h(0:20), i, m\n h = 0\n read(*,*) n\n read(*,*) h(1:n)\n m = 0\n do i = 1, n\n if (h(i).ge.maxval(h(0:i-1))) m = m + 1\n end do\n write(*,'(i0)') m\n stop\nend program great_ocean_view", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N mountains ranging from east to west, and an ocean to the west.\n\nAt the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.\n\nThe height of the i-th mountain from the west is H_i.\n\nYou can certainly see the ocean from the inn at the top of the westmost mountain.\n\nFor the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \\leq H_i, H_2 \\leq H_i, ..., and H_{i-1} \\leq H_i.\n\nFrom how many of these N inns can you see the ocean?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq H_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the number of inns from which you can see the ocean.\n\nSample Input 1\n\n4\n6 5 6 8\n\nSample Output 1\n\n3\n\nYou can see the ocean from the first, third and fourth inns from the west.\n\nSample Input 2\n\n5\n4 5 3 5 4\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5\n9 5 6 8 4\n\nSample Output 3\n\n1", "sample_input": "4\n6 5 6 8\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03072", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N mountains ranging from east to west, and an ocean to the west.\n\nAt the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.\n\nThe height of the i-th mountain from the west is H_i.\n\nYou can certainly see the ocean from the inn at the top of the westmost mountain.\n\nFor the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \\leq H_i, H_2 \\leq H_i, ..., and H_{i-1} \\leq H_i.\n\nFrom how many of these N inns can you see the ocean?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 20\n\n1 \\leq H_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the number of inns from which you can see the ocean.\n\nSample Input 1\n\n4\n6 5 6 8\n\nSample Output 1\n\n3\n\nYou can see the ocean from the first, third and fourth inns from the west.\n\nSample Input 2\n\n5\n4 5 3 5 4\n\nSample Output 2\n\n3\n\nSample Input 3\n\n5\n9 5 6 8 4\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 242, "cpu_time_ms": 10, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s315777319", "group_id": "codeNet:p03072", "input_text": "program gob\n implicit none\n integer :: n=0,i=0,is_DomainOver=0,j=0,is_fault=0,cnt=1\n integer, allocatable :: H(:)\n read(*,*)n\n allocate(H(n))\n read(*,*) (H(i),i=1,n)\n !Domein check\n if(n<1 .or. 20s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_C\n\n ! constants for this \n integer(kind=INT32), parameter, private :: len_string_max = 100000_INT32\n\n ! variables for this \n character(len=len_string_max, kind=1) :: given_string\n integer (kind=INT32) :: num_operations(0:1)\n\n ! contained s and s are below\n contains\n\n subroutine task_C\n\n ! variables for this \n integer(kind=INT32) :: itr\n\n ! STEP.01\n ! read out the given string\n read(unit=INPUT_UNIT, fmt='(A)') given_string\n\n ! STEP.02\n ! count up the number of operations\n num_operations = 0_INT32\n\n do itr = 1_INT32, len_trim(given_string), 1_INT32\n if (mod(itr, 2_INT32) .ne. 0_INT32) then\n if (given_string(itr:itr) .ne. '0') num_operations(0) = num_operations(0) + 1_INT32\n if (given_string(itr:itr) .ne. '1') num_operations(1) = num_operations(1) + 1_INT32\n else\n if (given_string(itr:itr) .ne. '1') num_operations(0) = num_operations(0) + 1_INT32\n if (given_string(itr:itr) .ne. '0') num_operations(1) = num_operations(1) + 1_INT32\n end if\n end do\n\n ! STEP.04\n ! output the result\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') minval(num_operations(:))\n\n ! STEP.END\n return\n\n end subroutine task_C\n\nend module ABC124\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC124\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_C\n\nend program main", "language": "Fortran", "metadata": {"date": 1555197464, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03073.html", "problem_id": "p03073", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03073/input.txt", "sample_output_relpath": "derived/input_output/data/p03073/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03073/Fortran/s436462460.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s436462460", "user_id": "u484703930"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module ABC124\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: task_C\n\n ! constants for this \n integer(kind=INT32), parameter, private :: len_string_max = 100000_INT32\n\n ! variables for this \n character(len=len_string_max, kind=1) :: given_string\n integer (kind=INT32) :: num_operations(0:1)\n\n ! contained s and s are below\n contains\n\n subroutine task_C\n\n ! variables for this \n integer(kind=INT32) :: itr\n\n ! STEP.01\n ! read out the given string\n read(unit=INPUT_UNIT, fmt='(A)') given_string\n\n ! STEP.02\n ! count up the number of operations\n num_operations = 0_INT32\n\n do itr = 1_INT32, len_trim(given_string), 1_INT32\n if (mod(itr, 2_INT32) .ne. 0_INT32) then\n if (given_string(itr:itr) .ne. '0') num_operations(0) = num_operations(0) + 1_INT32\n if (given_string(itr:itr) .ne. '1') num_operations(1) = num_operations(1) + 1_INT32\n else\n if (given_string(itr:itr) .ne. '1') num_operations(0) = num_operations(0) + 1_INT32\n if (given_string(itr:itr) .ne. '0') num_operations(1) = num_operations(1) + 1_INT32\n end if\n end do\n\n ! STEP.04\n ! output the result\n write(unit=OUTPUT_UNIT, fmt='(I0)', advance='yes') minval(num_operations(:))\n\n ! STEP.END\n return\n\n end subroutine task_C\n\nend module ABC124\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC124\n\n ! require all variables to be explicitly declared\n implicit none\n\n call task_C\n\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\n\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\n\nYou want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.\n\nAt least how many tiles need to be repainted to satisfy the condition?\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of tiles that need to be repainted to satisfy the condition.\n\nSample Input 1\n\n000\n\nSample Output 1\n\n1\n\nThe condition can be satisfied by repainting the middle tile white.\n\nSample Input 2\n\n10010010\n\nSample Output 2\n\n3\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "000\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03073", "source_text": "Score : 300 points\n\nProblem Statement\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\n\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\n\nYou want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.\n\nAt least how many tiles need to be repainted to satisfy the condition?\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of tiles that need to be repainted to satisfy the condition.\n\nSample Input 1\n\n000\n\nSample Output 1\n\n1\n\nThe condition can be satisfied by repainting the middle tile white.\n\nSample Input 2\n\n10010010\n\nSample Output 2\n\n3\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1697, "cpu_time_ms": 2, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s654750566", "group_id": "codeNet:p03073", "input_text": "program main\n implicit none\n integer CC, i, n, renzoku, CC2\n character(10**5) s, c\n read(*, *) s\n s = trim(s)\n n = len(s)\n !01010101010\n do i = 1,n\n if (mod(i,2) == 1) then\n if (s(i:i) == '0') then\n CC = CC + 1\n else\n CC2 = CC2 + 1\n end if\n else\n if (s(i:i) == '1') then\n CC = CC + 1\n else\n CC2 = CC2 + 1\n end if\n end if\n end do\n write(*, '(i0)') min(CC,CC2)\nend program main", "language": "Fortran", "metadata": {"date": 1555185865, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03073.html", "problem_id": "p03073", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03073/input.txt", "sample_output_relpath": "derived/input_output/data/p03073/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03073/Fortran/s654750566.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s654750566", "user_id": "u050276949"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n integer CC, i, n, renzoku, CC2\n character(10**5) s, c\n read(*, *) s\n s = trim(s)\n n = len(s)\n !01010101010\n do i = 1,n\n if (mod(i,2) == 1) then\n if (s(i:i) == '0') then\n CC = CC + 1\n else\n CC2 = CC2 + 1\n end if\n else\n if (s(i:i) == '1') then\n CC = CC + 1\n else\n CC2 = CC2 + 1\n end if\n end if\n end do\n write(*, '(i0)') min(CC,CC2)\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\n\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\n\nYou want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.\n\nAt least how many tiles need to be repainted to satisfy the condition?\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of tiles that need to be repainted to satisfy the condition.\n\nSample Input 1\n\n000\n\nSample Output 1\n\n1\n\nThe condition can be satisfied by repainting the middle tile white.\n\nSample Input 2\n\n10010010\n\nSample Output 2\n\n3\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "000\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03073", "source_text": "Score : 300 points\n\nProblem Statement\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\n\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\n\nYou want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.\n\nAt least how many tiles need to be repainted to satisfy the condition?\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of tiles that need to be repainted to satisfy the condition.\n\nSample Input 1\n\n000\n\nSample Output 1\n\n1\n\nThe condition can be satisfied by repainting the middle tile white.\n\nSample Input 2\n\n10010010\n\nSample Output 2\n\n3\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 452, "cpu_time_ms": 3, "memory_kb": 700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s090572154", "group_id": "codeNet:p03073", "input_text": "program coloring_colorfully\n implicit none\n character(100000) :: s\n integer :: n, i, o0, o1, e0, e1\n read(*,*) s\n s = trim(adjustl(s))\n n = len_trim(s)\n o0 = 0\n o1 = 0\n e0 = 0\n e1 = 0\n do i = 1, n, 2\n if (s(i:i).eq.\"0\") then\n o0 = o0 + 1\n else\n o1 = o1 + 1\n end if\n end do\n do i = 2, n, 2\n if (s(i:i).eq.\"0\") then\n e0 = e0 + 1\n else\n e1 = e1 + 1\n end if\n end do\n write(*,'(i0)') n - max(o0+e1,o1+e0)\n stop\nend program coloring_colorfully", "language": "Fortran", "metadata": {"date": 1555183050, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03073.html", "problem_id": "p03073", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03073/input.txt", "sample_output_relpath": "derived/input_output/data/p03073/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03073/Fortran/s090572154.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s090572154", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program coloring_colorfully\n implicit none\n character(100000) :: s\n integer :: n, i, o0, o1, e0, e1\n read(*,*) s\n s = trim(adjustl(s))\n n = len_trim(s)\n o0 = 0\n o1 = 0\n e0 = 0\n e1 = 0\n do i = 1, n, 2\n if (s(i:i).eq.\"0\") then\n o0 = o0 + 1\n else\n o1 = o1 + 1\n end if\n end do\n do i = 2, n, 2\n if (s(i:i).eq.\"0\") then\n e0 = e0 + 1\n else\n e1 = e1 + 1\n end if\n end do\n write(*,'(i0)') n - max(o0+e1,o1+e0)\n stop\nend program coloring_colorfully", "problem_context": "Score : 300 points\n\nProblem Statement\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\n\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\n\nYou want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.\n\nAt least how many tiles need to be repainted to satisfy the condition?\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of tiles that need to be repainted to satisfy the condition.\n\nSample Input 1\n\n000\n\nSample Output 1\n\n1\n\nThe condition can be satisfied by repainting the middle tile white.\n\nSample Input 2\n\n10010010\n\nSample Output 2\n\n3\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "000\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03073", "source_text": "Score : 300 points\n\nProblem Statement\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\n\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\n\nYou want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.\n\nAt least how many tiles need to be repainted to satisfy the condition?\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of tiles that need to be repainted to satisfy the condition.\n\nSample Input 1\n\n000\n\nSample Output 1\n\n1\n\nThe condition can be satisfied by repainting the middle tile white.\n\nSample Input 2\n\n10010010\n\nSample Output 2\n\n3\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 491, "cpu_time_ms": 3, "memory_kb": 2596}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s952462913", "group_id": "codeNet:p03073", "input_text": "character(10**5) S\ninteger cnt\nread*,S\n!0101のリズムとあわせてみて1010のリズムどっちがあってるか判定して\n!あってる方と合わせる感じでいきます\ncnt=0\ndo i=1, len_trim(S)\n if(mod(i,2)==1)then\n if(S(i:i)==\"0\")cnt=cnt+1\n else\n if(S(i:i)==\"1\")cnt=cnt+1\n endif\nend do\nprint\"(I0)\",min(len_trim(S)-cnt,cnt)\nend", "language": "Fortran", "metadata": {"date": 1555183047, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03073.html", "problem_id": "p03073", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03073/input.txt", "sample_output_relpath": "derived/input_output/data/p03073/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03073/Fortran/s952462913.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s952462913", "user_id": "u598073939"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "character(10**5) S\ninteger cnt\nread*,S\n!0101のリズムとあわせてみて1010のリズムどっちがあってるか判定して\n!あってる方と合わせる感じでいきます\ncnt=0\ndo i=1, len_trim(S)\n if(mod(i,2)==1)then\n if(S(i:i)==\"0\")cnt=cnt+1\n else\n if(S(i:i)==\"1\")cnt=cnt+1\n endif\nend do\nprint\"(I0)\",min(len_trim(S)-cnt,cnt)\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\n\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\n\nYou want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.\n\nAt least how many tiles need to be repainted to satisfy the condition?\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of tiles that need to be repainted to satisfy the condition.\n\nSample Input 1\n\n000\n\nSample Output 1\n\n1\n\nThe condition can be satisfied by repainting the middle tile white.\n\nSample Input 2\n\n10010010\n\nSample Output 2\n\n3\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "000\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03073", "source_text": "Score : 300 points\n\nProblem Statement\n\nN tiles are arranged in a row from left to right. The initial color of each tile is represented by a string S of length N.\n\nThe i-th tile from the left is painted black if the i-th character of S is 0, and painted white if that character is 1.\n\nYou want to repaint some of the tiles black or white, so that any two adjacent tiles have different colors.\n\nAt least how many tiles need to be repainted to satisfy the condition?\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS_i is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum number of tiles that need to be repainted to satisfy the condition.\n\nSample Input 1\n\n000\n\nSample Output 1\n\n1\n\nThe condition can be satisfied by repainting the middle tile white.\n\nSample Input 2\n\n10010010\n\nSample Output 2\n\n3\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 354, "cpu_time_ms": 6, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s082752446", "group_id": "codeNet:p03074", "input_text": "program handstand\n implicit none\n integer :: n, k, i, m, a(100000), r, x, y, z, t, j\n logical :: b(100000)\n character(100000) :: s\n a = 0\n b = .false.\n read(*,*) n, k\n if (n.eq.1) then\n write(*,'(i0)') 1\n stop\n end if\n read(*,*) s\n s = trim(adjustl(s))\n r = 1\n if (s(1:1).eq.\"0\") r = -r\n a(1) = r\n x = -1\n y = -1\n do i = 2, n\n if (s(i:i).eq.s(i-1:i-1)) then\n a(i) = a(i-1) + r\n else\n b(i-1) = .true.\n if ((x.lt.0).and.(r.gt.0)) x = i-1\n if ((y.lt.0).and.(r.lt.0)) y = i-1\n r = -r\n a(i) = r\n end if\n end do\n b(n) = .true.\n if ((x.lt.0).or.(y.lt.0)) then\n write(*,'(i0)') abs(a(n))\n stop\n end if\n t = a(x)\n if (y.lt.x) then\n t = t - a(y)\n k = k - 1\n end if\n if ((k.gt.0).and.(n.gt.x)) then\n do i = x+1, n\n if (b(i)) then\n if (a(i).lt.0) then\n t = t - a(i)\n k = k - 1\n else\n t = t + a(i)\n z = i\n if (k.eq.0) exit\n end if\n end if\n end do\n end if\n m = t\n if (n.gt.z) then\n do i = z+1, n\n if (b(i)) then\n if (a(i).lt.0) then\n t = t + a(y) - a(i)\n if (x.lt.y) then\n t = t - a(x)\n do j = x+1, n\n if (b(j).and.a(j).gt.0) then\n x = j\n exit\n end if\n end do\n end if\n do j = y+1, n\n if (b(j).and.a(j).lt.0) then\n y = j\n exit\n end if\n end do\n if (m.lt.t) m = t\n else\n t = t + a(i)\n if (m.lt.t) m = t\n end if\n end if\n end do\n end if\n write(*,'(i0)') m\n stop\nend program handstand", "language": "Fortran", "metadata": {"date": 1555186830, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03074.html", "problem_id": "p03074", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03074/input.txt", "sample_output_relpath": "derived/input_output/data/p03074/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03074/Fortran/s082752446.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s082752446", "user_id": "u506403362"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program handstand\n implicit none\n integer :: n, k, i, m, a(100000), r, x, y, z, t, j\n logical :: b(100000)\n character(100000) :: s\n a = 0\n b = .false.\n read(*,*) n, k\n if (n.eq.1) then\n write(*,'(i0)') 1\n stop\n end if\n read(*,*) s\n s = trim(adjustl(s))\n r = 1\n if (s(1:1).eq.\"0\") r = -r\n a(1) = r\n x = -1\n y = -1\n do i = 2, n\n if (s(i:i).eq.s(i-1:i-1)) then\n a(i) = a(i-1) + r\n else\n b(i-1) = .true.\n if ((x.lt.0).and.(r.gt.0)) x = i-1\n if ((y.lt.0).and.(r.lt.0)) y = i-1\n r = -r\n a(i) = r\n end if\n end do\n b(n) = .true.\n if ((x.lt.0).or.(y.lt.0)) then\n write(*,'(i0)') abs(a(n))\n stop\n end if\n t = a(x)\n if (y.lt.x) then\n t = t - a(y)\n k = k - 1\n end if\n if ((k.gt.0).and.(n.gt.x)) then\n do i = x+1, n\n if (b(i)) then\n if (a(i).lt.0) then\n t = t - a(i)\n k = k - 1\n else\n t = t + a(i)\n z = i\n if (k.eq.0) exit\n end if\n end if\n end do\n end if\n m = t\n if (n.gt.z) then\n do i = z+1, n\n if (b(i)) then\n if (a(i).lt.0) then\n t = t + a(y) - a(i)\n if (x.lt.y) then\n t = t - a(x)\n do j = x+1, n\n if (b(j).and.a(j).gt.0) then\n x = j\n exit\n end if\n end do\n end if\n do j = y+1, n\n if (b(j).and.a(j).lt.0) then\n y = j\n exit\n end if\n end do\n if (m.lt.t) m = t\n else\n t = t + a(i)\n if (m.lt.t) m = t\n end if\n end if\n end do\n end if\n write(*,'(i0)') m\n stop\nend program handstand", "problem_context": "Score : 400 points\n\nProblem Statement\n\nN people are arranged in a row from left to right.\n\nYou are given a string S of length N consisting of 0 and 1, and a positive integer K.\n\nThe i-th person from the left is standing on feet if the i-th character of S is 0, and standing on hands if that character is 1.\n\nYou will give the following direction at most K times (possibly zero):\n\nDirection: Choose integers l and r satisfying 1 \\leq l \\leq r \\leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.\n\nFind the maximum possible number of consecutive people standing on hands after at most K directions.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\nThe length of the string S is N.\n\nEach character of the string S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of consecutive people standing on hands after at most K directions.\n\nSample Input 1\n\n5 1\n00010\n\nSample Output 1\n\n4\n\nWe can have four consecutive people standing on hands, which is the maximum result, by giving the following direction:\n\nGive the direction with l = 1, r = 3, which flips the first, second and third persons from the left.\n\nSample Input 2\n\n14 2\n11101010110011\n\nSample Output 2\n\n8\n\nSample Input 3\n\n1 1\n1\n\nSample Output 3\n\n1\n\nNo directions are necessary.", "sample_input": "5 1\n00010\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03074", "source_text": "Score : 400 points\n\nProblem Statement\n\nN people are arranged in a row from left to right.\n\nYou are given a string S of length N consisting of 0 and 1, and a positive integer K.\n\nThe i-th person from the left is standing on feet if the i-th character of S is 0, and standing on hands if that character is 1.\n\nYou will give the following direction at most K times (possibly zero):\n\nDirection: Choose integers l and r satisfying 1 \\leq l \\leq r \\leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.\n\nFind the maximum possible number of consecutive people standing on hands after at most K directions.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\nThe length of the string S is N.\n\nEach character of the string S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of consecutive people standing on hands after at most K directions.\n\nSample Input 1\n\n5 1\n00010\n\nSample Output 1\n\n4\n\nWe can have four consecutive people standing on hands, which is the maximum result, by giving the following direction:\n\nGive the direction with l = 1, r = 3, which flips the first, second and third persons from the left.\n\nSample Input 2\n\n14 2\n11101010110011\n\nSample Output 2\n\n8\n\nSample Input 3\n\n1 1\n1\n\nSample Output 3\n\n1\n\nNo directions are necessary.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1680, "cpu_time_ms": 5, "memory_kb": 1468}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s635539053", "group_id": "codeNet:p03074", "input_text": "program main\nImplicit None\n\tinteger(8)::n,k,i,p,q,a\n\tinteger(8),allocatable::t(:),u(:)\n\tcharacter(len=100000)::s\n\t\n\tread*,n,k\n\tread*,s\n\t\n\tp=1\n\tif(s(1:1) == \"0\")then\n\t\tp=p+1\n\tendif\n\t\n\t\n\tdo i = 2,n\n\t\tif(s(i:i) /= s(i-1:i-1)) p = p+1\n\tenddo\n\t\n\ta = p\n\t\n\tallocate(t(p),u(a))\n\t\n\tp = 1\n\tq = 1\n\tif(s(1:1) == \"0\")then\n\t\tt(1) = 0\n\t\tq = q+1\n\tendif\n\t\n\tdo i = 2,n\n\t\tif(s(i:i) == s(i-1:i-1))then\n\t\t\tp = p+1\n\t\t\telse\n\t\t\tt(q) = p\n\t\t\tp = 1\n\t\t\tq = q+1\n\t\tendif\n\tenddo\n\tt(q) = p\n\t\n\tdo i =2,a\n\t\tt(i) = t(i-1)+t(i)\n\tenddo\n\t\n\tk = 2*k+1\n\t\n\tif(a < k)then\n\t\tprint\"(i0)\",n\n\t\tstop\n\tendif\n\t\n\tp = t(k)\n\tdo i = 3,a-k+1,2\n\t\tif(p < t(k+i-1)-t(i-1)) p = t(k+i-1)-t(i-1)\n\tenddo\n\t\n\tprint\"(i0)\",p\nend program main", "language": "Fortran", "metadata": {"date": 1555185089, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03074.html", "problem_id": "p03074", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03074/input.txt", "sample_output_relpath": "derived/input_output/data/p03074/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03074/Fortran/s635539053.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s635539053", "user_id": "u900266249"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main\nImplicit None\n\tinteger(8)::n,k,i,p,q,a\n\tinteger(8),allocatable::t(:),u(:)\n\tcharacter(len=100000)::s\n\t\n\tread*,n,k\n\tread*,s\n\t\n\tp=1\n\tif(s(1:1) == \"0\")then\n\t\tp=p+1\n\tendif\n\t\n\t\n\tdo i = 2,n\n\t\tif(s(i:i) /= s(i-1:i-1)) p = p+1\n\tenddo\n\t\n\ta = p\n\t\n\tallocate(t(p),u(a))\n\t\n\tp = 1\n\tq = 1\n\tif(s(1:1) == \"0\")then\n\t\tt(1) = 0\n\t\tq = q+1\n\tendif\n\t\n\tdo i = 2,n\n\t\tif(s(i:i) == s(i-1:i-1))then\n\t\t\tp = p+1\n\t\t\telse\n\t\t\tt(q) = p\n\t\t\tp = 1\n\t\t\tq = q+1\n\t\tendif\n\tenddo\n\tt(q) = p\n\t\n\tdo i =2,a\n\t\tt(i) = t(i-1)+t(i)\n\tenddo\n\t\n\tk = 2*k+1\n\t\n\tif(a < k)then\n\t\tprint\"(i0)\",n\n\t\tstop\n\tendif\n\t\n\tp = t(k)\n\tdo i = 3,a-k+1,2\n\t\tif(p < t(k+i-1)-t(i-1)) p = t(k+i-1)-t(i-1)\n\tenddo\n\t\n\tprint\"(i0)\",p\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nN people are arranged in a row from left to right.\n\nYou are given a string S of length N consisting of 0 and 1, and a positive integer K.\n\nThe i-th person from the left is standing on feet if the i-th character of S is 0, and standing on hands if that character is 1.\n\nYou will give the following direction at most K times (possibly zero):\n\nDirection: Choose integers l and r satisfying 1 \\leq l \\leq r \\leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.\n\nFind the maximum possible number of consecutive people standing on hands after at most K directions.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\nThe length of the string S is N.\n\nEach character of the string S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of consecutive people standing on hands after at most K directions.\n\nSample Input 1\n\n5 1\n00010\n\nSample Output 1\n\n4\n\nWe can have four consecutive people standing on hands, which is the maximum result, by giving the following direction:\n\nGive the direction with l = 1, r = 3, which flips the first, second and third persons from the left.\n\nSample Input 2\n\n14 2\n11101010110011\n\nSample Output 2\n\n8\n\nSample Input 3\n\n1 1\n1\n\nSample Output 3\n\n1\n\nNo directions are necessary.", "sample_input": "5 1\n00010\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03074", "source_text": "Score : 400 points\n\nProblem Statement\n\nN people are arranged in a row from left to right.\n\nYou are given a string S of length N consisting of 0 and 1, and a positive integer K.\n\nThe i-th person from the left is standing on feet if the i-th character of S is 0, and standing on hands if that character is 1.\n\nYou will give the following direction at most K times (possibly zero):\n\nDirection: Choose integers l and r satisfying 1 \\leq l \\leq r \\leq N, and flip the l-th, (l+1)-th, ..., and r-th persons. That is, for each i = l, l+1, ..., r, the i-th person from the left now stands on hands if he/she was standing on feet, and stands on feet if he/she was standing on hands.\n\nFind the maximum possible number of consecutive people standing on hands after at most K directions.\n\nConstraints\n\nN is an integer satisfying 1 \\leq N \\leq 10^5.\n\nK is an integer satisfying 1 \\leq K \\leq 10^5.\n\nThe length of the string S is N.\n\nEach character of the string S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the maximum possible number of consecutive people standing on hands after at most K directions.\n\nSample Input 1\n\n5 1\n00010\n\nSample Output 1\n\n4\n\nWe can have four consecutive people standing on hands, which is the maximum result, by giving the following direction:\n\nGive the direction with l = 1, r = 3, which flips the first, second and third persons from the left.\n\nSample Input 2\n\n14 2\n11101010110011\n\nSample Output 2\n\n8\n\nSample Input 3\n\n1 1\n1\n\nSample Output 3\n\n1\n\nNo directions are necessary.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 675, "cpu_time_ms": 4, "memory_kb": 1316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s614081655", "group_id": "codeNet:p03075", "input_text": "program sample\n\timplicit none\n integer(8)::i,j\n real(8)::a,b,c,d,e,k,sub\n real(8) :: sort(5)\n \n read(*,*) a\n read(*,*) b \n read(*,*) c \n read(*,*) d \n read(*,*) e \n read(*,*) k \n \n sort(1) =a\n sort(2) =b\n sort(3)=c\n sort(4)=d\n sort(5)=e\n \n do i=1,5\n \tdo j=i,5\n \tif(sort(i)>sort(j)) then\n \tsub=sort(i)\n sort(i)=sort(j)\n sort(j)=sub\n end if\n end do\n end do\n \n if(abs(sort(5)-sort(1))<=k) then\n \twrite(*,*) 'Yay!'\n\telse\n \twrite(*,*) ':('\n end if\n \n stop\nend program sample", "language": "Fortran", "metadata": {"date": 1593201374, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Fortran/s614081655.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s614081655", "user_id": "u323210830"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "program sample\n\timplicit none\n integer(8)::i,j\n real(8)::a,b,c,d,e,k,sub\n real(8) :: sort(5)\n \n read(*,*) a\n read(*,*) b \n read(*,*) c \n read(*,*) d \n read(*,*) e \n read(*,*) k \n \n sort(1) =a\n sort(2) =b\n sort(3)=c\n sort(4)=d\n sort(5)=e\n \n do i=1,5\n \tdo j=i,5\n \tif(sort(i)>sort(j)) then\n \tsub=sort(i)\n sort(i)=sort(j)\n sort(j)=sub\n end if\n end do\n end do\n \n if(abs(sort(5)-sort(1))<=k) then\n \twrite(*,*) 'Yay!'\n\telse\n \twrite(*,*) ':('\n end if\n \n stop\nend program sample", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 626, "cpu_time_ms": 6, "memory_kb": 2960}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s950935009", "group_id": "codeNet:p03075", "input_text": "program answer\n implicit none\n\n integer :: a, b, c, d, e, k\n\n read(*,*) a\n read(*,*) b\n read(*,*) c\n read(*,*) d\n read(*,*) e\n read(*,*) k\n if(abs(a-b)<=k .and. abs(a-c)<=k .and. abs(a-d)<=k .and. abs(a-e)<=k) then\n if(abs(b-c)<=k .and. abs(b-d)<=k .and. abs(b-e)<=k .and.abs(c-d)<=k) then\n if( abs(c-e)<=k .and. abs(d-e)<=k) then\n write(*,*) 'Yay!'\n else\n write(*,*) ':('\n end if\n else\n write(*,*) ':('\n end if\n else\n write(*,*) ':('\n end if\n\n stop\n end program answer\n", "language": "Fortran", "metadata": {"date": 1593199216, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Fortran/s950935009.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s950935009", "user_id": "u873780029"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "program answer\n implicit none\n\n integer :: a, b, c, d, e, k\n\n read(*,*) a\n read(*,*) b\n read(*,*) c\n read(*,*) d\n read(*,*) e\n read(*,*) k\n if(abs(a-b)<=k .and. abs(a-c)<=k .and. abs(a-d)<=k .and. abs(a-e)<=k) then\n if(abs(b-c)<=k .and. abs(b-d)<=k .and. abs(b-e)<=k .and.abs(c-d)<=k) then\n if( abs(c-e)<=k .and. abs(d-e)<=k) then\n write(*,*) 'Yay!'\n else\n write(*,*) ':('\n end if\n else\n write(*,*) ':('\n end if\n else\n write(*,*) ':('\n end if\n\n stop\n end program answer\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 546, "cpu_time_ms": 2, "memory_kb": 2852}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s246492318", "group_id": "codeNet:p03075", "input_text": "program prob1\n implicit none\n integer :: a,b,c,d,e,k\n read(*,*) a,b,c,d,e,k\n\n if(e-a > k) then\n write(*,*) ':('\n else\n write(*,*) 'Yay!'\n end if\n\n stop\ncontains\nend program prob1", "language": "Fortran", "metadata": {"date": 1593198171, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Fortran/s246492318.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s246492318", "user_id": "u478462004"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "program prob1\n implicit none\n integer :: a,b,c,d,e,k\n read(*,*) a,b,c,d,e,k\n\n if(e-a > k) then\n write(*,*) ':('\n else\n write(*,*) 'Yay!'\n end if\n\n stop\ncontains\nend program prob1", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 213, "cpu_time_ms": 12, "memory_kb": 2756}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s990789203", "group_id": "codeNet:p03075", "input_text": "program kyomu\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: antena(5),k,i,j\n\n do i=1,5\n read*, antena(i)\n end do\n read*, k\n\n do i=1,4\n do j=i+1,5\n if (antena(j)-antena(i) > k) then\n print'(a)', ':('\n stop\n end if\n end do\n end do\n print'(a)', 'Yay!'\n\nend program kyomu", "language": "Fortran", "metadata": {"date": 1591371534, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Fortran/s990789203.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s990789203", "user_id": "u234636620"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "program kyomu\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: antena(5),k,i,j\n\n do i=1,5\n read*, antena(i)\n end do\n read*, k\n\n do i=1,4\n do j=i+1,5\n if (antena(j)-antena(i) > k) then\n print'(a)', ':('\n stop\n end if\n end do\n end do\n print'(a)', 'Yay!'\n\nend program kyomu", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 388, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s022878744", "group_id": "codeNet:p03075", "input_text": "program aaa\nimplicit none\n\ninteger :: k, i, j\ninteger, dimension(5) :: a\n\ndo i=1, 5\nread*, a(i)\nend do\nread*, k\n\ndo i=1, 5\n do j=i+1, 5\n if(abs(a(i)-a(j))>k) then\n write(*,'(a2)') ':('\n return\n end if\n end do\nend do\n\nwrite(*,'(a4)') 'Yay!'\n\nend program", "language": "Fortran", "metadata": {"date": 1570531743, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Fortran/s022878744.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s022878744", "user_id": "u039189422"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "program aaa\nimplicit none\n\ninteger :: k, i, j\ninteger, dimension(5) :: a\n\ndo i=1, 5\nread*, a(i)\nend do\nread*, k\n\ndo i=1, 5\n do j=i+1, 5\n if(abs(a(i)-a(j))>k) then\n write(*,'(a2)') ':('\n return\n end if\n end do\nend do\n\nwrite(*,'(a4)') 'Yay!'\n\nend program", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 252, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s473776816", "group_id": "codeNet:p03075", "input_text": "module ABC123\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: ABC123_A\n\n ! constants for this \n character(len=4, kind=1), parameter, private :: string_communicatable = 'Yay!'\n character(len=2, kind=1), parameter, private :: string_NOT_communicatable = ':('\n integer (kind=INT8), parameter, private :: num_antenna = 5_INT8\n\n ! contained s and s are below\n contains\n\n subroutine ABC123_A\n\n ! variables for this \n integer(kind=INT8) :: coordinate_A, coordinate_E\n integer(kind=INT8) :: distance_max\n\n ! support variables for this \n integer(kind=INT8) :: itr\n\n ! STEP.01\n ! read out the coordinate of the antennas\n read(unit=INPUT_UNIT, fmt='(I3)') coordinate_A\n\n do itr = 2_INT8, num_antenna, 1_INT8\n read(unit=INPUT_UNIT, fmt='(I3)') coordinate_E\n end do\n\n ! STEP.02\n ! read out the maximum communicatable distance\n read(unit=INPUT_UNIT, fmt='(I3)') distance_max\n\n ! STEP.03\n ! judge the distance among the antennas\n if ( coordinate_E - coordinate_A .gt. distance_max ) then\n write(unit=OUTPUT_UNIT, fmt='(A)', advance='yes') string_NOT_communicatable\n else\n write(unit=OUTPUT_UNIT, fmt='(A)', advance='yes') string_communicatable\n end if\n\n ! STEP.END\n return\n\n end subroutine ABC123_A\n\nend module ABC123\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC123\n\n ! require all variables to be explicitly declared\n implicit none\n\n call ABC123_A\n\nend program main", "language": "Fortran", "metadata": {"date": 1554588089, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Fortran/s473776816.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s473776816", "user_id": "u484703930"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "module ABC123\n\n ! s to import\n use, intrinsic :: iso_fortran_env\n\n ! require all variables to be explicitly declared\n implicit none\n\n ! accessibility of s and s in this \n public :: ABC123_A\n\n ! constants for this \n character(len=4, kind=1), parameter, private :: string_communicatable = 'Yay!'\n character(len=2, kind=1), parameter, private :: string_NOT_communicatable = ':('\n integer (kind=INT8), parameter, private :: num_antenna = 5_INT8\n\n ! contained s and s are below\n contains\n\n subroutine ABC123_A\n\n ! variables for this \n integer(kind=INT8) :: coordinate_A, coordinate_E\n integer(kind=INT8) :: distance_max\n\n ! support variables for this \n integer(kind=INT8) :: itr\n\n ! STEP.01\n ! read out the coordinate of the antennas\n read(unit=INPUT_UNIT, fmt='(I3)') coordinate_A\n\n do itr = 2_INT8, num_antenna, 1_INT8\n read(unit=INPUT_UNIT, fmt='(I3)') coordinate_E\n end do\n\n ! STEP.02\n ! read out the maximum communicatable distance\n read(unit=INPUT_UNIT, fmt='(I3)') distance_max\n\n ! STEP.03\n ! judge the distance among the antennas\n if ( coordinate_E - coordinate_A .gt. distance_max ) then\n write(unit=OUTPUT_UNIT, fmt='(A)', advance='yes') string_NOT_communicatable\n else\n write(unit=OUTPUT_UNIT, fmt='(A)', advance='yes') string_communicatable\n end if\n\n ! STEP.END\n return\n\n end subroutine ABC123_A\n\nend module ABC123\n\nprogram main\n\n ! s to import\n use, non_intrinsic :: ABC123\n\n ! require all variables to be explicitly declared\n implicit none\n\n call ABC123_A\n\nend program main", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1699, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s375787423", "group_id": "codeNet:p03075", "input_text": "integer a,b,c,d,e,k\nread*,a,b,c,d,e,k\nif(e-a>k)then\nprint*,\":(\"\nelse\nprint*,\"Yay!\"\nendif\nend", "language": "Fortran", "metadata": {"date": 1554585799, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Fortran/s375787423.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s375787423", "user_id": "u394482932"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "integer a,b,c,d,e,k\nread*,a,b,c,d,e,k\nif(e-a>k)then\nprint*,\":(\"\nelse\nprint*,\"Yay!\"\nendif\nend", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 92, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s225048195", "group_id": "codeNet:p03075", "input_text": "implicit none\ninteger k,i\ninteger,dimension(5)::a\n\ndo i=1,5\nread(5,*) a(i)\nenddo\nread(5,*) k\n\nif(a(5)-a(1).gt.k) then\nwrite(6,*) \":(\"\nelse\nwrite(6,*) \"Yay!\"\nendif\n\n\nend", "language": "Fortran", "metadata": {"date": 1554579953, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Fortran/s225048195.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s225048195", "user_id": "u093744128"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "implicit none\ninteger k,i\ninteger,dimension(5)::a\n\ndo i=1,5\nread(5,*) a(i)\nenddo\nread(5,*) k\n\nif(a(5)-a(1).gt.k) then\nwrite(6,*) \":(\"\nelse\nwrite(6,*) \"Yay!\"\nendif\n\n\nend", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 168, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s923024900", "group_id": "codeNet:p03075", "input_text": "program main\n implicit none\n integer :: a(5),k\n integer :: distance\n integer :: i,j\n do i = 1,5\n read(*,*) a(i)\n end do\n read(*,*) k\n do i = 1,4\n do j=i+1,5\n distance = a(j)-a(i)\n if ( k >= a(i)) then\n cycle\n else\n write(*,'(a)')':('\n stop\n end if\n end do\n end do\n write(*,'(a)')'Yay!'\n stop\ncontains\n \nend program main\n", "language": "Fortran", "metadata": {"date": 1554577479, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03075.html", "problem_id": "p03075", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03075/input.txt", "sample_output_relpath": "derived/input_output/data/p03075/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03075/Fortran/s923024900.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s923024900", "user_id": "u886432251"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "program main\n implicit none\n integer :: a(5),k\n integer :: distance\n integer :: i,j\n do i = 1,5\n read(*,*) a(i)\n end do\n read(*,*) k\n do i = 1,4\n do j=i+1,5\n distance = a(j)-a(i)\n if ( k >= a(i)) then\n cycle\n else\n write(*,'(a)')':('\n stop\n end if\n end do\n end do\n write(*,'(a)')'Yay!'\n stop\ncontains\n \nend program main\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "sample_input": "1\n2\n4\n8\n9\n15\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03075", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.\n\nTwo antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.\n\nDetermine if there exists a pair of antennas that cannot communicate directly.\n\nHere, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.\n\nConstraints\n\na, b, c, d, e and k are integers between 0 and 123 (inclusive).\n\na < b < c < d < e\n\nInput\n\nInput is given from Standard Input in the following format:\n\na\nb\nc\nd\ne\nk\n\nOutput\n\nPrint :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.\n\nSample Input 1\n\n1\n2\n4\n8\n9\n15\n\nSample Output 1\n\nYay!\n\nIn this case, there is no pair of antennas that cannot communicate directly, because:\n\nthe distance between A and B is 2 - 1 = 1\n\nthe distance between A and C is 4 - 1 = 3\n\nthe distance between A and D is 8 - 1 = 7\n\nthe distance between A and E is 9 - 1 = 8\n\nthe distance between B and C is 4 - 2 = 2\n\nthe distance between B and D is 8 - 2 = 6\n\nthe distance between B and E is 9 - 2 = 7\n\nthe distance between C and D is 8 - 4 = 4\n\nthe distance between C and E is 9 - 4 = 5\n\nthe distance between D and E is 9 - 8 = 1\n\nand none of them is greater than 15. Thus, the correct output is Yay!.\n\nSample Input 2\n\n15\n18\n26\n35\n36\n18\n\nSample Output 2\n\n:(\n\nIn this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.\nThus, the correct output is :(.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 402, "cpu_time_ms": 7, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s910628581", "group_id": "codeNet:p03076", "input_text": "program answer\n implicit none\n integer :: i, A, B, C, D, E, aa, bb, cc, dd, ee, ans\n read(*,*) A\n read(*,*) B\n read(*,*) C\n read(*,*) D\n read(*,*) E\n aa=A-(A/10)*10\n bb=B-(B/10)*10\n cc=C-(C/10)*10\n dd=D-(D/10)*10\n ee=E-(E/10)*10\n\n ans=(A/10+B/10+C/10+D/10+E/10+5)*10\n if(aa==0) then\n ans=ans-10\n end if\n if(bb==0) then\n ans=ans-10\n end if\n if(cc==0) then\n ans=ans-10\n end if\n\n if(dd==0) then\n ans=ans-10\n end if\n if(ee==0) then\n ans=ans-10\n end if\n\n if(min(aa,bb,cc,dd,ee)==aa) then\n ans=ans-(A/10+1)*10+A\n else if(min(aa,bb,cc,dd,ee)==bb) then\n ans=ans-(B/10+1)*10+B\n else if(min(aa,bb,cc,dd,ee)==cc) then\n ans=ans-(C/10+1)*10+C\n else if(min(aa,bb,cc,dd,ee)==dd) then\n ans=ans-(D/10+1)*10+D\n else if(min(aa,bb,cc,dd,ee)==ee) then\n ans=ans-(E/10+1)*10+E\n end if\n\n if(aa==0.or.bb==0.or.cc==0.or.dd==0.or.ee==0) then\n if(aa==0) then\n aa=10\n end if\n if(bb==0) then\n bb=10\n end if\n if(cc==0) then\n cc=10\n end if\n if(dd==0) then\n dd=10\n end if\n if(ee==0) then\n ee=10\n end if\n ans=ans+min(aa,bb,cc,dd,ee)\n end if\n\n write(*,*) ans\n stop\n end program answer\n ", "language": "Fortran", "metadata": {"date": 1599247341, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03076.html", "problem_id": "p03076", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03076/input.txt", "sample_output_relpath": "derived/input_output/data/p03076/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03076/Fortran/s910628581.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s910628581", "user_id": "u873780029"}, "prompt_components": {"gold_output": "215\n", "input_to_evaluate": "program answer\n implicit none\n integer :: i, A, B, C, D, E, aa, bb, cc, dd, ee, ans\n read(*,*) A\n read(*,*) B\n read(*,*) C\n read(*,*) D\n read(*,*) E\n aa=A-(A/10)*10\n bb=B-(B/10)*10\n cc=C-(C/10)*10\n dd=D-(D/10)*10\n ee=E-(E/10)*10\n\n ans=(A/10+B/10+C/10+D/10+E/10+5)*10\n if(aa==0) then\n ans=ans-10\n end if\n if(bb==0) then\n ans=ans-10\n end if\n if(cc==0) then\n ans=ans-10\n end if\n\n if(dd==0) then\n ans=ans-10\n end if\n if(ee==0) then\n ans=ans-10\n end if\n\n if(min(aa,bb,cc,dd,ee)==aa) then\n ans=ans-(A/10+1)*10+A\n else if(min(aa,bb,cc,dd,ee)==bb) then\n ans=ans-(B/10+1)*10+B\n else if(min(aa,bb,cc,dd,ee)==cc) then\n ans=ans-(C/10+1)*10+C\n else if(min(aa,bb,cc,dd,ee)==dd) then\n ans=ans-(D/10+1)*10+D\n else if(min(aa,bb,cc,dd,ee)==ee) then\n ans=ans-(E/10+1)*10+E\n end if\n\n if(aa==0.or.bb==0.or.cc==0.or.dd==0.or.ee==0) then\n if(aa==0) then\n aa=10\n end if\n if(bb==0) then\n bb=10\n end if\n if(cc==0) then\n cc=10\n end if\n if(dd==0) then\n dd=10\n end if\n if(ee==0) then\n ee=10\n end if\n ans=ans+min(aa,bb,cc,dd,ee)\n end if\n\n write(*,*) ans\n stop\n end program answer\n ", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe restaurant AtCoder serves the following five dishes:\n\nABC Don (rice bowl): takes A minutes to serve.\n\nARC Curry: takes B minutes to serve.\n\nAGC Pasta: takes C minutes to serve.\n\nAPC Ramen: takes D minutes to serve.\n\nATC Hanbagu (hamburger patty): takes E minutes to serve.\n\nHere, the time to serve a dish is the time between when an order is placed and when the dish is delivered.\n\nThis restaurant has the following rules on orders:\n\nAn order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).\n\nOnly one dish can be ordered at a time.\n\nNo new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.\n\nE869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.\n\nHere, he can order the dishes in any order he likes, and he can place an order already at time 0.\n\nConstraints\n\nA, B, C, D and E are integers between 1 and 123 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the earliest possible time for the last dish to be delivered, as an integer.\n\nSample Input 1\n\n29\n20\n7\n35\n120\n\nSample Output 1\n\n215\n\nIf we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:\n\nOrder ABC Don at time 0, which will be delivered at time 29.\n\nOrder ARC Curry at time 30, which will be delivered at time 50.\n\nOrder AGC Pasta at time 50, which will be delivered at time 57.\n\nOrder ATC Hanbagu at time 60, which will be delivered at time 180.\n\nOrder APC Ramen at time 180, which will be delivered at time 215.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 2\n\n101\n86\n119\n108\n57\n\nSample Output 2\n\n481\n\nIf we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:\n\nOrder AGC Pasta at time 0, which will be delivered at time 119.\n\nOrder ARC Curry at time 120, which will be delivered at time 206.\n\nOrder ATC Hanbagu at time 210, which will be delivered at time 267.\n\nOrder APC Ramen at time 270, which will be delivered at time 378.\n\nOrder ABC Don at time 380, which will be delivered at time 481.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 3\n\n123\n123\n123\n123\n123\n\nSample Output 3\n\n643\n\nThis is the largest valid case.", "sample_input": "29\n20\n7\n35\n120\n"}, "reference_outputs": ["215\n"], "source_document_id": "p03076", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe restaurant AtCoder serves the following five dishes:\n\nABC Don (rice bowl): takes A minutes to serve.\n\nARC Curry: takes B minutes to serve.\n\nAGC Pasta: takes C minutes to serve.\n\nAPC Ramen: takes D minutes to serve.\n\nATC Hanbagu (hamburger patty): takes E minutes to serve.\n\nHere, the time to serve a dish is the time between when an order is placed and when the dish is delivered.\n\nThis restaurant has the following rules on orders:\n\nAn order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).\n\nOnly one dish can be ordered at a time.\n\nNo new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.\n\nE869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.\n\nHere, he can order the dishes in any order he likes, and he can place an order already at time 0.\n\nConstraints\n\nA, B, C, D and E are integers between 1 and 123 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the earliest possible time for the last dish to be delivered, as an integer.\n\nSample Input 1\n\n29\n20\n7\n35\n120\n\nSample Output 1\n\n215\n\nIf we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:\n\nOrder ABC Don at time 0, which will be delivered at time 29.\n\nOrder ARC Curry at time 30, which will be delivered at time 50.\n\nOrder AGC Pasta at time 50, which will be delivered at time 57.\n\nOrder ATC Hanbagu at time 60, which will be delivered at time 180.\n\nOrder APC Ramen at time 180, which will be delivered at time 215.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 2\n\n101\n86\n119\n108\n57\n\nSample Output 2\n\n481\n\nIf we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:\n\nOrder AGC Pasta at time 0, which will be delivered at time 119.\n\nOrder ARC Curry at time 120, which will be delivered at time 206.\n\nOrder ATC Hanbagu at time 210, which will be delivered at time 267.\n\nOrder APC Ramen at time 270, which will be delivered at time 378.\n\nOrder ABC Don at time 380, which will be delivered at time 481.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 3\n\n123\n123\n123\n123\n123\n\nSample Output 3\n\n643\n\nThis is the largest valid case.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1208, "cpu_time_ms": 6, "memory_kb": 2840}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s627483197", "group_id": "codeNet:p03076", "input_text": "program prob3\n implicit none\n integer :: a(5), ans, i, mi\n read(*,*) a\n ans = 0\n do i = 1, 5\n ans = ans + a(i)\n ans = ((ans - 1) / 10 + 1) * 10\n end do\n mi = 10\n do i = 1, 5\n if(mod(a(i), 10) == 0) then\n cycle\n end if\n mi = min(mod(a(i), 10), mi)\n end do\n ans = ans - (10 - mi)\n write(*,*) ans\n\n stop\ncontains\nend program prob3", "language": "Fortran", "metadata": {"date": 1599246525, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03076.html", "problem_id": "p03076", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03076/input.txt", "sample_output_relpath": "derived/input_output/data/p03076/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03076/Fortran/s627483197.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s627483197", "user_id": "u478462004"}, "prompt_components": {"gold_output": "215\n", "input_to_evaluate": "program prob3\n implicit none\n integer :: a(5), ans, i, mi\n read(*,*) a\n ans = 0\n do i = 1, 5\n ans = ans + a(i)\n ans = ((ans - 1) / 10 + 1) * 10\n end do\n mi = 10\n do i = 1, 5\n if(mod(a(i), 10) == 0) then\n cycle\n end if\n mi = min(mod(a(i), 10), mi)\n end do\n ans = ans - (10 - mi)\n write(*,*) ans\n\n stop\ncontains\nend program prob3", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe restaurant AtCoder serves the following five dishes:\n\nABC Don (rice bowl): takes A minutes to serve.\n\nARC Curry: takes B minutes to serve.\n\nAGC Pasta: takes C minutes to serve.\n\nAPC Ramen: takes D minutes to serve.\n\nATC Hanbagu (hamburger patty): takes E minutes to serve.\n\nHere, the time to serve a dish is the time between when an order is placed and when the dish is delivered.\n\nThis restaurant has the following rules on orders:\n\nAn order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).\n\nOnly one dish can be ordered at a time.\n\nNo new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.\n\nE869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.\n\nHere, he can order the dishes in any order he likes, and he can place an order already at time 0.\n\nConstraints\n\nA, B, C, D and E are integers between 1 and 123 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the earliest possible time for the last dish to be delivered, as an integer.\n\nSample Input 1\n\n29\n20\n7\n35\n120\n\nSample Output 1\n\n215\n\nIf we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:\n\nOrder ABC Don at time 0, which will be delivered at time 29.\n\nOrder ARC Curry at time 30, which will be delivered at time 50.\n\nOrder AGC Pasta at time 50, which will be delivered at time 57.\n\nOrder ATC Hanbagu at time 60, which will be delivered at time 180.\n\nOrder APC Ramen at time 180, which will be delivered at time 215.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 2\n\n101\n86\n119\n108\n57\n\nSample Output 2\n\n481\n\nIf we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:\n\nOrder AGC Pasta at time 0, which will be delivered at time 119.\n\nOrder ARC Curry at time 120, which will be delivered at time 206.\n\nOrder ATC Hanbagu at time 210, which will be delivered at time 267.\n\nOrder APC Ramen at time 270, which will be delivered at time 378.\n\nOrder ABC Don at time 380, which will be delivered at time 481.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 3\n\n123\n123\n123\n123\n123\n\nSample Output 3\n\n643\n\nThis is the largest valid case.", "sample_input": "29\n20\n7\n35\n120\n"}, "reference_outputs": ["215\n"], "source_document_id": "p03076", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe restaurant AtCoder serves the following five dishes:\n\nABC Don (rice bowl): takes A minutes to serve.\n\nARC Curry: takes B minutes to serve.\n\nAGC Pasta: takes C minutes to serve.\n\nAPC Ramen: takes D minutes to serve.\n\nATC Hanbagu (hamburger patty): takes E minutes to serve.\n\nHere, the time to serve a dish is the time between when an order is placed and when the dish is delivered.\n\nThis restaurant has the following rules on orders:\n\nAn order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).\n\nOnly one dish can be ordered at a time.\n\nNo new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.\n\nE869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.\n\nHere, he can order the dishes in any order he likes, and he can place an order already at time 0.\n\nConstraints\n\nA, B, C, D and E are integers between 1 and 123 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the earliest possible time for the last dish to be delivered, as an integer.\n\nSample Input 1\n\n29\n20\n7\n35\n120\n\nSample Output 1\n\n215\n\nIf we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:\n\nOrder ABC Don at time 0, which will be delivered at time 29.\n\nOrder ARC Curry at time 30, which will be delivered at time 50.\n\nOrder AGC Pasta at time 50, which will be delivered at time 57.\n\nOrder ATC Hanbagu at time 60, which will be delivered at time 180.\n\nOrder APC Ramen at time 180, which will be delivered at time 215.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 2\n\n101\n86\n119\n108\n57\n\nSample Output 2\n\n481\n\nIf we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:\n\nOrder AGC Pasta at time 0, which will be delivered at time 119.\n\nOrder ARC Curry at time 120, which will be delivered at time 206.\n\nOrder ATC Hanbagu at time 210, which will be delivered at time 267.\n\nOrder APC Ramen at time 270, which will be delivered at time 378.\n\nOrder ABC Don at time 380, which will be delivered at time 481.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 3\n\n123\n123\n123\n123\n123\n\nSample Output 3\n\n643\n\nThis is the largest valid case.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 409, "cpu_time_ms": 10, "memory_kb": 2788}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s212566846", "group_id": "codeNet:p03076", "input_text": "program c20829\n\nimplicit none\ninteger(16) :: a, b, c, d, e, n, a1, b1, c1, d1, e1, a2, b2, c2, d2, e2, z\n\nn = 0\n\nread *, a\nread *, b\nread *, c\nread *, d\nread *, e\n\na1 = mod(a, 10)\nb1 = mod(b, 10)\nc1 = mod(c, 10)\nd1 = mod(d, 10)\ne1 = mod(e, 10)\n\n!print *, a1, b1, c1, d1, e1\n\n!stop\n\nz = 10\n\nif(z > a1 .and. a1 .ne. 0) then\n z = a1\nend if\n\nif(z > b1 .and. b1 .ne. 0) then\n z = b1\nend if\n\nif(z > c1 .and. c1 .ne. 0) then\n z = c1\nend if\n\nif(z > d1 .and. d1 .ne. 0) then\n z = d1\nend if\n\nif(z > e1 .and. e1 .ne. 0) then\n z = e1\nend if\n\n!print *, z\n\nn = n + ceiling(real(a)/10) * 10\nn = n + ceiling(real(b)/10) * 10\nn = n + ceiling(real(c)/10) * 10\nn = n + ceiling(real(d)/10) * 10\nn = n + ceiling(real(e)/10) * 10\nn = n - 10 + z\n\nprint *, n\n\nend program c20829", "language": "Fortran", "metadata": {"date": 1598725880, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03076.html", "problem_id": "p03076", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03076/input.txt", "sample_output_relpath": "derived/input_output/data/p03076/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03076/Fortran/s212566846.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s212566846", "user_id": "u644436095"}, "prompt_components": {"gold_output": "215\n", "input_to_evaluate": "program c20829\n\nimplicit none\ninteger(16) :: a, b, c, d, e, n, a1, b1, c1, d1, e1, a2, b2, c2, d2, e2, z\n\nn = 0\n\nread *, a\nread *, b\nread *, c\nread *, d\nread *, e\n\na1 = mod(a, 10)\nb1 = mod(b, 10)\nc1 = mod(c, 10)\nd1 = mod(d, 10)\ne1 = mod(e, 10)\n\n!print *, a1, b1, c1, d1, e1\n\n!stop\n\nz = 10\n\nif(z > a1 .and. a1 .ne. 0) then\n z = a1\nend if\n\nif(z > b1 .and. b1 .ne. 0) then\n z = b1\nend if\n\nif(z > c1 .and. c1 .ne. 0) then\n z = c1\nend if\n\nif(z > d1 .and. d1 .ne. 0) then\n z = d1\nend if\n\nif(z > e1 .and. e1 .ne. 0) then\n z = e1\nend if\n\n!print *, z\n\nn = n + ceiling(real(a)/10) * 10\nn = n + ceiling(real(b)/10) * 10\nn = n + ceiling(real(c)/10) * 10\nn = n + ceiling(real(d)/10) * 10\nn = n + ceiling(real(e)/10) * 10\nn = n - 10 + z\n\nprint *, n\n\nend program c20829", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe restaurant AtCoder serves the following five dishes:\n\nABC Don (rice bowl): takes A minutes to serve.\n\nARC Curry: takes B minutes to serve.\n\nAGC Pasta: takes C minutes to serve.\n\nAPC Ramen: takes D minutes to serve.\n\nATC Hanbagu (hamburger patty): takes E minutes to serve.\n\nHere, the time to serve a dish is the time between when an order is placed and when the dish is delivered.\n\nThis restaurant has the following rules on orders:\n\nAn order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).\n\nOnly one dish can be ordered at a time.\n\nNo new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.\n\nE869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.\n\nHere, he can order the dishes in any order he likes, and he can place an order already at time 0.\n\nConstraints\n\nA, B, C, D and E are integers between 1 and 123 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the earliest possible time for the last dish to be delivered, as an integer.\n\nSample Input 1\n\n29\n20\n7\n35\n120\n\nSample Output 1\n\n215\n\nIf we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:\n\nOrder ABC Don at time 0, which will be delivered at time 29.\n\nOrder ARC Curry at time 30, which will be delivered at time 50.\n\nOrder AGC Pasta at time 50, which will be delivered at time 57.\n\nOrder ATC Hanbagu at time 60, which will be delivered at time 180.\n\nOrder APC Ramen at time 180, which will be delivered at time 215.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 2\n\n101\n86\n119\n108\n57\n\nSample Output 2\n\n481\n\nIf we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:\n\nOrder AGC Pasta at time 0, which will be delivered at time 119.\n\nOrder ARC Curry at time 120, which will be delivered at time 206.\n\nOrder ATC Hanbagu at time 210, which will be delivered at time 267.\n\nOrder APC Ramen at time 270, which will be delivered at time 378.\n\nOrder ABC Don at time 380, which will be delivered at time 481.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 3\n\n123\n123\n123\n123\n123\n\nSample Output 3\n\n643\n\nThis is the largest valid case.", "sample_input": "29\n20\n7\n35\n120\n"}, "reference_outputs": ["215\n"], "source_document_id": "p03076", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe restaurant AtCoder serves the following five dishes:\n\nABC Don (rice bowl): takes A minutes to serve.\n\nARC Curry: takes B minutes to serve.\n\nAGC Pasta: takes C minutes to serve.\n\nAPC Ramen: takes D minutes to serve.\n\nATC Hanbagu (hamburger patty): takes E minutes to serve.\n\nHere, the time to serve a dish is the time between when an order is placed and when the dish is delivered.\n\nThis restaurant has the following rules on orders:\n\nAn order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).\n\nOnly one dish can be ordered at a time.\n\nNo new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.\n\nE869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.\n\nHere, he can order the dishes in any order he likes, and he can place an order already at time 0.\n\nConstraints\n\nA, B, C, D and E are integers between 1 and 123 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the earliest possible time for the last dish to be delivered, as an integer.\n\nSample Input 1\n\n29\n20\n7\n35\n120\n\nSample Output 1\n\n215\n\nIf we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:\n\nOrder ABC Don at time 0, which will be delivered at time 29.\n\nOrder ARC Curry at time 30, which will be delivered at time 50.\n\nOrder AGC Pasta at time 50, which will be delivered at time 57.\n\nOrder ATC Hanbagu at time 60, which will be delivered at time 180.\n\nOrder APC Ramen at time 180, which will be delivered at time 215.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 2\n\n101\n86\n119\n108\n57\n\nSample Output 2\n\n481\n\nIf we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:\n\nOrder AGC Pasta at time 0, which will be delivered at time 119.\n\nOrder ARC Curry at time 120, which will be delivered at time 206.\n\nOrder ATC Hanbagu at time 210, which will be delivered at time 267.\n\nOrder APC Ramen at time 270, which will be delivered at time 378.\n\nOrder ABC Don at time 380, which will be delivered at time 481.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 3\n\n123\n123\n123\n123\n123\n\nSample Output 3\n\n643\n\nThis is the largest valid case.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 754, "cpu_time_ms": 5, "memory_kb": 2764}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s780894819", "group_id": "codeNet:p03076", "input_text": "program bbb\nimplicit none\n\ninteger :: i, m, res\ninteger, dimension(5) :: meal, one\ninteger, dimension(1) :: mloc\nread*, meal\n\nres=0\n\ndo i=1,5\none(i)=meal(i)-(meal(i)/10)*10\nif(one(i)==0) one(i)=10\nend do\n\nm=minval(one)\nmloc=minloc(one)\n\ndo i=1, 5\n if(one(i)==10) then\n res=res+meal(i)\n else\n res=res+(meal(i)/10)*10+10\n end if\nend do\n\nres=res-10+one(mloc(1))\n\nwrite(*,'(i0)') res\n\nend program", "language": "Fortran", "metadata": {"date": 1570533121, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03076.html", "problem_id": "p03076", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03076/input.txt", "sample_output_relpath": "derived/input_output/data/p03076/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03076/Fortran/s780894819.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s780894819", "user_id": "u039189422"}, "prompt_components": {"gold_output": "215\n", "input_to_evaluate": "program bbb\nimplicit none\n\ninteger :: i, m, res\ninteger, dimension(5) :: meal, one\ninteger, dimension(1) :: mloc\nread*, meal\n\nres=0\n\ndo i=1,5\none(i)=meal(i)-(meal(i)/10)*10\nif(one(i)==0) one(i)=10\nend do\n\nm=minval(one)\nmloc=minloc(one)\n\ndo i=1, 5\n if(one(i)==10) then\n res=res+meal(i)\n else\n res=res+(meal(i)/10)*10+10\n end if\nend do\n\nres=res-10+one(mloc(1))\n\nwrite(*,'(i0)') res\n\nend program", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe restaurant AtCoder serves the following five dishes:\n\nABC Don (rice bowl): takes A minutes to serve.\n\nARC Curry: takes B minutes to serve.\n\nAGC Pasta: takes C minutes to serve.\n\nAPC Ramen: takes D minutes to serve.\n\nATC Hanbagu (hamburger patty): takes E minutes to serve.\n\nHere, the time to serve a dish is the time between when an order is placed and when the dish is delivered.\n\nThis restaurant has the following rules on orders:\n\nAn order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).\n\nOnly one dish can be ordered at a time.\n\nNo new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.\n\nE869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.\n\nHere, he can order the dishes in any order he likes, and he can place an order already at time 0.\n\nConstraints\n\nA, B, C, D and E are integers between 1 and 123 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the earliest possible time for the last dish to be delivered, as an integer.\n\nSample Input 1\n\n29\n20\n7\n35\n120\n\nSample Output 1\n\n215\n\nIf we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:\n\nOrder ABC Don at time 0, which will be delivered at time 29.\n\nOrder ARC Curry at time 30, which will be delivered at time 50.\n\nOrder AGC Pasta at time 50, which will be delivered at time 57.\n\nOrder ATC Hanbagu at time 60, which will be delivered at time 180.\n\nOrder APC Ramen at time 180, which will be delivered at time 215.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 2\n\n101\n86\n119\n108\n57\n\nSample Output 2\n\n481\n\nIf we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:\n\nOrder AGC Pasta at time 0, which will be delivered at time 119.\n\nOrder ARC Curry at time 120, which will be delivered at time 206.\n\nOrder ATC Hanbagu at time 210, which will be delivered at time 267.\n\nOrder APC Ramen at time 270, which will be delivered at time 378.\n\nOrder ABC Don at time 380, which will be delivered at time 481.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 3\n\n123\n123\n123\n123\n123\n\nSample Output 3\n\n643\n\nThis is the largest valid case.", "sample_input": "29\n20\n7\n35\n120\n"}, "reference_outputs": ["215\n"], "source_document_id": "p03076", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe restaurant AtCoder serves the following five dishes:\n\nABC Don (rice bowl): takes A minutes to serve.\n\nARC Curry: takes B minutes to serve.\n\nAGC Pasta: takes C minutes to serve.\n\nAPC Ramen: takes D minutes to serve.\n\nATC Hanbagu (hamburger patty): takes E minutes to serve.\n\nHere, the time to serve a dish is the time between when an order is placed and when the dish is delivered.\n\nThis restaurant has the following rules on orders:\n\nAn order can only be placed at a time that is a multiple of 10 (time 0, 10, 20, ...).\n\nOnly one dish can be ordered at a time.\n\nNo new order can be placed when an order is already placed and the dish is still not delivered, but a new order can be placed at the exact time when the dish is delivered.\n\nE869120 arrives at this restaurant at time 0. He will order all five dishes. Find the earliest possible time for the last dish to be delivered.\n\nHere, he can order the dishes in any order he likes, and he can place an order already at time 0.\n\nConstraints\n\nA, B, C, D and E are integers between 1 and 123 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\nE\n\nOutput\n\nPrint the earliest possible time for the last dish to be delivered, as an integer.\n\nSample Input 1\n\n29\n20\n7\n35\n120\n\nSample Output 1\n\n215\n\nIf we decide to order the dishes in the order ABC Don, ARC Curry, AGC Pasta, ATC Hanbagu, APC Ramen, the earliest possible time for each order is as follows:\n\nOrder ABC Don at time 0, which will be delivered at time 29.\n\nOrder ARC Curry at time 30, which will be delivered at time 50.\n\nOrder AGC Pasta at time 50, which will be delivered at time 57.\n\nOrder ATC Hanbagu at time 60, which will be delivered at time 180.\n\nOrder APC Ramen at time 180, which will be delivered at time 215.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 2\n\n101\n86\n119\n108\n57\n\nSample Output 2\n\n481\n\nIf we decide to order the dishes in the order AGC Pasta, ARC Curry, ATC Hanbagu, APC Ramen, ABC Don, the earliest possible time for each order is as follows:\n\nOrder AGC Pasta at time 0, which will be delivered at time 119.\n\nOrder ARC Curry at time 120, which will be delivered at time 206.\n\nOrder ATC Hanbagu at time 210, which will be delivered at time 267.\n\nOrder APC Ramen at time 270, which will be delivered at time 378.\n\nOrder ABC Don at time 380, which will be delivered at time 481.\n\nThere is no way to order the dishes in which the last dish will be delivered earlier than this.\n\nSample Input 3\n\n123\n123\n123\n123\n123\n\nSample Output 3\n\n643\n\nThis is the largest valid case.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 392, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s429264482", "group_id": "codeNet:p03076", "input_text": "program fivedishes\n implicit none\n\ninteger::a(5),i,count=0,m=615\n\ndo i=1,5\n read*,a(i)\n if(mod(a(i),10)==0)then\n count=count+a(i)\n else\n count=count+(a(i)/10+1)*10\n end if\nend do\n\ndo i=1,5\n if(mod(a(i),10)/=0)then\n if(count-(a(i)/10+1)*10+a(i)x*y)exit\n\tenddo\n\t\n\tcall h1(e,k*z)\n\tcall rev(e,k*z)\n\t\n\tdo i = 1,k\n\t\tprint\"(i0)\",e(i)\n\tenddo\nend program main\n\nsubroutine rev(a,n)\nImplicit None\n\tinteger(8)::a(n),b(n)\n\tinteger(8)::n,i\n\t\n\tdo i =1,n\n\tb(i) = a(n-i+1)\n\tenddo\n\t\n\ta =b\nend subroutine rev\n\nsubroutine h1(a,n)\nimplicit None\n\tinteger(8)::a(n),x\n\tinteger(8)::n,i,ie,i0,i1,i2\n\t\n\tdo i = n/2,1,-1\n\t\tx = a(i);ie = n + 1; i0 = i; i1 = i0 * 2\n\t\tdo while(i1 < ie)\n\t\t\ti2 = i1 + 1\n\t\t\tif(i2 < ie .and. a(i1) < a(i2)) i1 = i2\n\t\t\tif(a(i1) > x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\n\tdo ie = n,2,-1\n\t\tx = a(ie)\n\t\ta(ie) = a(1)\n\t\ta(1) = x\n\t\ti0 =1;i1 =2\n\t\tdo while(i1 x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\nend subroutine h1", "language": "Fortran", "metadata": {"date": 1554837726, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03078.html", "problem_id": "p03078", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03078/input.txt", "sample_output_relpath": "derived/input_output/data/p03078/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03078/Fortran/s866071824.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s866071824", "user_id": "u900266249"}, "prompt_components": {"gold_output": "19\n17\n15\n14\n13\n12\n10\n8\n", "input_to_evaluate": "program main\nimplicit None\n\tinteger(8)::x,y,z,k,i,j\n\tinteger(8),allocatable::a(:),b(:),c(:),d(:),e(:)\n\t\n\tread*,x,y,z,k\n\tallocate(a(x),b(y),c(z),d(x*y),e(k*z))\n\tread*,a;read*,b;read*,c\n\t\n\tdo i =1,x\n\t\tdo j =1,y\n\t\t\td((i-1)*y+j) = a(i)+b(j)\n\t\tenddo\n\tenddo\n\t\n\tcall h1(d,x*y)\n\tcall rev(d,x*y)\n\te = 0\n\t\n\tdo i =1,k\n\t\tdo j = 1,z\n\t\t\te((i-1)*z+j) = d(i)+c(j)\n\t\tenddo\n\t\tif((i+1)>x*y)exit\n\tenddo\n\t\n\tcall h1(e,k*z)\n\tcall rev(e,k*z)\n\t\n\tdo i = 1,k\n\t\tprint\"(i0)\",e(i)\n\tenddo\nend program main\n\nsubroutine rev(a,n)\nImplicit None\n\tinteger(8)::a(n),b(n)\n\tinteger(8)::n,i\n\t\n\tdo i =1,n\n\tb(i) = a(n-i+1)\n\tenddo\n\t\n\ta =b\nend subroutine rev\n\nsubroutine h1(a,n)\nimplicit None\n\tinteger(8)::a(n),x\n\tinteger(8)::n,i,ie,i0,i1,i2\n\t\n\tdo i = n/2,1,-1\n\t\tx = a(i);ie = n + 1; i0 = i; i1 = i0 * 2\n\t\tdo while(i1 < ie)\n\t\t\ti2 = i1 + 1\n\t\t\tif(i2 < ie .and. a(i1) < a(i2)) i1 = i2\n\t\t\tif(a(i1) > x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\n\tdo ie = n,2,-1\n\t\tx = a(ie)\n\t\ta(ie) = a(1)\n\t\ta(1) = x\n\t\ti0 =1;i1 =2\n\t\tdo while(i1 x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\nend subroutine h1", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as follows:\n\nThe deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.\n\nThe deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.\n\nThe deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.\n\nTakahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.\n\nThere are X \\times Y \\times Z such ways to choose three cakes.\n\nWe will arrange these X \\times Y \\times Z ways in descending order of the sum of the deliciousness of the cakes.\n\nPrint the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.\n\nConstraints\n\n1 \\leq X \\leq 1 \\ 000\n\n1 \\leq Y \\leq 1 \\ 000\n\n1 \\leq Z \\leq 1 \\ 000\n\n1 \\leq K \\leq \\min(3 \\ 000, X \\times Y \\times Z)\n\n1 \\leq A_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq B_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq C_i \\leq 10 \\ 000 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z K\nA_1 \\ A_2 \\ A_3 \\ ... \\ A_X\nB_1 \\ B_2 \\ B_3 \\ ... \\ B_Y\nC_1 \\ C_2 \\ C_3 \\ ... \\ C_Z\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th value stated in the problem statement.\n\nSample Input 1\n\n2 2 2 8\n4 6\n1 5\n3 8\n\nSample Output 1\n\n19\n17\n15\n14\n13\n12\n10\n8\n\nThere are 2 \\times 2 \\times 2 = 8 ways to choose three cakes, as shown below in descending order of the sum of the deliciousness of the cakes:\n\n(A_2, B_2, C_2): 6 + 5 + 8 = 19\n\n(A_1, B_2, C_2): 4 + 5 + 8 = 17\n\n(A_2, B_1, C_2): 6 + 1 + 8 = 15\n\n(A_2, B_2, C_1): 6 + 5 + 3 = 14\n\n(A_1, B_1, C_2): 4 + 1 + 8 = 13\n\n(A_1, B_2, C_1): 4 + 5 + 3 = 12\n\n(A_2, B_1, C_1): 6 + 1 + 3 = 10\n\n(A_1, B_1, C_1): 4 + 1 + 3 = 8\n\nSample Input 2\n\n3 3 3 5\n1 10 100\n2 20 200\n1 10 100\n\nSample Output 2\n\n400\n310\n310\n301\n301\n\nThere may be multiple combinations of cakes with the same sum of the deliciousness. For example, in this test case, the sum of A_1, B_3, C_3 and the sum of A_3, B_3, C_1 are both 301.\nHowever, they are different ways of choosing cakes, so 301 occurs twice in the output.\n\nSample Input 3\n\n10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736\n\nSample Output 3\n\n23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547\n\nNote that the input or output may not fit into a 32-bit integer type.", "sample_input": "2 2 2 8\n4 6\n1 5\n3 8\n"}, "reference_outputs": ["19\n17\n15\n14\n13\n12\n10\n8\n"], "source_document_id": "p03078", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as follows:\n\nThe deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.\n\nThe deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.\n\nThe deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.\n\nTakahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.\n\nThere are X \\times Y \\times Z such ways to choose three cakes.\n\nWe will arrange these X \\times Y \\times Z ways in descending order of the sum of the deliciousness of the cakes.\n\nPrint the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.\n\nConstraints\n\n1 \\leq X \\leq 1 \\ 000\n\n1 \\leq Y \\leq 1 \\ 000\n\n1 \\leq Z \\leq 1 \\ 000\n\n1 \\leq K \\leq \\min(3 \\ 000, X \\times Y \\times Z)\n\n1 \\leq A_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq B_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq C_i \\leq 10 \\ 000 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z K\nA_1 \\ A_2 \\ A_3 \\ ... \\ A_X\nB_1 \\ B_2 \\ B_3 \\ ... \\ B_Y\nC_1 \\ C_2 \\ C_3 \\ ... \\ C_Z\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th value stated in the problem statement.\n\nSample Input 1\n\n2 2 2 8\n4 6\n1 5\n3 8\n\nSample Output 1\n\n19\n17\n15\n14\n13\n12\n10\n8\n\nThere are 2 \\times 2 \\times 2 = 8 ways to choose three cakes, as shown below in descending order of the sum of the deliciousness of the cakes:\n\n(A_2, B_2, C_2): 6 + 5 + 8 = 19\n\n(A_1, B_2, C_2): 4 + 5 + 8 = 17\n\n(A_2, B_1, C_2): 6 + 1 + 8 = 15\n\n(A_2, B_2, C_1): 6 + 5 + 3 = 14\n\n(A_1, B_1, C_2): 4 + 1 + 8 = 13\n\n(A_1, B_2, C_1): 4 + 5 + 3 = 12\n\n(A_2, B_1, C_1): 6 + 1 + 3 = 10\n\n(A_1, B_1, C_1): 4 + 1 + 3 = 8\n\nSample Input 2\n\n3 3 3 5\n1 10 100\n2 20 200\n1 10 100\n\nSample Output 2\n\n400\n310\n310\n301\n301\n\nThere may be multiple combinations of cakes with the same sum of the deliciousness. For example, in this test case, the sum of A_1, B_3, C_3 and the sum of A_3, B_3, C_1 are both 301.\nHowever, they are different ways of choosing cakes, so 301 occurs twice in the output.\n\nSample Input 3\n\n10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736\n\nSample Output 3\n\n23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547\n\nNote that the input or output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1224, "cpu_time_ms": 586, "memory_kb": 55288}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s504137787", "group_id": "codeNet:p03078", "input_text": "implicit none\ninteger(8):: n, i, ans, k, x, y, z, j\ninteger(8),allocatable,dimension(:):: a,b,c,d,e\n\nread (5,*) x,y,z,n\n\nallocate(a(x))\nallocate(b(y))\nallocate(c(z))\nallocate(d(x*y))\nallocate(e(min(x*y, 3000) * z))\n\nd = 0\ne = 0\nread(5,*) (a(i),i=1,x)\nread(5,*) (b(i),i=1,y)\nread(5,*) (c(i),i=1,z)\n\n\ndo i = 1, x\n do j = 1, y\n d( (i-1) * y + j ) = a(i) + b(j)\n enddo\nenddo\n\ncall heapsort(x,c)\ncall heapsort(x*y,d)\n\n\ndo i = x*y, max(x*y-3000+1, 1), -1\n do j = 1, z\n e((x*y-i) * z + j ) = d(i) + c(j)\n enddo\nenddo\n \n \ncall heapsort(min(x*y, 3000) * z, e)\n\ndo i = min(x*y, 3000) * z, min(x*y, 3000) * z - n +1, -1\n write(6,*) e(i)\nenddo\n \n \n\nend\n \n!---http://slpr.sakura.ne.jp/qp/sortf90/---\nsubroutine heapsort(n,array)\n implicit none\n integer(8),intent(in) :: n\n double precision,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n double precision :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n\n if(n.eq.1)return \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort", "language": "Fortran", "metadata": {"date": 1554583703, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03078.html", "problem_id": "p03078", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03078/input.txt", "sample_output_relpath": "derived/input_output/data/p03078/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03078/Fortran/s504137787.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s504137787", "user_id": "u909643606"}, "prompt_components": {"gold_output": "19\n17\n15\n14\n13\n12\n10\n8\n", "input_to_evaluate": "implicit none\ninteger(8):: n, i, ans, k, x, y, z, j\ninteger(8),allocatable,dimension(:):: a,b,c,d,e\n\nread (5,*) x,y,z,n\n\nallocate(a(x))\nallocate(b(y))\nallocate(c(z))\nallocate(d(x*y))\nallocate(e(min(x*y, 3000) * z))\n\nd = 0\ne = 0\nread(5,*) (a(i),i=1,x)\nread(5,*) (b(i),i=1,y)\nread(5,*) (c(i),i=1,z)\n\n\ndo i = 1, x\n do j = 1, y\n d( (i-1) * y + j ) = a(i) + b(j)\n enddo\nenddo\n\ncall heapsort(x,c)\ncall heapsort(x*y,d)\n\n\ndo i = x*y, max(x*y-3000+1, 1), -1\n do j = 1, z\n e((x*y-i) * z + j ) = d(i) + c(j)\n enddo\nenddo\n \n \ncall heapsort(min(x*y, 3000) * z, e)\n\ndo i = min(x*y, 3000) * z, min(x*y, 3000) * z - n +1, -1\n write(6,*) e(i)\nenddo\n \n \n\nend\n \n!---http://slpr.sakura.ne.jp/qp/sortf90/---\nsubroutine heapsort(n,array)\n implicit none\n integer(8),intent(in) :: n\n double precision,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n double precision :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n\n if(n.eq.1)return \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as follows:\n\nThe deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.\n\nThe deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.\n\nThe deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.\n\nTakahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.\n\nThere are X \\times Y \\times Z such ways to choose three cakes.\n\nWe will arrange these X \\times Y \\times Z ways in descending order of the sum of the deliciousness of the cakes.\n\nPrint the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.\n\nConstraints\n\n1 \\leq X \\leq 1 \\ 000\n\n1 \\leq Y \\leq 1 \\ 000\n\n1 \\leq Z \\leq 1 \\ 000\n\n1 \\leq K \\leq \\min(3 \\ 000, X \\times Y \\times Z)\n\n1 \\leq A_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq B_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq C_i \\leq 10 \\ 000 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z K\nA_1 \\ A_2 \\ A_3 \\ ... \\ A_X\nB_1 \\ B_2 \\ B_3 \\ ... \\ B_Y\nC_1 \\ C_2 \\ C_3 \\ ... \\ C_Z\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th value stated in the problem statement.\n\nSample Input 1\n\n2 2 2 8\n4 6\n1 5\n3 8\n\nSample Output 1\n\n19\n17\n15\n14\n13\n12\n10\n8\n\nThere are 2 \\times 2 \\times 2 = 8 ways to choose three cakes, as shown below in descending order of the sum of the deliciousness of the cakes:\n\n(A_2, B_2, C_2): 6 + 5 + 8 = 19\n\n(A_1, B_2, C_2): 4 + 5 + 8 = 17\n\n(A_2, B_1, C_2): 6 + 1 + 8 = 15\n\n(A_2, B_2, C_1): 6 + 5 + 3 = 14\n\n(A_1, B_1, C_2): 4 + 1 + 8 = 13\n\n(A_1, B_2, C_1): 4 + 5 + 3 = 12\n\n(A_2, B_1, C_1): 6 + 1 + 3 = 10\n\n(A_1, B_1, C_1): 4 + 1 + 3 = 8\n\nSample Input 2\n\n3 3 3 5\n1 10 100\n2 20 200\n1 10 100\n\nSample Output 2\n\n400\n310\n310\n301\n301\n\nThere may be multiple combinations of cakes with the same sum of the deliciousness. For example, in this test case, the sum of A_1, B_3, C_3 and the sum of A_3, B_3, C_1 are both 301.\nHowever, they are different ways of choosing cakes, so 301 occurs twice in the output.\n\nSample Input 3\n\n10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736\n\nSample Output 3\n\n23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547\n\nNote that the input or output may not fit into a 32-bit integer type.", "sample_input": "2 2 2 8\n4 6\n1 5\n3 8\n"}, "reference_outputs": ["19\n17\n15\n14\n13\n12\n10\n8\n"], "source_document_id": "p03078", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as follows:\n\nThe deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.\n\nThe deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.\n\nThe deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.\n\nTakahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.\n\nThere are X \\times Y \\times Z such ways to choose three cakes.\n\nWe will arrange these X \\times Y \\times Z ways in descending order of the sum of the deliciousness of the cakes.\n\nPrint the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.\n\nConstraints\n\n1 \\leq X \\leq 1 \\ 000\n\n1 \\leq Y \\leq 1 \\ 000\n\n1 \\leq Z \\leq 1 \\ 000\n\n1 \\leq K \\leq \\min(3 \\ 000, X \\times Y \\times Z)\n\n1 \\leq A_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq B_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq C_i \\leq 10 \\ 000 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z K\nA_1 \\ A_2 \\ A_3 \\ ... \\ A_X\nB_1 \\ B_2 \\ B_3 \\ ... \\ B_Y\nC_1 \\ C_2 \\ C_3 \\ ... \\ C_Z\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th value stated in the problem statement.\n\nSample Input 1\n\n2 2 2 8\n4 6\n1 5\n3 8\n\nSample Output 1\n\n19\n17\n15\n14\n13\n12\n10\n8\n\nThere are 2 \\times 2 \\times 2 = 8 ways to choose three cakes, as shown below in descending order of the sum of the deliciousness of the cakes:\n\n(A_2, B_2, C_2): 6 + 5 + 8 = 19\n\n(A_1, B_2, C_2): 4 + 5 + 8 = 17\n\n(A_2, B_1, C_2): 6 + 1 + 8 = 15\n\n(A_2, B_2, C_1): 6 + 5 + 3 = 14\n\n(A_1, B_1, C_2): 4 + 1 + 8 = 13\n\n(A_1, B_2, C_1): 4 + 5 + 3 = 12\n\n(A_2, B_1, C_1): 6 + 1 + 3 = 10\n\n(A_1, B_1, C_1): 4 + 1 + 3 = 8\n\nSample Input 2\n\n3 3 3 5\n1 10 100\n2 20 200\n1 10 100\n\nSample Output 2\n\n400\n310\n310\n301\n301\n\nThere may be multiple combinations of cakes with the same sum of the deliciousness. For example, in this test case, the sum of A_1, B_3, C_3 and the sum of A_3, B_3, C_1 are both 301.\nHowever, they are different ways of choosing cakes, so 301 occurs twice in the output.\n\nSample Input 3\n\n10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736\n\nSample Output 3\n\n23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547\n\nNote that the input or output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1799, "cpu_time_ms": 647, "memory_kb": 31616}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s493517274", "group_id": "codeNet:p03078", "input_text": "program cake_123\n implicit none\n integer :: x, y, z, k, i, j, m, n\n integer(8) :: a(1000), b(1000), c(1000), d(2000000)\n integer :: u, v, w\n a = 0_8\n b = 0_8\n c = 0_8\n d = 0_8\n read(*,*) x, y, z, k\n read(*,*) a(1:x)\n read(*,*) b(1:y)\n read(*,*) c(1:z)\n call merge_sort(x,a(1:x))\n call merge_sort(y,b(1:y))\n call merge_sort(z,c(1:z))\n if (x*y*z.le.1000000) then\n do i = 1, x\n do j = 1, y\n do m = 1, z\n d(y*z*(i-1)+z*(j-1)+m) = a(i)+b(j)+c(m)\n end do\n end do\n end do\n call merge_sort(x*y*z,d(1:x*y*z))\n do i = 1, k\n write(*,'(i0)') d(i)\n end do\n stop\n end if\n u = x/5\n if (u.lt.1) u = x\n v = y/5\n if (v.lt.1) v = y\n w = z/5\n if (w.lt.1) w = z\n do i = 1, u\n do j = 1, v\n do m = 1, w\n d(v*w*(i-1)+w*(j-1)+m) = a(i)+b(j)+c(m)\n end do\n end do\n end do\n call merge_sort(u*v*w,d(1:u*v*w))\n do i = 1, k\n write(*,'(i0)') d(i)\n end do\ncontains\n subroutine merge_sort(n,c)\n implicit none\n integer, intent(in) :: n\n integer(8), intent(inout) :: c(n)\n integer :: num, gth, i, ubnd\n num = n\n gth = 1\n do while (num.gt.1)\n do i = 1, num/2\n ubnd = min(2*i*gth,n)\n call merge(c(2*(i-1)*gth+1:(2*i-1)*gth),c((2*i-1)*gth+1:ubnd))\n end do\n gth = 2*gth\n num = (num+1)/2\n end do\n return\n end subroutine merge_sort\n \n subroutine merge(c1,c2)\n implicit none\n integer(8), intent(inout) :: c1(:), c2(:)\n integer(8) :: c(size(c1)+size(c2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(c1)\n n2 = size(c2)\n do while (i1.le.n1.and.i2.le.n2)\n if (c1(i1).ge.c2(i2)) then\n c(i1+i2-1) = c1(i1)\n i1 = i1+1\n else\n c(i1+i2-1) = c2(i2)\n i2 = i2+1\n end if\n end do\n if (i1.le.n1) then\n c(i1+i2-1:n1+n2) = c1(i1:n1)\n else if (i2.le.n2) then\n c(i1+i2-1:n1+n2) = c2(i2:n2)\n end if\n c1 = c(1:n1)\n c2 = c(n1+1:n1+n2)\n return\n end subroutine merge\nend program cake_123", "language": "Fortran", "metadata": {"date": 1554582111, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03078.html", "problem_id": "p03078", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03078/input.txt", "sample_output_relpath": "derived/input_output/data/p03078/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03078/Fortran/s493517274.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s493517274", "user_id": "u506403362"}, "prompt_components": {"gold_output": "19\n17\n15\n14\n13\n12\n10\n8\n", "input_to_evaluate": "program cake_123\n implicit none\n integer :: x, y, z, k, i, j, m, n\n integer(8) :: a(1000), b(1000), c(1000), d(2000000)\n integer :: u, v, w\n a = 0_8\n b = 0_8\n c = 0_8\n d = 0_8\n read(*,*) x, y, z, k\n read(*,*) a(1:x)\n read(*,*) b(1:y)\n read(*,*) c(1:z)\n call merge_sort(x,a(1:x))\n call merge_sort(y,b(1:y))\n call merge_sort(z,c(1:z))\n if (x*y*z.le.1000000) then\n do i = 1, x\n do j = 1, y\n do m = 1, z\n d(y*z*(i-1)+z*(j-1)+m) = a(i)+b(j)+c(m)\n end do\n end do\n end do\n call merge_sort(x*y*z,d(1:x*y*z))\n do i = 1, k\n write(*,'(i0)') d(i)\n end do\n stop\n end if\n u = x/5\n if (u.lt.1) u = x\n v = y/5\n if (v.lt.1) v = y\n w = z/5\n if (w.lt.1) w = z\n do i = 1, u\n do j = 1, v\n do m = 1, w\n d(v*w*(i-1)+w*(j-1)+m) = a(i)+b(j)+c(m)\n end do\n end do\n end do\n call merge_sort(u*v*w,d(1:u*v*w))\n do i = 1, k\n write(*,'(i0)') d(i)\n end do\ncontains\n subroutine merge_sort(n,c)\n implicit none\n integer, intent(in) :: n\n integer(8), intent(inout) :: c(n)\n integer :: num, gth, i, ubnd\n num = n\n gth = 1\n do while (num.gt.1)\n do i = 1, num/2\n ubnd = min(2*i*gth,n)\n call merge(c(2*(i-1)*gth+1:(2*i-1)*gth),c((2*i-1)*gth+1:ubnd))\n end do\n gth = 2*gth\n num = (num+1)/2\n end do\n return\n end subroutine merge_sort\n \n subroutine merge(c1,c2)\n implicit none\n integer(8), intent(inout) :: c1(:), c2(:)\n integer(8) :: c(size(c1)+size(c2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(c1)\n n2 = size(c2)\n do while (i1.le.n1.and.i2.le.n2)\n if (c1(i1).ge.c2(i2)) then\n c(i1+i2-1) = c1(i1)\n i1 = i1+1\n else\n c(i1+i2-1) = c2(i2)\n i2 = i2+1\n end if\n end do\n if (i1.le.n1) then\n c(i1+i2-1:n1+n2) = c1(i1:n1)\n else if (i2.le.n2) then\n c(i1+i2-1:n1+n2) = c2(i2:n2)\n end if\n c1 = c(1:n1)\n c2 = c(n1+1:n1+n2)\n return\n end subroutine merge\nend program cake_123", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as follows:\n\nThe deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.\n\nThe deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.\n\nThe deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.\n\nTakahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.\n\nThere are X \\times Y \\times Z such ways to choose three cakes.\n\nWe will arrange these X \\times Y \\times Z ways in descending order of the sum of the deliciousness of the cakes.\n\nPrint the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.\n\nConstraints\n\n1 \\leq X \\leq 1 \\ 000\n\n1 \\leq Y \\leq 1 \\ 000\n\n1 \\leq Z \\leq 1 \\ 000\n\n1 \\leq K \\leq \\min(3 \\ 000, X \\times Y \\times Z)\n\n1 \\leq A_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq B_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq C_i \\leq 10 \\ 000 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z K\nA_1 \\ A_2 \\ A_3 \\ ... \\ A_X\nB_1 \\ B_2 \\ B_3 \\ ... \\ B_Y\nC_1 \\ C_2 \\ C_3 \\ ... \\ C_Z\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th value stated in the problem statement.\n\nSample Input 1\n\n2 2 2 8\n4 6\n1 5\n3 8\n\nSample Output 1\n\n19\n17\n15\n14\n13\n12\n10\n8\n\nThere are 2 \\times 2 \\times 2 = 8 ways to choose three cakes, as shown below in descending order of the sum of the deliciousness of the cakes:\n\n(A_2, B_2, C_2): 6 + 5 + 8 = 19\n\n(A_1, B_2, C_2): 4 + 5 + 8 = 17\n\n(A_2, B_1, C_2): 6 + 1 + 8 = 15\n\n(A_2, B_2, C_1): 6 + 5 + 3 = 14\n\n(A_1, B_1, C_2): 4 + 1 + 8 = 13\n\n(A_1, B_2, C_1): 4 + 5 + 3 = 12\n\n(A_2, B_1, C_1): 6 + 1 + 3 = 10\n\n(A_1, B_1, C_1): 4 + 1 + 3 = 8\n\nSample Input 2\n\n3 3 3 5\n1 10 100\n2 20 200\n1 10 100\n\nSample Output 2\n\n400\n310\n310\n301\n301\n\nThere may be multiple combinations of cakes with the same sum of the deliciousness. For example, in this test case, the sum of A_1, B_3, C_3 and the sum of A_3, B_3, C_1 are both 301.\nHowever, they are different ways of choosing cakes, so 301 occurs twice in the output.\n\nSample Input 3\n\n10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736\n\nSample Output 3\n\n23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547\n\nNote that the input or output may not fit into a 32-bit integer type.", "sample_input": "2 2 2 8\n4 6\n1 5\n3 8\n"}, "reference_outputs": ["19\n17\n15\n14\n13\n12\n10\n8\n"], "source_document_id": "p03078", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as follows:\n\nThe deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.\n\nThe deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.\n\nThe deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.\n\nTakahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.\n\nThere are X \\times Y \\times Z such ways to choose three cakes.\n\nWe will arrange these X \\times Y \\times Z ways in descending order of the sum of the deliciousness of the cakes.\n\nPrint the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.\n\nConstraints\n\n1 \\leq X \\leq 1 \\ 000\n\n1 \\leq Y \\leq 1 \\ 000\n\n1 \\leq Z \\leq 1 \\ 000\n\n1 \\leq K \\leq \\min(3 \\ 000, X \\times Y \\times Z)\n\n1 \\leq A_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq B_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq C_i \\leq 10 \\ 000 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z K\nA_1 \\ A_2 \\ A_3 \\ ... \\ A_X\nB_1 \\ B_2 \\ B_3 \\ ... \\ B_Y\nC_1 \\ C_2 \\ C_3 \\ ... \\ C_Z\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th value stated in the problem statement.\n\nSample Input 1\n\n2 2 2 8\n4 6\n1 5\n3 8\n\nSample Output 1\n\n19\n17\n15\n14\n13\n12\n10\n8\n\nThere are 2 \\times 2 \\times 2 = 8 ways to choose three cakes, as shown below in descending order of the sum of the deliciousness of the cakes:\n\n(A_2, B_2, C_2): 6 + 5 + 8 = 19\n\n(A_1, B_2, C_2): 4 + 5 + 8 = 17\n\n(A_2, B_1, C_2): 6 + 1 + 8 = 15\n\n(A_2, B_2, C_1): 6 + 5 + 3 = 14\n\n(A_1, B_1, C_2): 4 + 1 + 8 = 13\n\n(A_1, B_2, C_1): 4 + 5 + 3 = 12\n\n(A_2, B_1, C_1): 6 + 1 + 3 = 10\n\n(A_1, B_1, C_1): 4 + 1 + 3 = 8\n\nSample Input 2\n\n3 3 3 5\n1 10 100\n2 20 200\n1 10 100\n\nSample Output 2\n\n400\n310\n310\n301\n301\n\nThere may be multiple combinations of cakes with the same sum of the deliciousness. For example, in this test case, the sum of A_1, B_3, C_3 and the sum of A_3, B_3, C_1 are both 301.\nHowever, they are different ways of choosing cakes, so 301 occurs twice in the output.\n\nSample Input 3\n\n10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736\n\nSample Output 3\n\n23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547\n\nNote that the input or output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2063, "cpu_time_ms": 114, "memory_kb": 16348}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s379588905", "group_id": "codeNet:p03078", "input_text": "program cake_123\n implicit none\n integer :: x, y, z, k, i, j, m, n\n integer(8) :: a(1000), b(1000), c(1000), d(40000)\n integer :: u, v, w\n a = 0_8\n b = 0_8\n c = 0_8\n d = 0_8\n read(*,*) x, y, z, k\n read(*,*) a(1:x)\n read(*,*) b(1:y)\n read(*,*) c(1:z)\n call merge_sort(x,a(1:x))\n call merge_sort(y,b(1:y))\n call merge_sort(z,c(1:z))\n if (x*y*z.le.40000) then\n do i = 1, x\n do j = 1, y\n do m = 1, z\n d(y*z*(i-1)+z*(j-1)+m) = a(i)+b(j)+c(m)\n end do\n end do\n end do\n call merge_sort(x*y*z,d(1:x*y*z))\n do i = 1, k\n write(*,'(i0)') d(i)\n end do\n stop\n end if\n u = x/30\n if (u.lt.1) u = x\n v = y/30\n if (v.lt.1) v = y\n w = z/30\n if (w.lt.1) w = z\n do i = 1, u\n do j = 1, v\n do m = 1, w\n d(v*w*(i-1)+w*(j-1)+m) = a(i)+b(j)+c(m)\n end do\n end do\n end do\n call merge_sort(u*v*w,d(1:u*v*w))\n do i = 1, k\n write(*,'(i0)') d(i)\n end do\ncontains\n subroutine merge_sort(n,c)\n implicit none\n integer, intent(in) :: n\n integer(8), intent(inout) :: c(n)\n integer :: num, gth, i, ubnd\n num = n\n gth = 1\n do while (num.gt.1)\n do i = 1, num/2\n ubnd = min(2*i*gth,n)\n call merge(c(2*(i-1)*gth+1:(2*i-1)*gth),c((2*i-1)*gth+1:ubnd))\n end do\n gth = 2*gth\n num = (num+1)/2\n end do\n return\n end subroutine merge_sort\n \n subroutine merge(c1,c2)\n implicit none\n integer(8), intent(inout) :: c1(:), c2(:)\n integer(8) :: c(size(c1)+size(c2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(c1)\n n2 = size(c2)\n do while (i1.le.n1.and.i2.le.n2)\n if (c1(i1).ge.c2(i2)) then\n c(i1+i2-1) = c1(i1)\n i1 = i1+1\n else\n c(i1+i2-1) = c2(i2)\n i2 = i2+1\n end if\n end do\n if (i1.le.n1) then\n c(i1+i2-1:n1+n2) = c1(i1:n1)\n else if (i2.le.n2) then\n c(i1+i2-1:n1+n2) = c2(i2:n2)\n end if\n c1 = c(1:n1)\n c2 = c(n1+1:n1+n2)\n return\n end subroutine merge\nend program cake_123", "language": "Fortran", "metadata": {"date": 1554581851, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03078.html", "problem_id": "p03078", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03078/input.txt", "sample_output_relpath": "derived/input_output/data/p03078/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03078/Fortran/s379588905.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s379588905", "user_id": "u506403362"}, "prompt_components": {"gold_output": "19\n17\n15\n14\n13\n12\n10\n8\n", "input_to_evaluate": "program cake_123\n implicit none\n integer :: x, y, z, k, i, j, m, n\n integer(8) :: a(1000), b(1000), c(1000), d(40000)\n integer :: u, v, w\n a = 0_8\n b = 0_8\n c = 0_8\n d = 0_8\n read(*,*) x, y, z, k\n read(*,*) a(1:x)\n read(*,*) b(1:y)\n read(*,*) c(1:z)\n call merge_sort(x,a(1:x))\n call merge_sort(y,b(1:y))\n call merge_sort(z,c(1:z))\n if (x*y*z.le.40000) then\n do i = 1, x\n do j = 1, y\n do m = 1, z\n d(y*z*(i-1)+z*(j-1)+m) = a(i)+b(j)+c(m)\n end do\n end do\n end do\n call merge_sort(x*y*z,d(1:x*y*z))\n do i = 1, k\n write(*,'(i0)') d(i)\n end do\n stop\n end if\n u = x/30\n if (u.lt.1) u = x\n v = y/30\n if (v.lt.1) v = y\n w = z/30\n if (w.lt.1) w = z\n do i = 1, u\n do j = 1, v\n do m = 1, w\n d(v*w*(i-1)+w*(j-1)+m) = a(i)+b(j)+c(m)\n end do\n end do\n end do\n call merge_sort(u*v*w,d(1:u*v*w))\n do i = 1, k\n write(*,'(i0)') d(i)\n end do\ncontains\n subroutine merge_sort(n,c)\n implicit none\n integer, intent(in) :: n\n integer(8), intent(inout) :: c(n)\n integer :: num, gth, i, ubnd\n num = n\n gth = 1\n do while (num.gt.1)\n do i = 1, num/2\n ubnd = min(2*i*gth,n)\n call merge(c(2*(i-1)*gth+1:(2*i-1)*gth),c((2*i-1)*gth+1:ubnd))\n end do\n gth = 2*gth\n num = (num+1)/2\n end do\n return\n end subroutine merge_sort\n \n subroutine merge(c1,c2)\n implicit none\n integer(8), intent(inout) :: c1(:), c2(:)\n integer(8) :: c(size(c1)+size(c2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(c1)\n n2 = size(c2)\n do while (i1.le.n1.and.i2.le.n2)\n if (c1(i1).ge.c2(i2)) then\n c(i1+i2-1) = c1(i1)\n i1 = i1+1\n else\n c(i1+i2-1) = c2(i2)\n i2 = i2+1\n end if\n end do\n if (i1.le.n1) then\n c(i1+i2-1:n1+n2) = c1(i1:n1)\n else if (i2.le.n2) then\n c(i1+i2-1:n1+n2) = c2(i2:n2)\n end if\n c1 = c(1:n1)\n c2 = c(n1+1:n1+n2)\n return\n end subroutine merge\nend program cake_123", "problem_context": "Score: 400 points\n\nProblem Statement\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as follows:\n\nThe deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.\n\nThe deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.\n\nThe deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.\n\nTakahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.\n\nThere are X \\times Y \\times Z such ways to choose three cakes.\n\nWe will arrange these X \\times Y \\times Z ways in descending order of the sum of the deliciousness of the cakes.\n\nPrint the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.\n\nConstraints\n\n1 \\leq X \\leq 1 \\ 000\n\n1 \\leq Y \\leq 1 \\ 000\n\n1 \\leq Z \\leq 1 \\ 000\n\n1 \\leq K \\leq \\min(3 \\ 000, X \\times Y \\times Z)\n\n1 \\leq A_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq B_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq C_i \\leq 10 \\ 000 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z K\nA_1 \\ A_2 \\ A_3 \\ ... \\ A_X\nB_1 \\ B_2 \\ B_3 \\ ... \\ B_Y\nC_1 \\ C_2 \\ C_3 \\ ... \\ C_Z\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th value stated in the problem statement.\n\nSample Input 1\n\n2 2 2 8\n4 6\n1 5\n3 8\n\nSample Output 1\n\n19\n17\n15\n14\n13\n12\n10\n8\n\nThere are 2 \\times 2 \\times 2 = 8 ways to choose three cakes, as shown below in descending order of the sum of the deliciousness of the cakes:\n\n(A_2, B_2, C_2): 6 + 5 + 8 = 19\n\n(A_1, B_2, C_2): 4 + 5 + 8 = 17\n\n(A_2, B_1, C_2): 6 + 1 + 8 = 15\n\n(A_2, B_2, C_1): 6 + 5 + 3 = 14\n\n(A_1, B_1, C_2): 4 + 1 + 8 = 13\n\n(A_1, B_2, C_1): 4 + 5 + 3 = 12\n\n(A_2, B_1, C_1): 6 + 1 + 3 = 10\n\n(A_1, B_1, C_1): 4 + 1 + 3 = 8\n\nSample Input 2\n\n3 3 3 5\n1 10 100\n2 20 200\n1 10 100\n\nSample Output 2\n\n400\n310\n310\n301\n301\n\nThere may be multiple combinations of cakes with the same sum of the deliciousness. For example, in this test case, the sum of A_1, B_3, C_3 and the sum of A_3, B_3, C_1 are both 301.\nHowever, they are different ways of choosing cakes, so 301 occurs twice in the output.\n\nSample Input 3\n\n10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736\n\nSample Output 3\n\n23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547\n\nNote that the input or output may not fit into a 32-bit integer type.", "sample_input": "2 2 2 8\n4 6\n1 5\n3 8\n"}, "reference_outputs": ["19\n17\n15\n14\n13\n12\n10\n8\n"], "source_document_id": "p03078", "source_text": "Score: 400 points\n\nProblem Statement\n\nThe Patisserie AtCoder sells cakes with number-shaped candles.\nThere are X, Y and Z kinds of cakes with 1-shaped, 2-shaped and 3-shaped candles, respectively.\nEach cake has an integer value called deliciousness, as follows:\n\nThe deliciousness of the cakes with 1-shaped candles are A_1, A_2, ..., A_X.\n\nThe deliciousness of the cakes with 2-shaped candles are B_1, B_2, ..., B_Y.\n\nThe deliciousness of the cakes with 3-shaped candles are C_1, C_2, ..., C_Z.\n\nTakahashi decides to buy three cakes, one for each of the three shapes of the candles, to celebrate ABC 123.\n\nThere are X \\times Y \\times Z such ways to choose three cakes.\n\nWe will arrange these X \\times Y \\times Z ways in descending order of the sum of the deliciousness of the cakes.\n\nPrint the sums of the deliciousness of the cakes for the first, second, ..., K-th ways in this list.\n\nConstraints\n\n1 \\leq X \\leq 1 \\ 000\n\n1 \\leq Y \\leq 1 \\ 000\n\n1 \\leq Z \\leq 1 \\ 000\n\n1 \\leq K \\leq \\min(3 \\ 000, X \\times Y \\times Z)\n\n1 \\leq A_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq B_i \\leq 10 \\ 000 \\ 000 \\ 000\n\n1 \\leq C_i \\leq 10 \\ 000 \\ 000 \\ 000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y Z K\nA_1 \\ A_2 \\ A_3 \\ ... \\ A_X\nB_1 \\ B_2 \\ B_3 \\ ... \\ B_Y\nC_1 \\ C_2 \\ C_3 \\ ... \\ C_Z\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th value stated in the problem statement.\n\nSample Input 1\n\n2 2 2 8\n4 6\n1 5\n3 8\n\nSample Output 1\n\n19\n17\n15\n14\n13\n12\n10\n8\n\nThere are 2 \\times 2 \\times 2 = 8 ways to choose three cakes, as shown below in descending order of the sum of the deliciousness of the cakes:\n\n(A_2, B_2, C_2): 6 + 5 + 8 = 19\n\n(A_1, B_2, C_2): 4 + 5 + 8 = 17\n\n(A_2, B_1, C_2): 6 + 1 + 8 = 15\n\n(A_2, B_2, C_1): 6 + 5 + 3 = 14\n\n(A_1, B_1, C_2): 4 + 1 + 8 = 13\n\n(A_1, B_2, C_1): 4 + 5 + 3 = 12\n\n(A_2, B_1, C_1): 6 + 1 + 3 = 10\n\n(A_1, B_1, C_1): 4 + 1 + 3 = 8\n\nSample Input 2\n\n3 3 3 5\n1 10 100\n2 20 200\n1 10 100\n\nSample Output 2\n\n400\n310\n310\n301\n301\n\nThere may be multiple combinations of cakes with the same sum of the deliciousness. For example, in this test case, the sum of A_1, B_3, C_3 and the sum of A_3, B_3, C_1 are both 301.\nHowever, they are different ways of choosing cakes, so 301 occurs twice in the output.\n\nSample Input 3\n\n10 10 10 20\n7467038376 5724769290 292794712 2843504496 3381970101 8402252870 249131806 6310293640 6690322794 6082257488\n1873977926 2576529623 1144842195 1379118507 6003234687 4925540914 3902539811 3326692703 484657758 2877436338\n4975681328 8974383988 2882263257 7690203955 514305523 6679823484 4263279310 585966808 3752282379 620585736\n\nSample Output 3\n\n23379871545\n22444657051\n22302177772\n22095691512\n21667941469\n21366963278\n21287912315\n21279176669\n21160477018\n21085311041\n21059876163\n21017997739\n20703329561\n20702387965\n20590247696\n20383761436\n20343962175\n20254073196\n20210218542\n20150096547\n\nNote that the input or output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2062, "cpu_time_ms": 8, "memory_kb": 1148}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s818262344", "group_id": "codeNet:p03079", "input_text": "program prob39\n implicit none\n integer :: q,w,e\n read(*,*) q,w,e\n if(q==w .and. w==e)then\n write(*,*) 'Yes'\n else\n write(*,*) 'No'\n end if\n\n stop\ncontains\nend program prob39", "language": "Fortran", "metadata": {"date": 1592608811, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03079.html", "problem_id": "p03079", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03079/input.txt", "sample_output_relpath": "derived/input_output/data/p03079/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03079/Fortran/s818262344.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s818262344", "user_id": "u478462004"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program prob39\n implicit none\n integer :: q,w,e\n read(*,*) q,w,e\n if(q==w .and. w==e)then\n write(*,*) 'Yes'\n else\n write(*,*) 'No'\n end if\n\n stop\ncontains\nend program prob39", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\n\nDetermine if there exists an equilateral triangle whose sides have lengths A, B and C.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A,B,C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf there exists an equilateral triangle whose sides have lengths A, B and C, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nThere exists an equilateral triangle whose sides have lengths 2, 2 and 2.\n\nSample Input 2\n\n3 4 5\n\nSample Output 2\n\nNo\n\nThere is no equilateral triangle whose sides have lengths 3, 4 and 5.", "sample_input": "2 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03079", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\n\nDetermine if there exists an equilateral triangle whose sides have lengths A, B and C.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A,B,C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf there exists an equilateral triangle whose sides have lengths A, B and C, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nThere exists an equilateral triangle whose sides have lengths 2, 2 and 2.\n\nSample Input 2\n\n3 4 5\n\nSample Output 2\n\nNo\n\nThere is no equilateral triangle whose sides have lengths 3, 4 and 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 208, "cpu_time_ms": 6, "memory_kb": 2828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s839505314", "group_id": "codeNet:p03079", "input_text": "Integer A,B,C\nread*,A,B,C\nif (A==B.and.B==C)then\n print\"(a)\",\"Yes\"\nelse\n print\"(A)\",\"No\"\nendif\nend", "language": "Fortran", "metadata": {"date": 1553976158, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03079.html", "problem_id": "p03079", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03079/input.txt", "sample_output_relpath": "derived/input_output/data/p03079/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03079/Fortran/s839505314.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s839505314", "user_id": "u598073939"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "Integer A,B,C\nread*,A,B,C\nif (A==B.and.B==C)then\n print\"(a)\",\"Yes\"\nelse\n print\"(A)\",\"No\"\nendif\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\n\nDetermine if there exists an equilateral triangle whose sides have lengths A, B and C.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A,B,C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf there exists an equilateral triangle whose sides have lengths A, B and C, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nThere exists an equilateral triangle whose sides have lengths 2, 2 and 2.\n\nSample Input 2\n\n3 4 5\n\nSample Output 2\n\nNo\n\nThere is no equilateral triangle whose sides have lengths 3, 4 and 5.", "sample_input": "2 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03079", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\n\nDetermine if there exists an equilateral triangle whose sides have lengths A, B and C.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A,B,C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf there exists an equilateral triangle whose sides have lengths A, B and C, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nThere exists an equilateral triangle whose sides have lengths 2, 2 and 2.\n\nSample Input 2\n\n3 4 5\n\nSample Output 2\n\nNo\n\nThere is no equilateral triangle whose sides have lengths 3, 4 and 5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 100, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s481683258", "group_id": "codeNet:p03080", "input_text": "PROGRAM ATCODER\n\nimplicit none\ncharacter(len=100) :: s\ninteger :: i,count=0,n\n\nread*, n,s\n\ndo i = 1, n, 1\n if ( s(i:i) == 'R' ) then\n count = count + 1\n end if\nend do\n\nif ( count > n/2 ) then\n print'(a)', 'Yes' \nelse\n print'(a)', 'No' \nend if\n\ncontains\n!!!!!! サブルーチンは↓\n!!!!!!\n\nEND PROGRAM ATCODER\n", "language": "Fortran", "metadata": {"date": 1553976329, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03080.html", "problem_id": "p03080", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03080/input.txt", "sample_output_relpath": "derived/input_output/data/p03080/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03080/Fortran/s481683258.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s481683258", "user_id": "u454557108"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ncharacter(len=100) :: s\ninteger :: i,count=0,n\n\nread*, n,s\n\ndo i = 1, n, 1\n if ( s(i:i) == 'R' ) then\n count = count + 1\n end if\nend do\n\nif ( count > n/2 ) then\n print'(a)', 'Yes' \nelse\n print'(a)', 'No' \nend if\n\ncontains\n!!!!!! サブルーチンは↓\n!!!!!!\n\nEND PROGRAM ATCODER\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each person wears a red hat or a blue hat.\n\nYou are given a string s representing the colors of the people. Person i wears a red hat if s_i is R, and a blue hat if s_i is B.\n\nDetermine if there are more people wearing a red hat than people wearing a blue hat.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|s| = N\n\ns_i is R or B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nIf there are more people wearing a red hat than there are people wearing a blue hat, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nRRBR\n\nSample Output 1\n\nYes\n\nThere are three people wearing a red hat, and one person wearing a blue hat.\n\nSince there are more people wearing a red hat than people wearing a blue hat, the answer is Yes.\n\nSample Input 2\n\n4\nBRBR\n\nSample Output 2\n\nNo\n\nThere are two people wearing a red hat, and two people wearing a blue hat.\n\nSince there are as many people wearing a red hat as people wearing a blue hat, the answer is No.", "sample_input": "4\nRRBR\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03080", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each person wears a red hat or a blue hat.\n\nYou are given a string s representing the colors of the people. Person i wears a red hat if s_i is R, and a blue hat if s_i is B.\n\nDetermine if there are more people wearing a red hat than people wearing a blue hat.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n|s| = N\n\ns_i is R or B.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nIf there are more people wearing a red hat than there are people wearing a blue hat, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\nRRBR\n\nSample Output 1\n\nYes\n\nThere are three people wearing a red hat, and one person wearing a blue hat.\n\nSince there are more people wearing a red hat than people wearing a blue hat, the answer is Yes.\n\nSample Input 2\n\n4\nBRBR\n\nSample Output 2\n\nNo\n\nThere are two people wearing a red hat, and two people wearing a blue hat.\n\nSince there are as many people wearing a red hat as people wearing a blue hat, the answer is No.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 320, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s145560869", "group_id": "codeNet:p03081", "input_text": "Integer N,Q\nCharacter(1000000) moji\ncharacter(1),Allocatable,Dimension(:)::t,d\ninteger l,r\ninteger mi,ma,md\nread*,N,Q\nallocate(t(Q),d(Q))\n\nread*,moji\n\ndo i=1,Q\n read*,t(i),d(i)\nend do\n!二部探索法、まずは0に落ちるもの\nmi=0!辿り着く\nma=N+1!辿り着かないもの\nDo while(mi+1= c(j))then\n count(i) = count(i) + 1\n end if\n end do\nend do\n\ndo i = 1,q\n read(*,*) l,r\n write(*,'(i0)') count(r) - count(l)\nend do\n\ncontains\n!!!!!! サブルーチンは↓\n!!!!!!\n\nEND PROGRAM ATCODER\n", "language": "Fortran", "metadata": {"date": 1553463254, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Fortran/s364336473.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s364336473", "user_id": "u454557108"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: n,q,i,j,l,r,t,u\ncharacter(len=10**5) :: s,b\ninteger,allocatable :: c(:),count(:)\n\nread(*,*) n,q,s\n\nallocate(c(n/2),count(n))\nc = n+1\ncount = 0\n\nt = 1\ndo i = 1,n/2\n u = index(s(t:),'AC')\n If (u==0) exit\n c(i) = t + u\n t = t + u\nend do\n\ndo i = 2, n\n do j = 1, n/2\n if(i >= c(j))then\n count(i) = count(i) + 1\n end if\n end do\nend do\n\ndo i = 1,q\n read(*,*) l,r\n write(*,'(i0)') count(r) - count(l)\nend do\n\ncontains\n!!!!!! サブルーチンは↓\n!!!!!!\n\nEND PROGRAM ATCODER\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 535, "cpu_time_ms": 2103, "memory_kb": 1188}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s943472866", "group_id": "codeNet:p03087", "input_text": "implicit none\n\ninteger n,q,i,left,right,j,l,r,k\ncharacter(:),allocatable:: s\ninteger,allocatable,dimension(:) ::counts\ninteger ::cnt=0\n\nread(5,*)n,q\nallocate(character(n)::s)\nallocate(counts(n))\ncounts(:)=0\n\nread(5,*)s\n\ndo k=1,n-1\nif(s(k:k+1)==\"AC\") then\ncounts(k)=1\ncounts(k+1)=2\nendif\nenddo\n\ndo i=1,q\nread(5,*)l,r\ndo j=l,r-1\n\nif(counts(j)==1 .and. counts(j+1)==2) then\ncnt=cnt+1\nendif\n\n\nenddo\nwrite(6,*)cnt\ncnt=0\nenddo\n\n\ndeallocate(counts)\ndeallocate(s)\nend", "language": "Fortran", "metadata": {"date": 1553463131, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Fortran/s943472866.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s943472866", "user_id": "u093744128"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "implicit none\n\ninteger n,q,i,left,right,j,l,r,k\ncharacter(:),allocatable:: s\ninteger,allocatable,dimension(:) ::counts\ninteger ::cnt=0\n\nread(5,*)n,q\nallocate(character(n)::s)\nallocate(counts(n))\ncounts(:)=0\n\nread(5,*)s\n\ndo k=1,n-1\nif(s(k:k+1)==\"AC\") then\ncounts(k)=1\ncounts(k+1)=2\nendif\nenddo\n\ndo i=1,q\nread(5,*)l,r\ndo j=l,r-1\n\nif(counts(j)==1 .and. counts(j+1)==2) then\ncnt=cnt+1\nendif\n\n\nenddo\nwrite(6,*)cnt\ncnt=0\nenddo\n\n\ndeallocate(counts)\ndeallocate(s)\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 459, "cpu_time_ms": 2103, "memory_kb": 2280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s800451225", "group_id": "codeNet:p03087", "input_text": "program atgc3\n implicit none\n character(len=100000) :: S\n integer :: i,j,N,Q,CountAC,sita,ue\n integer,allocatable :: LR(:,:)\n integer,allocatable :: Flags(:)\n read(*,*) N,Q\n allocate(LR(2,Q))\n read(*,*) S\n !write(*,*) trim(S) \n allocate(Flags(N))\n Flags=0\n\n !write(*,*) Flags \n sita=N\n ue=1\n do i=1,Q\n read(*,*) LR(:,i)\n if(sita.gt.LR(1,i)) then\n sita=LR(1,i)\n endif\n if(ue.lt.LR(2,i)) then\n ue=LR(2,i)\n endif\n enddo\n do i=sita,ue\n if(S(i:i+1).eq.'AC') then\n Flags(i)=1\n endif\n enddo\n\n do i=1,Q\n CountAC=sum(Flags(LR(1,i):LR(2,i)-1))\n write(*,'(i0)') CountAC\n enddo\n\n deallocate(LR)\n deallocate(Flags)\n\n\nend program atgc3", "language": "Fortran", "metadata": {"date": 1553462480, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Fortran/s800451225.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s800451225", "user_id": "u613124399"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "program atgc3\n implicit none\n character(len=100000) :: S\n integer :: i,j,N,Q,CountAC,sita,ue\n integer,allocatable :: LR(:,:)\n integer,allocatable :: Flags(:)\n read(*,*) N,Q\n allocate(LR(2,Q))\n read(*,*) S\n !write(*,*) trim(S) \n allocate(Flags(N))\n Flags=0\n\n !write(*,*) Flags \n sita=N\n ue=1\n do i=1,Q\n read(*,*) LR(:,i)\n if(sita.gt.LR(1,i)) then\n sita=LR(1,i)\n endif\n if(ue.lt.LR(2,i)) then\n ue=LR(2,i)\n endif\n enddo\n do i=sita,ue\n if(S(i:i+1).eq.'AC') then\n Flags(i)=1\n endif\n enddo\n\n do i=1,Q\n CountAC=sum(Flags(LR(1,i):LR(2,i)-1))\n write(*,'(i0)') CountAC\n enddo\n\n deallocate(LR)\n deallocate(Flags)\n\n\nend program atgc3", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1110, "cpu_time_ms": 2103, "memory_kb": 2212}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s274073955", "group_id": "codeNet:p03087", "input_text": "program atgc3\n implicit none\n character(len=10000) :: S\n integer :: i,j,N,Q,CountAC\n integer,allocatable :: LR(:,:)\n\n read(*,*) N,Q\n allocate(LR(2,Q))\n read(*,*) S\n do i=1,Q\n read(*,*) LR(:,i)\n enddo\n do i=1,Q\n CountAC=0\n! write(*,*) LR(:,i) \n do j=LR(1,i),LR(2,i)-1\n! write(*,*) S(j:j+1)!,j,Q \n if(S(j:j+1).eq.'AC') then\n CountAC=CountAC+1\n endif\n ! \n enddo\n write(*,'(i0)') CountAC\n enddo\n\n deallocate(LR)\n\n\n\nend program atgc3\n\n", "language": "Fortran", "metadata": {"date": 1553460612, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Fortran/s274073955.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s274073955", "user_id": "u613124399"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "program atgc3\n implicit none\n character(len=10000) :: S\n integer :: i,j,N,Q,CountAC\n integer,allocatable :: LR(:,:)\n\n read(*,*) N,Q\n allocate(LR(2,Q))\n read(*,*) S\n do i=1,Q\n read(*,*) LR(:,i)\n enddo\n do i=1,Q\n CountAC=0\n! write(*,*) LR(:,i) \n do j=LR(1,i),LR(2,i)-1\n! write(*,*) S(j:j+1)!,j,Q \n if(S(j:j+1).eq.'AC') then\n CountAC=CountAC+1\n endif\n ! \n enddo\n write(*,'(i0)') CountAC\n enddo\n\n deallocate(LR)\n\n\n\nend program atgc3\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 903, "cpu_time_ms": 215, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s444993407", "group_id": "codeNet:p03087", "input_text": "program main\nimplicit none\ninteger :: n,q,l,r\ncharacter(len=10**5) :: s\ninteger :: i,j,nc\n\nread(*,*) n,q\nread(*,*) s(1:n)\ndo i = 1, q\n read(*,*) l,r\n \n nc = 0\n do j = l, r-1\n if (s(j:j+1) =='AC')then\n nc = nc+1\n end if\n end do\n write(*,'(i0)') nc\n\nend do\n\n\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1553460262, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Fortran/s444993407.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s444993407", "user_id": "u696547932"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: n,q,l,r\ncharacter(len=10**5) :: s\ninteger :: i,j,nc\n\nread(*,*) n,q\nread(*,*) s(1:n)\ndo i = 1, q\n read(*,*) l,r\n \n nc = 0\n do j = l, r-1\n if (s(j:j+1) =='AC')then\n nc = nc+1\n end if\n end do\n write(*,'(i0)') nc\n\nend do\n\n\n\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 305, "cpu_time_ms": 2107, "memory_kb": 700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s652329670", "group_id": "codeNet:p03087", "input_text": "INTEGER N,Q\nCHARACTER(100000) S\nINTEGER L,R\nINTEGER CNT\nREAD*,N,Q\nREAD*,S\nDO I=1,Q\n CNT=0\n READ*,L,R\n DO\n IF(INDEX(S(L:R),\"AC\")==0)EXIT\n L=L+INDEX(S(L:R),\"AC\")\n CNT=CNT+1\n CYCLE\n END DO\n PRINT\"(I0)\",CNT\nEND DO\nEND", "language": "Fortran", "metadata": {"date": 1553460141, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03087.html", "problem_id": "p03087", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03087/input.txt", "sample_output_relpath": "derived/input_output/data/p03087/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03087/Fortran/s652329670.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s652329670", "user_id": "u598073939"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "INTEGER N,Q\nCHARACTER(100000) S\nINTEGER L,R\nINTEGER CNT\nREAD*,N,Q\nREAD*,S\nDO I=1,Q\n CNT=0\n READ*,L,R\n DO\n IF(INDEX(S(L:R),\"AC\")==0)EXIT\n L=L+INDEX(S(L:R),\"AC\")\n CNT=CNT+1\n CYCLE\n END DO\n PRINT\"(I0)\",CNT\nEND DO\nEND", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "sample_input": "8 3\nACACTACG\n3 7\n2 3\n1 8\n"}, "reference_outputs": ["2\n0\n3\n"], "source_document_id": "p03087", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, C, G and T. Answer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): You will be given integers l_i and r_i (1 \\leq l_i < r_i \\leq N). Consider the substring of S starting at index l_i and ending at index r_i (both inclusive). In this string, how many times does AC occurs as a substring?\n\nNotes\n\nA substring of a string T is a string obtained by removing zero or more characters from the beginning and the end of T.\n\nFor example, the substrings of ATCODER include TCO, AT, CODER, ATCODER and (the empty string), but not AC.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\nS is a string of length N.\n\nEach character in S is A, C, G or T.\n\n1 \\leq l_i < r_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nS\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the answer to the i-th query.\n\nSample Input 1\n\n8 3\nACACTACG\n3 7\n2 3\n1 8\n\nSample Output 1\n\n2\n0\n3\n\nQuery 1: the substring of S starting at index 3 and ending at index 7 is ACTAC. In this string, AC occurs twice as a substring.\n\nQuery 2: the substring of S starting at index 2 and ending at index 3 is CA. In this string, AC occurs zero times as a substring.\n\nQuery 3: the substring of S starting at index 1 and ending at index 8 is ACACTACG. In this string, AC occurs three times as a substring.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 230, "cpu_time_ms": 2103, "memory_kb": 700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s676678697", "group_id": "codeNet:p03089", "input_text": "program main\n implicit none\n integer :: n, i\n integer, allocatable :: b(:), res(:)\n\n read (*, *) n\n allocate (b(n), res(n))\n read (*, *) b(:)\n\n do i = 1, n\n if (b(i) > i) then\n write (*, \"(i0)\") -1\n stop\n end if\n end do\n\n do i = 1, n\n call remove(b, res(n - i + 1))\n end do\n\n do i = 1, n\n write (*, \"(i0)\") res(i)\n end do\n\n contains\n\n subroutine remove(b, ret)\n integer, allocatable, intent(inout) :: b(:)\n integer, intent(out) :: ret\n integer :: n, i, c(size(b))\n n = size(b)\n c = [(b(i) - i, i = 1, n)]\n loop: block\n do i = n, 1, -1\n if (c(i) == 0) exit loop\n end do\n stop 1\n end block loop\n ret = b(i)\n b = [b(:i - 1), b(i + 1:)]\n end subroutine remove\nend program main\n", "language": "Fortran", "metadata": {"date": 1553390987, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03089.html", "problem_id": "p03089", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03089/input.txt", "sample_output_relpath": "derived/input_output/data/p03089/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03089/Fortran/s676678697.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s676678697", "user_id": "u388927326"}, "prompt_components": {"gold_output": "1\n1\n2\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, i\n integer, allocatable :: b(:), res(:)\n\n read (*, *) n\n allocate (b(n), res(n))\n read (*, *) b(:)\n\n do i = 1, n\n if (b(i) > i) then\n write (*, \"(i0)\") -1\n stop\n end if\n end do\n\n do i = 1, n\n call remove(b, res(n - i + 1))\n end do\n\n do i = 1, n\n write (*, \"(i0)\") res(i)\n end do\n\n contains\n\n subroutine remove(b, ret)\n integer, allocatable, intent(inout) :: b(:)\n integer, intent(out) :: ret\n integer :: n, i, c(size(b))\n n = size(b)\n c = [(b(i) - i, i = 1, n)]\n loop: block\n do i = n, 1, -1\n if (c(i) == 0) exit loop\n end do\n stop 1\n end block loop\n ret = b(i)\n b = [b(:i - 1), b(i + 1:)]\n end subroutine remove\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has an empty sequence a.\n\nHe will perform N operations on this sequence.\n\nIn the i-th operation, he chooses an integer j satisfying 1 \\leq j \\leq i, and insert j at position j in a (the beginning is position 1).\n\nYou are given a sequence b of length N. Determine if it is possible that a is equal to b after N operations. If it is, show one possible sequence of operations that achieves it.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq b_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nb_1 \\dots b_N\n\nOutput\n\nIf there is no sequence of N operations after which a would be equal to b, print -1.\nIf there is, print N lines. In the i-th line, the integer chosen in the i-th operation should be printed. If there are multiple solutions, any of them is accepted.\n\nSample Input 1\n\n3\n1 2 1\n\nSample Output 1\n\n1\n1\n2\n\nIn this sequence of operations, the sequence a changes as follows:\n\nAfter the first operation: (1)\n\nAfter the second operation: (1,1)\n\nAfter the third operation: (1,2,1)\n\nSample Input 2\n\n2\n2 2\n\nSample Output 2\n\n-1\n\n2 cannot be inserted at the beginning of the sequence, so this is impossible.\n\nSample Input 3\n\n9\n1 1 1 2 2 1 2 3 2\n\nSample Output 3\n\n1\n2\n2\n3\n1\n2\n2\n1\n1", "sample_input": "3\n1 2 1\n"}, "reference_outputs": ["1\n1\n2\n"], "source_document_id": "p03089", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has an empty sequence a.\n\nHe will perform N operations on this sequence.\n\nIn the i-th operation, he chooses an integer j satisfying 1 \\leq j \\leq i, and insert j at position j in a (the beginning is position 1).\n\nYou are given a sequence b of length N. Determine if it is possible that a is equal to b after N operations. If it is, show one possible sequence of operations that achieves it.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq b_i \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nb_1 \\dots b_N\n\nOutput\n\nIf there is no sequence of N operations after which a would be equal to b, print -1.\nIf there is, print N lines. In the i-th line, the integer chosen in the i-th operation should be printed. If there are multiple solutions, any of them is accepted.\n\nSample Input 1\n\n3\n1 2 1\n\nSample Output 1\n\n1\n1\n2\n\nIn this sequence of operations, the sequence a changes as follows:\n\nAfter the first operation: (1)\n\nAfter the second operation: (1,1)\n\nAfter the third operation: (1,2,1)\n\nSample Input 2\n\n2\n2 2\n\nSample Output 2\n\n-1\n\n2 cannot be inserted at the beginning of the sequence, so this is impossible.\n\nSample Input 3\n\n9\n1 1 1 2 2 1 2 3 2\n\nSample Output 3\n\n1\n2\n2\n3\n1\n2\n2\n1\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 759, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s814710580", "group_id": "codeNet:p03095", "input_text": "program main\n implicit none\n integer(8):: n,han(97:122)=0,i,ans=1\n character(100000)::s\n read(*,*)n\n read(*,*)s\n do i=1,n\n han(iachar(s(i:i)))=han(iachar(s(i:i)))+1\n enddo\n do i=97,122\n ans=mod(ans*(han(i)+1),10**9+7)\n enddo\n ans=ans-1\n write(*,*)ans\nend program main\n", "language": "Fortran", "metadata": {"date": 1552823824, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03095.html", "problem_id": "p03095", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03095/input.txt", "sample_output_relpath": "derived/input_output/data/p03095/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03095/Fortran/s814710580.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s814710580", "user_id": "u539011156"}, "prompt_components": {"gold_output": "15\n", "input_to_evaluate": "program main\n implicit none\n integer(8):: n,han(97:122)=0,i,ans=1\n character(100000)::s\n read(*,*)n\n read(*,*)s\n do i=1,n\n han(iachar(s(i:i)))=han(iachar(s(i:i)))+1\n enddo\n do i=97,122\n ans=mod(ans*(han(i)+1),10**9+7)\n enddo\n ans=ans-1\n write(*,*)ans\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N.\nAmong its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings.\n\nHere, a subsequence of a string is a concatenation of one or more characters from the string without changing the order.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nS consists of lowercase English letters.\n\n|S|=N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of the subsequences such that all characters are different, modulo 10^9+7.\n\nSample Input 1\n\n4\nabcd\n\nSample Output 1\n\n15\n\nSince all characters in S itself are different, all its subsequences satisfy the condition.\n\nSample Input 2\n\n3\nbaa\n\nSample Output 2\n\n5\n\nThe answer is five: b, two occurrences of a, two occurrences of ba. Note that we do not count baa, since it contains two as.\n\nSample Input 3\n\n5\nabcab\n\nSample Output 3\n\n17", "sample_input": "4\nabcd\n"}, "reference_outputs": ["15\n"], "source_document_id": "p03095", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N.\nAmong its subsequences, count the ones such that all characters are different, modulo 10^9+7. Two subsequences are considered different if their characters come from different positions in the string, even if they are the same as strings.\n\nHere, a subsequence of a string is a concatenation of one or more characters from the string without changing the order.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nS consists of lowercase English letters.\n\n|S|=N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of the subsequences such that all characters are different, modulo 10^9+7.\n\nSample Input 1\n\n4\nabcd\n\nSample Output 1\n\n15\n\nSince all characters in S itself are different, all its subsequences satisfy the condition.\n\nSample Input 2\n\n3\nbaa\n\nSample Output 2\n\n5\n\nThe answer is five: b, two occurrences of a, two occurrences of ba. Note that we do not count baa, since it contains two as.\n\nSample Input 3\n\n5\nabcab\n\nSample Output 3\n\n17", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 300, "cpu_time_ms": 3, "memory_kb": 700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s366941525", "group_id": "codeNet:p03097", "input_text": "program differ_by_1_bit\n implicit none\n integer :: n, a, b, i, m, p(0:131071) = 0\n read(*,*) n, a, b\n if (mod(popcnt(a),2) == mod(popcnt(b),2)) then\n write(*,'(a)') \"NO\"\n stop\n end if\n m = lshift(1,n)-1\n p(0:m) = compose(n,a,b)\n write(*,'(a)') \"YES\"\n write(*,'(i0)',advance='no') p(0)\n do i = 1, m\n write(*,'(x,i0)',advance='no') p(i)\n end do\n write(*,*)\n stop\ncontains\n recursive function compose(n,a,b) result(p)\n implicit none\n integer, intent(in) :: n, a, b\n integer :: s, t, x = 0, y = 0, c = 0, i, j, k\n integer :: p(0:lshift(1,n)-1), q(0:lshift(1,n-1)-1), r(0:lshift(1,n-1)-1)\n p = 0\n if (n == 1) then\n p(0:1) = (/a,b/)\n return\n end if\n s = lshift(1,n-1)-1\n t = lshift(1,n)-1\n do i = 0, n-1\n if (btest(a,i) .eqv. btest(b,i)) cycle\n do j = 0, i-1\n if (btest(a,j)) x = ibset(x,j)\n if (btest(b,j)) y = ibset(y,j)\n end do\n k = i\n do j = i+1, n-1\n if (btest(a,j)) x = ibset(x,j-1)\n if (btest(b,j)) y = ibset(y,j-1)\n end do\n c = ibset(x,0)\n if (btest(x,0)) c = ibclr(x,0)\n exit\n end do\n q = compose(n-1,x,c)\n r = compose(n-1,c,y)\n do i = 0, s\n do j = 0, k-1\n if (btest(q(i),j)) p(i) = ibset(p(i),j)\n if (btest(r(i),j)) p(i+s+1) = ibset(p(i+s+1),j)\n end do\n if (btest(a,k)) p(i) = ibset(p(i),k)\n if (btest(b,k)) p(i+s+1) = ibset(p(i+s+1),k)\n do j = k+1, n-1\n if (btest(q(i),j-1)) p(i) = ibset(p(i),j)\n if (btest(r(i),j-1)) p(i+s+1) = ibset(p(i+s+1),j)\n end do\n end do\n return\n end function compose\nend program differ_by_1_bit", "language": "Fortran", "metadata": {"date": 1565131873, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03097.html", "problem_id": "p03097", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03097/input.txt", "sample_output_relpath": "derived/input_output/data/p03097/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03097/Fortran/s366941525.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s366941525", "user_id": "u506403362"}, "prompt_components": {"gold_output": "YES\n1 0 2 3\n", "input_to_evaluate": "program differ_by_1_bit\n implicit none\n integer :: n, a, b, i, m, p(0:131071) = 0\n read(*,*) n, a, b\n if (mod(popcnt(a),2) == mod(popcnt(b),2)) then\n write(*,'(a)') \"NO\"\n stop\n end if\n m = lshift(1,n)-1\n p(0:m) = compose(n,a,b)\n write(*,'(a)') \"YES\"\n write(*,'(i0)',advance='no') p(0)\n do i = 1, m\n write(*,'(x,i0)',advance='no') p(i)\n end do\n write(*,*)\n stop\ncontains\n recursive function compose(n,a,b) result(p)\n implicit none\n integer, intent(in) :: n, a, b\n integer :: s, t, x = 0, y = 0, c = 0, i, j, k\n integer :: p(0:lshift(1,n)-1), q(0:lshift(1,n-1)-1), r(0:lshift(1,n-1)-1)\n p = 0\n if (n == 1) then\n p(0:1) = (/a,b/)\n return\n end if\n s = lshift(1,n-1)-1\n t = lshift(1,n)-1\n do i = 0, n-1\n if (btest(a,i) .eqv. btest(b,i)) cycle\n do j = 0, i-1\n if (btest(a,j)) x = ibset(x,j)\n if (btest(b,j)) y = ibset(y,j)\n end do\n k = i\n do j = i+1, n-1\n if (btest(a,j)) x = ibset(x,j-1)\n if (btest(b,j)) y = ibset(y,j-1)\n end do\n c = ibset(x,0)\n if (btest(x,0)) c = ibclr(x,0)\n exit\n end do\n q = compose(n-1,x,c)\n r = compose(n-1,c,y)\n do i = 0, s\n do j = 0, k-1\n if (btest(q(i),j)) p(i) = ibset(p(i),j)\n if (btest(r(i),j)) p(i+s+1) = ibset(p(i+s+1),j)\n end do\n if (btest(a,k)) p(i) = ibset(p(i),k)\n if (btest(b,k)) p(i+s+1) = ibset(p(i+s+1),k)\n do j = k+1, n-1\n if (btest(q(i),j-1)) p(i) = ibset(p(i),j)\n if (btest(r(i),j-1)) p(i+s+1) = ibset(p(i+s+1),j)\n end do\n end do\n return\n end function compose\nend program differ_by_1_bit", "problem_context": "Score : 800 points\n\nProblem Statement\n\nYou are given integers N,\\ A and B.\nDetermine if there exists a permutation (P_0,\\ P_1,\\ ...\\ P_{2^N-1}) of (0,\\ 1,\\ ...\\ 2^N-1) that satisfies all of the following conditions, and create one such permutation if it exists.\n\nP_0=A\n\nP_{2^N-1}=B\n\nFor all 0 \\leq i < 2^N-1, the binary representations of P_i and P_{i+1} differ by exactly one bit.\n\nConstraints\n\n1 \\leq N \\leq 17\n\n0 \\leq A \\leq 2^N-1\n\n0 \\leq B \\leq 2^N-1\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nIf there is no permutation that satisfies the conditions, print NO.\n\nIf there is such a permutation, print YES in the first line.\nThen, print (P_0,\\ P_1,\\ ...\\ P_{2^N-1}) in the second line, with spaces in between.\nIf there are multiple solutions, any of them is accepted.\n\nSample Input 1\n\n2 1 3\n\nSample Output 1\n\nYES\n1 0 2 3\n\nThe binary representation of P=(1,0,2,3) is (01,00,10,11), where any two adjacent elements differ by exactly one bit.\n\nSample Input 2\n\n3 2 1\n\nSample Output 2\n\nNO", "sample_input": "2 1 3\n"}, "reference_outputs": ["YES\n1 0 2 3\n"], "source_document_id": "p03097", "source_text": "Score : 800 points\n\nProblem Statement\n\nYou are given integers N,\\ A and B.\nDetermine if there exists a permutation (P_0,\\ P_1,\\ ...\\ P_{2^N-1}) of (0,\\ 1,\\ ...\\ 2^N-1) that satisfies all of the following conditions, and create one such permutation if it exists.\n\nP_0=A\n\nP_{2^N-1}=B\n\nFor all 0 \\leq i < 2^N-1, the binary representations of P_i and P_{i+1} differ by exactly one bit.\n\nConstraints\n\n1 \\leq N \\leq 17\n\n0 \\leq A \\leq 2^N-1\n\n0 \\leq B \\leq 2^N-1\n\nA \\neq B\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B\n\nOutput\n\nIf there is no permutation that satisfies the conditions, print NO.\n\nIf there is such a permutation, print YES in the first line.\nThen, print (P_0,\\ P_1,\\ ...\\ P_{2^N-1}) in the second line, with spaces in between.\nIf there are multiple solutions, any of them is accepted.\n\nSample Input 1\n\n2 1 3\n\nSample Output 1\n\nYES\n1 0 2 3\n\nThe binary representation of P=(1,0,2,3) is (01,00,10,11), where any two adjacent elements differ by exactly one bit.\n\nSample Input 2\n\n3 2 1\n\nSample Output 2\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1638, "cpu_time_ms": 108, "memory_kb": 1784}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s250365201", "group_id": "codeNet:p03098", "input_text": "program a_sequence_of_permutations\n implicit none\n integer :: n, k, p(100000) = 0, q(100000) = 0, r(100000,2) = 0, i\n read(*,*) n, k\n read(*,*) p(1:n)\n read(*,*) q(1:n)\n if (k == 1) then\n call output(p(1:n))\n stop\n end if\n r(1:n,2) = q(1:n)\n do i = 3, k\n r(1:n,1) = p(1:n)\n call quick_sort(r(1:n,:),1)\n p(1:n) = q(1:n)\n q(1:n) = r(1:n,2)\n end do\n call output(q(1:n))\ncontains\n subroutine output(a)\n integer, intent(in) :: a(:)\n integer :: n, i\n n = size(a)\n write(*,'(i0)',advance='no') a(1)\n do i = 2, n\n write(*,'(x,i0)',advance='no') a(i)\n end do\n write(*,*)\n end\n recursive subroutine quick_sort(a,i)\n integer, intent(inout) :: a(:,:)\n integer, intent(in) :: i\n integer :: n, l, r, m\n integer :: p, b(size(a,2))\n n = size(a,1)\n l = 1\n r = n\n m = (l+r)/2\n p = a(m,i)+a(l,i)+a(r,i)-max(a(m,i),a(l,i),a(r,i))-min(a(m,i),a(l,i),a(r,i))\n do\n do while (a(l,i) < p)\n l = l+1\n end do\n do while (a(r,i) > p)\n r = r-1\n end do\n if (l >= r) exit\n b = a(l,:)\n a(l,:) = a(r,:)\n a(r,:) = b\n l = l+1\n r = r-1\n end do\n if (1 < l-1) call quick_sort(a(1:l-1,:),i)\n if (r+1 < n) call quick_sort(a(r+1:n,:),i)\n end\nend program a_sequence_of_permutations", "language": "Fortran", "metadata": {"date": 1568509335, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03098.html", "problem_id": "p03098", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03098/input.txt", "sample_output_relpath": "derived/input_output/data/p03098/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03098/Fortran/s250365201.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s250365201", "user_id": "u506403362"}, "prompt_components": {"gold_output": "3 2 1\n", "input_to_evaluate": "program a_sequence_of_permutations\n implicit none\n integer :: n, k, p(100000) = 0, q(100000) = 0, r(100000,2) = 0, i\n read(*,*) n, k\n read(*,*) p(1:n)\n read(*,*) q(1:n)\n if (k == 1) then\n call output(p(1:n))\n stop\n end if\n r(1:n,2) = q(1:n)\n do i = 3, k\n r(1:n,1) = p(1:n)\n call quick_sort(r(1:n,:),1)\n p(1:n) = q(1:n)\n q(1:n) = r(1:n,2)\n end do\n call output(q(1:n))\ncontains\n subroutine output(a)\n integer, intent(in) :: a(:)\n integer :: n, i\n n = size(a)\n write(*,'(i0)',advance='no') a(1)\n do i = 2, n\n write(*,'(x,i0)',advance='no') a(i)\n end do\n write(*,*)\n end\n recursive subroutine quick_sort(a,i)\n integer, intent(inout) :: a(:,:)\n integer, intent(in) :: i\n integer :: n, l, r, m\n integer :: p, b(size(a,2))\n n = size(a,1)\n l = 1\n r = n\n m = (l+r)/2\n p = a(m,i)+a(l,i)+a(r,i)-max(a(m,i),a(l,i),a(r,i))-min(a(m,i),a(l,i),a(r,i))\n do\n do while (a(l,i) < p)\n l = l+1\n end do\n do while (a(r,i) > p)\n r = r-1\n end do\n if (l >= r) exit\n b = a(l,:)\n a(l,:) = a(r,:)\n a(r,:) = b\n l = l+1\n r = r-1\n end do\n if (1 < l-1) call quick_sort(a(1:l-1,:),i)\n if (r+1 < n) call quick_sort(a(r+1:n,:),i)\n end\nend program a_sequence_of_permutations", "problem_context": "Score : 1000 points\n\nProblem Statement\n\nFor two permutations p and q of the integers from 1 through N, let f(p,q) be the permutation that satisfies the following:\n\nThe p_i-th element (1 \\leq i \\leq N) in f(p,q) is q_i.\nHere, p_i and q_i respectively denote the i-th element in p and q.\n\nYou are given two permutations p and q of the integers from 1 through N.\nWe will now define a sequence {a_n} of permutations of the integers from 1 through N, as follows:\n\na_1=p, a_2=q\n\na_{n+2}=f(a_n,a_{n+1}) ( n \\geq 1 )\n\nGiven a positive integer K, find a_K.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\np and q are permutations of the integers from 1 through N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\nq_1 ... q_N\n\nOutput\n\nPrint N integers, with spaces in between.\nThe i-th integer (1 \\leq i \\leq N) should be the i-th element in a_K.\n\nSample Input 1\n\n3 3\n1 2 3\n3 2 1\n\nSample Output 1\n\n3 2 1\n\nSince a_3=f(p,q), we just need to find f(p,q).\nWe have p_i=i here, so f(p,q)=q.\n\nSample Input 2\n\n5 5\n4 5 1 2 3\n3 2 1 5 4\n\nSample Output 2\n\n4 3 2 1 5\n\nSample Input 3\n\n10 1000000000\n7 10 6 5 4 2 9 1 3 8\n4 1 9 2 3 7 8 10 6 5\n\nSample Output 3\n\n7 9 4 8 2 5 1 6 10 3", "sample_input": "3 3\n1 2 3\n3 2 1\n"}, "reference_outputs": ["3 2 1\n"], "source_document_id": "p03098", "source_text": "Score : 1000 points\n\nProblem Statement\n\nFor two permutations p and q of the integers from 1 through N, let f(p,q) be the permutation that satisfies the following:\n\nThe p_i-th element (1 \\leq i \\leq N) in f(p,q) is q_i.\nHere, p_i and q_i respectively denote the i-th element in p and q.\n\nYou are given two permutations p and q of the integers from 1 through N.\nWe will now define a sequence {a_n} of permutations of the integers from 1 through N, as follows:\n\na_1=p, a_2=q\n\na_{n+2}=f(a_n,a_{n+1}) ( n \\geq 1 )\n\nGiven a positive integer K, find a_K.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq 10^9\n\np and q are permutations of the integers from 1 through N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\np_1 ... p_N\nq_1 ... q_N\n\nOutput\n\nPrint N integers, with spaces in between.\nThe i-th integer (1 \\leq i \\leq N) should be the i-th element in a_K.\n\nSample Input 1\n\n3 3\n1 2 3\n3 2 1\n\nSample Output 1\n\n3 2 1\n\nSince a_3=f(p,q), we just need to find f(p,q).\nWe have p_i=i here, so f(p,q)=q.\n\nSample Input 2\n\n5 5\n4 5 1 2 3\n3 2 1 5 4\n\nSample Output 2\n\n4 3 2 1 5\n\nSample Input 3\n\n10 1000000000\n7 10 6 5 4 2 9 1 3 8\n4 1 9 2 3 7 8 10 6 5\n\nSample Output 3\n\n7 9 4 8 2 5 1 6 10 3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1298, "cpu_time_ms": 2103, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s138387346", "group_id": "codeNet:p03101", "input_text": "read*,i,j,k,l;print*,(i-k)*(j-l);end", "language": "Fortran", "metadata": {"date": 1552172105, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03101.html", "problem_id": "p03101", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03101/input.txt", "sample_output_relpath": "derived/input_output/data/p03101/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03101/Fortran/s138387346.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s138387346", "user_id": "u394482932"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "read*,i,j,k,l;print*,(i-k)*(j-l);end", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are H rows and W columns of white square cells.\n\nYou will choose h of the rows and w of the columns, and paint all of the cells contained in those rows or columns.\n\nHow many white cells will remain?\n\nIt can be proved that this count does not depend on what rows and columns are chosen.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 20\n\n1 \\leq h \\leq H\n\n1 \\leq w \\leq W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nh w\n\nOutput\n\nPrint the number of white cells that will remain.\n\nSample Input 1\n\n3 2\n2 1\n\nSample Output 1\n\n1\n\nThere are 3 rows and 2 columns of cells. When two rows and one column are chosen and painted in black, there is always one white cell that remains.\n\nSample Input 2\n\n5 5\n2 3\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2 4\n2 4\n\nSample Output 3\n\n0", "sample_input": "3 2\n2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03101", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are H rows and W columns of white square cells.\n\nYou will choose h of the rows and w of the columns, and paint all of the cells contained in those rows or columns.\n\nHow many white cells will remain?\n\nIt can be proved that this count does not depend on what rows and columns are chosen.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq H, W \\leq 20\n\n1 \\leq h \\leq H\n\n1 \\leq w \\leq W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nh w\n\nOutput\n\nPrint the number of white cells that will remain.\n\nSample Input 1\n\n3 2\n2 1\n\nSample Output 1\n\n1\n\nThere are 3 rows and 2 columns of cells. When two rows and one column are chosen and painted in black, there is always one white cell that remains.\n\nSample Input 2\n\n5 5\n2 3\n\nSample Output 2\n\n6\n\nSample Input 3\n\n2 4\n2 4\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 36, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s767869625", "group_id": "codeNet:p03102", "input_text": "program sample\n implicit none\n \n integer(8) :: i,j,m,n,c,k,s\n \n integer(8),allocatable :: b(:),a(:)\n \n read(*,*) n,m,c\n allocate(b(m))\n allocate(a(m))\n read(*,*)b\n k=0\n do i=1,n\n read(*,*)a\n s=0\n do j=1,m\n s=s+a(j)*b(j)\n end do\n if (s+c>0)then\n k=k+1\n end if\n end do\n\n\n write(*,*) k \n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1592058474, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03102.html", "problem_id": "p03102", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03102/input.txt", "sample_output_relpath": "derived/input_output/data/p03102/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03102/Fortran/s767869625.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s767869625", "user_id": "u713568912"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program sample\n implicit none\n \n integer(8) :: i,j,m,n,c,k,s\n \n integer(8),allocatable :: b(:),a(:)\n \n read(*,*) n,m,c\n allocate(b(m))\n allocate(a(m))\n read(*,*)b\n k=0\n do i=1,n\n read(*,*)a\n s=0\n do j=1,m\n s=s+a(j)*b(j)\n end do\n if (s+c>0)then\n k=k+1\n end if\n end do\n\n\n write(*,*) k \n stop\nend program sample\n \n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "sample_input": "2 3 -10\n1 2 3\n3 2 1\n1 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03102", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 419, "cpu_time_ms": 3, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s405527948", "group_id": "codeNet:p03102", "input_text": "program abc121b\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,m,c,i,ans\n integer(int32), allocatable:: b(:), a(:,:)\n\n read*, n,m,c\n allocate(b(m))\n allocate(a(m,n))\n read*, b(:)\n do i=1,n\n read*, a(:,i)\n end do\n ans=0\n do i=1,n\n if (sum(a(:,i)*b(:))+c > 0)ans=ans+1\n end do\n print'(i0)', ans\nend program abc121b", "language": "Fortran", "metadata": {"date": 1589487200, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03102.html", "problem_id": "p03102", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03102/input.txt", "sample_output_relpath": "derived/input_output/data/p03102/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03102/Fortran/s405527948.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s405527948", "user_id": "u234636620"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program abc121b\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,m,c,i,ans\n integer(int32), allocatable:: b(:), a(:,:)\n\n read*, n,m,c\n allocate(b(m))\n allocate(a(m,n))\n read*, b(:)\n do i=1,n\n read*, a(:,i)\n end do\n ans=0\n do i=1,n\n if (sum(a(:,i)*b(:))+c > 0)ans=ans+1\n end do\n print'(i0)', ans\nend program abc121b", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "sample_input": "2 3 -10\n1 2 3\n3 2 1\n1 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03102", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 390, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s687375930", "group_id": "codeNet:p03102", "input_text": "program main \nimplicit none\n\ninteger :: n,m,c\ninteger :: i,j,sm,cnt=0;\ninteger,allocatable :: a(:,:),b(:)\nread(*,*)n,m,c\nallocate(a(n,m),b(m))\n\nread(*,*)b(1:m)\ndo i=1,n\n\tread(*,*)a(i,1:m)\nend do\ndo i=1,n\n\tsm=0;\n\tdo j=1,m\n sm = sm + a(i,j)*b(j)\n end do\n if (sm+c > 0) then \n \tcnt = cnt +1\n end if\nend do\n\nwrite(*,'(i0)')cnt\n\nend program", "language": "Fortran", "metadata": {"date": 1556293469, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03102.html", "problem_id": "p03102", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03102/input.txt", "sample_output_relpath": "derived/input_output/data/p03102/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03102/Fortran/s687375930.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s687375930", "user_id": "u850779832"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main \nimplicit none\n\ninteger :: n,m,c\ninteger :: i,j,sm,cnt=0;\ninteger,allocatable :: a(:,:),b(:)\nread(*,*)n,m,c\nallocate(a(n,m),b(m))\n\nread(*,*)b(1:m)\ndo i=1,n\n\tread(*,*)a(i,1:m)\nend do\ndo i=1,n\n\tsm=0;\n\tdo j=1,m\n sm = sm + a(i,j)*b(j)\n end do\n if (sm+c > 0) then \n \tcnt = cnt +1\n end if\nend do\n\nwrite(*,'(i0)')cnt\n\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "sample_input": "2 3 -10\n1 2 3\n3 2 1\n1 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03102", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 354, "cpu_time_ms": 3, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s472261405", "group_id": "codeNet:p03102", "input_text": "integer(8) :: n,m,c,ans=0,p\ninteger(8),allocatable,dimension(:) :: B,A\nread*,n,m,c\nallocate(B(m),A(m))\nread(*,*)(B(i),i=1,m)\ndo i = 1,n\n read(*,*)(A(j),j=1,m)\n p = sum(A*B) + c\n if(p>0)then\n ans = ans + 1\n endif\nenddo\nwrite(*,'(i0)')ans\nend", "language": "Fortran", "metadata": {"date": 1552164145, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03102.html", "problem_id": "p03102", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03102/input.txt", "sample_output_relpath": "derived/input_output/data/p03102/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03102/Fortran/s472261405.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s472261405", "user_id": "u780122303"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "integer(8) :: n,m,c,ans=0,p\ninteger(8),allocatable,dimension(:) :: B,A\nread*,n,m,c\nallocate(B(m),A(m))\nread(*,*)(B(i),i=1,m)\ndo i = 1,n\n read(*,*)(A(j),j=1,m)\n p = sum(A*B) + c\n if(p>0)then\n ans = ans + 1\n endif\nenddo\nwrite(*,'(i0)')ans\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "sample_input": "2 3 -10\n1 2 3\n3 2 1\n1 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03102", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 259, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s235549124", "group_id": "codeNet:p03102", "input_text": "program main\n\timplicit none\n\tinteger :: N, M, C\n\tinteger, allocatable :: A(:, :), B(:)\n\tinteger :: counter, i\n\tread(*, *) N, M, C\n\tallocate(A(1:N, 1:M), B(1:M))\n\tread(*, *) B\n\tdo i = 1, N\n\t\tread(*, *) A(i, 1:M)\n\tend do\n\tB = MATMUL(A,B)+C\n\tcounter = 0\n\tdo i = 1, N\n\t\tif(B(i) > 0) then\n\t\t\tcounter = counter + 1\n\t\tend if\n\tend do\n\twrite(*, *) counter\nend program main", "language": "Fortran", "metadata": {"date": 1552162197, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03102.html", "problem_id": "p03102", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03102/input.txt", "sample_output_relpath": "derived/input_output/data/p03102/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03102/Fortran/s235549124.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s235549124", "user_id": "u728000113"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n\timplicit none\n\tinteger :: N, M, C\n\tinteger, allocatable :: A(:, :), B(:)\n\tinteger :: counter, i\n\tread(*, *) N, M, C\n\tallocate(A(1:N, 1:M), B(1:M))\n\tread(*, *) B\n\tdo i = 1, N\n\t\tread(*, *) A(i, 1:M)\n\tend do\n\tB = MATMUL(A,B)+C\n\tcounter = 0\n\tdo i = 1, N\n\t\tif(B(i) > 0) then\n\t\t\tcounter = counter + 1\n\t\tend if\n\tend do\n\twrite(*, *) counter\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "sample_input": "2 3 -10\n1 2 3\n3 2 1\n1 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03102", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N pieces of source code. The characteristics of the i-th code is represented by M integers A_{i1}, A_{i2}, ..., A_{iM}.\n\nAdditionally, you are given integers B_1, B_2, ..., B_M and C.\n\nThe i-th code correctly solves this problem if and only if A_{i1} B_1 + A_{i2} B_2 + ... + A_{iM} B_M + C > 0.\n\nAmong the N codes, find the number of codes that correctly solve this problem.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 20\n\n-100 \\leq A_{ij} \\leq 100\n\n-100 \\leq B_i \\leq 100\n\n-100 \\leq C \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M C\nB_1 B_2 ... B_M\nA_{11} A_{12} ... A_{1M}\nA_{21} A_{22} ... A_{2M}\n\\vdots\nA_{N1} A_{N2} ... A_{NM}\n\nOutput\n\nPrint the number of codes among the given N codes that correctly solve this problem.\n\nSample Input 1\n\n2 3 -10\n1 2 3\n3 2 1\n1 2 2\n\nSample Output 1\n\n1\n\nOnly the second code correctly solves this problem, as follows:\n\nSince 3 \\times 1 + 2 \\times 2 + 1 \\times 3 + (-10) = 0 \\leq 0, the first code does not solve this problem.\n\n1 \\times 1 + 2 \\times 2 + 2 \\times 3 + (-10) = 1 > 0, the second code solves this problem.\n\nSample Input 2\n\n5 2 -4\n-2 5\n100 41\n100 40\n-3 0\n-6 -2\n18 -13\n\nSample Output 2\n\n2\n\nSample Input 3\n\n3 3 0\n100 -100 0\n0 100 100\n100 100 100\n-100 100 100\n\nSample Output 3\n\n0\n\nAll of them are Wrong Answer. Except yours.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 363, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s646131083", "group_id": "codeNet:p03103", "input_text": "program main\nimplicit none\ninteger(8) :: i, j, k\ninteger(8) :: n, m\ninteger(8), allocatable :: a(:), b(:)\n\nread(*,*) n, m\nallocate( a(n), b(n) )\ndo i = 1, n\n read(*,*) a(i), b(i)\nend do\ncall heapsort2( n, a, b )\n\ni = 0\nj = 1\nk = 0\ndo while( i+b(j) .le. m )\n k = k + a(j)*b(j)\n i = i + b(j)\n j = j + 1\nend do\nk = k + (m-i)*a(j)\nwrite(*,'(i0)') k\n \nstop\ncontains\nsubroutine heapsort2(n,array,array2)\n implicit none\n integer(8),intent(in) :: n\n integer(8),intent(inout) :: array(1:n), array2(1:n)\n integer(8) ::i,k,j,l\n integer(8) :: t, u\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n u=array2(L)\n else\n t=array(k)\n u=array2(k)\n array(k)=array(1)\n array2(k)=array2(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n array2(1)=u\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n array2(i)=array2(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n array2(i)=u\n end do\nend subroutine heapsort2\n\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1563284536, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03103.html", "problem_id": "p03103", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03103/input.txt", "sample_output_relpath": "derived/input_output/data/p03103/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03103/Fortran/s646131083.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s646131083", "user_id": "u696547932"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "program main\nimplicit none\ninteger(8) :: i, j, k\ninteger(8) :: n, m\ninteger(8), allocatable :: a(:), b(:)\n\nread(*,*) n, m\nallocate( a(n), b(n) )\ndo i = 1, n\n read(*,*) a(i), b(i)\nend do\ncall heapsort2( n, a, b )\n\ni = 0\nj = 1\nk = 0\ndo while( i+b(j) .le. m )\n k = k + a(j)*b(j)\n i = i + b(j)\n j = j + 1\nend do\nk = k + (m-i)*a(j)\nwrite(*,'(i0)') k\n \nstop\ncontains\nsubroutine heapsort2(n,array,array2)\n implicit none\n integer(8),intent(in) :: n\n integer(8),intent(inout) :: array(1:n), array2(1:n)\n integer(8) ::i,k,j,l\n integer(8) :: t, u\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n u=array2(L)\n else\n t=array(k)\n u=array2(k)\n array(k)=array(1)\n array2(k)=array2(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n array2(1)=u\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n array2(i)=array2(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n array2(i)=u\n end do\nend subroutine heapsort2\n\n\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "2 5\n4 9\n2 4\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03103", "source_text": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1281, "cpu_time_ms": 79, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s460565353", "group_id": "codeNet:p03103", "input_text": "program main\n\timplicit none\n integer :: n, m\n integer, allocatable :: a(:), b(:)\n integer :: i, j, tmp1, tmp2\n integer :: tenpo, kakaku, kosu, amari\n read(*, *) n, m\n allocate(a(n)); allocate(b(n))\n do i = 1, n\n \tread(*, *) a(i), b(i)\n enddo\n do i = 1, n\n \tdo j = i+1, n\n \tif (a(i).lt.a(j)) then\n \ttmp1 = a(i)\n a(i) = a(j)\n a(j) = tmp1\n tmp2 = b(i)\n b(i) = b(j)\n b(j) = tmp2\n end if\n\t\tenddo\n\tenddo\n kosu = 0\n tenpo = 0\n do i = 1, n\n\t\tkosu = kosu + b(i)\n tenpo = tenpo + 1\n if (kosu.ge.m) then\n \tamari = kosu - m\n exit\n end if\n enddo\n do i = 1, tenpo-1\n \tkakaku = kakaku + a(i)*b(i)\n enddo\n kakaku = kakaku + a(tenpo)*(b(tenpo)-amari)\n write(*, *) kakaku\nstop\nend program main", "language": "Fortran", "metadata": {"date": 1560259407, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03103.html", "problem_id": "p03103", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03103/input.txt", "sample_output_relpath": "derived/input_output/data/p03103/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03103/Fortran/s460565353.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s460565353", "user_id": "u337929351"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "program main\n\timplicit none\n integer :: n, m\n integer, allocatable :: a(:), b(:)\n integer :: i, j, tmp1, tmp2\n integer :: tenpo, kakaku, kosu, amari\n read(*, *) n, m\n allocate(a(n)); allocate(b(n))\n do i = 1, n\n \tread(*, *) a(i), b(i)\n enddo\n do i = 1, n\n \tdo j = i+1, n\n \tif (a(i).lt.a(j)) then\n \ttmp1 = a(i)\n a(i) = a(j)\n a(j) = tmp1\n tmp2 = b(i)\n b(i) = b(j)\n b(j) = tmp2\n end if\n\t\tenddo\n\tenddo\n kosu = 0\n tenpo = 0\n do i = 1, n\n\t\tkosu = kosu + b(i)\n tenpo = tenpo + 1\n if (kosu.ge.m) then\n \tamari = kosu - m\n exit\n end if\n enddo\n do i = 1, tenpo-1\n \tkakaku = kakaku + a(i)*b(i)\n enddo\n kakaku = kakaku + a(tenpo)*(b(tenpo)-amari)\n write(*, *) kakaku\nstop\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "2 5\n4 9\n2 4\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03103", "source_text": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 878, "cpu_time_ms": 2103, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s542332843", "group_id": "codeNet:p03103", "input_text": "module mymodule\n implicit none\n public\n type store_type\n integer(8) :: price, storage\n end type store_type\nend module mymodule\n\nprogram main\n use mymodule\n implicit none\n integer(8) :: n, m, i, cost\n type(store_type), allocatable :: stores(:)\n\n read (*, *) n, m\n allocate (stores(n))\n do i = 1, n\n read (*, *) stores(i) % price, stores(i) % storage\n end do\n\n call quicksort(stores)\n\n cost = 0\n do i = 1, n\n if (m <= stores(i) % storage) then\n cost = cost + m * stores(i) % price\n exit\n end if\n cost = cost + stores(i) % storage * stores(i) % price\n m = m - stores(i) % storage\n end do\n\n write (*, \"(i0)\") cost\n\n contains\n\n recursive subroutine quicksort(a)\n type(store_type), intent(inout) :: a(:)\n type(store_type) :: pivot, tmp\n integer :: i, j, k, n\n real(4) :: r\n n = size(a)\n if (n <= 1) return\n i = 1\n j = n\n call random_number(r)\n k = 1 + floor(r * n)\n k = max(1, min(k, n))\n pivot = a(k)\n do\n do while (pivot % price > a(i) % price) ! Derived type comparison\n i = i + 1\n end do\n do while (a(j) % price > pivot % price) ! Derived type comparison\n j = j - 1\n end do\n if (i >= j) exit\n tmp = a(i)\n a(i) = a(j)\n a(j) = tmp\n i = i + 1\n j = j - 1\n end do\n call quicksort(a(1:i - 1))\n call quicksort(a(j + 1:n))\n end subroutine quicksort\nend program main\n", "language": "Fortran", "metadata": {"date": 1553144194, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03103.html", "problem_id": "p03103", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03103/input.txt", "sample_output_relpath": "derived/input_output/data/p03103/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03103/Fortran/s542332843.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s542332843", "user_id": "u388927326"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "module mymodule\n implicit none\n public\n type store_type\n integer(8) :: price, storage\n end type store_type\nend module mymodule\n\nprogram main\n use mymodule\n implicit none\n integer(8) :: n, m, i, cost\n type(store_type), allocatable :: stores(:)\n\n read (*, *) n, m\n allocate (stores(n))\n do i = 1, n\n read (*, *) stores(i) % price, stores(i) % storage\n end do\n\n call quicksort(stores)\n\n cost = 0\n do i = 1, n\n if (m <= stores(i) % storage) then\n cost = cost + m * stores(i) % price\n exit\n end if\n cost = cost + stores(i) % storage * stores(i) % price\n m = m - stores(i) % storage\n end do\n\n write (*, \"(i0)\") cost\n\n contains\n\n recursive subroutine quicksort(a)\n type(store_type), intent(inout) :: a(:)\n type(store_type) :: pivot, tmp\n integer :: i, j, k, n\n real(4) :: r\n n = size(a)\n if (n <= 1) return\n i = 1\n j = n\n call random_number(r)\n k = 1 + floor(r * n)\n k = max(1, min(k, n))\n pivot = a(k)\n do\n do while (pivot % price > a(i) % price) ! Derived type comparison\n i = i + 1\n end do\n do while (a(j) % price > pivot % price) ! Derived type comparison\n j = j - 1\n end do\n if (i >= j) exit\n tmp = a(i)\n a(i) = a(j)\n a(j) = tmp\n i = i + 1\n j = j - 1\n end do\n call quicksort(a(1:i - 1))\n call quicksort(a(j + 1:n))\n end subroutine quicksort\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "2 5\n4 9\n2 4\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03103", "source_text": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1418, "cpu_time_ms": 79, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s296145282", "group_id": "codeNet:p03103", "input_text": "Program ABC121C\n\ninteger(8) n,m,c,p,x\ninteger(8),allocatable::a(:),b(:)\n\nread(*,*) n,m\nallocate(a(n))\nallocate(b(n))\ndo i=1,n\n read(*,*) a(i),b(i)\nend do\n\nc=0\np=0\n\ndo i=1,n\n do j=i+1,n\n if (a(i)>a(j)) then\n x=a(i)\n a(i)=a(j)\n a(j)=x\n x=b(i)\n b(i)=b(j)\n b(j)=x\n end if\n end do\nend do\n\ndo i=1,n\n c=c+a(i)*b(i)\n p=p+b(i)\n if (p>=m) then\n c=c-a(i)*(p-m)\n go to 10\n end if\nend do\n \n10 write(*,*) c\n\nstop\nend", "language": "Fortran", "metadata": {"date": 1552594709, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03103.html", "problem_id": "p03103", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03103/input.txt", "sample_output_relpath": "derived/input_output/data/p03103/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03103/Fortran/s296145282.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s296145282", "user_id": "u538260936"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "Program ABC121C\n\ninteger(8) n,m,c,p,x\ninteger(8),allocatable::a(:),b(:)\n\nread(*,*) n,m\nallocate(a(n))\nallocate(b(n))\ndo i=1,n\n read(*,*) a(i),b(i)\nend do\n\nc=0\np=0\n\ndo i=1,n\n do j=i+1,n\n if (a(i)>a(j)) then\n x=a(i)\n a(i)=a(j)\n a(j)=x\n x=b(i)\n b(i)=b(j)\n b(j)=x\n end if\n end do\nend do\n\ndo i=1,n\n c=c+a(i)*b(i)\n p=p+b(i)\n if (p>=m) then\n c=c-a(i)*(p-m)\n go to 10\n end if\nend do\n \n10 write(*,*) c\n\nstop\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "2 5\n4 9\n2 4\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03103", "source_text": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 418, "cpu_time_ms": 2103, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s112869336", "group_id": "codeNet:p03103", "input_text": "program main\n implicit none\n integer(8) :: N,M\n integer(8),allocatable :: A(:),B(:)\n integer(8),allocatable :: A2(:,:)\n integer(8) :: i\n integer(8) :: nout\n integer(8) :: out\n read(*,*) N,M\n allocate(A(N),B(N))\n do i = 1,N\n read(*,*) A(i),B(i)\n end do\n allocate(A2(N,2) )\n A2(:,1) = A(:)\n A2(:,2) = B(:)\n\n call hsort(N,A2)\n out=0\n nout=0\n do i = 1,N\n nout = nout + A2(i,2)\n out = out +A2(i,1) * A2(i,2)\n if ( nout >= M ) THEn\n out = out - A2(i,1)*(nout-M)\n exit\n end if\n end do\n write(*,'(i0)') out\n stop\ncontains\n subroutine hsort(n, x)\n implicit none\n integer(8), intent(IN) :: n\n integer(8), intent(INOUT) :: x(n,2)\n ! local\n integer(8) k\n integer(8) :: tmp,tmp2\n ! external subroutine\n !external mkheap\n\n ! 配列 x 全体をヒープにする。\n do k = n/2, 1, -1\n tmp = x(k,1)\n call mkheap(n, x, k, n, tmp)\n enddo\n\n ! ヒープの根と右下の葉を交換してソートする。\n do k = n, 2, -1\n tmp = x(k,1)\n x(k,1) = x(1,1)\n tmp2 = x(1,2)\n x(1,2) =x(k,2) \n x(k,2) = tmp2\n \n call mkheap(n, x, int(1,8), k-1, tmp)\n end do\n\n return\n end subroutine hsort\n\n subroutine mkheap(n, x, root, leaf, val)\n implicit none\n integer(8), intent(IN) :: n, root, leaf\n integer(8), intent(INOUT) :: x(1:n,2)\n integer(8), intent(IN) :: val\n ! local\n integer(8) :: i, j\n integer(8) :: tmp\n\n i = root\n j = i * 2\n\n do\n if (j > leaf) exit\n\n if (j < leaf) then\n if (x(j,1) < x(j+1,1)) j = j + 1\n end if\n\n if (x(j,1) > val) then\n x(i,1) = x(j,1)\n tmp = x(j,2)\n x(j,2) = x(i,2)\n x(i,2) = tmp\n i = j\n j = i * 2\n else\n j = leaf + 1\n endif\n end do\n\n x(i,1) = val\n\n return\n end subroutine mkheap\n \n end program main\n", "language": "Fortran", "metadata": {"date": 1552167085, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03103.html", "problem_id": "p03103", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03103/input.txt", "sample_output_relpath": "derived/input_output/data/p03103/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03103/Fortran/s112869336.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s112869336", "user_id": "u886432251"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: N,M\n integer(8),allocatable :: A(:),B(:)\n integer(8),allocatable :: A2(:,:)\n integer(8) :: i\n integer(8) :: nout\n integer(8) :: out\n read(*,*) N,M\n allocate(A(N),B(N))\n do i = 1,N\n read(*,*) A(i),B(i)\n end do\n allocate(A2(N,2) )\n A2(:,1) = A(:)\n A2(:,2) = B(:)\n\n call hsort(N,A2)\n out=0\n nout=0\n do i = 1,N\n nout = nout + A2(i,2)\n out = out +A2(i,1) * A2(i,2)\n if ( nout >= M ) THEn\n out = out - A2(i,1)*(nout-M)\n exit\n end if\n end do\n write(*,'(i0)') out\n stop\ncontains\n subroutine hsort(n, x)\n implicit none\n integer(8), intent(IN) :: n\n integer(8), intent(INOUT) :: x(n,2)\n ! local\n integer(8) k\n integer(8) :: tmp,tmp2\n ! external subroutine\n !external mkheap\n\n ! 配列 x 全体をヒープにする。\n do k = n/2, 1, -1\n tmp = x(k,1)\n call mkheap(n, x, k, n, tmp)\n enddo\n\n ! ヒープの根と右下の葉を交換してソートする。\n do k = n, 2, -1\n tmp = x(k,1)\n x(k,1) = x(1,1)\n tmp2 = x(1,2)\n x(1,2) =x(k,2) \n x(k,2) = tmp2\n \n call mkheap(n, x, int(1,8), k-1, tmp)\n end do\n\n return\n end subroutine hsort\n\n subroutine mkheap(n, x, root, leaf, val)\n implicit none\n integer(8), intent(IN) :: n, root, leaf\n integer(8), intent(INOUT) :: x(1:n,2)\n integer(8), intent(IN) :: val\n ! local\n integer(8) :: i, j\n integer(8) :: tmp\n\n i = root\n j = i * 2\n\n do\n if (j > leaf) exit\n\n if (j < leaf) then\n if (x(j,1) < x(j+1,1)) j = j + 1\n end if\n\n if (x(j,1) > val) then\n x(i,1) = x(j,1)\n tmp = x(j,2)\n x(j,2) = x(i,2)\n x(i,2) = tmp\n i = j\n j = i * 2\n else\n j = leaf + 1\n endif\n end do\n\n x(i,1) = val\n\n return\n end subroutine mkheap\n \n end program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "sample_input": "2 5\n4 9\n2 4\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03103", "source_text": "Score : 300 points\n\nProblem Statement\n\nHearing that energy drinks increase rating in those sites, Takahashi decides to buy up M cans of energy drinks.\n\nThere are N stores that sell energy drinks. In the i-th store, he can buy at most B_i cans of energy drinks for A_i yen (the currency of Japan) each.\n\nWhat is the minimum amount of money with which he can buy M cans of energy drinks?\n\nIt is guaranteed that, in the given inputs, a sufficient amount of money can always buy M cans of energy drinks.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^5\n\nB_1 + ... + B_N \\geq M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_N B_N\n\nOutput\n\nPrint the minimum amount of money with which Takahashi can buy M cans of energy drinks.\n\nSample Input 1\n\n2 5\n4 9\n2 4\n\nSample Output 1\n\n12\n\nWith 12 yen, we can buy one drink at the first store and four drinks at the second store, for the total of five drinks. However, we cannot buy 5 drinks with 11 yen or less.\n\nSample Input 2\n\n4 30\n6 18\n2 5\n3 10\n7 9\n\nSample Output 2\n\n130\n\nSample Input 3\n\n1 100000\n1000000000 100000\n\nSample Output 3\n\n100000000000000\n\nThe output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1910, "cpu_time_ms": 80, "memory_kb": 3328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s094970042", "group_id": "codeNet:p03106", "input_text": "program main\ninteger :: a,b,k,cnt=0\nread(*,*)a,b,k\n\ndo i = 100,1,-1\nif(mod(a,i)==0 .and. mod(b,i)==0) cnt = cnt + 1\nif(cnt == k) exit\nend do\n\nwrite(*,*) i\nend program main", "language": "Fortran", "metadata": {"date": 1589404551, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03106.html", "problem_id": "p03106", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03106/input.txt", "sample_output_relpath": "derived/input_output/data/p03106/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03106/Fortran/s094970042.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s094970042", "user_id": "u850779832"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\ninteger :: a,b,k,cnt=0\nread(*,*)a,b,k\n\ndo i = 100,1,-1\nif(mod(a,i)==0 .and. mod(b,i)==0) cnt = cnt + 1\nif(cnt == k) exit\nend do\n\nwrite(*,*) i\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nFind the K-th largest positive integer that divides both A and B.\n\nThe input guarantees that there exists such a number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 100\n\nThe K-th largest positive integer that divides both A and B exists.\n\nK \\geq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the K-th largest positive integer that divides both A and B.\n\nSample Input 1\n\n8 12 2\n\nSample Output 1\n\n2\n\nThree positive integers divides both 8 and 12: 1, 2 and 4.\nAmong them, the second largest is 2.\n\nSample Input 2\n\n100 50 4\n\nSample Output 2\n\n5\n\nSample Input 3\n\n1 1 1\n\nSample Output 3\n\n1", "sample_input": "8 12 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03106", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nFind the K-th largest positive integer that divides both A and B.\n\nThe input guarantees that there exists such a number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 100\n\nThe K-th largest positive integer that divides both A and B exists.\n\nK \\geq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the K-th largest positive integer that divides both A and B.\n\nSample Input 1\n\n8 12 2\n\nSample Output 1\n\n2\n\nThree positive integers divides both 8 and 12: 1, 2 and 4.\nAmong them, the second largest is 2.\n\nSample Input 2\n\n100 50 4\n\nSample Output 2\n\n5\n\nSample Input 3\n\n1 1 1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 171, "cpu_time_ms": 2, "memory_kb": 2808}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s840755821", "group_id": "codeNet:p03106", "input_text": "program main\n implicit none\n integer :: a, b, k, i, j = 0\n \n read *, a, b, k\n\n do i = min(a, b), 1, -1\n j = j + 1\n if (mod(a, i) + mod(b, i) > 0) then\n j = j - 1\n end if\n if (j == k) then\n print '(i0)', i\n exit\n end if\n end do\n\nend", "language": "Fortran", "metadata": {"date": 1551667136, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03106.html", "problem_id": "p03106", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03106/input.txt", "sample_output_relpath": "derived/input_output/data/p03106/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03106/Fortran/s840755821.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s840755821", "user_id": "u282360873"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer :: a, b, k, i, j = 0\n \n read *, a, b, k\n\n do i = min(a, b), 1, -1\n j = j + 1\n if (mod(a, i) + mod(b, i) > 0) then\n j = j - 1\n end if\n if (j == k) then\n print '(i0)', i\n exit\n end if\n end do\n\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nFind the K-th largest positive integer that divides both A and B.\n\nThe input guarantees that there exists such a number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 100\n\nThe K-th largest positive integer that divides both A and B exists.\n\nK \\geq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the K-th largest positive integer that divides both A and B.\n\nSample Input 1\n\n8 12 2\n\nSample Output 1\n\n2\n\nThree positive integers divides both 8 and 12: 1, 2 and 4.\nAmong them, the second largest is 2.\n\nSample Input 2\n\n100 50 4\n\nSample Output 2\n\n5\n\nSample Input 3\n\n1 1 1\n\nSample Output 3\n\n1", "sample_input": "8 12 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03106", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nFind the K-th largest positive integer that divides both A and B.\n\nThe input guarantees that there exists such a number.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A, B \\leq 100\n\nThe K-th largest positive integer that divides both A and B exists.\n\nK \\geq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the K-th largest positive integer that divides both A and B.\n\nSample Input 1\n\n8 12 2\n\nSample Output 1\n\n2\n\nThree positive integers divides both 8 and 12: 1, 2 and 4.\nAmong them, the second largest is 2.\n\nSample Input 2\n\n100 50 4\n\nSample Output 2\n\n5\n\nSample Input 3\n\n1 1 1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 267, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s769178893", "group_id": "codeNet:p03107", "input_text": "program answer\n implicit none\n integer :: i, j, N, ans, count\n character(len=10**5) :: S\n read(*,*) S\n N=len_trim(S)\n ans=0\n count=1\n do\n if(count==0) then\n exit\n end if\n count=0\n do i = 1, N-1\n if(S(i:i)=='2') then\n cycle\n else if(S(i:i)=='1') then\n do j = i+1, N\n if(S(j:j)=='2') then\n cycle\n else if(S(j:j)=='1') then\n exit\n else if(S(j:j)=='0') then\n S(i:i)='2'\n S(j:j)='2'\n ans=ans+1\n count=count+1\n exit\n end if\n end do\n else\n do j = i+1, N\n if(S(j:j)=='2') then\n cycle\n else if(S(j:j)=='0') then\n exit\n else\n S(i:i)='2'\n S(j:j)='2'\n ans=ans+1\n count=count+1\n exit\n end if\n end do \n end if\n end do\n end do\n\n write(*,*) ans*2\n stop\n end program answer", "language": "Fortran", "metadata": {"date": 1599309870, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03107.html", "problem_id": "p03107", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03107/input.txt", "sample_output_relpath": "derived/input_output/data/p03107/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03107/Fortran/s769178893.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s769178893", "user_id": "u873780029"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program answer\n implicit none\n integer :: i, j, N, ans, count\n character(len=10**5) :: S\n read(*,*) S\n N=len_trim(S)\n ans=0\n count=1\n do\n if(count==0) then\n exit\n end if\n count=0\n do i = 1, N-1\n if(S(i:i)=='2') then\n cycle\n else if(S(i:i)=='1') then\n do j = i+1, N\n if(S(j:j)=='2') then\n cycle\n else if(S(j:j)=='1') then\n exit\n else if(S(j:j)=='0') then\n S(i:i)='2'\n S(j:j)='2'\n ans=ans+1\n count=count+1\n exit\n end if\n end do\n else\n do j = i+1, N\n if(S(j:j)=='2') then\n cycle\n else if(S(j:j)=='0') then\n exit\n else\n S(i:i)='2'\n S(j:j)='2'\n ans=ans+1\n count=count+1\n exit\n end if\n end do \n end if\n end do\n end do\n\n write(*,*) ans*2\n stop\n end program answer", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "0011\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03107", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1109, "cpu_time_ms": 2205, "memory_kb": 3184}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s700264990", "group_id": "codeNet:p03107", "input_text": "program sample\n implicit none\n character(100000)::s,t\n integer(8) :: i,j,k,m,n\n integer(8)::a,b,c,d\n integer(8),allocatable::x(:),y(:)\n \n \n read(*,*)s\n n=len_trim(s)\n \n a=0\n b=0\n do i=1,n\n if(s(i:i).eq.'0')then\n a=a+1\n else\n b=b+1\n end if\n end do\n c=min(a,b)\n write(*,*)2*c\n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1598037546, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03107.html", "problem_id": "p03107", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03107/input.txt", "sample_output_relpath": "derived/input_output/data/p03107/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03107/Fortran/s700264990.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s700264990", "user_id": "u713568912"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program sample\n implicit none\n character(100000)::s,t\n integer(8) :: i,j,k,m,n\n integer(8)::a,b,c,d\n integer(8),allocatable::x(:),y(:)\n \n \n read(*,*)s\n n=len_trim(s)\n \n a=0\n b=0\n do i=1,n\n if(s(i:i).eq.'0')then\n a=a+1\n else\n b=b+1\n end if\n end do\n c=min(a,b)\n write(*,*)2*c\n stop\nend program sample\n \n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "0011\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03107", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 393, "cpu_time_ms": 7, "memory_kb": 3164}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s372042045", "group_id": "codeNet:p03107", "input_text": "character(10**5+7) :: s\nread*,s\nwrite(*,'(I0)')min(count((/(s(i:i)=='0',i=1,10**5)/)),count((/(s(i:i)=='1',i=1,10**5)/)))*2\nend", "language": "Fortran", "metadata": {"date": 1551677616, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03107.html", "problem_id": "p03107", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03107/input.txt", "sample_output_relpath": "derived/input_output/data/p03107/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03107/Fortran/s372042045.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s372042045", "user_id": "u780122303"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "character(10**5+7) :: s\nread*,s\nwrite(*,'(I0)')min(count((/(s(i:i)=='0',i=1,10**5)/)),count((/(s(i:i)=='1',i=1,10**5)/)))*2\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "0011\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03107", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cubes stacked vertically on a desk.\n\nYou are given a string S of length N. The color of the i-th cube from the bottom is red if the i-th character in S is 0, and blue if that character is 1.\n\nYou can perform the following operation any number of times: choose a red cube and a blue cube that are adjacent, and remove them. Here, the cubes that were stacked on the removed cubes will fall down onto the object below them.\n\nAt most how many cubes can be removed?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n|S| = N\n\nEach character in S is 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum number of cubes that can be removed.\n\nSample Input 1\n\n0011\n\nSample Output 1\n\n4\n\nAll four cubes can be removed, by performing the operation as follows:\n\nRemove the second and third cubes from the bottom. Then, the fourth cube drops onto the first cube.\n\nRemove the first and second cubes from the bottom.\n\nSample Input 2\n\n11011010001011\n\nSample Output 2\n\n12\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 127, "cpu_time_ms": 3, "memory_kb": 956}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s784806651", "group_id": "codeNet:p03108", "input_text": "module mod_union_find\n implicit none\n type union_find\n integer :: n = 0\n integer, pointer :: par(:), rnk(:), siz(:) => null()\n contains\n procedure :: init => inituf\n procedure :: release => releaseuf\n procedure :: find => find\n procedure :: same => same\n procedure :: unite => unite\n procedure :: size => size_of\n end type\n interface union_find\n module procedure :: newuf\n end interface union_find\ncontains\n function newuf(n) result(ret)\n integer, intent(in) :: n\n type(union_find) :: ret\n integer :: i\n ret%n = n\n allocate(ret%par(n),ret%rnk(n),ret%siz(n))\n ret%rnk = 0\n ret%siz = 1\n ret%par = [(i,i=1,n)]\n end\n subroutine inituf(this,n)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: n\n integer :: i\n if (this%n /= n) then\n if (this%n /= 0) deallocate(this%par,this%rnk,this%siz)\n allocate(this%par(n),this%rnk(n),this%siz(n))\n end if\n this%n = n\n this%rnk = 0\n this%siz = 1\n this%par = [(i,i=1,n)]\n end\n subroutine releaseuf(this)\n class(union_find), intent(inout) :: this\n if (this%n /= 0) deallocate(this%par,this%rnk,this%siz)\n this%n = 0\n end\n recursive function find(this,i) result(ret)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i\n integer :: ret\n if (this%par(i) /= i) this%par(i) = find(this,this%par(i))\n ret = this%par(i)\n end\n logical function same(this,i,j)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i, j\n same = find(this,i) == find(this,j)\n end\n subroutine unite(this,i,j)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i, j\n integer :: x, y\n x = find(this,i)\n y = find(this,j)\n if (x == y) return\n if (this%rnk(x) < this%rnk(y)) then\n this%par(x) = y\n this%siz(y) = this%siz(y)+this%siz(x)\n else\n this%par(y) = x\n this%siz(x) = this%siz(x)+this%siz(y)\n if (this%rnk(x) == this%rnk(y)) this%rnk(x) = this%rnk(x)+1\n end if\n end\n integer function size_of(this,i)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i\n size_of = this%siz(find(this,i))\n end\nend module mod_union_find\nprogram decayed_bridges\n use mod_union_find\n implicit none\n integer :: n, m, a(100000) = 0, b(100000) = 0, i\n integer(8) :: x(0:100000) = 0\n type(union_find) :: uf\n read(*,*) n, m\n do i = 1, m\n read(*,*) a(i), b(i)\n end do\n uf = union_find(n)\n x(m) = int(n,8)*(n-1)/2\n do i = m, 1, -1\n x(i-1) = x(i)\n if (.not.uf%same(a(i),b(i))) then\n x(i-1) = x(i-1)-int(uf%size(a(i)),8)*uf%size(b(i))\n call uf%unite(a(i),b(i))\n end if\n end do\n do i = 1, m\n write(*,'(i0)') x(i)\n end do\nend program decayed_bridges", "language": "Fortran", "metadata": {"date": 1590754096, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03108.html", "problem_id": "p03108", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03108/input.txt", "sample_output_relpath": "derived/input_output/data/p03108/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03108/Fortran/s784806651.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s784806651", "user_id": "u506403362"}, "prompt_components": {"gold_output": "0\n0\n4\n5\n6\n", "input_to_evaluate": "module mod_union_find\n implicit none\n type union_find\n integer :: n = 0\n integer, pointer :: par(:), rnk(:), siz(:) => null()\n contains\n procedure :: init => inituf\n procedure :: release => releaseuf\n procedure :: find => find\n procedure :: same => same\n procedure :: unite => unite\n procedure :: size => size_of\n end type\n interface union_find\n module procedure :: newuf\n end interface union_find\ncontains\n function newuf(n) result(ret)\n integer, intent(in) :: n\n type(union_find) :: ret\n integer :: i\n ret%n = n\n allocate(ret%par(n),ret%rnk(n),ret%siz(n))\n ret%rnk = 0\n ret%siz = 1\n ret%par = [(i,i=1,n)]\n end\n subroutine inituf(this,n)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: n\n integer :: i\n if (this%n /= n) then\n if (this%n /= 0) deallocate(this%par,this%rnk,this%siz)\n allocate(this%par(n),this%rnk(n),this%siz(n))\n end if\n this%n = n\n this%rnk = 0\n this%siz = 1\n this%par = [(i,i=1,n)]\n end\n subroutine releaseuf(this)\n class(union_find), intent(inout) :: this\n if (this%n /= 0) deallocate(this%par,this%rnk,this%siz)\n this%n = 0\n end\n recursive function find(this,i) result(ret)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i\n integer :: ret\n if (this%par(i) /= i) this%par(i) = find(this,this%par(i))\n ret = this%par(i)\n end\n logical function same(this,i,j)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i, j\n same = find(this,i) == find(this,j)\n end\n subroutine unite(this,i,j)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i, j\n integer :: x, y\n x = find(this,i)\n y = find(this,j)\n if (x == y) return\n if (this%rnk(x) < this%rnk(y)) then\n this%par(x) = y\n this%siz(y) = this%siz(y)+this%siz(x)\n else\n this%par(y) = x\n this%siz(x) = this%siz(x)+this%siz(y)\n if (this%rnk(x) == this%rnk(y)) this%rnk(x) = this%rnk(x)+1\n end if\n end\n integer function size_of(this,i)\n class(union_find), intent(inout) :: this\n integer, intent(in) :: i\n size_of = this%siz(find(this,i))\n end\nend module mod_union_find\nprogram decayed_bridges\n use mod_union_find\n implicit none\n integer :: n, m, a(100000) = 0, b(100000) = 0, i\n integer(8) :: x(0:100000) = 0\n type(union_find) :: uf\n read(*,*) n, m\n do i = 1, m\n read(*,*) a(i), b(i)\n end do\n uf = union_find(n)\n x(m) = int(n,8)*(n-1)/2\n do i = m, 1, -1\n x(i-1) = x(i)\n if (.not.uf%same(a(i),b(i))) then\n x(i-1) = x(i-1)-int(uf%size(a(i)),8)*uf%size(b(i))\n call uf%unite(a(i),b(i))\n end if\n end do\n do i = 1, m\n write(*,'(i0)') x(i)\n end do\nend program decayed_bridges", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "sample_input": "4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n"}, "reference_outputs": ["0\n0\n4\n5\n6\n"], "source_document_id": "p03108", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2736, "cpu_time_ms": 114, "memory_kb": 4088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s705834179", "group_id": "codeNet:p03108", "input_text": "module uf\n implicit none\n integer(8) :: unionfind(100000) = -1\n\ncontains\n\n recursive function root(i) result(res)\n integer(8),intent(in) :: i\n integer(8) res\n\n if (unionfind(i) < 0) then\n res = i\n else\n unionfind(i) = root(unionfind(i))\n res = unionfind(i)\n end if\n end function root\n\n subroutine unite(a, b)\n integer(8),intent(in) :: a,b\n\n if (unionfind(a) < unionfind(b)) then\n unionfind(a) = unionfind(a) + unionfind(b)\n unionfind(b) = a\n else\n unionfind(b) = unionfind(b) + unionfind(a)\n unionfind(a) = b\n end if\n end subroutine unite\n\nend module uf\n\nprogram abc120d\n use uf\n implicit none\n integer(8) n, m, i, ra, rb\n integer(8),dimension(:),allocatable :: a, b, ans\n\n read *, n,m\n allocate(a(m),b(m),ans(m))\n\n do i = 1,m\n read *, a(i),b(i)\n end do\n\n ans(m) = n*(n-1)/2\n\n do i = m,2,-1\n ans(i-1) = ans(i)\n ra = root(a(i))\n rb = root(b(i))\n if (ra /= rb) then\n ans(i-1) = ans(i-1)-unionfind(ra)*unionfind(rb)\n call unite(ra,rb)\n end if\n end do\n\n do i = 1,m\n print *, ans(i)\n end do\n\nend program abc120d\n", "language": "Fortran", "metadata": {"date": 1558087403, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03108.html", "problem_id": "p03108", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03108/input.txt", "sample_output_relpath": "derived/input_output/data/p03108/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03108/Fortran/s705834179.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s705834179", "user_id": "u081445141"}, "prompt_components": {"gold_output": "0\n0\n4\n5\n6\n", "input_to_evaluate": "module uf\n implicit none\n integer(8) :: unionfind(100000) = -1\n\ncontains\n\n recursive function root(i) result(res)\n integer(8),intent(in) :: i\n integer(8) res\n\n if (unionfind(i) < 0) then\n res = i\n else\n unionfind(i) = root(unionfind(i))\n res = unionfind(i)\n end if\n end function root\n\n subroutine unite(a, b)\n integer(8),intent(in) :: a,b\n\n if (unionfind(a) < unionfind(b)) then\n unionfind(a) = unionfind(a) + unionfind(b)\n unionfind(b) = a\n else\n unionfind(b) = unionfind(b) + unionfind(a)\n unionfind(a) = b\n end if\n end subroutine unite\n\nend module uf\n\nprogram abc120d\n use uf\n implicit none\n integer(8) n, m, i, ra, rb\n integer(8),dimension(:),allocatable :: a, b, ans\n\n read *, n,m\n allocate(a(m),b(m),ans(m))\n\n do i = 1,m\n read *, a(i),b(i)\n end do\n\n ans(m) = n*(n-1)/2\n\n do i = m,2,-1\n ans(i-1) = ans(i)\n ra = root(a(i))\n rb = root(b(i))\n if (ra /= rb) then\n ans(i-1) = ans(i-1)-unionfind(ra)*unionfind(rb)\n call unite(ra,rb)\n end if\n end do\n\n do i = 1,m\n print *, ans(i)\n end do\n\nend program abc120d\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "sample_input": "4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n"}, "reference_outputs": ["0\n0\n4\n5\n6\n"], "source_document_id": "p03108", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1137, "cpu_time_ms": 102, "memory_kb": 5504}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s456386495", "group_id": "codeNet:p03108", "input_text": "module UF\n\timplicit none\n\tprivate\n\ttype Union_Find\n\t\tinteger, allocatable :: par(:), rank(:), counter(:)\n\tend type Union_Find\n\tpublic Union_Find, make_Union_Find, unite, UF_size, root, same\n\t\n\tcontains\n\t\n\tsubroutine make_Union_Find(UFty, N)\n\t\tinteger, intent(in) :: N\n\t\ttype(Union_Find), intent(out) :: UFty\n\t\tallocate(UFty%par(1:N), UFty%rank(1:N), UFty%counter(1:N))\n\t\tcall format_Union_Find(UFty, N)\n\tend subroutine make_Union_Find\n\t\n\tsubroutine format_Union_Find(UFty, N)\n\t\tinteger, intent(in) :: N\n\t\ttype(Union_Find), intent(inout) :: UFty\n\t\tinteger :: i\n\t\tdo i = 1, N\n\t\t\tUFty%par(i) = i\n\t\tend do\n\t\tUFty%rank = 0\n\t\tUFty%counter = 1\n\tend subroutine format_Union_Find\n\t\n\tsubroutine unite(UFty, x, y)\n\t\tinteger, value :: x, y\n\t\ttype(Union_Find), intent(inout) :: UFty\n\t\tx = root(UFty, x)\n\t\ty = root(UFty, y)\n\t\tif(x == y) return\n\t\tif(UFty%rank(x) < UFty%rank(y)) then\n\t\t\tUFty%par(x) = y\n\t\t\tUFty%counter(y) = UFty%counter(y) + UFty%counter(x)\t\n\t\telse\n\t\t\tUFty%par(y) = x\n\t\t\tUFty%counter(x) = UFty%counter(x) + UFty%counter(y)\t\n\t\t\tif(UFty%rank(x) == UFty%rank(y)) UFty%rank(x) = UFty%rank(x) + 1\n\t\tend if\n\tend subroutine unite\n\t\n\tfunction UF_size(UFty, x) result(y)\n\t\tinteger, intent(in) :: x\n\t\ttype(Union_Find), intent(inout) :: UFty\n\t\tinteger :: y\n\t\ty = UFty%counter(root(UFty, x))\n\t\treturn\n\tend function UF_size\n\t\n\trecursive function root(UFty, x) result(root_ans)\n\t\tinteger, intent(in) :: x\n\t\ttype(Union_Find), intent(inout) :: UFty\n\t\tinteger :: root_ans\n\t\tif(UFty%par(x) == x) then\n\t\t\troot_ans = x\n\t\t\treturn\n\t\telse\n\t\t\tUFty%par(x) = root(UFty, UFty%par(x))\n\t\t\troot_ans = UFty%par(x)\n\t\t\treturn\n\t\tend if\n\tend function root\n\t\n\tlogical function same(UFty, x, y)\n\t\tinteger, intent(in) :: x, y\n\t\ttype(Union_Find), intent(inout) :: UFty\n\t\tif(root(UFty, x) == root(UFty, y)) then\n\t\t\tsame = .TRUE.\n\t\telse\n\t\t\tsame = .FALSE. \n\t\tend if\n\tend function same\nend module UF\n\nprogram main\n\tuse UF\n\timplicit none\n\tinteger :: N, M, i\n\tinteger, allocatable :: A(:), B(:)\n\tinteger(8), allocatable :: ans(:)\n\ttype(Union_Find) :: Island\n\tread(*, *) N, M\n\tallocate(A(1:M), B(1:M))\n\tallocate(ans(1:M))\n\tdo i = 1, M\n\t\tread(*, *) A(i), B(i)\n\tend do\n\t\n\t\n\tcall make_Union_Find(Island, N)\n\t\n\tans(M) = (N*(N-1)) / 2\n\tdo i = M, 2, -1\n\t\tif(same(Island, A(i), B(i))) then\n\t\t\tans(i-1) = ans(i)\n\t\telse\n\t\t\tans(i-1) = ans(i) - UF_size(Island, A(i))*UF_size(Island, B(i))\n\t\tend if\n\t\tcall unite(Island, A(i), B(i))\n\tend do\n\tdo i = 1, M\n\t\twrite(*, *) ans(i)\n\tend do\nend program main", "language": "Fortran", "metadata": {"date": 1552170038, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03108.html", "problem_id": "p03108", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03108/input.txt", "sample_output_relpath": "derived/input_output/data/p03108/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03108/Fortran/s456386495.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s456386495", "user_id": "u728000113"}, "prompt_components": {"gold_output": "0\n0\n4\n5\n6\n", "input_to_evaluate": "module UF\n\timplicit none\n\tprivate\n\ttype Union_Find\n\t\tinteger, allocatable :: par(:), rank(:), counter(:)\n\tend type Union_Find\n\tpublic Union_Find, make_Union_Find, unite, UF_size, root, same\n\t\n\tcontains\n\t\n\tsubroutine make_Union_Find(UFty, N)\n\t\tinteger, intent(in) :: N\n\t\ttype(Union_Find), intent(out) :: UFty\n\t\tallocate(UFty%par(1:N), UFty%rank(1:N), UFty%counter(1:N))\n\t\tcall format_Union_Find(UFty, N)\n\tend subroutine make_Union_Find\n\t\n\tsubroutine format_Union_Find(UFty, N)\n\t\tinteger, intent(in) :: N\n\t\ttype(Union_Find), intent(inout) :: UFty\n\t\tinteger :: i\n\t\tdo i = 1, N\n\t\t\tUFty%par(i) = i\n\t\tend do\n\t\tUFty%rank = 0\n\t\tUFty%counter = 1\n\tend subroutine format_Union_Find\n\t\n\tsubroutine unite(UFty, x, y)\n\t\tinteger, value :: x, y\n\t\ttype(Union_Find), intent(inout) :: UFty\n\t\tx = root(UFty, x)\n\t\ty = root(UFty, y)\n\t\tif(x == y) return\n\t\tif(UFty%rank(x) < UFty%rank(y)) then\n\t\t\tUFty%par(x) = y\n\t\t\tUFty%counter(y) = UFty%counter(y) + UFty%counter(x)\t\n\t\telse\n\t\t\tUFty%par(y) = x\n\t\t\tUFty%counter(x) = UFty%counter(x) + UFty%counter(y)\t\n\t\t\tif(UFty%rank(x) == UFty%rank(y)) UFty%rank(x) = UFty%rank(x) + 1\n\t\tend if\n\tend subroutine unite\n\t\n\tfunction UF_size(UFty, x) result(y)\n\t\tinteger, intent(in) :: x\n\t\ttype(Union_Find), intent(inout) :: UFty\n\t\tinteger :: y\n\t\ty = UFty%counter(root(UFty, x))\n\t\treturn\n\tend function UF_size\n\t\n\trecursive function root(UFty, x) result(root_ans)\n\t\tinteger, intent(in) :: x\n\t\ttype(Union_Find), intent(inout) :: UFty\n\t\tinteger :: root_ans\n\t\tif(UFty%par(x) == x) then\n\t\t\troot_ans = x\n\t\t\treturn\n\t\telse\n\t\t\tUFty%par(x) = root(UFty, UFty%par(x))\n\t\t\troot_ans = UFty%par(x)\n\t\t\treturn\n\t\tend if\n\tend function root\n\t\n\tlogical function same(UFty, x, y)\n\t\tinteger, intent(in) :: x, y\n\t\ttype(Union_Find), intent(inout) :: UFty\n\t\tif(root(UFty, x) == root(UFty, y)) then\n\t\t\tsame = .TRUE.\n\t\telse\n\t\t\tsame = .FALSE. \n\t\tend if\n\tend function same\nend module UF\n\nprogram main\n\tuse UF\n\timplicit none\n\tinteger :: N, M, i\n\tinteger, allocatable :: A(:), B(:)\n\tinteger(8), allocatable :: ans(:)\n\ttype(Union_Find) :: Island\n\tread(*, *) N, M\n\tallocate(A(1:M), B(1:M))\n\tallocate(ans(1:M))\n\tdo i = 1, M\n\t\tread(*, *) A(i), B(i)\n\tend do\n\t\n\t\n\tcall make_Union_Find(Island, N)\n\t\n\tans(M) = (N*(N-1)) / 2\n\tdo i = M, 2, -1\n\t\tif(same(Island, A(i), B(i))) then\n\t\t\tans(i-1) = ans(i)\n\t\telse\n\t\t\tans(i-1) = ans(i) - UF_size(Island, A(i))*UF_size(Island, B(i))\n\t\tend if\n\t\tcall unite(Island, A(i), B(i))\n\tend do\n\tdo i = 1, M\n\t\twrite(*, *) ans(i)\n\tend do\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "sample_input": "4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n"}, "reference_outputs": ["0\n0\n4\n5\n6\n"], "source_document_id": "p03108", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2520, "cpu_time_ms": 103, "memory_kb": 5120}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s791633354", "group_id": "codeNet:p03108", "input_text": "module m1\n implicit none\n integer(8) :: u(100000) = -1\ncontains\n recursive integer(8) function root(i) result(res)\n integer(8), intent(in) :: i\n if (u(i) < 0) then\n res = i\n else\n u(i) = root(u(i))\n res = u(i)\n end if\n end function root\nend module m1\nprogram abc120d\n use m1\n implicit none\n integer(8) n, m, i, ra, rb\n integer(8), dimension(:), allocatable :: a, b, ans\n read *, n, m\n allocate(a(m), b(m), ans(m))\n do i = 1, m\n read *, a(i), b(i)\n end do\n ans(m) = n * (n - 1) / 2\n do i = m, 2, -1\n ans(i - 1) = ans(i)\n ra = root(a(i))\n rb = root(b(i))\n if (ra /= rb) then\n ans(i - 1) = ans(i - 1) - u(ra) * u(rb)\n if (u(ra) < u(rb)) then\n u(ra) = u(ra) + u(rb)\n u(rb) = ra\n else\n u(rb) = u(rb) + u(ra)\n u(ra) = rb\n end if\n end if\n end do\n do i = 1, m\n print '(i0)', ans(i)\n end do\nend program abc120d\n", "language": "Fortran", "metadata": {"date": 1551796475, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03108.html", "problem_id": "p03108", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03108/input.txt", "sample_output_relpath": "derived/input_output/data/p03108/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03108/Fortran/s791633354.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s791633354", "user_id": "u081445141"}, "prompt_components": {"gold_output": "0\n0\n4\n5\n6\n", "input_to_evaluate": "module m1\n implicit none\n integer(8) :: u(100000) = -1\ncontains\n recursive integer(8) function root(i) result(res)\n integer(8), intent(in) :: i\n if (u(i) < 0) then\n res = i\n else\n u(i) = root(u(i))\n res = u(i)\n end if\n end function root\nend module m1\nprogram abc120d\n use m1\n implicit none\n integer(8) n, m, i, ra, rb\n integer(8), dimension(:), allocatable :: a, b, ans\n read *, n, m\n allocate(a(m), b(m), ans(m))\n do i = 1, m\n read *, a(i), b(i)\n end do\n ans(m) = n * (n - 1) / 2\n do i = m, 2, -1\n ans(i - 1) = ans(i)\n ra = root(a(i))\n rb = root(b(i))\n if (ra /= rb) then\n ans(i - 1) = ans(i - 1) - u(ra) * u(rb)\n if (u(ra) < u(rb)) then\n u(ra) = u(ra) + u(rb)\n u(rb) = ra\n else\n u(rb) = u(rb) + u(ra)\n u(ra) = rb\n end if\n end if\n end do\n do i = 1, m\n print '(i0)', ans(i)\n end do\nend program abc120d\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "sample_input": "4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n"}, "reference_outputs": ["0\n0\n4\n5\n6\n"], "source_document_id": "p03108", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N islands and M bridges.\n\nThe i-th bridge connects the A_i-th and B_i-th islands bidirectionally.\n\nInitially, we can travel between any two islands using some of these bridges.\n\nHowever, the results of a survey show that these bridges will all collapse because of aging, in the order from the first bridge to the M-th bridge.\n\nLet the inconvenience be the number of pairs of islands (a, b) (a < b) such that we are no longer able to travel between the a-th and b-th islands using some of the bridges remaining.\n\nFor each i (1 \\leq i \\leq M), find the inconvenience just after the i-th bridge collapses.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nAll pairs (A_i, B_i) are distinct.\n\nThe inconvenience is initially 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\nA_2 B_2\n\\vdots\nA_M B_M\n\nOutput\n\nIn the order i = 1, 2, ..., M, print the inconvenience just after the i-th bridge collapses.\nNote that the answer may not fit into a 32-bit integer type.\n\nSample Input 1\n\n4 5\n1 2\n3 4\n1 3\n2 3\n1 4\n\nSample Output 1\n\n0\n0\n4\n5\n6\n\nFor example, when the first to third bridges have collapsed, the inconvenience is 4 since we can no longer travel between the pairs (1, 2), (1, 3), (2, 4) and (3, 4).\n\nSample Input 2\n\n6 5\n2 3\n1 2\n5 6\n3 4\n4 5\n\nSample Output 2\n\n8\n9\n12\n14\n15\n\nSample Input 3\n\n2 1\n1 2\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 945, "cpu_time_ms": 110, "memory_kb": 4480}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s316400509", "group_id": "codeNet:p03109", "input_text": "character(10) :: s\ninteger :: y,m,d\n\nread*,s\n\nread(s(1:4),*),y\nread(s(2:3),*),m\nread(s(2:3),*),d\n\nif( y<2019 ) goto 200\nif( y>2020 ) goto 100\nif( m<3 ) goto 200\nif( m>5 ) goto 100\nif( d<31 ) goto 100\n\n\n100 continue\nprint*,'TBD'\nstop\n200 continue\nprint*,'Heisei'\nstop\nend\n", "language": "Fortran", "metadata": {"date": 1575852419, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03109.html", "problem_id": "p03109", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03109/input.txt", "sample_output_relpath": "derived/input_output/data/p03109/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03109/Fortran/s316400509.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s316400509", "user_id": "u171356453"}, "prompt_components": {"gold_output": "Heisei\n", "input_to_evaluate": "character(10) :: s\ninteger :: y,m,d\n\nread*,s\n\nread(s(1:4),*),y\nread(s(2:3),*),m\nread(s(2:3),*),d\n\nif( y<2019 ) goto 200\nif( y>2020 ) goto 100\nif( m<3 ) goto 200\nif( m>5 ) goto 100\nif( d<31 ) goto 100\n\n\n100 continue\nprint*,'TBD'\nstop\n200 continue\nprint*,'Heisei'\nstop\nend\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\n\nWrite a program that prints Heisei if the date represented by S is not later than April 30, 2019, and prints TBD otherwise.\n\nConstraints\n\nS is a string that represents a valid date in the year 2019 in the yyyy/mm/dd format.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Heisei if the date represented by S is not later than April 30, 2019, and print TBD otherwise.\n\nSample Input 1\n\n2019/04/30\n\nSample Output 1\n\nHeisei\n\nSample Input 2\n\n2019/11/01\n\nSample Output 2\n\nTBD", "sample_input": "2019/04/30\n"}, "reference_outputs": ["Heisei\n"], "source_document_id": "p03109", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S as input. This represents a valid date in the year 2019 in the yyyy/mm/dd format. (For example, April 30, 2019 is represented as 2019/04/30.)\n\nWrite a program that prints Heisei if the date represented by S is not later than April 30, 2019, and prints TBD otherwise.\n\nConstraints\n\nS is a string that represents a valid date in the year 2019 in the yyyy/mm/dd format.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Heisei if the date represented by S is not later than April 30, 2019, and print TBD otherwise.\n\nSample Input 1\n\n2019/04/30\n\nSample Output 1\n\nHeisei\n\nSample Input 2\n\n2019/11/01\n\nSample Output 2\n\nTBD", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 271, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s855347908", "group_id": "codeNet:p03110", "input_text": "program main\n implicit none\n integer(8)::n,i\n real(8)::su,u\n character(3) a\n read(*,*)n\n su=0\n do i=1,n\n read(*,*)u,a\n if(a==\"JPY\")then\n su=su+u\n else\n su=su+u*380000.0\n endif\n enddo\n write(*,*)su\nend program main\n", "language": "Fortran", "metadata": {"date": 1551039081, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03110.html", "problem_id": "p03110", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03110/input.txt", "sample_output_relpath": "derived/input_output/data/p03110/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03110/Fortran/s855347908.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s855347908", "user_id": "u539011156"}, "prompt_components": {"gold_output": "48000.0\n", "input_to_evaluate": "program main\n implicit none\n integer(8)::n,i\n real(8)::su,u\n character(3) a\n read(*,*)n\n su=0\n do i=1,n\n read(*,*)u,a\n if(a==\"JPY\")then\n su=su+u\n else\n su=su+u*380000.0\n endif\n enddo\n write(*,*)su\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\n\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.\n\nFor example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.\n\nIf we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?\n\nConstraints\n\n2 \\leq N \\leq 10\n\nu_i = JPY or BTC.\n\nIf u_i = JPY, x_i is an integer such that 1 \\leq x_i \\leq 10^8.\n\nIf u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \\leq x_i \\leq 100.00000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 u_1\nx_2 u_2\n:\nx_N u_N\n\nOutput\n\nIf the gifts are worth Y yen in total, print the value Y (not necessarily an integer).\n\nOutput will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10000 JPY\n0.10000000 BTC\n\nSample Output 1\n\n48000.0\n\nThe otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.\n\nOutputs such as 48000 and 48000.1 will also be judged correct.\n\nSample Input 2\n\n3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC\n\nSample Output 2\n\n138000000.0038\n\nIn this case, outputs such as 138001000 and 1.38e8 will also be judged correct.", "sample_input": "2\n10000 JPY\n0.10000000 BTC\n"}, "reference_outputs": ["48000.0\n"], "source_document_id": "p03110", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi received otoshidama (New Year's money gifts) from N of his relatives.\n\nYou are given N values x_1, x_2, ..., x_N and N strings u_1, u_2, ..., u_N as input. Each string u_i is either JPY or BTC, and x_i and u_i represent the content of the otoshidama from the i-th relative.\n\nFor example, if x_1 = 10000 and u_1 = JPY, the otoshidama from the first relative is 10000 Japanese yen; if x_2 = 0.10000000 and u_2 = BTC, the otoshidama from the second relative is 0.1 bitcoins.\n\nIf we convert the bitcoins into yen at the rate of 380000.0 JPY per 1.0 BTC, how much are the gifts worth in total?\n\nConstraints\n\n2 \\leq N \\leq 10\n\nu_i = JPY or BTC.\n\nIf u_i = JPY, x_i is an integer such that 1 \\leq x_i \\leq 10^8.\n\nIf u_i = BTC, x_i is a decimal with 8 decimal digits, such that 0.00000001 \\leq x_i \\leq 100.00000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nx_1 u_1\nx_2 u_2\n:\nx_N u_N\n\nOutput\n\nIf the gifts are worth Y yen in total, print the value Y (not necessarily an integer).\n\nOutput will be judged correct when the absolute or relative error from the judge's output is at most 10^{-5}.\n\nSample Input 1\n\n2\n10000 JPY\n0.10000000 BTC\n\nSample Output 1\n\n48000.0\n\nThe otoshidama from the first relative is 10000 yen. The otoshidama from the second relative is 0.1 bitcoins, which is worth 38000.0 yen if converted at the rate of 380000.0 JPY per 1.0 BTC. The sum of these is 48000.0 yen.\n\nOutputs such as 48000 and 48000.1 will also be judged correct.\n\nSample Input 2\n\n3\n100000000 JPY\n100.00000000 BTC\n0.00000001 BTC\n\nSample Output 2\n\n138000000.0038\n\nIn this case, outputs such as 138001000 and 1.38e8 will also be judged correct.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 268, "cpu_time_ms": 4, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s861371817", "group_id": "codeNet:p03111", "input_text": "program kadomatsu\n implicit none\n integer :: n,a,b,c,i,j,k,count,distro\n integer :: bar(4)\n integer, allocatable :: l(:)\n integer, allocatable :: mp(:)\n\n read *, n,a,b,c\n allocate(l(n))\n do i = 1, n\n read*, l(i)\n end do\n allocate(mp(4**n))\n do j = 1, 4**n!pattern of junction\n bar = 0\n mp(j) = 0\n count = j\n do k = n,1,-1!number of bamboo\n distro = count/4**(k-1) + 1\n bar(distro) = bar(distro) + l(k)\n if (distro /= 4) mp(j) = mp(j) + 10\n count = mod(count,4**(k-1))\n end do\n if (bar(1)*bar(2)*bar(3) == 0) then\n mp(j) = 10000\n else\n mp(j) = mp(j) + abs(a-bar(1)) + abs(b-bar(2)) + abs (c-bar(3)) - 30\n end if\n end do\n print '(i0)', minval(mp)\n stop\nend program kadomatsu\n", "language": "Fortran", "metadata": {"date": 1556107505, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03111.html", "problem_id": "p03111", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03111/input.txt", "sample_output_relpath": "derived/input_output/data/p03111/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03111/Fortran/s861371817.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s861371817", "user_id": "u121479332"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "program kadomatsu\n implicit none\n integer :: n,a,b,c,i,j,k,count,distro\n integer :: bar(4)\n integer, allocatable :: l(:)\n integer, allocatable :: mp(:)\n\n read *, n,a,b,c\n allocate(l(n))\n do i = 1, n\n read*, l(i)\n end do\n allocate(mp(4**n))\n do j = 1, 4**n!pattern of junction\n bar = 0\n mp(j) = 0\n count = j\n do k = n,1,-1!number of bamboo\n distro = count/4**(k-1) + 1\n bar(distro) = bar(distro) + l(k)\n if (distro /= 4) mp(j) = mp(j) + 10\n count = mod(count,4**(k-1))\n end do\n if (bar(1)*bar(2)*bar(3) == 0) then\n mp(j) = 10000\n else\n mp(j) = mp(j) + abs(a-bar(1)) + abs(b-bar(2)) + abs (c-bar(3)) - 30\n end if\n end do\n print '(i0)', minval(mp)\n stop\nend program kadomatsu\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively.\n\nYour objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number:\n\nExtension Magic: Consumes 1 MP (magic point). Choose one bamboo and increase its length by 1.\n\nShortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1.\n\nComposition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.)\n\nAt least how much MP is needed to achieve the objective?\n\nConstraints\n\n3 \\leq N \\leq 8\n\n1 \\leq C < B < A \\leq 1000\n\n1 \\leq l_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\nl_1\nl_2\n:\nl_N\n\nOutput\n\nPrint the minimum amount of MP needed to achieve the objective.\n\nSample Input 1\n\n5 100 90 80\n98\n40\n30\n21\n80\n\nSample Output 1\n\n23\n\nWe are obtaining three bamboos of lengths 100, 90, 80 from five bamboos 98, 40, 30, 21, 80. We already have a bamboo of length 80, and we can obtain bamboos of lengths 100, 90 by using the magics as follows at the total cost of 23 MP, which is optimal.\n\nUse Extension Magic twice on the bamboo of length 98 to obtain a bamboo of length 100. (MP consumed: 2)\n\nUse Composition Magic on the bamboos of lengths 40, 30 to obtain a bamboo of length 70. (MP consumed: 10)\n\nUse Shortening Magic once on the bamboo of length 21 to obtain a bamboo of length 20. (MP consumed: 1)\n\nUse Composition Magic on the bamboo of length 70 obtained in step 2 and the bamboo of length 20 obtained in step 3 to obtain a bamboo of length 90. (MP consumed: 10)\n\nSample Input 2\n\n8 100 90 80\n100\n100\n90\n90\n90\n80\n80\n80\n\nSample Output 2\n\n0\n\nIf we already have all bamboos of the desired lengths, the amount of MP needed is 0. As seen here, we do not necessarily need to use all the bamboos.\n\nSample Input 3\n\n8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666\n\nSample Output 3\n\n243", "sample_input": "5 100 90 80\n98\n40\n30\n21\n80\n"}, "reference_outputs": ["23\n"], "source_document_id": "p03111", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively.\n\nYour objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number:\n\nExtension Magic: Consumes 1 MP (magic point). Choose one bamboo and increase its length by 1.\n\nShortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1.\n\nComposition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.)\n\nAt least how much MP is needed to achieve the objective?\n\nConstraints\n\n3 \\leq N \\leq 8\n\n1 \\leq C < B < A \\leq 1000\n\n1 \\leq l_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\nl_1\nl_2\n:\nl_N\n\nOutput\n\nPrint the minimum amount of MP needed to achieve the objective.\n\nSample Input 1\n\n5 100 90 80\n98\n40\n30\n21\n80\n\nSample Output 1\n\n23\n\nWe are obtaining three bamboos of lengths 100, 90, 80 from five bamboos 98, 40, 30, 21, 80. We already have a bamboo of length 80, and we can obtain bamboos of lengths 100, 90 by using the magics as follows at the total cost of 23 MP, which is optimal.\n\nUse Extension Magic twice on the bamboo of length 98 to obtain a bamboo of length 100. (MP consumed: 2)\n\nUse Composition Magic on the bamboos of lengths 40, 30 to obtain a bamboo of length 70. (MP consumed: 10)\n\nUse Shortening Magic once on the bamboo of length 21 to obtain a bamboo of length 20. (MP consumed: 1)\n\nUse Composition Magic on the bamboo of length 70 obtained in step 2 and the bamboo of length 20 obtained in step 3 to obtain a bamboo of length 90. (MP consumed: 10)\n\nSample Input 2\n\n8 100 90 80\n100\n100\n90\n90\n90\n80\n80\n80\n\nSample Output 2\n\n0\n\nIf we already have all bamboos of the desired lengths, the amount of MP needed is 0. As seen here, we do not necessarily need to use all the bamboos.\n\nSample Input 3\n\n8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666\n\nSample Output 3\n\n243", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 776, "cpu_time_ms": 7, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s218670033", "group_id": "codeNet:p03111", "input_text": "program main\nimplicit none\ninteger :: n, a, b, c\ninteger , allocatable :: l(:),l2(:)\ninteger :: i, j ,k\ninteger :: mp\ninteger :: a_check, n_i, n_j\ninteger :: a_diff, a_state\n \nread(*,*) n,a,b,c\nallocate(l(n))\nallocate(l2(n*(n+1)/2))\ndo i = 1, n\n read(*,*) l(i)\nend do\ncall bubble(n,l)\n \nmp = 0\nk = 0\na_check = 1000\ndo i = 1, n-1\n do j = i+1, n\n k = k+1\n l2(k)= l(i)+l(j)\n if ( a_check .gt. abs(a-l2(k))) then\n a_check = abs(a - l2(k))\n n_i = i\n n_j = j\n end if\n end do\nend do\ndo i = 1, n-1\n if (l(i).le.a .and. l(i+1) .ge. a) then\n if ( abs(a-l(i)).lt.abs(a-l(i+1)))then\n a_diff = abs(a-l(i))\n else\n a_diff = abs(a-l(i+1))\n end if\n if(a_check+10 .lt. a_diff)then\n mp = mp + a_check +10\n a_state = 1\n else\n mp = mp + a_diff\n a_state = 0\n end if\n end if\nend do\nwrite(*,'(i0)') mp\n \n \nstop\ncontains\n subroutine bubble(n,array)\n implicit none\n integer , intent(in) :: n\n integer , intent(inout) :: array(n)\n integer :: i, j\n integer :: t\n \n do i = 1, n-1\n do j = i+1 , n\n if(array(i).gt.array(j))then\n t = array(i)\n array(i) = array(j)\n array(j) = t\n end if\n end do\n end do\n end subroutine bubble\n \nend program main", "language": "Fortran", "metadata": {"date": 1551044489, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03111.html", "problem_id": "p03111", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03111/input.txt", "sample_output_relpath": "derived/input_output/data/p03111/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03111/Fortran/s218670033.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s218670033", "user_id": "u696547932"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: n, a, b, c\ninteger , allocatable :: l(:),l2(:)\ninteger :: i, j ,k\ninteger :: mp\ninteger :: a_check, n_i, n_j\ninteger :: a_diff, a_state\n \nread(*,*) n,a,b,c\nallocate(l(n))\nallocate(l2(n*(n+1)/2))\ndo i = 1, n\n read(*,*) l(i)\nend do\ncall bubble(n,l)\n \nmp = 0\nk = 0\na_check = 1000\ndo i = 1, n-1\n do j = i+1, n\n k = k+1\n l2(k)= l(i)+l(j)\n if ( a_check .gt. abs(a-l2(k))) then\n a_check = abs(a - l2(k))\n n_i = i\n n_j = j\n end if\n end do\nend do\ndo i = 1, n-1\n if (l(i).le.a .and. l(i+1) .ge. a) then\n if ( abs(a-l(i)).lt.abs(a-l(i+1)))then\n a_diff = abs(a-l(i))\n else\n a_diff = abs(a-l(i+1))\n end if\n if(a_check+10 .lt. a_diff)then\n mp = mp + a_check +10\n a_state = 1\n else\n mp = mp + a_diff\n a_state = 0\n end if\n end if\nend do\nwrite(*,'(i0)') mp\n \n \nstop\ncontains\n subroutine bubble(n,array)\n implicit none\n integer , intent(in) :: n\n integer , intent(inout) :: array(n)\n integer :: i, j\n integer :: t\n \n do i = 1, n-1\n do j = i+1 , n\n if(array(i).gt.array(j))then\n t = array(i)\n array(i) = array(j)\n array(j) = t\n end if\n end do\n end do\n end subroutine bubble\n \nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively.\n\nYour objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number:\n\nExtension Magic: Consumes 1 MP (magic point). Choose one bamboo and increase its length by 1.\n\nShortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1.\n\nComposition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.)\n\nAt least how much MP is needed to achieve the objective?\n\nConstraints\n\n3 \\leq N \\leq 8\n\n1 \\leq C < B < A \\leq 1000\n\n1 \\leq l_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\nl_1\nl_2\n:\nl_N\n\nOutput\n\nPrint the minimum amount of MP needed to achieve the objective.\n\nSample Input 1\n\n5 100 90 80\n98\n40\n30\n21\n80\n\nSample Output 1\n\n23\n\nWe are obtaining three bamboos of lengths 100, 90, 80 from five bamboos 98, 40, 30, 21, 80. We already have a bamboo of length 80, and we can obtain bamboos of lengths 100, 90 by using the magics as follows at the total cost of 23 MP, which is optimal.\n\nUse Extension Magic twice on the bamboo of length 98 to obtain a bamboo of length 100. (MP consumed: 2)\n\nUse Composition Magic on the bamboos of lengths 40, 30 to obtain a bamboo of length 70. (MP consumed: 10)\n\nUse Shortening Magic once on the bamboo of length 21 to obtain a bamboo of length 20. (MP consumed: 1)\n\nUse Composition Magic on the bamboo of length 70 obtained in step 2 and the bamboo of length 20 obtained in step 3 to obtain a bamboo of length 90. (MP consumed: 10)\n\nSample Input 2\n\n8 100 90 80\n100\n100\n90\n90\n90\n80\n80\n80\n\nSample Output 2\n\n0\n\nIf we already have all bamboos of the desired lengths, the amount of MP needed is 0. As seen here, we do not necessarily need to use all the bamboos.\n\nSample Input 3\n\n8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666\n\nSample Output 3\n\n243", "sample_input": "5 100 90 80\n98\n40\n30\n21\n80\n"}, "reference_outputs": ["23\n"], "source_document_id": "p03111", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou have N bamboos. The lengths (in centimeters) of these are l_1, l_2, ..., l_N, respectively.\n\nYour objective is to use some of these bamboos (possibly all) to obtain three bamboos of length A, B, C. For that, you can use the following three kinds of magics any number:\n\nExtension Magic: Consumes 1 MP (magic point). Choose one bamboo and increase its length by 1.\n\nShortening Magic: Consumes 1 MP. Choose one bamboo of length at least 2 and decrease its length by 1.\n\nComposition Magic: Consumes 10 MP. Choose two bamboos and combine them into one bamboo. The length of this new bamboo is equal to the sum of the lengths of the two bamboos combined. (Afterwards, further magics can be used on this bamboo.)\n\nAt least how much MP is needed to achieve the objective?\n\nConstraints\n\n3 \\leq N \\leq 8\n\n1 \\leq C < B < A \\leq 1000\n\n1 \\leq l_i \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\nl_1\nl_2\n:\nl_N\n\nOutput\n\nPrint the minimum amount of MP needed to achieve the objective.\n\nSample Input 1\n\n5 100 90 80\n98\n40\n30\n21\n80\n\nSample Output 1\n\n23\n\nWe are obtaining three bamboos of lengths 100, 90, 80 from five bamboos 98, 40, 30, 21, 80. We already have a bamboo of length 80, and we can obtain bamboos of lengths 100, 90 by using the magics as follows at the total cost of 23 MP, which is optimal.\n\nUse Extension Magic twice on the bamboo of length 98 to obtain a bamboo of length 100. (MP consumed: 2)\n\nUse Composition Magic on the bamboos of lengths 40, 30 to obtain a bamboo of length 70. (MP consumed: 10)\n\nUse Shortening Magic once on the bamboo of length 21 to obtain a bamboo of length 20. (MP consumed: 1)\n\nUse Composition Magic on the bamboo of length 70 obtained in step 2 and the bamboo of length 20 obtained in step 3 to obtain a bamboo of length 90. (MP consumed: 10)\n\nSample Input 2\n\n8 100 90 80\n100\n100\n90\n90\n90\n80\n80\n80\n\nSample Output 2\n\n0\n\nIf we already have all bamboos of the desired lengths, the amount of MP needed is 0. As seen here, we do not necessarily need to use all the bamboos.\n\nSample Input 3\n\n8 1000 800 100\n300\n333\n400\n444\n500\n555\n600\n666\n\nSample Output 3\n\n243", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1332, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s087967914", "group_id": "codeNet:p03112", "input_text": "program main\n implicit none\n integer :: A,B,Q\n integer(8),allocatable :: S(:)\n integer(8),allocatable :: T(:)\n integer(8) :: xtmp\n integer(8) :: xtmp_loc(1)\n integer(8) :: cand(2)\n integer(8),allocatable :: x(:)\n integer(8),allocatable :: sorted(:)\n integer :: i,j\n integer :: is,ie\n read(*,*) A,B,Q\n allocate(S(A),T(B),x(Q))\n do i = 1,A\n read(*,*) S(i)\n end do\n do i = 1,B\n read(*,*) T(i)\n end do\n do i = 1,Q\n read(*,*) X(i)\n end do\n\n do i = 1,Q\n ! first visit T\n cand(1)=0\n xtmp=X(i)\n xtmp_loc = T( minloc( abs(T(:)-xtmp)) )\n cand(1) = cand(1) + abs(xtmp - xtmp_loc(1))\n xtmp = xtmp_loc(1)\n cand(1) = cand(1) + minval( abs(S(:)-xtmp))\n\n ! first visit S\n cand(2)=0\n xtmp=X(i)\n xtmp_loc = S( minloc( abs(S(:)-xtmp)) )\n cand(2) = cand(2) + abs(xtmp - xtmp_loc(1))\n xtmp = xtmp_loc(1)\n cand(2) = cand(2) + minval( abs(T(:)-xtmp))\n write(*,'(i0)') minval(cand)\n end do\n stop\ncontains\n subroutine near(is,ie,B,T,xtmp)\n integer,intent(out) :: is,ie\n integer(8) :: xtmp\n integer,intent(in) :: B\n integer(8) :: T(B)\n is = 1 ; ie = B\n if ( B/2 /= 1 ) then\n if (T(B/2) < xtmp ) then\n is = B/2-1 ; ie = B\n else\n is = 1 ; ie = B/2\n end if\n else\n return\n end if\n!@ if ( T(B/8*7) < xtmp ) then\n!@ is = B/8*7 ; ie =B\n!@ elseif( T(B/4*3) Amin ) A = A-Amin\n where ( mod(A,Amin) == 0 ) A = Amin\n if ( any(A < Amin ) ) then\n Amin = minval(A,A>0)\n end if\n if ( count(A > 0 ) == 1 .or. all( A == Amin ) ) exit\n end do\n write(*,'(i0)') minval(A,A >0 )\n deallocate(A)\n stop\ncontains\n recursive function iqsort(ix) result(ires)\n integer, allocatable :: ires(:)\n integer, intent(in) :: ix(:)\n integer :: k\n if (size(ix) <= 1) then \n ires = ix\n else \n k = ix(size(ix) / 2)\n ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] \n end if\n end function iqsort \nend program main\n", "language": "Fortran", "metadata": {"date": 1550374118, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03127.html", "problem_id": "p03127", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03127/input.txt", "sample_output_relpath": "derived/input_output/data/p03127/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03127/Fortran/s943212900.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s943212900", "user_id": "u886432251"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer :: N\n integer,allocatable :: A(:)\n integer :: Amin, i_loop,Amin_bf\n integer :: i,j,k\n read(*,*) N\n allocate( A(N) )\n read(*,*) A\n Amin = minval(A)\n where ( mod(A,Amin) == 0 ) A = Amin\n A = mod(A,Amin)\n ! calc mod\n do \n where(A > Amin ) A = A-Amin\n where ( mod(A,Amin) == 0 ) A = Amin\n if ( any(A < Amin ) ) then\n Amin = minval(A,A>0)\n end if\n if ( count(A > 0 ) == 1 .or. all( A == Amin ) ) exit\n end do\n write(*,'(i0)') minval(A,A >0 )\n deallocate(A)\n stop\ncontains\n recursive function iqsort(ix) result(ires)\n integer, allocatable :: ires(:)\n integer, intent(in) :: ix(:)\n integer :: k\n if (size(ix) <= 1) then \n ires = ix\n else \n k = ix(size(ix) / 2)\n ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] \n end if\n end function iqsort \nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "sample_input": "4\n2 10 8 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03127", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 945, "cpu_time_ms": 35, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s170596716", "group_id": "codeNet:p03127", "input_text": "program main\n implicit none\n integer :: N\n integer,allocatable :: A(:)\n integer,allocatable :: A2(:)\n integer :: Amin, i_loop,Amin_bf\n integer :: i,j,k\n read(*,*) N\n allocate(A(N),A2(N))\n read(*,*) A\n A2 = A\n Amin = minval(A)\n where ( mod(A,Amin) == 0 ) A = Amin\n ! calc mod\n do\n where(A > Amin ) A = A-Amin\n where ( mod(A,Amin) == 0 ) A = Amin\n if ( any(A < Amin ) ) then\n Amin = minval(A,A>0)\n end if\n if ( count(A > 0 ) == 1 .or. all( A == A(1)) ) exit\n end do\n write(*,'(i0)') minval(A,A >0 )\n deallocate(A)\n deallocate(A2)\n stop\ncontains\n recursive function iqsort(ix) result(ires)\n integer, allocatable :: ires(:)\n integer, intent(in) :: ix(:)\n integer :: k\n if (size(ix) <= 1) then \n ires = ix\n else \n k = ix(size(ix) / 2)\n ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] \n end if\n end function iqsort \nend program main\n", "language": "Fortran", "metadata": {"date": 1550373365, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03127.html", "problem_id": "p03127", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03127/input.txt", "sample_output_relpath": "derived/input_output/data/p03127/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03127/Fortran/s170596716.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s170596716", "user_id": "u886432251"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer :: N\n integer,allocatable :: A(:)\n integer,allocatable :: A2(:)\n integer :: Amin, i_loop,Amin_bf\n integer :: i,j,k\n read(*,*) N\n allocate(A(N),A2(N))\n read(*,*) A\n A2 = A\n Amin = minval(A)\n where ( mod(A,Amin) == 0 ) A = Amin\n ! calc mod\n do\n where(A > Amin ) A = A-Amin\n where ( mod(A,Amin) == 0 ) A = Amin\n if ( any(A < Amin ) ) then\n Amin = minval(A,A>0)\n end if\n if ( count(A > 0 ) == 1 .or. all( A == A(1)) ) exit\n end do\n write(*,'(i0)') minval(A,A >0 )\n deallocate(A)\n deallocate(A2)\n stop\ncontains\n recursive function iqsort(ix) result(ires)\n integer, allocatable :: ires(:)\n integer, intent(in) :: ix(:)\n integer :: k\n if (size(ix) <= 1) then \n ires = ix\n else \n k = ix(size(ix) / 2)\n ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] \n end if\n end function iqsort \nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "sample_input": "4\n2 10 8 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03127", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 986, "cpu_time_ms": 2103, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s276134858", "group_id": "codeNet:p03127", "input_text": "program main\n implicit none\n integer :: N\n integer,allocatable :: A(:)\n integer,allocatable :: A2(:)\n integer :: Amin, i_loop,Amin_bf\n integer :: i,j,k\n read(*,*) N\n allocate(A(N),A2(N))\n read(*,*) A\n A2 = A\n Amin = minval(A)\n ! calc mod\n do\n where(A > Amin ) A = A-Amin\n if ( any(A < Amin ) ) then\n Amin_bf = Amin_bf\n Amin = minval(A,A>0)\n end if\n if ( count(A > 0 ) == 1 .or. all( A == A(1)) ) exit\n end do\n write(*,'(i0)') minval(A,A >0 )\n deallocate(A)\n deallocate(A2)\n stop\ncontains\n recursive function iqsort(ix) result(ires)\n integer, allocatable :: ires(:)\n integer, intent(in) :: ix(:)\n integer :: k\n if (size(ix) <= 1) then \n ires = ix\n else \n k = ix(size(ix) / 2)\n ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] \n end if\n end function iqsort \nend program main\n", "language": "Fortran", "metadata": {"date": 1550372849, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03127.html", "problem_id": "p03127", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03127/input.txt", "sample_output_relpath": "derived/input_output/data/p03127/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03127/Fortran/s276134858.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s276134858", "user_id": "u886432251"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer :: N\n integer,allocatable :: A(:)\n integer,allocatable :: A2(:)\n integer :: Amin, i_loop,Amin_bf\n integer :: i,j,k\n read(*,*) N\n allocate(A(N),A2(N))\n read(*,*) A\n A2 = A\n Amin = minval(A)\n ! calc mod\n do\n where(A > Amin ) A = A-Amin\n if ( any(A < Amin ) ) then\n Amin_bf = Amin_bf\n Amin = minval(A,A>0)\n end if\n if ( count(A > 0 ) == 1 .or. all( A == A(1)) ) exit\n end do\n write(*,'(i0)') minval(A,A >0 )\n deallocate(A)\n deallocate(A2)\n stop\ncontains\n recursive function iqsort(ix) result(ires)\n integer, allocatable :: ires(:)\n integer, intent(in) :: ix(:)\n integer :: k\n if (size(ix) <= 1) then \n ires = ix\n else \n k = ix(size(ix) / 2)\n ires = [iqsort(pack(ix, ix < k)), pack(ix, ix == k), iqsort(pack(ix, ix > k))] \n end if\n end function iqsort \nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "sample_input": "4\n2 10 8 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03127", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 929, "cpu_time_ms": 2103, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s030291042", "group_id": "codeNet:p03127", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger :: n, i, check\ninteger, allocatable :: a(:), m(:)\n\nread(*,*) n\nallocate (a(n), m(n-1))\nread(*,*) (a(i), i=1,n)\n\ncall hs(n,a)\n\ncheck = 0\ndo i = 1, n-1\n\tm(i) = mod(a(n),a(i))\n if(m(i) /= 0) then\n \tcheck = 1\n end if\nend do\n\nif(check == 1)then\n\twrite(*,'(i0)') 1\nelse\n\twrite(*,'(i0)') a(1)\nend if\n\nEND PROGRAM ATCODER\n\nsubroutine hs(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n integer :: t\n \n if(n <= 0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n == 1)return\n \n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j <= k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n \n return\nend subroutine hs", "language": "Fortran", "metadata": {"date": 1550372464, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03127.html", "problem_id": "p03127", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03127/input.txt", "sample_output_relpath": "derived/input_output/data/p03127/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03127/Fortran/s030291042.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s030291042", "user_id": "u454557108"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger :: n, i, check\ninteger, allocatable :: a(:), m(:)\n\nread(*,*) n\nallocate (a(n), m(n-1))\nread(*,*) (a(i), i=1,n)\n\ncall hs(n,a)\n\ncheck = 0\ndo i = 1, n-1\n\tm(i) = mod(a(n),a(i))\n if(m(i) /= 0) then\n \tcheck = 1\n end if\nend do\n\nif(check == 1)then\n\twrite(*,'(i0)') 1\nelse\n\twrite(*,'(i0)') a(1)\nend if\n\nEND PROGRAM ATCODER\n\nsubroutine hs(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n integer :: t\n \n if(n <= 0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n == 1)return\n \n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j <= k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n \n return\nend subroutine hs", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "sample_input": "4\n2 10 8 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03127", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N monsters, numbered 1, 2, ..., N.\n\nInitially, the health of Monster i is A_i.\n\nBelow, a monster with at least 1 health is called alive.\n\nUntil there is only one alive monster, the following is repeated:\n\nA random alive monster attacks another random alive monster.\n\nAs a result, the health of the monster attacked is reduced by the amount equal to the current health of the monster attacking.\n\nFind the minimum possible final health of the last monster alive.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible final health of the last monster alive.\n\nSample Input 1\n\n4\n2 10 8 40\n\nSample Output 1\n\n2\n\nWhen only the first monster keeps on attacking, the final health of the last monster will be 2, which is minimum.\n\nSample Input 2\n\n4\n5 13 8 1000000000\n\nSample Output 2\n\n1\n\nSample Input 3\n\n3\n1000000000 1000000000 1000000000\n\nSample Output 3\n\n1000000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1156, "cpu_time_ms": 44, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s234957115", "group_id": "codeNet:p03128", "input_text": "program atcoder\n implicit none\n integer(8) :: i,j,n,m,ans=0,k,mincost=-1,use2max=-1\n integer(8),allocatable,dimension(:) :: a,canuse,cost\n character(len=10000),allocatable,dimension(:) :: dp,x\n read*,n,m\n allocate(a(m))\n allocate(canuse(9))\n allocate(cost(9))\n allocate(dp(0:n))\n dp = \"-\"\n x = (/\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"/);\n cost = (/2,5,5,4,5,6,3,7,6/)\n read(*,*)(a(j),j=1,m)\n dp(0) = \"\"\n do i=0,N\n if(trim(dp(i))==\"-\")then\n cycle\n endif\n do j=1,m\n if(i+cost(a(j)) > N )then\n cycle\n endif\n dp(i+cost(a(j))) = maxst( dp(i+cost(a(j))) , trim(dp(i))//x(a(j)) )\n enddo\n enddo\n write(*,'(a)')trim(dp(n))\n stop \ncontains\nfunction maxst(x,y)\n character maxst*10000,x*10000,y*10000\n if(x==\"-\")then\n maxst = y\n else if(y==\"-\")then\n maxst = x\n else if(len(trim(x))>len(trim(y)))then\n maxst = x\n else if(len(trim(x))=y)then\n maxst = x\n else\n maxst = y\n endif\nend function maxst\nend program atcoder", "language": "Fortran", "metadata": {"date": 1550425107, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03128.html", "problem_id": "p03128", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03128/input.txt", "sample_output_relpath": "derived/input_output/data/p03128/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03128/Fortran/s234957115.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s234957115", "user_id": "u780122303"}, "prompt_components": {"gold_output": "777773\n", "input_to_evaluate": "program atcoder\n implicit none\n integer(8) :: i,j,n,m,ans=0,k,mincost=-1,use2max=-1\n integer(8),allocatable,dimension(:) :: a,canuse,cost\n character(len=10000),allocatable,dimension(:) :: dp,x\n read*,n,m\n allocate(a(m))\n allocate(canuse(9))\n allocate(cost(9))\n allocate(dp(0:n))\n dp = \"-\"\n x = (/\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\"/);\n cost = (/2,5,5,4,5,6,3,7,6/)\n read(*,*)(a(j),j=1,m)\n dp(0) = \"\"\n do i=0,N\n if(trim(dp(i))==\"-\")then\n cycle\n endif\n do j=1,m\n if(i+cost(a(j)) > N )then\n cycle\n endif\n dp(i+cost(a(j))) = maxst( dp(i+cost(a(j))) , trim(dp(i))//x(a(j)) )\n enddo\n enddo\n write(*,'(a)')trim(dp(n))\n stop \ncontains\nfunction maxst(x,y)\n character maxst*10000,x*10000,y*10000\n if(x==\"-\")then\n maxst = y\n else if(y==\"-\")then\n maxst = x\n else if(len(trim(x))>len(trim(y)))then\n maxst = x\n else if(len(trim(x))=y)then\n maxst = x\n else\n maxst = y\n endif\nend function maxst\nend program atcoder", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFind the largest integer that can be formed with exactly N matchsticks, under the following conditions:\n\nEvery digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \\leq A_i \\leq 9).\n\nThe number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respectively.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^4\n\n1 \\leq M \\leq 9\n\n1 \\leq A_i \\leq 9\n\nA_i are all different.\n\nThere exists an integer that can be formed by exactly N matchsticks under the conditions.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the largest integer that can be formed with exactly N matchsticks under the conditions in the problem statement.\n\nSample Input 1\n\n20 4\n3 7 8 4\n\nSample Output 1\n\n777773\n\nThe integer 777773 can be formed with 3 + 3 + 3 + 3 + 3 + 5 = 20 matchsticks, and this is the largest integer that can be formed by 20 matchsticks under the conditions.\n\nSample Input 2\n\n101 9\n9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n71111111111111111111111111111111111111111111111111\n\nThe output may not fit into a 64-bit integer type.\n\nSample Input 3\n\n15 3\n5 4 6\n\nSample Output 3\n\n654", "sample_input": "20 4\n3 7 8 4\n"}, "reference_outputs": ["777773\n"], "source_document_id": "p03128", "source_text": "Score : 400 points\n\nProblem Statement\n\nFind the largest integer that can be formed with exactly N matchsticks, under the following conditions:\n\nEvery digit in the integer must be one of the digits A_1, A_2, ..., A_M (1 \\leq A_i \\leq 9).\n\nThe number of matchsticks used to form digits 1, 2, 3, 4, 5, 6, 7, 8, 9 should be 2, 5, 5, 4, 5, 6, 3, 7, 6, respectively.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^4\n\n1 \\leq M \\leq 9\n\n1 \\leq A_i \\leq 9\n\nA_i are all different.\n\nThere exists an integer that can be formed by exactly N matchsticks under the conditions.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the largest integer that can be formed with exactly N matchsticks under the conditions in the problem statement.\n\nSample Input 1\n\n20 4\n3 7 8 4\n\nSample Output 1\n\n777773\n\nThe integer 777773 can be formed with 3 + 3 + 3 + 3 + 3 + 5 = 20 matchsticks, and this is the largest integer that can be formed by 20 matchsticks under the conditions.\n\nSample Input 2\n\n101 9\n9 8 7 6 5 4 3 2 1\n\nSample Output 2\n\n71111111111111111111111111111111111111111111111111\n\nThe output may not fit into a 64-bit integer type.\n\nSample Input 3\n\n15 3\n5 4 6\n\nSample Output 3\n\n654", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1145, "cpu_time_ms": 396, "memory_kb": 98280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s041253027", "group_id": "codeNet:p03130", "input_text": "integer town(4)\ninteger a,b\ntown=0\ndo i=1,3\n read*,a,b\n town(a)=town(a)+1\n town(b)=town(b)+1\nend do\nif(maxval(town)==3 )then\n print\"(A)\",\"NO\"\nelse\n print\"(A)\",\"YES\"\nendif\nend", "language": "Fortran", "metadata": {"date": 1557352290, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03130.html", "problem_id": "p03130", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03130/input.txt", "sample_output_relpath": "derived/input_output/data/p03130/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03130/Fortran/s041253027.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s041253027", "user_id": "u598073939"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "integer town(4)\ninteger a,b\ntown=0\ndo i=1,3\n read*,a,b\n town(a)=town(a)+1\n town(b)=town(b)+1\nend do\nif(maxval(town)==3 )then\n print\"(A)\",\"NO\"\nelse\n print\"(A)\",\"YES\"\nendif\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are four towns, numbered 1,2,3 and 4.\nAlso, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally.\nNo two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roads.\n\nDetermine if we can visit all the towns by traversing each of the roads exactly once.\n\nConstraints\n\n1 \\leq a_i,b_i \\leq 4(1\\leq i\\leq 3)\n\na_i and b_i are different. (1\\leq i\\leq 3)\n\nNo two roads connect the same pair of towns.\n\nAny town can be reached from any other town using the roads.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na_1 b_1\na_2 b_2\na_3 b_3\n\nOutput\n\nIf we can visit all the towns by traversing each of the roads exactly once, print YES; otherwise, print NO.\n\nSample Input 1\n\n4 2\n1 3\n2 3\n\nSample Output 1\n\nYES\n\nWe can visit all the towns in the order 1,3,2,4.\n\nSample Input 2\n\n3 2\n2 4\n1 2\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n2 1\n3 2\n4 3\n\nSample Output 3\n\nYES", "sample_input": "4 2\n1 3\n2 3\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03130", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are four towns, numbered 1,2,3 and 4.\nAlso, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally.\nNo two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roads.\n\nDetermine if we can visit all the towns by traversing each of the roads exactly once.\n\nConstraints\n\n1 \\leq a_i,b_i \\leq 4(1\\leq i\\leq 3)\n\na_i and b_i are different. (1\\leq i\\leq 3)\n\nNo two roads connect the same pair of towns.\n\nAny town can be reached from any other town using the roads.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na_1 b_1\na_2 b_2\na_3 b_3\n\nOutput\n\nIf we can visit all the towns by traversing each of the roads exactly once, print YES; otherwise, print NO.\n\nSample Input 1\n\n4 2\n1 3\n2 3\n\nSample Output 1\n\nYES\n\nWe can visit all the towns in the order 1,3,2,4.\n\nSample Input 2\n\n3 2\n2 4\n1 2\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n2 1\n3 2\n4 3\n\nSample Output 3\n\nYES", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 179, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s242895164", "group_id": "codeNet:p03131", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: k,a,b,ans\n\n read*, k,a,b\n ans=a + ((k-(a-1))/2)*(b-a)\n if (mod(k-(a-1),2_8) == 1) ans=ans+1\n print'(i0)', max(k+1,ans)\nend program name", "language": "Fortran", "metadata": {"date": 1587016290, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03131.html", "problem_id": "p03131", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03131/input.txt", "sample_output_relpath": "derived/input_output/data/p03131/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03131/Fortran/s242895164.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s242895164", "user_id": "u234636620"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: k,a,b,ans\n\n read*, k,a,b\n ans=a + ((k-(a-1))/2)*(b-a)\n if (mod(k-(a-1),2_8) == 1) ans=ans+1\n print'(i0)', max(k+1,ans)\nend program name", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke has one biscuit and zero Japanese yen (the currency) in his pocket.\nHe will perform the following operations exactly K times in total, in the order he likes:\n\nHit his pocket, which magically increases the number of biscuits by one.\n\nExchange A biscuits to 1 yen.\n\nExchange 1 yen to B biscuits.\n\nFind the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nConstraints\n\n1 \\leq K,A,B \\leq 10^9\n\nK,A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK A B\n\nOutput\n\nPrint the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nSample Input 1\n\n4 2 6\n\nSample Output 1\n\n7\n\nThe number of biscuits in Snuke's pocket after K operations is maximized as follows:\n\nHit his pocket. Now he has 2 biscuits and 0 yen.\n\nExchange 2 biscuits to 1 yen. his pocket. Now he has 0 biscuits and 1 yen.\n\nHit his pocket. Now he has 1 biscuits and 1 yen.\n\nExchange 1 yen to 6 biscuits. his pocket. Now he has 7 biscuits and 0 yen.\n\nSample Input 2\n\n7 3 4\n\nSample Output 2\n\n8\n\nSample Input 3\n\n314159265 35897932 384626433\n\nSample Output 3\n\n48518828981938099", "sample_input": "4 2 6\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03131", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke has one biscuit and zero Japanese yen (the currency) in his pocket.\nHe will perform the following operations exactly K times in total, in the order he likes:\n\nHit his pocket, which magically increases the number of biscuits by one.\n\nExchange A biscuits to 1 yen.\n\nExchange 1 yen to B biscuits.\n\nFind the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nConstraints\n\n1 \\leq K,A,B \\leq 10^9\n\nK,A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK A B\n\nOutput\n\nPrint the maximum possible number of biscuits in Snuke's pocket after K operations.\n\nSample Input 1\n\n4 2 6\n\nSample Output 1\n\n7\n\nThe number of biscuits in Snuke's pocket after K operations is maximized as follows:\n\nHit his pocket. Now he has 2 biscuits and 0 yen.\n\nExchange 2 biscuits to 1 yen. his pocket. Now he has 0 biscuits and 1 yen.\n\nHit his pocket. Now he has 1 biscuits and 1 yen.\n\nExchange 1 yen to 6 biscuits. his pocket. Now he has 7 biscuits and 0 yen.\n\nSample Input 2\n\n7 3 4\n\nSample Output 2\n\n8\n\nSample Input 3\n\n314159265 35897932 384626433\n\nSample Output 3\n\n48518828981938099", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 236, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s977027219", "group_id": "codeNet:p03135", "input_text": "real a,b\nread*, a,b\nprint*, a/b\nend", "language": "Fortran", "metadata": {"date": 1571900239, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03135.html", "problem_id": "p03135", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03135/input.txt", "sample_output_relpath": "derived/input_output/data/p03135/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03135/Fortran/s977027219.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s977027219", "user_id": "u244203620"}, "prompt_components": {"gold_output": "2.6666666667\n", "input_to_evaluate": "real a,b\nread*, a,b\nprint*, a/b\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "sample_input": "8 3\n"}, "reference_outputs": ["2.6666666667\n"], "source_document_id": "p03135", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 35, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s124899456", "group_id": "codeNet:p03135", "input_text": "program shiken\n implicit none\n real(8) :: T,X,Y\n\n read(*,*) T,X\n\n Y=T*1.0/X\n write(*,*) Y\n\n\nend program shiken\n\n\n", "language": "Fortran", "metadata": {"date": 1549248673, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03135.html", "problem_id": "p03135", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03135/input.txt", "sample_output_relpath": "derived/input_output/data/p03135/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03135/Fortran/s124899456.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s124899456", "user_id": "u613124399"}, "prompt_components": {"gold_output": "2.6666666667\n", "input_to_evaluate": "program shiken\n implicit none\n real(8) :: T,X,Y\n\n read(*,*) T,X\n\n Y=T*1.0/X\n write(*,*) Y\n\n\nend program shiken\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "sample_input": "8 3\n"}, "reference_outputs": ["2.6666666667\n"], "source_document_id": "p03135", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn order to pass the entrance examination tomorrow, Taro has to study for T more hours.\n\nFortunately, he can leap to World B where time passes X times as fast as it does in our world (World A).\n\nWhile (X \\times t) hours pass in World B, t hours pass in World A.\n\nHow many hours will pass in World A while Taro studies for T hours in World B?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq T \\leq 100\n\n1 \\leq X \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT X\n\nOutput\n\nPrint the number of hours that will pass in World A.\n\nThe output will be regarded as correct when its absolute or relative error from the judge's output is at most 10^{-3}.\n\nSample Input 1\n\n8 3\n\nSample Output 1\n\n2.6666666667\n\nWhile Taro studies for eight hours in World B where time passes three times as fast, 2.6666... hours will pass in World A.\n\nNote that an absolute or relative error of at most 10^{-3} is allowed.\n\nSample Input 2\n\n99 1\n\nSample Output 2\n\n99.0000000000\n\nSample Input 3\n\n1 100\n\nSample Output 3\n\n0.0100000000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 118, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s586085615", "group_id": "codeNet:p03136", "input_text": "INTEGER N\ninteger,allocatable,dimension(:)::x\nREAD*,N\nallocate(x(n))\nread*,x\nPRINT\"(A)\",MERGE(\"Yes\",\" No\",Maxval(x)*2 L(i+1))then\n mx=mx\nendif\nend do\n!結果の書き出し\n\ndo i=0,N\nif(mx==L(i)) cycle\nx=L(i)+x\nend do\n\nif(mx L(i+1))then\n mx=mx\nendif\nend do\n!結果の書き出し\n\ndo i=0,N\nif(mx==L(i)) cycle\nx=L(i)+x\nend do\n\nif(mx= m) then\n print'(i0)', 0\n stop\n end if\n allocate(x(m))\n read*, x(:)\n allocate(dx(m-1))\n call merge_sort(x,1,m)\n do i=1,m-1\n dx(i) = x(i+1)-x(i)\n end do\n call merge_sort(dx,1,m-1)\n print'(i0)', sum(dx(1:m-n))\n\ncontains\nrecursive subroutine merge_sort(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call merge_sort(ar, fst, mdl)\n call merge_sort(ar, mdl+1, lst)\n call merge_(ar, fst, mdl, lst)\nend subroutine\n\nsubroutine merge_(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\nend subroutine\n\nsubroutine swap(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\nend subroutine\nend program name", "language": "Fortran", "metadata": {"date": 1587054278, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03137.html", "problem_id": "p03137", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03137/input.txt", "sample_output_relpath": "derived/input_output/data/p03137/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03137/Fortran/s951700743.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s951700743", "user_id": "u234636620"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,m,i\n integer(int32), allocatable:: x(:),dx(:)\n\n read*, n,m\n if (n >= m) then\n print'(i0)', 0\n stop\n end if\n allocate(x(m))\n read*, x(:)\n allocate(dx(m-1))\n call merge_sort(x,1,m)\n do i=1,m-1\n dx(i) = x(i+1)-x(i)\n end do\n call merge_sort(dx,1,m-1)\n print'(i0)', sum(dx(1:m-n))\n\ncontains\nrecursive subroutine merge_sort(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call merge_sort(ar, fst, mdl)\n call merge_sort(ar, mdl+1, lst)\n call merge_(ar, fst, mdl, lst)\nend subroutine\n\nsubroutine merge_(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\nend subroutine\n\nsubroutine swap(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\nend subroutine\nend program name", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will play a one-player game using a number line and N pieces.\n\nFirst, we place each of these pieces at some integer coordinate.\n\nHere, multiple pieces can be placed at the same coordinate.\n\nOur objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move:\n\nMove: Choose a piece and let x be its coordinate. Put that piece at coordinate x+1 or x-1.\n\nNote that the coordinates where we initially place the pieces are already regarded as visited.\n\nFind the minimum number of moves required to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n-10^5 \\leq X_i \\leq 10^5\n\nX_1, X_2, ..., X_M are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 X_2 ... X_M\n\nOutput\n\nFind the minimum number of moves required to achieve the objective.\n\nSample Input 1\n\n2 5\n10 12 1 2 14\n\nSample Output 1\n\n5\n\nThe objective can be achieved in five moves as follows, and this is the minimum number of moves required.\n\nInitially, put the two pieces at coordinates 1 and 10.\n\nMove the piece at coordinate 1 to 2.\n\nMove the piece at coordinate 10 to 11.\n\nMove the piece at coordinate 11 to 12.\n\nMove the piece at coordinate 12 to 13.\n\nMove the piece at coordinate 13 to 14.\n\nSample Input 2\n\n3 7\n-10 -3 0 9 -100 2 17\n\nSample Output 2\n\n19\n\nSample Input 3\n\n100 1\n-100000\n\nSample Output 3\n\n0", "sample_input": "2 5\n10 12 1 2 14\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03137", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will play a one-player game using a number line and N pieces.\n\nFirst, we place each of these pieces at some integer coordinate.\n\nHere, multiple pieces can be placed at the same coordinate.\n\nOur objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move:\n\nMove: Choose a piece and let x be its coordinate. Put that piece at coordinate x+1 or x-1.\n\nNote that the coordinates where we initially place the pieces are already regarded as visited.\n\nFind the minimum number of moves required to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n-10^5 \\leq X_i \\leq 10^5\n\nX_1, X_2, ..., X_M are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 X_2 ... X_M\n\nOutput\n\nFind the minimum number of moves required to achieve the objective.\n\nSample Input 1\n\n2 5\n10 12 1 2 14\n\nSample Output 1\n\n5\n\nThe objective can be achieved in five moves as follows, and this is the minimum number of moves required.\n\nInitially, put the two pieces at coordinates 1 and 10.\n\nMove the piece at coordinate 1 to 2.\n\nMove the piece at coordinate 10 to 11.\n\nMove the piece at coordinate 11 to 12.\n\nMove the piece at coordinate 12 to 13.\n\nMove the piece at coordinate 13 to 14.\n\nSample Input 2\n\n3 7\n-10 -3 0 9 -100 2 17\n\nSample Output 2\n\n19\n\nSample Input 3\n\n100 1\n-100000\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1651, "cpu_time_ms": 49, "memory_kb": 1844}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s525545997", "group_id": "codeNet:p03137", "input_text": "integer n,m,a,ans\ninteger,allocatable,dimension(:)::x,dx(:)\n\nread*,n, m\nallocate(x(m),dx(m-1))\nread*, (x(i), i=1,m)\n\nif(n >= m)then\n print\"(i0)\",0\n stop\nend if\n\ncall heapsort(m,x)\n\ndo i =1, m-1\n dx(i)=x(i+1) - x(i)\nend do\n\ncall heapsort(m-1,dx)\n\nans = sum(dx)\nif (n > 1)ans = ans - sum(dx(m-n+1:m-1))\nprint\"(i0)\",ans\n\ncontains\n\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n integer::i,k,j,l\n integer:: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend", "language": "Fortran", "metadata": {"date": 1565312515, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03137.html", "problem_id": "p03137", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03137/input.txt", "sample_output_relpath": "derived/input_output/data/p03137/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03137/Fortran/s525545997.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s525545997", "user_id": "u598073939"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "integer n,m,a,ans\ninteger,allocatable,dimension(:)::x,dx(:)\n\nread*,n, m\nallocate(x(m),dx(m-1))\nread*, (x(i), i=1,m)\n\nif(n >= m)then\n print\"(i0)\",0\n stop\nend if\n\ncall heapsort(m,x)\n\ndo i =1, m-1\n dx(i)=x(i+1) - x(i)\nend do\n\ncall heapsort(m-1,dx)\n\nans = sum(dx)\nif (n > 1)ans = ans - sum(dx(m-n+1:m-1))\nprint\"(i0)\",ans\n\ncontains\n\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n integer::i,k,j,l\n integer:: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will play a one-player game using a number line and N pieces.\n\nFirst, we place each of these pieces at some integer coordinate.\n\nHere, multiple pieces can be placed at the same coordinate.\n\nOur objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move:\n\nMove: Choose a piece and let x be its coordinate. Put that piece at coordinate x+1 or x-1.\n\nNote that the coordinates where we initially place the pieces are already regarded as visited.\n\nFind the minimum number of moves required to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n-10^5 \\leq X_i \\leq 10^5\n\nX_1, X_2, ..., X_M are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 X_2 ... X_M\n\nOutput\n\nFind the minimum number of moves required to achieve the objective.\n\nSample Input 1\n\n2 5\n10 12 1 2 14\n\nSample Output 1\n\n5\n\nThe objective can be achieved in five moves as follows, and this is the minimum number of moves required.\n\nInitially, put the two pieces at coordinates 1 and 10.\n\nMove the piece at coordinate 1 to 2.\n\nMove the piece at coordinate 10 to 11.\n\nMove the piece at coordinate 11 to 12.\n\nMove the piece at coordinate 12 to 13.\n\nMove the piece at coordinate 13 to 14.\n\nSample Input 2\n\n3 7\n-10 -3 0 9 -100 2 17\n\nSample Output 2\n\n19\n\nSample Input 3\n\n100 1\n-100000\n\nSample Output 3\n\n0", "sample_input": "2 5\n10 12 1 2 14\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03137", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will play a one-player game using a number line and N pieces.\n\nFirst, we place each of these pieces at some integer coordinate.\n\nHere, multiple pieces can be placed at the same coordinate.\n\nOur objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move:\n\nMove: Choose a piece and let x be its coordinate. Put that piece at coordinate x+1 or x-1.\n\nNote that the coordinates where we initially place the pieces are already regarded as visited.\n\nFind the minimum number of moves required to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n-10^5 \\leq X_i \\leq 10^5\n\nX_1, X_2, ..., X_M are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 X_2 ... X_M\n\nOutput\n\nFind the minimum number of moves required to achieve the objective.\n\nSample Input 1\n\n2 5\n10 12 1 2 14\n\nSample Output 1\n\n5\n\nThe objective can be achieved in five moves as follows, and this is the minimum number of moves required.\n\nInitially, put the two pieces at coordinates 1 and 10.\n\nMove the piece at coordinate 1 to 2.\n\nMove the piece at coordinate 10 to 11.\n\nMove the piece at coordinate 11 to 12.\n\nMove the piece at coordinate 12 to 13.\n\nMove the piece at coordinate 13 to 14.\n\nSample Input 2\n\n3 7\n-10 -3 0 9 -100 2 17\n\nSample Output 2\n\n19\n\nSample Input 3\n\n100 1\n-100000\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1097, "cpu_time_ms": 41, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s414106096", "group_id": "codeNet:p03137", "input_text": "program stream\n integer(8) :: n,m, i, j, k, l, ans\n integer(8),allocatable :: x(:),y(:),z(:),w(:)\n\n read *, n, m \n ans = 0\n allocate(x(m),y(m),z(m-1),w(m-1))\n read *, x\n do i = 1, m\n y(i) = minval(x)\n x(minloc(x)) = 200000\n end do\n\n !print '(i0)', y\n \n do j = 1, m-1\n z(j) = y(j+1) - y(j)\n end do\n\n !print '(i0)', z\n \n do k = 1, m-1\n w(k) = minval(z)\n z(minloc(z)) = 300000\n end do\n\n !print '(i0)', w\n \n if (n >= m) then\n print '(i0)', 0\n else\n do l = 1, m-n\n ans = ans + w(l)\n end do\n print '(i0)', ans\n end if\n stop\nend program", "language": "Fortran", "metadata": {"date": 1556226445, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03137.html", "problem_id": "p03137", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03137/input.txt", "sample_output_relpath": "derived/input_output/data/p03137/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03137/Fortran/s414106096.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s414106096", "user_id": "u121479332"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program stream\n integer(8) :: n,m, i, j, k, l, ans\n integer(8),allocatable :: x(:),y(:),z(:),w(:)\n\n read *, n, m \n ans = 0\n allocate(x(m),y(m),z(m-1),w(m-1))\n read *, x\n do i = 1, m\n y(i) = minval(x)\n x(minloc(x)) = 200000\n end do\n\n !print '(i0)', y\n \n do j = 1, m-1\n z(j) = y(j+1) - y(j)\n end do\n\n !print '(i0)', z\n \n do k = 1, m-1\n w(k) = minval(z)\n z(minloc(z)) = 300000\n end do\n\n !print '(i0)', w\n \n if (n >= m) then\n print '(i0)', 0\n else\n do l = 1, m-n\n ans = ans + w(l)\n end do\n print '(i0)', ans\n end if\n stop\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe will play a one-player game using a number line and N pieces.\n\nFirst, we place each of these pieces at some integer coordinate.\n\nHere, multiple pieces can be placed at the same coordinate.\n\nOur objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move:\n\nMove: Choose a piece and let x be its coordinate. Put that piece at coordinate x+1 or x-1.\n\nNote that the coordinates where we initially place the pieces are already regarded as visited.\n\nFind the minimum number of moves required to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n-10^5 \\leq X_i \\leq 10^5\n\nX_1, X_2, ..., X_M are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 X_2 ... X_M\n\nOutput\n\nFind the minimum number of moves required to achieve the objective.\n\nSample Input 1\n\n2 5\n10 12 1 2 14\n\nSample Output 1\n\n5\n\nThe objective can be achieved in five moves as follows, and this is the minimum number of moves required.\n\nInitially, put the two pieces at coordinates 1 and 10.\n\nMove the piece at coordinate 1 to 2.\n\nMove the piece at coordinate 10 to 11.\n\nMove the piece at coordinate 11 to 12.\n\nMove the piece at coordinate 12 to 13.\n\nMove the piece at coordinate 13 to 14.\n\nSample Input 2\n\n3 7\n-10 -3 0 9 -100 2 17\n\nSample Output 2\n\n19\n\nSample Input 3\n\n100 1\n-100000\n\nSample Output 3\n\n0", "sample_input": "2 5\n10 12 1 2 14\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03137", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe will play a one-player game using a number line and N pieces.\n\nFirst, we place each of these pieces at some integer coordinate.\n\nHere, multiple pieces can be placed at the same coordinate.\n\nOur objective is to visit all of the M coordinates X_1, X_2, ..., X_M with these pieces, by repeating the following move:\n\nMove: Choose a piece and let x be its coordinate. Put that piece at coordinate x+1 or x-1.\n\nNote that the coordinates where we initially place the pieces are already regarded as visited.\n\nFind the minimum number of moves required to achieve the objective.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n-10^5 \\leq X_i \\leq 10^5\n\nX_1, X_2, ..., X_M are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 X_2 ... X_M\n\nOutput\n\nFind the minimum number of moves required to achieve the objective.\n\nSample Input 1\n\n2 5\n10 12 1 2 14\n\nSample Output 1\n\n5\n\nThe objective can be achieved in five moves as follows, and this is the minimum number of moves required.\n\nInitially, put the two pieces at coordinates 1 and 10.\n\nMove the piece at coordinate 1 to 2.\n\nMove the piece at coordinate 10 to 11.\n\nMove the piece at coordinate 11 to 12.\n\nMove the piece at coordinate 12 to 13.\n\nMove the piece at coordinate 13 to 14.\n\nSample Input 2\n\n3 7\n-10 -3 0 9 -100 2 17\n\nSample Output 2\n\n19\n\nSample Input 3\n\n100 1\n-100000\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 583, "cpu_time_ms": 2103, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s376435740", "group_id": "codeNet:p03140", "input_text": "program main\nimplicit None\n\tinteger(8)::n,p=0,i\n\tcharacter(len =100)::a,b,c\n\t\n\tread*,n\n\tread*,a,b,c\n\t\n\tdo i = 1,n\n\t\tif(a(i:i) == b(i:i))then\n\t\t\tif(a(i:i) /= c(i:i)) p = p+1\n\t\t\telse\n\t\t\t\tif(a(i:i) == c(i:i))then\n\t\t\t\t\tp = p+1\n\t\t\t\t\telse if(b(i:i) == c(i:i))then\n\t\t\t\t\tp = p+1\n\t\t\t\t\telse\n\t\t\t\t\tp = p+2\n\t\t\t\tendif\n\t\tendif\n\tenddo\n\t\n\tprint \"(i0)\",p\nend program main", "language": "Fortran", "metadata": {"date": 1548642108, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03140.html", "problem_id": "p03140", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03140/input.txt", "sample_output_relpath": "derived/input_output/data/p03140/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03140/Fortran/s376435740.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s376435740", "user_id": "u900266249"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\nimplicit None\n\tinteger(8)::n,p=0,i\n\tcharacter(len =100)::a,b,c\n\t\n\tread*,n\n\tread*,a,b,c\n\t\n\tdo i = 1,n\n\t\tif(a(i:i) == b(i:i))then\n\t\t\tif(a(i:i) /= c(i:i)) p = p+1\n\t\t\telse\n\t\t\t\tif(a(i:i) == c(i:i))then\n\t\t\t\t\tp = p+1\n\t\t\t\t\telse if(b(i:i) == c(i:i))then\n\t\t\t\t\tp = p+1\n\t\t\t\t\telse\n\t\t\t\t\tp = p+2\n\t\t\t\tendif\n\t\tendif\n\tenddo\n\t\n\tprint \"(i0)\",p\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.\n\nOur objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:\n\nOperation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.\n\nWhat is the minimum number of operations required to achieve the objective?\n\nConstraints\n\n1 \\leq N \\leq 100\n\nEach of the strings A, B and C is a string of length N.\n\nEach character in each of the strings A, B and C is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\nB\nC\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4\nwest\neast\nwait\n\nSample Output 1\n\n3\n\nIn this sample, initially A = west、B = east、C = wait. We can achieve the objective in the minimum number of operations by performing three operations as follows:\n\nChange the second character in A to a. A is now wast.\n\nChange the first character in B to w. B is now wast.\n\nChange the third character in C to s. C is now wast.\n\nSample Input 2\n\n9\ndifferent\ndifferent\ndifferent\n\nSample Output 2\n\n0\n\nIf A, B and C are already equal in the beginning, the number of operations required is 0.\n\nSample Input 3\n\n7\nzenkoku\ntouitsu\nprogram\n\nSample Output 3\n\n13", "sample_input": "4\nwest\neast\nwait\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03140", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given three strings A, B and C. Each of these is a string of length N consisting of lowercase English letters.\n\nOur objective is to make all these three strings equal. For that, you can repeatedly perform the following operation:\n\nOperation: Choose one of the strings A, B and C, and specify an integer i between 1 and N (inclusive). Change the i-th character from the beginning of the chosen string to some other lowercase English letter.\n\nWhat is the minimum number of operations required to achieve the objective?\n\nConstraints\n\n1 \\leq N \\leq 100\n\nEach of the strings A, B and C is a string of length N.\n\nEach character in each of the strings A, B and C is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\nB\nC\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4\nwest\neast\nwait\n\nSample Output 1\n\n3\n\nIn this sample, initially A = west、B = east、C = wait. We can achieve the objective in the minimum number of operations by performing three operations as follows:\n\nChange the second character in A to a. A is now wast.\n\nChange the first character in B to w. B is now wast.\n\nChange the third character in C to s. C is now wast.\n\nSample Input 2\n\n9\ndifferent\ndifferent\ndifferent\n\nSample Output 2\n\n0\n\nIf A, B and C are already equal in the beginning, the number of operations required is 0.\n\nSample Input 3\n\n7\nzenkoku\ntouitsu\nprogram\n\nSample Output 3\n\n13", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 353, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s249227341", "group_id": "codeNet:p03141", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger(8) :: n,i,j,s,dif\ninteger(8),allocatable :: a(:), b(:), c(:)\n\nread(*,*) n\nallocate(a(n)) ; allocate(b(n)) ; allocate(c(n))\n\ndif = 0\ndo i = 1, n\n read(*,*) a(i),b(i)\nend do\n\nc(:) = a(:) + b(:)\n\ndif = -sum(b)\n\nwrite(*,*) c(:)\ncall hsort(n,c)\nwrite(*,*) c(:)\n\ndo i = 1, n, 2\n dif = dif + c(i)\nend do\n\ndeallocate(a) ; deallocate(b) ; deallocate(c)\n\nwrite(*,'(i0)') dif\n\nEND PROGRAM ATCODER\n\n\n! 以下サブルーチン\nsubroutine hsort(n, x)\n implicit none\n integer, intent(IN) :: n\n real(8), intent(INOUT) :: x(n)\n ! local\n integer k\n real(8) :: tmp\n ! external subroutine\n external mkheap\n\n do k = n/2, 1, -1\n tmp = x(k)\n call mkheap(n, x, k, n, tmp)\n enddo\n\n do k = n, 2, -1\n tmp = x(k)\n x(k) = x(1)\n call mkheap(n, x, 1, k-1, tmp)\n end do\n\n return\nend subroutine hsort\n\nsubroutine mkheap(n, x, root, leaf, val)\n implicit none\n integer, intent(IN) :: n, root, leaf\n real(8), intent(INOUT) :: x(1:n)\n real(8), intent(IN) :: val\n ! local\n integer :: i, j\n\n i = root\n j = i * 2\n\n do\n if (j > leaf) exit\n\n if (j < leaf) then\n if (x(j) < x(j+1)) j = j + 1\n end if\n\n if (x(j) > val) then\n x(i) = x(j)\n i = j\n j = i * 2\n else\n j = leaf + 1\n endif\n end do\n\n x(i) = val\n\n return\nend subroutine mkheap\n!サブルーチン終了", "language": "Fortran", "metadata": {"date": 1548655535, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03141.html", "problem_id": "p03141", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03141/input.txt", "sample_output_relpath": "derived/input_output/data/p03141/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03141/Fortran/s249227341.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s249227341", "user_id": "u454557108"}, "prompt_components": {"gold_output": "20\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger(8) :: n,i,j,s,dif\ninteger(8),allocatable :: a(:), b(:), c(:)\n\nread(*,*) n\nallocate(a(n)) ; allocate(b(n)) ; allocate(c(n))\n\ndif = 0\ndo i = 1, n\n read(*,*) a(i),b(i)\nend do\n\nc(:) = a(:) + b(:)\n\ndif = -sum(b)\n\nwrite(*,*) c(:)\ncall hsort(n,c)\nwrite(*,*) c(:)\n\ndo i = 1, n, 2\n dif = dif + c(i)\nend do\n\ndeallocate(a) ; deallocate(b) ; deallocate(c)\n\nwrite(*,'(i0)') dif\n\nEND PROGRAM ATCODER\n\n\n! 以下サブルーチン\nsubroutine hsort(n, x)\n implicit none\n integer, intent(IN) :: n\n real(8), intent(INOUT) :: x(n)\n ! local\n integer k\n real(8) :: tmp\n ! external subroutine\n external mkheap\n\n do k = n/2, 1, -1\n tmp = x(k)\n call mkheap(n, x, k, n, tmp)\n enddo\n\n do k = n, 2, -1\n tmp = x(k)\n x(k) = x(1)\n call mkheap(n, x, 1, k-1, tmp)\n end do\n\n return\nend subroutine hsort\n\nsubroutine mkheap(n, x, root, leaf, val)\n implicit none\n integer, intent(IN) :: n, root, leaf\n real(8), intent(INOUT) :: x(1:n)\n real(8), intent(IN) :: val\n ! local\n integer :: i, j\n\n i = root\n j = i * 2\n\n do\n if (j > leaf) exit\n\n if (j < leaf) then\n if (x(j) < x(j+1)) j = j + 1\n end if\n\n if (x(j) > val) then\n x(i) = x(j)\n i = j\n j = i * 2\n else\n j = leaf + 1\n endif\n end do\n\n x(i) = val\n\n return\nend subroutine mkheap\n!サブルーチン終了", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N dishes of cuisine placed in front of Takahashi and Aoki.\nFor convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.\n\nWhen Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happiness.\n\nStarting from Takahashi, they alternately choose one dish and eat it, until there is no more dish to eat.\nHere, both of them choose dishes so that the following value is maximized: \"the sum of the happiness he/she will earn in the end\" minus \"the sum of the happiness the other person will earn in the end\".\n\nFind the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nSample Input 1\n\n3\n10 10\n20 20\n30 30\n\nSample Output 1\n\n20\n\nIn this sample, both of them earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since Takahashi and Aoki have the same \"taste\", each time they will choose the dish with which they can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (30 + 10) - 20 = 20.\n\nSample Input 2\n\n3\n20 10\n20 20\n20 30\n\nSample Output 2\n\n20\n\nIn this sample, Takahashi earns 20 points of happiness by eating any one of the dishes 1, 2 and 3, but Aoki earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since only Aoki has likes and dislikes, each time they will choose the dish with which Aoki can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (20 + 20) - 20 = 20.\n\nSample Input 3\n\n6\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 3\n\n-2999999997\n\nNote that the answer may not fit into a 32-bit integer.", "sample_input": "3\n10 10\n20 20\n30 30\n"}, "reference_outputs": ["20\n"], "source_document_id": "p03141", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N dishes of cuisine placed in front of Takahashi and Aoki.\nFor convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.\n\nWhen Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happiness.\n\nStarting from Takahashi, they alternately choose one dish and eat it, until there is no more dish to eat.\nHere, both of them choose dishes so that the following value is maximized: \"the sum of the happiness he/she will earn in the end\" minus \"the sum of the happiness the other person will earn in the end\".\n\nFind the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nSample Input 1\n\n3\n10 10\n20 20\n30 30\n\nSample Output 1\n\n20\n\nIn this sample, both of them earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since Takahashi and Aoki have the same \"taste\", each time they will choose the dish with which they can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (30 + 10) - 20 = 20.\n\nSample Input 2\n\n3\n20 10\n20 20\n20 30\n\nSample Output 2\n\n20\n\nIn this sample, Takahashi earns 20 points of happiness by eating any one of the dishes 1, 2 and 3, but Aoki earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since only Aoki has likes and dislikes, each time they will choose the dish with which Aoki can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (20 + 20) - 20 = 20.\n\nSample Input 3\n\n6\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 3\n\n-2999999997\n\nNote that the answer may not fit into a 32-bit integer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1373, "cpu_time_ms": 145, "memory_kb": 7296}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s063344054", "group_id": "codeNet:p03141", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger :: n,i,j,s\ninteger(8) :: dif\ninteger,allocatable :: a(:), b(:), c(:)\n\nread(*,*) n\nallocate(a(n)) ; allocate(b(n)) ; allocate(c(n))\n\ndo i = 1, n\n read(*,*) a(i),b(i)\n c(i) = b(i) + a(i)\nend do\n\ndo i = 1, n\n do j = i+1, n\n if (c(j) > c(i))then\n s = c(i)\n c(i) = c(j)\n c(j) = s\n end if\n end do\nend do\n\ndif = -(sum(b))\nif (mod(n,2) == 0)then\n do i = 1, n-1, 2\n dif = dif + c(i)\n end do\nelse\n do i = 1, n, 2\n dif = dif + c(i)\n end do\nend if\n\ndeallocate(a) ; deallocate(b) ; deallocate(c)\n\nwrite(*,'(i0)') dif\n\nEND PROGRAM ATCODER", "language": "Fortran", "metadata": {"date": 1548648990, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03141.html", "problem_id": "p03141", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03141/input.txt", "sample_output_relpath": "derived/input_output/data/p03141/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03141/Fortran/s063344054.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s063344054", "user_id": "u454557108"}, "prompt_components": {"gold_output": "20\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger :: n,i,j,s\ninteger(8) :: dif\ninteger,allocatable :: a(:), b(:), c(:)\n\nread(*,*) n\nallocate(a(n)) ; allocate(b(n)) ; allocate(c(n))\n\ndo i = 1, n\n read(*,*) a(i),b(i)\n c(i) = b(i) + a(i)\nend do\n\ndo i = 1, n\n do j = i+1, n\n if (c(j) > c(i))then\n s = c(i)\n c(i) = c(j)\n c(j) = s\n end if\n end do\nend do\n\ndif = -(sum(b))\nif (mod(n,2) == 0)then\n do i = 1, n-1, 2\n dif = dif + c(i)\n end do\nelse\n do i = 1, n, 2\n dif = dif + c(i)\n end do\nend if\n\ndeallocate(a) ; deallocate(b) ; deallocate(c)\n\nwrite(*,'(i0)') dif\n\nEND PROGRAM ATCODER", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N dishes of cuisine placed in front of Takahashi and Aoki.\nFor convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.\n\nWhen Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happiness.\n\nStarting from Takahashi, they alternately choose one dish and eat it, until there is no more dish to eat.\nHere, both of them choose dishes so that the following value is maximized: \"the sum of the happiness he/she will earn in the end\" minus \"the sum of the happiness the other person will earn in the end\".\n\nFind the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nSample Input 1\n\n3\n10 10\n20 20\n30 30\n\nSample Output 1\n\n20\n\nIn this sample, both of them earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since Takahashi and Aoki have the same \"taste\", each time they will choose the dish with which they can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (30 + 10) - 20 = 20.\n\nSample Input 2\n\n3\n20 10\n20 20\n20 30\n\nSample Output 2\n\n20\n\nIn this sample, Takahashi earns 20 points of happiness by eating any one of the dishes 1, 2 and 3, but Aoki earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since only Aoki has likes and dislikes, each time they will choose the dish with which Aoki can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (20 + 20) - 20 = 20.\n\nSample Input 3\n\n6\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 3\n\n-2999999997\n\nNote that the answer may not fit into a 32-bit integer.", "sample_input": "3\n10 10\n20 20\n30 30\n"}, "reference_outputs": ["20\n"], "source_document_id": "p03141", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N dishes of cuisine placed in front of Takahashi and Aoki.\nFor convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.\n\nWhen Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happiness.\n\nStarting from Takahashi, they alternately choose one dish and eat it, until there is no more dish to eat.\nHere, both of them choose dishes so that the following value is maximized: \"the sum of the happiness he/she will earn in the end\" minus \"the sum of the happiness the other person will earn in the end\".\n\nFind the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nSample Input 1\n\n3\n10 10\n20 20\n30 30\n\nSample Output 1\n\n20\n\nIn this sample, both of them earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since Takahashi and Aoki have the same \"taste\", each time they will choose the dish with which they can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (30 + 10) - 20 = 20.\n\nSample Input 2\n\n3\n20 10\n20 20\n20 30\n\nSample Output 2\n\n20\n\nIn this sample, Takahashi earns 20 points of happiness by eating any one of the dishes 1, 2 and 3, but Aoki earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since only Aoki has likes and dislikes, each time they will choose the dish with which Aoki can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (20 + 20) - 20 = 20.\n\nSample Input 3\n\n6\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 3\n\n-2999999997\n\nNote that the answer may not fit into a 32-bit integer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 648, "cpu_time_ms": 2103, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s399811326", "group_id": "codeNet:p03141", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger(8) :: n,i,j,s,t,u,taka,ao\ninteger(8),allocatable :: a(:), b(:), c(:)\n\nread(*,*) n\nallocate(a(n)) ; allocate(b(n)) ; allocate(c(n))\n\ndo i = 1, n\n read(*,*) a(i),b(i)\n c(i) = b(i) - a(i)\nend do\n\ndo i = 1, n\n do j = i+1, n\n if (c(j) > c(i))then\n s = c(i) ; t = a(i) ; u = b(i)\n c(i) = c(j) ; a(i) = a(j) ; b(i) = b(j)\n c(j) = s ; a(j) = t ; b(j) = u\n end if\n end do\nend do\n\ntaka = 0 ; ao = 0\ndo i = 1, n, 2\n j = i + 1\n if (i <= n)then\n taka = taka + a(i)\n end if\n if (j <= n)then\n ao = ao + b(j)\n end if\nend do\n\nprint'(i0)', taka - ao\n\nEND PROGRAM ATCODER", "language": "Fortran", "metadata": {"date": 1548645216, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03141.html", "problem_id": "p03141", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03141/input.txt", "sample_output_relpath": "derived/input_output/data/p03141/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03141/Fortran/s399811326.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s399811326", "user_id": "u454557108"}, "prompt_components": {"gold_output": "20\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger(8) :: n,i,j,s,t,u,taka,ao\ninteger(8),allocatable :: a(:), b(:), c(:)\n\nread(*,*) n\nallocate(a(n)) ; allocate(b(n)) ; allocate(c(n))\n\ndo i = 1, n\n read(*,*) a(i),b(i)\n c(i) = b(i) - a(i)\nend do\n\ndo i = 1, n\n do j = i+1, n\n if (c(j) > c(i))then\n s = c(i) ; t = a(i) ; u = b(i)\n c(i) = c(j) ; a(i) = a(j) ; b(i) = b(j)\n c(j) = s ; a(j) = t ; b(j) = u\n end if\n end do\nend do\n\ntaka = 0 ; ao = 0\ndo i = 1, n, 2\n j = i + 1\n if (i <= n)then\n taka = taka + a(i)\n end if\n if (j <= n)then\n ao = ao + b(j)\n end if\nend do\n\nprint'(i0)', taka - ao\n\nEND PROGRAM ATCODER", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N dishes of cuisine placed in front of Takahashi and Aoki.\nFor convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.\n\nWhen Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happiness.\n\nStarting from Takahashi, they alternately choose one dish and eat it, until there is no more dish to eat.\nHere, both of them choose dishes so that the following value is maximized: \"the sum of the happiness he/she will earn in the end\" minus \"the sum of the happiness the other person will earn in the end\".\n\nFind the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nSample Input 1\n\n3\n10 10\n20 20\n30 30\n\nSample Output 1\n\n20\n\nIn this sample, both of them earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since Takahashi and Aoki have the same \"taste\", each time they will choose the dish with which they can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (30 + 10) - 20 = 20.\n\nSample Input 2\n\n3\n20 10\n20 20\n20 30\n\nSample Output 2\n\n20\n\nIn this sample, Takahashi earns 20 points of happiness by eating any one of the dishes 1, 2 and 3, but Aoki earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since only Aoki has likes and dislikes, each time they will choose the dish with which Aoki can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (20 + 20) - 20 = 20.\n\nSample Input 3\n\n6\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 3\n\n-2999999997\n\nNote that the answer may not fit into a 32-bit integer.", "sample_input": "3\n10 10\n20 20\n30 30\n"}, "reference_outputs": ["20\n"], "source_document_id": "p03141", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N dishes of cuisine placed in front of Takahashi and Aoki.\nFor convenience, we call these dishes Dish 1, Dish 2, ..., Dish N.\n\nWhen Takahashi eats Dish i, he earns A_i points of happiness; when Aoki eats Dish i, she earns B_i points of happiness.\n\nStarting from Takahashi, they alternately choose one dish and eat it, until there is no more dish to eat.\nHere, both of them choose dishes so that the following value is maximized: \"the sum of the happiness he/she will earn in the end\" minus \"the sum of the happiness the other person will earn in the end\".\n\nFind the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 B_1\n:\nA_N B_N\n\nOutput\n\nPrint the value: \"the sum of the happiness Takahashi earns in the end\" minus \"the sum of the happiness Aoki earns in the end\".\n\nSample Input 1\n\n3\n10 10\n20 20\n30 30\n\nSample Output 1\n\n20\n\nIn this sample, both of them earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since Takahashi and Aoki have the same \"taste\", each time they will choose the dish with which they can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (30 + 10) - 20 = 20.\n\nSample Input 2\n\n3\n20 10\n20 20\n20 30\n\nSample Output 2\n\n20\n\nIn this sample, Takahashi earns 20 points of happiness by eating any one of the dishes 1, 2 and 3, but Aoki earns 10 points of happiness by eating Dish 1, 20 points by eating Dish 2, and 30 points by eating Dish 3.\n\nIn this case, since only Aoki has likes and dislikes, each time they will choose the dish with which Aoki can earn the greatest happiness. Thus, first Takahashi will choose Dish 3, then Aoki will choose Dish 2, and finally Takahashi will choose Dish 1, so the answer is (20 + 20) - 20 = 20.\n\nSample Input 3\n\n6\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n1 1000000000\n\nSample Output 3\n\n-2999999997\n\nNote that the answer may not fit into a 32-bit integer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 679, "cpu_time_ms": 2103, "memory_kb": 2560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s368452299", "group_id": "codeNet:p03147", "input_text": "program sample\n implicit none\n \n integer(8) :: i,j,m,n\n integer(8),allocatable :: x(:),y(:)\n \n read(*,*) n\n allocate(x(n))\n read(*,*)x\n m=x(1)\n do i=1,n-1\n if(x(i+1)>x(i))then\n m=m+x(i+1)-x(i)\n end if\n end do\n write(*,*)m\n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1597492579, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03147.html", "problem_id": "p03147", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03147/input.txt", "sample_output_relpath": "derived/input_output/data/p03147/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03147/Fortran/s368452299.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s368452299", "user_id": "u713568912"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program sample\n implicit none\n \n integer(8) :: i,j,m,n\n integer(8),allocatable :: x(:),y(:)\n \n read(*,*) n\n allocate(x(n))\n read(*,*)x\n m=x(1)\n do i=1,n-1\n if(x(i+1)>x(i))then\n m=m+x(i+1)-x(i)\n end if\n end do\n write(*,*)m\n stop\nend program sample\n \n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0.\nYou are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \\leq k \\leq N), by repeating the following \"watering\" operation:\n\nSpecify integers l and r. Increase the height of Flower x by 1 for all x such that l \\leq x \\leq r.\n\nFind the minimum number of watering operations required to satisfy the condition.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq h_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 h_3 ...... h_N\n\nOutput\n\nPrint the minimum number of watering operations required to satisfy the condition.\n\nSample Input 1\n\n4\n1 2 2 1\n\nSample Output 1\n\n2\n\nThe minimum number of watering operations required is 2.\nOne way to achieve it is:\n\nPerform the operation with (l,r)=(1,3).\n\nPerform the operation with (l,r)=(2,4).\n\nSample Input 2\n\n5\n3 1 2 3 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n8\n4 23 75 0 23 96 50 100\n\nSample Output 3\n\n221", "sample_input": "4\n1 2 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03147", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0.\nYou are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \\leq k \\leq N), by repeating the following \"watering\" operation:\n\nSpecify integers l and r. Increase the height of Flower x by 1 for all x such that l \\leq x \\leq r.\n\nFind the minimum number of watering operations required to satisfy the condition.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq h_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 h_3 ...... h_N\n\nOutput\n\nPrint the minimum number of watering operations required to satisfy the condition.\n\nSample Input 1\n\n4\n1 2 2 1\n\nSample Output 1\n\n2\n\nThe minimum number of watering operations required is 2.\nOne way to achieve it is:\n\nPerform the operation with (l,r)=(1,3).\n\nPerform the operation with (l,r)=(2,4).\n\nSample Input 2\n\n5\n3 1 2 3 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n8\n4 23 75 0 23 96 50 100\n\nSample Output 3\n\n221", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 313, "cpu_time_ms": 15, "memory_kb": 2772}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s024876797", "group_id": "codeNet:p03147", "input_text": "program garden\n implicit none\n\n integer :: n, min, max, i, cnt, j, k, t, s\n integer, allocatable :: h(:), h2(:)\n\n read(*,*) n\n allocate(h(n))\n allocate(h2(n))\n read(*,*) h\n\n min = minval(h)\n max = maxval(h)\n\n\n if (product(h) /= 0) then\n cnt = 1\n else\n cnt = 0\n end if\n\n \n do j = min, max\n do t = 1, n\n if(h(t) >= j) then\n h2(t) = h(t) - j \n else\n h2(t) = 0\n end if\n\n \n end do\n \n do i = 1, n\n if (h2(i) >= 1) then\n if(product(h2(i:n)) == 0) then\n do k = i, n\n if(h2(k) == 0) then\n cnt = cnt + 1\n exit\n end if\n end do\n do s = i, k\n h2(s) = 0\n end do\n \n else\n cnt = cnt + 1\n exit\n end if\n end if\n end do\n \n end do\n\n write(*,*) cnt\nend program garden\n\n \n", "language": "Fortran", "metadata": {"date": 1591392412, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03147.html", "problem_id": "p03147", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03147/input.txt", "sample_output_relpath": "derived/input_output/data/p03147/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03147/Fortran/s024876797.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s024876797", "user_id": "u979474608"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program garden\n implicit none\n\n integer :: n, min, max, i, cnt, j, k, t, s\n integer, allocatable :: h(:), h2(:)\n\n read(*,*) n\n allocate(h(n))\n allocate(h2(n))\n read(*,*) h\n\n min = minval(h)\n max = maxval(h)\n\n\n if (product(h) /= 0) then\n cnt = 1\n else\n cnt = 0\n end if\n\n \n do j = min, max\n do t = 1, n\n if(h(t) >= j) then\n h2(t) = h(t) - j \n else\n h2(t) = 0\n end if\n\n \n end do\n \n do i = 1, n\n if (h2(i) >= 1) then\n if(product(h2(i:n)) == 0) then\n do k = i, n\n if(h2(k) == 0) then\n cnt = cnt + 1\n exit\n end if\n end do\n do s = i, k\n h2(s) = 0\n end do\n \n else\n cnt = cnt + 1\n exit\n end if\n end if\n end do\n \n end do\n\n write(*,*) cnt\nend program garden\n\n \n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0.\nYou are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \\leq k \\leq N), by repeating the following \"watering\" operation:\n\nSpecify integers l and r. Increase the height of Flower x by 1 for all x such that l \\leq x \\leq r.\n\nFind the minimum number of watering operations required to satisfy the condition.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq h_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 h_3 ...... h_N\n\nOutput\n\nPrint the minimum number of watering operations required to satisfy the condition.\n\nSample Input 1\n\n4\n1 2 2 1\n\nSample Output 1\n\n2\n\nThe minimum number of watering operations required is 2.\nOne way to achieve it is:\n\nPerform the operation with (l,r)=(1,3).\n\nPerform the operation with (l,r)=(2,4).\n\nSample Input 2\n\n5\n3 1 2 3 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n8\n4 23 75 0 23 96 50 100\n\nSample Output 3\n\n221", "sample_input": "4\n1 2 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03147", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn a flower bed, there are N flowers, numbered 1,2,......,N. Initially, the heights of all flowers are 0.\nYou are given a sequence h=\\{h_1,h_2,h_3,......\\} as input. You would like to change the height of Flower k to h_k for all k (1 \\leq k \\leq N), by repeating the following \"watering\" operation:\n\nSpecify integers l and r. Increase the height of Flower x by 1 for all x such that l \\leq x \\leq r.\n\nFind the minimum number of watering operations required to satisfy the condition.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq h_i \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nh_1 h_2 h_3 ...... h_N\n\nOutput\n\nPrint the minimum number of watering operations required to satisfy the condition.\n\nSample Input 1\n\n4\n1 2 2 1\n\nSample Output 1\n\n2\n\nThe minimum number of watering operations required is 2.\nOne way to achieve it is:\n\nPerform the operation with (l,r)=(1,3).\n\nPerform the operation with (l,r)=(2,4).\n\nSample Input 2\n\n5\n3 1 2 3 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n8\n4 23 75 0 23 96 50 100\n\nSample Output 3\n\n221", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 977, "cpu_time_ms": 109, "memory_kb": 980}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s866575256", "group_id": "codeNet:p03148", "input_text": "program test\nimplicit none\ninteger(8) :: i=0,j=0,n=0,k=0,t(100000)=0,d(100000)=0,dummy(100000)=0,num=0\ninteger(8) :: tt(100000)=0,dd(100000)=0,lost(100000)=0,lost_cum(100000)=0\ninteger(8) :: get(100000)=0,get_cum(100000)=0,total(100000)=0,sumi_a(100000)=0,sumi_b(100000)=0\ninteger(8) :: kind_max_a(100000)=0,kind_max_b(100000)=0,kind_count=0,lost_count=0,get_count=0,count=0,error\n\nread(*,*) n,k\ndo i=1,n\n\tread(*,*) t(i),d(i)\nenddo\n\nif(n==k) then\n\tgoto 100\nelse\n\t!まずは降順に並べる\n\tcall heapsort_down(n,d(1:n),t(1:n))\n\t\n\t!1~k番目が暫定食べる、k+1~n番目が食べない\n\ttt(1:n) = t(1:n)\n\tdd(1:n) = d(1:n)\n\t\n\t!食べるグループで、各種類の最高値を計算\n\tdo i=1,k\n\t\tkind_max_a(tt(i)) = max(kind_max_a(tt(i)),dd(i))\n\tenddo\n\t\n\t!各種類の最高値を1個だけ残して、それ以外は新たな種類の寿司に置換される可能性がある\n\tlost_count = 0\n\tdo i=1,k\n\t\tif(dd(i) == kind_max_a(tt(i)) .and. sumi_a(tt(i)) == 0 ) then\n\t\t\tsumi_a(tt(i)) = 1\n\t\telse\n\t\t\tlost_count=lost_count+1\n\t\t\tlost(lost_count) = dd(i)\n\t\tendif\n\tenddo\n\t\n\tif(lost_count == 0)then\n\t\tgoto 200\n\tendif\n\t\n\t!昇順ソートをかける\n\tcall heapsort_up(lost_count,lost(1:lost_count),dummy(1:lost_count))\n\t\n\t!失う価値の累積和\n\tdo i=1,lost_count\n\t\tif(i == 1) then\n\t\t\tlost_cum(i) = lost(1)\n\t\telse\n\t\t\tlost_cum(i) = lost_cum(i-1) + lost(i)\n\t\tendif\n\tenddo\n\t\n\t!食べるグループの種類は何種類?\n\tcall heapsort_up(k,tt(1:k),dd(1:k))\n\tkind_count = 1\n\tif(k>=2)then\n\t\tdo i =2,k\n\t\t\tif(tt(i) .ne. tt(i-1))then\n\t\t\t kind_count = kind_count + 1\n\t\t\tendif\n\t\tenddo\n\tendif\n\t\n\t!食べないグループで、各種類の最高値を列挙\n\tdo i=k+1,n\n\t\tkind_max_b(tt(i)) = max(kind_max_b(tt(i)),dd(i))\n\tenddo\n\t\n\t!食べないグループで、各種類の最高値にあたり、かつ食べるグループにない寿司が置換に使われる可能性がある\n\tget_count = 0\n\tdo i=k+1,n\n\t\tif((dd(i) == kind_max_b(tt(i))) .and. kind_max_a(tt(i)) == 0 .and. sumi_b(tt(i)) == 0) then\n\t\t\tget_count = get_count + 1\n\t\t\tget(get_count) = dd(i)\n\t\t\tsumi_b(tt(i)) = 1\n\t\tendif\n\tenddo\n\t\n\tif(get_count == 0)then\n\t\tgoto 300\n\tendif\n\t\n\t!降順ソートをかける\n\tcall heapsort_down(get_count,get(1:get_count),dummy(1:get_count))\n\t\n\t!得る価値\n\tdo i=1,get_count\n\t\tif(i == 1) then\n\t\t\tget_cum(i) = get(1) + 2*(kind_count+i)-1\n\t\telse\n\t\t\tget_cum(i) = get_cum(i-1) + get(i) + 2*(kind_count+i)-1\n\t\tendif\n\tenddo\n\t\n\tcount = min(lost_count,get_count)\n\t\n\tdo i = 1,count\n\t\ttotal(i) = get_cum(i) - lost_cum(i)\n\tenddo\n\t\n\twrite(*,*) sum(d(1:k))+ kind_count*kind_count+ max(0,maxval(total(1:count)))\nendif\n\nif(1 == 0)then\n100 continue\n\tcall heapsort_up(n,t(1:k),d(1:k))\n\tnum = 1\n\tif(k>=2)then\n\t\tdo i =2,k\n\t\t\tif(t(i) .ne. t(i-1))then\n\t\t\t num = num + 1\n\t\t\tendif\n\t\tenddo\n\tendif\n\twrite(*,*) sum(d(1:k)) + num*num\nendif\n\nif(1 == 0)then\n200 continue\n\tcall heapsort_up(n,t(1:k),d(1:k))\n\tnum = 1\n\tif(k>=2)then\n\t\tdo i =2,k\n\t\t\tif(t(i) .ne. t(i-1))then\n\t\t\t num = num + 1\n\t\t\tendif\n\t\tenddo\n\tendif\n\twrite(*,*) sum(d(1:k)) + num*num\nendif\n\nif(1 == 0)then\n300 continue\n\tcall heapsort_up(n,t(1:k),d(1:k))\n\tnum = 1\n\tif(k>=2)then\n\t\tdo i =2,k\n\t\t\tif(t(i) .ne. t(i-1))then\n\t\t\t num = num + 1\n\t\t\tendif\n\t\tenddo\n\tendif\n\twrite(*,*) sum(d(1:k)) + num*num + d(1000000) !ERROR\nendif\n\ncontains\n \nsubroutine heapsort_down(n,y1,y2)\n \n\timplicit none\n\tinteger(8),intent(in) :: n\n\tinteger(8),intent(inout) :: y1(1:n)\n\tinteger(8),intent(inout) :: y2(1:n)\n\tinteger(8) :: i,k,j,l\n\tinteger(8) :: t1,t2\n\t\n\tl = n/2+1\n\tk = n\n \n\tdo while (k /= 1)\n\t\t if(l > 1) then\n\t\t\t\tl = l-1\n\t\t\t\tt1 = y1(l)\n\t\t\t\tt2 = y2(l)\n\t\t\t\t\n\t\t else\n\t\t\t\tt1 = y1(k)\n\t\t\t\tt2 = y2(k)\n\t\t\t\ty1(k) = y1(1)\n\t\t\t\ty2(k) = y2(1)\n\t\t\t\tk = k-1\n\t\t\t\tif(k == 1) then\n\t\t\t\t\t y1(1) = t1\n\t\t\t\t\t y2(1) = t2\n\t\t\t\t\t exit\n\t\t\t\tendif\n\t\t endif\n \n\t\t i = l\n\t\t j = l+l\n \n\t\t do while(j <= k)\n\t\t\t\tif(j < k) then\n\t\t\t\t\t if(y1(j) > y1(j+1)) j = j+1\n\t\t\t\tendif\n\t\t\t\t\n\t\t\t\tif (t1 > y1(j)) then\n\t\t\t\t\t y1(i) = y1(j)\n\t\t\t\t\t y2(i) = y2(j)\n\t\t\t\t\t i = j\n\t\t\t\t\t j = j+j\n\t\t\t\telse\n\t\t\t\t\t j = k+1\n\t\t\t\tendif\n\t\t \n\t\t enddo\n\t\t \n\t\t y1(i) = t1\n\t\t y2(i) = t2\n\t\n\tenddo\n\treturn\n \nend subroutine heapsort_down\n\nsubroutine heapsort_up(n,y1,y2)\n \n\timplicit none\n\tinteger(8),intent(in) :: n\n\tinteger(8),intent(inout) :: y1(1:n)\n\tinteger(8),intent(inout) :: y2(1:n)\n\tinteger(8) :: i,k,j,l\n\tinteger(8) :: t1,t2\n\t\n\tl = n/2+1\n\tk = n\n \n\tdo while (k /= 1)\n\t\t if(l > 1) then\n\t\t\t\tl = l-1\n\t\t\t\tt1 = y1(l)\n\t\t\t\tt2 = y2(l)\n\t\t\t\t\n\t\t else\n\t\t\t\tt1 = y1(k)\n\t\t\t\tt2 = y2(k)\n\t\t\t\ty1(k) = y1(1)\n\t\t\t\ty2(k) = y2(1)\n\t\t\t\tk = k-1\n\t\t\t\tif(k == 1) then\n\t\t\t\t\t y1(1) = t1\n\t\t\t\t\t y2(1) = t2\n\t\t\t\t\t exit\n\t\t\t\tendif\n\t\t endif\n \n\t\t i = l\n\t\t j = l+l\n \n\t\t do while(j <= k)\n\t\t\t\tif(j < k) then\n\t\t\t\t\t if(y1(j) < y1(j+1)) j = j+1\n\t\t\t\tendif\n\t\t\t\t\n\t\t\t\tif (t1 < y1(j)) then\n\t\t\t\t\t y1(i) = y1(j)\n\t\t\t\t\t y2(i) = y2(j)\n\t\t\t\t\t i = j\n\t\t\t\t\t j = j+j\n\t\t\t\telse\n\t\t\t\t\t j = k+1\n\t\t\t\tendif\n\t\t \n\t\t enddo\n\t\t \n\t\t y1(i) = t1\n\t\t y2(i) = t2\n\t\n\tenddo\n\treturn\n \nend subroutine heapsort_up\n\nend program", "language": "Fortran", "metadata": {"date": 1551139848, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03148.html", "problem_id": "p03148", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03148/input.txt", "sample_output_relpath": "derived/input_output/data/p03148/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03148/Fortran/s866575256.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s866575256", "user_id": "u454703763"}, "prompt_components": {"gold_output": "26\n", "input_to_evaluate": "program test\nimplicit none\ninteger(8) :: i=0,j=0,n=0,k=0,t(100000)=0,d(100000)=0,dummy(100000)=0,num=0\ninteger(8) :: tt(100000)=0,dd(100000)=0,lost(100000)=0,lost_cum(100000)=0\ninteger(8) :: get(100000)=0,get_cum(100000)=0,total(100000)=0,sumi_a(100000)=0,sumi_b(100000)=0\ninteger(8) :: kind_max_a(100000)=0,kind_max_b(100000)=0,kind_count=0,lost_count=0,get_count=0,count=0,error\n\nread(*,*) n,k\ndo i=1,n\n\tread(*,*) t(i),d(i)\nenddo\n\nif(n==k) then\n\tgoto 100\nelse\n\t!まずは降順に並べる\n\tcall heapsort_down(n,d(1:n),t(1:n))\n\t\n\t!1~k番目が暫定食べる、k+1~n番目が食べない\n\ttt(1:n) = t(1:n)\n\tdd(1:n) = d(1:n)\n\t\n\t!食べるグループで、各種類の最高値を計算\n\tdo i=1,k\n\t\tkind_max_a(tt(i)) = max(kind_max_a(tt(i)),dd(i))\n\tenddo\n\t\n\t!各種類の最高値を1個だけ残して、それ以外は新たな種類の寿司に置換される可能性がある\n\tlost_count = 0\n\tdo i=1,k\n\t\tif(dd(i) == kind_max_a(tt(i)) .and. sumi_a(tt(i)) == 0 ) then\n\t\t\tsumi_a(tt(i)) = 1\n\t\telse\n\t\t\tlost_count=lost_count+1\n\t\t\tlost(lost_count) = dd(i)\n\t\tendif\n\tenddo\n\t\n\tif(lost_count == 0)then\n\t\tgoto 200\n\tendif\n\t\n\t!昇順ソートをかける\n\tcall heapsort_up(lost_count,lost(1:lost_count),dummy(1:lost_count))\n\t\n\t!失う価値の累積和\n\tdo i=1,lost_count\n\t\tif(i == 1) then\n\t\t\tlost_cum(i) = lost(1)\n\t\telse\n\t\t\tlost_cum(i) = lost_cum(i-1) + lost(i)\n\t\tendif\n\tenddo\n\t\n\t!食べるグループの種類は何種類?\n\tcall heapsort_up(k,tt(1:k),dd(1:k))\n\tkind_count = 1\n\tif(k>=2)then\n\t\tdo i =2,k\n\t\t\tif(tt(i) .ne. tt(i-1))then\n\t\t\t kind_count = kind_count + 1\n\t\t\tendif\n\t\tenddo\n\tendif\n\t\n\t!食べないグループで、各種類の最高値を列挙\n\tdo i=k+1,n\n\t\tkind_max_b(tt(i)) = max(kind_max_b(tt(i)),dd(i))\n\tenddo\n\t\n\t!食べないグループで、各種類の最高値にあたり、かつ食べるグループにない寿司が置換に使われる可能性がある\n\tget_count = 0\n\tdo i=k+1,n\n\t\tif((dd(i) == kind_max_b(tt(i))) .and. kind_max_a(tt(i)) == 0 .and. sumi_b(tt(i)) == 0) then\n\t\t\tget_count = get_count + 1\n\t\t\tget(get_count) = dd(i)\n\t\t\tsumi_b(tt(i)) = 1\n\t\tendif\n\tenddo\n\t\n\tif(get_count == 0)then\n\t\tgoto 300\n\tendif\n\t\n\t!降順ソートをかける\n\tcall heapsort_down(get_count,get(1:get_count),dummy(1:get_count))\n\t\n\t!得る価値\n\tdo i=1,get_count\n\t\tif(i == 1) then\n\t\t\tget_cum(i) = get(1) + 2*(kind_count+i)-1\n\t\telse\n\t\t\tget_cum(i) = get_cum(i-1) + get(i) + 2*(kind_count+i)-1\n\t\tendif\n\tenddo\n\t\n\tcount = min(lost_count,get_count)\n\t\n\tdo i = 1,count\n\t\ttotal(i) = get_cum(i) - lost_cum(i)\n\tenddo\n\t\n\twrite(*,*) sum(d(1:k))+ kind_count*kind_count+ max(0,maxval(total(1:count)))\nendif\n\nif(1 == 0)then\n100 continue\n\tcall heapsort_up(n,t(1:k),d(1:k))\n\tnum = 1\n\tif(k>=2)then\n\t\tdo i =2,k\n\t\t\tif(t(i) .ne. t(i-1))then\n\t\t\t num = num + 1\n\t\t\tendif\n\t\tenddo\n\tendif\n\twrite(*,*) sum(d(1:k)) + num*num\nendif\n\nif(1 == 0)then\n200 continue\n\tcall heapsort_up(n,t(1:k),d(1:k))\n\tnum = 1\n\tif(k>=2)then\n\t\tdo i =2,k\n\t\t\tif(t(i) .ne. t(i-1))then\n\t\t\t num = num + 1\n\t\t\tendif\n\t\tenddo\n\tendif\n\twrite(*,*) sum(d(1:k)) + num*num\nendif\n\nif(1 == 0)then\n300 continue\n\tcall heapsort_up(n,t(1:k),d(1:k))\n\tnum = 1\n\tif(k>=2)then\n\t\tdo i =2,k\n\t\t\tif(t(i) .ne. t(i-1))then\n\t\t\t num = num + 1\n\t\t\tendif\n\t\tenddo\n\tendif\n\twrite(*,*) sum(d(1:k)) + num*num + d(1000000) !ERROR\nendif\n\ncontains\n \nsubroutine heapsort_down(n,y1,y2)\n \n\timplicit none\n\tinteger(8),intent(in) :: n\n\tinteger(8),intent(inout) :: y1(1:n)\n\tinteger(8),intent(inout) :: y2(1:n)\n\tinteger(8) :: i,k,j,l\n\tinteger(8) :: t1,t2\n\t\n\tl = n/2+1\n\tk = n\n \n\tdo while (k /= 1)\n\t\t if(l > 1) then\n\t\t\t\tl = l-1\n\t\t\t\tt1 = y1(l)\n\t\t\t\tt2 = y2(l)\n\t\t\t\t\n\t\t else\n\t\t\t\tt1 = y1(k)\n\t\t\t\tt2 = y2(k)\n\t\t\t\ty1(k) = y1(1)\n\t\t\t\ty2(k) = y2(1)\n\t\t\t\tk = k-1\n\t\t\t\tif(k == 1) then\n\t\t\t\t\t y1(1) = t1\n\t\t\t\t\t y2(1) = t2\n\t\t\t\t\t exit\n\t\t\t\tendif\n\t\t endif\n \n\t\t i = l\n\t\t j = l+l\n \n\t\t do while(j <= k)\n\t\t\t\tif(j < k) then\n\t\t\t\t\t if(y1(j) > y1(j+1)) j = j+1\n\t\t\t\tendif\n\t\t\t\t\n\t\t\t\tif (t1 > y1(j)) then\n\t\t\t\t\t y1(i) = y1(j)\n\t\t\t\t\t y2(i) = y2(j)\n\t\t\t\t\t i = j\n\t\t\t\t\t j = j+j\n\t\t\t\telse\n\t\t\t\t\t j = k+1\n\t\t\t\tendif\n\t\t \n\t\t enddo\n\t\t \n\t\t y1(i) = t1\n\t\t y2(i) = t2\n\t\n\tenddo\n\treturn\n \nend subroutine heapsort_down\n\nsubroutine heapsort_up(n,y1,y2)\n \n\timplicit none\n\tinteger(8),intent(in) :: n\n\tinteger(8),intent(inout) :: y1(1:n)\n\tinteger(8),intent(inout) :: y2(1:n)\n\tinteger(8) :: i,k,j,l\n\tinteger(8) :: t1,t2\n\t\n\tl = n/2+1\n\tk = n\n \n\tdo while (k /= 1)\n\t\t if(l > 1) then\n\t\t\t\tl = l-1\n\t\t\t\tt1 = y1(l)\n\t\t\t\tt2 = y2(l)\n\t\t\t\t\n\t\t else\n\t\t\t\tt1 = y1(k)\n\t\t\t\tt2 = y2(k)\n\t\t\t\ty1(k) = y1(1)\n\t\t\t\ty2(k) = y2(1)\n\t\t\t\tk = k-1\n\t\t\t\tif(k == 1) then\n\t\t\t\t\t y1(1) = t1\n\t\t\t\t\t y2(1) = t2\n\t\t\t\t\t exit\n\t\t\t\tendif\n\t\t endif\n \n\t\t i = l\n\t\t j = l+l\n \n\t\t do while(j <= k)\n\t\t\t\tif(j < k) then\n\t\t\t\t\t if(y1(j) < y1(j+1)) j = j+1\n\t\t\t\tendif\n\t\t\t\t\n\t\t\t\tif (t1 < y1(j)) then\n\t\t\t\t\t y1(i) = y1(j)\n\t\t\t\t\t y2(i) = y2(j)\n\t\t\t\t\t i = j\n\t\t\t\t\t j = j+j\n\t\t\t\telse\n\t\t\t\t\t j = k+1\n\t\t\t\tendif\n\t\t \n\t\t enddo\n\t\t \n\t\t y1(i) = t1\n\t\t y2(i) = t2\n\t\n\tenddo\n\treturn\n \nend subroutine heapsort_up\n\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N pieces of sushi. Each piece has two parameters: \"kind of topping\" t_i and \"deliciousness\" d_i.\nYou are choosing K among these N pieces to eat.\nYour \"satisfaction\" here will be calculated as follows:\n\nThe satisfaction is the sum of the \"base total deliciousness\" and the \"variety bonus\".\n\nThe base total deliciousness is the sum of the deliciousness of the pieces you eat.\n\nThe variety bonus is x*x, where x is the number of different kinds of toppings of the pieces you eat.\n\nYou want to have as much satisfaction as possible.\nFind this maximum satisfaction.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 10^5\n\n1 \\leq t_i \\leq N\n\n1 \\leq d_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nt_1 d_1\nt_2 d_2\n.\n.\n.\nt_N d_N\n\nOutput\n\nPrint the maximum satisfaction that you can obtain.\n\nSample Input 1\n\n5 3\n1 9\n1 7\n2 6\n2 5\n3 1\n\nSample Output 1\n\n26\n\nIf you eat Sushi 1,2 and 3:\n\nThe base total deliciousness is 9+7+6=22.\n\nThe variety bonus is 2*2=4.\n\nThus, your satisfaction will be 26, which is optimal.\n\nSample Input 2\n\n7 4\n1 1\n2 1\n3 1\n4 6\n4 5\n4 5\n4 5\n\nSample Output 2\n\n25\n\nIt is optimal to eat Sushi 1,2,3 and 4.\n\nSample Input 3\n\n6 5\n5 1000000000\n2 990000000\n3 980000000\n6 970000000\n6 960000000\n4 950000000\n\nSample Output 3\n\n4900000016\n\nNote that the output may not fit into a 32-bit integer type.", "sample_input": "5 3\n1 9\n1 7\n2 6\n2 5\n3 1\n"}, "reference_outputs": ["26\n"], "source_document_id": "p03148", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N pieces of sushi. Each piece has two parameters: \"kind of topping\" t_i and \"deliciousness\" d_i.\nYou are choosing K among these N pieces to eat.\nYour \"satisfaction\" here will be calculated as follows:\n\nThe satisfaction is the sum of the \"base total deliciousness\" and the \"variety bonus\".\n\nThe base total deliciousness is the sum of the deliciousness of the pieces you eat.\n\nThe variety bonus is x*x, where x is the number of different kinds of toppings of the pieces you eat.\n\nYou want to have as much satisfaction as possible.\nFind this maximum satisfaction.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 10^5\n\n1 \\leq t_i \\leq N\n\n1 \\leq d_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nt_1 d_1\nt_2 d_2\n.\n.\n.\nt_N d_N\n\nOutput\n\nPrint the maximum satisfaction that you can obtain.\n\nSample Input 1\n\n5 3\n1 9\n1 7\n2 6\n2 5\n3 1\n\nSample Output 1\n\n26\n\nIf you eat Sushi 1,2 and 3:\n\nThe base total deliciousness is 9+7+6=22.\n\nThe variety bonus is 2*2=4.\n\nThus, your satisfaction will be 26, which is optimal.\n\nSample Input 2\n\n7 4\n1 1\n2 1\n3 1\n4 6\n4 5\n4 5\n4 5\n\nSample Output 2\n\n25\n\nIt is optimal to eat Sushi 1,2,3 and 4.\n\nSample Input 3\n\n6 5\n5 1000000000\n2 990000000\n3 980000000\n6 970000000\n6 960000000\n4 950000000\n\nSample Output 3\n\n4900000016\n\nNote that the output may not fit into a 32-bit integer type.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 4871, "cpu_time_ms": 200, "memory_kb": 9984}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s993925314", "group_id": "codeNet:p03149", "input_text": "program prob1\n implicit none\n integer(8) :: a(4)\n read(*,*) a\n\n call msort(a)\n\n if(a(1) == 1 .and.a(2) == 4 .and.a(3) == 7 .and.a(4) == 9)then\n write(*,*) \"YES\"\n else\n write(*,*) \"NO\"\n end if\n\n\n stop\ncontains\n\n !\n ! swap two arguments\n !\nsubroutine swap(a, b)\n implicit none\n integer(8), intent(inout) :: a, b\n\n integer(8) :: c\n\n c = a\n a = b\n b = c\n\n end subroutine swap\n\n !\n ! merge sort\n !\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n\n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n\n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n\n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n\n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n\n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n\n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\nend program prob1", "language": "Fortran", "metadata": {"date": 1596827104, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03149.html", "problem_id": "p03149", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03149/input.txt", "sample_output_relpath": "derived/input_output/data/p03149/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03149/Fortran/s993925314.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s993925314", "user_id": "u478462004"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program prob1\n implicit none\n integer(8) :: a(4)\n read(*,*) a\n\n call msort(a)\n\n if(a(1) == 1 .and.a(2) == 4 .and.a(3) == 7 .and.a(4) == 9)then\n write(*,*) \"YES\"\n else\n write(*,*) \"NO\"\n end if\n\n\n stop\ncontains\n\n !\n ! swap two arguments\n !\nsubroutine swap(a, b)\n implicit none\n integer(8), intent(inout) :: a, b\n\n integer(8) :: c\n\n c = a\n a = b\n b = c\n\n end subroutine swap\n\n !\n ! merge sort\n !\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n\n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n\n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n\n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n\n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n\n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n\n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\nend program prob1", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits \"1974\".\n\nConstraints\n\n0 \\leq N_1, N_2, N_3, N_4 \\leq 9\n\nN_1, N_2, N_3 and N_4 are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN_1 N_2 N_3 N_4\n\nOutput\n\nIf N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits \"1974\", print YES; if they cannot, print NO.\n\nSample Input 1\n\n1 7 9 4\n\nSample Output 1\n\nYES\n\nWe can get 1974 by swapping N_2 and N_3.\n\nSample Input 2\n\n1 9 7 4\n\nSample Output 2\n\nYES\n\nWe already have 1974 before doing anything.\n\nSample Input 3\n\n1 2 9 1\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n4 9 0 8\n\nSample Output 4\n\nNO", "sample_input": "1 7 9 4\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03149", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits \"1974\".\n\nConstraints\n\n0 \\leq N_1, N_2, N_3, N_4 \\leq 9\n\nN_1, N_2, N_3 and N_4 are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN_1 N_2 N_3 N_4\n\nOutput\n\nIf N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits \"1974\", print YES; if they cannot, print NO.\n\nSample Input 1\n\n1 7 9 4\n\nSample Output 1\n\nYES\n\nWe can get 1974 by swapping N_2 and N_3.\n\nSample Input 2\n\n1 9 7 4\n\nSample Output 2\n\nYES\n\nWe already have 1974 before doing anything.\n\nSample Input 3\n\n1 2 9 1\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n4 9 0 8\n\nSample Output 4\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1730, "cpu_time_ms": 10, "memory_kb": 2784}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s364907126", "group_id": "codeNet:p03149", "input_text": "module Sort_Module\n implicit none\n public\n contains\n recursive subroutine mergesort(a, p, r, b)\n integer(8) a(:), b(:)\n integer(8) p, r\n integer(8) q\n if (p < r) then\n q = (p+r)/2\n call mergesort(a, p, q, b)\n call mergesort(a, q+1, r, b)\n call merge(a, p, q, r, b)\n end if\n end subroutine mergesort\n subroutine merge(a, p, q, r, b)\n integer(8) a(:), b(:)\n integer(8) p, r, q, i, j, k\n integer(8) t\n k = p; i = p; j = q+1\n do\n if (.not. (k <= r)) exit\n if (j > r) then\n t = a(i); i = i+1\n else if (i > q) then\n t = a(j); j = j+1\n else if (a(i) <= a(j)) then\n t = a(i); i = i+1\n else\n t = a(j); j = j+1\n end if\n b(k) = t; k = k+1\n end do\n do i = p, r\n a(i) = b(i) \n end do\n end subroutine merge\n subroutine sort(a)\n integer(8) a(:), b(size(a)),n\n n = size(a)\n call mergesort(a,1_8,n,b)\n end subroutine sort\n\n\n\nend module Sort_Module\n\nprogram atcoder\n use Sort_Module\n implicit none\n integer(8) :: a(4)\n read*,a(1),a(2),a(3),a(4)\n call sort(a)\n if(a(1)==1.and.a(2)==4.and.a(3)==7.and.a(4)==9)then\n write(*,'(a)')\"YES\"\n else\n write(*,'(a)')\"NO\"\n endif\n\n stop \ncontains\n\n\nend program atcoder", "language": "Fortran", "metadata": {"date": 1547488947, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03149.html", "problem_id": "p03149", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03149/input.txt", "sample_output_relpath": "derived/input_output/data/p03149/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03149/Fortran/s364907126.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s364907126", "user_id": "u780122303"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "module Sort_Module\n implicit none\n public\n contains\n recursive subroutine mergesort(a, p, r, b)\n integer(8) a(:), b(:)\n integer(8) p, r\n integer(8) q\n if (p < r) then\n q = (p+r)/2\n call mergesort(a, p, q, b)\n call mergesort(a, q+1, r, b)\n call merge(a, p, q, r, b)\n end if\n end subroutine mergesort\n subroutine merge(a, p, q, r, b)\n integer(8) a(:), b(:)\n integer(8) p, r, q, i, j, k\n integer(8) t\n k = p; i = p; j = q+1\n do\n if (.not. (k <= r)) exit\n if (j > r) then\n t = a(i); i = i+1\n else if (i > q) then\n t = a(j); j = j+1\n else if (a(i) <= a(j)) then\n t = a(i); i = i+1\n else\n t = a(j); j = j+1\n end if\n b(k) = t; k = k+1\n end do\n do i = p, r\n a(i) = b(i) \n end do\n end subroutine merge\n subroutine sort(a)\n integer(8) a(:), b(size(a)),n\n n = size(a)\n call mergesort(a,1_8,n,b)\n end subroutine sort\n\n\n\nend module Sort_Module\n\nprogram atcoder\n use Sort_Module\n implicit none\n integer(8) :: a(4)\n read*,a(1),a(2),a(3),a(4)\n call sort(a)\n if(a(1)==1.and.a(2)==4.and.a(3)==7.and.a(4)==9)then\n write(*,'(a)')\"YES\"\n else\n write(*,'(a)')\"NO\"\n endif\n\n stop \ncontains\n\n\nend program atcoder", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits \"1974\".\n\nConstraints\n\n0 \\leq N_1, N_2, N_3, N_4 \\leq 9\n\nN_1, N_2, N_3 and N_4 are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN_1 N_2 N_3 N_4\n\nOutput\n\nIf N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits \"1974\", print YES; if they cannot, print NO.\n\nSample Input 1\n\n1 7 9 4\n\nSample Output 1\n\nYES\n\nWe can get 1974 by swapping N_2 and N_3.\n\nSample Input 2\n\n1 9 7 4\n\nSample Output 2\n\nYES\n\nWe already have 1974 before doing anything.\n\nSample Input 3\n\n1 2 9 1\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n4 9 0 8\n\nSample Output 4\n\nNO", "sample_input": "1 7 9 4\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03149", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits \"1974\".\n\nConstraints\n\n0 \\leq N_1, N_2, N_3, N_4 \\leq 9\n\nN_1, N_2, N_3 and N_4 are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN_1 N_2 N_3 N_4\n\nOutput\n\nIf N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits \"1974\", print YES; if they cannot, print NO.\n\nSample Input 1\n\n1 7 9 4\n\nSample Output 1\n\nYES\n\nWe can get 1974 by swapping N_2 and N_3.\n\nSample Input 2\n\n1 9 7 4\n\nSample Output 2\n\nYES\n\nWe already have 1974 before doing anything.\n\nSample Input 3\n\n1 2 9 1\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n4 9 0 8\n\nSample Output 4\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1467, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s339139918", "group_id": "codeNet:p03150", "input_text": "program main\n implicit none\n\n character(len=100) :: s\n character(len=7) :: c\n integer :: n\n\n read(*,*) s\n\n n = len_trim(s)\n c = 'keyence'\n\n if(index(s,c) /= 0) then\n if (index(s,c) == 1 .or. index(s,c, back=.true.) == n-6) then\n write(*,*) 'YES'\n else\n write(*,*) 'NO'\n end if\n stop\n else if(index(s,c(1:1)) /= 0) then\n if(index(s,c(2:7)) /= 0) then\n if(index(s,c(1:1)) == 1 .and. index(s,c(2:7), back=.true.) == n-5) then\n write(*,*) 'YES'\n end if\n else\n if(index(s,c(1:2)) /= 0) then\n if(index(s,c(3:7)) /= 0) then\n if(index(s,c(1:2)) == 1 .and. index(s,c(3:7), back=.true.) == n-4) then\n write(*,*) 'YES'\n end if\n else\n if(index(s,c(1:3)) /= 0) then\n if(index(s,c(4:7)) /= 0) then\n\t if(index(s,c(1:3)) == 1 .and. index(s,c(4:7), back=.true.) == n-3) then\n write(*,*) 'YES'\n end if\n else\n if(index(s,c(1:4)) /= 0) then\n if(index(s,c(5:7)) /= 0) then\n\t if(index(s,c(1:4)) == 1 .and. index(s,c(5:7), back=.true.) == n-2) then\n write(*,*) 'YES'\n end if\n else\n if(index(s,c(1:5)) /= 0) then\n if(index(s,c(6:7)) /= 0) then\n\t if(index(s,c(1:5)) == 1 .and. index(s,c(6:7), back=.true.) == n-1) then\n write(*,*) 'YES'\n end if\n else\n if(index(s,c(1:6)) /= 0) then\n if(index(s,c(7:7)) /= 0) then\n\t if(index(s,c(1:6)) == 1 .and. index(s,c(7:7), back=.true.) == n) then\n write(*,*) 'YES'\n end if\n else\n write(*,*) 'NO'\n end if\n end if\n\n end if\nend if\nend if\nend if\nend if\nend if\n\n\nend if\nend if\nend if\nend if\nend program main\n", "language": "Fortran", "metadata": {"date": 1591994354, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03150.html", "problem_id": "p03150", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03150/input.txt", "sample_output_relpath": "derived/input_output/data/p03150/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03150/Fortran/s339139918.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s339139918", "user_id": "u979474608"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program main\n implicit none\n\n character(len=100) :: s\n character(len=7) :: c\n integer :: n\n\n read(*,*) s\n\n n = len_trim(s)\n c = 'keyence'\n\n if(index(s,c) /= 0) then\n if (index(s,c) == 1 .or. index(s,c, back=.true.) == n-6) then\n write(*,*) 'YES'\n else\n write(*,*) 'NO'\n end if\n stop\n else if(index(s,c(1:1)) /= 0) then\n if(index(s,c(2:7)) /= 0) then\n if(index(s,c(1:1)) == 1 .and. index(s,c(2:7), back=.true.) == n-5) then\n write(*,*) 'YES'\n end if\n else\n if(index(s,c(1:2)) /= 0) then\n if(index(s,c(3:7)) /= 0) then\n if(index(s,c(1:2)) == 1 .and. index(s,c(3:7), back=.true.) == n-4) then\n write(*,*) 'YES'\n end if\n else\n if(index(s,c(1:3)) /= 0) then\n if(index(s,c(4:7)) /= 0) then\n\t if(index(s,c(1:3)) == 1 .and. index(s,c(4:7), back=.true.) == n-3) then\n write(*,*) 'YES'\n end if\n else\n if(index(s,c(1:4)) /= 0) then\n if(index(s,c(5:7)) /= 0) then\n\t if(index(s,c(1:4)) == 1 .and. index(s,c(5:7), back=.true.) == n-2) then\n write(*,*) 'YES'\n end if\n else\n if(index(s,c(1:5)) /= 0) then\n if(index(s,c(6:7)) /= 0) then\n\t if(index(s,c(1:5)) == 1 .and. index(s,c(6:7), back=.true.) == n-1) then\n write(*,*) 'YES'\n end if\n else\n if(index(s,c(1:6)) /= 0) then\n if(index(s,c(7:7)) /= 0) then\n\t if(index(s,c(1:6)) == 1 .and. index(s,c(7:7), back=.true.) == n) then\n write(*,*) 'YES'\n end if\n else\n write(*,*) 'NO'\n end if\n end if\n\n end if\nend if\nend if\nend if\nend if\nend if\n\n\nend if\nend if\nend if\nend if\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA string is called a KEYENCE string when it can be changed to keyence by removing its contiguous substring (possibly empty) only once.\n\nGiven a string S consisting of lowercase English letters, determine if S is a KEYENCE string.\n\nConstraints\n\nThe length of S is between 7 and 100 (inclusive).\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a KEYENCE string, print YES; otherwise, print NO.\n\nSample Input 1\n\nkeyofscience\n\nSample Output 1\n\nYES\n\nkeyence is an abbreviation of key of science.\n\nSample Input 2\n\nmpyszsbznf\n\nSample Output 2\n\nNO\n\nSample Input 3\n\nashlfyha\n\nSample Output 3\n\nNO\n\nSample Input 4\n\nkeyence\n\nSample Output 4\n\nYES", "sample_input": "keyofscience\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03150", "source_text": "Score : 200 points\n\nProblem Statement\n\nA string is called a KEYENCE string when it can be changed to keyence by removing its contiguous substring (possibly empty) only once.\n\nGiven a string S consisting of lowercase English letters, determine if S is a KEYENCE string.\n\nConstraints\n\nThe length of S is between 7 and 100 (inclusive).\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a KEYENCE string, print YES; otherwise, print NO.\n\nSample Input 1\n\nkeyofscience\n\nSample Output 1\n\nYES\n\nkeyence is an abbreviation of key of science.\n\nSample Input 2\n\nmpyszsbznf\n\nSample Output 2\n\nNO\n\nSample Input 3\n\nashlfyha\n\nSample Output 3\n\nNO\n\nSample Input 4\n\nkeyence\n\nSample Output 4\n\nYES", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1746, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s702623744", "group_id": "codeNet:p03150", "input_text": "program main\nimplicit none\ncharacter(100) ::S\ninteger :: count = 0\ninteger :: n\n\nread *,S\nn = len_trim(S)\n\nif(S(1:1)==\"k\") count = count + 1\nif(S(1:2)==\"ke\") count = count + 1\nif(S(1:3)==\"key\") count = count + 1\nif(S(1:4)==\"keye\") count = count + 1\nif(S(1:5)==\"keyen\") count = count + 1\nif(S(1:6)==\"keyenc\") count = count + 1\nif(S(1:7)==\"keyence\")count = count + 1\n\nif(S(n-0:n)== \"e\")count = count + 1\nif(S(n-1:n)== \"ce\")count = count + 1\nif(S(n-2:n)== \"nce\")count = count + 1\nif(S(n-3:n)== \"ence\")count = count + 1\nif(S(n-4:n)== \"yence\")count = count + 1\nif(S(n-5:n)== \"eyence\")count = count + 1\nif(S(n-6:n)==\"keyence\")count = count + 1\n\nif ( count > 6 ) then\nprint *, \"YES\"\nelse\nprint *, \"NO\"\nend if\n\nend program main", "language": "Fortran", "metadata": {"date": 1551993024, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03150.html", "problem_id": "p03150", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03150/input.txt", "sample_output_relpath": "derived/input_output/data/p03150/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03150/Fortran/s702623744.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s702623744", "user_id": "u731648631"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program main\nimplicit none\ncharacter(100) ::S\ninteger :: count = 0\ninteger :: n\n\nread *,S\nn = len_trim(S)\n\nif(S(1:1)==\"k\") count = count + 1\nif(S(1:2)==\"ke\") count = count + 1\nif(S(1:3)==\"key\") count = count + 1\nif(S(1:4)==\"keye\") count = count + 1\nif(S(1:5)==\"keyen\") count = count + 1\nif(S(1:6)==\"keyenc\") count = count + 1\nif(S(1:7)==\"keyence\")count = count + 1\n\nif(S(n-0:n)== \"e\")count = count + 1\nif(S(n-1:n)== \"ce\")count = count + 1\nif(S(n-2:n)== \"nce\")count = count + 1\nif(S(n-3:n)== \"ence\")count = count + 1\nif(S(n-4:n)== \"yence\")count = count + 1\nif(S(n-5:n)== \"eyence\")count = count + 1\nif(S(n-6:n)==\"keyence\")count = count + 1\n\nif ( count > 6 ) then\nprint *, \"YES\"\nelse\nprint *, \"NO\"\nend if\n\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA string is called a KEYENCE string when it can be changed to keyence by removing its contiguous substring (possibly empty) only once.\n\nGiven a string S consisting of lowercase English letters, determine if S is a KEYENCE string.\n\nConstraints\n\nThe length of S is between 7 and 100 (inclusive).\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a KEYENCE string, print YES; otherwise, print NO.\n\nSample Input 1\n\nkeyofscience\n\nSample Output 1\n\nYES\n\nkeyence is an abbreviation of key of science.\n\nSample Input 2\n\nmpyszsbznf\n\nSample Output 2\n\nNO\n\nSample Input 3\n\nashlfyha\n\nSample Output 3\n\nNO\n\nSample Input 4\n\nkeyence\n\nSample Output 4\n\nYES", "sample_input": "keyofscience\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03150", "source_text": "Score : 200 points\n\nProblem Statement\n\nA string is called a KEYENCE string when it can be changed to keyence by removing its contiguous substring (possibly empty) only once.\n\nGiven a string S consisting of lowercase English letters, determine if S is a KEYENCE string.\n\nConstraints\n\nThe length of S is between 7 and 100 (inclusive).\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is a KEYENCE string, print YES; otherwise, print NO.\n\nSample Input 1\n\nkeyofscience\n\nSample Output 1\n\nYES\n\nkeyence is an abbreviation of key of science.\n\nSample Input 2\n\nmpyszsbznf\n\nSample Output 2\n\nNO\n\nSample Input 3\n\nashlfyha\n\nSample Output 3\n\nNO\n\nSample Input 4\n\nkeyence\n\nSample Output 4\n\nYES", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 749, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s310523519", "group_id": "codeNet:p03151", "input_text": "program prob6\n implicit none\n integer(8) :: n, i, ans, minsum\n integer(8), allocatable :: a(:), b(:), d(:)\n read(*,*) n\n allocate(a(n))\n allocate(b(n))\n allocate(d(n))\n read(*,*) a\n read(*,*) b\n\n d = a - b\n if(sum(d) < 0) then\n write(*,*) \"-1\"\n stop\n end if\n\n call msort(d)\n\n do i = 1, n\n if(d(i) >= 0) then\n ans = i - 1\n exit\n end if\n minsum = minsum - d(i)\n end do\n\n do i = n, 1, -1\n if(minsum <= 0) then\n exit\n end if\n minsum = minsum - d(i)\n ans = ans + 1\n end do\n\n write(*,*) ans\n\n deallocate(a)\n deallocate(b)\n deallocate(d)\n stop\ncontains\n\n\n !\n ! swap two arguments\n !\nsubroutine swap(a, b)\n implicit none\n integer(8), intent(inout) :: a, b\n\n integer(8) :: c\n\n c = a\n a = b\n b = c\n\n end subroutine swap\n\n !\n ! quick sortを乱択化するためのsubroutine\n ! このsubroutineは非公開にしているため、kadai6.f90内の\n ! randintとはバッティングしない\n !\n subroutine randint(x, maxint)\n implicit none\n integer(8), intent(out) :: x\n integer(8), intent(in) :: maxint\n\n real(8) :: r\n\n call random_number(r)\n\n x = int(maxint * r)\n\n end subroutine randint\n\n !\n ! quick sort\n !\n recursive subroutine qsort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n\n integer(8) :: n, pivot, pivindex, i, j\n\n n = size(x)\n \n !\n ! pivotのindexを1~nの中からランダムで選ぶ\n ! はじめの配列が特殊な形でも時間計算量がO(nlog n)になる\n ! この時間計測プログラムでは不要(配列がランダムなので)\n !\n call randint(pivindex, n)\n pivindex = pivindex + 1\n\n ! pivotを右端に除けておく\n pivot = x(pivindex)\n call swap(x(pivindex), x(n))\n \n !\n ! i はpivot以上の値が入っているindexの最小値\n ! j はいま調べているindex\n !\n i = 1\n do j = 1, n-1\n if( x(j) < pivot ) then\n call swap(x(i), x(j))\n i = i + 1\n end if\n end do\n\n ! i番目にpivot、i-1番目まではpivot未満、i+1番目からはpivot以上になる\n call swap(x(i), x(n))\n \n ! i <= 2ならiまではソート完了。そうでなければi-1までをソート\n if(i >= 3) then\n call qsort(x(:i-1))\n end if\n\n ! i >= n-1ならi以降はソート完了。そうでなければi+1以降をソート\n if(i <= n-2) then\n call qsort(x(i+1:))\n end if\n\n return\n end subroutine qsort\n\n !\n ! merge sort\n !\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n\n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n\n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n\n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n\n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n\n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n\n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\n\nend program prob6", "language": "Fortran", "metadata": {"date": 1591386394, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03151.html", "problem_id": "p03151", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03151/input.txt", "sample_output_relpath": "derived/input_output/data/p03151/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03151/Fortran/s310523519.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s310523519", "user_id": "u478462004"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program prob6\n implicit none\n integer(8) :: n, i, ans, minsum\n integer(8), allocatable :: a(:), b(:), d(:)\n read(*,*) n\n allocate(a(n))\n allocate(b(n))\n allocate(d(n))\n read(*,*) a\n read(*,*) b\n\n d = a - b\n if(sum(d) < 0) then\n write(*,*) \"-1\"\n stop\n end if\n\n call msort(d)\n\n do i = 1, n\n if(d(i) >= 0) then\n ans = i - 1\n exit\n end if\n minsum = minsum - d(i)\n end do\n\n do i = n, 1, -1\n if(minsum <= 0) then\n exit\n end if\n minsum = minsum - d(i)\n ans = ans + 1\n end do\n\n write(*,*) ans\n\n deallocate(a)\n deallocate(b)\n deallocate(d)\n stop\ncontains\n\n\n !\n ! swap two arguments\n !\nsubroutine swap(a, b)\n implicit none\n integer(8), intent(inout) :: a, b\n\n integer(8) :: c\n\n c = a\n a = b\n b = c\n\n end subroutine swap\n\n !\n ! quick sortを乱択化するためのsubroutine\n ! このsubroutineは非公開にしているため、kadai6.f90内の\n ! randintとはバッティングしない\n !\n subroutine randint(x, maxint)\n implicit none\n integer(8), intent(out) :: x\n integer(8), intent(in) :: maxint\n\n real(8) :: r\n\n call random_number(r)\n\n x = int(maxint * r)\n\n end subroutine randint\n\n !\n ! quick sort\n !\n recursive subroutine qsort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n\n integer(8) :: n, pivot, pivindex, i, j\n\n n = size(x)\n \n !\n ! pivotのindexを1~nの中からランダムで選ぶ\n ! はじめの配列が特殊な形でも時間計算量がO(nlog n)になる\n ! この時間計測プログラムでは不要(配列がランダムなので)\n !\n call randint(pivindex, n)\n pivindex = pivindex + 1\n\n ! pivotを右端に除けておく\n pivot = x(pivindex)\n call swap(x(pivindex), x(n))\n \n !\n ! i はpivot以上の値が入っているindexの最小値\n ! j はいま調べているindex\n !\n i = 1\n do j = 1, n-1\n if( x(j) < pivot ) then\n call swap(x(i), x(j))\n i = i + 1\n end if\n end do\n\n ! i番目にpivot、i-1番目まではpivot未満、i+1番目からはpivot以上になる\n call swap(x(i), x(n))\n \n ! i <= 2ならiまではソート完了。そうでなければi-1までをソート\n if(i >= 3) then\n call qsort(x(:i-1))\n end if\n\n ! i >= n-1ならi以降はソート完了。そうでなければi+1以降をソート\n if(i <= n-2) then\n call qsort(x(i+1:))\n end if\n\n return\n end subroutine qsort\n\n !\n ! merge sort\n !\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n\n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n\n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n\n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n\n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n\n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n\n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\n\nend program prob6", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA university student, Takahashi, has to take N examinations and pass all of them.\nCurrently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination.\n\nTakahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness.\n\nFor Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions:\n\nThe sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal.\n\nFor every i, B_i \\leq C_i holds.\n\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nA_i and B_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N}\nB_1 B_2 ... B_{N}\n\nOutput\n\nPrint the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the conditions.\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nSample Input 1\n\n3\n2 3 5\n3 4 1\n\nSample Output 1\n\n3\n\n(A_1, A_2, A_3) = (2, 3, 5) and (B_1, B_2, B_3) = (3, 4, 1). If nothing is done, he cannot pass the first and second exams.\nThe minimum possible number of indices i such that A_i and C_i are different, 3, is achieved when:\n\n(C_1, C_2, C_3) = (3, 5, 2)\n\nSample Input 2\n\n3\n2 3 3\n2 2 1\n\nSample Output 2\n\n0\n\nIn this case, he has to do nothing in order to pass all the exams.\n\nSample Input 3\n\n3\n17 7 1\n25 6 14\n\nSample Output 3\n\n-1\n\nIn this case, no matter what is done, he cannot pass all the exams.\n\nSample Input 4\n\n12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212\n\nSample Output 4\n\n5", "sample_input": "3\n2 3 5\n3 4 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03151", "source_text": "Score : 400 points\n\nProblem Statement\n\nA university student, Takahashi, has to take N examinations and pass all of them.\nCurrently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination.\n\nTakahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness.\n\nFor Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions:\n\nThe sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal.\n\nFor every i, B_i \\leq C_i holds.\n\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nA_i and B_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N}\nB_1 B_2 ... B_{N}\n\nOutput\n\nPrint the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the conditions.\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nSample Input 1\n\n3\n2 3 5\n3 4 1\n\nSample Output 1\n\n3\n\n(A_1, A_2, A_3) = (2, 3, 5) and (B_1, B_2, B_3) = (3, 4, 1). If nothing is done, he cannot pass the first and second exams.\nThe minimum possible number of indices i such that A_i and C_i are different, 3, is achieved when:\n\n(C_1, C_2, C_3) = (3, 5, 2)\n\nSample Input 2\n\n3\n2 3 3\n2 2 1\n\nSample Output 2\n\n0\n\nIn this case, he has to do nothing in order to pass all the exams.\n\nSample Input 3\n\n3\n17 7 1\n25 6 14\n\nSample Output 3\n\n-1\n\nIn this case, no matter what is done, he cannot pass all the exams.\n\nSample Input 4\n\n12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3868, "cpu_time_ms": 79, "memory_kb": 4280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s533288934", "group_id": "codeNet:p03151", "input_text": "program exam_and_wizard\n implicit none\n integer :: n, i, num\n integer(8) :: a(100000), b(100000), c(100000), tot\n a = 0_8\n b = 0_8\n c = 0_8\n read(*,*) n\n read(*,*) a(1:n)\n read(*,*) b(1:n)\n c(1:n) = a(1:n) - b(1:n)\n num = 0\n tot = 0_8\n do i = 1, n\n if (c(i).lt.0) then\n num = num + 1\n tot = tot - c(i)\n end if\n end do\n if (num.eq.0) then\n write(*,'(i0)') 0\n stop\n end if\n call merge_sort(n,c(1:n))\n do i = n, 1, -1\n if (c(i).lt.0) exit\n tot = tot - c(i)\n num = num + 1\n if (tot.le.0_8) then\n write(*,'(i0)') num\n stop\n end if\n end do\n write(*,'(i0)') -1\n stop\ncontains\n subroutine merge_sort(n,c)\n implicit none\n integer, intent(in) :: n\n integer(8), intent(inout) :: c(n)\n integer :: num, lth, ubd, i\n num = n\n lth = 1\n do while (num.gt.1)\n do i = 1, num/2\n ubd = min(2*i*lth,n)\n call merge(c(2*(i-1)*lth+1:(2*i-1)*lth),c((2*i-1)*lth+1:ubd))\n end do\n lth = 2*lth\n num = (num+1)/2\n end do\n return\n end subroutine merge_sort\n subroutine merge(c1,c2)\n implicit none\n integer(8), intent(inout) :: c1(:), c2(:)\n integer(8) :: c(size(c1)+size(c2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(c1)\n n2 = size(c2)\n do while (i1.le.n1.and.i2.le.n2)\n if (c1(i1).le.c2(i2)) then\n c(i1+i2-1) = c1(i1)\n i1 = i1+1\n else\n c(i1+i2-1) = c2(i2)\n i2 = i2+1\n end if\n end do\n if (i1.le.n1) then\n c(i1+i2-1:n1+n2) = c1(i1:n1)\n else if (i2.le.n2) then\n c(i1+i2-1:n1+n2) = c2(i2:n2)\n end if\n c1 = c(1:n1)\n c2 = c(n1+1:n1+n2)\n return\n end subroutine merge\nend program exam_and_wizard", "language": "Fortran", "metadata": {"date": 1557797827, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03151.html", "problem_id": "p03151", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03151/input.txt", "sample_output_relpath": "derived/input_output/data/p03151/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03151/Fortran/s533288934.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s533288934", "user_id": "u506403362"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program exam_and_wizard\n implicit none\n integer :: n, i, num\n integer(8) :: a(100000), b(100000), c(100000), tot\n a = 0_8\n b = 0_8\n c = 0_8\n read(*,*) n\n read(*,*) a(1:n)\n read(*,*) b(1:n)\n c(1:n) = a(1:n) - b(1:n)\n num = 0\n tot = 0_8\n do i = 1, n\n if (c(i).lt.0) then\n num = num + 1\n tot = tot - c(i)\n end if\n end do\n if (num.eq.0) then\n write(*,'(i0)') 0\n stop\n end if\n call merge_sort(n,c(1:n))\n do i = n, 1, -1\n if (c(i).lt.0) exit\n tot = tot - c(i)\n num = num + 1\n if (tot.le.0_8) then\n write(*,'(i0)') num\n stop\n end if\n end do\n write(*,'(i0)') -1\n stop\ncontains\n subroutine merge_sort(n,c)\n implicit none\n integer, intent(in) :: n\n integer(8), intent(inout) :: c(n)\n integer :: num, lth, ubd, i\n num = n\n lth = 1\n do while (num.gt.1)\n do i = 1, num/2\n ubd = min(2*i*lth,n)\n call merge(c(2*(i-1)*lth+1:(2*i-1)*lth),c((2*i-1)*lth+1:ubd))\n end do\n lth = 2*lth\n num = (num+1)/2\n end do\n return\n end subroutine merge_sort\n subroutine merge(c1,c2)\n implicit none\n integer(8), intent(inout) :: c1(:), c2(:)\n integer(8) :: c(size(c1)+size(c2))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(c1)\n n2 = size(c2)\n do while (i1.le.n1.and.i2.le.n2)\n if (c1(i1).le.c2(i2)) then\n c(i1+i2-1) = c1(i1)\n i1 = i1+1\n else\n c(i1+i2-1) = c2(i2)\n i2 = i2+1\n end if\n end do\n if (i1.le.n1) then\n c(i1+i2-1:n1+n2) = c1(i1:n1)\n else if (i2.le.n2) then\n c(i1+i2-1:n1+n2) = c2(i2:n2)\n end if\n c1 = c(1:n1)\n c2 = c(n1+1:n1+n2)\n return\n end subroutine merge\nend program exam_and_wizard", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA university student, Takahashi, has to take N examinations and pass all of them.\nCurrently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination.\n\nTakahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness.\n\nFor Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions:\n\nThe sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal.\n\nFor every i, B_i \\leq C_i holds.\n\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nA_i and B_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N}\nB_1 B_2 ... B_{N}\n\nOutput\n\nPrint the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the conditions.\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nSample Input 1\n\n3\n2 3 5\n3 4 1\n\nSample Output 1\n\n3\n\n(A_1, A_2, A_3) = (2, 3, 5) and (B_1, B_2, B_3) = (3, 4, 1). If nothing is done, he cannot pass the first and second exams.\nThe minimum possible number of indices i such that A_i and C_i are different, 3, is achieved when:\n\n(C_1, C_2, C_3) = (3, 5, 2)\n\nSample Input 2\n\n3\n2 3 3\n2 2 1\n\nSample Output 2\n\n0\n\nIn this case, he has to do nothing in order to pass all the exams.\n\nSample Input 3\n\n3\n17 7 1\n25 6 14\n\nSample Output 3\n\n-1\n\nIn this case, no matter what is done, he cannot pass all the exams.\n\nSample Input 4\n\n12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212\n\nSample Output 4\n\n5", "sample_input": "3\n2 3 5\n3 4 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03151", "source_text": "Score : 400 points\n\nProblem Statement\n\nA university student, Takahashi, has to take N examinations and pass all of them.\nCurrently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination.\n\nTakahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness.\n\nFor Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions:\n\nThe sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal.\n\nFor every i, B_i \\leq C_i holds.\n\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nA_i and B_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N}\nB_1 B_2 ... B_{N}\n\nOutput\n\nPrint the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the conditions.\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nSample Input 1\n\n3\n2 3 5\n3 4 1\n\nSample Output 1\n\n3\n\n(A_1, A_2, A_3) = (2, 3, 5) and (B_1, B_2, B_3) = (3, 4, 1). If nothing is done, he cannot pass the first and second exams.\nThe minimum possible number of indices i such that A_i and C_i are different, 3, is achieved when:\n\n(C_1, C_2, C_3) = (3, 5, 2)\n\nSample Input 2\n\n3\n2 3 3\n2 2 1\n\nSample Output 2\n\n0\n\nIn this case, he has to do nothing in order to pass all the exams.\n\nSample Input 3\n\n3\n17 7 1\n25 6 14\n\nSample Output 3\n\n-1\n\nIn this case, no matter what is done, he cannot pass all the exams.\n\nSample Input 4\n\n12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1702, "cpu_time_ms": 78, "memory_kb": 4088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s877684503", "group_id": "codeNet:p03151", "input_text": "program main\n implicit none\n integer (8) :: M, N, count, i, j, JG\n integer (8), allocatable, dimension ( : ) :: A, B, D, tmp\n\n read *,N\n allocate ( A ( N ) )\n allocate ( B ( N ) )\n allocate ( D ( N ) )\n allocate ( tmp ( N ) )\n read *, A\n read *, B\n\n count = 0\n JG = 0\n M = 0\n\n do i = 1, N\n JG = JG + A ( i ) - B ( i )\n end do\n\n if ( JG < 0 ) then\n print *,-1\n stop\n end if\n\n do i = 1, N\n D ( i ) = A ( i ) - B ( i )\n if ( D ( i ) < 0 ) then\n M = M + D ( i )\n count = count + 1\n end if\n end do\n\n do j = 1, N\n do i = 1, N - 1\n if ( D ( i ) < D ( i + 1 ) ) then\n tmp ( i ) = D ( i )\n D ( i ) = D ( i + 1 )\n D ( i + 1 ) = tmp ( i )\n end if\n end do\n end do\n\n do i = 1, N\n if ( M >= 0 ) exit\n M = M + D ( i )\n count = count + 1\n end do\n\n print *, count\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1552006658, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03151.html", "problem_id": "p03151", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03151/input.txt", "sample_output_relpath": "derived/input_output/data/p03151/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03151/Fortran/s877684503.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s877684503", "user_id": "u731648631"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n implicit none\n integer (8) :: M, N, count, i, j, JG\n integer (8), allocatable, dimension ( : ) :: A, B, D, tmp\n\n read *,N\n allocate ( A ( N ) )\n allocate ( B ( N ) )\n allocate ( D ( N ) )\n allocate ( tmp ( N ) )\n read *, A\n read *, B\n\n count = 0\n JG = 0\n M = 0\n\n do i = 1, N\n JG = JG + A ( i ) - B ( i )\n end do\n\n if ( JG < 0 ) then\n print *,-1\n stop\n end if\n\n do i = 1, N\n D ( i ) = A ( i ) - B ( i )\n if ( D ( i ) < 0 ) then\n M = M + D ( i )\n count = count + 1\n end if\n end do\n\n do j = 1, N\n do i = 1, N - 1\n if ( D ( i ) < D ( i + 1 ) ) then\n tmp ( i ) = D ( i )\n D ( i ) = D ( i + 1 )\n D ( i + 1 ) = tmp ( i )\n end if\n end do\n end do\n\n do i = 1, N\n if ( M >= 0 ) exit\n M = M + D ( i )\n count = count + 1\n end do\n\n print *, count\n\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA university student, Takahashi, has to take N examinations and pass all of them.\nCurrently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination.\n\nTakahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness.\n\nFor Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions:\n\nThe sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal.\n\nFor every i, B_i \\leq C_i holds.\n\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nA_i and B_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N}\nB_1 B_2 ... B_{N}\n\nOutput\n\nPrint the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the conditions.\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nSample Input 1\n\n3\n2 3 5\n3 4 1\n\nSample Output 1\n\n3\n\n(A_1, A_2, A_3) = (2, 3, 5) and (B_1, B_2, B_3) = (3, 4, 1). If nothing is done, he cannot pass the first and second exams.\nThe minimum possible number of indices i such that A_i and C_i are different, 3, is achieved when:\n\n(C_1, C_2, C_3) = (3, 5, 2)\n\nSample Input 2\n\n3\n2 3 3\n2 2 1\n\nSample Output 2\n\n0\n\nIn this case, he has to do nothing in order to pass all the exams.\n\nSample Input 3\n\n3\n17 7 1\n25 6 14\n\nSample Output 3\n\n-1\n\nIn this case, no matter what is done, he cannot pass all the exams.\n\nSample Input 4\n\n12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212\n\nSample Output 4\n\n5", "sample_input": "3\n2 3 5\n3 4 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03151", "source_text": "Score : 400 points\n\nProblem Statement\n\nA university student, Takahashi, has to take N examinations and pass all of them.\nCurrently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination.\n\nTakahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness.\n\nFor Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions:\n\nThe sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal.\n\nFor every i, B_i \\leq C_i holds.\n\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nA_i and B_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N}\nB_1 B_2 ... B_{N}\n\nOutput\n\nPrint the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the conditions.\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nSample Input 1\n\n3\n2 3 5\n3 4 1\n\nSample Output 1\n\n3\n\n(A_1, A_2, A_3) = (2, 3, 5) and (B_1, B_2, B_3) = (3, 4, 1). If nothing is done, he cannot pass the first and second exams.\nThe minimum possible number of indices i such that A_i and C_i are different, 3, is achieved when:\n\n(C_1, C_2, C_3) = (3, 5, 2)\n\nSample Input 2\n\n3\n2 3 3\n2 2 1\n\nSample Output 2\n\n0\n\nIn this case, he has to do nothing in order to pass all the exams.\n\nSample Input 3\n\n3\n17 7 1\n25 6 14\n\nSample Output 3\n\n-1\n\nIn this case, no matter what is done, he cannot pass all the exams.\n\nSample Input 4\n\n12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 934, "cpu_time_ms": 2107, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s858168259", "group_id": "codeNet:p03151", "input_text": "program keyence2019\n implicit none\n integer n, i, ans\n integer(8) s\n integer(8), dimension(:), allocatable :: a, b, c\n\n read *, n\n allocate(a(n), b(n), c(n))\n read *, a, b\n c = a - b\n c = sort_desc(c)\n s = sum(pack(c, c < 0))\n ans = count(c < 0)\n do i = 1, n\n if (s >= 0 .or. c(i) <= 0) exit\n s = s + c(i)\n ans = ans + 1\n end do\n if (s < 0) then\n print '(a)', '-1'\n else\n print '(i0)', ans\n end if\ncontains\n recursive function sort_desc(a) result(res)\n integer(8), dimension(:), allocatable :: res, l, r\n integer(8), dimension(:), intent(in) :: a\n integer p\n\n if (size(a) < 2) then\n res = a\n else\n p = size(a) / 2\n l = [pack(a(1:p-1), a(1:p-1) > a(p)), pack(a(p+1:), a(p+1:) > a(p))]\n r = [pack(a(1:p-1), a(1:p-1) <= a(p)), pack(a(p+1:), a(p+1:) <= a(p))]\n res = [sort_desc(l), a(p), sort_desc(r)]\n end if\n end function sort_desc\nend program keyence2019\n", "language": "Fortran", "metadata": {"date": 1547578039, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03151.html", "problem_id": "p03151", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03151/input.txt", "sample_output_relpath": "derived/input_output/data/p03151/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03151/Fortran/s858168259.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s858168259", "user_id": "u081445141"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program keyence2019\n implicit none\n integer n, i, ans\n integer(8) s\n integer(8), dimension(:), allocatable :: a, b, c\n\n read *, n\n allocate(a(n), b(n), c(n))\n read *, a, b\n c = a - b\n c = sort_desc(c)\n s = sum(pack(c, c < 0))\n ans = count(c < 0)\n do i = 1, n\n if (s >= 0 .or. c(i) <= 0) exit\n s = s + c(i)\n ans = ans + 1\n end do\n if (s < 0) then\n print '(a)', '-1'\n else\n print '(i0)', ans\n end if\ncontains\n recursive function sort_desc(a) result(res)\n integer(8), dimension(:), allocatable :: res, l, r\n integer(8), dimension(:), intent(in) :: a\n integer p\n\n if (size(a) < 2) then\n res = a\n else\n p = size(a) / 2\n l = [pack(a(1:p-1), a(1:p-1) > a(p)), pack(a(p+1:), a(p+1:) > a(p))]\n r = [pack(a(1:p-1), a(1:p-1) <= a(p)), pack(a(p+1:), a(p+1:) <= a(p))]\n res = [sort_desc(l), a(p), sort_desc(r)]\n end if\n end function sort_desc\nend program keyence2019\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA university student, Takahashi, has to take N examinations and pass all of them.\nCurrently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination.\n\nTakahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness.\n\nFor Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions:\n\nThe sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal.\n\nFor every i, B_i \\leq C_i holds.\n\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nA_i and B_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N}\nB_1 B_2 ... B_{N}\n\nOutput\n\nPrint the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the conditions.\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nSample Input 1\n\n3\n2 3 5\n3 4 1\n\nSample Output 1\n\n3\n\n(A_1, A_2, A_3) = (2, 3, 5) and (B_1, B_2, B_3) = (3, 4, 1). If nothing is done, he cannot pass the first and second exams.\nThe minimum possible number of indices i such that A_i and C_i are different, 3, is achieved when:\n\n(C_1, C_2, C_3) = (3, 5, 2)\n\nSample Input 2\n\n3\n2 3 3\n2 2 1\n\nSample Output 2\n\n0\n\nIn this case, he has to do nothing in order to pass all the exams.\n\nSample Input 3\n\n3\n17 7 1\n25 6 14\n\nSample Output 3\n\n-1\n\nIn this case, no matter what is done, he cannot pass all the exams.\n\nSample Input 4\n\n12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212\n\nSample Output 4\n\n5", "sample_input": "3\n2 3 5\n3 4 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03151", "source_text": "Score : 400 points\n\nProblem Statement\n\nA university student, Takahashi, has to take N examinations and pass all of them.\nCurrently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination.\n\nTakahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness.\n\nFor Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions:\n\nThe sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal.\n\nFor every i, B_i \\leq C_i holds.\n\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nA_i and B_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N}\nB_1 B_2 ... B_{N}\n\nOutput\n\nPrint the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the conditions.\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nSample Input 1\n\n3\n2 3 5\n3 4 1\n\nSample Output 1\n\n3\n\n(A_1, A_2, A_3) = (2, 3, 5) and (B_1, B_2, B_3) = (3, 4, 1). If nothing is done, he cannot pass the first and second exams.\nThe minimum possible number of indices i such that A_i and C_i are different, 3, is achieved when:\n\n(C_1, C_2, C_3) = (3, 5, 2)\n\nSample Input 2\n\n3\n2 3 3\n2 2 1\n\nSample Output 2\n\n0\n\nIn this case, he has to do nothing in order to pass all the exams.\n\nSample Input 3\n\n3\n17 7 1\n25 6 14\n\nSample Output 3\n\n-1\n\nIn this case, no matter what is done, he cannot pass all the exams.\n\nSample Input 4\n\n12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 940, "cpu_time_ms": 2206, "memory_kb": 1564628}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s679902447", "group_id": "codeNet:p03151", "input_text": "program keyence2019\n implicit none\n integer n, i, ans\n integer(8) s\n integer(8), dimension(:), allocatable :: a, b, c\n\n read *, n\n allocate(a(n), b(n), c(n))\n read *, a, b\n c = a - b\n c = sort_desc(c)\n s = sum(pack(c, c < 0))\n ans = count(c < 0)\n do i = 1, n\n if (s >= 0 .or. c(i) <= 0) exit\n s = s + c(i)\n ans = ans + 1\n end do\n if (s < 0) then\n print '(a)', '-1'\n else\n print '(i0)', ans\n end if\ncontains\n recursive function sort_desc(a) result(res)\n integer(8), dimension(:), allocatable :: res\n integer(8), dimension(:), intent(in) :: a\n\n if (size(a) < 2) then\n res = a\n else\n res = [sort_desc(pack(a(2:), a(2:) > a(1))), a(1), sort_desc(pack(a(2:), a(2:) <= a(1)))]\n end if\n end function sort_desc\nend program keyence2019\n", "language": "Fortran", "metadata": {"date": 1547569093, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03151.html", "problem_id": "p03151", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03151/input.txt", "sample_output_relpath": "derived/input_output/data/p03151/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03151/Fortran/s679902447.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s679902447", "user_id": "u081445141"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program keyence2019\n implicit none\n integer n, i, ans\n integer(8) s\n integer(8), dimension(:), allocatable :: a, b, c\n\n read *, n\n allocate(a(n), b(n), c(n))\n read *, a, b\n c = a - b\n c = sort_desc(c)\n s = sum(pack(c, c < 0))\n ans = count(c < 0)\n do i = 1, n\n if (s >= 0 .or. c(i) <= 0) exit\n s = s + c(i)\n ans = ans + 1\n end do\n if (s < 0) then\n print '(a)', '-1'\n else\n print '(i0)', ans\n end if\ncontains\n recursive function sort_desc(a) result(res)\n integer(8), dimension(:), allocatable :: res\n integer(8), dimension(:), intent(in) :: a\n\n if (size(a) < 2) then\n res = a\n else\n res = [sort_desc(pack(a(2:), a(2:) > a(1))), a(1), sort_desc(pack(a(2:), a(2:) <= a(1)))]\n end if\n end function sort_desc\nend program keyence2019\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA university student, Takahashi, has to take N examinations and pass all of them.\nCurrently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination.\n\nTakahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness.\n\nFor Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions:\n\nThe sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal.\n\nFor every i, B_i \\leq C_i holds.\n\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nA_i and B_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N}\nB_1 B_2 ... B_{N}\n\nOutput\n\nPrint the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the conditions.\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nSample Input 1\n\n3\n2 3 5\n3 4 1\n\nSample Output 1\n\n3\n\n(A_1, A_2, A_3) = (2, 3, 5) and (B_1, B_2, B_3) = (3, 4, 1). If nothing is done, he cannot pass the first and second exams.\nThe minimum possible number of indices i such that A_i and C_i are different, 3, is achieved when:\n\n(C_1, C_2, C_3) = (3, 5, 2)\n\nSample Input 2\n\n3\n2 3 3\n2 2 1\n\nSample Output 2\n\n0\n\nIn this case, he has to do nothing in order to pass all the exams.\n\nSample Input 3\n\n3\n17 7 1\n25 6 14\n\nSample Output 3\n\n-1\n\nIn this case, no matter what is done, he cannot pass all the exams.\n\nSample Input 4\n\n12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212\n\nSample Output 4\n\n5", "sample_input": "3\n2 3 5\n3 4 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03151", "source_text": "Score : 400 points\n\nProblem Statement\n\nA university student, Takahashi, has to take N examinations and pass all of them.\nCurrently, his readiness for the i-th examination is A_{i}, and according to his investigation, it is known that he needs readiness of at least B_{i} in order to pass the i-th examination.\n\nTakahashi thinks that he may not be able to pass all the examinations, and he has decided to ask a magician, Aoki, to change the readiness for as few examinations as possible so that he can pass all of them, while not changing the total readiness.\n\nFor Takahashi, find the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the following conditions:\n\nThe sum of the sequence A_1, A_2, ..., A_{N} and the sum of the sequence C_1, C_2, ..., C_{N} are equal.\n\nFor every i, B_i \\leq C_i holds.\n\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nA_i and B_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_{N}\nB_1 B_2 ... B_{N}\n\nOutput\n\nPrint the minimum possible number of indices i such that A_i and C_i are different, for a sequence C_1, C_2, ..., C_{N} that satisfies the conditions.\nIf such a sequence C_1, C_2, ..., C_{N} cannot be constructed, print -1.\n\nSample Input 1\n\n3\n2 3 5\n3 4 1\n\nSample Output 1\n\n3\n\n(A_1, A_2, A_3) = (2, 3, 5) and (B_1, B_2, B_3) = (3, 4, 1). If nothing is done, he cannot pass the first and second exams.\nThe minimum possible number of indices i such that A_i and C_i are different, 3, is achieved when:\n\n(C_1, C_2, C_3) = (3, 5, 2)\n\nSample Input 2\n\n3\n2 3 3\n2 2 1\n\nSample Output 2\n\n0\n\nIn this case, he has to do nothing in order to pass all the exams.\n\nSample Input 3\n\n3\n17 7 1\n25 6 14\n\nSample Output 3\n\n-1\n\nIn this case, no matter what is done, he cannot pass all the exams.\n\nSample Input 4\n\n12\n757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604\n74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 792, "cpu_time_ms": 2231, "memory_kb": 1750144}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s206231663", "group_id": "codeNet:p03162", "input_text": " PROGRAM Vacation\n IMPLICIT NONE\n integer :: n\n integer,allocatable :: abcTable(:,:)\n integer :: day,Yday,Today\n integer,allocatable :: dp(:,:)\n \n read*,n\n allocate(abcTable(n,3),dp(0:n,3) )\n do day = 1,n\n read*,abcTable(day,:)\n end do\n \n dp = 0\n !dp(day,abc)当日に行動abcをとった場合のday(終了時)での最大値\n \n !abcHielaux,abcHodiaux\n do day = 1,n\n do Today = 1,3\n do Yday = 1,3\n if( Today==Yday )cycle\n dp(day,Today) = max( dp(day,Today), &\n &dp(day-1,Yday)+abcTable(day,Today) )\n end do\n end do\n end do\n \n print*,maxval(dp(n,:))\n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1583626058, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03162.html", "problem_id": "p03162", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03162/input.txt", "sample_output_relpath": "derived/input_output/data/p03162/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03162/Fortran/s206231663.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s206231663", "user_id": "u171356453"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": " PROGRAM Vacation\n IMPLICIT NONE\n integer :: n\n integer,allocatable :: abcTable(:,:)\n integer :: day,Yday,Today\n integer,allocatable :: dp(:,:)\n \n read*,n\n allocate(abcTable(n,3),dp(0:n,3) )\n do day = 1,n\n read*,abcTable(day,:)\n end do\n \n dp = 0\n !dp(day,abc)当日に行動abcをとった場合のday(終了時)での最大値\n \n !abcHielaux,abcHodiaux\n do day = 1,n\n do Today = 1,3\n do Yday = 1,3\n if( Today==Yday )cycle\n dp(day,Today) = max( dp(day,Today), &\n &dp(day-1,Yday)+abcTable(day,Today) )\n end do\n end do\n end do\n \n print*,maxval(dp(n,:))\n \n \n END PROGRAM", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTaro's summer vacation starts tomorrow, and he has decided to make plans for it now.\n\nThe vacation consists of N days.\nFor each i (1 \\leq i \\leq N), Taro will choose one of the following activities and do it on the i-th day:\n\nA: Swim in the sea. Gain a_i points of happiness.\n\nB: Catch bugs in the mountains. Gain b_i points of happiness.\n\nC: Do homework at home. Gain c_i points of happiness.\n\nAs Taro gets bored easily, he cannot do the same activities for two or more consecutive days.\n\nFind the maximum possible total points of happiness that Taro gains.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i, c_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the maximum possible total points of happiness that Taro gains.\n\nSample Input 1\n\n3\n10 40 70\n20 50 80\n30 60 90\n\nSample Output 1\n\n210\n\nIf Taro does activities in the order C, B, C, he will gain 70 + 50 + 90 = 210 points of happiness.\n\nSample Input 2\n\n1\n100 10 1\n\nSample Output 2\n\n100\n\nSample Input 3\n\n7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 5 1\n\nSample Output 3\n\n46\n\nTaro should do activities in the order C, A, B, A, C, B, A.", "sample_input": "3\n10 40 70\n20 50 80\n30 60 90\n"}, "reference_outputs": ["210\n"], "source_document_id": "p03162", "source_text": "Score : 100 points\n\nProblem Statement\n\nTaro's summer vacation starts tomorrow, and he has decided to make plans for it now.\n\nThe vacation consists of N days.\nFor each i (1 \\leq i \\leq N), Taro will choose one of the following activities and do it on the i-th day:\n\nA: Swim in the sea. Gain a_i points of happiness.\n\nB: Catch bugs in the mountains. Gain b_i points of happiness.\n\nC: Do homework at home. Gain c_i points of happiness.\n\nAs Taro gets bored easily, he cannot do the same activities for two or more consecutive days.\n\nFind the maximum possible total points of happiness that Taro gains.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i, c_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the maximum possible total points of happiness that Taro gains.\n\nSample Input 1\n\n3\n10 40 70\n20 50 80\n30 60 90\n\nSample Output 1\n\n210\n\nIf Taro does activities in the order C, B, C, he will gain 70 + 50 + 90 = 210 points of happiness.\n\nSample Input 2\n\n1\n100 10 1\n\nSample Output 2\n\n100\n\nSample Input 3\n\n7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 5 1\n\nSample Output 3\n\n46\n\nTaro should do activities in the order C, A, B, A, C, B, A.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 756, "cpu_time_ms": 86, "memory_kb": 2560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s218285892", "group_id": "codeNet:p03162", "input_text": "program main\n implicit none\n integer :: i, j, N\n integer,allocatable,dimension(:, :) :: v, dp\n logical,dimension(3, 3) :: f\n f = .true.\n do i = 1,3\n f(i, i) = .false.\n enddo\n\n read*, N\n allocate(dp(3, N), v(3, N))\n do i = 1, N\n read*, v(:, i)\n end do\n\n dp(:, 1) = v(:, 1)\n do i = 2, N\n do j = 1, 3\n dp(j, i) = maxval(pack(dp(:, i-1), f(:, j))) + v(j, i)\n enddo\n enddo\n print*, maxval(dp(:, N))\nend", "language": "Fortran", "metadata": {"date": 1547308018, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03162.html", "problem_id": "p03162", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03162/input.txt", "sample_output_relpath": "derived/input_output/data/p03162/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03162/Fortran/s218285892.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s218285892", "user_id": "u394519598"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "program main\n implicit none\n integer :: i, j, N\n integer,allocatable,dimension(:, :) :: v, dp\n logical,dimension(3, 3) :: f\n f = .true.\n do i = 1,3\n f(i, i) = .false.\n enddo\n\n read*, N\n allocate(dp(3, N), v(3, N))\n do i = 1, N\n read*, v(:, i)\n end do\n\n dp(:, 1) = v(:, 1)\n do i = 2, N\n do j = 1, 3\n dp(j, i) = maxval(pack(dp(:, i-1), f(:, j))) + v(j, i)\n enddo\n enddo\n print*, maxval(dp(:, N))\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTaro's summer vacation starts tomorrow, and he has decided to make plans for it now.\n\nThe vacation consists of N days.\nFor each i (1 \\leq i \\leq N), Taro will choose one of the following activities and do it on the i-th day:\n\nA: Swim in the sea. Gain a_i points of happiness.\n\nB: Catch bugs in the mountains. Gain b_i points of happiness.\n\nC: Do homework at home. Gain c_i points of happiness.\n\nAs Taro gets bored easily, he cannot do the same activities for two or more consecutive days.\n\nFind the maximum possible total points of happiness that Taro gains.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i, c_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the maximum possible total points of happiness that Taro gains.\n\nSample Input 1\n\n3\n10 40 70\n20 50 80\n30 60 90\n\nSample Output 1\n\n210\n\nIf Taro does activities in the order C, B, C, he will gain 70 + 50 + 90 = 210 points of happiness.\n\nSample Input 2\n\n1\n100 10 1\n\nSample Output 2\n\n100\n\nSample Input 3\n\n7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 5 1\n\nSample Output 3\n\n46\n\nTaro should do activities in the order C, A, B, A, C, B, A.", "sample_input": "3\n10 40 70\n20 50 80\n30 60 90\n"}, "reference_outputs": ["210\n"], "source_document_id": "p03162", "source_text": "Score : 100 points\n\nProblem Statement\n\nTaro's summer vacation starts tomorrow, and he has decided to make plans for it now.\n\nThe vacation consists of N days.\nFor each i (1 \\leq i \\leq N), Taro will choose one of the following activities and do it on the i-th day:\n\nA: Swim in the sea. Gain a_i points of happiness.\n\nB: Catch bugs in the mountains. Gain b_i points of happiness.\n\nC: Do homework at home. Gain c_i points of happiness.\n\nAs Taro gets bored easily, he cannot do the same activities for two or more consecutive days.\n\nFind the maximum possible total points of happiness that Taro gains.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i, c_i \\leq 10^4\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1 c_1\na_2 b_2 c_2\n:\na_N b_N c_N\n\nOutput\n\nPrint the maximum possible total points of happiness that Taro gains.\n\nSample Input 1\n\n3\n10 40 70\n20 50 80\n30 60 90\n\nSample Output 1\n\n210\n\nIf Taro does activities in the order C, B, C, he will gain 70 + 50 + 90 = 210 points of happiness.\n\nSample Input 2\n\n1\n100 10 1\n\nSample Output 2\n\n100\n\nSample Input 3\n\n7\n6 7 8\n8 8 3\n2 5 2\n7 8 6\n4 6 8\n2 3 4\n7 5 1\n\nSample Output 3\n\n46\n\nTaro should do activities in the order C, A, B, A, C, B, A.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 429, "cpu_time_ms": 106, "memory_kb": 2560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s458286466", "group_id": "codeNet:p03164", "input_text": "program eee\nimplicit none\n \ninteger(8) :: n, w, i, j\ninteger(8),allocatable,dimension(:) :: ww, vv\ninteger(8),allocatable,dimension(:,:) :: dp\n! 初期値の設定\nread*, n, w\nallocate(ww(n),vv(n))\ndo i=1, n\n\tread*, ww(i), vv(i)\nend do\nallocate(dp(0:n,0:1000*n))\ndp=w*n+1\ndp(0,0)=0\n! end 初期値の設定\n \ndo i=1,n\n\tdo j=0,1000*n\n\t\tif(j>=vv(i)) then\t\t\t\t\t!追加可能パターン\n \tdp(i,j)=dp(i-1,j-vv(i))+ww(i)\t!i-1の場合の、価値j-v(i)から参照\n end if\n dp(i,j)=min(dp(i,j),dp(i-1,j))\t\t!追加したものとしていないものの比較を行う\n end do\nend do\n \ndo j=1000*n,0,-1\n if(dp(n,j)<=w) then\n \twrite(*,'(i0)') j\n return\n end if\nend do\n \nend program\n", "language": "Fortran", "metadata": {"date": 1571228363, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Fortran/s458286466.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s458286466", "user_id": "u039189422"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "program eee\nimplicit none\n \ninteger(8) :: n, w, i, j\ninteger(8),allocatable,dimension(:) :: ww, vv\ninteger(8),allocatable,dimension(:,:) :: dp\n! 初期値の設定\nread*, n, w\nallocate(ww(n),vv(n))\ndo i=1, n\n\tread*, ww(i), vv(i)\nend do\nallocate(dp(0:n,0:1000*n))\ndp=w*n+1\ndp(0,0)=0\n! end 初期値の設定\n \ndo i=1,n\n\tdo j=0,1000*n\n\t\tif(j>=vv(i)) then\t\t\t\t\t!追加可能パターン\n \tdp(i,j)=dp(i-1,j-vv(i))+ww(i)\t!i-1の場合の、価値j-v(i)から参照\n end if\n dp(i,j)=min(dp(i,j),dp(i-1,j))\t\t!追加したものとしていないものの比較を行う\n end do\nend do\n \ndo j=1000*n,0,-1\n if(dp(n,j)<=w) then\n \twrite(*,'(i0)') j\n return\n end if\nend do\n \nend program\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 714, "cpu_time_ms": 156, "memory_kb": 79232}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s103361172", "group_id": "codeNet:p03164", "input_text": "program eee\nimplicit none\n\ninteger(8) :: n, w, i, j\ninteger(8),allocatable,dimension(:) :: ww, vv\ninteger(8),allocatable,dimension(:,:) :: dp\n! 初期値の設定\nread*, n, w\nallocate(ww(n),vv(n))\ndo i=1, n\n\tread*, ww(i), vv(i)\nend do\nallocate(dp(0:n,0:sum(vv)))\ndp=sum(vv)+1\ndp(0,0)=0\n! end 初期値の設定\n\ndo i=1,n\n\tdo j=0,sum(vv)\n\t\tif(j>=vv(i)) then\t\t\t\t\t!追加可能パターン\n \tdp(i,j)=dp(i-1,j-vv(i))+ww(i)\t!i-1の場合の、価値j-v(i)から参照\n end if\n dp(i,j)=min(dp(i,j),dp(i-1,j))\t\t!追加したものとしていないものの比較を行う\n end do\nend do\n\ndo j=sum(vv),0,-1\n if(dp(n,j)<=w) then\n \twrite(*,'(i0)') j\n return\n end if\nend do\n\nend program", "language": "Fortran", "metadata": {"date": 1571227622, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03164.html", "problem_id": "p03164", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03164/input.txt", "sample_output_relpath": "derived/input_output/data/p03164/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03164/Fortran/s103361172.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s103361172", "user_id": "u039189422"}, "prompt_components": {"gold_output": "90\n", "input_to_evaluate": "program eee\nimplicit none\n\ninteger(8) :: n, w, i, j\ninteger(8),allocatable,dimension(:) :: ww, vv\ninteger(8),allocatable,dimension(:,:) :: dp\n! 初期値の設定\nread*, n, w\nallocate(ww(n),vv(n))\ndo i=1, n\n\tread*, ww(i), vv(i)\nend do\nallocate(dp(0:n,0:sum(vv)))\ndp=sum(vv)+1\ndp(0,0)=0\n! end 初期値の設定\n\ndo i=1,n\n\tdo j=0,sum(vv)\n\t\tif(j>=vv(i)) then\t\t\t\t\t!追加可能パターン\n \tdp(i,j)=dp(i-1,j-vv(i))+ww(i)\t!i-1の場合の、価値j-v(i)から参照\n end if\n dp(i,j)=min(dp(i,j),dp(i-1,j))\t\t!追加したものとしていないものの比較を行う\n end do\nend do\n\ndo j=sum(vv),0,-1\n if(dp(n,j)<=w) then\n \twrite(*,'(i0)') j\n return\n end if\nend do\n\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "sample_input": "3 8\n3 30\n4 50\n5 60\n"}, "reference_outputs": ["90\n"], "source_document_id": "p03164", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N items, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), Item i has a weight of w_i and a value of v_i.\n\nTaro has decided to choose some of the N items and carry them home in a knapsack.\nThe capacity of the knapsack is W, which means that the sum of the weights of items taken must be at most W.\n\nFind the maximum possible sum of the values of items that Taro takes home.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq W \\leq 10^9\n\n1 \\leq w_i \\leq W\n\n1 \\leq v_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN W\nw_1 v_1\nw_2 v_2\n:\nw_N v_N\n\nOutput\n\nPrint the maximum possible sum of the values of items that Taro takes home.\n\nSample Input 1\n\n3 8\n3 30\n4 50\n5 60\n\nSample Output 1\n\n90\n\nItems 1 and 3 should be taken.\nThen, the sum of the weights is 3 + 5 = 8, and the sum of the values is 30 + 60 = 90.\n\nSample Input 2\n\n1 1000000000\n1000000000 10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6 15\n6 5\n5 6\n6 4\n6 6\n3 5\n7 2\n\nSample Output 3\n\n17\n\nItems 2, 4 and 5 should be taken.\nThen, the sum of the weights is 5 + 6 + 3 = 14, and the sum of the values is 6 + 6 + 5 = 17.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 716, "cpu_time_ms": 154, "memory_kb": 79104}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s557308475", "group_id": "codeNet:p03166", "input_text": "integer N,M\ninteger X,Y\ninteger,allocatable,dimension(:,:)::EDGE\ninteger,allocatable,dimension(:)::Nindex\ninteger,allocatable,dimension(:)::DP\ninteger ans\n!読み込み\nread*,N,M\nallocate(DP(N))\nallocate(EDGE(N,M))\nallocate(Nindex(N))\nEDGE=0\nNindex=0\ndo i=1,M\n read*,X,Y\n Nindex(X)=Nindex(X)+1\n EDGE(X,Nindex(X))=Y\nend do\n!読み込み終了\n\nDP = -1\n!DP[i]とはノードiからのびる経路のうち最短のもの\n!まだ調べていない状態は-1とする\nans = 0\ndo i=1,N\n if(DP(i)==-1)DP(i)=DFS(i)\n ans=max(ans,DP(i) )\nend do\n\nprint\"(I0)\",ans\n\ncontains\n\nrecursive function DFS(u)result(res)\ninteger u,res\n if(DP(u) >= 0)then\n res=DP(u)\n else\n DP(u)=0\n do j=1,Nindex(u)\n DP(u)=max(DP(u),DFS(EDGE(u,j))+1)\n end do\n res=DP(u)\n endif\nend function DFS\nend", "language": "Fortran", "metadata": {"date": 1556729707, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03166.html", "problem_id": "p03166", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03166/input.txt", "sample_output_relpath": "derived/input_output/data/p03166/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03166/Fortran/s557308475.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s557308475", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "integer N,M\ninteger X,Y\ninteger,allocatable,dimension(:,:)::EDGE\ninteger,allocatable,dimension(:)::Nindex\ninteger,allocatable,dimension(:)::DP\ninteger ans\n!読み込み\nread*,N,M\nallocate(DP(N))\nallocate(EDGE(N,M))\nallocate(Nindex(N))\nEDGE=0\nNindex=0\ndo i=1,M\n read*,X,Y\n Nindex(X)=Nindex(X)+1\n EDGE(X,Nindex(X))=Y\nend do\n!読み込み終了\n\nDP = -1\n!DP[i]とはノードiからのびる経路のうち最短のもの\n!まだ調べていない状態は-1とする\nans = 0\ndo i=1,N\n if(DP(i)==-1)DP(i)=DFS(i)\n ans=max(ans,DP(i) )\nend do\n\nprint\"(I0)\",ans\n\ncontains\n\nrecursive function DFS(u)result(res)\ninteger u,res\n if(DP(u) >= 0)then\n res=DP(u)\n else\n DP(u)=0\n do j=1,Nindex(u)\n DP(u)=max(DP(u),DFS(EDGE(u,j))+1)\n end do\n res=DP(u)\n endif\nend function DFS\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a directed graph G with N vertices and M edges.\nThe vertices are numbered 1, 2, \\ldots, N, and for each i (1 \\leq i \\leq M), the i-th directed edge goes from Vertex x_i to y_i.\nG does not contain directed cycles.\n\nFind the length of the longest directed path in G.\nHere, the length of a directed path is the number of edges in it.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq x_i, y_i \\leq N\n\nAll pairs (x_i, y_i) are distinct.\n\nG does not contain directed cycles.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the length of the longest directed path in G.\n\nSample Input 1\n\n4 5\n1 2\n1 3\n3 2\n2 4\n3 4\n\nSample Output 1\n\n3\n\nThe red directed path in the following figure is the longest:\n\nSample Input 2\n\n6 3\n2 3\n4 5\n5 6\n\nSample Output 2\n\n2\n\nThe red directed path in the following figure is the longest:\n\nSample Input 3\n\n5 8\n5 3\n2 3\n2 4\n5 2\n5 1\n1 4\n4 3\n1 3\n\nSample Output 3\n\n3\n\nThe red directed path in the following figure is one of the longest:", "sample_input": "4 5\n1 2\n1 3\n3 2\n2 4\n3 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03166", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a directed graph G with N vertices and M edges.\nThe vertices are numbered 1, 2, \\ldots, N, and for each i (1 \\leq i \\leq M), the i-th directed edge goes from Vertex x_i to y_i.\nG does not contain directed cycles.\n\nFind the length of the longest directed path in G.\nHere, the length of a directed path is the number of edges in it.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq x_i, y_i \\leq N\n\nAll pairs (x_i, y_i) are distinct.\n\nG does not contain directed cycles.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the length of the longest directed path in G.\n\nSample Input 1\n\n4 5\n1 2\n1 3\n3 2\n2 4\n3 4\n\nSample Output 1\n\n3\n\nThe red directed path in the following figure is the longest:\n\nSample Input 2\n\n6 3\n2 3\n4 5\n5 6\n\nSample Output 2\n\n2\n\nThe red directed path in the following figure is the longest:\n\nSample Input 3\n\n5 8\n5 3\n2 3\n2 4\n5 2\n5 1\n1 4\n4 3\n1 3\n\nSample Output 3\n\n3\n\nThe red directed path in the following figure is one of the longest:", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 787, "cpu_time_ms": 751, "memory_kb": 1205760}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s121341375", "group_id": "codeNet:p03168", "input_text": "integer N\ndouble precision,allocatable,dimension(:)::p\ndouble precision,allocatable,dimension(:,:)::DP\ndouble precision ans\nread*,N\nallocate(p(N))\nread*,p\n\nallocate(DP(0:N,0:N))\nDP=0\nDP(0,0)=1\ndo i=1,N\n DP(i,0)=DP(i-1,0)*(1-p(i))\n do j=1,i\n DP(i,j)=DP(i-1,j-1)*p(i) + DP(i-1,j)*(1-p(i))\n end do\nend do\nans=0\ndo i=N/2+merge(1,0,mod(N,2)==1),N\n ans=ans+DP(N,i)\nend do\n\nprint\"(F12.11)\",ans\nend", "language": "Fortran", "metadata": {"date": 1556761052, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03168.html", "problem_id": "p03168", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03168/input.txt", "sample_output_relpath": "derived/input_output/data/p03168/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03168/Fortran/s121341375.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s121341375", "user_id": "u598073939"}, "prompt_components": {"gold_output": "0.612\n", "input_to_evaluate": "integer N\ndouble precision,allocatable,dimension(:)::p\ndouble precision,allocatable,dimension(:,:)::DP\ndouble precision ans\nread*,N\nallocate(p(N))\nread*,p\n\nallocate(DP(0:N,0:N))\nDP=0\nDP(0,0)=1\ndo i=1,N\n DP(i,0)=DP(i-1,0)*(1-p(i))\n do j=1,i\n DP(i,j)=DP(i-1,j-1)*p(i) + DP(i-1,j)*(1-p(i))\n end do\nend do\nans=0\ndo i=N/2+merge(1,0,mod(N,2)==1),N\n ans=ans+DP(N,i)\nend do\n\nprint\"(F12.11)\",ans\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nLet N be a positive odd number.\n\nThere are N coins, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), when Coin i is tossed, it comes up heads with probability p_i and tails with probability 1 - p_i.\n\nTaro has tossed all the N coins.\nFind the probability of having more heads than tails.\n\nConstraints\n\nN is an odd number.\n\n1 \\leq N \\leq 2999\n\np_i is a real number and has two decimal places.\n\n0 < p_i < 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint the probability of having more heads than tails.\nThe output is considered correct when the absolute error is not greater than 10^{-9}.\n\nSample Input 1\n\n3\n0.30 0.60 0.80\n\nSample Output 1\n\n0.612\n\nThe probability of each case where we have more heads than tails is as follows:\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Head, Head) is 0.3 × 0.6 × 0.8 = 0.144;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Tail, Head, Head) is 0.7 × 0.6 × 0.8 = 0.336;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Tail, Head) is 0.3 × 0.4 × 0.8 = 0.096;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Head, Tail) is 0.3 × 0.6 × 0.2 = 0.036.\n\nThus, the probability of having more heads than tails is 0.144 + 0.336 + 0.096 + 0.036 = 0.612.\n\nSample Input 2\n\n1\n0.50\n\nSample Output 2\n\n0.5\n\nOutputs such as 0.500, 0.500000001 and 0.499999999 are also considered correct.\n\nSample Input 3\n\n5\n0.42 0.01 0.42 0.99 0.42\n\nSample Output 3\n\n0.3821815872", "sample_input": "3\n0.30 0.60 0.80\n"}, "reference_outputs": ["0.612\n"], "source_document_id": "p03168", "source_text": "Score : 100 points\n\nProblem Statement\n\nLet N be a positive odd number.\n\nThere are N coins, numbered 1, 2, \\ldots, N.\nFor each i (1 \\leq i \\leq N), when Coin i is tossed, it comes up heads with probability p_i and tails with probability 1 - p_i.\n\nTaro has tossed all the N coins.\nFind the probability of having more heads than tails.\n\nConstraints\n\nN is an odd number.\n\n1 \\leq N \\leq 2999\n\np_i is a real number and has two decimal places.\n\n0 < p_i < 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\np_1 p_2 \\ldots p_N\n\nOutput\n\nPrint the probability of having more heads than tails.\nThe output is considered correct when the absolute error is not greater than 10^{-9}.\n\nSample Input 1\n\n3\n0.30 0.60 0.80\n\nSample Output 1\n\n0.612\n\nThe probability of each case where we have more heads than tails is as follows:\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Head, Head) is 0.3 × 0.6 × 0.8 = 0.144;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Tail, Head, Head) is 0.7 × 0.6 × 0.8 = 0.336;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Tail, Head) is 0.3 × 0.4 × 0.8 = 0.096;\n\nThe probability of having (Coin 1, Coin 2, Coin 3) = (Head, Head, Tail) is 0.3 × 0.6 × 0.2 = 0.036.\n\nThus, the probability of having more heads than tails is 0.144 + 0.336 + 0.096 + 0.036 = 0.612.\n\nSample Input 2\n\n1\n0.50\n\nSample Output 2\n\n0.5\n\nOutputs such as 0.500, 0.500000001 and 0.499999999 are also considered correct.\n\nSample Input 3\n\n5\n0.42 0.01 0.42 0.99 0.42\n\nSample Output 3\n\n0.3821815872", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 397, "cpu_time_ms": 80, "memory_kb": 70528}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s501863655", "group_id": "codeNet:p03170", "input_text": "program atcoder\n implicit none\n integer :: i,j,n,k\n integer,allocatable,dimension(:) :: dp\n integer,allocatable,dimension(:) :: a\n read*,n,k\n allocate(dp(0:k+1))\n ! dp(i) := はじめ石がi個の時、先攻の人が勝てるかどうか\n allocate(a(n))\n read(*,*)(a(i),i=1,n)\n dp = 0\n do i = 0,k\n do j = 1,n\n if(i-a(j)>=0 .and. dp(i-a(j))==0)then\n !石がi個のとき、a[j]個取って相手が勝てない状態にできるなら勝てる\n dp(i) = 1\n endif\n enddo\n enddo\n if(dp(k)==1)then\n write(*,'(a)')\"First\"\n else\n write(*,'(a)')\"Second\"\n endif\n stop \ncontains\n\nend program atcoder\n", "language": "Fortran", "metadata": {"date": 1546923909, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03170.html", "problem_id": "p03170", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03170/input.txt", "sample_output_relpath": "derived/input_output/data/p03170/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03170/Fortran/s501863655.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s501863655", "user_id": "u780122303"}, "prompt_components": {"gold_output": "First\n", "input_to_evaluate": "program atcoder\n implicit none\n integer :: i,j,n,k\n integer,allocatable,dimension(:) :: dp\n integer,allocatable,dimension(:) :: a\n read*,n,k\n allocate(dp(0:k+1))\n ! dp(i) := はじめ石がi個の時、先攻の人が勝てるかどうか\n allocate(a(n))\n read(*,*)(a(i),i=1,n)\n dp = 0\n do i = 0,k\n do j = 1,n\n if(i-a(j)>=0 .and. dp(i-a(j))==0)then\n !石がi個のとき、a[j]個取って相手が勝てない状態にできるなら勝てる\n dp(i) = 1\n endif\n enddo\n enddo\n if(dp(k)==1)then\n write(*,'(a)')\"First\"\n else\n write(*,'(a)')\"Second\"\n endif\n stop \ncontains\n\nend program atcoder\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a set A = \\{ a_1, a_2, \\ldots, a_N \\} consisting of N positive integers.\nTaro and Jiro will play the following game against each other.\n\nInitially, we have a pile consisting of K stones.\nThe two players perform the following operation alternately, starting from Taro:\n\nChoose an element x in A, and remove exactly x stones from the pile.\n\nA player loses when he becomes unable to play.\nAssuming that both players play optimally, determine the winner.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 10^5\n\n1 \\leq a_1 < a_2 < \\cdots < a_N \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nIf Taro will win, print First; if Jiro will win, print Second.\n\nSample Input 1\n\n2 4\n2 3\n\nSample Output 1\n\nFirst\n\nIf Taro removes three stones, Jiro cannot make a move.\nThus, Taro wins.\n\nSample Input 2\n\n2 5\n2 3\n\nSample Output 2\n\nSecond\n\nWhatever Taro does in his operation, Jiro wins, as follows:\n\nIf Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.\n\nIf Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.\n\nSample Input 3\n\n2 7\n2 3\n\nSample Output 3\n\nFirst\n\nTaro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:\n\nIf Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.\n\nIf Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.\n\nSample Input 4\n\n3 20\n1 2 3\n\nSample Output 4\n\nSecond\n\nSample Input 5\n\n3 21\n1 2 3\n\nSample Output 5\n\nFirst\n\nSample Input 6\n\n1 100000\n1\n\nSample Output 6\n\nSecond", "sample_input": "2 4\n2 3\n"}, "reference_outputs": ["First\n"], "source_document_id": "p03170", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a set A = \\{ a_1, a_2, \\ldots, a_N \\} consisting of N positive integers.\nTaro and Jiro will play the following game against each other.\n\nInitially, we have a pile consisting of K stones.\nThe two players perform the following operation alternately, starting from Taro:\n\nChoose an element x in A, and remove exactly x stones from the pile.\n\nA player loses when he becomes unable to play.\nAssuming that both players play optimally, determine the winner.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 10^5\n\n1 \\leq a_1 < a_2 < \\cdots < a_N \\leq K\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 a_2 \\ldots a_N\n\nOutput\n\nIf Taro will win, print First; if Jiro will win, print Second.\n\nSample Input 1\n\n2 4\n2 3\n\nSample Output 1\n\nFirst\n\nIf Taro removes three stones, Jiro cannot make a move.\nThus, Taro wins.\n\nSample Input 2\n\n2 5\n2 3\n\nSample Output 2\n\nSecond\n\nWhatever Taro does in his operation, Jiro wins, as follows:\n\nIf Taro removes two stones, Jiro can remove three stones to make Taro unable to make a move.\n\nIf Taro removes three stones, Jiro can remove two stones to make Taro unable to make a move.\n\nSample Input 3\n\n2 7\n2 3\n\nSample Output 3\n\nFirst\n\nTaro should remove two stones. Then, whatever Jiro does in his operation, Taro wins, as follows:\n\nIf Jiro removes two stones, Taro can remove three stones to make Jiro unable to make a move.\n\nIf Jiro removes three stones, Taro can remove two stones to make Jiro unable to make a move.\n\nSample Input 4\n\n3 20\n1 2 3\n\nSample Output 4\n\nSecond\n\nSample Input 5\n\n3 21\n1 2 3\n\nSample Output 5\n\nFirst\n\nSample Input 6\n\n1 100000\n1\n\nSample Output 6\n\nSecond", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 719, "cpu_time_ms": 18, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s911856413", "group_id": "codeNet:p03192", "input_text": "program main\n\timplicit none\n integer::a,ans,i\n read(*,*) a\n ans=0\n do i=1,4\n \tif(mod(a,10)==2)then\n \tans=ans+1\n \n end if\n a=a/10\n end do\n write(*,*) ans\n stop\nend program main\n\n\n", "language": "Fortran", "metadata": {"date": 1592633679, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03192.html", "problem_id": "p03192", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03192/input.txt", "sample_output_relpath": "derived/input_output/data/p03192/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03192/Fortran/s911856413.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s911856413", "user_id": "u884601206"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n\timplicit none\n integer::a,ans,i\n read(*,*) a\n ans=0\n do i=1,4\n \tif(mod(a,10)==2)then\n \tans=ans+1\n \n end if\n a=a/10\n end do\n write(*,*) ans\n stop\nend program main\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer N that has exactly four digits in base ten.\nHow many times does 2 occur in the base-ten representation of N?\n\nConstraints\n\n1000 \\leq N \\leq 9999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n3\n\n2 occurs three times in 1222. By the way, this contest is held on December 22 (JST).\n\nSample Input 2\n\n3456\n\nSample Output 2\n\n0\n\nSample Input 3\n\n9592\n\nSample Output 3\n\n1", "sample_input": "1222\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03192", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer N that has exactly four digits in base ten.\nHow many times does 2 occur in the base-ten representation of N?\n\nConstraints\n\n1000 \\leq N \\leq 9999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n3\n\n2 occurs three times in 1222. By the way, this contest is held on December 22 (JST).\n\nSample Input 2\n\n3456\n\nSample Output 2\n\n0\n\nSample Input 3\n\n9592\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 234, "cpu_time_ms": 5, "memory_kb": 2796}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s482530756", "group_id": "codeNet:p03192", "input_text": "program atcoder\n implicit none\n character(len=4) k\n integer :: ans=0,i\n read *,k\n do i = 1,4\n if(k(i:i)=='2')ans = ans+1\n end do\n write(*,'(I0)')ans\nend program atcoder\n", "language": "Fortran", "metadata": {"date": 1549148087, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03192.html", "problem_id": "p03192", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03192/input.txt", "sample_output_relpath": "derived/input_output/data/p03192/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03192/Fortran/s482530756.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s482530756", "user_id": "u780122303"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program atcoder\n implicit none\n character(len=4) k\n integer :: ans=0,i\n read *,k\n do i = 1,4\n if(k(i:i)=='2')ans = ans+1\n end do\n write(*,'(I0)')ans\nend program atcoder\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer N that has exactly four digits in base ten.\nHow many times does 2 occur in the base-ten representation of N?\n\nConstraints\n\n1000 \\leq N \\leq 9999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n3\n\n2 occurs three times in 1222. By the way, this contest is held on December 22 (JST).\n\nSample Input 2\n\n3456\n\nSample Output 2\n\n0\n\nSample Input 3\n\n9592\n\nSample Output 3\n\n1", "sample_input": "1222\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03192", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer N that has exactly four digits in base ten.\nHow many times does 2 occur in the base-ten representation of N?\n\nConstraints\n\n1000 \\leq N \\leq 9999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n3\n\n2 occurs three times in 1222. By the way, this contest is held on December 22 (JST).\n\nSample Input 2\n\n3456\n\nSample Output 2\n\n0\n\nSample Input 3\n\n9592\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 197, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s092243084", "group_id": "codeNet:p03193", "input_text": "program CADDiB2018B\n implicit none\n integer(8)::N,H,W,A,B,i,ans=0\n read*,N,H,W\n do i=1,N\n read*,A,B\n if(A>=H.and.B>=W)ans=ans+1\n end do\n print'(i0)',ans\nend program CADDiB2018B", "language": "Fortran", "metadata": {"date": 1597342577, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03193.html", "problem_id": "p03193", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03193/input.txt", "sample_output_relpath": "derived/input_output/data/p03193/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03193/Fortran/s092243084.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s092243084", "user_id": "u414699019"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program CADDiB2018B\n implicit none\n integer(8)::N,H,W,A,B,i,ans=0\n read*,N,H,W\n do i=1,N\n read*,A,B\n if(A>=H.and.B>=W)ans=ans+1\n end do\n print'(i0)',ans\nend program CADDiB2018B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N rectangular plate materials made of special metal called AtCoder Alloy.\nThe dimensions of the i-th material are A_i \\times B_i (A_i vertically and B_i horizontally).\n\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \\times W.\nHe is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary.\nWhen cutting a material, the cuts must be parallel to one of the sides of the material.\nAlso, the materials have fixed directions and cannot be rotated.\nFor example, a 5 \\times 3 material cannot be used as a 3 \\times 5 plate.\n\nOut of the N materials, how many can produce an H \\times W plate if properly cut?\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H W\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 5 2\n10 3\n5 2\n2 5\n\nSample Output 1\n\n2\n\nTakahashi wants a 5 \\times 2 plate.\n\nThe dimensions of the first material are 10 \\times 3. We can obtain a 5 \\times 2 plate by properly cutting it.\n\nThe dimensions of the second material are 5 \\times 2. We can obtain a 5 \\times 2 plate without cutting it.\n\nThe dimensions of the third material are 2 \\times 5. We cannot obtain a 5 \\times 2 plate, whatever cuts are made. Note that the material cannot be rotated and used as a 5 \\times 2 plate.\n\nSample Input 2\n\n10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268\n\nSample Output 2\n\n8", "sample_input": "3 5 2\n10 3\n5 2\n2 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03193", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N rectangular plate materials made of special metal called AtCoder Alloy.\nThe dimensions of the i-th material are A_i \\times B_i (A_i vertically and B_i horizontally).\n\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \\times W.\nHe is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary.\nWhen cutting a material, the cuts must be parallel to one of the sides of the material.\nAlso, the materials have fixed directions and cannot be rotated.\nFor example, a 5 \\times 3 material cannot be used as a 3 \\times 5 plate.\n\nOut of the N materials, how many can produce an H \\times W plate if properly cut?\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H W\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 5 2\n10 3\n5 2\n2 5\n\nSample Output 1\n\n2\n\nTakahashi wants a 5 \\times 2 plate.\n\nThe dimensions of the first material are 10 \\times 3. We can obtain a 5 \\times 2 plate by properly cutting it.\n\nThe dimensions of the second material are 5 \\times 2. We can obtain a 5 \\times 2 plate without cutting it.\n\nThe dimensions of the third material are 2 \\times 5. We cannot obtain a 5 \\times 2 plate, whatever cuts are made. Note that the material cannot be rotated and used as a 5 \\times 2 plate.\n\nSample Input 2\n\n10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268\n\nSample Output 2\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 208, "cpu_time_ms": 10, "memory_kb": 2812}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s329433597", "group_id": "codeNet:p03193", "input_text": "integer(8) N,H,W\ninteger(8) A,B\ninteger ans\nread*,N,H,W\nans=0\ndo i=1,N\n read*,A,B\n if(A>=H.and.B>=W)ans=ans+1\nend do\nprint\"(i0)\",ans\nend", "language": "Fortran", "metadata": {"date": 1557242181, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03193.html", "problem_id": "p03193", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03193/input.txt", "sample_output_relpath": "derived/input_output/data/p03193/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03193/Fortran/s329433597.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s329433597", "user_id": "u598073939"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "integer(8) N,H,W\ninteger(8) A,B\ninteger ans\nread*,N,H,W\nans=0\ndo i=1,N\n read*,A,B\n if(A>=H.and.B>=W)ans=ans+1\nend do\nprint\"(i0)\",ans\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N rectangular plate materials made of special metal called AtCoder Alloy.\nThe dimensions of the i-th material are A_i \\times B_i (A_i vertically and B_i horizontally).\n\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \\times W.\nHe is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary.\nWhen cutting a material, the cuts must be parallel to one of the sides of the material.\nAlso, the materials have fixed directions and cannot be rotated.\nFor example, a 5 \\times 3 material cannot be used as a 3 \\times 5 plate.\n\nOut of the N materials, how many can produce an H \\times W plate if properly cut?\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H W\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 5 2\n10 3\n5 2\n2 5\n\nSample Output 1\n\n2\n\nTakahashi wants a 5 \\times 2 plate.\n\nThe dimensions of the first material are 10 \\times 3. We can obtain a 5 \\times 2 plate by properly cutting it.\n\nThe dimensions of the second material are 5 \\times 2. We can obtain a 5 \\times 2 plate without cutting it.\n\nThe dimensions of the third material are 2 \\times 5. We cannot obtain a 5 \\times 2 plate, whatever cuts are made. Note that the material cannot be rotated and used as a 5 \\times 2 plate.\n\nSample Input 2\n\n10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268\n\nSample Output 2\n\n8", "sample_input": "3 5 2\n10 3\n5 2\n2 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03193", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N rectangular plate materials made of special metal called AtCoder Alloy.\nThe dimensions of the i-th material are A_i \\times B_i (A_i vertically and B_i horizontally).\n\nTakahashi wants a rectangular plate made of AtCoder Alloy whose dimensions are exactly H \\times W.\nHe is trying to obtain such a plate by choosing one of the N materials and cutting it if necessary.\nWhen cutting a material, the cuts must be parallel to one of the sides of the material.\nAlso, the materials have fixed directions and cannot be rotated.\nFor example, a 5 \\times 3 material cannot be used as a 3 \\times 5 plate.\n\nOut of the N materials, how many can produce an H \\times W plate if properly cut?\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n1 \\leq H \\leq 10^9\n\n1 \\leq W \\leq 10^9\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq B_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN H W\nA_1 B_1\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 5 2\n10 3\n5 2\n2 5\n\nSample Output 1\n\n2\n\nTakahashi wants a 5 \\times 2 plate.\n\nThe dimensions of the first material are 10 \\times 3. We can obtain a 5 \\times 2 plate by properly cutting it.\n\nThe dimensions of the second material are 5 \\times 2. We can obtain a 5 \\times 2 plate without cutting it.\n\nThe dimensions of the third material are 2 \\times 5. We cannot obtain a 5 \\times 2 plate, whatever cuts are made. Note that the material cannot be rotated and used as a 5 \\times 2 plate.\n\nSample Input 2\n\n10 587586158 185430194\n894597290 708587790\n680395892 306946994\n590262034 785368612\n922328576 106880540\n847058850 326169610\n936315062 193149191\n702035777 223363392\n11672949 146832978\n779291680 334178158\n615808191 701464268\n\nSample Output 2\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 138, "cpu_time_ms": 5, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s384619261", "group_id": "codeNet:p03194", "input_text": "program CADDiB2018C\n implicit none\n integer(8)::N,P,Ps,i,i_cnt,ans=1\n read*,N,P\n Ps=int(sqrt(real(P)))+1\n do i=2,Ps\n if(mod(P,i)==0)then\n i_cnt=0\n do\n if(mod(P,i)/=0)exit\n P=P/i\n i_cnt=i_cnt+1\n end do\n ans=ans*(i**(i_cnt/N))\n end if\n end do\n ans=ans*(P**(1/N))\n print'(i0)',ans\nend program CADDiB2018C", "language": "Fortran", "metadata": {"date": 1597342994, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03194.html", "problem_id": "p03194", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03194/input.txt", "sample_output_relpath": "derived/input_output/data/p03194/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03194/Fortran/s384619261.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s384619261", "user_id": "u414699019"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program CADDiB2018C\n implicit none\n integer(8)::N,P,Ps,i,i_cnt,ans=1\n read*,N,P\n Ps=int(sqrt(real(P)))+1\n do i=2,Ps\n if(mod(P,i)==0)then\n i_cnt=0\n do\n if(mod(P,i)/=0)exit\n P=P/i\n i_cnt=i_cnt+1\n end do\n ans=ans*(i**(i_cnt/N))\n end if\n end do\n ans=ans*(P**(1/N))\n print'(i0)',ans\nend program CADDiB2018C", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers a_1, a_2, ..., a_N not less than 1.\nThe values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \\times a_2 \\times ... \\times a_N = P.\n\nFind the maximum possible greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\n1 \\leq N \\leq 10^{12}\n\n1 \\leq P \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN P\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 24\n\nSample Output 1\n\n2\n\nThe greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.\n\nSample Input 2\n\n5 1\n\nSample Output 2\n\n1\n\nAs a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.\n\nSample Input 3\n\n1 111\n\nSample Output 3\n\n111\n\nSample Input 4\n\n4 972439611840\n\nSample Output 4\n\n206", "sample_input": "3 24\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03194", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers a_1, a_2, ..., a_N not less than 1.\nThe values of a_1, a_2, ..., a_N are not known, but it is known that a_1 \\times a_2 \\times ... \\times a_N = P.\n\nFind the maximum possible greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\n1 \\leq N \\leq 10^{12}\n\n1 \\leq P \\leq 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN P\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 24\n\nSample Output 1\n\n2\n\nThe greatest common divisor would be 2 when, for example, a_1=2, a_2=6 and a_3=2.\n\nSample Input 2\n\n5 1\n\nSample Output 2\n\n1\n\nAs a_i are positive integers, the only possible case is a_1 = a_2 = a_3 = a_4 = a_5 = 1.\n\nSample Input 3\n\n1 111\n\nSample Output 3\n\n111\n\nSample Input 4\n\n4 972439611840\n\nSample Output 4\n\n206", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 428, "cpu_time_ms": 19, "memory_kb": 2964}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s354621137", "group_id": "codeNet:p03198", "input_text": "program negative_doubling\n implicit none\n integer :: n, d(2,200000) = 0, dp(2,200000,0:15) = 0, m, i, j, x, y\n integer(8) :: a(200000) = 0_8, p, q\n read(*,*) n\n read(*,*) a(1:n)\n do j = 1, 2\n do i = 1, n-1\n p = a(i)\n q = a(i+1)\n if (p <= q) then\n do while (4_8*p <= q)\n d(j,i) = d(j,i)-1\n p = 4_8*p\n end do\n else\n do while (p > q)\n d(j,i) = d(j,i)+1\n q = 4_8*q\n end do\n end if\n end do\n a(1:n) = a(n:1:-1)\n end do\n do x = 0, 15\n dp(:,n,x) = 2*x\n end do\n do j = 1, 2\n do i = n-1, 1, -1\n do x = 0, 15\n y = max(x+d(j,i),0)\n if (y <= 15) then\n dp(j,i,x) = dp(j,i+1,y)+2*x\n else\n dp(j,i,x) = dp(j,i+1,15)+2*x+2*(y-15)*(n-i)\n end if\n end do\n end do\n end do\n dp(2,1:n,:) = dp(2,n:1:-1,:)\n m = min(dp(1,1,0),dp(2,n,0)+n)\n do i = 2, n\n m = min(m,dp(1,i,0)+dp(2,i-1,0)+i-1)\n end do\n write(*,'(i0)') m\n stop\nend program negative_doubling", "language": "Fortran", "metadata": {"date": 1565376209, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03198.html", "problem_id": "p03198", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03198/input.txt", "sample_output_relpath": "derived/input_output/data/p03198/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03198/Fortran/s354621137.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s354621137", "user_id": "u506403362"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program negative_doubling\n implicit none\n integer :: n, d(2,200000) = 0, dp(2,200000,0:15) = 0, m, i, j, x, y\n integer(8) :: a(200000) = 0_8, p, q\n read(*,*) n\n read(*,*) a(1:n)\n do j = 1, 2\n do i = 1, n-1\n p = a(i)\n q = a(i+1)\n if (p <= q) then\n do while (4_8*p <= q)\n d(j,i) = d(j,i)-1\n p = 4_8*p\n end do\n else\n do while (p > q)\n d(j,i) = d(j,i)+1\n q = 4_8*q\n end do\n end if\n end do\n a(1:n) = a(n:1:-1)\n end do\n do x = 0, 15\n dp(:,n,x) = 2*x\n end do\n do j = 1, 2\n do i = n-1, 1, -1\n do x = 0, 15\n y = max(x+d(j,i),0)\n if (y <= 15) then\n dp(j,i,x) = dp(j,i+1,y)+2*x\n else\n dp(j,i,x) = dp(j,i+1,15)+2*x+2*(y-15)*(n-i)\n end if\n end do\n end do\n end do\n dp(2,1:n,:) = dp(2,n:1:-1,:)\n m = min(dp(1,1,0),dp(2,n,0)+n)\n do i = 2, n\n m = min(m,dp(1,i,0)+dp(2,i-1,0)+i-1)\n end do\n write(*,'(i0)') m\n stop\nend program negative_doubling", "problem_context": "Score : 800 points\n\nProblem Statement\n\nThere are N positive integers A_1, A_2, ..., A_N.\nTakahashi can perform the following operation on these integers any number of times:\n\nChoose 1 \\leq i \\leq N and multiply the value of A_i by -2.\n\nNotice that he multiplies it by minus two.\n\nHe would like to make A_1 \\leq A_2 \\leq ... \\leq A_N holds.\nFind the minimum number of operations required. If it is impossible, print -1.\n\nConstraints\n\n1 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4\n3 1 4 1\n\nSample Output 1\n\n3\n\nOne possible solution is:\n\nChoose i=4 and multiply the value of A_4 by -2. A_1, A_2, A_3, A_4 are now 3, 1, 4, -2.\n\nChoose i=1 and multiply the value of A_1 by -2. A_1, A_2, A_3, A_4 are now -6, 1, 4, -2.\n\nChoose i=4 and multiply the value of A_4 by -2. A_1, A_2, A_3, A_4 are now -6, 1, 4, 4.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n0\n\nA_1 \\leq A_2 \\leq ... \\leq A_N holds before any operation is performed.\n\nSample Input 3\n\n8\n657312726 129662684 181537270 324043958 468214806 916875077 825989291 319670097\n\nSample Output 3\n\n7", "sample_input": "4\n3 1 4 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03198", "source_text": "Score : 800 points\n\nProblem Statement\n\nThere are N positive integers A_1, A_2, ..., A_N.\nTakahashi can perform the following operation on these integers any number of times:\n\nChoose 1 \\leq i \\leq N and multiply the value of A_i by -2.\n\nNotice that he multiplies it by minus two.\n\nHe would like to make A_1 \\leq A_2 \\leq ... \\leq A_N holds.\nFind the minimum number of operations required. If it is impossible, print -1.\n\nConstraints\n\n1 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n4\n3 1 4 1\n\nSample Output 1\n\n3\n\nOne possible solution is:\n\nChoose i=4 and multiply the value of A_4 by -2. A_1, A_2, A_3, A_4 are now 3, 1, 4, -2.\n\nChoose i=1 and multiply the value of A_1 by -2. A_1, A_2, A_3, A_4 are now -6, 1, 4, -2.\n\nChoose i=4 and multiply the value of A_4 by -2. A_1, A_2, A_3, A_4 are now -6, 1, 4, 4.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n0\n\nA_1 \\leq A_2 \\leq ... \\leq A_N holds before any operation is performed.\n\nSample Input 3\n\n8\n657312726 129662684 181537270 324043958 468214806 916875077 825989291 319670097\n\nSample Output 3\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1008, "cpu_time_ms": 103, "memory_kb": 42980}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s508058254", "group_id": "codeNet:p03200", "input_text": "program pro5\n implicit none\n character(len=2*10**5)::C\n integer::i, j, b, ans\n read(*,*) C\n b = 0\n ans = 0\n\n do i = 1, len_trim(C)\n if(C(i:i) .eq. 'W') then\n ans = ans + b\n else\n b = b+1\n end if\n end do\n\n write(*,*) ans\n stop\n\nend program pro5", "language": "Fortran", "metadata": {"date": 1590376932, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03200.html", "problem_id": "p03200", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03200/input.txt", "sample_output_relpath": "derived/input_output/data/p03200/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03200/Fortran/s508058254.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s508058254", "user_id": "u841856382"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program pro5\n implicit none\n character(len=2*10**5)::C\n integer::i, j, b, ans\n read(*,*) C\n b = 0\n ans = 0\n\n do i = 1, len_trim(C)\n if(C(i:i) .eq. 'W') then\n ans = ans + b\n else\n b = b+1\n end if\n end do\n\n write(*,*) ans\n stop\n\nend program pro5", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "sample_input": "BBW\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03200", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 316, "cpu_time_ms": 10, "memory_kb": 1468}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s515315990", "group_id": "codeNet:p03200", "input_text": "program irreversible_operation\n implicit none\n character(len=200000) :: s\n integer :: i, j, n\n integer(8) :: a, b\n read(*,*) s\n n = len_trim(s)\n a = 0\n b = 0\n j = 0\n do i = 1, n\n if (s(i:i) .eq. 'B') then\n a = a + n - j\n b = b + i\n j = j + 1\n end if\n end do\n write(*,'(i0)') a - b\n stop\nend program irreversible_operation", "language": "Fortran", "metadata": {"date": 1544937701, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03200.html", "problem_id": "p03200", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03200/input.txt", "sample_output_relpath": "derived/input_output/data/p03200/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03200/Fortran/s515315990.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s515315990", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program irreversible_operation\n implicit none\n character(len=200000) :: s\n integer :: i, j, n\n integer(8) :: a, b\n read(*,*) s\n n = len_trim(s)\n a = 0\n b = 0\n j = 0\n do i = 1, n\n if (s(i:i) .eq. 'B') then\n a = a + n - j\n b = b + i\n j = j + 1\n end if\n end do\n write(*,'(i0)') a - b\n stop\nend program irreversible_operation", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "sample_input": "BBW\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03200", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 388, "cpu_time_ms": 10, "memory_kb": 1468}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s495111621", "group_id": "codeNet:p03200", "input_text": "program main\nimplicit None\ncharacter*200000::s\ninteger(8)::k,t,i,n\ninteger(8),allocatable::a(:)\n\nread *,s\nk = len_trim(s)\nt = 0\n\ndo i = k,1,-1\n\tif(s(i:i) == \"B\")then\n\tt = t + 1\n\tendif\nenddo\n\nif(t == 0)then\n\tprint 101,t\n\tstop\nendif\n\nallocate(a(t))\n\nn = 1\ndo i = k,1,-1\n\tif(s(i:i) == \"B\")then\n\t\ta(n) = i\n\t\tn = n + 1\n\tendif\nenddo\n\nn = 0\ndo i = 1,t\n\tn = n + k - (a(i)) -(i -1)\nenddo\n\nprint 101,n\ndeallocate(a)\n\n101 format(i0)\nend program main", "language": "Fortran", "metadata": {"date": 1544927650, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03200.html", "problem_id": "p03200", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03200/input.txt", "sample_output_relpath": "derived/input_output/data/p03200/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03200/Fortran/s495111621.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s495111621", "user_id": "u900266249"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\nimplicit None\ncharacter*200000::s\ninteger(8)::k,t,i,n\ninteger(8),allocatable::a(:)\n\nread *,s\nk = len_trim(s)\nt = 0\n\ndo i = k,1,-1\n\tif(s(i:i) == \"B\")then\n\tt = t + 1\n\tendif\nenddo\n\nif(t == 0)then\n\tprint 101,t\n\tstop\nendif\n\nallocate(a(t))\n\nn = 1\ndo i = k,1,-1\n\tif(s(i:i) == \"B\")then\n\t\ta(n) = i\n\t\tn = n + 1\n\tendif\nenddo\n\nn = 0\ndo i = 1,t\n\tn = n + k - (a(i)) -(i -1)\nenddo\n\nprint 101,n\ndeallocate(a)\n\n101 format(i0)\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "sample_input": "BBW\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03200", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N Reversi pieces arranged in a row. (A Reversi piece is a disc with a black side and a white side.)\nThe state of each piece is represented by a string S of length N.\nIf S_i=B, the i-th piece from the left is showing black;\nIf S_i=W, the i-th piece from the left is showing white.\n\nConsider performing the following operation:\n\nChoose i (1 \\leq i < N) such that the i-th piece from the left is showing black and the (i+1)-th piece from the left is showing white, then flip both of those pieces. That is, the i-th piece from the left is now showing white and the (i+1)-th piece from the left is now showing black.\n\nFind the maximum possible number of times this operation can be performed.\n\nConstraints\n\n1 \\leq |S| \\leq 2\\times 10^5\n\nS_i=B or W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum possible number of times the operation can be performed.\n\nSample Input 1\n\nBBW\n\nSample Output 1\n\n2\n\nThe operation can be performed twice, as follows:\n\nFlip the second and third pieces from the left.\n\nFlip the first and second pieces from the left.\n\nSample Input 2\n\nBWBWBW\n\nSample Output 2\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 439, "cpu_time_ms": 9, "memory_kb": 2316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s384911121", "group_id": "codeNet:p03201", "input_text": "program main\nimplicit None\n\tinteger(8)::n,p,i,k,s\n\tinteger(8),allocatable::a(:)\n\treal(8)::x,y\n\t\n\ts = 0\n\tread *,n\n\tallocate(a(n))\n\t\n\tread *,a\n\t\n\tcall hsort(a,n)\n\t\n\ty = 2\n\tdo i = n,2,-1\n\t\tif(a(i) == 0) cycle\n\t\tp =2** (int(log(real(a(i)))/log(real(y))+1))-a(i)\n\t\t\n\t\tcall schint(a,i-1,p,k)\n\t\t\n\t\tif (k == 0) cycle\n\t\t\n\t\tif(a(k) == p)then\n\t\t\ta(k) = 0\n\t\t\ts = s + 1\n\t\tendif\n\tenddo\n\t\n\tprint 101,s\n\t\n101 format(i0)\nend program main\n\nsubroutine makeheap(a,n)\nImplicit None\n\tinteger(8)::n,i,c1,c2,p,t,m\n\tinteger(8)::a(n)\n\t\n\tdo i = n/2,1,-1\n\t\tp = i; c1 = i * 2\n\t\tdo while (c1 <= n)\n\t\t\tc2 = c1 + 1\n\t\t\tif(c2 <= n .and. a(c2) > a(c1)) c1 = c2\n\t\t\tif(a(p) < a(c1))then\n\t\t\t\tt = a(p)\n\t\t\t\ta(p) = a(c1)\n\t\t\t\ta(c1) = t\n\t\t\t\tp = c1\n\t\t\t\tc1 = p*2\n\t\t\t\telse\n\t\t\t\t\texit\n\t\t\tendif\n\t\tenddo\n\tenddo\nend subroutine makeheap\n\nsubroutine hsort(a,n)\nImplicit None\n\tinteger(8)::n,t,i,p,c1,c2,j\n\tinteger(8)::a(n)\n\t\n\tcall makeheap(a,n)\n\t\n\tdo i = n,2,-1\n\t\tt = a(i)\n\t\ta(i) = a(1)\n\t\ta(1) = t\n\t\t\n\t\tp = 1\n\t\tdo\n\t\t\tc1 = p*2\n\t\t\tif (c1 >= i) exit\n\t\t\t\n\t\t\tc2 = c1 +1\n\t\t\tif(c2 < i .and. a(c2) > a(c1))then\n\t\t\t\t\tc1 = c2\n\t\t\tendif\n\t\t\t\n\t\t\tif(a(c1) >a(p))then\n\t\t\t\tt = a(p)\n\t\t\t\ta(p) = a(c1)\n\t\t\t\ta(c1) = t\n\t\t\t\tp = c1\n\t\t\t\telse\n\t\t\t\t\texit\n\t\t\tendif\n\t\tenddo\n\tenddo\nend subroutine hsort\n\nsubroutine schint(a,e1,x,p)\nimplicit None\n\tinteger(8)::e1,s,e,x,p,t\n\tinteger(8)::a(e1)\n\t\n\ts = 1;e = e1\n\t\n\tif(a(e) < x)then\n\t\tp = 0\n\t\treturn\n\tendif\n\t\n\tdo\n\t\tt = (s + e)/2\n\t\tif(a(t) < x)then\n\t\t\tif(a(t+1) >= x)then\n\t\t\t\tp = t + 1\n\t\t\t\treturn\n\t\t\tendif\n\t\t\t\n\t\t\ts = t\n\t\t\telse if(t == 1 .or. a(t-1) < x)then\n\t\t\t\tp = t\n\t\t\t\treturn\n\t\t\telse\n\t\t\te = t\n\t\tendif\n\tenddo\n\t\nend subroutine schint", "language": "Fortran", "metadata": {"date": 1545193959, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03201.html", "problem_id": "p03201", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03201/input.txt", "sample_output_relpath": "derived/input_output/data/p03201/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03201/Fortran/s384911121.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s384911121", "user_id": "u900266249"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\nimplicit None\n\tinteger(8)::n,p,i,k,s\n\tinteger(8),allocatable::a(:)\n\treal(8)::x,y\n\t\n\ts = 0\n\tread *,n\n\tallocate(a(n))\n\t\n\tread *,a\n\t\n\tcall hsort(a,n)\n\t\n\ty = 2\n\tdo i = n,2,-1\n\t\tif(a(i) == 0) cycle\n\t\tp =2** (int(log(real(a(i)))/log(real(y))+1))-a(i)\n\t\t\n\t\tcall schint(a,i-1,p,k)\n\t\t\n\t\tif (k == 0) cycle\n\t\t\n\t\tif(a(k) == p)then\n\t\t\ta(k) = 0\n\t\t\ts = s + 1\n\t\tendif\n\tenddo\n\t\n\tprint 101,s\n\t\n101 format(i0)\nend program main\n\nsubroutine makeheap(a,n)\nImplicit None\n\tinteger(8)::n,i,c1,c2,p,t,m\n\tinteger(8)::a(n)\n\t\n\tdo i = n/2,1,-1\n\t\tp = i; c1 = i * 2\n\t\tdo while (c1 <= n)\n\t\t\tc2 = c1 + 1\n\t\t\tif(c2 <= n .and. a(c2) > a(c1)) c1 = c2\n\t\t\tif(a(p) < a(c1))then\n\t\t\t\tt = a(p)\n\t\t\t\ta(p) = a(c1)\n\t\t\t\ta(c1) = t\n\t\t\t\tp = c1\n\t\t\t\tc1 = p*2\n\t\t\t\telse\n\t\t\t\t\texit\n\t\t\tendif\n\t\tenddo\n\tenddo\nend subroutine makeheap\n\nsubroutine hsort(a,n)\nImplicit None\n\tinteger(8)::n,t,i,p,c1,c2,j\n\tinteger(8)::a(n)\n\t\n\tcall makeheap(a,n)\n\t\n\tdo i = n,2,-1\n\t\tt = a(i)\n\t\ta(i) = a(1)\n\t\ta(1) = t\n\t\t\n\t\tp = 1\n\t\tdo\n\t\t\tc1 = p*2\n\t\t\tif (c1 >= i) exit\n\t\t\t\n\t\t\tc2 = c1 +1\n\t\t\tif(c2 < i .and. a(c2) > a(c1))then\n\t\t\t\t\tc1 = c2\n\t\t\tendif\n\t\t\t\n\t\t\tif(a(c1) >a(p))then\n\t\t\t\tt = a(p)\n\t\t\t\ta(p) = a(c1)\n\t\t\t\ta(c1) = t\n\t\t\t\tp = c1\n\t\t\t\telse\n\t\t\t\t\texit\n\t\t\tendif\n\t\tenddo\n\tenddo\nend subroutine hsort\n\nsubroutine schint(a,e1,x,p)\nimplicit None\n\tinteger(8)::e1,s,e,x,p,t\n\tinteger(8)::a(e1)\n\t\n\ts = 1;e = e1\n\t\n\tif(a(e) < x)then\n\t\tp = 0\n\t\treturn\n\tendif\n\t\n\tdo\n\t\tt = (s + e)/2\n\t\tif(a(t) < x)then\n\t\t\tif(a(t+1) >= x)then\n\t\t\t\tp = t + 1\n\t\t\t\treturn\n\t\t\tendif\n\t\t\t\n\t\t\ts = t\n\t\t\telse if(t == 1 .or. a(t-1) < x)then\n\t\t\t\tp = t\n\t\t\t\treturn\n\t\t\telse\n\t\t\te = t\n\t\tendif\n\tenddo\n\t\nend subroutine schint", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03201", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1591, "cpu_time_ms": 104, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s560172106", "group_id": "codeNet:p03201", "input_text": "program main\nimplicit None\ninteger(8)::n,i,j,p,q,s,e,f,g\ninteger(8),allocatable::a(:)\nreal(8)::k,x,y\n\n\tread *,n\n\tallocate(a(n))\n\tread *,a\n\tcall h2(a,n)\n\t\n\ts = 0\n\tdo i = n,1,-1\n\t\tif (a(i) >10e9) cycle\n\t\tx = real(a(i));y = 2\n\t\tq = 2**(int(log(x)/log(y)+1))\n\t\t\n\t\tp = q-a(i)\n\t\t\n\t\te = 1\n\t\tf = i-1\n\t\t\n\t\tdo while (f-e >3)\n\t\tg = (e + f)/2\n\t\tif(a(g) > p)then\n\t\t\tf = g-1\n\t\t\telse\n\t\t\t\te = g\n\t\tendif\n\t\tenddo\n\t\t\n\t\t\n\t\tdo j = f,e,-1\n\t\t\tif(a(j) == p)then\n\t\t\t\ts = s + 1\n\t\t\t\ta(j) = 1000000001\n\t\t\t\texit\n\t\t\tendif\n\t\tenddo\n\tenddo\n\t\n\tprint * ,s\n101 format(i0)\nend program main\n\nsubroutine h2(a,n)\nimplicit None\n\tinteger(8)::a(n),x\n\tinteger(8)::n,i,ie,i0,i1,i2\n\t\n\tdo i = n/2,1,-1\n\t\tx = a(i);ie = n + 1; i0 = i; i1 = i0 * 2\n\t\tdo while(i1 < ie)\n\t\t\ti2 = i1 + 1\n\t\t\tif(i2 < ie .and. a(i1) < a(i2)) i1 = i2\n\t\t\tif(a(i1) > x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\n\tdo ie = n,2,-1\n\t\tx = a(ie)\n\t\ta(ie) = a(1)\n\t\ta(1) = x\n\t\ti0 =1;i1 =2\n\t\tdo while(i1 x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\nend subroutine h2", "language": "Fortran", "metadata": {"date": 1544932613, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03201.html", "problem_id": "p03201", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03201/input.txt", "sample_output_relpath": "derived/input_output/data/p03201/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03201/Fortran/s560172106.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s560172106", "user_id": "u900266249"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\nimplicit None\ninteger(8)::n,i,j,p,q,s,e,f,g\ninteger(8),allocatable::a(:)\nreal(8)::k,x,y\n\n\tread *,n\n\tallocate(a(n))\n\tread *,a\n\tcall h2(a,n)\n\t\n\ts = 0\n\tdo i = n,1,-1\n\t\tif (a(i) >10e9) cycle\n\t\tx = real(a(i));y = 2\n\t\tq = 2**(int(log(x)/log(y)+1))\n\t\t\n\t\tp = q-a(i)\n\t\t\n\t\te = 1\n\t\tf = i-1\n\t\t\n\t\tdo while (f-e >3)\n\t\tg = (e + f)/2\n\t\tif(a(g) > p)then\n\t\t\tf = g-1\n\t\t\telse\n\t\t\t\te = g\n\t\tendif\n\t\tenddo\n\t\t\n\t\t\n\t\tdo j = f,e,-1\n\t\t\tif(a(j) == p)then\n\t\t\t\ts = s + 1\n\t\t\t\ta(j) = 1000000001\n\t\t\t\texit\n\t\t\tendif\n\t\tenddo\n\tenddo\n\t\n\tprint * ,s\n101 format(i0)\nend program main\n\nsubroutine h2(a,n)\nimplicit None\n\tinteger(8)::a(n),x\n\tinteger(8)::n,i,ie,i0,i1,i2\n\t\n\tdo i = n/2,1,-1\n\t\tx = a(i);ie = n + 1; i0 = i; i1 = i0 * 2\n\t\tdo while(i1 < ie)\n\t\t\ti2 = i1 + 1\n\t\t\tif(i2 < ie .and. a(i1) < a(i2)) i1 = i2\n\t\t\tif(a(i1) > x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\n\tdo ie = n,2,-1\n\t\tx = a(ie)\n\t\ta(ie) = a(1)\n\t\ta(1) = x\n\t\ti0 =1;i1 =2\n\t\tdo while(i1 x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\nend subroutine h2", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03201", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1163, "cpu_time_ms": 111, "memory_kb": 2944}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s197868086", "group_id": "codeNet:p03201", "input_text": "program main\nimplicit None\ninteger(8)::n,i,j,p,q,s\ninteger(8),allocatable::a(:)\nreal(8)::k,x,y\n\n\tread *,n\n\tallocate(a(n))\n\tread *,a\n\tcall h2(a,n)\n\t\n\ts = 0\n\tdo i = n,1,-1\n\t\tif (a(i) >10e9) cycle\n\t\tx = a(i);y = 2\n\t\tk = log(x)/log(y)\n\t\tp = int(k)+1\n\t\tq = 2**p\n\t\t\n\t\tp = q-a(i)\n\t\t\n\t\tdo j = i-1,1,-1\n\t\t\tif(a(j) == p)then\n\t\t\t\ts = s + 1\n\t\t\t\ta(j) = 1000000001\n\t\t\t\texit\n\t\t\tendif\n\t\tenddo\n\tenddo\n\t\n\tprint * ,s\n101 format(i0)\nend program main\n\nsubroutine h2(a,n)\nimplicit None\n\tinteger(8)::a(n),x\n\tinteger(8)::n,i,ie,i0,i1,i2\n\t\n\tdo i = n/2,1,-1\n\t\tx = a(i);ie = n + 1; i0 = i; i1 = i0 * 2\n\t\tdo while(i1 < ie)\n\t\t\ti2 = i1 + 1\n\t\t\tif(i2 < ie .and. a(i1) < a(i2)) i1 = i2\n\t\t\tif(a(i1) > x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\n\tdo ie = n,2,-1\n\t\tx = a(ie)\n\t\ta(ie) = a(1)\n\t\ta(1) = x\n\t\ti0 =1;i1 =2\n\t\tdo while(i1 x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\nend subroutine h2", "language": "Fortran", "metadata": {"date": 1544930712, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03201.html", "problem_id": "p03201", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03201/input.txt", "sample_output_relpath": "derived/input_output/data/p03201/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03201/Fortran/s197868086.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s197868086", "user_id": "u900266249"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\nimplicit None\ninteger(8)::n,i,j,p,q,s\ninteger(8),allocatable::a(:)\nreal(8)::k,x,y\n\n\tread *,n\n\tallocate(a(n))\n\tread *,a\n\tcall h2(a,n)\n\t\n\ts = 0\n\tdo i = n,1,-1\n\t\tif (a(i) >10e9) cycle\n\t\tx = a(i);y = 2\n\t\tk = log(x)/log(y)\n\t\tp = int(k)+1\n\t\tq = 2**p\n\t\t\n\t\tp = q-a(i)\n\t\t\n\t\tdo j = i-1,1,-1\n\t\t\tif(a(j) == p)then\n\t\t\t\ts = s + 1\n\t\t\t\ta(j) = 1000000001\n\t\t\t\texit\n\t\t\tendif\n\t\tenddo\n\tenddo\n\t\n\tprint * ,s\n101 format(i0)\nend program main\n\nsubroutine h2(a,n)\nimplicit None\n\tinteger(8)::a(n),x\n\tinteger(8)::n,i,ie,i0,i1,i2\n\t\n\tdo i = n/2,1,-1\n\t\tx = a(i);ie = n + 1; i0 = i; i1 = i0 * 2\n\t\tdo while(i1 < ie)\n\t\t\ti2 = i1 + 1\n\t\t\tif(i2 < ie .and. a(i1) < a(i2)) i1 = i2\n\t\t\tif(a(i1) > x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\n\tdo ie = n,2,-1\n\t\tx = a(ie)\n\t\ta(ie) = a(1)\n\t\ta(1) = x\n\t\ti0 =1;i1 =2\n\t\tdo while(i1 x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\nend subroutine h2", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03201", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1040, "cpu_time_ms": 2103, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s266235135", "group_id": "codeNet:p03201", "input_text": "program main\n implicit none\n integer(8) n,beki(31)\n integer(8),allocatable,dimension(:)::a\n integer(8) ::i,j,k,counter=0\n read(*,*)n\n allocate(a(n))\n read(*,*)a\n call heapsort(n,a)\n do i=1,31\n beki(i)=2**i\n enddo\n !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n do i=n,2,-1\n do j=i-1,1,-1\n do k=1,31\n if(beki(k)==a(i)+a(j) .and. a(i)/=0 .and. a(j)/=0)then\n counter=counter+1\n a(j)=0\n endif\n enddo\n enddo\n enddo\n write(*,*)counter\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer(8),intent(in) :: n\n integer(8),intent(inout) :: array(1:n)\n \n integer(8) ::i,k,j,l\n integer(8) :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n\n return\nend subroutine heapsort\nend program main\n", "language": "Fortran", "metadata": {"date": 1544929235, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03201.html", "problem_id": "p03201", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03201/input.txt", "sample_output_relpath": "derived/input_output/data/p03201/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03201/Fortran/s266235135.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s266235135", "user_id": "u539011156"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n integer(8) n,beki(31)\n integer(8),allocatable,dimension(:)::a\n integer(8) ::i,j,k,counter=0\n read(*,*)n\n allocate(a(n))\n read(*,*)a\n call heapsort(n,a)\n do i=1,31\n beki(i)=2**i\n enddo\n !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n do i=n,2,-1\n do j=i-1,1,-1\n do k=1,31\n if(beki(k)==a(i)+a(j) .and. a(i)/=0 .and. a(j)/=0)then\n counter=counter+1\n a(j)=0\n endif\n enddo\n enddo\n enddo\n write(*,*)counter\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer(8),intent(in) :: n\n integer(8),intent(inout) :: array(1:n)\n \n integer(8) ::i,k,j,l\n integer(8) :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n\n return\nend subroutine heapsort\nend program main\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03201", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi has N balls with positive integers written on them. The integer written on the i-th ball is A_i.\nHe would like to form some number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\nNote that a ball cannot belong to multiple pairs.\nFind the maximum possible number of pairs that can be formed.\n\nHere, a positive integer is said to be a power of 2 when it can be written as 2^t using some non-negative integer t.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of pairs such that the sum of the integers written on each pair of balls is a power of 2.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nWe can form one pair whose sum of the written numbers is 4 by pairing the first and third balls.\nNote that we cannot pair the second ball with itself.\n\nSample Input 2\n\n5\n3 11 14 5 13\n\nSample Output 2\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1383, "cpu_time_ms": 2103, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s288806638", "group_id": "codeNet:p03202", "input_text": "module mod_tree_map\n implicit none\n type t_entry\n private\n integer :: key\n integer :: val\n end type\n type t_node\n private\n type(t_node), pointer :: left => null(), right => null()\n integer :: level = 1\n type(t_entry), pointer :: e => null()\n end type\n type t_tree_map\n private\n type(t_node), pointer :: root => null()\n integer :: deflt = 0\n contains\n procedure :: size => size_of\n procedure :: clear => clear\n procedure :: set_default => set_default\n procedure :: put => put\n procedure :: remove => remove\n procedure :: get => get\n procedure :: contain => contain\n procedure :: first_key => get_first_key\n procedure :: last_key => get_last_key\n procedure :: floor_key => floor_key\n procedure :: lower_key => lower_key\n procedure :: ceiling_key => ceiling_key\n procedure :: higher_key => higher_key\n procedure :: get_keys => get_keys\n end type\ncontains\n function new_entry(key,val) result(e)\n integer, intent(in) :: key\n integer, intent(in) :: val\n type(t_entry), pointer :: e\n e => null()\n allocate(e)\n e%key = key\n e%val = val\n end\n function new_node(e) result(n)\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n n => null()\n allocate(n)\n n%e => e\n end\n integer function level(n)\n type(t_node), pointer, intent(in) :: n\n level = 0\n if (.not.associated(n)) return\n level = n%level\n end\n logical function is_leaf(n)\n type(t_node), pointer, intent(in) :: n\n is_leaf = associated(n) .and. .not.associated(n%left) .and. &\n & .not.associated(n%right)\n end\n recursive function tree_size(n) result(s)\n type(t_node), pointer, intent(in) :: n\n integer :: s\n s = 0\n if (.not.associated(n)) return\n s = 1+tree_size(n%left)+tree_size(n%right)\n end\n function skew(n) result(l)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: l\n l => n\n if (.not.(associated(n) .and. associated(n%left) .and. &\n & n%left%level == n%level)) return\n l => n%left\n n%left => l%right\n l%right => n\n end\n function split(n) result(r)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: r\n r => n\n if (.not.(associated(n) .and. associated(n%right) .and. &\n & associated(n%right%right) .and. n%right%right%level == n%level)) return\n r => n%right\n n%right => r%left\n r%left => n\n r%level = r%level+1\n end\n function predecessor(n) result(p)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: p\n p => null()\n if (.not.associated(n%left)) return\n p => n%left\n do while (associated(p%right))\n p => p%right\n end do\n end\n function successor(n) result(s)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: s\n s => null()\n if (.not.associated(n%right)) return\n s => n%right\n do while (associated(s%left))\n s => s%left\n end do\n end\n recursive function insert(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: t\n t => new_node(e)\n if (.not.associated(n)) return\n t => n\n if (e%key < t%e%key) then\n t%left => insert(t%left,e)\n else if (e%key > t%e%key) then\n t%right => insert(t%right,e)\n else\n t%e => e\n end if\n t => skew(t)\n t => split(t)\n end\n recursive function delete(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: t, l\n t => n\n if (.not.associated(n)) return\n if (e%key < t%e%key) then\n t%left => delete(t%left,e)\n else if (e%key > t%e%key) then\n t%right => delete(t%right,e)\n else\n if (is_leaf(t)) then\n t => null()\n return\n end if\n if (.not.associated(t%left)) then\n l => successor(t)\n t%right => delete(t%right,l%e)\n t%e => l%e\n else\n l => predecessor(t)\n t%left => delete(t%left,l%e)\n t%e => l%e\n end if\n end if\n t => decrease_level(t)\n t => skew(t)\n t%right => skew(t%right)\n if (associated(t%right)) t%right%right => skew(t%right%right)\n t => split(t)\n t%right => split(t%right)\n end\n function decrease_level(n) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: t\n integer :: should_be\n t => n\n should_be = min(level(t%left),level(t%right))+1\n if (t%level > should_be) then\n t%level = should_be\n if (level(t%right) > should_be) t%right%level = should_be\n end if\n end\n recursive subroutine release_tree(t)\n type(t_node), pointer, intent(inout) :: t\n if (.not.associated(t)) return\n call release_tree(t%left)\n call release_tree(t%right)\n deallocate(t)\n end\n recursive subroutine get_keys_list(t,keys,num)\n type(t_node), pointer, intent(in) :: t\n integer, intent(inout) :: keys(:)\n integer, intent(inout) :: num\n if (.not.associated(t)) return\n call get_keys_list(t%left,keys,num)\n num = num+1\n keys(num) = t%e%key\n call get_keys_list(t%right,keys,num)\n end\n integer function size_of(this)\n class(t_tree_map), intent(in) :: this\n size_of = tree_size(this%root)\n end\n subroutine clear(this)\n class(t_tree_map), intent(inout) :: this\n call release_tree(this%root)\n this%root => null()\n end\n subroutine set_default(this,deflt)\n class(t_tree_map), intent(inout) :: this\n integer, intent(in) :: deflt\n this%deflt = deflt\n end\n subroutine put_entry(this,e)\n type(t_tree_map), intent(inout) :: this\n type(t_entry), pointer, intent(in) :: e\n this%root => insert(this%root,e)\n end\n subroutine remove_entry(this,e)\n type(t_tree_map), intent(inout) :: this\n type(t_entry), pointer, intent(in) :: e\n this%root => delete(this%root,e)\n end\n function get_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n function contain_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n logical :: ret\n ret = .false.\n n => this%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret = .true.\n return\n end if\n end do\n end\n function get_first_entry(this) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%left))\n n => n%left\n end do\n ret => n%e\n end\n function poll_first_entry(this) result(ret)\n type(t_tree_map), intent(inout) :: this\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%left))\n n => n%left\n end do\n ret => n%e\n this%root => delete(this%root,ret)\n end\n function get_last_entry(this) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%right))\n n => n%right\n end do\n ret => n%e\n end\n function poll_last_entry(this) result(ret)\n type(t_tree_map), intent(inout) :: this\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%right))\n n => n%right\n end do\n ret => n%e\n this%root => delete(this%root,ret)\n end\n function floor_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n if (.not.associated(ret)) then\n ret => n%e\n cycle\n end if\n if (e%key-ret%key > e%key-n%e%key) ret => n%e\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n function lower_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_entry), pointer :: ret\n ret => floor_entry(this,new_entry(e%key-1,0))\n end\n function ceiling_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n do while (associated(n))\n if (e%key < n%e%key) then\n if (.not.associated(ret)) then\n ret => n%e\n cycle\n end if\n if (e%key-ret%key < e%key-n%e%key) ret => n%e\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n function higher_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_entry), pointer :: ret\n ret => ceiling_entry(this,new_entry(e%key+1,0))\n end\n subroutine get_keys(this,keys,num)\n class(t_tree_map), intent(in) :: this\n integer, intent(inout) :: keys(:)\n integer, intent(inout) :: num\n keys = 0\n num = 0\n call get_keys_list(this%root,keys,num)\n end\n subroutine put(this,key,val)\n class(t_tree_map), intent(inout) :: this\n integer, intent(in) :: key\n integer, intent(in) :: val\n call put_entry(this,new_entry(key,val))\n end\n subroutine remove(this,key)\n class(t_tree_map), intent(inout) :: this\n integer, intent(in) :: key\n call remove_entry(this,new_entry(key,0))\n end\n function get(this,key) result(val)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: val\n val = this%deflt\n tmp => get_entry(this,new_entry(key,0))\n if (.not.associated(tmp)) return\n val = tmp%val\n end\n logical function contain(this,key)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n contain = contain_entry(this,new_entry(key,0))\n end\n function get_first_key(this) result(key)\n class(t_tree_map), intent(in) :: this\n type(t_entry), pointer :: tmp\n integer :: key\n key = this%deflt\n tmp => get_first_entry(this)\n if (.not.associated(tmp)) return\n key = tmp%key\n end\n function get_last_key(this) result(key)\n class(t_tree_map), intent(in) :: this\n type(t_entry), pointer :: tmp\n integer :: key\n key = this%deflt\n tmp => get_last_entry(this)\n if (.not.associated(tmp)) return\n key = tmp%key\n end\n function floor_key(this,key) result(ret)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = this%deflt\n tmp => floor_entry(this,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n function lower_key(this,key) result(ret)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = this%deflt\n tmp => lower_entry(this,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n function ceiling_key(this,key) result(ret)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = this%deflt\n tmp => ceiling_entry(this,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n function higher_key(this,key) result(ret)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = this%deflt\n tmp => higher_entry(this,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\nend module mod_tree_map\nprogram lexicographic_constraints\n implicit none\n integer :: n, a(200000) = 0, l = 0, r, m\n read(*,*) n\n read(*,*) a(1:n)\n r = n\n do while (r-l > 1)\n m = (l+r)/2\n if (check(m)) then\n r = m\n else\n l = m\n end if\n end do\n write(*,'(i0)') r\ncontains\n logical function check(m)\n use mod_tree_map\n type(t_tree_map) :: map\n type(t_entry), pointer :: tmp\n integer, intent(in) :: m\n integer :: i, j\n call map%clear()\n check = .false.\n do i = 2, n\n if (a(i) > a(i-1)) cycle\n do while (map%size() > 0 .and. map%last_key() > a(i))\n tmp => poll_last_entry(map)\n end do\n call map%put(a(i),map%get(a(i))+1)\n do j = a(i), 2, -1\n if (map%get(j) < m) exit\n call map%remove(j)\n call map%put(j-1,map%get(j-1)+1)\n end do\n if (map%get(1) >= m) return\n end do\n check = .true.\n end\nend program lexicographic_constraints", "language": "Fortran", "metadata": {"date": 1569528012, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03202.html", "problem_id": "p03202", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03202/input.txt", "sample_output_relpath": "derived/input_output/data/p03202/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03202/Fortran/s288806638.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s288806638", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "module mod_tree_map\n implicit none\n type t_entry\n private\n integer :: key\n integer :: val\n end type\n type t_node\n private\n type(t_node), pointer :: left => null(), right => null()\n integer :: level = 1\n type(t_entry), pointer :: e => null()\n end type\n type t_tree_map\n private\n type(t_node), pointer :: root => null()\n integer :: deflt = 0\n contains\n procedure :: size => size_of\n procedure :: clear => clear\n procedure :: set_default => set_default\n procedure :: put => put\n procedure :: remove => remove\n procedure :: get => get\n procedure :: contain => contain\n procedure :: first_key => get_first_key\n procedure :: last_key => get_last_key\n procedure :: floor_key => floor_key\n procedure :: lower_key => lower_key\n procedure :: ceiling_key => ceiling_key\n procedure :: higher_key => higher_key\n procedure :: get_keys => get_keys\n end type\ncontains\n function new_entry(key,val) result(e)\n integer, intent(in) :: key\n integer, intent(in) :: val\n type(t_entry), pointer :: e\n e => null()\n allocate(e)\n e%key = key\n e%val = val\n end\n function new_node(e) result(n)\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n n => null()\n allocate(n)\n n%e => e\n end\n integer function level(n)\n type(t_node), pointer, intent(in) :: n\n level = 0\n if (.not.associated(n)) return\n level = n%level\n end\n logical function is_leaf(n)\n type(t_node), pointer, intent(in) :: n\n is_leaf = associated(n) .and. .not.associated(n%left) .and. &\n & .not.associated(n%right)\n end\n recursive function tree_size(n) result(s)\n type(t_node), pointer, intent(in) :: n\n integer :: s\n s = 0\n if (.not.associated(n)) return\n s = 1+tree_size(n%left)+tree_size(n%right)\n end\n function skew(n) result(l)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: l\n l => n\n if (.not.(associated(n) .and. associated(n%left) .and. &\n & n%left%level == n%level)) return\n l => n%left\n n%left => l%right\n l%right => n\n end\n function split(n) result(r)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: r\n r => n\n if (.not.(associated(n) .and. associated(n%right) .and. &\n & associated(n%right%right) .and. n%right%right%level == n%level)) return\n r => n%right\n n%right => r%left\n r%left => n\n r%level = r%level+1\n end\n function predecessor(n) result(p)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: p\n p => null()\n if (.not.associated(n%left)) return\n p => n%left\n do while (associated(p%right))\n p => p%right\n end do\n end\n function successor(n) result(s)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: s\n s => null()\n if (.not.associated(n%right)) return\n s => n%right\n do while (associated(s%left))\n s => s%left\n end do\n end\n recursive function insert(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: t\n t => new_node(e)\n if (.not.associated(n)) return\n t => n\n if (e%key < t%e%key) then\n t%left => insert(t%left,e)\n else if (e%key > t%e%key) then\n t%right => insert(t%right,e)\n else\n t%e => e\n end if\n t => skew(t)\n t => split(t)\n end\n recursive function delete(n,e) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: t, l\n t => n\n if (.not.associated(n)) return\n if (e%key < t%e%key) then\n t%left => delete(t%left,e)\n else if (e%key > t%e%key) then\n t%right => delete(t%right,e)\n else\n if (is_leaf(t)) then\n t => null()\n return\n end if\n if (.not.associated(t%left)) then\n l => successor(t)\n t%right => delete(t%right,l%e)\n t%e => l%e\n else\n l => predecessor(t)\n t%left => delete(t%left,l%e)\n t%e => l%e\n end if\n end if\n t => decrease_level(t)\n t => skew(t)\n t%right => skew(t%right)\n if (associated(t%right)) t%right%right => skew(t%right%right)\n t => split(t)\n t%right => split(t%right)\n end\n function decrease_level(n) result(t)\n type(t_node), pointer, intent(in) :: n\n type(t_node), pointer :: t\n integer :: should_be\n t => n\n should_be = min(level(t%left),level(t%right))+1\n if (t%level > should_be) then\n t%level = should_be\n if (level(t%right) > should_be) t%right%level = should_be\n end if\n end\n recursive subroutine release_tree(t)\n type(t_node), pointer, intent(inout) :: t\n if (.not.associated(t)) return\n call release_tree(t%left)\n call release_tree(t%right)\n deallocate(t)\n end\n recursive subroutine get_keys_list(t,keys,num)\n type(t_node), pointer, intent(in) :: t\n integer, intent(inout) :: keys(:)\n integer, intent(inout) :: num\n if (.not.associated(t)) return\n call get_keys_list(t%left,keys,num)\n num = num+1\n keys(num) = t%e%key\n call get_keys_list(t%right,keys,num)\n end\n integer function size_of(this)\n class(t_tree_map), intent(in) :: this\n size_of = tree_size(this%root)\n end\n subroutine clear(this)\n class(t_tree_map), intent(inout) :: this\n call release_tree(this%root)\n this%root => null()\n end\n subroutine set_default(this,deflt)\n class(t_tree_map), intent(inout) :: this\n integer, intent(in) :: deflt\n this%deflt = deflt\n end\n subroutine put_entry(this,e)\n type(t_tree_map), intent(inout) :: this\n type(t_entry), pointer, intent(in) :: e\n this%root => insert(this%root,e)\n end\n subroutine remove_entry(this,e)\n type(t_tree_map), intent(inout) :: this\n type(t_entry), pointer, intent(in) :: e\n this%root => delete(this%root,e)\n end\n function get_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n function contain_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n logical :: ret\n ret = .false.\n n => this%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret = .true.\n return\n end if\n end do\n end\n function get_first_entry(this) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%left))\n n => n%left\n end do\n ret => n%e\n end\n function poll_first_entry(this) result(ret)\n type(t_tree_map), intent(inout) :: this\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%left))\n n => n%left\n end do\n ret => n%e\n this%root => delete(this%root,ret)\n end\n function get_last_entry(this) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%right))\n n => n%right\n end do\n ret => n%e\n end\n function poll_last_entry(this) result(ret)\n type(t_tree_map), intent(inout) :: this\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n if (.not.associated(n)) return\n do while (associated(n%right))\n n => n%right\n end do\n ret => n%e\n this%root => delete(this%root,ret)\n end\n function floor_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n do while (associated(n))\n if (e%key < n%e%key) then\n n => n%left\n else if (e%key > n%e%key) then\n if (.not.associated(ret)) then\n ret => n%e\n cycle\n end if\n if (e%key-ret%key > e%key-n%e%key) ret => n%e\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n function lower_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_entry), pointer :: ret\n ret => floor_entry(this,new_entry(e%key-1,0))\n end\n function ceiling_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_node), pointer :: n\n type(t_entry), pointer :: ret\n ret => null()\n n => this%root\n do while (associated(n))\n if (e%key < n%e%key) then\n if (.not.associated(ret)) then\n ret => n%e\n cycle\n end if\n if (e%key-ret%key < e%key-n%e%key) ret => n%e\n n => n%left\n else if (e%key > n%e%key) then\n n => n%right\n else\n ret => n%e\n return\n end if\n end do\n end\n function higher_entry(this,e) result(ret)\n type(t_tree_map), intent(in) :: this\n type(t_entry), pointer, intent(in) :: e\n type(t_entry), pointer :: ret\n ret => ceiling_entry(this,new_entry(e%key+1,0))\n end\n subroutine get_keys(this,keys,num)\n class(t_tree_map), intent(in) :: this\n integer, intent(inout) :: keys(:)\n integer, intent(inout) :: num\n keys = 0\n num = 0\n call get_keys_list(this%root,keys,num)\n end\n subroutine put(this,key,val)\n class(t_tree_map), intent(inout) :: this\n integer, intent(in) :: key\n integer, intent(in) :: val\n call put_entry(this,new_entry(key,val))\n end\n subroutine remove(this,key)\n class(t_tree_map), intent(inout) :: this\n integer, intent(in) :: key\n call remove_entry(this,new_entry(key,0))\n end\n function get(this,key) result(val)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: val\n val = this%deflt\n tmp => get_entry(this,new_entry(key,0))\n if (.not.associated(tmp)) return\n val = tmp%val\n end\n logical function contain(this,key)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n contain = contain_entry(this,new_entry(key,0))\n end\n function get_first_key(this) result(key)\n class(t_tree_map), intent(in) :: this\n type(t_entry), pointer :: tmp\n integer :: key\n key = this%deflt\n tmp => get_first_entry(this)\n if (.not.associated(tmp)) return\n key = tmp%key\n end\n function get_last_key(this) result(key)\n class(t_tree_map), intent(in) :: this\n type(t_entry), pointer :: tmp\n integer :: key\n key = this%deflt\n tmp => get_last_entry(this)\n if (.not.associated(tmp)) return\n key = tmp%key\n end\n function floor_key(this,key) result(ret)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = this%deflt\n tmp => floor_entry(this,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n function lower_key(this,key) result(ret)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = this%deflt\n tmp => lower_entry(this,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n function ceiling_key(this,key) result(ret)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = this%deflt\n tmp => ceiling_entry(this,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\n function higher_key(this,key) result(ret)\n class(t_tree_map), intent(in) :: this\n integer, intent(in) :: key\n type(t_entry), pointer :: tmp\n integer :: ret\n ret = this%deflt\n tmp => higher_entry(this,new_entry(key,0))\n if (.not.associated(tmp)) return\n ret = tmp%key\n end\nend module mod_tree_map\nprogram lexicographic_constraints\n implicit none\n integer :: n, a(200000) = 0, l = 0, r, m\n read(*,*) n\n read(*,*) a(1:n)\n r = n\n do while (r-l > 1)\n m = (l+r)/2\n if (check(m)) then\n r = m\n else\n l = m\n end if\n end do\n write(*,'(i0)') r\ncontains\n logical function check(m)\n use mod_tree_map\n type(t_tree_map) :: map\n type(t_entry), pointer :: tmp\n integer, intent(in) :: m\n integer :: i, j\n call map%clear()\n check = .false.\n do i = 2, n\n if (a(i) > a(i-1)) cycle\n do while (map%size() > 0 .and. map%last_key() > a(i))\n tmp => poll_last_entry(map)\n end do\n call map%put(a(i),map%get(a(i))+1)\n do j = a(i), 2, -1\n if (map%get(j) < m) exit\n call map%remove(j)\n call map%put(j-1,map%get(j-1)+1)\n end do\n if (map%get(1) >= m) return\n end do\n check = .true.\n end\nend program lexicographic_constraints", "problem_context": "Score : 700 points\n\nProblem Statement\n\nThere are N strings arranged in a row.\nIt is known that, for any two adjacent strings, the string to the left is lexicographically smaller than the string to the right.\nThat is, S_1 r) then\n t = a(i); ti = ia(i); i = i+1\n else if (i > q) then\n t = a(j); ti = ia(j); j = j+1\n \n else if (a(i) <= a(j)) then\n t = a(i); ti = ia(i); i = i+1\n else\n t = a(j); ti = ia(j); j = j+1\n end if\n b(k) = t; ib(k) = ti; k = k+1\n\n end do\n do i = p, r\n a(i) = b(i)\n ia(i) = ib(i)\n end do\n end subroutine merge\n subroutine sort(a,ia)\n integer(8) a(:), b(size(a)),n,ia(:),ib(size(a))\n n = size(a)\n call mergesort(a,1_8,n,b,ia,ib)\n end subroutine sort\n end program atcoder_abc115c_sort", "language": "Fortran", "metadata": {"date": 1566884768, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03208.html", "problem_id": "p03208", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03208/input.txt", "sample_output_relpath": "derived/input_output/data/p03208/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03208/Fortran/s982428309.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s982428309", "user_id": "u780122303"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program atcoder_abc115c_sort\n implicit none\n integer(8) :: n,k,i,ans=10000000000_8\n integer(8),allocatable,dimension(:) :: a,ind\n read*,n,k\n allocate( a(n) )\n allocate( ind(n) )\n read(*,*)(a(i),i=1,n)\n do i=1,n\n ind(i) = i;\n end do\n call sort(a,ind)\n do i=1,n-k+1\n ans = min(ans,a(i+k-1)-a(i))\n enddo\n write(*,'(I0)')ans\n\n\n !----------------------functions--------------------------\n contains\n recursive subroutine mergesort(a, p, r, b,ia,ib)\n integer(8) a(:), b(:),ia(:),ib(:)\n integer(8) p, r\n integer(8) q\n if (p < r) then\n q = (p+r)/2\n call mergesort(a, p, q, b,ia,ib)\n call mergesort(a, q+1, r, b,ia,ib)\n call merge(a, p, q, r, b, ia,ib)\n end if\n end subroutine mergesort\n subroutine merge(a, p, q, r, b, ia,ib)\n integer(8) a(:), b(:),ia(:),ib(:)\n integer(8) p, r, q, i, j, k\n integer(8) t,ti\n k = p; i = p; j = q+1\n do\n if (.not. (k <= r)) exit\n if (j > r) then\n t = a(i); ti = ia(i); i = i+1\n else if (i > q) then\n t = a(j); ti = ia(j); j = j+1\n \n else if (a(i) <= a(j)) then\n t = a(i); ti = ia(i); i = i+1\n else\n t = a(j); ti = ia(j); j = j+1\n end if\n b(k) = t; ib(k) = ti; k = k+1\n\n end do\n do i = p, r\n a(i) = b(i)\n ia(i) = ib(i)\n end do\n end subroutine merge\n subroutine sort(a,ia)\n integer(8) a(:), b(size(a)),n,ia(:),ib(size(a))\n n = size(a)\n call mergesort(a,1_8,n,b,ia,ib)\n end subroutine sort\n end program atcoder_abc115c_sort", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "sample_input": "5 3\n10\n15\n11\n14\n12\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03208", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn some other world, today is Christmas Eve.\n\nThere are N trees planted in Mr. Takaha's garden. The height of the i-th tree (1 \\leq i \\leq N) is h_i meters.\n\nHe decides to choose K trees from these trees and decorate them with electric lights. To make the scenery more beautiful, the heights of the decorated trees should be as close to each other as possible.\n\nMore specifically, let the height of the tallest decorated tree be h_{max} meters, and the height of the shortest decorated tree be h_{min} meters. The smaller the value h_{max} - h_{min} is, the better. What is the minimum possible value of h_{max} - h_{min}?\n\nConstraints\n\n2 \\leq K < N \\leq 10^5\n\n1 \\leq h_i \\leq 10^9\n\nh_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nh_1\nh_2\n:\nh_N\n\nOutput\n\nPrint the minimum possible value of h_{max} - h_{min}.\n\nSample Input 1\n\n5 3\n10\n15\n11\n14\n12\n\nSample Output 1\n\n2\n\nIf we decorate the first, third and fifth trees, h_{max} = 12, h_{min} = 10 so h_{max} - h_{min} = 2. This is optimal.\n\nSample Input 2\n\n5 3\n5\n7\n5\n7\n7\n\nSample Output 2\n\n0\n\nIf we decorate the second, fourth and fifth trees, h_{max} = 7, h_{min} = 7 so h_{max} - h_{min} = 0. This is optimal.\n\nThere are not too many trees in these sample inputs, but note that there can be at most one hundred thousand trees (we just can't put a sample with a hundred thousand lines here).", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1538, "cpu_time_ms": 52, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s353552789", "group_id": "codeNet:p03209", "input_text": "program test\nimplicit none\n\ninteger(8)::n,x,a\ninteger(8):: i,j,k,fib(0:50),pat(0:50),level\n\nread(*,*) n,x\n\n\tfib(0) = 1\n\tpat(0) = 1\n\tdo i=1,50\n\t\tfib(i) = 2*fib(i-1)+3\n\t\tpat(i) = 2*pat(i-1)+1\n\tenddo\n\na = ans(n,x)\n\nwrite(*,*) a\n\n!もし下からの指定された層数がハンバーガーの半分をこえていたら、パティ層数から、指定されてない部分を引く\n\n\n!そうでなければ、レベルn-1バーガーの、x-1層目までのパティ数を数える\n\ncontains\n\nrecursive integer(8) function ans(n,x) result(res)\n\timplicit none\n\tinteger(8):: n,x\n\n\tif(x==0) then\n\t\tres = 0\n\telse if(n==0 .and. x==1)then\n\t\tres = 1\n\telse if(2*x > fib(n))then\n\t\tres = pat(n) - ans(n,fib(n)-x)\n\telse\n\t\tres = ans(n-1,x-1)\n\tendif\n\t\n\treturn\n\t\nend function\n\nend program", "language": "Fortran", "metadata": {"date": 1551179110, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03209.html", "problem_id": "p03209", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03209/input.txt", "sample_output_relpath": "derived/input_output/data/p03209/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03209/Fortran/s353552789.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s353552789", "user_id": "u454703763"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program test\nimplicit none\n\ninteger(8)::n,x,a\ninteger(8):: i,j,k,fib(0:50),pat(0:50),level\n\nread(*,*) n,x\n\n\tfib(0) = 1\n\tpat(0) = 1\n\tdo i=1,50\n\t\tfib(i) = 2*fib(i-1)+3\n\t\tpat(i) = 2*pat(i-1)+1\n\tenddo\n\na = ans(n,x)\n\nwrite(*,*) a\n\n!もし下からの指定された層数がハンバーガーの半分をこえていたら、パティ層数から、指定されてない部分を引く\n\n\n!そうでなければ、レベルn-1バーガーの、x-1層目までのパティ数を数える\n\ncontains\n\nrecursive integer(8) function ans(n,x) result(res)\n\timplicit none\n\tinteger(8):: n,x\n\n\tif(x==0) then\n\t\tres = 0\n\telse if(n==0 .and. x==1)then\n\t\tres = 1\n\telse if(2*x > fib(n))then\n\t\tres = pat(n) - ans(n,fib(n)-x)\n\telse\n\t\tres = ans(n-1,x-1)\n\tendif\n\t\n\treturn\n\t\nend function\n\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nIn some other world, today is Christmas.\n\nMr. Takaha decides to make a multi-dimensional burger in his party. A level-L burger (L is an integer greater than or equal to 0) is the following thing:\n\nA level-0 burger is a patty.\n\nA level-L burger (L \\geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom.\n\nFor example, a level-1 burger and a level-2 burger look like BPPPB and BBPPPBPBPPPBB (rotated 90 degrees), where B and P stands for a bun and a patty.\n\nThe burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq X \\leq ( the total number of layers in a level-N burger )\n\nN and X are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the number of patties in the bottom-most X layers from the bottom of a level-N burger.\n\nSample Input 1\n\n2 7\n\nSample Output 1\n\n4\n\nThere are 4 patties in the bottom-most 7 layers of a level-2 burger (BBPPPBPBPPPBB).\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n0\n\nThe bottom-most layer of a level-1 burger is a bun.\n\nSample Input 3\n\n50 4321098765432109\n\nSample Output 3\n\n2160549382716056\n\nA level-50 burger is rather thick, to the extent that the number of its layers does not fit into a 32-bit integer.", "sample_input": "2 7\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03209", "source_text": "Score : 400 points\n\nProblem Statement\n\nIn some other world, today is Christmas.\n\nMr. Takaha decides to make a multi-dimensional burger in his party. A level-L burger (L is an integer greater than or equal to 0) is the following thing:\n\nA level-0 burger is a patty.\n\nA level-L burger (L \\geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom.\n\nFor example, a level-1 burger and a level-2 burger look like BPPPB and BBPPPBPBPPPBB (rotated 90 degrees), where B and P stands for a bun and a patty.\n\nThe burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq X \\leq ( the total number of layers in a level-N burger )\n\nN and X are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the number of patties in the bottom-most X layers from the bottom of a level-N burger.\n\nSample Input 1\n\n2 7\n\nSample Output 1\n\n4\n\nThere are 4 patties in the bottom-most 7 layers of a level-2 burger (BBPPPBPBPPPBB).\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n0\n\nThe bottom-most layer of a level-1 burger is a bun.\n\nSample Input 3\n\n50 4321098765432109\n\nSample Output 3\n\n2160549382716056\n\nA level-50 burger is rather thick, to the extent that the number of its layers does not fit into a 32-bit integer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 774, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s197841912", "group_id": "codeNet:p03209", "input_text": "program atcoder\n implicit none\n integer(8) :: a(0:51),b(0:51),i,ans,n,x\n read*,n,x\n ans = 0\n a(0) = 1\n b(0) = 1\n do i=1,50\n a(i) = a(i-1) * 2 + 3\n b(i) = b(i-1) * 2 + 1 \n enddo\n call dfs(n,x)\n write(*,'(I0)')ans\n!----------------------functions--------------------------\ncontains\n\nrecursive subroutine dfs(nn,xx)\n implicit none\n integer(8) :: nn,xx\n if(nn==0 .and. xx>=1)then\n ans = ans + 1\n else if(xx<=1)then\n ans = ans\n else if(xx>a(nn)/2)then\n ans = ans+1+b(nn-1)\n call dfs(n-1,xx-a(nn)/2-1)\n else if(xx==a(nn)/2)then\n ans = ans + b(n-1)\n else\n call dfs(nn-1,xx-1)\n end if\n return\nend subroutine dfs\n\nend program atcoder", "language": "Fortran", "metadata": {"date": 1544363311, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03209.html", "problem_id": "p03209", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03209/input.txt", "sample_output_relpath": "derived/input_output/data/p03209/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03209/Fortran/s197841912.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s197841912", "user_id": "u780122303"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program atcoder\n implicit none\n integer(8) :: a(0:51),b(0:51),i,ans,n,x\n read*,n,x\n ans = 0\n a(0) = 1\n b(0) = 1\n do i=1,50\n a(i) = a(i-1) * 2 + 3\n b(i) = b(i-1) * 2 + 1 \n enddo\n call dfs(n,x)\n write(*,'(I0)')ans\n!----------------------functions--------------------------\ncontains\n\nrecursive subroutine dfs(nn,xx)\n implicit none\n integer(8) :: nn,xx\n if(nn==0 .and. xx>=1)then\n ans = ans + 1\n else if(xx<=1)then\n ans = ans\n else if(xx>a(nn)/2)then\n ans = ans+1+b(nn-1)\n call dfs(n-1,xx-a(nn)/2-1)\n else if(xx==a(nn)/2)then\n ans = ans + b(n-1)\n else\n call dfs(nn-1,xx-1)\n end if\n return\nend subroutine dfs\n\nend program atcoder", "problem_context": "Score : 400 points\n\nProblem Statement\n\nIn some other world, today is Christmas.\n\nMr. Takaha decides to make a multi-dimensional burger in his party. A level-L burger (L is an integer greater than or equal to 0) is the following thing:\n\nA level-0 burger is a patty.\n\nA level-L burger (L \\geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom.\n\nFor example, a level-1 burger and a level-2 burger look like BPPPB and BBPPPBPBPPPBB (rotated 90 degrees), where B and P stands for a bun and a patty.\n\nThe burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq X \\leq ( the total number of layers in a level-N burger )\n\nN and X are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the number of patties in the bottom-most X layers from the bottom of a level-N burger.\n\nSample Input 1\n\n2 7\n\nSample Output 1\n\n4\n\nThere are 4 patties in the bottom-most 7 layers of a level-2 burger (BBPPPBPBPPPBB).\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n0\n\nThe bottom-most layer of a level-1 burger is a bun.\n\nSample Input 3\n\n50 4321098765432109\n\nSample Output 3\n\n2160549382716056\n\nA level-50 burger is rather thick, to the extent that the number of its layers does not fit into a 32-bit integer.", "sample_input": "2 7\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03209", "source_text": "Score : 400 points\n\nProblem Statement\n\nIn some other world, today is Christmas.\n\nMr. Takaha decides to make a multi-dimensional burger in his party. A level-L burger (L is an integer greater than or equal to 0) is the following thing:\n\nA level-0 burger is a patty.\n\nA level-L burger (L \\geq 1) is a bun, a level-(L-1) burger, a patty, another level-(L-1) burger and another bun, stacked vertically in this order from the bottom.\n\nFor example, a level-1 burger and a level-2 burger look like BPPPB and BBPPPBPBPPPBB (rotated 90 degrees), where B and P stands for a bun and a patty.\n\nThe burger Mr. Takaha will make is a level-N burger. Lunlun the Dachshund will eat X layers from the bottom of this burger (a layer is a patty or a bun). How many patties will she eat?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq X \\leq ( the total number of layers in a level-N burger )\n\nN and X are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the number of patties in the bottom-most X layers from the bottom of a level-N burger.\n\nSample Input 1\n\n2 7\n\nSample Output 1\n\n4\n\nThere are 4 patties in the bottom-most 7 layers of a level-2 burger (BBPPPBPBPPPBB).\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\n0\n\nThe bottom-most layer of a level-1 burger is a bun.\n\nSample Input 3\n\n50 4321098765432109\n\nSample Output 3\n\n2160549382716056\n\nA level-50 burger is rather thick, to the extent that the number of its layers does not fit into a 32-bit integer.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 737, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s793471873", "group_id": "codeNet:p03210", "input_text": "integer :: x\n\nread*,x\n\nif( x==3.or.x==5.or.x==7 )then\n print*,'YES'\nelse\n print*,'NO'\nend if\nend\n", "language": "Fortran", "metadata": {"date": 1576447496, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03210.html", "problem_id": "p03210", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03210/input.txt", "sample_output_relpath": "derived/input_output/data/p03210/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03210/Fortran/s793471873.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s793471873", "user_id": "u171356453"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "integer :: x\n\nread*,x\n\nif( x==3.or.x==5.or.x==7 )then\n print*,'YES'\nelse\n print*,'NO'\nend if\nend\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.\n\nTakahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time?\n\nConstraints\n\n1 ≤ X ≤ 9\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf Takahashi's growth will be celebrated, print YES; if it will not, print NO.\n\nSample Input 1\n\n5\n\nSample Output 1\n\nYES\n\nThe growth of a five-year-old child will be celebrated.\n\nSample Input 2\n\n6\n\nSample Output 2\n\nNO\n\nSee you next year.", "sample_input": "5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03210", "source_text": "Score : 100 points\n\nProblem Statement\n\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.\n\nTakahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time?\n\nConstraints\n\n1 ≤ X ≤ 9\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf Takahashi's growth will be celebrated, print YES; if it will not, print NO.\n\nSample Input 1\n\n5\n\nSample Output 1\n\nYES\n\nThe growth of a five-year-old child will be celebrated.\n\nSample Input 2\n\n6\n\nSample Output 2\n\nNO\n\nSee you next year.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 99, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s600212570", "group_id": "codeNet:p03210", "input_text": "program jihanki\n implicit none\n integer :: d\n\n read(*,*)d\n if (d==3 .or. d==5 .or. d==7) then\n write(*,*)'YES'\n else\n write(*,*)'NO'\n end if\n \nend program jihanki\n", "language": "Fortran", "metadata": {"date": 1551907624, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03210.html", "problem_id": "p03210", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03210/input.txt", "sample_output_relpath": "derived/input_output/data/p03210/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03210/Fortran/s600212570.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s600212570", "user_id": "u508570129"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program jihanki\n implicit none\n integer :: d\n\n read(*,*)d\n if (d==3 .or. d==5 .or. d==7) then\n write(*,*)'YES'\n else\n write(*,*)'NO'\n end if\n \nend program jihanki\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.\n\nTakahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time?\n\nConstraints\n\n1 ≤ X ≤ 9\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf Takahashi's growth will be celebrated, print YES; if it will not, print NO.\n\nSample Input 1\n\n5\n\nSample Output 1\n\nYES\n\nThe growth of a five-year-old child will be celebrated.\n\nSample Input 2\n\n6\n\nSample Output 2\n\nNO\n\nSee you next year.", "sample_input": "5\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03210", "source_text": "Score : 100 points\n\nProblem Statement\n\nShichi-Go-San (literally \"Seven-Five-Three\") is a traditional event in a certain country to celebrate the growth of seven-, five- and three-year-old children.\n\nTakahashi is now X years old. Will his growth be celebrated in Shichi-Go-San this time?\n\nConstraints\n\n1 ≤ X ≤ 9\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf Takahashi's growth will be celebrated, print YES; if it will not, print NO.\n\nSample Input 1\n\n5\n\nSample Output 1\n\nYES\n\nThe growth of a five-year-old child will be celebrated.\n\nSample Input 2\n\n6\n\nSample Output 2\n\nNO\n\nSee you next year.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 178, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s280824134", "group_id": "codeNet:p03212", "input_text": "program main\nimplicit None\n\tinteger(8)::n,p,a(9),s(9,262143),b(262143),i,c,x,y,z,L,d,w\n\tinteger(8)::r(26484)\n\t\n\tdo n = 1,262143\n\t\tcall tet(n,a)\n\t\ts(:,n) = a\n\tenddo\n\t\n\ts = (1-((8-(s*2+1))/7))*(s*2+1)\n\t\n\tb = 0\n\tdo n = 1,262143\n\t\tdo i = 1,9\n\t\t\tb(n) = b(n) + s(i,n)*(10**(i-1))\n\t\tenddo\n\tenddo\n\t\n\tp = 0\n\tn = 1\n\t\n\tdo\n\t\tif (p > 26484) exit\n\t\tx = 0;y = 0;z = 0;w = 1\n\t\td = b(n)\n\t\tL = int(log10(real(d)))+1\n\t\tdo i = L,1,-1\n\t\t\tif(d/10**(i-1) == 7)then\n\t\t\t\tx =1\n\t\t\t\td = d - 7 * 10**(i-1)\n\t\t\t\telse if(d/10**(i-1) == 5)then\n\t\t\t\ty =1\n\t\t\t\td = d - 5 * 10**(i-1)\n\t\t\t\telse if(d/10**(i-1) == 3)then\n\t\t\t\tz =1\n\t\t\t\td = d - 3 * 10**(i-1)\n\t\t\t\telse if(d/10**(i-1) == 0)then\n\t\t\t\tw = 0\n\t\t\t\texit\n\t\t\tendif\n\t\tenddo\n\t\t\n\t\t!print 101,b(n),L,x,y,z,w\n\t\tif(x ==1 .and. y == 1 .and. z ==1 .and. w == 1)then\n\t\t\tp = p + 1\n\t\t\tr(p) = b(n)\n\t\tendif\n\t\tn = n + 1\n\tenddo\n\t\n\tread*,c\n\t\n\t\n\tp = 0\n\tdo\n\t\tif(p == 26484) exit\n\t\tif(r(p+1) > c) exit\n\t\tif(r(p+1) < c) p = p + 1\n\tenddo\n\t\n\tprint *,p\n\t\n101 format(8(i0,1x))\nend program main\n\nsubroutine tet(n,a)\n\tinteger(8)::n,i,p\n\tinteger(8)::a(9)\n\t\n\ta = 0\n\tp = n\n\ti = 1\n\tdo while (p /= 0)\n\t\ta(i) = mod(p,4)\n\t\tp = p/4\n\t\ti = i + 1\n\tenddo\nend subroutine tet", "language": "Fortran", "metadata": {"date": 1545624992, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03212.html", "problem_id": "p03212", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03212/input.txt", "sample_output_relpath": "derived/input_output/data/p03212/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03212/Fortran/s280824134.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s280824134", "user_id": "u900266249"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main\nimplicit None\n\tinteger(8)::n,p,a(9),s(9,262143),b(262143),i,c,x,y,z,L,d,w\n\tinteger(8)::r(26484)\n\t\n\tdo n = 1,262143\n\t\tcall tet(n,a)\n\t\ts(:,n) = a\n\tenddo\n\t\n\ts = (1-((8-(s*2+1))/7))*(s*2+1)\n\t\n\tb = 0\n\tdo n = 1,262143\n\t\tdo i = 1,9\n\t\t\tb(n) = b(n) + s(i,n)*(10**(i-1))\n\t\tenddo\n\tenddo\n\t\n\tp = 0\n\tn = 1\n\t\n\tdo\n\t\tif (p > 26484) exit\n\t\tx = 0;y = 0;z = 0;w = 1\n\t\td = b(n)\n\t\tL = int(log10(real(d)))+1\n\t\tdo i = L,1,-1\n\t\t\tif(d/10**(i-1) == 7)then\n\t\t\t\tx =1\n\t\t\t\td = d - 7 * 10**(i-1)\n\t\t\t\telse if(d/10**(i-1) == 5)then\n\t\t\t\ty =1\n\t\t\t\td = d - 5 * 10**(i-1)\n\t\t\t\telse if(d/10**(i-1) == 3)then\n\t\t\t\tz =1\n\t\t\t\td = d - 3 * 10**(i-1)\n\t\t\t\telse if(d/10**(i-1) == 0)then\n\t\t\t\tw = 0\n\t\t\t\texit\n\t\t\tendif\n\t\tenddo\n\t\t\n\t\t!print 101,b(n),L,x,y,z,w\n\t\tif(x ==1 .and. y == 1 .and. z ==1 .and. w == 1)then\n\t\t\tp = p + 1\n\t\t\tr(p) = b(n)\n\t\tendif\n\t\tn = n + 1\n\tenddo\n\t\n\tread*,c\n\t\n\t\n\tp = 0\n\tdo\n\t\tif(p == 26484) exit\n\t\tif(r(p+1) > c) exit\n\t\tif(r(p+1) < c) p = p + 1\n\tenddo\n\t\n\tprint *,p\n\t\n101 format(8(i0,1x))\nend program main\n\nsubroutine tet(n,a)\n\tinteger(8)::n,i,p\n\tinteger(8)::a(9)\n\t\n\ta = 0\n\tp = n\n\ti = 1\n\tdo while (p /= 0)\n\t\ta(i) = mod(p,4)\n\t\tp = p/4\n\t\ti = i + 1\n\tenddo\nend subroutine tet", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "sample_input": "575\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03212", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N. Among the integers between 1 and N (inclusive), how many Shichi-Go-San numbers (literally \"Seven-Five-Three numbers\") are there?\n\nHere, a Shichi-Go-San number is a positive integer that satisfies the following condition:\n\nWhen the number is written in base ten, each of the digits 7, 5 and 3 appears at least once, and the other digits never appear.\n\nConstraints\n\n1 \\leq N < 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of the Shichi-Go-San numbers between 1 and N (inclusive).\n\nSample Input 1\n\n575\n\nSample Output 1\n\n4\n\nThere are four Shichi-Go-San numbers not greater than 575: 357, 375, 537 and 573.\n\nSample Input 2\n\n3600\n\nSample Output 2\n\n13\n\nThere are 13 Shichi-Go-San numbers not greater than 3600: the above four numbers, 735, 753, 3357, 3375, 3537, 3557, 3573, 3575 and 3577.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n26484", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1147, "cpu_time_ms": 238, "memory_kb": 21340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s727134440", "group_id": "codeNet:p03214", "input_text": "program main\nimplicit none\ninteger :: i, j, k\ninteger :: n\ninteger , allocatable :: a(:)\nreal :: ave\n\nread(*,*) n\nallocate( a(n) )\nread(*,*) a\nave = sum(a)/n\nj = ave\ndo i = 1, n\n if( abs(a(i)-ave) .lt. j ) then\n j = abs(a(i)-ave)\n k = i-1\n end if\nend do\nwrite(*,'(i0)') k\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1563311867, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03214.html", "problem_id": "p03214", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03214/input.txt", "sample_output_relpath": "derived/input_output/data/p03214/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03214/Fortran/s727134440.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s727134440", "user_id": "u696547932"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: i, j, k\ninteger :: n\ninteger , allocatable :: a(:)\nreal :: ave\n\nread(*,*) n\nallocate( a(n) )\nread(*,*) a\nave = sum(a)/n\nj = ave\ndo i = 1, n\n if( abs(a(i)-ave) .lt. j ) then\n j = abs(a(i)-ave)\n k = i-1\n end if\nend do\nwrite(*,'(i0)') k\n\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nNiwango-kun is an employee of Dwango Co., Ltd.\n\nOne day, he is asked to generate a thumbnail from a video a user submitted.\n\nTo generate a thumbnail, he needs to select a frame of the video according to the following procedure:\n\nGet an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the number of the frames of the video, and each a_i denotes the representation of the i-th frame of the video.\n\nSelect t-th frame whose representation a_t is nearest to the average of all frame representations.\n\nIf there are multiple such frames, select the frame with the smallest index.\n\nFind the index t of the frame he should select to generate a thumbnail.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq a_i \\leq 100\n\nAll numbers given in input are integers\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_{0} a_{1} ... a_{N-1}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nSince the average of frame representations is 2, Niwango-kun needs to select the index 1, whose representation is 2, that is, the nearest value to the average.\n\nSample Input 2\n\n4\n2 5 2 5\n\nSample Output 2\n\n0\n\nThe average of frame representations is 3.5.\n\nIn this case, every frame has the same distance from its representation to the average.\n\nTherefore, Niwango-kun should select index 0, the smallest index among them.", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03214", "source_text": "Score : 200 points\n\nProblem Statement\n\nNiwango-kun is an employee of Dwango Co., Ltd.\n\nOne day, he is asked to generate a thumbnail from a video a user submitted.\n\nTo generate a thumbnail, he needs to select a frame of the video according to the following procedure:\n\nGet an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the number of the frames of the video, and each a_i denotes the representation of the i-th frame of the video.\n\nSelect t-th frame whose representation a_t is nearest to the average of all frame representations.\n\nIf there are multiple such frames, select the frame with the smallest index.\n\nFind the index t of the frame he should select to generate a thumbnail.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq a_i \\leq 100\n\nAll numbers given in input are integers\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_{0} a_{1} ... a_{N-1}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nSince the average of frame representations is 2, Niwango-kun needs to select the index 1, whose representation is 2, that is, the nearest value to the average.\n\nSample Input 2\n\n4\n2 5 2 5\n\nSample Output 2\n\n0\n\nThe average of frame representations is 3.5.\n\nIn this case, every frame has the same distance from its representation to the average.\n\nTherefore, Niwango-kun should select index 0, the smallest index among them.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 304, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s303471840", "group_id": "codeNet:p03214", "input_text": "program main\nimplicit none\ninteger :: i, j, m, n\ninteger , allocatable :: a( : )\n\nread(*,*) n\nallocate( a(n) )\nread(*,*) a(1:n)\n\nm = 100\ndo i = 1 , n\n if( abs( a(i) - sum(a)/n ) < m ) then\n m = a(i) - sum(a)/n\n j = i\n end if\nend do\ndo i = 1, n\n if( i/=j ) then\n if( a(i) == a(j) ) then\n j = 1\n end if\n end if\nend do\nwrite(*,'(i0)') j - 1\n\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1555705798, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03214.html", "problem_id": "p03214", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03214/input.txt", "sample_output_relpath": "derived/input_output/data/p03214/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03214/Fortran/s303471840.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s303471840", "user_id": "u696547932"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: i, j, m, n\ninteger , allocatable :: a( : )\n\nread(*,*) n\nallocate( a(n) )\nread(*,*) a(1:n)\n\nm = 100\ndo i = 1 , n\n if( abs( a(i) - sum(a)/n ) < m ) then\n m = a(i) - sum(a)/n\n j = i\n end if\nend do\ndo i = 1, n\n if( i/=j ) then\n if( a(i) == a(j) ) then\n j = 1\n end if\n end if\nend do\nwrite(*,'(i0)') j - 1\n\n\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nNiwango-kun is an employee of Dwango Co., Ltd.\n\nOne day, he is asked to generate a thumbnail from a video a user submitted.\n\nTo generate a thumbnail, he needs to select a frame of the video according to the following procedure:\n\nGet an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the number of the frames of the video, and each a_i denotes the representation of the i-th frame of the video.\n\nSelect t-th frame whose representation a_t is nearest to the average of all frame representations.\n\nIf there are multiple such frames, select the frame with the smallest index.\n\nFind the index t of the frame he should select to generate a thumbnail.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq a_i \\leq 100\n\nAll numbers given in input are integers\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_{0} a_{1} ... a_{N-1}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nSince the average of frame representations is 2, Niwango-kun needs to select the index 1, whose representation is 2, that is, the nearest value to the average.\n\nSample Input 2\n\n4\n2 5 2 5\n\nSample Output 2\n\n0\n\nThe average of frame representations is 3.5.\n\nIn this case, every frame has the same distance from its representation to the average.\n\nTherefore, Niwango-kun should select index 0, the smallest index among them.", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03214", "source_text": "Score : 200 points\n\nProblem Statement\n\nNiwango-kun is an employee of Dwango Co., Ltd.\n\nOne day, he is asked to generate a thumbnail from a video a user submitted.\n\nTo generate a thumbnail, he needs to select a frame of the video according to the following procedure:\n\nGet an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the number of the frames of the video, and each a_i denotes the representation of the i-th frame of the video.\n\nSelect t-th frame whose representation a_t is nearest to the average of all frame representations.\n\nIf there are multiple such frames, select the frame with the smallest index.\n\nFind the index t of the frame he should select to generate a thumbnail.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq a_i \\leq 100\n\nAll numbers given in input are integers\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_{0} a_{1} ... a_{N-1}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n1\n\nSince the average of frame representations is 2, Niwango-kun needs to select the index 1, whose representation is 2, that is, the nearest value to the average.\n\nSample Input 2\n\n4\n2 5 2 5\n\nSample Output 2\n\n0\n\nThe average of frame representations is 3.5.\n\nIn this case, every frame has the same distance from its representation to the average.\n\nTherefore, Niwango-kun should select index 0, the smallest index among them.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 393, "cpu_time_ms": 4, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s132608756", "group_id": "codeNet:p03217", "input_text": "module mod_square_rotation\n implicit none\n integer :: d, s(3,0:2000,0:2000) = 0\ncontains\n subroutine cumsum(a,k)\n integer, intent(in) :: a(:,:), k\n integer :: i, j, l, b(3,d,d)\n b(3,d,d) = 0\n do i = 1, d\n do j = 1, d\n if (a(i,j) > (k+1)*(k+1)) b(1,i,j) = b(1,i,j)+1\n if (a(i,j) > k*k) b(2,i,j) = b(2,i,j)+1\n if (a(i,j) > k*(k+1)) b(3,i,j) = b(3,i,j)+1\n end do\n end do\n do i = 1, 2*d\n do j = 1, 2*d\n s(:,i,j) = s(:,i-1,j)+s(:,i,j-1)-s(:,i-1,j-1) &\n & +b(:,mod(i-1,d)+1,mod(j-1,d)+1)\n end do\n end do\n end\n integer function getsum(l,i1,j1,i2,j2)\n integer, intent(in) :: l, i1, j1, i2, j2\n getsum = s(l,i1,j1)-s(l,i2-1,j1)-s(l,i1,j2-1)+s(l,i2-1,j2-1)\n end\n logical function check(b)\n integer, intent(in) :: b\n integer :: i, j\n check = .false.\n do i = 1, d\n do j = 1, d\n if (getsum(1,i,j,i+b,j+b) == 0) cycle\n if (getsum(2,i+b+1,j+b+1,i+d-1,j+d-1) == 0) cycle\n if (getsum(3,i+b+1,j,i+d-1,j+b) == 0) cycle\n if (getsum(3,i,j+b+1,i+b,j+d-1) == 0) cycle\n check = .true.\n return\n end do\n end do\n end\nend module mod_square_rotation\nprogram square_rotation\n use mod_square_rotation\n implicit none\n integer :: n, x, y, a(0:1000,0:1000) = 0, i, j, m, k, l, r\n logical :: ok\n read(*,*) n, d\n do i = 1, n\n read(*,*) x, y\n x = mod(x,d)\n y = mod(y,d)\n a(x,y) = a(x,y)+1\n end do\n m = maxval(a(0:d-1,0:d-1))\n k = 0\n do\n if (m <= (k+1)*(k+1)) exit\n k = k+1\n end do\n call cumsum(a(0:d-1,0:d-1),k)\n l = -1\n r = d-1\n do while (r-l > 1)\n m = (l+r)/2\n if (check(m)) then\n r = m\n else\n l = m\n end if\n end do\n write(*,'(i0)') k*d+r\nend program square_rotation", "language": "Fortran", "metadata": {"date": 1566634675, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03217.html", "problem_id": "p03217", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03217/input.txt", "sample_output_relpath": "derived/input_output/data/p03217/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03217/Fortran/s132608756.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s132608756", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module mod_square_rotation\n implicit none\n integer :: d, s(3,0:2000,0:2000) = 0\ncontains\n subroutine cumsum(a,k)\n integer, intent(in) :: a(:,:), k\n integer :: i, j, l, b(3,d,d)\n b(3,d,d) = 0\n do i = 1, d\n do j = 1, d\n if (a(i,j) > (k+1)*(k+1)) b(1,i,j) = b(1,i,j)+1\n if (a(i,j) > k*k) b(2,i,j) = b(2,i,j)+1\n if (a(i,j) > k*(k+1)) b(3,i,j) = b(3,i,j)+1\n end do\n end do\n do i = 1, 2*d\n do j = 1, 2*d\n s(:,i,j) = s(:,i-1,j)+s(:,i,j-1)-s(:,i-1,j-1) &\n & +b(:,mod(i-1,d)+1,mod(j-1,d)+1)\n end do\n end do\n end\n integer function getsum(l,i1,j1,i2,j2)\n integer, intent(in) :: l, i1, j1, i2, j2\n getsum = s(l,i1,j1)-s(l,i2-1,j1)-s(l,i1,j2-1)+s(l,i2-1,j2-1)\n end\n logical function check(b)\n integer, intent(in) :: b\n integer :: i, j\n check = .false.\n do i = 1, d\n do j = 1, d\n if (getsum(1,i,j,i+b,j+b) == 0) cycle\n if (getsum(2,i+b+1,j+b+1,i+d-1,j+d-1) == 0) cycle\n if (getsum(3,i+b+1,j,i+d-1,j+b) == 0) cycle\n if (getsum(3,i,j+b+1,i+b,j+d-1) == 0) cycle\n check = .true.\n return\n end do\n end do\n end\nend module mod_square_rotation\nprogram square_rotation\n use mod_square_rotation\n implicit none\n integer :: n, x, y, a(0:1000,0:1000) = 0, i, j, m, k, l, r\n logical :: ok\n read(*,*) n, d\n do i = 1, n\n read(*,*) x, y\n x = mod(x,d)\n y = mod(y,d)\n a(x,y) = a(x,y)+1\n end do\n m = maxval(a(0:d-1,0:d-1))\n k = 0\n do\n if (m <= (k+1)*(k+1)) exit\n k = k+1\n end do\n call cumsum(a(0:d-1,0:d-1),k)\n l = -1\n r = d-1\n do while (r-l > 1)\n m = (l+r)/2\n if (check(m)) then\n r = m\n else\n l = m\n end if\n end do\n write(*,'(i0)') k*d+r\nend program square_rotation", "problem_context": "Score : 800 points\n\nProblem Statement\n\nNiwango-kun, an employee of Dwango Co., Ltd., likes Niconico TV-chan, so he collected a lot of soft toys of her and spread them on the floor.\n\nNiwango-kun has N black rare soft toys of Niconico TV-chan and they are spread together with ordinary ones. He wanted these black rare soft toys to be close together, so he decided to rearrange them.\n\nIn an infinitely large two-dimensional plane, every lattice point has a soft toy on it. The coordinates (x_i,y_i) of N black rare soft toys are given. All soft toys are considered to be points (without a length, area, or volume).\n\nHe may perform the following operation arbitrarily many times:\n\nPut an axis-aligned square with side length D, rotate the square by 90 degrees with four soft toys on the four corners of the square. More specifically, if the left bottom corner's coordinate is (x, y), rotate four points (x,y) \\rightarrow (x+D,y) \\rightarrow (x+D,y+D) \\rightarrow (x,y+D) \\rightarrow (x,y) in this order. Each of the four corners of the square must be on a lattice point.\n\nLet's define the scatteredness of an arrangement by the minimum side length of an axis-aligned square enclosing all black rare soft toys. Black rare soft toys on the edges or the vertices of a square are considered to be enclosed by the square.\n\nFind the minimum scatteredness after he performs arbitrarily many operations.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq D \\leq 1000\n\n0 \\leq x_i, y_i \\leq 10^9\n\nGiven coordinates are pairwise distinct\n\nAll numbers given in input are integers\n\nPartial Scores\n\n500 points will be awarded for passing the test set satisfying 1 \\leq D \\leq 30.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 1\n0 0\n1 0\n2 0\n\nSample Output 1\n\n1\n\nSample Input 2\n\n19 2\n1 3\n2 3\n0 1\n1 1\n2 1\n3 1\n4 4\n5 4\n6 4\n7 4\n8 4\n8 3\n8 2\n8 1\n8 0\n7 0\n6 0\n5 0\n4 0\n\nSample Output 2\n\n4\n\nSample Input 3\n\n8 3\n0 0\n0 3\n3 0\n3 3\n2 2\n2 5\n5 2\n5 5\n\nSample Output 3\n\n4", "sample_input": "3 1\n0 0\n1 0\n2 0\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03217", "source_text": "Score : 800 points\n\nProblem Statement\n\nNiwango-kun, an employee of Dwango Co., Ltd., likes Niconico TV-chan, so he collected a lot of soft toys of her and spread them on the floor.\n\nNiwango-kun has N black rare soft toys of Niconico TV-chan and they are spread together with ordinary ones. He wanted these black rare soft toys to be close together, so he decided to rearrange them.\n\nIn an infinitely large two-dimensional plane, every lattice point has a soft toy on it. The coordinates (x_i,y_i) of N black rare soft toys are given. All soft toys are considered to be points (without a length, area, or volume).\n\nHe may perform the following operation arbitrarily many times:\n\nPut an axis-aligned square with side length D, rotate the square by 90 degrees with four soft toys on the four corners of the square. More specifically, if the left bottom corner's coordinate is (x, y), rotate four points (x,y) \\rightarrow (x+D,y) \\rightarrow (x+D,y+D) \\rightarrow (x,y+D) \\rightarrow (x,y) in this order. Each of the four corners of the square must be on a lattice point.\n\nLet's define the scatteredness of an arrangement by the minimum side length of an axis-aligned square enclosing all black rare soft toys. Black rare soft toys on the edges or the vertices of a square are considered to be enclosed by the square.\n\nFind the minimum scatteredness after he performs arbitrarily many operations.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq D \\leq 1000\n\n0 \\leq x_i, y_i \\leq 10^9\n\nGiven coordinates are pairwise distinct\n\nAll numbers given in input are integers\n\nPartial Scores\n\n500 points will be awarded for passing the test set satisfying 1 \\leq D \\leq 30.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 1\n0 0\n1 0\n2 0\n\nSample Output 1\n\n1\n\nSample Input 2\n\n19 2\n1 3\n2 3\n0 1\n1 1\n2 1\n3 1\n4 4\n5 4\n6 4\n7 4\n8 4\n8 3\n8 2\n8 1\n8 0\n7 0\n6 0\n5 0\n4 0\n\nSample Output 2\n\n4\n\nSample Input 3\n\n8 3\n0 0\n0 3\n3 0\n3 3\n2 2\n2 5\n5 2\n5 5\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1745, "cpu_time_ms": 341, "memory_kb": 62720}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s627522172", "group_id": "codeNet:p03219", "input_text": "program sample\n\timplicit none\n integer :: a,b\n \n read(*,*) a,b\n write(*,*) a+b/2\n \n stop\nend program sample\n\n\n", "language": "Fortran", "metadata": {"date": 1592635806, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03219.html", "problem_id": "p03219", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03219/input.txt", "sample_output_relpath": "derived/input_output/data/p03219/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03219/Fortran/s627522172.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s627522172", "user_id": "u323210830"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "program sample\n\timplicit none\n integer :: a,b\n \n read(*,*) a,b\n write(*,*) a+b/2\n \n stop\nend program sample\n\n\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "sample_input": "81 58\n"}, "reference_outputs": ["110\n"], "source_document_id": "p03219", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 128, "cpu_time_ms": 6, "memory_kb": 2812}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s258781625", "group_id": "codeNet:p03219", "input_text": "program main\n\timplicit none\n integer::a,b\n read(*,*)a,b\n write(*,*) a+b/2\n stop\nend program main", "language": "Fortran", "metadata": {"date": 1592633391, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03219.html", "problem_id": "p03219", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03219/input.txt", "sample_output_relpath": "derived/input_output/data/p03219/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03219/Fortran/s258781625.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s258781625", "user_id": "u884601206"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "program main\n\timplicit none\n integer::a,b\n read(*,*)a,b\n write(*,*) a+b/2\n stop\nend program main", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "sample_input": "81 58\n"}, "reference_outputs": ["110\n"], "source_document_id": "p03219", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 108, "cpu_time_ms": 6, "memory_kb": 2836}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s976056315", "group_id": "codeNet:p03219", "input_text": "integer a,b\nread*,a,b\nprint\"(I0)\",a+b/2\nend", "language": "Fortran", "metadata": {"date": 1551433714, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03219.html", "problem_id": "p03219", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03219/input.txt", "sample_output_relpath": "derived/input_output/data/p03219/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03219/Fortran/s976056315.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s976056315", "user_id": "u598073939"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "integer a,b\nread*,a,b\nprint\"(I0)\",a+b/2\nend", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "sample_input": "81 58\n"}, "reference_outputs": ["110\n"], "source_document_id": "p03219", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 43, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s208486174", "group_id": "codeNet:p03219", "input_text": "program test\nimplicit none\n\ninteger(8) :: h,w,k,i,j,ans,big=1d9+7\ninteger(8) :: go(0:10,3)=0,br_a(0:10),br_b(0:10),dp(0:200,0:10)=0\n\nread(*,*) h,w,k\n\n!最後に橋あり→a,なし→b\n\nbr_a(0)=0\nbr_b(0)=0\n\nbr_a(1)=0\nbr_b(1)=1\n\ndo i=2,w\n\tbr_a(i) = br_b(i-1)\n\tbr_b(i) = mod(br_b(i-1) + br_a(i-1),big)\nenddo\n\n!左に行く\ndo i=1,w\n\tif(i==1) then\n\t\tgo(i,1) = 0\n\telse\n\t\tgo(i,1) = mod(br_b(i-1) * br_b(w-i+1),big)\n\tendif\nenddo\n\n!右に行く\ndo i=1,w\n\tgo(i,3) = go(w+1-i,1)\nenddo\n\n!どちらでもない\ndo i=1,w\n\tgo(i,2) = mod((br_a(w)+br_b(w)) - go(i,1) - go(i,3),big)\nenddo\n\n!とりあえずDPっしょ\ndp(0,1)=1\ndo i=1,h\n\tdo j=1,w\n\t\tdp(i,j) = mod(dp(i-1,j-1)*go(j-1,3) +dp(i-1,j)*go(j,2) +dp(i-1,j+1)*go(j+1,1),big)\n\tenddo\nenddo\n\nwrite(*,*) dp(h,k)\n\nend program\n", "language": "Fortran", "metadata": {"date": 1551432278, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03219.html", "problem_id": "p03219", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03219/input.txt", "sample_output_relpath": "derived/input_output/data/p03219/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03219/Fortran/s208486174.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s208486174", "user_id": "u454703763"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "program test\nimplicit none\n\ninteger(8) :: h,w,k,i,j,ans,big=1d9+7\ninteger(8) :: go(0:10,3)=0,br_a(0:10),br_b(0:10),dp(0:200,0:10)=0\n\nread(*,*) h,w,k\n\n!最後に橋あり→a,なし→b\n\nbr_a(0)=0\nbr_b(0)=0\n\nbr_a(1)=0\nbr_b(1)=1\n\ndo i=2,w\n\tbr_a(i) = br_b(i-1)\n\tbr_b(i) = mod(br_b(i-1) + br_a(i-1),big)\nenddo\n\n!左に行く\ndo i=1,w\n\tif(i==1) then\n\t\tgo(i,1) = 0\n\telse\n\t\tgo(i,1) = mod(br_b(i-1) * br_b(w-i+1),big)\n\tendif\nenddo\n\n!右に行く\ndo i=1,w\n\tgo(i,3) = go(w+1-i,1)\nenddo\n\n!どちらでもない\ndo i=1,w\n\tgo(i,2) = mod((br_a(w)+br_b(w)) - go(i,1) - go(i,3),big)\nenddo\n\n!とりあえずDPっしょ\ndp(0,1)=1\ndo i=1,h\n\tdo j=1,w\n\t\tdp(i,j) = mod(dp(i-1,j-1)*go(j-1,3) +dp(i-1,j)*go(j,2) +dp(i-1,j+1)*go(j+1,1),big)\n\tenddo\nenddo\n\nwrite(*,*) dp(h,k)\n\nend program\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "sample_input": "81 58\n"}, "reference_outputs": ["110\n"], "source_document_id": "p03219", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 762, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s644911272", "group_id": "codeNet:p03219", "input_text": "program main\n implicit none\n integer :: x, y\n read(*, *) x, y\n write(*, \"(i0)\") x + y / 2\nend program main\n", "language": "Fortran", "metadata": {"date": 1547545598, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03219.html", "problem_id": "p03219", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03219/input.txt", "sample_output_relpath": "derived/input_output/data/p03219/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03219/Fortran/s644911272.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s644911272", "user_id": "u388927326"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "program main\n implicit none\n integer :: x, y\n read(*, *) x, y\n write(*, \"(i0)\") x + y / 2\nend program main\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "sample_input": "81 58\n"}, "reference_outputs": ["110\n"], "source_document_id": "p03219", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a train going from Station A to Station B that costs X yen (the currency of Japan).\n\nAlso, there is a bus going from Station B to Station C that costs Y yen.\n\nJoisino got a special ticket. With this ticket, she can take the bus for half the fare if she travels from Station A to Station B by train and then travels from Station B to Station C by bus.\n\nHow much does it cost to travel from Station A to Station C if she uses this ticket?\n\nConstraints\n\n1 \\leq X,Y \\leq 100\n\nY is an even number.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf it costs x yen to travel from Station A to Station C, print x.\n\nSample Input 1\n\n81 58\n\nSample Output 1\n\n110\n\nThe train fare is 81 yen.\n\nThe train fare is 58 ⁄ 2=29 yen with the 50% discount.\n\nThus, it costs 110 yen to travel from Station A to Station C.\n\nSample Input 2\n\n4 54\n\nSample Output 2\n\n31", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 111, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s644664254", "group_id": "codeNet:p03222", "input_text": "program number_of_amidakuji\n implicit none\n integer(8), parameter :: md = 1000000007_8\n integer :: h, w, k, i, j\n integer(8) :: dp(0:100,0:9) = 0_8, f(-1:9) = 0_8\n dp(0,1) = 1_8\n f(0) = 1_8\n read(*,*) h, w, k\n do i = 1, w\n f(i) = mod(f(i-1)+f(i-2),md)\n end do\n do i = 1, h\n do j = 1, w\n dp(i,j) = mod(mod(f(j-2)*f(w-j)*dp(i-1,j-1),md) &\n & +mod(f(j-1)*f(w-j)*dp(i-1,j),md)+mod(f(j-1)*f(w-j-1)*dp(i-1,j+1),md),md)\n end do\n end do\n write(*,'(i0)') dp(h,k)\nend program number_of_amidakuji", "language": "Fortran", "metadata": {"date": 1569517505, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03222.html", "problem_id": "p03222", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03222/input.txt", "sample_output_relpath": "derived/input_output/data/p03222/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03222/Fortran/s644664254.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s644664254", "user_id": "u506403362"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program number_of_amidakuji\n implicit none\n integer(8), parameter :: md = 1000000007_8\n integer :: h, w, k, i, j\n integer(8) :: dp(0:100,0:9) = 0_8, f(-1:9) = 0_8\n dp(0,1) = 1_8\n f(0) = 1_8\n read(*,*) h, w, k\n do i = 1, w\n f(i) = mod(f(i-1)+f(i-2),md)\n end do\n do i = 1, h\n do j = 1, w\n dp(i,j) = mod(mod(f(j-2)*f(w-j)*dp(i-1,j-1),md) &\n & +mod(f(j-1)*f(w-j)*dp(i-1,j),md)+mod(f(j-1)*f(w-j-1)*dp(i-1,j+1),md),md)\n end do\n end do\n write(*,'(i0)') dp(h,k)\nend program number_of_amidakuji", "problem_context": "Score: 400 points\n\nProblem Statement\n\nAmidakuji is a traditional method of lottery in Japan.\n\nTo make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 [cm], and the endpoints of the horizontal lines must be at 1, 2, 3, ..., or H [cm] from the top of a vertical line.\n\nA valid amidakuji is an amidakuji that satisfies the following conditions:\n\nNo two horizontal lines share an endpoint.\n\nThe two endpoints of each horizontal lines must be at the same height.\n\nA horizontal line must connect adjacent vertical lines.\n\nFind the number of the valid amidakuji that satisfy the following condition, modulo 1\\ 000\\ 000\\ 007: if we trace the path from the top of the leftmost vertical line to the bottom, always following horizontal lines when we encounter them, we reach the bottom of the K-th vertical line from the left.\n\nFor example, in the following amidakuji, we will reach the bottom of the fourth vertical line from the left.\n\nConstraints\n\nH is an integer between 1 and 100 (inclusive).\n\nW is an integer between 1 and 8 (inclusive).\n\nK is an integer between 1 and W (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\n\nOutput\n\nPrint the number of the amidakuji that satisfy the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n1 3 2\n\nSample Output 1\n\n1\n\nOnly the following one amidakuji satisfies the condition:\n\nSample Input 2\n\n1 3 1\n\nSample Output 2\n\n2\n\nOnly the following two amidakuji satisfy the condition:\n\nSample Input 3\n\n2 3 3\n\nSample Output 3\n\n1\n\nOnly the following one amidakuji satisfies the condition:\n\nSample Input 4\n\n2 3 1\n\nSample Output 4\n\n5\n\nOnly the following five amidakuji satisfy the condition:\n\nSample Input 5\n\n7 1 1\n\nSample Output 5\n\n1\n\nAs there is only one vertical line, we cannot draw any horizontal lines. Thus, there is only one amidakuji that satisfies the condition: the amidakuji with no horizontal lines.\n\nSample Input 6\n\n15 8 5\n\nSample Output 6\n\n437760187\n\nBe sure to print the answer modulo 1\\ 000\\ 000\\ 007.", "sample_input": "1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03222", "source_text": "Score: 400 points\n\nProblem Statement\n\nAmidakuji is a traditional method of lottery in Japan.\n\nTo make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 [cm], and the endpoints of the horizontal lines must be at 1, 2, 3, ..., or H [cm] from the top of a vertical line.\n\nA valid amidakuji is an amidakuji that satisfies the following conditions:\n\nNo two horizontal lines share an endpoint.\n\nThe two endpoints of each horizontal lines must be at the same height.\n\nA horizontal line must connect adjacent vertical lines.\n\nFind the number of the valid amidakuji that satisfy the following condition, modulo 1\\ 000\\ 000\\ 007: if we trace the path from the top of the leftmost vertical line to the bottom, always following horizontal lines when we encounter them, we reach the bottom of the K-th vertical line from the left.\n\nFor example, in the following amidakuji, we will reach the bottom of the fourth vertical line from the left.\n\nConstraints\n\nH is an integer between 1 and 100 (inclusive).\n\nW is an integer between 1 and 8 (inclusive).\n\nK is an integer between 1 and W (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W K\n\nOutput\n\nPrint the number of the amidakuji that satisfy the condition, modulo 1\\ 000\\ 000\\ 007.\n\nSample Input 1\n\n1 3 2\n\nSample Output 1\n\n1\n\nOnly the following one amidakuji satisfies the condition:\n\nSample Input 2\n\n1 3 1\n\nSample Output 2\n\n2\n\nOnly the following two amidakuji satisfy the condition:\n\nSample Input 3\n\n2 3 3\n\nSample Output 3\n\n1\n\nOnly the following one amidakuji satisfies the condition:\n\nSample Input 4\n\n2 3 1\n\nSample Output 4\n\n5\n\nOnly the following five amidakuji satisfy the condition:\n\nSample Input 5\n\n7 1 1\n\nSample Output 5\n\n1\n\nAs there is only one vertical line, we cannot draw any horizontal lines. Thus, there is only one amidakuji that satisfies the condition: the amidakuji with no horizontal lines.\n\nSample Input 6\n\n15 8 5\n\nSample Output 6\n\n437760187\n\nBe sure to print the answer modulo 1\\ 000\\ 000\\ 007.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 516, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s041006399", "group_id": "codeNet:p03227", "input_text": "character s*3\nread*,s\nif(len_trim(s)==2) then\n\tprint*, s\nelse\n\tprint*,s(3:3),s(2:2),s(1:1)\nend if\nend", "language": "Fortran", "metadata": {"date": 1571910926, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03227.html", "problem_id": "p03227", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03227/input.txt", "sample_output_relpath": "derived/input_output/data/p03227/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03227/Fortran/s041006399.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s041006399", "user_id": "u244203620"}, "prompt_components": {"gold_output": "cba\n", "input_to_evaluate": "character s*3\nread*,s\nif(len_trim(s)==2) then\n\tprint*, s\nelse\n\tprint*,s(3:3),s(2:2),s(1:1)\nend if\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it.\n\nConstraints\n\nThe length of S is 2 or 3.\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf the length of S is 2, print S as is; if the length is 3, print S after reversing it.\n\nSample Input 1\n\nabc\n\nSample Output 1\n\ncba\n\nAs the length of S is 3, we print it after reversing it.\n\nSample Input 2\n\nac\n\nSample Output 2\n\nac\n\nAs the length of S is 2, we print it as is.", "sample_input": "abc\n"}, "reference_outputs": ["cba\n"], "source_document_id": "p03227", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length 2 or 3 consisting of lowercase English letters. If the length of the string is 2, print it as is; if the length is 3, print the string after reversing it.\n\nConstraints\n\nThe length of S is 2 or 3.\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf the length of S is 2, print S as is; if the length is 3, print S after reversing it.\n\nSample Input 1\n\nabc\n\nSample Output 1\n\ncba\n\nAs the length of S is 3, we print it after reversing it.\n\nSample Input 2\n\nac\n\nSample Output 2\n\nac\n\nAs the length of S is 2, we print it as is.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 101, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s307081010", "group_id": "codeNet:p03228", "input_text": "program main\nimplicit None\n\tinteger(8)::a,b,k,i\n\t\n\tread *,a,b,k\n\t\n\tdo i = 1,k\n\t\tif(mod(i,2) == 1)then\n\t\t\ta = a/2\n\t\t\tb = b + a\n\t\t\telse\n\t\t\tb = b/2\n\t\t\ta = a + b\n\t\tendif\n\tenddo\n\t\n\tprint 101,a,b\n\t\n101 format(i0,1x,i0)\nend program main\n", "language": "Fortran", "metadata": {"date": 1540689730, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03228.html", "problem_id": "p03228", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03228/input.txt", "sample_output_relpath": "derived/input_output/data/p03228/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03228/Fortran/s307081010.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s307081010", "user_id": "u900266249"}, "prompt_components": {"gold_output": "5 3\n", "input_to_evaluate": "program main\nimplicit None\n\tinteger(8)::a,b,k,i\n\t\n\tread *,a,b,k\n\t\n\tdo i = 1,k\n\t\tif(mod(i,2) == 1)then\n\t\t\ta = a/2\n\t\t\tb = b + a\n\t\t\telse\n\t\t\tb = b/2\n\t\t\ta = a + b\n\t\tendif\n\tenddo\n\t\n\tprint 101,a,b\n\t\n101 format(i0,1x,i0)\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn the beginning, Takahashi has A cookies, and Aoki has B cookies.\nThey will perform the following operation alternately, starting from Takahashi:\n\nIf the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other person.\n\nFind the numbers of cookies Takahashi and Aoki respectively have after performing K operations in total.\n\nConstraints\n\n1 \\leq A,B \\leq 10^9\n\n1 \\leq K \\leq 100\n\nA,B and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the number of cookies Takahashi has, and the number of cookies Aoki has, in this order, after performing K operations in total.\n\nSample Input 1\n\n5 4 2\n\nSample Output 1\n\n5 3\n\nThe process will go as follows:\n\nIn the beginning, Takahashi and Aoki have 5 and 4 cookies, respectively.\n\nTakahashi eats one cookie and gives two cookies to Aoki. They now have 2 and 6 cookies, respectively.\n\nAoki gives three cookies to Takahashi. They now have 5 and 3 cookies, respectively.\n\nSample Input 2\n\n3 3 3\n\nSample Output 2\n\n1 3\n\nSample Input 3\n\n314159265 358979323 84\n\nSample Output 3\n\n448759046 224379523", "sample_input": "5 4 2\n"}, "reference_outputs": ["5 3\n"], "source_document_id": "p03228", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn the beginning, Takahashi has A cookies, and Aoki has B cookies.\nThey will perform the following operation alternately, starting from Takahashi:\n\nIf the number of cookies in his hand is odd, eat one of those cookies; if the number is even, do nothing. Then, give one-half of the cookies in his hand to the other person.\n\nFind the numbers of cookies Takahashi and Aoki respectively have after performing K operations in total.\n\nConstraints\n\n1 \\leq A,B \\leq 10^9\n\n1 \\leq K \\leq 100\n\nA,B and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint the number of cookies Takahashi has, and the number of cookies Aoki has, in this order, after performing K operations in total.\n\nSample Input 1\n\n5 4 2\n\nSample Output 1\n\n5 3\n\nThe process will go as follows:\n\nIn the beginning, Takahashi and Aoki have 5 and 4 cookies, respectively.\n\nTakahashi eats one cookie and gives two cookies to Aoki. They now have 2 and 6 cookies, respectively.\n\nAoki gives three cookies to Takahashi. They now have 5 and 3 cookies, respectively.\n\nSample Input 2\n\n3 3 3\n\nSample Output 2\n\n1 3\n\nSample Input 3\n\n314159265 358979323 84\n\nSample Output 3\n\n448759046 224379523", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 230, "cpu_time_ms": 4, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s705026114", "group_id": "codeNet:p03229", "input_text": "program prob6\n implicit none\n integer :: N\n integer(8), allocatable :: A(:)\n integer(8) :: ans, tmp\n integer :: i\n read(*,*) N\n allocate(A(N))\n \n do i = 1, N\n read(*,*) A(i)\n end do\n\n call msort(A)\n\n ans = 0\n if(mod(N, 2) == 1)then\n do i = 1, N/2\n ans = ans - 2 * A(i)\n end do\n ans = ans + A(N/2+1)\n ans = ans + A(N/2+2)\n do i = N/2+3, N\n ans = ans + 2 * A(i)\n end do\n\n do i = 1, N/2 -1\n tmp = tmp - 2 * A(i)\n end do\n tmp = tmp - A(N/2)\n tmp = tmp - A(N/2+1)\n do i = N/2+2, N\n tmp = tmp + 2 * A(i)\n end do \n ans = max(tmp, ans) \n else\n do i = 1, N/2 -1\n ans = ans - 2 * A(i)\n end do\n ans = ans - A(N/2)\n ans = ans + A(N/2+1)\n do i = N/2+2, N\n ans = ans + 2 * A(i)\n end do \n end if\n\n write(*,*) ans\n\n deallocate(A)\n stop\ncontains\n\n !\n ! swap two arguments\n !\nsubroutine swap(a, b)\n implicit none\n integer(8), intent(inout) :: a, b\n\n integer(8) :: c\n\n c = a\n a = b\n b = c\n\n end subroutine swap\n\n !\n ! merge sort\n !\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n\n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n\n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n\n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n\n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n\n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n\n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\n\nend program prob6", "language": "Fortran", "metadata": {"date": 1593827023, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03229.html", "problem_id": "p03229", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03229/input.txt", "sample_output_relpath": "derived/input_output/data/p03229/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03229/Fortran/s705026114.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s705026114", "user_id": "u478462004"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "program prob6\n implicit none\n integer :: N\n integer(8), allocatable :: A(:)\n integer(8) :: ans, tmp\n integer :: i\n read(*,*) N\n allocate(A(N))\n \n do i = 1, N\n read(*,*) A(i)\n end do\n\n call msort(A)\n\n ans = 0\n if(mod(N, 2) == 1)then\n do i = 1, N/2\n ans = ans - 2 * A(i)\n end do\n ans = ans + A(N/2+1)\n ans = ans + A(N/2+2)\n do i = N/2+3, N\n ans = ans + 2 * A(i)\n end do\n\n do i = 1, N/2 -1\n tmp = tmp - 2 * A(i)\n end do\n tmp = tmp - A(N/2)\n tmp = tmp - A(N/2+1)\n do i = N/2+2, N\n tmp = tmp + 2 * A(i)\n end do \n ans = max(tmp, ans) \n else\n do i = 1, N/2 -1\n ans = ans - 2 * A(i)\n end do\n ans = ans - A(N/2)\n ans = ans + A(N/2+1)\n do i = N/2+2, N\n ans = ans + 2 * A(i)\n end do \n end if\n\n write(*,*) ans\n\n deallocate(A)\n stop\ncontains\n\n !\n ! swap two arguments\n !\nsubroutine swap(a, b)\n implicit none\n integer(8), intent(inout) :: a, b\n\n integer(8) :: c\n\n c = a\n a = b\n b = c\n\n end subroutine swap\n\n !\n ! merge sort\n !\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n\n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n\n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n\n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n\n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n\n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n\n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\n\nend program prob6", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03229", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2493, "cpu_time_ms": 61, "memory_kb": 4388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s426675103", "group_id": "codeNet:p03229", "input_text": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\n\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\nprogram tenka1_2018_c\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int64):: n,i,d1,d2,ans=0\n integer(int64), allocatable:: a(:),sa(:),ba(:)\n\n read*, n\n allocate(a(n),sa(n/2),ba(n/2))\n do i=1,n\n read*, a(i)\n end do\n\n call merge_sort(a,1_8,n)\n\n sa = a(1:n/2)\n ba = a(n-n/2+1:n)\n ans = sum(abs(sa-ba))\n d1 = sum(abs(sa(1:size(sa)-1)-ba(2:size(ba))))\n d2 = sum(abs(sa(2:size(sa))-ba(1:size(ba)-1)))\n\n if (mod(n,2_8) == 1)then\n d1=d1+max(abs(sa(size(sa))-a(n/2+1)), abs(ba(1)-a(n/2+1)))\n d2=d2+max(abs(sa(1)-a(n/2+1)), abs(ba(size(ba))-a(n/2+1)))\n end if\n \n print'(*(i0,1x))', ans+max(d1,d2)\n\n \nend program tenka1_2018_c", "language": "Fortran", "metadata": {"date": 1591587993, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03229.html", "problem_id": "p03229", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03229/input.txt", "sample_output_relpath": "derived/input_output/data/p03229/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03229/Fortran/s426675103.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s426675103", "user_id": "u234636620"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\n\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\nprogram tenka1_2018_c\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int64):: n,i,d1,d2,ans=0\n integer(int64), allocatable:: a(:),sa(:),ba(:)\n\n read*, n\n allocate(a(n),sa(n/2),ba(n/2))\n do i=1,n\n read*, a(i)\n end do\n\n call merge_sort(a,1_8,n)\n\n sa = a(1:n/2)\n ba = a(n-n/2+1:n)\n ans = sum(abs(sa-ba))\n d1 = sum(abs(sa(1:size(sa)-1)-ba(2:size(ba))))\n d2 = sum(abs(sa(2:size(sa))-ba(1:size(ba)-1)))\n\n if (mod(n,2_8) == 1)then\n d1=d1+max(abs(sa(size(sa))-a(n/2+1)), abs(ba(1)-a(n/2+1)))\n d2=d2+max(abs(sa(1)-a(n/2+1)), abs(ba(size(ba))-a(n/2+1)))\n end if\n \n print'(*(i0,1x))', ans+max(d1,d2)\n\n \nend program tenka1_2018_c", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03229", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6890, "cpu_time_ms": 61, "memory_kb": 2468}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s167681483", "group_id": "codeNet:p03229", "input_text": "program align\n implicit none\n integer :: n, a(100000) = 0, b(100000) = 0, i, j\n integer(8) :: x = 0_8, y\n read(*,*) n\n do i = 1, n\n read(*,*) a(i)\n end do\n call quick_sort(a(1:n))\n do j = 1, 2\n b(1) = a((n+1)/2)\n do i = 1, n-1\n if (mod(i,2) == 0) then\n b(i+1) = a(i/2)\n else\n b(i+1) = a(n-i/2)\n end if\n end do\n y = 0_8\n do i = 1, n-1\n y = y+abs(b(i)-b(i+1))\n end do\n x = max(x,y)\n a(1:n) = a(n:1:-1)\n end do\n write(*,'(i0)') x\ncontains\n recursive subroutine quick_sort(a)\n integer, intent(inout) :: a(:)\n integer :: n, l, r, m\n integer :: p\n n = size(a)\n l = 1\n r = n\n m = (n+1)/2\n p = a(l)+a(m)+a(r)-max(a(l),a(m),a(r))-min(a(l),a(m),a(r))\n do\n do while (a(l) < p)\n l = l+1\n end do\n do while (a(r) > p)\n r = r-1\n end do\n if (l >= r) exit\n a(l) = xor(a(l),a(r))\n a(r) = xor(a(l),a(r))\n a(l) = xor(a(l),a(r))\n l = l+1\n r = r-1\n end do\n if (l-1 > 1) call quick_sort(a(1:l-1))\n if (n > r+1) call quick_sort(a(r+1:n))\n end\nend program align", "language": "Fortran", "metadata": {"date": 1569482682, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03229.html", "problem_id": "p03229", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03229/input.txt", "sample_output_relpath": "derived/input_output/data/p03229/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03229/Fortran/s167681483.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s167681483", "user_id": "u506403362"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "program align\n implicit none\n integer :: n, a(100000) = 0, b(100000) = 0, i, j\n integer(8) :: x = 0_8, y\n read(*,*) n\n do i = 1, n\n read(*,*) a(i)\n end do\n call quick_sort(a(1:n))\n do j = 1, 2\n b(1) = a((n+1)/2)\n do i = 1, n-1\n if (mod(i,2) == 0) then\n b(i+1) = a(i/2)\n else\n b(i+1) = a(n-i/2)\n end if\n end do\n y = 0_8\n do i = 1, n-1\n y = y+abs(b(i)-b(i+1))\n end do\n x = max(x,y)\n a(1:n) = a(n:1:-1)\n end do\n write(*,'(i0)') x\ncontains\n recursive subroutine quick_sort(a)\n integer, intent(inout) :: a(:)\n integer :: n, l, r, m\n integer :: p\n n = size(a)\n l = 1\n r = n\n m = (n+1)/2\n p = a(l)+a(m)+a(r)-max(a(l),a(m),a(r))-min(a(l),a(m),a(r))\n do\n do while (a(l) < p)\n l = l+1\n end do\n do while (a(r) > p)\n r = r-1\n end do\n if (l >= r) exit\n a(l) = xor(a(l),a(r))\n a(r) = xor(a(l),a(r))\n a(l) = xor(a(l),a(r))\n l = l+1\n r = r-1\n end do\n if (l-1 > 1) call quick_sort(a(1:l-1))\n if (n > r+1) call quick_sort(a(r+1:n))\n end\nend program align", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03229", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1109, "cpu_time_ms": 53, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s860311034", "group_id": "codeNet:p03229", "input_text": "program test\nimplicit none\n\ninteger(8) :: n,a(200000),dummy(200000)=0,i,j,ans,k,ans1,ans2,ans3\n\nread(*,*) n\ndo i=1,n\n\tread(*,*) a(i)\nenddo\n\ncall heapsort_down(n,a(1:n),dummy(1:n))\n\nif(n==2)then\n\tans = abs(a(2)-a(1))\nelse if(n==3) then\n\tans1 = abs(a(1)-a(2))+abs(a(2)-a(3))\n\tans2 = abs(a(1)-a(3))+abs(a(3)-a(2))\n\tans3 = abs(a(3)-a(1))+abs(a(1)-a(2))\n\tans = max(ans1,ans2,ans3)\nelse if(mod(n,2)==0) then !偶数\n\tk = n/2\n\tans = 2*sum(a(1:k-1)) + a(k) - a(k+1) -2*sum(a(k+2:n))\nelse !奇数\n\tk = (n-1)/2\n\tans = 2*sum(a(1:k)) - a(k+1) - a(k+2) -2*sum(a(k+3:n))\n\tans = ans / 0\nendif\n\nwrite(*,*) ans\n\ncontains\nsubroutine heapsort_down(n,y1,y2)\n \n\timplicit none\n\tinteger(8),intent(in) :: n\n\tinteger(8),intent(inout) :: y1(1:n)\n\tinteger(8),intent(inout) :: y2(1:n)\n\tinteger(8) :: i,k,j,l\n\tinteger(8) :: t1,t2\n\t\n\tl = n/2+1\n\tk = n\n \n\tdo while (k /= 1)\n\t\t if(l > 1) then\n\t\t\t\tl = l-1\n\t\t\t\tt1 = y1(l)\n\t\t\t\tt2 = y2(l)\n\t\t\t\t\n\t\t else\n\t\t\t\tt1 = y1(k)\n\t\t\t\tt2 = y2(k)\n\t\t\t\ty1(k) = y1(1)\n\t\t\t\ty2(k) = y2(1)\n\t\t\t\tk = k-1\n\t\t\t\tif(k == 1) then\n\t\t\t\t\t y1(1) = t1\n\t\t\t\t\t y2(1) = t2\n\t\t\t\t\t exit\n\t\t\t\tendif\n\t\t endif\n \n\t\t i = l\n\t\t j = l+l\n \n\t\t do while(j <= k)\n\t\t\t\tif(j < k) then\n\t\t\t\t\t if(y1(j) > y1(j+1)) j = j+1\n\t\t\t\tendif\n\t\t\t\t\n\t\t\t\tif (t1 > y1(j)) then\n\t\t\t\t\t y1(i) = y1(j)\n\t\t\t\t\t y2(i) = y2(j)\n\t\t\t\t\t i = j\n\t\t\t\t\t j = j+j\n\t\t\t\telse\n\t\t\t\t\t j = k+1\n\t\t\t\tendif\n\t\t \n\t\t enddo\n\t\t \n\t\t y1(i) = t1\n\t\t y2(i) = t2\n\t\n\tenddo\n\treturn\n \nend subroutine heapsort_down\n \nsubroutine heapsort_up(n,y1,y2)\n \n\timplicit none\n\tinteger(8),intent(in) :: n\n\tinteger(8),intent(inout) :: y1(1:n)\n\tinteger(8),intent(inout) :: y2(1:n)\n\tinteger(8) :: i,k,j,l\n\tinteger(8) :: t1,t2\n\t\n\tl = n/2+1\n\tk = n\n \n\tdo while (k /= 1)\n\t\t if(l > 1) then\n\t\t\t\tl = l-1\n\t\t\t\tt1 = y1(l)\n\t\t\t\tt2 = y2(l)\n\t\t\t\t\n\t\t else\n\t\t\t\tt1 = y1(k)\n\t\t\t\tt2 = y2(k)\n\t\t\t\ty1(k) = y1(1)\n\t\t\t\ty2(k) = y2(1)\n\t\t\t\tk = k-1\n\t\t\t\tif(k == 1) then\n\t\t\t\t\t y1(1) = t1\n\t\t\t\t\t y2(1) = t2\n\t\t\t\t\t exit\n\t\t\t\tendif\n\t\t endif\n \n\t\t i = l\n\t\t j = l+l\n \n\t\t do while(j <= k)\n\t\t\t\tif(j < k) then\n\t\t\t\t\t if(y1(j) < y1(j+1)) j = j+1\n\t\t\t\tendif\n\t\t\t\t\n\t\t\t\tif (t1 < y1(j)) then\n\t\t\t\t\t y1(i) = y1(j)\n\t\t\t\t\t y2(i) = y2(j)\n\t\t\t\t\t i = j\n\t\t\t\t\t j = j+j\n\t\t\t\telse\n\t\t\t\t\t j = k+1\n\t\t\t\tendif\n\t\t \n\t\t enddo\n\t\t \n\t\t y1(i) = t1\n\t\t y2(i) = t2\n\t\n\tenddo\n\treturn\n \nend subroutine heapsort_up\n\nend program", "language": "Fortran", "metadata": {"date": 1551848252, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03229.html", "problem_id": "p03229", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03229/input.txt", "sample_output_relpath": "derived/input_output/data/p03229/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03229/Fortran/s860311034.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s860311034", "user_id": "u454703763"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "program test\nimplicit none\n\ninteger(8) :: n,a(200000),dummy(200000)=0,i,j,ans,k,ans1,ans2,ans3\n\nread(*,*) n\ndo i=1,n\n\tread(*,*) a(i)\nenddo\n\ncall heapsort_down(n,a(1:n),dummy(1:n))\n\nif(n==2)then\n\tans = abs(a(2)-a(1))\nelse if(n==3) then\n\tans1 = abs(a(1)-a(2))+abs(a(2)-a(3))\n\tans2 = abs(a(1)-a(3))+abs(a(3)-a(2))\n\tans3 = abs(a(3)-a(1))+abs(a(1)-a(2))\n\tans = max(ans1,ans2,ans3)\nelse if(mod(n,2)==0) then !偶数\n\tk = n/2\n\tans = 2*sum(a(1:k-1)) + a(k) - a(k+1) -2*sum(a(k+2:n))\nelse !奇数\n\tk = (n-1)/2\n\tans = 2*sum(a(1:k)) - a(k+1) - a(k+2) -2*sum(a(k+3:n))\n\tans = ans / 0\nendif\n\nwrite(*,*) ans\n\ncontains\nsubroutine heapsort_down(n,y1,y2)\n \n\timplicit none\n\tinteger(8),intent(in) :: n\n\tinteger(8),intent(inout) :: y1(1:n)\n\tinteger(8),intent(inout) :: y2(1:n)\n\tinteger(8) :: i,k,j,l\n\tinteger(8) :: t1,t2\n\t\n\tl = n/2+1\n\tk = n\n \n\tdo while (k /= 1)\n\t\t if(l > 1) then\n\t\t\t\tl = l-1\n\t\t\t\tt1 = y1(l)\n\t\t\t\tt2 = y2(l)\n\t\t\t\t\n\t\t else\n\t\t\t\tt1 = y1(k)\n\t\t\t\tt2 = y2(k)\n\t\t\t\ty1(k) = y1(1)\n\t\t\t\ty2(k) = y2(1)\n\t\t\t\tk = k-1\n\t\t\t\tif(k == 1) then\n\t\t\t\t\t y1(1) = t1\n\t\t\t\t\t y2(1) = t2\n\t\t\t\t\t exit\n\t\t\t\tendif\n\t\t endif\n \n\t\t i = l\n\t\t j = l+l\n \n\t\t do while(j <= k)\n\t\t\t\tif(j < k) then\n\t\t\t\t\t if(y1(j) > y1(j+1)) j = j+1\n\t\t\t\tendif\n\t\t\t\t\n\t\t\t\tif (t1 > y1(j)) then\n\t\t\t\t\t y1(i) = y1(j)\n\t\t\t\t\t y2(i) = y2(j)\n\t\t\t\t\t i = j\n\t\t\t\t\t j = j+j\n\t\t\t\telse\n\t\t\t\t\t j = k+1\n\t\t\t\tendif\n\t\t \n\t\t enddo\n\t\t \n\t\t y1(i) = t1\n\t\t y2(i) = t2\n\t\n\tenddo\n\treturn\n \nend subroutine heapsort_down\n \nsubroutine heapsort_up(n,y1,y2)\n \n\timplicit none\n\tinteger(8),intent(in) :: n\n\tinteger(8),intent(inout) :: y1(1:n)\n\tinteger(8),intent(inout) :: y2(1:n)\n\tinteger(8) :: i,k,j,l\n\tinteger(8) :: t1,t2\n\t\n\tl = n/2+1\n\tk = n\n \n\tdo while (k /= 1)\n\t\t if(l > 1) then\n\t\t\t\tl = l-1\n\t\t\t\tt1 = y1(l)\n\t\t\t\tt2 = y2(l)\n\t\t\t\t\n\t\t else\n\t\t\t\tt1 = y1(k)\n\t\t\t\tt2 = y2(k)\n\t\t\t\ty1(k) = y1(1)\n\t\t\t\ty2(k) = y2(1)\n\t\t\t\tk = k-1\n\t\t\t\tif(k == 1) then\n\t\t\t\t\t y1(1) = t1\n\t\t\t\t\t y2(1) = t2\n\t\t\t\t\t exit\n\t\t\t\tendif\n\t\t endif\n \n\t\t i = l\n\t\t j = l+l\n \n\t\t do while(j <= k)\n\t\t\t\tif(j < k) then\n\t\t\t\t\t if(y1(j) < y1(j+1)) j = j+1\n\t\t\t\tendif\n\t\t\t\t\n\t\t\t\tif (t1 < y1(j)) then\n\t\t\t\t\t y1(i) = y1(j)\n\t\t\t\t\t y2(i) = y2(j)\n\t\t\t\t\t i = j\n\t\t\t\t\t j = j+j\n\t\t\t\telse\n\t\t\t\t\t j = k+1\n\t\t\t\tendif\n\t\t \n\t\t enddo\n\t\t \n\t\t y1(i) = t1\n\t\t y2(i) = t2\n\t\n\tenddo\n\treturn\n \nend subroutine heapsort_up\n\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "sample_input": "5\n6\n8\n1\n2\n3\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03229", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N integers; the i-th of them is A_i.\nFind the maximum possible sum of the absolute differences between the adjacent elements after arranging these integers in a row in any order you like.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint the maximum possible sum of the absolute differences between the adjacent elements after arranging the given integers in a row in any order you like.\n\nSample Input 1\n\n5\n6\n8\n1\n2\n3\n\nSample Output 1\n\n21\n\nWhen the integers are arranged as 3,8,1,6,2, the sum of the absolute differences between the adjacent elements is |3 - 8| + |8 - 1| + |1 - 6| + |6 - 2| = 21. This is the maximum possible sum.\n\nSample Input 2\n\n6\n3\n1\n4\n1\n5\n9\n\nSample Output 2\n\n25\n\nSample Input 3\n\n3\n5\n5\n1\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2218, "cpu_time_ms": 159, "memory_kb": 2264}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s380415735", "group_id": "codeNet:p03238", "input_text": "program jihanki\n implicit none\n integer :: n\n integer :: a,b\n\n read(*,*)n\n if (n==1) then\n write(*,*)'Hello World'\n else\n read(*,*)a\n read(*,*)b\n write(*,*)a+b\n end if\n\nend program jihanki", "language": "Fortran", "metadata": {"date": 1551910477, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03238.html", "problem_id": "p03238", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03238/input.txt", "sample_output_relpath": "derived/input_output/data/p03238/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03238/Fortran/s380415735.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s380415735", "user_id": "u508570129"}, "prompt_components": {"gold_output": "Hello World\n", "input_to_evaluate": "program jihanki\n implicit none\n integer :: n\n integer :: a,b\n\n read(*,*)n\n if (n==1) then\n write(*,*)'Hello World'\n else\n read(*,*)a\n read(*,*)b\n write(*,*)a+b\n end if\n\nend program jihanki", "problem_context": "Score: 100 points\n\nProblem Statement\n\nIn 2020, AtCoder Inc. with an annual sales of more than one billion yen (the currency of Japan) has started a business in programming education.\n\nOne day, there was an exam where a one-year-old child must write a program that prints Hello World, and a two-year-old child must write a program that receives integers A, B and prints A+B.\n\nTakahashi, who is taking this exam, suddenly forgets his age.\n\nHe decides to write a program that first receives his age N (1 or 2) as input, then prints Hello World if N=1, and additionally receives integers A, B and prints A+B if N=2.\n\nWrite this program for him.\n\nConstraints\n\nN is 1 or 2.\n\nA is an integer between 1 and 9 (inclusive).\n\nB is an integer between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in one of the following formats:\n\n1\n\n2\nA\nB\n\nOutput\n\nIf N=1, print Hello World; if N=2, print A+B.\n\nSample Input 1\n\n1\n\nSample Output 1\n\nHello World\n\nAs N=1, Takahashi is one year old. Thus, we should print Hello World.\n\nSample Input 2\n\n2\n3\n5\n\nSample Output 2\n\n8\n\nAs N=2, Takahashi is two years old. Thus, we should print A+B, which is 8 since A=3 and B=5.", "sample_input": "1\n"}, "reference_outputs": ["Hello World\n"], "source_document_id": "p03238", "source_text": "Score: 100 points\n\nProblem Statement\n\nIn 2020, AtCoder Inc. with an annual sales of more than one billion yen (the currency of Japan) has started a business in programming education.\n\nOne day, there was an exam where a one-year-old child must write a program that prints Hello World, and a two-year-old child must write a program that receives integers A, B and prints A+B.\n\nTakahashi, who is taking this exam, suddenly forgets his age.\n\nHe decides to write a program that first receives his age N (1 or 2) as input, then prints Hello World if N=1, and additionally receives integers A, B and prints A+B if N=2.\n\nWrite this program for him.\n\nConstraints\n\nN is 1 or 2.\n\nA is an integer between 1 and 9 (inclusive).\n\nB is an integer between 1 and 9 (inclusive).\n\nInput\n\nInput is given from Standard Input in one of the following formats:\n\n1\n\n2\nA\nB\n\nOutput\n\nIf N=1, print Hello World; if N=2, print A+B.\n\nSample Input 1\n\n1\n\nSample Output 1\n\nHello World\n\nAs N=1, Takahashi is one year old. Thus, we should print Hello World.\n\nSample Input 2\n\n2\n3\n5\n\nSample Output 2\n\n8\n\nAs N=2, Takahashi is two years old. Thus, we should print A+B, which is 8 since A=3 and B=5.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 211, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s719332855", "group_id": "codeNet:p03239", "input_text": "program main\n implicit none\n \n integer :: i,j,n,tt,c(100),t(100),chk=0,big = 100000,best\n \n read(*,*)n,tt\n do i = 1, n\n read(*,*)c(i),t(i)\n if (t(i) <= tt) then\n chk = 1\n end if\n end do\n if (chk == 0) then\n write(*,*)'TLE'\n stop\n end if\n \n do i = 1, n\n if (t(i) > tt) then\n cycle\n end if\n if (c(i) < big) then\n big = c(i)\n best = i\n end if\n end do\n write(*,*)big\nend program main", "language": "Fortran", "metadata": {"date": 1570804866, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03239.html", "problem_id": "p03239", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03239/input.txt", "sample_output_relpath": "derived/input_output/data/p03239/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03239/Fortran/s719332855.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s719332855", "user_id": "u287431190"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main\n implicit none\n \n integer :: i,j,n,tt,c(100),t(100),chk=0,big = 100000,best\n \n read(*,*)n,tt\n do i = 1, n\n read(*,*)c(i),t(i)\n if (t(i) <= tt) then\n chk = 1\n end if\n end do\n if (chk == 0) then\n write(*,*)'TLE'\n stop\n end if\n \n do i = 1, n\n if (t(i) > tt) then\n cycle\n end if\n if (c(i) < big) then\n big = c(i)\n best = i\n end if\n end do\n write(*,*)big\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWhen Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.\n\nYou, the smartwatch, has found N routes to his home.\n\nIf Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.\n\nFind the smallest cost of a route that takes not longer than time T.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq T \\leq 1000\n\n1 \\leq c_i \\leq 1000\n\n1 \\leq t_i \\leq 1000\n\nThe pairs (c_i, t_i) are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\nc_1 t_1\nc_2 t_2\n:\nc_N t_N\n\nOutput\n\nPrint the smallest cost of a route that takes not longer than time T.\n\nIf there is no route that takes not longer than time T, print TLE instead.\n\nSample Input 1\n\n3 70\n7 60\n1 80\n4 50\n\nSample Output 1\n\n4\n\nThe first route gets him home at cost 7.\n\nThe second route takes longer than time T = 70.\n\nThe third route gets him home at cost 4.\n\nThus, the cost 4 of the third route is the minimum.\n\nSample Input 2\n\n4 3\n1 1000\n2 4\n3 1000\n4 500\n\nSample Output 2\n\nTLE\n\nThere is no route that takes not longer than time T = 3.\n\nSample Input 3\n\n5 9\n25 8\n5 9\n4 10\n1000 1000\n6 1\n\nSample Output 3\n\n5", "sample_input": "3 70\n7 60\n1 80\n4 50\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03239", "source_text": "Score : 200 points\n\nProblem Statement\n\nWhen Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.\n\nYou, the smartwatch, has found N routes to his home.\n\nIf Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.\n\nFind the smallest cost of a route that takes not longer than time T.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq T \\leq 1000\n\n1 \\leq c_i \\leq 1000\n\n1 \\leq t_i \\leq 1000\n\nThe pairs (c_i, t_i) are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\nc_1 t_1\nc_2 t_2\n:\nc_N t_N\n\nOutput\n\nPrint the smallest cost of a route that takes not longer than time T.\n\nIf there is no route that takes not longer than time T, print TLE instead.\n\nSample Input 1\n\n3 70\n7 60\n1 80\n4 50\n\nSample Output 1\n\n4\n\nThe first route gets him home at cost 7.\n\nThe second route takes longer than time T = 70.\n\nThe third route gets him home at cost 4.\n\nThus, the cost 4 of the third route is the minimum.\n\nSample Input 2\n\n4 3\n1 1000\n2 4\n3 1000\n4 500\n\nSample Output 2\n\nTLE\n\nThere is no route that takes not longer than time T = 3.\n\nSample Input 3\n\n5 9\n25 8\n5 9\n4 10\n1000 1000\n6 1\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 439, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s435599952", "group_id": "codeNet:p03241", "input_text": "program partition\n implicit none\n integer :: n, m, i\n read(*,*) n, m\n do i = m/n, 1, -1\n if (mod(m,i) .ne. 0) cycle\n write(*,'(i0)') i\n stop\n end do\nend program partition", "language": "Fortran", "metadata": {"date": 1538880830, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03241.html", "problem_id": "p03241", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03241/input.txt", "sample_output_relpath": "derived/input_output/data/p03241/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03241/Fortran/s435599952.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s435599952", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program partition\n implicit none\n integer :: n, m, i\n read(*,*) n, m\n do i = m/n, 1, -1\n if (mod(m,i) .ne. 0) cycle\n write(*,'(i0)') i\n stop\n end do\nend program partition", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 187, "cpu_time_ms": 60, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s776958618", "group_id": "codeNet:p03241", "input_text": "program partition\n implicit none\n integer(8) :: n, m, i\n read(*,*) n, m\n do i = m/n, 1, -1\n if (mod(m,i) .ne. 0) cycle\n write(*,'(i0)') i\n stop\n end do\nend program partition\n", "language": "Fortran", "metadata": {"date": 1538880683, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03241.html", "problem_id": "p03241", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03241/input.txt", "sample_output_relpath": "derived/input_output/data/p03241/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03241/Fortran/s776958618.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s776958618", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program partition\n implicit none\n integer(8) :: n, m, i\n read(*,*) n, m\n do i = m/n, 1, -1\n if (mod(m,i) .ne. 0) cycle\n write(*,'(i0)') i\n stop\n end do\nend program partition\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "sample_input": "3 14\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03241", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given integers N and M.\n\nConsider a sequence a of length N consisting of positive integers such that a_1 + a_2 + ... + a_N = M. Find the maximum possible value of the greatest common divisor of a_1, a_2, ..., a_N.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\nN \\leq M \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the maximum possible value of the greatest common divisor of a sequence a_1, a_2, ..., a_N that satisfies the condition.\n\nSample Input 1\n\n3 14\n\nSample Output 1\n\n2\n\nConsider the sequence (a_1, a_2, a_3) = (2, 4, 8). Their greatest common divisor is 2, and this is the maximum value.\n\nSample Input 2\n\n10 123\n\nSample Output 2\n\n3\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n10000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 191, "cpu_time_ms": 210, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s120519192", "group_id": "codeNet:p03242", "input_text": "program AtCoder_Beginner_Contest_999\n implicit none\n integer :: n\n read(*,*) n\n write(*,'(i0)') 1110-n\nend program AtCoder_Beginner_Contest_999", "language": "Fortran", "metadata": {"date": 1569468153, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03242.html", "problem_id": "p03242", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03242/input.txt", "sample_output_relpath": "derived/input_output/data/p03242/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03242/Fortran/s120519192.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s120519192", "user_id": "u506403362"}, "prompt_components": {"gold_output": "991\n", "input_to_evaluate": "program AtCoder_Beginner_Contest_999\n implicit none\n integer :: n\n read(*,*) n\n write(*,'(i0)') 1110-n\nend program AtCoder_Beginner_Contest_999", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "sample_input": "119\n"}, "reference_outputs": ["991\n"], "source_document_id": "p03242", "source_text": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 147, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s066918048", "group_id": "codeNet:p03242", "input_text": "program sunuke\n\nimplicit none\n\ninteger:: n\ninteger:: x,y,z\n\nread(*,*) n\nx=n/100\nn=n-100*x\ny=n/10\nn=n-10*n\n\nif(x==1) then\n x=9\nelse\n x=1\nendif\nif(y==1) then\n y=9\nelse\n y=1\nendif\nif(z==1) then\n z=9\nelse\n z=1\nendif\n\nn=100*x+10*y+z\n\nwrite(*,*) n\n\nend program sunuke\n", "language": "Fortran", "metadata": {"date": 1551583358, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03242.html", "problem_id": "p03242", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03242/input.txt", "sample_output_relpath": "derived/input_output/data/p03242/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03242/Fortran/s066918048.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s066918048", "user_id": "u293324662"}, "prompt_components": {"gold_output": "991\n", "input_to_evaluate": "program sunuke\n\nimplicit none\n\ninteger:: n\ninteger:: x,y,z\n\nread(*,*) n\nx=n/100\nn=n-100*x\ny=n/10\nn=n-10*n\n\nif(x==1) then\n x=9\nelse\n x=1\nendif\nif(y==1) then\n y=9\nelse\n y=1\nendif\nif(z==1) then\n z=9\nelse\n z=1\nendif\n\nn=100*x+10*y+z\n\nwrite(*,*) n\n\nend program sunuke\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "sample_input": "119\n"}, "reference_outputs": ["991\n"], "source_document_id": "p03242", "source_text": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 274, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s657995920", "group_id": "codeNet:p03242", "input_text": "program contest999\n implicit none\n integer :: n\n read(*,*) n\n write(*,'(i0)') 1110-n\n stop\nend program contest999", "language": "Fortran", "metadata": {"date": 1538272877, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03242.html", "problem_id": "p03242", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03242/input.txt", "sample_output_relpath": "derived/input_output/data/p03242/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03242/Fortran/s657995920.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s657995920", "user_id": "u506403362"}, "prompt_components": {"gold_output": "991\n", "input_to_evaluate": "program contest999\n implicit none\n integer :: n\n read(*,*) n\n write(*,'(i0)') 1110-n\n stop\nend program contest999", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "sample_input": "119\n"}, "reference_outputs": ["991\n"], "source_document_id": "p03242", "source_text": "Score : 100 points\n\nProblem Statement\n\nCat Snuke is learning to write characters.\nToday, he practiced writing digits 1 and 9, but he did it the other way around.\n\nYou are given a three-digit integer n written by Snuke.\nPrint the integer obtained by replacing each digit 1 with 9 and each digit 9 with 1 in n.\n\nConstraints\n\n111 \\leq n \\leq 999\n\nn is an integer consisting of digits 1 and 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\n\nOutput\n\nPrint the integer obtained by replacing each occurrence of 1 with 9 and each occurrence of 9 with 1 in n.\n\nSample Input 1\n\n119\n\nSample Output 1\n\n991\n\nReplace the 9 in the ones place with 1, the 1 in the tens place with 9 and the 1 in the hundreds place with 9. The answer is 991.\n\nSample Input 2\n\n999\n\nSample Output 2\n\n111", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 118, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s384883073", "group_id": "codeNet:p03243", "input_text": "program AtCoder_Beginner_Contest_111\n implicit none\n integer :: n\n read(*,*) n\n write(*,'(i0)') (n+110)/111*111\nend program AtCoder_Beginner_Contest_111", "language": "Fortran", "metadata": {"date": 1569468249, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03243.html", "problem_id": "p03243", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03243/input.txt", "sample_output_relpath": "derived/input_output/data/p03243/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03243/Fortran/s384883073.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s384883073", "user_id": "u506403362"}, "prompt_components": {"gold_output": "111\n", "input_to_evaluate": "program AtCoder_Beginner_Contest_111\n implicit none\n integer :: n\n read(*,*) n\n write(*,'(i0)') (n+110)/111*111\nend program AtCoder_Beginner_Contest_111", "problem_context": "Score : 200 points\n\nProblem Statement\n\nKurohashi has never participated in AtCoder Beginner Contest (ABC).\n\nThe next ABC to be held is ABC N (the N-th ABC ever held).\nKurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same.\n\nWhat is the earliest ABC where Kurohashi can make his debut?\n\nConstraints\n\n100 \\leq N \\leq 999\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf the earliest ABC where Kurohashi can make his debut is ABC n, print n.\n\nSample Input 1\n\n111\n\nSample Output 1\n\n111\n\nThe next ABC to be held is ABC 111, where Kurohashi can make his debut.\n\nSample Input 2\n\n112\n\nSample Output 2\n\n222\n\nThe next ABC to be held is ABC 112, which means Kurohashi can no longer participate in ABC 111.\nAmong the ABCs where Kurohashi can make his debut, the earliest one is ABC 222.\n\nSample Input 3\n\n750\n\nSample Output 3\n\n777", "sample_input": "111\n"}, "reference_outputs": ["111\n"], "source_document_id": "p03243", "source_text": "Score : 200 points\n\nProblem Statement\n\nKurohashi has never participated in AtCoder Beginner Contest (ABC).\n\nThe next ABC to be held is ABC N (the N-th ABC ever held).\nKurohashi wants to make his debut in some ABC x such that all the digits of x in base ten are the same.\n\nWhat is the earliest ABC where Kurohashi can make his debut?\n\nConstraints\n\n100 \\leq N \\leq 999\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf the earliest ABC where Kurohashi can make his debut is ABC n, print n.\n\nSample Input 1\n\n111\n\nSample Output 1\n\n111\n\nThe next ABC to be held is ABC 111, where Kurohashi can make his debut.\n\nSample Input 2\n\n112\n\nSample Output 2\n\n222\n\nThe next ABC to be held is ABC 112, which means Kurohashi can no longer participate in ABC 111.\nAmong the ABCs where Kurohashi can make his debut, the earliest one is ABC 222.\n\nSample Input 3\n\n750\n\nSample Output 3\n\n777", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 156, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s355661025", "group_id": "codeNet:p03244", "input_text": "program main\nimplicit None\n\tinteger(8)::n,i,p(2),q(2),r(2),s(2)\n\tinteger(8),allocatable::v(:),a(:),b(:)\n\t\n\tread*,n\n\tallocate(v(n),a(n/2),b(n/2))\n\t\n\tread*,v\n\tn = n/2\n\tif(minval(v) == maxval(v))then\n\t\tprint 101,n\n\t\tstop\n\tendif\n\t\n\tdo i = 1,n\n\t\ta(i) = v(i*2-1)\n\t\tb(i) = v(i*2)\n\tenddo\n\t\n\tcall h1(a,n)\n\tcall h1(b,n)\n\t\n\tp =0;q =0;r =0;s =0\n\t\n\tcall a1(a,n,p,q)\n\tcall a1(b,n,r,s)\n\t\n\tif(q(1) /= s(1))then\n\t\tprint 101,2*n-p(1)-r(1)\n\t\tstop\n\tendif\n\t\n\ti = 2*n-p(1)-r(2)\n\tif(i > 2*n-p(2)-r(1)) i = 2*n-p(2)-r(1)\n\t\n\tprint 101,i\n\t\n101 format(i0)\nend program main\n\nsubroutine h1(a,n)\nimplicit None\n\tinteger(8)::a(n),x\n\tinteger(8)::n,i,ie,i0,i1,i2\n\t\n\tdo i = n/2,1,-1\n\t\tx = a(i);ie = n + 1; i0 = i; i1 = i0 * 2\n\t\tdo while(i1 < ie)\n\t\t\ti2 = i1 + 1\n\t\t\tif(i2 < ie .and. a(i1) < a(i2)) i1 = i2\n\t\t\tif(a(i1) > x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\n\tdo ie = n,2,-1\n\t\tx = a(ie)\n\t\ta(ie) = a(1)\n\t\ta(1) = x\n\t\ti0 =1;i1 =2\n\t\tdo while(i1 x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\nend subroutine h1\n\nsubroutine a1(a,n,p,q)\nImplicit None\ninteger(8)::n,p(2),q(2),i,t=1\ninteger(8)::a(n)\n\tdo i = 2,n\n\t\tif(a(i) == a(i-1))then\n\t\t\tt = t+1\n\t\t\telse\n\t\t\tif (t > p(1))then\n\t\t\t\tp(2) = p(1)\n\t\t\t\tp(1) = t\n\t\t\t\tq(2) = q(1)\n\t\t\t\tq(1) = a(i-1)\n\t\t\t\tt = 1\n\t\t\t\telse if(t > p(2))then\n\t\t\t\tp(2) = t\n\t\t\t\tq(2) = a(i-1)\n\t\t\t\tt = 1\n\t\t\tendif\n\t\tendif\n\tenddo\n\t\n\tif (t > p(1))then\n\t\tp(2) = p(1)\n\t\tp(1) = t\n\t\tq(2) = q(1)\n\t\tq(1) = a(i-1)\n\t\tt = 1\n\t\telse if(t > p(2))then\n\t\tp(2) = t\n\t\tq(2) = a(i-1)\n\t\tt = 1\n\tendif\nend subroutine a1", "language": "Fortran", "metadata": {"date": 1547780084, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03244.html", "problem_id": "p03244", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03244/input.txt", "sample_output_relpath": "derived/input_output/data/p03244/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03244/Fortran/s355661025.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s355661025", "user_id": "u900266249"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\nimplicit None\n\tinteger(8)::n,i,p(2),q(2),r(2),s(2)\n\tinteger(8),allocatable::v(:),a(:),b(:)\n\t\n\tread*,n\n\tallocate(v(n),a(n/2),b(n/2))\n\t\n\tread*,v\n\tn = n/2\n\tif(minval(v) == maxval(v))then\n\t\tprint 101,n\n\t\tstop\n\tendif\n\t\n\tdo i = 1,n\n\t\ta(i) = v(i*2-1)\n\t\tb(i) = v(i*2)\n\tenddo\n\t\n\tcall h1(a,n)\n\tcall h1(b,n)\n\t\n\tp =0;q =0;r =0;s =0\n\t\n\tcall a1(a,n,p,q)\n\tcall a1(b,n,r,s)\n\t\n\tif(q(1) /= s(1))then\n\t\tprint 101,2*n-p(1)-r(1)\n\t\tstop\n\tendif\n\t\n\ti = 2*n-p(1)-r(2)\n\tif(i > 2*n-p(2)-r(1)) i = 2*n-p(2)-r(1)\n\t\n\tprint 101,i\n\t\n101 format(i0)\nend program main\n\nsubroutine h1(a,n)\nimplicit None\n\tinteger(8)::a(n),x\n\tinteger(8)::n,i,ie,i0,i1,i2\n\t\n\tdo i = n/2,1,-1\n\t\tx = a(i);ie = n + 1; i0 = i; i1 = i0 * 2\n\t\tdo while(i1 < ie)\n\t\t\ti2 = i1 + 1\n\t\t\tif(i2 < ie .and. a(i1) < a(i2)) i1 = i2\n\t\t\tif(a(i1) > x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\n\tdo ie = n,2,-1\n\t\tx = a(ie)\n\t\ta(ie) = a(1)\n\t\ta(1) = x\n\t\ti0 =1;i1 =2\n\t\tdo while(i1 x)then\n\t\t\t\ta(i0) = a(i1);a(i1) = x\n\t\t\t\telse\n\t\t\t\texit\n\t\t\tendif\n\t\t\ti0 = i1;i1 = i0 *2\n\t\tenddo\n\tenddo\nend subroutine h1\n\nsubroutine a1(a,n,p,q)\nImplicit None\ninteger(8)::n,p(2),q(2),i,t=1\ninteger(8)::a(n)\n\tdo i = 2,n\n\t\tif(a(i) == a(i-1))then\n\t\t\tt = t+1\n\t\t\telse\n\t\t\tif (t > p(1))then\n\t\t\t\tp(2) = p(1)\n\t\t\t\tp(1) = t\n\t\t\t\tq(2) = q(1)\n\t\t\t\tq(1) = a(i-1)\n\t\t\t\tt = 1\n\t\t\t\telse if(t > p(2))then\n\t\t\t\tp(2) = t\n\t\t\t\tq(2) = a(i-1)\n\t\t\t\tt = 1\n\t\t\tendif\n\t\tendif\n\tenddo\n\t\n\tif (t > p(1))then\n\t\tp(2) = p(1)\n\t\tp(1) = t\n\t\tq(2) = q(1)\n\t\tq(1) = a(i-1)\n\t\tt = 1\n\t\telse if(t > p(2))then\n\t\tp(2) = t\n\t\tq(2) = a(i-1)\n\t\tt = 1\n\tendif\nend subroutine a1", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "sample_input": "4\n3 1 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03244", "source_text": "Score : 300 points\n\nProblem Statement\n\nA sequence a_1,a_2,... ,a_n is said to be /\\/\\/\\/ when the following conditions are satisfied:\n\nFor each i = 1,2,..., n-2, a_i = a_{i+2}.\n\nExactly two different numbers appear in the sequence.\n\nYou are given a sequence v_1,v_2,...,v_n whose length is even.\nWe would like to make this sequence /\\/\\/\\/ by replacing some of its elements.\nFind the minimum number of elements that needs to be replaced.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\nn is even.\n\n1 \\leq v_i \\leq 10^5\n\nv_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\nv_1 v_2 ... v_n\n\nOutput\n\nPrint the minimum number of elements that needs to be replaced.\n\nSample Input 1\n\n4\n3 1 3 2\n\nSample Output 1\n\n1\n\nThe sequence 3,1,3,2 is not /\\/\\/\\/, but we can make it /\\/\\/\\/ by replacing one of its elements: for example, replace the fourth element to make it 3,1,3,1.\n\nSample Input 2\n\n6\n105 119 105 119 105 119\n\nSample Output 2\n\n0\n\nThe sequence 105,119,105,119,105,119 is /\\/\\/\\/.\n\nSample Input 3\n\n4\n1 1 1 1\n\nSample Output 3\n\n2\n\nThe elements of the sequence 1,1,1,1 are all the same, so it is not /\\/\\/\\/.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1650, "cpu_time_ms": 36, "memory_kb": 2816}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s987006445", "group_id": "codeNet:p03252", "input_text": "program prob4\n implicit none\n integer::N, i, ans, l, j, k\n character(len=200005)::S,T\n integer::c(26), d(26)\n read(*,*) S, T\n l = len_trim(S)\n c = 0\n d = 0\n\n do i = 1, l\n j = ichar(S(i:i)) - 96\n k = ichar(T(i:i)) - 96\n if(c(j) > 0) then\n if(k .ne. c(j)) then\n write(*,'(a)') \"No\"\n stop\n end if\n else\n c(j) = k\n end if\n if(d(k) > 0) then\n if(j .ne. d(k)) then\n write(*,'(a)') \"No\"\n stop\n end if\n else\n d(k) = j\n end if\n end do\n write(*,'(a)') \"Yes\"\n stop\nend program", "language": "Fortran", "metadata": {"date": 1595036556, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03252.html", "problem_id": "p03252", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03252/input.txt", "sample_output_relpath": "derived/input_output/data/p03252/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03252/Fortran/s987006445.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s987006445", "user_id": "u841856382"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program prob4\n implicit none\n integer::N, i, ans, l, j, k\n character(len=200005)::S,T\n integer::c(26), d(26)\n read(*,*) S, T\n l = len_trim(S)\n c = 0\n d = 0\n\n do i = 1, l\n j = ichar(S(i:i)) - 96\n k = ichar(T(i:i)) - 96\n if(c(j) > 0) then\n if(k .ne. c(j)) then\n write(*,'(a)') \"No\"\n stop\n end if\n else\n c(j) = k\n end if\n if(d(k) > 0) then\n if(j .ne. d(k)) then\n write(*,'(a)') \"No\"\n stop\n end if\n else\n d(k) = j\n end if\n end do\n write(*,'(a)') \"Yes\"\n stop\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "sample_input": "azzel\napple\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03252", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 683, "cpu_time_ms": 16, "memory_kb": 3368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s266576754", "group_id": "codeNet:p03252", "input_text": "program string_transformation\n implicit none\n character(200000) :: s, t\n integer :: n, i, j, a, b\n logical :: x(26,26) = .false.\n read(*,*) s\n read(*,*) t\n n = len_trim(s)\n do i = 1, n\n x(ord(s(i:i)),ord(t(i:i))) = .true.\n end do\n do i = 1, 26\n a = 0\n b = 0\n do j = 1, 26\n if (x(i,j)) a = a+1\n if (x(j,i)) b = b+1\n end do\n if (a > 1 .or. b > 1) then\n write(*,'(a)') \"No\"\n stop\n end if\n end do\n write(*,'(a)') \"Yes\"\ncontains\n integer function ord(s)\n character(1), intent(in) :: s\n ord = ichar(s)-96\n end\nend program string_transformation", "language": "Fortran", "metadata": {"date": 1569467792, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03252.html", "problem_id": "p03252", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03252/input.txt", "sample_output_relpath": "derived/input_output/data/p03252/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03252/Fortran/s266576754.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s266576754", "user_id": "u506403362"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program string_transformation\n implicit none\n character(200000) :: s, t\n integer :: n, i, j, a, b\n logical :: x(26,26) = .false.\n read(*,*) s\n read(*,*) t\n n = len_trim(s)\n do i = 1, n\n x(ord(s(i:i)),ord(t(i:i))) = .true.\n end do\n do i = 1, 26\n a = 0\n b = 0\n do j = 1, 26\n if (x(i,j)) a = a+1\n if (x(j,i)) b = b+1\n end do\n if (a > 1 .or. b > 1) then\n write(*,'(a)') \"No\"\n stop\n end if\n end do\n write(*,'(a)') \"Yes\"\ncontains\n integer function ord(s)\n character(1), intent(in) :: s\n ord = ichar(s)-96\n end\nend program string_transformation", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "sample_input": "azzel\napple\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03252", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given strings S and T consisting of lowercase English letters.\n\nYou can perform the following operation on S any number of times:\n\nOperation: Choose two distinct lowercase English letters c_1 and c_2, then replace every occurrence of c_1 with c_2, and every occurrence of c_2 with c_1.\n\nDetermine if S and T can be made equal by performing the operation zero or more times.\n\nConstraints\n\n1 \\leq |S| \\leq 2 \\times 10^5\n\n|S| = |T|\n\nS and T consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nT\n\nOutput\n\nIf S and T can be made equal, print Yes; otherwise, print No.\n\nSample Input 1\n\nazzel\napple\n\nSample Output 1\n\nYes\n\nazzel can be changed to apple, as follows:\n\nChoose e as c_1 and l as c_2. azzel becomes azzle.\n\nChoose z as c_1 and p as c_2. azzle becomes apple.\n\nSample Input 2\n\nchokudai\nredcoder\n\nSample Output 2\n\nNo\n\nNo sequences of operation can change chokudai to redcoder.\n\nSample Input 3\n\nabcdefghijklmnopqrstuvwxyz\nibyhqfrekavclxjstdwgpzmonu\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 598, "cpu_time_ms": 7, "memory_kb": 1164}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s962371381", "group_id": "codeNet:p03254", "input_text": "program main\n implicit integer(a-z)\n allocatable::a(:)\n allocatable::sort(:)\n\n read(*,*)n,have\n allocate(a(n))\n allocate(sort(n))\n read(*,*)(a(i),i=1,n)\n\n do i=1,n\n sort(i)=minval(a(1:n-i+1))\n tmp=minval(a(1:n-i+1))\n do j=1,n-i+1\n if(tmp.eq.a(j)) exit\n end do\n a(j)=a(n-i+1)\n a(n-i+1)=tmp\n \n !write(*,*)\"sort\",sort\n !write(*,*)\"a \",a\n !write(*,*)\n end do\n\n do i=1,n\n if(sum(sort(1:i)).gt.have)then\n !ans=sum(a(1:i-1))\n exit\n end if\n end do\n \n if(sum(sort(1:i-1)).ne.have .and.&\n sum(sort(1:i-1)).ge.have) i=i-1\n \n !write(*,*)\"sort\",sort\n write(*,*)i-1!,ans\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1537064789, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03254.html", "problem_id": "p03254", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03254/input.txt", "sample_output_relpath": "derived/input_output/data/p03254/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03254/Fortran/s962371381.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s962371381", "user_id": "u594649885"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit integer(a-z)\n allocatable::a(:)\n allocatable::sort(:)\n\n read(*,*)n,have\n allocate(a(n))\n allocate(sort(n))\n read(*,*)(a(i),i=1,n)\n\n do i=1,n\n sort(i)=minval(a(1:n-i+1))\n tmp=minval(a(1:n-i+1))\n do j=1,n-i+1\n if(tmp.eq.a(j)) exit\n end do\n a(j)=a(n-i+1)\n a(n-i+1)=tmp\n \n !write(*,*)\"sort\",sort\n !write(*,*)\"a \",a\n !write(*,*)\n end do\n\n do i=1,n\n if(sum(sort(1:i)).gt.have)then\n !ans=sum(a(1:i-1))\n exit\n end if\n end do\n \n if(sum(sort(1:i-1)).ne.have .and.&\n sum(sort(1:i-1)).ge.have) i=i-1\n \n !write(*,*)\"sort\",sort\n write(*,*)i-1!,ans\n\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, ..., N.\n\nSnuke has decided to distribute x sweets among them.\nHe needs to give out all the x sweets, but some of the children may get zero sweets.\n\nFor each i (1 \\leq i \\leq N), Child i will be happy if he/she gets exactly a_i sweets.\nSnuke is trying to maximize the number of happy children by optimally distributing the sweets.\nFind the maximum possible number of happy children.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n1 \\leq x \\leq 10^9\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum possible number of happy children.\n\nSample Input 1\n\n3 70\n20 30 10\n\nSample Output 1\n\n2\n\nOne optimal way to distribute sweets is (20, 30, 20).\n\nSample Input 2\n\n3 10\n20 30 10\n\nSample Output 2\n\n1\n\nThe optimal way to distribute sweets is (0, 0, 10).\n\nSample Input 3\n\n4 1111\n1 10 100 1000\n\nSample Output 3\n\n4\n\nThe optimal way to distribute sweets is (1, 10, 100, 1000).\n\nSample Input 4\n\n2 10\n20 20\n\nSample Output 4\n\n0\n\nNo children will be happy, no matter how the sweets are distributed.", "sample_input": "3 70\n20 30 10\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03254", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N children, numbered 1, 2, ..., N.\n\nSnuke has decided to distribute x sweets among them.\nHe needs to give out all the x sweets, but some of the children may get zero sweets.\n\nFor each i (1 \\leq i \\leq N), Child i will be happy if he/she gets exactly a_i sweets.\nSnuke is trying to maximize the number of happy children by optimally distributing the sweets.\nFind the maximum possible number of happy children.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 100\n\n1 \\leq x \\leq 10^9\n\n1 \\leq a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum possible number of happy children.\n\nSample Input 1\n\n3 70\n20 30 10\n\nSample Output 1\n\n2\n\nOne optimal way to distribute sweets is (20, 30, 20).\n\nSample Input 2\n\n3 10\n20 30 10\n\nSample Output 2\n\n1\n\nThe optimal way to distribute sweets is (0, 0, 10).\n\nSample Input 3\n\n4 1111\n1 10 100 1000\n\nSample Output 3\n\n4\n\nThe optimal way to distribute sweets is (1, 10, 100, 1000).\n\nSample Input 4\n\n2 10\n20 20\n\nSample Output 4\n\n0\n\nNo children will be happy, no matter how the sweets are distributed.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 665, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s789100123", "group_id": "codeNet:p03264", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: k\n\n read*, k\n print'(i0)', (k/2)*(k/2+mod(k,2))\nend program main", "language": "Fortran", "metadata": {"date": 1591395032, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03264.html", "problem_id": "p03264", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03264/input.txt", "sample_output_relpath": "derived/input_output/data/p03264/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03264/Fortran/s789100123.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s789100123", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: k\n\n read*, k\n print'(i0)', (k/2)*(k/2+mod(k,2))\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nFind the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.\n\nConstraints\n\n2\\leq K\\leq 100\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive).\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n\nTwo pairs can be chosen: (2,1) and (2,3).\n\nSample Input 2\n\n6\n\nSample Output 2\n\n9\n\nSample Input 3\n\n11\n\nSample Output 3\n\n30\n\nSample Input 4\n\n50\n\nSample Output 4\n\n625", "sample_input": "3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03264", "source_text": "Score : 100 points\n\nProblem Statement\n\nFind the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive). The order does not matter.\n\nConstraints\n\n2\\leq K\\leq 100\n\nK is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the number of ways to choose a pair of an even number and an odd number from the positive integers between 1 and K (inclusive).\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n\nTwo pairs can be chosen: (2,1) and (2,3).\n\nSample Input 2\n\n6\n\nSample Output 2\n\n9\n\nSample Input 3\n\n11\n\nSample Output 3\n\n30\n\nSample Input 4\n\n50\n\nSample Output 4\n\n625", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 159, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s691916168", "group_id": "codeNet:p03265", "input_text": "program prob2\n implicit none\n integer::x1, x2, x3, x4, y1, y2, y3, y4, dx, dy\n read(*,*) x1, y1, x2, y2\n dx = x2 - x1\n dy = y2 - y1\n if(dx >= 0 .and. dy >= 0) then !-+\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx >= 0 .and. dy <= 0) then !++\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx <= 0 .and. dy >= 0) then !--\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx <= 0 .and. dy <= 0) then !+-\n x3 = x2 - y2\n y3 = y2 + x2\n end if\n x4 = x3 - dx\n y4 = y3 - dy\n write(*,*) x3, y3, x4, y4\n stop\nend program", "language": "Fortran", "metadata": {"date": 1596854128, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03265.html", "problem_id": "p03265", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03265/input.txt", "sample_output_relpath": "derived/input_output/data/p03265/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03265/Fortran/s691916168.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s691916168", "user_id": "u841856382"}, "prompt_components": {"gold_output": "-1 1 -1 0\n", "input_to_evaluate": "program prob2\n implicit none\n integer::x1, x2, x3, x4, y1, y2, y3, y4, dx, dy\n read(*,*) x1, y1, x2, y2\n dx = x2 - x1\n dy = y2 - y1\n if(dx >= 0 .and. dy >= 0) then !-+\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx >= 0 .and. dy <= 0) then !++\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx <= 0 .and. dy >= 0) then !--\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx <= 0 .and. dy <= 0) then !+-\n x3 = x2 - y2\n y3 = y2 + x2\n end if\n x4 = x3 - dx\n y4 = y3 - dy\n write(*,*) x3, y3, x4, y4\n stop\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis points up.)\n\nTakahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).\n\nGiven x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.\n\nConstraints\n\n|x_1|,|y_1|,|x_2|,|y_2| \\leq 100\n\n(x_1,y_1) ≠ (x_2,y_2)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 y_1 x_2 y_2\n\nOutput\n\nPrint x_3,y_3,x_4 and y_4 as integers, in this order.\n\nSample Input 1\n\n0 0 0 1\n\nSample Output 1\n\n-1 1 -1 0\n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.\nNote that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.\n\nSample Input 2\n\n2 3 6 6\n\nSample Output 2\n\n3 10 -1 7\n\nSample Input 3\n\n31 -41 -59 26\n\nSample Output 3\n\n-126 -64 -36 -131", "sample_input": "0 0 0 1\n"}, "reference_outputs": ["-1 1 -1 0\n"], "source_document_id": "p03265", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis points up.)\n\nTakahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).\n\nGiven x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.\n\nConstraints\n\n|x_1|,|y_1|,|x_2|,|y_2| \\leq 100\n\n(x_1,y_1) ≠ (x_2,y_2)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 y_1 x_2 y_2\n\nOutput\n\nPrint x_3,y_3,x_4 and y_4 as integers, in this order.\n\nSample Input 1\n\n0 0 0 1\n\nSample Output 1\n\n-1 1 -1 0\n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.\nNote that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.\n\nSample Input 2\n\n2 3 6 6\n\nSample Output 2\n\n3 10 -1 7\n\nSample Input 3\n\n31 -41 -59 26\n\nSample Output 3\n\n-126 -64 -36 -131", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 581, "cpu_time_ms": 11, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s100872847", "group_id": "codeNet:p03265", "input_text": "program main\n implicit none\n \n integer x1,x2,x3,x4,y1,y2,y3,y4\n real :: ap,c,a,x31,x32,y31,y32,r31,r32,r2,b,r\n \n read(*,*)x1,y1,x2,y2\n ap = real(y1 - y2)/real(x1 - x2)\n r = sqrt(real(y1-y2)**2 + real(x1-x2)**2)\n a = -1/ap\n b = real(x2*(x1 - x2)) + real(y2*(y1 - y2))\n \n x31 = ((-a*b)+sqrt(a**2*b**2 - (a**2 + 1)*(b**2 - r**2)))/(a**2 + 1)\n x32 = ((-a*b)-sqrt(a**2*b**2 - (a**2 + 1)*(b**2 - r**2)))/(a**2 + 1)\n y31 = a*x31 + b\n y32 = a*x32 + b\n r31 = x31**2 + y31**2\n r32 = x32**2 + y32**2\n if (r31 < r32) then\n x3 = int(x31)\n y3 = int(y31)\n else\n x3 = int(x32)\n y3 = int(y32)\n end if\n \n x4 = x1 + (x3 - x2)\n y4 = y1 + (y3 - y2)\n write(*,*)x3, y3, x4, y4\nend program main", "language": "Fortran", "metadata": {"date": 1570999241, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03265.html", "problem_id": "p03265", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03265/input.txt", "sample_output_relpath": "derived/input_output/data/p03265/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03265/Fortran/s100872847.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s100872847", "user_id": "u287431190"}, "prompt_components": {"gold_output": "-1 1 -1 0\n", "input_to_evaluate": "program main\n implicit none\n \n integer x1,x2,x3,x4,y1,y2,y3,y4\n real :: ap,c,a,x31,x32,y31,y32,r31,r32,r2,b,r\n \n read(*,*)x1,y1,x2,y2\n ap = real(y1 - y2)/real(x1 - x2)\n r = sqrt(real(y1-y2)**2 + real(x1-x2)**2)\n a = -1/ap\n b = real(x2*(x1 - x2)) + real(y2*(y1 - y2))\n \n x31 = ((-a*b)+sqrt(a**2*b**2 - (a**2 + 1)*(b**2 - r**2)))/(a**2 + 1)\n x32 = ((-a*b)-sqrt(a**2*b**2 - (a**2 + 1)*(b**2 - r**2)))/(a**2 + 1)\n y31 = a*x31 + b\n y32 = a*x32 + b\n r31 = x31**2 + y31**2\n r32 = x32**2 + y32**2\n if (r31 < r32) then\n x3 = int(x31)\n y3 = int(y31)\n else\n x3 = int(x32)\n y3 = int(y32)\n end if\n \n x4 = x1 + (x3 - x2)\n y4 = y1 + (y3 - y2)\n write(*,*)x3, y3, x4, y4\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis points up.)\n\nTakahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).\n\nGiven x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.\n\nConstraints\n\n|x_1|,|y_1|,|x_2|,|y_2| \\leq 100\n\n(x_1,y_1) ≠ (x_2,y_2)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 y_1 x_2 y_2\n\nOutput\n\nPrint x_3,y_3,x_4 and y_4 as integers, in this order.\n\nSample Input 1\n\n0 0 0 1\n\nSample Output 1\n\n-1 1 -1 0\n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.\nNote that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.\n\nSample Input 2\n\n2 3 6 6\n\nSample Output 2\n\n3 10 -1 7\n\nSample Input 3\n\n31 -41 -59 26\n\nSample Output 3\n\n-126 -64 -36 -131", "sample_input": "0 0 0 1\n"}, "reference_outputs": ["-1 1 -1 0\n"], "source_document_id": "p03265", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis points up.)\n\nTakahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).\n\nGiven x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.\n\nConstraints\n\n|x_1|,|y_1|,|x_2|,|y_2| \\leq 100\n\n(x_1,y_1) ≠ (x_2,y_2)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 y_1 x_2 y_2\n\nOutput\n\nPrint x_3,y_3,x_4 and y_4 as integers, in this order.\n\nSample Input 1\n\n0 0 0 1\n\nSample Output 1\n\n-1 1 -1 0\n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.\nNote that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.\n\nSample Input 2\n\n2 3 6 6\n\nSample Output 2\n\n3 10 -1 7\n\nSample Input 3\n\n31 -41 -59 26\n\nSample Output 3\n\n-126 -64 -36 -131", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 706, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s471760747", "group_id": "codeNet:p03265", "input_text": "INTEGER A,B,C,D\nREAD*,A,B,C,D\nWRITE(*,FMT=\"(I0)\",advance='no') C+B-D,D-A+C,A+B-D,B-A+C\nEND", "language": "Fortran", "metadata": {"date": 1552199963, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03265.html", "problem_id": "p03265", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03265/input.txt", "sample_output_relpath": "derived/input_output/data/p03265/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03265/Fortran/s471760747.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s471760747", "user_id": "u598073939"}, "prompt_components": {"gold_output": "-1 1 -1 0\n", "input_to_evaluate": "INTEGER A,B,C,D\nREAD*,A,B,C,D\nWRITE(*,FMT=\"(I0)\",advance='no') C+B-D,D-A+C,A+B-D,B-A+C\nEND", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis points up.)\n\nTakahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).\n\nGiven x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.\n\nConstraints\n\n|x_1|,|y_1|,|x_2|,|y_2| \\leq 100\n\n(x_1,y_1) ≠ (x_2,y_2)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 y_1 x_2 y_2\n\nOutput\n\nPrint x_3,y_3,x_4 and y_4 as integers, in this order.\n\nSample Input 1\n\n0 0 0 1\n\nSample Output 1\n\n-1 1 -1 0\n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.\nNote that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.\n\nSample Input 2\n\n2 3 6 6\n\nSample Output 2\n\n3 10 -1 7\n\nSample Input 3\n\n31 -41 -59 26\n\nSample Output 3\n\n-126 -64 -36 -131", "sample_input": "0 0 0 1\n"}, "reference_outputs": ["-1 1 -1 0\n"], "source_document_id": "p03265", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a square in the xy-plane. The coordinates of its four vertices are (x_1,y_1),(x_2,y_2),(x_3,y_3) and (x_4,y_4) in counter-clockwise order.\n(Assume that the positive x-axis points right, and the positive y-axis points up.)\n\nTakahashi remembers (x_1,y_1) and (x_2,y_2), but he has forgot (x_3,y_3) and (x_4,y_4).\n\nGiven x_1,x_2,y_1,y_2, restore x_3,y_3,x_4,y_4. It can be shown that x_3,y_3,x_4 and y_4 uniquely exist and have integer values.\n\nConstraints\n\n|x_1|,|y_1|,|x_2|,|y_2| \\leq 100\n\n(x_1,y_1) ≠ (x_2,y_2)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx_1 y_1 x_2 y_2\n\nOutput\n\nPrint x_3,y_3,x_4 and y_4 as integers, in this order.\n\nSample Input 1\n\n0 0 0 1\n\nSample Output 1\n\n-1 1 -1 0\n\n(0,0),(0,1),(-1,1),(-1,0) is the four vertices of a square in counter-clockwise order.\nNote that (x_3,y_3)=(1,1),(x_4,y_4)=(1,0) is not accepted, as the vertices are in clockwise order.\n\nSample Input 2\n\n2 3 6 6\n\nSample Output 2\n\n3 10 -1 7\n\nSample Input 3\n\n31 -41 -59 26\n\nSample Output 3\n\n-126 -64 -36 -131", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 90, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s056684184", "group_id": "codeNet:p03266", "input_text": "program prob2\n implicit none\n integer::x1, x2, x3, x4, y1, y2, y3, y4, dx, dy\n read(*,*) x1, y1, x2, y2\n dx = x2 - x1\n dy = y2 - y1\n if(dx >= 0 .and. dy >= 0) then !-+\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx >= 0 .and. dy <= 0) then !++\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx <= 0 .and. dy >= 0) then !--\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx <= 0 .and. dy <= 0) then !+-\n x3 = x2 - y2\n y3 = y2 + x2\n end if\n x4 = x3 - dx\n y4 = y3 - dy\n write(*,*) x3, y3, x4, y4\n stop\nend program", "language": "Fortran", "metadata": {"date": 1596854068, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03266.html", "problem_id": "p03266", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03266/input.txt", "sample_output_relpath": "derived/input_output/data/p03266/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03266/Fortran/s056684184.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s056684184", "user_id": "u841856382"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program prob2\n implicit none\n integer::x1, x2, x3, x4, y1, y2, y3, y4, dx, dy\n read(*,*) x1, y1, x2, y2\n dx = x2 - x1\n dy = y2 - y1\n if(dx >= 0 .and. dy >= 0) then !-+\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx >= 0 .and. dy <= 0) then !++\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx <= 0 .and. dy >= 0) then !--\n x3 = x2 - dy\n y3 = y2 + dx\n else if(dx <= 0 .and. dy <= 0) then !+-\n x3 = x2 - y2\n y3 = y2 + x2\n end if\n x4 = x3 - dx\n y4 = y3 - dy\n write(*,*) x3, y3, x4, y4\n stop\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03266", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 581, "cpu_time_ms": 12, "memory_kb": 3164}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s070080705", "group_id": "codeNet:p03268", "input_text": "program prob5\n implicit none\n integer(8) :: n, k\n integer(8) :: ans\n read(*,*) n, k\n ans = 0\n if(mod(k , 2) == 0) then\n ans = (N/K) * (N/K) * (N/K)\n ans = ans + ((N/(K/2))+1)/2 * ((N/(K/2))+1)/2 * ((N/(K/2))+1)/2\n else\n ans = (N/K) * (N/K) * (N/K)\n end if\n write(*,*) ans\n stop\ncontains\nend program prob5", "language": "Fortran", "metadata": {"date": 1596850978, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03268.html", "problem_id": "p03268", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03268/input.txt", "sample_output_relpath": "derived/input_output/data/p03268/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03268/Fortran/s070080705.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s070080705", "user_id": "u478462004"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program prob5\n implicit none\n integer(8) :: n, k\n integer(8) :: ans\n read(*,*) n, k\n ans = 0\n if(mod(k , 2) == 0) then\n ans = (N/K) * (N/K) * (N/K)\n ans = ans + ((N/(K/2))+1)/2 * ((N/(K/2))+1)/2 * ((N/(K/2))+1)/2\n else\n ans = (N/K) * (N/K) * (N/K)\n end if\n write(*,*) ans\n stop\ncontains\nend program prob5", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03268", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 355, "cpu_time_ms": 18, "memory_kb": 2784}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s474085704", "group_id": "codeNet:p03268", "input_text": "program arc102_a\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,k,i\n integer(int32):: a0, ah\n read*, n,k\n a0=n/k\n ah=0\n if (mod(k,2) == 0) then\n do i=1,n\n if (mod(i,k) == k/2) ah=ah+1\n end do\n end if\n\n print'(i0)', a0**3 + ah**3\n\n\nend program arc102_a", "language": "Fortran", "metadata": {"date": 1591296405, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03268.html", "problem_id": "p03268", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03268/input.txt", "sample_output_relpath": "derived/input_output/data/p03268/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03268/Fortran/s474085704.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s474085704", "user_id": "u234636620"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program arc102_a\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,k,i\n integer(int32):: a0, ah\n read*, n,k\n a0=n/k\n ah=0\n if (mod(k,2) == 0) then\n do i=1,n\n if (mod(i,k) == k/2) ah=ah+1\n end do\n end if\n\n print'(i0)', a0**3 + ah**3\n\n\nend program arc102_a", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "sample_input": "3 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03268", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given integers N and K. Find the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\nThe order of a,b,c does matter, and some of them can be the same.\n\nConstraints\n\n1 \\leq N,K \\leq 2\\times 10^5\n\nN and K are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of triples (a,b,c) of positive integers not greater than N such that a+b,b+c and c+a are all multiples of K.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n9\n\n(1,1,1),(1,1,3),(1,3,1),(1,3,3),(2,2,2),(3,1,1),(3,1,3),(3,3,1) and (3,3,3) satisfy the condition.\n\nSample Input 2\n\n5 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n27\n\nSample Input 4\n\n35897 932\n\nSample Output 4\n\n114191", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 328, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s394173349", "group_id": "codeNet:p03273", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: h,w,i,j\n character(1),allocatable:: a(:,:),ans(:,:)\n\n read*, h,w\n allocate(a(w,h),ans(w,h))\n a(:,:) = ' '\n ans(:,:) = ' '\n\n block\n character(w):: inpt_a\n integer(int32):: diff=0\n do i=1,h\n read*, inpt_a\n if (all_dot(inpt_a)) then\n diff=diff+1\n cycle\n end if\n do j=1,w\n a(j,i-diff) = inpt_a(j:j)\n end do\n end do\n end block\n\n block\n character(h):: ah\n integer(int32):: diff\n\n do j=1,w\n diff=0\n do i=1,h\n ah(i:i) = a(j,i)\n end do\n if(all_dot(ah))then\n diff=diff+1\n cycle\n end if\n ans(j,:) = a(j+diff,:)\n end do\n end block\n \n block\n character(w):: ansc\n do i=1,h\n do j=1,w\n ansc(j:j) = ans(j,i)\n end do\n if (len_trim(ansc) == 0) cycle\n print'(a)', trim(ansc)\n end do\n end block\n\ncontains\n function all_dot(s) result(ret)\n character(*):: s\n logical:: ret\n integer(int32):: l,i\n\n l = len(s)\n ret = .true.\n do i=1,l\n if (s(i:i) == '#') ret=.false.\n end do\n end function\nend program name", "language": "Fortran", "metadata": {"date": 1586705581, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03273.html", "problem_id": "p03273", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03273/input.txt", "sample_output_relpath": "derived/input_output/data/p03273/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03273/Fortran/s394173349.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s394173349", "user_id": "u234636620"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: h,w,i,j\n character(1),allocatable:: a(:,:),ans(:,:)\n\n read*, h,w\n allocate(a(w,h),ans(w,h))\n a(:,:) = ' '\n ans(:,:) = ' '\n\n block\n character(w):: inpt_a\n integer(int32):: diff=0\n do i=1,h\n read*, inpt_a\n if (all_dot(inpt_a)) then\n diff=diff+1\n cycle\n end if\n do j=1,w\n a(j,i-diff) = inpt_a(j:j)\n end do\n end do\n end block\n\n block\n character(h):: ah\n integer(int32):: diff\n\n do j=1,w\n diff=0\n do i=1,h\n ah(i:i) = a(j,i)\n end do\n if(all_dot(ah))then\n diff=diff+1\n cycle\n end if\n ans(j,:) = a(j+diff,:)\n end do\n end block\n \n block\n character(w):: ansc\n do i=1,h\n do j=1,w\n ansc(j:j) = ans(j,i)\n end do\n if (len_trim(ansc) == 0) cycle\n print'(a)', trim(ansc)\n end do\n end block\n\ncontains\n function all_dot(s) result(ret)\n character(*):: s\n logical:: ret\n integer(int32):: l,i\n\n l = len(s)\n ret = .true.\n do i=1,l\n if (s(i:i) == '#') ret=.false.\n end do\n end function\nend program name", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "sample_input": "4 4\n##.#\n....\n##.#\n.#.#\n"}, "reference_outputs": ["###\n###\n.##\n"], "source_document_id": "p03273", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a grid of squares with H horizontal rows and W vertical columns.\nThe square at the i-th row from the top and the j-th column from the left is represented as (i, j).\nEach square is black or white.\nThe color of the square is given as an H-by-W matrix (a_{i, j}).\nIf a_{i, j} is ., the square (i, j) is white; if a_{i, j} is #, the square (i, j) is black.\n\nSnuke is compressing this grid.\nHe will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:\n\nOperation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.\n\nIt can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation.\nFind the final state of the grid.\n\nConstraints\n\n1 \\leq H, W \\leq 100\n\na_{i, j} is . or #.\n\nThere is at least one black square in the whole grid.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{1, 1}...a_{1, W}\n:\na_{H, 1}...a_{H, W}\n\nOutput\n\nPrint the final state of the grid in the same format as input (without the numbers of rows and columns); see the samples for clarity.\n\nSample Input 1\n\n4 4\n##.#\n....\n##.#\n.#.#\n\nSample Output 1\n\n###\n###\n.##\n\nThe second row and the third column in the original grid will be removed.\n\nSample Input 2\n\n3 3\n#..\n.#.\n..#\n\nSample Output 2\n\n#..\n.#.\n..#\n\nAs there is no row or column that consists only of white squares, no operation will be performed.\n\nSample Input 3\n\n4 5\n.....\n.....\n..#..\n.....\n\nSample Output 3\n\n#\n\nSample Input 4\n\n7 6\n......\n....#.\n.#....\n..#...\n..#...\n......\n.#..#.\n\nSample Output 4\n\n..#\n#..\n.#.\n.#.\n#.#", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1457, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s329296703", "group_id": "codeNet:p03274", "input_text": "program test\ninteger::d\n allocatable :: a(:), b(:)\nread(*,*) N, c\nz=N-c+1\nallocate(a(N),b(z))\nread(*, *)(a(i), i = 1,N)\ndo i=1,N-c+1\nk=i+c-1\nx=a(i)\ny=a(k)\nt=abs(x)\nu=abs(y)\nm=min(t,u)\nb(i)=m+(y-x)\nend do\nd=minval(b)\nprint*,d\nend program test", "language": "Fortran", "metadata": {"date": 1535248715, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03274.html", "problem_id": "p03274", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03274/input.txt", "sample_output_relpath": "derived/input_output/data/p03274/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03274/Fortran/s329296703.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s329296703", "user_id": "u723571904"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "program test\ninteger::d\n allocatable :: a(:), b(:)\nread(*,*) N, c\nz=N-c+1\nallocate(a(N),b(z))\nread(*, *)(a(i), i = 1,N)\ndo i=1,N-c+1\nk=i+c-1\nx=a(i)\ny=a(k)\nt=abs(x)\nu=abs(y)\nm=min(t,u)\nb(i)=m+(y-x)\nend do\nd=minval(b)\nprint*,d\nend program test", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "sample_input": "5 3\n-30 -10 10 20 50\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03274", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N candles placed on a number line.\nThe i-th candle from the left is placed on coordinate x_i.\nHere, x_1 < x_2 < ... < x_N holds.\n\nInitially, no candles are burning.\nSnuke decides to light K of the N candles.\n\nNow, he is at coordinate 0.\nHe can move left and right along the line with speed 1.\nHe can also light a candle when he is at the same position as the candle, in negligible time.\n\nFind the minimum time required to light K candles.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq K \\leq N\n\nx_i is an integer.\n\n|x_i| \\leq 10^8\n\nx_1 < x_2 < ... < x_N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the minimum time required to light K candles.\n\nSample Input 1\n\n5 3\n-30 -10 10 20 50\n\nSample Output 1\n\n40\n\nHe should move and light candles as follows:\n\nMove from coordinate 0 to -10.\n\nLight the second candle from the left.\n\nMove from coordinate -10 to 10.\n\nLight the third candle from the left.\n\nMove from coordinate 10 to 20.\n\nLight the fourth candle from the left.\n\nSample Input 2\n\n3 2\n10 20 30\n\nSample Output 2\n\n20\n\nSample Input 3\n\n1 1\n0\n\nSample Output 3\n\n0\n\nThere may be a candle placed at coordinate 0.\n\nSample Input 4\n\n8 5\n-9 -7 -4 -3 1 2 3 4\n\nSample Output 4\n\n10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 241, "cpu_time_ms": 44, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s359520631", "group_id": "codeNet:p03280", "input_text": "program sample\n\timplicit none\n integer ::x,y\n \n read(*,*) x,y\n \n write(*,*) (x-1)*(y-1)\n \n stop\nend program sample\n", "language": "Fortran", "metadata": {"date": 1592630112, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03280.html", "problem_id": "p03280", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03280/input.txt", "sample_output_relpath": "derived/input_output/data/p03280/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03280/Fortran/s359520631.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s359520631", "user_id": "u323210830"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program sample\n\timplicit none\n integer ::x,y\n \n read(*,*) x,y\n \n write(*,*) (x-1)*(y-1)\n \n stop\nend program sample\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "sample_input": "2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03280", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 136, "cpu_time_ms": 5, "memory_kb": 2796}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s823846981", "group_id": "codeNet:p03280", "input_text": "program test\n\timplicit none\n integer :: A,B\n \n read(*,*) A,B\n \n write(*,*) A*B-A-B+1\n\tstop\nend program test", "language": "Fortran", "metadata": {"date": 1590895370, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03280.html", "problem_id": "p03280", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03280/input.txt", "sample_output_relpath": "derived/input_output/data/p03280/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03280/Fortran/s823846981.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s823846981", "user_id": "u230290001"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program test\n\timplicit none\n integer :: A,B\n \n read(*,*) A,B\n \n write(*,*) A*B-A-B+1\n\tstop\nend program test", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "sample_input": "2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03280", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s890963441", "group_id": "codeNet:p03280", "input_text": "program garden\n\timplicit none\n integer(8) :: A, B\n \n read(*,*) A,B\n write(*,*) (A-1)*(B-1)\n stop\n \nend program garden", "language": "Fortran", "metadata": {"date": 1590800807, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03280.html", "problem_id": "p03280", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03280/input.txt", "sample_output_relpath": "derived/input_output/data/p03280/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03280/Fortran/s890963441.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s890963441", "user_id": "u961266059"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program garden\n\timplicit none\n integer(8) :: A, B\n \n read(*,*) A,B\n write(*,*) (A-1)*(B-1)\n stop\n \nend program garden", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "sample_input": "2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03280", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 135, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s743203191", "group_id": "codeNet:p03280", "input_text": "program prob1\n implicit none\n integer::A, B\n read(*,*) A, B\n write(*,*) A*B - A - B + 1\n\n stop\n\n\n\nend program prob1", "language": "Fortran", "metadata": {"date": 1590800487, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03280.html", "problem_id": "p03280", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03280/input.txt", "sample_output_relpath": "derived/input_output/data/p03280/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03280/Fortran/s743203191.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s743203191", "user_id": "u841856382"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program prob1\n implicit none\n integer::A, B\n read(*,*) A, B\n write(*,*) A*B - A - B + 1\n\n stop\n\n\n\nend program prob1", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "sample_input": "2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03280", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 130, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s524021766", "group_id": "codeNet:p03280", "input_text": "read*,n,i\nprint\"(i0)\",(n-1)*(i-1)\nend", "language": "Fortran", "metadata": {"date": 1545015082, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03280.html", "problem_id": "p03280", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03280/input.txt", "sample_output_relpath": "derived/input_output/data/p03280/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03280/Fortran/s524021766.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s524021766", "user_id": "u900266249"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "read*,n,i\nprint\"(i0)\",(n-1)*(i-1)\nend", "problem_context": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "sample_input": "2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03280", "source_text": "Score: 100 points\n\nProblem Statement\n\nThere is a farm whose length and width are A yard and B yard, respectively. A farmer, John, made a vertical road and a horizontal road inside the farm from one border to another, as shown below: (The gray part represents the roads.)\n\nWhat is the area of this yard excluding the roads? Find it.\n\nNote\n\nIt can be proved that the positions of the roads do not affect the area.\n\nConstraints\n\nA is an integer between 2 and 100 (inclusive).\n\nB is an integer between 2 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the area of this yard excluding the roads (in square yards).\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n1\n\nIn this case, the area is 1 square yard.\n\nSample Input 2\n\n5 7\n\nSample Output 2\n\n24\n\nIn this case, the area is 24 square yards.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 37, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s067232316", "group_id": "codeNet:p03281", "input_text": "program main\n implicit none\n integer :: N\n integer,allocatable :: divisor(:)\n integer :: out\n integer :: i,j \n read (*,*) N\n allocate(divisor(N))\n divisor = 0\n do i = 1, N\n do j = 1, i\n if (mod(i,j) ==0 ) then\n divisor(i) = divisor(i)+1\n end if\n end do\n end do\n out = 0\n do i = 1, N\n if ( mod(i,2) /= 0 .and. divisor(i) == 8 ) then\n out = out + 1\n end if\n end do\n write(*,'(i0)') out \n stop\nend program main\n", "language": "Fortran", "metadata": {"date": 1582417793, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03281.html", "problem_id": "p03281", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03281/input.txt", "sample_output_relpath": "derived/input_output/data/p03281/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03281/Fortran/s067232316.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s067232316", "user_id": "u886432251"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\n implicit none\n integer :: N\n integer,allocatable :: divisor(:)\n integer :: out\n integer :: i,j \n read (*,*) N\n allocate(divisor(N))\n divisor = 0\n do i = 1, N\n do j = 1, i\n if (mod(i,j) ==0 ) then\n divisor(i) = divisor(i)+1\n end if\n end do\n end do\n out = 0\n do i = 1, N\n if ( mod(i,2) /= 0 .and. divisor(i) == 8 ) then\n out = out + 1\n end if\n end do\n write(*,'(i0)') out \n stop\nend program main\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "sample_input": "105\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03281", "source_text": "Score: 200 points\n\nProblem Statement\n\nThe number 105 is quite special - it is odd but still it has eight divisors.\nNow, your task is this: how many odd numbers with exactly eight positive divisors are there between 1 and N (inclusive)?\n\nConstraints\n\nN is an integer between 1 and 200 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n105\n\nSample Output 1\n\n1\n\nAmong the numbers between 1 and 105, the only number that is odd and has exactly eight divisors is 105.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n0\n\n1 has one divisor. 3, 5 and 7 are all prime and have two divisors. Thus, there is no number that satisfies the condition.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 471, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s481367481", "group_id": "codeNet:p03282", "input_text": "program prime_numbers\n implicit none\n integer(8) i, j,n,m,Q,l,r,y,p1,q1\n integer, allocatable :: x(:,:),p(:,:)\n \n read (*,*)n ,m,q\n allocate(x(2,m))\n allocate(p(2,q))\n read(*,*)x\n read(*,*)p\n !transpose(x)\n !transpose(p)\n do i=1,q\n y=0\n p1=p(i,1)\n q1=p(i,2)\n do j=1,m\n if (p(i,1)<=x(j,1) .and. x(j,2)<=p(i,2))then\n y=y+1\n end if\n end do\n write(*,*)y\n end do\n deallocate(x)\n deallocate(p)\n \n stop\nend program prime_numbers\n", "language": "Fortran", "metadata": {"date": 1590806066, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03282.html", "problem_id": "p03282", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03282/input.txt", "sample_output_relpath": "derived/input_output/data/p03282/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03282/Fortran/s481367481.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s481367481", "user_id": "u713568912"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program prime_numbers\n implicit none\n integer(8) i, j,n,m,Q,l,r,y,p1,q1\n integer, allocatable :: x(:,:),p(:,:)\n \n read (*,*)n ,m,q\n allocate(x(2,m))\n allocate(p(2,q))\n read(*,*)x\n read(*,*)p\n !transpose(x)\n !transpose(p)\n do i=1,q\n y=0\n p1=p(i,1)\n q1=p(i,2)\n do j=1,m\n if (p(i,1)<=x(j,1) .and. x(j,2)<=p(i,2))then\n y=y+1\n end if\n end do\n write(*,*)y\n end do\n deallocate(x)\n deallocate(p)\n \n stop\nend program prime_numbers\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nMr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:\n\nEach occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.\n\nFor example, if S is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.\nYou are interested in what the string looks like after 5 \\times 10^{15} days. What is the K-th character from the left in the string after 5 \\times 10^{15} days?\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nK is an integer between 1 and 10^{18} (inclusive).\n\nThe length of the string after 5 \\times 10^{15} days is at least K.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the K-th character from the left in Mr. Infinity's string after 5 \\times 10^{15} days.\n\nSample Input 1\n\n1214\n4\n\nSample Output 1\n\n2\n\nThe string S changes as follows:\n\nNow: 1214\n\nAfter one day: 12214444\n\nAfter two days: 1222214444444444444444\n\nAfter three days: 12222222214444444444444444444444444444444444444444444444444444444444444444\n\nThe first five characters in the string after 5 \\times 10^{15} days is 12222. As K=4, we should print the fourth character, 2.\n\nSample Input 2\n\n3\n157\n\nSample Output 2\n\n3\n\nThe initial string is 3. The string after 5 \\times 10^{15} days consists only of 3.\n\nSample Input 3\n\n299792458\n9460730472580800\n\nSample Output 3\n\n2", "sample_input": "1214\n4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03282", "source_text": "Score: 300 points\n\nProblem Statement\n\nMr. Infinity has a string S consisting of digits from 1 to 9. Each time the date changes, this string changes as follows:\n\nEach occurrence of 2 in S is replaced with 22. Similarly, each 3 becomes 333, 4 becomes 4444, 5 becomes 55555, 6 becomes 666666, 7 becomes 7777777, 8 becomes 88888888 and 9 becomes 999999999. 1 remains as 1.\n\nFor example, if S is 1324, it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.\nYou are interested in what the string looks like after 5 \\times 10^{15} days. What is the K-th character from the left in the string after 5 \\times 10^{15} days?\n\nConstraints\n\nS is a string of length between 1 and 100 (inclusive).\n\nK is an integer between 1 and 10^{18} (inclusive).\n\nThe length of the string after 5 \\times 10^{15} days is at least K.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nK\n\nOutput\n\nPrint the K-th character from the left in Mr. Infinity's string after 5 \\times 10^{15} days.\n\nSample Input 1\n\n1214\n4\n\nSample Output 1\n\n2\n\nThe string S changes as follows:\n\nNow: 1214\n\nAfter one day: 12214444\n\nAfter two days: 1222214444444444444444\n\nAfter three days: 12222222214444444444444444444444444444444444444444444444444444444444444444\n\nThe first five characters in the string after 5 \\times 10^{15} days is 12222. As K=4, we should print the fourth character, 2.\n\nSample Input 2\n\n3\n157\n\nSample Output 2\n\n3\n\nThe initial string is 3. The string after 5 \\times 10^{15} days consists only of 3.\n\nSample Input 3\n\n299792458\n9460730472580800\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 543, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s135083768", "group_id": "codeNet:p03288", "input_text": "program main\n implicit none\n integer a\n read(*,*)a\n if(a<1200)then\n write(*,*)\"ABC\"\n elseif(a<2800)then\n write(*,*)\"ARC\"\n else\n write(*,*)\"AGC\"\n endif\nend program main\n", "language": "Fortran", "metadata": {"date": 1535916180, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03288.html", "problem_id": "p03288", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03288/input.txt", "sample_output_relpath": "derived/input_output/data/p03288/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03288/Fortran/s135083768.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s135083768", "user_id": "u539011156"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "program main\n implicit none\n integer a\n read(*,*)a\n if(a<1200)then\n write(*,*)\"ABC\"\n elseif(a<2800)then\n write(*,*)\"ARC\"\n else\n write(*,*)\"AGC\"\n endif\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA programming competition site AtCode regularly holds programming contests.\n\nThe next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.\n\nThe contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800.\n\nThe contest after the ARC is called AGC, which is rated for all contestants.\n\nTakahashi's rating on AtCode is R. What is the next contest rated for him?\n\nConstraints\n\n0 ≤ R ≤ 4208\n\nR is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the name of the next contest rated for Takahashi (ABC, ARC or AGC).\n\nSample Input 1\n\n1199\n\nSample Output 1\n\nABC\n\n1199 is less than 1200, so ABC will be rated.\n\nSample Input 2\n\n1200\n\nSample Output 2\n\nARC\n\n1200 is not less than 1200 and ABC will be unrated, but it is less than 2800 and ARC will be rated.\n\nSample Input 3\n\n4208\n\nSample Output 3\n\nAGC", "sample_input": "1199\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03288", "source_text": "Score : 100 points\n\nProblem Statement\n\nA programming competition site AtCode regularly holds programming contests.\n\nThe next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.\n\nThe contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800.\n\nThe contest after the ARC is called AGC, which is rated for all contestants.\n\nTakahashi's rating on AtCode is R. What is the next contest rated for him?\n\nConstraints\n\n0 ≤ R ≤ 4208\n\nR is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\n\nOutput\n\nPrint the name of the next contest rated for Takahashi (ABC, ARC or AGC).\n\nSample Input 1\n\n1199\n\nSample Output 1\n\nABC\n\n1199 is less than 1200, so ABC will be rated.\n\nSample Input 2\n\n1200\n\nSample Output 2\n\nARC\n\n1200 is not less than 1200 and ABC will be unrated, but it is less than 2800 and ARC will be rated.\n\nSample Input 3\n\n4208\n\nSample Output 3\n\nAGC", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 223, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s050217315", "group_id": "codeNet:p03292", "input_text": "program answer\n implicit none\n\n character(len=100):: S, T, U\n integer :: i, j, a\n\n read(*,*) S\n read(*,*) T\n\n a=len_trim(S)\n\n if(a==1) then\n if(S==T) then\n write(*,*) 'Yes'\n stop\n else\n write(*,*) 'No'\n stop\n end if\n end if\n\n \n do j = 1, a-1\n U=S\n S(j+1:j+1)=U(j:j)\n S(1:1)=U(a:a)\n if(S==T) then\n write(*,*) 'Yes'\n stop\n end if\n end do\n \n write(*,*) 'No' \n\n stop\n end program answer\n", "language": "Fortran", "metadata": {"date": 1593222900, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03292.html", "problem_id": "p03292", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03292/input.txt", "sample_output_relpath": "derived/input_output/data/p03292/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03292/Fortran/s050217315.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s050217315", "user_id": "u873780029"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program answer\n implicit none\n\n character(len=100):: S, T, U\n integer :: i, j, a\n\n read(*,*) S\n read(*,*) T\n\n a=len_trim(S)\n\n if(a==1) then\n if(S==T) then\n write(*,*) 'Yes'\n stop\n else\n write(*,*) 'No'\n stop\n end if\n end if\n\n \n do j = 1, a-1\n U=S\n S(j+1:j+1)=U(j:j)\n S(1:1)=U(a:a)\n if(S==T) then\n write(*,*) 'Yes'\n stop\n end if\n end do\n \n write(*,*) 'No' \n\n stop\n end program answer\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "sample_input": "1 6 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03292", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 501, "cpu_time_ms": 17, "memory_kb": 3152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s986579674", "group_id": "codeNet:p03292", "input_text": "integer a,b,c\nread*, a,b,c\nprint*, max(a,b,c) - min(a,b,c)\nend", "language": "Fortran", "metadata": {"date": 1571896971, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03292.html", "problem_id": "p03292", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03292/input.txt", "sample_output_relpath": "derived/input_output/data/p03292/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03292/Fortran/s986579674.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s986579674", "user_id": "u244203620"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "integer a,b,c\nread*, a,b,c\nprint*, max(a,b,c) - min(a,b,c)\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "sample_input": "1 6 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03292", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 62, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s728529735", "group_id": "codeNet:p03292", "input_text": "integer x(3)\nread*,x\nprint\"(I0)\",maxval(x)-minval(x)\nend", "language": "Fortran", "metadata": {"date": 1551432299, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03292.html", "problem_id": "p03292", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03292/input.txt", "sample_output_relpath": "derived/input_output/data/p03292/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03292/Fortran/s728529735.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s728529735", "user_id": "u598073939"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "integer x(3)\nread*,x\nprint\"(I0)\",maxval(x)-minval(x)\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "sample_input": "1 6 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03292", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 56, "cpu_time_ms": 3, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s280247078", "group_id": "codeNet:p03292", "input_text": "program task_scheduling_problem\n implicit none\n integer :: a(3)\n read(*,*) a(:)\n write(*,'(i0)') maxval(a) - minval(a)\n stop\nend program task_scheduling_problem", "language": "Fortran", "metadata": {"date": 1551325589, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03292.html", "problem_id": "p03292", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03292/input.txt", "sample_output_relpath": "derived/input_output/data/p03292/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03292/Fortran/s280247078.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s280247078", "user_id": "u506403362"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program task_scheduling_problem\n implicit none\n integer :: a(3)\n read(*,*) a(:)\n write(*,'(i0)') maxval(a) - minval(a)\n stop\nend program task_scheduling_problem", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "sample_input": "1 6 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03292", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou have three tasks, all of which need to be completed.\n\nFirst, you can complete any one task at cost 0.\n\nThen, just after completing the i-th task, you can complete the j-th task at cost |A_j - A_i|.\n\nHere, |x| denotes the absolute value of x.\n\nFind the minimum total cost required to complete all the task.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A_1, A_2, A_3 \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nPrint the minimum total cost required to complete all the task.\n\nSample Input 1\n\n1 6 3\n\nSample Output 1\n\n5\n\nWhen the tasks are completed in the following order, the total cost will be 5, which is the minimum:\n\nComplete the first task at cost 0.\n\nComplete the third task at cost 2.\n\nComplete the second task at cost 3.\n\nSample Input 2\n\n11 5 5\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100 100 100\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 165, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s670379905", "group_id": "codeNet:p03294", "input_text": "program modulo_summation\n implicit none\n integer :: n, a(3000) = 0\n read(*,*) n\n read(*,*) a(1:n)\n write(*,'(i0)') sum(a)-n\nend program modulo_summation", "language": "Fortran", "metadata": {"date": 1590789305, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03294.html", "problem_id": "p03294", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03294/input.txt", "sample_output_relpath": "derived/input_output/data/p03294/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03294/Fortran/s670379905.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s670379905", "user_id": "u506403362"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program modulo_summation\n implicit none\n integer :: n, a(3000) = 0\n read(*,*) n\n read(*,*) a(1:n)\n write(*,'(i0)') sum(a)-n\nend program modulo_summation", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "sample_input": "3\n3 4 6\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03294", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 157, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s415419744", "group_id": "codeNet:p03294", "input_text": "integer,allocatable,dimension(:)::A\nread*,i\nallocate(A(i))\nread*,A\nprint\"(i0)\",sum(A)-i\nend", "language": "Fortran", "metadata": {"date": 1565244434, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03294.html", "problem_id": "p03294", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03294/input.txt", "sample_output_relpath": "derived/input_output/data/p03294/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03294/Fortran/s415419744.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s415419744", "user_id": "u598073939"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "integer,allocatable,dimension(:)::A\nread*,i\nallocate(A(i))\nread*,A\nprint\"(i0)\",sum(A)-i\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "sample_input": "3\n3 4 6\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03294", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given N positive integers a_1, a_2, ..., a_N.\n\nFor a non-negative integer m, let f(m) = (m\\ mod\\ a_1) + (m\\ mod\\ a_2) + ... + (m\\ mod\\ a_N).\n\nHere, X\\ mod\\ Y denotes the remainder of the division of X by Y.\n\nFind the maximum value of f.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 3000\n\n2 \\leq a_i \\leq 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the maximum value of f.\n\nSample Input 1\n\n3\n3 4 6\n\nSample Output 1\n\n10\n\nf(11) = (11\\ mod\\ 3) + (11\\ mod\\ 4) + (11\\ mod\\ 6) = 10 is the maximum value of f.\n\nSample Input 2\n\n5\n7 46 11 20 11\n\nSample Output 2\n\n90\n\nSample Input 3\n\n7\n994 518 941 851 647 2 581\n\nSample Output 3\n\n4527", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 91, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s243695572", "group_id": "codeNet:p03295", "input_text": "module sub\n\timplicit none\ncontains\nsubroutine heapsort2(n,array,turn)\n implicit none\n integer,intent(in)::n\n integer,intent(out)::turn(1:n)\n integer,intent(inout)::array(1:n)\n \n integer::i,k,j,l,m\n double precision::t\n \n ! if(n.le.0)then\n ! write(6,*)\"Error, at heapsort\"; stop\n ! endif\n if(n.eq.1)return\n\n do i=1,N\n turn(i)=i\n enddo\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(l)\n m=turn(l)\n else\n t=array(k)\n m=turn(k)\n array(k)=array(1)\n turn(k)=turn(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n turn(1)=m\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n turn(i)=turn(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n turn(i)=m\n enddo\n\n return\nend subroutine heapsort2\nend module sub\n\n\n\nprogram main\n\tuse sub\n\timplicit none\n\tinteger :: N, M, i, j, counter\n\tinteger, allocatable :: a(:), b(:), turn(:)\n\tread(*, *) N, M\n\tallocate(a(1:M))\n\tallocate(b(1:M))\n\tallocate(turn(1:M))\n\tdo i = 1, M\n\t\tread(*, *) a(i), b(i)\n\tend do\n\t\n\tcall heapsort2(M,a,turn)\n\tj = 1\n\tcounter = 0\n\tdo i = 1, M\n\t\tif(a(j) /= a(i)) then\n\t\t\tif(b(turn(j)) <= a(i)) then\n\t\t\t\tcounter = counter + 1\n\t\t\t\tj = i\n\t\t\telse if(b(turn(j)) >= b(turn(i))) then\n\t\t\t\tj = i\n\t\t\tend if\n\t\telse\n\t\t\tif(b(turn(j)) > b(turn(i))) then\n\t\t\t\tj = i\n\t\t\tend if\n\t\tend if\n\tend do\n\twrite(*, *) counter+1\nend program main", "language": "Fortran", "metadata": {"date": 1532228019, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03295.html", "problem_id": "p03295", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03295/input.txt", "sample_output_relpath": "derived/input_output/data/p03295/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03295/Fortran/s243695572.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s243695572", "user_id": "u728000113"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module sub\n\timplicit none\ncontains\nsubroutine heapsort2(n,array,turn)\n implicit none\n integer,intent(in)::n\n integer,intent(out)::turn(1:n)\n integer,intent(inout)::array(1:n)\n \n integer::i,k,j,l,m\n double precision::t\n \n ! if(n.le.0)then\n ! write(6,*)\"Error, at heapsort\"; stop\n ! endif\n if(n.eq.1)return\n\n do i=1,N\n turn(i)=i\n enddo\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(l)\n m=turn(l)\n else\n t=array(k)\n m=turn(k)\n array(k)=array(1)\n turn(k)=turn(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n turn(1)=m\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n turn(i)=turn(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n turn(i)=m\n enddo\n\n return\nend subroutine heapsort2\nend module sub\n\n\n\nprogram main\n\tuse sub\n\timplicit none\n\tinteger :: N, M, i, j, counter\n\tinteger, allocatable :: a(:), b(:), turn(:)\n\tread(*, *) N, M\n\tallocate(a(1:M))\n\tallocate(b(1:M))\n\tallocate(turn(1:M))\n\tdo i = 1, M\n\t\tread(*, *) a(i), b(i)\n\tend do\n\t\n\tcall heapsort2(M,a,turn)\n\tj = 1\n\tcounter = 0\n\tdo i = 1, M\n\t\tif(a(j) /= a(i)) then\n\t\t\tif(b(turn(j)) <= a(i)) then\n\t\t\t\tcounter = counter + 1\n\t\t\t\tj = i\n\t\t\telse if(b(turn(j)) >= b(turn(i))) then\n\t\t\t\tj = i\n\t\t\tend if\n\t\telse\n\t\t\tif(b(turn(j)) > b(turn(i))) then\n\t\t\t\tj = i\n\t\t\tend if\n\t\tend if\n\tend do\n\twrite(*, *) counter+1\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N islands lining up from west to east, connected by N-1 bridges.\n\nThe i-th bridge connects the i-th island from the west and the (i+1)-th island from the west.\n\nOne day, disputes took place between some islands, and there were M requests from the inhabitants of the islands:\n\nRequest i: A dispute took place between the a_i-th island from the west and the b_i-th island from the west. Please make traveling between these islands with bridges impossible.\n\nYou decided to remove some bridges to meet all these M requests.\n\nFind the minimum number of bridges that must be removed.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq a_i < b_i \\leq N\n\nAll pairs (a_i, b_i) are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nPrint the minimum number of bridges that must be removed.\n\nSample Input 1\n\n5 2\n1 4\n2 5\n\nSample Output 1\n\n1\n\nThe requests can be met by removing the bridge connecting the second and third islands from the west.\n\nSample Input 2\n\n9 5\n1 8\n2 7\n3 5\n4 6\n7 9\n\nSample Output 2\n\n2\n\nSample Input 3\n\n5 10\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5\n\nSample Output 3\n\n4", "sample_input": "5 2\n1 4\n2 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03295", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N islands lining up from west to east, connected by N-1 bridges.\n\nThe i-th bridge connects the i-th island from the west and the (i+1)-th island from the west.\n\nOne day, disputes took place between some islands, and there were M requests from the inhabitants of the islands:\n\nRequest i: A dispute took place between the a_i-th island from the west and the b_i-th island from the west. Please make traveling between these islands with bridges impossible.\n\nYou decided to remove some bridges to meet all these M requests.\n\nFind the minimum number of bridges that must be removed.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq a_i < b_i \\leq N\n\nAll pairs (a_i, b_i) are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nPrint the minimum number of bridges that must be removed.\n\nSample Input 1\n\n5 2\n1 4\n2 5\n\nSample Output 1\n\n1\n\nThe requests can be met by removing the bridge connecting the second and third islands from the west.\n\nSample Input 2\n\n9 5\n1 8\n2 7\n3 5\n4 6\n7 9\n\nSample Output 2\n\n2\n\nSample Input 3\n\n5 10\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1632, "cpu_time_ms": 144, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s691191087", "group_id": "codeNet:p03295", "input_text": "module sub\n\timplicit none\ncontains\nsubroutine heapsort2(n,array,turn)\n implicit none\n integer,intent(in)::n\n integer,intent(out)::turn(1:n)\n integer,intent(inout)::array(1:n)\n \n integer::i,k,j,l,m\n double precision::t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n\n do i=1,N\n turn(i)=i\n enddo\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(l)\n m=turn(l)\n else\n t=array(k)\n m=turn(k)\n array(k)=array(1)\n turn(k)=turn(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n turn(1)=m\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n turn(i)=turn(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n turn(i)=m\n enddo\n\n return\nend subroutine heapsort2\nend module sub\n\n\n\nprogram main\n\tuse sub\n\timplicit none\n\tinteger :: N, M, i, j, counter\n\tinteger, allocatable :: a(:), b(:), turn(:)\n\tread(*, *) N, M\n\tallocate(a(1:M))\n\tallocate(b(1:M))\n\tallocate(turn(1:M))\n\tdo i = 1, M\n\t\tread(*, *) a(i), b(i)\n\tend do\n\t\n\tcall heapsort2(M,a,turn)\n\tj = 1\n\tcounter = 0\n\tdo i = 1, M\n\tif(a(j) /= a(i)) then\n\t\tif(b(turn(j)) < a(i)) then\n\t\t\tcounter = counter + 1\n\t\t\tj = i\n\t\telse if(b(turn(j)) > b(turn(i))) then\n\t\t\tj = i\n\t\tend if\n\tend if\n\tend do\n\twrite(*, *) counter\nend program main", "language": "Fortran", "metadata": {"date": 1532227189, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03295.html", "problem_id": "p03295", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03295/input.txt", "sample_output_relpath": "derived/input_output/data/p03295/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03295/Fortran/s691191087.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s691191087", "user_id": "u728000113"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "module sub\n\timplicit none\ncontains\nsubroutine heapsort2(n,array,turn)\n implicit none\n integer,intent(in)::n\n integer,intent(out)::turn(1:n)\n integer,intent(inout)::array(1:n)\n \n integer::i,k,j,l,m\n double precision::t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n\n do i=1,N\n turn(i)=i\n enddo\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(l)\n m=turn(l)\n else\n t=array(k)\n m=turn(k)\n array(k)=array(1)\n turn(k)=turn(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n turn(1)=m\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n turn(i)=turn(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n turn(i)=m\n enddo\n\n return\nend subroutine heapsort2\nend module sub\n\n\n\nprogram main\n\tuse sub\n\timplicit none\n\tinteger :: N, M, i, j, counter\n\tinteger, allocatable :: a(:), b(:), turn(:)\n\tread(*, *) N, M\n\tallocate(a(1:M))\n\tallocate(b(1:M))\n\tallocate(turn(1:M))\n\tdo i = 1, M\n\t\tread(*, *) a(i), b(i)\n\tend do\n\t\n\tcall heapsort2(M,a,turn)\n\tj = 1\n\tcounter = 0\n\tdo i = 1, M\n\tif(a(j) /= a(i)) then\n\t\tif(b(turn(j)) < a(i)) then\n\t\t\tcounter = counter + 1\n\t\t\tj = i\n\t\telse if(b(turn(j)) > b(turn(i))) then\n\t\t\tj = i\n\t\tend if\n\tend if\n\tend do\n\twrite(*, *) counter\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N islands lining up from west to east, connected by N-1 bridges.\n\nThe i-th bridge connects the i-th island from the west and the (i+1)-th island from the west.\n\nOne day, disputes took place between some islands, and there were M requests from the inhabitants of the islands:\n\nRequest i: A dispute took place between the a_i-th island from the west and the b_i-th island from the west. Please make traveling between these islands with bridges impossible.\n\nYou decided to remove some bridges to meet all these M requests.\n\nFind the minimum number of bridges that must be removed.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq a_i < b_i \\leq N\n\nAll pairs (a_i, b_i) are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nPrint the minimum number of bridges that must be removed.\n\nSample Input 1\n\n5 2\n1 4\n2 5\n\nSample Output 1\n\n1\n\nThe requests can be met by removing the bridge connecting the second and third islands from the west.\n\nSample Input 2\n\n9 5\n1 8\n2 7\n3 5\n4 6\n7 9\n\nSample Output 2\n\n2\n\nSample Input 3\n\n5 10\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5\n\nSample Output 3\n\n4", "sample_input": "5 2\n1 4\n2 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03295", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N islands lining up from west to east, connected by N-1 bridges.\n\nThe i-th bridge connects the i-th island from the west and the (i+1)-th island from the west.\n\nOne day, disputes took place between some islands, and there were M requests from the inhabitants of the islands:\n\nRequest i: A dispute took place between the a_i-th island from the west and the b_i-th island from the west. Please make traveling between these islands with bridges impossible.\n\nYou decided to remove some bridges to meet all these M requests.\n\nFind the minimum number of bridges that must be removed.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq a_i < b_i \\leq N\n\nAll pairs (a_i, b_i) are distinct.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\na_2 b_2\n:\na_M b_M\n\nOutput\n\nPrint the minimum number of bridges that must be removed.\n\nSample Input 1\n\n5 2\n1 4\n2 5\n\nSample Output 1\n\n1\n\nThe requests can be met by removing the bridge connecting the second and third islands from the west.\n\nSample Input 2\n\n9 5\n1 8\n2 7\n3 5\n4 6\n7 9\n\nSample Output 2\n\n2\n\nSample Input 3\n\n5 10\n1 2\n1 3\n1 4\n1 5\n2 3\n2 4\n2 5\n3 4\n3 5\n4 5\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1554, "cpu_time_ms": 72, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s894799983", "group_id": "codeNet:p03303", "input_text": "program main\n\timplicit none\n character(1000) S, ans\n\tinteger w, i\n\tread(*, *) S\n\tread(*, *) w\n\tdo i = 1, len_trim(S)\n\t\tif(w == 1) then\n\t\t\twrite(*, *) trim(S)\n\t\t\tgoto 1\n\t\telse if(mod(i,w) == 1) then\n\t\t\twrite(*, '(a)', advance = 'No') S(i:i)\n\t\tend if\n\tend do\n\twrite(*, *) ''\n1 continue\nend program main", "language": "Fortran", "metadata": {"date": 1531012639, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03303.html", "problem_id": "p03303", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03303/input.txt", "sample_output_relpath": "derived/input_output/data/p03303/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03303/Fortran/s894799983.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s894799983", "user_id": "u728000113"}, "prompt_components": {"gold_output": "adg\n", "input_to_evaluate": "program main\n\timplicit none\n character(1000) S, ans\n\tinteger w, i\n\tread(*, *) S\n\tread(*, *) w\n\tdo i = 1, len_trim(S)\n\t\tif(w == 1) then\n\t\t\twrite(*, *) trim(S)\n\t\t\tgoto 1\n\t\telse if(mod(i,w) == 1) then\n\t\t\twrite(*, '(a)', advance = 'No') S(i:i)\n\t\tend if\n\tend do\n\twrite(*, *) ''\n1 continue\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nWe will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom.\n\nConstraints\n\n1 \\leq w \\leq |S| \\leq 1000\n\nS consists of lowercase English letters.\n\nw is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nw\n\nOutput\n\nPrint the desired string in one line.\n\nSample Input 1\n\nabcdefgh\n3\n\nSample Output 1\n\nadg\n\nWhen we write down abcdefgh, starting a new line after every three letters, we get the following:\n\nabc\n\ndef\n\ngh\n\nConcatenating the letters at the beginnings of these lines, we obtain adg.\n\nSample Input 2\n\nlllll\n1\n\nSample Output 2\n\nlllll\n\nSample Input 3\n\nsouuundhound\n2\n\nSample Output 3\n\nsuudon", "sample_input": "abcdefgh\n3\n"}, "reference_outputs": ["adg\n"], "source_document_id": "p03303", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters.\nWe will write down this string, starting a new line after every w letters. Print the string obtained by concatenating the letters at the beginnings of these lines from top to bottom.\n\nConstraints\n\n1 \\leq w \\leq |S| \\leq 1000\n\nS consists of lowercase English letters.\n\nw is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nw\n\nOutput\n\nPrint the desired string in one line.\n\nSample Input 1\n\nabcdefgh\n3\n\nSample Output 1\n\nadg\n\nWhen we write down abcdefgh, starting a new line after every three letters, we get the following:\n\nabc\n\ndef\n\ngh\n\nConcatenating the letters at the beginnings of these lines, we obtain adg.\n\nSample Input 2\n\nlllll\n1\n\nSample Output 2\n\nlllll\n\nSample Input 3\n\nsouuundhound\n2\n\nSample Output 3\n\nsuudon", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 303, "cpu_time_ms": 5, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s422302487", "group_id": "codeNet:p03305", "input_text": "module mod_graph\n implicit none\n integer(8), parameter :: inf = 1000000000000000000_8\n\n type item\n integer :: id = 0\n integer(8) :: wt = 0_8\n end type\n\n type priorityqueue\n integer :: num = 0\n type(item), pointer :: heap(:) => null()\n end type\n\n type edge\n integer :: fm = 0, to = 0, cp = 0, rv = 0\n integer(8) :: wt = 0_8\n end type\n\n type arraylist\n integer :: num = 0\n type(edge), pointer :: arr(:) => null()\n contains\n procedure :: bellman_ford => bellman_ford\n end type\n\n type graph\n type(arraylist), pointer :: egs(:) => null()\n logical, pointer :: used(:) => null()\n contains\n procedure :: add => add\n procedure :: dijkstra => dijkstra\n procedure :: ford_fulkerson => ford_fulkerson\n end type\n\n interface graph\n module procedure :: newg\n end interface graph\n\ncontains\n\n function newi(id,wt) result(ret)\n integer, intent(in) :: id\n integer(8), intent(in) :: wt\n type(item) :: ret\n ret%id = id\n ret%wt = wt\n end\n\n subroutine swapi(a,b)\n type(item), intent(inout) :: a, b\n type(item) :: c\n c = a\n a = b\n b = c\n end\n\n subroutine appendi(a)\n type(item), pointer, intent(inout) :: a(:)\n integer :: n\n type(item), allocatable :: tmp(:)\n n = size(a)\n allocate(tmp(n))\n tmp = a\n deallocate(a)\n allocate(a(2*n))\n a(1:n) = tmp\n deallocate(tmp)\n end\n\n function lessi(a,b) result(ret)\n type(item), intent(in) :: a, b\n logical :: ret\n ret = a%wt < b%wt\n end\n\n subroutine finalizei(pq)\n type(priorityqueue), intent(inout) :: pq\n if (associated(pq%heap)) deallocate(pq%heap)\n pq%num = 0\n end\n\n subroutine offer(pq,it)\n type(priorityqueue), intent(inout) :: pq\n type(item), intent(in) :: it\n integer :: i, j\n if (.not.associated(pq%heap)) allocate(pq%heap(1))\n if (pq%num == size(pq%heap)) call appendi(pq%heap)\n pq%num = pq%num+1\n pq%heap(pq%num) = it\n i = pq%num\n do while (i > 1)\n j = i/2\n if (lessi(pq%heap(i),pq%heap(j))) call swapi(pq%heap(i),pq%heap(j))\n i = j\n end do\n end\n\n function poll(pq) result(ret)\n type(priorityqueue), intent(inout) :: pq\n type(item) :: ret\n integer :: n, i, j\n n = pq%num\n ret = pq%heap(1)\n pq%heap(1) = pq%heap(n)\n pq%num = pq%num-1\n i = 1\n do while (2*i < n)\n j = 2*i\n if (j+1 < n .and. lessi(pq%heap(j+1),pq%heap(j))) j = j+1\n if (lessi(pq%heap(j),pq%heap(i))) call swapi(pq%heap(j),pq%heap(i))\n i = j\n end do\n end\n\n function newe(to,wt,fm,cp,rv) result(ret)\n integer, intent(in) :: to\n integer(8), intent(in) :: wt\n integer, intent(in), optional :: fm, cp, rv\n type(edge) :: ret\n if (present(fm)) ret%fm = fm\n ret%to = to\n ret%wt = wt\n if (present(cp) .and. present(rv)) then\n ret%cp = cp\n ret%rv = rv\n end if\n end\n\n subroutine appende(a)\n type(edge), pointer, intent(inout) :: a(:)\n integer :: n\n type(edge), allocatable :: tmp(:)\n n = size(a)\n allocate(tmp(n))\n tmp = a\n deallocate(a)\n allocate(a(2*n))\n a(1:n) = tmp\n deallocate(tmp)\n end\n\n function lesse(a,b) result(ret)\n type(edge), intent(in) :: a, b\n logical :: ret\n ret = a%wt < b%wt\n end\n\n subroutine finalizee(list)\n type(arraylist), intent(inout) :: list\n if (associated(list%arr)) deallocate(list%arr)\n list%num = 0\n end\n\n subroutine adde(list,e)\n type(arraylist), intent(inout) :: list\n type(edge), intent(in) :: e\n if (.not.associated(list%arr)) allocate(list%arr(1))\n if (list%num == size(list%arr)) call appende(list%arr)\n list%num = list%num+1\n list%arr(list%num) = e\n end\n\n function pope(list) result(ret)\n type(arraylist), intent(inout) :: list\n type(edge) :: ret\n ret = list%arr(list%num)\n list%num = list%num-1\n end\n\n function newg(n) result(ret)\n integer, intent(in) :: n\n type(graph) :: ret\n allocate(ret%egs(n))\n end\n\n subroutine add(g,fm,to,wt,cp)\n class(graph), intent(inout) :: g\n integer, intent(in) :: fm, to\n integer, intent(in), optional :: cp\n integer(8) :: wt\n if (present(cp)) then\n call adde(g%egs(fm),newe(to,wt,cp=cp,rv=g%egs(to)%num))\n call adde(g%egs(to),newe(fm,wt,cp=0,rv=g%egs(fm)%num-1))\n else\n call adde(g%egs(fm),newe(to,wt))\n end if\n end\n\n function dijkstra(g,s) result(ret)\n class(graph), intent(in) :: g\n integer, intent(in) :: s\n integer(8) :: ret(size(g%egs))\n type(priorityqueue) :: pq\n type(item) :: it\n type(edge) :: e\n integer :: i\n ret = inf\n ret(s) = 0_8\n call offer(pq,newi(s,ret(s)))\n do while (pq%num > 0)\n it = poll(pq)\n if (it%wt > ret(it%id)) cycle\n do i = 1, g%egs(it%id)%num\n e = g%egs(it%id)%arr(i)\n if (ret(e%to) > ret(it%id)+e%wt) then\n ret(e%to) = ret(it%id)+e%wt\n call offer(pq,newi(e%to,ret(e%to)))\n end if\n end do\n end do\n end\n\n recursive subroutine dfs_bf(g,u)\n type(graph), intent(inout) :: g\n integer, intent(in) :: u\n integer :: i, v\n g%used(u) = .true.\n do i = 1, g%egs(u)%num\n v = g%egs(u)%arr(i)%to\n if (g%used(v)) cycle\n call dfs_bf(g,v)\n end do\n end\n\n function bellman_ford(es,s,t) result(ret)\n class(arraylist), intent(in) :: es\n integer, intent(in) :: s, t\n integer(8) :: ret\n integer :: n, i, fm, to, step\n integer(8) :: wt\n logical :: updated\n integer(8), allocatable :: tmp(:)\n type(graph) :: gs, gt\n type(arraylist) :: reach\n n = 0\n do i = 1, es%num\n n = max(n,es%arr(i)%fm,es%arr(i)%to)\n end do\n gs = newg(n)\n gt = newg(n)\n allocate(gs%used(n),gt%used(n))\n gs%used = .false.\n gt%used = .false.\n do i = 1, es%num\n fm = es%arr(i)%fm\n to = es%arr(i)%to\n wt = es%arr(i)%wt\n call add(gs,fm,to,wt)\n call add(gt,to,fm,wt)\n end do\n call dfs_bf(gs,s)\n call dfs_bf(gt,t)\n n = 0\n do i = 1, es%num\n fm = es%arr(i)%fm\n to = es%arr(i)%to\n if (gs%used(fm) .and. gt%used(fm) .and. gs%used(to) .and. gt%used(to)) then\n call adde(reach,es%arr(i))\n n = max(n,fm,to)\n end if\n end do\n deallocate(gs%used,gt%used)\n allocate(tmp(n))\n tmp = inf\n tmp(s) = 0_8\n step = 0\n updated = .true.\n do while (updated)\n updated = .false.\n do i = 1, reach%num\n fm = reach%arr(i)%fm\n to = reach%arr(i)%to\n wt = reach%arr(i)%wt\n if (tmp(to) > tmp(fm)+wt) then\n tmp(to) = tmp(fm)+wt\n updated = .true.\n end if\n end do\n step = step+1\n if (step > n) then\n ret = -inf\n return\n end if\n end do\n ret = tmp(t)\n deallocate(tmp)\n end\n\n recursive function dfs_ff(g,u,t,f) result(ret)\n class(graph), intent(inout) :: g\n integer, intent(in) :: u, t, f\n integer :: ret\n integer :: i, v, cp, rv\n ret = f\n if (u == t) return\n g%used(u) = .true.\n do i = 1, g%egs(u)%num\n v = g%egs(u)%arr(i)%to\n cp = g%egs(u)%arr(i)%cp\n if (g%used(v) .or. cp <= 0) cycle\n ret = dfs_ff(g,v,t,min(f,cp))\n rv = g%egs(u)%arr(i)%rv\n if (ret > 0) then\n g%egs(u)%arr(i)%cp = g%egs(u)%arr(i)%cp-ret\n g%egs(v)%arr(rv)%cp = g%egs(v)%arr(rv)%cp+ret\n return\n end if\n end do\n ret = 0\n end\n\n function ford_fulkerson(g,s,t) result(ret)\n class(graph), intent(inout) :: g\n integer, intent(in) :: s, t\n integer :: ret\n integer :: f\n ret = 0\n if (.not.associated(g%used)) allocate(g%used(size(g%egs)))\n do\n g%used = .false.\n f = dfs_ff(g,s,t,1000000000)\n if (f == 0) then\n deallocate(g%used)\n return\n end if\n ret = ret+f\n end do\n end\n\nend module mod_graph\n\nprogram saving_snuuk\n use mod_graph\n implicit none\n integer(8), parameter :: dyen = 1000000000000000_8\n integer :: n, m, s, t, u, v, i\n integer(8) :: a, b, cy(100000) = 0_8, cs(100000) = 0_8, ans(100000) = 0_8\n type(graph) :: gy, gs\n read(*,*) n, m, s, t\n gy = graph(n)\n gs = graph(n)\n do i = 1, m\n read(*,*) u, v, a, b\n call gy%add(u,v,a)\n call gy%add(v,u,a)\n call gs%add(u,v,b)\n call gs%add(v,u,b)\n end do\n cy(1:n) = gy%dijkstra(s)\n cs(1:n) = gs%dijkstra(t)\n ans(n) = cy(n)+cs(n)\n do i = n-1, 1, -1\n ans(i) = min(ans(i+1),cy(i)+cs(i))\n end do\n do i = 1, n\n write(*,'(i0)') dyen-ans(i)\n end do\nend program saving_snuuk", "language": "Fortran", "metadata": {"date": 1567205313, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03305.html", "problem_id": "p03305", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03305/input.txt", "sample_output_relpath": "derived/input_output/data/p03305/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03305/Fortran/s422302487.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s422302487", "user_id": "u506403362"}, "prompt_components": {"gold_output": "999999999999998\n999999999999989\n999999999999979\n999999999999897\n", "input_to_evaluate": "module mod_graph\n implicit none\n integer(8), parameter :: inf = 1000000000000000000_8\n\n type item\n integer :: id = 0\n integer(8) :: wt = 0_8\n end type\n\n type priorityqueue\n integer :: num = 0\n type(item), pointer :: heap(:) => null()\n end type\n\n type edge\n integer :: fm = 0, to = 0, cp = 0, rv = 0\n integer(8) :: wt = 0_8\n end type\n\n type arraylist\n integer :: num = 0\n type(edge), pointer :: arr(:) => null()\n contains\n procedure :: bellman_ford => bellman_ford\n end type\n\n type graph\n type(arraylist), pointer :: egs(:) => null()\n logical, pointer :: used(:) => null()\n contains\n procedure :: add => add\n procedure :: dijkstra => dijkstra\n procedure :: ford_fulkerson => ford_fulkerson\n end type\n\n interface graph\n module procedure :: newg\n end interface graph\n\ncontains\n\n function newi(id,wt) result(ret)\n integer, intent(in) :: id\n integer(8), intent(in) :: wt\n type(item) :: ret\n ret%id = id\n ret%wt = wt\n end\n\n subroutine swapi(a,b)\n type(item), intent(inout) :: a, b\n type(item) :: c\n c = a\n a = b\n b = c\n end\n\n subroutine appendi(a)\n type(item), pointer, intent(inout) :: a(:)\n integer :: n\n type(item), allocatable :: tmp(:)\n n = size(a)\n allocate(tmp(n))\n tmp = a\n deallocate(a)\n allocate(a(2*n))\n a(1:n) = tmp\n deallocate(tmp)\n end\n\n function lessi(a,b) result(ret)\n type(item), intent(in) :: a, b\n logical :: ret\n ret = a%wt < b%wt\n end\n\n subroutine finalizei(pq)\n type(priorityqueue), intent(inout) :: pq\n if (associated(pq%heap)) deallocate(pq%heap)\n pq%num = 0\n end\n\n subroutine offer(pq,it)\n type(priorityqueue), intent(inout) :: pq\n type(item), intent(in) :: it\n integer :: i, j\n if (.not.associated(pq%heap)) allocate(pq%heap(1))\n if (pq%num == size(pq%heap)) call appendi(pq%heap)\n pq%num = pq%num+1\n pq%heap(pq%num) = it\n i = pq%num\n do while (i > 1)\n j = i/2\n if (lessi(pq%heap(i),pq%heap(j))) call swapi(pq%heap(i),pq%heap(j))\n i = j\n end do\n end\n\n function poll(pq) result(ret)\n type(priorityqueue), intent(inout) :: pq\n type(item) :: ret\n integer :: n, i, j\n n = pq%num\n ret = pq%heap(1)\n pq%heap(1) = pq%heap(n)\n pq%num = pq%num-1\n i = 1\n do while (2*i < n)\n j = 2*i\n if (j+1 < n .and. lessi(pq%heap(j+1),pq%heap(j))) j = j+1\n if (lessi(pq%heap(j),pq%heap(i))) call swapi(pq%heap(j),pq%heap(i))\n i = j\n end do\n end\n\n function newe(to,wt,fm,cp,rv) result(ret)\n integer, intent(in) :: to\n integer(8), intent(in) :: wt\n integer, intent(in), optional :: fm, cp, rv\n type(edge) :: ret\n if (present(fm)) ret%fm = fm\n ret%to = to\n ret%wt = wt\n if (present(cp) .and. present(rv)) then\n ret%cp = cp\n ret%rv = rv\n end if\n end\n\n subroutine appende(a)\n type(edge), pointer, intent(inout) :: a(:)\n integer :: n\n type(edge), allocatable :: tmp(:)\n n = size(a)\n allocate(tmp(n))\n tmp = a\n deallocate(a)\n allocate(a(2*n))\n a(1:n) = tmp\n deallocate(tmp)\n end\n\n function lesse(a,b) result(ret)\n type(edge), intent(in) :: a, b\n logical :: ret\n ret = a%wt < b%wt\n end\n\n subroutine finalizee(list)\n type(arraylist), intent(inout) :: list\n if (associated(list%arr)) deallocate(list%arr)\n list%num = 0\n end\n\n subroutine adde(list,e)\n type(arraylist), intent(inout) :: list\n type(edge), intent(in) :: e\n if (.not.associated(list%arr)) allocate(list%arr(1))\n if (list%num == size(list%arr)) call appende(list%arr)\n list%num = list%num+1\n list%arr(list%num) = e\n end\n\n function pope(list) result(ret)\n type(arraylist), intent(inout) :: list\n type(edge) :: ret\n ret = list%arr(list%num)\n list%num = list%num-1\n end\n\n function newg(n) result(ret)\n integer, intent(in) :: n\n type(graph) :: ret\n allocate(ret%egs(n))\n end\n\n subroutine add(g,fm,to,wt,cp)\n class(graph), intent(inout) :: g\n integer, intent(in) :: fm, to\n integer, intent(in), optional :: cp\n integer(8) :: wt\n if (present(cp)) then\n call adde(g%egs(fm),newe(to,wt,cp=cp,rv=g%egs(to)%num))\n call adde(g%egs(to),newe(fm,wt,cp=0,rv=g%egs(fm)%num-1))\n else\n call adde(g%egs(fm),newe(to,wt))\n end if\n end\n\n function dijkstra(g,s) result(ret)\n class(graph), intent(in) :: g\n integer, intent(in) :: s\n integer(8) :: ret(size(g%egs))\n type(priorityqueue) :: pq\n type(item) :: it\n type(edge) :: e\n integer :: i\n ret = inf\n ret(s) = 0_8\n call offer(pq,newi(s,ret(s)))\n do while (pq%num > 0)\n it = poll(pq)\n if (it%wt > ret(it%id)) cycle\n do i = 1, g%egs(it%id)%num\n e = g%egs(it%id)%arr(i)\n if (ret(e%to) > ret(it%id)+e%wt) then\n ret(e%to) = ret(it%id)+e%wt\n call offer(pq,newi(e%to,ret(e%to)))\n end if\n end do\n end do\n end\n\n recursive subroutine dfs_bf(g,u)\n type(graph), intent(inout) :: g\n integer, intent(in) :: u\n integer :: i, v\n g%used(u) = .true.\n do i = 1, g%egs(u)%num\n v = g%egs(u)%arr(i)%to\n if (g%used(v)) cycle\n call dfs_bf(g,v)\n end do\n end\n\n function bellman_ford(es,s,t) result(ret)\n class(arraylist), intent(in) :: es\n integer, intent(in) :: s, t\n integer(8) :: ret\n integer :: n, i, fm, to, step\n integer(8) :: wt\n logical :: updated\n integer(8), allocatable :: tmp(:)\n type(graph) :: gs, gt\n type(arraylist) :: reach\n n = 0\n do i = 1, es%num\n n = max(n,es%arr(i)%fm,es%arr(i)%to)\n end do\n gs = newg(n)\n gt = newg(n)\n allocate(gs%used(n),gt%used(n))\n gs%used = .false.\n gt%used = .false.\n do i = 1, es%num\n fm = es%arr(i)%fm\n to = es%arr(i)%to\n wt = es%arr(i)%wt\n call add(gs,fm,to,wt)\n call add(gt,to,fm,wt)\n end do\n call dfs_bf(gs,s)\n call dfs_bf(gt,t)\n n = 0\n do i = 1, es%num\n fm = es%arr(i)%fm\n to = es%arr(i)%to\n if (gs%used(fm) .and. gt%used(fm) .and. gs%used(to) .and. gt%used(to)) then\n call adde(reach,es%arr(i))\n n = max(n,fm,to)\n end if\n end do\n deallocate(gs%used,gt%used)\n allocate(tmp(n))\n tmp = inf\n tmp(s) = 0_8\n step = 0\n updated = .true.\n do while (updated)\n updated = .false.\n do i = 1, reach%num\n fm = reach%arr(i)%fm\n to = reach%arr(i)%to\n wt = reach%arr(i)%wt\n if (tmp(to) > tmp(fm)+wt) then\n tmp(to) = tmp(fm)+wt\n updated = .true.\n end if\n end do\n step = step+1\n if (step > n) then\n ret = -inf\n return\n end if\n end do\n ret = tmp(t)\n deallocate(tmp)\n end\n\n recursive function dfs_ff(g,u,t,f) result(ret)\n class(graph), intent(inout) :: g\n integer, intent(in) :: u, t, f\n integer :: ret\n integer :: i, v, cp, rv\n ret = f\n if (u == t) return\n g%used(u) = .true.\n do i = 1, g%egs(u)%num\n v = g%egs(u)%arr(i)%to\n cp = g%egs(u)%arr(i)%cp\n if (g%used(v) .or. cp <= 0) cycle\n ret = dfs_ff(g,v,t,min(f,cp))\n rv = g%egs(u)%arr(i)%rv\n if (ret > 0) then\n g%egs(u)%arr(i)%cp = g%egs(u)%arr(i)%cp-ret\n g%egs(v)%arr(rv)%cp = g%egs(v)%arr(rv)%cp+ret\n return\n end if\n end do\n ret = 0\n end\n\n function ford_fulkerson(g,s,t) result(ret)\n class(graph), intent(inout) :: g\n integer, intent(in) :: s, t\n integer :: ret\n integer :: f\n ret = 0\n if (.not.associated(g%used)) allocate(g%used(size(g%egs)))\n do\n g%used = .false.\n f = dfs_ff(g,s,t,1000000000)\n if (f == 0) then\n deallocate(g%used)\n return\n end if\n ret = ret+f\n end do\n end\n\nend module mod_graph\n\nprogram saving_snuuk\n use mod_graph\n implicit none\n integer(8), parameter :: dyen = 1000000000000000_8\n integer :: n, m, s, t, u, v, i\n integer(8) :: a, b, cy(100000) = 0_8, cs(100000) = 0_8, ans(100000) = 0_8\n type(graph) :: gy, gs\n read(*,*) n, m, s, t\n gy = graph(n)\n gs = graph(n)\n do i = 1, m\n read(*,*) u, v, a, b\n call gy%add(u,v,a)\n call gy%add(v,u,a)\n call gs%add(u,v,b)\n call gs%add(v,u,b)\n end do\n cy(1:n) = gy%dijkstra(s)\n cs(1:n) = gs%dijkstra(t)\n ans(n) = cy(n)+cs(n)\n do i = n-1, 1, -1\n ans(i) = min(ans(i+1),cy(i)+cs(i))\n end do\n do i = 1, n\n write(*,'(i0)') dyen-ans(i)\n end do\nend program saving_snuuk", "problem_context": "Score : 400 points\n\nProblem Statement\n\nKenkoooo is planning a trip in Republic of Snuke.\nIn this country, there are n cities and m trains running.\nThe cities are numbered 1 through n, and the i-th train connects City u_i and v_i bidirectionally.\nAny city can be reached from any city by changing trains.\n\nTwo currencies are used in the country: yen and snuuk.\nAny train fare can be paid by both yen and snuuk.\nThe fare of the i-th train is a_i yen if paid in yen, and b_i snuuk if paid in snuuk.\n\nIn a city with a money exchange office, you can change 1 yen into 1 snuuk.\nHowever, when you do a money exchange, you have to change all your yen into snuuk.\nThat is, if Kenkoooo does a money exchange when he has X yen, he will then have X snuuk.\nCurrently, there is a money exchange office in every city, but the office in City i will shut down in i years and can never be used in and after that year.\n\nKenkoooo is planning to depart City s with 10^{15} yen in his pocket and head for City t, and change his yen into snuuk in some city while traveling.\nIt is acceptable to do the exchange in City s or City t.\n\nKenkoooo would like to have as much snuuk as possible when he reaches City t by making the optimal choices for the route to travel and the city to do the exchange.\nFor each i=0,...,n-1, find the maximum amount of snuuk that Kenkoooo has when he reaches City t if he goes on a trip from City s to City t after i years.\nYou can assume that the trip finishes within the year.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n1 \\leq m \\leq 10^5\n\n1 \\leq s,t \\leq n\n\ns \\neq t\n\n1 \\leq u_i < v_i \\leq n\n\n1 \\leq a_i,b_i \\leq 10^9\n\nIf i\\neq j, then u_i \\neq u_j or v_i \\neq v_j.\n\nAny city can be reached from any city by changing trains.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m s t\nu_1 v_1 a_1 b_1\n:\nu_m v_m a_m b_m\n\nOutput\n\nPrint n lines.\nIn the i-th line, print the maximum amount of snuuk that Kenkoooo has when he reaches City t if he goes on a trip from City s to City t after i-1 years.\n\nSample Input 1\n\n4 3 2 3\n1 4 1 100\n1 2 1 10\n1 3 20 1\n\nSample Output 1\n\n999999999999998\n999999999999989\n999999999999979\n999999999999897\n\nAfter 0 years, it is optimal to do the exchange in City 1.\n\nAfter 1 years, it is optimal to do the exchange in City 2.\n\nNote that City 1 can still be visited even after the exchange office is closed.\nAlso note that, if it was allowed to keep 1 yen when do the exchange in City 2 and change the remaining yen into snuuk, we could reach City 3 with 999999999999998 snuuk, but this is NOT allowed.\n\nAfter 2 years, it is optimal to do the exchange in City 3.\n\nAfter 3 years, it is optimal to do the exchange in City 4.\nNote that the same train can be used multiple times.\n\nSample Input 2\n\n8 12 3 8\n2 8 685087149 857180777\n6 7 298270585 209942236\n2 4 346080035 234079976\n2 5 131857300 22507157\n4 8 30723332 173476334\n2 6 480845267 448565596\n1 4 181424400 548830121\n4 5 57429995 195056405\n7 8 160277628 479932440\n1 6 475692952 203530153\n3 5 336869679 160714712\n2 7 389775999 199123879\n\nSample Output 2\n\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994", "sample_input": "4 3 2 3\n1 4 1 100\n1 2 1 10\n1 3 20 1\n"}, "reference_outputs": ["999999999999998\n999999999999989\n999999999999979\n999999999999897\n"], "source_document_id": "p03305", "source_text": "Score : 400 points\n\nProblem Statement\n\nKenkoooo is planning a trip in Republic of Snuke.\nIn this country, there are n cities and m trains running.\nThe cities are numbered 1 through n, and the i-th train connects City u_i and v_i bidirectionally.\nAny city can be reached from any city by changing trains.\n\nTwo currencies are used in the country: yen and snuuk.\nAny train fare can be paid by both yen and snuuk.\nThe fare of the i-th train is a_i yen if paid in yen, and b_i snuuk if paid in snuuk.\n\nIn a city with a money exchange office, you can change 1 yen into 1 snuuk.\nHowever, when you do a money exchange, you have to change all your yen into snuuk.\nThat is, if Kenkoooo does a money exchange when he has X yen, he will then have X snuuk.\nCurrently, there is a money exchange office in every city, but the office in City i will shut down in i years and can never be used in and after that year.\n\nKenkoooo is planning to depart City s with 10^{15} yen in his pocket and head for City t, and change his yen into snuuk in some city while traveling.\nIt is acceptable to do the exchange in City s or City t.\n\nKenkoooo would like to have as much snuuk as possible when he reaches City t by making the optimal choices for the route to travel and the city to do the exchange.\nFor each i=0,...,n-1, find the maximum amount of snuuk that Kenkoooo has when he reaches City t if he goes on a trip from City s to City t after i years.\nYou can assume that the trip finishes within the year.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n1 \\leq m \\leq 10^5\n\n1 \\leq s,t \\leq n\n\ns \\neq t\n\n1 \\leq u_i < v_i \\leq n\n\n1 \\leq a_i,b_i \\leq 10^9\n\nIf i\\neq j, then u_i \\neq u_j or v_i \\neq v_j.\n\nAny city can be reached from any city by changing trains.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m s t\nu_1 v_1 a_1 b_1\n:\nu_m v_m a_m b_m\n\nOutput\n\nPrint n lines.\nIn the i-th line, print the maximum amount of snuuk that Kenkoooo has when he reaches City t if he goes on a trip from City s to City t after i-1 years.\n\nSample Input 1\n\n4 3 2 3\n1 4 1 100\n1 2 1 10\n1 3 20 1\n\nSample Output 1\n\n999999999999998\n999999999999989\n999999999999979\n999999999999897\n\nAfter 0 years, it is optimal to do the exchange in City 1.\n\nAfter 1 years, it is optimal to do the exchange in City 2.\n\nNote that City 1 can still be visited even after the exchange office is closed.\nAlso note that, if it was allowed to keep 1 yen when do the exchange in City 2 and change the remaining yen into snuuk, we could reach City 3 with 999999999999998 snuuk, but this is NOT allowed.\n\nAfter 2 years, it is optimal to do the exchange in City 3.\n\nAfter 3 years, it is optimal to do the exchange in City 4.\nNote that the same train can be used multiple times.\n\nSample Input 2\n\n8 12 3 8\n2 8 685087149 857180777\n6 7 298270585 209942236\n2 4 346080035 234079976\n2 5 131857300 22507157\n4 8 30723332 173476334\n2 6 480845267 448565596\n1 4 181424400 548830121\n4 5 57429995 195056405\n7 8 160277628 479932440\n1 6 475692952 203530153\n3 5 336869679 160714712\n2 7 389775999 199123879\n\nSample Output 2\n\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994\n999999574976994", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 8360, "cpu_time_ms": 317, "memory_kb": 30156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s714507602", "group_id": "codeNet:p03307", "input_text": "program main\n implicit none\n integer :: n\n read(*, *) n\n if (mod(n, 2) /= 0) then\n n = n * 2\n end if\n write(*, \"(i0)\") n\nend program main\n", "language": "Fortran", "metadata": {"date": 1547660398, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03307.html", "problem_id": "p03307", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03307/input.txt", "sample_output_relpath": "derived/input_output/data/p03307/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03307/Fortran/s714507602.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s714507602", "user_id": "u388927326"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "program main\n implicit none\n integer :: n\n read(*, *) n\n if (mod(n, 2) /= 0) then\n n = n * 2\n end if\n write(*, \"(i0)\") n\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a positive integer N.\nFind the minimum positive integer divisible by both 2 and N.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum positive integer divisible by both 2 and N.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\n6 is divisible by both 2 and 3.\nAlso, there is no positive integer less than 6 that is divisible by both 2 and 3.\nThus, the answer is 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n1999999998", "sample_input": "3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03307", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a positive integer N.\nFind the minimum positive integer divisible by both 2 and N.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum positive integer divisible by both 2 and N.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\n6 is divisible by both 2 and 3.\nAlso, there is no positive integer less than 6 that is divisible by both 2 and 3.\nThus, the answer is 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n10\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\n1999999998", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 147, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s727579405", "group_id": "codeNet:p03308", "input_text": "program main\n implicit none\n \n integer :: n,i,j,a(100),t\n \n read(*,*)n\n read(*,*)(a(i),i = 1, n)\n \n do i=1,N-1\n do j=i+1,N\n if(a(i) .gt. a(j))then\n t=a(i)\n a(i)=a(j)\n a(j)=t\n end if\n end do\n end do\n \n write(*,*)abs(a(1) - a(n))\nend program main\n", "language": "Fortran", "metadata": {"date": 1571081695, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03308.html", "problem_id": "p03308", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03308/input.txt", "sample_output_relpath": "derived/input_output/data/p03308/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03308/Fortran/s727579405.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s727579405", "user_id": "u287431190"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program main\n implicit none\n \n integer :: n,i,j,a(100),t\n \n read(*,*)n\n read(*,*)(a(i),i = 1, n)\n \n do i=1,N-1\n do j=i+1,N\n if(a(i) .gt. a(j))then\n t=a(i)\n a(i)=a(j)\n a(j)=t\n end if\n end do\n end do\n \n write(*,*)abs(a(1) - a(n))\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an integer sequence A of length N.\nFind the maximum absolute difference of two elements (with different indices) in A.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum absolute difference of two elements (with different indices) in A.\n\nSample Input 1\n\n4\n1 4 6 3\n\nSample Output 1\n\n5\n\nThe maximum absolute difference of two elements is A_3-A_1=6-1=5.\n\nSample Input 2\n\n2\n1000000000 1\n\nSample Output 2\n\n999999999\n\nSample Input 3\n\n5\n1 1 1 1 1\n\nSample Output 3\n\n0", "sample_input": "4\n1 4 6 3\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03308", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an integer sequence A of length N.\nFind the maximum absolute difference of two elements (with different indices) in A.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum absolute difference of two elements (with different indices) in A.\n\nSample Input 1\n\n4\n1 4 6 3\n\nSample Output 1\n\n5\n\nThe maximum absolute difference of two elements is A_3-A_1=6-1=5.\n\nSample Input 2\n\n2\n1000000000 1\n\nSample Output 2\n\n999999999\n\nSample Input 3\n\n5\n1 1 1 1 1\n\nSample Output 3\n\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 308, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s758948260", "group_id": "codeNet:p03309", "input_text": "program c\n\ninteger(8) :: n,a(200000),nn,ans=0\n\nread(*,*) n\nread(*,*) (a(i),i=1,n)\n\ndo i=1,n\n\ta(i) = a(i) - i\nenddo\n\ncall heapsort(n,a(1:n))\nnn = a((n+1)/2)\n\ndo i=1,n\n\ta(i) = abs(a(i) - nn)\nenddo\n\nwrite(*,*) sum(a(1:n))\n\n\n\ncontains\n\nsubroutine heapsort(n,y1)\n\n\timplicit none\n\tinteger(8),intent(in) :: n\n\tinteger(8),intent(inout) :: y1(1:n)\n\tinteger(8) :: i,k,j,l\n\tinteger(8) :: t1\n\t\n\tl = n/2+1\n\tk = n\n\n\tdo while (k /= 1)\n\t\t if(l > 1) then\n\t\t\t\tl = l-1\n\t\t\t\tt1 = y1(l)\n\t\t\t\t\n\t\t else\n\t\t\t\tt1 = y1(k)\n\t\t\t\ty1(k) = y1(1)\n\t\t\t\tk = k-1\n\t\t\t\tif(k == 1) then\n\t\t\t\t\t y1(1) = t1\n\t\t\t\t\t exit\n\t\t\t\tendif\n\t\t endif\n\n\t\t i = l\n\t\t j = l+l\n\n\t\t do while(j <= k)\n\t\t\t\tif(j < k) then\n\t\t\t\t\t if(y1(j) < y1(j+1)) j = j+1\n\t\t\t\tendif\n\t\t\t\t\n\t\t\t\tif (t1 < y1(j)) then\n\t\t\t\t\t y1(i) = y1(j)\n\t\t\t\t\t i = j\n\t\t\t\t\t j = j+j\n\t\t\t\telse\n\t\t\t\t\t j = k+1\n\t\t\t\tendif\n\t\t \n\t\t enddo\n\t\t \n\t\t y1(i) = t1\n\t\n\tenddo\n\treturn\n\nend subroutine heapsort\n\nend program", "language": "Fortran", "metadata": {"date": 1533415040, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03309.html", "problem_id": "p03309", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03309/input.txt", "sample_output_relpath": "derived/input_output/data/p03309/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03309/Fortran/s758948260.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s758948260", "user_id": "u454703763"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program c\n\ninteger(8) :: n,a(200000),nn,ans=0\n\nread(*,*) n\nread(*,*) (a(i),i=1,n)\n\ndo i=1,n\n\ta(i) = a(i) - i\nenddo\n\ncall heapsort(n,a(1:n))\nnn = a((n+1)/2)\n\ndo i=1,n\n\ta(i) = abs(a(i) - nn)\nenddo\n\nwrite(*,*) sum(a(1:n))\n\n\n\ncontains\n\nsubroutine heapsort(n,y1)\n\n\timplicit none\n\tinteger(8),intent(in) :: n\n\tinteger(8),intent(inout) :: y1(1:n)\n\tinteger(8) :: i,k,j,l\n\tinteger(8) :: t1\n\t\n\tl = n/2+1\n\tk = n\n\n\tdo while (k /= 1)\n\t\t if(l > 1) then\n\t\t\t\tl = l-1\n\t\t\t\tt1 = y1(l)\n\t\t\t\t\n\t\t else\n\t\t\t\tt1 = y1(k)\n\t\t\t\ty1(k) = y1(1)\n\t\t\t\tk = k-1\n\t\t\t\tif(k == 1) then\n\t\t\t\t\t y1(1) = t1\n\t\t\t\t\t exit\n\t\t\t\tendif\n\t\t endif\n\n\t\t i = l\n\t\t j = l+l\n\n\t\t do while(j <= k)\n\t\t\t\tif(j < k) then\n\t\t\t\t\t if(y1(j) < y1(j+1)) j = j+1\n\t\t\t\tendif\n\t\t\t\t\n\t\t\t\tif (t1 < y1(j)) then\n\t\t\t\t\t y1(i) = y1(j)\n\t\t\t\t\t i = j\n\t\t\t\t\t j = j+j\n\t\t\t\telse\n\t\t\t\t\t j = k+1\n\t\t\t\tendif\n\t\t \n\t\t enddo\n\t\t \n\t\t y1(i) = t1\n\t\n\tenddo\n\treturn\n\nend subroutine heapsort\n\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will freely choose an integer b.\nHere, he will get sad if A_i and b+i are far from each other.\nMore specifically, the sadness of Snuke is calculated as follows:\n\nabs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\nHere, abs(x) is a function that returns the absolute value of x.\n\nFind the minimum possible sadness of Snuke.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible sadness of Snuke.\n\nSample Input 1\n\n5\n2 2 3 5 5\n\nSample Output 1\n\n2\n\nIf we choose b=0, the sadness of Snuke would be abs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2.\nAny choice of b does not make the sadness of Snuke less than 2, so the answer is 2.\n\nSample Input 2\n\n9\n1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n6\n6 5 4 3 2 1\n\nSample Output 3\n\n18\n\nSample Input 4\n\n7\n1 1 1 1 2 3 4\n\nSample Output 4\n\n6", "sample_input": "5\n2 2 3 5 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03309", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will freely choose an integer b.\nHere, he will get sad if A_i and b+i are far from each other.\nMore specifically, the sadness of Snuke is calculated as follows:\n\nabs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\nHere, abs(x) is a function that returns the absolute value of x.\n\nFind the minimum possible sadness of Snuke.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible sadness of Snuke.\n\nSample Input 1\n\n5\n2 2 3 5 5\n\nSample Output 1\n\n2\n\nIf we choose b=0, the sadness of Snuke would be abs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2.\nAny choice of b does not make the sadness of Snuke less than 2, so the answer is 2.\n\nSample Input 2\n\n9\n1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n6\n6 5 4 3 2 1\n\nSample Output 3\n\n18\n\nSample Input 4\n\n7\n1 1 1 1 2 3 4\n\nSample Output 4\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 889, "cpu_time_ms": 88, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s559199386", "group_id": "codeNet:p03309", "input_text": "program main\n implicit none\n integer n,i,sumv1,sumv2,b1,b2\n integer,allocatable,dimension(:)::a\n read(*,*)n\n allocate(a(n))\n read(*,*)a\n do i=1,n\n a(i)=a(i)-i\n enddo\n sumv1=0;sumv2=0\n b1=sum(a)/n\n b2=b1-1\n do i=1,n\n sumv1=sumv1+abs(b1-a(i))\n sumv2=sumv2+abs(b2-a(i))\n enddo\n write(*,*)min(sumv1,sumv2)\n \nend program main\n", "language": "Fortran", "metadata": {"date": 1530617908, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03309.html", "problem_id": "p03309", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03309/input.txt", "sample_output_relpath": "derived/input_output/data/p03309/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03309/Fortran/s559199386.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s559199386", "user_id": "u539011156"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer n,i,sumv1,sumv2,b1,b2\n integer,allocatable,dimension(:)::a\n read(*,*)n\n allocate(a(n))\n read(*,*)a\n do i=1,n\n a(i)=a(i)-i\n enddo\n sumv1=0;sumv2=0\n b1=sum(a)/n\n b2=b1-1\n do i=1,n\n sumv1=sumv1+abs(b1-a(i))\n sumv2=sumv2+abs(b2-a(i))\n enddo\n write(*,*)min(sumv1,sumv2)\n \nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will freely choose an integer b.\nHere, he will get sad if A_i and b+i are far from each other.\nMore specifically, the sadness of Snuke is calculated as follows:\n\nabs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\nHere, abs(x) is a function that returns the absolute value of x.\n\nFind the minimum possible sadness of Snuke.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible sadness of Snuke.\n\nSample Input 1\n\n5\n2 2 3 5 5\n\nSample Output 1\n\n2\n\nIf we choose b=0, the sadness of Snuke would be abs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2.\nAny choice of b does not make the sadness of Snuke less than 2, so the answer is 2.\n\nSample Input 2\n\n9\n1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n6\n6 5 4 3 2 1\n\nSample Output 3\n\n18\n\nSample Input 4\n\n7\n1 1 1 1 2 3 4\n\nSample Output 4\n\n6", "sample_input": "5\n2 2 3 5 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03309", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will freely choose an integer b.\nHere, he will get sad if A_i and b+i are far from each other.\nMore specifically, the sadness of Snuke is calculated as follows:\n\nabs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\nHere, abs(x) is a function that returns the absolute value of x.\n\nFind the minimum possible sadness of Snuke.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible sadness of Snuke.\n\nSample Input 1\n\n5\n2 2 3 5 5\n\nSample Output 1\n\n2\n\nIf we choose b=0, the sadness of Snuke would be abs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2.\nAny choice of b does not make the sadness of Snuke less than 2, so the answer is 2.\n\nSample Input 2\n\n9\n1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n6\n6 5 4 3 2 1\n\nSample Output 3\n\n18\n\nSample Input 4\n\n7\n1 1 1 1 2 3 4\n\nSample Output 4\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 408, "cpu_time_ms": 65, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s240375961", "group_id": "codeNet:p03311", "input_text": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\n\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\nprogram arc100_a\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int64):: n,i,ans\n integer(int64), allocatable:: a(:)\n\n read*, n\n allocate(a(n))\n read*, a(:)\n do i=1,n\n a(i)=a(i)-i\n end do\n \n call merge_sort(a,1_8,n)\n ans = sum(abs(a(:)-a(n/2+1)))\n print'(i0)', ans\nend program arc100_a", "language": "Fortran", "metadata": {"date": 1591637110, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03311.html", "problem_id": "p03311", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03311/input.txt", "sample_output_relpath": "derived/input_output/data/p03311/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03311/Fortran/s240375961.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s240375961", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\n\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\nprogram arc100_a\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int64):: n,i,ans\n integer(int64), allocatable:: a(:)\n\n read*, n\n allocate(a(n))\n read*, a(:)\n do i=1,n\n a(i)=a(i)-i\n end do\n \n call merge_sort(a,1_8,n)\n ans = sum(abs(a(:)-a(n/2+1)))\n print'(i0)', ans\nend program arc100_a", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will freely choose an integer b.\nHere, he will get sad if A_i and b+i are far from each other.\nMore specifically, the sadness of Snuke is calculated as follows:\n\nabs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\nHere, abs(x) is a function that returns the absolute value of x.\n\nFind the minimum possible sadness of Snuke.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible sadness of Snuke.\n\nSample Input 1\n\n5\n2 2 3 5 5\n\nSample Output 1\n\n2\n\nIf we choose b=0, the sadness of Snuke would be abs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2.\nAny choice of b does not make the sadness of Snuke less than 2, so the answer is 2.\n\nSample Input 2\n\n9\n1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n6\n6 5 4 3 2 1\n\nSample Output 3\n\n18\n\nSample Input 4\n\n7\n1 1 1 1 2 3 4\n\nSample Output 4\n\n6", "sample_input": "5\n2 2 3 5 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03311", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has an integer sequence A of length N.\n\nHe will freely choose an integer b.\nHere, he will get sad if A_i and b+i are far from each other.\nMore specifically, the sadness of Snuke is calculated as follows:\n\nabs(A_1 - (b+1)) + abs(A_2 - (b+2)) + ... + abs(A_N - (b+N))\n\nHere, abs(x) is a function that returns the absolute value of x.\n\nFind the minimum possible sadness of Snuke.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum possible sadness of Snuke.\n\nSample Input 1\n\n5\n2 2 3 5 5\n\nSample Output 1\n\n2\n\nIf we choose b=0, the sadness of Snuke would be abs(2-(0+1))+abs(2-(0+2))+abs(3-(0+3))+abs(5-(0+4))+abs(5-(0+5))=2.\nAny choice of b does not make the sadness of Snuke less than 2, so the answer is 2.\n\nSample Input 2\n\n9\n1 2 3 4 5 6 7 8 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n6\n6 5 4 3 2 1\n\nSample Output 3\n\n18\n\nSample Input 4\n\n7\n1 1 1 1 2 3 4\n\nSample Output 4\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6526, "cpu_time_ms": 95, "memory_kb": 4644}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s768676988", "group_id": "codeNet:p03315", "input_text": "program test\nimplicit none\n\ncharacter(4) :: eat\ninteger :: i,j,k,l,m,n\n\nread(*,*) eat\nif(eat=='++++') then\n\twrite(*,*) 4\nelse if(eat=='-+++' .or. eat=='+-++' .or. eat=='++-+' .or. eat=='+++-') then\n\twrite(*,*) 2\nelse if (eat=='----') then\n\twrite(*,*) -4\nelse if (eat=='---+' .or. eat=='--+-' .or. eat=='-+--' .or. eat=='+---') then\n\twrite(*,*) -2\nelse\n\twrite(*,*) 0\nendif\n\nend program", "language": "Fortran", "metadata": {"date": 1529802288, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03315.html", "problem_id": "p03315", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03315/input.txt", "sample_output_relpath": "derived/input_output/data/p03315/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03315/Fortran/s768676988.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s768676988", "user_id": "u454703763"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program test\nimplicit none\n\ncharacter(4) :: eat\ninteger :: i,j,k,l,m,n\n\nread(*,*) eat\nif(eat=='++++') then\n\twrite(*,*) 4\nelse if(eat=='-+++' .or. eat=='+-++' .or. eat=='++-+' .or. eat=='+++-') then\n\twrite(*,*) 2\nelse if (eat=='----') then\n\twrite(*,*) -4\nelse if (eat=='---+' .or. eat=='--+-' .or. eat=='-+--' .or. eat=='+---') then\n\twrite(*,*) -2\nelse\n\twrite(*,*) 0\nendif\n\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is always an integer in Takahashi's mind.\n\nInitially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is + or -. When he eats +, the integer in his mind increases by 1; when he eats -, the integer in his mind decreases by 1.\n\nThe symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat.\n\nFind the integer in Takahashi's mind after he eats all the symbols.\n\nConstraints\n\nThe length of S is 4.\n\nEach character in S is + or -.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the integer in Takahashi's mind after he eats all the symbols.\n\nSample Input 1\n\n+-++\n\nSample Output 1\n\n2\n\nInitially, the integer in Takahashi's mind is 0.\n\nThe first integer for him to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe second integer to eat is -. After eating it, the integer in his mind becomes 0.\n\nThe third integer to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe fourth integer to eat is +. After eating it, the integer in his mind becomes 2.\n\nThus, the integer in Takahashi's mind after he eats all the symbols is 2.\n\nSample Input 2\n\n-+--\n\nSample Output 2\n\n-2\n\nSample Input 3\n\n----\n\nSample Output 3\n\n-4", "sample_input": "+-++\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03315", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is always an integer in Takahashi's mind.\n\nInitially, the integer in Takahashi's mind is 0. Takahashi is now going to eat four symbols, each of which is + or -. When he eats +, the integer in his mind increases by 1; when he eats -, the integer in his mind decreases by 1.\n\nThe symbols Takahashi is going to eat are given to you as a string S. The i-th character in S is the i-th symbol for him to eat.\n\nFind the integer in Takahashi's mind after he eats all the symbols.\n\nConstraints\n\nThe length of S is 4.\n\nEach character in S is + or -.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the integer in Takahashi's mind after he eats all the symbols.\n\nSample Input 1\n\n+-++\n\nSample Output 1\n\n2\n\nInitially, the integer in Takahashi's mind is 0.\n\nThe first integer for him to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe second integer to eat is -. After eating it, the integer in his mind becomes 0.\n\nThe third integer to eat is +. After eating it, the integer in his mind becomes 1.\n\nThe fourth integer to eat is +. After eating it, the integer in his mind becomes 2.\n\nThus, the integer in Takahashi's mind after he eats all the symbols is 2.\n\nSample Input 2\n\n-+--\n\nSample Output 2\n\n-2\n\nSample Input 3\n\n----\n\nSample Output 3\n\n-4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 384, "cpu_time_ms": 4, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s184048365", "group_id": "codeNet:p03316", "input_text": "program main\n\timplicit none\n\tinteger i, S\n\tinteger(8) N, Nh\n\tread(*, *) N\n\tNh = N\n\tS = 0\n\tdo i = 1, 10\n\t\tS = S + mod(N, 10)\n\t\tN = N / 10\n\t\tif(N < 10) then\n\t\t\tS = S + N\n\t\t\texit\n\t\tend if\n\tend do\n\tif(mod(Nh, S) == 0) then\n\t\twrite(*, *) 'Yes'\n\telse\n\t\twrite(*, *) 'No'\n\tend if\nend program main", "language": "Fortran", "metadata": {"date": 1529802532, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03316.html", "problem_id": "p03316", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03316/input.txt", "sample_output_relpath": "derived/input_output/data/p03316/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03316/Fortran/s184048365.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s184048365", "user_id": "u728000113"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n\timplicit none\n\tinteger i, S\n\tinteger(8) N, Nh\n\tread(*, *) N\n\tNh = N\n\tS = 0\n\tdo i = 1, 10\n\t\tS = S + mod(N, 10)\n\t\tN = N / 10\n\t\tif(N < 10) then\n\t\t\tS = S + N\n\t\t\texit\n\t\tend if\n\tend do\n\tif(mod(Nh, S) == 0) then\n\t\twrite(*, *) 'Yes'\n\telse\n\t\twrite(*, *) 'No'\n\tend if\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(101) = 1 + 0 + 1 = 2.\n\nGiven an integer N, determine if S(N) divides N.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf S(N) divides N, print Yes; if it does not, print No.\n\nSample Input 1\n\n12\n\nSample Output 1\n\nYes\n\nIn this input, N=12.\nAs S(12) = 1 + 2 = 3, S(N) divides N.\n\nSample Input 2\n\n101\n\nSample Output 2\n\nNo\n\nAs S(101) = 1 + 0 + 1 = 2, S(N) does not divide N.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\nYes", "sample_input": "12\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03316", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(101) = 1 + 0 + 1 = 2.\n\nGiven an integer N, determine if S(N) divides N.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf S(N) divides N, print Yes; if it does not, print No.\n\nSample Input 1\n\n12\n\nSample Output 1\n\nYes\n\nIn this input, N=12.\nAs S(12) = 1 + 2 = 3, S(N) divides N.\n\nSample Input 2\n\n101\n\nSample Output 2\n\nNo\n\nAs S(101) = 1 + 0 + 1 = 2, S(N) does not divide N.\n\nSample Input 3\n\n999999999\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 288, "cpu_time_ms": 5, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s817807244", "group_id": "codeNet:p03317", "input_text": "program minimization\n implicit none\n integer :: k=0,n=0,cnt=0,i=0\n integer, allocatable :: a(:)\n\n read(*,*)n,k\n allocate(a(n))\n read(*,*) (a(i),i=1,n)\n if(n<2 .or. 1000000)then\n b=b+1\n end if\n end do\n if (b>m)then\n m=b\n end if\n end do\n write(*,*) m\n \n stop\n contains\n subroutine alfnumber(st,a)\n implicit none\n character,intent(in) :: st\n integer(8),intent(out) :: a\n integer::i\n character(1)::ch(26)\n ch=(/'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'/)\n do i=1,26\n if(st .eq. ch(i))then\n a=i\n return\n end if\n end do \n end subroutine alfnumber\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1594494171, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03338.html", "problem_id": "p03338", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03338/input.txt", "sample_output_relpath": "derived/input_output/data/p03338/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03338/Fortran/s663733587.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s663733587", "user_id": "u713568912"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program sample\n implicit none\n character(1000)::s\n integer(8) :: i,j,m,n,a,b,x(26),y(26)\n \n read(*,*) n\n \n read(*,*)s\n x(:)=0\n y(:)=0\n\n do i=1,n\n call alfnumber(s(i:i),a)\n y(a)=y(a)+1\n end do\n m=0\n\n do i=1,n\n call alfnumber(s(i:i),a)\n y(a)=y(a)-1\n x(a)=x(a)+1\n b=0\n do j=1,26\n if(x(j)*y(j)>0)then\n b=b+1\n end if\n end do\n if (b>m)then\n m=b\n end if\n end do\n write(*,*) m\n \n stop\n contains\n subroutine alfnumber(st,a)\n implicit none\n character,intent(in) :: st\n integer(8),intent(out) :: a\n integer::i\n character(1)::ch(26)\n ch=(/'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'/)\n do i=1,26\n if(st .eq. ch(i))then\n a=i\n return\n end if\n end do \n end subroutine alfnumber\nend program sample\n \n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\nWe will cut this string at one position into two strings X and Y.\nHere, we would like to maximize the number of different letters contained in both X and Y.\nFind the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n|S| = N\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the largest possible number of different letters contained in both X and Y.\n\nSample Input 1\n\n6\naabbca\n\nSample Output 1\n\n2\n\nIf we cut the string between the third and fourth letters into X = aab and Y = bca, the letters contained in both X and Y are a and b.\nThere will never be three or more different letters contained in both X and Y, so the answer is 2.\n\nSample Input 2\n\n10\naaaaaaaaaa\n\nSample Output 2\n\n1\n\nHowever we divide S, only a will be contained in both X and Y.\n\nSample Input 3\n\n45\ntgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir\n\nSample Output 3\n\n9", "sample_input": "6\naabbca\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03338", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of lowercase English letters.\nWe will cut this string at one position into two strings X and Y.\nHere, we would like to maximize the number of different letters contained in both X and Y.\nFind the largest possible number of different letters contained in both X and Y when we cut the string at the optimal position.\n\nConstraints\n\n2 \\leq N \\leq 100\n\n|S| = N\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the largest possible number of different letters contained in both X and Y.\n\nSample Input 1\n\n6\naabbca\n\nSample Output 1\n\n2\n\nIf we cut the string between the third and fourth letters into X = aab and Y = bca, the letters contained in both X and Y are a and b.\nThere will never be three or more different letters contained in both X and Y, so the answer is 2.\n\nSample Input 2\n\n10\naaaaaaaaaa\n\nSample Output 2\n\n1\n\nHowever we divide S, only a will be contained in both X and Y.\n\nSample Input 3\n\n45\ntgxgdqkyjzhyputjjtllptdfxocrylqfqjynmfbfucbir\n\nSample Output 3\n\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1035, "cpu_time_ms": 6, "memory_kb": 2860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s568455604", "group_id": "codeNet:p03341", "input_text": "program ARC098C\n implicit none\n integer(8)::N,i\n integer(8)::e_count=0\n integer(8)::w_count=0\n integer(8)::result\n integer(8),allocatable,dimension(:)::E,W\n character(300000)::S\n\n read(5,*)N\n read(5,*)S\n allocate(E(N))\n allocate(W(N))\n result=N-1\n\n do i=1,N\n if(S(i:i)=='E')then\n e_count=e_count+1\n else\n w_count=w_count+1\n end if\n E(i)=e_count\n W(i)=w_count\n end do\n\n do i=1,N\n if(i==1)then\n if(E(N)-E(i)0) then\nimp = 1\nendif\n\ndo i=2,n\n\n\t\tif(retsu(i) - retsu(i-1) > 1) then\n\t\t\timp = 1\n\t\tendif\n\t\t\n\t\tif(retsu(i)==0) then\n\t\t\tnumber = number\n\t\telse if(retsu(i)==1)then\n\t\t\tnumber = number + 1\n\t\telse if(retsu(i) - retsu(i-1) == 1) then\n\t\t\tnumber = number + 1\n\t\telse if(retsu(i) <= retsu(i-1)) then\n\t\t\tnumber = number + retsu(i)\n\t\tendif\n\t\t\t\nenddo\n\nif(imp == 1)then\n\twrite(*,*) -1\nelse\n\twrite(*,*) number\nendif\n\nend program", "language": "Fortran", "metadata": {"date": 1526870134, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03347.html", "problem_id": "p03347", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03347/input.txt", "sample_output_relpath": "derived/input_output/data/p03347/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03347/Fortran/s886237665.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s886237665", "user_id": "u454703763"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program test\nimplicit none\ninteger :: n,i\ninteger :: retsu(2*10**5) = 0, imp=0, number=0\n\nread(*,*) n\n\ndo i=1,n\n\tread(*,*) retsu(i)\nenddo\n\nif(retsu(1)>0) then\nimp = 1\nendif\n\ndo i=2,n\n\n\t\tif(retsu(i) - retsu(i-1) > 1) then\n\t\t\timp = 1\n\t\tendif\n\t\t\n\t\tif(retsu(i)==0) then\n\t\t\tnumber = number\n\t\telse if(retsu(i)==1)then\n\t\t\tnumber = number + 1\n\t\telse if(retsu(i) - retsu(i-1) == 1) then\n\t\t\tnumber = number + 1\n\t\telse if(retsu(i) <= retsu(i-1)) then\n\t\t\tnumber = number + retsu(i)\n\t\tendif\n\t\t\t\nenddo\n\nif(imp == 1)then\n\twrite(*,*) -1\nelse\n\twrite(*,*) number\nendif\n\nend program", "problem_context": "Score : 700 points\n\nProblem Statement\n\nThere is a sequence X of length N, where every element is initially 0. Let X_i denote the i-th element of X.\n\nYou are given a sequence A of length N. The i-th element of A is A_i. Determine if we can make X equal to A by repeating the operation below. If we can, find the minimum number of operations required.\n\nChoose an integer i such that 1\\leq i\\leq N-1. Replace the value of X_{i+1} with the value of X_i plus 1.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nIf we can make X equal to A by repeating the operation, print the minimum number of operations required. If we cannot, print -1.\n\nSample Input 1\n\n4\n0\n1\n1\n2\n\nSample Output 1\n\n3\n\nWe can make X equal to A as follows:\n\nChoose i=2. X becomes (0,0,1,0).\n\nChoose i=1. X becomes (0,1,1,0).\n\nChoose i=3. X becomes (0,1,1,2).\n\nSample Input 2\n\n3\n1\n2\n1\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n9\n0\n1\n1\n0\n1\n2\n2\n1\n2\n\nSample Output 3\n\n8", "sample_input": "4\n0\n1\n1\n2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03347", "source_text": "Score : 700 points\n\nProblem Statement\n\nThere is a sequence X of length N, where every element is initially 0. Let X_i denote the i-th element of X.\n\nYou are given a sequence A of length N. The i-th element of A is A_i. Determine if we can make X equal to A by repeating the operation below. If we can, find the minimum number of operations required.\n\nChoose an integer i such that 1\\leq i\\leq N-1. Replace the value of X_{i+1} with the value of X_i plus 1.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nIf we can make X equal to A by repeating the operation, print the minimum number of operations required. If we cannot, print -1.\n\nSample Input 1\n\n4\n0\n1\n1\n2\n\nSample Output 1\n\n3\n\nWe can make X equal to A as follows:\n\nChoose i=2. X becomes (0,0,1,0).\n\nChoose i=1. X becomes (0,1,1,0).\n\nChoose i=3. X becomes (0,1,1,2).\n\nSample Input 2\n\n3\n1\n2\n1\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n9\n0\n1\n1\n0\n1\n2\n2\n1\n2\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 563, "cpu_time_ms": 89, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s839433889", "group_id": "codeNet:p03347", "input_text": "program test\nimplicit none\ninteger :: n,i\ninteger :: retsu(2*10**5) = 0, imp=0, number=0\n\nread(*,*) n\n\ndo i=1,n\n\tread(*,*) retsu(i)\nenddo\n\nif(retsu(1)>0) then\nimp = 1\nendif\n\ndo i=2,n\n\n\t\tif(retsu(i+1) - retsu(i) > 1) then\n\t\t\timp = 1\n\t\tendif\n\t\tif(retsu(i)==0) then\n\t\t\tnumber = number\n\t\telse if(retsu(i)==1)then\n\t\t\tnumber = number + 1\n\t\telse if(retsu(i) - retsu(i-1) == 1) then\n\t\t\tnumber = number + 1\n\t\telse if(retsu(i) <= retsu(i-1)) then\n\t\t\tnumber = number + retsu(i)\n\t\tendif\n\t\t\t\nenddo\n\nif(imp == 1)then\n\twrite(*,*) -1\nelse\n\twrite(*,*) number\nendif\n\nend program", "language": "Fortran", "metadata": {"date": 1526869974, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03347.html", "problem_id": "p03347", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03347/input.txt", "sample_output_relpath": "derived/input_output/data/p03347/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03347/Fortran/s839433889.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s839433889", "user_id": "u454703763"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program test\nimplicit none\ninteger :: n,i\ninteger :: retsu(2*10**5) = 0, imp=0, number=0\n\nread(*,*) n\n\ndo i=1,n\n\tread(*,*) retsu(i)\nenddo\n\nif(retsu(1)>0) then\nimp = 1\nendif\n\ndo i=2,n\n\n\t\tif(retsu(i+1) - retsu(i) > 1) then\n\t\t\timp = 1\n\t\tendif\n\t\tif(retsu(i)==0) then\n\t\t\tnumber = number\n\t\telse if(retsu(i)==1)then\n\t\t\tnumber = number + 1\n\t\telse if(retsu(i) - retsu(i-1) == 1) then\n\t\t\tnumber = number + 1\n\t\telse if(retsu(i) <= retsu(i-1)) then\n\t\t\tnumber = number + retsu(i)\n\t\tendif\n\t\t\t\nenddo\n\nif(imp == 1)then\n\twrite(*,*) -1\nelse\n\twrite(*,*) number\nendif\n\nend program", "problem_context": "Score : 700 points\n\nProblem Statement\n\nThere is a sequence X of length N, where every element is initially 0. Let X_i denote the i-th element of X.\n\nYou are given a sequence A of length N. The i-th element of A is A_i. Determine if we can make X equal to A by repeating the operation below. If we can, find the minimum number of operations required.\n\nChoose an integer i such that 1\\leq i\\leq N-1. Replace the value of X_{i+1} with the value of X_i plus 1.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nIf we can make X equal to A by repeating the operation, print the minimum number of operations required. If we cannot, print -1.\n\nSample Input 1\n\n4\n0\n1\n1\n2\n\nSample Output 1\n\n3\n\nWe can make X equal to A as follows:\n\nChoose i=2. X becomes (0,0,1,0).\n\nChoose i=1. X becomes (0,1,1,0).\n\nChoose i=3. X becomes (0,1,1,2).\n\nSample Input 2\n\n3\n1\n2\n1\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n9\n0\n1\n1\n0\n1\n2\n2\n1\n2\n\nSample Output 3\n\n8", "sample_input": "4\n0\n1\n1\n2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03347", "source_text": "Score : 700 points\n\nProblem Statement\n\nThere is a sequence X of length N, where every element is initially 0. Let X_i denote the i-th element of X.\n\nYou are given a sequence A of length N. The i-th element of A is A_i. Determine if we can make X equal to A by repeating the operation below. If we can, find the minimum number of operations required.\n\nChoose an integer i such that 1\\leq i\\leq N-1. Replace the value of X_{i+1} with the value of X_i plus 1.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nIf we can make X equal to A by repeating the operation, print the minimum number of operations required. If we cannot, print -1.\n\nSample Input 1\n\n4\n0\n1\n1\n2\n\nSample Output 1\n\n3\n\nWe can make X equal to A as follows:\n\nChoose i=2. X becomes (0,0,1,0).\n\nChoose i=1. X becomes (0,1,1,0).\n\nChoose i=3. X becomes (0,1,1,2).\n\nSample Input 2\n\n3\n1\n2\n1\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n9\n0\n1\n1\n0\n1\n2\n2\n1\n2\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 560, "cpu_time_ms": 84, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s488572518", "group_id": "codeNet:p03352", "input_text": "program main\n\timplicit none\n integer(8)::x,i,j,ans\n \n read(*,*)x\n ans=0\n \n do i=1,x\n \tdo j=1,x\n \tif(i**j<=x .and. i**j>ans)then\n \tans=i**j\n end if\n end do\n end do\n stop\nend program main\n", "language": "Fortran", "metadata": {"date": 1592616253, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03352.html", "problem_id": "p03352", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03352/input.txt", "sample_output_relpath": "derived/input_output/data/p03352/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03352/Fortran/s488572518.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s488572518", "user_id": "u884601206"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program main\n\timplicit none\n integer(8)::x,i,j,ans\n \n read(*,*)x\n ans=0\n \n do i=1,x\n \tdo j=1,x\n \tif(i**j<=x .and. i**j>ans)then\n \tans=i**j\n end if\n end do\n end do\n stop\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03352", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 249, "cpu_time_ms": 4, "memory_kb": 2816}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s897275570", "group_id": "codeNet:p03352", "input_text": "program exp\nimplicit none\ninteger i,j,base,index\ninteger in,temp\nread *, in ! 1<=in<=1000\nbase = 1\nindex =1\ndo i=1,int(sqrt(real(in))) ! Base of exponential\n do j=1, 9 ! Index of exponential, 2^10>1000 therefore j<=9\n if(i**j<=in) then\n if(i**j>base**index) then\n base=i\n index = j\n end if\n end if\n end do\nend do\nprint *, base**index\nend program exp", "language": "Fortran", "metadata": {"date": 1570400176, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03352.html", "problem_id": "p03352", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03352/input.txt", "sample_output_relpath": "derived/input_output/data/p03352/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03352/Fortran/s897275570.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s897275570", "user_id": "u275279141"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program exp\nimplicit none\ninteger i,j,base,index\ninteger in,temp\nread *, in ! 1<=in<=1000\nbase = 1\nindex =1\ndo i=1,int(sqrt(real(in))) ! Base of exponential\n do j=1, 9 ! Index of exponential, 2^10>1000 therefore j<=9\n if(i**j<=in) then\n if(i**j>base**index) then\n base=i\n index = j\n end if\n end if\n end do\nend do\nprint *, base**index\nend program exp", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03352", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 382, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s038968253", "group_id": "codeNet:p03352", "input_text": "INTEGER N,C\nREAD*,N\nC=1\nDO I=1,N\n DO J=2,N\n IF(I**J>N)EXIT\n C=MAX(C,I**J)\n END DO\nEND DO\nPRINT\"(I0)\",C\nEND", "language": "Fortran", "metadata": {"date": 1551846092, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03352.html", "problem_id": "p03352", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03352/input.txt", "sample_output_relpath": "derived/input_output/data/p03352/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03352/Fortran/s038968253.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s038968253", "user_id": "u598073939"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "INTEGER N,C\nREAD*,N\nC=1\nDO I=1,N\n DO J=2,N\n IF(I**J>N)EXIT\n C=MAX(C,I**J)\n END DO\nEND DO\nPRINT\"(I0)\",C\nEND", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03352", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 114, "cpu_time_ms": 6, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s235580579", "group_id": "codeNet:p03352", "input_text": "program main\n implicit none\n integer(8) X, i, j, ans\n\tread(*, *) X\n\tans = 0\n\tdo i = 1, 40\n\t do j = 2, 10\n\t\t\tif(i**j < 1 .or. i**j > 1000) then\n\t\t\t\texit\n\t\t else if(i**j <= X) then\n\t\t\t ans = max(i**j, ans)\n\t\t\tend if\n\t\tend do\n\tend do\n\twrite(*, *) ans\nend program main", "language": "Fortran", "metadata": {"date": 1526176569, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03352.html", "problem_id": "p03352", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03352/input.txt", "sample_output_relpath": "derived/input_output/data/p03352/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03352/Fortran/s235580579.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s235580579", "user_id": "u728000113"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program main\n implicit none\n integer(8) X, i, j, ans\n\tread(*, *) X\n\tans = 0\n\tdo i = 1, 40\n\t do j = 2, 10\n\t\t\tif(i**j < 1 .or. i**j > 1000) then\n\t\t\t\texit\n\t\t else if(i**j <= X) then\n\t\t\t ans = max(i**j, ans)\n\t\t\tend if\n\t\tend do\n\tend do\n\twrite(*, *) ans\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03352", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 279, "cpu_time_ms": 8, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s750568806", "group_id": "codeNet:p03352", "input_text": "program main\n implicit none\n integer(8) X, i, j, ans\n\tread(*, *) X\n\tans = 0\n\tdo i = 1, 40\n\t do j = 2, 10\n\t\t\tif(i**j < 0) then\n\t\t\t\texit\n\t\t else if(i**j <= X) then\n\t\t\t ans = i**j\n\t\t\tend if\n\t\tend do\n\tend do\n\twrite(*, *) ans\nend program main", "language": "Fortran", "metadata": {"date": 1526174119, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03352.html", "problem_id": "p03352", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03352/input.txt", "sample_output_relpath": "derived/input_output/data/p03352/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03352/Fortran/s750568806.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s750568806", "user_id": "u728000113"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program main\n implicit none\n integer(8) X, i, j, ans\n\tread(*, *) X\n\tans = 0\n\tdo i = 1, 40\n\t do j = 2, 10\n\t\t\tif(i**j < 0) then\n\t\t\t\texit\n\t\t else if(i**j <= X) then\n\t\t\t ans = i**j\n\t\t\tend if\n\t\tend do\n\tend do\n\twrite(*, *) ans\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03352", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a positive integer X.\nFind the largest perfect power that is at most X.\nHere, a perfect power is an integer that can be represented as b^p, where b is an integer not less than 1 and p is an integer not less than 2.\n\nConstraints\n\n1 ≤ X ≤ 1000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the largest perfect power that is at most X.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\nThere are four perfect powers that are at most 10: 1, 4, 8 and 9.\nWe should print the largest among them, 9.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n999\n\nSample Output 3\n\n961", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 252, "cpu_time_ms": 5, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s637825384", "group_id": "codeNet:p03355", "input_text": "program prob6\n implicit none\n character(5005) :: s\n character(5) :: t\n integer :: K\n character(5), dimension(:), allocatable :: a\n integer :: i, j, L, cnt\n read(*,*) s\n read(*,*) K\n\n L = len_trim(s)\n allocate(a(L*K))\n do i = 1, L\n do j = 1, K\n a(L*(j-1)+i) = adjustl(s(i:i+j-1))\n end do\n end do\n\n call msort(a)\n cnt = 1\n i = 2\n t = a(1)\n do while(cnt < K)\n if(t /= a(i)) then\n t = a(i)\n cnt = cnt + 1\n end if\n i = i + 1\n end do\n\n write(*,'(a)') trim(adjustl(t))\n stop\ncontains\n\n !\n ! swap two arguments\n !\nsubroutine swap(a, b)\n implicit none\n character(5), intent(inout) :: a, b\n\n character(5) :: c\n\n c = a\n a = b\n b = c\n\n end subroutine swap\n\n !\n ! merge sort\n !\n recursive subroutine msort(x)\n implicit none\n character(5), intent(inout) :: x(:)\n\n integer(8) :: n, mid, i, j, k\n character(5), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n\n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n\n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n\n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n\n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n\n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\nend program prob6", "language": "Fortran", "metadata": {"date": 1594432505, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03355.html", "problem_id": "p03355", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03355/input.txt", "sample_output_relpath": "derived/input_output/data/p03355/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03355/Fortran/s637825384.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s637825384", "user_id": "u478462004"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "program prob6\n implicit none\n character(5005) :: s\n character(5) :: t\n integer :: K\n character(5), dimension(:), allocatable :: a\n integer :: i, j, L, cnt\n read(*,*) s\n read(*,*) K\n\n L = len_trim(s)\n allocate(a(L*K))\n do i = 1, L\n do j = 1, K\n a(L*(j-1)+i) = adjustl(s(i:i+j-1))\n end do\n end do\n\n call msort(a)\n cnt = 1\n i = 2\n t = a(1)\n do while(cnt < K)\n if(t /= a(i)) then\n t = a(i)\n cnt = cnt + 1\n end if\n i = i + 1\n end do\n\n write(*,'(a)') trim(adjustl(t))\n stop\ncontains\n\n !\n ! swap two arguments\n !\nsubroutine swap(a, b)\n implicit none\n character(5), intent(inout) :: a, b\n\n character(5) :: c\n\n c = a\n a = b\n b = c\n\n end subroutine swap\n\n !\n ! merge sort\n !\n recursive subroutine msort(x)\n implicit none\n character(5), intent(inout) :: x(:)\n\n integer(8) :: n, mid, i, j, k\n character(5), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n\n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n\n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n\n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n\n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n\n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\nend program prob6", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "sample_input": "aba\n4\n"}, "reference_outputs": ["b\n"], "source_document_id": "p03355", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string s.\nAmong the different substrings of s, print the K-th lexicographically smallest one.\n\nA substring of s is a string obtained by taking out a non-empty contiguous part in s.\nFor example, if s = ababc, a, bab and ababc are substrings of s, while ac, z and an empty string are not.\nAlso, we say that substrings are different when they are different as strings.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 ≤ |s| ≤ 5000\n\ns consists of lowercase English letters.\n\n1 ≤ K ≤ 5\n\ns has at least K different substrings.\n\nPartial Score\n\n200 points will be awarded as a partial score for passing the test set satisfying |s| ≤ 50.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the K-th lexicographically smallest substring of K.\n\nSample Input 1\n\naba\n4\n\nSample Output 1\n\nb\n\ns has five substrings: a, b, ab, ba and aba.\nAmong them, we should print the fourth smallest one, b.\nNote that we do not count a twice.\n\nSample Input 2\n\natcoderandatcodeer\n5\n\nSample Output 2\n\nandat\n\nSample Input 3\n\nz\n1\n\nSample Output 3\n\nz", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2096, "cpu_time_ms": 25, "memory_kb": 3188}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s316252903", "group_id": "codeNet:p03360", "input_text": "program main\n implicit none\n integer :: a, b, c, k\n read(*, *) a, b, c\n read(*, *) k\n write(*, \"(i0)\") max(a, b, c) * (2 ** k - 1) + (a + b + c)\nend program main\n", "language": "Fortran", "metadata": {"date": 1550911158, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03360.html", "problem_id": "p03360", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03360/input.txt", "sample_output_relpath": "derived/input_output/data/p03360/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03360/Fortran/s316252903.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s316252903", "user_id": "u388927326"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "program main\n implicit none\n integer :: a, b, c, k\n read(*, *) a, b, c\n read(*, *) k\n write(*, \"(i0)\") max(a, b, c) * (2 ** k - 1) + (a + b + c)\nend program main\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nThere are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times:\n\nChoose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n.\n\nWhat is the largest possible sum of the integers written on the blackboard after K operations?\n\nConstraints\n\nA, B and C are integers between 1 and 50 (inclusive).\n\nK is an integer between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nPrint the largest possible sum of the integers written on the blackboard after K operations by E869220.\n\nSample Input 1\n\n5 3 11\n1\n\nSample Output 1\n\n30\n\nIn this sample, 5, 3, 11 are initially written on the blackboard, and E869120 can perform the operation once.\n\nThere are three choices:\n\nDouble 5: The integers written on the board after the operation are 10, 3, 11.\n\nDouble 3: The integers written on the board after the operation are 5, 6, 11.\n\nDouble 11: The integers written on the board after the operation are 5, 3, 22.\n\nIf he chooses 3., the sum of the integers written on the board afterwards is 5 + 3 + 22 = 30, which is the largest among 1. through 3.\n\nSample Input 2\n\n3 3 4\n2\n\nSample Output 2\n\n22\n\nE869120 can perform the operation twice. The sum of the integers eventually written on the blackboard is maximized as follows:\n\nFirst, double 4. The integers written on the board are now 3, 3, 8.\n\nNext, double 8. The integers written on the board are now 3, 3, 16.\n\nThen, the sum of the integers eventually written on the blackboard is 3 + 3 + 16 = 22.", "sample_input": "5 3 11\n1\n"}, "reference_outputs": ["30\n"], "source_document_id": "p03360", "source_text": "Score: 200 points\n\nProblem Statement\n\nThere are three positive integers A, B and C written on a blackboard. E869120 performs the following operation K times:\n\nChoose one integer written on the blackboard and let the chosen integer be n. Replace the chosen integer with 2n.\n\nWhat is the largest possible sum of the integers written on the blackboard after K operations?\n\nConstraints\n\nA, B and C are integers between 1 and 50 (inclusive).\n\nK is an integer between 1 and 10 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nPrint the largest possible sum of the integers written on the blackboard after K operations by E869220.\n\nSample Input 1\n\n5 3 11\n1\n\nSample Output 1\n\n30\n\nIn this sample, 5, 3, 11 are initially written on the blackboard, and E869120 can perform the operation once.\n\nThere are three choices:\n\nDouble 5: The integers written on the board after the operation are 10, 3, 11.\n\nDouble 3: The integers written on the board after the operation are 5, 6, 11.\n\nDouble 11: The integers written on the board after the operation are 5, 3, 22.\n\nIf he chooses 3., the sum of the integers written on the board afterwards is 5 + 3 + 22 = 30, which is the largest among 1. through 3.\n\nSample Input 2\n\n3 3 4\n2\n\nSample Output 2\n\n22\n\nE869120 can perform the operation twice. The sum of the integers eventually written on the blackboard is maximized as follows:\n\nFirst, double 4. The integers written on the board are now 3, 3, 8.\n\nNext, double 8. The integers written on the board are now 3, 3, 16.\n\nThen, the sum of the integers eventually written on the blackboard is 3 + 3 + 16 = 22.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 167, "cpu_time_ms": 3, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s884405446", "group_id": "codeNet:p03363", "input_text": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\n\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\n\nprogram agc023_a\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int64):: n,i,c,ans\n integer(int64), allocatable:: a(:),s(:)\n\n read*, n\n allocate(a(n),s(0:n))\n read*, a(:)\n s(:) = 0\n do i=1,n\n s(i) = s(i-1)+a(i)\n end do\n\n call merge_sort(s,1_8,n+1)\n ans=0\n c=1\n do i=1,n\n if (s(i) == s(i-1)) then\n c=c+1\n else\n ans=ans+(c*(c-1))/2\n c=1\n end if\n end do\n ans=ans+(c*(c-1))/2\n print'(i0)', ans\nend program agc023_a", "language": "Fortran", "metadata": {"date": 1591381701, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03363.html", "problem_id": "p03363", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03363/input.txt", "sample_output_relpath": "derived/input_output/data/p03363/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03363/Fortran/s884405446.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s884405446", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\n\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\n\nprogram agc023_a\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int64):: n,i,c,ans\n integer(int64), allocatable:: a(:),s(:)\n\n read*, n\n allocate(a(n),s(0:n))\n read*, a(:)\n s(:) = 0\n do i=1,n\n s(i) = s(i-1)+a(i)\n end do\n\n call merge_sort(s,1_8,n+1)\n ans=0\n c=1\n do i=1,n\n if (s(i) == s(i-1)) then\n c=c+1\n else\n ans=ans+(c*(c-1))/2\n c=1\n end if\n end do\n ans=ans+(c*(c-1))/2\n print'(i0)', ans\nend program agc023_a", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have an integer sequence A, whose length is N.\n\nFind the number of the non-empty contiguous subsequences of A whose sums are 0.\nNote that we are counting the ways to take out subsequences.\nThat is, even if the contents of some two subsequences are the same, they are counted individually if they are taken from different positions.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFind the number of the non-empty contiguous subsequences of A whose sum is 0.\n\nSample Input 1\n\n6\n1 3 -4 2 2 -2\n\nSample Output 1\n\n3\n\nThere are three contiguous subsequences whose sums are 0: (1,3,-4), (-4,2,2) and (2,-2).\n\nSample Input 2\n\n7\n1 -1 1 -1 1 -1 1\n\nSample Output 2\n\n12\n\nIn this case, some subsequences that have the same contents but are taken from different positions are counted individually.\nFor example, three occurrences of (1, -1) are counted.\n\nSample Input 3\n\n5\n1 -2 3 -4 5\n\nSample Output 3\n\n0\n\nThere are no contiguous subsequences whose sums are 0.", "sample_input": "6\n1 3 -4 2 2 -2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03363", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have an integer sequence A, whose length is N.\n\nFind the number of the non-empty contiguous subsequences of A whose sums are 0.\nNote that we are counting the ways to take out subsequences.\nThat is, even if the contents of some two subsequences are the same, they are counted individually if they are taken from different positions.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n-10^9 \\leq A_i \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nFind the number of the non-empty contiguous subsequences of A whose sum is 0.\n\nSample Input 1\n\n6\n1 3 -4 2 2 -2\n\nSample Output 1\n\n3\n\nThere are three contiguous subsequences whose sums are 0: (1,3,-4), (-4,2,2) and (2,-2).\n\nSample Input 2\n\n7\n1 -1 1 -1 1 -1 1\n\nSample Output 2\n\n12\n\nIn this case, some subsequences that have the same contents but are taken from different positions are counted individually.\nFor example, three occurrences of (1, -1) are counted.\n\nSample Input 3\n\n5\n1 -2 3 -4 5\n\nSample Output 3\n\n0\n\nThere are no contiguous subsequences whose sums are 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6718, "cpu_time_ms": 95, "memory_kb": 6180}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s915751723", "group_id": "codeNet:p03371", "input_text": "program Half_and_Half\n implicit none\n integer(4):: a,b,c\n integer(4):: x,y\n \n read*, a,b,c,x,y\n\n print*, min(x,y) * min(a+b, 2*c) + min(max((x-y)*a,(y-x)*b), abs(x-y)*2*c)\n\nend program Half_and_Half", "language": "Fortran", "metadata": {"date": 1585927224, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03371.html", "problem_id": "p03371", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03371/input.txt", "sample_output_relpath": "derived/input_output/data/p03371/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03371/Fortran/s915751723.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s915751723", "user_id": "u234636620"}, "prompt_components": {"gold_output": "7900\n", "input_to_evaluate": "program Half_and_Half\n implicit none\n integer(4):: a,b,c\n integer(4):: x,y\n \n read*, a,b,c,x,y\n\n print*, min(x,y) * min(a+b, 2*c) + min(max((x-y)*a,(y-x)*b), abs(x-y)*2*c)\n\nend program Half_and_Half", "problem_context": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "sample_input": "1500 2000 1600 3 2\n"}, "reference_outputs": ["7900\n"], "source_document_id": "p03371", "source_text": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 216, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s238677784", "group_id": "codeNet:p03371", "input_text": "program probC\n implicit none\n integer a,b,c,x,y,ans,tmp\n\n read(*,*) a,b,c,x,y\n\n ans = 0\n if(a+b>=2*c) then\n tmp = min(x,y)\n ans = tmp*2*c\n x = x - tmp\n y = y - tmp\n\n end if\n \n \n if ( a>=2*c .and. x.ne.0) then\n ans = ans + x*2*c\n x = 0\n\n\n end if\n if ( b>=2*c .and. y.ne.0) then\n ans = ans + y*2*c\n y = 0\n\n end if\n\n ans = ans + x*a + y*b\n\n write (*,*) ans\n\n\n \nend program probC\n\n", "language": "Fortran", "metadata": {"date": 1524360162, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03371.html", "problem_id": "p03371", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03371/input.txt", "sample_output_relpath": "derived/input_output/data/p03371/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03371/Fortran/s238677784.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s238677784", "user_id": "u177040005"}, "prompt_components": {"gold_output": "7900\n", "input_to_evaluate": "program probC\n implicit none\n integer a,b,c,x,y,ans,tmp\n\n read(*,*) a,b,c,x,y\n\n ans = 0\n if(a+b>=2*c) then\n tmp = min(x,y)\n ans = tmp*2*c\n x = x - tmp\n y = y - tmp\n\n end if\n \n \n if ( a>=2*c .and. x.ne.0) then\n ans = ans + x*2*c\n x = 0\n\n\n end if\n if ( b>=2*c .and. y.ne.0) then\n ans = ans + y*2*c\n y = 0\n\n end if\n\n ans = ans + x*a + y*b\n\n write (*,*) ans\n\n\n \nend program probC\n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "sample_input": "1500 2000 1600 3 2\n"}, "reference_outputs": ["7900\n"], "source_document_id": "p03371", "source_text": "Score : 300 points\n\nProblem Statement\n\n\"Pizza At\", a fast food chain, offers three kinds of pizza: \"A-pizza\", \"B-pizza\" and \"AB-pizza\". A-pizza and B-pizza are completely different pizzas, and AB-pizza is one half of A-pizza and one half of B-pizza combined together. The prices of one A-pizza, B-pizza and AB-pizza are A yen, B yen and C yen (yen is the currency of Japan), respectively.\n\nNakahashi needs to prepare X A-pizzas and Y B-pizzas for a party tonight. He can only obtain these pizzas by directly buying A-pizzas and B-pizzas, or buying two AB-pizzas and then rearrange them into one A-pizza and one B-pizza. At least how much money does he need for this? It is fine to have more pizzas than necessary by rearranging pizzas.\n\nConstraints\n\n1 ≤ A, B, C ≤ 5000\n\n1 ≤ X, Y ≤ 10^5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C X Y\n\nOutput\n\nPrint the minimum amount of money required to prepare X A-pizzas and Y B-pizzas.\n\nSample Input 1\n\n1500 2000 1600 3 2\n\nSample Output 1\n\n7900\n\nIt is optimal to buy four AB-pizzas and rearrange them into two A-pizzas and two B-pizzas, then buy additional one A-pizza.\n\nSample Input 2\n\n1500 2000 1900 3 2\n\nSample Output 2\n\n8500\n\nIt is optimal to directly buy three A-pizzas and two B-pizzas.\n\nSample Input 3\n\n1500 2000 500 90000 100000\n\nSample Output 3\n\n100000000\n\nIt is optimal to buy 200000 AB-pizzas and rearrange them into 100000 A-pizzas and 100000 B-pizzas. We will have 10000 more A-pizzas than necessary, but that is fine.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 433, "cpu_time_ms": 4, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s923910715", "group_id": "codeNet:p03372", "input_text": "program test\nimplicit none\ninteger :: i,j,n\ninteger(8) :: c,x(100001),v(100001),profit(100001)=0,profit2(100001)=0,max_value=0,max_value2=0\n\nread(*,*) n,c\ndo i = 1,n\nread(*,*) x(i),v(i)\nenddo\n\n!clockwise_start\n\ndo j = n, 1, -1\n profit(j) = sum(v(j:n))-(c-x(j))\n if(j < n) profit(j) = max(profit(j),profit(j+1))\nenddo\n\ndo i = 1, n\n profit2(i) = sum(v(1:i)) - 2 * x(i) + max(x(i),profit(i+1))\n max_value = max(max_value,profit2(i))\n enddo\n\n!counterclockwise_start\n\ndo i = 1, n\n profit(i) = sum(v(1:i))-x(i)\n if(i >= 2) profit(i) = max(profit(i),profit(i-1))\nenddo\n\ndo j = 1, n\n profit2(j) = sum(v(j:n))- 2 * (c-x(j)) + max((c-x(j)),profit(j-1))\n max_value2 = max(max_value2,profit2(j))\nenddo\n\nwrite(*,*) max(max_value,max_value2)\n\nend program", "language": "Fortran", "metadata": {"date": 1524370183, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03372.html", "problem_id": "p03372", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03372/input.txt", "sample_output_relpath": "derived/input_output/data/p03372/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03372/Fortran/s923910715.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s923910715", "user_id": "u454703763"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "program test\nimplicit none\ninteger :: i,j,n\ninteger(8) :: c,x(100001),v(100001),profit(100001)=0,profit2(100001)=0,max_value=0,max_value2=0\n\nread(*,*) n,c\ndo i = 1,n\nread(*,*) x(i),v(i)\nenddo\n\n!clockwise_start\n\ndo j = n, 1, -1\n profit(j) = sum(v(j:n))-(c-x(j))\n if(j < n) profit(j) = max(profit(j),profit(j+1))\nenddo\n\ndo i = 1, n\n profit2(i) = sum(v(1:i)) - 2 * x(i) + max(x(i),profit(i+1))\n max_value = max(max_value,profit2(i))\n enddo\n\n!counterclockwise_start\n\ndo i = 1, n\n profit(i) = sum(v(1:i))-x(i)\n if(i >= 2) profit(i) = max(profit(i),profit(i-1))\nenddo\n\ndo j = 1, n\n profit2(j) = sum(v(j:n))- 2 * (c-x(j)) + max((c-x(j)),profit(j-1))\n max_value2 = max(max_value2,profit2(j))\nenddo\n\nwrite(*,*) max(max_value,max_value2)\n\nend program", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03372", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 749, "cpu_time_ms": 2103, "memory_kb": 2432}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s195079000", "group_id": "codeNet:p03372", "input_text": "program test\nimplicit none\ninteger :: i,j,n\ninteger(8) :: c,x(100000),v(100000),tokei,hantokei(100000),goukei(100000)=0,saikou\n\nread(*,*) n,c\ndo i = 1,n\nread(*,*) x(i),v(i)\nenddo\n\ndo i = 0, n\n\nif(i == 0) then\n tokei = 0\n hantokei = 0\nelse\ntokei = sum(v(1:i)) - x(i)\nhantokei = 0\nendif\n\ndo j = i+1, n\nhantokei(j) = sum(v(j:n)) - (x(i) + c - x(j))\nenddo\n\ngoukei(i) = tokei + maxval(hantokei(:))\n\nenddo\n\nsaikou = maxval(goukei(:))\n\ndo i = 1, n\n\ntokei = sum(v(i:n)) - ( c - x(i))\nhantokei = 0\n\ndo j = 1, i-1\nif(j>=1) then\nhantokei(j) = sum(v(1:j)) - (c - x(i) + x(j))\nendif\nenddo\n\ngoukei(i) = tokei + maxval(hantokei(:))\n\nenddo\n\nwrite(*,*) max(saikou,maxval(goukei(:)))\n\nend program", "language": "Fortran", "metadata": {"date": 1524365656, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03372.html", "problem_id": "p03372", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03372/input.txt", "sample_output_relpath": "derived/input_output/data/p03372/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03372/Fortran/s195079000.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s195079000", "user_id": "u454703763"}, "prompt_components": {"gold_output": "191\n", "input_to_evaluate": "program test\nimplicit none\ninteger :: i,j,n\ninteger(8) :: c,x(100000),v(100000),tokei,hantokei(100000),goukei(100000)=0,saikou\n\nread(*,*) n,c\ndo i = 1,n\nread(*,*) x(i),v(i)\nenddo\n\ndo i = 0, n\n\nif(i == 0) then\n tokei = 0\n hantokei = 0\nelse\ntokei = sum(v(1:i)) - x(i)\nhantokei = 0\nendif\n\ndo j = i+1, n\nhantokei(j) = sum(v(j:n)) - (x(i) + c - x(j))\nenddo\n\ngoukei(i) = tokei + maxval(hantokei(:))\n\nenddo\n\nsaikou = maxval(goukei(:))\n\ndo i = 1, n\n\ntokei = sum(v(i:n)) - ( c - x(i))\nhantokei = 0\n\ndo j = 1, i-1\nif(j>=1) then\nhantokei(j) = sum(v(1:j)) - (c - x(i) + x(j))\nendif\nenddo\n\ngoukei(i) = tokei + maxval(hantokei(:))\n\nenddo\n\nwrite(*,*) max(saikou,maxval(goukei(:)))\n\nend program", "problem_context": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "sample_input": "3 20\n2 80\n9 120\n16 1\n"}, "reference_outputs": ["191\n"], "source_document_id": "p03372", "source_text": "Score : 500 points\n\nProblem Statement\n\n\"Teishi-zushi\", a Japanese restaurant, is a plain restaurant with only one round counter. The outer circumference of the counter is C meters. Customers cannot go inside the counter.\n\nNakahashi entered Teishi-zushi, and he was guided to the counter. Now, there are N pieces of sushi (vinegared rice with seafood and so on) on the counter. The distance measured clockwise from the point where Nakahashi is standing to the point where the i-th sushi is placed, is x_i meters. Also, the i-th sushi has a nutritive value of v_i kilocalories.\n\nNakahashi can freely walk around the circumference of the counter. When he reach a point where a sushi is placed, he can eat that sushi and take in its nutrition (naturally, the sushi disappears). However, while walking, he consumes 1 kilocalories per meter.\n\nWhenever he is satisfied, he can leave the restaurant from any place (he does not have to return to the initial place). On balance, at most how much nutrition can he take in before he leaves? That is, what is the maximum possible value of the total nutrition taken in minus the total energy consumed? Assume that there are no other customers, and no new sushi will be added to the counter. Also, since Nakahashi has plenty of nutrition in his body, assume that no matter how much he walks and consumes energy, he never dies from hunger.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n2 ≤ C ≤ 10^{14}\n\n1 ≤ x_1 < x_2 < ... < x_N < C\n\n1 ≤ v_i ≤ 10^9\n\nAll values in input are integers.\n\nSubscores\n\n300 points will be awarded for passing the test set satisfying N ≤ 100.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN C\nx_1 v_1\nx_2 v_2\n:\nx_N v_N\n\nOutput\n\nIf Nakahashi can take in at most c kilocalories on balance before he leaves the restaurant, print c.\n\nSample Input 1\n\n3 20\n2 80\n9 120\n16 1\n\nSample Output 1\n\n191\n\nThere are three sushi on the counter with a circumference of 20 meters. If he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks seven more meters clockwise, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 9 kilocalories, thus he can take in 191 kilocalories on balance, which is the largest possible value.\n\nSample Input 2\n\n3 20\n2 80\n9 1\n16 120\n\nSample Output 2\n\n192\n\nThe second and third sushi have been swapped. Again, if he walks two meters clockwise from the initial place, he can eat a sushi of 80 kilocalories. If he walks six more meters counterclockwise this time, he can eat a sushi of 120 kilocalories. If he leaves now, the total nutrition taken in is 200 kilocalories, and the total energy consumed is 8 kilocalories, thus he can take in 192 kilocalories on balance, which is the largest possible value.\n\nSample Input 3\n\n1 100000000000000\n50000000000000 1\n\nSample Output 3\n\n0\n\nEven though the only sushi is so far that it does not fit into a 32-bit integer, its nutritive value is low, thus he should immediately leave without doing anything.\n\nSample Input 4\n\n15 10000000000\n400000000 1000000000\n800000000 1000000000\n1900000000 1000000000\n2400000000 1000000000\n2900000000 1000000000\n3300000000 1000000000\n3700000000 1000000000\n3800000000 1000000000\n4000000000 1000000000\n4100000000 1000000000\n5200000000 1000000000\n6600000000 1000000000\n8000000000 1000000000\n9300000000 1000000000\n9700000000 1000000000\n\nSample Output 4\n\n6500000000\n\nAll these sample inputs above are included in the test set for the partial score.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 682, "cpu_time_ms": 2103, "memory_kb": 2560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s626747584", "group_id": "codeNet:p03377", "input_text": "integer a,b,c\nread*, a,b,c\nif(a<=c .and. c<=a+b)then\n\tprint*, \"YES\"\nelse\n\tprint*, \"NO\"\nend if\nend", "language": "Fortran", "metadata": {"date": 1571893784, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03377.html", "problem_id": "p03377", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03377/input.txt", "sample_output_relpath": "derived/input_output/data/p03377/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03377/Fortran/s626747584.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s626747584", "user_id": "u244203620"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "integer a,b,c\nread*, a,b,c\nif(a<=c .and. c<=a+b)then\n\tprint*, \"YES\"\nelse\n\tprint*, \"NO\"\nend if\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are a total of A + B cats and dogs.\nAmong them, A are known to be cats, but the remaining B are not known to be either cats or dogs.\n\nDetermine if it is possible that there are exactly X cats among these A + B animals.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\n1 \\leq X \\leq 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B X\n\nOutput\n\nIf it is possible that there are exactly X cats, print YES; if it is impossible, print NO.\n\nSample Input 1\n\n3 5 4\n\nSample Output 1\n\nYES\n\nIf there are one cat and four dogs among the B = 5 animals, there are X = 4 cats in total.\n\nSample Input 2\n\n2 2 6\n\nSample Output 2\n\nNO\n\nEven if all of the B = 2 animals are cats, there are less than X = 6 cats in total.\n\nSample Input 3\n\n5 3 2\n\nSample Output 3\n\nNO\n\nEven if all of the B = 3 animals are dogs, there are more than X = 2 cats in total.", "sample_input": "3 5 4\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03377", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are a total of A + B cats and dogs.\nAmong them, A are known to be cats, but the remaining B are not known to be either cats or dogs.\n\nDetermine if it is possible that there are exactly X cats among these A + B animals.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\leq B \\leq 100\n\n1 \\leq X \\leq 200\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B X\n\nOutput\n\nIf it is possible that there are exactly X cats, print YES; if it is impossible, print NO.\n\nSample Input 1\n\n3 5 4\n\nSample Output 1\n\nYES\n\nIf there are one cat and four dogs among the B = 5 animals, there are X = 4 cats in total.\n\nSample Input 2\n\n2 2 6\n\nSample Output 2\n\nNO\n\nEven if all of the B = 2 animals are cats, there are less than X = 6 cats in total.\n\nSample Input 3\n\n5 3 2\n\nSample Output 3\n\nNO\n\nEven if all of the B = 3 animals are dogs, there are more than X = 2 cats in total.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 97, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s673689473", "group_id": "codeNet:p03378", "input_text": "program ABC_094_B_TollGates\n implicit none\n integer N, M, X, i, countN\n integer, allocatable :: A(:)\n read(*, *) N, M, X\n allocate(A(1: M))\n read(*, *) A(1: M)\n countN = 0\n do i = 1, M\n if(X > A(i)) then\n\t countN = countN + 1\n\t end if \n end do\n write(*, *) min(countN, M - countN)\nend program ABC_094_B_TollGates", "language": "Fortran", "metadata": {"date": 1523755731, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03378.html", "problem_id": "p03378", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03378/input.txt", "sample_output_relpath": "derived/input_output/data/p03378/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03378/Fortran/s673689473.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s673689473", "user_id": "u728000113"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program ABC_094_B_TollGates\n implicit none\n integer N, M, X, i, countN\n integer, allocatable :: A(:)\n read(*, *) N, M, X\n allocate(A(1: M))\n read(*, *) A(1: M)\n countN = 0\n do i = 1, M\n if(X > A(i)) then\n\t countN = countN + 1\n\t end if \n end do\n write(*, *) min(countN, M - countN)\nend program ABC_094_B_TollGates", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right.\n\nInitially, you are in Square X.\nYou can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N.\nHowever, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a cost of 1.\nIt is guaranteed that there is no toll gate in Square 0, Square X and Square N.\n\nFind the minimum cost incurred before reaching the goal.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq 100\n\n1 \\leq X \\leq N - 1\n\n1 \\leq A_1 < A_2 < ... < A_M \\leq N\n\nA_i \\neq X\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the minimum cost incurred before reaching the goal.\n\nSample Input 1\n\n5 3 3\n1 2 4\n\nSample Output 1\n\n1\n\nThe optimal solution is as follows:\n\nFirst, travel from Square 3 to Square 4. Here, there is a toll gate in Square 4, so the cost of 1 is incurred.\n\nThen, travel from Square 4 to Square 5. This time, no cost is incurred.\n\nNow, we are in Square 5 and we have reached the goal.\n\nIn this case, the total cost incurred is 1.\n\nSample Input 2\n\n7 3 2\n4 5 6\n\nSample Output 2\n\n0\n\nWe may be able to reach the goal at no cost.\n\nSample Input 3\n\n10 7 5\n1 2 3 4 6 8 9\n\nSample Output 3\n\n3", "sample_input": "5 3 3\n1 2 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03378", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N + 1 squares arranged in a row, numbered 0, 1, ..., N from left to right.\n\nInitially, you are in Square X.\nYou can freely travel between adjacent squares. Your goal is to reach Square 0 or Square N.\nHowever, for each i = 1, 2, ..., M, there is a toll gate in Square A_i, and traveling to Square A_i incurs a cost of 1.\nIt is guaranteed that there is no toll gate in Square 0, Square X and Square N.\n\nFind the minimum cost incurred before reaching the goal.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq 100\n\n1 \\leq X \\leq N - 1\n\n1 \\leq A_1 < A_2 < ... < A_M \\leq N\n\nA_i \\neq X\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M X\nA_1 A_2 ... A_M\n\nOutput\n\nPrint the minimum cost incurred before reaching the goal.\n\nSample Input 1\n\n5 3 3\n1 2 4\n\nSample Output 1\n\n1\n\nThe optimal solution is as follows:\n\nFirst, travel from Square 3 to Square 4. Here, there is a toll gate in Square 4, so the cost of 1 is incurred.\n\nThen, travel from Square 4 to Square 5. This time, no cost is incurred.\n\nNow, we are in Square 5 and we have reached the goal.\n\nIn this case, the total cost incurred is 1.\n\nSample Input 2\n\n7 3 2\n4 5 6\n\nSample Output 2\n\n0\n\nWe may be able to reach the goal at no cost.\n\nSample Input 3\n\n10 7 5\n1 2 3 4 6 8 9\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 345, "cpu_time_ms": 4, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s195241839", "group_id": "codeNet:p03380", "input_text": "program ABC_094_D_BinomialCoefficients\n implicit none\n integer(8) n, l, r, i\n integer(8), allocatable :: a(:)\n read(*, *) n\n allocate(a(1: n))\n read(*, *) a(1: n)\n l = maxval(a(1:n))\n r = a(1)\n do i = 1, n\n if( abs(dble(l/2) - r) >= abs(dble(l/2) - a(i)) .and. a(i) /= l) then\n\t r = a(i)\n\t end if\n end do\n write(*, *) l, r \nend program ABC_094_D_BinomialCoefficients", "language": "Fortran", "metadata": {"date": 1523760295, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03380.html", "problem_id": "p03380", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03380/input.txt", "sample_output_relpath": "derived/input_output/data/p03380/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03380/Fortran/s195241839.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s195241839", "user_id": "u728000113"}, "prompt_components": {"gold_output": "11 6\n", "input_to_evaluate": "program ABC_094_D_BinomialCoefficients\n implicit none\n integer(8) n, l, r, i\n integer(8), allocatable :: a(:)\n read(*, *) n\n allocate(a(1: n))\n read(*, *) a(1: n)\n l = maxval(a(1:n))\n r = a(1)\n do i = 1, n\n if( abs(dble(l/2) - r) >= abs(dble(l/2) - a(i)) .and. a(i) /= l) then\n\t r = a(i)\n\t end if\n end do\n write(*, *) l, r \nend program ABC_094_D_BinomialCoefficients", "problem_context": "Score : 400 points\n\nProblem Statement\n\nLet {\\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order.\nFrom n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\\rm comb}(a_i,a_j) is maximized.\nIf there are multiple pairs that maximize the value, any of them is accepted.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n0 \\leq a_i \\leq 10^9\n\na_1,a_2,...,a_n are pairwise distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint a_i and a_j that you selected, with a space in between.\n\nSample Input 1\n\n5\n6 9 4 2 11\n\nSample Output 1\n\n11 6\n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n\\rm{comb}(4,2)=6\n\n\\rm{comb}(6,2)=15\n\n\\rm{comb}(6,4)=15\n\n\\rm{comb}(9,2)=36\n\n\\rm{comb}(9,4)=126\n\n\\rm{comb}(9,6)=84\n\n\\rm{comb}(11,2)=55\n\n\\rm{comb}(11,4)=330\n\n\\rm{comb}(11,6)=462\n\n\\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\nSample Input 2\n\n2\n100 0\n\nSample Output 2\n\n100 0", "sample_input": "5\n6 9 4 2 11\n"}, "reference_outputs": ["11 6\n"], "source_document_id": "p03380", "source_text": "Score : 400 points\n\nProblem Statement\n\nLet {\\rm comb}(n,r) be the number of ways to choose r objects from among n objects, disregarding order.\nFrom n non-negative integers a_1, a_2, ..., a_n, select two numbers a_i > a_j so that {\\rm comb}(a_i,a_j) is maximized.\nIf there are multiple pairs that maximize the value, any of them is accepted.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n0 \\leq a_i \\leq 10^9\n\na_1,a_2,...,a_n are pairwise distinct.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint a_i and a_j that you selected, with a space in between.\n\nSample Input 1\n\n5\n6 9 4 2 11\n\nSample Output 1\n\n11 6\n\n\\rm{comb}(a_i,a_j) for each possible selection is as follows:\n\n\\rm{comb}(4,2)=6\n\n\\rm{comb}(6,2)=15\n\n\\rm{comb}(6,4)=15\n\n\\rm{comb}(9,2)=36\n\n\\rm{comb}(9,4)=126\n\n\\rm{comb}(9,6)=84\n\n\\rm{comb}(11,2)=55\n\n\\rm{comb}(11,4)=330\n\n\\rm{comb}(11,6)=462\n\n\\rm{comb}(11,9)=55\n\nThus, we should print 11 and 6.\n\nSample Input 2\n\n2\n100 0\n\nSample Output 2\n\n100 0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 402, "cpu_time_ms": 33, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s265357953", "group_id": "codeNet:p03385", "input_text": "integer :: piyo(3),i\ncharacter(3) :: s\nread*,s\n\npiyo = 0\ndo i = 1,3\n select case( s(i:i) )\n case( 'a' )\n piyo(1) = piyo(1) + 1\n case( 'b' )\n piyo(2) = piyo(2) + 1\n case( 'c' )\n piyo(3) = piyo(3) + 1\n end select\nend do\n\ndo i = 1,3\n if( piyo(i)/=1 )then\n print*,'No'\n stop\n end if\nend do\nprint*,'Yes'\nend", "language": "Fortran", "metadata": {"date": 1579328545, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03385.html", "problem_id": "p03385", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03385/input.txt", "sample_output_relpath": "derived/input_output/data/p03385/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03385/Fortran/s265357953.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s265357953", "user_id": "u171356453"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "integer :: piyo(3),i\ncharacter(3) :: s\nread*,s\n\npiyo = 0\ndo i = 1,3\n select case( s(i:i) )\n case( 'a' )\n piyo(1) = piyo(1) + 1\n case( 'b' )\n piyo(2) = piyo(2) + 1\n case( 'c' )\n piyo(3) = piyo(3) + 1\n end select\nend do\n\ndo i = 1,3\n if( piyo(i)/=1 )then\n print*,'No'\n stop\n end if\nend do\nprint*,'Yes'\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length 3 consisting of a, b and c. Determine if S can be obtained by permuting abc.\n\nConstraints\n\n|S|=3\n\nS consists of a, b and c.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S can be obtained by permuting abc, print Yes; otherwise, print No.\n\nSample Input 1\n\nbac\n\nSample Output 1\n\nYes\n\nSwapping the first and second characters in bac results in abc.\n\nSample Input 2\n\nbab\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nabc\n\nSample Output 3\n\nYes\n\nSample Input 4\n\naaa\n\nSample Output 4\n\nNo", "sample_input": "bac\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03385", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length 3 consisting of a, b and c. Determine if S can be obtained by permuting abc.\n\nConstraints\n\n|S|=3\n\nS consists of a, b and c.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S can be obtained by permuting abc, print Yes; otherwise, print No.\n\nSample Input 1\n\nbac\n\nSample Output 1\n\nYes\n\nSwapping the first and second characters in bac results in abc.\n\nSample Input 2\n\nbab\n\nSample Output 2\n\nNo\n\nSample Input 3\n\nabc\n\nSample Output 3\n\nYes\n\nSample Input 4\n\naaa\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 324, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s861440871", "group_id": "codeNet:p03386", "input_text": "program main\n implicit none\n integer :: a, b, k, i\n read(*, *) a, b, k\n if (b - a > 200) then\n do i = 0, k - 1\n write(*, \"(i0)\") a + i\n end do\n do i = k - 1, 0, -1\n write(*, \"(i0)\") b - i\n end do\n else\n do i = a, b\n if (i - a < k .or. b - i < k) then\n write(*, \"(i0)\") i\n end if\n end do\n end if\nend program main\n", "language": "Fortran", "metadata": {"date": 1550913237, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03386.html", "problem_id": "p03386", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03386/input.txt", "sample_output_relpath": "derived/input_output/data/p03386/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03386/Fortran/s861440871.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s861440871", "user_id": "u388927326"}, "prompt_components": {"gold_output": "3\n4\n7\n8\n", "input_to_evaluate": "program main\n implicit none\n integer :: a, b, k, i\n read(*, *) a, b, k\n if (b - a > 200) then\n do i = 0, k - 1\n write(*, \"(i0)\") a + i\n end do\n do i = k - 1, 0, -1\n write(*, \"(i0)\") b - i\n end do\n else\n do i = a, b\n if (i - a < k .or. b - i < k) then\n write(*, \"(i0)\") i\n end if\n end do\n end if\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nPrint all the integers that satisfies the following in ascending order:\n\nAmong the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.\n\nConstraints\n\n1 \\leq A \\leq B \\leq 10^9\n\n1 \\leq K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint all the integers that satisfies the condition above in ascending order.\n\nSample Input 1\n\n3 8 2\n\nSample Output 1\n\n3\n4\n7\n8\n\n3 is the first smallest integer among the integers between 3 and 8.\n\n4 is the second smallest integer among the integers between 3 and 8.\n\n7 is the second largest integer among the integers between 3 and 8.\n\n8 is the first largest integer among the integers between 3 and 8.\n\nSample Input 2\n\n4 8 3\n\nSample Output 2\n\n4\n5\n6\n7\n8\n\nSample Input 3\n\n2 9 100\n\nSample Output 3\n\n2\n3\n4\n5\n6\n7\n8\n9", "sample_input": "3 8 2\n"}, "reference_outputs": ["3\n4\n7\n8\n"], "source_document_id": "p03386", "source_text": "Score : 200 points\n\nProblem Statement\n\nPrint all the integers that satisfies the following in ascending order:\n\nAmong the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.\n\nConstraints\n\n1 \\leq A \\leq B \\leq 10^9\n\n1 \\leq K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint all the integers that satisfies the condition above in ascending order.\n\nSample Input 1\n\n3 8 2\n\nSample Output 1\n\n3\n4\n7\n8\n\n3 is the first smallest integer among the integers between 3 and 8.\n\n4 is the second smallest integer among the integers between 3 and 8.\n\n7 is the second largest integer among the integers between 3 and 8.\n\n8 is the first largest integer among the integers between 3 and 8.\n\nSample Input 2\n\n4 8 3\n\nSample Output 2\n\n4\n5\n6\n7\n8\n\nSample Input 3\n\n2 9 100\n\nSample Output 3\n\n2\n3\n4\n5\n6\n7\n8\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 363, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s790267784", "group_id": "codeNet:p03386", "input_text": "program ABC_093_B_SmallandLargeIntegers\n implicit none\n integer(8) A, B\n integer K, i\n read(*, *) A, B, K\n if(B-A+1 <= 2 * K) then\n do i = A, B\n\t write(*, *) i\n\t end do\n else \n do i = A, A + K - 1\n write(*, *) i\n end do\n do i = B - K + 1, B\n write(*, *) i\n end do\n end if\nend program ABC_093_B_SmallandLargeIntegers", "language": "Fortran", "metadata": {"date": 1523150496, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03386.html", "problem_id": "p03386", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03386/input.txt", "sample_output_relpath": "derived/input_output/data/p03386/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03386/Fortran/s790267784.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s790267784", "user_id": "u728000113"}, "prompt_components": {"gold_output": "3\n4\n7\n8\n", "input_to_evaluate": "program ABC_093_B_SmallandLargeIntegers\n implicit none\n integer(8) A, B\n integer K, i\n read(*, *) A, B, K\n if(B-A+1 <= 2 * K) then\n do i = A, B\n\t write(*, *) i\n\t end do\n else \n do i = A, A + K - 1\n write(*, *) i\n end do\n do i = B - K + 1, B\n write(*, *) i\n end do\n end if\nend program ABC_093_B_SmallandLargeIntegers", "problem_context": "Score : 200 points\n\nProblem Statement\n\nPrint all the integers that satisfies the following in ascending order:\n\nAmong the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.\n\nConstraints\n\n1 \\leq A \\leq B \\leq 10^9\n\n1 \\leq K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint all the integers that satisfies the condition above in ascending order.\n\nSample Input 1\n\n3 8 2\n\nSample Output 1\n\n3\n4\n7\n8\n\n3 is the first smallest integer among the integers between 3 and 8.\n\n4 is the second smallest integer among the integers between 3 and 8.\n\n7 is the second largest integer among the integers between 3 and 8.\n\n8 is the first largest integer among the integers between 3 and 8.\n\nSample Input 2\n\n4 8 3\n\nSample Output 2\n\n4\n5\n6\n7\n8\n\nSample Input 3\n\n2 9 100\n\nSample Output 3\n\n2\n3\n4\n5\n6\n7\n8\n9", "sample_input": "3 8 2\n"}, "reference_outputs": ["3\n4\n7\n8\n"], "source_document_id": "p03386", "source_text": "Score : 200 points\n\nProblem Statement\n\nPrint all the integers that satisfies the following in ascending order:\n\nAmong the integers between A and B (inclusive), it is either within the K smallest integers or within the K largest integers.\n\nConstraints\n\n1 \\leq A \\leq B \\leq 10^9\n\n1 \\leq K \\leq 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B K\n\nOutput\n\nPrint all the integers that satisfies the condition above in ascending order.\n\nSample Input 1\n\n3 8 2\n\nSample Output 1\n\n3\n4\n7\n8\n\n3 is the first smallest integer among the integers between 3 and 8.\n\n4 is the second smallest integer among the integers between 3 and 8.\n\n7 is the second largest integer among the integers between 3 and 8.\n\n8 is the first largest integer among the integers between 3 and 8.\n\nSample Input 2\n\n4 8 3\n\nSample Output 2\n\n4\n5\n6\n7\n8\n\nSample Input 3\n\n2 9 100\n\nSample Output 3\n\n2\n3\n4\n5\n6\n7\n8\n9", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 386, "cpu_time_ms": 4, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s987440538", "group_id": "codeNet:p03393", "input_text": "program name\n implicit none\n character(26):: s\n character(1):: mins\n integer(4):: ls,i,mic, ri\n integer(4),allocatable:: si(:)\n logical:: is_use(26)\n\n read*, s\n ls = len_trim(s)\n allocate(si(ls))\n\n do i=1,ls\n si(i) = ichar(s(i:i)) - ichar('a') + 1\n end do\n\n is_use(:) = .false.\n\n do i=1,ls\n is_use(si(i)) = .true.\n end do\n\n mic=10001\n do i=1,26\n if (.not. is_use(i)) mic=min(mic,i)\n end do\n\n if (mic==10001) then\n ri = 1000\n do i=ls,2,-1\n if (s(i-1:i-1) < s(i:i)) then\n ri = i\n exit\n end if\n end do\n\n if(ri == 1000) then\n print*, -1\n stop\n end if\n mins='z'\n do i=ri,ls\n if (s(ri-1:ri-1) >= s(i:i)) cycle\n mins = min(s(i:i),mins)\n end do\n print*, s(1:ri-2) // mins\n stop\n end if\n\n\n\n s(ls+1:ls+1) = char(mic+ichar('a')-1)\n\n print*, trim(s)\n\n\nend program name", "language": "Fortran", "metadata": {"date": 1585228634, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03393.html", "problem_id": "p03393", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03393/input.txt", "sample_output_relpath": "derived/input_output/data/p03393/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03393/Fortran/s987440538.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s987440538", "user_id": "u234636620"}, "prompt_components": {"gold_output": "atcoderb\n", "input_to_evaluate": "program name\n implicit none\n character(26):: s\n character(1):: mins\n integer(4):: ls,i,mic, ri\n integer(4),allocatable:: si(:)\n logical:: is_use(26)\n\n read*, s\n ls = len_trim(s)\n allocate(si(ls))\n\n do i=1,ls\n si(i) = ichar(s(i:i)) - ichar('a') + 1\n end do\n\n is_use(:) = .false.\n\n do i=1,ls\n is_use(si(i)) = .true.\n end do\n\n mic=10001\n do i=1,26\n if (.not. is_use(i)) mic=min(mic,i)\n end do\n\n if (mic==10001) then\n ri = 1000\n do i=ls,2,-1\n if (s(i-1:i-1) < s(i:i)) then\n ri = i\n exit\n end if\n end do\n\n if(ri == 1000) then\n print*, -1\n stop\n end if\n mins='z'\n do i=ri,ls\n if (s(ri-1:ri-1) >= s(i:i)) cycle\n mins = min(s(i:i),mins)\n end do\n print*, s(1:ri-2) // mins\n stop\n end if\n\n\n\n s(ls+1:ls+1) = char(mic+ichar('a')-1)\n\n print*, trim(s)\n\n\nend program name", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible diverse words in lexicographical order.\n\nA word is called diverse if and only if it is a nonempty string of English lowercase letters and all letters in the word are distinct. For example, atcoder, zscoder and agc are diverse words while gotou and connect aren't diverse words.\n\nGiven a diverse word S, determine the next word that appears after S in the dictionary, i.e. the lexicographically smallest diverse word that is lexicographically larger than S, or determine that it doesn't exist.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 \\leq |S| \\leq 26\n\nS is a diverse word.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the next word that appears after S in the dictionary, or -1 if it doesn't exist.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\natcoderb\n\natcoderb is the lexicographically smallest diverse word that is lexicographically larger than atcoder. Note that atcoderb is lexicographically smaller than b.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nabcd\n\nSample Input 3\n\nzyxwvutsrqponmlkjihgfedcba\n\nSample Output 3\n\n-1\n\nThis is the lexicographically largest diverse word, so the answer is -1.\n\nSample Input 4\n\nabcdefghijklmnopqrstuvwzyx\n\nSample Output 4\n\nabcdefghijklmnopqrstuvx", "sample_input": "atcoder\n"}, "reference_outputs": ["atcoderb\n"], "source_document_id": "p03393", "source_text": "Score : 300 points\n\nProblem Statement\n\nGotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible diverse words in lexicographical order.\n\nA word is called diverse if and only if it is a nonempty string of English lowercase letters and all letters in the word are distinct. For example, atcoder, zscoder and agc are diverse words while gotou and connect aren't diverse words.\n\nGiven a diverse word S, determine the next word that appears after S in the dictionary, i.e. the lexicographically smallest diverse word that is lexicographically larger than S, or determine that it doesn't exist.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 \\leq |S| \\leq 26\n\nS is a diverse word.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the next word that appears after S in the dictionary, or -1 if it doesn't exist.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\natcoderb\n\natcoderb is the lexicographically smallest diverse word that is lexicographically larger than atcoder. Note that atcoderb is lexicographically smaller than b.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nabcd\n\nSample Input 3\n\nzyxwvutsrqponmlkjihgfedcba\n\nSample Output 3\n\n-1\n\nThis is the lexicographically largest diverse word, so the answer is -1.\n\nSample Input 4\n\nabcdefghijklmnopqrstuvwzyx\n\nSample Output 4\n\nabcdefghijklmnopqrstuvx", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1007, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s643086101", "group_id": "codeNet:p03393", "input_text": "program name\n implicit none\n character(26):: s\n integer(4):: ls,i,mic\n integer(4),allocatable:: si(:)\n logical:: is_use(26), f\n\n read*, s\n ls = len_trim(s)\n allocate(si(ls))\n\n do i=1,ls\n si(i) = ichar(s(i:i)) - ichar('a') + 1\n end do\n\n is_use(:) = .false.\n\n do i=1,ls\n is_use(si(i)) = .true.\n end do\n\n mic=10001\n do i=1,26\n if (.not. is_use(i)) mic=min(mic,i)\n end do\n f=.false.\n\n if (mic==10001) then\n do i=ls,2,-1\n if (si(i) > si(i-1)) then\n s(i-1:i-1) = char(ichar(s(i-1:i-1))+1)\n ls=i-1\n f=.true.\n exit\n end if\n end do\n if(f) then\n print*, s(1:ls)\n stop\n else\n print*, -1\n stop\n end if\n end if\n\n\n\n s(ls+1:ls+1) = char(mic+ichar('a')-1)\n\n print*, trim(s)\n\n\nend program name", "language": "Fortran", "metadata": {"date": 1585226109, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03393.html", "problem_id": "p03393", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03393/input.txt", "sample_output_relpath": "derived/input_output/data/p03393/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03393/Fortran/s643086101.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s643086101", "user_id": "u234636620"}, "prompt_components": {"gold_output": "atcoderb\n", "input_to_evaluate": "program name\n implicit none\n character(26):: s\n integer(4):: ls,i,mic\n integer(4),allocatable:: si(:)\n logical:: is_use(26), f\n\n read*, s\n ls = len_trim(s)\n allocate(si(ls))\n\n do i=1,ls\n si(i) = ichar(s(i:i)) - ichar('a') + 1\n end do\n\n is_use(:) = .false.\n\n do i=1,ls\n is_use(si(i)) = .true.\n end do\n\n mic=10001\n do i=1,26\n if (.not. is_use(i)) mic=min(mic,i)\n end do\n f=.false.\n\n if (mic==10001) then\n do i=ls,2,-1\n if (si(i) > si(i-1)) then\n s(i-1:i-1) = char(ichar(s(i-1:i-1))+1)\n ls=i-1\n f=.true.\n exit\n end if\n end do\n if(f) then\n print*, s(1:ls)\n stop\n else\n print*, -1\n stop\n end if\n end if\n\n\n\n s(ls+1:ls+1) = char(mic+ichar('a')-1)\n\n print*, trim(s)\n\n\nend program name", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible diverse words in lexicographical order.\n\nA word is called diverse if and only if it is a nonempty string of English lowercase letters and all letters in the word are distinct. For example, atcoder, zscoder and agc are diverse words while gotou and connect aren't diverse words.\n\nGiven a diverse word S, determine the next word that appears after S in the dictionary, i.e. the lexicographically smallest diverse word that is lexicographically larger than S, or determine that it doesn't exist.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 \\leq |S| \\leq 26\n\nS is a diverse word.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the next word that appears after S in the dictionary, or -1 if it doesn't exist.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\natcoderb\n\natcoderb is the lexicographically smallest diverse word that is lexicographically larger than atcoder. Note that atcoderb is lexicographically smaller than b.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nabcd\n\nSample Input 3\n\nzyxwvutsrqponmlkjihgfedcba\n\nSample Output 3\n\n-1\n\nThis is the lexicographically largest diverse word, so the answer is -1.\n\nSample Input 4\n\nabcdefghijklmnopqrstuvwzyx\n\nSample Output 4\n\nabcdefghijklmnopqrstuvx", "sample_input": "atcoder\n"}, "reference_outputs": ["atcoderb\n"], "source_document_id": "p03393", "source_text": "Score : 300 points\n\nProblem Statement\n\nGotou just received a dictionary. However, he doesn't recognize the language used in the dictionary. He did some analysis on the dictionary and realizes that the dictionary contains all possible diverse words in lexicographical order.\n\nA word is called diverse if and only if it is a nonempty string of English lowercase letters and all letters in the word are distinct. For example, atcoder, zscoder and agc are diverse words while gotou and connect aren't diverse words.\n\nGiven a diverse word S, determine the next word that appears after S in the dictionary, i.e. the lexicographically smallest diverse word that is lexicographically larger than S, or determine that it doesn't exist.\n\nLet X = x_{1}x_{2}...x_{n} and Y = y_{1}y_{2}...y_{m} be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or x_{j} > y_{j} where j is the smallest integer such that x_{j} \\neq y_{j}.\n\nConstraints\n\n1 \\leq |S| \\leq 26\n\nS is a diverse word.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the next word that appears after S in the dictionary, or -1 if it doesn't exist.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\natcoderb\n\natcoderb is the lexicographically smallest diverse word that is lexicographically larger than atcoder. Note that atcoderb is lexicographically smaller than b.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nabcd\n\nSample Input 3\n\nzyxwvutsrqponmlkjihgfedcba\n\nSample Output 3\n\n-1\n\nThis is the lexicographically largest diverse word, so the answer is -1.\n\nSample Input 4\n\nabcdefghijklmnopqrstuvwzyx\n\nSample Output 4\n\nabcdefghijklmnopqrstuvx", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 922, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s078043119", "group_id": "codeNet:p03399", "input_text": "program sample\n\tinteger ::A,B,C,D,e,f\n \n read(*,*) A\n read(*,*) B \n read(*,*) C \n read(*,*) D \n \n if (A>B) then\n \te=B\n else if(A<=B) then\n \te=A\n end if\n if(C>D) then\n \tf=D\n else if(C<=D) then\n \tf=C\n end if\n write(*,*) e+f\n stop\nend program sample\n\n", "language": "Fortran", "metadata": {"date": 1592631481, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03399.html", "problem_id": "p03399", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03399/input.txt", "sample_output_relpath": "derived/input_output/data/p03399/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03399/Fortran/s078043119.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s078043119", "user_id": "u323210830"}, "prompt_components": {"gold_output": "520\n", "input_to_evaluate": "program sample\n\tinteger ::A,B,C,D,e,f\n \n read(*,*) A\n read(*,*) B \n read(*,*) C \n read(*,*) D \n \n if (A>B) then\n \te=B\n else if(A<=B) then\n \te=A\n end if\n if(C>D) then\n \tf=D\n else if(C<=D) then\n \tf=C\n end if\n write(*,*) e+f\n stop\nend program sample\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou planned a trip using trains and buses.\nThe train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket.\nSimilarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket.\n\nFind the minimum total fare when the optimal choices are made for trains and buses.\n\nConstraints\n\n1 \\leq A \\leq 1 000\n\n1 \\leq B \\leq 1 000\n\n1 \\leq C \\leq 1 000\n\n1 \\leq D \\leq 1 000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\n\nOutput\n\nPrint the minimum total fare.\n\nSample Input 1\n\n600\n300\n220\n420\n\nSample Output 1\n\n520\n\nThe train fare will be 600 yen if you buy ordinary tickets, and 300 yen if you buy an unlimited ticket.\nThus, the optimal choice for trains is to buy an unlimited ticket for 300 yen.\nOn the other hand, the optimal choice for buses is to buy ordinary tickets for 220 yen.\n\nTherefore, the minimum total fare is 300 + 220 = 520 yen.\n\nSample Input 2\n\n555\n555\n400\n200\n\nSample Output 2\n\n755\n\nSample Input 3\n\n549\n817\n715\n603\n\nSample Output 3\n\n1152", "sample_input": "600\n300\n220\n420\n"}, "reference_outputs": ["520\n"], "source_document_id": "p03399", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou planned a trip using trains and buses.\nThe train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket.\nSimilarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket.\n\nFind the minimum total fare when the optimal choices are made for trains and buses.\n\nConstraints\n\n1 \\leq A \\leq 1 000\n\n1 \\leq B \\leq 1 000\n\n1 \\leq C \\leq 1 000\n\n1 \\leq D \\leq 1 000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\n\nOutput\n\nPrint the minimum total fare.\n\nSample Input 1\n\n600\n300\n220\n420\n\nSample Output 1\n\n520\n\nThe train fare will be 600 yen if you buy ordinary tickets, and 300 yen if you buy an unlimited ticket.\nThus, the optimal choice for trains is to buy an unlimited ticket for 300 yen.\nOn the other hand, the optimal choice for buses is to buy ordinary tickets for 220 yen.\n\nTherefore, the minimum total fare is 300 + 220 = 520 yen.\n\nSample Input 2\n\n555\n555\n400\n200\n\nSample Output 2\n\n755\n\nSample Input 3\n\n549\n817\n715\n603\n\nSample Output 3\n\n1152", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 311, "cpu_time_ms": 6, "memory_kb": 2756}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s159638968", "group_id": "codeNet:p03399", "input_text": "program sample\n\tinteger ::A,B,C,D,e,f\n \n read(*,*) A\n read(*,*) B \n read(*,*) C \n read(*,*) D \n \n if (A>B) then\n \te=B\n else if(B<=A) then\n \te=A\n end if\n if(C>D) then\n \tf=D\n else if(C<=D) then\n \tf=C\n end if\n write(*,*) e+f\n stop\nend program sample", "language": "Fortran", "metadata": {"date": 1592631420, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03399.html", "problem_id": "p03399", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03399/input.txt", "sample_output_relpath": "derived/input_output/data/p03399/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03399/Fortran/s159638968.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s159638968", "user_id": "u323210830"}, "prompt_components": {"gold_output": "520\n", "input_to_evaluate": "program sample\n\tinteger ::A,B,C,D,e,f\n \n read(*,*) A\n read(*,*) B \n read(*,*) C \n read(*,*) D \n \n if (A>B) then\n \te=B\n else if(B<=A) then\n \te=A\n end if\n if(C>D) then\n \tf=D\n else if(C<=D) then\n \tf=C\n end if\n write(*,*) e+f\n stop\nend program sample", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou planned a trip using trains and buses.\nThe train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket.\nSimilarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket.\n\nFind the minimum total fare when the optimal choices are made for trains and buses.\n\nConstraints\n\n1 \\leq A \\leq 1 000\n\n1 \\leq B \\leq 1 000\n\n1 \\leq C \\leq 1 000\n\n1 \\leq D \\leq 1 000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\n\nOutput\n\nPrint the minimum total fare.\n\nSample Input 1\n\n600\n300\n220\n420\n\nSample Output 1\n\n520\n\nThe train fare will be 600 yen if you buy ordinary tickets, and 300 yen if you buy an unlimited ticket.\nThus, the optimal choice for trains is to buy an unlimited ticket for 300 yen.\nOn the other hand, the optimal choice for buses is to buy ordinary tickets for 220 yen.\n\nTherefore, the minimum total fare is 300 + 220 = 520 yen.\n\nSample Input 2\n\n555\n555\n400\n200\n\nSample Output 2\n\n755\n\nSample Input 3\n\n549\n817\n715\n603\n\nSample Output 3\n\n1152", "sample_input": "600\n300\n220\n420\n"}, "reference_outputs": ["520\n"], "source_document_id": "p03399", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou planned a trip using trains and buses.\nThe train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket.\nSimilarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket.\n\nFind the minimum total fare when the optimal choices are made for trains and buses.\n\nConstraints\n\n1 \\leq A \\leq 1 000\n\n1 \\leq B \\leq 1 000\n\n1 \\leq C \\leq 1 000\n\n1 \\leq D \\leq 1 000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\n\nOutput\n\nPrint the minimum total fare.\n\nSample Input 1\n\n600\n300\n220\n420\n\nSample Output 1\n\n520\n\nThe train fare will be 600 yen if you buy ordinary tickets, and 300 yen if you buy an unlimited ticket.\nThus, the optimal choice for trains is to buy an unlimited ticket for 300 yen.\nOn the other hand, the optimal choice for buses is to buy ordinary tickets for 220 yen.\n\nTherefore, the minimum total fare is 300 + 220 = 520 yen.\n\nSample Input 2\n\n555\n555\n400\n200\n\nSample Output 2\n\n755\n\nSample Input 3\n\n549\n817\n715\n603\n\nSample Output 3\n\n1152", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 309, "cpu_time_ms": 6, "memory_kb": 2796}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s593145515", "group_id": "codeNet:p03399", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32)::a,b,c,d\n read*, a\n read*, b\n read*, c\n read*, d\n\n print'(i0)', min(a,b)+min(c,d)\nend program main", "language": "Fortran", "metadata": {"date": 1591398981, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03399.html", "problem_id": "p03399", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03399/input.txt", "sample_output_relpath": "derived/input_output/data/p03399/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03399/Fortran/s593145515.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s593145515", "user_id": "u234636620"}, "prompt_components": {"gold_output": "520\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32)::a,b,c,d\n read*, a\n read*, b\n read*, c\n read*, d\n\n print'(i0)', min(a,b)+min(c,d)\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou planned a trip using trains and buses.\nThe train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket.\nSimilarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket.\n\nFind the minimum total fare when the optimal choices are made for trains and buses.\n\nConstraints\n\n1 \\leq A \\leq 1 000\n\n1 \\leq B \\leq 1 000\n\n1 \\leq C \\leq 1 000\n\n1 \\leq D \\leq 1 000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\n\nOutput\n\nPrint the minimum total fare.\n\nSample Input 1\n\n600\n300\n220\n420\n\nSample Output 1\n\n520\n\nThe train fare will be 600 yen if you buy ordinary tickets, and 300 yen if you buy an unlimited ticket.\nThus, the optimal choice for trains is to buy an unlimited ticket for 300 yen.\nOn the other hand, the optimal choice for buses is to buy ordinary tickets for 220 yen.\n\nTherefore, the minimum total fare is 300 + 220 = 520 yen.\n\nSample Input 2\n\n555\n555\n400\n200\n\nSample Output 2\n\n755\n\nSample Input 3\n\n549\n817\n715\n603\n\nSample Output 3\n\n1152", "sample_input": "600\n300\n220\n420\n"}, "reference_outputs": ["520\n"], "source_document_id": "p03399", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou planned a trip using trains and buses.\nThe train fare will be A yen (the currency of Japan) if you buy ordinary tickets along the way, and B yen if you buy an unlimited ticket.\nSimilarly, the bus fare will be C yen if you buy ordinary tickets along the way, and D yen if you buy an unlimited ticket.\n\nFind the minimum total fare when the optimal choices are made for trains and buses.\n\nConstraints\n\n1 \\leq A \\leq 1 000\n\n1 \\leq B \\leq 1 000\n\n1 \\leq C \\leq 1 000\n\n1 \\leq D \\leq 1 000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\nC\nD\n\nOutput\n\nPrint the minimum total fare.\n\nSample Input 1\n\n600\n300\n220\n420\n\nSample Output 1\n\n520\n\nThe train fare will be 600 yen if you buy ordinary tickets, and 300 yen if you buy an unlimited ticket.\nThus, the optimal choice for trains is to buy an unlimited ticket for 300 yen.\nOn the other hand, the optimal choice for buses is to buy ordinary tickets for 220 yen.\n\nTherefore, the minimum total fare is 300 + 220 = 520 yen.\n\nSample Input 2\n\n555\n555\n400\n200\n\nSample Output 2\n\n755\n\nSample Input 3\n\n549\n817\n715\n603\n\nSample Output 3\n\n1152", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 200, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s319920502", "group_id": "codeNet:p03415", "input_text": "character(3) :: p,i,y\nread*,p\nread*,i\nread*,y\nprint*,p(1:1)//i(2:2)//y(3:3)\nend", "language": "Fortran", "metadata": {"date": 1579328907, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03415.html", "problem_id": "p03415", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03415/input.txt", "sample_output_relpath": "derived/input_output/data/p03415/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03415/Fortran/s319920502.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s319920502", "user_id": "u171356453"}, "prompt_components": {"gold_output": "abc\n", "input_to_evaluate": "character(3) :: p,i,y\nread*,p\nread*,i\nread*,y\nprint*,p(1:1)//i(2:2)//y(3:3)\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have a 3×3 square grid, where each square contains a lowercase English letters.\nThe letter in the square at the i-th row from the top and j-th column from the left is c_{ij}.\n\nPrint the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nConstraints\n\nInput consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{11}c_{12}c_{13}\nc_{21}c_{22}c_{23}\nc_{31}c_{32}c_{33}\n\nOutput\n\nPrint the string of length 3 that can be obtained by concatenating the letters on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nSample Input 1\n\nant\nobe\nrec\n\nSample Output 1\n\nabc\n\nThe letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid are a, b and c from top-right to bottom-left. Concatenate these letters and print abc.\n\nSample Input 2\n\nedu\ncat\nion\n\nSample Output 2\n\nean", "sample_input": "ant\nobe\nrec\n"}, "reference_outputs": ["abc\n"], "source_document_id": "p03415", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have a 3×3 square grid, where each square contains a lowercase English letters.\nThe letter in the square at the i-th row from the top and j-th column from the left is c_{ij}.\n\nPrint the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nConstraints\n\nInput consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{11}c_{12}c_{13}\nc_{21}c_{22}c_{23}\nc_{31}c_{32}c_{33}\n\nOutput\n\nPrint the string of length 3 that can be obtained by concatenating the letters on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nSample Input 1\n\nant\nobe\nrec\n\nSample Output 1\n\nabc\n\nThe letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid are a, b and c from top-right to bottom-left. Concatenate these letters and print abc.\n\nSample Input 2\n\nedu\ncat\nion\n\nSample Output 2\n\nean", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 79, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s613984825", "group_id": "codeNet:p03415", "input_text": "character a*3,b*3,c*3\nread*, a,b,c\nprint*, a(1:1)//b(2:2)//c(3:3)\nend", "language": "Fortran", "metadata": {"date": 1571890822, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03415.html", "problem_id": "p03415", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03415/input.txt", "sample_output_relpath": "derived/input_output/data/p03415/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03415/Fortran/s613984825.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s613984825", "user_id": "u244203620"}, "prompt_components": {"gold_output": "abc\n", "input_to_evaluate": "character a*3,b*3,c*3\nread*, a,b,c\nprint*, a(1:1)//b(2:2)//c(3:3)\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have a 3×3 square grid, where each square contains a lowercase English letters.\nThe letter in the square at the i-th row from the top and j-th column from the left is c_{ij}.\n\nPrint the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nConstraints\n\nInput consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{11}c_{12}c_{13}\nc_{21}c_{22}c_{23}\nc_{31}c_{32}c_{33}\n\nOutput\n\nPrint the string of length 3 that can be obtained by concatenating the letters on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nSample Input 1\n\nant\nobe\nrec\n\nSample Output 1\n\nabc\n\nThe letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid are a, b and c from top-right to bottom-left. Concatenate these letters and print abc.\n\nSample Input 2\n\nedu\ncat\nion\n\nSample Output 2\n\nean", "sample_input": "ant\nobe\nrec\n"}, "reference_outputs": ["abc\n"], "source_document_id": "p03415", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have a 3×3 square grid, where each square contains a lowercase English letters.\nThe letter in the square at the i-th row from the top and j-th column from the left is c_{ij}.\n\nPrint the string of length 3 that can be obtained by concatenating the letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nConstraints\n\nInput consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{11}c_{12}c_{13}\nc_{21}c_{22}c_{23}\nc_{31}c_{32}c_{33}\n\nOutput\n\nPrint the string of length 3 that can be obtained by concatenating the letters on the diagonal connecting the top-left and bottom-right corner of the grid, from the top-left to bottom-right.\n\nSample Input 1\n\nant\nobe\nrec\n\nSample Output 1\n\nabc\n\nThe letters in the squares on the diagonal connecting the top-left and bottom-right corner of the grid are a, b and c from top-right to bottom-left. Concatenate these letters and print abc.\n\nSample Input 2\n\nedu\ncat\nion\n\nSample Output 2\n\nean", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 69, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s240236396", "group_id": "codeNet:p03417", "input_text": "program main\nimplicit None\n\tinteger(8)::n,m\n\tread *,n,m\n\t\n\tif(n*m == 1)then\n\t\tprint 101,1\n\t\tstop\n\tendif\n\t\n\tif(n == 1 .or. m == 1)then\n\t\tprint 101,n*m-2\n\t\tstop\n\tendif\n\t\n\tprint 101,(n-2)*(m-2)\n101 format(i0)\nend program main", "language": "Fortran", "metadata": {"date": 1545360342, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03417.html", "problem_id": "p03417", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03417/input.txt", "sample_output_relpath": "derived/input_output/data/p03417/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03417/Fortran/s240236396.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s240236396", "user_id": "u900266249"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program main\nimplicit None\n\tinteger(8)::n,m\n\tread *,n,m\n\t\n\tif(n*m == 1)then\n\t\tprint 101,1\n\t\tstop\n\tendif\n\t\n\tif(n == 1 .or. m == 1)then\n\t\tprint 101,n*m-2\n\t\tstop\n\tendif\n\t\n\tprint 101,(n-2)*(m-2)\n101 format(i0)\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region.\nThe front and back sides of these cards can be distinguished, and initially every card faces up.\n\nWe will perform the following operation once for each square contains a card:\n\nFor each of the following nine squares, flip the card in it if it exists: the target square itself and the eight squares that shares a corner or a side with the target square.\n\nIt can be proved that, whether each card faces up or down after all the operations does not depend on the order the operations are performed.\nFind the number of cards that face down after all the operations.\n\nConstraints\n\n1 \\leq N,M \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of cards that face down after all the operations.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n0\n\nWe will flip every card in any of the four operations. Thus, after all the operations, all cards face up.\n\nSample Input 2\n\n1 7\n\nSample Output 2\n\n5\n\nAfter all the operations, all cards except at both ends face down.\n\nSample Input 3\n\n314 1592\n\nSample Output 3\n\n496080", "sample_input": "2 2\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03417", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region.\nThe front and back sides of these cards can be distinguished, and initially every card faces up.\n\nWe will perform the following operation once for each square contains a card:\n\nFor each of the following nine squares, flip the card in it if it exists: the target square itself and the eight squares that shares a corner or a side with the target square.\n\nIt can be proved that, whether each card faces up or down after all the operations does not depend on the order the operations are performed.\nFind the number of cards that face down after all the operations.\n\nConstraints\n\n1 \\leq N,M \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of cards that face down after all the operations.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n0\n\nWe will flip every card in any of the four operations. Thus, after all the operations, all cards face up.\n\nSample Input 2\n\n1 7\n\nSample Output 2\n\n5\n\nAfter all the operations, all cards except at both ends face down.\n\nSample Input 3\n\n314 1592\n\nSample Output 3\n\n496080", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 222, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s101365571", "group_id": "codeNet:p03417", "input_text": "program main\nimplicit None\n\tinteger::n,m\n\tread *,n,m\n\t\n\tif(n == 1 .or. m == 1)then\n\t\tif(n*m == 1)then\n\t\t\tprint 101,1\n\t\t\tstop\n\t\tendif\n\t\tprint 101,n*m-2\n\t\tstop\n\tendif\n\t\n\tprint 101,(n-2)*(m-2)\n101 format(i0)\nend program main\n", "language": "Fortran", "metadata": {"date": 1545358465, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03417.html", "problem_id": "p03417", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03417/input.txt", "sample_output_relpath": "derived/input_output/data/p03417/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03417/Fortran/s101365571.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s101365571", "user_id": "u900266249"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program main\nimplicit None\n\tinteger::n,m\n\tread *,n,m\n\t\n\tif(n == 1 .or. m == 1)then\n\t\tif(n*m == 1)then\n\t\t\tprint 101,1\n\t\t\tstop\n\t\tendif\n\t\tprint 101,n*m-2\n\t\tstop\n\tendif\n\t\n\tprint 101,(n-2)*(m-2)\n101 format(i0)\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region.\nThe front and back sides of these cards can be distinguished, and initially every card faces up.\n\nWe will perform the following operation once for each square contains a card:\n\nFor each of the following nine squares, flip the card in it if it exists: the target square itself and the eight squares that shares a corner or a side with the target square.\n\nIt can be proved that, whether each card faces up or down after all the operations does not depend on the order the operations are performed.\nFind the number of cards that face down after all the operations.\n\nConstraints\n\n1 \\leq N,M \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of cards that face down after all the operations.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n0\n\nWe will flip every card in any of the four operations. Thus, after all the operations, all cards face up.\n\nSample Input 2\n\n1 7\n\nSample Output 2\n\n5\n\nAfter all the operations, all cards except at both ends face down.\n\nSample Input 3\n\n314 1592\n\nSample Output 3\n\n496080", "sample_input": "2 2\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03417", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region.\nThe front and back sides of these cards can be distinguished, and initially every card faces up.\n\nWe will perform the following operation once for each square contains a card:\n\nFor each of the following nine squares, flip the card in it if it exists: the target square itself and the eight squares that shares a corner or a side with the target square.\n\nIt can be proved that, whether each card faces up or down after all the operations does not depend on the order the operations are performed.\nFind the number of cards that face down after all the operations.\n\nConstraints\n\n1 \\leq N,M \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of cards that face down after all the operations.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n0\n\nWe will flip every card in any of the four operations. Thus, after all the operations, all cards face up.\n\nSample Input 2\n\n1 7\n\nSample Output 2\n\n5\n\nAfter all the operations, all cards except at both ends face down.\n\nSample Input 3\n\n314 1592\n\nSample Output 3\n\n496080", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 222, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s390037407", "group_id": "codeNet:p03419", "input_text": "integer N,M\nread*,N,M\nprint\"(i0)\",max(merge(max(m,n)-2,(N-2)*(M-2),(N-1)*(M-1)==0)+merge(2,0,m+n==2),0)\nend", "language": "Fortran", "metadata": {"date": 1558935387, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03419.html", "problem_id": "p03419", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03419/input.txt", "sample_output_relpath": "derived/input_output/data/p03419/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03419/Fortran/s390037407.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s390037407", "user_id": "u598073939"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "integer N,M\nread*,N,M\nprint\"(i0)\",max(merge(max(m,n)-2,(N-2)*(M-2),(N-1)*(M-1)==0)+merge(2,0,m+n==2),0)\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region.\nThe front and back sides of these cards can be distinguished, and initially every card faces up.\n\nWe will perform the following operation once for each square contains a card:\n\nFor each of the following nine squares, flip the card in it if it exists: the target square itself and the eight squares that shares a corner or a side with the target square.\n\nIt can be proved that, whether each card faces up or down after all the operations does not depend on the order the operations are performed.\nFind the number of cards that face down after all the operations.\n\nConstraints\n\n1 \\leq N,M \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of cards that face down after all the operations.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n0\n\nWe will flip every card in any of the four operations. Thus, after all the operations, all cards face up.\n\nSample Input 2\n\n1 7\n\nSample Output 2\n\n5\n\nAfter all the operations, all cards except at both ends face down.\n\nSample Input 3\n\n314 1592\n\nSample Output 3\n\n496080", "sample_input": "2 2\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03419", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a grid with infinitely many rows and columns. In this grid, there is a rectangular region with consecutive N rows and M columns, and a card is placed in each square in this region.\nThe front and back sides of these cards can be distinguished, and initially every card faces up.\n\nWe will perform the following operation once for each square contains a card:\n\nFor each of the following nine squares, flip the card in it if it exists: the target square itself and the eight squares that shares a corner or a side with the target square.\n\nIt can be proved that, whether each card faces up or down after all the operations does not depend on the order the operations are performed.\nFind the number of cards that face down after all the operations.\n\nConstraints\n\n1 \\leq N,M \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of cards that face down after all the operations.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n0\n\nWe will flip every card in any of the four operations. Thus, after all the operations, all cards face up.\n\nSample Input 2\n\n1 7\n\nSample Output 2\n\n5\n\nAfter all the operations, all cards except at both ends face down.\n\nSample Input 3\n\n314 1592\n\nSample Output 3\n\n496080", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 107, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s249677480", "group_id": "codeNet:p03420", "input_text": "program arc091_d\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,k,b,ans=0\n\n read*, n,k\n\n do b = k+1,n\n ans=ans+(n/(b)*(b-k))+max((n-((n/b)*b+k)+1),0)\n end do\n if (k==0) ans=ans-n\n print'(i0)', ans\nend program arc091_d", "language": "Fortran", "metadata": {"date": 1591986962, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03420.html", "problem_id": "p03420", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03420/input.txt", "sample_output_relpath": "derived/input_output/data/p03420/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03420/Fortran/s249677480.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s249677480", "user_id": "u234636620"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program arc091_d\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,k,b,ans=0\n\n read*, n,k\n\n do b = k+1,n\n ans=ans+(n/(b)*(b-k))+max((n-((n/b)*b+k)+1),0)\n end do\n if (k==0) ans=ans-n\n print'(i0)', ans\nend program arc091_d", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten.\nHe remembers that the remainder of a divided by b was greater than or equal to K.\nFind the number of possible pairs that he may have had.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq K \\leq N-1\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible pairs that he may have had.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n7\n\nThere are seven possible pairs: (2,3),(5,3),(2,4),(3,4),(2,5),(3,5) and (4,5).\n\nSample Input 2\n\n10 0\n\nSample Output 2\n\n100\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n287927211", "sample_input": "5 2\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03420", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi had a pair of two positive integers not exceeding N, (a,b), which he has forgotten.\nHe remembers that the remainder of a divided by b was greater than or equal to K.\nFind the number of possible pairs that he may have had.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq K \\leq N-1\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of possible pairs that he may have had.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n7\n\nThere are seven possible pairs: (2,3),(5,3),(2,4),(3,4),(2,5),(3,5) and (4,5).\n\nSample Input 2\n\n10 0\n\nSample Output 2\n\n100\n\nSample Input 3\n\n31415 9265\n\nSample Output 3\n\n287927211", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 270, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s794587188", "group_id": "codeNet:p03422", "input_text": "program strange_nim\n implicit none\n integer :: n, a, k, i, g = 0\n read(*,*) n\n do i = 1, n\n read(*,*) a, k\n g = xor(g,grundy(a,k))\n end do\n if (g == 0) then\n write(*,'(a)') \"Aoki\"\n else\n write(*,'(a)') \"Takahashi\"\n end if\ncontains\n recursive function grundy(a,k) result(ret)\n integer, intent(in) :: a, k\n integer :: ret\n ret = a/k\n if (ret == 0 .or. mod(a,k) == 0) return\n ret = grundy(a-ret-1,k)\n end\nend program strange_nim", "language": "Fortran", "metadata": {"date": 1568178206, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03422.html", "problem_id": "p03422", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03422/input.txt", "sample_output_relpath": "derived/input_output/data/p03422/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03422/Fortran/s794587188.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s794587188", "user_id": "u506403362"}, "prompt_components": {"gold_output": "Aoki\n", "input_to_evaluate": "program strange_nim\n implicit none\n integer :: n, a, k, i, g = 0\n read(*,*) n\n do i = 1, n\n read(*,*) a, k\n g = xor(g,grundy(a,k))\n end do\n if (g == 0) then\n write(*,'(a)') \"Aoki\"\n else\n write(*,'(a)') \"Takahashi\"\n end if\ncontains\n recursive function grundy(a,k) result(ret)\n integer, intent(in) :: a, k\n integer :: ret\n ret = a/k\n if (ret == 0 .or. mod(a,k) == 0) return\n ret = grundy(a-ret-1,k)\n end\nend program strange_nim", "problem_context": "Score : 900 points\n\nProblem Statement\n\nTakahashi and Aoki are playing a stone-taking game. Initially, there are N piles of stones, and the i-th pile contains A_i stones and has an associated integer K_i.\n\nStarting from Takahashi, Takahashi and Aoki take alternate turns to perform the following operation:\n\nChoose a pile. If the i-th pile is selected and there are X stones left in the pile, remove some number of stones between 1 and floor(X/K_i) (inclusive) from the pile.\n\nThe player who first becomes unable to perform the operation loses the game. Assuming that both players play optimally, determine the winner of the game.\nHere, floor(x) represents the largest integer not greater than x.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i,K_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 K_1\n:\nA_N K_N\n\nOutput\n\nIf Takahashi will win, print Takahashi; if Aoki will win, print Aoki.\n\nSample Input 1\n\n2\n5 2\n3 3\n\nSample Output 1\n\nAoki\n\nInitially, from the first pile at most floor(5/2)=2 stones can be removed at a time, and from the second pile at most floor(3/3)=1 stone can be removed at a time.\n\nIf Takahashi first takes two stones from the first pile, from the first pile at most floor(3/2)=1 stone can now be removed at a time, and from the second pile at most floor(3/3)=1 stone can be removed at a time.\n\nThen, if Aoki takes one stone from the second pile, from the first pile at most floor(3/2)=1 stone can be removed at a time, and from the second pile no more stones can be removed (since floor(2/3)=0).\n\nThen, if Takahashi takes one stone from the first pile, from the first pile at most floor(2/2)=1 stone can now be removed at a time, and from the second pile no more stones can be removed.\n\nThen, if Aoki takes one stone from the first pile, from the first pile at most floor(1/2)=0 stones can now be removed at a time, and from the second pile no more stones can be removed.\n\nNo more operation can be performed, thus Aoki wins. If Takahashi plays differently, Aoki can also win by play accordingly.\n\nSample Input 2\n\n3\n3 2\n4 3\n5 1\n\nSample Output 2\n\nTakahashi\n\nSample Input 3\n\n3\n28 3\n16 4\n19 2\n\nSample Output 3\n\nAoki\n\nSample Input 4\n\n4\n3141 59\n26535 897\n93 23\n8462 64\n\nSample Output 4\n\nTakahashi", "sample_input": "2\n5 2\n3 3\n"}, "reference_outputs": ["Aoki\n"], "source_document_id": "p03422", "source_text": "Score : 900 points\n\nProblem Statement\n\nTakahashi and Aoki are playing a stone-taking game. Initially, there are N piles of stones, and the i-th pile contains A_i stones and has an associated integer K_i.\n\nStarting from Takahashi, Takahashi and Aoki take alternate turns to perform the following operation:\n\nChoose a pile. If the i-th pile is selected and there are X stones left in the pile, remove some number of stones between 1 and floor(X/K_i) (inclusive) from the pile.\n\nThe player who first becomes unable to perform the operation loses the game. Assuming that both players play optimally, determine the winner of the game.\nHere, floor(x) represents the largest integer not greater than x.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i,K_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 K_1\n:\nA_N K_N\n\nOutput\n\nIf Takahashi will win, print Takahashi; if Aoki will win, print Aoki.\n\nSample Input 1\n\n2\n5 2\n3 3\n\nSample Output 1\n\nAoki\n\nInitially, from the first pile at most floor(5/2)=2 stones can be removed at a time, and from the second pile at most floor(3/3)=1 stone can be removed at a time.\n\nIf Takahashi first takes two stones from the first pile, from the first pile at most floor(3/2)=1 stone can now be removed at a time, and from the second pile at most floor(3/3)=1 stone can be removed at a time.\n\nThen, if Aoki takes one stone from the second pile, from the first pile at most floor(3/2)=1 stone can be removed at a time, and from the second pile no more stones can be removed (since floor(2/3)=0).\n\nThen, if Takahashi takes one stone from the first pile, from the first pile at most floor(2/2)=1 stone can now be removed at a time, and from the second pile no more stones can be removed.\n\nThen, if Aoki takes one stone from the first pile, from the first pile at most floor(1/2)=0 stones can now be removed at a time, and from the second pile no more stones can be removed.\n\nNo more operation can be performed, thus Aoki wins. If Takahashi plays differently, Aoki can also win by play accordingly.\n\nSample Input 2\n\n3\n3 2\n4 3\n5 1\n\nSample Output 2\n\nTakahashi\n\nSample Input 3\n\n3\n28 3\n16 4\n19 2\n\nSample Output 3\n\nAoki\n\nSample Input 4\n\n4\n3141 59\n26535 897\n93 23\n8462 64\n\nSample Output 4\n\nTakahashi", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 462, "cpu_time_ms": 2112, "memory_kb": 98176}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s686459308", "group_id": "codeNet:p03423", "input_text": "program prob23\n implicit none\n integer :: n\n read(*,*) n\n write(*,*) n/3\n\n stop\ncontains\nend program prob23", "language": "Fortran", "metadata": {"date": 1592629340, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03423.html", "problem_id": "p03423", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03423/input.txt", "sample_output_relpath": "derived/input_output/data/p03423/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03423/Fortran/s686459308.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s686459308", "user_id": "u478462004"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program prob23\n implicit none\n integer :: n\n read(*,*) n\n write(*,*) n/3\n\n stop\ncontains\nend program prob23", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N students in a school.\n\nWe will divide these students into some groups, and in each group they will discuss some themes.\n\nYou think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.\n\nDivide the students so that the number of groups consisting of three or more students is maximized.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf you can form at most x groups consisting of three or more students, print x.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n2\n\nFor example, you can form a group of three students and another of five students.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nSometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.\n\nSample Input 3\n\n9\n\nSample Output 3\n\n3", "sample_input": "8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03423", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N students in a school.\n\nWe will divide these students into some groups, and in each group they will discuss some themes.\n\nYou think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.\n\nDivide the students so that the number of groups consisting of three or more students is maximized.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf you can form at most x groups consisting of three or more students, print x.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n2\n\nFor example, you can form a group of three students and another of five students.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nSometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.\n\nSample Input 3\n\n9\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 122, "cpu_time_ms": 5, "memory_kb": 2852}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s443694579", "group_id": "codeNet:p03423", "input_text": "program main\n\timplicit none\n integer::a\n read(*,*)a\n write(*,*)a/3\n stop\nend program main", "language": "Fortran", "metadata": {"date": 1592628671, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03423.html", "problem_id": "p03423", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03423/input.txt", "sample_output_relpath": "derived/input_output/data/p03423/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03423/Fortran/s443694579.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s443694579", "user_id": "u884601206"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n\timplicit none\n integer::a\n read(*,*)a\n write(*,*)a/3\n stop\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N students in a school.\n\nWe will divide these students into some groups, and in each group they will discuss some themes.\n\nYou think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.\n\nDivide the students so that the number of groups consisting of three or more students is maximized.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf you can form at most x groups consisting of three or more students, print x.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n2\n\nFor example, you can form a group of three students and another of five students.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nSometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.\n\nSample Input 3\n\n9\n\nSample Output 3\n\n3", "sample_input": "8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03423", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N students in a school.\n\nWe will divide these students into some groups, and in each group they will discuss some themes.\n\nYou think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.\n\nDivide the students so that the number of groups consisting of three or more students is maximized.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf you can form at most x groups consisting of three or more students, print x.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n2\n\nFor example, you can form a group of three students and another of five students.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nSometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.\n\nSample Input 3\n\n9\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 101, "cpu_time_ms": 5, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s940107689", "group_id": "codeNet:p03423", "input_text": "read*,n\nprint*,n/3\nend", "language": "Fortran", "metadata": {"date": 1579328968, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03423.html", "problem_id": "p03423", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03423/input.txt", "sample_output_relpath": "derived/input_output/data/p03423/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03423/Fortran/s940107689.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s940107689", "user_id": "u171356453"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "read*,n\nprint*,n/3\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are N students in a school.\n\nWe will divide these students into some groups, and in each group they will discuss some themes.\n\nYou think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.\n\nDivide the students so that the number of groups consisting of three or more students is maximized.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf you can form at most x groups consisting of three or more students, print x.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n2\n\nFor example, you can form a group of three students and another of five students.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nSometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.\n\nSample Input 3\n\n9\n\nSample Output 3\n\n3", "sample_input": "8\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03423", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are N students in a school.\n\nWe will divide these students into some groups, and in each group they will discuss some themes.\n\nYou think that groups consisting of two or less students cannot have an effective discussion, so you want to have as many groups consisting of three or more students as possible.\n\nDivide the students so that the number of groups consisting of three or more students is maximized.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf you can form at most x groups consisting of three or more students, print x.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n2\n\nFor example, you can form a group of three students and another of five students.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nSometimes you cannot form any group consisting of three or more students, regardless of how you divide the students.\n\nSample Input 3\n\n9\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 22, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s615297160", "group_id": "codeNet:p03425", "input_text": "program ABC_089_C_March\n implicit none\n integer(8) N, i, j, k, a(1:5)\n integer(8)countN\n character(1) c, m(1:5)\n character(10), allocatable :: S(:)\n read(*, *) N\n allocate(S(1: N))\n do i = 1, N\n read(*, *) S(i)\n end do\n m(1) = 'M'\n m(2) = 'A'\n m(3) = 'R'\n m(4) = 'C'\n m(5) = 'H'\n a(:) = 0\n do j = 1, 5\n do i = 1, N\n\t read(S(i), '(a1)') c\n\t\t if( c == m(j) ) then\n\t\t a(j) = a(j) + 1\n\t\t end if\n\t end do\n end do\n countN = 0\n do k = 1, 3\n do j = k, 3\n\t do i = j, 3\n\t\t countN = countN + a(k)*a(j+1)*a(i+2)\n\t\t end do\n\t end do\n end do\n write(*, *) countN\nend program ABC_089_C_March", "language": "Fortran", "metadata": {"date": 1524883034, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03425.html", "problem_id": "p03425", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03425/input.txt", "sample_output_relpath": "derived/input_output/data/p03425/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03425/Fortran/s615297160.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s615297160", "user_id": "u728000113"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ABC_089_C_March\n implicit none\n integer(8) N, i, j, k, a(1:5)\n integer(8)countN\n character(1) c, m(1:5)\n character(10), allocatable :: S(:)\n read(*, *) N\n allocate(S(1: N))\n do i = 1, N\n read(*, *) S(i)\n end do\n m(1) = 'M'\n m(2) = 'A'\n m(3) = 'R'\n m(4) = 'C'\n m(5) = 'H'\n a(:) = 0\n do j = 1, 5\n do i = 1, N\n\t read(S(i), '(a1)') c\n\t\t if( c == m(j) ) then\n\t\t a(j) = a(j) + 1\n\t\t end if\n\t end do\n end do\n countN = 0\n do k = 1, 3\n do j = k, 3\n\t do i = j, 3\n\t\t countN = countN + a(k)*a(j+1)*a(i+2)\n\t\t end do\n\t end do\n end do\n write(*, *) countN\nend program ABC_089_C_March", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people. The name of the i-th person is S_i.\n\nWe would like to choose three people so that the following conditions are met:\n\nThe name of every chosen person begins with M, A, R, C or H.\n\nThere are no multiple people whose names begin with the same letter.\n\nHow many such ways are there to choose three people, disregarding order?\n\nNote that the answer may not fit into a 32-bit integer type.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i consists of uppercase English letters.\n\n1 \\leq |S_i| \\leq 10\n\nS_i \\neq S_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nIf there are x ways to choose three people so that the given conditions are met, print x.\n\nSample Input 1\n\n5\nMASHIKE\nRUMOI\nOBIRA\nHABORO\nHOROKANAI\n\nSample Output 1\n\n2\n\nWe can choose three people with the following names:\n\nMASHIKE, RUMOI, HABORO\n\nMASHIKE, RUMOI, HOROKANAI\n\nThus, we have two ways.\n\nSample Input 2\n\n4\nZZ\nZZZ\nZ\nZZZZZZZZZZ\n\nSample Output 2\n\n0\n\nNote that there may be no ways to choose three people so that the given conditions are met.\n\nSample Input 3\n\n5\nCHOKUDAI\nRNG\nMAKOTO\nAOKI\nRINGO\n\nSample Output 3\n\n7", "sample_input": "5\nMASHIKE\nRUMOI\nOBIRA\nHABORO\nHOROKANAI\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03425", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people. The name of the i-th person is S_i.\n\nWe would like to choose three people so that the following conditions are met:\n\nThe name of every chosen person begins with M, A, R, C or H.\n\nThere are no multiple people whose names begin with the same letter.\n\nHow many such ways are there to choose three people, disregarding order?\n\nNote that the answer may not fit into a 32-bit integer type.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\nS_i consists of uppercase English letters.\n\n1 \\leq |S_i| \\leq 10\n\nS_i \\neq S_j (i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nIf there are x ways to choose three people so that the given conditions are met, print x.\n\nSample Input 1\n\n5\nMASHIKE\nRUMOI\nOBIRA\nHABORO\nHOROKANAI\n\nSample Output 1\n\n2\n\nWe can choose three people with the following names:\n\nMASHIKE, RUMOI, HABORO\n\nMASHIKE, RUMOI, HOROKANAI\n\nThus, we have two ways.\n\nSample Input 2\n\n4\nZZ\nZZZ\nZ\nZZZZZZZZZZ\n\nSample Output 2\n\n0\n\nNote that there may be no ways to choose three people so that the given conditions are met.\n\nSample Input 3\n\n5\nCHOKUDAI\nRNG\nMAKOTO\nAOKI\nRINGO\n\nSample Output 3\n\n7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 668, "cpu_time_ms": 335, "memory_kb": 1536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s522299046", "group_id": "codeNet:p03427", "input_text": "program prob4\n implicit none\n integer(8) :: N\n integer :: m\n\n read(*,*) N\n N = N + 1\n\n m = 0\n do while(N >= 10)\n N = N / 10\n m = m + 1\n end do\n\n write(*,*) 9*m + N - 1\n\n stop\ncontains\nend program prob4", "language": "Fortran", "metadata": {"date": 1592616106, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03427.html", "problem_id": "p03427", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03427/input.txt", "sample_output_relpath": "derived/input_output/data/p03427/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03427/Fortran/s522299046.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s522299046", "user_id": "u478462004"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "program prob4\n implicit none\n integer(8) :: N\n integer :: m\n\n read(*,*) N\n N = N + 1\n\n m = 0\n do while(N >= 10)\n N = N / 10\n m = m + 1\n end do\n\n write(*,*) 9*m + N - 1\n\n stop\ncontains\nend program prob4", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFind the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nConstraints\n\n1\\leq N \\leq 10^{16}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nSample Input 1\n\n100\n\nSample Output 1\n\n18\n\nFor example, the sum of the digits in 99 is 18, which turns out to be the maximum value.\n\nSample Input 2\n\n9995\n\nSample Output 2\n\n35\n\nFor example, the sum of the digits in 9989 is 35, which turns out to be the maximum value.\n\nSample Input 3\n\n3141592653589793\n\nSample Output 3\n\n137", "sample_input": "100\n"}, "reference_outputs": ["18\n"], "source_document_id": "p03427", "source_text": "Score : 300 points\n\nProblem Statement\n\nFind the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nConstraints\n\n1\\leq N \\leq 10^{16}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nSample Input 1\n\n100\n\nSample Output 1\n\n18\n\nFor example, the sum of the digits in 99 is 18, which turns out to be the maximum value.\n\nSample Input 2\n\n9995\n\nSample Output 2\n\n35\n\nFor example, the sum of the digits in 9989 is 35, which turns out to be the maximum value.\n\nSample Input 3\n\n3141592653589793\n\nSample Output 3\n\n137", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 245, "cpu_time_ms": 6, "memory_kb": 2836}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s142504879", "group_id": "codeNet:p03427", "input_text": "program A819B\n implicit none\n integer(8)::i,j,ans,Nlen,calc\n character(17)::N\n integer(8),allocatable,dimension(:)::A\n read*,N\n Nlen=len_trim(N)\n ans=0\n allocate(A(Nlen))\n do i=1,Nlen\n A(i)=ichar(N(i:i))-48\n ans=ans+A(i)\n end do\n\n do i=1,Nlen\n calc=0\n do j=1,Nlen\n if(ji)calc=calc+9\n end do\n ans=max(ans,calc)\n end do\n\n print'(i0)',ans\nend program A819B", "language": "Fortran", "metadata": {"date": 1584633050, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03427.html", "problem_id": "p03427", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03427/input.txt", "sample_output_relpath": "derived/input_output/data/p03427/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03427/Fortran/s142504879.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s142504879", "user_id": "u414699019"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "program A819B\n implicit none\n integer(8)::i,j,ans,Nlen,calc\n character(17)::N\n integer(8),allocatable,dimension(:)::A\n read*,N\n Nlen=len_trim(N)\n ans=0\n allocate(A(Nlen))\n do i=1,Nlen\n A(i)=ichar(N(i:i))-48\n ans=ans+A(i)\n end do\n\n do i=1,Nlen\n calc=0\n do j=1,Nlen\n if(ji)calc=calc+9\n end do\n ans=max(ans,calc)\n end do\n\n print'(i0)',ans\nend program A819B", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFind the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nConstraints\n\n1\\leq N \\leq 10^{16}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nSample Input 1\n\n100\n\nSample Output 1\n\n18\n\nFor example, the sum of the digits in 99 is 18, which turns out to be the maximum value.\n\nSample Input 2\n\n9995\n\nSample Output 2\n\n35\n\nFor example, the sum of the digits in 9989 is 35, which turns out to be the maximum value.\n\nSample Input 3\n\n3141592653589793\n\nSample Output 3\n\n137", "sample_input": "100\n"}, "reference_outputs": ["18\n"], "source_document_id": "p03427", "source_text": "Score : 300 points\n\nProblem Statement\n\nFind the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nConstraints\n\n1\\leq N \\leq 10^{16}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nSample Input 1\n\n100\n\nSample Output 1\n\n18\n\nFor example, the sum of the digits in 99 is 18, which turns out to be the maximum value.\n\nSample Input 2\n\n9995\n\nSample Output 2\n\n35\n\nFor example, the sum of the digits in 9989 is 35, which turns out to be the maximum value.\n\nSample Input 3\n\n3141592653589793\n\nSample Output 3\n\n137", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 517, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s756575391", "group_id": "codeNet:p03427", "input_text": "program A819B\n implicit none\n integer(8)::i,j,ans,Nlen,calc\n character(16)::N\n integer(8),allocatable,dimension(:)::A\n read*,N\n Nlen=len_trim(N)\n ans=0\n allocate(A(Nlen))\n do i=1,Nlen\n A(i)=ichar(N(i:i))-48\n ans=ans+A(i)\n end do\n\n do i=1,Nlen\n calc=0\n if(A(i)/=0)then\n do j=1,Nlen\n if(ji)calc=calc+9\n end do\n end if\n ans=max(ans,calc)\n end do\n\n print'(i0)',ans\nend program A819B", "language": "Fortran", "metadata": {"date": 1584619849, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03427.html", "problem_id": "p03427", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03427/input.txt", "sample_output_relpath": "derived/input_output/data/p03427/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03427/Fortran/s756575391.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s756575391", "user_id": "u414699019"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "program A819B\n implicit none\n integer(8)::i,j,ans,Nlen,calc\n character(16)::N\n integer(8),allocatable,dimension(:)::A\n read*,N\n Nlen=len_trim(N)\n ans=0\n allocate(A(Nlen))\n do i=1,Nlen\n A(i)=ichar(N(i:i))-48\n ans=ans+A(i)\n end do\n\n do i=1,Nlen\n calc=0\n if(A(i)/=0)then\n do j=1,Nlen\n if(ji)calc=calc+9\n end do\n end if\n ans=max(ans,calc)\n end do\n\n print'(i0)',ans\nend program A819B", "problem_context": "Score : 300 points\n\nProblem Statement\n\nFind the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nConstraints\n\n1\\leq N \\leq 10^{16}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nSample Input 1\n\n100\n\nSample Output 1\n\n18\n\nFor example, the sum of the digits in 99 is 18, which turns out to be the maximum value.\n\nSample Input 2\n\n9995\n\nSample Output 2\n\n35\n\nFor example, the sum of the digits in 9989 is 35, which turns out to be the maximum value.\n\nSample Input 3\n\n3141592653589793\n\nSample Output 3\n\n137", "sample_input": "100\n"}, "reference_outputs": ["18\n"], "source_document_id": "p03427", "source_text": "Score : 300 points\n\nProblem Statement\n\nFind the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nConstraints\n\n1\\leq N \\leq 10^{16}\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.\n\nSample Input 1\n\n100\n\nSample Output 1\n\n18\n\nFor example, the sum of the digits in 99 is 18, which turns out to be the maximum value.\n\nSample Input 2\n\n9995\n\nSample Output 2\n\n35\n\nFor example, the sum of the digits in 9989 is 35, which turns out to be the maximum value.\n\nSample Input 3\n\n3141592653589793\n\nSample Output 3\n\n137", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 576, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s189736266", "group_id": "codeNet:p03433", "input_text": "program main\n implicit none\n integer :: n, a\n read *, n\n read *, a\n if (a >= 499) then\n print \"(a)\", \"Yes\"\n else if (modulo(n, 500) <= a) then\n print \"(a)\", \"Yes\"\n else\n print \"(a)\", \"No\"\n end if\nend program main\n", "language": "Fortran", "metadata": {"date": 1587674310, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03433.html", "problem_id": "p03433", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03433/input.txt", "sample_output_relpath": "derived/input_output/data/p03433/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03433/Fortran/s189736266.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s189736266", "user_id": "u388927326"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n implicit none\n integer :: n, a\n read *, n\n read *, a\n if (a >= 499) then\n print \"(a)\", \"Yes\"\n else if (modulo(n, 500) <= a) then\n print \"(a)\", \"Yes\"\n else\n print \"(a)\", \"No\"\n end if\nend program main\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\nN is an integer between 1 and 10000 (inclusive).\n\nA is an integer between 0 and 1000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutput\n\nIf E869120 can pay exactly N yen using only his 1-yen and 500-yen coins, print Yes; otherwise, print No.\n\nSample Input 1\n\n2018\n218\n\nSample Output 1\n\nYes\n\nWe can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.\n\nSample Input 2\n\n2763\n0\n\nSample Output 2\n\nNo\n\nWhen we have no 1-yen coins, we can only pay a multiple of 500 yen using only 500-yen coins. Since 2763 is not a multiple of 500, we cannot pay this amount.\n\nSample Input 3\n\n37\n514\n\nSample Output 3\n\nYes", "sample_input": "2018\n218\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03433", "source_text": "Score: 100 points\n\nProblem Statement\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\nN is an integer between 1 and 10000 (inclusive).\n\nA is an integer between 0 and 1000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutput\n\nIf E869120 can pay exactly N yen using only his 1-yen and 500-yen coins, print Yes; otherwise, print No.\n\nSample Input 1\n\n2018\n218\n\nSample Output 1\n\nYes\n\nWe can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.\n\nSample Input 2\n\n2763\n0\n\nSample Output 2\n\nNo\n\nWhen we have no 1-yen coins, we can only pay a multiple of 500 yen using only 500-yen coins. Since 2763 is not a multiple of 500, we cannot pay this amount.\n\nSample Input 3\n\n37\n514\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 230, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s642973971", "group_id": "codeNet:p03433", "input_text": "integer :: n,a\nread*,n\nread*,a\n\nif( mod(n,500)<=a )then\n print*,'Yes'\nelse\n print*,'No'\nend if\nend", "language": "Fortran", "metadata": {"date": 1579329077, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03433.html", "problem_id": "p03433", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03433/input.txt", "sample_output_relpath": "derived/input_output/data/p03433/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03433/Fortran/s642973971.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s642973971", "user_id": "u171356453"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "integer :: n,a\nread*,n\nread*,a\n\nif( mod(n,500)<=a )then\n print*,'Yes'\nelse\n print*,'No'\nend if\nend", "problem_context": "Score: 100 points\n\nProblem Statement\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\nN is an integer between 1 and 10000 (inclusive).\n\nA is an integer between 0 and 1000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutput\n\nIf E869120 can pay exactly N yen using only his 1-yen and 500-yen coins, print Yes; otherwise, print No.\n\nSample Input 1\n\n2018\n218\n\nSample Output 1\n\nYes\n\nWe can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.\n\nSample Input 2\n\n2763\n0\n\nSample Output 2\n\nNo\n\nWhen we have no 1-yen coins, we can only pay a multiple of 500 yen using only 500-yen coins. Since 2763 is not a multiple of 500, we cannot pay this amount.\n\nSample Input 3\n\n37\n514\n\nSample Output 3\n\nYes", "sample_input": "2018\n218\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03433", "source_text": "Score: 100 points\n\nProblem Statement\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\nN is an integer between 1 and 10000 (inclusive).\n\nA is an integer between 0 and 1000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutput\n\nIf E869120 can pay exactly N yen using only his 1-yen and 500-yen coins, print Yes; otherwise, print No.\n\nSample Input 1\n\n2018\n218\n\nSample Output 1\n\nYes\n\nWe can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.\n\nSample Input 2\n\n2763\n0\n\nSample Output 2\n\nNo\n\nWhen we have no 1-yen coins, we can only pay a multiple of 500 yen using only 500-yen coins. Since 2763 is not a multiple of 500, we cannot pay this amount.\n\nSample Input 3\n\n37\n514\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 100, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s283925082", "group_id": "codeNet:p03433", "input_text": "integer a,b\nread*,a,b\nif(mod(a,500)<=b)then\n\tprint\"(A)\",\"Yes\"\nelse\n\tprint\"(A)\",\"No\"\nendif\nend", "language": "Fortran", "metadata": {"date": 1551429759, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03433.html", "problem_id": "p03433", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03433/input.txt", "sample_output_relpath": "derived/input_output/data/p03433/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03433/Fortran/s283925082.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s283925082", "user_id": "u598073939"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "integer a,b\nread*,a,b\nif(mod(a,500)<=b)then\n\tprint\"(A)\",\"Yes\"\nelse\n\tprint\"(A)\",\"No\"\nendif\nend", "problem_context": "Score: 100 points\n\nProblem Statement\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\nN is an integer between 1 and 10000 (inclusive).\n\nA is an integer between 0 and 1000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutput\n\nIf E869120 can pay exactly N yen using only his 1-yen and 500-yen coins, print Yes; otherwise, print No.\n\nSample Input 1\n\n2018\n218\n\nSample Output 1\n\nYes\n\nWe can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.\n\nSample Input 2\n\n2763\n0\n\nSample Output 2\n\nNo\n\nWhen we have no 1-yen coins, we can only pay a multiple of 500 yen using only 500-yen coins. Since 2763 is not a multiple of 500, we cannot pay this amount.\n\nSample Input 3\n\n37\n514\n\nSample Output 3\n\nYes", "sample_input": "2018\n218\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03433", "source_text": "Score: 100 points\n\nProblem Statement\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\nN is an integer between 1 and 10000 (inclusive).\n\nA is an integer between 0 and 1000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutput\n\nIf E869120 can pay exactly N yen using only his 1-yen and 500-yen coins, print Yes; otherwise, print No.\n\nSample Input 1\n\n2018\n218\n\nSample Output 1\n\nYes\n\nWe can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.\n\nSample Input 2\n\n2763\n0\n\nSample Output 2\n\nNo\n\nWhen we have no 1-yen coins, we can only pay a multiple of 500 yen using only 500-yen coins. Since 2763 is not a multiple of 500, we cannot pay this amount.\n\nSample Input 3\n\n37\n514\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 93, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s130625405", "group_id": "codeNet:p03433", "input_text": " read(*,*) i,j\n if(mod(i,500).le.j) then\n write(*,*) \"Yes\"\n else\n write(*,*) \"No\"\n end if\n end", "language": "Fortran", "metadata": {"date": 1519185372, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03433.html", "problem_id": "p03433", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03433/input.txt", "sample_output_relpath": "derived/input_output/data/p03433/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03433/Fortran/s130625405.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s130625405", "user_id": "u857484987"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": " read(*,*) i,j\n if(mod(i,500).le.j) then\n write(*,*) \"Yes\"\n else\n write(*,*) \"No\"\n end if\n end", "problem_context": "Score: 100 points\n\nProblem Statement\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\nN is an integer between 1 and 10000 (inclusive).\n\nA is an integer between 0 and 1000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutput\n\nIf E869120 can pay exactly N yen using only his 1-yen and 500-yen coins, print Yes; otherwise, print No.\n\nSample Input 1\n\n2018\n218\n\nSample Output 1\n\nYes\n\nWe can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.\n\nSample Input 2\n\n2763\n0\n\nSample Output 2\n\nNo\n\nWhen we have no 1-yen coins, we can only pay a multiple of 500 yen using only 500-yen coins. Since 2763 is not a multiple of 500, we cannot pay this amount.\n\nSample Input 3\n\n37\n514\n\nSample Output 3\n\nYes", "sample_input": "2018\n218\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03433", "source_text": "Score: 100 points\n\nProblem Statement\n\nE869120 has A 1-yen coins and infinitely many 500-yen coins.\n\nDetermine if he can pay exactly N yen using only these coins.\n\nConstraints\n\nN is an integer between 1 and 10000 (inclusive).\n\nA is an integer between 0 and 1000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutput\n\nIf E869120 can pay exactly N yen using only his 1-yen and 500-yen coins, print Yes; otherwise, print No.\n\nSample Input 1\n\n2018\n218\n\nSample Output 1\n\nYes\n\nWe can pay 2018 yen with four 500-yen coins and 18 1-yen coins, so the answer is Yes.\n\nSample Input 2\n\n2763\n0\n\nSample Output 2\n\nNo\n\nWhen we have no 1-yen coins, we can only pay a multiple of 500 yen using only 500-yen coins. Since 2763 is not a multiple of 500, we cannot pay this amount.\n\nSample Input 3\n\n37\n514\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 133, "cpu_time_ms": 9, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s804414040", "group_id": "codeNet:p03434", "input_text": "program B086\n implicit none\n integer(8) :: N\n integer(8), allocatable, dimension(:) :: a\n integer(8) :: i, j, max, Alice, Bob\n\n read(5,*) N\n allocate(a(N))\n read(5,*) (a(i), i = 1, N)\n Alice = 0\n Bob = 0\n\n\n do i = 1, N\n if (mod(i,2) /= 0) then\n max = maxval(a)\n Alice = Alice + max \n\n else\n max = maxval(a)\n Bob = Bob + max\n\n end if\n\n j = 1\n do while (a(j) /= max)\n j = j + 1\n end do\n\n a(j) = 0\n\n end do\n\n write(6,*) Alice - Bob\n\n\nend program B086\n", "language": "Fortran", "metadata": {"date": 1598160135, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03434.html", "problem_id": "p03434", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03434/input.txt", "sample_output_relpath": "derived/input_output/data/p03434/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03434/Fortran/s804414040.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s804414040", "user_id": "u952194205"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program B086\n implicit none\n integer(8) :: N\n integer(8), allocatable, dimension(:) :: a\n integer(8) :: i, j, max, Alice, Bob\n\n read(5,*) N\n allocate(a(N))\n read(5,*) (a(i), i = 1, N)\n Alice = 0\n Bob = 0\n\n\n do i = 1, N\n if (mod(i,2) /= 0) then\n max = maxval(a)\n Alice = Alice + max \n\n else\n max = maxval(a)\n Bob = Bob + max\n\n end if\n\n j = 1\n do while (a(j) /= max)\n j = j + 1\n end do\n\n a(j) = 0\n\n end do\n\n write(6,*) Alice - Bob\n\n\nend program B086\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "sample_input": "2\n3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03434", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 588, "cpu_time_ms": 11, "memory_kb": 2820}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s227421155", "group_id": "codeNet:p03434", "input_text": "program tenquestionsix\nimplicit none\ninteger N, i, suma, sumb, sumab\ninteger,allocatable,dimension(:) :: A\nsuma=0\nsumb=0\nsumab=0\nread(*,*) N\nallocate(A(N))\nread(*,*) A\ncall heapsort(N,A)\n do i=N,1,-2\n suma=suma+A(i)\n end do\n do i=N-1,1,-2\n sumb=sumb+A(i)\n end do\nsumab=suma-sumb\nwrite(*,*) sumab\nend program\n\nsubroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n \n integer,intent(inout) :: array(1:n) \n integer ::i,k,j,l\n double precision :: t\n \n if(n.le.0)then \n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return \n\n l=n/2+1 \n k=n\n do while(k.ne.1) \n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1 \n endif\n if (t.lt.array(j))then \n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo \n array(i)=t\n enddo \n\n return\nend subroutine heapsort", "language": "Fortran", "metadata": {"date": 1558896298, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03434.html", "problem_id": "p03434", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03434/input.txt", "sample_output_relpath": "derived/input_output/data/p03434/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03434/Fortran/s227421155.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s227421155", "user_id": "u039189422"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program tenquestionsix\nimplicit none\ninteger N, i, suma, sumb, sumab\ninteger,allocatable,dimension(:) :: A\nsuma=0\nsumb=0\nsumab=0\nread(*,*) N\nallocate(A(N))\nread(*,*) A\ncall heapsort(N,A)\n do i=N,1,-2\n suma=suma+A(i)\n end do\n do i=N-1,1,-2\n sumb=sumb+A(i)\n end do\nsumab=suma-sumb\nwrite(*,*) sumab\nend program\n\nsubroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n \n integer,intent(inout) :: array(1:n) \n integer ::i,k,j,l\n double precision :: t\n \n if(n.le.0)then \n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return \n\n l=n/2+1 \n k=n\n do while(k.ne.1) \n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1 \n endif\n if (t.lt.array(j))then \n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo \n array(i)=t\n enddo \n\n return\nend subroutine heapsort", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "sample_input": "2\n3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03434", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1333, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s272247575", "group_id": "codeNet:p03434", "input_text": "implicit none\nINTEGER(8) :: n,i,ans,k\nREAL(8),ALLOCATABLE,DIMENSION(:) :: a\n\nans = 0\nk = 0\n\nREAD(5,*) n\nALLOCATE(a(n))\nREAD(5,*) (a(i),i=1,n)\n\ncall heapsort(n,a)\n\ndo i=n,1,-1\n if(MOD(n-i,2)==0)then\n ans = ans+a(i)\n else\n ans = ans-a(i)\n endif\nenddo\n\nWRITE(6,\"(i0)\") ans\n\nend\n\n!---http://slpr.sakura.ne.jp/qp/sortf90/---\nsubroutine heapsort(n,array)\n implicit none\n INTEGER(8),INTENT(IN) :: n\n DOUBLE PRECISION,INTENT(INOUT) :: array(1:n)\n\n INTEGER :: i,k,j,l\n DOUBLE PRECISION :: t\n\n if(n.le.0)then\n WRITE(6,*)\"Error, at heapsort\"; stop\n endif\n\n if(n.eq.1)return\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l = l-1\n t = array(l)\n else\n t=array(k)\n array(k) = array(l)\n k = k-1\n if(k.eq.1)then\n array(1) = t\n exit\n endif\n endif\n i = l\n j = l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if(t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n RETURN\nend subroutine\n", "language": "Fortran", "metadata": {"date": 1548877633, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03434.html", "problem_id": "p03434", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03434/input.txt", "sample_output_relpath": "derived/input_output/data/p03434/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03434/Fortran/s272247575.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s272247575", "user_id": "u762420987"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "implicit none\nINTEGER(8) :: n,i,ans,k\nREAL(8),ALLOCATABLE,DIMENSION(:) :: a\n\nans = 0\nk = 0\n\nREAD(5,*) n\nALLOCATE(a(n))\nREAD(5,*) (a(i),i=1,n)\n\ncall heapsort(n,a)\n\ndo i=n,1,-1\n if(MOD(n-i,2)==0)then\n ans = ans+a(i)\n else\n ans = ans-a(i)\n endif\nenddo\n\nWRITE(6,\"(i0)\") ans\n\nend\n\n!---http://slpr.sakura.ne.jp/qp/sortf90/---\nsubroutine heapsort(n,array)\n implicit none\n INTEGER(8),INTENT(IN) :: n\n DOUBLE PRECISION,INTENT(INOUT) :: array(1:n)\n\n INTEGER :: i,k,j,l\n DOUBLE PRECISION :: t\n\n if(n.le.0)then\n WRITE(6,*)\"Error, at heapsort\"; stop\n endif\n\n if(n.eq.1)return\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l = l-1\n t = array(l)\n else\n t=array(k)\n array(k) = array(l)\n k = k-1\n if(k.eq.1)then\n array(1) = t\n exit\n endif\n endif\n i = l\n j = l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if(t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n RETURN\nend subroutine\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "sample_input": "2\n3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03434", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1427, "cpu_time_ms": 4, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s096588730", "group_id": "codeNet:p03434", "input_text": "subroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n integer :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n \n return\n end subroutine heapsort\n\nprogram main\n integer N, diff\n integer, allocatable :: a(:)\n\n read(*,*) N\n allocate(a(N))\n read(*,*) a(:)\n\n call heapsort(N,a)\n\n diff=0\n do i=1,N\n if(i/2/=0)then\n diff = diff + a(i)\n else\n diff = diff - a(i)\n endif\n enddo\n\n write(*,*) diff\n \nend program", "language": "Fortran", "metadata": {"date": 1519006575, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03434.html", "problem_id": "p03434", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03434/input.txt", "sample_output_relpath": "derived/input_output/data/p03434/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03434/Fortran/s096588730.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s096588730", "user_id": "u872669364"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "subroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n integer :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n \n return\n end subroutine heapsort\n\nprogram main\n integer N, diff\n integer, allocatable :: a(:)\n\n read(*,*) N\n allocate(a(N))\n read(*,*) a(:)\n\n call heapsort(N,a)\n\n diff=0\n do i=1,N\n if(i/2/=0)then\n diff = diff + a(i)\n else\n diff = diff - a(i)\n endif\n enddo\n\n write(*,*) diff\n \nend program", "problem_context": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "sample_input": "2\n3 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03434", "source_text": "Score: 200 points\n\nProblem Statement\n\nWe have N cards. A number a_i is written on the i-th card.\n\nAlice and Bob will play a game using these cards. In this game, Alice and Bob alternately take one card. Alice goes first.\n\nThe game ends when all the cards are taken by the two players, and the score of each player is the sum of the numbers written on the cards he/she has taken. When both players take the optimal strategy to maximize their scores, find Alice's score minus Bob's score.\n\nConstraints\n\nN is an integer between 1 and 100 (inclusive).\n\na_i \\ (1 \\leq i \\leq N) is an integer between 1 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 a_3 ... a_N\n\nOutput\n\nPrint Alice's score minus Bob's score when both players take the optimal strategy to maximize their scores.\n\nSample Input 1\n\n2\n3 1\n\nSample Output 1\n\n2\n\nFirst, Alice will take the card with 3. Then, Bob will take the card with 1.\nThe difference of their scores will be 3 - 1 = 2.\n\nSample Input 2\n\n3\n2 7 4\n\nSample Output 2\n\n5\n\nFirst, Alice will take the card with 7. Then, Bob will take the card with 4. Lastly, Alice will take the card with 2. The difference of their scores will be 7 - 4 + 2 = 5. The difference of their scores will be 3 - 1 = 2.\n\nSample Input 3\n\n4\n20 18 2 18\n\nSample Output 3\n\n18", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1230, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s726785648", "group_id": "codeNet:p03435", "input_text": "program probC\n implicit none\n integer :: c(3,3),a(3),b(3)\n integer i,j,k,ans\n\n do i=1,3\n read(*,*) c(i,1:3)\n end do\n\n do i=0,100\n ans=0\n a(1)=i\n\n b(1)=c(1,1)-a(1)\n b(2)=c(1,2)-a(1)\n b(3)=c(1,3)-a(1)\n \n a(2)=c(2,1)-b(1)\n a(3)=c(3,1)-b(1)\n\n do j=1,3\n do k=1,3\n if(c(j,k).ne.a(j)+b(k)) ans=1\n end do\n end do\n\n if(ans==0) then\n write(*,*) 'Yes'\n stop\n end if\n end do\n\n write(*,*) 'No'\n \nend program probC\n", "language": "Fortran", "metadata": {"date": 1519008332, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03435.html", "problem_id": "p03435", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03435/input.txt", "sample_output_relpath": "derived/input_output/data/p03435/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03435/Fortran/s726785648.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s726785648", "user_id": "u177040005"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program probC\n implicit none\n integer :: c(3,3),a(3),b(3)\n integer i,j,k,ans\n\n do i=1,3\n read(*,*) c(i,1:3)\n end do\n\n do i=0,100\n ans=0\n a(1)=i\n\n b(1)=c(1,1)-a(1)\n b(2)=c(1,2)-a(1)\n b(3)=c(1,3)-a(1)\n \n a(2)=c(2,1)-b(1)\n a(3)=c(3,1)-b(1)\n\n do j=1,3\n do k=1,3\n if(c(j,k).ne.a(j)+b(k)) ans=1\n end do\n end do\n\n if(ans==0) then\n write(*,*) 'Yes'\n stop\n end if\n end do\n\n write(*,*) 'No'\n \nend program probC\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nWe have a 3 \\times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.\n\nAccording to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.\n\nDetermine if he is correct.\n\nConstraints\n\nc_{i, j} \\ (1 \\leq i \\leq 3, 1 \\leq j \\leq 3) is an integer between 0 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{1,1} c_{1,2} c_{1,3}\nc_{2,1} c_{2,2} c_{2,3}\nc_{3,1} c_{3,2} c_{3,3}\n\nOutput\n\nIf Takahashi's statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 0 1\n2 1 2\n1 0 1\n\nSample Output 1\n\nYes\n\nTakahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.\n\nSample Input 2\n\n2 2 2\n2 1 2\n2 2 2\n\nSample Output 2\n\nNo\n\nTakahashi is incorrect in this case.\n\nSample Input 3\n\n0 8 8\n0 8 8\n0 8 8\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1 8 6\n2 9 7\n0 7 7\n\nSample Output 4\n\nNo", "sample_input": "1 0 1\n2 1 2\n1 0 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03435", "source_text": "Score: 300 points\n\nProblem Statement\n\nWe have a 3 \\times 3 grid. A number c_{i, j} is written in the square (i, j), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.\n\nAccording to Takahashi, there are six integers a_1, a_2, a_3, b_1, b_2, b_3 whose values are fixed, and the number written in the square (i, j) is equal to a_i + b_j.\n\nDetermine if he is correct.\n\nConstraints\n\nc_{i, j} \\ (1 \\leq i \\leq 3, 1 \\leq j \\leq 3) is an integer between 0 and 100 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nc_{1,1} c_{1,2} c_{1,3}\nc_{2,1} c_{2,2} c_{2,3}\nc_{3,1} c_{3,2} c_{3,3}\n\nOutput\n\nIf Takahashi's statement is correct, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 0 1\n2 1 2\n1 0 1\n\nSample Output 1\n\nYes\n\nTakahashi is correct, since there are possible sets of integers such as: a_1=0,a_2=1,a_3=0,b_1=1,b_2=0,b_3=1.\n\nSample Input 2\n\n2 2 2\n2 1 2\n2 2 2\n\nSample Output 2\n\nNo\n\nTakahashi is incorrect in this case.\n\nSample Input 3\n\n0 8 8\n0 8 8\n0 8 8\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n1 8 6\n2 9 7\n0 7 7\n\nSample Output 4\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 500, "cpu_time_ms": 4, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s522427522", "group_id": "codeNet:p03436", "input_text": "module queue\n implicit none\n type :: JagArray\n integer,allocatable :: array(:)\n end type JagArray\ncontains\n subroutine push(A,b)\n \tinteger,allocatable,dimension(:)::A\n integer::b\n A=[A,b]\n end subroutine\n subroutine pop(A)\n \tinteger,allocatable,dimension(:)::A\n A=A(2:)\n end subroutine\nend module queue\n\nmodule maze\ninteger,allocatable,dimension(:,:)::mazemap\ncontains\nsubroutine getmap(mazemap,R,C)\n integer,allocatable,dimension(:,:)::mazemap\n integer R,C\n character(50) linereader\n allocate(mazemap(0:R+1,0:C+1))\n mazemap(0,:)=-2;mazemap(R+1,:)=-2;mazemap(:,0)=-2;mazemap(:,C+1)=-2;\n do i=1,R\n read*,linereader\n do j=1,C\n if(linereader(j:j)==\".\")mazemap(i,j)=-1\n if(linereader(j:j)==\"#\")mazemap(i,j)=-2\n end do\n end do\nend subroutine\nend module maze\n\nuse queue\nuse maze\ninteger,allocatable,dimension(:)::queue_x,queue_y\ninteger H,W\ninteger numcnt\ninteger dirx(4),diry(4)\ndirx=[1,0,-1,0]\ndiry=[0,1,0,-1]\nread*,H,W\ncall getmap(mazemap,H,W)\n\nmazemap(1,1)=1\nqueue_x=[1]\nqueue_y=[1]\ndo while(mazemap(H,W)==-1)\n do i=1,4\n if(mazemap(queue_x(1)+dirx(i),queue_y(1)+diry(i))==-1)then\n mazemap(queue_x(1)+dirx(i),queue_y(1)+diry(i))=mazemap(queue_x(1),queue_y(1))+1\n call push(queue_x,queue_x(1)+dirx(i))\n call push(queue_y,queue_y(1)+diry(i))\n endif\n end do\n call pop(queue_x)\n call pop(queue_y)\n if(size(queue_x)==0)exit\nend do\n\nnumcnt=0\ndo i=1,H\n do j=1,W\n if(mazemap(i,j)==-2)numcnt=numcnt+1\n end do\nend do\nprint\"(i0)\",merge(-1,H*W-mazemap(H,W)-numcnt,mazemap(i,j)==-1)\nend", "language": "Fortran", "metadata": {"date": 1562892914, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03436.html", "problem_id": "p03436", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03436/input.txt", "sample_output_relpath": "derived/input_output/data/p03436/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03436/Fortran/s522427522.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s522427522", "user_id": "u598073939"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "module queue\n implicit none\n type :: JagArray\n integer,allocatable :: array(:)\n end type JagArray\ncontains\n subroutine push(A,b)\n \tinteger,allocatable,dimension(:)::A\n integer::b\n A=[A,b]\n end subroutine\n subroutine pop(A)\n \tinteger,allocatable,dimension(:)::A\n A=A(2:)\n end subroutine\nend module queue\n\nmodule maze\ninteger,allocatable,dimension(:,:)::mazemap\ncontains\nsubroutine getmap(mazemap,R,C)\n integer,allocatable,dimension(:,:)::mazemap\n integer R,C\n character(50) linereader\n allocate(mazemap(0:R+1,0:C+1))\n mazemap(0,:)=-2;mazemap(R+1,:)=-2;mazemap(:,0)=-2;mazemap(:,C+1)=-2;\n do i=1,R\n read*,linereader\n do j=1,C\n if(linereader(j:j)==\".\")mazemap(i,j)=-1\n if(linereader(j:j)==\"#\")mazemap(i,j)=-2\n end do\n end do\nend subroutine\nend module maze\n\nuse queue\nuse maze\ninteger,allocatable,dimension(:)::queue_x,queue_y\ninteger H,W\ninteger numcnt\ninteger dirx(4),diry(4)\ndirx=[1,0,-1,0]\ndiry=[0,1,0,-1]\nread*,H,W\ncall getmap(mazemap,H,W)\n\nmazemap(1,1)=1\nqueue_x=[1]\nqueue_y=[1]\ndo while(mazemap(H,W)==-1)\n do i=1,4\n if(mazemap(queue_x(1)+dirx(i),queue_y(1)+diry(i))==-1)then\n mazemap(queue_x(1)+dirx(i),queue_y(1)+diry(i))=mazemap(queue_x(1),queue_y(1))+1\n call push(queue_x,queue_x(1)+dirx(i))\n call push(queue_y,queue_y(1)+diry(i))\n endif\n end do\n call pop(queue_x)\n call pop(queue_y)\n if(size(queue_x)==0)exit\nend do\n\nnumcnt=0\ndo i=1,H\n do j=1,W\n if(mazemap(i,j)==-2)numcnt=numcnt+1\n end do\nend do\nprint\"(i0)\",merge(-1,H*W-mazemap(H,W)-numcnt,mazemap(i,j)==-1)\nend", "problem_context": "Score: 400 points\n\nProblem statement\n\nWe have an H \\times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j).\n\nSnuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square (1, 1). The player repeatedly moves Kenus up, down, left or right by one square. The game is completed when Kenus reaches square (H, W) passing only white squares.\n\nBefore Snuke starts the game, he can change the color of some of the white squares to black. However, he cannot change the color of square (1, 1) and (H, W). Also, changes of color must all be carried out before the beginning of the game.\n\nWhen the game is completed, Snuke's score will be the number of times he changed the color of a square before the beginning of the game. Find the maximum possible score that Snuke can achieve, or print -1 if the game cannot be completed, that is, Kenus can never reach square (H, W) regardless of how Snuke changes the color of the squares.\n\nThe color of the squares are given to you as characters s_{i, j}. If square (i, j) is initially painted by white, s_{i, j} is .; if square (i, j) is initially painted by black, s_{i, j} is #.\n\nConstraints\n\nH is an integer between 2 and 50 (inclusive).\n\nW is an integer between 2 and 50 (inclusive).\n\ns_{i, j} is . or # (1 \\leq i \\leq H, 1 \\leq j \\leq W).\n\ns_{1, 1} and s_{H, W} are ..\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{1, 1}s_{1, 2}s_{1, 3} ... s_{1, W}\ns_{2, 1}s_{2, 2}s_{2, 3} ... s_{2, W}\n: :\ns_{H, 1}s_{H, 2}s_{H, 3} ... s_{H, W}\n\nOutput\n\nPrint the maximum possible score that Snuke can achieve, or print -1 if the game cannot be completed.\n\nSample Input 1\n\n3 3\n..#\n#..\n...\n\nSample Output 1\n\n2\n\nThe score 2 can be achieved by changing the color of squares as follows:\n\nSample Input 2\n\n10 37\n.....................................\n...#...####...####..###...###...###..\n..#.#..#...#.##....#...#.#...#.#...#.\n..#.#..#...#.#.....#...#.#...#.#...#.\n.#...#.#..##.#.....#...#.#.###.#.###.\n.#####.####..#.....#...#..##....##...\n.#...#.#...#.#.....#...#.#...#.#...#.\n.#...#.#...#.##....#...#.#...#.#...#.\n.#...#.####...####..###...###...###..\n.....................................\n\nSample Output 2\n\n209", "sample_input": "3 3\n..#\n#..\n...\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03436", "source_text": "Score: 400 points\n\nProblem statement\n\nWe have an H \\times W grid whose squares are painted black or white. The square at the i-th row from the top and the j-th column from the left is denoted as (i, j).\n\nSnuke would like to play the following game on this grid. At the beginning of the game, there is a character called Kenus at square (1, 1). The player repeatedly moves Kenus up, down, left or right by one square. The game is completed when Kenus reaches square (H, W) passing only white squares.\n\nBefore Snuke starts the game, he can change the color of some of the white squares to black. However, he cannot change the color of square (1, 1) and (H, W). Also, changes of color must all be carried out before the beginning of the game.\n\nWhen the game is completed, Snuke's score will be the number of times he changed the color of a square before the beginning of the game. Find the maximum possible score that Snuke can achieve, or print -1 if the game cannot be completed, that is, Kenus can never reach square (H, W) regardless of how Snuke changes the color of the squares.\n\nThe color of the squares are given to you as characters s_{i, j}. If square (i, j) is initially painted by white, s_{i, j} is .; if square (i, j) is initially painted by black, s_{i, j} is #.\n\nConstraints\n\nH is an integer between 2 and 50 (inclusive).\n\nW is an integer between 2 and 50 (inclusive).\n\ns_{i, j} is . or # (1 \\leq i \\leq H, 1 \\leq j \\leq W).\n\ns_{1, 1} and s_{H, W} are ..\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\ns_{1, 1}s_{1, 2}s_{1, 3} ... s_{1, W}\ns_{2, 1}s_{2, 2}s_{2, 3} ... s_{2, W}\n: :\ns_{H, 1}s_{H, 2}s_{H, 3} ... s_{H, W}\n\nOutput\n\nPrint the maximum possible score that Snuke can achieve, or print -1 if the game cannot be completed.\n\nSample Input 1\n\n3 3\n..#\n#..\n...\n\nSample Output 1\n\n2\n\nThe score 2 can be achieved by changing the color of squares as follows:\n\nSample Input 2\n\n10 37\n.....................................\n...#...####...####..###...###...###..\n..#.#..#...#.##....#...#.#...#.#...#.\n..#.#..#...#.#.....#...#.#...#.#...#.\n.#...#.#..##.#.....#...#.#.###.#.###.\n.#####.####..#.....#...#..##....##...\n.#...#.#...#.#.....#...#.#...#.#...#.\n.#...#.#...#.##....#...#.#...#.#...#.\n.#...#.####...####..###...###...###..\n.....................................\n\nSample Output 2\n\n209", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1548, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s117092317", "group_id": "codeNet:p03437", "input_text": "integer X,Y\nread*,x,y\nif(mod(x,y)==0)then\n print\"(i0)\",-1\nelse\n print\"(i0)\",x\nendif\nend", "language": "Fortran", "metadata": {"date": 1557203752, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03437.html", "problem_id": "p03437", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03437/input.txt", "sample_output_relpath": "derived/input_output/data/p03437/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03437/Fortran/s117092317.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s117092317", "user_id": "u598073939"}, "prompt_components": {"gold_output": "16\n", "input_to_evaluate": "integer X,Y\nread*,x,y\nif(mod(x,y)==0)then\n print\"(i0)\",-1\nelse\n print\"(i0)\",x\nendif\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers X and Y.\nIf there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it.\nIf it does not exist, print -1.\n\nConstraints\n\n1 ≤ X,Y ≤ 10^9\n\nX and Y are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\n16\n\nFor example, 16 is a multiple of 8 but not a multiple of 6.\n\nSample Input 2\n\n3 3\n\nSample Output 2\n\n-1\n\nA multiple of 3 is a multiple of 3.", "sample_input": "8 6\n"}, "reference_outputs": ["16\n"], "source_document_id": "p03437", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers X and Y.\nIf there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it.\nIf it does not exist, print -1.\n\nConstraints\n\n1 ≤ X,Y ≤ 10^9\n\nX and Y are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\n16\n\nFor example, 16 is a multiple of 8 but not a multiple of 6.\n\nSample Input 2\n\n3 3\n\nSample Output 2\n\n-1\n\nA multiple of 3 is a multiple of 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 89, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s480620065", "group_id": "codeNet:p03437", "input_text": "program main\n implicit none\n integer X, Y, i\n integer(8) N\n\n read(*,*) X, Y\n\n do i = 1, 1000000000\n N = X*i\n if(mod(N,Y)/=0)then\n write(*,*) N\n stop\n endif\n enddo\n\n write(*,*) -1\n\n\nend program", "language": "Fortran", "metadata": {"date": 1517718367, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03437.html", "problem_id": "p03437", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03437/input.txt", "sample_output_relpath": "derived/input_output/data/p03437/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03437/Fortran/s480620065.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s480620065", "user_id": "u872669364"}, "prompt_components": {"gold_output": "16\n", "input_to_evaluate": "program main\n implicit none\n integer X, Y, i\n integer(8) N\n\n read(*,*) X, Y\n\n do i = 1, 1000000000\n N = X*i\n if(mod(N,Y)/=0)then\n write(*,*) N\n stop\n endif\n enddo\n\n write(*,*) -1\n\n\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers X and Y.\nIf there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it.\nIf it does not exist, print -1.\n\nConstraints\n\n1 ≤ X,Y ≤ 10^9\n\nX and Y are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\n16\n\nFor example, 16 is a multiple of 8 but not a multiple of 6.\n\nSample Input 2\n\n3 3\n\nSample Output 2\n\n-1\n\nA multiple of 3 is a multiple of 3.", "sample_input": "8 6\n"}, "reference_outputs": ["16\n"], "source_document_id": "p03437", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers X and Y.\nIf there exists a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, choose one such integer and print it.\nIf it does not exist, print -1.\n\nConstraints\n\n1 ≤ X,Y ≤ 10^9\n\nX and Y are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint a positive integer not greater than 10^{18} that is a multiple of X but not a multiple of Y, or print -1 if it does not exist.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\n16\n\nFor example, 16 is a multiple of 8 but not a multiple of 6.\n\nSample Input 2\n\n3 3\n\nSample Output 2\n\n-1\n\nA multiple of 3 is a multiple of 3.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 256, "cpu_time_ms": 2103, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s303608896", "group_id": "codeNet:p03447", "input_text": "integer a,b,c\nread*,a,b,c\nprint\"(i0)\",mod(a-b,c)\nend", "language": "Fortran", "metadata": {"date": 1551429595, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03447.html", "problem_id": "p03447", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03447/input.txt", "sample_output_relpath": "derived/input_output/data/p03447/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03447/Fortran/s303608896.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s303608896", "user_id": "u598073939"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "integer a,b,c\nread*,a,b,c\nprint\"(i0)\",mod(a-b,c)\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou went shopping to buy cakes and donuts with X yen (the currency of Japan).\n\nFirst, you bought one cake for A yen at a cake shop.\nThen, you bought as many donuts as possible for B yen each, at a donut shop.\n\nHow much do you have left after shopping?\n\nConstraints\n\n1 \\leq A, B \\leq 1 000\n\nA + B \\leq X \\leq 10 000\n\nX, A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\nA\nB\n\nOutput\n\nPrint the amount you have left after shopping.\n\nSample Input 1\n\n1234\n150\n100\n\nSample Output 1\n\n84\n\nYou have 1234 - 150 = 1084 yen left after buying a cake.\nWith this amount, you can buy 10 donuts, after which you have 84 yen left.\n\nSample Input 2\n\n1000\n108\n108\n\nSample Output 2\n\n28\n\nSample Input 3\n\n579\n123\n456\n\nSample Output 3\n\n0\n\nSample Input 4\n\n7477\n549\n593\n\nSample Output 4\n\n405", "sample_input": "1234\n150\n100\n"}, "reference_outputs": ["84\n"], "source_document_id": "p03447", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou went shopping to buy cakes and donuts with X yen (the currency of Japan).\n\nFirst, you bought one cake for A yen at a cake shop.\nThen, you bought as many donuts as possible for B yen each, at a donut shop.\n\nHow much do you have left after shopping?\n\nConstraints\n\n1 \\leq A, B \\leq 1 000\n\nA + B \\leq X \\leq 10 000\n\nX, A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\nA\nB\n\nOutput\n\nPrint the amount you have left after shopping.\n\nSample Input 1\n\n1234\n150\n100\n\nSample Output 1\n\n84\n\nYou have 1234 - 150 = 1084 yen left after buying a cake.\nWith this amount, you can buy 10 donuts, after which you have 84 yen left.\n\nSample Input 2\n\n1000\n108\n108\n\nSample Output 2\n\n28\n\nSample Input 3\n\n579\n123\n456\n\nSample Output 3\n\n0\n\nSample Input 4\n\n7477\n549\n593\n\nSample Output 4\n\n405", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 52, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s322217099", "group_id": "codeNet:p03449", "input_text": "program prob4\n implicit none\n integer :: n, i, m, tmp\n integer, allocatable :: a(:), aa(:)\n read(*,*) n\n allocate(a(n))\n allocate(aa(n))\n read(*,*) a\n read(*,*) aa\n\n tmp = a(1)\n do i = 1, n\n tmp = tmp + aa(i)\n end do\n m = tmp\n\n do i = 2, n\n tmp = tmp + a(i)\n tmp = tmp - aa(i-1)\n m = max(m, tmp)\n end do\n\n write(*,*) m\n deallocate(a)\n deallocate(aa)\n\n stop\ncontains\nend program prob4", "language": "Fortran", "metadata": {"date": 1591406170, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03449.html", "problem_id": "p03449", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03449/input.txt", "sample_output_relpath": "derived/input_output/data/p03449/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03449/Fortran/s322217099.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s322217099", "user_id": "u478462004"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "program prob4\n implicit none\n integer :: n, i, m, tmp\n integer, allocatable :: a(:), aa(:)\n read(*,*) n\n allocate(a(n))\n allocate(aa(n))\n read(*,*) a\n read(*,*) aa\n\n tmp = a(1)\n do i = 1, n\n tmp = tmp + aa(i)\n end do\n m = tmp\n\n do i = 2, n\n tmp = tmp + a(i)\n tmp = tmp - aa(i-1)\n m = max(m, tmp)\n end do\n\n write(*,*) m\n deallocate(a)\n deallocate(aa)\n\n stop\ncontains\nend program prob4", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a 2 \\times N grid. We will denote the square at the i-th row and j-th column (1 \\leq i \\leq 2, 1 \\leq j \\leq N) as (i, j).\n\nYou are initially in the top-left square, (1, 1).\nYou will travel to the bottom-right square, (2, N), by repeatedly moving right or down.\n\nThe square (i, j) contains A_{i, j} candies.\nYou will collect all the candies you visit during the travel.\nThe top-left and bottom-right squares also contain candies, and you will also collect them.\n\nAt most how many candies can you collect when you choose the best way to travel?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_{i, j} \\leq 100 (1 \\leq i \\leq 2, 1 \\leq j \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} ... A_{1, N}\nA_{2, 1} A_{2, 2} ... A_{2, N}\n\nOutput\n\nPrint the maximum number of candies that can be collected.\n\nSample Input 1\n\n5\n3 2 2 4 1\n1 2 2 2 1\n\nSample Output 1\n\n14\n\nThe number of collected candies will be maximized when you:\n\nmove right three times, then move down once, then move right once.\n\nSample Input 2\n\n4\n1 1 1 1\n1 1 1 1\n\nSample Output 2\n\n5\n\nYou will always collect the same number of candies, regardless of how you travel.\n\nSample Input 3\n\n7\n3 3 4 5 4 5 3\n5 3 4 4 2 3 2\n\nSample Output 3\n\n29\n\nSample Input 4\n\n1\n2\n3\n\nSample Output 4\n\n5", "sample_input": "5\n3 2 2 4 1\n1 2 2 2 1\n"}, "reference_outputs": ["14\n"], "source_document_id": "p03449", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a 2 \\times N grid. We will denote the square at the i-th row and j-th column (1 \\leq i \\leq 2, 1 \\leq j \\leq N) as (i, j).\n\nYou are initially in the top-left square, (1, 1).\nYou will travel to the bottom-right square, (2, N), by repeatedly moving right or down.\n\nThe square (i, j) contains A_{i, j} candies.\nYou will collect all the candies you visit during the travel.\nThe top-left and bottom-right squares also contain candies, and you will also collect them.\n\nAt most how many candies can you collect when you choose the best way to travel?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq A_{i, j} \\leq 100 (1 \\leq i \\leq 2, 1 \\leq j \\leq N)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_{1, 1} A_{1, 2} ... A_{1, N}\nA_{2, 1} A_{2, 2} ... A_{2, N}\n\nOutput\n\nPrint the maximum number of candies that can be collected.\n\nSample Input 1\n\n5\n3 2 2 4 1\n1 2 2 2 1\n\nSample Output 1\n\n14\n\nThe number of collected candies will be maximized when you:\n\nmove right three times, then move down once, then move right once.\n\nSample Input 2\n\n4\n1 1 1 1\n1 1 1 1\n\nSample Output 2\n\n5\n\nYou will always collect the same number of candies, regardless of how you travel.\n\nSample Input 3\n\n7\n3 3 4 5 4 5 3\n5 3 4 4 2 3 2\n\nSample Output 3\n\n29\n\nSample Input 4\n\n1\n2\n3\n\nSample Output 4\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 465, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s284353075", "group_id": "codeNet:p03450", "input_text": "module Weighted_UF\n \n integer, allocatable, dimension(:) :: par, rank, diff_weight\n\n contains\n \n subroutine init(N)\n integer :: N\n allocate(par(N), rank(N), diff_weight(N))\n do i = 1, N\n par(i) = i\n rank(i) = 0\n diff_weight(i) = 0\n end do\n end subroutine\n\n recursive function root(x) result (res)\n integer :: x, res\n if (par(x) == x)then \n res = x\n else\n res = root(par(x))\n diff_weight(x) = diff_weight(x) + diff_weight(par(x))\n par(x) = res\n end if\n end function\n\n function weight(x) result (res)\n integer :: x, res, r\n res = diff_weight(x)\n r = root(x)\n end function\n\n function same(x, y) result (res)\n integer :: x, y\n logical :: res\n res = (root(x) == root(y))\n end function\n \n subroutine unite(x, y, w)\n integer :: x, y, w\n w = w + weight(x) - weight(y)\n x = root(x); y = root(y)\n if (x /= y) then\n if(rank(x) < rank(y)) then\n x = xor(x, y); y = xor(y, x); x = xor(x, y) !swap\n w = -w\n end if\n if(rank(x) == rank(y)) then\n rank(x) = rank(x) + 1\n end if\n par(y) = x\n diff_weight(y) = w\n end if\n end subroutine\n\n function diff(x, y) result (res)\n integer :: x, y, res\n res = weight(y) - weight(x)\n end function\n \n subroutine print_UF(N)\n integer :: N\n print\"(a)\", parents\n do i = 1, N\n print*, \"Number :\", i , \" \" , par(i)\n end do\n end subroutine\nend module Weighted_UF\n\nprogram main\n use Weighted_UF\n\n integer N, M, l, r, d\n read*,N, M\n\n call init(N)\n\n do i = 1, M\n read*, l, r, d\n if (same(l, r)) then\n if (diff(l, r) /= d) then\n print*, l, r\n print\"(a)\", \"No\"\n stop\n end if\n else\n call unite(l, r, d)\n end if\n \n end do\n\n print\"(a)\", \"Yes\"\nend", "language": "Fortran", "metadata": {"date": 1561847887, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03450.html", "problem_id": "p03450", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03450/input.txt", "sample_output_relpath": "derived/input_output/data/p03450/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03450/Fortran/s284353075.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s284353075", "user_id": "u394482932"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "module Weighted_UF\n \n integer, allocatable, dimension(:) :: par, rank, diff_weight\n\n contains\n \n subroutine init(N)\n integer :: N\n allocate(par(N), rank(N), diff_weight(N))\n do i = 1, N\n par(i) = i\n rank(i) = 0\n diff_weight(i) = 0\n end do\n end subroutine\n\n recursive function root(x) result (res)\n integer :: x, res\n if (par(x) == x)then \n res = x\n else\n res = root(par(x))\n diff_weight(x) = diff_weight(x) + diff_weight(par(x))\n par(x) = res\n end if\n end function\n\n function weight(x) result (res)\n integer :: x, res, r\n res = diff_weight(x)\n r = root(x)\n end function\n\n function same(x, y) result (res)\n integer :: x, y\n logical :: res\n res = (root(x) == root(y))\n end function\n \n subroutine unite(x, y, w)\n integer :: x, y, w\n w = w + weight(x) - weight(y)\n x = root(x); y = root(y)\n if (x /= y) then\n if(rank(x) < rank(y)) then\n x = xor(x, y); y = xor(y, x); x = xor(x, y) !swap\n w = -w\n end if\n if(rank(x) == rank(y)) then\n rank(x) = rank(x) + 1\n end if\n par(y) = x\n diff_weight(y) = w\n end if\n end subroutine\n\n function diff(x, y) result (res)\n integer :: x, y, res\n res = weight(y) - weight(x)\n end function\n \n subroutine print_UF(N)\n integer :: N\n print\"(a)\", parents\n do i = 1, N\n print*, \"Number :\", i , \" \" , par(i)\n end do\n end subroutine\nend module Weighted_UF\n\nprogram main\n use Weighted_UF\n\n integer N, M, l, r, d\n read*,N, M\n\n call init(N)\n\n do i = 1, M\n read*, l, r, d\n if (same(l, r)) then\n if (diff(l, r) /= d) then\n print*, l, r\n print\"(a)\", \"No\"\n stop\n end if\n else\n call unite(l, r, d)\n end if\n \n end do\n\n print\"(a)\", \"Yes\"\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordinate.\n\nYou will given M pieces of information regarding the positions of these people.\nThe i-th piece of information has the form (L_i, R_i, D_i).\nThis means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.\n\nIt turns out that some of these M pieces of information may be incorrect.\nDetermine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.\n\nConstraints\n\n1 \\leq N \\leq 100 000\n\n0 \\leq M \\leq 200 000\n\n1 \\leq L_i, R_i \\leq N (1 \\leq i \\leq M)\n\n0 \\leq D_i \\leq 10 000 (1 \\leq i \\leq M)\n\nL_i \\neq R_i (1 \\leq i \\leq M)\n\nIf i \\neq j, then (L_i, R_i) \\neq (L_j, R_j) and (L_i, R_i) \\neq (R_j, L_j).\n\nD_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 D_1\nL_2 R_2 D_2\n:\nL_M R_M D_M\n\nOutput\n\nIf there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print Yes; if it does not exist, print No.\n\nSample Input 1\n\n3 3\n1 2 1\n2 3 1\n1 3 2\n\nSample Output 1\n\nYes\n\nSome possible sets of values (x_1, x_2, x_3) are (0, 1, 2) and (101, 102, 103).\n\nSample Input 2\n\n3 3\n1 2 1\n2 3 1\n1 3 5\n\nSample Output 2\n\nNo\n\nIf the first two pieces of information are correct, x_3 - x_1 = 2 holds, which is contradictory to the last piece of information.\n\nSample Input 3\n\n4 3\n2 1 1\n2 3 5\n3 4 2\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n10 3\n8 7 100\n7 9 100\n9 8 100\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n100 0\n\nSample Output 5\n\nYes", "sample_input": "3 3\n1 2 1\n2 3 1\n1 3 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03450", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N people standing on the x-axis.\nLet the coordinate of Person i be x_i.\nFor every i, x_i is an integer between 0 and 10^9 (inclusive).\nIt is possible that more than one person is standing at the same coordinate.\n\nYou will given M pieces of information regarding the positions of these people.\nThe i-th piece of information has the form (L_i, R_i, D_i).\nThis means that Person R_i is to the right of Person L_i by D_i units of distance, that is, x_{R_i} - x_{L_i} = D_i holds.\n\nIt turns out that some of these M pieces of information may be incorrect.\nDetermine if there exists a set of values (x_1, x_2, ..., x_N) that is consistent with the given pieces of information.\n\nConstraints\n\n1 \\leq N \\leq 100 000\n\n0 \\leq M \\leq 200 000\n\n1 \\leq L_i, R_i \\leq N (1 \\leq i \\leq M)\n\n0 \\leq D_i \\leq 10 000 (1 \\leq i \\leq M)\n\nL_i \\neq R_i (1 \\leq i \\leq M)\n\nIf i \\neq j, then (L_i, R_i) \\neq (L_j, R_j) and (L_i, R_i) \\neq (R_j, L_j).\n\nD_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 D_1\nL_2 R_2 D_2\n:\nL_M R_M D_M\n\nOutput\n\nIf there exists a set of values (x_1, x_2, ..., x_N) that is consistent with all given pieces of information, print Yes; if it does not exist, print No.\n\nSample Input 1\n\n3 3\n1 2 1\n2 3 1\n1 3 2\n\nSample Output 1\n\nYes\n\nSome possible sets of values (x_1, x_2, x_3) are (0, 1, 2) and (101, 102, 103).\n\nSample Input 2\n\n3 3\n1 2 1\n2 3 1\n1 3 5\n\nSample Output 2\n\nNo\n\nIf the first two pieces of information are correct, x_3 - x_1 = 2 holds, which is contradictory to the last piece of information.\n\nSample Input 3\n\n4 3\n2 1 1\n2 3 5\n3 4 2\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n10 3\n8 7 100\n7 9 100\n9 8 100\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n100 0\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2117, "cpu_time_ms": 168, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s621135208", "group_id": "codeNet:p03457", "input_text": " PROGRAM traveling\n IMPLICIT NONE\n INTEGER :: N\n INTEGER,ALLOCATABLE :: t(:), x(:),y(:)\n \n INTEGER :: i, dt, dx,dy, s\n LOGICAL :: flag = .TRUE.\n \n READ*,N\n N = N + 1\n ALLOCATE( t(N),x(N),y(N) )\n DO i = 2,N\n READ*,t(i),x(i),y(i)\n END DO\n t(1) = 0\n x(1) = 0\n y(1) = 0\n \n DO i = 1,N-1\n dt = t(i+1) - t(i)\n dx = abs( x(i+1)-x(i) )\n dy = abs( y(i+1)-y(i) )\n \n IF(dx+dy>dt)THEN\n flag = .false.\n EXIT\n END IF\n \n s = dy+dx -dt\n IF( mod(dx+dy,2)/=mod(dt,2) )THEN\n flag = .false.\n EXIT\n END IF\n END DO\n \n IF(flag)THEN\n print'(A)','YES'\n ELSE\n print'(A)','NO'\n END IF\n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1568675374, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Fortran/s621135208.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s621135208", "user_id": "u171356453"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": " PROGRAM traveling\n IMPLICIT NONE\n INTEGER :: N\n INTEGER,ALLOCATABLE :: t(:), x(:),y(:)\n \n INTEGER :: i, dt, dx,dy, s\n LOGICAL :: flag = .TRUE.\n \n READ*,N\n N = N + 1\n ALLOCATE( t(N),x(N),y(N) )\n DO i = 2,N\n READ*,t(i),x(i),y(i)\n END DO\n t(1) = 0\n x(1) = 0\n y(1) = 0\n \n DO i = 1,N-1\n dt = t(i+1) - t(i)\n dx = abs( x(i+1)-x(i) )\n dy = abs( y(i+1)-y(i) )\n \n IF(dx+dy>dt)THEN\n flag = .false.\n EXIT\n END IF\n \n s = dy+dx -dt\n IF( mod(dx+dy,2)/=mod(dt,2) )THEN\n flag = .false.\n EXIT\n END IF\n END DO\n \n IF(flag)THEN\n print'(A)','YES'\n ELSE\n print'(A)','NO'\n END IF\n \n \n END PROGRAM", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 830, "cpu_time_ms": 75, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s768255541", "group_id": "codeNet:p03457", "input_text": "program tenquestionten\n integer,allocatable,dimension(:) :: X\n integer,allocatable,dimension(:) :: Y\n integer,allocatable,dimension(:) :: T\n integer N, i, j, sum, Xl, Yl, Tl, Z\n read(*,*) N\n allocate(X(N+1))\n allocate(Y(N+1))\n allocate(T(N+1))\n sum=0\n X(1) = 0\n Y(1) = 0\n T(1) = 0\n do i=2,N+1\n read(*,*) T(i), X(i), Y(i)\n end do\n do i=1,N\n Xl=abs(X(i+1)-X(i))\n Yl=abs(Y(i+1)-Y(i))\n Tl=abs(T(i+1)-T(i))\n Z=Xl+Yl\n if (Tl.ge.Z) then\n if ((mod(Z,2)).eq.(mod(Tl,2))) then\n sum = sum + 1\n end if\n end if\n end do\n if (sum.eq.N) then\n write(*,*) \"YES\"\n else if (sum.ne.N) then\n write(*,*) \"NO\"\n end if\nend program", "language": "Fortran", "metadata": {"date": 1558978539, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Fortran/s768255541.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s768255541", "user_id": "u039189422"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program tenquestionten\n integer,allocatable,dimension(:) :: X\n integer,allocatable,dimension(:) :: Y\n integer,allocatable,dimension(:) :: T\n integer N, i, j, sum, Xl, Yl, Tl, Z\n read(*,*) N\n allocate(X(N+1))\n allocate(Y(N+1))\n allocate(T(N+1))\n sum=0\n X(1) = 0\n Y(1) = 0\n T(1) = 0\n do i=2,N+1\n read(*,*) T(i), X(i), Y(i)\n end do\n do i=1,N\n Xl=abs(X(i+1)-X(i))\n Yl=abs(Y(i+1)-Y(i))\n Tl=abs(T(i+1)-T(i))\n Z=Xl+Yl\n if (Tl.ge.Z) then\n if ((mod(Z,2)).eq.(mod(Tl,2))) then\n sum = sum + 1\n end if\n end if\n end do\n if (sum.eq.N) then\n write(*,*) \"YES\"\n else if (sum.ne.N) then\n write(*,*) \"NO\"\n end if\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 627, "cpu_time_ms": 77, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s442347425", "group_id": "codeNet:p03457", "input_text": "program tenquestionten\n integer,allocatable,dimension(:) :: X\n integer,allocatable,dimension(:) :: Y\n integer,allocatable,dimension(:) :: T\n integer N, i, j, sum, Xl, Yl, Tl, Z\n read(*,*) N\n allocate(X(N+1))\n allocate(Y(N+1))\n allocate(T(N+1))\n sum=0\n X(1) = 0\n Y(1) = 0\n T(1) = 0\n do i=2,N+1\n read(*,*) T(i), X(i), Y(i)\n end do\n do i=1,N\n Xl=abs(X(i+1)-X(i))\n Yl=abs(Y(i+1)-Y(i))\n Tl=abs(T(i+1)-T(i))\n Z=Xl+Yl\n if (Z.ge.Tl) then\n if ((mod(Z,2)).eq.(mod(Tl,2))) then\n sum = sum + 1\n end if\n end if\n end do\n if (sum.eq.N-1) then\n write(*,*) \"YES\"\n else if (sum.ne.N-1) then\n write(*,*) \"NO\"\n end if\nend program", "language": "Fortran", "metadata": {"date": 1558972188, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03457.html", "problem_id": "p03457", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03457/input.txt", "sample_output_relpath": "derived/input_output/data/p03457/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03457/Fortran/s442347425.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s442347425", "user_id": "u039189422"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program tenquestionten\n integer,allocatable,dimension(:) :: X\n integer,allocatable,dimension(:) :: Y\n integer,allocatable,dimension(:) :: T\n integer N, i, j, sum, Xl, Yl, Tl, Z\n read(*,*) N\n allocate(X(N+1))\n allocate(Y(N+1))\n allocate(T(N+1))\n sum=0\n X(1) = 0\n Y(1) = 0\n T(1) = 0\n do i=2,N+1\n read(*,*) T(i), X(i), Y(i)\n end do\n do i=1,N\n Xl=abs(X(i+1)-X(i))\n Yl=abs(Y(i+1)-Y(i))\n Tl=abs(T(i+1)-T(i))\n Z=Xl+Yl\n if (Z.ge.Tl) then\n if ((mod(Z,2)).eq.(mod(Tl,2))) then\n sum = sum + 1\n end if\n end if\n end do\n if (sum.eq.N-1) then\n write(*,*) \"YES\"\n else if (sum.ne.N-1) then\n write(*,*) \"NO\"\n end if\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "sample_input": "2\n3 1 2\n6 1 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03457", "source_text": "Score : 300 points\n\nProblem Statement\n\nAtCoDeer the deer is going on a trip in a two-dimensional plane.\nIn his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.\n\nIf AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).\nNote that he cannot stay at his place.\nDetermine whether he can carry out his plan.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n0 ≤ x_i ≤ 10^5\n\n0 ≤ y_i ≤ 10^5\n\n1 ≤ t_i ≤ 10^5\n\nt_i < t_{i+1} (1 ≤ i ≤ N-1)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nt_1 x_1 y_1\nt_2 x_2 y_2\n:\nt_N x_N y_N\n\nOutput\n\nIf AtCoDeer can carry out his plan, print Yes; if he cannot, print No.\n\nSample Input 1\n\n2\n3 1 2\n6 1 1\n\nSample Output 1\n\nYes\n\nFor example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).\n\nSample Input 2\n\n1\n2 100 100\n\nSample Output 2\n\nNo\n\nIt is impossible to be at (100,100) two seconds after being at (0,0).\n\nSample Input 3\n\n2\n5 1 1\n100 1 1\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 631, "cpu_time_ms": 77, "memory_kb": 1408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s696654792", "group_id": "codeNet:p03458", "input_text": "implicit none\n\ninteger:: n,i,j,k,count,jj,count_max\ncharacter,allocatable,dimension(:) :: c*1\ninteger,allocatable,dimension(:):: x,y\nread (5,*) n,k\n\nallocate(x(n))\nallocate(y(n))\nallocate(c(n))\n\ndo i=1,n\n read(5,*) x(i),y(i),c(i)\nenddo\n\ndo j=1,k\n do jj=1,k\n count=0\n do i=1,n\n if (mod(mod(x(i)-j+1,k),2)==1 .and. mod(mod(y(i)-jj+1,k),2)==0 .and. c(i)==\"W\" ) then\n count=count+1\n if (mod(mod(x(i)-j+1,k),2)==0 .and. mod(mod(y(i)-jj+1,k),2)==1 .and. c(i)==\"W\" ) then\n count=count+1\n endif\n endif\nenddo\nenddo\n count_max=max(count,n-count)\nenddo\n\n!write(*,*) n,k\n!write(*,*) x,y,c\nwrite(*,*) count_max\n\nstop\nend\n", "language": "Fortran", "metadata": {"date": 1516593016, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03458.html", "problem_id": "p03458", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03458/input.txt", "sample_output_relpath": "derived/input_output/data/p03458/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03458/Fortran/s696654792.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s696654792", "user_id": "u909643606"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "implicit none\n\ninteger:: n,i,j,k,count,jj,count_max\ncharacter,allocatable,dimension(:) :: c*1\ninteger,allocatable,dimension(:):: x,y\nread (5,*) n,k\n\nallocate(x(n))\nallocate(y(n))\nallocate(c(n))\n\ndo i=1,n\n read(5,*) x(i),y(i),c(i)\nenddo\n\ndo j=1,k\n do jj=1,k\n count=0\n do i=1,n\n if (mod(mod(x(i)-j+1,k),2)==1 .and. mod(mod(y(i)-jj+1,k),2)==0 .and. c(i)==\"W\" ) then\n count=count+1\n if (mod(mod(x(i)-j+1,k),2)==0 .and. mod(mod(y(i)-jj+1,k),2)==1 .and. c(i)==\"W\" ) then\n count=count+1\n endif\n endif\nenddo\nenddo\n count_max=max(count,n-count)\nenddo\n\n!write(*,*) n,k\n!write(*,*) x,y,c\nwrite(*,*) count_max\n\nstop\nend\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "sample_input": "4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03458", "source_text": "Score : 500 points\n\nProblem Statement\n\nAtCoDeer is thinking of painting an infinite two-dimensional grid in a checked pattern of side K.\nHere, a checked pattern of side K is a pattern where each square is painted black or white so that each connected component of each color is a K × K square.\nBelow is an example of a checked pattern of side 3:\n\nAtCoDeer has N desires.\nThe i-th desire is represented by x_i, y_i and c_i.\nIf c_i is B, it means that he wants to paint the square (x_i,y_i) black; if c_i is W, he wants to paint the square (x_i,y_i) white.\nAt most how many desires can he satisfy at the same time?\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 1000\n\n0 ≤ x_i ≤ 10^9\n\n0 ≤ y_i ≤ 10^9\n\nIf i ≠ j, then (x_i,y_i) ≠ (x_j,y_j).\n\nc_i is B or W.\n\nN, K, x_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\nx_2 y_2 c_2\n:\nx_N y_N c_N\n\nOutput\n\nPrint the maximum number of desires that can be satisfied at the same time.\n\nSample Input 1\n\n4 3\n0 1 W\n1 2 W\n5 3 B\n5 4 B\n\nSample Output 1\n\n4\n\nHe can satisfy all his desires by painting as shown in the example above.\n\nSample Input 2\n\n2 1000\n0 0 B\n0 1 W\n\nSample Output 2\n\n2\n\nSample Input 3\n\n6 2\n1 2 B\n2 1 W\n2 2 B\n1 0 B\n0 6 W\n4 5 W\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 677, "cpu_time_ms": 2103, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s368645692", "group_id": "codeNet:p03464", "input_text": "implicit none\n\ninteger(8) :: ans_min=10000000000_8, ans_max=0, count=0\ninteger(8) :: k, i, j, n, n_org\ninteger,allocatable,dimension(:):: a\n\nread(5,*) k\nallocate(a(k))\n\nread(5,*) (a(i),i=1,k)\n\nn=maxval(a)-mod(maxval(a),a(1))\n\n\n!write(6,*) n\ndo j=1,1000\n n_org=n\n do i=1, k\n n=(int(n/a(i)))*a(i)\n enddo\n \n if (n==2) then\n ans_min=min(ans_min,n_org)\n ans_max=max(ans_max,n_org)\n count=1\n endif\nn=n_org+a(1)\n\nenddo\n\nif (count==0) then\n write(6,*), -1\nelse\n write(6,*) ans_min,ans_max+a(1)-1\nendif \n\nstop\nend", "language": "Fortran", "metadata": {"date": 1515989977, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03464.html", "problem_id": "p03464", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03464/input.txt", "sample_output_relpath": "derived/input_output/data/p03464/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03464/Fortran/s368645692.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s368645692", "user_id": "u909643606"}, "prompt_components": {"gold_output": "6 8\n", "input_to_evaluate": "implicit none\n\ninteger(8) :: ans_min=10000000000_8, ans_max=0, count=0\ninteger(8) :: k, i, j, n, n_org\ninteger,allocatable,dimension(:):: a\n\nread(5,*) k\nallocate(a(k))\n\nread(5,*) (a(i),i=1,k)\n\nn=maxval(a)-mod(maxval(a),a(1))\n\n\n!write(6,*) n\ndo j=1,1000\n n_org=n\n do i=1, k\n n=(int(n/a(i)))*a(i)\n enddo\n \n if (n==2) then\n ans_min=min(ans_min,n_org)\n ans_max=max(ans_max,n_org)\n count=1\n endif\nn=n_org+a(1)\n\nenddo\n\nif (count==0) then\n write(6,*), -1\nelse\n write(6,*) ans_min,ans_max+a(1)-1\nendif \n\nstop\nend", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "sample_input": "4\n3 4 3 2\n"}, "reference_outputs": ["6 8\n"], "source_document_id": "p03464", "source_text": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 557, "cpu_time_ms": 1499, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s056907123", "group_id": "codeNet:p03464", "input_text": "implicit none\n\ninteger(8) :: ans_min=10000000000_8, ans_max=0, count=0\ninteger(8) :: k, i, j, n, n_org\ninteger,allocatable,dimension(:):: a\n\nread(5,*) k\nallocate(a(k))\n\nread(5,*) (a(i),i=1,k)\n\nn=maxval(a)-mod(maxval(a),a(1))\n\n\nwrite(6,*) n\ndo j=1,300\n n_org=n\n do i=1, k\n n=(int(n/a(i)))*a(i)\n enddo\n \n if (n==2) then\n ans_min=min(ans_min,n_org)\n ans_max=max(ans_max,n_org)\n count=1\n endif\nn=n_org+a(1)\n\nenddo\n\nif (count==0) then\n write(6,*), -1\nelse\n write(6,*) ans_min,ans_max+a(1)-1\nendif \n\nstop\nend", "language": "Fortran", "metadata": {"date": 1515989875, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03464.html", "problem_id": "p03464", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03464/input.txt", "sample_output_relpath": "derived/input_output/data/p03464/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03464/Fortran/s056907123.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s056907123", "user_id": "u909643606"}, "prompt_components": {"gold_output": "6 8\n", "input_to_evaluate": "implicit none\n\ninteger(8) :: ans_min=10000000000_8, ans_max=0, count=0\ninteger(8) :: k, i, j, n, n_org\ninteger,allocatable,dimension(:):: a\n\nread(5,*) k\nallocate(a(k))\n\nread(5,*) (a(i),i=1,k)\n\nn=maxval(a)-mod(maxval(a),a(1))\n\n\nwrite(6,*) n\ndo j=1,300\n n_org=n\n do i=1, k\n n=(int(n/a(i)))*a(i)\n enddo\n \n if (n==2) then\n ans_min=min(ans_min,n_org)\n ans_max=max(ans_max,n_org)\n count=1\n endif\nn=n_org+a(1)\n\nenddo\n\nif (count==0) then\n write(6,*), -1\nelse\n write(6,*) ans_min,ans_max+a(1)-1\nendif \n\nstop\nend", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "sample_input": "4\n3 4 3 2\n"}, "reference_outputs": ["6 8\n"], "source_document_id": "p03464", "source_text": "Score : 500 points\n\nProblem Statement\n\nAn adult game master and N children are playing a game on an ice rink.\nThe game consists of K rounds.\nIn the i-th round, the game master announces:\n\nForm groups consisting of A_i children each!\n\nThen the children who are still in the game form as many groups of A_i children as possible.\nOne child may belong to at most one group.\nThose who are left without a group leave the game. The others proceed to the next round.\nNote that it's possible that nobody leaves the game in some round.\n\nIn the end, after the K-th round, there are exactly two children left, and they are declared the winners.\n\nYou have heard the values of A_1, A_2, ..., A_K. You don't know N, but you want to estimate it.\n\nFind the smallest and the largest possible number of children in the game before the start, or determine that no valid values of N exist.\n\nConstraints\n\n1 \\leq K \\leq 10^5\n\n2 \\leq A_i \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA_1 A_2 ... A_K\n\nOutput\n\nPrint two integers representing the smallest and the largest possible value of N, respectively,\nor a single integer -1 if the described situation is impossible.\n\nSample Input 1\n\n4\n3 4 3 2\n\nSample Output 1\n\n6 8\n\nFor example, if the game starts with 6 children, then it proceeds as follows:\n\nIn the first round, 6 children form 2 groups of 3 children, and nobody leaves the game.\n\nIn the second round, 6 children form 1 group of 4 children, and 2 children leave the game.\n\nIn the third round, 4 children form 1 group of 3 children, and 1 child leaves the game.\n\nIn the fourth round, 3 children form 1 group of 2 children, and 1 child leaves the game.\n\nThe last 2 children are declared the winners.\n\nSample Input 2\n\n5\n3 4 100 3 2\n\nSample Output 2\n\n-1\n\nThis situation is impossible.\nIn particular, if the game starts with less than 100 children, everyone leaves after the third round.\n\nSample Input 3\n\n10\n2 2 2 2 2 2 2 2 2 2\n\nSample Output 3\n\n2 3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 555, "cpu_time_ms": 469, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s068294011", "group_id": "codeNet:p03474", "input_text": "INTEGER A,B\nCHARACTER(20) S\nREAD*,A,B,S\nIF(SCAN(S,\"-\")/=A+1.OR.SCAN(S,\"-\",.TRUE.)/=A+1)THEN\n PRINT\"(A)\",\"No\"\nELSE\n PRINT\"(A)\",\"Yes\"\nENDIF\nEND", "language": "Fortran", "metadata": {"date": 1551796022, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03474.html", "problem_id": "p03474", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03474/input.txt", "sample_output_relpath": "derived/input_output/data/p03474/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03474/Fortran/s068294011.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s068294011", "user_id": "u598073939"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "INTEGER A,B\nCHARACTER(20) S\nREAD*,A,B,S\nIF(SCAN(S,\"-\")/=A+1.OR.SCAN(S,\"-\",.TRUE.)/=A+1)THEN\n PRINT\"(A)\",\"No\"\nELSE\n PRINT\"(A)\",\"Yes\"\nENDIF\nEND", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.\n\nYou are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.\n\nConstraints\n\n1≤A,B≤5\n\n|S|=A+B+1\n\nS consists of - and digits from 0 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\nS\n\nOutput\n\nPrint Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.\n\nSample Input 1\n\n3 4\n269-6650\n\nSample Output 1\n\nYes\n\nThe (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.\n\nSample Input 2\n\n1 1\n---\n\nSample Output 2\n\nNo\n\nS contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.\n\nSample Input 3\n\n1 2\n7444\n\nSample Output 3\n\nNo", "sample_input": "3 4\n269-6650\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03474", "source_text": "Score : 200 points\n\nProblem Statement\n\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.\n\nYou are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.\n\nConstraints\n\n1≤A,B≤5\n\n|S|=A+B+1\n\nS consists of - and digits from 0 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\nS\n\nOutput\n\nPrint Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.\n\nSample Input 1\n\n3 4\n269-6650\n\nSample Output 1\n\nYes\n\nThe (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.\n\nSample Input 2\n\n1 1\n---\n\nSample Output 2\n\nNo\n\nS contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.\n\nSample Input 3\n\n1 2\n7444\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s940456409", "group_id": "codeNet:p03474", "input_text": "program proB\n implicit none\n integer i,j,a,b\n character s*9,check*10\n\n read(*,*) a,b\n read(*,*) s\n\n check='0123456789'\n do i=1,a+b\n if(i==a+1) then\n if(s(i:i)=='-') then\n cycle\n else\n write(*,*) 'No'\n stop\n end if \n else if(s(i:i)=='0' .or. s(i:i)=='1' .or. s(i:i)=='2' .or. s(i:i)=='3' &\n .or. s(i:i)=='4' .or. s(i:i)=='5' .or. s(i:i)=='6' .or. s(i:i)=='7' &\n .or. s(i:i)=='8' .or. s(i:i)=='9') then\n cycle\n else\n write(*,*) 'No'\n stop\n end if\n end do\n\n write(*,*) 'Yes'\n \n\nend program proB\n", "language": "Fortran", "metadata": {"date": 1516742186, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03474.html", "problem_id": "p03474", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03474/input.txt", "sample_output_relpath": "derived/input_output/data/p03474/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03474/Fortran/s940456409.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s940456409", "user_id": "u177040005"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program proB\n implicit none\n integer i,j,a,b\n character s*9,check*10\n\n read(*,*) a,b\n read(*,*) s\n\n check='0123456789'\n do i=1,a+b\n if(i==a+1) then\n if(s(i:i)=='-') then\n cycle\n else\n write(*,*) 'No'\n stop\n end if \n else if(s(i:i)=='0' .or. s(i:i)=='1' .or. s(i:i)=='2' .or. s(i:i)=='3' &\n .or. s(i:i)=='4' .or. s(i:i)=='5' .or. s(i:i)=='6' .or. s(i:i)=='7' &\n .or. s(i:i)=='8' .or. s(i:i)=='9') then\n cycle\n else\n write(*,*) 'No'\n stop\n end if\n end do\n\n write(*,*) 'Yes'\n \n\nend program proB\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.\n\nYou are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.\n\nConstraints\n\n1≤A,B≤5\n\n|S|=A+B+1\n\nS consists of - and digits from 0 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\nS\n\nOutput\n\nPrint Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.\n\nSample Input 1\n\n3 4\n269-6650\n\nSample Output 1\n\nYes\n\nThe (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.\n\nSample Input 2\n\n1 1\n---\n\nSample Output 2\n\nNo\n\nS contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.\n\nSample Input 3\n\n1 2\n7444\n\nSample Output 3\n\nNo", "sample_input": "3 4\n269-6650\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03474", "source_text": "Score : 200 points\n\nProblem Statement\n\nThe postal code in Atcoder Kingdom is A+B+1 characters long, its (A+1)-th character is a hyphen -, and the other characters are digits from 0 through 9.\n\nYou are given a string S. Determine whether it follows the postal code format in Atcoder Kingdom.\n\nConstraints\n\n1≤A,B≤5\n\n|S|=A+B+1\n\nS consists of - and digits from 0 through 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\nS\n\nOutput\n\nPrint Yes if S follows the postal code format in AtCoder Kingdom; print No otherwise.\n\nSample Input 1\n\n3 4\n269-6650\n\nSample Output 1\n\nYes\n\nThe (A+1)-th character of S is -, and the other characters are digits from 0 through 9, so it follows the format.\n\nSample Input 2\n\n1 1\n---\n\nSample Output 2\n\nNo\n\nS contains unnecessary -s other than the (A+1)-th character, so it does not follow the format.\n\nSample Input 3\n\n1 2\n7444\n\nSample Output 3\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 615, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s903760617", "group_id": "codeNet:p03475", "input_text": "program C_solution\n\nimplicit none\ninteger :: n,c(499),s(499),f(499)\ninteger :: i,j,k,t(500)\n\nread(*,*) n\ndo i=1, n-1\n read(*,*) c(i),s(i),f(i)\nenddo\n\ndo i = 1, n\n t(i) = 0\n if ( i <= n-1 ) then\n do j = i , n-1\n t(i) = max( s(j), ((t(i)-1)/f(j))*f(j) + f(j) ) + c(j)\n enddo\n endif\n write(*,*) t(i)\n enddo\n\n\nend program", "language": "Fortran", "metadata": {"date": 1523681689, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03475.html", "problem_id": "p03475", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03475/input.txt", "sample_output_relpath": "derived/input_output/data/p03475/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03475/Fortran/s903760617.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s903760617", "user_id": "u454703763"}, "prompt_components": {"gold_output": "12\n11\n0\n", "input_to_evaluate": "program C_solution\n\nimplicit none\ninteger :: n,c(499),s(499),f(499)\ninteger :: i,j,k,t(500)\n\nread(*,*) n\ndo i=1, n-1\n read(*,*) c(i),s(i),f(i)\nenddo\n\ndo i = 1, n\n t(i) = 0\n if ( i <= n-1 ) then\n do j = i , n-1\n t(i) = max( s(j), ((t(i)-1)/f(j))*f(j) + f(j) ) + c(j)\n enddo\n endif\n write(*,*) t(i)\n enddo\n\n\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA railroad running from west to east in Atcoder Kingdom is now complete.\n\nThere are N stations on the railroad, numbered 1 through N from west to east.\n\nTomorrow, the opening ceremony of the railroad will take place.\n\nOn this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i to Station i+1 in C_i seconds. No other trains will be operated.\n\nThe first train from Station i to Station i+1 will depart Station i S_i seconds after the ceremony begins. Thereafter, there will be a train that departs Station i every F_i seconds.\n\nHere, it is guaranteed that F_i divides S_i.\n\nThat is, for each Time t satisfying S_i≤t and t%F_i=0, there will be a train that departs Station i t seconds after the ceremony begins and arrives at Station i+1 t+C_i seconds after the ceremony begins, where A%B denotes A modulo B, and there will be no other trains.\n\nFor each i, find the earliest possible time we can reach Station N if we are at Station i when the ceremony begins, ignoring the time needed to change trains.\n\nConstraints\n\n1≤N≤500\n\n1≤C_i≤100\n\n1≤S_i≤10^5\n\n1≤F_i≤10\n\nS_i%F_i=0\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nC_1 S_1 F_1\n:\nC_{N-1} S_{N-1} F_{N-1}\n\nOutput\n\nPrint N lines. Assuming that we are at Station i (1≤i≤N) when the ceremony begins, if the earliest possible time we can reach Station N is x seconds after the ceremony begins, the i-th line should contain x.\n\nSample Input 1\n\n3\n6 5 1\n1 10 1\n\nSample Output 1\n\n12\n11\n0\n\nWe will travel from Station 1 as follows:\n\n5 seconds after the beginning: take the train to Station 2.\n\n11 seconds: arrive at Station 2.\n\n11 seconds: take the train to Station 3.\n\n12 seconds: arrive at Station 3.\n\nWe will travel from Station 2 as follows:\n\n10 seconds: take the train to Station 3.\n\n11 seconds: arrive at Station 3.\n\nNote that we should print 0 for Station 3.\n\nSample Input 2\n\n4\n12 24 6\n52 16 4\n99 2 2\n\nSample Output 2\n\n187\n167\n101\n0\n\nSample Input 3\n\n4\n12 13 1\n44 17 17\n66 4096 64\n\nSample Output 3\n\n4162\n4162\n4162\n0", "sample_input": "3\n6 5 1\n1 10 1\n"}, "reference_outputs": ["12\n11\n0\n"], "source_document_id": "p03475", "source_text": "Score : 300 points\n\nProblem Statement\n\nA railroad running from west to east in Atcoder Kingdom is now complete.\n\nThere are N stations on the railroad, numbered 1 through N from west to east.\n\nTomorrow, the opening ceremony of the railroad will take place.\n\nOn this railroad, for each integer i such that 1≤i≤N-1, there will be trains that run from Station i to Station i+1 in C_i seconds. No other trains will be operated.\n\nThe first train from Station i to Station i+1 will depart Station i S_i seconds after the ceremony begins. Thereafter, there will be a train that departs Station i every F_i seconds.\n\nHere, it is guaranteed that F_i divides S_i.\n\nThat is, for each Time t satisfying S_i≤t and t%F_i=0, there will be a train that departs Station i t seconds after the ceremony begins and arrives at Station i+1 t+C_i seconds after the ceremony begins, where A%B denotes A modulo B, and there will be no other trains.\n\nFor each i, find the earliest possible time we can reach Station N if we are at Station i when the ceremony begins, ignoring the time needed to change trains.\n\nConstraints\n\n1≤N≤500\n\n1≤C_i≤100\n\n1≤S_i≤10^5\n\n1≤F_i≤10\n\nS_i%F_i=0\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nC_1 S_1 F_1\n:\nC_{N-1} S_{N-1} F_{N-1}\n\nOutput\n\nPrint N lines. Assuming that we are at Station i (1≤i≤N) when the ceremony begins, if the earliest possible time we can reach Station N is x seconds after the ceremony begins, the i-th line should contain x.\n\nSample Input 1\n\n3\n6 5 1\n1 10 1\n\nSample Output 1\n\n12\n11\n0\n\nWe will travel from Station 1 as follows:\n\n5 seconds after the beginning: take the train to Station 2.\n\n11 seconds: arrive at Station 2.\n\n11 seconds: take the train to Station 3.\n\n12 seconds: arrive at Station 3.\n\nWe will travel from Station 2 as follows:\n\n10 seconds: take the train to Station 3.\n\n11 seconds: arrive at Station 3.\n\nNote that we should print 0 for Station 3.\n\nSample Input 2\n\n4\n12 24 6\n52 16 4\n99 2 2\n\nSample Output 2\n\n187\n167\n101\n0\n\nSample Input 3\n\n4\n12 13 1\n44 17 17\n66 4096 64\n\nSample Output 3\n\n4162\n4162\n4162\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 346, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s063908048", "group_id": "codeNet:p03476", "input_text": "program D_solution\n\nimplicit none\ninteger :: Q,l(10**5),r(10**5)\ninteger :: i,j\ninteger :: is_prime(10**5),like_2017(50001)\n\nread(*,*) Q\ndo i = 1, Q\n read(*,*) l(i),r(i)\nenddo\n\nis_prime(1) = 0\n\ndo i = 2, 10**5\n is_prime(i) = 1\n do j = 2, int((i)**0.5)\n if(mod(i,j) == 0) then\n is_prime(i) = 0\n endif\n enddo\nenddo\n\nlike_2017 = 0\n\ndo i = 1, 10**5, 2\n like_2017((i+1)/2) = is_prime(i) * is_prime((i+1)/2)\nenddo\n\ndo i=1,Q\n write(*,*) sum(like_2017((l(i)+1)/2:(r(i)+1)/2))\nenddo\nend program", "language": "Fortran", "metadata": {"date": 1523736539, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03476.html", "problem_id": "p03476", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03476/input.txt", "sample_output_relpath": "derived/input_output/data/p03476/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03476/Fortran/s063908048.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s063908048", "user_id": "u454703763"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program D_solution\n\nimplicit none\ninteger :: Q,l(10**5),r(10**5)\ninteger :: i,j\ninteger :: is_prime(10**5),like_2017(50001)\n\nread(*,*) Q\ndo i = 1, Q\n read(*,*) l(i),r(i)\nenddo\n\nis_prime(1) = 0\n\ndo i = 2, 10**5\n is_prime(i) = 1\n do j = 2, int((i)**0.5)\n if(mod(i,j) == 0) then\n is_prime(i) = 0\n endif\n enddo\nenddo\n\nlike_2017 = 0\n\ndo i = 1, 10**5, 2\n like_2017((i+1)/2) = is_prime(i) * is_prime((i+1)/2)\nenddo\n\ndo i=1,Q\n write(*,*) sum(like_2017((l(i)+1)/2:(r(i)+1)/2))\nenddo\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.\n\nYou are given Q queries.\n\nIn the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i.\n\nConstraints\n\n1≤Q≤10^5\n\n1≤l_i≤r_i≤10^5\n\nl_i and r_i are odd.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line (1≤i≤Q) should contain the response to the i-th query.\n\nSample Input 1\n\n1\n3 7\n\nSample Output 1\n\n2\n\n3 is similar to 2017, since both 3 and (3+1)/2=2 are prime.\n\n5 is similar to 2017, since both 5 and (5+1)/2=3 are prime.\n\n7 is not similar to 2017, since (7+1)/2=4 is not prime, although 7 is prime.\n\nThus, the response to the first query should be 2.\n\nSample Input 2\n\n4\n13 13\n7 11\n7 11\n2017 2017\n\nSample Output 2\n\n1\n0\n0\n1\n\nNote that 2017 is also similar to 2017.\n\nSample Input 3\n\n6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49\n\nSample Output 3\n\n4\n4\n1\n1\n1\n2", "sample_input": "1\n3 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03476", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.\n\nYou are given Q queries.\n\nIn the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i.\n\nConstraints\n\n1≤Q≤10^5\n\n1≤l_i≤r_i≤10^5\n\nl_i and r_i are odd.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line (1≤i≤Q) should contain the response to the i-th query.\n\nSample Input 1\n\n1\n3 7\n\nSample Output 1\n\n2\n\n3 is similar to 2017, since both 3 and (3+1)/2=2 are prime.\n\n5 is similar to 2017, since both 5 and (5+1)/2=3 are prime.\n\n7 is not similar to 2017, since (7+1)/2=4 is not prime, although 7 is prime.\n\nThus, the response to the first query should be 2.\n\nSample Input 2\n\n4\n13 13\n7 11\n7 11\n2017 2017\n\nSample Output 2\n\n1\n0\n0\n1\n\nNote that 2017 is also similar to 2017.\n\nSample Input 3\n\n6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49\n\nSample Output 3\n\n4\n4\n1\n1\n1\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 504, "cpu_time_ms": 2103, "memory_kb": 3328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s740672022", "group_id": "codeNet:p03476", "input_text": "program D_solution\n\nimplicit none\ninteger :: Q,l(10**5),r(10**5),n\ninteger :: i,j,is_prime(10**5)\n\nread(*,*) Q\ndo i = 1, Q\n read(*,*) l(i),r(i)\nenddo\n\n is_prime(1) = 0\ndo i = 2, 10**5\n is_prime(i) = 1\n do j = 2, int((i)**0.5)\n if(mod(i,j) == 0) then\n is_prime(i) = 0\n endif\n enddo\nenddo\n\ndo i=1,Q\n n = 0\n do j=l(i),r(i),2\n if(is_prime(j) == 1 .and. is_prime(int((j+1)/2)) == 1) then\n\tn = n + 1\n endif\n enddo\n write(*,*) n\nenddo\nend program", "language": "Fortran", "metadata": {"date": 1523733743, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03476.html", "problem_id": "p03476", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03476/input.txt", "sample_output_relpath": "derived/input_output/data/p03476/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03476/Fortran/s740672022.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s740672022", "user_id": "u454703763"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program D_solution\n\nimplicit none\ninteger :: Q,l(10**5),r(10**5),n\ninteger :: i,j,is_prime(10**5)\n\nread(*,*) Q\ndo i = 1, Q\n read(*,*) l(i),r(i)\nenddo\n\n is_prime(1) = 0\ndo i = 2, 10**5\n is_prime(i) = 1\n do j = 2, int((i)**0.5)\n if(mod(i,j) == 0) then\n is_prime(i) = 0\n endif\n enddo\nenddo\n\ndo i=1,Q\n n = 0\n do j=l(i),r(i),2\n if(is_prime(j) == 1 .and. is_prime(int((j+1)/2)) == 1) then\n\tn = n + 1\n endif\n enddo\n write(*,*) n\nenddo\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.\n\nYou are given Q queries.\n\nIn the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i.\n\nConstraints\n\n1≤Q≤10^5\n\n1≤l_i≤r_i≤10^5\n\nl_i and r_i are odd.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line (1≤i≤Q) should contain the response to the i-th query.\n\nSample Input 1\n\n1\n3 7\n\nSample Output 1\n\n2\n\n3 is similar to 2017, since both 3 and (3+1)/2=2 are prime.\n\n5 is similar to 2017, since both 5 and (5+1)/2=3 are prime.\n\n7 is not similar to 2017, since (7+1)/2=4 is not prime, although 7 is prime.\n\nThus, the response to the first query should be 2.\n\nSample Input 2\n\n4\n13 13\n7 11\n7 11\n2017 2017\n\nSample Output 2\n\n1\n0\n0\n1\n\nNote that 2017 is also similar to 2017.\n\nSample Input 3\n\n6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49\n\nSample Output 3\n\n4\n4\n1\n1\n1\n2", "sample_input": "1\n3 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03476", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe say that a odd number N is similar to 2017 when both N and (N+1)/2 are prime.\n\nYou are given Q queries.\n\nIn the i-th query, given two odd numbers l_i and r_i, find the number of odd numbers x similar to 2017 such that l_i ≤ x ≤ r_i.\n\nConstraints\n\n1≤Q≤10^5\n\n1≤l_i≤r_i≤10^5\n\nl_i and r_i are odd.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nl_1 r_1\n:\nl_Q r_Q\n\nOutput\n\nPrint Q lines. The i-th line (1≤i≤Q) should contain the response to the i-th query.\n\nSample Input 1\n\n1\n3 7\n\nSample Output 1\n\n2\n\n3 is similar to 2017, since both 3 and (3+1)/2=2 are prime.\n\n5 is similar to 2017, since both 5 and (5+1)/2=3 are prime.\n\n7 is not similar to 2017, since (7+1)/2=4 is not prime, although 7 is prime.\n\nThus, the response to the first query should be 2.\n\nSample Input 2\n\n4\n13 13\n7 11\n7 11\n2017 2017\n\nSample Output 2\n\n1\n0\n0\n1\n\nNote that 2017 is also similar to 2017.\n\nSample Input 3\n\n6\n1 53\n13 91\n37 55\n19 51\n73 91\n13 49\n\nSample Output 3\n\n4\n4\n1\n1\n1\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 465, "cpu_time_ms": 2103, "memory_kb": 2560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s900903088", "group_id": "codeNet:p03477", "input_text": "program main\n implicit none\n integer :: a, b, c, d\n read *, a, b, c, d\n if (a + b == c + d) then\n print \"(a)\", \"Balanced\"\n else if (a + b < c + d) then\n print \"(a)\", \"Right\"\n else\n print \"(a)\", \"Left\"\n end if\nend program main\n", "language": "Fortran", "metadata": {"date": 1587694822, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03477.html", "problem_id": "p03477", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03477/input.txt", "sample_output_relpath": "derived/input_output/data/p03477/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03477/Fortran/s900903088.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900903088", "user_id": "u388927326"}, "prompt_components": {"gold_output": "Left\n", "input_to_evaluate": "program main\n implicit none\n integer :: a, b, c, d\n read *, a, b, c, d\n if (a + b == c + d) then\n print \"(a)\", \"Balanced\"\n else if (a + b < c + d) then\n print \"(a)\", \"Right\"\n else\n print \"(a)\", \"Left\"\n end if\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L8, we should print Left.\n\nSample Input 2\n\n3 4 5 2\n\nSample Output 2\n\nBalanced\n\nThe total weight of the masses on the left pan is 7, and the total weight of the masses on the right pan is 7. Since 7=7, we should print Balanced.\n\nSample Input 3\n\n1 7 6 4\n\nSample Output 3\n\nRight\n\nThe total weight of the masses on the left pan is 8, and the total weight of the masses on the right pan is 10. Since 8<10, we should print Right.", "sample_input": "3 8 7 1\n"}, "reference_outputs": ["Left\n"], "source_document_id": "p03477", "source_text": "Score : 100 points\n\nProblem Statement\n\nA balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L8, we should print Left.\n\nSample Input 2\n\n3 4 5 2\n\nSample Output 2\n\nBalanced\n\nThe total weight of the masses on the left pan is 7, and the total weight of the masses on the right pan is 7. Since 7=7, we should print Balanced.\n\nSample Input 3\n\n1 7 6 4\n\nSample Output 3\n\nRight\n\nThe total weight of the masses on the left pan is 8, and the total weight of the masses on the right pan is 10. Since 8<10, we should print Right.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 242, "cpu_time_ms": 7, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s219794285", "group_id": "codeNet:p03479", "input_text": "program main\ninteger(8) X,Y,length\n\nread(*,*) X,Y\nAn=X*2\nlength=1\ndo\n\tAn = X*2\n if(An<=Y)then\n\t length = length + 1\n else\n \texit\n endif\nenddo\n\nwrite(*,*) length\n\nend program", "language": "Fortran", "metadata": {"date": 1514628117, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03479.html", "problem_id": "p03479", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03479/input.txt", "sample_output_relpath": "derived/input_output/data/p03479/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03479/Fortran/s219794285.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s219794285", "user_id": "u351524992"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\ninteger(8) X,Y,length\n\nread(*,*) X,Y\nAn=X*2\nlength=1\ndo\n\tAn = X*2\n if(An<=Y)then\n\t length = length + 1\n else\n \texit\n endif\nenddo\n\nwrite(*,*) length\n\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nAs a token of his gratitude, Takahashi has decided to give his mother an integer sequence.\nThe sequence A needs to satisfy the conditions below:\n\nA consists of integers between X and Y (inclusive).\n\nFor each 1\\leq i \\leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.\n\nFind the maximum possible length of the sequence.\n\nConstraints\n\n1 \\leq X \\leq Y \\leq 10^{18}\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the maximum possible length of the sequence.\n\nSample Input 1\n\n3 20\n\nSample Output 1\n\n3\n\nThe sequence 3,6,18 satisfies the conditions.\n\nSample Input 2\n\n25 100\n\nSample Output 2\n\n3\n\nSample Input 3\n\n314159265 358979323846264338\n\nSample Output 3\n\n31", "sample_input": "3 20\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03479", "source_text": "Score : 300 points\n\nProblem Statement\n\nAs a token of his gratitude, Takahashi has decided to give his mother an integer sequence.\nThe sequence A needs to satisfy the conditions below:\n\nA consists of integers between X and Y (inclusive).\n\nFor each 1\\leq i \\leq |A|-1, A_{i+1} is a multiple of A_i and strictly greater than A_i.\n\nFind the maximum possible length of the sequence.\n\nConstraints\n\n1 \\leq X \\leq Y \\leq 10^{18}\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the maximum possible length of the sequence.\n\nSample Input 1\n\n3 20\n\nSample Output 1\n\n3\n\nThe sequence 3,6,18 satisfies the conditions.\n\nSample Input 2\n\n25 100\n\nSample Output 2\n\n3\n\nSample Input 3\n\n314159265 358979323846264338\n\nSample Output 3\n\n31", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 188, "cpu_time_ms": 2103, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s057224262", "group_id": "codeNet:p03494", "input_text": "program shift_only\n implicit none\n integer :: n, a(200) = 0, i\n read(*,*) n\n read(*,*) a(1:n)\n write(*,'(i0)') minval(number_of_trailing_zeros(a(1:n)))\ncontains\n pure elemental integer function number_of_trailing_zeros(i) result(res)\n integer, intent(in) :: i\n integer :: x, y\n if (i == 0) then\n res = 32\n return\n end if\n res = 31\n x = i\n y = lshift(x, 16)\n if (y /= 0) then\n res = res - 16\n x = y\n end if\n y = lshift(x, 8)\n if (y /= 0) then\n res = res - 8\n x = y\n end if\n y = lshift(x, 4)\n if (y /= 0) then\n res = res - 4\n x = y\n end if\n y = lshift(x, 2)\n if (y /= 0) then\n res = res - 2\n x = y\n end if\n res = res - urshift(lshift(x, 1), 31)\n end\n pure elemental integer function urshift(i, n) result(res)\n integer, intent(in) :: i\n integer, intent(in) :: n\n if (n == 0) then\n res = i\n else\n res = rshift(ibclr(rshift(i, 1), 31), n - 1)\n end if\n end\nend program shift_only", "language": "Fortran", "metadata": {"date": 1597784976, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Fortran/s057224262.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s057224262", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program shift_only\n implicit none\n integer :: n, a(200) = 0, i\n read(*,*) n\n read(*,*) a(1:n)\n write(*,'(i0)') minval(number_of_trailing_zeros(a(1:n)))\ncontains\n pure elemental integer function number_of_trailing_zeros(i) result(res)\n integer, intent(in) :: i\n integer :: x, y\n if (i == 0) then\n res = 32\n return\n end if\n res = 31\n x = i\n y = lshift(x, 16)\n if (y /= 0) then\n res = res - 16\n x = y\n end if\n y = lshift(x, 8)\n if (y /= 0) then\n res = res - 8\n x = y\n end if\n y = lshift(x, 4)\n if (y /= 0) then\n res = res - 4\n x = y\n end if\n y = lshift(x, 2)\n if (y /= 0) then\n res = res - 2\n x = y\n end if\n res = res - urshift(lshift(x, 1), 31)\n end\n pure elemental integer function urshift(i, n) result(res)\n integer, intent(in) :: i\n integer, intent(in) :: n\n if (n == 0) then\n res = i\n else\n res = rshift(ibclr(rshift(i, 1), 31), n - 1)\n end if\n end\nend program shift_only", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1014, "cpu_time_ms": 5, "memory_kb": 2772}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s334812238", "group_id": "codeNet:p03494", "input_text": "program main\n implicit none\n INTEGER :: i, n, ans = 1e9, ans1 = 0\n INTEGER, ALLOCATABLE :: a(:)\n read(*, *) n\n ALLOCATE(a(n))\n READ(*, *) (a(i), i = 1, n)\n do i = 1, n\n do while(mod(a(i), 2) == 0)\n ans1 = ans1 + 1\n a(i) = a(i) / 2\n enddo\n ans = min(ans, ans1)\n ans1 = 0\n enddo\n write(*, *) ans\nend program main", "language": "Fortran", "metadata": {"date": 1593972412, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Fortran/s334812238.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s334812238", "user_id": "u690555363"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n INTEGER :: i, n, ans = 1e9, ans1 = 0\n INTEGER, ALLOCATABLE :: a(:)\n read(*, *) n\n ALLOCATE(a(n))\n READ(*, *) (a(i), i = 1, n)\n do i = 1, n\n do while(mod(a(i), 2) == 0)\n ans1 = ans1 + 1\n a(i) = a(i) / 2\n enddo\n ans = min(ans, ans1)\n ans1 = 0\n enddo\n write(*, *) ans\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 387, "cpu_time_ms": 3, "memory_kb": 2780}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s375702417", "group_id": "codeNet:p03494", "input_text": "program main\n implicit none\n integer :: n,i,j,divide,cnt\n integer,allocatable,dimension(:) :: a\n\n read(5,*) n\n\n allocate (a(n))\n read(5,*) (a(i),i=1,n)\n\n do j = 1, 1000\n divide = 0\n \n do i = 1, n\n if ( mod(a(i),2)==0 ) then\n divide = divide +1\n endif\n end do\n\n if ( divide == n ) then\n cnt = cnt + 1\n do i = 1, n\n a(i) = a(i)/2\n end do\n else\n exit\n endif\n end do\n\n write(6,\"(i0)\") cnt\n\nend program main", "language": "Fortran", "metadata": {"date": 1587076541, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Fortran/s375702417.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s375702417", "user_id": "u351459750"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n integer :: n,i,j,divide,cnt\n integer,allocatable,dimension(:) :: a\n\n read(5,*) n\n\n allocate (a(n))\n read(5,*) (a(i),i=1,n)\n\n do j = 1, 1000\n divide = 0\n \n do i = 1, n\n if ( mod(a(i),2)==0 ) then\n divide = divide +1\n endif\n end do\n\n if ( divide == n ) then\n cnt = cnt + 1\n do i = 1, n\n a(i) = a(i)/2\n end do\n else\n exit\n endif\n end do\n\n write(6,\"(i0)\") cnt\n\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 574, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s582732329", "group_id": "codeNet:p03494", "input_text": "program tenquestionthree\n implicit none\n integer n, i, x\n integer,allocatable,dimension(:) ::A\n x=30\n read(*,*) n\n allocate(A(n))\n read(*,*) A !横に読ます時これでいいらしい\n do i=1,n\n do while ((mod(A(i),2**x)).ne.0) !do while文.論理が真ならループを繰り返す.最も2の成分が少ないA(i)を探してる\n x=x-1\n end do\n end do\n write(*,*) x\nend program", "language": "Fortran", "metadata": {"date": 1558884395, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03494.html", "problem_id": "p03494", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03494/input.txt", "sample_output_relpath": "derived/input_output/data/p03494/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03494/Fortran/s582732329.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s582732329", "user_id": "u039189422"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program tenquestionthree\n implicit none\n integer n, i, x\n integer,allocatable,dimension(:) ::A\n x=30\n read(*,*) n\n allocate(A(n))\n read(*,*) A !横に読ます時これでいいらしい\n do i=1,n\n do while ((mod(A(i),2**x)).ne.0) !do while文.論理が真ならループを繰り返す.最も2の成分が少ないA(i)を探してる\n x=x-1\n end do\n end do\n write(*,*) x\nend program", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "sample_input": "3\n8 12 40\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03494", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N positive integers written on a blackboard: A_1, ..., A_N.\n\nSnuke can perform the following operation when all integers on the blackboard are even:\n\nReplace each integer X on the blackboard by X divided by 2.\n\nFind the maximum possible number of operations that Snuke can perform.\n\nConstraints\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n8 12 40\n\nSample Output 1\n\n2\n\nInitially, [8, 12, 40] are written on the blackboard.\nSince all those integers are even, Snuke can perform the operation.\n\nAfter the operation is performed once, [4, 6, 20] are written on the blackboard.\nSince all those integers are again even, he can perform the operation.\n\nAfter the operation is performed twice, [2, 3, 10] are written on the blackboard.\nNow, there is an odd number 3 on the blackboard, so he cannot perform the operation any more.\n\nThus, Snuke can perform the operation at most twice.\n\nSample Input 2\n\n4\n5 6 8 10\n\nSample Output 2\n\n0\n\nSince there is an odd number 5 on the blackboard already in the beginning, Snuke cannot perform the operation at all.\n\nSample Input 3\n\n6\n382253568 723152896 37802240 379425024 404894720 471526144\n\nSample Output 3\n\n8", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 474, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s104639624", "group_id": "codeNet:p03504", "input_text": "program recording\n implicit none\n integer :: n, k, s, t, c, x(200001,30), i, j, m\n s = 0\n x = 0\n read(*,*) n, k\n do i = 1, n\n read(*,*) s, t, c\n x(2*s-1,c) = x(2*s-1,c) + 1\n x(2*t+1,c) = x(2*t+1,c) - 1\n end do\n do j = 1, k\n do i = 1, 200001\n x(i+1,j) = x(i+1,j) + x(i,j)\n end do\n end do\n m = 0\n do i = 1, 200001\n c = sum(x(i,:))\n if (m.lt.c) m = c\n end do\n write(*,'(i0)') m\n stop\nend program recording", "language": "Fortran", "metadata": {"date": 1556211209, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03504.html", "problem_id": "p03504", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03504/input.txt", "sample_output_relpath": "derived/input_output/data/p03504/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03504/Fortran/s104639624.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s104639624", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program recording\n implicit none\n integer :: n, k, s, t, c, x(200001,30), i, j, m\n s = 0\n x = 0\n read(*,*) n, k\n do i = 1, n\n read(*,*) s, t, c\n x(2*s-1,c) = x(2*s-1,c) + 1\n x(2*t+1,c) = x(2*t+1,c) - 1\n end do\n do j = 1, k\n do i = 1, 200001\n x(i+1,j) = x(i+1,j) + x(i,j)\n end do\n end do\n m = 0\n do i = 1, 200001\n c = sum(x(i,:))\n if (m.lt.c) m = c\n end do\n write(*,'(i0)') m\n stop\nend program recording", "problem_context": "Score : 400 points\n\nProblem Statement\n\nJoisino is planning to record N TV programs with recorders.\n\nThe TV can receive C channels numbered 1 through C.\n\nThe i-th program that she wants to record will be broadcast from time s_i to time t_i (including time s_i but not t_i) on Channel c_i.\n\nHere, there will never be more than one program that are broadcast on the same channel at the same time.\n\nWhen the recorder is recording a channel from time S to time T (including time S but not T), it cannot record other channels from time S-0.5 to time T (including time S-0.5 but not T).\n\nFind the minimum number of recorders required to record the channels so that all the N programs are completely recorded.\n\nConstraints\n\n1≤N≤10^5\n\n1≤C≤30\n\n1≤s_i'\nelse\n print *, '<'\nend if\n \nend program r20718h", "language": "Fortran", "metadata": {"date": 1595125779, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03547.html", "problem_id": "p03547", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03547/input.txt", "sample_output_relpath": "derived/input_output/data/p03547/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03547/Fortran/s405798819.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s405798819", "user_id": "u644436095"}, "prompt_components": {"gold_output": "<\n", "input_to_evaluate": "program r20718h\n \nimplicit none\ncharacter(len=1) :: x, y\n \nread *, x, y\n \nif(ichar(x) == ichar(y)) then\n print *, '='\nelse if(ichar(x) > ichar(y)) then\n print *, '>'\nelse\n print *, '<'\nend if\n \nend program r20718h", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn programming, hexadecimal notation is often used.\n\nIn hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters A, B, C, D, E and F are used to represent the values 10, 11, 12, 13, 14 and 15, respectively.\n\nIn this problem, you are given two letters X and Y. Each X and Y is A, B, C, D, E or F.\n\nWhen X and Y are seen as hexadecimal numbers, which is larger?\n\nConstraints\n\nEach X and Y is A, B, C, D, E or F.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf X is smaller, print <; if Y is smaller, print >; if they are equal, print =.\n\nSample Input 1\n\nA B\n\nSample Output 1\n\n<\n\n10 < 11.\n\nSample Input 2\n\nE C\n\nSample Output 2\n\n>\n\n14 > 12.\n\nSample Input 3\n\nF F\n\nSample Output 3\n\n=\n\n15 = 15.", "sample_input": "A B\n"}, "reference_outputs": ["<\n"], "source_document_id": "p03547", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn programming, hexadecimal notation is often used.\n\nIn hexadecimal notation, besides the ten digits 0, 1, ..., 9, the six letters A, B, C, D, E and F are used to represent the values 10, 11, 12, 13, 14 and 15, respectively.\n\nIn this problem, you are given two letters X and Y. Each X and Y is A, B, C, D, E or F.\n\nWhen X and Y are seen as hexadecimal numbers, which is larger?\n\nConstraints\n\nEach X and Y is A, B, C, D, E or F.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nIf X is smaller, print <; if Y is smaller, print >; if they are equal, print =.\n\nSample Input 1\n\nA B\n\nSample Output 1\n\n<\n\n10 < 11.\n\nSample Input 2\n\nE C\n\nSample Output 2\n\n>\n\n14 > 12.\n\nSample Input 3\n\nF F\n\nSample Output 3\n\n=\n\n15 = 15.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 213, "cpu_time_ms": 6, "memory_kb": 2764}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s321253659", "group_id": "codeNet:p03549", "input_text": "program ABC078C\n implicit none\n integer(8)::N,M\n read(5,*)N,M\n\n print'(i0)',(1900*M+100*(N-M))*2**M\n\nend program ABC078C", "language": "Fortran", "metadata": {"date": 1576780934, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03549.html", "problem_id": "p03549", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03549/input.txt", "sample_output_relpath": "derived/input_output/data/p03549/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03549/Fortran/s321253659.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s321253659", "user_id": "u414699019"}, "prompt_components": {"gold_output": "3800\n", "input_to_evaluate": "program ABC078C\n implicit none\n integer(8)::N,M\n read(5,*)N,M\n\n print'(i0)',(1900*M+100*(N-M))*2**M\n\nend program ABC078C", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "sample_input": "1 1\n"}, "reference_outputs": ["3800\n"], "source_document_id": "p03549", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 132, "cpu_time_ms": 2, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s030494959", "group_id": "codeNet:p03549", "input_text": "program main\n\timplicit none\n\tinteger n,m,ans\n\tread(*,*)n,m\n\tn=n-m\n\tans=(n*100+m*1900)*2**m\n\twrite(*,*)ans\nend program main\n", "language": "Fortran", "metadata": {"date": 1512851092, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03549.html", "problem_id": "p03549", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03549/input.txt", "sample_output_relpath": "derived/input_output/data/p03549/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03549/Fortran/s030494959.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s030494959", "user_id": "u539011156"}, "prompt_components": {"gold_output": "3800\n", "input_to_evaluate": "program main\n\timplicit none\n\tinteger n,m,ans\n\tread(*,*)n,m\n\tn=n-m\n\tans=(n*100+m*1900)*2**m\n\twrite(*,*)ans\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "sample_input": "1 1\n"}, "reference_outputs": ["3800\n"], "source_document_id": "p03549", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi is now competing in a programming contest, but he received TLE in a problem where the answer is YES or NO.\n\nWhen he checked the detailed status of the submission, there were N test cases in the problem, and the code received TLE in M of those cases.\n\nThen, he rewrote the code to correctly solve each of those M cases with 1/2 probability in 1900 milliseconds, and correctly solve each of the other N-M cases without fail in 100 milliseconds.\n\nNow, he goes through the following process:\n\nSubmit the code.\n\nWait until the code finishes execution on all the cases.\n\nIf the code fails to correctly solve some of the M cases, submit it again.\n\nRepeat until the code correctly solve all the cases in one submission.\n\nLet the expected value of the total execution time of the code be X milliseconds. Print X (as an integer).\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n1 \\leq M \\leq {\\rm min}(N, 5)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint X, the expected value of the total execution time of the code, as an integer. It can be proved that, under the constraints in this problem, X is an integer not exceeding 10^9.\n\nSample Input 1\n\n1 1\n\nSample Output 1\n\n3800\n\nIn this input, there is only one case. Takahashi will repeatedly submit the code that correctly solves this case with 1/2 probability in 1900 milliseconds.\n\nThe code will succeed in one attempt with 1/2 probability, in two attempts with 1/4 probability, and in three attempts with 1/8 probability, and so on.\n\nThus, the answer is 1900 \\times 1/2 + (2 \\times 1900) \\times 1/4 + (3 \\times 1900) \\times 1/8 + ... = 3800.\n\nSample Input 2\n\n10 2\n\nSample Output 2\n\n18400\n\nThe code will take 1900 milliseconds in each of the 2 cases, and 100 milliseconds in each of the 10-2=8 cases. The probability of the code correctly solving all the cases is 1/2 \\times 1/2 = 1/4.\n\nSample Input 3\n\n100 5\n\nSample Output 3\n\n608000", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 123, "cpu_time_ms": 2, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s316800888", "group_id": "codeNet:p03555", "input_text": "program ABC077A\n implicit none\n character(3)::C1,C2\n read(5,*)C1,C2\n\n if(C1(1:1)==C2(3:3) .and. C1(2:2)==C2(2:2) .and. C1(3:3)==C2(1:1))then\n print'(A)',\"YES\"\n else\n print'(A)',\"NO\"\n end if\n \nend program ABC077A", "language": "Fortran", "metadata": {"date": 1576781451, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03555.html", "problem_id": "p03555", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03555/input.txt", "sample_output_relpath": "derived/input_output/data/p03555/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03555/Fortran/s316800888.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s316800888", "user_id": "u414699019"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program ABC077A\n implicit none\n character(3)::C1,C2\n read(5,*)C1,C2\n\n if(C1(1:1)==C2(3:3) .and. C1(2:2)==C2(2:2) .and. C1(3:3)==C2(1:1))then\n print'(A)',\"YES\"\n else\n print'(A)',\"NO\"\n end if\n \nend program ABC077A", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a grid with 2 rows and 3 columns of squares.\nThe color of the square at the i-th row and j-th column is represented by the character C_{ij}.\n\nWrite a program that prints YES if this grid remains the same when rotated 180 degrees, and prints NO otherwise.\n\nConstraints\n\nC_{i,j}(1 \\leq i \\leq 2, 1 \\leq j \\leq 3) is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nC_{11}C_{12}C_{13}\nC_{21}C_{22}C_{23}\n\nOutput\n\nPrint YES if this grid remains the same when rotated 180 degrees; print NO otherwise.\n\nSample Input 1\n\npot\ntop\n\nSample Output 1\n\nYES\n\nThis grid remains the same when rotated 180 degrees.\n\nSample Input 2\n\ntab\nbet\n\nSample Output 2\n\nNO\n\nThis grid does not remain the same when rotated 180 degrees.\n\nSample Input 3\n\neye\neel\n\nSample Output 3\n\nNO", "sample_input": "pot\ntop\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03555", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a grid with 2 rows and 3 columns of squares.\nThe color of the square at the i-th row and j-th column is represented by the character C_{ij}.\n\nWrite a program that prints YES if this grid remains the same when rotated 180 degrees, and prints NO otherwise.\n\nConstraints\n\nC_{i,j}(1 \\leq i \\leq 2, 1 \\leq j \\leq 3) is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nC_{11}C_{12}C_{13}\nC_{21}C_{22}C_{23}\n\nOutput\n\nPrint YES if this grid remains the same when rotated 180 degrees; print NO otherwise.\n\nSample Input 1\n\npot\ntop\n\nSample Output 1\n\nYES\n\nThis grid remains the same when rotated 180 degrees.\n\nSample Input 2\n\ntab\nbet\n\nSample Output 2\n\nNO\n\nThis grid does not remain the same when rotated 180 degrees.\n\nSample Input 3\n\neye\neel\n\nSample Output 3\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 246, "cpu_time_ms": 4, "memory_kb": 512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s287298865", "group_id": "codeNet:p03556", "input_text": "program main\n\tinteger n\n\tread(*,*)n\n\twrite(*,*)(int(sqrt(real(n))))**2\nend program main\n", "language": "Fortran", "metadata": {"date": 1512275788, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03556.html", "problem_id": "p03556", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03556/input.txt", "sample_output_relpath": "derived/input_output/data/p03556/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03556/Fortran/s287298865.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s287298865", "user_id": "u539011156"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program main\n\tinteger n\n\tread(*,*)n\n\twrite(*,*)(int(sqrt(real(n))))**2\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the largest square number not exceeding N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\n10 is not square, but 9 = 3 × 3 is. Thus, we print 9.\n\nSample Input 2\n\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\n271828182\n\nSample Output 3\n\n271821169", "sample_input": "10\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03556", "source_text": "Score : 200 points\n\nProblem Statement\n\nFind the largest square number not exceeding N. Here, a square number is an integer that can be represented as the square of an integer.\n\nConstraints\n\n1 \\leq N \\leq 10^9\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the largest square number not exceeding N.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n9\n\n10 is not square, but 9 = 3 × 3 is. Thus, we print 9.\n\nSample Input 2\n\n81\n\nSample Output 2\n\n81\n\nSample Input 3\n\n271828182\n\nSample Output 3\n\n271821169", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 88, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s719242591", "group_id": "codeNet:p03559", "input_text": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\n\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int64):: n,i,j,ans\n integer(int64), allocatable:: a(:), b(:), c(:)\n integer(int64), allocatable:: ca(:), cb(:)\n\n read*, n\n allocate(a(n), b(n), c(n))\n allocate(ca(0:n), cb(0:n+1), source=0_8)\n read*, a(:)\n read*, b(:)\n read*, c(:)\n\n call merge_sort(a, 1_8, n)\n call merge_sort(b, 1_8, n)\n call merge_sort(c, 1_8, n)\n\n j=1\n cb(0) = n\n do i=1,n\n cb(i) = cb(i-1)\n do while(b(i) >= c(j))\n j=j+1\n cb(i)=cb(i)-1\n if (j > n) exit\n end do\n end do\n j=1\n ca(0)=n\n do i=1,n\n ca(i) = ca(i-1)\n do while(a(i) >= b(j))\n j=j+1\n ca(i)=ca(i)-1\n if (j > n) exit\n end do\n end do\n do i=n-1,1,-1\n cb(i)=cb(i)+cb(i+1)\n end do\n ans=0\n cb(0)=0\n do i=1,n\n ans=ans+cb(n+1-ca(i))\n end do\n print'(i0)', ans\nend program main", "language": "Fortran", "metadata": {"date": 1591591429, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03559.html", "problem_id": "p03559", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03559/input.txt", "sample_output_relpath": "derived/input_output/data/p03559/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03559/Fortran/s719242591.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s719242591", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\n\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\n\nprogram main\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int64):: n,i,j,ans\n integer(int64), allocatable:: a(:), b(:), c(:)\n integer(int64), allocatable:: ca(:), cb(:)\n\n read*, n\n allocate(a(n), b(n), c(n))\n allocate(ca(0:n), cb(0:n+1), source=0_8)\n read*, a(:)\n read*, b(:)\n read*, c(:)\n\n call merge_sort(a, 1_8, n)\n call merge_sort(b, 1_8, n)\n call merge_sort(c, 1_8, n)\n\n j=1\n cb(0) = n\n do i=1,n\n cb(i) = cb(i-1)\n do while(b(i) >= c(j))\n j=j+1\n cb(i)=cb(i)-1\n if (j > n) exit\n end do\n end do\n j=1\n ca(0)=n\n do i=1,n\n ca(i) = ca(i-1)\n do while(a(i) >= b(j))\n j=j+1\n ca(i)=ca(i)-1\n if (j > n) exit\n end do\n end do\n do i=n-1,1,-1\n cb(i)=cb(i)+cb(i+1)\n end do\n ans=0\n cb(0)=0\n do i=1,n\n ans=ans+cb(n+1-ca(i))\n end do\n print'(i0)', ans\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "sample_input": "2\n1 5\n2 4\n3 6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03559", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe season for Snuke Festival has come again this year. First of all, Ringo will perform a ritual to summon Snuke. For the ritual, he needs an altar, which consists of three parts, one in each of the three categories: upper, middle and lower.\n\nHe has N parts for each of the three categories. The size of the i-th upper part is A_i, the size of the i-th middle part is B_i, and the size of the i-th lower part is C_i.\n\nTo build an altar, the size of the middle part must be strictly greater than that of the upper part, and the size of the lower part must be strictly greater than that of the middle part. On the other hand, any three parts that satisfy these conditions can be combined to form an altar.\n\nHow many different altars can Ringo build? Here, two altars are considered different when at least one of the three parts used is different.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq B_i \\leq 10^9(1\\leq i\\leq N)\n\n1 \\leq C_i \\leq 10^9(1\\leq i\\leq N)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 ... A_N\nB_1 ... B_N\nC_1 ... C_N\n\nOutput\n\nPrint the number of different altars that Ringo can build.\n\nSample Input 1\n\n2\n1 5\n2 4\n3 6\n\nSample Output 1\n\n3\n\nThe following three altars can be built:\n\nUpper: 1-st part, Middle: 1-st part, Lower: 1-st part\n\nUpper: 1-st part, Middle: 1-st part, Lower: 2-nd part\n\nUpper: 1-st part, Middle: 2-nd part, Lower: 2-nd part\n\nSample Input 2\n\n3\n1 1 1\n2 2 2\n3 3 3\n\nSample Output 2\n\n27\n\nSample Input 3\n\n6\n3 14 159 2 6 53\n58 9 79 323 84 6\n2643 383 2 79 50 288\n\nSample Output 3\n\n87", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 7159, "cpu_time_ms": 146, "memory_kb": 6196}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s341866178", "group_id": "codeNet:p03563", "input_text": "program main\n\timplicit none\n integer::a,b\n read(*,*)a\n read(*,*)b\n write(*,*) 2*b-a\n stop\nend program main", "language": "Fortran", "metadata": {"date": 1592634290, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03563.html", "problem_id": "p03563", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03563/input.txt", "sample_output_relpath": "derived/input_output/data/p03563/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03563/Fortran/s341866178.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s341866178", "user_id": "u884601206"}, "prompt_components": {"gold_output": "2032\n", "input_to_evaluate": "program main\n\timplicit none\n integer::a,b\n read(*,*)a\n read(*,*)b\n write(*,*) 2*b-a\n stop\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a user of a site that hosts programming contests.\n\nWhen a user competes in a contest, the rating of the user (not necessarily an integer) changes according to the performance of the user, as follows:\n\nLet the current rating of the user be a.\n\nSuppose that the performance of the user in the contest is b.\n\nThen, the new rating of the user will be the avarage of a and b.\n\nFor example, if a user with rating 1 competes in a contest and gives performance 1000, his/her new rating will be 500.5, the average of 1 and 1000.\n\nTakahashi's current rating is R, and he wants his rating to be exactly G after the next contest.\n\nFind the performance required to achieve it.\n\nConstraints\n\n0 \\leq R, G \\leq 4500\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\nG\n\nOutput\n\nPrint the performance required to achieve the objective.\n\nSample Input 1\n\n2002\n2017\n\nSample Output 1\n\n2032\n\nTakahashi's current rating is 2002.\n\nIf his performance in the contest is 2032, his rating will be the average of 2002 and 2032, which is equal to the desired rating, 2017.\n\nSample Input 2\n\n4500\n0\n\nSample Output 2\n\n-4500\n\nAlthough the current and desired ratings are between 0 and 4500, the performance of a user can be below 0.", "sample_input": "2002\n2017\n"}, "reference_outputs": ["2032\n"], "source_document_id": "p03563", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is a user of a site that hosts programming contests.\n\nWhen a user competes in a contest, the rating of the user (not necessarily an integer) changes according to the performance of the user, as follows:\n\nLet the current rating of the user be a.\n\nSuppose that the performance of the user in the contest is b.\n\nThen, the new rating of the user will be the avarage of a and b.\n\nFor example, if a user with rating 1 competes in a contest and gives performance 1000, his/her new rating will be 500.5, the average of 1 and 1000.\n\nTakahashi's current rating is R, and he wants his rating to be exactly G after the next contest.\n\nFind the performance required to achieve it.\n\nConstraints\n\n0 \\leq R, G \\leq 4500\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nR\nG\n\nOutput\n\nPrint the performance required to achieve the objective.\n\nSample Input 1\n\n2002\n2017\n\nSample Output 1\n\n2032\n\nTakahashi's current rating is 2002.\n\nIf his performance in the contest is 2032, his rating will be the average of 2002 and 2032, which is equal to the desired rating, 2017.\n\nSample Input 2\n\n4500\n0\n\nSample Output 2\n\n-4500\n\nAlthough the current and desired ratings are between 0 and 4500, the performance of a user can be below 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 3, "memory_kb": 2724}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s336845743", "group_id": "codeNet:p03564", "input_text": "program name\n\n implicit none\n integer N,K,num,i\n read*, N\n read*, K\n num = 1\n do i = 1, N, 1\n if ( numa+k)then\n\t\t\ta=a+k\n\t\telse\n\t\t\ta=a*2\n\t\tendif\n\tenddo\n\twrite(*,*)a\nend program main\n", "language": "Fortran", "metadata": {"date": 1510795316, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03564.html", "problem_id": "p03564", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03564/input.txt", "sample_output_relpath": "derived/input_output/data/p03564/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03564/Fortran/s882445835.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s882445835", "user_id": "u539011156"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main\n\timplicit none\n\tinteger n,k\n\tinteger ::i,a=1\n\tread(*,*)n,k\n\tdo i=1,n\n\t\tif(a*2>a+k)then\n\t\t\ta=a+k\n\t\telse\n\t\t\ta=a*2\n\t\tendif\n\tenddo\n\twrite(*,*)a\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSquare1001 has seen an electric bulletin board displaying the integer 1.\nHe can perform the following operations A and B to change this value:\n\nOperation A: The displayed value is doubled.\n\nOperation B: The displayed value increases by K.\n\nSquare1001 needs to perform these operations N times in total.\nFind the minimum possible value displayed in the board after N operations.\n\nConstraints\n\n1 \\leq N, K \\leq 10\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the minimum possible value displayed in the board after N operations.\n\nSample Input 1\n\n4\n3\n\nSample Output 1\n\n10\n\nThe value will be minimized when the operations are performed in the following order: A, A, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 7 → 10.\n\nSample Input 2\n\n10\n10\n\nSample Output 2\n\n76\n\nThe value will be minimized when the operations are performed in the following order: A, A, A, A, B, B, B, B, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 8 → 16 → 26 → 36 → 46 → 56 → 66 → 76.\n\nBy the way, this contest is AtCoder Beginner Contest 076.", "sample_input": "4\n3\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03564", "source_text": "Score : 200 points\n\nProblem Statement\n\nSquare1001 has seen an electric bulletin board displaying the integer 1.\nHe can perform the following operations A and B to change this value:\n\nOperation A: The displayed value is doubled.\n\nOperation B: The displayed value increases by K.\n\nSquare1001 needs to perform these operations N times in total.\nFind the minimum possible value displayed in the board after N operations.\n\nConstraints\n\n1 \\leq N, K \\leq 10\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the minimum possible value displayed in the board after N operations.\n\nSample Input 1\n\n4\n3\n\nSample Output 1\n\n10\n\nThe value will be minimized when the operations are performed in the following order: A, A, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 7 → 10.\n\nSample Input 2\n\n10\n10\n\nSample Output 2\n\n76\n\nThe value will be minimized when the operations are performed in the following order: A, A, A, A, B, B, B, B, B, B.\n\nIn this case, the value will change as follows: 1 → 2 → 4 → 8 → 16 → 26 → 36 → 46 → 56 → 66 → 76.\n\nBy the way, this contest is AtCoder Beginner Contest 076.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 170, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s365247379", "group_id": "codeNet:p03569", "input_text": "program code_festival_2017_qualc_c\n use,intrinsic :: iso_fortran_env\n implicit none\n character(100000):: s, nox_s\n integer(int32):: ls, lnxs,i,j,ans\n\n read*, s\n ls = len_trim(s)\n nox_s = ''\n do i=1,ls\n if (s(i:i) == 'x') cycle\n nox_s = trim(nox_s) // s(i:i)\n end do\n lnxs = len_trim(nox_s)\n i=1\n j=lnxs\n\n do while(i <= j)\n if (nox_s(i:i) /= nox_s(j:j)) then\n print'(i0)', -1\n stop\n end if\n i=i+1\n j=j-1\n end do\n\n ans=0\n i=1\n j=ls\n do while(i <= j)\n if (s(i:i) == s(j:j)) then\n i=i+1\n j=j-1\n cycle\n else if (s(i:i) == 'x') then\n ans=ans+1\n i=i+1\n else\n j=j-1\n ans=ans+1\n end if\n end do\n print'(i0)', ans\nend program code_festival_2017_qualc_c", "language": "Fortran", "metadata": {"date": 1591294090, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03569.html", "problem_id": "p03569", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03569/input.txt", "sample_output_relpath": "derived/input_output/data/p03569/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03569/Fortran/s365247379.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s365247379", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program code_festival_2017_qualc_c\n use,intrinsic :: iso_fortran_env\n implicit none\n character(100000):: s, nox_s\n integer(int32):: ls, lnxs,i,j,ans\n\n read*, s\n ls = len_trim(s)\n nox_s = ''\n do i=1,ls\n if (s(i:i) == 'x') cycle\n nox_s = trim(nox_s) // s(i:i)\n end do\n lnxs = len_trim(nox_s)\n i=1\n j=lnxs\n\n do while(i <= j)\n if (nox_s(i:i) /= nox_s(j:j)) then\n print'(i0)', -1\n stop\n end if\n i=i+1\n j=j-1\n end do\n\n ans=0\n i=1\n j=ls\n do while(i <= j)\n if (s(i:i) == s(j:j)) then\n i=i+1\n j=j-1\n cycle\n else if (s(i:i) == 'x') then\n ans=ans+1\n i=i+1\n else\n j=j-1\n ans=ans+1\n end if\n end do\n print'(i0)', ans\nend program code_festival_2017_qualc_c", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke can perform the following operation repeatedly:\n\nInsert a letter x to any position in s of his choice, including the beginning and end of s.\n\nSnuke's objective is to turn s into a palindrome.\nDetermine whether the objective is achievable. If it is achievable, find the minimum number of operations required.\n\nNotes\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are palindromes, while ab, abab and abcda are not.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf the objective is achievable, print the number of operations required.\nIf it is not, print -1 instead.\n\nSample Input 1\n\nxabxa\n\nSample Output 1\n\n2\n\nOne solution is as follows (newly inserted x are shown in bold):\n\nxabxa → xaxbxa → xaxbxax\n\nSample Input 2\n\nab\n\nSample Output 2\n\n-1\n\nNo sequence of operations can turn s into a palindrome.\n\nSample Input 3\n\na\n\nSample Output 3\n\n0\n\ns is a palindrome already at the beginning.\n\nSample Input 4\n\noxxx\n\nSample Output 4\n\n3\n\nOne solution is as follows:\n\noxxx → xoxxx → xxoxxx → xxxoxxx", "sample_input": "xabxa\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03569", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a string s consisting of lowercase English letters.\nSnuke can perform the following operation repeatedly:\n\nInsert a letter x to any position in s of his choice, including the beginning and end of s.\n\nSnuke's objective is to turn s into a palindrome.\nDetermine whether the objective is achievable. If it is achievable, find the minimum number of operations required.\n\nNotes\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are palindromes, while ab, abab and abcda are not.\n\nConstraints\n\n1 \\leq |s| \\leq 10^5\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf the objective is achievable, print the number of operations required.\nIf it is not, print -1 instead.\n\nSample Input 1\n\nxabxa\n\nSample Output 1\n\n2\n\nOne solution is as follows (newly inserted x are shown in bold):\n\nxabxa → xaxbxa → xaxbxax\n\nSample Input 2\n\nab\n\nSample Output 2\n\n-1\n\nNo sequence of operations can turn s into a palindrome.\n\nSample Input 3\n\na\n\nSample Output 3\n\n0\n\ns is a palindrome already at the beginning.\n\nSample Input 4\n\noxxx\n\nSample Output 4\n\n3\n\nOne solution is as follows:\n\noxxx → xoxxx → xxoxxx → xxxoxxx", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 870, "cpu_time_ms": 1017, "memory_kb": 8744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s980939504", "group_id": "codeNet:p03573", "input_text": "integer a,b,c\nread*,a,b,c\nif(a==b)then\n\tprint\"(i0)\",c\nelse if(b==c)then\n\tprint\"(i0)\",a\nelse\n\tprint\"(i0)\",b\nendif\nend", "language": "Fortran", "metadata": {"date": 1551426176, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03573.html", "problem_id": "p03573", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03573/input.txt", "sample_output_relpath": "derived/input_output/data/p03573/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03573/Fortran/s980939504.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s980939504", "user_id": "u598073939"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "integer a,b,c\nread*,a,b,c\nif(a==b)then\n\tprint\"(i0)\",c\nelse if(b==c)then\n\tprint\"(i0)\",a\nelse\n\tprint\"(i0)\",b\nendif\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers, A, B and C.\n\nAmong them, two are the same, but the remaining one is different from the rest.\n\nFor example, when A=5,B=7,C=5, A and C are the same, but B is different.\n\nFind the one that is different from the rest among the given three integers.\n\nConstraints\n\n-100 \\leq A,B,C \\leq 100\n\nA, B and C are integers.\n\nThe input satisfies the condition in the statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nAmong A, B and C, print the integer that is different from the rest.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\n7\n\nThis is the same case as the one in the statement.\n\nSample Input 2\n\n1 1 7\n\nSample Output 2\n\n7\n\nIn this case, C is the one we seek.\n\nSample Input 3\n\n-100 100 100\n\nSample Output 3\n\n-100", "sample_input": "5 7 5\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03573", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers, A, B and C.\n\nAmong them, two are the same, but the remaining one is different from the rest.\n\nFor example, when A=5,B=7,C=5, A and C are the same, but B is different.\n\nFind the one that is different from the rest among the given three integers.\n\nConstraints\n\n-100 \\leq A,B,C \\leq 100\n\nA, B and C are integers.\n\nThe input satisfies the condition in the statement.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nAmong A, B and C, print the integer that is different from the rest.\n\nSample Input 1\n\n5 7 5\n\nSample Output 1\n\n7\n\nThis is the same case as the one in the statement.\n\nSample Input 2\n\n1 1 7\n\nSample Output 2\n\n7\n\nIn this case, C is the one we seek.\n\nSample Input 3\n\n-100 100 100\n\nSample Output 3\n\n-100", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 116, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s627545181", "group_id": "codeNet:p03575", "input_text": "program prob5\n implicit none\n integer, allocatable::c(:,:), dist(:), cnt(:), ct(:,:), disted(:), ans(:,:)\n integer::n, m, i, j, k, a, b\n read(*,*) n, m\n allocate(c(n,n),dist(n),cnt(n),ct(n,n),disted(n),ans(n,n))\n c = 0\n do i = 1, m\n read(*,*) a, b\n c(a,b) = 1\n c(b,a) = 1\n end do\n ans = c\n do i = 1, n\n dist = 0\n disted = 0\n disted(i) = 1\n cnt = 0\n ct = c\n do j = 1, n\n if(ct(i,j) == 1) then\n dist(j) = 1\n cnt(j) = 1\n ct(i,j) = 0\n ct(j,i) = 0\n disted(j) = 1\n end if\n end do\n do while(sum(ct) > 0)\n do j = 1, n\n if(dist(j) == 1) then\n do k = 1, n\n if(ct(j,k) == 1) then\n dist(k) = 1\n if(cnt(k) > 0) then\n ans(j,k) = 0\n ans(k,j) = 0\n end if\n disted(k) = 1\n cnt(k) = cnt(k) + 1\n ct(j,k) = 0\n ct(k,j) = 0\n end if\n end do\n end if\n dist(j) = 0\n end do\n write(*,*) cnt\n end do\n end do\n write(*,*) sum(ans)/2\n stop\nend program", "language": "Fortran", "metadata": {"date": 1598065965, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03575.html", "problem_id": "p03575", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03575/input.txt", "sample_output_relpath": "derived/input_output/data/p03575/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03575/Fortran/s627545181.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s627545181", "user_id": "u841856382"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program prob5\n implicit none\n integer, allocatable::c(:,:), dist(:), cnt(:), ct(:,:), disted(:), ans(:,:)\n integer::n, m, i, j, k, a, b\n read(*,*) n, m\n allocate(c(n,n),dist(n),cnt(n),ct(n,n),disted(n),ans(n,n))\n c = 0\n do i = 1, m\n read(*,*) a, b\n c(a,b) = 1\n c(b,a) = 1\n end do\n ans = c\n do i = 1, n\n dist = 0\n disted = 0\n disted(i) = 1\n cnt = 0\n ct = c\n do j = 1, n\n if(ct(i,j) == 1) then\n dist(j) = 1\n cnt(j) = 1\n ct(i,j) = 0\n ct(j,i) = 0\n disted(j) = 1\n end if\n end do\n do while(sum(ct) > 0)\n do j = 1, n\n if(dist(j) == 1) then\n do k = 1, n\n if(ct(j,k) == 1) then\n dist(k) = 1\n if(cnt(k) > 0) then\n ans(j,k) = 0\n ans(k,j) = 0\n end if\n disted(k) = 1\n cnt(k) = cnt(k) + 1\n ct(j,k) = 0\n ct(k,j) = 0\n end if\n end do\n end if\n dist(j) = 0\n end do\n write(*,*) cnt\n end do\n end do\n write(*,*) sum(ans)/2\n stop\nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an undirected connected graph with N vertices and M edges that does not contain self-loops and double edges.\n\nThe i-th edge (1 \\leq i \\leq M) connects Vertex a_i and Vertex b_i.\n\nAn edge whose removal disconnects the graph is called a bridge.\n\nFind the number of the edges that are bridges among the M edges.\n\nNotes\n\nA self-loop is an edge i such that a_i=b_i (1 \\leq i \\leq M).\n\nDouble edges are a pair of edges i,j such that a_i=a_j and b_i=b_j (1 \\leq i=noudo) then\n noudo=Li\n youeki=S\n yousitu=T\n endif\n endif\n\nend do\nend do\nend do\nend do\n\nwrite(6,'(i0,\" \"i0)') int(youeki),int(yousitu)\nend \n", "language": "Fortran", "metadata": {"date": 1505925717, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03599.html", "problem_id": "p03599", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03599/input.txt", "sample_output_relpath": "derived/input_output/data/p03599/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03599/Fortran/s750056902.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s750056902", "user_id": "u909643606"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "implicit none\ninteger :: a,b,c,d,e,f,n_a,i,j,k,l,S\ndouble precision :: youeki, yousitu,noudo,Li,T\n\nread(5,*) a,b,c,d,e,f\nyoueki=0\nyousitu=0\nnoudo=0\nn_a=int(f/(100*a))\n\ndo i=0, 3+n_a\ndo j=0, 3+int((f-100*i*a)/(100*b))\ndo k=0, 3+int((f-100*i*a-100*j*b-k*c)/d)\ndo l=0, 3+int((f-100*i*a-100*j*b-k*c)/d)\n S=100*a*i+100*b*j+c*k+d*l\n T=c*k+d*l\n if (S/=0) then\n Li=100.0*T/S\n if (S<=f .and. Li<=100.0*e/(100.0+e) .and. Li>=noudo) then\n noudo=Li\n youeki=S\n yousitu=T\n endif\n endif\n\nend do\nend do\nend do\nend do\n\nwrite(6,'(i0,\" \"i0)') int(youeki),int(yousitu)\nend \n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "sample_input": "1 2 10 20 15 200\n"}, "reference_outputs": ["110 10\n"], "source_document_id": "p03599", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke is making sugar water in a beaker.\nInitially, the beaker is empty. Snuke can perform the following four types of operations any number of times. He may choose not to perform some types of operations.\n\nOperation 1: Pour 100A grams of water into the beaker.\n\nOperation 2: Pour 100B grams of water into the beaker.\n\nOperation 3: Put C grams of sugar into the beaker.\n\nOperation 4: Put D grams of sugar into the beaker.\n\nIn our experimental environment, E grams of sugar can dissolve into 100 grams of water.\n\nSnuke will make sugar water with the highest possible density.\n\nThe beaker can contain at most F grams of substances (water and sugar combined), and there must not be any undissolved sugar in the beaker.\nFind the mass of the sugar water Snuke will make, and the mass of sugar dissolved in it.\nIf there is more than one candidate, any of them will be accepted.\n\nWe remind you that the sugar water that contains a grams of water and b grams of sugar is \\frac{100b}{a + b} percent.\nAlso, in this problem, pure water that does not contain any sugar is regarded as 0 percent density sugar water.\n\nConstraints\n\n1 \\leq A < B \\leq 30\n\n1 \\leq C < D \\leq 30\n\n1 \\leq E \\leq 100\n\n100A \\leq F \\leq 3 000\n\nA, B, C, D, E and F are all integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nA B C D E F\n\nOutputs\n\nPrint two integers separated by a space.\nThe first integer should be the mass of the desired sugar water, and the second should be the mass of the sugar dissolved in it.\n\nSample Input 1\n\n1 2 10 20 15 200\n\nSample Output 1\n\n110 10\n\nIn this environment, 15 grams of sugar can dissolve into 100 grams of water, and the beaker can contain at most 200 grams of substances.\n\nWe can make 110 grams of sugar water by performing Operation 1 once and Operation 3 once.\nIt is not possible to make sugar water with higher density.\nFor example, the following sequences of operations are infeasible:\n\nIf we perform Operation 1 once and Operation 4 once, there will be undissolved sugar in the beaker.\n\nIf we perform Operation 2 once and Operation 3 three times, the mass of substances in the beaker will exceed 200 grams.\n\nSample Input 2\n\n1 2 1 2 100 1000\n\nSample Output 2\n\n200 100\n\nThere are other acceptable outputs, such as:\n\n400 200\n\nHowever, the output below is not acceptable:\n\n300 150\n\nThis is because, in order to make 300 grams of sugar water containing 150 grams of sugar, we need to pour exactly 150 grams of water into the beaker, which is impossible.\n\nSample Input 3\n\n17 19 22 26 55 2802\n\nSample Output 3\n\n2634 934", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 614, "cpu_time_ms": 9, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s832647239", "group_id": "codeNet:p03605", "input_text": "program ABC073A\n implicit none\n integer(8)::N\n read(5,*)N\n\n if(N/10==9.or.mod(N,10)==9)then\n print'(A)',\"Yes\"\n else\n print'(A)',\"No\"\n end if\nend program ABC073A", "language": "Fortran", "metadata": {"date": 1578993499, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03605.html", "problem_id": "p03605", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03605/input.txt", "sample_output_relpath": "derived/input_output/data/p03605/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03605/Fortran/s832647239.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s832647239", "user_id": "u414699019"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program ABC073A\n implicit none\n integer(8)::N\n read(5,*)N\n\n if(N/10==9.or.mod(N,10)==9)then\n print'(A)',\"Yes\"\n else\n print'(A)',\"No\"\n end if\nend program ABC073A", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIt is September 9 in Japan now.\n\nYou are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?\n\nConstraints\n\n10≤N≤99\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf 9 is contained in the decimal notation of N, print Yes; if not, print No.\n\nSample Input 1\n\n29\n\nSample Output 1\n\nYes\n\nThe one's digit of 29 is 9.\n\nSample Input 2\n\n72\n\nSample Output 2\n\nNo\n\n72 does not contain 9.\n\nSample Input 3\n\n91\n\nSample Output 3\n\nYes", "sample_input": "29\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03605", "source_text": "Score : 100 points\n\nProblem Statement\n\nIt is September 9 in Japan now.\n\nYou are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?\n\nConstraints\n\n10≤N≤99\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf 9 is contained in the decimal notation of N, print Yes; if not, print No.\n\nSample Input 1\n\n29\n\nSample Output 1\n\nYes\n\nThe one's digit of 29 is 9.\n\nSample Input 2\n\n72\n\nSample Output 2\n\nNo\n\n72 does not contain 9.\n\nSample Input 3\n\n91\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 192, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s131161722", "group_id": "codeNet:p03605", "input_text": "character a*2\nread*, a\nif(a(1:1)=='9' .or. a(2:2)=='9') then\n\tprint*, 'Yes'\nelse\n\tprint*, 'No'\nend if\nend", "language": "Fortran", "metadata": {"date": 1571884770, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03605.html", "problem_id": "p03605", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03605/input.txt", "sample_output_relpath": "derived/input_output/data/p03605/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03605/Fortran/s131161722.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s131161722", "user_id": "u244203620"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "character a*2\nread*, a\nif(a(1:1)=='9' .or. a(2:2)=='9') then\n\tprint*, 'Yes'\nelse\n\tprint*, 'No'\nend if\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIt is September 9 in Japan now.\n\nYou are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?\n\nConstraints\n\n10≤N≤99\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf 9 is contained in the decimal notation of N, print Yes; if not, print No.\n\nSample Input 1\n\n29\n\nSample Output 1\n\nYes\n\nThe one's digit of 29 is 9.\n\nSample Input 2\n\n72\n\nSample Output 2\n\nNo\n\n72 does not contain 9.\n\nSample Input 3\n\n91\n\nSample Output 3\n\nYes", "sample_input": "29\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03605", "source_text": "Score : 100 points\n\nProblem Statement\n\nIt is September 9 in Japan now.\n\nYou are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?\n\nConstraints\n\n10≤N≤99\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf 9 is contained in the decimal notation of N, print Yes; if not, print No.\n\nSample Input 1\n\n29\n\nSample Output 1\n\nYes\n\nThe one's digit of 29 is 9.\n\nSample Input 2\n\n72\n\nSample Output 2\n\nNo\n\n72 does not contain 9.\n\nSample Input 3\n\n91\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 105, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s317879844", "group_id": "codeNet:p03605", "input_text": "read*,i;print*,merge(\"Yes\",\" No\",mod(i,10)==9.or.i/10==0);end", "language": "Fortran", "metadata": {"date": 1556391102, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03605.html", "problem_id": "p03605", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03605/input.txt", "sample_output_relpath": "derived/input_output/data/p03605/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03605/Fortran/s317879844.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s317879844", "user_id": "u394482932"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "read*,i;print*,merge(\"Yes\",\" No\",mod(i,10)==9.or.i/10==0);end", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIt is September 9 in Japan now.\n\nYou are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?\n\nConstraints\n\n10≤N≤99\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf 9 is contained in the decimal notation of N, print Yes; if not, print No.\n\nSample Input 1\n\n29\n\nSample Output 1\n\nYes\n\nThe one's digit of 29 is 9.\n\nSample Input 2\n\n72\n\nSample Output 2\n\nNo\n\n72 does not contain 9.\n\nSample Input 3\n\n91\n\nSample Output 3\n\nYes", "sample_input": "29\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03605", "source_text": "Score : 100 points\n\nProblem Statement\n\nIt is September 9 in Japan now.\n\nYou are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?\n\nConstraints\n\n10≤N≤99\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf 9 is contained in the decimal notation of N, print Yes; if not, print No.\n\nSample Input 1\n\n29\n\nSample Output 1\n\nYes\n\nThe one's digit of 29 is 9.\n\nSample Input 2\n\n72\n\nSample Output 2\n\nNo\n\n72 does not contain 9.\n\nSample Input 3\n\n91\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 61, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s043107220", "group_id": "codeNet:p03605", "input_text": "program main\n\timplicit none\n\tinteger n,modn\n\tread(*,*)n\n\tmodn=mod(n,10)\n\tn=n-modn\n\tif(n==90 .or. modn==9)then\n\t\twrite(*,\"(a3)\")\"YES\"\n\telse\n\t\twrite(*,\"(a2)\")\"NO\"\n\tendif\nend program main\n", "language": "Fortran", "metadata": {"date": 1505426196, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03605.html", "problem_id": "p03605", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03605/input.txt", "sample_output_relpath": "derived/input_output/data/p03605/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03605/Fortran/s043107220.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s043107220", "user_id": "u539011156"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n\timplicit none\n\tinteger n,modn\n\tread(*,*)n\n\tmodn=mod(n,10)\n\tn=n-modn\n\tif(n==90 .or. modn==9)then\n\t\twrite(*,\"(a3)\")\"YES\"\n\telse\n\t\twrite(*,\"(a2)\")\"NO\"\n\tendif\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIt is September 9 in Japan now.\n\nYou are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?\n\nConstraints\n\n10≤N≤99\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf 9 is contained in the decimal notation of N, print Yes; if not, print No.\n\nSample Input 1\n\n29\n\nSample Output 1\n\nYes\n\nThe one's digit of 29 is 9.\n\nSample Input 2\n\n72\n\nSample Output 2\n\nNo\n\n72 does not contain 9.\n\nSample Input 3\n\n91\n\nSample Output 3\n\nYes", "sample_input": "29\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03605", "source_text": "Score : 100 points\n\nProblem Statement\n\nIt is September 9 in Japan now.\n\nYou are given a two-digit integer N. Answer the question: Is 9 contained in the decimal notation of N?\n\nConstraints\n\n10≤N≤99\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf 9 is contained in the decimal notation of N, print Yes; if not, print No.\n\nSample Input 1\n\n29\n\nSample Output 1\n\nYes\n\nThe one's digit of 29 is 9.\n\nSample Input 2\n\n72\n\nSample Output 2\n\nNo\n\n72 does not contain 9.\n\nSample Input 3\n\n91\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 185, "cpu_time_ms": 6, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s392308065", "group_id": "codeNet:p03607", "input_text": "program sample\n implicit none\n \n integer(8) :: i,j,m,n,b\n integer(8),allocatable :: a(:),y(:)\n \n read(*,*) n\n allocate(a(n))\n do i=1,n\n read(*,*)a(i)\n end do\n call msort(a)\n b=0\n m=0\n do i=1,n-1\n if(a(i)==a(i+1))then\n a(i)=0\n a(i+1)=0\n \n else if(a(i)==0)then\n cycle\n else\n m=m+1\n end if\n end do\n if (a(n)/=0)then\n m=m+1\n end if\n \n write(*,*)m\n stop\n contains\n\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n \n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n \n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n \n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n \n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n \n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n \n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1594596618, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Fortran/s392308065.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s392308065", "user_id": "u713568912"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program sample\n implicit none\n \n integer(8) :: i,j,m,n,b\n integer(8),allocatable :: a(:),y(:)\n \n read(*,*) n\n allocate(a(n))\n do i=1,n\n read(*,*)a(i)\n end do\n call msort(a)\n b=0\n m=0\n do i=1,n-1\n if(a(i)==a(i+1))then\n a(i)=0\n a(i+1)=0\n \n else if(a(i)==0)then\n cycle\n else\n m=m+1\n end if\n end do\n if (a(n)/=0)then\n m=m+1\n end if\n \n write(*,*)m\n stop\n contains\n\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n \n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n \n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n \n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n \n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n \n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n \n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\nend program sample\n \n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1797, "cpu_time_ms": 59, "memory_kb": 4384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s193504871", "group_id": "codeNet:p03607", "input_text": "program sample\n implicit none\n \n integer(8) :: i,j,m,n,b\n integer(8),allocatable :: a(:),y(:)\n \n read(*,*) n\n allocate(a(n))\n do i=1,n\n read(*,*)a(i)\n end do\n call msort(a)\n b=0\n m=0\n do i=1,n-1\n if(a(i)==a(i+1))then\n a(i)=0\n a(i+1)=0\n \n else if(a(i)==0)then\n cycle\n else\n m=m+1\n end if\n end do\n write(*,*)m\n stop\n contains\n\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n \n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n \n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n \n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n \n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n \n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n \n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1594596254, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Fortran/s193504871.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s193504871", "user_id": "u713568912"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program sample\n implicit none\n \n integer(8) :: i,j,m,n,b\n integer(8),allocatable :: a(:),y(:)\n \n read(*,*) n\n allocate(a(n))\n do i=1,n\n read(*,*)a(i)\n end do\n call msort(a)\n b=0\n m=0\n do i=1,n-1\n if(a(i)==a(i+1))then\n a(i)=0\n a(i+1)=0\n \n else if(a(i)==0)then\n cycle\n else\n m=m+1\n end if\n end do\n write(*,*)m\n stop\n contains\n\n recursive subroutine msort(x)\n implicit none\n integer(8), intent(inout) :: x(:)\n \n integer(8) :: n, mid, i, j, k\n integer(8), allocatable :: tmp(:)\n \n n = size(x)\n \n if(n == 1) then\n return\n end if\n \n !\n ! 前半と後半に分けてソート\n ! 1~midとmid+1~nをそれぞれソート済みにする\n !\n mid = n / 2\n call msort(x(:mid))\n call msort(x(mid+1:))\n \n !\n ! tmpという配列にxを一時的に保管\n ! マージソートは外部ソート\n !\n allocate(tmp(n))\n tmp = x\n \n ! tmpの後半部分を左右反転\n do k = n, mid+1, -1\n tmp(k) = x(mid + n - k + 1)\n end do\n \n ! iは前半のリストのうちまだ見ていないものの最小値\n ! jは後半のリストのうちまだ見ていないものの最小値\n ! kは見た回数の合計\n i = 1\n j = n\n \n do k = 1, n\n !\n ! 一番左と一番右のうち小さい方をxに入れていく\n ! ここが等号つき不等号なので、安定ソートとなる\n !\n if(tmp(i) <= tmp(j)) then\n x(k) = tmp(i)\n i = i + 1\n else\n x(k) = tmp(j)\n j = j - 1\n end if\n end do\n \n deallocate(tmp)\n return\n end subroutine msort\nend program sample\n \n\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1746, "cpu_time_ms": 58, "memory_kb": 4384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s390067571", "group_id": "codeNet:p03607", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,i,c,ans,na\n integer(int32), allocatable:: a(:)\n read*, n\n allocate(a(n))\n do i=1,n\n read*, a(i)\n end do\n\n call merge_sort(a,1,n)\n na=0\n c=0\n ans=0\n do i=1,n\n if (na == a(i)) then\n c=c+1\n else\n ans=ans+and(c,1)\n c=1\n na=a(i)\n end if\n end do\n print*, ans\n\n \ncontains\n recursive subroutine merge_sort(ar, fst, lst)\n integer(4),intent(inout):: ar(:)\n integer(4),intent(in):: fst,lst\n integer(4):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call merge_sort(ar, fst, mdl)\n call merge_sort(ar, mdl+1, lst)\n call merge_(ar, fst, mdl, lst)\n end subroutine\n\n subroutine merge_(ar, fst, mdl, lst)\n integer(4),intent(inout):: ar(:)\n integer(4),intent(in):: fst, mdl, lst\n integer(4),allocatable:: tmp(:)\n integer(4):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n subroutine swap(x,y)\n integer(4),intent(inout):: x,y\n integer(4):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\nend program name", "language": "Fortran", "metadata": {"date": 1586818410, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Fortran/s390067571.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s390067571", "user_id": "u234636620"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,i,c,ans,na\n integer(int32), allocatable:: a(:)\n read*, n\n allocate(a(n))\n do i=1,n\n read*, a(i)\n end do\n\n call merge_sort(a,1,n)\n na=0\n c=0\n ans=0\n do i=1,n\n if (na == a(i)) then\n c=c+1\n else\n ans=ans+and(c,1)\n c=1\n na=a(i)\n end if\n end do\n print*, ans\n\n \ncontains\n recursive subroutine merge_sort(ar, fst, lst)\n integer(4),intent(inout):: ar(:)\n integer(4),intent(in):: fst,lst\n integer(4):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call merge_sort(ar, fst, mdl)\n call merge_sort(ar, mdl+1, lst)\n call merge_(ar, fst, mdl, lst)\n end subroutine\n\n subroutine merge_(ar, fst, mdl, lst)\n integer(4),intent(inout):: ar(:)\n integer(4),intent(in):: fst, mdl, lst\n integer(4),allocatable:: tmp(:)\n integer(4):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n subroutine swap(x,y)\n integer(4),intent(inout):: x,y\n integer(4):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\nend program name", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1836, "cpu_time_ms": 58, "memory_kb": 1468}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s055383709", "group_id": "codeNet:p03607", "input_text": "program main\nimplicit none\ninteger :: i, j, k\ninteger :: n\ninteger , allocatable :: a(:), b(:)\n\nread(*,*) n\nallocate( a(n) )\ndo i = 1 ,n\n read(*,*) a(i)\nend do\ncall heapsort( n , a )\nj = 1\nk = 0\ndo i = 2, n\n if( a(i-1) /= a(i) ) then\n if( mod(j,2) == 1 ) then\n k = k + 1\n end if\n j = 0\n end if\n j = j+1\nend do\nif( mod(j,2) == 1 ) then\n k = k+1\nend if\nwrite(*,'(i0)') k\nstop\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n integer :: t\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n end do\nend subroutine heapsort\nend program main\n", "language": "Fortran", "metadata": {"date": 1563315685, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Fortran/s055383709.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s055383709", "user_id": "u696547932"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: i, j, k\ninteger :: n\ninteger , allocatable :: a(:), b(:)\n\nread(*,*) n\nallocate( a(n) )\ndo i = 1 ,n\n read(*,*) a(i)\nend do\ncall heapsort( n , a )\nj = 1\nk = 0\ndo i = 2, n\n if( a(i-1) /= a(i) ) then\n if( mod(j,2) == 1 ) then\n k = k + 1\n end if\n j = 0\n end if\n j = j+1\nend do\nif( mod(j,2) == 1 ) then\n k = k+1\nend if\nwrite(*,'(i0)') k\nstop\ncontains\nsubroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n integer :: t\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n end if\n end if\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n end if\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n end if\n end do\n array(i)=t\n end do\nend subroutine heapsort\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1148, "cpu_time_ms": 54, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s007886609", "group_id": "codeNet:p03607", "input_text": "program main\nimplicit none\ninteger :: i, j, k\ninteger :: n\ninteger , allocatable :: a(:), b(:)\n\nread(*,*) n\nallocate( a(n), b(n) )\nb(1) = 0\ndo i = 1, n\n read(*,*) a(i)\n k = 1\n do j = 1, i\n if( a(i) == b(j) ) then\n k = 0\n b(j) = 0\n end if\n end do\n if( k == 1 ) then\n b(i) = a(i)\n else\n b(i) = 0\n end if\nend do\nj = 0\ndo i = 1, n\n if( b(i) /= 0 ) then\n j = j + 1\n end if \nend do\nwrite(*,'(i0)') j\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1563314563, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Fortran/s007886609.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s007886609", "user_id": "u696547932"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: i, j, k\ninteger :: n\ninteger , allocatable :: a(:), b(:)\n\nread(*,*) n\nallocate( a(n), b(n) )\nb(1) = 0\ndo i = 1, n\n read(*,*) a(i)\n k = 1\n do j = 1, i\n if( a(i) == b(j) ) then\n k = 0\n b(j) = 0\n end if\n end do\n if( k == 1 ) then\n b(i) = a(i)\n else\n b(i) = 0\n end if\nend do\nj = 0\ndo i = 1, n\n if( b(i) /= 0 ) then\n j = j + 1\n end if \nend do\nwrite(*,'(i0)') j\n\nend program main\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 475, "cpu_time_ms": 2103, "memory_kb": 896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s603575315", "group_id": "codeNet:p03607", "input_text": "implicit none\ninteger(8):: i,j,k,n,m,ans\ninteger(8),allocatable,dimension(:):: num,count\n\nread (5,*) n\n \nallocate(num(n))\nallocate(count(n))\ncount=0\nans=0\nm=1\ncount(1)=1\n \ndo i=1,n\n read (5,*) num(i)\nenddo\n\ncall heapsort(n,num)\n\ndo i = 2,n\n if (num(m)==num(i)) then\n count(m)=count(m)+1\n else\n ans=ans+mod(count(m),2)\n m=i\n count(m)=1\n endif\nenddo\n\nif(num(n)/=num(n-1)) then\n ans=ans+1\nendif\n\nwrite(6,\"(i0)\") ans\nend\n\n!---http://slpr.sakura.ne.jp/qp/sortf90/---\nsubroutine heapsort(n,array)\n implicit none\n integer(8),intent(in) :: n\n double precision,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n double precision :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n\n return\nend subroutine heapsort", "language": "Fortran", "metadata": {"date": 1507908103, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03607.html", "problem_id": "p03607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03607/input.txt", "sample_output_relpath": "derived/input_output/data/p03607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03607/Fortran/s603575315.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s603575315", "user_id": "u909643606"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "implicit none\ninteger(8):: i,j,k,n,m,ans\ninteger(8),allocatable,dimension(:):: num,count\n\nread (5,*) n\n \nallocate(num(n))\nallocate(count(n))\ncount=0\nans=0\nm=1\ncount(1)=1\n \ndo i=1,n\n read (5,*) num(i)\nenddo\n\ncall heapsort(n,num)\n\ndo i = 2,n\n if (num(m)==num(i)) then\n count(m)=count(m)+1\n else\n ans=ans+mod(count(m),2)\n m=i\n count(m)=1\n endif\nenddo\n\nif(num(n)/=num(n-1)) then\n ans=ans+1\nendif\n\nwrite(6,\"(i0)\") ans\nend\n\n!---http://slpr.sakura.ne.jp/qp/sortf90/---\nsubroutine heapsort(n,array)\n implicit none\n integer(8),intent(in) :: n\n double precision,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n double precision :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n\n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n\n return\nend subroutine heapsort", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "sample_input": "3\n6\n2\n6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03607", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are playing the following game with Joisino.\n\nInitially, you have a blank sheet of paper.\n\nJoisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.\n\nThen, you are asked a question: How many numbers are written on the sheet now?\n\nThe numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?\n\nConstraints\n\n1≤N≤100000\n\n1≤A_i≤1000000000(=10^9)\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\n:\nA_N\n\nOutput\n\nPrint how many numbers will be written on the sheet at the end of the game.\n\nSample Input 1\n\n3\n6\n2\n6\n\nSample Output 1\n\n1\n\nThe game proceeds as follows:\n\n6 is not written on the sheet, so write 6.\n\n2 is not written on the sheet, so write 2.\n\n6 is written on the sheet, so erase 6.\n\nThus, the sheet contains only 2 in the end. The answer is 1.\n\nSample Input 2\n\n4\n2\n5\n5\n2\n\nSample Output 2\n\n0\n\nIt is possible that no number is written on the sheet in the end.\n\nSample Input 3\n\n6\n12\n22\n16\n22\n18\n12\n\nSample Output 3\n\n2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1471, "cpu_time_ms": 61, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s289119404", "group_id": "codeNet:p03610", "input_text": "program ABC072B\n implicit none\n integer(8)::i\n integer(8)::t_len=1\n character(100000)::s,t\n read(5,*)s\n\n do i=1,len_trim(s)\n if(mod(i,2)==1)then\n t(t_len:t_len)=s(i:i)\n t_len=t_len+1\n end if\n end do\n\n print'(A)',t(1:t_len-1)\nend program ABC072B", "language": "Fortran", "metadata": {"date": 1579062249, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03610.html", "problem_id": "p03610", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03610/input.txt", "sample_output_relpath": "derived/input_output/data/p03610/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03610/Fortran/s289119404.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s289119404", "user_id": "u414699019"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "program ABC072B\n implicit none\n integer(8)::i\n integer(8)::t_len=1\n character(100000)::s,t\n read(5,*)s\n\n do i=1,len_trim(s)\n if(mod(i,2)==1)then\n t(t_len:t_len)=s(i:i)\n t_len=t_len+1\n end if\n end do\n\n print'(A)',t(1:t_len-1)\nend program ABC072B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "sample_input": "atcoder\n"}, "reference_outputs": ["acdr\n"], "source_document_id": "p03610", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string s consisting of lowercase English letters. Extract all the characters in the odd-indexed positions and print the string obtained by concatenating them. Here, the leftmost character is assigned the index 1.\n\nConstraints\n\nEach character in s is a lowercase English letter.\n\n1≤|s|≤10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string obtained by concatenating all the characters in the odd-numbered positions.\n\nSample Input 1\n\natcoder\n\nSample Output 1\n\nacdr\n\nExtract the first character a, the third character c, the fifth character d and the seventh character r to obtain acdr.\n\nSample Input 2\n\naaaa\n\nSample Output 2\n\naa\n\nSample Input 3\n\nz\n\nSample Output 3\n\nz\n\nSample Input 4\n\nfukuokayamaguchi\n\nSample Output 4\n\nfkoaaauh", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 304, "cpu_time_ms": 7, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s087667773", "group_id": "codeNet:p03616", "input_text": "program sandglass\n implicit none\n integer :: x, k, q, a(100000), tt(200000,2), ans(100000), i\n integer :: tlft, trit, alft, arit, t0, t1, s\n logical :: rev\n a = 0\n tt = 0\n ans = 0\n read(*,*) x\n read(*,*) k\n read(*,*) tt(1:k,1)\n read(*,*) q\n do i = 1, q\n read(*,*) tt(k+i,1), a(i)\n tt(k+i,2) = i\n end do\n call merge_sort(tt(1:k+q,1:2))\n tlft = 0\n trit = x\n alft = 0\n arit = x\n rev = .false.\n t0 = 0\n do i = 1, k+q\n t1 = tt(i,1)\n s = tt(i,2)\n alft = alft-(t1-t0)\n if (alft.lt.0) then\n tlft = tlft-alft\n if (tlft.gt.x) tlft = x\n alft = 0\n end if\n arit = arit-(t1-t0)\n if (arit.lt.0) then\n trit = trit+arit\n if (trit.lt.0) trit = 0\n arit = 0\n end if\n if (tlft.ge.trit) then\n if (rev) then\n tlft = trit-1\n if (tlft.lt.0) tlft = 0\n else\n trit = tlft+1\n if (trit.gt.x) trit = x\n end if\n end if\n !write(*,'(6(i0,x))') t0, t1, tlft, trit, alft, arit\n t0 = t1\n if (s.eq.0) then\n rev = .not.rev\n alft = x-alft\n arit = x-arit\n cycle\n end if\n if (a(s).le.tlft) then\n ans(s) = alft\n else if (a(s).ge.trit) then\n ans(s) = arit\n else\n ans(s) = a(s)-tlft+alft\n if (rev) ans(s) = -a(s)+tlft+alft\n end if\n if (rev) ans(s) = x-ans(s)\n end do\n do i = 1, q\n write(*,'(i0)') ans(i)\n end do\n stop\ncontains\n subroutine merge_sort(c)\n implicit none\n integer, intent(inout) :: c(:,:)\n integer :: n, m, l, u, i\n n = size(c(:,1))\n m = n\n l = 1\n do while (m.gt.1)\n do i = 1, m/2\n u = min(2*i*l,n)\n call merger(c(2*(i-1)*l+1:(2*i-1)*l,:),c((2*i-1)*l+1:u,:))\n end do\n l = 2*l\n m = (m+1)/2\n end do\n return\n end subroutine merge_sort\n subroutine merger(c1,c2)\n implicit none\n integer, intent(inout) :: c1(:,:), c2(:,:)\n integer :: c(size(c1(:,1))+size(c2(:,1)),size(c2(1,:)))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(c1(:,1))\n n2 = size(c2(:,1))\n do while ((i1.le.n1).and.(i2.le.n2))\n if (c1(i1,1).le.c2(i2,1)) then\n c(i1+i2-1,:) = c1(i1,:)\n i1 = i1+1\n else\n c(i1+i2-1,:) = c2(i2,:)\n i2 = i2+1\n end if\n end do\n if (i1.le.n1) then\n c(i1+i2-1:n1+n2,:) = c1(i1:n1,:)\n else if (i2.le.n2) then\n c(i1+i2-1:n1+n2,:) = c2(i2:n2,:)\n end if\n c1 = c(1:n1,:)\n c2 = c(n1+1:n1+n2,:)\n return\n end subroutine merger\nend program sandglass", "language": "Fortran", "metadata": {"date": 1562436638, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03616.html", "problem_id": "p03616", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03616/input.txt", "sample_output_relpath": "derived/input_output/data/p03616/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03616/Fortran/s087667773.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s087667773", "user_id": "u506403362"}, "prompt_components": {"gold_output": "60\n1\n120\n", "input_to_evaluate": "program sandglass\n implicit none\n integer :: x, k, q, a(100000), tt(200000,2), ans(100000), i\n integer :: tlft, trit, alft, arit, t0, t1, s\n logical :: rev\n a = 0\n tt = 0\n ans = 0\n read(*,*) x\n read(*,*) k\n read(*,*) tt(1:k,1)\n read(*,*) q\n do i = 1, q\n read(*,*) tt(k+i,1), a(i)\n tt(k+i,2) = i\n end do\n call merge_sort(tt(1:k+q,1:2))\n tlft = 0\n trit = x\n alft = 0\n arit = x\n rev = .false.\n t0 = 0\n do i = 1, k+q\n t1 = tt(i,1)\n s = tt(i,2)\n alft = alft-(t1-t0)\n if (alft.lt.0) then\n tlft = tlft-alft\n if (tlft.gt.x) tlft = x\n alft = 0\n end if\n arit = arit-(t1-t0)\n if (arit.lt.0) then\n trit = trit+arit\n if (trit.lt.0) trit = 0\n arit = 0\n end if\n if (tlft.ge.trit) then\n if (rev) then\n tlft = trit-1\n if (tlft.lt.0) tlft = 0\n else\n trit = tlft+1\n if (trit.gt.x) trit = x\n end if\n end if\n !write(*,'(6(i0,x))') t0, t1, tlft, trit, alft, arit\n t0 = t1\n if (s.eq.0) then\n rev = .not.rev\n alft = x-alft\n arit = x-arit\n cycle\n end if\n if (a(s).le.tlft) then\n ans(s) = alft\n else if (a(s).ge.trit) then\n ans(s) = arit\n else\n ans(s) = a(s)-tlft+alft\n if (rev) ans(s) = -a(s)+tlft+alft\n end if\n if (rev) ans(s) = x-ans(s)\n end do\n do i = 1, q\n write(*,'(i0)') ans(i)\n end do\n stop\ncontains\n subroutine merge_sort(c)\n implicit none\n integer, intent(inout) :: c(:,:)\n integer :: n, m, l, u, i\n n = size(c(:,1))\n m = n\n l = 1\n do while (m.gt.1)\n do i = 1, m/2\n u = min(2*i*l,n)\n call merger(c(2*(i-1)*l+1:(2*i-1)*l,:),c((2*i-1)*l+1:u,:))\n end do\n l = 2*l\n m = (m+1)/2\n end do\n return\n end subroutine merge_sort\n subroutine merger(c1,c2)\n implicit none\n integer, intent(inout) :: c1(:,:), c2(:,:)\n integer :: c(size(c1(:,1))+size(c2(:,1)),size(c2(1,:)))\n integer :: i1, i2, n1, n2\n i1 = 1\n i2 = 1\n n1 = size(c1(:,1))\n n2 = size(c2(:,1))\n do while ((i1.le.n1).and.(i2.le.n2))\n if (c1(i1,1).le.c2(i2,1)) then\n c(i1+i2-1,:) = c1(i1,:)\n i1 = i1+1\n else\n c(i1+i2-1,:) = c2(i2,:)\n i2 = i2+1\n end if\n end do\n if (i1.le.n1) then\n c(i1+i2-1:n1+n2,:) = c1(i1:n1,:)\n else if (i2.le.n2) then\n c(i1+i2-1:n1+n2,:) = c2(i2:n2,:)\n end if\n c1 = c(1:n1,:)\n c2 = c(n1+1:n1+n2,:)\n return\n end subroutine merger\nend program sandglass", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a sandglass consisting of two bulbs, bulb A and bulb B. These bulbs contain some amount of sand.\nWhen we put the sandglass, either bulb A or B lies on top of the other and becomes the upper bulb. The other bulb becomes the lower bulb.\n\nThe sand drops from the upper bulb to the lower bulb at a rate of 1 gram per second.\nWhen the upper bulb no longer contains any sand, nothing happens.\n\nInitially at time 0, bulb A is the upper bulb and contains a grams of sand; bulb B contains X-a grams of sand (for a total of X grams).\n\nWe will turn over the sandglass at time r_1,r_2,..,r_K. Assume that this is an instantaneous action and takes no time. Here, time t refer to the time t seconds after time 0.\n\nYou are given Q queries.\nEach query is in the form of (t_i,a_i).\nFor each query, assume that a=a_i and find the amount of sand that would be contained in bulb A at time t_i.\n\nConstraints\n\n1≤X≤10^9\n\n1≤K≤10^5\n\n1≤r_1 abs(x-b))then\n write(*,*) \"B\"\n else\n write(*,*) \"A\"\n end if\n\n stop\ncontains\nend program prob2", "language": "Fortran", "metadata": {"date": 1591405651, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03623.html", "problem_id": "p03623", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03623/input.txt", "sample_output_relpath": "derived/input_output/data/p03623/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03623/Fortran/s498313696.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s498313696", "user_id": "u478462004"}, "prompt_components": {"gold_output": "B\n", "input_to_evaluate": "program prob2\n implicit none\n integer :: x,a,b\n read(*,*) x,a,b\n if(abs(x-a) > abs(x-b))then\n write(*,*) \"B\"\n else\n write(*,*) \"A\"\n end if\n\n stop\ncontains\nend program prob2", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke lives at position x on a number line.\nOn this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.\n\nSnuke decided to get food delivery from the closer of stores A and B.\nFind out which store is closer to Snuke's residence.\n\nHere, the distance between two points s and t on a number line is represented by |s-t|.\n\nConstraints\n\n1 \\leq x \\leq 1000\n\n1 \\leq a \\leq 1000\n\n1 \\leq b \\leq 1000\n\nx, a and b are pairwise distinct.\n\nThe distances between Snuke's residence and stores A and B are different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx a b\n\nOutput\n\nIf store A is closer, print A; if store B is closer, print B.\n\nSample Input 1\n\n5 2 7\n\nSample Output 1\n\nB\n\nThe distances between Snuke's residence and stores A and B are 3 and 2, respectively.\nSince store B is closer, print B.\n\nSample Input 2\n\n1 999 1000\n\nSample Output 2\n\nA", "sample_input": "5 2 7\n"}, "reference_outputs": ["B\n"], "source_document_id": "p03623", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke lives at position x on a number line.\nOn this line, there are two stores A and B, respectively at position a and b, that offer food for delivery.\n\nSnuke decided to get food delivery from the closer of stores A and B.\nFind out which store is closer to Snuke's residence.\n\nHere, the distance between two points s and t on a number line is represented by |s-t|.\n\nConstraints\n\n1 \\leq x \\leq 1000\n\n1 \\leq a \\leq 1000\n\n1 \\leq b \\leq 1000\n\nx, a and b are pairwise distinct.\n\nThe distances between Snuke's residence and stores A and B are different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx a b\n\nOutput\n\nIf store A is closer, print A; if store B is closer, print B.\n\nSample Input 1\n\n5 2 7\n\nSample Output 1\n\nB\n\nThe distances between Snuke's residence and stores A and B are 3 and 2, respectively.\nSince store B is closer, print B.\n\nSample Input 2\n\n1 999 1000\n\nSample Output 2\n\nA", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 207, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s403637901", "group_id": "codeNet:p03623", "input_text": "integer a,b,c\nread*,a,b,c\nif(abs(a-b)= num) then\n exit\n end if\n\n if (flag) then\n if (s1(i + a:i + a) /= s2(i+a:i+a)) then\n a = a + 1\n answer = mod(answer*3, m)\n flag = .true.\n else\n flag = .false.\n end if\n else\n if (s1(i + a:i + a) /= s2(i+a:i+a)) then\n a = a + 1\n answer = mod(answer*2, m)\n flag = .true.\n else\n answer = mod(answer*2, m)\n flag = .false.\n end if\n end if\n end do\n\n print *, answer\nend program main", "language": "Fortran", "metadata": {"date": 1517197004, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03626.html", "problem_id": "p03626", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03626/input.txt", "sample_output_relpath": "derived/input_output/data/p03626/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03626/Fortran/s104676733.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s104676733", "user_id": "u085486962"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "program main\n integer(8) :: answer = 1\n integer(8) :: m = 1000000007\n integer :: num\n character (52) :: s1, s2\n character :: s(52) = '_'\n integer :: a = 0, start = 1\n logical :: flag = .true.\n\n read *, num\n read *, s1\n read *, s2\n s1 = trim(s1)\n s2 = trim(s2)\n\n if(s1(1:1) == s2(2:2)) then\n answer = 6\n start = start + 2\n flag = .true.\n else\n answer = 3\n start = start + 1\n flag = .false.\n end if\n\n do i=start,num-1\n if (i+a >= num) then\n exit\n end if\n\n if (flag) then\n if (s1(i + a:i + a) /= s2(i+a:i+a)) then\n a = a + 1\n answer = mod(answer*3, m)\n flag = .true.\n else\n flag = .false.\n end if\n else\n if (s1(i + a:i + a) /= s2(i+a:i+a)) then\n a = a + 1\n answer = mod(answer*2, m)\n flag = .true.\n else\n answer = mod(answer*2, m)\n flag = .false.\n end if\n end if\n end do\n\n print *, answer\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a board with a 2 \\times N grid.\nSnuke covered the board with N dominoes without overlaps.\nHere, a domino can cover a 1 \\times 2 or 2 \\times 1 square.\n\nThen, Snuke decided to paint these dominoes using three colors: red, cyan and green.\nTwo dominoes that are adjacent by side should be painted by different colors.\nHere, it is not always necessary to use all three colors.\n\nFind the number of such ways to paint the dominoes, modulo 1000000007.\n\nThe arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner:\n\nEach domino is represented by a different English letter (lowercase or uppercase).\n\nThe j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left.\n\nConstraints\n\n1 \\leq N \\leq 52\n\n|S_1| = |S_2| = N\n\nS_1 and S_2 consist of lowercase and uppercase English letters.\n\nS_1 and S_2 represent a valid arrangement of dominoes.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\nS_2\n\nOutput\n\nPrint the number of such ways to paint the dominoes, modulo 1000000007.\n\nSample Input 1\n\n3\naab\nccb\n\nSample Output 1\n\n6\n\nThere are six ways as shown below:\n\nSample Input 2\n\n1\nZ\nZ\n\nSample Output 2\n\n3\n\nNote that it is not always necessary to use all the colors.\n\nSample Input 3\n\n52\nRvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\nRLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn\n\nSample Output 3\n\n958681902", "sample_input": "3\naab\nccb\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03626", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a board with a 2 \\times N grid.\nSnuke covered the board with N dominoes without overlaps.\nHere, a domino can cover a 1 \\times 2 or 2 \\times 1 square.\n\nThen, Snuke decided to paint these dominoes using three colors: red, cyan and green.\nTwo dominoes that are adjacent by side should be painted by different colors.\nHere, it is not always necessary to use all three colors.\n\nFind the number of such ways to paint the dominoes, modulo 1000000007.\n\nThe arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner:\n\nEach domino is represented by a different English letter (lowercase or uppercase).\n\nThe j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left.\n\nConstraints\n\n1 \\leq N \\leq 52\n\n|S_1| = |S_2| = N\n\nS_1 and S_2 consist of lowercase and uppercase English letters.\n\nS_1 and S_2 represent a valid arrangement of dominoes.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\nS_2\n\nOutput\n\nPrint the number of such ways to paint the dominoes, modulo 1000000007.\n\nSample Input 1\n\n3\naab\nccb\n\nSample Output 1\n\n6\n\nThere are six ways as shown below:\n\nSample Input 2\n\n1\nZ\nZ\n\nSample Output 2\n\n3\n\nNote that it is not always necessary to use all the colors.\n\nSample Input 3\n\n52\nRvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\nRLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn\n\nSample Output 3\n\n958681902", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1145, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s915815721", "group_id": "codeNet:p03626", "input_text": "program main\n integer(8) :: answer = 1\n integer(8) :: m = 1000000007\n integer :: num\n character (52) :: s1, s2\n character :: s(52) = '_'\n integer :: a = 0, start = 1\n logical :: flag = .true.\n\n read *, num\n read *, s1\n read *, s2\n s1 = trim(s1)\n\n if(s1(1:1) == s1(2:2)) then\n answer = 6\n start = start + 2\n flag = .true.\n else\n answer = 3\n start = start + 1\n flag = .false.\n end if\n\n do i=start,num-1\n if (i+a >= num) then\n exit\n end if\n\n if (flag) then\n if (s1(i + a:i + a) == s1(i+1+a:i+1+a)) then\n a = a + 1\n answer = mod(answer*3, m)\n flag = .true.\n else\n flag = .false.\n end if\n else\n if (s1(i + a:i+a) == s1(i+1+a:i+1+a)) then\n a = a + 1\n answer = mod(answer*2, m)\n flag = .true.\n else\n answer = mod(answer*2, m)\n flag = .false.\n end if\n end if\n end do\n\n print *, answer\nend program main", "language": "Fortran", "metadata": {"date": 1517196545, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03626.html", "problem_id": "p03626", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03626/input.txt", "sample_output_relpath": "derived/input_output/data/p03626/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03626/Fortran/s915815721.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s915815721", "user_id": "u085486962"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "program main\n integer(8) :: answer = 1\n integer(8) :: m = 1000000007\n integer :: num\n character (52) :: s1, s2\n character :: s(52) = '_'\n integer :: a = 0, start = 1\n logical :: flag = .true.\n\n read *, num\n read *, s1\n read *, s2\n s1 = trim(s1)\n\n if(s1(1:1) == s1(2:2)) then\n answer = 6\n start = start + 2\n flag = .true.\n else\n answer = 3\n start = start + 1\n flag = .false.\n end if\n\n do i=start,num-1\n if (i+a >= num) then\n exit\n end if\n\n if (flag) then\n if (s1(i + a:i + a) == s1(i+1+a:i+1+a)) then\n a = a + 1\n answer = mod(answer*3, m)\n flag = .true.\n else\n flag = .false.\n end if\n else\n if (s1(i + a:i+a) == s1(i+1+a:i+1+a)) then\n a = a + 1\n answer = mod(answer*2, m)\n flag = .true.\n else\n answer = mod(answer*2, m)\n flag = .false.\n end if\n end if\n end do\n\n print *, answer\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a board with a 2 \\times N grid.\nSnuke covered the board with N dominoes without overlaps.\nHere, a domino can cover a 1 \\times 2 or 2 \\times 1 square.\n\nThen, Snuke decided to paint these dominoes using three colors: red, cyan and green.\nTwo dominoes that are adjacent by side should be painted by different colors.\nHere, it is not always necessary to use all three colors.\n\nFind the number of such ways to paint the dominoes, modulo 1000000007.\n\nThe arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner:\n\nEach domino is represented by a different English letter (lowercase or uppercase).\n\nThe j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left.\n\nConstraints\n\n1 \\leq N \\leq 52\n\n|S_1| = |S_2| = N\n\nS_1 and S_2 consist of lowercase and uppercase English letters.\n\nS_1 and S_2 represent a valid arrangement of dominoes.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\nS_2\n\nOutput\n\nPrint the number of such ways to paint the dominoes, modulo 1000000007.\n\nSample Input 1\n\n3\naab\nccb\n\nSample Output 1\n\n6\n\nThere are six ways as shown below:\n\nSample Input 2\n\n1\nZ\nZ\n\nSample Output 2\n\n3\n\nNote that it is not always necessary to use all the colors.\n\nSample Input 3\n\n52\nRvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\nRLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn\n\nSample Output 3\n\n958681902", "sample_input": "3\naab\nccb\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03626", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a board with a 2 \\times N grid.\nSnuke covered the board with N dominoes without overlaps.\nHere, a domino can cover a 1 \\times 2 or 2 \\times 1 square.\n\nThen, Snuke decided to paint these dominoes using three colors: red, cyan and green.\nTwo dominoes that are adjacent by side should be painted by different colors.\nHere, it is not always necessary to use all three colors.\n\nFind the number of such ways to paint the dominoes, modulo 1000000007.\n\nThe arrangement of the dominoes is given to you as two strings S_1 and S_2 in the following manner:\n\nEach domino is represented by a different English letter (lowercase or uppercase).\n\nThe j-th character in S_i represents the domino that occupies the square at the i-th row from the top and j-th column from the left.\n\nConstraints\n\n1 \\leq N \\leq 52\n\n|S_1| = |S_2| = N\n\nS_1 and S_2 consist of lowercase and uppercase English letters.\n\nS_1 and S_2 represent a valid arrangement of dominoes.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\nS_2\n\nOutput\n\nPrint the number of such ways to paint the dominoes, modulo 1000000007.\n\nSample Input 1\n\n3\naab\nccb\n\nSample Output 1\n\n6\n\nThere are six ways as shown below:\n\nSample Input 2\n\n1\nZ\nZ\n\nSample Output 2\n\n3\n\nNote that it is not always necessary to use all the colors.\n\nSample Input 3\n\n52\nRvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn\nRLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn\n\nSample Output 3\n\n958681902", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1133, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s057104907", "group_id": "codeNet:p03627", "input_text": "program main\n implicit none\n\n integer :: n, i, ans, cnt\n integer, allocatable :: a(:),b(:)\n\n read(*,*) n\n allocate(a(n))\n allocate(b(n))\n\n b(:) = 0\n ans = 0\n cnt = 0\n read(*,*) a\n call quicksort(a, 1, n)\n do i = n, 2, -1\n if(a(i) == a(i-1)) then\n ans = a(i)\n cnt = i\n exit\n end if\n end do\n\n do i = cnt-2, 2, -1\n if(a(i) == a(i-1)) then\n ans = ans * a(i)\n exit\n end if\n if(i == 2) then\n ans = 0\n end if\n \n end do\n\n write(*,*) ans\n\n stop\n \ncontains\n recursive subroutine quicksort(a, first, last)\n implicit none\n integer :: a(*)\n integer :: first, last\n integer :: i, j\n integer :: x, t\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i); a(i) = a(j); a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort(a, first, i - 1)\n if (j + 1 < last) call quicksort(a, j + 1, last)\n end subroutine quicksort\n\nend program main\n\n \n", "language": "Fortran", "metadata": {"date": 1592620021, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03627.html", "problem_id": "p03627", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03627/input.txt", "sample_output_relpath": "derived/input_output/data/p03627/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03627/Fortran/s057104907.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s057104907", "user_id": "u979474608"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n\n integer :: n, i, ans, cnt\n integer, allocatable :: a(:),b(:)\n\n read(*,*) n\n allocate(a(n))\n allocate(b(n))\n\n b(:) = 0\n ans = 0\n cnt = 0\n read(*,*) a\n call quicksort(a, 1, n)\n do i = n, 2, -1\n if(a(i) == a(i-1)) then\n ans = a(i)\n cnt = i\n exit\n end if\n end do\n\n do i = cnt-2, 2, -1\n if(a(i) == a(i-1)) then\n ans = ans * a(i)\n exit\n end if\n if(i == 2) then\n ans = 0\n end if\n \n end do\n\n write(*,*) ans\n\n stop\n \ncontains\n recursive subroutine quicksort(a, first, last)\n implicit none\n integer :: a(*)\n integer :: first, last\n integer :: i, j\n integer :: x, t\n \n x = a( (first+last) / 2 )\n i = first\n j = last\n do\n do while (a(i) < x)\n i=i+1\n end do\n do while (x < a(j))\n j=j-1\n end do\n if (i >= j) exit\n t = a(i); a(i) = a(j); a(j) = t\n i=i+1\n j=j-1\n end do\n if (first < i - 1) call quicksort(a, first, i - 1)\n if (j + 1 < last) call quicksort(a, j + 1, last)\n end subroutine quicksort\n\nend program main\n\n \n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "sample_input": "6\n3 1 2 4 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03627", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N sticks with negligible thickness.\nThe length of the i-th stick is A_i.\n\nSnuke wants to select four different sticks from these sticks and form a rectangle (including a square), using the sticks as its sides.\nFind the maximum possible area of the rectangle.\n\nConstraints\n\n4 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the maximum possible area of the rectangle.\nIf no rectangle can be formed, print 0.\n\nSample Input 1\n\n6\n3 1 2 4 2 1\n\nSample Output 1\n\n2\n\n1 \\times 2 rectangle can be formed.\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\n0\n\nNo rectangle can be formed.\n\nSample Input 3\n\n10\n3 3 3 3 4 4 4 5 5 5\n\nSample Output 3\n\n20", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1134, "cpu_time_ms": 49, "memory_kb": 3792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s508432696", "group_id": "codeNet:p03635", "input_text": "program sample\n\timplicit none\n integer ::a,b\n \n read(*,*) a,b\n \n write(*,*) (a-1)*(b-1)\n \n stop\nend program sample", "language": "Fortran", "metadata": {"date": 1592636054, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03635.html", "problem_id": "p03635", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03635/input.txt", "sample_output_relpath": "derived/input_output/data/p03635/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03635/Fortran/s508432696.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s508432696", "user_id": "u323210830"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "program sample\n\timplicit none\n integer ::a,b\n \n read(*,*) a,b\n \n write(*,*) (a-1)*(b-1)\n \n stop\nend program sample", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn K-city, there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city?\n\nConstraints\n\n2 ≤ n, m ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\n\nOutput\n\nPrint the number of blocks in K-city.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\n6\n\nThere are six blocks, as shown below:\n\nSample Input 2\n\n2 2\n\nSample Output 2\n\n1\n\nThere are one block, as shown below:", "sample_input": "3 4\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03635", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn K-city, there are n streets running east-west, and m streets running north-south. Each street running east-west and each street running north-south cross each other. We will call the smallest area that is surrounded by four streets a block. How many blocks there are in K-city?\n\nConstraints\n\n2 ≤ n, m ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\n\nOutput\n\nPrint the number of blocks in K-city.\n\nSample Input 1\n\n3 4\n\nSample Output 1\n\n6\n\nThere are six blocks, as shown below:\n\nSample Input 2\n\n2 2\n\nSample Output 2\n\n1\n\nThere are one block, as shown below:", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 135, "cpu_time_ms": 8, "memory_kb": 2792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s402942422", "group_id": "codeNet:p03637", "input_text": "program main\n\timplicit none\n\tinteger :: n,a=0,b=0\n\tinteger(4) i,j(100000)\n\tread(*,*)n\n\tread(*,*)j(1:n)\n\tdo i=1,n\n\t\tif(mod(j(i),4)==0)a=a+1\n\t\tif(mod(j(i),2)==1)b=b+1\n\tenddo\n\ta=int(a*1.5)\n\tif(b>a)then\n\t\twrite(*,'(a2)')\"No\"\n\telse\n\t\twrite(*,'(a3)')\"Yes\"\n\tendif\nend program main\n", "language": "Fortran", "metadata": {"date": 1502324108, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03637.html", "problem_id": "p03637", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03637/input.txt", "sample_output_relpath": "derived/input_output/data/p03637/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03637/Fortran/s402942422.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s402942422", "user_id": "u539011156"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program main\n\timplicit none\n\tinteger :: n,a=0,b=0\n\tinteger(4) i,j(100000)\n\tread(*,*)n\n\tread(*,*)j(1:n)\n\tdo i=1,n\n\t\tif(mod(j(i),4)==0)a=a+1\n\t\tif(mod(j(i),2)==1)b=b+1\n\tenddo\n\ta=int(a*1.5)\n\tif(b>a)then\n\t\twrite(*,'(a2)')\"No\"\n\telse\n\t\twrite(*,'(a3)')\"Yes\"\n\tendif\nend program main\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "sample_input": "3\n1 10 100\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03637", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a sequence of length N, a = (a_1, a_2, ..., a_N).\nEach a_i is a positive integer.\n\nSnuke's objective is to permute the element in a so that the following condition is satisfied:\n\nFor each 1 ≤ i ≤ N - 1, the product of a_i and a_{i + 1} is a multiple of 4.\n\nDetermine whether Snuke can achieve his objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nIf Snuke can achieve his objective, print Yes; otherwise, print No.\n\nSample Input 1\n\n3\n1 10 100\n\nSample Output 1\n\nYes\n\nOne solution is (1, 100, 10).\n\nSample Input 2\n\n4\n1 2 3 4\n\nSample Output 2\n\nNo\n\nIt is impossible to permute a so that the condition is satisfied.\n\nSample Input 3\n\n3\n1 4 1\n\nSample Output 3\n\nYes\n\nThe condition is already satisfied initially.\n\nSample Input 4\n\n2\n1 1\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n6\n2 7 1 8 2 8\n\nSample Output 5\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 274, "cpu_time_ms": 33, "memory_kb": 1152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s572701908", "group_id": "codeNet:p03638", "input_text": "program main\n implicit none\n integer :: n\n integer :: h, w\n integer, allocatable :: an(:)\n integer, allocatable :: masu(:)\n integer :: i, j, cnt\n\n read *, h, w\n read *, n\n\n allocate(an(n))\n allocate(masu(h*w))\n\n read *, an(1:n)\n\n cnt = 1\n do i = 1, n\n masu(cnt:cnt+an(i)-1) = i\n cnt = cnt + an(i)\n enddo\n\n do i = 1, h\n if(mod(i,2)==0)then\n print *, (masu(h*(i-1)+j),j = 1,w,1)\n else\n print *, (masu(h*(i-1)+j),j = w,1,-1)\n endif\n enddo\n\nend program", "language": "Fortran", "metadata": {"date": 1595903986, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03638.html", "problem_id": "p03638", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03638/input.txt", "sample_output_relpath": "derived/input_output/data/p03638/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03638/Fortran/s572701908.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s572701908", "user_id": "u310855433"}, "prompt_components": {"gold_output": "1 1\n2 3\n", "input_to_evaluate": "program main\n implicit none\n integer :: n\n integer :: h, w\n integer, allocatable :: an(:)\n integer, allocatable :: masu(:)\n integer :: i, j, cnt\n\n read *, h, w\n read *, n\n\n allocate(an(n))\n allocate(masu(h*w))\n\n read *, an(1:n)\n\n cnt = 1\n do i = 1, n\n masu(cnt:cnt+an(i)-1) = i\n cnt = cnt + an(i)\n enddo\n\n do i = 1, h\n if(mod(i,2)==0)then\n print *, (masu(h*(i-1)+j),j = 1,w,1)\n else\n print *, (masu(h*(i-1)+j),j = w,1,-1)\n endif\n enddo\n\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nSnuke is painting these squares in colors 1, 2, ..., N.\nHere, the following conditions should be satisfied:\n\nFor each i (1 ≤ i ≤ N), there are exactly a_i squares painted in Color i. Here, a_1 + a_2 + ... + a_N = H W.\n\nFor each i (1 ≤ i ≤ N), the squares painted in Color i are 4-connected. That is, every square painted in Color i can be reached from every square painted in Color i by repeatedly traveling to a horizontally or vertically adjacent square painted in Color i.\n\nFind a way to paint the squares so that the conditions are satisfied.\nIt can be shown that a solution always exists.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\n1 ≤ N ≤ H W\n\na_i ≥ 1\n\na_1 + a_2 + ... + a_N = H W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint one way to paint the squares that satisfies the conditions.\nOutput in the following format:\n\nc_{1 1} ... c_{1 W}\n:\nc_{H 1} ... c_{H W}\n\nHere, c_{i j} is the color of the square at the i-th row from the top and j-th column from the left.\n\nSample Input 1\n\n2 2\n3\n2 1 1\n\nSample Output 1\n\n1 1\n2 3\n\nBelow is an example of an invalid solution:\n\n1 2\n3 1\n\nThis is because the squares painted in Color 1 are not 4-connected.\n\nSample Input 2\n\n3 5\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 4 4 4 3\n2 5 4 5 3\n2 5 5 5 3\n\nSample Input 3\n\n1 1\n1\n1\n\nSample Output 3\n\n1", "sample_input": "2 2\n3\n2 1 1\n"}, "reference_outputs": ["1 1\n2 3\n"], "source_document_id": "p03638", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns of squares.\nSnuke is painting these squares in colors 1, 2, ..., N.\nHere, the following conditions should be satisfied:\n\nFor each i (1 ≤ i ≤ N), there are exactly a_i squares painted in Color i. Here, a_1 + a_2 + ... + a_N = H W.\n\nFor each i (1 ≤ i ≤ N), the squares painted in Color i are 4-connected. That is, every square painted in Color i can be reached from every square painted in Color i by repeatedly traveling to a horizontally or vertically adjacent square painted in Color i.\n\nFind a way to paint the squares so that the conditions are satisfied.\nIt can be shown that a solution always exists.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\n1 ≤ N ≤ H W\n\na_i ≥ 1\n\na_1 + a_2 + ... + a_N = H W\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint one way to paint the squares that satisfies the conditions.\nOutput in the following format:\n\nc_{1 1} ... c_{1 W}\n:\nc_{H 1} ... c_{H W}\n\nHere, c_{i j} is the color of the square at the i-th row from the top and j-th column from the left.\n\nSample Input 1\n\n2 2\n3\n2 1 1\n\nSample Output 1\n\n1 1\n2 3\n\nBelow is an example of an invalid solution:\n\n1 2\n3 1\n\nThis is because the squares painted in Color 1 are not 4-connected.\n\nSample Input 2\n\n3 5\n5\n1 2 3 4 5\n\nSample Output 2\n\n1 4 4 4 3\n2 5 4 5 3\n2 5 5 5 3\n\nSample Input 3\n\n1 1\n1\n1\n\nSample Output 3\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 489, "cpu_time_ms": 15, "memory_kb": 2868}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s961689999", "group_id": "codeNet:p03643", "input_text": "program prob76\n implicit none\n character(3) :: s\n read(*,*) s\n write(*,'(2a)') \"ABC\",s\n\n stop\ncontains\nend program prob76", "language": "Fortran", "metadata": {"date": 1592634252, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03643.html", "problem_id": "p03643", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03643/input.txt", "sample_output_relpath": "derived/input_output/data/p03643/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03643/Fortran/s961689999.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s961689999", "user_id": "u478462004"}, "prompt_components": {"gold_output": "ABC100\n", "input_to_evaluate": "program prob76\n implicit none\n character(3) :: s\n read(*,*) s\n write(*,'(2a)') \"ABC\",s\n\n stop\ncontains\nend program prob76", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest, AtCoder Beginner Contest, is abbreviated as ABC.\n\nWhen we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.\n\nWhat is the abbreviation for the N-th round of ABC? Write a program to output the answer.\n\nConstraints\n\n100 ≤ N ≤ 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the abbreviation for the N-th round of ABC.\n\nSample Input 1\n\n100\n\nSample Output 1\n\nABC100\n\nThe 100th round of ABC is ABC100.\n\nSample Input 2\n\n425\n\nSample Output 2\n\nABC425\n\nSample Input 3\n\n999\n\nSample Output 3\n\nABC999", "sample_input": "100\n"}, "reference_outputs": ["ABC100\n"], "source_document_id": "p03643", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest, AtCoder Beginner Contest, is abbreviated as ABC.\n\nWhen we refer to a specific round of ABC, a three-digit number is appended after ABC. For example, ABC680 is the 680th round of ABC.\n\nWhat is the abbreviation for the N-th round of ABC? Write a program to output the answer.\n\nConstraints\n\n100 ≤ N ≤ 999\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the abbreviation for the N-th round of ABC.\n\nSample Input 1\n\n100\n\nSample Output 1\n\nABC100\n\nThe 100th round of ABC is ABC100.\n\nSample Input 2\n\n425\n\nSample Output 2\n\nABC425\n\nSample Input 3\n\n999\n\nSample Output 3\n\nABC999", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 136, "cpu_time_ms": 6, "memory_kb": 2848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s099407885", "group_id": "codeNet:p03644", "input_text": "program main\n implicit none\n integer :: n,i\n\n read(*,*)n\n if (n >= 64) then\n write(*,*)64\n else if (n >= 32) then\n write(*,*)32\n else if (n >= 16) then\n write(*,*)16\n else if (n >= 8) then\n write(*,*)8\n else if (n >= 4) then\n write(*,*)4\n else if (n >= 2) then\n write(*,*)2\n else\n write(*,*)1\n end if\nend program main", "language": "Fortran", "metadata": {"date": 1571611328, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03644.html", "problem_id": "p03644", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03644/input.txt", "sample_output_relpath": "derived/input_output/data/p03644/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03644/Fortran/s099407885.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s099407885", "user_id": "u287431190"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "program main\n implicit none\n integer :: n,i\n\n read(*,*)n\n if (n >= 64) then\n write(*,*)64\n else if (n >= 32) then\n write(*,*)32\n else if (n >= 16) then\n write(*,*)16\n else if (n >= 8) then\n write(*,*)8\n else if (n >= 4) then\n write(*,*)4\n else if (n >= 2) then\n write(*,*)2\n else\n write(*,*)1\n end if\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves numbers divisible by 2.\n\nYou are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.\n\nHere, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.\n\nFor example,\n\n6 can be divided by 2 once: 6 -> 3.\n\n8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.\n\n3 can be divided by 2 zero times.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n4\n\n4 can be divided by 2 twice, which is the most number of times among 1, 2, ..., 7.\n\nSample Input 2\n\n32\n\nSample Output 2\n\n32\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1\n\nSample Input 4\n\n100\n\nSample Output 4\n\n64", "sample_input": "7\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03644", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves numbers divisible by 2.\n\nYou are given a positive integer N. Among the integers between 1 and N (inclusive), find the one that can be divisible by 2 for the most number of times. The solution is always unique.\n\nHere, the number of times an integer can be divisible by 2, is how many times the integer can be divided by 2 without remainder.\n\nFor example,\n\n6 can be divided by 2 once: 6 -> 3.\n\n8 can be divided by 2 three times: 8 -> 4 -> 2 -> 1.\n\n3 can be divided by 2 zero times.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n4\n\n4 can be divided by 2 twice, which is the most number of times among 1, 2, ..., 7.\n\nSample Input 2\n\n32\n\nSample Output 2\n\n32\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1\n\nSample Input 4\n\n100\n\nSample Output 4\n\n64", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 385, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s098834688", "group_id": "codeNet:p03649", "input_text": "program decrease\n implicit none\n integer :: n, i\n integer(8) :: a(50), m, t\n a = 0_8\n read(*,*) n\n read(*,*) a(1:n)\n t = 0_8\n do\n m = maxval(a(1:n))\n if (m.lt.int(n,8)) exit\n m = 0_8\n do i = 1, n\n m = m + a(i)/int(n,8)\n end do\n do i = 1, n\n a(i) = a(i) + m - (a(i)/int(n,8))*int(n+1,8)\n end do\n t = t + m\n end do\n write(*,'(i0)') t\n stop\nend program decrease", "language": "Fortran", "metadata": {"date": 1558159011, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03649.html", "problem_id": "p03649", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03649/input.txt", "sample_output_relpath": "derived/input_output/data/p03649/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03649/Fortran/s098834688.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s098834688", "user_id": "u506403362"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "program decrease\n implicit none\n integer :: n, i\n integer(8) :: a(50), m, t\n a = 0_8\n read(*,*) n\n read(*,*) a(1:n)\n t = 0_8\n do\n m = maxval(a(1:n))\n if (m.lt.int(n,8)) exit\n m = 0_8\n do i = 1, n\n m = m + a(i)/int(n,8)\n end do\n do i = 1, n\n a(i) = a(i) + m - (a(i)/int(n,8))*int(n+1,8)\n end do\n t = t + m\n end do\n write(*,'(i0)') t\n stop\nend program decrease", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller. (The operation is the same as the one in Problem D.)\n\nDetermine the largest element in the sequence (if there is more than one, choose one). Decrease the value of this element by N, and increase each of the other elements by 1.\n\nIt can be proved that the largest element in the sequence becomes N-1 or smaller after a finite number of operations.\n\nYou are given the sequence a_i. Find the number of times we will perform the above operation.\n\nConstraints\n\n2 ≤ N ≤ 50\n\n0 ≤ a_i ≤ 10^{16} + 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of times the operation will be performed.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n0\n\nSample Input 2\n\n3\n1 0 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n2\n2 2\n\nSample Output 3\n\n2\n\nSample Input 4\n\n7\n27 0 0 0 0 0 0\n\nSample Output 4\n\n3\n\nSample Input 5\n\n10\n1000 193 256 777 0 1 1192 1234567891011 48 425\n\nSample Output 5\n\n1234567894848", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03649", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a sequence of length N consisting of non-negative integers. Consider performing the following operation on this sequence until the largest element in this sequence becomes N-1 or smaller. (The operation is the same as the one in Problem D.)\n\nDetermine the largest element in the sequence (if there is more than one, choose one). Decrease the value of this element by N, and increase each of the other elements by 1.\n\nIt can be proved that the largest element in the sequence becomes N-1 or smaller after a finite number of operations.\n\nYou are given the sequence a_i. Find the number of times we will perform the above operation.\n\nConstraints\n\n2 ≤ N ≤ 50\n\n0 ≤ a_i ≤ 10^{16} + 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of times the operation will be performed.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n0\n\nSample Input 2\n\n3\n1 0 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n2\n2 2\n\nSample Output 3\n\n2\n\nSample Input 4\n\n7\n27 0 0 0 0 0 0\n\nSample Output 4\n\n3\n\nSample Input 5\n\n10\n1000 193 256 777 0 1 1192 1234567891011 48 425\n\nSample Output 5\n\n1234567894848", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 403, "cpu_time_ms": 6, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s667323487", "group_id": "codeNet:p03657", "input_text": "program sample\n\tinteger ::A,B,C\n \n read(*,*) A,B \n C=A+B\n \n if (mod(A,3)==0 .or. mod(B,3)==0 .or. mod(C,3)==0) then\n \twrite(*,*) 'possible'\n else\n \twrite(*,*) 'Impossible'\n end if\n stop\nend program sample\n\n", "language": "Fortran", "metadata": {"date": 1592631737, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03657.html", "problem_id": "p03657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03657/input.txt", "sample_output_relpath": "derived/input_output/data/p03657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03657/Fortran/s667323487.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s667323487", "user_id": "u323210830"}, "prompt_components": {"gold_output": "Possible\n", "input_to_evaluate": "program sample\n\tinteger ::A,B,C\n \n read(*,*) A,B \n C=A+B\n \n if (mod(A,3)==0 .or. mod(B,3)==0 .or. mod(C,3)==0) then\n \twrite(*,*) 'possible'\n else\n \twrite(*,*) 'Impossible'\n end if\n stop\nend program sample\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke is giving cookies to his three goats.\n\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\n\nYour task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.\n\nConstraints\n\n1 \\leq A,B \\leq 100\n\nBoth A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nPossible\n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nImpossible\n\nSince there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.", "sample_input": "4 5\n"}, "reference_outputs": ["Possible\n"], "source_document_id": "p03657", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke is giving cookies to his three goats.\n\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\n\nYour task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.\n\nConstraints\n\n1 \\leq A,B \\leq 100\n\nBoth A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nPossible\n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nImpossible\n\nSince there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 238, "cpu_time_ms": 6, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s245142086", "group_id": "codeNet:p03657", "input_text": "program ABC067A\n implicit none\n integer(8)::A,B\n read(5,*)A,B\n if(mod(A,3)==0.or.mod(B,3)==0.or.mod(A+B,3)==0)then\n print'(A)',\"Possible\"\n else\n print'(A)',\"Impossible\"\n end if\nend program ABC067A", "language": "Fortran", "metadata": {"date": 1580422649, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03657.html", "problem_id": "p03657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03657/input.txt", "sample_output_relpath": "derived/input_output/data/p03657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03657/Fortran/s245142086.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s245142086", "user_id": "u414699019"}, "prompt_components": {"gold_output": "Possible\n", "input_to_evaluate": "program ABC067A\n implicit none\n integer(8)::A,B\n read(5,*)A,B\n if(mod(A,3)==0.or.mod(B,3)==0.or.mod(A+B,3)==0)then\n print'(A)',\"Possible\"\n else\n print'(A)',\"Impossible\"\n end if\nend program ABC067A", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke is giving cookies to his three goats.\n\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\n\nYour task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.\n\nConstraints\n\n1 \\leq A,B \\leq 100\n\nBoth A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nPossible\n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nImpossible\n\nSince there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.", "sample_input": "4 5\n"}, "reference_outputs": ["Possible\n"], "source_document_id": "p03657", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke is giving cookies to his three goats.\n\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\n\nYour task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.\n\nConstraints\n\n1 \\leq A,B \\leq 100\n\nBoth A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nPossible\n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nImpossible\n\nSince there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 228, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s841914056", "group_id": "codeNet:p03657", "input_text": "read*,i,j;print*,merge(\" Possible\",\"Impossible\",mod((i+j)*i*j,3)==0);end", "language": "Fortran", "metadata": {"date": 1556256096, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03657.html", "problem_id": "p03657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03657/input.txt", "sample_output_relpath": "derived/input_output/data/p03657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03657/Fortran/s841914056.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s841914056", "user_id": "u394482932"}, "prompt_components": {"gold_output": "Possible\n", "input_to_evaluate": "read*,i,j;print*,merge(\" Possible\",\"Impossible\",mod((i+j)*i*j,3)==0);end", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke is giving cookies to his three goats.\n\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\n\nYour task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.\n\nConstraints\n\n1 \\leq A,B \\leq 100\n\nBoth A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nPossible\n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nImpossible\n\nSince there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.", "sample_input": "4 5\n"}, "reference_outputs": ["Possible\n"], "source_document_id": "p03657", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke is giving cookies to his three goats.\n\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\n\nYour task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.\n\nConstraints\n\n1 \\leq A,B \\leq 100\n\nBoth A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nPossible\n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nImpossible\n\nSince there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 73, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s982588292", "group_id": "codeNet:p03657", "input_text": "read*,i,j;print*,merge(\" Possible\",\"Impossible\",mod(i+j,3)==0);end", "language": "Fortran", "metadata": {"date": 1556255956, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03657.html", "problem_id": "p03657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03657/input.txt", "sample_output_relpath": "derived/input_output/data/p03657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03657/Fortran/s982588292.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s982588292", "user_id": "u394482932"}, "prompt_components": {"gold_output": "Possible\n", "input_to_evaluate": "read*,i,j;print*,merge(\" Possible\",\"Impossible\",mod(i+j,3)==0);end", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke is giving cookies to his three goats.\n\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\n\nYour task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.\n\nConstraints\n\n1 \\leq A,B \\leq 100\n\nBoth A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nPossible\n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nImpossible\n\nSince there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.", "sample_input": "4 5\n"}, "reference_outputs": ["Possible\n"], "source_document_id": "p03657", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke is giving cookies to his three goats.\n\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\n\nYour task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.\n\nConstraints\n\n1 \\leq A,B \\leq 100\n\nBoth A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nPossible\n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nImpossible\n\nSince there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 67, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s821188101", "group_id": "codeNet:p03657", "input_text": " program main\n read(*,*) i, j\n if (mod(i,3).eq.0) then\n write(*,*) \"Possible\"\n else if (mod(j,3).eq.0) then\n write(*,*) \"Possible\"\n else if (mod(i+j,3).eq.0) then\n write(*,*) \"Possible\"\n else\n write(*,*) \"Impossible\"\n end if\n end\n", "language": "Fortran", "metadata": {"date": 1509674719, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03657.html", "problem_id": "p03657", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03657/input.txt", "sample_output_relpath": "derived/input_output/data/p03657/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03657/Fortran/s821188101.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s821188101", "user_id": "u857484987"}, "prompt_components": {"gold_output": "Possible\n", "input_to_evaluate": " program main\n read(*,*) i, j\n if (mod(i,3).eq.0) then\n write(*,*) \"Possible\"\n else if (mod(j,3).eq.0) then\n write(*,*) \"Possible\"\n else if (mod(i+j,3).eq.0) then\n write(*,*) \"Possible\"\n else\n write(*,*) \"Impossible\"\n end if\n end\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke is giving cookies to his three goats.\n\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\n\nYour task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.\n\nConstraints\n\n1 \\leq A,B \\leq 100\n\nBoth A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nPossible\n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nImpossible\n\nSince there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.", "sample_input": "4 5\n"}, "reference_outputs": ["Possible\n"], "source_document_id": "p03657", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke is giving cookies to his three goats.\n\nHe has two cookie tins. One contains A cookies, and the other contains B cookies. He can thus give A cookies, B cookies or A+B cookies to his goats (he cannot open the tins).\n\nYour task is to determine whether Snuke can give cookies to his three goats so that each of them can have the same number of cookies.\n\nConstraints\n\n1 \\leq A,B \\leq 100\n\nBoth A and B are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf it is possible to give cookies so that each of the three goats can have the same number of cookies, print Possible; otherwise, print Impossible.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nPossible\n\nIf Snuke gives nine cookies, each of the three goats can have three cookies.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nImpossible\n\nSince there are only two cookies, the three goats cannot have the same number of cookies no matter what Snuke gives to them.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 298, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s768684051", "group_id": "codeNet:p03658", "input_text": "INTEGER M,K\nINTEGER,ALLOCATABLE,DIMENSION(:)::L\nINTEGER ANSWER\nREAD*,M,K\nALLOCATE(L(M))\nREAD*,L\nCALL HEAPSORT(M,L)\nANSWER=0\nDO I=0,K-1\n ANSWER=ANSWER+L(M-I)\nENDDO\nPRINT\"(I0)\",ANSWER\n\nCONTAINS\n\nsubroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n integer :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n \n return\nend subroutine heapsort\nEND", "language": "Fortran", "metadata": {"date": 1551751093, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03658.html", "problem_id": "p03658", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03658/input.txt", "sample_output_relpath": "derived/input_output/data/p03658/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03658/Fortran/s768684051.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s768684051", "user_id": "u598073939"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "INTEGER M,K\nINTEGER,ALLOCATABLE,DIMENSION(:)::L\nINTEGER ANSWER\nREAD*,M,K\nALLOCATE(L(M))\nREAD*,L\nCALL HEAPSORT(M,L)\nANSWER=0\nDO I=0,K-1\n ANSWER=ANSWER+L(M-I)\nENDDO\nPRINT\"(I0)\",ANSWER\n\nCONTAINS\n\nsubroutine heapsort(n,array)\n implicit none\n integer,intent(in) :: n\n integer,intent(inout) :: array(1:n)\n \n integer ::i,k,j,l\n integer :: t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n \n return\nend subroutine heapsort\nEND", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke has N sticks.\nThe length of the i-th stick is l_i.\n\nSnuke is making a snake toy by joining K of the sticks together.\n\nThe length of the toy is represented by the sum of the individual sticks that compose it.\nFind the maximum possible length of the toy.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 50\n\n1 \\leq l_i \\leq 50\n\nl_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nl_1 l_2 l_3 ... l_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5 3\n1 2 3 4 5\n\nSample Output 1\n\n12\n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5, which is the maximum possible length.\n\nSample Input 2\n\n15 14\n50 26 27 21 41 7 42 35 7 5 5 36 39 1 45\n\nSample Output 2\n\n386", "sample_input": "5 3\n1 2 3 4 5\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03658", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke has N sticks.\nThe length of the i-th stick is l_i.\n\nSnuke is making a snake toy by joining K of the sticks together.\n\nThe length of the toy is represented by the sum of the individual sticks that compose it.\nFind the maximum possible length of the toy.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 50\n\n1 \\leq l_i \\leq 50\n\nl_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nl_1 l_2 l_3 ... l_{N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5 3\n1 2 3 4 5\n\nSample Output 1\n\n12\n\nYou can make a toy of length 12 by joining the sticks of lengths 3, 4 and 5, which is the maximum possible length.\n\nSample Input 2\n\n15 14\n50 26 27 21 41 7 42 35 7 5 5 36 39 1 45\n\nSample Output 2\n\n386", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1007, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s825748976", "group_id": "codeNet:p03671", "input_text": "read*,i,j,k\nprint*,(i+j+k)-max(i,j,k)\nend", "language": "Fortran", "metadata": {"date": 1580696252, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03671.html", "problem_id": "p03671", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03671/input.txt", "sample_output_relpath": "derived/input_output/data/p03671/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03671/Fortran/s825748976.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s825748976", "user_id": "u171356453"}, "prompt_components": {"gold_output": "1300\n", "input_to_evaluate": "read*,i,j,k\nprint*,(i+j+k)-max(i,j,k)\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke is buying a bicycle.\nThe bicycle of his choice does not come with a bell, so he has to buy one separately.\n\nHe has very high awareness of safety, and decides to buy two bells, one for each hand.\n\nThe store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively.\nFind the minimum total price of two different bells.\n\nConstraints\n\n1 \\leq a,b,c \\leq 10000\n\na, b and c are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c\n\nOutput\n\nPrint the minimum total price of two different bells.\n\nSample Input 1\n\n700 600 780\n\nSample Output 1\n\n1300\n\nBuying a 700-yen bell and a 600-yen bell costs 1300 yen.\n\nBuying a 700-yen bell and a 780-yen bell costs 1480 yen.\n\nBuying a 600-yen bell and a 780-yen bell costs 1380 yen.\n\nThe minimum among these is 1300 yen.\n\nSample Input 2\n\n10000 10000 10000\n\nSample Output 2\n\n20000\n\nBuying any two bells costs 20000 yen.", "sample_input": "700 600 780\n"}, "reference_outputs": ["1300\n"], "source_document_id": "p03671", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke is buying a bicycle.\nThe bicycle of his choice does not come with a bell, so he has to buy one separately.\n\nHe has very high awareness of safety, and decides to buy two bells, one for each hand.\n\nThe store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively.\nFind the minimum total price of two different bells.\n\nConstraints\n\n1 \\leq a,b,c \\leq 10000\n\na, b and c are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c\n\nOutput\n\nPrint the minimum total price of two different bells.\n\nSample Input 1\n\n700 600 780\n\nSample Output 1\n\n1300\n\nBuying a 700-yen bell and a 600-yen bell costs 1300 yen.\n\nBuying a 700-yen bell and a 780-yen bell costs 1480 yen.\n\nBuying a 600-yen bell and a 780-yen bell costs 1380 yen.\n\nThe minimum among these is 1300 yen.\n\nSample Input 2\n\n10000 10000 10000\n\nSample Output 2\n\n20000\n\nBuying any two bells costs 20000 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 41, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s900726512", "group_id": "codeNet:p03671", "input_text": "program main\n\timplicit none\n integer a, b,c\n read(*, *) a, b, c\n write(*, *) min(a+b, b+c, c+a)\nend program main", "language": "Fortran", "metadata": {"date": 1529810285, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03671.html", "problem_id": "p03671", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03671/input.txt", "sample_output_relpath": "derived/input_output/data/p03671/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03671/Fortran/s900726512.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900726512", "user_id": "u728000113"}, "prompt_components": {"gold_output": "1300\n", "input_to_evaluate": "program main\n\timplicit none\n integer a, b,c\n read(*, *) a, b, c\n write(*, *) min(a+b, b+c, c+a)\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke is buying a bicycle.\nThe bicycle of his choice does not come with a bell, so he has to buy one separately.\n\nHe has very high awareness of safety, and decides to buy two bells, one for each hand.\n\nThe store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively.\nFind the minimum total price of two different bells.\n\nConstraints\n\n1 \\leq a,b,c \\leq 10000\n\na, b and c are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c\n\nOutput\n\nPrint the minimum total price of two different bells.\n\nSample Input 1\n\n700 600 780\n\nSample Output 1\n\n1300\n\nBuying a 700-yen bell and a 600-yen bell costs 1300 yen.\n\nBuying a 700-yen bell and a 780-yen bell costs 1480 yen.\n\nBuying a 600-yen bell and a 780-yen bell costs 1380 yen.\n\nThe minimum among these is 1300 yen.\n\nSample Input 2\n\n10000 10000 10000\n\nSample Output 2\n\n20000\n\nBuying any two bells costs 20000 yen.", "sample_input": "700 600 780\n"}, "reference_outputs": ["1300\n"], "source_document_id": "p03671", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke is buying a bicycle.\nThe bicycle of his choice does not come with a bell, so he has to buy one separately.\n\nHe has very high awareness of safety, and decides to buy two bells, one for each hand.\n\nThe store sells three kinds of bells for the price of a, b and c yen (the currency of Japan), respectively.\nFind the minimum total price of two different bells.\n\nConstraints\n\n1 \\leq a,b,c \\leq 10000\n\na, b and c are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c\n\nOutput\n\nPrint the minimum total price of two different bells.\n\nSample Input 1\n\n700 600 780\n\nSample Output 1\n\n1300\n\nBuying a 700-yen bell and a 600-yen bell costs 1300 yen.\n\nBuying a 700-yen bell and a 780-yen bell costs 1480 yen.\n\nBuying a 600-yen bell and a 780-yen bell costs 1380 yen.\n\nThe minimum among these is 1300 yen.\n\nSample Input 2\n\n10000 10000 10000\n\nSample Output 2\n\n20000\n\nBuying any two bells costs 20000 yen.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 121, "cpu_time_ms": 4, "memory_kb": 768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s728956832", "group_id": "codeNet:p03673", "input_text": "program main\n\timplicit none\n\tinteger n, i\n\tinteger, allocatable :: a(:)\n\tread(*, *) n\n\tallocate(a(1: n))\n\tread(*, *) a(1: n)\n\tif(n == 1) then\n\t\twrite(*, *)\ta(1)\n\telse\n\t\tif(mod(n,2) == 0) then\n\t\t\tdo i = n, 2, -2\n\t\t\t\twrite(*, '(I0)', advance = 'NO') a(i)\n\t\t\t\twrite(*, '(a)', advance = 'NO') ' '\n\t\t\tend do\n\t\t\tdo i = 1, n-3, 2\n\t\t\t\twrite(*, '(I0)', advance = 'NO') a(i)\n\t\t\t\twrite(*, '(a)', advance = 'NO') ' '\n\t\t\tend do\n\t\t\twrite(*, '(I0)') a(n-1)\n\t\telse\n\t\t\tdo i = n, 1, -2\n\t\t\t\twrite(*, '(I0)', advance = 'NO') a(i)\n\t\t\t\twrite(*, '(a)', advance = 'NO') ' '\n\t\t\tend do\n\t\t\tdo i = 2, n-3, 2\n\t\t\t\twrite(*, '(I0)', advance = 'NO') a(i)\n\t\t\t\twrite(*, '(a)', advance = 'NO') ' '\n\t\t\tend do\n\t\t\twrite(*, '(I0)') a(n-1)\n\t\tend if\n\tend if\nend program main", "language": "Fortran", "metadata": {"date": 1529274320, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03673.html", "problem_id": "p03673", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03673/input.txt", "sample_output_relpath": "derived/input_output/data/p03673/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03673/Fortran/s728956832.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s728956832", "user_id": "u728000113"}, "prompt_components": {"gold_output": "4 2 1 3\n", "input_to_evaluate": "program main\n\timplicit none\n\tinteger n, i\n\tinteger, allocatable :: a(:)\n\tread(*, *) n\n\tallocate(a(1: n))\n\tread(*, *) a(1: n)\n\tif(n == 1) then\n\t\twrite(*, *)\ta(1)\n\telse\n\t\tif(mod(n,2) == 0) then\n\t\t\tdo i = n, 2, -2\n\t\t\t\twrite(*, '(I0)', advance = 'NO') a(i)\n\t\t\t\twrite(*, '(a)', advance = 'NO') ' '\n\t\t\tend do\n\t\t\tdo i = 1, n-3, 2\n\t\t\t\twrite(*, '(I0)', advance = 'NO') a(i)\n\t\t\t\twrite(*, '(a)', advance = 'NO') ' '\n\t\t\tend do\n\t\t\twrite(*, '(I0)') a(n-1)\n\t\telse\n\t\t\tdo i = n, 1, -2\n\t\t\t\twrite(*, '(I0)', advance = 'NO') a(i)\n\t\t\t\twrite(*, '(a)', advance = 'NO') ' '\n\t\t\tend do\n\t\t\tdo i = 2, n-3, 2\n\t\t\t\twrite(*, '(I0)', advance = 'NO') a(i)\n\t\t\t\twrite(*, '(a)', advance = 'NO') ' '\n\t\t\tend do\n\t\t\twrite(*, '(I0)') a(n-1)\n\t\tend if\n\tend if\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "sample_input": "4\n1 2 3 4\n"}, "reference_outputs": ["4 2 1 3\n"], "source_document_id": "p03673", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 732, "cpu_time_ms": 208, "memory_kb": 3456}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s872525350", "group_id": "codeNet:p03673", "input_text": "\tprogram main\n\tinteger n, a(1:20010), b(1:20010)\n\tread *, n\n\tread *,(a(i),i=1,n)\n\tif (n .gt. 1) then\n\t\tdo i = 1, n/2\n\t\t\tb(i) = a(n-i+1)\n\t\t\tb(n-i+1) = a(n-i)\n\t\tend do\n\tend if\n\tif (mod(n,2) .eq. 1) b(n/2+1) = a(n/2+1)\n\twrite(6,*) (b(i),i = 1,n)\n\tend", "language": "Fortran", "metadata": {"date": 1498965144, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03673.html", "problem_id": "p03673", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03673/input.txt", "sample_output_relpath": "derived/input_output/data/p03673/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03673/Fortran/s872525350.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s872525350", "user_id": "u857484987"}, "prompt_components": {"gold_output": "4 2 1 3\n", "input_to_evaluate": "\tprogram main\n\tinteger n, a(1:20010), b(1:20010)\n\tread *, n\n\tread *,(a(i),i=1,n)\n\tif (n .gt. 1) then\n\t\tdo i = 1, n/2\n\t\t\tb(i) = a(n-i+1)\n\t\t\tb(n-i+1) = a(n-i)\n\t\tend do\n\tend if\n\tif (mod(n,2) .eq. 1) b(n/2+1) = a(n/2+1)\n\twrite(6,*) (b(i),i = 1,n)\n\tend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "sample_input": "4\n1 2 3 4\n"}, "reference_outputs": ["4 2 1 3\n"], "source_document_id": "p03673", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length n, a_1, ..., a_n.\nLet us consider performing the following n operations on an empty sequence b.\n\nThe i-th operation is as follows:\n\nAppend a_i to the end of b.\n\nReverse the order of the elements in b.\n\nFind the sequence b obtained after these n operations.\n\nConstraints\n\n1 \\leq n \\leq 2\\times 10^5\n\n0 \\leq a_i \\leq 10^9\n\nn and a_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn\na_1 a_2 ... a_n\n\nOutput\n\nPrint n integers in a line with spaces in between.\nThe i-th integer should be b_i.\n\nSample Input 1\n\n4\n1 2 3 4\n\nSample Output 1\n\n4 2 1 3\n\nAfter step 1 of the first operation, b becomes: 1.\n\nAfter step 2 of the first operation, b becomes: 1.\n\nAfter step 1 of the second operation, b becomes: 1, 2.\n\nAfter step 2 of the second operation, b becomes: 2, 1.\n\nAfter step 1 of the third operation, b becomes: 2, 1, 3.\n\nAfter step 2 of the third operation, b becomes: 3, 1, 2.\n\nAfter step 1 of the fourth operation, b becomes: 3, 1, 2, 4.\n\nAfter step 2 of the fourth operation, b becomes: 4, 2, 1, 3.\n\nThus, the answer is 4 2 1 3.\n\nSample Input 2\n\n3\n1 2 3\n\nSample Output 2\n\n3 1 2\n\nAs shown above in Sample Output 1, b becomes 3, 1, 2 after step 2 of the third operation. Thus, the answer is 3 1 2.\n\nSample Input 3\n\n1\n1000000000\n\nSample Output 3\n\n1000000000\n\nSample Input 4\n\n6\n0 6 7 6 7 0\n\nSample Output 4\n\n0 6 6 0 7 7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 247, "cpu_time_ms": 108, "memory_kb": 984}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s424877697", "group_id": "codeNet:p03680", "input_text": "program sample\n implicit none\n integer(8) :: n,i,b\ninteger(8),allocatable :: a(:)\n \nread(*,*) n\nallocate(a(n))\ndo i=1,n\nread(*,*) a(i)\nend do\n \nb=1\ndo i=1,n\n b=a(b)\n if(a(b)==2)then\n write(*,*) i\n stop\n endif \nend do\n \nwrite(*,*) -1\n \nend program sample", "language": "Fortran", "metadata": {"date": 1599487036, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Fortran/s424877697.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s424877697", "user_id": "u943740059"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program sample\n implicit none\n integer(8) :: n,i,b\ninteger(8),allocatable :: a(:)\n \nread(*,*) n\nallocate(a(n))\ndo i=1,n\nread(*,*) a(i)\nend do\n \nb=1\ndo i=1,n\n b=a(b)\n if(a(b)==2)then\n write(*,*) i\n stop\n endif \nend do\n \nwrite(*,*) -1\n \nend program sample", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 273, "cpu_time_ms": 47, "memory_kb": 3612}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s197052551", "group_id": "codeNet:p03680", "input_text": "program name\n implicit none\n integer(4):: n,i,cnt\n integer(4),allocatable:: a(:)\n logical,allocatable:: pulled(:)\n\n read*, n\n allocate(a(n),pulled(n))\n\n do i=1,n\n read*, a(i)\n end do\n\n pulled(:) = .false.\n i=1\n cnt = 0\n do while(.not.(pulled(2)))\n i = a(i)\n if (pulled(i)) then\n print*, -1\n stop\n end if\n pulled(i) = .true.\n cnt=cnt+1\n end do\n\n print*, cnt\n\nend program name", "language": "Fortran", "metadata": {"date": 1586649381, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Fortran/s197052551.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s197052551", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program name\n implicit none\n integer(4):: n,i,cnt\n integer(4),allocatable:: a(:)\n logical,allocatable:: pulled(:)\n\n read*, n\n allocate(a(n),pulled(n))\n\n do i=1,n\n read*, a(i)\n end do\n\n pulled(:) = .false.\n i=1\n cnt = 0\n do while(.not.(pulled(2)))\n i = a(i)\n if (pulled(i)) then\n print*, -1\n stop\n end if\n pulled(i) = .true.\n cnt=cnt+1\n end do\n\n print*, cnt\n\nend program name", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 480, "cpu_time_ms": 37, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s023160206", "group_id": "codeNet:p03680", "input_text": "program main\n implicit none\n \n integer :: n,a(100000),i,j,c=0,f=1\n \n read(*,*)n\n do i = 1, n\n read(*,*)a(i)\n end do\n \n do i = 1, n\n c = c + 1 \n f = a(f)\n if (f == 2) then\n write(*,*)c\n stop\n end if\n end do\n write(*,*)-1\nend program main\n ", "language": "Fortran", "metadata": {"date": 1571669749, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Fortran/s023160206.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s023160206", "user_id": "u287431190"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\n implicit none\n \n integer :: n,a(100000),i,j,c=0,f=1\n \n read(*,*)n\n do i = 1, n\n read(*,*)a(i)\n end do\n \n do i = 1, n\n c = c + 1 \n f = a(f)\n if (f == 2) then\n write(*,*)c\n stop\n end if\n end do\n write(*,*)-1\nend program main\n ", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 277, "cpu_time_ms": 35, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s008440694", "group_id": "codeNet:p03680", "input_text": "program trained\n implicit none\n integer :: n, a(100000) = 0, i, k\n read(*,*) n\n do i = 1, n\n read(*,*) a(i)\n end do\n i = 1\n do k = 1, n\n i = a(i)\n if (i == 2) then\n write(*,'(i0)') k\n stop\n end if\n end do\n write(*,'(i0)') -1\nend program trained", "language": "Fortran", "metadata": {"date": 1570412868, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03680.html", "problem_id": "p03680", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03680/input.txt", "sample_output_relpath": "derived/input_output/data/p03680/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03680/Fortran/s008440694.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s008440694", "user_id": "u506403362"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program trained\n implicit none\n integer :: n, a(100000) = 0, i, k\n read(*,*) n\n do i = 1, n\n read(*,*) a(i)\n end do\n i = 1\n do k = 1, n\n i = a(i)\n if (i == 2) then\n write(*,'(i0)') k\n stop\n end if\n end do\n write(*,'(i0)') -1\nend program trained", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "sample_input": "3\n3\n1\n2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03680", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi wants to gain muscle, and decides to work out at AtCoder Gym.\n\nThe exercise machine at the gym has N buttons, and exactly one of the buttons is lighten up.\nThese buttons are numbered 1 through N.\nWhen Button i is lighten up and you press it, the light is turned off, and then Button a_i will be lighten up. It is possible that i=a_i.\nWhen Button i is not lighten up, nothing will happen by pressing it.\n\nInitially, Button 1 is lighten up. Takahashi wants to quit pressing buttons when Button 2 is lighten up.\n\nDetermine whether this is possible. If the answer is positive, find the minimum number of times he needs to press buttons.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1\na_2\n:\na_N\n\nOutput\n\nPrint -1 if it is impossible to lighten up Button 2.\nOtherwise, print the minimum number of times we need to press buttons in order to lighten up Button 2.\n\nSample Input 1\n\n3\n3\n1\n2\n\nSample Output 1\n\n2\n\nPress Button 1, then Button 3.\n\nSample Input 2\n\n4\n3\n4\n1\n2\n\nSample Output 2\n\n-1\n\nPressing Button 1 lightens up Button 3, and vice versa, so Button 2 will never be lighten up.\n\nSample Input 3\n\n5\n3\n3\n4\n2\n4\n\nSample Output 3\n\n3", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 275, "cpu_time_ms": 38, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s452967320", "group_id": "codeNet:p03687", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n character(100):: s\n integer(int32):: ans,i,si,osi,dst,inf=1000000000\n\n read*, s\n ans=inf\n do i=ichar('a'),ichar('z')\n ! print*, '--',char(i)\n dst=0\n osi=0\n do si=1,len_trim(s)\n if (s(si:si) == char(i)) then\n dst=max(dst,si-osi-1)\n osi=si\n end if\n end do\n ! print*, dst,len_trim(s)-osi-1\n dst=max(dst,len_trim(s)-osi)\n osi=inf\n do si=1,len_trim(s)\n if (s(si:si)==char(i)) then\n osi=si\n exit\n end if\n end do\n ! print*, osi-1,dst\n ans=min(ans, max(osi-1,dst))\n end do\n print'(i0)', ans\nend program name", "language": "Fortran", "metadata": {"date": 1587056482, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03687.html", "problem_id": "p03687", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03687/input.txt", "sample_output_relpath": "derived/input_output/data/p03687/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03687/Fortran/s452967320.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s452967320", "user_id": "u234636620"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n character(100):: s\n integer(int32):: ans,i,si,osi,dst,inf=1000000000\n\n read*, s\n ans=inf\n do i=ichar('a'),ichar('z')\n ! print*, '--',char(i)\n dst=0\n osi=0\n do si=1,len_trim(s)\n if (s(si:si) == char(i)) then\n dst=max(dst,si-osi-1)\n osi=si\n end if\n end do\n ! print*, dst,len_trim(s)-osi-1\n dst=max(dst,len_trim(s)-osi)\n osi=inf\n do si=1,len_trim(s)\n if (s(si:si)==char(i)) then\n osi=si\n exit\n end if\n end do\n ! print*, osi-1,dst\n ans=min(ans, max(osi-1,dst))\n end do\n print'(i0)', ans\nend program name", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke can change a string t of length N into a string t' of length N - 1 under the following rule:\n\nFor each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t.\n\nThere is a string s consisting of lowercase English letters.\nSnuke's objective is to apply the above operation to s repeatedly so that all the characters in s are the same.\nFind the minimum necessary number of operations.\n\nConstraints\n\n1 ≤ |s| ≤ 100\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum necessary number of operations to achieve the objective.\n\nSample Input 1\n\nserval\n\nSample Output 1\n\n3\n\nOne solution is: serval → srvvl → svvv → vvv.\n\nSample Input 2\n\njackal\n\nSample Output 2\n\n2\n\nOne solution is: jackal → aacaa → aaaa.\n\nSample Input 3\n\nzzz\n\nSample Output 3\n\n0\n\nAll the characters in s are the same from the beginning.\n\nSample Input 4\n\nwhbrjpjyhsrywlqjxdbrbaomnw\n\nSample Output 4\n\n8\n\nIn 8 operations, he can change s to rrrrrrrrrrrrrrrrrr.", "sample_input": "serval\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03687", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke can change a string t of length N into a string t' of length N - 1 under the following rule:\n\nFor each i (1 ≤ i ≤ N - 1), the i-th character of t' must be either the i-th or (i + 1)-th character of t.\n\nThere is a string s consisting of lowercase English letters.\nSnuke's objective is to apply the above operation to s repeatedly so that all the characters in s are the same.\nFind the minimum necessary number of operations.\n\nConstraints\n\n1 ≤ |s| ≤ 100\n\ns consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum necessary number of operations to achieve the objective.\n\nSample Input 1\n\nserval\n\nSample Output 1\n\n3\n\nOne solution is: serval → srvvl → svvv → vvv.\n\nSample Input 2\n\njackal\n\nSample Output 2\n\n2\n\nOne solution is: jackal → aacaa → aaaa.\n\nSample Input 3\n\nzzz\n\nSample Output 3\n\n0\n\nAll the characters in s are the same from the beginning.\n\nSample Input 4\n\nwhbrjpjyhsrywlqjxdbrbaomnw\n\nSample Output 4\n\n8\n\nIn 8 operations, he can change s to rrrrrrrrrrrrrrrrrr.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 777, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s795039638", "group_id": "codeNet:p03689", "input_text": "program plus_minus_rectangle\n implicit none\n integer :: h, w, x, y, a(500,500), s(0:500,0:500), i, j\n a = 0\n s = 0\n read(*,*) h, w, x, y\n if (mod(h,x).eq.0.and.mod(w,y).eq.0) then\n write(*,'(a)') \"No\"\n end if\n write(*,'(a)') \"Yes\"\n do i = 1, h, x\n do j = 1, w, y\n a(i,j) = 1\n if (i+x-1.le.h.and.j+y-1.le.w) a(i+x-1,j+y-1) = -2\n end do\n end do\n do i = 1, h\n call output(a(i,1:w))\n end do\n stop\ncontains\n subroutine output(a)\n implicit none\n integer, intent(in) :: a(:)\n integer :: n, i\n n = size(a)\n do i = 1, n\n write(*,'(i0,x)',advance='no') a(i)\n end do\n write(*,*)\n return\n end subroutine output\nend program plus_minus_rectangle", "language": "Fortran", "metadata": {"date": 1562638529, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03689.html", "problem_id": "p03689", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03689/input.txt", "sample_output_relpath": "derived/input_output/data/p03689/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03689/Fortran/s795039638.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s795039638", "user_id": "u506403362"}, "prompt_components": {"gold_output": "Yes\n1 1 1\n1 -4 1\n1 1 1\n", "input_to_evaluate": "program plus_minus_rectangle\n implicit none\n integer :: h, w, x, y, a(500,500), s(0:500,0:500), i, j\n a = 0\n s = 0\n read(*,*) h, w, x, y\n if (mod(h,x).eq.0.and.mod(w,y).eq.0) then\n write(*,'(a)') \"No\"\n end if\n write(*,'(a)') \"Yes\"\n do i = 1, h, x\n do j = 1, w, y\n a(i,j) = 1\n if (i+x-1.le.h.and.j+y-1.le.w) a(i+x-1,j+y-1) = -2\n end do\n end do\n do i = 1, h\n call output(a(i,1:w))\n end do\n stop\ncontains\n subroutine output(a)\n implicit none\n integer, intent(in) :: a(:)\n integer :: n, i\n n = size(a)\n do i = 1, n\n write(*,'(i0,x)',advance='no') a(i)\n end do\n write(*,*)\n return\n end subroutine output\nend program plus_minus_rectangle", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given four integers: H, W, h and w (1 ≤ h ≤ H, 1 ≤ w ≤ W).\nDetermine whether there exists a matrix such that all of the following conditions are held, and construct one such matrix if the answer is positive:\n\nThe matrix has H rows and W columns.\n\nEach element of the matrix is an integer between -10^9 and 10^9 (inclusive).\n\nThe sum of all the elements of the matrix is positive.\n\nThe sum of all the elements within every subrectangle with h rows and w columns in the matrix is negative.\n\nConstraints\n\n1 ≤ h ≤ H ≤ 500\n\n1 ≤ w ≤ W ≤ 500\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W h w\n\nOutput\n\nIf there does not exist a matrix that satisfies all of the conditions, print No.\n\nOtherwise, print Yes in the first line, and print a matrix in the subsequent lines in the following format:\n\na_{11} ... a_{1W}\n:\na_{H1} ... a_{HW}\n\nHere, a_{ij} represents the (i,\\ j) element of the matrix.\n\nSample Input 1\n\n3 3 2 2\n\nSample Output 1\n\nYes\n1 1 1\n1 -4 1\n1 1 1\n\nThe sum of all the elements of this matrix is 4, which is positive.\nAlso, in this matrix, there are four subrectangles with 2 rows and 2 columns as shown below. For each of them, the sum of all the elements inside is -1, which is negative.\n\nSample Input 2\n\n2 4 1 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 4 2 3\n\nSample Output 3\n\nYes\n2 -5 8 7\n3 -5 -4 -5\n2 1 -1 7", "sample_input": "3 3 2 2\n"}, "reference_outputs": ["Yes\n1 1 1\n1 -4 1\n1 1 1\n"], "source_document_id": "p03689", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given four integers: H, W, h and w (1 ≤ h ≤ H, 1 ≤ w ≤ W).\nDetermine whether there exists a matrix such that all of the following conditions are held, and construct one such matrix if the answer is positive:\n\nThe matrix has H rows and W columns.\n\nEach element of the matrix is an integer between -10^9 and 10^9 (inclusive).\n\nThe sum of all the elements of the matrix is positive.\n\nThe sum of all the elements within every subrectangle with h rows and w columns in the matrix is negative.\n\nConstraints\n\n1 ≤ h ≤ H ≤ 500\n\n1 ≤ w ≤ W ≤ 500\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W h w\n\nOutput\n\nIf there does not exist a matrix that satisfies all of the conditions, print No.\n\nOtherwise, print Yes in the first line, and print a matrix in the subsequent lines in the following format:\n\na_{11} ... a_{1W}\n:\na_{H1} ... a_{HW}\n\nHere, a_{ij} represents the (i,\\ j) element of the matrix.\n\nSample Input 1\n\n3 3 2 2\n\nSample Output 1\n\nYes\n1 1 1\n1 -4 1\n1 1 1\n\nThe sum of all the elements of this matrix is 4, which is positive.\nAlso, in this matrix, there are four subrectangles with 2 rows and 2 columns as shown below. For each of them, the sum of all the elements inside is -1, which is negative.\n\nSample Input 2\n\n2 4 1 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 4 2 3\n\nSample Output 3\n\nYes\n2 -5 8 7\n3 -5 -4 -5\n2 1 -1 7", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 697, "cpu_time_ms": 80, "memory_kb": 2944}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s156647318", "group_id": "codeNet:p03694", "input_text": "program main\n integer N\n integer, allocatable :: a(:)\n read(*, *) N\n allocate(a(1: N))\n read(*, *) a(1: N)\n write(*, *) maxval(a(:)) - minval(a(:))\nend program main", "language": "Fortran", "metadata": {"date": 1523937990, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03694.html", "problem_id": "p03694", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03694/input.txt", "sample_output_relpath": "derived/input_output/data/p03694/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03694/Fortran/s156647318.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s156647318", "user_id": "u728000113"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program main\n integer N\n integer, allocatable :: a(:)\n read(*, *) N\n allocate(a(1: N))\n read(*, *) a(1: N)\n write(*, *) maxval(a(:)) - minval(a(:))\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIt is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.\n\nThere are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.\n\nFind the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n0 ≤ a_i ≤ 1000\n\na_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum distance to be traveled.\n\nSample Input 1\n\n4\n2 3 7 9\n\nSample Output 1\n\n7\n\nThe travel distance of 7 can be achieved by starting at coordinate 9 and traveling straight to coordinate 2.\n\nIt is not possible to do with a travel distance of less than 7, and thus 7 is the minimum distance to be traveled.\n\nSample Input 2\n\n8\n3 1 4 1 5 9 2 6\n\nSample Output 2\n\n8\n\nThere may be more than one house at a position.", "sample_input": "4\n2 3 7 9\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03694", "source_text": "Score : 200 points\n\nProblem Statement\n\nIt is only six months until Christmas, and AtCoDeer the reindeer is now planning his travel to deliver gifts.\n\nThere are N houses along TopCoDeer street. The i-th house is located at coordinate a_i. He has decided to deliver gifts to all these houses.\n\nFind the minimum distance to be traveled when AtCoDeer can start and end his travel at any positions.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n0 ≤ a_i ≤ 1000\n\na_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum distance to be traveled.\n\nSample Input 1\n\n4\n2 3 7 9\n\nSample Output 1\n\n7\n\nThe travel distance of 7 can be achieved by starting at coordinate 9 and traveling straight to coordinate 2.\n\nIt is not possible to do with a travel distance of less than 7, and thus 7 is the minimum distance to be traveled.\n\nSample Input 2\n\n8\n3 1 4 1 5 9 2 6\n\nSample Output 2\n\n8\n\nThere may be more than one house at a position.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 176, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s798808185", "group_id": "codeNet:p03695", "input_text": "program name\n implicit none\n integer(4):: n\n integer(4),allocatable:: a(:)\n integer(4):: over\n integer(4):: i,j\n logical:: iro(9)\n\n read*, n\n allocate(a(n))\n read*, a(:)\n iro(:) = .false.\n over = 0\n\n do i=1,n\n do j=0,4800\n if (j*400 <= a(i) .and. a(i) < (j+1)*400) then\n if (j < 8) then\n iro(j+1) = .true.\n else\n iro(9) = .true.\n over=over+1\n end if\n end if\n end do\n end do\n\n\n print*, tsum(iro)\n print*, tsum(iro)+over -1\n\n\ncontains\n function tsum(larr) result(ret)\n logical:: larr(:)\n integer(4):: ret\n integer(4):: i\n ret=0\n do i=1,size(larr)\n if (larr(i)) ret=ret+1\n end do\n end function\nend program name", "language": "Fortran", "metadata": {"date": 1586662807, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03695.html", "problem_id": "p03695", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03695/input.txt", "sample_output_relpath": "derived/input_output/data/p03695/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03695/Fortran/s798808185.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s798808185", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "program name\n implicit none\n integer(4):: n\n integer(4),allocatable:: a(:)\n integer(4):: over\n integer(4):: i,j\n logical:: iro(9)\n\n read*, n\n allocate(a(n))\n read*, a(:)\n iro(:) = .false.\n over = 0\n\n do i=1,n\n do j=0,4800\n if (j*400 <= a(i) .and. a(i) < (j+1)*400) then\n if (j < 8) then\n iro(j+1) = .true.\n else\n iro(9) = .true.\n over=over+1\n end if\n end if\n end do\n end do\n\n\n print*, tsum(iro)\n print*, tsum(iro)+over -1\n\n\ncontains\n function tsum(larr) result(ret)\n logical:: larr(:)\n integer(4):: ret\n integer(4):: i\n ret=0\n do i=1,size(larr)\n if (larr(i)) ret=ret+1\n end do\n end function\nend program name", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:\n\nRating 1-399 : gray\n\nRating 400-799 : brown\n\nRating 800-1199 : green\n\nRating 1200-1599 : cyan\n\nRating 1600-1999 : blue\n\nRating 2000-2399 : yellow\n\nRating 2400-2799 : orange\n\nRating 2800-3199 : red\n\nOther than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.\n\nCurrently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.\n\nFind the minimum and maximum possible numbers of different colors of the users.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ a_i ≤ 4800\n\na_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.\n\nSample Input 1\n\n4\n2100 2500 2700 2700\n\nSample Output 1\n\n2 2\n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are two different colors.\n\nSample Input 2\n\n5\n1100 1900 2800 3200 3200\n\nSample Output 2\n\n3 5\n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and the user with rating 2800 is \"red\".\n\nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are three different colors. This is one possible scenario for the minimum number of colors.\n\nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are five different colors. This is one possible scenario for the maximum number of colors.\n\nSample Input 3\n\n20\n800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990\n\nSample Output 3\n\n1 1\n\nAll the users are \"green\", and thus there is one color.", "sample_input": "4\n2100 2500 2700 2700\n"}, "reference_outputs": ["2 2\n"], "source_document_id": "p03695", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn AtCoder, a person who has participated in a contest receives a color, which corresponds to the person's rating as follows:\n\nRating 1-399 : gray\n\nRating 400-799 : brown\n\nRating 800-1199 : green\n\nRating 1200-1599 : cyan\n\nRating 1600-1999 : blue\n\nRating 2000-2399 : yellow\n\nRating 2400-2799 : orange\n\nRating 2800-3199 : red\n\nOther than the above, a person whose rating is 3200 or higher can freely pick his/her color, which can be one of the eight colors above or not.\n\nCurrently, there are N users who have participated in a contest in AtCoder, and the i-th user has a rating of a_i.\n\nFind the minimum and maximum possible numbers of different colors of the users.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ a_i ≤ 4800\n\na_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum possible number of different colors of the users, and the maximum possible number of different colors, with a space in between.\n\nSample Input 1\n\n4\n2100 2500 2700 2700\n\nSample Output 1\n\n2 2\n\nThe user with rating 2100 is \"yellow\", and the others are \"orange\". There are two different colors.\n\nSample Input 2\n\n5\n1100 1900 2800 3200 3200\n\nSample Output 2\n\n3 5\n\nThe user with rating 1100 is \"green\", the user with rating 1900 is blue and the user with rating 2800 is \"red\".\n\nIf the fourth user picks \"red\", and the fifth user picks \"blue\", there are three different colors. This is one possible scenario for the minimum number of colors.\n\nIf the fourth user picks \"purple\", and the fifth user picks \"black\", there are five different colors. This is one possible scenario for the maximum number of colors.\n\nSample Input 3\n\n20\n800 810 820 830 840 850 860 870 880 890 900 910 920 930 940 950 960 970 980 990\n\nSample Output 3\n\n1 1\n\nAll the users are \"green\", and thus there is one color.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 849, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s178313285", "group_id": "codeNet:p03696", "input_text": "program prob4\n implicit none\n integer::i, j, l, r, n, mode\n character(len=100)::S\n character(len=300)::ans, tmp\n read(*,*) n\n read(*,*) S\n ans = \"\"\n l = 0\n r = 0\n do i = 1, n\n if(S(i:i) .eq. \"(\") then\n if(r > 0) then\n do j = 1, r\n ans = \")\" // trim(ans)\n end do\n do j = 1, r\n ans = \"(\" // trim(ans)\n end do\n r = 0\n l = 0\n end if\n l = l + 1\n else\n if(l > 0) then\n do j = 1, l\n ans = trim(ans) // \"(\"\n end do\n do j = 1, l\n ans = trim(ans) // \")\"\n end do\n l = 0\n r = 0\n end if\n r = r + 1\n end if\n end do\n if(r > 0) then\n do i = 1, r-1\n ans = trim(ans) // \")\"\n end do\n do i = 1, r-1\n ans = \"(\" // trim(ans)\n end do\n else if(l > 0) then\n do i = 1, l-1\n ans = trim(ans) // \"(\"\n end do\n do i = 1, l-1\n ans = trim(ans) // \"9\"\n end do\n end if\n write(*,'(a)') trim(ans)\n stop\nend program", "language": "Fortran", "metadata": {"date": 1596246305, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03696.html", "problem_id": "p03696", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03696/input.txt", "sample_output_relpath": "derived/input_output/data/p03696/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03696/Fortran/s178313285.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s178313285", "user_id": "u841856382"}, "prompt_components": {"gold_output": "(())\n", "input_to_evaluate": "program prob4\n implicit none\n integer::i, j, l, r, n, mode\n character(len=100)::S\n character(len=300)::ans, tmp\n read(*,*) n\n read(*,*) S\n ans = \"\"\n l = 0\n r = 0\n do i = 1, n\n if(S(i:i) .eq. \"(\") then\n if(r > 0) then\n do j = 1, r\n ans = \")\" // trim(ans)\n end do\n do j = 1, r\n ans = \"(\" // trim(ans)\n end do\n r = 0\n l = 0\n end if\n l = l + 1\n else\n if(l > 0) then\n do j = 1, l\n ans = trim(ans) // \"(\"\n end do\n do j = 1, l\n ans = trim(ans) // \")\"\n end do\n l = 0\n r = 0\n end if\n r = r + 1\n end if\n end do\n if(r > 0) then\n do i = 1, r-1\n ans = trim(ans) // \")\"\n end do\n do i = 1, r-1\n ans = \"(\" // trim(ans)\n end do\n else if(l > 0) then\n do i = 1, l-1\n ans = trim(ans) // \"(\"\n end do\n do i = 1, l-1\n ans = trim(ans) // \"9\"\n end do\n end if\n write(*,'(a)') trim(ans)\n stop\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of ( and ). Your task is to insert some number of ( and ) into S to obtain a correct bracket sequence.\n\nHere, a correct bracket sequence is defined as follows:\n\n() is a correct bracket sequence.\n\nIf X is a correct bracket sequence, the concatenation of (, X and ) in this order is also a correct bracket sequence.\n\nIf X and Y are correct bracket sequences, the concatenation of X and Y in this order is also a correct bracket sequence.\n\nEvery correct bracket sequence can be derived from the rules above.\n\nFind the shortest correct bracket sequence that can be obtained. If there is more than one such sequence, find the lexicographically smallest one.\n\nConstraints\n\nThe length of S is N.\n\n1 ≤ N ≤ 100\n\nS consists of ( and ).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the lexicographically smallest string among the shortest correct bracket sequences that can be obtained by inserting some number of ( and ) into S.\n\nSample Input 1\n\n3\n())\n\nSample Output 1\n\n(())\n\nSample Input 2\n\n6\n)))())\n\nSample Output 2\n\n(((()))())\n\nSample Input 3\n\n8\n))))((((\n\nSample Output 3\n\n(((())))(((())))", "sample_input": "3\n())\n"}, "reference_outputs": ["(())\n"], "source_document_id": "p03696", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of ( and ). Your task is to insert some number of ( and ) into S to obtain a correct bracket sequence.\n\nHere, a correct bracket sequence is defined as follows:\n\n() is a correct bracket sequence.\n\nIf X is a correct bracket sequence, the concatenation of (, X and ) in this order is also a correct bracket sequence.\n\nIf X and Y are correct bracket sequences, the concatenation of X and Y in this order is also a correct bracket sequence.\n\nEvery correct bracket sequence can be derived from the rules above.\n\nFind the shortest correct bracket sequence that can be obtained. If there is more than one such sequence, find the lexicographically smallest one.\n\nConstraints\n\nThe length of S is N.\n\n1 ≤ N ≤ 100\n\nS consists of ( and ).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the lexicographically smallest string among the shortest correct bracket sequences that can be obtained by inserting some number of ( and ) into S.\n\nSample Input 1\n\n3\n())\n\nSample Output 1\n\n(())\n\nSample Input 2\n\n6\n)))())\n\nSample Output 2\n\n(((()))())\n\nSample Input 3\n\n8\n))))((((\n\nSample Output 3\n\n(((())))(((())))", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1268, "cpu_time_ms": 5, "memory_kb": 2912}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s039924842", "group_id": "codeNet:p03697", "input_text": "implicit none\n\ninteger::a,b\nread(5,*) a,b\nif (a+b<10) then\n write(6,*) a+b\nelse\n write(6,*) \"error\"\nendif\n\nend", "language": "Fortran", "metadata": {"date": 1514268725, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03697.html", "problem_id": "p03697", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03697/input.txt", "sample_output_relpath": "derived/input_output/data/p03697/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03697/Fortran/s039924842.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s039924842", "user_id": "u909643606"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "implicit none\n\ninteger::a,b\nread(5,*) a,b\nif (a+b<10) then\n write(6,*) a+b\nelse\n write(6,*) \"error\"\nendif\n\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers A and B as the input. Output the value of A + B.\n\nHowever, if A + B is 10 or greater, output error instead.\n\nConstraints\n\nA and B are integers.\n\n1 ≤ A, B ≤ 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf A + B is 10 or greater, print the string error (case-sensitive); otherwise, print the value of A + B.\n\nSample Input 1\n\n6 3\n\nSample Output 1\n\n9\n\nSample Input 2\n\n6 4\n\nSample Output 2\n\nerror", "sample_input": "6 3\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03697", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers A and B as the input. Output the value of A + B.\n\nHowever, if A + B is 10 or greater, output error instead.\n\nConstraints\n\nA and B are integers.\n\n1 ≤ A, B ≤ 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf A + B is 10 or greater, print the string error (case-sensitive); otherwise, print the value of A + B.\n\nSample Input 1\n\n6 3\n\nSample Output 1\n\n9\n\nSample Input 2\n\n6 4\n\nSample Output 2\n\nerror", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 116, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s590301340", "group_id": "codeNet:p03698", "input_text": "program main\n implicit none\n character(26) :: s\n integer :: i, j, n\n read(*, *) s\n n = len(trim(s))\n do i = 1, n\n do j = i + 1, n\n if (s(i:i) == s(j:j)) then\n write(*, \"(a)\") \"no\"\n stop 0\n end if\n end do\n end do\n write(*, \"(a)\") \"yes\"\nend program main\n", "language": "Fortran", "metadata": {"date": 1551198425, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03698.html", "problem_id": "p03698", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03698/input.txt", "sample_output_relpath": "derived/input_output/data/p03698/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03698/Fortran/s590301340.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s590301340", "user_id": "u388927326"}, "prompt_components": {"gold_output": "yes\n", "input_to_evaluate": "program main\n implicit none\n character(26) :: s\n integer :: i, j, n\n read(*, *) s\n n = len(trim(s))\n do i = 1, n\n do j = i + 1, n\n if (s(i:i) == s(j:j)) then\n write(*, \"(a)\") \"no\"\n stop 0\n end if\n end do\n end do\n write(*, \"(a)\") \"yes\"\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.\n\nConstraints\n\n2 ≤ |S| ≤ 26, where |S| denotes the length of S.\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf all the characters in S are different, print yes (case-sensitive); otherwise, print no.\n\nSample Input 1\n\nuncopyrightable\n\nSample Output 1\n\nyes\n\nSample Input 2\n\ndifferent\n\nSample Output 2\n\nno\n\nSample Input 3\n\nno\n\nSample Output 3\n\nyes", "sample_input": "uncopyrightable\n"}, "reference_outputs": ["yes\n"], "source_document_id": "p03698", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of lowercase English letters. Determine whether all the characters in S are different.\n\nConstraints\n\n2 ≤ |S| ≤ 26, where |S| denotes the length of S.\n\nS consists of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf all the characters in S are different, print yes (case-sensitive); otherwise, print no.\n\nSample Input 1\n\nuncopyrightable\n\nSample Output 1\n\nyes\n\nSample Input 2\n\ndifferent\n\nSample Output 2\n\nno\n\nSample Input 3\n\nno\n\nSample Output 3\n\nyes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 290, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s099670928", "group_id": "codeNet:p03711", "input_text": "read*,i,j\nif(i==2.or.j==2)then\nprint*,\"No\"\nelse\nprint*,\"Yes\"\nendif\nend", "language": "Fortran", "metadata": {"date": 1552617431, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03711.html", "problem_id": "p03711", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03711/input.txt", "sample_output_relpath": "derived/input_output/data/p03711/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03711/Fortran/s099670928.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s099670928", "user_id": "u394482932"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "read*,i,j\nif(i==2.or.j==2)then\nprint*,\"No\"\nelse\nprint*,\"Yes\"\nendif\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nBased on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.\nGiven two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.\n\nConstraints\n\nx and y are integers.\n\n1 ≤ x < y ≤ 12\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nIf x and y belong to the same group, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nYes\n\nSample Input 2\n\n2 4\n\nSample Output 2\n\nNo", "sample_input": "1 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03711", "source_text": "Score : 100 points\n\nProblem Statement\n\nBased on some criterion, Snuke divided the integers from 1 through 12 into three groups as shown in the figure below.\nGiven two integers x and y (1 ≤ x < y ≤ 12), determine whether they belong to the same group.\n\nConstraints\n\nx and y are integers.\n\n1 ≤ x < y ≤ 12\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nIf x and y belong to the same group, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nYes\n\nSample Input 2\n\n2 4\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 70, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s202595435", "group_id": "codeNet:p03712", "input_text": "program ABC062B\n implicit none\n integer(8)::H,W,i\n character(100),dimension(100)::A\n read(5,*)H,W\n read(5,*)(A(i),i=1,H)\n\n do i=1,W+2\n write(*,'(A)',advance='no')\"#\"\n end do\n print'(A)',\"\"\n\n do i=1,H\n write(*,'(A)',advance='no')\"#\"\n write(*,'(A)',advance='no')A(i)(1:W)\n write(*,'(A)',advance='no')\"#\"\n print'(A)',\"\"\n end do\n\n do i=1,W+2\n write(*,'(A)',advance='no')\"#\"\n end do\n print'(A)',\"\"\nend program ABC062B", "language": "Fortran", "metadata": {"date": 1580682178, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03712.html", "problem_id": "p03712", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03712/input.txt", "sample_output_relpath": "derived/input_output/data/p03712/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03712/Fortran/s202595435.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s202595435", "user_id": "u414699019"}, "prompt_components": {"gold_output": "#####\n#abc#\n#arc#\n#####\n", "input_to_evaluate": "program ABC062B\n implicit none\n integer(8)::H,W,i\n character(100),dimension(100)::A\n read(5,*)H,W\n read(5,*)(A(i),i=1,H)\n\n do i=1,W+2\n write(*,'(A)',advance='no')\"#\"\n end do\n print'(A)',\"\"\n\n do i=1,H\n write(*,'(A)',advance='no')\"#\"\n write(*,'(A)',advance='no')A(i)(1:W)\n write(*,'(A)',advance='no')\"#\"\n print'(A)',\"\"\n end do\n\n do i=1,W+2\n write(*,'(A)',advance='no')\"#\"\n end do\n print'(A)',\"\"\nend program ABC062B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a image with a height of H pixels and a width of W pixels.\nEach pixel is represented by a lowercase English letter.\nThe pixel at the i-th row from the top and j-th column from the left is a_{ij}.\n\nPut a box around this image and output the result. The box should consist of # and have a thickness of 1.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\na_{ij} is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} ... a_{1W}\n:\na_{H1} ... a_{HW}\n\nOutput\n\nPrint the image surrounded by a box that consists of # and has a thickness of 1.\n\nSample Input 1\n\n2 3\nabc\narc\n\nSample Output 1\n\n#####\n#abc#\n#arc#\n#####\n\nSample Input 2\n\n1 1\nz\n\nSample Output 2\n\n###\n#z#\n###", "sample_input": "2 3\nabc\narc\n"}, "reference_outputs": ["#####\n#abc#\n#arc#\n#####\n"], "source_document_id": "p03712", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a image with a height of H pixels and a width of W pixels.\nEach pixel is represented by a lowercase English letter.\nThe pixel at the i-th row from the top and j-th column from the left is a_{ij}.\n\nPut a box around this image and output the result. The box should consist of # and have a thickness of 1.\n\nConstraints\n\n1 ≤ H, W ≤ 100\n\na_{ij} is a lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\na_{11} ... a_{1W}\n:\na_{H1} ... a_{HW}\n\nOutput\n\nPrint the image surrounded by a box that consists of # and has a thickness of 1.\n\nSample Input 1\n\n2 3\nabc\narc\n\nSample Output 1\n\n#####\n#abc#\n#arc#\n#####\n\nSample Input 2\n\n1 1\nz\n\nSample Output 2\n\n###\n#z#\n###", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 493, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s552922280", "group_id": "codeNet:p03719", "input_text": "program sample\n\timplicit none\n integer :: A,B,C\n \n read(*,*) A,B,C\n \n if (C >= A .and. C<=B) then\n \twrite(*,*) \"Yes\"\n else\n \twrite(*,*) \"No\"\n end if\n \n stop\nend program sample", "language": "Fortran", "metadata": {"date": 1592010802, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03719.html", "problem_id": "p03719", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03719/input.txt", "sample_output_relpath": "derived/input_output/data/p03719/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03719/Fortran/s552922280.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s552922280", "user_id": "u323210830"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program sample\n\timplicit none\n integer :: A,B,C\n \n read(*,*) A,B,C\n \n if (C >= A .and. C<=B) then\n \twrite(*,*) \"Yes\"\n else\n \twrite(*,*) \"No\"\n end if\n \n stop\nend program sample", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\nDetermine whether C is not less than A and not greater than B.\n\nConstraints\n\n-100≤A,B,C≤100\n\nA, B and C are all integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the condition is satisfied, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3 2\n\nSample Output 1\n\nYes\n\nC=2 is not less than A=1 and not greater than B=3, and thus the output should be Yes.\n\nSample Input 2\n\n6 5 4\n\nSample Output 2\n\nNo\n\nC=4 is less than A=6, and thus the output should be No.\n\nSample Input 3\n\n2 2 2\n\nSample Output 3\n\nYes", "sample_input": "1 3 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03719", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given three integers A, B and C.\nDetermine whether C is not less than A and not greater than B.\n\nConstraints\n\n-100≤A,B,C≤100\n\nA, B and C are all integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf the condition is satisfied, print Yes; otherwise, print No.\n\nSample Input 1\n\n1 3 2\n\nSample Output 1\n\nYes\n\nC=2 is not less than A=1 and not greater than B=3, and thus the output should be Yes.\n\nSample Input 2\n\n6 5 4\n\nSample Output 2\n\nNo\n\nC=4 is less than A=6, and thus the output should be No.\n\nSample Input 3\n\n2 2 2\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 208, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s262789597", "group_id": "codeNet:p03721", "input_text": "program ABC061C\n implicit none\n integer(8)::N,K,a,b,i,count\n integer(8),dimension(100000)::L\n read(5,*)N,K\n L=0\n count=0\n\n do i=1,N\n read(5,*)a,b\n L(a)=L(a)+b\n end do\n\n do i=1,100000\n count=count+L(i)\n if(count>=K)then\n print'(i0)',i\n exit\n end if\n end do\nend program ABC061C", "language": "Fortran", "metadata": {"date": 1580682964, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03721.html", "problem_id": "p03721", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03721/input.txt", "sample_output_relpath": "derived/input_output/data/p03721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03721/Fortran/s262789597.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s262789597", "user_id": "u414699019"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program ABC061C\n implicit none\n integer(8)::N,K,a,b,i,count\n integer(8),dimension(100000)::L\n read(5,*)N,K\n L=0\n count=0\n\n do i=1,N\n read(5,*)a,b\n L(a)=L(a)+b\n end do\n\n do i=1,100000\n count=count+L(i)\n if(count>=K)then\n print'(i0)',i\n exit\n end if\n end do\nend program ABC061C", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "sample_input": "3 4\n1 1\n2 2\n3 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03721", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 362, "cpu_time_ms": 63, "memory_kb": 1024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s773534863", "group_id": "codeNet:p03721", "input_text": "program main\n integer(8) N, K, i\n integer(8), allocatable :: a(:), b(:)\n read(*, *) N, K\n allocate(a(1: N))\n allocate(b(1: N))\n do i = 1, N\n read(*, *) a(i), b(i)\n end do\n do i = 1, N\n if(1 <= K .and. K <= b(i)) then\n\t write(*, *) a(i)\n\t exit\n\t else\n\t K = K - b(i)\n\t end if\n end do\nend program main", "language": "Fortran", "metadata": {"date": 1523940836, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03721.html", "problem_id": "p03721", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03721/input.txt", "sample_output_relpath": "derived/input_output/data/p03721/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03721/Fortran/s773534863.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s773534863", "user_id": "u728000113"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\n integer(8) N, K, i\n integer(8), allocatable :: a(:), b(:)\n read(*, *) N, K\n allocate(a(1: N))\n allocate(b(1: N))\n do i = 1, N\n read(*, *) a(i), b(i)\n end do\n do i = 1, N\n if(1 <= K .and. K <= b(i)) then\n\t write(*, *) a(i)\n\t exit\n\t else\n\t K = K - b(i)\n\t end if\n end do\nend program main", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "sample_input": "3 4\n1 1\n2 2\n3 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03721", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is an empty array.\nThe following N operations will be performed to insert integers into the array.\nIn the i-th operation (1≤i≤N), b_i copies of an integer a_i are inserted into the array.\nFind the K-th smallest integer in the array after the N operations.\nFor example, the 4-th smallest integer in the array \\{1,2,2,3,3,3\\} is 3.\n\nConstraints\n\n1≤N≤10^5\n\n1≤a_i,b_i≤10^5\n\n1≤K≤b_1…+…b_n\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\na_1 b_1\n:\na_N b_N\n\nOutput\n\nPrint the K-th smallest integer in the array after the N operations.\n\nSample Input 1\n\n3 4\n1 1\n2 2\n3 3\n\nSample Output 1\n\n3\n\nThe resulting array is the same as the one in the problem statement.\n\nSample Input 2\n\n10 500000\n1 100000\n1 100000\n1 100000\n1 100000\n1 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n100000 100000\n\nSample Output 2\n\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 350, "cpu_time_ms": 67, "memory_kb": 1792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s498900444", "group_id": "codeNet:p03722", "input_text": "program main\n implicit none\n integer(8):: inf = 1000000000\n integer(4):: n,m, i,j,k\n integer(8), allocatable:: a(:),b(:),c(:)\n integer(8), allocatable:: dist(:)\n\n read*, n, m\n allocate(a(m), b(m), c(m), dist(n))\n do i = 1, m\n read*, a(i),b(i),c(i)\n end do\n c = c*(-1)\n dist(1:n) = inf*100\n ! print*, dist\n dist(1) = 0\n \n do j = 1, m\n do i = 1, m\n ! print*, dist(b(i)), dist(a(i)) + c(i)\n if (dist(b(i)) <= dist(a(i)) + c(i))cycle\n dist(b(i)) = dist(a(i)) + c(i)\n ! print*, dist\n if(j <= m-1) cycle\n print*, 'inf'\n stop\n end do\n end do\n\n print'(i0)', -1*dist(n)\n\n\n\nend program", "language": "Fortran", "metadata": {"date": 1568392406, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03722.html", "problem_id": "p03722", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03722/input.txt", "sample_output_relpath": "derived/input_output/data/p03722/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03722/Fortran/s498900444.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s498900444", "user_id": "u234636620"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program main\n implicit none\n integer(8):: inf = 1000000000\n integer(4):: n,m, i,j,k\n integer(8), allocatable:: a(:),b(:),c(:)\n integer(8), allocatable:: dist(:)\n\n read*, n, m\n allocate(a(m), b(m), c(m), dist(n))\n do i = 1, m\n read*, a(i),b(i),c(i)\n end do\n c = c*(-1)\n dist(1:n) = inf*100\n ! print*, dist\n dist(1) = 0\n \n do j = 1, m\n do i = 1, m\n ! print*, dist(b(i)), dist(a(i)) + c(i)\n if (dist(b(i)) <= dist(a(i)) + c(i))cycle\n dist(b(i)) = dist(a(i)) + c(i)\n ! print*, dist\n if(j <= m-1) cycle\n print*, 'inf'\n stop\n end do\n end do\n\n print'(i0)', -1*dist(n)\n\n\n\nend program", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere is a directed graph with N vertices and M edges.\nThe i-th edge (1≤i≤M) points from vertex a_i to vertex b_i, and has a weight c_i.\nWe will play the following single-player game using this graph and a piece.\n\nInitially, the piece is placed at vertex 1, and the score of the player is set to 0.\nThe player can move the piece as follows:\n\nWhen the piece is placed at vertex a_i, move the piece along the i-th edge to vertex b_i. After this move, the score of the player is increased by c_i.\n\nThe player can end the game only when the piece is placed at vertex N.\nThe given graph guarantees that it is possible to traverse from vertex 1 to vertex N.\n\nWhen the player acts optimally to maximize the score at the end of the game, what will the score be?\nIf it is possible to increase the score indefinitely, print inf.\n\nConstraints\n\n2≤N≤1000\n\n1≤M≤min(N(N-1),2000)\n\n1≤a_i,b_i≤N (1≤i≤M)\n\na_i≠b_i (1≤i≤M)\n\na_i≠a_j or b_i≠b_j (1≤i 0)\n if (n >= lshift(1_8,k)-1_8) exit\n k = k-1\n end do\n do i = 1, k\n p(i) = i\n end do\n n = n-lshift(1_8,k)+1_8\n do i = k-1, 0, -1\n if (n < lshift(1_8,i)) cycle\n p(i+1:k+1) = p(i:k)\n k = k+1\n p(i) = k\n n = n-lshift(1_8,i)\n end do\n do i = 1, k\n p(k+i) = i\n end do\n write(*,'(i0)') 2*k\n write(*,'(i0)',advance='no') p(1)\n do i = 2, 2*k\n write(*,'(x,i0)',advance='no') p(i)\n end do\n write(*,*)\nend program tautonym_puzzle", "language": "Fortran", "metadata": {"date": 1568467313, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03769.html", "problem_id": "p03769", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03769/input.txt", "sample_output_relpath": "derived/input_output/data/p03769/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03769/Fortran/s321931724.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s321931724", "user_id": "u506403362"}, "prompt_components": {"gold_output": "4\n1 1 1 1\n", "input_to_evaluate": "program tautonym_puzzle\n implicit none\n integer(8) :: n\n integer :: k = 40, p(80) = 0, i\n read(*,*) n\n do while (k > 0)\n if (n >= lshift(1_8,k)-1_8) exit\n k = k-1\n end do\n do i = 1, k\n p(i) = i\n end do\n n = n-lshift(1_8,k)+1_8\n do i = k-1, 0, -1\n if (n < lshift(1_8,i)) cycle\n p(i+1:k+1) = p(i:k)\n k = k+1\n p(i) = k\n n = n-lshift(1_8,i)\n end do\n do i = 1, k\n p(k+i) = i\n end do\n write(*,'(i0)') 2*k\n write(*,'(i0)',advance='no') p(1)\n do i = 2, 2*k\n write(*,'(x,i0)',advance='no') p(i)\n end do\n write(*,*)\nend program tautonym_puzzle", "problem_context": "Score : 1000 points\n\nProblem Statement\n\nWe will call a string x good if it satisfies the following condition:\n\nCondition: x can be represented as a concatenation of two copies of another string y of length at least 1.\n\nFor example, aa and bubobubo are good; an empty string, a, abcabcabc and abba are not good.\n\nEagle and Owl created a puzzle on good strings.\nFind one string s that satisfies the following conditions. It can be proved that such a string always exists under the constraints in this problem.\n\n1 ≤ |s| ≤ 200\n\nEach character of s is one of the 100 characters represented by the integers 1 through 100.\n\nAmong the 2^{|s|} subsequences of s, exactly N are good strings.\n\nConstraints\n\n1 ≤ N ≤ 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print |s|, the length of s.\nIn the second line, print the elements in s in order, with spaces in between. Any string that satisfies the above conditions will be accepted.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n4\n1 1 1 1\n\nThere are two good strings that appear as subsequences of s: (1,1) and (1,1,1,1). There are six occurrences of (1,1) and one occurrence of (1,1,1,1), for a total of seven.\n\nSample Input 2\n\n299\n\nSample Output 2\n\n23\n32 11 11 73 45 8 11 83 83 8 45 32 32 10 100 73 32 83 45 73 32 11 10", "sample_input": "7\n"}, "reference_outputs": ["4\n1 1 1 1\n"], "source_document_id": "p03769", "source_text": "Score : 1000 points\n\nProblem Statement\n\nWe will call a string x good if it satisfies the following condition:\n\nCondition: x can be represented as a concatenation of two copies of another string y of length at least 1.\n\nFor example, aa and bubobubo are good; an empty string, a, abcabcabc and abba are not good.\n\nEagle and Owl created a puzzle on good strings.\nFind one string s that satisfies the following conditions. It can be proved that such a string always exists under the constraints in this problem.\n\n1 ≤ |s| ≤ 200\n\nEach character of s is one of the 100 characters represented by the integers 1 through 100.\n\nAmong the 2^{|s|} subsequences of s, exactly N are good strings.\n\nConstraints\n\n1 ≤ N ≤ 10^{12}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print |s|, the length of s.\nIn the second line, print the elements in s in order, with spaces in between. Any string that satisfies the above conditions will be accepted.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n4\n1 1 1 1\n\nThere are two good strings that appear as subsequences of s: (1,1) and (1,1,1,1). There are six occurrences of (1,1) and one occurrence of (1,1,1,1), for a total of seven.\n\nSample Input 2\n\n299\n\nSample Output 2\n\n23\n32 11 11 73 45 8 11 83 83 8 45 32 32 10 100 73 32 83 45 73 32 11 10", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 581, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s110082615", "group_id": "codeNet:p03773", "input_text": "program main\n implicit none\n integer(16)::N,A,B\n integer(16),allocatable,dimension(:,:)::C\n integer(16),allocatable,dimension(:)::v\n integer(16)::i\n integer(16),parameter::mo=10**9+7_16\n real(16)::ANS1\n integer(16)::ANS2\n integer(16)::cnt,cnt2\n read*,N,A,B\n allocate(v(N))\n read*,v\n call heapsort(N,v)\n ANS1=0\n do i=N,N-A+1,-1\n ANS1=ANS1+v(i)\n end do\n ANS1=ANS1/real(A)\n print\"(f0.20)\",ANS1\n call comb_table(N)\n\n if(v(N)/=v(N-A+1))then\n cnt=0\n do i=N,1,-1\n if(v(i)/=v(N-A+1))exit\n cnt=cnt+1\n end do\n cnt2 = count(v(n-a+1:n) == v(n-a+1))\n ANS2=C(cnt,cnt2)\n else\n cnt=A\n do i=N-A,1,-1\n if(v(i)/=v(N))exit\n cnt=cnt+1\n end do\n ANS2=0\n do i=A,B\n ANS2=ANS2+C(cnt,i)\n end do\n endif\n print\"(i0)\",ANS2\ncontains\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16)::i,k,j,l\n integer(16):: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nsubroutine comb_table(N)\n integer(16)::N\n integer(16)::i,j\n allocate(C(0:N,0:N))\n C=0\n do i=0,N\n do j=0,i\n if(j==0 .or. j==i)then\n C(i,j)=1\n else\n C(i,j)=C(i-1,j-1)+C(i-1,j)\n endif\n end do\n end do\nend subroutine\nend program main", "language": "Fortran", "metadata": {"date": 1585781485, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03773.html", "problem_id": "p03773", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03773/input.txt", "sample_output_relpath": "derived/input_output/data/p03773/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03773/Fortran/s110082615.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s110082615", "user_id": "u598073939"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "program main\n implicit none\n integer(16)::N,A,B\n integer(16),allocatable,dimension(:,:)::C\n integer(16),allocatable,dimension(:)::v\n integer(16)::i\n integer(16),parameter::mo=10**9+7_16\n real(16)::ANS1\n integer(16)::ANS2\n integer(16)::cnt,cnt2\n read*,N,A,B\n allocate(v(N))\n read*,v\n call heapsort(N,v)\n ANS1=0\n do i=N,N-A+1,-1\n ANS1=ANS1+v(i)\n end do\n ANS1=ANS1/real(A)\n print\"(f0.20)\",ANS1\n call comb_table(N)\n\n if(v(N)/=v(N-A+1))then\n cnt=0\n do i=N,1,-1\n if(v(i)/=v(N-A+1))exit\n cnt=cnt+1\n end do\n cnt2 = count(v(n-a+1:n) == v(n-a+1))\n ANS2=C(cnt,cnt2)\n else\n cnt=A\n do i=N-A,1,-1\n if(v(i)/=v(N))exit\n cnt=cnt+1\n end do\n ANS2=0\n do i=A,B\n ANS2=ANS2+C(cnt,i)\n end do\n endif\n print\"(i0)\",ANS2\ncontains\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16)::i,k,j,l\n integer(16):: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nsubroutine comb_table(N)\n integer(16)::N\n integer(16)::i,j\n allocate(C(0:N,0:N))\n C=0\n do i=0,N\n do j=0,i\n if(j==0 .or. j==i)then\n C(i,j)=1\n else\n C(i,j)=C(i-1,j-1)+C(i-1,j)\n endif\n end do\n end do\nend subroutine\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nDolphin loves programming contests. Today, he will take part in a contest in AtCoder.\n\nIn this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as \"21 o'clock\".\n\nThe current time is A o'clock, and a contest will begin in exactly B hours.\nWhen will the contest begin? Answer in 24-hour time.\n\nConstraints\n\n0 \\leq A,B \\leq 23\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the hour of the starting time of the contest in 24-hour time.\n\nSample Input 1\n\n9 12\n\nSample Output 1\n\n21\n\nIn this input, the current time is 9 o'clock, and 12 hours later it will be 21 o'clock in 24-hour time.\n\nSample Input 2\n\n19 0\n\nSample Output 2\n\n19\n\nThe contest has just started.\n\nSample Input 3\n\n23 2\n\nSample Output 3\n\n1\n\nThe contest will begin at 1 o'clock the next day.", "sample_input": "9 12\n"}, "reference_outputs": ["21\n"], "source_document_id": "p03773", "source_text": "Score : 100 points\n\nProblem Statement\n\nDolphin loves programming contests. Today, he will take part in a contest in AtCoder.\n\nIn this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as \"21 o'clock\".\n\nThe current time is A o'clock, and a contest will begin in exactly B hours.\nWhen will the contest begin? Answer in 24-hour time.\n\nConstraints\n\n0 \\leq A,B \\leq 23\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint the hour of the starting time of the contest in 24-hour time.\n\nSample Input 1\n\n9 12\n\nSample Output 1\n\n21\n\nIn this input, the current time is 9 o'clock, and 12 hours later it will be 21 o'clock in 24-hour time.\n\nSample Input 2\n\n19 0\n\nSample Output 2\n\n19\n\nThe contest has just started.\n\nSample Input 3\n\n23 2\n\nSample Output 3\n\n1\n\nThe contest will begin at 1 o'clock the next day.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1849, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s074962221", "group_id": "codeNet:p03775", "input_text": "integer,parameter :: p = 8\ninteger(p) :: n,i\n\ndo i = ceiling(sqrt(real(n))),1,-1\n if( mod(n,i)==0 ) exit\nend do\n\nprint*,max(digit(i),digit(n/i))\n\ncontains\nfunction digit( n ) result( i )\n integer(p) :: i,n\n i = 0\n do while( n/=0 )\n n = n / 10\n i = i + 1\n end do\nend function\n \n\nend\n", "language": "Fortran", "metadata": {"date": 1601233841, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Fortran/s074962221.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s074962221", "user_id": "u171356453"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "integer,parameter :: p = 8\ninteger(p) :: n,i\n\ndo i = ceiling(sqrt(real(n))),1,-1\n if( mod(n,i)==0 ) exit\nend do\n\nprint*,max(digit(i),digit(n/i))\n\ncontains\nfunction digit( n ) result( i )\n integer(p) :: i,n\n i = 0\n do while( n/=0 )\n n = n / 10\n i = i + 1\n end do\nend function\n \n\nend\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 296, "cpu_time_ms": 11, "memory_kb": 2792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s576754918", "group_id": "codeNet:p03775", "input_text": "integer(16) N,ans,i\nread*,N\nans=huge(ans)\ndo i=1,N\n if(i*i>N)exit\n if(mod(N,i)==0)then\n do j=10,0,-1\n if(N/i>=10**j)then\n ans=min(ans,j+1)\n exit\n endif\n end do\n endif\nend do\nprint\"(I0)\",ans\nend", "language": "Fortran", "metadata": {"date": 1564980084, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03775.html", "problem_id": "p03775", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03775/input.txt", "sample_output_relpath": "derived/input_output/data/p03775/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03775/Fortran/s576754918.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s576754918", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "integer(16) N,ans,i\nread*,N\nans=huge(ans)\ndo i=1,N\n if(i*i>N)exit\n if(mod(N,i)==0)then\n do j=10,0,-1\n if(N/i>=10**j)then\n ans=min(ans,j+1)\n exit\n endif\n end do\n endif\nend do\nprint\"(I0)\",ans\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "sample_input": "10000\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03775", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFor two positive integers A and B, we will define F(A,B) as the larger of the following: the number of digits in the decimal notation of A, and the number of digits in the decimal notation of B.\n\nFor example, F(3,11) = 2 since 3 has one digit and 11 has two digits.\n\nFind the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nConstraints\n\n1 \\leq N \\leq 10^{10}\n\nN is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the minimum value of F(A,B) as (A,B) ranges over all pairs of positive integers such that N = A \\times B.\n\nSample Input 1\n\n10000\n\nSample Output 1\n\n3\n\nF(A,B) has a minimum value of 3 at (A,B)=(100,100).\n\nSample Input 2\n\n1000003\n\nSample Output 2\n\n7\n\nThere are two pairs (A,B) that satisfy the condition: (1,1000003) and (1000003,1). For these pairs, F(1,1000003)=F(1000003,1)=7.\n\nSample Input 3\n\n9876543210\n\nSample Output 3\n\n6", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 226, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s648476029", "group_id": "codeNet:p03776", "input_text": "program main\n implicit none\n integer(16)::N,A,B\n integer(16),allocatable,dimension(:,:)::C\n integer(16),allocatable,dimension(:)::v\n integer(16)::i\n integer(16),parameter::mo=10**9+7_16\n real(16)::ANS1\n integer(16)::ANS2\n integer(16)::cnt,cnt2\n read*,N,A,B\n allocate(v(N))\n read*,v\n call heapsort(N,v)\n ANS1=0\n do i=N,N-A+1,-1\n ANS1=ANS1+v(i)\n end do\n ANS1=ANS1/real(A)\n print\"(f0.20)\",ANS1\n call comb_table(N)\n\n if(v(N)/=v(N-A+1))then\n cnt=count(v(1:n) == v(n-a+1))\n cnt2 = count(v(n-a+1:n) == v(n-a+1))\n ANS2=C(cnt,cnt2)\n else\n cnt=A\n do i=N-A,1,-1\n if(v(i)/=v(N))exit\n cnt=cnt+1\n end do\n ANS2=0\n do i=A,B\n ANS2=ANS2+C(cnt,i)\n end do\n endif\n print\"(i0)\",ANS2\ncontains\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16)::i,k,j,l\n integer(16):: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nsubroutine comb_table(N)\n integer(16)::N\n integer(16)::i,j\n allocate(C(0:N,0:N))\n C=0\n do i=0,N\n do j=0,i\n if(j==0 .or. j==i)then\n C(i,j)=1\n else\n C(i,j)=C(i-1,j-1)+C(i-1,j)\n endif\n end do\n end do\nend subroutine\nend program main", "language": "Fortran", "metadata": {"date": 1585781614, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03776.html", "problem_id": "p03776", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03776/input.txt", "sample_output_relpath": "derived/input_output/data/p03776/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03776/Fortran/s648476029.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s648476029", "user_id": "u598073939"}, "prompt_components": {"gold_output": "4.500000\n1\n", "input_to_evaluate": "program main\n implicit none\n integer(16)::N,A,B\n integer(16),allocatable,dimension(:,:)::C\n integer(16),allocatable,dimension(:)::v\n integer(16)::i\n integer(16),parameter::mo=10**9+7_16\n real(16)::ANS1\n integer(16)::ANS2\n integer(16)::cnt,cnt2\n read*,N,A,B\n allocate(v(N))\n read*,v\n call heapsort(N,v)\n ANS1=0\n do i=N,N-A+1,-1\n ANS1=ANS1+v(i)\n end do\n ANS1=ANS1/real(A)\n print\"(f0.20)\",ANS1\n call comb_table(N)\n\n if(v(N)/=v(N-A+1))then\n cnt=count(v(1:n) == v(n-a+1))\n cnt2 = count(v(n-a+1:n) == v(n-a+1))\n ANS2=C(cnt,cnt2)\n else\n cnt=A\n do i=N-A,1,-1\n if(v(i)/=v(N))exit\n cnt=cnt+1\n end do\n ANS2=0\n do i=A,B\n ANS2=ANS2+C(cnt,i)\n end do\n endif\n print\"(i0)\",ANS2\ncontains\nsubroutine heapsort(n,array)\n implicit none\n!ここの入力は状況に応じて変更すること\n integer(16),intent(in) :: n\n integer(16),intent(inout) :: array(1:n)\n integer(16)::i,k,j,l\n integer(16):: t\n\n l=n/2+1\n k=n\n do while(k /= 1)\n if(l > 1)then\n l=l-1\n t=array(L)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k == 1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j<=k)\n if(j < k)then\n if(array(j) < array(j+1))j=j+1\n endif\n if (t < array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n return\nend subroutine heapsort\nsubroutine comb_table(N)\n integer(16)::N\n integer(16)::i,j\n allocate(C(0:N,0:N))\n C=0\n do i=0,N\n do j=0,i\n if(j==0 .or. j==i)then\n C(i,j)=1\n else\n C(i,j)=C(i-1,j-1)+C(i-1,j)\n endif\n end do\n end do\nend subroutine\nend program main", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given N items.\n\nThe value of the i-th item (1 \\leq i \\leq N) is v_i.\n\nYour have to select at least A and at most B of these items.\n\nUnder this condition, find the maximum possible arithmetic mean of the values of selected items.\n\nAdditionally, find the number of ways to select items so that the mean of the values of selected items is maximized.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq A,B \\leq N\n\n1 \\leq v_i \\leq 10^{15}\n\nEach v_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN A B\nv_1\nv_2\n...\nv_N\n\nOutput\n\nPrint two lines.\n\nThe first line should contain the maximum possible arithmetic mean of the values of selected items. The output should be considered correct if the absolute or relative error is at most 10^{-6}.\n\nThe second line should contain the number of ways to select items so that the mean of the values of selected items is maximized.\n\nSample Input 1\n\n5 2 2\n1 2 3 4 5\n\nSample Output 1\n\n4.500000\n1\n\nThe mean of the values of selected items will be maximized when selecting the fourth and fifth items. Hence, the first line of the output should contain 4.5.\n\nThere is no other way to select items so that the mean of the values will be 4.5, and thus the second line of the output should contain 1.\n\nSample Input 2\n\n4 2 3\n10 20 10 10\n\nSample Output 2\n\n15.000000\n3\n\nThere can be multiple ways to select items so that the mean of the values will be maximized.\n\nSample Input 3\n\n5 1 5\n1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996\n\nSample Output 3\n\n1000000000000000.000000\n1", "sample_input": "5 2 2\n1 2 3 4 5\n"}, "reference_outputs": ["4.500000\n1\n"], "source_document_id": "p03776", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given N items.\n\nThe value of the i-th item (1 \\leq i \\leq N) is v_i.\n\nYour have to select at least A and at most B of these items.\n\nUnder this condition, find the maximum possible arithmetic mean of the values of selected items.\n\nAdditionally, find the number of ways to select items so that the mean of the values of selected items is maximized.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq A,B \\leq N\n\n1 \\leq v_i \\leq 10^{15}\n\nEach v_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN A B\nv_1\nv_2\n...\nv_N\n\nOutput\n\nPrint two lines.\n\nThe first line should contain the maximum possible arithmetic mean of the values of selected items. The output should be considered correct if the absolute or relative error is at most 10^{-6}.\n\nThe second line should contain the number of ways to select items so that the mean of the values of selected items is maximized.\n\nSample Input 1\n\n5 2 2\n1 2 3 4 5\n\nSample Output 1\n\n4.500000\n1\n\nThe mean of the values of selected items will be maximized when selecting the fourth and fifth items. Hence, the first line of the output should contain 4.5.\n\nThere is no other way to select items so that the mean of the values will be 4.5, and thus the second line of the output should contain 1.\n\nSample Input 2\n\n4 2 3\n10 20 10 10\n\nSample Output 2\n\n15.000000\n3\n\nThere can be multiple ways to select items so that the mean of the values will be maximized.\n\nSample Input 3\n\n5 1 5\n1000000000000000 999999999999999 999999999999998 999999999999997 999999999999996\n\nSample Output 3\n\n1000000000000000.000000\n1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1803, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s917555507", "group_id": "codeNet:p03777", "input_text": "program sample\n\timplicit none\n character(len=1) ::a,b\n \n read(*,*) a,b\n \n if (a==b) then\n \twrite(*,*) 'H'\n else\n \twrite(*,*) 'D'\n\tend if\n\n stop\nend program sample\n\n", "language": "Fortran", "metadata": {"date": 1592628966, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03777.html", "problem_id": "p03777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03777/input.txt", "sample_output_relpath": "derived/input_output/data/p03777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03777/Fortran/s917555507.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s917555507", "user_id": "u323210830"}, "prompt_components": {"gold_output": "H\n", "input_to_evaluate": "program sample\n\timplicit none\n character(len=1) ::a,b\n \n read(*,*) a,b\n \n if (a==b) then\n \twrite(*,*) 'H'\n else\n \twrite(*,*) 'D'\n\tend if\n\n stop\nend program sample\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTwo deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest.\nIn this game, an honest player always tells the truth, and an dishonest player always tell lies.\nYou are given two characters a and b as the input. Each of them is either H or D, and carries the following information:\n\nIf a=H, AtCoDeer is honest; if a=D, AtCoDeer is dishonest.\nIf b=H, AtCoDeer is saying that TopCoDeer is honest; if b=D, AtCoDeer is saying that TopCoDeer is dishonest.\n\nGiven this information, determine whether TopCoDeer is honest.\n\nConstraints\n\na=H or a=D.\n\nb=H or b=D.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf TopCoDeer is honest, print H. If he is dishonest, print D.\n\nSample Input 1\n\nH H\n\nSample Output 1\n\nH\n\nIn this input, AtCoDeer is honest. Hence, as he says, TopCoDeer is honest.\n\nSample Input 2\n\nD H\n\nSample Output 2\n\nD\n\nIn this input, AtCoDeer is dishonest. Hence, contrary to what he says, TopCoDeer is dishonest.\n\nSample Input 3\n\nD D\n\nSample Output 3\n\nH", "sample_input": "H H\n"}, "reference_outputs": ["H\n"], "source_document_id": "p03777", "source_text": "Score : 100 points\n\nProblem Statement\n\nTwo deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest.\nIn this game, an honest player always tells the truth, and an dishonest player always tell lies.\nYou are given two characters a and b as the input. Each of them is either H or D, and carries the following information:\n\nIf a=H, AtCoDeer is honest; if a=D, AtCoDeer is dishonest.\nIf b=H, AtCoDeer is saying that TopCoDeer is honest; if b=D, AtCoDeer is saying that TopCoDeer is dishonest.\n\nGiven this information, determine whether TopCoDeer is honest.\n\nConstraints\n\na=H or a=D.\n\nb=H or b=D.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf TopCoDeer is honest, print H. If he is dishonest, print D.\n\nSample Input 1\n\nH H\n\nSample Output 1\n\nH\n\nIn this input, AtCoDeer is honest. Hence, as he says, TopCoDeer is honest.\n\nSample Input 2\n\nD H\n\nSample Output 2\n\nD\n\nIn this input, AtCoDeer is dishonest. Hence, contrary to what he says, TopCoDeer is dishonest.\n\nSample Input 3\n\nD D\n\nSample Output 3\n\nH", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 191, "cpu_time_ms": 7, "memory_kb": 2828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s679692043", "group_id": "codeNet:p03777", "input_text": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n character(1):: a,b\n read*, a,b\n if (a==b) then\n print'(a)', 'H'\n else\n print'(a)', 'D'\n end if\n \nend program main", "language": "Fortran", "metadata": {"date": 1591415800, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03777.html", "problem_id": "p03777", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03777/input.txt", "sample_output_relpath": "derived/input_output/data/p03777/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03777/Fortran/s679692043.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s679692043", "user_id": "u234636620"}, "prompt_components": {"gold_output": "H\n", "input_to_evaluate": "program main\n use,intrinsic :: iso_fortran_env\n implicit none\n character(1):: a,b\n read*, a,b\n if (a==b) then\n print'(a)', 'H'\n else\n print'(a)', 'D'\n end if\n \nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTwo deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest.\nIn this game, an honest player always tells the truth, and an dishonest player always tell lies.\nYou are given two characters a and b as the input. Each of them is either H or D, and carries the following information:\n\nIf a=H, AtCoDeer is honest; if a=D, AtCoDeer is dishonest.\nIf b=H, AtCoDeer is saying that TopCoDeer is honest; if b=D, AtCoDeer is saying that TopCoDeer is dishonest.\n\nGiven this information, determine whether TopCoDeer is honest.\n\nConstraints\n\na=H or a=D.\n\nb=H or b=D.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf TopCoDeer is honest, print H. If he is dishonest, print D.\n\nSample Input 1\n\nH H\n\nSample Output 1\n\nH\n\nIn this input, AtCoDeer is honest. Hence, as he says, TopCoDeer is honest.\n\nSample Input 2\n\nD H\n\nSample Output 2\n\nD\n\nIn this input, AtCoDeer is dishonest. Hence, contrary to what he says, TopCoDeer is dishonest.\n\nSample Input 3\n\nD D\n\nSample Output 3\n\nH", "sample_input": "H H\n"}, "reference_outputs": ["H\n"], "source_document_id": "p03777", "source_text": "Score : 100 points\n\nProblem Statement\n\nTwo deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest.\nIn this game, an honest player always tells the truth, and an dishonest player always tell lies.\nYou are given two characters a and b as the input. Each of them is either H or D, and carries the following information:\n\nIf a=H, AtCoDeer is honest; if a=D, AtCoDeer is dishonest.\nIf b=H, AtCoDeer is saying that TopCoDeer is honest; if b=D, AtCoDeer is saying that TopCoDeer is dishonest.\n\nGiven this information, determine whether TopCoDeer is honest.\n\nConstraints\n\na=H or a=D.\n\nb=H or b=D.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf TopCoDeer is honest, print H. If he is dishonest, print D.\n\nSample Input 1\n\nH H\n\nSample Output 1\n\nH\n\nIn this input, AtCoDeer is honest. Hence, as he says, TopCoDeer is honest.\n\nSample Input 2\n\nD H\n\nSample Output 2\n\nD\n\nIn this input, AtCoDeer is dishonest. Hence, contrary to what he says, TopCoDeer is dishonest.\n\nSample Input 3\n\nD D\n\nSample Output 3\n\nH", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 214, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s390065449", "group_id": "codeNet:p03778", "input_text": "program main\nimplicit none\ninteger :: W,a,b,d\n read(*,*) W,a,b\n d = ABS( b - a )\n if(d=k)then\n \n ans=i\n \n write(*,*)ans\n stop\n end if\n end do \n \n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1597779368, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03779.html", "problem_id": "p03779", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03779/input.txt", "sample_output_relpath": "derived/input_output/data/p03779/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03779/Fortran/s116876426.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s116876426", "user_id": "u713568912"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program sample\n implicit none\n character(100)::s,t\n integer(8) :: i,j,k,m,n,ans\n integer(8)::a,b,c,d\n integer(8),allocatable::x(:),y(:)\n \n read(*,*)k\n do i=1,k/2+1\n m=m+i\n if(m>=k)then\n \n ans=i\n \n write(*,*)ans\n stop\n end if\n end do \n \n stop\nend program sample\n \n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0.\nDuring the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right.\nThat is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i.\nThe kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible.\nFind the earliest possible time to reach coordinate X.\n\nConstraints\n\nX is an integer.\n\n1≤X≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the earliest possible time for the kangaroo to reach coordinate X.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times, which is the earliest possible time.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nHe can reach his nest at time 2 by staying at his position during the first second, and jumping to the right at the next second.\n\nSample Input 3\n\n11\n\nSample Output 3\n\n5", "sample_input": "6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03779", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a kangaroo at coordinate 0 on an infinite number line that runs from left to right, at time 0.\nDuring the period between time i-1 and time i, the kangaroo can either stay at his position, or perform a jump of length exactly i to the left or to the right.\nThat is, if his coordinate at time i-1 is x, he can be at coordinate x-i, x or x+i at time i.\nThe kangaroo's nest is at coordinate X, and he wants to travel to coordinate X as fast as possible.\nFind the earliest possible time to reach coordinate X.\n\nConstraints\n\nX is an integer.\n\n1≤X≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the earliest possible time for the kangaroo to reach coordinate X.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n3\n\nThe kangaroo can reach his nest at time 3 by jumping to the right three times, which is the earliest possible time.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n2\n\nHe can reach his nest at time 2 by staying at his position during the first second, and jumping to the right at the next second.\n\nSample Input 3\n\n11\n\nSample Output 3\n\n5", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 378, "cpu_time_ms": 11, "memory_kb": 2852}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s835133090", "group_id": "codeNet:p03786", "input_text": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\n\nprogram agc011\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int32):: n,i\n integer(int32),allocatable:: a(:), cnt(:)\n\n read*, n\n allocate(a(n))\n allocate(cnt(n), source=1)\n read*, a(:)\n\n call merge_sort(a,1,n)\n\n do i=1,n-1\n if (a(i)*2 >= a(i+1)) cnt(i+1) = cnt(i)+cnt(i+1)\n a(i+1)=a(i+1)+a(i)\n end do\n print'(i0)', cnt(n)\nend program agc011", "language": "Fortran", "metadata": {"date": 1591058327, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03786.html", "problem_id": "p03786", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03786/input.txt", "sample_output_relpath": "derived/input_output/data/p03786/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03786/Fortran/s835133090.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s835133090", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "module merge_sort_mod\n use,intrinsic :: iso_fortran_env\n implicit none\n private\n public:: merge_sort, double_merge_sort\n interface merge_sort\n module procedure ms32, ms64\n end interface\n\n interface double_merge_sort\n module procedure msd3232, msd6464\n end interface\ncontains\n recursive subroutine ms32(ar, fst, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap32(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms32(ar, fst, mdl)\n call ms32(ar, mdl+1, lst)\n call merge32(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge32(ar, fst, mdl, lst)\n integer(int32),intent(inout):: ar(:)\n integer(int32),intent(in):: fst, mdl, lst\n integer(int32),allocatable:: tmp(:)\n integer(int32):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap32(x,y)\n integer(int32),intent(inout):: x,y\n integer(int32):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n\n recursive subroutine ms64(ar, fst, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst-fst < 2) then\n if (ar(fst) > ar(lst)) call swap64(ar(fst),ar(lst))\n return\n end if\n\n mdl = (fst+lst)/2\n call ms64(ar, fst, mdl)\n call ms64(ar, mdl+1, lst)\n call merge64(ar, fst, mdl, lst)\n end subroutine\n\n\n subroutine merge64(ar, fst, mdl, lst)\n integer(int64),intent(inout):: ar(:)\n integer(int64),intent(in):: fst, mdl, lst\n integer(int64),allocatable:: tmp(:)\n integer(int64):: li, ri, ti\n\n allocate(tmp(lst-fst+1))\n\n li=fst\n ri=mdl+1 \n ti=1\n\n do while (li <= mdl .and. ri <= lst)\n if (ar(li) <= ar(ri)) then\n tmp(ti) = ar(li)\n li=li+1\n else\n tmp(ti) = ar(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n tmp(ti:) = ar(li:mdl)\n else\n tmp(ti:) = ar(ri:lst)\n end if\n\n ar(fst:lst) = tmp(:)\n deallocate(tmp)\n end subroutine\n\n\n subroutine swap64(x,y)\n integer(int64),intent(inout):: x,y\n integer(int64):: tmp\n tmp = x\n x = y\n y = tmp\n end subroutine\n\n recursive subroutine msd3232(ar1, ar2, fst, lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,lst\n integer(int32):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap32(ar1(fst), ar1(lst))\n call swap32(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd3232(ar1,ar2,fst,mdl)\n call msd3232(ar1,ar2,mdl+1,lst)\n call merged3232(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged3232(ar1,ar2,fst,mdl,lst)\n integer(int32),intent(inout):: ar1(:),ar2(:)\n integer(int32),intent(in):: fst,mdl,lst\n integer(int32),allocatable:: t1(:),t2(:)\n integer(int32):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\n\n\n recursive subroutine msd6464(ar1, ar2, fst, lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,lst\n integer(int64):: mdl\n\n if (lst - fst < 2) then\n if (ar1(fst) > ar1(lst)) then\n call swap64(ar1(fst), ar1(lst))\n call swap64(ar2(fst), ar2(lst))\n end if\n return\n end if\n\n mdl = (fst+lst)/2\n\n call msd6464(ar1,ar2,fst,mdl)\n call msd6464(ar1,ar2,mdl+1,lst)\n call merged6464(ar1,ar2,fst,mdl,lst)\n end subroutine\n\n\n subroutine merged6464(ar1,ar2,fst,mdl,lst)\n integer(int64),intent(inout):: ar1(:),ar2(:)\n integer(int64),intent(in):: fst,mdl,lst\n integer(int64),allocatable:: t1(:),t2(:)\n integer(int64):: li,ri,ti\n\n allocate(t1(lst-fst+1), t2(lst-fst+1))\n\n li=fst\n ri=mdl+1\n ti=1\n\n do while(li <= mdl .and. ri <= lst)\n if (ar1(li) <= ar1(ri)) then\n t1(ti) = ar1(li) \n t2(ti) = ar2(li)\n li=li+1\n else\n t1(ti) = ar1(ri)\n t2(ti) = ar2(ri)\n ri=ri+1\n end if\n ti=ti+1\n end do\n\n if (li <= mdl) then\n t1(ti:) = ar1(li:mdl)\n t2(ti:) = ar2(li:mdl)\n else\n t1(ti:) = ar1(ri:lst)\n t2(ti:) = ar2(ri:lst)\n end if\n\n ar1(fst:lst) = t1(:)\n ar2(fst:lst) = t2(:)\n\n deallocate(t1,t2)\n end subroutine\nend module\n\n\nprogram agc011\n use,intrinsic :: iso_fortran_env\n use merge_sort_mod\n implicit none\n integer(int32):: n,i\n integer(int32),allocatable:: a(:), cnt(:)\n\n read*, n\n allocate(a(n))\n allocate(cnt(n), source=1)\n read*, a(:)\n\n call merge_sort(a,1,n)\n\n do i=1,n-1\n if (a(i)*2 >= a(i+1)) cnt(i+1) = cnt(i)+cnt(i+1)\n a(i+1)=a(i+1)+a(i)\n end do\n print'(i0)', cnt(n)\nend program agc011", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke found N strange creatures.\nEach creature has a fixed color and size. The color and size of the i-th creature are represented by i and A_i, respectively.\n\nEvery creature can absorb another creature whose size is at most twice the size of itself.\nWhen a creature of size A and color B absorbs another creature of size C and color D (C \\leq 2 \\times A), they will merge into one creature of size A+C and color B.\nHere, depending on the sizes of two creatures, it is possible that both of them can absorb the other.\n\nSnuke has been watching these creatures merge over and over and ultimately become one creature.\nFind the number of the possible colors of this creature.\n\nConstraints\n\n2 \\leq N \\leq 100000\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 … A_N\n\nOutput\n\nPrint the number of the possible colors of the last remaining creature after the N creatures repeatedly merge and ultimately become one creature.\n\nSample Input 1\n\n3\n3 1 4\n\nSample Output 1\n\n2\n\nThe possible colors of the last remaining creature are colors 1 and 3.\nFor example, when the creature of color 3 absorbs the creature of color 2, then the creature of color 1 absorbs the creature of color 3, the color of the last remaining creature will be color 1.\n\nSample Input 2\n\n5\n1 1 1 1 1\n\nSample Output 2\n\n5\n\nThere may be multiple creatures of the same size.\n\nSample Input 3\n\n6\n40 1 30 2 7 20\n\nSample Output 3\n\n4", "sample_input": "3\n3 1 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03786", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke found N strange creatures.\nEach creature has a fixed color and size. The color and size of the i-th creature are represented by i and A_i, respectively.\n\nEvery creature can absorb another creature whose size is at most twice the size of itself.\nWhen a creature of size A and color B absorbs another creature of size C and color D (C \\leq 2 \\times A), they will merge into one creature of size A+C and color B.\nHere, depending on the sizes of two creatures, it is possible that both of them can absorb the other.\n\nSnuke has been watching these creatures merge over and over and ultimately become one creature.\nFind the number of the possible colors of this creature.\n\nConstraints\n\n2 \\leq N \\leq 100000\n\n1 \\leq A_i \\leq 10^9\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 … A_N\n\nOutput\n\nPrint the number of the possible colors of the last remaining creature after the N creatures repeatedly merge and ultimately become one creature.\n\nSample Input 1\n\n3\n3 1 4\n\nSample Output 1\n\n2\n\nThe possible colors of the last remaining creature are colors 1 and 3.\nFor example, when the creature of color 3 absorbs the creature of color 2, then the creature of color 1 absorbs the creature of color 3, the color of the last remaining creature will be color 1.\n\nSample Input 2\n\n5\n1 1 1 1 1\n\nSample Output 2\n\n5\n\nThere may be multiple creatures of the same size.\n\nSample Input 3\n\n6\n40 1 30 2 7 20\n\nSample Output 3\n\n4", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 6586, "cpu_time_ms": 52, "memory_kb": 2364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s483334658", "group_id": "codeNet:p03798", "input_text": "program main\nimplicit none\ninteger :: n\n\n read(*,*) n\n call wolv_or_sheep(n)\n\ncontains\n\n subroutine wolv_or_sheep(n)\n integer,intent(in) :: n\n character(n) :: s\n logical :: t(n),sw(n)\n integer :: i\n\n read(*,'(A)') s\n t(:) = [(s(i:i)=='o',i=1,n)]\n\n call test_seq(n,t,.TRUE.,.TRUE.)\n call test_seq(n,t,.TRUE.,.FALSE.)\n call test_seq(n,t,.FALSE.,.TRUE.)\n call test_seq(n,t,.FALSE.,.FALSE.)\n\n print*,-1\n\n end subroutine wolv_or_sheep\n\n subroutine test_seq(n,t,a1,a2)\n integer,intent(in) :: n\n logical,intent(in) :: t(n),a1,a2\n logical :: res(n),accept\n integer :: i\n!\n res(1) = a1\n res(2) = a2\n!\n do i=2,n-1\n if(t(i).eqv.res(i))then\n res(i+1) = res(i-1)\n else\n res(i+1) = .not.res(i-1)\n endif\n enddo\n!\n accept = res(n-1).eqv.res(1)\n\n if(res(n))then\n accept = accept.and.t(n).or..not.accept.and..not.t(n)\n else\n accept = .not.accept.and.t(n).or.accept.and..not.t(n)\n endif\n!\n if(accept)then\n do i=1,n\n if(res(i))then\n write(*,'(A)',advance='NO') 'S'\n else\n write(*,'(A)',advance='NO') 'W'\n endif\n enddo\n write(*,'(A)') ''\n STOP\n endif\n!\n end subroutine test_seq\n!\nend program main\n", "language": "Fortran", "metadata": {"date": 1571265793, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03798.html", "problem_id": "p03798", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03798/input.txt", "sample_output_relpath": "derived/input_output/data/p03798/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03798/Fortran/s483334658.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s483334658", "user_id": "u075763649"}, "prompt_components": {"gold_output": "SSSWWS\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: n\n\n read(*,*) n\n call wolv_or_sheep(n)\n\ncontains\n\n subroutine wolv_or_sheep(n)\n integer,intent(in) :: n\n character(n) :: s\n logical :: t(n),sw(n)\n integer :: i\n\n read(*,'(A)') s\n t(:) = [(s(i:i)=='o',i=1,n)]\n\n call test_seq(n,t,.TRUE.,.TRUE.)\n call test_seq(n,t,.TRUE.,.FALSE.)\n call test_seq(n,t,.FALSE.,.TRUE.)\n call test_seq(n,t,.FALSE.,.FALSE.)\n\n print*,-1\n\n end subroutine wolv_or_sheep\n\n subroutine test_seq(n,t,a1,a2)\n integer,intent(in) :: n\n logical,intent(in) :: t(n),a1,a2\n logical :: res(n),accept\n integer :: i\n!\n res(1) = a1\n res(2) = a2\n!\n do i=2,n-1\n if(t(i).eqv.res(i))then\n res(i+1) = res(i-1)\n else\n res(i+1) = .not.res(i-1)\n endif\n enddo\n!\n accept = res(n-1).eqv.res(1)\n\n if(res(n))then\n accept = accept.and.t(n).or..not.accept.and..not.t(n)\n else\n accept = .not.accept.and.t(n).or.accept.and..not.t(n)\n endif\n!\n if(accept)then\n do i=1,n\n if(res(i))then\n write(*,'(A)',advance='NO') 'S'\n else\n write(*,'(A)',advance='NO') 'W'\n endif\n enddo\n write(*,'(A)') ''\n STOP\n endif\n!\n end subroutine test_seq\n!\nend program main\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nSnuke, who loves animals, built a zoo.\n\nThere are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle.\nThe animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered N is adjacent to the animals numbered N-1 and 1.\n\nThere are two kinds of animals in this zoo: honest sheep that only speak the truth, and lying wolves that only tell lies.\n\nSnuke cannot tell the difference between these two species, and asked each animal the following question: \"Are your neighbors of the same species?\" The animal numbered i answered s_i. Here, if s_i is o, the animal said that the two neighboring animals are of the same species, and if s_i is x, the animal said that the two neighboring animals are of different species.\n\nMore formally, a sheep answered o if the two neighboring animals are both sheep or both wolves, and answered x otherwise.\nSimilarly, a wolf answered x if the two neighboring animals are both sheep or both wolves, and answered o otherwise.\n\nSnuke is wondering whether there is a valid assignment of species to the animals that is consistent with these responses. If there is such an assignment, show one such assignment. Otherwise, print -1.\n\nConstraints\n\n3 ≤ N ≤ 10^{5}\n\ns is a string of length N consisting of o and x.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nIf there does not exist an valid assignment that is consistent with s, print -1.\nOtherwise, print an string t in the following format. The output is considered correct if the assignment described by t is consistent with s.\n\nt is a string of length N consisting of S and W.\n\nIf t_i is S, it indicates that the animal numbered i is a sheep. If t_i is W, it indicates that the animal numbered i is a wolf.\n\nSample Input 1\n\n6\nooxoox\n\nSample Output 1\n\nSSSWWS\n\nFor example, if the animals numbered 1, 2, 3, 4, 5 and 6 are respectively a sheep, sheep, sheep, wolf, wolf, and sheep, it is consistent with their responses. Besides, there is another valid assignment of species: a wolf, sheep, wolf, sheep, wolf and wolf.\n\nLet us remind you: if the neiboring animals are of the same species, a sheep answers o and a wolf answers x. If the neiboring animals are of different species, a sheep answers x and a wolf answers o.\n\nSample Input 2\n\n3\noox\n\nSample Output 2\n\n-1\n\nPrint -1 if there is no valid assignment of species.\n\nSample Input 3\n\n10\noxooxoxoox\n\nSample Output 3\n\nSSWWSSSWWS", "sample_input": "6\nooxoox\n"}, "reference_outputs": ["SSSWWS\n"], "source_document_id": "p03798", "source_text": "Score : 500 points\n\nProblem Statement\n\nSnuke, who loves animals, built a zoo.\n\nThere are N animals in this zoo. They are conveniently numbered 1 through N, and arranged in a circle.\nThe animal numbered i (2≤i≤N-1) is adjacent to the animals numbered i-1 and i+1. Also, the animal numbered 1 is adjacent to the animals numbered 2 and N, and the animal numbered N is adjacent to the animals numbered N-1 and 1.\n\nThere are two kinds of animals in this zoo: honest sheep that only speak the truth, and lying wolves that only tell lies.\n\nSnuke cannot tell the difference between these two species, and asked each animal the following question: \"Are your neighbors of the same species?\" The animal numbered i answered s_i. Here, if s_i is o, the animal said that the two neighboring animals are of the same species, and if s_i is x, the animal said that the two neighboring animals are of different species.\n\nMore formally, a sheep answered o if the two neighboring animals are both sheep or both wolves, and answered x otherwise.\nSimilarly, a wolf answered x if the two neighboring animals are both sheep or both wolves, and answered o otherwise.\n\nSnuke is wondering whether there is a valid assignment of species to the animals that is consistent with these responses. If there is such an assignment, show one such assignment. Otherwise, print -1.\n\nConstraints\n\n3 ≤ N ≤ 10^{5}\n\ns is a string of length N consisting of o and x.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\ns\n\nOutput\n\nIf there does not exist an valid assignment that is consistent with s, print -1.\nOtherwise, print an string t in the following format. The output is considered correct if the assignment described by t is consistent with s.\n\nt is a string of length N consisting of S and W.\n\nIf t_i is S, it indicates that the animal numbered i is a sheep. If t_i is W, it indicates that the animal numbered i is a wolf.\n\nSample Input 1\n\n6\nooxoox\n\nSample Output 1\n\nSSSWWS\n\nFor example, if the animals numbered 1, 2, 3, 4, 5 and 6 are respectively a sheep, sheep, sheep, wolf, wolf, and sheep, it is consistent with their responses. Besides, there is another valid assignment of species: a wolf, sheep, wolf, sheep, wolf and wolf.\n\nLet us remind you: if the neiboring animals are of the same species, a sheep answers o and a wolf answers x. If the neiboring animals are of different species, a sheep answers x and a wolf answers o.\n\nSample Input 2\n\n3\noox\n\nSample Output 2\n\n-1\n\nPrint -1 if there is no valid assignment of species.\n\nSample Input 3\n\n10\noxooxoxoox\n\nSample Output 3\n\nSSWWSSSWWS", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1289, "cpu_time_ms": 27, "memory_kb": 1280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s712639715", "group_id": "codeNet:p03799", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,m\n\n read*, n,m\n\n m=m-2*n\n print'(i0)', n+m/4\nend program name", "language": "Fortran", "metadata": {"date": 1587087090, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03799.html", "problem_id": "p03799", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03799/input.txt", "sample_output_relpath": "derived/input_output/data/p03799/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03799/Fortran/s712639715.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s712639715", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: n,m\n\n read*, n,m\n\n m=m-2*n\n print'(i0)', n+m/4\nend program name", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke loves puzzles.\n\nToday, he is working on a puzzle using S- and c-shaped pieces.\nIn this puzzle, you can combine two c-shaped pieces into one S-shaped piece, as shown in the figure below:\n\nSnuke decided to create as many Scc groups as possible by putting together one S-shaped piece and two c-shaped pieces.\n\nFind the maximum number of Scc groups that can be created when Snuke has N S-shaped pieces and M c-shaped pieces.\n\nConstraints\n\n1 ≤ N,M ≤ 10^{12}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 6\n\nSample Output 1\n\n2\n\nTwo Scc groups can be created as follows:\n\nCombine two c-shaped pieces into one S-shaped piece\n\nCreate two Scc groups, each from one S-shaped piece and two c-shaped pieces\n\nSample Input 2\n\n12345 678901\n\nSample Output 2\n\n175897", "sample_input": "1 6\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03799", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke loves puzzles.\n\nToday, he is working on a puzzle using S- and c-shaped pieces.\nIn this puzzle, you can combine two c-shaped pieces into one S-shaped piece, as shown in the figure below:\n\nSnuke decided to create as many Scc groups as possible by putting together one S-shaped piece and two c-shaped pieces.\n\nFind the maximum number of Scc groups that can be created when Snuke has N S-shaped pieces and M c-shaped pieces.\n\nConstraints\n\n1 ≤ N,M ≤ 10^{12}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 6\n\nSample Output 1\n\n2\n\nTwo Scc groups can be created as follows:\n\nCombine two c-shaped pieces into one S-shaped piece\n\nCreate two Scc groups, each from one S-shaped piece and two c-shaped pieces\n\nSample Input 2\n\n12345 678901\n\nSample Output 2\n\n175897", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 161, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s228410794", "group_id": "codeNet:p03803", "input_text": "integer a,b\nread*, a, b\nif(a == 1) a= 14\n\nif(b == 1) b = 14\n\nif(a > b) then\n\tprint*, 'Alice'\nelse if(b > a) then\n\tprint*, 'Bob'\nelse\n\tprint*, 'Draw'\nend if\nend", "language": "Fortran", "metadata": {"date": 1571878476, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03803.html", "problem_id": "p03803", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03803/input.txt", "sample_output_relpath": "derived/input_output/data/p03803/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03803/Fortran/s228410794.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s228410794", "user_id": "u244203620"}, "prompt_components": {"gold_output": "Alice\n", "input_to_evaluate": "integer a,b\nread*, a, b\nif(a == 1) a= 14\n\nif(b == 1) b = 14\n\nif(a > b) then\n\tprint*, 'Alice'\nelse if(b > a) then\n\tprint*, 'Bob'\nelse\n\tprint*, 'Draw'\nend if\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAlice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards.\n\nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the number written on it, as follows:\n\nWeak 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 Strong\n\nOne Card Poker is played as follows:\n\nEach player picks one card from the deck. The chosen card becomes the player's hand.\n\nThe players reveal their hands to each other. The player with the stronger card wins the game.\n\nIf their cards are equally strong, the game is drawn.\n\nYou are watching Alice and Bob playing the game, and can see their hands.\n\nThe number written on Alice's card is A, and the number written on Bob's card is B.\n\nWrite a program to determine the outcome of the game.\n\nConstraints\n\n1≦A≦13\n\n1≦B≦13\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\nAlice\n\n8 is written on Alice's card, and 6 is written on Bob's card.\nAlice has the stronger card, and thus the output should be Alice.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nDraw\n\nSince their cards have the same number, the game will be drawn.\n\nSample Input 3\n\n13 1\n\nSample Output 3\n\nBob", "sample_input": "8 6\n"}, "reference_outputs": ["Alice\n"], "source_document_id": "p03803", "source_text": "Score : 100 points\n\nProblem Statement\n\nAlice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards.\n\nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the number written on it, as follows:\n\nWeak 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 Strong\n\nOne Card Poker is played as follows:\n\nEach player picks one card from the deck. The chosen card becomes the player's hand.\n\nThe players reveal their hands to each other. The player with the stronger card wins the game.\n\nIf their cards are equally strong, the game is drawn.\n\nYou are watching Alice and Bob playing the game, and can see their hands.\n\nThe number written on Alice's card is A, and the number written on Bob's card is B.\n\nWrite a program to determine the outcome of the game.\n\nConstraints\n\n1≦A≦13\n\n1≦B≦13\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\nAlice\n\n8 is written on Alice's card, and 6 is written on Bob's card.\nAlice has the stronger card, and thus the output should be Alice.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nDraw\n\nSince their cards have the same number, the game will be drawn.\n\nSample Input 3\n\n13 1\n\nSample Output 3\n\nBob", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 159, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s609526831", "group_id": "codeNet:p03803", "input_text": "program name\n\n implicit none\n integer A,B\n read*, A,B\n if ( A==1 .or. B==1 ) then\n if (A==B) then\n print*, \"Draw\"\n elseif (A>B) then\n print*, \"Bob\"\n else\n print*, \"Alice\"\n end if\n else\n if (A==B) then\n print*, \"Draw\"\n elseif (A>B) then\n print*, \"Alice\"\n else\n print*, \"Bob\"\n end if\n end if\nend program", "language": "Fortran", "metadata": {"date": 1560435658, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03803.html", "problem_id": "p03803", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03803/input.txt", "sample_output_relpath": "derived/input_output/data/p03803/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03803/Fortran/s609526831.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s609526831", "user_id": "u762420987"}, "prompt_components": {"gold_output": "Alice\n", "input_to_evaluate": "program name\n\n implicit none\n integer A,B\n read*, A,B\n if ( A==1 .or. B==1 ) then\n if (A==B) then\n print*, \"Draw\"\n elseif (A>B) then\n print*, \"Bob\"\n else\n print*, \"Alice\"\n end if\n else\n if (A==B) then\n print*, \"Draw\"\n elseif (A>B) then\n print*, \"Alice\"\n else\n print*, \"Bob\"\n end if\n end if\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAlice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards.\n\nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the number written on it, as follows:\n\nWeak 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 Strong\n\nOne Card Poker is played as follows:\n\nEach player picks one card from the deck. The chosen card becomes the player's hand.\n\nThe players reveal their hands to each other. The player with the stronger card wins the game.\n\nIf their cards are equally strong, the game is drawn.\n\nYou are watching Alice and Bob playing the game, and can see their hands.\n\nThe number written on Alice's card is A, and the number written on Bob's card is B.\n\nWrite a program to determine the outcome of the game.\n\nConstraints\n\n1≦A≦13\n\n1≦B≦13\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\nAlice\n\n8 is written on Alice's card, and 6 is written on Bob's card.\nAlice has the stronger card, and thus the output should be Alice.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nDraw\n\nSince their cards have the same number, the game will be drawn.\n\nSample Input 3\n\n13 1\n\nSample Output 3\n\nBob", "sample_input": "8 6\n"}, "reference_outputs": ["Alice\n"], "source_document_id": "p03803", "source_text": "Score : 100 points\n\nProblem Statement\n\nAlice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards.\n\nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the number written on it, as follows:\n\nWeak 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 Strong\n\nOne Card Poker is played as follows:\n\nEach player picks one card from the deck. The chosen card becomes the player's hand.\n\nThe players reveal their hands to each other. The player with the stronger card wins the game.\n\nIf their cards are equally strong, the game is drawn.\n\nYou are watching Alice and Bob playing the game, and can see their hands.\n\nThe number written on Alice's card is A, and the number written on Bob's card is B.\n\nWrite a program to determine the outcome of the game.\n\nConstraints\n\n1≦A≦13\n\n1≦B≦13\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\nAlice\n\n8 is written on Alice's card, and 6 is written on Bob's card.\nAlice has the stronger card, and thus the output should be Alice.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nDraw\n\nSince their cards have the same number, the game will be drawn.\n\nSample Input 3\n\n13 1\n\nSample Output 3\n\nBob", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 441, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s757339899", "group_id": "codeNet:p03803", "input_text": "implicit none\ninteger (8):: a,b,c\ncharacter(1) :: s\nread(*,*) a, b\n\nif (a==1 ) then\n a=14\nendif\n\nif (b==1 ) then\n b=14\nendif\n\nif (a>b) then\n write(*,*) \"Alice\"\nelse if (b>a) then\n write(*,*) \"Bob\"\nelse\n write(*,*) \"Draw\"\nendif\n\nend\n", "language": "Fortran", "metadata": {"date": 1525442956, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03803.html", "problem_id": "p03803", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03803/input.txt", "sample_output_relpath": "derived/input_output/data/p03803/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03803/Fortran/s757339899.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s757339899", "user_id": "u909643606"}, "prompt_components": {"gold_output": "Alice\n", "input_to_evaluate": "implicit none\ninteger (8):: a,b,c\ncharacter(1) :: s\nread(*,*) a, b\n\nif (a==1 ) then\n a=14\nendif\n\nif (b==1 ) then\n b=14\nendif\n\nif (a>b) then\n write(*,*) \"Alice\"\nelse if (b>a) then\n write(*,*) \"Bob\"\nelse\n write(*,*) \"Draw\"\nendif\n\nend\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAlice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards.\n\nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the number written on it, as follows:\n\nWeak 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 Strong\n\nOne Card Poker is played as follows:\n\nEach player picks one card from the deck. The chosen card becomes the player's hand.\n\nThe players reveal their hands to each other. The player with the stronger card wins the game.\n\nIf their cards are equally strong, the game is drawn.\n\nYou are watching Alice and Bob playing the game, and can see their hands.\n\nThe number written on Alice's card is A, and the number written on Bob's card is B.\n\nWrite a program to determine the outcome of the game.\n\nConstraints\n\n1≦A≦13\n\n1≦B≦13\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\nAlice\n\n8 is written on Alice's card, and 6 is written on Bob's card.\nAlice has the stronger card, and thus the output should be Alice.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nDraw\n\nSince their cards have the same number, the game will be drawn.\n\nSample Input 3\n\n13 1\n\nSample Output 3\n\nBob", "sample_input": "8 6\n"}, "reference_outputs": ["Alice\n"], "source_document_id": "p03803", "source_text": "Score : 100 points\n\nProblem Statement\n\nAlice and Bob are playing One Card Poker.\n\nOne Card Poker is a two-player game using playing cards.\n\nEach card in this game shows an integer between 1 and 13, inclusive.\n\nThe strength of a card is determined by the number written on it, as follows:\n\nWeak 2 < 3 < 4 < 5 < 6 < 7 < 8 < 9 < 10 < 11 < 12 < 13 < 1 Strong\n\nOne Card Poker is played as follows:\n\nEach player picks one card from the deck. The chosen card becomes the player's hand.\n\nThe players reveal their hands to each other. The player with the stronger card wins the game.\n\nIf their cards are equally strong, the game is drawn.\n\nYou are watching Alice and Bob playing the game, and can see their hands.\n\nThe number written on Alice's card is A, and the number written on Bob's card is B.\n\nWrite a program to determine the outcome of the game.\n\nConstraints\n\n1≦A≦13\n\n1≦B≦13\n\nA and B are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nPrint Alice if Alice will win. Print Bob if Bob will win. Print Draw if the game will be drawn.\n\nSample Input 1\n\n8 6\n\nSample Output 1\n\nAlice\n\n8 is written on Alice's card, and 6 is written on Bob's card.\nAlice has the stronger card, and thus the output should be Alice.\n\nSample Input 2\n\n1 1\n\nSample Output 2\n\nDraw\n\nSince their cards have the same number, the game will be drawn.\n\nSample Input 3\n\n13 1\n\nSample Output 3\n\nBob", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 248, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s101796105", "group_id": "codeNet:p03804", "input_text": "program ABC054B\n implicit none\n character(50)::s\n integer(8)::N,M,i,j,k,l,conv\n integer(8)::mask_sum=0\n integer(8)::flg=0\n integer(8),dimension(50,50)::img,mask\n read(5,*)N,M\n\n do i=1,N\n read(5,*)s\n do j=1,N\n if(s(j:j)==\".\")then\n img(j,i)=1\n else\n img(j,i)=0\n end if\n end do\n end do\n\n do i=1,M\n read(5,*)s\n do j=1,M\n if(s(j:j)==\".\")then\n mask(j,i)=1\n mask_sum=mask_sum+1\n else\n mask(j,i)=0\n end if\n end do\n end do\n\n\n do i=0,N-M\n do j=0,N-M\n conv=0\n do k=1,M\n do l=1,M\n if(mask(l,k)==img(l+j,k+i))conv=conv+1\n end do\n end do\n if(conv==M*M)then\n flg=1\n exit\n end if\n end do\n if(flg==1)exit\n end do\n\n if(flg==1)then\n print'(A)',\"Yes\"\n else\n print'(A)',\"No\"\n end if\nend program ABC054B", "language": "Fortran", "metadata": {"date": 1580756294, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03804.html", "problem_id": "p03804", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03804/input.txt", "sample_output_relpath": "derived/input_output/data/p03804/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03804/Fortran/s101796105.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s101796105", "user_id": "u414699019"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program ABC054B\n implicit none\n character(50)::s\n integer(8)::N,M,i,j,k,l,conv\n integer(8)::mask_sum=0\n integer(8)::flg=0\n integer(8),dimension(50,50)::img,mask\n read(5,*)N,M\n\n do i=1,N\n read(5,*)s\n do j=1,N\n if(s(j:j)==\".\")then\n img(j,i)=1\n else\n img(j,i)=0\n end if\n end do\n end do\n\n do i=1,M\n read(5,*)s\n do j=1,M\n if(s(j:j)==\".\")then\n mask(j,i)=1\n mask_sum=mask_sum+1\n else\n mask(j,i)=0\n end if\n end do\n end do\n\n\n do i=0,N-M\n do j=0,N-M\n conv=0\n do k=1,M\n do l=1,M\n if(mask(l,k)==img(l+j,k+i))conv=conv+1\n end do\n end do\n if(conv==M*M)then\n flg=1\n exit\n end if\n end do\n if(flg==1)exit\n end do\n\n if(flg==1)then\n print'(A)',\"Yes\"\n else\n print'(A)',\"No\"\n end if\nend program ABC054B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of size 1×1.\n\nAlso, the given images are binary images, and the color of each pixel is either white or black.\n\nIn the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.\n\nThe image A is given as N strings A_1,...,A_N.\n\nThe j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).\n\nSimilarly, the template image B is given as M strings B_1,...,B_M.\n\nThe j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).\n\nDetermine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.\n\nConstraints\n\n1≦M≦N≦50\n\nA_i is a string of length N consisting of # and ..\n\nB_i is a string of length M consisting of # and ..\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nA_1\nA_2\n:\nA_N\nB_1\nB_2\n:\nB_M\n\nOutput\n\nPrint Yes if the template image B is contained in the image A. Print No otherwise.\n\nSample Input 1\n\n3 2\n#.#\n.#.\n#.#\n#.\n.#\n\nSample Output 1\n\nYes\n\nThe template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.\n\nSample Input 2\n\n4 1\n....\n....\n....\n....\n#\n\nSample Output 2\n\nNo\n\nThe template image B, composed of a black pixel, is not contained in the image A composed of white pixels.", "sample_input": "3 2\n#.#\n.#.\n#.#\n#.\n.#\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03804", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of size 1×1.\n\nAlso, the given images are binary images, and the color of each pixel is either white or black.\n\nIn the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.\n\nThe image A is given as N strings A_1,...,A_N.\n\nThe j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).\n\nSimilarly, the template image B is given as M strings B_1,...,B_M.\n\nThe j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).\n\nDetermine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.\n\nConstraints\n\n1≦M≦N≦50\n\nA_i is a string of length N consisting of # and ..\n\nB_i is a string of length M consisting of # and ..\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nA_1\nA_2\n:\nA_N\nB_1\nB_2\n:\nB_M\n\nOutput\n\nPrint Yes if the template image B is contained in the image A. Print No otherwise.\n\nSample Input 1\n\n3 2\n#.#\n.#.\n#.#\n#.\n.#\n\nSample Output 1\n\nYes\n\nThe template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.\n\nSample Input 2\n\n4 1\n....\n....\n....\n....\n#\n\nSample Output 2\n\nNo\n\nThe template image B, composed of a black pixel, is not contained in the image A composed of white pixels.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1081, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s616526325", "group_id": "codeNet:p03804", "input_text": "program ABC054B\n implicit none\n character(50)::s\n integer(8)::N,M,i,j,k,l,conv\n integer(8)::mask_sum=0\n integer(8)::flg=0\n integer(8),dimension(50,50)::img,mask\n read(5,*)N,M\n\n do i=1,N\n read(5,*)s\n do j=1,N\n if(s(j:j)==\".\")then\n img(j,i)=1\n else\n img(j,i)=0\n end if\n end do\n end do\n\n do i=1,M\n read(5,*)s\n do j=1,M\n if(s(j:j)==\".\")then\n mask(j,i)=1\n mask_sum=mask_sum+1\n else\n mask(j,i)=0\n end if\n end do\n end do\n\n\n do i=1,N-M\n do j=1,N-M\n conv=0\n do k=1,M\n do l=1,M\n if(mask(l,k)==img(l+j,k+i))conv=conv+1\n end do\n end do\n if(conv==M*M)then\n flg=1\n exit\n end if\n end do\n if(flg==1)exit\n end do\n\n if(flg==1)then\n print'(A)',\"Yes\"\n else\n print'(A)',\"No\"\n end if\nend program ABC054B", "language": "Fortran", "metadata": {"date": 1580756235, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03804.html", "problem_id": "p03804", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03804/input.txt", "sample_output_relpath": "derived/input_output/data/p03804/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03804/Fortran/s616526325.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s616526325", "user_id": "u414699019"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program ABC054B\n implicit none\n character(50)::s\n integer(8)::N,M,i,j,k,l,conv\n integer(8)::mask_sum=0\n integer(8)::flg=0\n integer(8),dimension(50,50)::img,mask\n read(5,*)N,M\n\n do i=1,N\n read(5,*)s\n do j=1,N\n if(s(j:j)==\".\")then\n img(j,i)=1\n else\n img(j,i)=0\n end if\n end do\n end do\n\n do i=1,M\n read(5,*)s\n do j=1,M\n if(s(j:j)==\".\")then\n mask(j,i)=1\n mask_sum=mask_sum+1\n else\n mask(j,i)=0\n end if\n end do\n end do\n\n\n do i=1,N-M\n do j=1,N-M\n conv=0\n do k=1,M\n do l=1,M\n if(mask(l,k)==img(l+j,k+i))conv=conv+1\n end do\n end do\n if(conv==M*M)then\n flg=1\n exit\n end if\n end do\n if(flg==1)exit\n end do\n\n if(flg==1)then\n print'(A)',\"Yes\"\n else\n print'(A)',\"No\"\n end if\nend program ABC054B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of size 1×1.\n\nAlso, the given images are binary images, and the color of each pixel is either white or black.\n\nIn the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.\n\nThe image A is given as N strings A_1,...,A_N.\n\nThe j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).\n\nSimilarly, the template image B is given as M strings B_1,...,B_M.\n\nThe j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).\n\nDetermine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.\n\nConstraints\n\n1≦M≦N≦50\n\nA_i is a string of length N consisting of # and ..\n\nB_i is a string of length M consisting of # and ..\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nA_1\nA_2\n:\nA_N\nB_1\nB_2\n:\nB_M\n\nOutput\n\nPrint Yes if the template image B is contained in the image A. Print No otherwise.\n\nSample Input 1\n\n3 2\n#.#\n.#.\n#.#\n#.\n.#\n\nSample Output 1\n\nYes\n\nThe template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.\n\nSample Input 2\n\n4 1\n....\n....\n....\n....\n#\n\nSample Output 2\n\nNo\n\nThe template image B, composed of a black pixel, is not contained in the image A composed of white pixels.", "sample_input": "3 2\n#.#\n.#.\n#.#\n#.\n.#\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03804", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given an image A composed of N rows and N columns of pixels, and a template image B composed of M rows and M columns of pixels.\n\nA pixel is the smallest element of an image, and in this problem it is a square of size 1×1.\n\nAlso, the given images are binary images, and the color of each pixel is either white or black.\n\nIn the input, every pixel is represented by a character: . corresponds to a white pixel, and # corresponds to a black pixel.\n\nThe image A is given as N strings A_1,...,A_N.\n\nThe j-th character in the string A_i corresponds to the pixel at the i-th row and j-th column of the image A (1≦i,j≦N).\n\nSimilarly, the template image B is given as M strings B_1,...,B_M.\n\nThe j-th character in the string B_i corresponds to the pixel at the i-th row and j-th column of the template image B (1≦i,j≦M).\n\nDetermine whether the template image B is contained in the image A when only parallel shifts can be applied to the images.\n\nConstraints\n\n1≦M≦N≦50\n\nA_i is a string of length N consisting of # and ..\n\nB_i is a string of length M consisting of # and ..\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nA_1\nA_2\n:\nA_N\nB_1\nB_2\n:\nB_M\n\nOutput\n\nPrint Yes if the template image B is contained in the image A. Print No otherwise.\n\nSample Input 1\n\n3 2\n#.#\n.#.\n#.#\n#.\n.#\n\nSample Output 1\n\nYes\n\nThe template image B is identical to the upper-left 2 × 2 subimage and the lower-right 2 × 2 subimage of A. Thus, the output should be Yes.\n\nSample Input 2\n\n4 1\n....\n....\n....\n....\n#\n\nSample Output 2\n\nNo\n\nThe template image B, composed of a black pixel, is not contained in the image A composed of white pixels.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1081, "cpu_time_ms": 4, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s339516045", "group_id": "codeNet:p03807", "input_text": "integer N\ninteger,allocatable,dimension(:)::A\ninteger oddcnt,evencnt\nread*,N\nallocate(A(N))\nread*,A\n\noddcnt=0\ndo i=1,N\n if(and(A(i),1)==1)oddcnt=oddcnt+1\nend do\nevencnt=N-oddcnt\nprint\"(A)\",merge(\"YES\",\" NO\",mod(oddcnt,2)==0 .and. mod(evencnt+oddcnt/2,2)==0)\nend", "language": "Fortran", "metadata": {"date": 1559142433, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03807.html", "problem_id": "p03807", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03807/input.txt", "sample_output_relpath": "derived/input_output/data/p03807/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03807/Fortran/s339516045.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s339516045", "user_id": "u598073939"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "integer N\ninteger,allocatable,dimension(:)::A\ninteger oddcnt,evencnt\nread*,N\nallocate(A(N))\nread*,A\n\noddcnt=0\ndo i=1,N\n if(and(A(i),1)==1)oddcnt=oddcnt+1\nend do\nevencnt=N-oddcnt\nprint\"(A)\",merge(\"YES\",\" NO\",mod(oddcnt,2)==0 .and. mod(evencnt+oddcnt/2,2)==0)\nend", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N integers written on a blackboard. The i-th integer is A_i.\n\nTakahashi will repeatedly perform the following operation on these numbers:\n\nSelect a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.\n\nThen, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.\n\nDetermine whether it is possible to have only one integer on the blackboard.\n\nConstraints\n\n2 ≦ N ≦ 10^5\n\n1 ≦ A_i ≦ 10^9\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 … A_N\n\nOutput\n\nIf it is possible to have only one integer on the blackboard, print YES. Otherwise, print NO.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\nYES\n\nIt is possible to have only one integer on the blackboard, as follows:\n\nErase 1 and 3 from the blackboard, then write 4. Now, there are two integers on the blackboard: 2 and 4.\n\nErase 2 and 4 from the blackboard, then write 6. Now, there is only one integer on the blackboard: 6.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\nNO", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03807", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N integers written on a blackboard. The i-th integer is A_i.\n\nTakahashi will repeatedly perform the following operation on these numbers:\n\nSelect a pair of integers, A_i and A_j, that have the same parity (that is, both are even or both are odd) and erase them.\n\nThen, write a new integer on the blackboard that is equal to the sum of those integers, A_i+A_j.\n\nDetermine whether it is possible to have only one integer on the blackboard.\n\nConstraints\n\n2 ≦ N ≦ 10^5\n\n1 ≦ A_i ≦ 10^9\n\nA_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 … A_N\n\nOutput\n\nIf it is possible to have only one integer on the blackboard, print YES. Otherwise, print NO.\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\nYES\n\nIt is possible to have only one integer on the blackboard, as follows:\n\nErase 1 and 3 from the blackboard, then write 4. Now, there are two integers on the blackboard: 2 and 4.\n\nErase 2 and 4 from the blackboard, then write 6. Now, there is only one integer on the blackboard: 6.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 262, "cpu_time_ms": 39, "memory_kb": 1664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s616173642", "group_id": "codeNet:p03813", "input_text": "read*,i;print*,merge(\"ABC\",\"ARC\",i<1200);end", "language": "Fortran", "metadata": {"date": 1551970016, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03813.html", "problem_id": "p03813", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03813/input.txt", "sample_output_relpath": "derived/input_output/data/p03813/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03813/Fortran/s616173642.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s616173642", "user_id": "u394482932"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "read*,i;print*,merge(\"ABC\",\"ARC\",i<1200);end", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSmeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise.\n\nYou are given Smeke's current rating, x. Print ABC if Smeke will participate in ABC, and print ARC otherwise.\n\nConstraints\n\n1 ≦ x ≦ 3{,}000\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1000\n\nSample Output 1\n\nABC\n\nSmeke's current rating is less than 1200, thus the output should be ABC.\n\nSample Input 2\n\n2000\n\nSample Output 2\n\nARC\n\nSmeke's current rating is not less than 1200, thus the output should be ARC.", "sample_input": "1000\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03813", "source_text": "Score : 100 points\n\nProblem Statement\n\nSmeke has decided to participate in AtCoder Beginner Contest (ABC) if his current rating is less than 1200, and participate in AtCoder Regular Contest (ARC) otherwise.\n\nYou are given Smeke's current rating, x. Print ABC if Smeke will participate in ABC, and print ARC otherwise.\n\nConstraints\n\n1 ≦ x ≦ 3{,}000\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1000\n\nSample Output 1\n\nABC\n\nSmeke's current rating is less than 1200, thus the output should be ABC.\n\nSample Input 2\n\n2000\n\nSample Output 2\n\nARC\n\nSmeke's current rating is not less than 1200, thus the output should be ARC.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 44, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s715855269", "group_id": "codeNet:p03817", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: x,mx\n\n read*, x\n mx = mod(x,11_8)\n print'(i0)', 2*(x/11_8)+and(mx,1)+and(mx/6,1)\nend program name", "language": "Fortran", "metadata": {"date": 1588718159, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03817.html", "problem_id": "p03817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03817/input.txt", "sample_output_relpath": "derived/input_output/data/p03817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03817/Fortran/s715855269.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s715855269", "user_id": "u234636620"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int64):: x,mx\n\n read*, x\n mx = mod(x,11_8)\n print'(i0)', 2*(x/11_8)+and(mx,1)+and(mx/6,1)\nend program name", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "sample_input": "7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03817", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 195, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s411842935", "group_id": "codeNet:p03817", "input_text": "program ARC068C\n implicit none\n integer(8)::x\n integer(8)::result=0\n read(5,*)x\n\n result=x/11\n result=result*2\n\n if(mod(x,11)>=7)then\n result=result+2\n else\n result=result+1\n end if\n\n print'(i0)',result\n \nend program ARC068C", "language": "Fortran", "metadata": {"date": 1574696616, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03817.html", "problem_id": "p03817", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03817/input.txt", "sample_output_relpath": "derived/input_output/data/p03817/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03817/Fortran/s411842935.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s411842935", "user_id": "u414699019"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program ARC068C\n implicit none\n integer(8)::x\n integer(8)::result=0\n read(5,*)x\n\n result=x/11\n result=result*2\n\n if(mod(x,11)>=7)then\n result=result+2\n else\n result=result+1\n end if\n\n print'(i0)',result\n \nend program ARC068C", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "sample_input": "7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03817", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has decided to play with a six-sided die. Each of its six sides shows an integer 1 through 6, and two numbers on opposite sides always add up to 7.\n\nSnuke will first put the die on the table with an arbitrary side facing upward, then repeatedly perform the following operation:\n\nOperation: Rotate the die 90° toward one of the following directions: left, right, front (the die will come closer) and back (the die will go farther). Then, obtain y points where y is the number written in the side facing upward.\n\nFor example, let us consider the situation where the side showing 1 faces upward, the near side shows 5 and the right side shows 4, as illustrated in the figure.\nIf the die is rotated toward the right as shown in the figure, the side showing 3 will face upward.\nBesides, the side showing 4 will face upward if the die is rotated toward the left, the side showing 2 will face upward if the die is rotated toward the front, and the side showing 5 will face upward if the die is rotated toward the back.\n\nFind the minimum number of operation Snuke needs to perform in order to score at least x points in total.\n\nConstraints\n\n1 ≦ x ≦ 10^{15}\n\nx is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n2\n\nSample Input 2\n\n149696127901\n\nSample Output 2\n\n27217477801", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 271, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s767917029", "group_id": "codeNet:p03827", "input_text": "program sample\n implicit none\n character(100)::s\n character(3)::ans\n integer(8) :: i,j,m,n,max\n integer(8),allocatable :: x(:),y(:)\n \n read(*,*)n\n read(*,*)s\n m=0\n max=0\n do i=1,n\n if(s(i:i) .eq. 'I')then\n m=m+1\n if(m>max)then\n max=m\n end if\n else\n m=m-1\n endif\n end do\n \n \n write(*,*)max\n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1596244569, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03827.html", "problem_id": "p03827", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03827/input.txt", "sample_output_relpath": "derived/input_output/data/p03827/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03827/Fortran/s767917029.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s767917029", "user_id": "u713568912"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program sample\n implicit none\n character(100)::s\n character(3)::ans\n integer(8) :: i,j,m,n,max\n integer(8),allocatable :: x(:),y(:)\n \n read(*,*)n\n read(*,*)s\n m=0\n max=0\n do i=1,n\n if(s(i:i) .eq. 'I')then\n m=m+1\n if(m>max)then\n max=m\n end if\n else\n m=m-1\n endif\n end do\n \n \n write(*,*)max\n stop\nend program sample\n \n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have an integer variable x.\nInitially, x=0.\n\nSome person gave you a string S of length N, and using the string you performed the following operation N times.\nIn the i-th operation, you incremented the value of x by 1 if S_i=I, and decremented the value of x by 1 if S_i=D.\n\nFind the maximum value taken by x during the operations (including before the first operation, and after the last operation).\n\nConstraints\n\n1≤N≤100\n\n|S|=N\n\nNo characters except I and D occur in S.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the maximum value taken by x during the operations.\n\nSample Input 1\n\n5\nIIDID\n\nSample Output 1\n\n2\n\nAfter each operation, the value of x becomes 1, 2, 1, 2 and 1, respectively. Thus, the output should be 2, the maximum value.\n\nSample Input 2\n\n7\nDDIDDII\n\nSample Output 2\n\n0\n\nThe initial value x=0 is the maximum value taken by x, thus the output should be 0.", "sample_input": "5\nIIDID\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03827", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have an integer variable x.\nInitially, x=0.\n\nSome person gave you a string S of length N, and using the string you performed the following operation N times.\nIn the i-th operation, you incremented the value of x by 1 if S_i=I, and decremented the value of x by 1 if S_i=D.\n\nFind the maximum value taken by x during the operations (including before the first operation, and after the last operation).\n\nConstraints\n\n1≤N≤100\n\n|S|=N\n\nNo characters except I and D occur in S.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the maximum value taken by x during the operations.\n\nSample Input 1\n\n5\nIIDID\n\nSample Output 1\n\n2\n\nAfter each operation, the value of x becomes 1, 2, 1, 2 and 1, respectively. Thus, the output should be 2, the maximum value.\n\nSample Input 2\n\n7\nDDIDDII\n\nSample Output 2\n\n0\n\nThe initial value x=0 is the maximum value taken by x, thus the output should be 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 442, "cpu_time_ms": 6, "memory_kb": 2752}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s306064920", "group_id": "codeNet:p03827", "input_text": "program prob2\n implicit none\n character(105) :: s\n integer :: n, i, ans, anss\n read(*,*) n, s\n ans = 0\n anss = 0\n do i = 1, n\n if(s(i:i) == 'I')then\n ans = ans + 1\n else \n ans = ans - 1\n end if\n anss = max(anss, ans)\n end do\n write(*,*) anss\n\n stop\ncontains\nend program prob2", "language": "Fortran", "metadata": {"date": 1596244072, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03827.html", "problem_id": "p03827", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03827/input.txt", "sample_output_relpath": "derived/input_output/data/p03827/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03827/Fortran/s306064920.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s306064920", "user_id": "u478462004"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program prob2\n implicit none\n character(105) :: s\n integer :: n, i, ans, anss\n read(*,*) n, s\n ans = 0\n anss = 0\n do i = 1, n\n if(s(i:i) == 'I')then\n ans = ans + 1\n else \n ans = ans - 1\n end if\n anss = max(anss, ans)\n end do\n write(*,*) anss\n\n stop\ncontains\nend program prob2", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have an integer variable x.\nInitially, x=0.\n\nSome person gave you a string S of length N, and using the string you performed the following operation N times.\nIn the i-th operation, you incremented the value of x by 1 if S_i=I, and decremented the value of x by 1 if S_i=D.\n\nFind the maximum value taken by x during the operations (including before the first operation, and after the last operation).\n\nConstraints\n\n1≤N≤100\n\n|S|=N\n\nNo characters except I and D occur in S.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the maximum value taken by x during the operations.\n\nSample Input 1\n\n5\nIIDID\n\nSample Output 1\n\n2\n\nAfter each operation, the value of x becomes 1, 2, 1, 2 and 1, respectively. Thus, the output should be 2, the maximum value.\n\nSample Input 2\n\n7\nDDIDDII\n\nSample Output 2\n\n0\n\nThe initial value x=0 is the maximum value taken by x, thus the output should be 0.", "sample_input": "5\nIIDID\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03827", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have an integer variable x.\nInitially, x=0.\n\nSome person gave you a string S of length N, and using the string you performed the following operation N times.\nIn the i-th operation, you incremented the value of x by 1 if S_i=I, and decremented the value of x by 1 if S_i=D.\n\nFind the maximum value taken by x during the operations (including before the first operation, and after the last operation).\n\nConstraints\n\n1≤N≤100\n\n|S|=N\n\nNo characters except I and D occur in S.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the maximum value taken by x during the operations.\n\nSample Input 1\n\n5\nIIDID\n\nSample Output 1\n\n2\n\nAfter each operation, the value of x becomes 1, 2, 1, 2 and 1, respectively. Thus, the output should be 2, the maximum value.\n\nSample Input 2\n\n7\nDDIDDII\n\nSample Output 2\n\n0\n\nThe initial value x=0 is the maximum value taken by x, thus the output should be 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 355, "cpu_time_ms": 4, "memory_kb": 2828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s587962413", "group_id": "codeNet:p03827", "input_text": "program main\nimplicit none\ninteger :: i, j, k\ninteger :: n\ncharacter :: s*100\n\nread(*,*) n\nread(*,*) s(1:n)\nj = 0\nk = 0\ndo i = 1, n\n if( s(i:i) == 'I' ) then\n j = j + 1\n else\n j = j - 1\n end if\n if( j .ge. k ) then\n k = j\n end if\nend do\nwrite(*,'(i0)') k\n\n\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1563559385, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03827.html", "problem_id": "p03827", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03827/input.txt", "sample_output_relpath": "derived/input_output/data/p03827/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03827/Fortran/s587962413.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s587962413", "user_id": "u696547932"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: i, j, k\ninteger :: n\ncharacter :: s*100\n\nread(*,*) n\nread(*,*) s(1:n)\nj = 0\nk = 0\ndo i = 1, n\n if( s(i:i) == 'I' ) then\n j = j + 1\n else\n j = j - 1\n end if\n if( j .ge. k ) then\n k = j\n end if\nend do\nwrite(*,'(i0)') k\n\n\n\nend program main\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have an integer variable x.\nInitially, x=0.\n\nSome person gave you a string S of length N, and using the string you performed the following operation N times.\nIn the i-th operation, you incremented the value of x by 1 if S_i=I, and decremented the value of x by 1 if S_i=D.\n\nFind the maximum value taken by x during the operations (including before the first operation, and after the last operation).\n\nConstraints\n\n1≤N≤100\n\n|S|=N\n\nNo characters except I and D occur in S.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the maximum value taken by x during the operations.\n\nSample Input 1\n\n5\nIIDID\n\nSample Output 1\n\n2\n\nAfter each operation, the value of x becomes 1, 2, 1, 2 and 1, respectively. Thus, the output should be 2, the maximum value.\n\nSample Input 2\n\n7\nDDIDDII\n\nSample Output 2\n\n0\n\nThe initial value x=0 is the maximum value taken by x, thus the output should be 0.", "sample_input": "5\nIIDID\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03827", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have an integer variable x.\nInitially, x=0.\n\nSome person gave you a string S of length N, and using the string you performed the following operation N times.\nIn the i-th operation, you incremented the value of x by 1 if S_i=I, and decremented the value of x by 1 if S_i=D.\n\nFind the maximum value taken by x during the operations (including before the first operation, and after the last operation).\n\nConstraints\n\n1≤N≤100\n\n|S|=N\n\nNo characters except I and D occur in S.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the maximum value taken by x during the operations.\n\nSample Input 1\n\n5\nIIDID\n\nSample Output 1\n\n2\n\nAfter each operation, the value of x becomes 1, 2, 1, 2 and 1, respectively. Thus, the output should be 2, the maximum value.\n\nSample Input 2\n\n7\nDDIDDII\n\nSample Output 2\n\n0\n\nThe initial value x=0 is the maximum value taken by x, thus the output should be 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 300, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s072781864", "group_id": "codeNet:p03838", "input_text": "program AGC008A\n implicit none\n integer(8)::x,y\n integer(8)::result=0\n read(5,*)x,y\n\n result=result+abs(abs(x)-abs(y))\n\n if(x*y>=0 .and. x>y)then\n result=result+2\n else if(x*y<0)then\n result=result+1\n end if\n\n print'(i0)',result\n\nend program AGC008A", "language": "Fortran", "metadata": {"date": 1576095686, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03838.html", "problem_id": "p03838", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03838/input.txt", "sample_output_relpath": "derived/input_output/data/p03838/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03838/Fortran/s072781864.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s072781864", "user_id": "u414699019"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program AGC008A\n implicit none\n integer(8)::x,y\n integer(8)::result=0\n read(5,*)x,y\n\n result=result+abs(abs(x)-abs(y))\n\n if(x*y>=0 .and. x>y)then\n result=result+2\n else if(x*y<0)then\n result=result+1\n end if\n\n print'(i0)',result\n\nend program AGC008A", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has a calculator. It has a display and two buttons.\n\nInitially, the display shows an integer x.\nSnuke wants to change this value into another integer y, by pressing the following two buttons some number of times in arbitrary order:\n\nButton A: When pressed, the value on the display is incremented by 1.\n\nButton B: When pressed, the sign of the value on the display is reversed.\n\nFind the minimum number of times Snuke needs to press the buttons to achieve his objective.\nIt can be shown that the objective is always achievable regardless of the values of the integers x and y.\n\nConstraints\n\nx and y are integers.\n\n|x|, |y| ≤ 10^9\n\nx and y are different.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nPrint the minimum number of times Snuke needs to press the buttons to achieve his objective.\n\nSample Input 1\n\n10 20\n\nSample Output 1\n\n10\n\nPress button A ten times.\n\nSample Input 2\n\n10 -10\n\nSample Output 2\n\n1\n\nPress button B once.\n\nSample Input 3\n\n-10 -20\n\nSample Output 3\n\n12\n\nPress the buttons as follows:\n\nPress button B once.\n\nPress button A ten times.\n\nPress button B once.", "sample_input": "10 20\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03838", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has a calculator. It has a display and two buttons.\n\nInitially, the display shows an integer x.\nSnuke wants to change this value into another integer y, by pressing the following two buttons some number of times in arbitrary order:\n\nButton A: When pressed, the value on the display is incremented by 1.\n\nButton B: When pressed, the sign of the value on the display is reversed.\n\nFind the minimum number of times Snuke needs to press the buttons to achieve his objective.\nIt can be shown that the objective is always achievable regardless of the values of the integers x and y.\n\nConstraints\n\nx and y are integers.\n\n|x|, |y| ≤ 10^9\n\nx and y are different.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nPrint the minimum number of times Snuke needs to press the buttons to achieve his objective.\n\nSample Input 1\n\n10 20\n\nSample Output 1\n\n10\n\nPress button A ten times.\n\nSample Input 2\n\n10 -10\n\nSample Output 2\n\n1\n\nPress button B once.\n\nSample Input 3\n\n-10 -20\n\nSample Output 3\n\n12\n\nPress the buttons as follows:\n\nPress button B once.\n\nPress button A ten times.\n\nPress button B once.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 290, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s640977428", "group_id": "codeNet:p03838", "input_text": "program AGC008A\n implicit none\n integer(8)::x,y\n integer(8)::result=0\n read(5,*)x,y\n\n result=result+abs(abs(x)-abs(y))\n\n if(x*y>0 .and. x>y)then\n if(x>0)then\n result=result+2\n else\n result=result+1\n end if\n else if(x*y<0)then\n result=result+1\n end if\n\n print'(i0)',result\n\nend program AGC008A", "language": "Fortran", "metadata": {"date": 1576095180, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03838.html", "problem_id": "p03838", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03838/input.txt", "sample_output_relpath": "derived/input_output/data/p03838/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03838/Fortran/s640977428.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s640977428", "user_id": "u414699019"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program AGC008A\n implicit none\n integer(8)::x,y\n integer(8)::result=0\n read(5,*)x,y\n\n result=result+abs(abs(x)-abs(y))\n\n if(x*y>0 .and. x>y)then\n if(x>0)then\n result=result+2\n else\n result=result+1\n end if\n else if(x*y<0)then\n result=result+1\n end if\n\n print'(i0)',result\n\nend program AGC008A", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has a calculator. It has a display and two buttons.\n\nInitially, the display shows an integer x.\nSnuke wants to change this value into another integer y, by pressing the following two buttons some number of times in arbitrary order:\n\nButton A: When pressed, the value on the display is incremented by 1.\n\nButton B: When pressed, the sign of the value on the display is reversed.\n\nFind the minimum number of times Snuke needs to press the buttons to achieve his objective.\nIt can be shown that the objective is always achievable regardless of the values of the integers x and y.\n\nConstraints\n\nx and y are integers.\n\n|x|, |y| ≤ 10^9\n\nx and y are different.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nPrint the minimum number of times Snuke needs to press the buttons to achieve his objective.\n\nSample Input 1\n\n10 20\n\nSample Output 1\n\n10\n\nPress button A ten times.\n\nSample Input 2\n\n10 -10\n\nSample Output 2\n\n1\n\nPress button B once.\n\nSample Input 3\n\n-10 -20\n\nSample Output 3\n\n12\n\nPress the buttons as follows:\n\nPress button B once.\n\nPress button A ten times.\n\nPress button B once.", "sample_input": "10 20\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03838", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has a calculator. It has a display and two buttons.\n\nInitially, the display shows an integer x.\nSnuke wants to change this value into another integer y, by pressing the following two buttons some number of times in arbitrary order:\n\nButton A: When pressed, the value on the display is incremented by 1.\n\nButton B: When pressed, the sign of the value on the display is reversed.\n\nFind the minimum number of times Snuke needs to press the buttons to achieve his objective.\nIt can be shown that the objective is always achievable regardless of the values of the integers x and y.\n\nConstraints\n\nx and y are integers.\n\n|x|, |y| ≤ 10^9\n\nx and y are different.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx y\n\nOutput\n\nPrint the minimum number of times Snuke needs to press the buttons to achieve his objective.\n\nSample Input 1\n\n10 20\n\nSample Output 1\n\n10\n\nPress button A ten times.\n\nSample Input 2\n\n10 -10\n\nSample Output 2\n\n1\n\nPress button B once.\n\nSample Input 3\n\n-10 -20\n\nSample Output 3\n\n12\n\nPress the buttons as follows:\n\nPress button B once.\n\nPress button A ten times.\n\nPress button B once.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 369, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s820138197", "group_id": "codeNet:p03844", "input_text": "program main\ncharacter(1) a\nread*,i,a,j\nif(a=='-')then\nprint*,i-j\nelse \nprint*,i+j\nendif\nend program main", "language": "Fortran", "metadata": {"date": 1575407240, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03844.html", "problem_id": "p03844", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03844/input.txt", "sample_output_relpath": "derived/input_output/data/p03844/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03844/Fortran/s820138197.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s820138197", "user_id": "u952130512"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "program main\ncharacter(1) a\nread*,i,a,j\nif(a=='-')then\nprint*,i-j\nelse \nprint*,i+j\nendif\nend program main", "problem_context": "Score : 100 points\n\nProblem Statement\n\nJoisino wants to evaluate the formula \"A op B\".\nHere, A and B are integers, and the binary operator op is either + or -.\nYour task is to evaluate the formula instead of her.\n\nConstraints\n\n1≦A,B≦10^9\n\nop is either + or -.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA op B\n\nOutput\n\nEvaluate the formula and print the result.\n\nSample Input 1\n\n1 + 2\n\nSample Output 1\n\n3\n\nSince 1 + 2 = 3, the output should be 3.\n\nSample Input 2\n\n5 - 7\n\nSample Output 2\n\n-2", "sample_input": "1 + 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03844", "source_text": "Score : 100 points\n\nProblem Statement\n\nJoisino wants to evaluate the formula \"A op B\".\nHere, A and B are integers, and the binary operator op is either + or -.\nYour task is to evaluate the formula instead of her.\n\nConstraints\n\n1≦A,B≦10^9\n\nop is either + or -.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA op B\n\nOutput\n\nEvaluate the formula and print the result.\n\nSample Input 1\n\n1 + 2\n\nSample Output 1\n\n3\n\nSince 1 + 2 = 3, the output should be 3.\n\nSample Input 2\n\n5 - 7\n\nSample Output 2\n\n-2", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 105, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s441367642", "group_id": "codeNet:p03845", "input_text": "program ABC050B\n implicit none\n integer(8)::N,P,X,i,M,result\n integer(8),dimension(100)::T\n read(5,*)N,(T(i),i=1,N),M\n result=sum(T(1:N))\n\n do i=1,M\n read(5,*)P,X\n print'(i0)',result+X-T(P)\n end do\nend program ABC050B", "language": "Fortran", "metadata": {"date": 1580963442, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03845.html", "problem_id": "p03845", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03845/input.txt", "sample_output_relpath": "derived/input_output/data/p03845/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03845/Fortran/s441367642.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s441367642", "user_id": "u414699019"}, "prompt_components": {"gold_output": "6\n9\n", "input_to_evaluate": "program ABC050B\n implicit none\n integer(8)::N,P,X,i,M,result\n integer(8),dimension(100)::T\n read(5,*)N,(T(i),i=1,N),M\n result=sum(T(1:N))\n\n do i=1,M\n read(5,*)P,X\n print'(i0)',result+X-T(P)\n end do\nend program ABC050B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nJoisino is about to compete in the final round of a certain programming competition.\nIn this contest, there are N problems, numbered 1 through N.\nJoisino knows that it takes her T_i seconds to solve problem i(1≦i≦N).\n\nAlso, there are M kinds of drinks offered to the contestants, numbered 1 through M.\nIf Joisino takes drink i(1≦i≦M), her brain will be stimulated and the time it takes for her to solve problem P_i will become X_i seconds.\nIt does not affect the time to solve the other problems.\n\nA contestant is allowed to take exactly one of the drinks before the start of the contest.\nFor each drink, Joisino wants to know how many seconds it takes her to solve all the problems if she takes that drink.\nHere, assume that the time it takes her to solve all the problems is equal to the sum of the time it takes for her to solve individual problems.\nYour task is to write a program to calculate it instead of her.\n\nConstraints\n\nAll input values are integers.\n\n1≦N≦100\n\n1≦T_i≦10^5\n\n1≦M≦100\n\n1≦P_i≦N\n\n1≦X_i≦10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 T_2 ... T_N\nM\nP_1 X_1\nP_2 X_2\n:\nP_M X_M\n\nOutput\n\nFor each drink, calculate how many seconds it takes Joisino to solve all the problems if she takes that drink, and print the results, one per line.\n\nSample Input 1\n\n3\n2 1 4\n2\n1 1\n2 3\n\nSample Output 1\n\n6\n9\n\nIf Joisino takes drink 1, the time it takes her to solve each problem will be 1, 1 and 4 seconds, respectively, totaling 6 seconds.\n\nIf Joisino takes drink 2, the time it takes her to solve each problem will be 2, 3 and 4 seconds, respectively, totaling 9 seconds.\n\nSample Input 2\n\n5\n7 2 3 8 5\n3\n4 2\n1 7\n4 13\n\nSample Output 2\n\n19\n25\n30", "sample_input": "3\n2 1 4\n2\n1 1\n2 3\n"}, "reference_outputs": ["6\n9\n"], "source_document_id": "p03845", "source_text": "Score : 200 points\n\nProblem Statement\n\nJoisino is about to compete in the final round of a certain programming competition.\nIn this contest, there are N problems, numbered 1 through N.\nJoisino knows that it takes her T_i seconds to solve problem i(1≦i≦N).\n\nAlso, there are M kinds of drinks offered to the contestants, numbered 1 through M.\nIf Joisino takes drink i(1≦i≦M), her brain will be stimulated and the time it takes for her to solve problem P_i will become X_i seconds.\nIt does not affect the time to solve the other problems.\n\nA contestant is allowed to take exactly one of the drinks before the start of the contest.\nFor each drink, Joisino wants to know how many seconds it takes her to solve all the problems if she takes that drink.\nHere, assume that the time it takes her to solve all the problems is equal to the sum of the time it takes for her to solve individual problems.\nYour task is to write a program to calculate it instead of her.\n\nConstraints\n\nAll input values are integers.\n\n1≦N≦100\n\n1≦T_i≦10^5\n\n1≦M≦100\n\n1≦P_i≦N\n\n1≦X_i≦10^5\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nT_1 T_2 ... T_N\nM\nP_1 X_1\nP_2 X_2\n:\nP_M X_M\n\nOutput\n\nFor each drink, calculate how many seconds it takes Joisino to solve all the problems if she takes that drink, and print the results, one per line.\n\nSample Input 1\n\n3\n2 1 4\n2\n1 1\n2 3\n\nSample Output 1\n\n6\n9\n\nIf Joisino takes drink 1, the time it takes her to solve each problem will be 1, 1 and 4 seconds, respectively, totaling 6 seconds.\n\nIf Joisino takes drink 2, the time it takes her to solve each problem will be 2, 3 and 4 seconds, respectively, totaling 9 seconds.\n\nSample Input 2\n\n5\n7 2 3 8 5\n3\n4 2\n1 7\n4 13\n\nSample Output 2\n\n19\n25\n30", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 252, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s026937902", "group_id": "codeNet:p03846", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: n,i\ninteger(16),allocatable :: a(:)\n\nread*, n\nallocate(a(n))\nread*, a(1:n)\n\ncall hs(n,a)\n\ndo i = n-1, 0, -2\n if ( i == 0 ) then\n if ( a(1) /= 0 ) stop\n exit\n end if\n if ( 2*i /= a(i)+a(i+1) ) then\n print'(i0)', 0\n stop\n end if\nend do\n\nprint'(i0)', mod(2**(n/2),1000000007)\n\ncontains\n!!!!!! サブルーチンは↓\nsubroutine hs(n,array)\n implicit none\n integer(16),intent(in)::n\n integer(16),intent(inout)::array(1:n)\n \n integer(16)::i,k,j,l,m\n integer(16)::t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(l)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n \n return\nend subroutine hs\n!!!!!!\n\nEND PROGRAM ATCODER", "language": "Fortran", "metadata": {"date": 1553548856, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03846.html", "problem_id": "p03846", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03846/input.txt", "sample_output_relpath": "derived/input_output/data/p03846/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03846/Fortran/s026937902.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s026937902", "user_id": "u454557108"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger(16) :: n,i\ninteger(16),allocatable :: a(:)\n\nread*, n\nallocate(a(n))\nread*, a(1:n)\n\ncall hs(n,a)\n\ndo i = n-1, 0, -2\n if ( i == 0 ) then\n if ( a(1) /= 0 ) stop\n exit\n end if\n if ( 2*i /= a(i)+a(i+1) ) then\n print'(i0)', 0\n stop\n end if\nend do\n\nprint'(i0)', mod(2**(n/2),1000000007)\n\ncontains\n!!!!!! サブルーチンは↓\nsubroutine hs(n,array)\n implicit none\n integer(16),intent(in)::n\n integer(16),intent(inout)::array(1:n)\n \n integer(16)::i,k,j,l,m\n integer(16)::t\n \n if(n.le.0)then\n write(6,*)\"Error, at heapsort\"; stop\n endif\n if(n.eq.1)return\n \n l=n/2+1\n k=n\n do while(k.ne.1)\n if(l.gt.1)then\n l=l-1\n t=array(l)\n else\n t=array(k)\n array(k)=array(1)\n k=k-1\n if(k.eq.1) then\n array(1)=t\n exit\n endif\n endif\n i=l\n j=l+l\n do while(j.le.k)\n if(j.lt.k)then\n if(array(j).lt.array(j+1))j=j+1\n endif\n if (t.lt.array(j))then\n array(i)=array(j)\n i=j\n j=j+j\n else\n j=k+1\n endif\n enddo\n array(i)=t\n enddo\n \n return\nend subroutine hs\n!!!!!!\n\nEND PROGRAM ATCODER", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people, conveniently numbered 1 through N.\nThey were standing in a row yesterday, but now they are unsure of the order in which they were standing.\nHowever, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.\nAccording to their reports, the difference above for person i is A_i.\n\nBased on these reports, find the number of the possible orders in which they were standing.\nSince it can be extremely large, print the answer modulo 10^9+7.\nNote that the reports may be incorrect and thus there may be no consistent order.\nIn such a case, print 0.\n\nConstraints\n\n1≦N≦10^5\n\n0≦A_i≦N-1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the possible orders in which they were standing, modulo 10^9+7.\n\nSample Input 1\n\n5\n2 4 4 0 2\n\nSample Output 1\n\n4\n\nThere are four possible orders, as follows:\n\n2,1,4,5,3\n\n2,5,4,1,3\n\n3,1,4,5,2\n\n3,5,4,1,2\n\nSample Input 2\n\n7\n6 4 0 2 4 0 2\n\nSample Output 2\n\n0\n\nAny order would be inconsistent with the reports, thus the answer is 0.\n\nSample Input 3\n\n8\n7 5 1 1 7 3 5 3\n\nSample Output 3\n\n16", "sample_input": "5\n2 4 4 0 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03846", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people, conveniently numbered 1 through N.\nThey were standing in a row yesterday, but now they are unsure of the order in which they were standing.\nHowever, each person remembered the following fact: the absolute difference of the number of the people who were standing to the left of that person, and the number of the people who were standing to the right of that person.\nAccording to their reports, the difference above for person i is A_i.\n\nBased on these reports, find the number of the possible orders in which they were standing.\nSince it can be extremely large, print the answer modulo 10^9+7.\nNote that the reports may be incorrect and thus there may be no consistent order.\nIn such a case, print 0.\n\nConstraints\n\n1≦N≦10^5\n\n0≦A_i≦N-1\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the number of the possible orders in which they were standing, modulo 10^9+7.\n\nSample Input 1\n\n5\n2 4 4 0 2\n\nSample Output 1\n\n4\n\nThere are four possible orders, as follows:\n\n2,1,4,5,3\n\n2,5,4,1,3\n\n3,1,4,5,2\n\n3,5,4,1,2\n\nSample Input 2\n\n7\n6 4 0 2 4 0 2\n\nSample Output 2\n\n0\n\nAny order would be inconsistent with the reports, thus the answer is 0.\n\nSample Input 3\n\n8\n7 5 1 1 7 3 5 3\n\nSample Output 3\n\n16", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1213, "cpu_time_ms": 50, "memory_kb": 2304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s551834952", "group_id": "codeNet:p03853", "input_text": "program sample\n implicit none\n character(100)::s,t\n integer(8) :: i,j,k,m,n,h,w\n integer(8)::a,b,c,d\n character(10000),allocatable::x(:),y(:)\n \n read(*,*) h,w\n allocate(x(h),y(2*h)) \n do i=1,h\n read(*,*)s\n write(*,*)s\n write(*,*)s\n !y(i*2-1)=x(i)\n !y(i*2)=x(i)\n end do\n \n stop\nend program sample\n \n\n", "language": "Fortran", "metadata": {"date": 1598663386, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03853.html", "problem_id": "p03853", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03853/input.txt", "sample_output_relpath": "derived/input_output/data/p03853/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03853/Fortran/s551834952.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s551834952", "user_id": "u713568912"}, "prompt_components": {"gold_output": "*.\n*.\n.*\n.*\n", "input_to_evaluate": "program sample\n implicit none\n character(100)::s,t\n integer(8) :: i,j,k,m,n,h,w\n integer(8)::a,b,c,d\n character(10000),allocatable::x(:),y(:)\n \n read(*,*) h,w\n allocate(x(h),y(2*h)) \n do i=1,h\n read(*,*)s\n write(*,*)s\n write(*,*)s\n !y(i*2-1)=x(i)\n !y(i*2)=x(i)\n end do\n \n stop\nend program sample\n \n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "sample_input": "2 2\n*.\n.*\n"}, "reference_outputs": ["*.\n*.\n.*\n.*\n"], "source_document_id": "p03853", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 370, "cpu_time_ms": 7, "memory_kb": 2872}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s860205665", "group_id": "codeNet:p03853", "input_text": "integer H,W\ncharacter(150),allocatable,dimension(:)::C\nread*,H,W\nallocate(C(H))\nread*,C\ndo i=1,H\n\tprint\"(A)\",trim(C(i))\n print\"(A)\",trim(C(i))\nenddo\nend", "language": "Fortran", "metadata": {"date": 1551575586, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03853.html", "problem_id": "p03853", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03853/input.txt", "sample_output_relpath": "derived/input_output/data/p03853/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03853/Fortran/s860205665.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s860205665", "user_id": "u598073939"}, "prompt_components": {"gold_output": "*.\n*.\n.*\n.*\n", "input_to_evaluate": "integer H,W\ncharacter(150),allocatable,dimension(:)::C\nread*,H,W\nallocate(C(H))\nread*,C\ndo i=1,H\n\tprint\"(A)\",trim(C(i))\n print\"(A)\",trim(C(i))\nenddo\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "sample_input": "2 2\n*.\n.*\n"}, "reference_outputs": ["*.\n*.\n.*\n.*\n"], "source_document_id": "p03853", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is an image with a height of H pixels and a width of W pixels. Each of the pixels is represented by either . or *. The character representing the pixel at the i-th row from the top and the j-th column from the left, is denoted by C_{i,j}.\n\nExtend this image vertically so that its height is doubled. That is, print a image with a height of 2H pixels and a width of W pixels where the pixel at the i-th row and j-th column is equal to C_{(i+1)/2,j} (the result of division is rounded down).\n\nConstraints\n\n1≦H, W≦100\n\nC_{i,j} is either . or *.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nC_{1,1}...C_{1,W}\n:\nC_{H,1}...C_{H,W}\n\nOutput\n\nPrint the extended image.\n\nSample Input 1\n\n2 2\n*.\n.*\n\nSample Output 1\n\n*.\n*.\n.*\n.*\n\nSample Input 2\n\n1 4\n***.\n\nSample Output 2\n\n***.\n***.\n\nSample Input 3\n\n9 20\n.....***....***.....\n....*...*..*...*....\n...*.....**.....*...\n...*.....*......*...\n....*.....*....*....\n.....**..*...**.....\n.......*..*.*.......\n........**.*........\n.........**.........\n\nSample Output 3\n\n.....***....***.....\n.....***....***.....\n....*...*..*...*....\n....*...*..*...*....\n...*.....**.....*...\n...*.....**.....*...\n...*.....*......*...\n...*.....*......*...\n....*.....*....*....\n....*.....*....*....\n.....**..*...**.....\n.....**..*...**.....\n.......*..*.*.......\n.......*..*.*.......\n........**.*........\n........**.*........\n.........**.........\n.........**.........", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 155, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s421177158", "group_id": "codeNet:p03861", "input_text": "integer(16) a,b,x\nread*,a,b,x\nprint\"(i0)\",b/x-a/x+merge(1,0,mod(a,x)==0)\nend", "language": "Fortran", "metadata": {"date": 1551575277, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03861.html", "problem_id": "p03861", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03861/input.txt", "sample_output_relpath": "derived/input_output/data/p03861/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03861/Fortran/s421177158.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s421177158", "user_id": "u598073939"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "integer(16) a,b,x\nread*,a,b,x\nprint\"(i0)\",b/x-a/x+merge(1,0,mod(a,x)==0)\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given nonnegative integers a and b (a ≤ b), and a positive integer x.\nAmong the integers between a and b, inclusive, how many are divisible by x?\n\nConstraints\n\n0 ≤ a ≤ b ≤ 10^{18}\n\n1 ≤ x ≤ 10^{18}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the number of the integers between a and b, inclusive, that are divisible by x.\n\nSample Input 1\n\n4 8 2\n\nSample Output 1\n\n3\n\nThere are three integers between 4 and 8, inclusive, that are divisible by 2: 4, 6 and 8.\n\nSample Input 2\n\n0 5 1\n\nSample Output 2\n\n6\n\nThere are six integers between 0 and 5, inclusive, that are divisible by 1: 0, 1, 2, 3, 4 and 5.\n\nSample Input 3\n\n9 9 2\n\nSample Output 3\n\n0\n\nThere are no integer between 9 and 9, inclusive, that is divisible by 2.\n\nSample Input 4\n\n1 1000000000000000000 3\n\nSample Output 4\n\n333333333333333333\n\nWatch out for integer overflows.", "sample_input": "4 8 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03861", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given nonnegative integers a and b (a ≤ b), and a positive integer x.\nAmong the integers between a and b, inclusive, how many are divisible by x?\n\nConstraints\n\n0 ≤ a ≤ b ≤ 10^{18}\n\n1 ≤ x ≤ 10^{18}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b x\n\nOutput\n\nPrint the number of the integers between a and b, inclusive, that are divisible by x.\n\nSample Input 1\n\n4 8 2\n\nSample Output 1\n\n3\n\nThere are three integers between 4 and 8, inclusive, that are divisible by 2: 4, 6 and 8.\n\nSample Input 2\n\n0 5 1\n\nSample Output 2\n\n6\n\nThere are six integers between 0 and 5, inclusive, that are divisible by 1: 0, 1, 2, 3, 4 and 5.\n\nSample Input 3\n\n9 9 2\n\nSample Output 3\n\n0\n\nThere are no integer between 9 and 9, inclusive, that is divisible by 2.\n\nSample Input 4\n\n1 1000000000000000000 3\n\nSample Output 4\n\n333333333333333333\n\nWatch out for integer overflows.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 76, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s503775591", "group_id": "codeNet:p03899", "input_text": "program struck_out\n implicit none\n integer :: n, m, k, i, j, l\n integer(8) :: a(100000), dp(0:100000,300)\n a = 0_8\n dp = 0_8\n read(*,*) n, m, k\n read(*,*) a(1:n)\n do i = 1, n\n dp(i,1) = a(i)\n do j = 2, k\n l = max(0,i-m)\n dp(i,j) = int(j,8)*a(i)+maxval(dp(l:i-1,j-1))\n end do\n end do\n write(*,'(i0)') maxval(dp(1:n,k))\n stop\nend program struck_out", "language": "Fortran", "metadata": {"date": 1562729026, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03899.html", "problem_id": "p03899", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03899/input.txt", "sample_output_relpath": "derived/input_output/data/p03899/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03899/Fortran/s503775591.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s503775591", "user_id": "u506403362"}, "prompt_components": {"gold_output": "56\n", "input_to_evaluate": "program struck_out\n implicit none\n integer :: n, m, k, i, j, l\n integer(8) :: a(100000), dp(0:100000,300)\n a = 0_8\n dp = 0_8\n read(*,*) n, m, k\n read(*,*) a(1:n)\n do i = 1, n\n dp(i,1) = a(i)\n do j = 2, k\n l = max(0,i-m)\n dp(i,j) = int(j,8)*a(i)+maxval(dp(l:i-1,j-1))\n end do\n end do\n write(*,'(i0)') maxval(dp(1:n,k))\n stop\nend program struck_out", "problem_context": "Score : 700 points\n\nProblem Statement\n\nThere are N panels arranged in a row in Takahashi's house, numbered 1 through N. The i-th panel has a number A_i written on it. Takahashi is playing by throwing balls at these panels.\n\nTakahashi threw a ball K times. Let the panel hit by a boll in the i-th throw be panel p_i. He set the score for the i-th throw as i \\times A_{p_i}.\n\nHe was about to calculate the total score for his throws, when he realized that he forgot the panels hit by balls, p_1,p_2,...,p_K. The only fact he remembers is that for every i (1 ≦ i ≦ K-1), 1 ≦ p_{i+1}-p_i ≦ M holds. Based on this fact, find the maximum possible total score for his throws.\n\nConstraints\n\n1 ≦ M ≦ N ≦ 100,000\n\n1 ≦ K ≦ min(300,N)\n\n1 ≦ A_i ≦ 10^{9}\n\nPartial Scores\n\nIn the test set worth 100 points, M = N.\n\nIn the test set worth another 200 points, N ≦ 300 and K ≦ 30.\n\nIn the test set worth another 300 points, K ≦ 30.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M K\nA_1 A_2 … A_N\n\nOutput\n\nPrint the maximum possible total score for Takahashi's throws.\n\nSample Input 1\n\n5 2 3\n10 2 8 10 2\n\nSample Output 1\n\n56\n\nThe total score is maximized when panels 1,3 and 4 are hit, in this order.\n\nSample Input 2\n\n5 5 2\n5 2 10 5 9\n\nSample Output 2\n\n28\n\nThis case satisfies the additional constraint M = N for a partial score.\n\nSample Input 3\n\n10 3 5\n3 7 2 6 9 4 8 5 1 1000000000\n\nSample Output 3\n\n5000000078", "sample_input": "5 2 3\n10 2 8 10 2\n"}, "reference_outputs": ["56\n"], "source_document_id": "p03899", "source_text": "Score : 700 points\n\nProblem Statement\n\nThere are N panels arranged in a row in Takahashi's house, numbered 1 through N. The i-th panel has a number A_i written on it. Takahashi is playing by throwing balls at these panels.\n\nTakahashi threw a ball K times. Let the panel hit by a boll in the i-th throw be panel p_i. He set the score for the i-th throw as i \\times A_{p_i}.\n\nHe was about to calculate the total score for his throws, when he realized that he forgot the panels hit by balls, p_1,p_2,...,p_K. The only fact he remembers is that for every i (1 ≦ i ≦ K-1), 1 ≦ p_{i+1}-p_i ≦ M holds. Based on this fact, find the maximum possible total score for his throws.\n\nConstraints\n\n1 ≦ M ≦ N ≦ 100,000\n\n1 ≦ K ≦ min(300,N)\n\n1 ≦ A_i ≦ 10^{9}\n\nPartial Scores\n\nIn the test set worth 100 points, M = N.\n\nIn the test set worth another 200 points, N ≦ 300 and K ≦ 30.\n\nIn the test set worth another 300 points, K ≦ 30.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M K\nA_1 A_2 … A_N\n\nOutput\n\nPrint the maximum possible total score for Takahashi's throws.\n\nSample Input 1\n\n5 2 3\n10 2 8 10 2\n\nSample Output 1\n\n56\n\nThe total score is maximized when panels 1,3 and 4 are hit, in this order.\n\nSample Input 2\n\n5 5 2\n5 2 10 5 9\n\nSample Output 2\n\n28\n\nThis case satisfies the additional constraint M = N for a partial score.\n\nSample Input 3\n\n10 3 5\n3 7 2 6 9 4 8 5 1 1000000000\n\nSample Output 3\n\n5000000078", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 376, "cpu_time_ms": 2104, "memory_kb": 235904}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s255807185", "group_id": "codeNet:p03943", "input_text": "integer x(3);read*,x;print*,merge(\"Yes\",\" No\",maxval(x)*2==sum(x));end", "language": "Fortran", "metadata": {"date": 1551968168, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03943.html", "problem_id": "p03943", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03943/input.txt", "sample_output_relpath": "derived/input_output/data/p03943/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03943/Fortran/s255807185.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s255807185", "user_id": "u394482932"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "integer x(3);read*,x;print*,merge(\"Yes\",\" No\",maxval(x)*2==sum(x));end", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTwo students of AtCoder Kindergarten are fighting over candy packs.\n\nThere are three candy packs, each of which contains a, b, and c candies, respectively.\n\nTeacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible.\n\nNote that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students.\n\nConstraints\n\n1 ≦ a, b, c ≦ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b c\n\nOutput\n\nIf it is possible to distribute the packs so that each student gets the same number of candies, print Yes. Otherwise, print No.\n\nSample Input 1\n\n10 30 20\n\nSample Output 1\n\nYes\n\nGive the pack with 30 candies to one student, and give the two packs with 10 and 20 candies to the other. Then, each gets 30 candies.\n\nSample Input 2\n\n30 30 100\n\nSample Output 2\n\nNo\n\nIn this case, the student who gets the pack with 100 candies always has more candies than the other.\n\nNote that every pack must be given to one of them.\n\nSample Input 3\n\n56 25 31\n\nSample Output 3\n\nYes", "sample_input": "10 30 20\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03943", "source_text": "Score : 100 points\n\nProblem Statement\n\nTwo students of AtCoder Kindergarten are fighting over candy packs.\n\nThere are three candy packs, each of which contains a, b, and c candies, respectively.\n\nTeacher Evi is trying to distribute the packs between the two students so that each student gets the same number of candies. Determine whether it is possible.\n\nNote that Evi cannot take candies out of the packs, and the whole contents of each pack must be given to one of the students.\n\nConstraints\n\n1 ≦ a, b, c ≦ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b c\n\nOutput\n\nIf it is possible to distribute the packs so that each student gets the same number of candies, print Yes. Otherwise, print No.\n\nSample Input 1\n\n10 30 20\n\nSample Output 1\n\nYes\n\nGive the pack with 30 candies to one student, and give the two packs with 10 and 20 candies to the other. Then, each gets 30 candies.\n\nSample Input 2\n\n30 30 100\n\nSample Output 2\n\nNo\n\nIn this case, the student who gets the pack with 100 candies always has more candies than the other.\n\nNote that every pack must be given to one of them.\n\nSample Input 3\n\n56 25 31\n\nSample Output 3\n\nYes", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 70, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s246538809", "group_id": "codeNet:p03944", "input_text": " PROGRAM piyo\n IMPLICIT NONE\n integer :: w,h,n\n integer,allocatable :: x(:),y(:),a(:)\n integer :: i\n logical,allocatable :: rect(:,:)\n \n read*,w,h,n\n allocate( x(n),y(n),a(n) )\n do i = 1,n\n read*,x(i),y(i),a(i)\n end do\n \n allocate( rect(1:w,1:h) )\n rect = .true.\n \n do i = 1,n\n select case( a(i) )\n case( 1 )\n rect(1:x(i),:) = .false.\n case( 2 )\n rect(x(i)+1:w,:) = .false.\n case( 3 )\n rect(:,1:y(i)) = .false.\n case( 4 )\n rect(:,y(i)+1:h) = .false.\n end select\n end do\n \n \n print*,count( rect )\n \n \n \n \n \n \n END PROGRAM", "language": "Fortran", "metadata": {"date": 1590382044, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03944.html", "problem_id": "p03944", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03944/input.txt", "sample_output_relpath": "derived/input_output/data/p03944/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03944/Fortran/s246538809.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s246538809", "user_id": "u171356453"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": " PROGRAM piyo\n IMPLICIT NONE\n integer :: w,h,n\n integer,allocatable :: x(:),y(:),a(:)\n integer :: i\n logical,allocatable :: rect(:,:)\n \n read*,w,h,n\n allocate( x(n),y(n),a(n) )\n do i = 1,n\n read*,x(i),y(i),a(i)\n end do\n \n allocate( rect(1:w,1:h) )\n rect = .true.\n \n do i = 1,n\n select case( a(i) )\n case( 1 )\n rect(1:x(i),:) = .false.\n case( 2 )\n rect(x(i)+1:w,:) = .false.\n case( 3 )\n rect(:,1:y(i)) = .false.\n case( 4 )\n rect(:,y(i)+1:h) = .false.\n end select\n end do\n \n \n print*,count( rect )\n \n \n \n \n \n \n END PROGRAM", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white.\n\nSnuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) point was (x_i, y_i).\n\nThen, he created an integer sequence a of length N, and for each 1 ≦ i ≦ N, he painted some region within the rectangle black, as follows:\n\nIf a_i = 1, he painted the region satisfying x < x_i within the rectangle.\n\nIf a_i = 2, he painted the region satisfying x > x_i within the rectangle.\n\nIf a_i = 3, he painted the region satisfying y < y_i within the rectangle.\n\nIf a_i = 4, he painted the region satisfying y > y_i within the rectangle.\n\nFind the area of the white region within the rectangle after he finished painting.\n\nConstraints\n\n1 ≦ W, H ≦ 100\n\n1 ≦ N ≦ 100\n\n0 ≦ x_i ≦ W (1 ≦ i ≦ N)\n\n0 ≦ y_i ≦ H (1 ≦ i ≦ N)\n\nW, H (21:32, added), x_i and y_i are integers.\n\na_i (1 ≦ i ≦ N) is 1, 2, 3 or 4.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nW H N\nx_1 y_1 a_1\nx_2 y_2 a_2\n:\nx_N y_N a_N\n\nOutput\n\nPrint the area of the white region within the rectangle after Snuke finished painting.\n\nSample Input 1\n\n5 4 2\n2 1 1\n3 3 4\n\nSample Output 1\n\n9\n\nThe figure below shows the rectangle before Snuke starts painting.\n\nFirst, as (x_1, y_1) = (2, 1) and a_1 = 1, he paints the region satisfying x < 2 within the rectangle:\n\nThen, as (x_2, y_2) = (3, 3) and a_2 = 4, he paints the region satisfying y > 3 within the rectangle:\n\nNow, the area of the white region within the rectangle is 9.\n\nSample Input 2\n\n5 4 3\n2 1 1\n3 3 4\n1 4 2\n\nSample Output 2\n\n0\n\nIt is possible that the whole region within the rectangle is painted black.\n\nSample Input 3\n\n10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\n\nSample Output 3\n\n64", "sample_input": "5 4 2\n2 1 1\n3 3 4\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03944", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white.\n\nSnuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) point was (x_i, y_i).\n\nThen, he created an integer sequence a of length N, and for each 1 ≦ i ≦ N, he painted some region within the rectangle black, as follows:\n\nIf a_i = 1, he painted the region satisfying x < x_i within the rectangle.\n\nIf a_i = 2, he painted the region satisfying x > x_i within the rectangle.\n\nIf a_i = 3, he painted the region satisfying y < y_i within the rectangle.\n\nIf a_i = 4, he painted the region satisfying y > y_i within the rectangle.\n\nFind the area of the white region within the rectangle after he finished painting.\n\nConstraints\n\n1 ≦ W, H ≦ 100\n\n1 ≦ N ≦ 100\n\n0 ≦ x_i ≦ W (1 ≦ i ≦ N)\n\n0 ≦ y_i ≦ H (1 ≦ i ≦ N)\n\nW, H (21:32, added), x_i and y_i are integers.\n\na_i (1 ≦ i ≦ N) is 1, 2, 3 or 4.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nW H N\nx_1 y_1 a_1\nx_2 y_2 a_2\n:\nx_N y_N a_N\n\nOutput\n\nPrint the area of the white region within the rectangle after Snuke finished painting.\n\nSample Input 1\n\n5 4 2\n2 1 1\n3 3 4\n\nSample Output 1\n\n9\n\nThe figure below shows the rectangle before Snuke starts painting.\n\nFirst, as (x_1, y_1) = (2, 1) and a_1 = 1, he paints the region satisfying x < 2 within the rectangle:\n\nThen, as (x_2, y_2) = (3, 3) and a_2 = 4, he paints the region satisfying y > 3 within the rectangle:\n\nNow, the area of the white region within the rectangle is 9.\n\nSample Input 2\n\n5 4 3\n2 1 1\n3 3 4\n1 4 2\n\nSample Output 2\n\n0\n\nIt is possible that the whole region within the rectangle is painted black.\n\nSample Input 3\n\n10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\n\nSample Output 3\n\n64", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 756, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s213835385", "group_id": "codeNet:p03944", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n, edge(4)\n integer(int32):: x,y,a,i\n\n edge(:) = 0\n read*, edge(2), edge(4), n\n\n do i = 1, n\n read*, x,y,a\n select case (a)\n case(1)\n edge(1) = max(edge(1),x)\n case(2)\n edge(2) = min(edge(2),x)\n case(3)\n edge(3) = max(edge(3),y)\n case(4)\n edge(4) = min(edge(4),y)\n end select\n end do\n\n if (edge(2) >= edge(1) .and. edge(4) >= edge(3)) then\n print'(i0)', (edge(2)-edge(1))*(edge(4)-edge(3))\n else\n print'(i0)', 0\n end if\nend program name", "language": "Fortran", "metadata": {"date": 1587409037, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03944.html", "problem_id": "p03944", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03944/input.txt", "sample_output_relpath": "derived/input_output/data/p03944/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03944/Fortran/s213835385.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s213835385", "user_id": "u234636620"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n, edge(4)\n integer(int32):: x,y,a,i\n\n edge(:) = 0\n read*, edge(2), edge(4), n\n\n do i = 1, n\n read*, x,y,a\n select case (a)\n case(1)\n edge(1) = max(edge(1),x)\n case(2)\n edge(2) = min(edge(2),x)\n case(3)\n edge(3) = max(edge(3),y)\n case(4)\n edge(4) = min(edge(4),y)\n end select\n end do\n\n if (edge(2) >= edge(1) .and. edge(4) >= edge(3)) then\n print'(i0)', (edge(2)-edge(1))*(edge(4)-edge(3))\n else\n print'(i0)', 0\n end if\nend program name", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white.\n\nSnuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) point was (x_i, y_i).\n\nThen, he created an integer sequence a of length N, and for each 1 ≦ i ≦ N, he painted some region within the rectangle black, as follows:\n\nIf a_i = 1, he painted the region satisfying x < x_i within the rectangle.\n\nIf a_i = 2, he painted the region satisfying x > x_i within the rectangle.\n\nIf a_i = 3, he painted the region satisfying y < y_i within the rectangle.\n\nIf a_i = 4, he painted the region satisfying y > y_i within the rectangle.\n\nFind the area of the white region within the rectangle after he finished painting.\n\nConstraints\n\n1 ≦ W, H ≦ 100\n\n1 ≦ N ≦ 100\n\n0 ≦ x_i ≦ W (1 ≦ i ≦ N)\n\n0 ≦ y_i ≦ H (1 ≦ i ≦ N)\n\nW, H (21:32, added), x_i and y_i are integers.\n\na_i (1 ≦ i ≦ N) is 1, 2, 3 or 4.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nW H N\nx_1 y_1 a_1\nx_2 y_2 a_2\n:\nx_N y_N a_N\n\nOutput\n\nPrint the area of the white region within the rectangle after Snuke finished painting.\n\nSample Input 1\n\n5 4 2\n2 1 1\n3 3 4\n\nSample Output 1\n\n9\n\nThe figure below shows the rectangle before Snuke starts painting.\n\nFirst, as (x_1, y_1) = (2, 1) and a_1 = 1, he paints the region satisfying x < 2 within the rectangle:\n\nThen, as (x_2, y_2) = (3, 3) and a_2 = 4, he paints the region satisfying y > 3 within the rectangle:\n\nNow, the area of the white region within the rectangle is 9.\n\nSample Input 2\n\n5 4 3\n2 1 1\n3 3 4\n1 4 2\n\nSample Output 2\n\n0\n\nIt is possible that the whole region within the rectangle is painted black.\n\nSample Input 3\n\n10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\n\nSample Output 3\n\n64", "sample_input": "5 4 2\n2 1 1\n3 3 4\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03944", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a rectangle in the xy-plane, with its lower left corner at (0, 0) and its upper right corner at (W, H). Each of its sides is parallel to the x-axis or y-axis. Initially, the whole region within the rectangle is painted white.\n\nSnuke plotted N points into the rectangle. The coordinate of the i-th (1 ≦ i ≦ N) point was (x_i, y_i).\n\nThen, he created an integer sequence a of length N, and for each 1 ≦ i ≦ N, he painted some region within the rectangle black, as follows:\n\nIf a_i = 1, he painted the region satisfying x < x_i within the rectangle.\n\nIf a_i = 2, he painted the region satisfying x > x_i within the rectangle.\n\nIf a_i = 3, he painted the region satisfying y < y_i within the rectangle.\n\nIf a_i = 4, he painted the region satisfying y > y_i within the rectangle.\n\nFind the area of the white region within the rectangle after he finished painting.\n\nConstraints\n\n1 ≦ W, H ≦ 100\n\n1 ≦ N ≦ 100\n\n0 ≦ x_i ≦ W (1 ≦ i ≦ N)\n\n0 ≦ y_i ≦ H (1 ≦ i ≦ N)\n\nW, H (21:32, added), x_i and y_i are integers.\n\na_i (1 ≦ i ≦ N) is 1, 2, 3 or 4.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nW H N\nx_1 y_1 a_1\nx_2 y_2 a_2\n:\nx_N y_N a_N\n\nOutput\n\nPrint the area of the white region within the rectangle after Snuke finished painting.\n\nSample Input 1\n\n5 4 2\n2 1 1\n3 3 4\n\nSample Output 1\n\n9\n\nThe figure below shows the rectangle before Snuke starts painting.\n\nFirst, as (x_1, y_1) = (2, 1) and a_1 = 1, he paints the region satisfying x < 2 within the rectangle:\n\nThen, as (x_2, y_2) = (3, 3) and a_2 = 4, he paints the region satisfying y > 3 within the rectangle:\n\nNow, the area of the white region within the rectangle is 9.\n\nSample Input 2\n\n5 4 3\n2 1 1\n3 3 4\n1 4 2\n\nSample Output 2\n\n0\n\nIt is possible that the whole region within the rectangle is painted black.\n\nSample Input 3\n\n10 10 5\n1 6 1\n4 1 3\n6 9 4\n9 4 2\n3 1 3\n\nSample Output 3\n\n64", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 688, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s051426253", "group_id": "codeNet:p03951", "input_text": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,i,overlap\n character(:),allocatable:: s,t\n\n read*, n\n allocate(character(n):: s,t)\n read*, s\n read*, t\n\n overlap=0\n do i=n-1,0,-1\n if (s(n-i:n) == t(1:1+i)) then\n print'(i0)', 2*n-(i+1)\n stop\n end if\n end do\n print'(i0)', 2*n\nend program name", "language": "Fortran", "metadata": {"date": 1586965688, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03951.html", "problem_id": "p03951", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03951/input.txt", "sample_output_relpath": "derived/input_output/data/p03951/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03951/Fortran/s051426253.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s051426253", "user_id": "u234636620"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "program name\n use,intrinsic :: iso_fortran_env\n implicit none\n integer(int32):: n,i,overlap\n character(:),allocatable:: s,t\n\n read*, n\n allocate(character(n):: s,t)\n read*, s\n read*, t\n\n overlap=0\n do i=n-1,0,-1\n if (s(n-i:n) == t(1:1+i)) then\n print'(i0)', 2*n-(i+1)\n stop\n end if\n end do\n print'(i0)', 2*n\nend program name", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke is interested in strings that satisfy the following conditions:\n\nThe length of the string is at least N.\n\nThe first N characters equal to the string s.\n\nThe last N characters equal to the string t.\n\nFind the length of the shortest string that satisfies the conditions.\n\nConstraints\n\n1≤N≤100\n\nThe lengths of s and t are both N.\n\ns and t consist of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\ns\nt\n\nOutput\n\nPrint the length of the shortest string that satisfies the conditions.\n\nSample Input 1\n\n3\nabc\ncde\n\nSample Output 1\n\n5\n\nThe shortest string is abcde.\n\nSample Input 2\n\n1\na\nz\n\nSample Output 2\n\n2\n\nThe shortest string is az.\n\nSample Input 3\n\n4\nexpr\nexpr\n\nSample Output 3\n\n4\n\nThe shortest string is expr.", "sample_input": "3\nabc\ncde\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03951", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke is interested in strings that satisfy the following conditions:\n\nThe length of the string is at least N.\n\nThe first N characters equal to the string s.\n\nThe last N characters equal to the string t.\n\nFind the length of the shortest string that satisfies the conditions.\n\nConstraints\n\n1≤N≤100\n\nThe lengths of s and t are both N.\n\ns and t consist of lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\ns\nt\n\nOutput\n\nPrint the length of the shortest string that satisfies the conditions.\n\nSample Input 1\n\n3\nabc\ncde\n\nSample Output 1\n\n5\n\nThe shortest string is abcde.\n\nSample Input 2\n\n1\na\nz\n\nSample Output 2\n\n2\n\nThe shortest string is az.\n\nSample Input 3\n\n4\nexpr\nexpr\n\nSample Output 3\n\n4\n\nThe shortest string is expr.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 396, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s279539223", "group_id": "codeNet:p03952", "input_text": "program\tmain\n implicit none\n integer n,x,i\n read*,n,x\n if(x=a .and. len_trim(s)<=b ) then\n! write(*,*) \"YES\"\n!else\n! write(*,*) \"NO\"\n!endif\n\nend", "language": "Fortran", "metadata": {"date": 1525642155, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03992.html", "problem_id": "p03992", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03992/input.txt", "sample_output_relpath": "derived/input_output/data/p03992/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03992/Fortran/s900476667.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s900476667", "user_id": "u909643606"}, "prompt_components": {"gold_output": "CODE FESTIVAL\n", "input_to_evaluate": "implicit none\ninteger(8) :: a,b,c,d\ncharacter(12) :: s\nread(*,*) s\nwrite(*,*) s(1:4)//\" \"//s(5:12)\n\n!if ( len_trim(s)>=a .and. len_trim(s)<=b ) then\n! write(*,*) \"YES\"\n!else\n! write(*,*) \"NO\"\n!endif\n\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODE FESTIVAL.\nHowever, Mr. Takahashi always writes it CODEFESTIVAL, omitting the single space between CODE and FESTIVAL.\n\nSo he has decided to make a program that puts the single space he omitted.\n\nYou are given a string s with 12 letters.\nOutput the string putting a single space between the first 4 letters and last 8 letters in the string s.\n\nConstraints\n\ns contains exactly 12 letters.\n\nAll letters in s are uppercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string putting a single space between the first 4 letters and last 8 letters in the string s.\nPut a line break at the end.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nCODE FESTIVAL\n\nPutting a single space between the first 4 letters and last 8 letters in CODEFESTIVAL makes it CODE FESTIVAL.\n\nSample Input 2\n\nPOSTGRADUATE\n\nSample Output 2\n\nPOST GRADUATE\n\nSample Input 3\n\nABCDEFGHIJKL\n\nSample Output 3\n\nABCD EFGHIJKL", "sample_input": "CODEFESTIVAL\n"}, "reference_outputs": ["CODE FESTIVAL\n"], "source_document_id": "p03992", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODE FESTIVAL.\nHowever, Mr. Takahashi always writes it CODEFESTIVAL, omitting the single space between CODE and FESTIVAL.\n\nSo he has decided to make a program that puts the single space he omitted.\n\nYou are given a string s with 12 letters.\nOutput the string putting a single space between the first 4 letters and last 8 letters in the string s.\n\nConstraints\n\ns contains exactly 12 letters.\n\nAll letters in s are uppercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the string putting a single space between the first 4 letters and last 8 letters in the string s.\nPut a line break at the end.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nCODE FESTIVAL\n\nPutting a single space between the first 4 letters and last 8 letters in CODEFESTIVAL makes it CODE FESTIVAL.\n\nSample Input 2\n\nPOSTGRADUATE\n\nSample Output 2\n\nPOST GRADUATE\n\nSample Input 3\n\nABCDEFGHIJKL\n\nSample Output 3\n\nABCD EFGHIJKL", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 210, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s993163130", "group_id": "codeNet:p03994", "input_text": "program codefestival_2016_qualA_c\n use,intrinsic :: iso_fortran_env\n implicit none\n character(100000):: s\n integer(int32):: k,n,i,cost,nind\n\n read*, s\n n = len_trim(s)\n read*, k\n\n do i=1,n\n cost = 1+ichar('z') - ichar(s(i:i))\n if (cost <= k) then\n s(i:i) = 'a'\n k=k-cost\n end if\n end do\n nind = (ichar(s(n:n)) - ichar('a'))\n \n s(n:n) = char(mod(nind+k, ichar('z')-ichar('a')+1) + ichar('a'))\n\n print'(a)', trim(s)\nend program codefestival_2016_qualA_c", "language": "Fortran", "metadata": {"date": 1591385639, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p03994.html", "problem_id": "p03994", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03994/input.txt", "sample_output_relpath": "derived/input_output/data/p03994/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03994/Fortran/s993163130.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s993163130", "user_id": "u234636620"}, "prompt_components": {"gold_output": "aya\n", "input_to_evaluate": "program codefestival_2016_qualA_c\n use,intrinsic :: iso_fortran_env\n implicit none\n character(100000):: s\n integer(int32):: k,n,i,cost,nind\n\n read*, s\n n = len_trim(s)\n read*, k\n\n do i=1,n\n cost = 1+ichar('z') - ichar(s(i:i))\n if (cost <= k) then\n s(i:i) = 'a'\n k=k-cost\n end if\n end do\n nind = (ichar(s(n:n)) - ichar('a'))\n \n s(n:n) = char(mod(nind+k, ichar('z')-ichar('a')+1) + ichar('a'))\n\n print'(a)', trim(s)\nend program codefestival_2016_qualA_c", "problem_context": "Score : 400 points\n\nProblem Statement\n\nMr. Takahashi has a string s consisting of lowercase English letters.\nHe repeats the following operation on s exactly K times.\n\nChoose an arbitrary letter on s and change that letter to the next alphabet. Note that the next letter of z is a.\n\nFor example, if you perform an operation for the second letter on aaz, aaz becomes abz.\nIf you then perform an operation for the third letter on abz, abz becomes aba.\n\nMr. Takahashi wants to have the lexicographically smallest string after performing exactly K operations on s.\nFind the such string.\n\nConstraints\n\n1≤|s|≤10^5\n\nAll letters in s are lowercase English letters.\n\n1≤K≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the lexicographically smallest string after performing exactly K operations on s.\n\nSample Input 1\n\nxyz\n4\n\nSample Output 1\n\naya\n\nFor example, you can perform the following operations: xyz, yyz, zyz, ayz, aya.\n\nSample Input 2\n\na\n25\n\nSample Output 2\n\nz\n\nYou have to perform exactly K operations.\n\nSample Input 3\n\ncodefestival\n100\n\nSample Output 3\n\naaaafeaaivap", "sample_input": "xyz\n4\n"}, "reference_outputs": ["aya\n"], "source_document_id": "p03994", "source_text": "Score : 400 points\n\nProblem Statement\n\nMr. Takahashi has a string s consisting of lowercase English letters.\nHe repeats the following operation on s exactly K times.\n\nChoose an arbitrary letter on s and change that letter to the next alphabet. Note that the next letter of z is a.\n\nFor example, if you perform an operation for the second letter on aaz, aaz becomes abz.\nIf you then perform an operation for the third letter on abz, abz becomes aba.\n\nMr. Takahashi wants to have the lexicographically smallest string after performing exactly K operations on s.\nFind the such string.\n\nConstraints\n\n1≤|s|≤10^5\n\nAll letters in s are lowercase English letters.\n\n1≤K≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\nK\n\nOutput\n\nPrint the lexicographically smallest string after performing exactly K operations on s.\n\nSample Input 1\n\nxyz\n4\n\nSample Output 1\n\naya\n\nFor example, you can perform the following operations: xyz, yyz, zyz, ayz, aya.\n\nSample Input 2\n\na\n25\n\nSample Output 2\n\nz\n\nYou have to perform exactly K operations.\n\nSample Input 3\n\ncodefestival\n100\n\nSample Output 3\n\naaaafeaaivap", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 533, "cpu_time_ms": 3, "memory_kb": 700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s055877117", "group_id": "codeNet:p03997", "input_text": "program main\n\timplicit none\n integer::a,b,c\n read(*,*)a\n read(*,*)b\n read(*,*)c\n write(*,*) (a+b)*c/2\n stop\nend program main\n", "language": "Fortran", "metadata": {"date": 1592625933, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p03997.html", "problem_id": "p03997", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03997/input.txt", "sample_output_relpath": "derived/input_output/data/p03997/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03997/Fortran/s055877117.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s055877117", "user_id": "u884601206"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "program main\n\timplicit none\n integer::a,b,c\n read(*,*)a\n read(*,*)b\n read(*,*)c\n write(*,*) (a+b)*c/2\n stop\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.\n\nAn example of a trapezoid\n\nFind the area of this trapezoid.\n\nConstraints\n\n1≦a≦100\n\n1≦b≦100\n\n1≦h≦100\n\nAll input values are integers.\n\nh is even.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na\nb\nh\n\nOutput\n\nPrint the area of the given trapezoid. It is guaranteed that the area is an integer.\n\nSample Input 1\n\n3\n4\n2\n\nSample Output 1\n\n7\n\nWhen the lengths of the upper base, lower base, and height are 3, 4, and 2, respectively, the area of the trapezoid is (3+4)×2/2 = 7.\n\nSample Input 2\n\n4\n4\n4\n\nSample Output 2\n\n16\n\nIn this case, a parallelogram is given, which is also a trapezoid.", "sample_input": "3\n4\n2\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03997", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a trapezoid. The lengths of its upper base, lower base, and height are a, b, and h, respectively.\n\nAn example of a trapezoid\n\nFind the area of this trapezoid.\n\nConstraints\n\n1≦a≦100\n\n1≦b≦100\n\n1≦h≦100\n\nAll input values are integers.\n\nh is even.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na\nb\nh\n\nOutput\n\nPrint the area of the given trapezoid. It is guaranteed that the area is an integer.\n\nSample Input 1\n\n3\n4\n2\n\nSample Output 1\n\n7\n\nWhen the lengths of the upper base, lower base, and height are 3, 4, and 2, respectively, the area of the trapezoid is (3+4)×2/2 = 7.\n\nSample Input 2\n\n4\n4\n4\n\nSample Output 2\n\n16\n\nIn this case, a parallelogram is given, which is also a trapezoid.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 143, "cpu_time_ms": 5, "memory_kb": 2860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s467733922", "group_id": "codeNet:p04001", "input_text": "program ManyFormulas\n\nimplicit none\ninteger :: I, J\ninteger(8) :: len, co, checker, K\ncharacter(10) :: S\ninteger(8), dimension(512) :: num, counter \n\nread(*,*) S\nlen = len_trim(S)\n\ndo I = 1, 512\nnum(I) = 0\nend do\n\ndo I = 1, 2**(len-1)\n do J = 1, 512\n counter(J) = 0\n end do\n counter(len) = len\n do J = 1, len-1\n if (btest(I-1,J-1)) then\n counter(J) = J\n end if\n end do\n!write(*,*) (counter(J),J=1,3)\nchecker = 1\n do J = 1, len\n if (counter(J)/=0) then\n read(S(checker:counter(J)),*) K\n! write(*,*) K\n num(I) = num(I) + K\n checker = counter(J) + 1\n end if\n end do\nend do\n\nwrite(*,*) sum(num)\n \nend program", "language": "Fortran", "metadata": {"date": 1568204504, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p04001.html", "problem_id": "p04001", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04001/input.txt", "sample_output_relpath": "derived/input_output/data/p04001/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04001/Fortran/s467733922.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s467733922", "user_id": "u039189422"}, "prompt_components": {"gold_output": "176\n", "input_to_evaluate": "program ManyFormulas\n\nimplicit none\ninteger :: I, J\ninteger(8) :: len, co, checker, K\ncharacter(10) :: S\ninteger(8), dimension(512) :: num, counter \n\nread(*,*) S\nlen = len_trim(S)\n\ndo I = 1, 512\nnum(I) = 0\nend do\n\ndo I = 1, 2**(len-1)\n do J = 1, 512\n counter(J) = 0\n end do\n counter(len) = len\n do J = 1, len-1\n if (btest(I-1,J-1)) then\n counter(J) = J\n end if\n end do\n!write(*,*) (counter(J),J=1,3)\nchecker = 1\n do J = 1, len\n if (counter(J)/=0) then\n read(S(checker:counter(J)),*) K\n! write(*,*) K\n num(I) = num(I) + K\n checker = counter(J) + 1\n end if\n end do\nend do\n\nwrite(*,*) sum(num)\n \nend program", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of digits between 1 and 9, inclusive.\nYou can insert the letter + into some of the positions (possibly none) between two letters in this string.\nHere, + must not occur consecutively after insertion.\n\nAll strings that can be obtained in this way can be evaluated as formulas.\n\nEvaluate all possible formulas, and print the sum of the results.\n\nConstraints\n\n1 \\leq |S| \\leq 10\n\nAll letters in S are digits between 1 and 9, inclusive.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the sum of the evaluated value over all possible formulas.\n\nSample Input 1\n\n125\n\nSample Output 1\n\n176\n\nThere are 4 formulas that can be obtained: 125, 1+25, 12+5 and 1+2+5. When each formula is evaluated,\n\n125\n\n1+25=26\n\n12+5=17\n\n1+2+5=8\n\nThus, the sum is 125+26+17+8=176.\n\nSample Input 2\n\n9999999999\n\nSample Output 2\n\n12656242944", "sample_input": "125\n"}, "reference_outputs": ["176\n"], "source_document_id": "p04001", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S consisting of digits between 1 and 9, inclusive.\nYou can insert the letter + into some of the positions (possibly none) between two letters in this string.\nHere, + must not occur consecutively after insertion.\n\nAll strings that can be obtained in this way can be evaluated as formulas.\n\nEvaluate all possible formulas, and print the sum of the results.\n\nConstraints\n\n1 \\leq |S| \\leq 10\n\nAll letters in S are digits between 1 and 9, inclusive.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the sum of the evaluated value over all possible formulas.\n\nSample Input 1\n\n125\n\nSample Output 1\n\n176\n\nThere are 4 formulas that can be obtained: 125, 1+25, 12+5 and 1+2+5. When each formula is evaluated,\n\n125\n\n1+25=26\n\n12+5=17\n\n1+2+5=8\n\nThus, the sum is 125+26+17+8=176.\n\nSample Input 2\n\n9999999999\n\nSample Output 2\n\n12656242944", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 613, "cpu_time_ms": 3, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s877681002", "group_id": "codeNet:p04005", "input_text": "program cuboid\n implicit none\n integer :: A, B, C\n\n read(*,*) A, B, C\n\n if (mod(A,2) == 0 .or. mod(B,2) == 0 .or. mod(C,2) == 0) then\n write(*,*) 0\n else\n write(*,*) min(A*B, B*C, C*A)\n end if\n stop\nend program cuboid\n", "language": "Fortran", "metadata": {"date": 1590804450, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p04005.html", "problem_id": "p04005", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04005/input.txt", "sample_output_relpath": "derived/input_output/data/p04005/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04005/Fortran/s877681002.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s877681002", "user_id": "u961266059"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "program cuboid\n implicit none\n integer :: A, B, C\n\n read(*,*) A, B, C\n\n if (mod(A,2) == 0 .or. mod(B,2) == 0 .or. mod(C,2) == 0) then\n write(*,*) 0\n else\n write(*,*) min(A*B, B*C, C*A)\n end if\n stop\nend program cuboid\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that:\n\nThere is at least one red block and at least one blue block.\n\nThe union of all red blocks forms a rectangular parallelepiped.\n\nThe union of all blue blocks forms a rectangular parallelepiped.\n\nSnuke wants to minimize the difference between the number of red blocks and the number of blue blocks. Find the minimum possible difference.\n\nConstraints\n\n2≤A,B,C≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the minimum possible difference between the number of red blocks and the number of blue blocks.\n\nSample Input 1\n\n3 3 3\n\nSample Output 1\n\n9\n\nFor example, Snuke can paint the blocks as shown in the diagram below.\nThere are 9 red blocks and 18 blue blocks, thus the difference is 9.\n\nSample Input 2\n\n2 2 4\n\nSample Output 2\n\n0\n\nFor example, Snuke can paint the blocks as shown in the diagram below.\nThere are 8 red blocks and 8 blue blocks, thus the difference is 0.\n\nSample Input 3\n\n5 3 5\n\nSample Output 3\n\n15\n\nFor example, Snuke can paint the blocks as shown in the diagram below.\nThere are 45 red blocks and 30 blue blocks, thus the difference is 9.", "sample_input": "3 3 3\n"}, "reference_outputs": ["9\n"], "source_document_id": "p04005", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a rectangular parallelepiped of size A×B×C, built with blocks of size 1×1×1. Snuke will paint each of the A×B×C blocks either red or blue, so that:\n\nThere is at least one red block and at least one blue block.\n\nThe union of all red blocks forms a rectangular parallelepiped.\n\nThe union of all blue blocks forms a rectangular parallelepiped.\n\nSnuke wants to minimize the difference between the number of red blocks and the number of blue blocks. Find the minimum possible difference.\n\nConstraints\n\n2≤A,B,C≤10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nPrint the minimum possible difference between the number of red blocks and the number of blue blocks.\n\nSample Input 1\n\n3 3 3\n\nSample Output 1\n\n9\n\nFor example, Snuke can paint the blocks as shown in the diagram below.\nThere are 9 red blocks and 18 blue blocks, thus the difference is 9.\n\nSample Input 2\n\n2 2 4\n\nSample Output 2\n\n0\n\nFor example, Snuke can paint the blocks as shown in the diagram below.\nThere are 8 red blocks and 8 blue blocks, thus the difference is 0.\n\nSample Input 3\n\n5 3 5\n\nSample Output 3\n\n15\n\nFor example, Snuke can paint the blocks as shown in the diagram below.\nThere are 45 red blocks and 30 blue blocks, thus the difference is 9.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 233, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s632643105", "group_id": "codeNet:p04012", "input_text": "program beautiful\nimplicit none\ncharacter(len=100) :: s\ninteger :: i, c(26), j\n\nread(*,*) s\nc = 0\ndo i = 1, len_trim(s)\nj = ichar(s(i:i))-ichar('a') + 1\nc(j) = c(j) + 1\nend do\ndo i = 1, 26\nif (mod(c(i),2) == 1 ) then\nwrite(*,'(a)') 'No'\nstop\nend if\nend do\nwrite(*,'(a)') 'Yes'\nstop\nend program beautiful", "language": "Fortran", "metadata": {"date": 1595035508, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p04012.html", "problem_id": "p04012", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04012/input.txt", "sample_output_relpath": "derived/input_output/data/p04012/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04012/Fortran/s632643105.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s632643105", "user_id": "u961266059"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program beautiful\nimplicit none\ncharacter(len=100) :: s\ninteger :: i, c(26), j\n\nread(*,*) s\nc = 0\ndo i = 1, len_trim(s)\nj = ichar(s(i:i))-ichar('a') + 1\nc(j) = c(j) + 1\nend do\ndo i = 1, 26\nif (mod(c(i),2) == 1 ) then\nwrite(*,'(a)') 'No'\nstop\nend if\nend do\nwrite(*,'(a)') 'Yes'\nstop\nend program beautiful", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet w be a string consisting of lowercase letters.\nWe will call w beautiful if the following condition is satisfied:\n\nEach lowercase letter of the English alphabet occurs even number of times in w.\n\nYou are given the string w. Determine if w is beautiful.\n\nConstraints\n\n1 \\leq |w| \\leq 100\n\nw consists of lowercase letters (a-z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nw\n\nOutput\n\nPrint Yes if w is beautiful. Print No otherwise.\n\nSample Input 1\n\nabaccaba\n\nSample Output 1\n\nYes\n\na occurs four times, b occurs twice, c occurs twice and the other letters occur zero times.\n\nSample Input 2\n\nhthth\n\nSample Output 2\n\nNo", "sample_input": "abaccaba\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p04012", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet w be a string consisting of lowercase letters.\nWe will call w beautiful if the following condition is satisfied:\n\nEach lowercase letter of the English alphabet occurs even number of times in w.\n\nYou are given the string w. Determine if w is beautiful.\n\nConstraints\n\n1 \\leq |w| \\leq 100\n\nw consists of lowercase letters (a-z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nw\n\nOutput\n\nPrint Yes if w is beautiful. Print No otherwise.\n\nSample Input 1\n\nabaccaba\n\nSample Output 1\n\nYes\n\na occurs four times, b occurs twice, c occurs twice and the other letters occur zero times.\n\nSample Input 2\n\nhthth\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 303, "cpu_time_ms": 7, "memory_kb": 2856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s490743420", "group_id": "codeNet:p04012", "input_text": "program ABC044B\n implicit none\n integer(8)::i,flg\n character(100)::w\n integer(8),dimension(26)::C\n read(5,*)w\n flg=0\n C=0\n do i=1,len_trim(w)\n C(ichar(w(i:i))-96)=C(ichar(w(i:i))-96)+1\n end do\n\n do i=1,26\n if(mod(C(i),2)==1)then\n flg=1\n exit\n end if\n end do\n\n if(flg==0)print'(A)',\"Yes\"\n if(flg==1)print'(A)',\"No\"\nend program ABC044B", "language": "Fortran", "metadata": {"date": 1583526319, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p04012.html", "problem_id": "p04012", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04012/input.txt", "sample_output_relpath": "derived/input_output/data/p04012/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04012/Fortran/s490743420.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s490743420", "user_id": "u414699019"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "program ABC044B\n implicit none\n integer(8)::i,flg\n character(100)::w\n integer(8),dimension(26)::C\n read(5,*)w\n flg=0\n C=0\n do i=1,len_trim(w)\n C(ichar(w(i:i))-96)=C(ichar(w(i:i))-96)+1\n end do\n\n do i=1,26\n if(mod(C(i),2)==1)then\n flg=1\n exit\n end if\n end do\n\n if(flg==0)print'(A)',\"Yes\"\n if(flg==1)print'(A)',\"No\"\nend program ABC044B", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLet w be a string consisting of lowercase letters.\nWe will call w beautiful if the following condition is satisfied:\n\nEach lowercase letter of the English alphabet occurs even number of times in w.\n\nYou are given the string w. Determine if w is beautiful.\n\nConstraints\n\n1 \\leq |w| \\leq 100\n\nw consists of lowercase letters (a-z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nw\n\nOutput\n\nPrint Yes if w is beautiful. Print No otherwise.\n\nSample Input 1\n\nabaccaba\n\nSample Output 1\n\nYes\n\na occurs four times, b occurs twice, c occurs twice and the other letters occur zero times.\n\nSample Input 2\n\nhthth\n\nSample Output 2\n\nNo", "sample_input": "abaccaba\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p04012", "source_text": "Score : 200 points\n\nProblem Statement\n\nLet w be a string consisting of lowercase letters.\nWe will call w beautiful if the following condition is satisfied:\n\nEach lowercase letter of the English alphabet occurs even number of times in w.\n\nYou are given the string w. Determine if w is beautiful.\n\nConstraints\n\n1 \\leq |w| \\leq 100\n\nw consists of lowercase letters (a-z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nw\n\nOutput\n\nPrint Yes if w is beautiful. Print No otherwise.\n\nSample Input 1\n\nabaccaba\n\nSample Output 1\n\nYes\n\na occurs four times, b occurs twice, c occurs twice and the other letters occur zero times.\n\nSample Input 2\n\nhthth\n\nSample Output 2\n\nNo", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 415, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s634662885", "group_id": "codeNet:p04016", "input_text": "program main\n implicit none\n integer(8) :: n, s, sqrt_n, b, p\n read(*, *) n\n read(*, *) s\n\n if (n < s) then\n write(*, \"(i0)\") -1\n stop 0\n else if (n == s) then\n write(*, \"(i0)\") n + 1\n stop 0\n end if\n\n sqrt_n = integer_sqrt(n)\n\n do b = 2, sqrt_n\n if (f(b, n) == s) then\n write(*, \"(i0)\") b\n stop 0\n end if\n end do\n\n do p = 1, sqrt_n\n b = (n - s) / p + 1\n if (b >= 2) then\n if (f(b, n) == s) then\n write(*, \"(i0)\") b\n stop 0\n end if\n end if\n end do\n\n write(*, \"(i0)\") -1\n\n contains\n\n function integer_sqrt(n)\n implicit none\n integer(8), intent(in) :: n\n integer(8) :: integer_sqrt, i\n if (n < 0) stop 101\n do i = 0, n + 1\n if (i ** 2 > n) then\n integer_sqrt = i - 1\n exit\n end if\n end do\n end function integer_sqrt\n\n recursive function f(b, n) result(res)\n implicit none\n integer(8), intent(in) :: b, n\n integer(8) :: res\n if (n < b) then\n res = n\n else\n res = f(b, n / b) + mod(n, b)\n end if\n end function f\nend program main\n", "language": "Fortran", "metadata": {"date": 1538815515, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p04016.html", "problem_id": "p04016", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04016/input.txt", "sample_output_relpath": "derived/input_output/data/p04016/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04016/Fortran/s634662885.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s634662885", "user_id": "u388927326"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: n, s, sqrt_n, b, p\n read(*, *) n\n read(*, *) s\n\n if (n < s) then\n write(*, \"(i0)\") -1\n stop 0\n else if (n == s) then\n write(*, \"(i0)\") n + 1\n stop 0\n end if\n\n sqrt_n = integer_sqrt(n)\n\n do b = 2, sqrt_n\n if (f(b, n) == s) then\n write(*, \"(i0)\") b\n stop 0\n end if\n end do\n\n do p = 1, sqrt_n\n b = (n - s) / p + 1\n if (b >= 2) then\n if (f(b, n) == s) then\n write(*, \"(i0)\") b\n stop 0\n end if\n end if\n end do\n\n write(*, \"(i0)\") -1\n\n contains\n\n function integer_sqrt(n)\n implicit none\n integer(8), intent(in) :: n\n integer(8) :: integer_sqrt, i\n if (n < 0) stop 101\n do i = 0, n + 1\n if (i ** 2 > n) then\n integer_sqrt = i - 1\n exit\n end if\n end do\n end function integer_sqrt\n\n recursive function f(b, n) result(res)\n implicit none\n integer(8), intent(in) :: b, n\n integer(8) :: res\n if (n < b) then\n res = n\n else\n res = f(b, n / b) + mod(n, b)\n end if\n end function f\nend program main\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nFor integers b (b \\geq 2) and n (n \\geq 1), let the function f(b,n) be defined as follows:\n\nf(b,n) = n, when n < b\n\nf(b,n) = f(b,\\,{\\rm floor}(n / b)) + (n \\ {\\rm mod} \\ b), when n \\geq b\n\nHere, {\\rm floor}(n / b) denotes the largest integer not exceeding n / b,\nand n \\ {\\rm mod} \\ b denotes the remainder of n divided by b.\n\nLess formally, f(b,n) is equal to the sum of the digits of n written in base b.\nFor example, the following hold:\n\nf(10,\\,87654)=8+7+6+5+4=30\n\nf(100,\\,87654)=8+76+54=138\n\nYou are given integers n and s.\nDetermine if there exists an integer b (b \\geq 2) such that f(b,n)=s.\nIf the answer is positive, also find the smallest such b.\n\nConstraints\n\n1 \\leq n \\leq 10^{11}\n\n1 \\leq s \\leq 10^{11}\n\nn,\\,s are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nn\ns\n\nOutput\n\nIf there exists an integer b (b \\geq 2) such that f(b,n)=s, print the smallest such b.\nIf such b does not exist, print -1 instead.\n\nSample Input 1\n\n87654\n30\n\nSample Output 1\n\n10\n\nSample Input 2\n\n87654\n138\n\nSample Output 2\n\n100\n\nSample Input 3\n\n87654\n45678\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n31415926535\n1\n\nSample Output 4\n\n31415926535\n\nSample Input 5\n\n1\n31415926535\n\nSample Output 5\n\n-1", "sample_input": "87654\n30\n"}, "reference_outputs": ["10\n"], "source_document_id": "p04016", "source_text": "Score : 500 points\n\nProblem Statement\n\nFor integers b (b \\geq 2) and n (n \\geq 1), let the function f(b,n) be defined as follows:\n\nf(b,n) = n, when n < b\n\nf(b,n) = f(b,\\,{\\rm floor}(n / b)) + (n \\ {\\rm mod} \\ b), when n \\geq b\n\nHere, {\\rm floor}(n / b) denotes the largest integer not exceeding n / b,\nand n \\ {\\rm mod} \\ b denotes the remainder of n divided by b.\n\nLess formally, f(b,n) is equal to the sum of the digits of n written in base b.\nFor example, the following hold:\n\nf(10,\\,87654)=8+7+6+5+4=30\n\nf(100,\\,87654)=8+76+54=138\n\nYou are given integers n and s.\nDetermine if there exists an integer b (b \\geq 2) such that f(b,n)=s.\nIf the answer is positive, also find the smallest such b.\n\nConstraints\n\n1 \\leq n \\leq 10^{11}\n\n1 \\leq s \\leq 10^{11}\n\nn,\\,s are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nn\ns\n\nOutput\n\nIf there exists an integer b (b \\geq 2) such that f(b,n)=s, print the smallest such b.\nIf such b does not exist, print -1 instead.\n\nSample Input 1\n\n87654\n30\n\nSample Output 1\n\n10\n\nSample Input 2\n\n87654\n138\n\nSample Output 2\n\n100\n\nSample Input 3\n\n87654\n45678\n\nSample Output 3\n\n-1\n\nSample Input 4\n\n31415926535\n1\n\nSample Output 4\n\n31415926535\n\nSample Input 5\n\n1\n31415926535\n\nSample Output 5\n\n-1", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1074, "cpu_time_ms": 20, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s628643585", "group_id": "codeNet:p04023", "input_text": "program sequential_operations_on_sequence\n implicit none\n integer :: n, q, i, j, x, u = 1, l, r, m\n integer(8) :: p(100000) = 0_8, k, t(100000) = 0_8, ans(100001) = 0_8\n read(*,*) n, q\n p(1) = int(n,8)\n do i = 1, q\n u = u+1\n read(*,*) p(u)\n do while (u > 1 .and. p(u-1) >= p(u))\n p(u-1) = p(u)\n u = u-1\n end do\n end do\n t(u) = 1_8\n do i = u, 1, -1\n j = i\n k = p(i)\n do\n r = j\n l = 0\n do while (r-l > 1)\n m = (l+r)/2\n if (p(m) > k) then\n r = m\n else\n l = m\n end if\n end do\n if (l == 0) then\n x = int(k,4)\n ans(1) = ans(1)+t(i)\n ans(x+1) = ans(x+1)-t(i)\n exit\n else\n j = l\n t(j) = t(j)+t(i)*(k/p(j))\n k = mod(k,p(j))\n end if\n end do\n end do\n write(*,'(i0)') ans(1)\n do i = 2, n\n ans(i) = ans(i)+ans(i-1)\n write(*,'(i0)') ans(i)\n end do\nend program sequential_operations_on_sequence", "language": "Fortran", "metadata": {"date": 1567838355, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p04023.html", "problem_id": "p04023", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04023/input.txt", "sample_output_relpath": "derived/input_output/data/p04023/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04023/Fortran/s628643585.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s628643585", "user_id": "u506403362"}, "prompt_components": {"gold_output": "3\n3\n3\n2\n0\n", "input_to_evaluate": "program sequential_operations_on_sequence\n implicit none\n integer :: n, q, i, j, x, u = 1, l, r, m\n integer(8) :: p(100000) = 0_8, k, t(100000) = 0_8, ans(100001) = 0_8\n read(*,*) n, q\n p(1) = int(n,8)\n do i = 1, q\n u = u+1\n read(*,*) p(u)\n do while (u > 1 .and. p(u-1) >= p(u))\n p(u-1) = p(u)\n u = u-1\n end do\n end do\n t(u) = 1_8\n do i = u, 1, -1\n j = i\n k = p(i)\n do\n r = j\n l = 0\n do while (r-l > 1)\n m = (l+r)/2\n if (p(m) > k) then\n r = m\n else\n l = m\n end if\n end do\n if (l == 0) then\n x = int(k,4)\n ans(1) = ans(1)+t(i)\n ans(x+1) = ans(x+1)-t(i)\n exit\n else\n j = l\n t(j) = t(j)+t(i)*(k/p(j))\n k = mod(k,p(j))\n end if\n end do\n end do\n write(*,'(i0)') ans(1)\n do i = 2, n\n ans(i) = ans(i)+ans(i-1)\n write(*,'(i0)') ans(i)\n end do\nend program sequential_operations_on_sequence", "problem_context": "Score : 1400 points\n\nProblem Statement\n\nSnuke got an integer sequence from his mother, as a birthday present. The sequence has N elements, and the i-th of them is i.\nSnuke performs the following Q operations on this sequence. The i-th operation, described by a parameter q_i, is as follows:\n\nTake the first q_i elements from the sequence obtained by concatenating infinitely many copy of the current sequence, then replace the current sequence with those q_i elements.\n\nAfter these Q operations, find how many times each of the integers 1 through N appears in the final sequence.\n\nConstraints\n\n1 ≦ N ≦ 10^5\n\n0 ≦ Q ≦ 10^5\n\n1 ≦ q_i ≦ 10^{18}\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN Q\nq_1\n:\nq_Q\n\nOutput\n\nPrint N lines. The i-th line (1 ≦ i ≦ N) should contain the number of times integer i appears in the final sequence after the Q operations.\n\nSample Input 1\n\n5 3\n6\n4\n11\n\nSample Output 1\n\n3\n3\n3\n2\n0\n\nAfter the first operation, the sequence becomes: 1,2,3,4,5,1.\n\nAfter the second operation, the sequence becomes: 1,2,3,4.\n\nAfter the third operation, the sequence becomes: 1,2,3,4,1,2,3,4,1,2,3.\n\nIn this sequence, integers 1,2,3,4,5 appear 3,3,3,2,0 times, respectively.\n\nSample Input 2\n\n10 10\n9\n13\n18\n8\n10\n10\n9\n19\n22\n27\n\nSample Output 2\n\n7\n4\n4\n3\n3\n2\n2\n2\n0\n0", "sample_input": "5 3\n6\n4\n11\n"}, "reference_outputs": ["3\n3\n3\n2\n0\n"], "source_document_id": "p04023", "source_text": "Score : 1400 points\n\nProblem Statement\n\nSnuke got an integer sequence from his mother, as a birthday present. The sequence has N elements, and the i-th of them is i.\nSnuke performs the following Q operations on this sequence. The i-th operation, described by a parameter q_i, is as follows:\n\nTake the first q_i elements from the sequence obtained by concatenating infinitely many copy of the current sequence, then replace the current sequence with those q_i elements.\n\nAfter these Q operations, find how many times each of the integers 1 through N appears in the final sequence.\n\nConstraints\n\n1 ≦ N ≦ 10^5\n\n0 ≦ Q ≦ 10^5\n\n1 ≦ q_i ≦ 10^{18}\n\nAll input values are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN Q\nq_1\n:\nq_Q\n\nOutput\n\nPrint N lines. The i-th line (1 ≦ i ≦ N) should contain the number of times integer i appears in the final sequence after the Q operations.\n\nSample Input 1\n\n5 3\n6\n4\n11\n\nSample Output 1\n\n3\n3\n3\n2\n0\n\nAfter the first operation, the sequence becomes: 1,2,3,4,5,1.\n\nAfter the second operation, the sequence becomes: 1,2,3,4.\n\nAfter the third operation, the sequence becomes: 1,2,3,4,1,2,3,4,1,2,3.\n\nIn this sequence, integers 1,2,3,4,5 appear 3,3,3,2,0 times, respectively.\n\nSample Input 2\n\n10 10\n9\n13\n18\n8\n10\n10\n9\n19\n22\n27\n\nSample Output 2\n\n7\n4\n4\n3\n3\n2\n2\n2\n0\n0", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 962, "cpu_time_ms": 140, "memory_kb": 3968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s636761361", "group_id": "codeNet:p04025", "input_text": "integer N\ninteger,allocatable,dimension(:)::a\ninteger ans,kouho\nread*,N\nallocate(a(N))\nread*,a\nans=huge(ans)\ndo i=minval(a),maxval(a)\n kouho=0\n do j=1,N\n kouho=kouho+(i-a(j))**2\n end do\n ans=min(ans,kouho)\nend do\nprint\"(i0)\",ans\nend", "language": "Fortran", "metadata": {"date": 1557366086, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p04025.html", "problem_id": "p04025", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04025/input.txt", "sample_output_relpath": "derived/input_output/data/p04025/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04025/Fortran/s636761361.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s636761361", "user_id": "u598073939"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "integer N\ninteger,allocatable,dimension(:)::a\ninteger ans,kouho\nread*,N\nallocate(a(N))\nread*,a\nans=huge(ans)\ndo i=minval(a),maxval(a)\n kouho=0\n do j=1,N\n kouho=kouho+(i-a(j))**2\n end do\n ans=min(ans,kouho)\nend do\nprint\"(i0)\",ans\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nEvi has N integers a_1,a_2,..,a_N. His objective is to have N equal integers by transforming some of them.\n\nHe may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).\n\nFind the minimum total cost to achieve his objective.\n\nConstraints\n\n1≦N≦100\n\n-100≦a_i≦100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum total cost to achieve Evi's objective.\n\nSample Input 1\n\n2\n4 8\n\nSample Output 1\n\n8\n\nTransforming the both into 6s will cost (4-6)^2+(8-6)^2=8 dollars, which is the minimum.\n\nSample Input 2\n\n3\n1 1 3\n\nSample Output 2\n\n3\n\nTransforming the all into 2s will cost (1-2)^2+(1-2)^2+(3-2)^2=3 dollars. Note that Evi has to pay (1-2)^2 dollar separately for transforming each of the two 1s.\n\nSample Input 3\n\n3\n4 2 5\n\nSample Output 3\n\n5\n\nLeaving the 4 as it is and transforming the 2 and the 5 into 4s will achieve the total cost of (2-4)^2+(5-4)^2=5 dollars, which is the minimum.\n\nSample Input 4\n\n4\n-100 -100 -100 -100\n\nSample Output 4\n\n0\n\nWithout transforming anything, Evi's objective is already achieved. Thus, the necessary cost is 0.", "sample_input": "2\n4 8\n"}, "reference_outputs": ["8\n"], "source_document_id": "p04025", "source_text": "Score : 200 points\n\nProblem Statement\n\nEvi has N integers a_1,a_2,..,a_N. His objective is to have N equal integers by transforming some of them.\n\nHe may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).\n\nFind the minimum total cost to achieve his objective.\n\nConstraints\n\n1≦N≦100\n\n-100≦a_i≦100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum total cost to achieve Evi's objective.\n\nSample Input 1\n\n2\n4 8\n\nSample Output 1\n\n8\n\nTransforming the both into 6s will cost (4-6)^2+(8-6)^2=8 dollars, which is the minimum.\n\nSample Input 2\n\n3\n1 1 3\n\nSample Output 2\n\n3\n\nTransforming the all into 2s will cost (1-2)^2+(1-2)^2+(3-2)^2=3 dollars. Note that Evi has to pay (1-2)^2 dollar separately for transforming each of the two 1s.\n\nSample Input 3\n\n3\n4 2 5\n\nSample Output 3\n\n5\n\nLeaving the 4 as it is and transforming the 2 and the 5 into 4s will achieve the total cost of (2-4)^2+(5-4)^2=5 dollars, which is the minimum.\n\nSample Input 4\n\n4\n-100 -100 -100 -100\n\nSample Output 4\n\n0\n\nWithout transforming anything, Evi's objective is already achieved. Thus, the necessary cost is 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 239, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s099231631", "group_id": "codeNet:p04025", "input_text": "program main\n implicit none\n integer(8) :: n, i, to, res, mi\n integer(8), allocatable :: a(:)\n read(*, *) n\n allocate(a(n))\n read(*, *) (a(i), i = 1, n)\n\n mi = huge(0_8)\n do to = -100, 100\n res = 0\n do i = 1, n\n res = res + (a(i) - to) ** 2\n end do\n mi = min(mi, res)\n end do\n\n write(*, \"(i0)\") mi\n\n deallocate(a)\n contains\nend\n", "language": "Fortran", "metadata": {"date": 1529750211, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p04025.html", "problem_id": "p04025", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04025/input.txt", "sample_output_relpath": "derived/input_output/data/p04025/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04025/Fortran/s099231631.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s099231631", "user_id": "u388927326"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program main\n implicit none\n integer(8) :: n, i, to, res, mi\n integer(8), allocatable :: a(:)\n read(*, *) n\n allocate(a(n))\n read(*, *) (a(i), i = 1, n)\n\n mi = huge(0_8)\n do to = -100, 100\n res = 0\n do i = 1, n\n res = res + (a(i) - to) ** 2\n end do\n mi = min(mi, res)\n end do\n\n write(*, \"(i0)\") mi\n\n deallocate(a)\n contains\nend\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nEvi has N integers a_1,a_2,..,a_N. His objective is to have N equal integers by transforming some of them.\n\nHe may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).\n\nFind the minimum total cost to achieve his objective.\n\nConstraints\n\n1≦N≦100\n\n-100≦a_i≦100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum total cost to achieve Evi's objective.\n\nSample Input 1\n\n2\n4 8\n\nSample Output 1\n\n8\n\nTransforming the both into 6s will cost (4-6)^2+(8-6)^2=8 dollars, which is the minimum.\n\nSample Input 2\n\n3\n1 1 3\n\nSample Output 2\n\n3\n\nTransforming the all into 2s will cost (1-2)^2+(1-2)^2+(3-2)^2=3 dollars. Note that Evi has to pay (1-2)^2 dollar separately for transforming each of the two 1s.\n\nSample Input 3\n\n3\n4 2 5\n\nSample Output 3\n\n5\n\nLeaving the 4 as it is and transforming the 2 and the 5 into 4s will achieve the total cost of (2-4)^2+(5-4)^2=5 dollars, which is the minimum.\n\nSample Input 4\n\n4\n-100 -100 -100 -100\n\nSample Output 4\n\n0\n\nWithout transforming anything, Evi's objective is already achieved. Thus, the necessary cost is 0.", "sample_input": "2\n4 8\n"}, "reference_outputs": ["8\n"], "source_document_id": "p04025", "source_text": "Score : 200 points\n\nProblem Statement\n\nEvi has N integers a_1,a_2,..,a_N. His objective is to have N equal integers by transforming some of them.\n\nHe may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).\n\nFind the minimum total cost to achieve his objective.\n\nConstraints\n\n1≦N≦100\n\n-100≦a_i≦100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum total cost to achieve Evi's objective.\n\nSample Input 1\n\n2\n4 8\n\nSample Output 1\n\n8\n\nTransforming the both into 6s will cost (4-6)^2+(8-6)^2=8 dollars, which is the minimum.\n\nSample Input 2\n\n3\n1 1 3\n\nSample Output 2\n\n3\n\nTransforming the all into 2s will cost (1-2)^2+(1-2)^2+(3-2)^2=3 dollars. Note that Evi has to pay (1-2)^2 dollar separately for transforming each of the two 1s.\n\nSample Input 3\n\n3\n4 2 5\n\nSample Output 3\n\n5\n\nLeaving the 4 as it is and transforming the 2 and the 5 into 4s will achieve the total cost of (2-4)^2+(5-4)^2=5 dollars, which is the minimum.\n\nSample Input 4\n\n4\n-100 -100 -100 -100\n\nSample Output 4\n\n0\n\nWithout transforming anything, Evi's objective is already achieved. Thus, the necessary cost is 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 357, "cpu_time_ms": 1, "memory_kb": 256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s543390358", "group_id": "codeNet:p04025", "input_text": "program\tmain\n implicit none\n integer(2)::n,i\n integer,allocatable::a(:)\n read*,n\n allocate(a(n))\n read*,a\n print*,minval((/(dot_product(a+i,a+i),i=-100,100)/))\nend program main", "language": "Fortran", "metadata": {"date": 1471137480, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p04025.html", "problem_id": "p04025", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04025/input.txt", "sample_output_relpath": "derived/input_output/data/p04025/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04025/Fortran/s543390358.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s543390358", "user_id": "u017744950"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "program\tmain\n implicit none\n integer(2)::n,i\n integer,allocatable::a(:)\n read*,n\n allocate(a(n))\n read*,a\n print*,minval((/(dot_product(a+i,a+i),i=-100,100)/))\nend program main", "problem_context": "Score : 200 points\n\nProblem Statement\n\nEvi has N integers a_1,a_2,..,a_N. His objective is to have N equal integers by transforming some of them.\n\nHe may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).\n\nFind the minimum total cost to achieve his objective.\n\nConstraints\n\n1≦N≦100\n\n-100≦a_i≦100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum total cost to achieve Evi's objective.\n\nSample Input 1\n\n2\n4 8\n\nSample Output 1\n\n8\n\nTransforming the both into 6s will cost (4-6)^2+(8-6)^2=8 dollars, which is the minimum.\n\nSample Input 2\n\n3\n1 1 3\n\nSample Output 2\n\n3\n\nTransforming the all into 2s will cost (1-2)^2+(1-2)^2+(3-2)^2=3 dollars. Note that Evi has to pay (1-2)^2 dollar separately for transforming each of the two 1s.\n\nSample Input 3\n\n3\n4 2 5\n\nSample Output 3\n\n5\n\nLeaving the 4 as it is and transforming the 2 and the 5 into 4s will achieve the total cost of (2-4)^2+(5-4)^2=5 dollars, which is the minimum.\n\nSample Input 4\n\n4\n-100 -100 -100 -100\n\nSample Output 4\n\n0\n\nWithout transforming anything, Evi's objective is already achieved. Thus, the necessary cost is 0.", "sample_input": "2\n4 8\n"}, "reference_outputs": ["8\n"], "source_document_id": "p04025", "source_text": "Score : 200 points\n\nProblem Statement\n\nEvi has N integers a_1,a_2,..,a_N. His objective is to have N equal integers by transforming some of them.\n\nHe may transform each integer at most once. Transforming an integer x into another integer y costs him (x-y)^2 dollars. Even if a_i=a_j (i≠j), he has to pay the cost separately for transforming each of them (See Sample 2).\n\nFind the minimum total cost to achieve his objective.\n\nConstraints\n\n1≦N≦100\n\n-100≦a_i≦100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum total cost to achieve Evi's objective.\n\nSample Input 1\n\n2\n4 8\n\nSample Output 1\n\n8\n\nTransforming the both into 6s will cost (4-6)^2+(8-6)^2=8 dollars, which is the minimum.\n\nSample Input 2\n\n3\n1 1 3\n\nSample Output 2\n\n3\n\nTransforming the all into 2s will cost (1-2)^2+(1-2)^2+(3-2)^2=3 dollars. Note that Evi has to pay (1-2)^2 dollar separately for transforming each of the two 1s.\n\nSample Input 3\n\n3\n4 2 5\n\nSample Output 3\n\n5\n\nLeaving the 4 as it is and transforming the 2 and the 5 into 4s will achieve the total cost of (2-4)^2+(5-4)^2=5 dollars, which is the minimum.\n\nSample Input 4\n\n4\n-100 -100 -100 -100\n\nSample Output 4\n\n0\n\nWithout transforming anything, Evi's objective is already achieved. Thus, the necessary cost is 0.", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 183, "cpu_time_ms": 76, "memory_kb": 640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s899603510", "group_id": "codeNet:p04043", "input_text": "program iroha_easy\n implicit none\n integer a, b, c\n read *, a, b, c\n if(a .eq. 5 .and. b .eq. 5 .and. c .eq. 7)then\n print *, 'YES'\n else if(a .eq. 5 .and. b .eq. 7 .and. c .eq. 5)then\n print *, 'YES'\n else if(a .eq. 7 .and. b .eq. 5 .and. c .eq. 5)then\n print *, 'YES'\n else\n print *, 'NO'\n end if\nend program", "language": "Fortran", "metadata": {"date": 1598450887, "filename_ext": "f", "original_language": "Fortran (GNU Fortran 9.2.1)", "problem_description_relpath": "problem_descriptions/p04043.html", "problem_id": "p04043", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04043/input.txt", "sample_output_relpath": "derived/input_output/data/p04043/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04043/Fortran/s899603510.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s899603510", "user_id": "u622206408"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program iroha_easy\n implicit none\n integer a, b, c\n read *, a, b, c\n if(a .eq. 5 .and. b .eq. 5 .and. c .eq. 7)then\n print *, 'YES'\n else if(a .eq. 5 .and. b .eq. 7 .and. c .eq. 5)then\n print *, 'YES'\n else if(a .eq. 7 .and. b .eq. 5 .and. c .eq. 5)then\n print *, 'YES'\n else\n print *, 'NO'\n end if\nend program", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.\n\nTo create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.\n\nConstraints\n\n1≦A,B,C≦10\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf it is possible to construct a Haiku by using each of the phrases once, print YES (case-sensitive). Otherwise, print NO.\n\nSample Input 1\n\n5 5 7\n\nSample Output 1\n\nYES\n\nUsing three phrases of length 5, 5 and 7, it is possible to construct a Haiku.\n\nSample Input 2\n\n7 7 5\n\nSample Output 2\n\nNO", "sample_input": "5 5 7\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p04043", "source_text": "Score : 100 points\n\nProblem Statement\n\nIroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.\n\nTo create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.\n\nConstraints\n\n1≦A,B,C≦10\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf it is possible to construct a Haiku by using each of the phrases once, print YES (case-sensitive). Otherwise, print NO.\n\nSample Input 1\n\n5 5 7\n\nSample Output 1\n\nYES\n\nUsing three phrases of length 5, 5 and 7, it is possible to construct a Haiku.\n\nSample Input 2\n\n7 7 5\n\nSample Output 2\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 362, "cpu_time_ms": 11, "memory_kb": 2860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s564929479", "group_id": "codeNet:p04043", "input_text": "program main\nimplicit none\ninteger :: a, b, c\n\nread(*,*) a, b, c\nif( a==5 ) then\n if( b== 5 ) then\n if( c == 7 ) then\n write(*,*) 'YES'\n stop\n end if\n else if( b == 7 ) then\n if ( c== 5 ) then\n write(*,*) 'YES'\n stop\n end if\n end if\nelse if( a== 7 ) then\n if( b==5.and.c==5 ) then\n write(*,*) 'YES'\n stop\n end if\nend if\nwrite(*,*) 'NO'\n\n\nend program main\n", "language": "Fortran", "metadata": {"date": 1558720460, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p04043.html", "problem_id": "p04043", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04043/input.txt", "sample_output_relpath": "derived/input_output/data/p04043/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04043/Fortran/s564929479.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s564929479", "user_id": "u696547932"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "program main\nimplicit none\ninteger :: a, b, c\n\nread(*,*) a, b, c\nif( a==5 ) then\n if( b== 5 ) then\n if( c == 7 ) then\n write(*,*) 'YES'\n stop\n end if\n else if( b == 7 ) then\n if ( c== 5 ) then\n write(*,*) 'YES'\n stop\n end if\n end if\nelse if( a== 7 ) then\n if( b==5.and.c==5 ) then\n write(*,*) 'YES'\n stop\n end if\nend if\nwrite(*,*) 'NO'\n\n\nend program main\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.\n\nTo create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.\n\nConstraints\n\n1≦A,B,C≦10\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf it is possible to construct a Haiku by using each of the phrases once, print YES (case-sensitive). Otherwise, print NO.\n\nSample Input 1\n\n5 5 7\n\nSample Output 1\n\nYES\n\nUsing three phrases of length 5, 5 and 7, it is possible to construct a Haiku.\n\nSample Input 2\n\n7 7 5\n\nSample Output 2\n\nNO", "sample_input": "5 5 7\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p04043", "source_text": "Score : 100 points\n\nProblem Statement\n\nIroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.\n\nTo create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.\n\nConstraints\n\n1≦A,B,C≦10\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf it is possible to construct a Haiku by using each of the phrases once, print YES (case-sensitive). Otherwise, print NO.\n\nSample Input 1\n\n5 5 7\n\nSample Output 1\n\nYES\n\nUsing three phrases of length 5, 5 and 7, it is possible to construct a Haiku.\n\nSample Input 2\n\n7 7 5\n\nSample Output 2\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 427, "cpu_time_ms": 2, "memory_kb": 384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Fortran:s525045888", "group_id": "codeNet:p04043", "input_text": "PROGRAM ATCODER\n\nimplicit none\ninteger :: a(3), c5, c7,i\n\nread(*,*) (a(i), i=1,3) !ここが入力欄\n\n! ここに計算式\nc5 = 0 ; c7 = 0\ndo i = 1, 3\nif (a(i) == 5)then\n\tc5 = c5 + 1\nelse if (a(i) == 7)then\n\tc7 = c7 + 1\nend if\nend do\n\n! ここに出力結果\nif (c5 == 2 .and. c7 == 1) then\n\twrite(*,'(a)') 'YES'\nelse\n\twrite(*,'(a)') 'NO'\nend if\n\nEND PROGRAM ATCODER", "language": "Fortran", "metadata": {"date": 1548865126, "filename_ext": "f", "original_language": "Fortran (gfortran v4.8.4)", "problem_description_relpath": "problem_descriptions/p04043.html", "problem_id": "p04043", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04043/input.txt", "sample_output_relpath": "derived/input_output/data/p04043/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04043/Fortran/s525045888.f", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s525045888", "user_id": "u454557108"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "PROGRAM ATCODER\n\nimplicit none\ninteger :: a(3), c5, c7,i\n\nread(*,*) (a(i), i=1,3) !ここが入力欄\n\n! ここに計算式\nc5 = 0 ; c7 = 0\ndo i = 1, 3\nif (a(i) == 5)then\n\tc5 = c5 + 1\nelse if (a(i) == 7)then\n\tc7 = c7 + 1\nend if\nend do\n\n! ここに出力結果\nif (c5 == 2 .and. c7 == 1) then\n\twrite(*,'(a)') 'YES'\nelse\n\twrite(*,'(a)') 'NO'\nend if\n\nEND PROGRAM ATCODER", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.\n\nTo create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.\n\nConstraints\n\n1≦A,B,C≦10\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf it is possible to construct a Haiku by using each of the phrases once, print YES (case-sensitive). Otherwise, print NO.\n\nSample Input 1\n\n5 5 7\n\nSample Output 1\n\nYES\n\nUsing three phrases of length 5, 5 and 7, it is possible to construct a Haiku.\n\nSample Input 2\n\n7 7 5\n\nSample Output 2\n\nNO", "sample_input": "5 5 7\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p04043", "source_text": "Score : 100 points\n\nProblem Statement\n\nIroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.\n\nTo create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.\n\nConstraints\n\n1≦A,B,C≦10\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B C\n\nOutput\n\nIf it is possible to construct a Haiku by using each of the phrases once, print YES (case-sensitive). Otherwise, print NO.\n\nSample Input 1\n\n5 5 7\n\nSample Output 1\n\nYES\n\nUsing three phrases of length 5, 5 and 7, it is possible to construct a Haiku.\n\nSample Input 2\n\n7 7 5\n\nSample Output 2\n\nNO", "split": "test_in_distribution", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 369, "cpu_time_ms": 2, "memory_kb": 256}, "variant": "low_resource"}