{"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s194913200", "group_id": "codeNet:p02534", "input_text": "println(\"ACL\"^parse(Int,readline()))\n", "language": "Julia", "metadata": {"date": 1601168699, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02534.html", "problem_id": "p02534", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02534/input.txt", "sample_output_relpath": "derived/input_output/data/p02534/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02534/Julia/s194913200.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s194913200", "user_id": "u081445141"}, "prompt_components": {"gold_output": "ACLACLACL\n", "input_to_evaluate": "println(\"ACL\"^parse(Int,readline()))\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer K.\nPrint the string obtained by repeating the string ACL K times and concatenating them.\n\nFor example, if K = 3, print ACLACLACL.\n\nConstraints\n\n1 \\leq K \\leq 5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the string obtained by repeating the string ACL K times and concatenating them.\n\nSample Input 1\n\n3\n\nSample Output 1\n\nACLACLACL", "sample_input": "3\n"}, "reference_outputs": ["ACLACLACL\n"], "source_document_id": "p02534", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an integer K.\nPrint the string obtained by repeating the string ACL K times and concatenating them.\n\nFor example, if K = 3, print ACLACLACL.\n\nConstraints\n\n1 \\leq K \\leq 5\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the string obtained by repeating the string ACL K times and concatenating them.\n\nSample Input 1\n\n3\n\nSample Output 1\n\nACLACLACL", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 187, "memory_kb": 151332}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s035739342", "group_id": "codeNet:p02536", "input_text": "function main()\n n,m=myreads(Int)\n # -----------Union-Find-----------\n par=Vector{Int}([i for i=1:n])\n siz=ones(Int,n)\n function root(x::Int)\n index=par[x]\n while par[index]!=index\n index=par[index]\n end\n return index\n end\n function unite(x::Int,y::Int)\n rx,ry=root(x),root(y)\n if rx==ry\n return 0\n elseif rx>ry\n rx,ry=ry,rx\n end\n par[ry]=rx\n siz[rx]+=siz[ry]\n end\n function same(x::Int,y::Int)\n isequal(root(x),root(y))\n end\n # --------------------------------\n for i=1:m\n a,b=myreads(Int)\n unite(a,b)\n end\n println(length(unique(par))-1)\nend\n\n# ----------input function----------\nsread()=chomp(readline())\nsreads(sp=\" \")=split(readline(),sp)\nmyread(ty)=parse(ty,readline())\nmyreads(ty)=map(x->parse(ty,x),split(readline()))\nmain()", "language": "Julia", "metadata": {"date": 1601412854, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02536.html", "problem_id": "p02536", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02536/input.txt", "sample_output_relpath": "derived/input_output/data/p02536/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02536/Julia/s035739342.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s035739342", "user_id": "u619197965"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n n,m=myreads(Int)\n # -----------Union-Find-----------\n par=Vector{Int}([i for i=1:n])\n siz=ones(Int,n)\n function root(x::Int)\n index=par[x]\n while par[index]!=index\n index=par[index]\n end\n return index\n end\n function unite(x::Int,y::Int)\n rx,ry=root(x),root(y)\n if rx==ry\n return 0\n elseif rx>ry\n rx,ry=ry,rx\n end\n par[ry]=rx\n siz[rx]+=siz[ry]\n end\n function same(x::Int,y::Int)\n isequal(root(x),root(y))\n end\n # --------------------------------\n for i=1:m\n a,b=myreads(Int)\n unite(a,b)\n end\n println(length(unique(par))-1)\nend\n\n# ----------input function----------\nsread()=chomp(readline())\nsreads(sp=\" \")=split(readline(),sp)\nmyread(ty)=parse(ty,readline())\nmyreads(ty)=map(x->parse(ty,x),split(readline()))\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M.\nRoad i connects City A_i and City B_i.\n\nSnuke can perform the following operation zero or more times:\n\nChoose two distinct cities that are not directly connected by a road, and build a new road between the two cities.\n\nAfter he finishes the operations, it must be possible to travel from any city to any other cities by following roads (possibly multiple times).\n\nWhat is the minimum number of roads he must build to achieve the goal?\n\nConstraints\n\n2 \\leq N \\leq 100,000\n\n1 \\leq M \\leq 100,000\n\n1 \\leq A_i < B_i \\leq N\n\nNo two roads connect the same pair of cities.\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 B_1\n:\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 1\n1 2\n\nSample Output 1\n\n1\n\nInitially, there are three cities, and there is a road between City 1 and City 2.\n\nSnuke can achieve the goal by building one new road, for example, between City 1 and City 3.\nAfter that,\n\nWe can travel between 1 and 2 directly.\n\nWe can travel between 1 and 3 directly.\n\nWe can travel between 2 and 3 by following both roads (2 - 1 - 3).", "sample_input": "3 1\n1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02536", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M.\nRoad i connects City A_i and City B_i.\n\nSnuke can perform the following operation zero or more times:\n\nChoose two distinct cities that are not directly connected by a road, and build a new road between the two cities.\n\nAfter he finishes the operations, it must be possible to travel from any city to any other cities by following roads (possibly multiple times).\n\nWhat is the minimum number of roads he must build to achieve the goal?\n\nConstraints\n\n2 \\leq N \\leq 100,000\n\n1 \\leq M \\leq 100,000\n\n1 \\leq A_i < B_i \\leq N\n\nNo two roads connect the same pair of cities.\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 B_1\n:\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 1\n1 2\n\nSample Output 1\n\n1\n\nInitially, there are three cities, and there is a road between City 1 and City 2.\n\nSnuke can achieve the goal by building one new road, for example, between City 1 and City 3.\nAfter that,\n\nWe can travel between 1 and 2 directly.\n\nWe can travel between 1 and 3 directly.\n\nWe can travel between 2 and 3 by following both roads (2 - 1 - 3).", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 450, "memory_kb": 208588}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s820032901", "group_id": "codeNet:p02536", "input_text": "\nmutable struct UnionFind{T <: Integer}\n parent:: Vector{T} # parent[root] is the negative of the size\n\n function UnionFind{T}(nodes::T) where T<:Integer\n if nodes <= 0\n throw(ArgumentError(\"invalid argument for nodes: $nodes\"))\n end\n\n parent = -ones(T, nodes)\n new{T}(parent)\n end\nend\n\nUnionFind(nodes::Integer) = UnionFind{typeof(nodes)}(nodes)\n\nfunction root(uf::UnionFind{T}, x::T)::T where T<:Integer\n if uf.parent[x] < 0\n return x\n else\n # uf.parent[x] = root{T}(uf, uf.parent[x])\n # return uf.parent[x]\n return uf.parent[x] = root(uf, uf.parent[x])\n end\nend\n\nfunction issame(uf::UnionFind{T}, x::T, y::T)::Bool where T<:Integer\n return root(uf, x) == root(uf, y)\nend\n\nfunction size(uf::UnionFind{T}, x::T)::T where T<:Integer\n return -uf.parent[root(uf, x)]\nend\n\nfunction unite!(uf::UnionFind{T}, x::T, y::T)::Bool where T<:Integer\n x = root(uf, x)\n y = root(uf, y)\n if x == y\n return false\n end\n if uf.parent[x] > uf.parent[y]\n x, y = y, x\n end\n # unite smaller tree(y) to bigger one(x)\n uf.parent[x] += uf.parent[y]\n uf.parent[y] = x\n return true\nend\n\nfunction main()\n N, M = parse.(Int, split(readline()))\n uf = UnionFind(N)\n ng=N\n for _ in 1:M\n Ai,Bi = parse.(Int, split(readline()))\n if !issame(uf,Ai,Bi)\n ng-=1\n end\n unite!(uf, Ai, Bi)\n end\n println(ng-1)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1601236937, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02536.html", "problem_id": "p02536", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02536/input.txt", "sample_output_relpath": "derived/input_output/data/p02536/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02536/Julia/s820032901.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s820032901", "user_id": "u117541450"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "\nmutable struct UnionFind{T <: Integer}\n parent:: Vector{T} # parent[root] is the negative of the size\n\n function UnionFind{T}(nodes::T) where T<:Integer\n if nodes <= 0\n throw(ArgumentError(\"invalid argument for nodes: $nodes\"))\n end\n\n parent = -ones(T, nodes)\n new{T}(parent)\n end\nend\n\nUnionFind(nodes::Integer) = UnionFind{typeof(nodes)}(nodes)\n\nfunction root(uf::UnionFind{T}, x::T)::T where T<:Integer\n if uf.parent[x] < 0\n return x\n else\n # uf.parent[x] = root{T}(uf, uf.parent[x])\n # return uf.parent[x]\n return uf.parent[x] = root(uf, uf.parent[x])\n end\nend\n\nfunction issame(uf::UnionFind{T}, x::T, y::T)::Bool where T<:Integer\n return root(uf, x) == root(uf, y)\nend\n\nfunction size(uf::UnionFind{T}, x::T)::T where T<:Integer\n return -uf.parent[root(uf, x)]\nend\n\nfunction unite!(uf::UnionFind{T}, x::T, y::T)::Bool where T<:Integer\n x = root(uf, x)\n y = root(uf, y)\n if x == y\n return false\n end\n if uf.parent[x] > uf.parent[y]\n x, y = y, x\n end\n # unite smaller tree(y) to bigger one(x)\n uf.parent[x] += uf.parent[y]\n uf.parent[y] = x\n return true\nend\n\nfunction main()\n N, M = parse.(Int, split(readline()))\n uf = UnionFind(N)\n ng=N\n for _ in 1:M\n Ai,Bi = parse.(Int, split(readline()))\n if !issame(uf,Ai,Bi)\n ng-=1\n end\n unite!(uf, Ai, Bi)\n end\n println(ng-1)\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M.\nRoad i connects City A_i and City B_i.\n\nSnuke can perform the following operation zero or more times:\n\nChoose two distinct cities that are not directly connected by a road, and build a new road between the two cities.\n\nAfter he finishes the operations, it must be possible to travel from any city to any other cities by following roads (possibly multiple times).\n\nWhat is the minimum number of roads he must build to achieve the goal?\n\nConstraints\n\n2 \\leq N \\leq 100,000\n\n1 \\leq M \\leq 100,000\n\n1 \\leq A_i < B_i \\leq N\n\nNo two roads connect the same pair of cities.\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 B_1\n:\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 1\n1 2\n\nSample Output 1\n\n1\n\nInitially, there are three cities, and there is a road between City 1 and City 2.\n\nSnuke can achieve the goal by building one new road, for example, between City 1 and City 3.\nAfter that,\n\nWe can travel between 1 and 2 directly.\n\nWe can travel between 1 and 3 directly.\n\nWe can travel between 2 and 3 by following both roads (2 - 1 - 3).", "sample_input": "3 1\n1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02536", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M.\nRoad i connects City A_i and City B_i.\n\nSnuke can perform the following operation zero or more times:\n\nChoose two distinct cities that are not directly connected by a road, and build a new road between the two cities.\n\nAfter he finishes the operations, it must be possible to travel from any city to any other cities by following roads (possibly multiple times).\n\nWhat is the minimum number of roads he must build to achieve the goal?\n\nConstraints\n\n2 \\leq N \\leq 100,000\n\n1 \\leq M \\leq 100,000\n\n1 \\leq A_i < B_i \\leq N\n\nNo two roads connect the same pair of cities.\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 B_1\n:\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 1\n1 2\n\nSample Output 1\n\n1\n\nInitially, there are three cities, and there is a road between City 1 and City 2.\n\nSnuke can achieve the goal by building one new road, for example, between City 1 and City 3.\nAfter that,\n\nWe can travel between 1 and 2 directly.\n\nWe can travel between 1 and 3 directly.\n\nWe can travel between 2 and 3 by following both roads (2 - 1 - 3).", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1473, "cpu_time_ms": 403, "memory_kb": 206908}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s140824522", "group_id": "codeNet:p02536", "input_text": "function solve()\n N, M = parse.(Int, split(readline()))\n adj = zeros(Int, N, N)\n\n for _ = 1:M\n A, B = parse.(Int, split(readline()))\n adj[A,B] = 1\n adj[B,A] = 1\n end\n\n cnt = 0\n\n visited = zeros(Int, N)\n\n for i = 1:N\n if visited[i] == 1 continue end\n\n cnt += 1\n\n s = [i]\n while !isempty(s)\n now = pop!(s)\n visited[now] = 1\n for j = 1:N\n if adj[now, j] == 1 && visited[j] == 0\n push!(s, j)\n end\n end\n end\n end\n\n println(cnt-1)\nend\n\nsolve()\n", "language": "Julia", "metadata": {"date": 1601169687, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02536.html", "problem_id": "p02536", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02536/input.txt", "sample_output_relpath": "derived/input_output/data/p02536/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02536/Julia/s140824522.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s140824522", "user_id": "u909017535"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function solve()\n N, M = parse.(Int, split(readline()))\n adj = zeros(Int, N, N)\n\n for _ = 1:M\n A, B = parse.(Int, split(readline()))\n adj[A,B] = 1\n adj[B,A] = 1\n end\n\n cnt = 0\n\n visited = zeros(Int, N)\n\n for i = 1:N\n if visited[i] == 1 continue end\n\n cnt += 1\n\n s = [i]\n while !isempty(s)\n now = pop!(s)\n visited[now] = 1\n for j = 1:N\n if adj[now, j] == 1 && visited[j] == 0\n push!(s, j)\n end\n end\n end\n end\n\n println(cnt-1)\nend\n\nsolve()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M.\nRoad i connects City A_i and City B_i.\n\nSnuke can perform the following operation zero or more times:\n\nChoose two distinct cities that are not directly connected by a road, and build a new road between the two cities.\n\nAfter he finishes the operations, it must be possible to travel from any city to any other cities by following roads (possibly multiple times).\n\nWhat is the minimum number of roads he must build to achieve the goal?\n\nConstraints\n\n2 \\leq N \\leq 100,000\n\n1 \\leq M \\leq 100,000\n\n1 \\leq A_i < B_i \\leq N\n\nNo two roads connect the same pair of cities.\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 B_1\n:\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 1\n1 2\n\nSample Output 1\n\n1\n\nInitially, there are three cities, and there is a road between City 1 and City 2.\n\nSnuke can achieve the goal by building one new road, for example, between City 1 and City 3.\nAfter that,\n\nWe can travel between 1 and 2 directly.\n\nWe can travel between 1 and 3 directly.\n\nWe can travel between 2 and 3 by following both roads (2 - 1 - 3).", "sample_input": "3 1\n1 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02536", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N cities numbered 1 through N, and M bidirectional roads numbered 1 through M.\nRoad i connects City A_i and City B_i.\n\nSnuke can perform the following operation zero or more times:\n\nChoose two distinct cities that are not directly connected by a road, and build a new road between the two cities.\n\nAfter he finishes the operations, it must be possible to travel from any city to any other cities by following roads (possibly multiple times).\n\nWhat is the minimum number of roads he must build to achieve the goal?\n\nConstraints\n\n2 \\leq N \\leq 100,000\n\n1 \\leq M \\leq 100,000\n\n1 \\leq A_i < B_i \\leq N\n\nNo two roads connect the same pair of cities.\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 B_1\n:\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 1\n1 2\n\nSample Output 1\n\n1\n\nInitially, there are three cities, and there is a road between City 1 and City 2.\n\nSnuke can achieve the goal by building one new road, for example, between City 1 and City 3.\nAfter that,\n\nWe can travel between 1 and 2 directly.\n\nWe can travel between 1 and 3 directly.\n\nWe can travel between 2 and 3 by following both roads (2 - 1 - 3).", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2241, "memory_kb": 3530748}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s165153707", "group_id": "codeNet:p02537", "input_text": "function solve()\n N,K=parse.(Int,split(readline()))\n D=zeros(Int,N)\n for _ in 1:N\n Ai=parse(Int,readline())\n mx=0\n for i=Ai-K:Ai+K\n if 1<=i<=N\n if D[i]>mx\n mx=D[i]\n end\n end\n end\n D[Ai]=mx+1\n #println(D)\n end\n println(maximum(D))\nend\nsolve()", "language": "Julia", "metadata": {"date": 1601238543, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s165153707.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s165153707", "user_id": "u117541450"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "function solve()\n N,K=parse.(Int,split(readline()))\n D=zeros(Int,N)\n for _ in 1:N\n Ai=parse(Int,readline())\n mx=0\n for i=Ai-K:Ai+K\n if 1<=i<=N\n if D[i]>mx\n mx=D[i]\n end\n end\n end\n D[Ai]=mx+1\n #println(D)\n end\n println(maximum(D))\nend\nsolve()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2212, "memory_kb": 308328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s447746821", "group_id": "codeNet:p02538", "input_text": "const MOD = 998244353\n\nfunction solve()\n N, Q = parse.(Int, split(readline()))\n S = \"1\"^N\n\n for _ = 1:Q\n L, R, D = parse.(Int, split(readline()))\n S = S[1:L-1]*string(D)^(R-L+1)*S[R+1:N]\n\n X = 0\n E = 1\n for i = N:-1:1\n X += (parse(Int, S[i]) * E)%MOD\n X = (X%MOD + MOD)%MOD\n E *= 10\n E = (E%MOD + MOD)%MOD\n end\n println((X + MOD)%MOD)\n end\nend\n\nsolve()\n", "language": "Julia", "metadata": {"date": 1601172557, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s447746821.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s447746821", "user_id": "u909017535"}, "prompt_components": {"gold_output": "11222211\n77772211\n77333333\n72333333\n72311333\n", "input_to_evaluate": "const MOD = 998244353\n\nfunction solve()\n N, Q = parse.(Int, split(readline()))\n S = \"1\"^N\n\n for _ = 1:Q\n L, R, D = parse.(Int, split(readline()))\n S = S[1:L-1]*string(D)^(R-L+1)*S[R+1:N]\n\n X = 0\n E = 1\n for i = N:-1:1\n X += (parse(Int, S[i]) * E)%MOD\n X = (X%MOD + MOD)%MOD\n E *= 10\n E = (E%MOD + MOD)%MOD\n end\n println((X + MOD)%MOD)\n end\nend\n\nsolve()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 460, "cpu_time_ms": 2211, "memory_kb": 222820}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s630992248", "group_id": "codeNet:p02546", "input_text": "stdin = readline()\n\nif string(stdin[end]) == \"s\"\n println(string(stdin, \"es\"))\nelse\n println(string(stdin, \"s\"))\nend\n", "language": "Julia", "metadata": {"date": 1600543606, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s630992248.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s630992248", "user_id": "u282965764"}, "prompt_components": {"gold_output": "apples\n", "input_to_evaluate": "stdin = readline()\n\nif string(stdin[end]) == \"s\"\n println(string(stdin, \"es\"))\nelse\n println(string(stdin, \"s\"))\nend\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 234, "memory_kb": 152072}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s886494471", "group_id": "codeNet:p02547", "input_text": "function main()\n stdin = readlines()\n\n l = parse(Int, stdin[1]);\n c = 0\n flg = 0\n\n for i = 2:l\n a, b = split(stdin[i])\n if a == b\n c += 1\n else\n c = 0\n end\n if c == 3\n flg = 1\n end\n end\n\n if flg == 1\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1600549280, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s886494471.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s886494471", "user_id": "u282965764"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n stdin = readlines()\n\n l = parse(Int, stdin[1]);\n c = 0\n flg = 0\n\n for i = 2:l\n a, b = split(stdin[i])\n if a == b\n c += 1\n else\n c = 0\n end\n if c == 3\n flg = 1\n end\n end\n\n if flg == 1\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 237, "memory_kb": 166392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s173660351", "group_id": "codeNet:p02547", "input_text": "function main()\n\tN = parse.(Int,readline())\n\tinputs = [parse.(Int,split(readline())) for _=1:N]\n\t\n\tp=0\n\tcnt=0\n\tfor input in inputs\n\t\tif input[1] == input[2]\n\t\t\tp+=1\n\t\telse\n\t\t\tp=0\n\t\tend\n\t\tif p ==3\n\t\t\tcnt+=1\n\t\tend\n\tend\n\tprintln(cnt > 0 ? \"Yes\" : \"No\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1600543337, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s173660351.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s173660351", "user_id": "u019567454"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n\tN = parse.(Int,readline())\n\tinputs = [parse.(Int,split(readline())) for _=1:N]\n\t\n\tp=0\n\tcnt=0\n\tfor input in inputs\n\t\tif input[1] == input[2]\n\t\t\tp+=1\n\t\telse\n\t\t\tp=0\n\t\tend\n\t\tif p ==3\n\t\t\tcnt+=1\n\t\tend\n\tend\n\tprintln(cnt > 0 ? \"Yes\" : \"No\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 261, "cpu_time_ms": 265, "memory_kb": 177728}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s913265531", "group_id": "codeNet:p02547", "input_text": "readints()=parse.(Int,split(readline()))\nN=readints()[1]\ns=0\nret=\"No\"\nfor i in 1:N\n D1,D2=readints()\n if D1==D2\n s+=1\n if s==3\n ret=\"Yes\"\n end\n else\n s=0\n end\nend\nprint(ret)", "language": "Julia", "metadata": {"date": 1600542708, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s913265531.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s913265531", "user_id": "u562051766"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "readints()=parse.(Int,split(readline()))\nN=readints()[1]\ns=0\nret=\"No\"\nfor i in 1:N\n D1,D2=readints()\n if D1==D2\n s+=1\n if s==3\n ret=\"Yes\"\n end\n else\n s=0\n end\nend\nprint(ret)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 224, "cpu_time_ms": 1389, "memory_kb": 275104}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s733410981", "group_id": "codeNet:p02547", "input_text": "function main()\n n=parse(Int,readline())\n r=0\n for i=1:n\n a,b=split(readline())\n if a==b; r+=1; else; r=0; end\n if r==3; return println(\"Yes\"); end\n end\n println(\"No\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1600542366, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s733410981.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s733410981", "user_id": "u443151804"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n n=parse(Int,readline())\n r=0\n for i=1:n\n a,b=split(readline())\n if a==b; r+=1; else; r=0; end\n if r==3; return println(\"Yes\"); end\n end\n println(\"No\")\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 200, "memory_kb": 155836}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s983175872", "group_id": "codeNet:p02548", "input_text": "readint()=parse.(Int,readline())\nN=readint()\nfunction main()\n s=0\n for i in 1:N\n s+=(N-1)÷i\n end\n print(s)\nend\nmain()\n ", "language": "Julia", "metadata": {"date": 1600543531, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s983175872.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s983175872", "user_id": "u562051766"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "readint()=parse.(Int,readline())\nN=readint()\nfunction main()\n s=0\n for i in 1:N\n s+=(N-1)÷i\n end\n print(s)\nend\nmain()\n ", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 142, "cpu_time_ms": 362, "memory_kb": 202704}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s948950978", "group_id": "codeNet:p02549", "input_text": "function ABC_D()\n readints()=parse.(Int,split(readline()))\n MOD=998244353\n N,K=readints()\n\n L=zeros(Int,K)\n R=zeros(Int,K)\n for i in 1:K\n L[i],R[i]=readints()\n end\n S0=Set(hcat(L,R))\n S=sort!(collect(S0))\n\n\n NMax = 2*10^5\n fac=ones(Int,NMax)#factorial_mod\n for i in 2:NMax\n fac[i]=fac[i-1]*i%MOD\n end\n\n function CMOD(a,b)#binominal_mod\n fac[a]*invmod(fac[b],MOD)%MOD*invmod(fac[a-b],MOD)%MOD\n end\n N1=N-1\n\n nk=zeros(Int,length(S))\n function nokori(nk)\n N1-(sum(S .* nk)-S[1]*nk[1])\n end\n function calcP(nk)\n\n ret=fac[sum(nk)]\n for i in 1:length(nk)\n if nk[i]==0\n im = 1\n else\n im= invmod(fac[nk[i]],MOD)\n end\n ret*=im\n ret%=MOD\n end\n ret\n end\n\n function S_plus(nk)\n nk[end]+=1\n for i in length(nk):-1:3\n if nk[i]>Smax[i]\n nk[i]=0\n nk[i-1]+=1\n end\n end\n if length(nk)>1\n if nk[2]>Smax[end]\n return false\n end\n else\n return false\n end\n true\n end \n\n nk=zeros(Int,length(S))\n Smax=@. N1 ÷ S\n chk=0\n\n flag=true\n println(S)\n while flag\n NOKORI=nokori(nk)\n if NOKORI % S[1] == 0 && NOKORI ≥ 0\n nk[1]=NOKORI÷S[1]\n println(\"$nk = > $(sum(nk.*S))\")\n chk+=calcP(nk)\n chk%=MOD\n end\n flag=S_plus(nk)\n end\n print(chk)\nend\n \nABC_D()", "language": "Julia", "metadata": {"date": 1600552502, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s948950978.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s948950978", "user_id": "u562051766"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function ABC_D()\n readints()=parse.(Int,split(readline()))\n MOD=998244353\n N,K=readints()\n\n L=zeros(Int,K)\n R=zeros(Int,K)\n for i in 1:K\n L[i],R[i]=readints()\n end\n S0=Set(hcat(L,R))\n S=sort!(collect(S0))\n\n\n NMax = 2*10^5\n fac=ones(Int,NMax)#factorial_mod\n for i in 2:NMax\n fac[i]=fac[i-1]*i%MOD\n end\n\n function CMOD(a,b)#binominal_mod\n fac[a]*invmod(fac[b],MOD)%MOD*invmod(fac[a-b],MOD)%MOD\n end\n N1=N-1\n\n nk=zeros(Int,length(S))\n function nokori(nk)\n N1-(sum(S .* nk)-S[1]*nk[1])\n end\n function calcP(nk)\n\n ret=fac[sum(nk)]\n for i in 1:length(nk)\n if nk[i]==0\n im = 1\n else\n im= invmod(fac[nk[i]],MOD)\n end\n ret*=im\n ret%=MOD\n end\n ret\n end\n\n function S_plus(nk)\n nk[end]+=1\n for i in length(nk):-1:3\n if nk[i]>Smax[i]\n nk[i]=0\n nk[i-1]+=1\n end\n end\n if length(nk)>1\n if nk[2]>Smax[end]\n return false\n end\n else\n return false\n end\n true\n end \n\n nk=zeros(Int,length(S))\n Smax=@. N1 ÷ S\n chk=0\n\n flag=true\n println(S)\n while flag\n NOKORI=nokori(nk)\n if NOKORI % S[1] == 0 && NOKORI ≥ 0\n nk[1]=NOKORI÷S[1]\n println(\"$nk = > $(sum(nk.*S))\")\n chk+=calcP(nk)\n chk%=MOD\n end\n flag=S_plus(nk)\n end\n print(chk)\nend\n \nABC_D()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1586, "cpu_time_ms": 2212, "memory_kb": 264464}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s366109389", "group_id": "codeNet:p02549", "input_text": "parseline(str=readline()) = parse.(Int, split(str))\nfunction main()\n N, K = parseline()\n Flag = zeros(Int, N)\n Mod = 998244353\n for k in 1:K\n l, r = parseline()\n Flag[l:r] .= 1\n end\n F = [n for n in 1:N if Flag[n]==1]\n dp = zeros(Int, N)\n dp[1] = 1\n for n in 1:N\n dp[n] == 0 && continue\n for f in F\n next = n + f\n next > N && break\n dp[next] += dp[n]\n end\n end\n println(mod(dp[end], Mod))\nend\nmain()", "language": "Julia", "metadata": {"date": 1600547273, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s366109389.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s366109389", "user_id": "u728564399"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseline(str=readline()) = parse.(Int, split(str))\nfunction main()\n N, K = parseline()\n Flag = zeros(Int, N)\n Mod = 998244353\n for k in 1:K\n l, r = parseline()\n Flag[l:r] .= 1\n end\n F = [n for n in 1:N if Flag[n]==1]\n dp = zeros(Int, N)\n dp[1] = 1\n for n in 1:N\n dp[n] == 0 && continue\n for f in F\n next = n + f\n next > N && break\n dp[next] += dp[n]\n end\n end\n println(mod(dp[end], Mod))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2212, "memory_kb": 194416}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s871865204", "group_id": "codeNet:p02549", "input_text": "function main()\n n,k=parse.(Int,split(readline()))\n l=Int[]\n dp=zeros(Int,n)\n dp[1]=1\n for i=1:k\n a,b=parse.(Int,split(readline()))\n for j=a:b\n push!(l,j)\n end\n end\n now=1\n while now!=n\n Now=dp[now]\n for i=l\n if now+i<=n\n dp[now+i]=mod(dp[now+i]+Now,998244353)\n end\n end\n now+=1\n end\n println(mod(dp[n],998244353))\nend\nmain()", "language": "Julia", "metadata": {"date": 1600545245, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s871865204.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s871865204", "user_id": "u443151804"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function main()\n n,k=parse.(Int,split(readline()))\n l=Int[]\n dp=zeros(Int,n)\n dp[1]=1\n for i=1:k\n a,b=parse.(Int,split(readline()))\n for j=a:b\n push!(l,j)\n end\n end\n now=1\n while now!=n\n Now=dp[now]\n for i=l\n if now+i<=n\n dp[now+i]=mod(dp[now+i]+Now,998244353)\n end\n end\n now+=1\n end\n println(mod(dp[n],998244353))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2210, "memory_kb": 177452}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s887255126", "group_id": "codeNet:p02550", "input_text": "parseline(str=readline()) = parse.(Int, split(str))\nfunction main()\n N, X, M = parseline()\n ans = 0\n temp = X\n A = zeros(Int, M+1)\n for m in 1:M+1\n A[m] = temp\n temp = powermod(temp, 2, M)\n temp ≡ 0 && break\n if temp ≡ 1\n A[m:end] .= 1\n break\n end\n end\n for n in 1:N\n ans += A[mod(n, M)]\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1600549248, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s887255126.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s887255126", "user_id": "u728564399"}, "prompt_components": {"gold_output": "1369\n", "input_to_evaluate": "parseline(str=readline()) = parse.(Int, split(str))\nfunction main()\n N, X, M = parseline()\n ans = 0\n temp = X\n A = zeros(Int, M+1)\n for m in 1:M+1\n A[m] = temp\n temp = powermod(temp, 2, M)\n temp ≡ 0 && break\n if temp ≡ 1\n A[m:end] .= 1\n break\n end\n end\n for n in 1:N\n ans += A[mod(n, M)]\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 412, "cpu_time_ms": 1588, "memory_kb": 352828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s782389695", "group_id": "codeNet:p02552", "input_text": "x = parse(Int, readline())\nif x == 0\n println(1)\nelse\n println(0)\nend", "language": "Julia", "metadata": {"date": 1600541406, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02552.html", "problem_id": "p02552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02552/input.txt", "sample_output_relpath": "derived/input_output/data/p02552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02552/Julia/s782389695.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s782389695", "user_id": "u001281732"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "x = parse(Int, readline())\nif x == 0\n println(1)\nelse\n println(0)\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "sample_input": "1\n"}, "reference_outputs": ["0\n"], "source_document_id": "p02552", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer x that is greater than or equal to 0, and less than or equal to 1.\nOutput 1 if x is equal to 0, or 0 if x is equal to 1.\n\nConstraints\n\n0 \\leq x \\leq 1\n\nx is an integer\n\nInput\n\nInput is given from Standard Input in the following format:\n\nx\n\nOutput\n\nPrint 1 if x is equal to 0, or 0 if x is equal to 1.\n\nSample Input 1\n\n1\n\nSample Output 1\n\n0\n\nSample Input 2\n\n0\n\nSample Output 2\n\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 71, "cpu_time_ms": 207, "memory_kb": 155484}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s002779715", "group_id": "codeNet:p02553", "input_text": "a, b, c, d = parse.(Int, readline())\n\nprintln(max(a * b, a * c, b * c, b * d))", "language": "Julia", "metadata": {"date": 1600541493, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02553.html", "problem_id": "p02553", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02553/input.txt", "sample_output_relpath": "derived/input_output/data/p02553/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02553/Julia/s002779715.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s002779715", "user_id": "u001281732"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a, b, c, d = parse.(Int, readline())\n\nprintln(max(a * b, a * c, b * c, b * d))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "sample_input": "1 2 1 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02553", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are integers a,b,c and d.\nIf x and y are integers and a \\leq x \\leq b and c\\leq y \\leq d hold, what is the maximum possible value of x \\times y?\n\nConstraints\n\n-10^9 \\leq a \\leq b \\leq 10^9\n\n-10^9 \\leq c \\leq d \\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n1 2 1 1\n\nSample Output 1\n\n2\n\nIf x = 1 and y = 1 then x \\times y = 1.\nIf x = 2 and y = 1 then x \\times y = 2.\nTherefore, the answer is 2.\n\nSample Input 2\n\n3 5 -4 -2\n\nSample Output 2\n\n-6\n\nThe answer can be negative.\n\nSample Input 3\n\n-1000000000 0 -1000000000 0\n\nSample Output 3\n\n1000000000000000000", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 78, "cpu_time_ms": 1274, "memory_kb": 274680}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s031375788", "group_id": "codeNet:p02554", "input_text": "function main()\n n=parse(Int64,readline())\n a,b,c=1,2,1\n d=Int(1e9+7)\n for i=1:n\n a=10*a%d\n b=9*b%d\n c=8*c%d\n end\n println((a-b+c)%d)\nend\nmain()", "language": "Julia", "metadata": {"date": 1600502110, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02554.html", "problem_id": "p02554", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02554/input.txt", "sample_output_relpath": "derived/input_output/data/p02554/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02554/Julia/s031375788.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s031375788", "user_id": "u443151804"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n n=parse(Int64,readline())\n a,b,c=1,2,1\n d=Int(1e9+7)\n for i=1:n\n a=10*a%d\n b=9*b%d\n c=8*c%d\n end\n println((a-b+c)%d)\nend\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nHow many integer sequences A_1,A_2,\\ldots,A_N of length N satisfy all of the following conditions?\n\n0 \\leq A_i \\leq 9\n\nThere exists some i such that A_i=0 holds.\n\nThere exists some i such that A_i=9 holds.\n\nThe answer can be very large, so output it modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq N \\leq 10^6\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 answer modulo 10^9 + 7.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n2\n\nTwo sequences \\{0,9\\} and \\{9,0\\} satisfy all conditions.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0\n\nSample Input 3\n\n869121\n\nSample Output 3\n\n2511445", "sample_input": "2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02554", "source_text": "Score : 300 points\n\nProblem Statement\n\nHow many integer sequences A_1,A_2,\\ldots,A_N of length N satisfy all of the following conditions?\n\n0 \\leq A_i \\leq 9\n\nThere exists some i such that A_i=0 holds.\n\nThere exists some i such that A_i=9 holds.\n\nThe answer can be very large, so output it modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq N \\leq 10^6\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 answer modulo 10^9 + 7.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n2\n\nTwo sequences \\{0,9\\} and \\{9,0\\} satisfy all conditions.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0\n\nSample Input 3\n\n869121\n\nSample Output 3\n\n2511445", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 218, "memory_kb": 158188}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s594637267", "group_id": "codeNet:p02554", "input_text": "n = parse(Int,readline())\nm = 10^9+7\na = powermod(10,n,m)\nb = powermod(9,n,m)\nc = powermod(8,n,m)\nprintln(mod(sum([a,-2b,c]),m))\n", "language": "Julia", "metadata": {"date": 1600123564, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02554.html", "problem_id": "p02554", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02554/input.txt", "sample_output_relpath": "derived/input_output/data/p02554/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02554/Julia/s594637267.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s594637267", "user_id": "u081445141"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n = parse(Int,readline())\nm = 10^9+7\na = powermod(10,n,m)\nb = powermod(9,n,m)\nc = powermod(8,n,m)\nprintln(mod(sum([a,-2b,c]),m))\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nHow many integer sequences A_1,A_2,\\ldots,A_N of length N satisfy all of the following conditions?\n\n0 \\leq A_i \\leq 9\n\nThere exists some i such that A_i=0 holds.\n\nThere exists some i such that A_i=9 holds.\n\nThe answer can be very large, so output it modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq N \\leq 10^6\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 answer modulo 10^9 + 7.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n2\n\nTwo sequences \\{0,9\\} and \\{9,0\\} satisfy all conditions.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0\n\nSample Input 3\n\n869121\n\nSample Output 3\n\n2511445", "sample_input": "2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02554", "source_text": "Score : 300 points\n\nProblem Statement\n\nHow many integer sequences A_1,A_2,\\ldots,A_N of length N satisfy all of the following conditions?\n\n0 \\leq A_i \\leq 9\n\nThere exists some i such that A_i=0 holds.\n\nThere exists some i such that A_i=9 holds.\n\nThe answer can be very large, so output it modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq N \\leq 10^6\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 answer modulo 10^9 + 7.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n2\n\nTwo sequences \\{0,9\\} and \\{9,0\\} satisfy all conditions.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n0\n\nSample Input 3\n\n869121\n\nSample Output 3\n\n2511445", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 129, "cpu_time_ms": 266, "memory_kb": 163396}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s549907632", "group_id": "codeNet:p02555", "input_text": "function F()\n S = parse(BigInt,readline())\n \n if S<3\n ans = 0\n elseif S<6\n ans = 1\n else\n N = Int(floor(S/3))\n c = 1\n for i= 2:N\n s = BigInt(S-3*i)\n c += binomial(s+i-1,s)\n end\n ans = c\n end \n \n ans = mod(ans,10^9+7)\n println(Int(ans))\n\nend\n\nF()", "language": "Julia", "metadata": {"date": 1600028457, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02555.html", "problem_id": "p02555", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02555/input.txt", "sample_output_relpath": "derived/input_output/data/p02555/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02555/Julia/s549907632.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s549907632", "user_id": "u409581352"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function F()\n S = parse(BigInt,readline())\n \n if S<3\n ans = 0\n elseif S<6\n ans = 1\n else\n N = Int(floor(S/3))\n c = 1\n for i= 2:N\n s = BigInt(S-3*i)\n c += binomial(s+i-1,s)\n end\n ans = c\n end \n \n ans = mod(ans,10^9+7)\n println(Int(ans))\n\nend\n\nF()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S.\nThe answer can be very large, so output it modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq S \\leq 2000\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 the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n3\n\n3 sequences satisfy the condition: \\{3,4\\}, \\{4,3\\} and \\{7\\}.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nThere are no sequences that satisfy the condition.\n\nSample Input 3\n\n1729\n\nSample Output 3\n\n294867501", "sample_input": "7\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02555", "source_text": "Score : 400 points\n\nProblem Statement\n\nGiven is an integer S.\nFind how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S.\nThe answer can be very large, so output it modulo 10^9 + 7.\n\nConstraints\n\n1 \\leq S \\leq 2000\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 the answer.\n\nSample Input 1\n\n7\n\nSample Output 1\n\n3\n\n3 sequences satisfy the condition: \\{3,4\\}, \\{4,3\\} and \\{7\\}.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n0\n\nThere are no sequences that satisfy the condition.\n\nSample Input 3\n\n1729\n\nSample Output 3\n\n294867501", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 303, "memory_kb": 172016}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s015640116", "group_id": "codeNet:p02556", "input_text": "# SPDX-License-Identifier: X11\n# 2020-09-13\n\nfunction _main()\n N = parse(Int, readline())\n X, Y = parse.(Int, split(readline()))\n A = [(X + Y, X - Y)]\n for i ∈ 2:N\n X, Y = parse.(Int, split(readline()))\n push!(A, (X + Y, X - Y))\n end\n return max(maximum(x -> x[1], A) - minimum(x -> x[1], A),\n maximum(x -> x[2], A) - minimum(x -> x[2], A))\nend\n\nprintln(_main())\n", "language": "Julia", "metadata": {"date": 1600030000, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02556.html", "problem_id": "p02556", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02556/input.txt", "sample_output_relpath": "derived/input_output/data/p02556/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02556/Julia/s015640116.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s015640116", "user_id": "u883424625"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "# SPDX-License-Identifier: X11\n# 2020-09-13\n\nfunction _main()\n N = parse(Int, readline())\n X, Y = parse.(Int, split(readline()))\n A = [(X + Y, X - Y)]\n for i ∈ 2:N\n X, Y = parse.(Int, split(readline()))\n push!(A, (X + Y, X - Y))\n end\n return max(maximum(x -> x[1], A) - minimum(x -> x[1], A),\n maximum(x -> x[2], A) - minimum(x -> x[2], A))\nend\n\nprintln(_main())\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N points on the 2D plane, i-th of which is located on (x_i, y_i).\nThere can be multiple points that share the same coordinate.\nWhat is the maximum possible Manhattan distance between two distinct points?\n\nHere, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq x_i,y_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\nx_1 y_1\nx_2 y_2\n:\nx_N y_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 1\n2 4\n3 2\n\nSample Output 1\n\n4\n\nThe Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.\n\nSample Input 2\n\n2\n1 1\n1 1\n\nSample Output 2\n\n0", "sample_input": "3\n1 1\n2 4\n3 2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02556", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N points on the 2D plane, i-th of which is located on (x_i, y_i).\nThere can be multiple points that share the same coordinate.\nWhat is the maximum possible Manhattan distance between two distinct points?\n\nHere, the Manhattan distance between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_i-y_j|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq x_i,y_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\nx_1 y_1\nx_2 y_2\n:\nx_N y_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n1 1\n2 4\n3 2\n\nSample Output 1\n\n4\n\nThe Manhattan distance between the first point and the second point is |1-2|+|1-4|=4, which is maximum possible.\n\nSample Input 2\n\n2\n1 1\n1 1\n\nSample Output 2\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 545, "memory_kb": 218516}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s214039881", "group_id": "codeNet:p02558", "input_text": "function main()\n n,q=myreads(Int)\n # -----------Union-Find-----------\n par=Vector{Int}([i for i=1:n])\n siz=ones(Int,n)\n function root(x::Int)\n index=par[x]\n while par[index]!=index\n index=par[index]\n end\n return index\n end\n function unite(x::Int,y::Int)\n rx,ry=root(x),root(y)\n if rx==ry\n return 0\n elseif rx>ry\n rx,ry=ry,rx\n end\n par[ry]=rx\n siz[rx]+=siz[ry]\n end\n function same(x::Int,y::Int)\n isequal(root(x),root(y))\n end\n # --------------------------------\n for i=1:q\n t,u,v=myreads(Int).+=1\n if t==1\n unite(u,v)\n else\n println(same(u,v) ? 1 : 0)\n end\n end\nend\n\n# ----------input function----------\nsread()=chomp(readline())\nsreads(sp=\" \")=split(readline(),sp)\nmyread(ty)=parse(ty,sread())\nmyreads(ty)=parse.(ty,sreads())\nmain()", "language": "Julia", "metadata": {"date": 1599594497, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02558.html", "problem_id": "p02558", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02558/input.txt", "sample_output_relpath": "derived/input_output/data/p02558/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02558/Julia/s214039881.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s214039881", "user_id": "u619197965"}, "prompt_components": {"gold_output": "0\n1\n0\n1\n", "input_to_evaluate": "function main()\n n,q=myreads(Int)\n # -----------Union-Find-----------\n par=Vector{Int}([i for i=1:n])\n siz=ones(Int,n)\n function root(x::Int)\n index=par[x]\n while par[index]!=index\n index=par[index]\n end\n return index\n end\n function unite(x::Int,y::Int)\n rx,ry=root(x),root(y)\n if rx==ry\n return 0\n elseif rx>ry\n rx,ry=ry,rx\n end\n par[ry]=rx\n siz[rx]+=siz[ry]\n end\n function same(x::Int,y::Int)\n isequal(root(x),root(y))\n end\n # --------------------------------\n for i=1:q\n t,u,v=myreads(Int).+=1\n if t==1\n unite(u,v)\n else\n println(same(u,v) ? 1 : 0)\n end\n end\nend\n\n# ----------input function----------\nsread()=chomp(readline())\nsreads(sp=\" \")=split(readline(),sp)\nmyread(ty)=parse(ty,sread())\nmyreads(ty)=parse.(ty,sreads())\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an undirected graph with N vertices and 0 edges. Process Q queries of the following types.\n\n0 u v: Add an edge (u, v).\n\n1 u v: Print 1 if u and v are in the same connected component, 0 otherwise.\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n1 \\leq Q \\leq 200,000\n\n0 \\leq u_i, v_i \\lt N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nt_1 u_1 v_1\nt_2 u_2 v_2\n:\nt_Q u_Q v_Q\n\n出力\n\nFor each query of the latter type, print the answer.\n\nSample Input 1\n\n4 7\n1 0 1\n0 0 1\n0 2 3\n1 0 1\n1 1 2\n0 0 2\n1 1 3\n\nSample Output 1\n\n0\n1\n0\n1", "sample_input": "4 7\n1 0 1\n0 0 1\n0 2 3\n1 0 1\n1 1 2\n0 0 2\n1 1 3\n"}, "reference_outputs": ["0\n1\n0\n1\n"], "source_document_id": "p02558", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an undirected graph with N vertices and 0 edges. Process Q queries of the following types.\n\n0 u v: Add an edge (u, v).\n\n1 u v: Print 1 if u and v are in the same connected component, 0 otherwise.\n\nConstraints\n\n1 \\leq N \\leq 200,000\n\n1 \\leq Q \\leq 200,000\n\n0 \\leq u_i, v_i \\lt N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\nt_1 u_1 v_1\nt_2 u_2 v_2\n:\nt_Q u_Q v_Q\n\n出力\n\nFor each query of the latter type, print the answer.\n\nSample Input 1\n\n4 7\n1 0 1\n0 0 1\n0 2 3\n1 0 1\n1 1 2\n0 0 2\n1 1 3\n\nSample Output 1\n\n0\n1\n0\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 637, "memory_kb": 222808}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s024483816", "group_id": "codeNet:p02559", "input_text": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nparseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction ftAdd(ft::Array{Int,1},k::Int,x::Int)\n\tt = k\n\tn = length(ft)\n\twhile t<=n\n\t\tft[t] += x\n\t\tt += t&(-t)\n\tend\n\tft\nend\n\nfunction ftSum(ft::Array{Int,1},ll::Int,rr::Int)\n\tl = ll\n\tr = rr\n\ts = 0\n\twhile r>0\n\t\ts += ft[r]\n\t\tr -= r&(-r)\n\tend\n\twhile l>0\n\t\ts -= ft[l]\n\t\tl -= l&(-l)\n\tend\n\ts\nend\n\nfunction main()\n\tn,q = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tft = zeros(Int,n)\n\tfor i in 1:n\n\t\tftAdd(ft,i,a[i])\n\tend\n\tfor query in 1:q\n\t\tx,y,z = readline() |> split |> parseMap\n\t\tif x == 0\n\t\t\tftAdd(ft,y+1,z)\n\t\telse\n\t\t\tprintln(ftSum(ft,y,z))\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1599994726, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02559.html", "problem_id": "p02559", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02559/input.txt", "sample_output_relpath": "derived/input_output/data/p02559/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02559/Julia/s024483816.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s024483816", "user_id": "u095714878"}, "prompt_components": {"gold_output": "15\n7\n25\n6\n", "input_to_evaluate": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nparseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction ftAdd(ft::Array{Int,1},k::Int,x::Int)\n\tt = k\n\tn = length(ft)\n\twhile t<=n\n\t\tft[t] += x\n\t\tt += t&(-t)\n\tend\n\tft\nend\n\nfunction ftSum(ft::Array{Int,1},ll::Int,rr::Int)\n\tl = ll\n\tr = rr\n\ts = 0\n\twhile r>0\n\t\ts += ft[r]\n\t\tr -= r&(-r)\n\tend\n\twhile l>0\n\t\ts -= ft[l]\n\t\tl -= l&(-l)\n\tend\n\ts\nend\n\nfunction main()\n\tn,q = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tft = zeros(Int,n)\n\tfor i in 1:n\n\t\tftAdd(ft,i,a[i])\n\tend\n\tfor query in 1:q\n\t\tx,y,z = readline() |> split |> parseMap\n\t\tif x == 0\n\t\t\tftAdd(ft,y+1,z)\n\t\telse\n\t\t\tprintln(ftSum(ft,y,z))\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an array a_0, a_1, ..., a_{N-1} of length N. Process Q queries of the following types.\n\n0 p x: a_p \\gets a_p + x\n\n1 l r: Print \\sum_{i = l}^{r - 1}{a_i}.\n\nConstraints\n\n1 \\leq N, Q \\leq 500,000\n\n0 \\leq a_i, x \\leq 10^9\n\n0 \\leq p < N\n\n0 \\leq l_i < r_i \\leq N\n\nAll values in Input are integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\na_0 a_1 ... a_{N - 1}\n\\textrm{Query}_0\n\\textrm{Query}_1\n:\n\\textrm{Query}_{Q - 1}\n\nOutput\n\nFor each query of the latter type, print the answer.\n\nSample Input 1\n\n5 5\n1 2 3 4 5\n1 0 5\n1 2 4\n0 3 10\n1 0 5\n1 0 3\n\nSample Output 1\n\n15\n7\n25\n6", "sample_input": "5 5\n1 2 3 4 5\n1 0 5\n1 2 4\n0 3 10\n1 0 5\n1 0 3\n"}, "reference_outputs": ["15\n7\n25\n6\n"], "source_document_id": "p02559", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an array a_0, a_1, ..., a_{N-1} of length N. Process Q queries of the following types.\n\n0 p x: a_p \\gets a_p + x\n\n1 l r: Print \\sum_{i = l}^{r - 1}{a_i}.\n\nConstraints\n\n1 \\leq N, Q \\leq 500,000\n\n0 \\leq a_i, x \\leq 10^9\n\n0 \\leq p < N\n\n0 \\leq l_i < r_i \\leq N\n\nAll values in Input are integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\na_0 a_1 ... a_{N - 1}\n\\textrm{Query}_0\n\\textrm{Query}_1\n:\n\\textrm{Query}_{Q - 1}\n\nOutput\n\nFor each query of the latter type, print the answer.\n\nSample Input 1\n\n5 5\n1 2 3 4 5\n1 0 5\n1 2 4\n0 3 10\n1 0 5\n1 0 3\n\nSample Output 1\n\n15\n7\n25\n6", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1668, "cpu_time_ms": 1069, "memory_kb": 230532}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s439508997", "group_id": "codeNet:p02559", "input_text": "using DataStructures\nparseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn,q = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tft = FenwickTree(a)\n\tfor query in 1:q\n\t\tx,y,z = readline() |> split |> parseMap\n\t\tif x == 0\n\t\t\tinc!(ft,y+1,z)\n\t\telse\n\t\t\tprintln(prefixsum(ft,z)-(y>0 ? prefixsum(ft,y) : 0))\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1599993844, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02559.html", "problem_id": "p02559", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02559/input.txt", "sample_output_relpath": "derived/input_output/data/p02559/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02559/Julia/s439508997.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s439508997", "user_id": "u095714878"}, "prompt_components": {"gold_output": "15\n7\n25\n6\n", "input_to_evaluate": "using DataStructures\nparseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn,q = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tft = FenwickTree(a)\n\tfor query in 1:q\n\t\tx,y,z = readline() |> split |> parseMap\n\t\tif x == 0\n\t\t\tinc!(ft,y+1,z)\n\t\telse\n\t\t\tprintln(prefixsum(ft,z)-(y>0 ? prefixsum(ft,y) : 0))\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given an array a_0, a_1, ..., a_{N-1} of length N. Process Q queries of the following types.\n\n0 p x: a_p \\gets a_p + x\n\n1 l r: Print \\sum_{i = l}^{r - 1}{a_i}.\n\nConstraints\n\n1 \\leq N, Q \\leq 500,000\n\n0 \\leq a_i, x \\leq 10^9\n\n0 \\leq p < N\n\n0 \\leq l_i < r_i \\leq N\n\nAll values in Input are integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\na_0 a_1 ... a_{N - 1}\n\\textrm{Query}_0\n\\textrm{Query}_1\n:\n\\textrm{Query}_{Q - 1}\n\nOutput\n\nFor each query of the latter type, print the answer.\n\nSample Input 1\n\n5 5\n1 2 3 4 5\n1 0 5\n1 2 4\n0 3 10\n1 0 5\n1 0 3\n\nSample Output 1\n\n15\n7\n25\n6", "sample_input": "5 5\n1 2 3 4 5\n1 0 5\n1 2 4\n0 3 10\n1 0 5\n1 0 3\n"}, "reference_outputs": ["15\n7\n25\n6\n"], "source_document_id": "p02559", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given an array a_0, a_1, ..., a_{N-1} of length N. Process Q queries of the following types.\n\n0 p x: a_p \\gets a_p + x\n\n1 l r: Print \\sum_{i = l}^{r - 1}{a_i}.\n\nConstraints\n\n1 \\leq N, Q \\leq 500,000\n\n0 \\leq a_i, x \\leq 10^9\n\n0 \\leq p < N\n\n0 \\leq l_i < r_i \\leq N\n\nAll values in Input are integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\na_0 a_1 ... a_{N - 1}\n\\textrm{Query}_0\n\\textrm{Query}_1\n:\n\\textrm{Query}_{Q - 1}\n\nOutput\n\nFor each query of the latter type, print the answer.\n\nSample Input 1\n\n5 5\n1 2 3 4 5\n1 0 5\n1 2 4\n0 3 10\n1 0 5\n1 0 3\n\nSample Output 1\n\n15\n7\n25\n6", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1483, "memory_kb": 274600}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s503675588", "group_id": "codeNet:p02560", "input_text": "function floor_sum(n, m, a, b)\n ans = 0\n if a >= m\n ans += (n - 1) * n * (a ÷ m) ÷ 2\n a %= m\n end\n if b >= m\n ans += n * (b ÷ m)\n b %= m\n end\n y_max = (a * n + b) ÷ m\n x_max = (y_max * m - b)\n if y_max == 0; return ans; end\n ans += (n - (x_max + a - 1) ÷ a) * y_max\n ans += floor_sum(y_max, a, m, (a - x_max % a) % a)\n return ans\nend\np()=parse.(Int,split(readline()))\nn=parse(Int,readline())\nfunction main()\n for i=1:n\n n,m,a,b=p()\n floor_sum(n,m,a,b) |> println\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1600016592, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02560.html", "problem_id": "p02560", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02560/input.txt", "sample_output_relpath": "derived/input_output/data/p02560/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02560/Julia/s503675588.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s503675588", "user_id": "u443151804"}, "prompt_components": {"gold_output": "3\n13\n0\n314095480\n499999999500000000\n", "input_to_evaluate": "function floor_sum(n, m, a, b)\n ans = 0\n if a >= m\n ans += (n - 1) * n * (a ÷ m) ÷ 2\n a %= m\n end\n if b >= m\n ans += n * (b ÷ m)\n b %= m\n end\n y_max = (a * n + b) ÷ m\n x_max = (y_max * m - b)\n if y_max == 0; return ans; end\n ans += (n - (x_max + a - 1) ÷ a) * y_max\n ans += floor_sum(y_max, a, m, (a - x_max % a) % a)\n return ans\nend\np()=parse.(Int,split(readline()))\nn=parse(Int,readline())\nfunction main()\n for i=1:n\n n,m,a,b=p()\n floor_sum(n,m,a,b) |> println\n end\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn this problem, you should process T testcases.\n\nFor each testcase, you are given four integers N, M, A, B.\n\nCalculate \\sum_{i = 0}^{N - 1} floor((A \\times i + B) / M).\n\nConstraints\n\n1 \\leq T \\leq 100,000\n\n1 \\leq N, M \\leq 10^9\n\n0 \\leq A, B < M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT\nN_0 M_0 A_0 B_0\nN_1 M_1 A_1 B_1\n:\nN_{T - 1} M_{T - 1} A_{T - 1} B_{T - 1}\n\nOutput\n\nPrint the answer for each testcase.\n\nSample Input 1\n\n5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n\nSample Output 1\n\n3\n13\n0\n314095480\n499999999500000000", "sample_input": "5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n"}, "reference_outputs": ["3\n13\n0\n314095480\n499999999500000000\n"], "source_document_id": "p02560", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn this problem, you should process T testcases.\n\nFor each testcase, you are given four integers N, M, A, B.\n\nCalculate \\sum_{i = 0}^{N - 1} floor((A \\times i + B) / M).\n\nConstraints\n\n1 \\leq T \\leq 100,000\n\n1 \\leq N, M \\leq 10^9\n\n0 \\leq A, B < M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nT\nN_0 M_0 A_0 B_0\nN_1 M_1 A_1 B_1\n:\nN_{T - 1} M_{T - 1} A_{T - 1} B_{T - 1}\n\nOutput\n\nPrint the answer for each testcase.\n\nSample Input 1\n\n5\n4 10 6 3\n6 5 4 3\n1 1 0 0\n31415 92653 58979 32384\n1000000000 1000000000 999999999 999999999\n\nSample Output 1\n\n3\n13\n0\n314095480\n499999999500000000", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 418, "memory_kb": 206640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s136798520", "group_id": "codeNet:p02570", "input_text": "d,t,s=parse.(Float,split(readline()))\ns*t>d ? \"Yes\" : \"No\" |> println", "language": "Julia", "metadata": {"date": 1599295721, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s136798520.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s136798520", "user_id": "u443151804"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "d,t,s=parse.(Float,split(readline()))\ns*t>d ? \"Yes\" : \"No\" |> println", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1249, "memory_kb": 274076}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s610628625", "group_id": "codeNet:p02570", "input_text": "parseInt(x) = parse(Int128, x)\nparseFloat(x) = parse(BigFloat, x)\n#parseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n D,T,S = parseMap(split(readline()))\n if D/S <= T\n println(\"Yes\")\n else\n println(\"No\")\n end\n\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1598727711, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s610628625.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s610628625", "user_id": "u524573278"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int128, x)\nparseFloat(x) = parse(BigFloat, x)\n#parseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n D,T,S = parseMap(split(readline()))\n if D/S <= T\n println(\"Yes\")\n else\n println(\"No\")\n end\n\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 398, "memory_kb": 189484}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s322619686", "group_id": "codeNet:p02571", "input_text": "import Base: -\nfunction -(s::AbstractString, t::AbstractString)\n res = 0\n for n in 1:length(s)\n s[n]≠t[n] && (res+=1)\n end\n return res\nend\nfunction main()\n S, T = readlines()\n len = length(T)\n t = len\n for n in 1:length(S)-len+1\n temp = S[n:n+len-1] - T\n temp < t && (t=temp)\n end\n return println(t)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1598879146, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s322619686.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s322619686", "user_id": "u728564399"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import Base: -\nfunction -(s::AbstractString, t::AbstractString)\n res = 0\n for n in 1:length(s)\n s[n]≠t[n] && (res+=1)\n end\n return res\nend\nfunction main()\n S, T = readlines()\n len = length(T)\n t = len\n for n in 1:length(S)-len+1\n temp = S[n:n+len-1] - T\n temp < t && (t=temp)\n end\n return println(t)\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 249, "memory_kb": 169916}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s410415945", "group_id": "codeNet:p02571", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nS = collect(chomp(readline()))\nT = collect(chomp(readline()))\n\n\nfunction count_change(S, T)\n count = 0\n for (s, t) in zip(S, T)\n if s != t\n count += 1\n end\n end\n return count\nend\n\nfunction main()\nmin_count = 100000\nfor i in 1:length(S) - length(T)\n now_count = count_change(S[i:i+length(T)], T)\n if min_count > now_count\n min_count = now_count\n end\nend\n\nprintln(min_count)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1598728152, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s410415945.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s410415945", "user_id": "u879294842"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nS = collect(chomp(readline()))\nT = collect(chomp(readline()))\n\n\nfunction count_change(S, T)\n count = 0\n for (s, t) in zip(S, T)\n if s != t\n count += 1\n end\n end\n return count\nend\n\nfunction main()\nmin_count = 100000\nfor i in 1:length(S) - length(T)\n now_count = count_change(S[i:i+length(T)], T)\n if min_count > now_count\n min_count = now_count\n end\nend\n\nprintln(min_count)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 526, "cpu_time_ms": 251, "memory_kb": 166904}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s222325351", "group_id": "codeNet:p02573", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N, M = readint()\n \n G = Vector{Vector{int}}(undef,N)\n for i in 1:N \n G[i] = Vector{int}(undef,0)\n end\n for i in 1:M\n A,B = readint()\n append!(G[A],[B])\n append!(G[B],[A])\n end\n \n checked = Vector{Bool}(undef,N)\n checked .= false\n\n Q = Queue{int}()\n smax = 0\n for i in 1:N\n if checked[i]\n continue\n end\n enqueue!(Q,i)\n s = 0\n\n while true\n if isempty(Q)\n break\n end\n a = dequeue!(Q)\n s += 1\n\n for b in G[a]\n if ! checked[b]\n enqueue!(Q,i)\n checked[b]=true\n end\n end\n end\n if smax < s\n smax = s\n end\n #println(G)\n\n end\n println(smax)\n \n \n\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1598729138, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02573.html", "problem_id": "p02573", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02573/input.txt", "sample_output_relpath": "derived/input_output/data/p02573/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02573/Julia/s222325351.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s222325351", "user_id": "u868531879"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N, M = readint()\n \n G = Vector{Vector{int}}(undef,N)\n for i in 1:N \n G[i] = Vector{int}(undef,0)\n end\n for i in 1:M\n A,B = readint()\n append!(G[A],[B])\n append!(G[B],[A])\n end\n \n checked = Vector{Bool}(undef,N)\n checked .= false\n\n Q = Queue{int}()\n smax = 0\n for i in 1:N\n if checked[i]\n continue\n end\n enqueue!(Q,i)\n s = 0\n\n while true\n if isempty(Q)\n break\n end\n a = dequeue!(Q)\n s += 1\n\n for b in G[a]\n if ! checked[b]\n enqueue!(Q,i)\n checked[b]=true\n end\n end\n end\n if smax < s\n smax = s\n end\n #println(G)\n\n end\n println(smax)\n \n \n\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N persons called Person 1 through Person N.\n\nYou are given M facts that \"Person A_i and Person B_i are friends.\" The same fact may be given multiple times.\n\nIf X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts.\n\nTakahashi the evil wants to divide the N persons into some number of groups so that every person has no friend in his/her group.\n\nAt least how many groups does he need to make?\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\leq M \\leq 2\\times 10^5\n\n1\\leq A_i,B_i\\leq N\n\nA_i \\neq B_i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n\\vdots\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5 3\n1 2\n3 4\n5 1\n\nSample Output 1\n\n3\n\nDividing them into three groups such as \\{1,3\\}, \\{2,4\\}, and \\{5\\} achieves the goal.\n\nSample Input 2\n\n4 10\n1 2\n2 1\n1 2\n2 1\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4\n\nSample Output 2\n\n4\n\nSample Input 3\n\n10 4\n3 1\n4 1\n5 9\n2 6\n\nSample Output 3\n\n3", "sample_input": "5 3\n1 2\n3 4\n5 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02573", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N persons called Person 1 through Person N.\n\nYou are given M facts that \"Person A_i and Person B_i are friends.\" The same fact may be given multiple times.\n\nIf X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts.\n\nTakahashi the evil wants to divide the N persons into some number of groups so that every person has no friend in his/her group.\n\nAt least how many groups does he need to make?\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n0 \\leq M \\leq 2\\times 10^5\n\n1\\leq A_i,B_i\\leq N\n\nA_i \\neq B_i\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n\\vdots\nA_M B_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n5 3\n1 2\n3 4\n5 1\n\nSample Output 1\n\n3\n\nDividing them into three groups such as \\{1,3\\}, \\{2,4\\}, and \\{5\\} achieves the goal.\n\nSample Input 2\n\n4 10\n1 2\n2 1\n1 2\n2 1\n1 2\n1 3\n1 4\n2 3\n2 4\n3 4\n\nSample Output 2\n\n4\n\nSample Input 3\n\n10 4\n3 1\n4 1\n5 9\n2 6\n\nSample Output 3\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 837, "cpu_time_ms": 913, "memory_kb": 248316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s573493922", "group_id": "codeNet:p02576", "input_text": "using Parsers\n\nfunction parse_numbers(s)\n pieces = split(s, ' ', keepempty=false)\n map(pieces) do piece\n parse(Float64, piece)\n end\nend\n\nstring = \"1000 1 1000\"\n\nn, x, t = parse_numbers(string)\n\nt = ceil(n / x) * t\n\n\n", "language": "Julia", "metadata": {"date": 1598271069, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02576.html", "problem_id": "p02576", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02576/input.txt", "sample_output_relpath": "derived/input_output/data/p02576/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02576/Julia/s573493922.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s573493922", "user_id": "u739732146"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "using Parsers\n\nfunction parse_numbers(s)\n pieces = split(s, ' ', keepempty=false)\n map(pieces) do piece\n parse(Float64, piece)\n end\nend\n\nstring = \"1000 1 1000\"\n\nn, x, t = parse_numbers(string)\n\nt = ceil(n / x) * t\n\n\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "sample_input": "20 12 6\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02576", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1267, "memory_kb": 272644}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s547692760", "group_id": "codeNet:p02576", "input_text": "parseInt(x) = parse(Int128, x)\nparseFloat(x) = parse(BigFloat, x)\n#parseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n N,X,T = parseMap(split(readline()))\n if div(N,X) == N/X\n ans = T*div(N,X)\n else\n ans = T*(div(N,X)+1)\n end\n println(Int128(ans))\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1598123570, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02576.html", "problem_id": "p02576", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02576/input.txt", "sample_output_relpath": "derived/input_output/data/p02576/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02576/Julia/s547692760.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s547692760", "user_id": "u524573278"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "parseInt(x) = parse(Int128, x)\nparseFloat(x) = parse(BigFloat, x)\n#parseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n N,X,T = parseMap(split(readline()))\n if div(N,X) == N/X\n ans = T*div(N,X)\n else\n ans = T*(div(N,X)+1)\n end\n println(Int128(ans))\nend\nmain()\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "sample_input": "20 12 6\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02576", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 463, "memory_kb": 191848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s699959946", "group_id": "codeNet:p02576", "input_text": "# %% constants & libraries\n# ------------------------\n\n# %% body\n# -------\n\nfunction main(io = stdin)\n readto(target = '\\n') = readuntil(io, target)\n readnum(T::Type{<:Number} = Int; dlm = isspace, kwargs...) =\n parse.(T, split(readto(), dlm; kwargs...))::Vector{T}\n\n # handle IO and and stuff\n N, X, T = readnum()\n println(ceil(Int, N/X) * T)\nend\n\nfunction solve()\n # ...\nend\n\n@static if @isdefined(Juno) || @isdefined(VSCodeServer)\n main(open(replace(@__FILE__, r\"(.+)\\.jl\" => s\"\\1.in\")))\nelse\n main()\nend\n", "language": "Julia", "metadata": {"date": 1598122990, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02576.html", "problem_id": "p02576", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02576/input.txt", "sample_output_relpath": "derived/input_output/data/p02576/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02576/Julia/s699959946.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s699959946", "user_id": "u585742242"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "# %% constants & libraries\n# ------------------------\n\n# %% body\n# -------\n\nfunction main(io = stdin)\n readto(target = '\\n') = readuntil(io, target)\n readnum(T::Type{<:Number} = Int; dlm = isspace, kwargs...) =\n parse.(T, split(readto(), dlm; kwargs...))::Vector{T}\n\n # handle IO and and stuff\n N, X, T = readnum()\n println(ceil(Int, N/X) * T)\nend\n\nfunction solve()\n # ...\nend\n\n@static if @isdefined(Juno) || @isdefined(VSCodeServer)\n main(open(replace(@__FILE__, r\"(.+)\\.jl\" => s\"\\1.in\")))\nelse\n main()\nend\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "sample_input": "20 12 6\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02576", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi loves takoyaki - a ball-shaped snack.\n\nWith a takoyaki machine, he can make at most X pieces of takoyaki at a time, taking T minutes regardless of the number of pieces to make.\n\nHow long does it take to make N takoyaki?\n\nConstraints\n\n1 \\leq N,X,T \\leq 1000\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN X T\n\nOutput\n\nPrint an integer representing the minimum number of minutes needed to make N pieces of takoyaki.\n\nSample Input 1\n\n20 12 6\n\nSample Output 1\n\n12\n\nHe can make 12 pieces of takoyaki in the first 6 minutes and 8 more in the next 6 minutes, so he can make 20 in a total of 12 minutes.\n\nNote that being able to make 12 in 6 minutes does not mean he can make 2 in 1 minute.\n\nSample Input 2\n\n1000 1 1000\n\nSample Output 2\n\n1000000\n\nIt seems to take a long time to make this kind of takoyaki.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 539, "cpu_time_ms": 359, "memory_kb": 189572}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s533281688", "group_id": "codeNet:p02577", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=sum(parseMap(split(readline(),\"\")))\n if n%9==0\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1598271503, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s533281688.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s533281688", "user_id": "u619197965"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=sum(parseMap(split(readline(),\"\")))\n if n%9==0\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 245, "memory_kb": 196276}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s620765979", "group_id": "codeNet:p02577", "input_text": "function main()\n S = readline()\n x = 0\n for s in S\n x += parse(Int, s)\n end\n if x % 9 == 0\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1598123141, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s620765979.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s620765979", "user_id": "u624923345"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n S = readline()\n x = 0\n for s in S\n x += parse(Int, s)\n end\n if x % 9 == 0\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 186, "memory_kb": 154232}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s751662911", "group_id": "codeNet:p02578", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n A = readint()\n\n sum = 0\n H = A[1]\n\n for i in 2:N\n if A[i] < H \n sum += H-A[i]\n else\n H = A[i]\n end\n end\n println(sum)\n\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1598123574, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s751662911.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s751662911", "user_id": "u868531879"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n A = readint()\n\n sum = 0\n H = A[1]\n\n for i in 2:N\n if A[i] < H \n sum += H-A[i]\n else\n H = A[i]\n end\n end\n println(sum)\n\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 562, "memory_kb": 208444}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s974143925", "group_id": "codeNet:p02579", "input_text": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nconst inf = typemax(Int)\nconst direction_walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]\nconst direction_warp = [[i, j] for i in -2:2, j in -2:2 if [i, j]≠[0,0] && [i, j]∉direction_walk]\nfunction WizardInMaze()\n data = readlines()\n H, W = parseline(data[1])\n start = parseline(data[2])\n goal = parseline(data[3])\n S = zeros(Int, H, W)\n for h in 1:H\n @inbounds S[h, :] = @views [d=='.' ? 0 : 1 for d in data[3+h]]\n end\n que = PriorityQueue{Int, Vector{Vector{Int}}}()\n enqueue!(que, 0, [start])\n cost = fill(inf, H, W)\n cost[start[1], start[2]] = 0\n while false ∈ [length(que[k])≡0 for k in keys(que)]\n while length(peek(que).second)≡0\n dequeue!(que)\n end\n node = popfirst!(peek(que).second)\n now = peek(que).first\n now > cost[node[1], node[2]] && continue\n for edge in 0:1\n direction = edge≡0 ? direction_walk : direction_warp\n for d in direction\n h, w = node + d\n !(1≤h≤H) && (h = min(max(h, 1), H))\n !(1≤w≤W) && (w = min(max(w, 1), W))\n next_cost = cost[node[1], node[2]] + edge\n S[h, w]≡0 && (cost[h, w] > next_cost) && (\n haskey(que, next_cost) ? push!(que[next_cost], [h, w]) : enqueue!(que, next_cost, [[h, w]]); \n cost[h, w] = next_cost\n )\n end\n end\n end\n ans = cost[goal[1], goal[2]]≡inf ? -1 : cost[goal[1], goal[2]]\n println(ans)\nend\nWizardInMaze()", "language": "Julia", "metadata": {"date": 1599273544, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s974143925.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s974143925", "user_id": "u728564399"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nconst inf = typemax(Int)\nconst direction_walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]\nconst direction_warp = [[i, j] for i in -2:2, j in -2:2 if [i, j]≠[0,0] && [i, j]∉direction_walk]\nfunction WizardInMaze()\n data = readlines()\n H, W = parseline(data[1])\n start = parseline(data[2])\n goal = parseline(data[3])\n S = zeros(Int, H, W)\n for h in 1:H\n @inbounds S[h, :] = @views [d=='.' ? 0 : 1 for d in data[3+h]]\n end\n que = PriorityQueue{Int, Vector{Vector{Int}}}()\n enqueue!(que, 0, [start])\n cost = fill(inf, H, W)\n cost[start[1], start[2]] = 0\n while false ∈ [length(que[k])≡0 for k in keys(que)]\n while length(peek(que).second)≡0\n dequeue!(que)\n end\n node = popfirst!(peek(que).second)\n now = peek(que).first\n now > cost[node[1], node[2]] && continue\n for edge in 0:1\n direction = edge≡0 ? direction_walk : direction_warp\n for d in direction\n h, w = node + d\n !(1≤h≤H) && (h = min(max(h, 1), H))\n !(1≤w≤W) && (w = min(max(w, 1), W))\n next_cost = cost[node[1], node[2]] + edge\n S[h, w]≡0 && (cost[h, w] > next_cost) && (\n haskey(que, next_cost) ? push!(que[next_cost], [h, w]) : enqueue!(que, next_cost, [[h, w]]); \n cost[h, w] = next_cost\n )\n end\n end\n end\n ans = cost[goal[1], goal[2]]≡inf ? -1 : cost[goal[1], goal[2]]\n println(ans)\nend\nWizardInMaze()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1612, "cpu_time_ms": 2214, "memory_kb": 314756}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s516729204", "group_id": "codeNet:p02579", "input_text": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nconst inf = typemax(Int)\nconst direction_walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]\nconst direction_warp = [[i, j] for i in -2:2, j in -2:2 if [i, j]≠[0,0] && [i, j]∉direction_walk]\nfunction WizardInMaze()\n data = readlines()\n H, W = parseline(data[1])\n start = parseline(data[2])\n goal = parseline(data[3])\n S = zeros(Int, H, W)\n for h in 1:H\n S[h, :] = [d=='.' ? 0 : 1 for d in data[3+h]]\n end\n queue = Deque{Vector{Int}}()\n push!(queue, start)\n que_dist = Deque{Int}()\n push!(que_dist, 0)\n cost = fill(inf, H, W)\n cost[start[1], start[2]] = 0\n while !isempty(queue)\n node = popfirst!(queue)\n now = popfirst!(que_dist)\n now > cost[node[1], node[2]] && continue\n for edge in 0:1\n direction = edge==0 ? direction_walk : direction_warp\n for d in direction\n h, w = node + d\n !(1≤h≤H) && (h = min(max(h, 1), H))\n !(1≤w≤W) && (w = min(max(w, 1), W))\n next_cost = cost[node[1], node[2]] + edge\n S[h, w]≡0 && (cost[h, w] > next_cost) && (\n edge==0 ? pushfirst!(queue, [h, w]) : push!(queue, [h, w]); \n cost[h, w] = next_cost\n )\n end\n end\n end\n ans = cost[goal[1], goal[2]]==inf ? -1 : cost[goal[1], goal[2]]\n println(ans)\nend\nWizardInMaze()", "language": "Julia", "metadata": {"date": 1599269107, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s516729204.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s516729204", "user_id": "u728564399"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nconst inf = typemax(Int)\nconst direction_walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]\nconst direction_warp = [[i, j] for i in -2:2, j in -2:2 if [i, j]≠[0,0] && [i, j]∉direction_walk]\nfunction WizardInMaze()\n data = readlines()\n H, W = parseline(data[1])\n start = parseline(data[2])\n goal = parseline(data[3])\n S = zeros(Int, H, W)\n for h in 1:H\n S[h, :] = [d=='.' ? 0 : 1 for d in data[3+h]]\n end\n queue = Deque{Vector{Int}}()\n push!(queue, start)\n que_dist = Deque{Int}()\n push!(que_dist, 0)\n cost = fill(inf, H, W)\n cost[start[1], start[2]] = 0\n while !isempty(queue)\n node = popfirst!(queue)\n now = popfirst!(que_dist)\n now > cost[node[1], node[2]] && continue\n for edge in 0:1\n direction = edge==0 ? direction_walk : direction_warp\n for d in direction\n h, w = node + d\n !(1≤h≤H) && (h = min(max(h, 1), H))\n !(1≤w≤W) && (w = min(max(w, 1), W))\n next_cost = cost[node[1], node[2]] + edge\n S[h, w]≡0 && (cost[h, w] > next_cost) && (\n edge==0 ? pushfirst!(queue, [h, w]) : push!(queue, [h, w]); \n cost[h, w] = next_cost\n )\n end\n end\n end\n ans = cost[goal[1], goal[2]]==inf ? -1 : cost[goal[1], goal[2]]\n println(ans)\nend\nWizardInMaze()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1463, "cpu_time_ms": 2059, "memory_kb": 320524}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s914335090", "group_id": "codeNet:p02579", "input_text": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nconst inf = typemax(Int)\nconst direction_walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]\nconst direction_warp = [[i, j] for i in -2:2, j in -2:2 if [i, j]≠[0,0] && [i, j]∉direction_walk]\nfunction WizardInMaze()\n data = readlines()\n H, W = parseline(data[1])\n start = parseline(data[2])\n goal = parseline(data[3])\n S = zeros(Int, H, W)\n for h in 1:H\n S[h, :] = [d=='.' ? 0 : 1 for d in data[3+h]]\n end\n queue = Deque{Vector{Int}}()\n push!(queue, start)\n cost = fill(inf, H, W)\n cost[start[1], start[2]] = 0\n while !isempty(queue)\n node = popfirst!(queue)\n for edge in 0:1\n direction = edge==0 ? direction_walk : direction_warp\n for d in direction\n h, w = node + d\n !(1≤h≤H) && (h = min(max(h, 1), H))\n !(1≤w≤W) && (w = min(max(w, 1), W))\n next_cost = cost[node[1], node[2]] + edge\n S[h, w]≡0 && (cost[h, w] > next_cost) && (\n edge==0 ? pushfirst!(queue, [h, w]) : push!(queue, [h, w]); \n cost[h, w] = next_cost\n )\n end\n end\n end\n ans = cost[goal[1], goal[2]]==inf ? -1 : cost[goal[1], goal[2]]\n println(ans)\nend\nWizardInMaze()", "language": "Julia", "metadata": {"date": 1599268928, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s914335090.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s914335090", "user_id": "u728564399"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nconst inf = typemax(Int)\nconst direction_walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]\nconst direction_warp = [[i, j] for i in -2:2, j in -2:2 if [i, j]≠[0,0] && [i, j]∉direction_walk]\nfunction WizardInMaze()\n data = readlines()\n H, W = parseline(data[1])\n start = parseline(data[2])\n goal = parseline(data[3])\n S = zeros(Int, H, W)\n for h in 1:H\n S[h, :] = [d=='.' ? 0 : 1 for d in data[3+h]]\n end\n queue = Deque{Vector{Int}}()\n push!(queue, start)\n cost = fill(inf, H, W)\n cost[start[1], start[2]] = 0\n while !isempty(queue)\n node = popfirst!(queue)\n for edge in 0:1\n direction = edge==0 ? direction_walk : direction_warp\n for d in direction\n h, w = node + d\n !(1≤h≤H) && (h = min(max(h, 1), H))\n !(1≤w≤W) && (w = min(max(w, 1), W))\n next_cost = cost[node[1], node[2]] + edge\n S[h, w]≡0 && (cost[h, w] > next_cost) && (\n edge==0 ? pushfirst!(queue, [h, w]) : push!(queue, [h, w]); \n cost[h, w] = next_cost\n )\n end\n end\n end\n ans = cost[goal[1], goal[2]]==inf ? -1 : cost[goal[1], goal[2]]\n println(ans)\nend\nWizardInMaze()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1329, "cpu_time_ms": 2126, "memory_kb": 276372}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s869366213", "group_id": "codeNet:p02579", "input_text": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nfunction WizardInMaze()\n data = readlines()\n H, W = parseline(data[1])\n start = parseline(data[2])\n goal = parseline(data[3])\n S = zeros(Int, H, W)\n for h in 1:H\n S[h, :] = [d=='.' ? 0 : 1 for d in data[3+h]]\n end\n queue = Deque{Vector{Int}}()\n push!(queue, start)\n que_dist = Deque{Int}()\n push!(que_dist, 0)\n inf = typemax(Int)\n cost = fill(inf, H, W)\n cost[start[1], start[2]] = 0\n direction_walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]\n direction_warp = [[i, j] for i in -2:2, j in -2:2 if [i, j]≠[0,0] && [i, j]∉direction_walk]\n while !isempty(queue)\n node = popfirst!(queue)\n now = popfirst!(que_dist)\n for edge in 0:1\n Wa = edge==0 ? direction_walk : direction_warp\n for d in Wa\n h, w = node + d\n !(1≤h≤H) && (h = min(max(h, 1), H))\n !(1≤w≤W) && (w = min(max(w, 1), W))\n next_cost = cost[node[1], node[2]] + edge\n# now < next_cost && continue\n S[h, w]≡0 && (cost[h, w] > next_cost) && (\n edge==0 ? (pushfirst!(queue, [h, w]);pushfirst!(que_dist, next_cost)) : (push!(queue, [h, w]);push!(que_dist, next_cost)); \n cost[h, w] = next_cost\n )\n end\n end\n end\n ans = cost[goal[1], goal[2]]==inf ? -1 : cost[goal[1], goal[2]]\n println(ans)\nend\nWizardInMaze()", "language": "Julia", "metadata": {"date": 1599268101, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s869366213.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s869366213", "user_id": "u728564399"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nfunction WizardInMaze()\n data = readlines()\n H, W = parseline(data[1])\n start = parseline(data[2])\n goal = parseline(data[3])\n S = zeros(Int, H, W)\n for h in 1:H\n S[h, :] = [d=='.' ? 0 : 1 for d in data[3+h]]\n end\n queue = Deque{Vector{Int}}()\n push!(queue, start)\n que_dist = Deque{Int}()\n push!(que_dist, 0)\n inf = typemax(Int)\n cost = fill(inf, H, W)\n cost[start[1], start[2]] = 0\n direction_walk = [[0, 1], [0, -1], [1, 0], [-1, 0]]\n direction_warp = [[i, j] for i in -2:2, j in -2:2 if [i, j]≠[0,0] && [i, j]∉direction_walk]\n while !isempty(queue)\n node = popfirst!(queue)\n now = popfirst!(que_dist)\n for edge in 0:1\n Wa = edge==0 ? direction_walk : direction_warp\n for d in Wa\n h, w = node + d\n !(1≤h≤H) && (h = min(max(h, 1), H))\n !(1≤w≤W) && (w = min(max(w, 1), W))\n next_cost = cost[node[1], node[2]] + edge\n# now < next_cost && continue\n S[h, w]≡0 && (cost[h, w] > next_cost) && (\n edge==0 ? (pushfirst!(queue, [h, w]);pushfirst!(que_dist, next_cost)) : (push!(queue, [h, w]);push!(que_dist, next_cost)); \n cost[h, w] = next_cost\n )\n end\n end\n end\n ans = cost[goal[1], goal[2]]==inf ? -1 : cost[goal[1], goal[2]]\n println(ans)\nend\nWizardInMaze()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1503, "cpu_time_ms": 2085, "memory_kb": 285772}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s099171141", "group_id": "codeNet:p02579", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nconst INF=1<<32\nconst h,w=parseMap(split(readline()))\nconst sh,sw=parseMap(split(readline()))\nconst gh,gw=parseMap(split(readline()))\nconst s=[readline() for _=1:h]\nfunction main()\n warp::Array{Int,2}=fill(INF,h,w)\n warp[sh,sw]=0\n q::Vector{Tuple{Int,Int}}=[(sh,sw)]\n while !isempty(q)\n (nowh::Int,noww::Int)=popfirst!(q)\n for i=nowh-2:nowh+2\n for j=noww-2:noww+2\n if i<1 || h1)\n while !isempty(st)\n p = dequeue!(st)\n if p == d\n reachable = true\n break\n end\n for sa in [(-1,0),(1,0),(0,-1),(0,1)]\n sp = p.+sa\n if 0 < sp[1] <= H && 0 < sp[2] <= W\n if wcs[sp...]==0 && kabe[sp...]\n wcs[sp...] = wcs[p...]\n enqueue!(st, sp=>wcs[sp...])\n end\n end\n end\n for ij in [(-2,-2),(-2,-1),(-2,0),(-2,1),(-2,2),(-1,-2),(-1,-1),(-1,1),(-1,2),(0,-2),(0,2),(1,-2),(1,-1),(1,1),(1,2),(2,-2),(2,-1),(2,0),(2,1),(2,2)]\n i,j = ij\n rp = p[1]+i,p[2]+j\n if 0 < rp[1] <= H && 0 < rp[2] <= W && kabe[rp...] && (wcs[rp...] == 0 || wcs[rp...] > wcs[p...]+1)\n wcs[rp...] = wcs[p...]+1\n enqueue!(st, rp=>wcs[rp...])\n end\n end\n end\n println(reachable ? wcs[d...]-1 : -1)\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1598131727, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s250236344.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s250236344", "user_id": "u729767359"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "using DataStructures\nfunction main()\n H,W = reads(Int,Int)\n c = reads(Int,Int)\n d = reads(Int,Int)\n kabe = zeros(Bool, H,W)\n for i in 1:H\n s = pread(String)\n for j in 1:W\n kabe[i,j] = s[j] == '.'\n end\n end\n reachable = false\n wcs = zeros(Int, H, W)\n wcs[c...] = 1\n st = PriorityQueue{Tuple{Int,Int},Int}()\n enqueue!(st, c=>1)\n while !isempty(st)\n p = dequeue!(st)\n if p == d\n reachable = true\n break\n end\n for sa in [(-1,0),(1,0),(0,-1),(0,1)]\n sp = p.+sa\n if 0 < sp[1] <= H && 0 < sp[2] <= W\n if wcs[sp...]==0 && kabe[sp...]\n wcs[sp...] = wcs[p...]\n enqueue!(st, sp=>wcs[sp...])\n end\n end\n end\n for ij in [(-2,-2),(-2,-1),(-2,0),(-2,1),(-2,2),(-1,-2),(-1,-1),(-1,1),(-1,2),(0,-2),(0,2),(1,-2),(1,-1),(1,1),(1,2),(2,-2),(2,-1),(2,0),(2,1),(2,2)]\n i,j = ij\n rp = p[1]+i,p[2]+j\n if 0 < rp[1] <= H && 0 < rp[2] <= W && kabe[rp...] && (wcs[rp...] == 0 || wcs[rp...] > wcs[p...]+1)\n wcs[rp...] = wcs[p...]+1\n enqueue!(st, rp=>wcs[rp...])\n end\n end\n end\n println(reachable ? wcs[d...]-1 : -1)\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2825, "cpu_time_ms": 1755, "memory_kb": 274060}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s790095613", "group_id": "codeNet:p02579", "input_text": "function main()\n H,W = reads(Int,Int)\n c = reads(Int,Int)\n d = reads(Int,Int)\n kabe = zeros(Bool, H,W)\n for i in 1:H\n s = pread(String)\n for j in 1:W\n kabe[i,j] = s[j] == '.'\n end\n end\n reachable = false\n checked = zeros(Bool, H,W)\n checked[c...] = true\n wcs = zeros(Int, H, W)\n wcs[c...] = 1\n st = Set([c])\n ss = Set(Tuple{Int,Int}[])\n while !isempty(st)\n while !isempty(st)\n p = pop!(st)\n if p == d\n reachable = true\n st = []\n ss = []\n break\n end\n for sa in [(-1,0),(1,0),(0,-1),(0,1)]\n sp = p.+sa\n if 0 < sp[1] <= H && 0 < sp[2] <= W\n if !checked[sp...] && kabe[p...] == kabe[sp...]\n checked[sp...] = true\n wcs[sp...] = wcs[p...]\n push!(st, sp)\n end\n end\n end\n push!(ss, p)\n end\n while !isempty(ss)\n p = pop!(ss)\n for i in -2:2, j in -2:2\n rp = p[1]+i,p[2]+j\n if 0 < rp[1] <= H && 0 < rp[2] <= W && !checked[rp...] && kabe[rp...] && (wcs[rp...] == 0 || wcs[rp...] > wcs[p...]+1)\n checked[rp...] = true\n wcs[rp...] = wcs[p...]+1\n push!(st, rp)\n break\n end\n end\n end\n end\n println(reachable ? wcs[d...]-1 : -1)\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1598129102, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s790095613.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s790095613", "user_id": "u729767359"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n H,W = reads(Int,Int)\n c = reads(Int,Int)\n d = reads(Int,Int)\n kabe = zeros(Bool, H,W)\n for i in 1:H\n s = pread(String)\n for j in 1:W\n kabe[i,j] = s[j] == '.'\n end\n end\n reachable = false\n checked = zeros(Bool, H,W)\n checked[c...] = true\n wcs = zeros(Int, H, W)\n wcs[c...] = 1\n st = Set([c])\n ss = Set(Tuple{Int,Int}[])\n while !isempty(st)\n while !isempty(st)\n p = pop!(st)\n if p == d\n reachable = true\n st = []\n ss = []\n break\n end\n for sa in [(-1,0),(1,0),(0,-1),(0,1)]\n sp = p.+sa\n if 0 < sp[1] <= H && 0 < sp[2] <= W\n if !checked[sp...] && kabe[p...] == kabe[sp...]\n checked[sp...] = true\n wcs[sp...] = wcs[p...]\n push!(st, sp)\n end\n end\n end\n push!(ss, p)\n end\n while !isempty(ss)\n p = pop!(ss)\n for i in -2:2, j in -2:2\n rp = p[1]+i,p[2]+j\n if 0 < rp[1] <= H && 0 < rp[2] <= W && !checked[rp...] && kabe[rp...] && (wcs[rp...] == 0 || wcs[rp...] > wcs[p...]+1)\n checked[rp...] = true\n wcs[rp...] = wcs[p...]+1\n push!(st, rp)\n break\n end\n end\n end\n end\n println(reachable ? wcs[d...]-1 : -1)\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3071, "cpu_time_ms": 2212, "memory_kb": 256308}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s424445595", "group_id": "codeNet:p02584", "input_text": "function main()\n X,K,D = reads(Int,Int,Int)\n f = false\n s = sign(X)\n if log10(abs(X)) >= log10(K)+log10(D)\n println((abs(X) - K*D) * s)\n else\n hoge = X÷ D\n amari = X - D*hoge\n f = D/2 >= abs(amari)\n p = f ? 0 : 1\n p = iseven(K - hoge - (f ? 0 : 1)) ? p : 1-p\n println(abs((amari,(D - abs(amari)))[p+1]))\n end\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1597703646, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s424445595.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s424445595", "user_id": "u729767359"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n X,K,D = reads(Int,Int,Int)\n f = false\n s = sign(X)\n if log10(abs(X)) >= log10(K)+log10(D)\n println((abs(X) - K*D) * s)\n else\n hoge = X÷ D\n amari = X - D*hoge\n f = D/2 >= abs(amari)\n p = f ? 0 : 1\n p = iseven(K - hoge - (f ? 0 : 1)) ? p : 1-p\n println(abs((amari,(D - abs(amari)))[p+1]))\n end\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1895, "cpu_time_ms": 386, "memory_kb": 194528}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s184240011", "group_id": "codeNet:p02584", "input_text": "function F()\n X,K,D = parse.(BigInt,split(readline()))\n X = abs(X)\n if X >0\n a = Int(floor(X/D))\n if a > K\n println(abs(X-K*D))\n else\n x1 = X-a*D\n x2 = X-(a+1)*D\n if abs(x1)abs(x-D)\n println(abs(x-D))\n else\n println(abs(x+D))\n end\n end\n end\n \n \n \n \n else\n if K%2==0\n println(0)\n else\n println(D)\n end\n end\n \n \n \nend\nF()", "language": "Julia", "metadata": {"date": 1597520377, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s184240011.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s184240011", "user_id": "u409581352"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function F()\n X,K,D = parse.(BigInt,split(readline()))\n X = abs(X)\n if X >0\n a = Int(floor(X/D))\n if a > K\n println(abs(X-K*D))\n else\n x1 = X-a*D\n x2 = X-(a+1)*D\n if abs(x1)abs(x-D)\n println(abs(x-D))\n else\n println(abs(x+D))\n end\n end\n end\n \n \n \n \n else\n if K%2==0\n println(0)\n else\n println(D)\n end\n end\n \n \n \nend\nF()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 354, "memory_kb": 186960}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s555407684", "group_id": "codeNet:p02584", "input_text": "function F()\n X,K,D = parse.(BigInt,split(readline()))\n if X >0\n a = Int(floor(X/D))\n if a > K\n println(abs(X-K*D))\n else\n x1 = X-a*D\n x2 = X-(a+1)*D\n if abs(x1)abs(x-D)\n println(abs(x-D))\n else\n println(abs(x+D))\n end\n end\n end\n \n elseif X<0\n a = Int(floor(X/D))\n if a>K\n println(abs(X+K*D))\n else\n x1 = X+a*D\n x2 = X+(a+1)*D\n if abs(x1)abs(x-D)\n println(abs(x-D))\n else\n println(abs(x+D))\n end\n end\n end\n \n \n \n else\n if K%2==0\n println(0)\n else\n println(D)\n end\n end\n \n \n \nend\nF()", "language": "Julia", "metadata": {"date": 1597519802, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s555407684.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s555407684", "user_id": "u409581352"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function F()\n X,K,D = parse.(BigInt,split(readline()))\n if X >0\n a = Int(floor(X/D))\n if a > K\n println(abs(X-K*D))\n else\n x1 = X-a*D\n x2 = X-(a+1)*D\n if abs(x1)abs(x-D)\n println(abs(x-D))\n else\n println(abs(x+D))\n end\n end\n end\n \n elseif X<0\n a = Int(floor(X/D))\n if a>K\n println(abs(X+K*D))\n else\n x1 = X+a*D\n x2 = X+(a+1)*D\n if abs(x1)abs(x-D)\n println(abs(x-D))\n else\n println(abs(x+D))\n end\n end\n end\n \n \n \n else\n if K%2==0\n println(0)\n else\n println(D)\n end\n end\n \n \n \nend\nF()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 879, "cpu_time_ms": 381, "memory_kb": 188580}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s149508502", "group_id": "codeNet:p02585", "input_text": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nfunction findmax(arr, K)\n start = argmax(arr)\n L = length(arr)\n p = K ÷ L\n q = K % L\n if p ≥ 1\n s = q + L\n p -= 1\n else\n s = q\n end\n score = zeros(Int, s)\n score[1] = arr[start]\n for k in 2:s\n next = (start + k)%L + 1\n score[k] = score[k-1] + arr[next]\n end\n cycle = sum(arr)\n pl = cycle≥0 ? p*cycle : 0\n return maximum(score) + pl\nend\nfunction MovingPiece()\n data = readlines()\n N, K = parseline(data[1])\n P = parseline(data[2])\n C = parseline(data[3])\n dsets = IntDisjointSets(N)\n for n in 1:N\n union!(dsets, n, P[n])\n end\n for n in 1:N\n find_root!(dsets, n)\n end\n parents = dsets.parents\n group = Dict([n=>Int[] for n in unique(parents)])\n for n in 1:N\n push!(group[parents[n]], n)\n end\n group = [[C[vv] for vv in v] for v in values(group)]\n ans = maximum(findmax.(group, K))\n println(ans)\nend\nMovingPiece()", "language": "Julia", "metadata": {"date": 1599280125, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s149508502.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s149508502", "user_id": "u728564399"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nfunction findmax(arr, K)\n start = argmax(arr)\n L = length(arr)\n p = K ÷ L\n q = K % L\n if p ≥ 1\n s = q + L\n p -= 1\n else\n s = q\n end\n score = zeros(Int, s)\n score[1] = arr[start]\n for k in 2:s\n next = (start + k)%L + 1\n score[k] = score[k-1] + arr[next]\n end\n cycle = sum(arr)\n pl = cycle≥0 ? p*cycle : 0\n return maximum(score) + pl\nend\nfunction MovingPiece()\n data = readlines()\n N, K = parseline(data[1])\n P = parseline(data[2])\n C = parseline(data[3])\n dsets = IntDisjointSets(N)\n for n in 1:N\n union!(dsets, n, P[n])\n end\n for n in 1:N\n find_root!(dsets, n)\n end\n parents = dsets.parents\n group = Dict([n=>Int[] for n in unique(parents)])\n for n in 1:N\n push!(group[parents[n]], n)\n end\n group = [[C[vv] for vv in v] for v in values(group)]\n ans = maximum(findmax.(group, K))\n println(ans)\nend\nMovingPiece()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1023, "cpu_time_ms": 845, "memory_kb": 221220}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s058678931", "group_id": "codeNet:p02585", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,k=parseMap(split(readline()))\n p=parseMap(split(readline()))\n c=parseMap(split(readline()))\n ans=-2<<40\n for i in 1:n\n now=i\n owari=0\n flags=fill(false,n)\n ruiseki=zeros(Int,n+1)\n for j in 1:n\n now=p[now]\n if flags[now]\n break\n end\n owari+=1\n flags[now]=true\n ruiseki[j+1]=ruiseki[j]+c[now]\n end\n # res=maximum(ruiseki[2:min(k,owari)+1])\n ans=max(ans,maximum(ruiseki[2:min(k,owari)+1]))\n # println(\"$ruiseki $owari $res\")\n if k>n\n res2=k÷owari*ruiseki[owari+1]\n if k%owari>0\n res2+=ruiseki[k%owari+1]\n end\n ans=max(ans,res2)\n # println(\"res2:$res2\")\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1597715496, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s058678931.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s058678931", "user_id": "u619197965"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,k=parseMap(split(readline()))\n p=parseMap(split(readline()))\n c=parseMap(split(readline()))\n ans=-2<<40\n for i in 1:n\n now=i\n owari=0\n flags=fill(false,n)\n ruiseki=zeros(Int,n+1)\n for j in 1:n\n now=p[now]\n if flags[now]\n break\n end\n owari+=1\n flags[now]=true\n ruiseki[j+1]=ruiseki[j]+c[now]\n end\n # res=maximum(ruiseki[2:min(k,owari)+1])\n ans=max(ans,maximum(ruiseki[2:min(k,owari)+1]))\n # println(\"$ruiseki $owari $res\")\n if k>n\n res2=k÷owari*ruiseki[owari+1]\n if k%owari>0\n res2+=ruiseki[k%owari+1]\n end\n ans=max(ans,res2)\n # println(\"res2:$res2\")\n end\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 941, "cpu_time_ms": 470, "memory_kb": 239496}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s127361226", "group_id": "codeNet:p02586", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\nfunction main()\n V=zeros(Int,3010,3010)\n dp=zeros(Int,3010,3010,4)\n R,C,K=parse.(Int,split(readline()))\n for i=1:K\n r,c,v=parse.(Int,split(readline()))\n V[r,c]=v\n end\n for i=1:R\n for j=1:C\n for k=1:4\n #sita\n dp[i+1,j+1,1]=max(dp[i+1,j+1,1],dp[i,j+1,k])\n dp[i+1,j+1,2]=max(dp[i+1,j+1,2],dp[i,j+1,k]+V[i,j])\n #migi\n dp[i+1,j+1,k]=max(dp[i+1,j+1,k],dp[i+1,j,k],k>1 ? dp[i+1,j,k-1]+V[i,j] : 0)\n end\n end\n end\n println(maximum(dp[R+1,C+1,:]))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1597971218, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02586.html", "problem_id": "p02586", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02586/input.txt", "sample_output_relpath": "derived/input_output/data/p02586/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02586/Julia/s127361226.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s127361226", "user_id": "u443151804"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\nfunction main()\n V=zeros(Int,3010,3010)\n dp=zeros(Int,3010,3010,4)\n R,C,K=parse.(Int,split(readline()))\n for i=1:K\n r,c,v=parse.(Int,split(readline()))\n V[r,c]=v\n end\n for i=1:R\n for j=1:C\n for k=1:4\n #sita\n dp[i+1,j+1,1]=max(dp[i+1,j+1,1],dp[i,j+1,k])\n dp[i+1,j+1,2]=max(dp[i+1,j+1,2],dp[i,j+1,k]+V[i,j])\n #migi\n dp[i+1,j+1,k]=max(dp[i+1,j+1,k],dp[i+1,j,k],k>1 ? dp[i+1,j,k-1]+V[i,j] : 0)\n end\n end\n end\n println(maximum(dp[R+1,C+1,:]))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \\leq i \\leq R) and the j-th column (1 \\leq j \\leq C). The i-th item is at (r_i, c_i) and has the value v_i.\n\nTakahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square).\n\nHe can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits.\n\nFind the maximum possible sum of the values of items he picks up.\n\nConstraints\n\n1 \\leq R, C \\leq 3000\n\n1 \\leq K \\leq \\min(2 \\times 10^5, R \\times C)\n\n1 \\leq r_i \\leq R\n\n1 \\leq c_i \\leq C\n\n(r_i, c_i) \\neq (r_j, c_j) (i \\neq j)\n\n1 \\leq v_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\nR C K\nr_1 c_1 v_1\nr_2 c_2 v_2\n:\nr_K c_K v_K\n\nOutput\n\nPrint the maximum possible sum of the values of items Takahashi picks up.\n\nSample Input 1\n\n2 2 3\n1 1 3\n2 1 4\n1 2 5\n\nSample Output 1\n\n8\n\nHe has two ways to get to the goal:\n\nVisit (1, 1), (1, 2), and (2, 2), in this order. In this case, the total value of the items he can pick up is 3 + 5 = 8.\n\nVisit (1, 1), (2, 1), and (2, 2), in this order. In this case, the total value of the items he can pick up is 3 + 4 = 7.\n\nThus, the maximum possible sum of the values of items he picks up is 8.\n\nSample Input 2\n\n2 5 5\n1 1 3\n2 4 20\n1 2 1\n1 3 4\n1 4 2\n\nSample Output 2\n\n29\n\nWe have four items in the 1-st row. The optimal choices are as follows:\n\nVisit (1, 1) (1, 2), (1, 3), (1, 4), (2, 4), and (2, 5), in this order, and pick up all items except the one on (1, 2). Then, the total value of the items he picks up will be 3 + 4 + 2 + 20 = 29.\n\nSample Input 3\n\n4 5 10\n2 5 12\n1 5 12\n2 3 15\n1 2 20\n1 1 28\n2 4 26\n3 2 27\n4 5 21\n3 5 10\n1 3 10\n\nSample Output 3\n\n142", "sample_input": "2 2 3\n1 1 3\n2 1 4\n1 2 5\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02586", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are K items placed on a grid of squares with R rows and C columns. Let (i, j) denote the square at the i-th row (1 \\leq i \\leq R) and the j-th column (1 \\leq j \\leq C). The i-th item is at (r_i, c_i) and has the value v_i.\n\nTakahashi will begin at (1, 1), the start, and get to (R, C), the goal. When he is at (i, j), he can move to (i + 1, j) or (i, j + 1) (but cannot move to a non-existent square).\n\nHe can pick up items on the squares he visits, including the start and the goal, but at most three for each row. It is allowed to ignore the item on a square he visits.\n\nFind the maximum possible sum of the values of items he picks up.\n\nConstraints\n\n1 \\leq R, C \\leq 3000\n\n1 \\leq K \\leq \\min(2 \\times 10^5, R \\times C)\n\n1 \\leq r_i \\leq R\n\n1 \\leq c_i \\leq C\n\n(r_i, c_i) \\neq (r_j, c_j) (i \\neq j)\n\n1 \\leq v_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\nR C K\nr_1 c_1 v_1\nr_2 c_2 v_2\n:\nr_K c_K v_K\n\nOutput\n\nPrint the maximum possible sum of the values of items Takahashi picks up.\n\nSample Input 1\n\n2 2 3\n1 1 3\n2 1 4\n1 2 5\n\nSample Output 1\n\n8\n\nHe has two ways to get to the goal:\n\nVisit (1, 1), (1, 2), and (2, 2), in this order. In this case, the total value of the items he can pick up is 3 + 5 = 8.\n\nVisit (1, 1), (2, 1), and (2, 2), in this order. In this case, the total value of the items he can pick up is 3 + 4 = 7.\n\nThus, the maximum possible sum of the values of items he picks up is 8.\n\nSample Input 2\n\n2 5 5\n1 1 3\n2 4 20\n1 2 1\n1 3 4\n1 4 2\n\nSample Output 2\n\n29\n\nWe have four items in the 1-st row. The optimal choices are as follows:\n\nVisit (1, 1) (1, 2), (1, 3), (1, 4), (2, 4), and (2, 5), in this order, and pick up all items except the one on (1, 2). Then, the total value of the items he picks up will be 3 + 4 + 2 + 20 = 29.\n\nSample Input 3\n\n4 5 10\n2 5 12\n1 5 12\n2 3 15\n1 2 20\n1 1 28\n2 4 26\n3 2 27\n4 5 21\n3 5 10\n1 3 10\n\nSample Output 3\n\n142", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1595, "memory_kb": 577424}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s967514307", "group_id": "codeNet:p02594", "input_text": "function main()\n \n X = parse(Int, readline())\n \n if X >= 30\n println(\"Yes\")\n else\n println(\"No\")\n end\n \nend", "language": "Julia", "metadata": {"date": 1597357915, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s967514307.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s967514307", "user_id": "u790457721"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "function main()\n \n X = parse(Int, readline())\n \n if X >= 30\n println(\"Yes\")\n else\n println(\"No\")\n end\n \nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 167, "memory_kb": 149992}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s765770034", "group_id": "codeNet:p02594", "input_text": "a=parse(Int,readline())\nif a>=30 \n s = \"Yes\"\nelse \n s = \"NO\"\nend\nprint(s)", "language": "Julia", "metadata": {"date": 1596774570, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s765770034.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s765770034", "user_id": "u385767174"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "a=parse(Int,readline())\nif a>=30 \n s = \"Yes\"\nelse \n s = \"NO\"\nend\nprint(s)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 75, "cpu_time_ms": 180, "memory_kb": 151636}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s539125273", "group_id": "codeNet:p02594", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tx = readline() |> parseInt\n\tprintln(x<30 ? \"No\" : \"Yes\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1596422491, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s539125273.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s539125273", "user_id": "u095714878"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tx = readline() |> parseInt\n\tprintln(x<30 ? \"No\" : \"Yes\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 201, "memory_kb": 152260}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s248421026", "group_id": "codeNet:p02594", "input_text": "# %% constants\n# ------------\n\n# %% body\n# -------\n\nfunction main(io = stdin)\n readto(target = '\\n') = readuntil(io, target)\n readnum(T::Type{<:Number} = Int; dlm = isspace, kwargs...) =\n parse.(T, split(readto(), dlm; kwargs...))\n\n # handle IO and and stuff\n X, = readnum()\n println(X ≥ 30 ? \"Yes\" : \"No\")\nend\n\nfunction solve()\n # ...\nend\n\n@static if @isdefined(Juno) || @isdefined(VSCodeServer)\n main(open(replace(@__FILE__, r\"(.+)\\.jl\" => s\"\\1.in\")))\nelse\n main()\nend\n", "language": "Julia", "metadata": {"date": 1596416521, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s248421026.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s248421026", "user_id": "u585742242"}, "prompt_components": {"gold_output": "No\n", "input_to_evaluate": "# %% constants\n# ------------\n\n# %% body\n# -------\n\nfunction main(io = stdin)\n readto(target = '\\n') = readuntil(io, target)\n readnum(T::Type{<:Number} = Int; dlm = isspace, kwargs...) =\n parse.(T, split(readto(), dlm; kwargs...))\n\n # handle IO and and stuff\n X, = readnum()\n println(X ≥ 30 ? \"Yes\" : \"No\")\nend\n\nfunction solve()\n # ...\nend\n\n@static if @isdefined(Juno) || @isdefined(VSCodeServer)\n main(open(replace(@__FILE__, r\"(.+)\\.jl\" => s\"\\1.in\")))\nelse\n main()\nend\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 305, "memory_kb": 186508}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s224433483", "group_id": "codeNet:p02595", "input_text": "N, D = map(s -> parse(s, Int), split(readline(), \" \"))\nres = 0\nfor i in 1:N\n x, y = map(s -> parse(s, Int), split(readline(), \" \"))\n if sqrt(x^2 + y^2) >= D\n res += 1\n end\nend\n\nprintln(res)", "language": "Julia", "metadata": {"date": 1596568797, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s224433483.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s224433483", "user_id": "u189731846"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N, D = map(s -> parse(s, Int), split(readline(), \" \"))\nres = 0\nfor i in 1:N\n x, y = map(s -> parse(s, Int), split(readline(), \" \"))\n if sqrt(x^2 + y^2) >= D\n res += 1\n end\nend\n\nprintln(res)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1323, "memory_kb": 273740}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s705313572", "group_id": "codeNet:p02595", "input_text": "function main()\n N, D = parse.(Int, split(readline()))\n x = zeros(Int, N)\n y = zeros(Int, N)\n for i in 1:N\n x[i], y[i] = parse.(Int, split(readline()))\n end\n \n ans = 0\n for i in 1:N\n if sqrt(x[i]^2 + y[i]^2) <= D\n ans += 1\n end\n end\n\n println(ans)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1596416608, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s705313572.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s705313572", "user_id": "u624923345"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main()\n N, D = parse.(Int, split(readline()))\n x = zeros(Int, N)\n y = zeros(Int, N)\n for i in 1:N\n x[i], y[i] = parse.(Int, split(readline()))\n end\n \n ans = 0\n for i in 1:N\n if sqrt(x[i]^2 + y[i]^2) <= D\n ans += 1\n end\n end\n\n println(ans)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 424, "memory_kb": 213320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s440674739", "group_id": "codeNet:p02596", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\nk=parse(Int,readline())\nfunction main()\n ans=1\n now=mod(7,k)\n while now!=0\n ans+=1\n now=mod(7+now*10,k)\n if ans>10^6;ans=-1; break; end\n end\n println(ans)\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1596418989, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s440674739.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s440674739", "user_id": "u443151804"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\nk=parse(Int,readline())\nfunction main()\n ans=1\n now=mod(7,k)\n while now!=0\n ans+=1\n now=mod(7+now*10,k)\n if ans>10^6;ans=-1; break; end\n end\n println(ans)\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 434, "memory_kb": 200180}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s683531532", "group_id": "codeNet:p02597", "input_text": "function F()\n N = parse(BigInt,readline())\n S = Vector{Char}(readline())\n \n \n \n C = []\n wl = 0\n rl = 0\n \n wr = count(x->x=='W',S)\n \n rr = count(x->x=='R',S)\n if rr<=wl\n C = append!(C,wl)\n else\n C = append!(C,wr)\n end\n \n for i=1:N\n if S[i] == 'W'\n wl += 1\n wr -= 1\n else\n rl += 1\n rr -= 1\n end\n if wl<=rr\n c = rr\n else\n c = wl\n end\n C = append!(C,c)\n end\n ans = minimum(C)\n println(ans)\nend\n\nF()", "language": "Julia", "metadata": {"date": 1599976307, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s683531532.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s683531532", "user_id": "u409581352"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function F()\n N = parse(BigInt,readline())\n S = Vector{Char}(readline())\n \n \n \n C = []\n wl = 0\n rl = 0\n \n wr = count(x->x=='W',S)\n \n rr = count(x->x=='R',S)\n if rr<=wl\n C = append!(C,wl)\n else\n C = append!(C,wr)\n end\n \n for i=1:N\n if S[i] == 'W'\n wl += 1\n wr -= 1\n else\n rl += 1\n rr -= 1\n end\n if wl<=rr\n c = rr\n else\n c = wl\n end\n C = append!(C,c)\n end\n ans = minimum(C)\n println(ans)\nend\n\nF()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 434, "memory_kb": 237468}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s504188495", "group_id": "codeNet:p02597", "input_text": "function F()\n N = parse(BigInt,readline())\n S = Vector{Char}(readline())\n s = [1 2 3]\n \n \n C = []\n wl = 0\n rl = 0\n \n wr = count(x->x=='W',S)\n \n rr = count(x->x=='R',S)\n if wr<=wl\n C = append!(C,wl)\n else\n C = append!(C,wr)\n end\n \n for i=1:N\n if S[i] == 'W'\n wl += 1\n wr -= 1\n else\n rl += 1\n rr -= 1\n end\n if wl<=rr\n c = rr\n else\n c = wl\n end\n C = append!(C,c)\n end\n ans = minimum(C)\n println(ans)\nend\n\nF()", "language": "Julia", "metadata": {"date": 1599976069, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s504188495.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s504188495", "user_id": "u409581352"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function F()\n N = parse(BigInt,readline())\n S = Vector{Char}(readline())\n s = [1 2 3]\n \n \n C = []\n wl = 0\n rl = 0\n \n wr = count(x->x=='W',S)\n \n rr = count(x->x=='R',S)\n if wr<=wl\n C = append!(C,wl)\n else\n C = append!(C,wr)\n end\n \n for i=1:N\n if S[i] == 'W'\n wl += 1\n wr -= 1\n else\n rl += 1\n rr -= 1\n end\n if wl<=rr\n c = rr\n else\n c = wl\n end\n C = append!(C,c)\n end\n ans = minimum(C)\n println(ans)\nend\n\nF()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 482, "cpu_time_ms": 455, "memory_kb": 240104}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s372027355", "group_id": "codeNet:p02597", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\nN = parseInt(readline())\nc = split(readline())\n#println(c[1])\nj = count(c[1][i]=='R' for i in 1:N)\n#println(j)\np = count(c[1][i]=='R' for i in 1:j)\n#println(p)\nprintln(j-p)\n#for i in 1:j\n# c[1][i]\n#end\n#println(mon)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1596420170, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s372027355.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s372027355", "user_id": "u524573278"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\nN = parseInt(readline())\nc = split(readline())\n#println(c[1])\nj = count(c[1][i]=='R' for i in 1:N)\n#println(j)\np = count(c[1][i]=='R' for i in 1:j)\n#println(p)\nprintln(j-p)\n#for i in 1:j\n# c[1][i]\n#end\n#println(mon)\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 250, "memory_kb": 163704}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s470617651", "group_id": "codeNet:p02597", "input_text": "function main()\n N = parse(Int, readline())\n c = readline()\n\n r = 0\n w = 0\n for i in 1:N\n if c[i] == 'R'\n r += 1\n else\n w += 1\n end\n end\n\n if r == N\n println(0)\n return\n end\n\n if w == N\n println(N)\n return\n end\n\n mw = 0\n for i in 1:r\n if c[i] == 'W'\n mw += 1\n end\n end\n\n mr = 0\n for i in r:N\n if c[i] == 'R'\n mr += 1\n end\n end\n\n println(min(mr, mw))\n\n #if mr == mw\n # println(mr)\n #elseif mw > mr\n # println(mr + (mw - mr))\n #else\n # println(mw + (mr - mw))\n #end\nend\n\nmain() ", "language": "Julia", "metadata": {"date": 1596419040, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s470617651.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s470617651", "user_id": "u624923345"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n N = parse(Int, readline())\n c = readline()\n\n r = 0\n w = 0\n for i in 1:N\n if c[i] == 'R'\n r += 1\n else\n w += 1\n end\n end\n\n if r == N\n println(0)\n return\n end\n\n if w == N\n println(N)\n return\n end\n\n mw = 0\n for i in 1:r\n if c[i] == 'W'\n mw += 1\n end\n end\n\n mr = 0\n for i in r:N\n if c[i] == 'R'\n mr += 1\n end\n end\n\n println(min(mr, mw))\n\n #if mr == mw\n # println(mr)\n #elseif mw > mr\n # println(mr + (mw - mr))\n #else\n # println(mw + (mr - mw))\n #end\nend\n\nmain() ", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 678, "cpu_time_ms": 234, "memory_kb": 159136}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s813482205", "group_id": "codeNet:p02598", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction cutN(A,L)\n N = length(A)\n c = 0\n for i in 1:N\n c += A[i]÷L\n if A[i]%L == 0\n c -= 1\n end\n end\n return c\nend\n\nfunction main()\n N,K = readint()\n A = readint()\n\n LB = 0\n for i in 1:N\n if LB < A[i]\n LB = A[i]\n end\n end\n LA = 1\n #LB = 10^9\n KA = cutN(A,LA)\n KB = cutN(A,LB)\n\n if KB == K\n println(LB)\n return\n elseif KA == K\n println(LA)\n return\n end\n\n while true\n LC = (LA + LB)÷2\n KC = cutN(A,LC)\n if KC == K && KC != cutN(A,LC-1)\n println(LC)\n return\n end\n\n if KC <= K\n LB = LC\n else\n LA = LC\n end\n\n #println(KA,\" \", KB,\" \", KC)\nend \n\n\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1596420547, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02598.html", "problem_id": "p02598", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02598/input.txt", "sample_output_relpath": "derived/input_output/data/p02598/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02598/Julia/s813482205.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s813482205", "user_id": "u868531879"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction cutN(A,L)\n N = length(A)\n c = 0\n for i in 1:N\n c += A[i]÷L\n if A[i]%L == 0\n c -= 1\n end\n end\n return c\nend\n\nfunction main()\n N,K = readint()\n A = readint()\n\n LB = 0\n for i in 1:N\n if LB < A[i]\n LB = A[i]\n end\n end\n LA = 1\n #LB = 10^9\n KA = cutN(A,LA)\n KB = cutN(A,LB)\n\n if KB == K\n println(LB)\n return\n elseif KA == K\n println(LA)\n return\n end\n\n while true\n LC = (LA + LB)÷2\n KC = cutN(A,LC)\n if KC == K && KC != cutN(A,LC-1)\n println(LC)\n return\n end\n\n if KC <= K\n LB = LC\n else\n LA = LC\n end\n\n #println(KA,\" \", KB,\" \", KC)\nend \n\n\n\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N logs of lengths A_1,A_2,\\cdots A_N.\n\nWe can cut these logs at most K times in total. When a log of length L is cut at a point whose distance from an end of the log is t (00\n\t\tans+=bit.bit[i]\n\t\ti-=i&-i\n\tend\n\tans\nend\nfunction add(bit::BIT,i::Int,a::Int)\n\twhile i<=bit.n\n\t\tbit.bit[i]+=a\n\t\ti+=i&-i\n\tend\nend\nfunction lower_bound(bit::BIT,k::Int)#k<=sum(ret)\n\tif k<=0\n\t\treturn 0\n\tend\n\tret=0\n\ti=1\n\twhile i*2<=bit.n\n\t\ti*=2\n\tend\n\twhile i>0\n\t\tif ret+i<=bit.n&&bit.bit[ret+i]>=1\n\tend\n\tret+1\nend\nfunction toi(x)\n\tparse(Int,x)\nend\nfunction ps(s)\n\tmap(toi,split(s))\nend\nfunction main()\n\tN,Q=ps(readline())\n\tC=ps(readline())\n\tid=zeros(Int,N)\n\tP=BIT(N)\n\tQs=[Pair{Int,Int}[] for _=1:N]\n\ti=0\n\tfor s=readlines()\n\t\ti+=1\n\t\tl,r=ps(s)\n\t\tpush!(Qs[r],l=>i)\n\tend\n\tans=zeros(Int,Q)\n\tcnt=0\n\tfor r=1:N\n\t\tc=C[r]\n\t\tif id[c]>0\n\t\t\tadd(P,id[c],-1)\n\t\t\tcnt-=1\n\t\tend\n\t\tid[c]=r\n\t\tadd(P,id[c],1)\n\t\tcnt+=1\n\t\tfor (l,i)=Qs[r]\n\t\t\tans[i]=cnt-sum(P,l-1)\n\t\tend\n\tend\n\tprintln.(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1597337846, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s528181585.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s528181585", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n3\n1\n", "input_to_evaluate": "struct BIT\n\tn::Int\n\tbit::Array{Int}\n\tBIT(n)=new(n,zeros(Int,n))\nend\nfunction sum(bit::BIT,i::Int)\n\tans=0\n\twhile i>0\n\t\tans+=bit.bit[i]\n\t\ti-=i&-i\n\tend\n\tans\nend\nfunction add(bit::BIT,i::Int,a::Int)\n\twhile i<=bit.n\n\t\tbit.bit[i]+=a\n\t\ti+=i&-i\n\tend\nend\nfunction lower_bound(bit::BIT,k::Int)#k<=sum(ret)\n\tif k<=0\n\t\treturn 0\n\tend\n\tret=0\n\ti=1\n\twhile i*2<=bit.n\n\t\ti*=2\n\tend\n\twhile i>0\n\t\tif ret+i<=bit.n&&bit.bit[ret+i]>=1\n\tend\n\tret+1\nend\nfunction toi(x)\n\tparse(Int,x)\nend\nfunction ps(s)\n\tmap(toi,split(s))\nend\nfunction main()\n\tN,Q=ps(readline())\n\tC=ps(readline())\n\tid=zeros(Int,N)\n\tP=BIT(N)\n\tQs=[Pair{Int,Int}[] for _=1:N]\n\ti=0\n\tfor s=readlines()\n\t\ti+=1\n\t\tl,r=ps(s)\n\t\tpush!(Qs[r],l=>i)\n\tend\n\tans=zeros(Int,Q)\n\tcnt=0\n\tfor r=1:N\n\t\tc=C[r]\n\t\tif id[c]>0\n\t\t\tadd(P,id[c],-1)\n\t\t\tcnt-=1\n\t\tend\n\t\tid[c]=r\n\t\tadd(P,id[c],1)\n\t\tcnt+=1\n\t\tfor (l,i)=Qs[r]\n\t\t\tans[i]=cnt-sum(P,l-1)\n\t\tend\n\tend\n\tprintln.(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1984, "memory_kb": 388708}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s310753231", "group_id": "codeNet:p02599", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction cutN(A,L)\n N = length(A)\n c = 0\n for i in 1:N\n c += A[i]÷L\n if A[i]%L == 0\n c -= 1\n end\n end\n return c\nend\n\nfunction main()\n N,K = readint()\n A = readint()\n\n LB = 0\n for i in 1:N\n if LB < A[i]\n LB = A[i]\n end\n end\n LA = 1\n #LB = 10^9\n KA = cutN(A,LA)\n KB = cutN(A,LB)\n\n if KB == K\n println(LB)\n return\n elseif KA <= K\n println(LA)\n return\n end\n\n while true\n LC = (LA + LB)÷2\n KC = cutN(A,LC)\n if cutN(A,LC) <= K < cutN(A,LC-1)\n println(LC)\n return\n end\n\n if cutN(A,LC-1) <= K\n LB = LC\n else\n LA = LC\n end\n\n #println(KA,\" \", KB,\" \", KC)\nend \n\n\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1596421479, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s310753231.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s310753231", "user_id": "u868531879"}, "prompt_components": {"gold_output": "2\n3\n1\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction cutN(A,L)\n N = length(A)\n c = 0\n for i in 1:N\n c += A[i]÷L\n if A[i]%L == 0\n c -= 1\n end\n end\n return c\nend\n\nfunction main()\n N,K = readint()\n A = readint()\n\n LB = 0\n for i in 1:N\n if LB < A[i]\n LB = A[i]\n end\n end\n LA = 1\n #LB = 10^9\n KA = cutN(A,LA)\n KB = cutN(A,LB)\n\n if KB == K\n println(LB)\n return\n elseif KA <= K\n println(LA)\n return\n end\n\n while true\n LC = (LA + LB)÷2\n KC = cutN(A,LC)\n if cutN(A,LC) <= K < cutN(A,LC-1)\n println(LC)\n return\n end\n\n if cutN(A,LC-1) <= K\n LB = LC\n else\n LA = LC\n end\n\n #println(KA,\" \", KB,\" \", KC)\nend \n\n\n\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 779, "cpu_time_ms": 802, "memory_kb": 231000}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s184672669", "group_id": "codeNet:p02600", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n X = parseInt(readline())\n if 400<= X\n if 600> X\n println(8)\n end\n end\n if 600<= X\n if 800> X\n println(7)\n end\n end\n if 800<= X\n if 1000> X\n println(6)\n end\n end\n if 1000<= X\n if 1200> X\n println(5)\n end\n end\n if 1200<= X\n if 1400> X\n println(4)\n end\n end\n if 1400<= X\n if 1600> X\n println(3)\n end\n end\n if 1600<= X\n if 1800> X\n println(2)\n end\n end\n if 1800<= X\n if 2000> X\n println(1)\n end\n end\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1595726164, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s184672669.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s184672669", "user_id": "u524573278"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n X = parseInt(readline())\n if 400<= X\n if 600> X\n println(8)\n end\n end\n if 600<= X\n if 800> X\n println(7)\n end\n end\n if 800<= X\n if 1000> X\n println(6)\n end\n end\n if 1000<= X\n if 1200> X\n println(5)\n end\n end\n if 1200<= X\n if 1400> X\n println(4)\n end\n end\n if 1400<= X\n if 1600> X\n println(3)\n end\n end\n if 1600<= X\n if 1800> X\n println(2)\n end\n end\n if 1800<= X\n if 2000> X\n println(1)\n end\n end\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 225, "memory_kb": 156376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s900563099", "group_id": "codeNet:p02600", "input_text": "# %% constants\n# ------------\n\n# %% body\n# -------\n\nfunction main(io = stdin)\n readto(target = '\\n') = readuntil(io, target)\n readnum(T::Type{<:Number} = Int; dlm = isspace, kwargs...) =\n parse.(T, split(readto(), dlm; kwargs...))\n\n # handle IO and solve\n X, = readnum()\n println(solve(X))\nend\n\nfunction solve(X)\n if 400 ≤ X ≤ 599\n 8\n elseif 600 ≤ X ≤ 799\n 7\n elseif 800 ≤ X ≤ 999\n 6\n elseif 1000 ≤ X ≤ 1199\n 5\n elseif 1200 ≤ X ≤ 1399\n 4\n elseif 1400 ≤ X ≤ 1599\n 3\n elseif 1600 ≤ X ≤ 1799\n 2\n elseif 1800 ≤ X ≤ 1999\n 1\n else\n nothing\n end\nend\n\n@static if @isdefined(Juno)\n main(open(replace(@__FILE__, r\"(.+)\\.jl\" => s\"\\1.in\")))\nelse\n main()\nend\n", "language": "Julia", "metadata": {"date": 1595725853, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s900563099.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900563099", "user_id": "u585742242"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "# %% constants\n# ------------\n\n# %% body\n# -------\n\nfunction main(io = stdin)\n readto(target = '\\n') = readuntil(io, target)\n readnum(T::Type{<:Number} = Int; dlm = isspace, kwargs...) =\n parse.(T, split(readto(), dlm; kwargs...))\n\n # handle IO and solve\n X, = readnum()\n println(solve(X))\nend\n\nfunction solve(X)\n if 400 ≤ X ≤ 599\n 8\n elseif 600 ≤ X ≤ 799\n 7\n elseif 800 ≤ X ≤ 999\n 6\n elseif 1000 ≤ X ≤ 1199\n 5\n elseif 1200 ≤ X ≤ 1399\n 4\n elseif 1400 ≤ X ≤ 1599\n 3\n elseif 1600 ≤ X ≤ 1799\n 2\n elseif 1800 ≤ X ≤ 1999\n 1\n else\n nothing\n end\nend\n\n@static if @isdefined(Juno)\n main(open(replace(@__FILE__, r\"(.+)\\.jl\" => s\"\\1.in\")))\nelse\n main()\nend\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 799, "cpu_time_ms": 372, "memory_kb": 190732}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s692897659", "group_id": "codeNet:p02601", "input_text": "function main()\n a,b,c,k = reads(Int,Int,Int,Int)\n println(search(a,b,c,k) ? \"Yes\" : \"No\")\nend\n\nfunction search(a,b,c,k,l=0)\n if a < b < c\n return true\n end\n k == l && return false\n ans = false\n ans |= search(2a,b,c,k,l+1)\n ans |= search(a,2b,c,k,l+1)\n ans |= search(a,b,2c,k,l+1)\n return ans\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1595730247, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02601.html", "problem_id": "p02601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02601/input.txt", "sample_output_relpath": "derived/input_output/data/p02601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02601/Julia/s692897659.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s692897659", "user_id": "u729767359"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n a,b,c,k = reads(Int,Int,Int,Int)\n println(search(a,b,c,k) ? \"Yes\" : \"No\")\nend\n\nfunction search(a,b,c,k,l=0)\n if a < b < c\n return true\n end\n k == l && return false\n ans = false\n ans |= search(2a,b,c,k,l+1)\n ans |= search(a,2b,c,k,l+1)\n ans |= search(a,b,2c,k,l+1)\n return ans\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "problem_context": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "sample_input": "7 2 5\n3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02601", "source_text": "Score: 200 points\n\nProblem Statement\n\nM-kun has the following three cards:\n\nA red card with the integer A.\n\nA green card with the integer B.\n\nA blue card with the integer C.\n\nHe is a genius magician who can do the following operation at most K times:\n\nChoose one of the three cards and multiply the written integer by 2.\n\nHis magic is successful if both of the following conditions are satisfied after the operations:\n\nThe integer on the green card is strictly greater than the integer on the red card.\n\nThe integer on the blue card is strictly greater than the integer on the green card.\n\nDetermine whether the magic can be successful.\n\nConstraints\n\n1 \\leq A, B, C \\leq 7\n\n1 \\leq K \\leq 7\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C\nK\n\nOutput\n\nIf the magic can be successful, print Yes; otherwise, print No.\n\nSample Input 1\n\n7 2 5\n3\n\nSample Output 1\n\nYes\n\nThe magic will be successful if, for example, he does the following operations:\n\nFirst, choose the blue card. The integers on the red, green, and blue cards are now 7, 2, and 10, respectively.\n\nSecond, choose the green card. The integers on the red, green, and blue cards are now 7, 4, and 10, respectively.\n\nThird, choose the green card. The integers on the red, green, and blue cards are now 7, 8, and 10, respectively.\n\nSample Input 2\n\n7 4 2\n3\n\nSample Output 2\n\nNo\n\nHe has no way to succeed in the magic with at most three operations.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1848, "cpu_time_ms": 427, "memory_kb": 194672}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s101130974", "group_id": "codeNet:p02602", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tfor i in k+1:n\n\t\tprintln(a[i]>a[i-k] ? \"Yes\" : \"No\")\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1596074410, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s101130974.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s101130974", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\nNo\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tfor i in k+1:n\n\t\tprintln(a[i]>a[i-k] ? \"Yes\" : \"No\")\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 292, "memory_kb": 194152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s164019618", "group_id": "codeNet:p02602", "input_text": "function main()\n N,K = reads(Int,Int)\n a = readvec(Int, N)\n arr = zeros(Int, N)\n arr[1] = a[1]\n for i in 2:N\n arr[i] = a[i] * arr[i-1]\n end\n v = arr[K]\n for i in K+1:N\n nv = arr[i] ÷ arr[i-K]\n println(v < nv ? \"Yes\" : \"No\")\n v = nv\n end\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1595730267, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s164019618.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s164019618", "user_id": "u729767359"}, "prompt_components": {"gold_output": "Yes\nNo\n", "input_to_evaluate": "function main()\n N,K = reads(Int,Int)\n a = readvec(Int, N)\n arr = zeros(Int, N)\n arr[1] = a[1]\n for i in 2:N\n arr[i] = a[i] * arr[i-1]\n end\n v = arr[K]\n for i in K+1:N\n nv = arr[i] ÷ arr[i-K]\n println(v < nv ? \"Yes\" : \"No\")\n v = nv\n end\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1722, "memory_kb": 287748}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s436046085", "group_id": "codeNet:p02603", "input_text": "function cal(mon,num,i,A,N)\n#for i in 1:N\n#println(mon)\n if i == N\n mon += num*A[i]\n num = 0\n elseif A[i] == maximum(A[i:N])\n mon += num*A[i]\n num = 0\n println(mon)\n exit()\n else\n if i == 1\n num += div(mon,A[i])\n mon -= num*A[i]\n elseif A[i] > A[i-1]\n mon += num*A[i]\n num = 0\n elseif A[i] < A[i-1]\n num += div(mon,A[i])\n mon -= num*A[i]\n end\n end\nreturn num,mon\nend\n\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\nN = parseInt(readline())\nA = parseMap(split(readline()))\nmon=1000 ; num=0\n#if A[1] == maximum(A)\n# println(1000)\n# exit()\n#end\nfor i in 1:N\n num,mon=cal(mon,num,i,A,N)\nend\nprintln(mon)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1595732888, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s436046085.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s436046085", "user_id": "u524573278"}, "prompt_components": {"gold_output": "1685\n", "input_to_evaluate": "function cal(mon,num,i,A,N)\n#for i in 1:N\n#println(mon)\n if i == N\n mon += num*A[i]\n num = 0\n elseif A[i] == maximum(A[i:N])\n mon += num*A[i]\n num = 0\n println(mon)\n exit()\n else\n if i == 1\n num += div(mon,A[i])\n mon -= num*A[i]\n elseif A[i] > A[i-1]\n mon += num*A[i]\n num = 0\n elseif A[i] < A[i-1]\n num += div(mon,A[i])\n mon -= num*A[i]\n end\n end\nreturn num,mon\nend\n\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\nN = parseInt(readline())\nA = parseMap(split(readline()))\nmon=1000 ; num=0\n#if A[1] == maximum(A)\n# println(1000)\n# exit()\n#end\nfor i in 1:N\n num,mon=cal(mon,num,i,A,N)\nend\nprintln(mon)\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 734, "cpu_time_ms": 283, "memory_kb": 166684}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s430499551", "group_id": "codeNet:p02603", "input_text": "function main()\n N = pread(Int)\n a = readvec(Int, N)\n mv = zeros(Int, N)\n mv = search!(1,N,a,mv)\n kb = 0\n mon = 1000\n for i in 1:N\n mv[i] == 0 && continue\n if mv[i] == 1\n kb += mon ÷ a[i]\n mon -= kb * a[i]\n else\n mon += kb * a[i]\n kb = 0\n end\n end\n #println(mv)\n println(mon)\nend\n\nfunction search!(si,ei,a,mv)\n si >= ei && return mv\n #println(si, \" \", ei)\n sv = a[si]\n ev = a[ei]\n nsi = si\n nei = ei\n esa = 0\n emin = ev\n for i in 1:ei-si-1\n if a[si+i] < sv\n nsi = si + i\n sv = a[si+i]\n end\n end\n\n for i in 1:ei-si-1\n if nsi >= ei-i\n break\n end\n if a[ei-i] < emin\n emin = a[ei-i]\n end\n if esa < a[ei-i] - emin\n nei = ei - i\n ev = a[ei-i]\n esa = a[ei-i] - emin\n end\n end\n #println(\" \", nsi, \" \", nei)\n if sv >= ev || nsi == nei\n return mv\n end\n mv[nsi] = 1\n mv[nei] = -1\n search!(si,nsi-1,a,mv)\n search!(nsi+1,nei-1,a,mv)\n search!(nei+1,ei,a,mv)\n return mv\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1595731641, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s430499551.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s430499551", "user_id": "u729767359"}, "prompt_components": {"gold_output": "1685\n", "input_to_evaluate": "function main()\n N = pread(Int)\n a = readvec(Int, N)\n mv = zeros(Int, N)\n mv = search!(1,N,a,mv)\n kb = 0\n mon = 1000\n for i in 1:N\n mv[i] == 0 && continue\n if mv[i] == 1\n kb += mon ÷ a[i]\n mon -= kb * a[i]\n else\n mon += kb * a[i]\n kb = 0\n end\n end\n #println(mv)\n println(mon)\nend\n\nfunction search!(si,ei,a,mv)\n si >= ei && return mv\n #println(si, \" \", ei)\n sv = a[si]\n ev = a[ei]\n nsi = si\n nei = ei\n esa = 0\n emin = ev\n for i in 1:ei-si-1\n if a[si+i] < sv\n nsi = si + i\n sv = a[si+i]\n end\n end\n\n for i in 1:ei-si-1\n if nsi >= ei-i\n break\n end\n if a[ei-i] < emin\n emin = a[ei-i]\n end\n if esa < a[ei-i] - emin\n nei = ei - i\n ev = a[ei-i]\n esa = a[ei-i] - emin\n end\n end\n #println(\" \", nsi, \" \", nei)\n if sv >= ev || nsi == nei\n return mv\n end\n mv[nsi] = 1\n mv[nei] = -1\n search!(si,nsi-1,a,mv)\n search!(nsi+1,nei-1,a,mv)\n search!(nei+1,ei,a,mv)\n return mv\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2679, "cpu_time_ms": 425, "memory_kb": 188580}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s738612640", "group_id": "codeNet:p02603", "input_text": "function cal(mon,num,i,A,N)\n#for i in 1:N\n#println(mon)\n if i == N\n mon += num*A[i]\n num = 0\n elseif A[i] == maximum(A[i:N])\n println(mon)\n exit()\n else\n if i == 1\n num = div(mon,A[i])\n mon -= num*A[i]\n elseif A[i] > A[i-1]\n mon += num*A[i]\n num = 0\n elseif A[i] < A[i-1]\n num = div(mon,A[i])\n mon -= num*A[i]\n end\n end\nreturn num,mon\nend\n\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\nN = parseInt(readline())\nA = parseMap(split(readline()))\nmon=1000 ; num=0\nif A[1] == maximum(A)\n println(1000)\n exit()\nend\nfor i in 1:N\n num,mon=cal(mon,num,i,A,N)\nend\nprintln(mon)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1595731002, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s738612640.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s738612640", "user_id": "u524573278"}, "prompt_components": {"gold_output": "1685\n", "input_to_evaluate": "function cal(mon,num,i,A,N)\n#for i in 1:N\n#println(mon)\n if i == N\n mon += num*A[i]\n num = 0\n elseif A[i] == maximum(A[i:N])\n println(mon)\n exit()\n else\n if i == 1\n num = div(mon,A[i])\n mon -= num*A[i]\n elseif A[i] > A[i-1]\n mon += num*A[i]\n num = 0\n elseif A[i] < A[i-1]\n num = div(mon,A[i])\n mon -= num*A[i]\n end\n end\nreturn num,mon\nend\n\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\nN = parseInt(readline())\nA = parseMap(split(readline()))\nmon=1000 ; num=0\nif A[1] == maximum(A)\n println(1000)\n exit()\nend\nfor i in 1:N\n num,mon=cal(mon,num,i,A,N)\nend\nprintln(mon)\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 696, "cpu_time_ms": 309, "memory_kb": 166712}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s021924324", "group_id": "codeNet:p02603", "input_text": "N=parse(Int,readline())\nA=parse.(Int,split(readline()))\nfunction solve(N,A)\nbuy=zeros(Int, N)\nsell=zeros(Int, N)\nbuy_flag=false\ndA=diff(A)\nfor i=1:(N-1)\n if dA[i]>0\n if !buy_flag\n buy[i]=1\n buy_flag=true\n end\n elseif dA[i]<0\n if buy_flag\n sell[i]=1\n buy_flag=false\n end\n end\nend\nif buy_flag & dA[end]>0\n sell[end]=1\n else\n buy[buy.== 1][end]=0\nend\n\nmoney=1000\nstock=0\nfor i=1:N\n# println(money,\" \",stock)\n if buy[i]==1\n stock=div(money,A[i])\n money=money%A[i]\n end\n if sell[i]==1\n money=money+stock*A[i]\n stock=0\n end\nend\nprint(money)\nend\nsolve(N,A)", "language": "Julia", "metadata": {"date": 1595730076, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s021924324.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s021924324", "user_id": "u765865533"}, "prompt_components": {"gold_output": "1685\n", "input_to_evaluate": "N=parse(Int,readline())\nA=parse.(Int,split(readline()))\nfunction solve(N,A)\nbuy=zeros(Int, N)\nsell=zeros(Int, N)\nbuy_flag=false\ndA=diff(A)\nfor i=1:(N-1)\n if dA[i]>0\n if !buy_flag\n buy[i]=1\n buy_flag=true\n end\n elseif dA[i]<0\n if buy_flag\n sell[i]=1\n buy_flag=false\n end\n end\nend\nif buy_flag & dA[end]>0\n sell[end]=1\n else\n buy[buy.== 1][end]=0\nend\n\nmoney=1000\nstock=0\nfor i=1:N\n# println(money,\" \",stock)\n if buy[i]==1\n stock=div(money,A[i])\n money=money%A[i]\n end\n if sell[i]==1\n money=money+stock*A[i]\n stock=0\n end\nend\nprint(money)\nend\nsolve(N,A)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 687, "cpu_time_ms": 1567, "memory_kb": 281240}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s688518227", "group_id": "codeNet:p02604", "input_text": "# %% library\n# ----------\n\n# %% library docs\n# ---------------\n\n\"\"\"\n @collect [cond] ex\n\nConstructs [`Array`](@ref) from lastly evaluated values from a `for` loop block that appears\n first within given `ex` expression.\nIf the optional `cond` expression is given, iterations where the `cond` is `false` are\n effectively filtered out.\n\n```julia-repl\njulia> @collect isodd(i) for i = 1:3\n println(\"i = \", i); i\n end\ni = 1\ni = 3\n2-element Array{Int64,1}:\n 1\n 3\n```\n\nSee also: [`@generator`](@ref)\n\"\"\"\nmacro collect end\n\n\"\"\"\n @generator [cond] ex\n\nConstructs [`Base.Generator`](@ref) from lastly evaluated values from a `for` loop block\n that appears first within given `ex` expression.\nIf the optional `cond` expression is given, iterations where the `cond` is `false` are\n effectively filtered out.\n\n```julia-repl\njulia> @generator isodd(i) for i = 1:3\n println(\"i = \", i); i\n end |> sum\ni = 1\ni = 3\n4\n```\n\nSee also: [`@collect`](@ref)\n\"\"\"\nmacro generator end\n\n\"\"\"\n bruteforcesearch(f::Function, n::Integer, b::Integer = 2)\n\nApplies `f` for all the ...\n$(\"\"#=TODO: add some equation here for the future reference=#)\n\n!!! note\n By default (i.e. when `b == 2`), this function is equivalent to bit-brute-force search.\n\n```julia-repl\njulia> bruteforcesearch(3) do comb\n @show collect(comb)\n end;\ncollect(mask) = [2, 1, 1]\ncollect(mask) = [1, 2, 1]\ncollect(mask) = [2, 2, 1]\ncollect(mask) = [1, 1, 2]\ncollect(mask) = [2, 1, 2]\ncollect(mask) = [1, 2, 2]\ncollect(mask) = [2, 2, 2]\ncollect(mask) = [1, 1, 1]\n\njulia> bruteforcesearch(2, 3) do comb\n @show collect(comb)\n end;\ncollect(mask) = [2, 1]\ncollect(mask) = [3, 1]\ncollect(mask) = [1, 2]\ncollect(mask) = [2, 2]\ncollect(mask) = [3, 2]\ncollect(mask) = [1, 3]\ncollect(mask) = [2, 3]\ncollect(mask) = [3, 3]\ncollect(mask) = [1, 1]\n```\n\"\"\"\nfunction bruteforcesearch end\n\n# %% library body\n# ---------------\n\nfunction decompose_forblk(forblk)\n @assert Meta.isexpr(forblk, :for) \"for block expression should be given\"\n itrspec, body = forblk.args\n @assert Meta.isexpr(itrspec, :(=)) \"invalid for loop specification\"\n v, itr = itrspec.args\n return body, v, itr\nend\n\nfunction recompose_to_comprehension(forblk, cond = nothing; gen = false)\n body, v, itr = decompose_forblk(forblk)\n return isnothing(cond) ?\n esc(gen ? :(($body for $v in $itr)) : :([$body for $v in $itr])) :\n esc(gen ? :(($body for $v in $itr if $cond)) : :([$body for $v in $itr if $cond]))\nend\n\nfunction walk_and_transform(x, cond = nothing; gen = false)\n Meta.isexpr(x, :for) && return recompose_to_comprehension(x, cond; gen = gen), true\n x isa Expr || return x, false\n for (i, ex) in enumerate(x.args)\n ex, transformed = walk_and_transform(ex, cond; gen = gen)\n x.args[i] = ex\n transformed && return x, true # already transformed\n end\n return x, false\nend\n\nmacro collect(ex) first(walk_and_transform(ex)) end\nmacro collect(cond, ex) first(walk_and_transform(ex, cond)) end\n\nmacro generator(ex) first(walk_and_transform(ex; gen = true)) end\nmacro generator(cond, ex) first(walk_and_transform(ex, cond; gen = true)) end\n\n@inbounds function bruteforcesearch(f::Function, n::Integer, b::Integer = 2)\n baselen = length(string(b, base = 10))\n @collect for i = 1:b^n\n s = reverse(string(i, pad = n, base = b))[1:n] # cut off the overflowed char when `i == base^n`\n comb = @generator for ns in partition(s, baselen)\n parse(Int, ns) + 1 # for 1-based indexing\n end\n f(comb)\n end\nend\n\npartition(a, n) = @generator for i in 1:(length(a)÷n)\n s = 1+n*(i-1)\n e = n*i\n a[s:e]\nend\n\n# %% constants\n# ------------\n\n# %% body\n# -------\n\nfunction main(io = stdin)\n readto(target = '\\n') = readuntil(io, target)\n readnum(T::Type{<:Number} = Int; dlm = isspace, kwargs...) =\n parse.(T, split(readto(), dlm; kwargs...))\n\n # handle IO and stuff\n N, = readnum()\n XYPs = [readnum() for _ in 1:N]\n println.(solve(N, XYPs))\nend\n\nfunction solve(N, XYPs)\n # TODO: precomputation\n Xcaches = [Dict{UInt,Int}() for _ in XYPs]\n Ycaches = [Dict{UInt,Int}() for _ in XYPs]\n\n bruteforcesearch(N, 2) do roads\n Xs = Set(0)\n Ys = Set(0)\n for (road, XYP) in zip(roads, XYPs)\n if road == 1\n push!(Xs, XYP[1])\n else\n push!(Ys, XYP[2])\n end\n end\n\n cache_distances!(XYPs, Xs, Ys, Xcaches, Ycaches)\n end\n\n ret = [typemax(Int) for n in 0:N]\n\n # calculate shortest distances for all the candidates\n bruteforcesearch(N, 3) do roads\n Xs = Set(0)\n Ys = Set(0)\n\n cnt = @collect for (road, XYP) in zip(roads, XYPs)\n if road == 1\n push!(Xs, XYP[1])\n 1\n elseif road == 2\n push!(Ys, XYP[2])\n 1\n else road == 3\n 0 # no road here, no count\n end\n end |> sum\n ret[cnt + 1] = min(ret[cnt + 1], sumup_distances(XYPs, Xs, Ys, Xcaches, Ycaches))\n end |> minimum\n\n return ret\nend\n\nfunction cache_distances!(XYPs, Xs, Ys, Xcaches, Ycaches)\n for ((X, Y, _), Xcache, Ycache) in zip(XYPs, Xcaches, Ycaches)\n cache_distance!(Xcache, X, Xs)\n cache_distance!(Ycache, Y, Xs)\n end\nend\n\nfunction cache_distance!(cache, p, ps)\n k = hash(ps)\n haskey(cache, k) || (cache[k] = shortest_distance(p, ps))\nend\n\nshortest_distance(p, ps) = minimum(abs(p - x) for x in ps)\n\nfunction sumup_distances(XYPs, Xs, Ys, Xcaches, Ycaches)\n @generator for ((_, _, P), Xcache, Ycache) in zip(XYPs, Xcaches, Ycaches)\n get_distance(Xs, Ys, Xcache, Ycache) * P\n end |> sum\nend\n\nget_distance(Xs, Ys, Xcache, Ycache) = min(Xcache[hash(Xs)], Ycache[hash(Ys)])\n\n@static if @isdefined(Juno)\n main(open(replace(@__FILE__, r\"(.+)\\.jl\" => s\"\\1.in\")))\nelse\n main()\nend\n", "language": "Julia", "metadata": {"date": 1595906131, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02604.html", "problem_id": "p02604", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02604/input.txt", "sample_output_relpath": "derived/input_output/data/p02604/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02604/Julia/s688518227.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s688518227", "user_id": "u585742242"}, "prompt_components": {"gold_output": "2900\n900\n0\n0\n", "input_to_evaluate": "# %% library\n# ----------\n\n# %% library docs\n# ---------------\n\n\"\"\"\n @collect [cond] ex\n\nConstructs [`Array`](@ref) from lastly evaluated values from a `for` loop block that appears\n first within given `ex` expression.\nIf the optional `cond` expression is given, iterations where the `cond` is `false` are\n effectively filtered out.\n\n```julia-repl\njulia> @collect isodd(i) for i = 1:3\n println(\"i = \", i); i\n end\ni = 1\ni = 3\n2-element Array{Int64,1}:\n 1\n 3\n```\n\nSee also: [`@generator`](@ref)\n\"\"\"\nmacro collect end\n\n\"\"\"\n @generator [cond] ex\n\nConstructs [`Base.Generator`](@ref) from lastly evaluated values from a `for` loop block\n that appears first within given `ex` expression.\nIf the optional `cond` expression is given, iterations where the `cond` is `false` are\n effectively filtered out.\n\n```julia-repl\njulia> @generator isodd(i) for i = 1:3\n println(\"i = \", i); i\n end |> sum\ni = 1\ni = 3\n4\n```\n\nSee also: [`@collect`](@ref)\n\"\"\"\nmacro generator end\n\n\"\"\"\n bruteforcesearch(f::Function, n::Integer, b::Integer = 2)\n\nApplies `f` for all the ...\n$(\"\"#=TODO: add some equation here for the future reference=#)\n\n!!! note\n By default (i.e. when `b == 2`), this function is equivalent to bit-brute-force search.\n\n```julia-repl\njulia> bruteforcesearch(3) do comb\n @show collect(comb)\n end;\ncollect(mask) = [2, 1, 1]\ncollect(mask) = [1, 2, 1]\ncollect(mask) = [2, 2, 1]\ncollect(mask) = [1, 1, 2]\ncollect(mask) = [2, 1, 2]\ncollect(mask) = [1, 2, 2]\ncollect(mask) = [2, 2, 2]\ncollect(mask) = [1, 1, 1]\n\njulia> bruteforcesearch(2, 3) do comb\n @show collect(comb)\n end;\ncollect(mask) = [2, 1]\ncollect(mask) = [3, 1]\ncollect(mask) = [1, 2]\ncollect(mask) = [2, 2]\ncollect(mask) = [3, 2]\ncollect(mask) = [1, 3]\ncollect(mask) = [2, 3]\ncollect(mask) = [3, 3]\ncollect(mask) = [1, 1]\n```\n\"\"\"\nfunction bruteforcesearch end\n\n# %% library body\n# ---------------\n\nfunction decompose_forblk(forblk)\n @assert Meta.isexpr(forblk, :for) \"for block expression should be given\"\n itrspec, body = forblk.args\n @assert Meta.isexpr(itrspec, :(=)) \"invalid for loop specification\"\n v, itr = itrspec.args\n return body, v, itr\nend\n\nfunction recompose_to_comprehension(forblk, cond = nothing; gen = false)\n body, v, itr = decompose_forblk(forblk)\n return isnothing(cond) ?\n esc(gen ? :(($body for $v in $itr)) : :([$body for $v in $itr])) :\n esc(gen ? :(($body for $v in $itr if $cond)) : :([$body for $v in $itr if $cond]))\nend\n\nfunction walk_and_transform(x, cond = nothing; gen = false)\n Meta.isexpr(x, :for) && return recompose_to_comprehension(x, cond; gen = gen), true\n x isa Expr || return x, false\n for (i, ex) in enumerate(x.args)\n ex, transformed = walk_and_transform(ex, cond; gen = gen)\n x.args[i] = ex\n transformed && return x, true # already transformed\n end\n return x, false\nend\n\nmacro collect(ex) first(walk_and_transform(ex)) end\nmacro collect(cond, ex) first(walk_and_transform(ex, cond)) end\n\nmacro generator(ex) first(walk_and_transform(ex; gen = true)) end\nmacro generator(cond, ex) first(walk_and_transform(ex, cond; gen = true)) end\n\n@inbounds function bruteforcesearch(f::Function, n::Integer, b::Integer = 2)\n baselen = length(string(b, base = 10))\n @collect for i = 1:b^n\n s = reverse(string(i, pad = n, base = b))[1:n] # cut off the overflowed char when `i == base^n`\n comb = @generator for ns in partition(s, baselen)\n parse(Int, ns) + 1 # for 1-based indexing\n end\n f(comb)\n end\nend\n\npartition(a, n) = @generator for i in 1:(length(a)÷n)\n s = 1+n*(i-1)\n e = n*i\n a[s:e]\nend\n\n# %% constants\n# ------------\n\n# %% body\n# -------\n\nfunction main(io = stdin)\n readto(target = '\\n') = readuntil(io, target)\n readnum(T::Type{<:Number} = Int; dlm = isspace, kwargs...) =\n parse.(T, split(readto(), dlm; kwargs...))\n\n # handle IO and stuff\n N, = readnum()\n XYPs = [readnum() for _ in 1:N]\n println.(solve(N, XYPs))\nend\n\nfunction solve(N, XYPs)\n # TODO: precomputation\n Xcaches = [Dict{UInt,Int}() for _ in XYPs]\n Ycaches = [Dict{UInt,Int}() for _ in XYPs]\n\n bruteforcesearch(N, 2) do roads\n Xs = Set(0)\n Ys = Set(0)\n for (road, XYP) in zip(roads, XYPs)\n if road == 1\n push!(Xs, XYP[1])\n else\n push!(Ys, XYP[2])\n end\n end\n\n cache_distances!(XYPs, Xs, Ys, Xcaches, Ycaches)\n end\n\n ret = [typemax(Int) for n in 0:N]\n\n # calculate shortest distances for all the candidates\n bruteforcesearch(N, 3) do roads\n Xs = Set(0)\n Ys = Set(0)\n\n cnt = @collect for (road, XYP) in zip(roads, XYPs)\n if road == 1\n push!(Xs, XYP[1])\n 1\n elseif road == 2\n push!(Ys, XYP[2])\n 1\n else road == 3\n 0 # no road here, no count\n end\n end |> sum\n ret[cnt + 1] = min(ret[cnt + 1], sumup_distances(XYPs, Xs, Ys, Xcaches, Ycaches))\n end |> minimum\n\n return ret\nend\n\nfunction cache_distances!(XYPs, Xs, Ys, Xcaches, Ycaches)\n for ((X, Y, _), Xcache, Ycache) in zip(XYPs, Xcaches, Ycaches)\n cache_distance!(Xcache, X, Xs)\n cache_distance!(Ycache, Y, Xs)\n end\nend\n\nfunction cache_distance!(cache, p, ps)\n k = hash(ps)\n haskey(cache, k) || (cache[k] = shortest_distance(p, ps))\nend\n\nshortest_distance(p, ps) = minimum(abs(p - x) for x in ps)\n\nfunction sumup_distances(XYPs, Xs, Ys, Xcaches, Ycaches)\n @generator for ((_, _, P), Xcache, Ycache) in zip(XYPs, Xcaches, Ycaches)\n get_distance(Xs, Ys, Xcache, Ycache) * P\n end |> sum\nend\n\nget_distance(Xs, Ys, Xcache, Ycache) = min(Xcache[hash(Xs)], Ycache[hash(Ys)])\n\n@static if @isdefined(Juno)\n main(open(replace(@__FILE__, r\"(.+)\\.jl\" => s\"\\1.in\")))\nelse\n main()\nend\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nNew AtCoder City has an infinite grid of streets, as follows:\n\nAt the center of the city stands a clock tower. Let (0, 0) be the coordinates of this point.\n\nA straight street, which we will call East-West Main Street, runs east-west and passes the clock tower. It corresponds to the x-axis in the two-dimensional coordinate plane.\n\nThere are also other infinitely many streets parallel to East-West Main Street, with a distance of 1 between them. They correspond to the lines \\ldots, y = -2, y = -1, y = 1, y = 2, \\ldots in the two-dimensional coordinate plane.\n\nA straight street, which we will call North-South Main Street, runs north-south and passes the clock tower. It corresponds to the y-axis in the two-dimensional coordinate plane.\n\nThere are also other infinitely many streets parallel to North-South Main Street, with a distance of 1 between them. They correspond to the lines \\ldots, x = -2, x = -1, x = 1, x = 2, \\ldots in the two-dimensional coordinate plane.\n\nThere are N residential areas in New AtCoder City. The i-th area is located at the intersection with the coordinates (X_i, Y_i) and has a population of P_i. Each citizen in the city lives in one of these areas.\n\nThe city currently has only two railroads, stretching infinitely, one along East-West Main Street and the other along North-South Main Street.\n\nM-kun, the mayor, thinks that they are not enough for the commuters, so he decides to choose K streets and build a railroad stretching infinitely along each of those streets.\n\nLet the walking distance of each citizen be the distance from his/her residential area to the nearest railroad.\n\nM-kun wants to build railroads so that the sum of the walking distances of all citizens, S, is minimized.\n\nFor each K = 0, 1, 2, \\dots, N, what is the minimum possible value of S after building railroads?\n\nConstraints\n\n1 \\leq N \\leq 15\n\n-10 \\ 000 \\leq X_i \\leq 10 \\ 000\n\n-10 \\ 000 \\leq Y_i \\leq 10 \\ 000\n\n1 \\leq P_i \\leq 1 \\ 000 \\ 000\n\nThe locations of the N residential areas, (X_i, Y_i), are all distinct.\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 P_1\nX_2 Y_2 P_2\n: : :\nX_N Y_N P_N\n\nOutput\n\nPrint the answer in N+1 lines.\n\nThe i-th line (i = 1, \\ldots, N+1) should contain the minimum possible value of S after building railroads for the case K = i-1.\n\nSample Input 1\n\n3\n1 2 300\n3 3 600\n1 4 800\n\nSample Output 1\n\n2900\n900\n0\n0\n\nWhen K = 0, the residents of Area 1, 2, and 3 have to walk the distances of 1, 3, and 1, respectively, to reach a railroad.\n\nThus, the sum of the walking distances of all citizens, S, is 1 \\times 300 + 3 \\times 600 + 1 \\times 800 = 2900.\n\nWhen K = 1, if we build a railroad along the street corresponding to the line y = 4 in the coordinate plane, the walking distances of the citizens of Area 1, 2, and 3 become 1, 1, and 0, respectively.\n\nThen, S = 1 \\times 300 + 1 \\times 600 + 0 \\times 800 = 900.\n\nWe have many other options for where we build the railroad, but none of them makes S less than 900.\n\nWhen K = 2, if we build a railroad along the street corresponding to the lines x = 1 and x = 3 in the coordinate plane, all citizens can reach a railroad with the walking distance of 0, so S = 0. We can also have S = 0 when K = 3.\n\nThe figure below shows the optimal way to build railroads for the cases K = 0, 1, 2.\n\nThe street painted blue represents the roads along which we build railroads.\n\nSample Input 2\n\n5\n3 5 400\n5 3 700\n5 5 1000\n5 7 700\n7 5 400\n\nSample Output 2\n\n13800\n1600\n0\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the cases K = 1, 2.\n\nSample Input 3\n\n6\n2 5 1000\n5 2 1100\n5 5 1700\n-2 -5 900\n-5 -2 600\n-5 -5 2200\n\nSample Output 3\n\n26700\n13900\n3200\n1200\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the case K = 3.\n\nSample Input 4\n\n8\n2 2 286017\n3 1 262355\n2 -2 213815\n1 -3 224435\n-2 -2 136860\n-3 -1 239338\n-2 2 217647\n-1 3 141903\n\nSample Output 4\n\n2576709\n1569381\n868031\n605676\n366338\n141903\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the case K = 4.", "sample_input": "3\n1 2 300\n3 3 600\n1 4 800\n"}, "reference_outputs": ["2900\n900\n0\n0\n"], "source_document_id": "p02604", "source_text": "Score: 500 points\n\nProblem Statement\n\nNew AtCoder City has an infinite grid of streets, as follows:\n\nAt the center of the city stands a clock tower. Let (0, 0) be the coordinates of this point.\n\nA straight street, which we will call East-West Main Street, runs east-west and passes the clock tower. It corresponds to the x-axis in the two-dimensional coordinate plane.\n\nThere are also other infinitely many streets parallel to East-West Main Street, with a distance of 1 between them. They correspond to the lines \\ldots, y = -2, y = -1, y = 1, y = 2, \\ldots in the two-dimensional coordinate plane.\n\nA straight street, which we will call North-South Main Street, runs north-south and passes the clock tower. It corresponds to the y-axis in the two-dimensional coordinate plane.\n\nThere are also other infinitely many streets parallel to North-South Main Street, with a distance of 1 between them. They correspond to the lines \\ldots, x = -2, x = -1, x = 1, x = 2, \\ldots in the two-dimensional coordinate plane.\n\nThere are N residential areas in New AtCoder City. The i-th area is located at the intersection with the coordinates (X_i, Y_i) and has a population of P_i. Each citizen in the city lives in one of these areas.\n\nThe city currently has only two railroads, stretching infinitely, one along East-West Main Street and the other along North-South Main Street.\n\nM-kun, the mayor, thinks that they are not enough for the commuters, so he decides to choose K streets and build a railroad stretching infinitely along each of those streets.\n\nLet the walking distance of each citizen be the distance from his/her residential area to the nearest railroad.\n\nM-kun wants to build railroads so that the sum of the walking distances of all citizens, S, is minimized.\n\nFor each K = 0, 1, 2, \\dots, N, what is the minimum possible value of S after building railroads?\n\nConstraints\n\n1 \\leq N \\leq 15\n\n-10 \\ 000 \\leq X_i \\leq 10 \\ 000\n\n-10 \\ 000 \\leq Y_i \\leq 10 \\ 000\n\n1 \\leq P_i \\leq 1 \\ 000 \\ 000\n\nThe locations of the N residential areas, (X_i, Y_i), are all distinct.\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 P_1\nX_2 Y_2 P_2\n: : :\nX_N Y_N P_N\n\nOutput\n\nPrint the answer in N+1 lines.\n\nThe i-th line (i = 1, \\ldots, N+1) should contain the minimum possible value of S after building railroads for the case K = i-1.\n\nSample Input 1\n\n3\n1 2 300\n3 3 600\n1 4 800\n\nSample Output 1\n\n2900\n900\n0\n0\n\nWhen K = 0, the residents of Area 1, 2, and 3 have to walk the distances of 1, 3, and 1, respectively, to reach a railroad.\n\nThus, the sum of the walking distances of all citizens, S, is 1 \\times 300 + 3 \\times 600 + 1 \\times 800 = 2900.\n\nWhen K = 1, if we build a railroad along the street corresponding to the line y = 4 in the coordinate plane, the walking distances of the citizens of Area 1, 2, and 3 become 1, 1, and 0, respectively.\n\nThen, S = 1 \\times 300 + 1 \\times 600 + 0 \\times 800 = 900.\n\nWe have many other options for where we build the railroad, but none of them makes S less than 900.\n\nWhen K = 2, if we build a railroad along the street corresponding to the lines x = 1 and x = 3 in the coordinate plane, all citizens can reach a railroad with the walking distance of 0, so S = 0. We can also have S = 0 when K = 3.\n\nThe figure below shows the optimal way to build railroads for the cases K = 0, 1, 2.\n\nThe street painted blue represents the roads along which we build railroads.\n\nSample Input 2\n\n5\n3 5 400\n5 3 700\n5 5 1000\n5 7 700\n7 5 400\n\nSample Output 2\n\n13800\n1600\n0\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the cases K = 1, 2.\n\nSample Input 3\n\n6\n2 5 1000\n5 2 1100\n5 5 1700\n-2 -5 900\n-5 -2 600\n-5 -5 2200\n\nSample Output 3\n\n26700\n13900\n3200\n1200\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the case K = 3.\n\nSample Input 4\n\n8\n2 2 286017\n3 1 262355\n2 -2 213815\n1 -3 224435\n-2 -2 136860\n-3 -1 239338\n-2 2 217647\n-1 3 141903\n\nSample Output 4\n\n2576709\n1569381\n868031\n605676\n366338\n141903\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the case K = 4.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 5930, "cpu_time_ms": 3317, "memory_kb": 332096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s365809129", "group_id": "codeNet:p02604", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n\n X = Vector{int}(undef,N)\n Y = Vector{int}(undef,N)\n P = Vector{int}(undef,N)\n for i in 1:N\n X[i],Y[i],P[i] = readint()\n end\n\n \n kai = Vector{int}(undef,N+1)\n kai .= typemax(int)\n\n xmin = Vector{int}(undef,N)\n ymin = Vector{int}(undef,N)\n sasi = Vector{Bool}(undef,N)\n\n for i in 0:3^N-1\n a = i\n c = 0\n sum = 0\n sasi .= false \n for j in 1:N\n xmin[j] = abs(X[j])\n ymin[j] = abs(Y[j])\n if xmin[j] ==0 || ymin[j]==0\n sasi[j] = true\n end\n end\n\n for j in 1:N\n if a%3 == 1\n c += 1 \n sasi[j]=true\n for k in 1:N\n sasi[k] && continue\n if X[k]==X[j]\n sasi[k] = true\n continue\n end\n xmin[k] = min(xmin[k],abs(X[k]-X[j]))\n end\n elseif a%3 == 2\n c += 1\n sasi[j]=true\n for k in 1:N\n sasi[k] && continue\n if Y[k]==Y[j]\n sasi[k] = true\n continue\n end\n ymin[k] = min(ymin[k],abs(Y[k]-Y[j]))\n end\n end\n a ÷= 3\n end\n\n sum = 0\n for j in 1:N\n sasi[j] && continue\n\n sum += min(xmin[j],ymin[j])*P[j]\n end\n kai[c+1] = min(kai[c+1],sum)\n end\n\n for i in 1:N+1\n println(kai[i])\n end\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1595730650, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02604.html", "problem_id": "p02604", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02604/input.txt", "sample_output_relpath": "derived/input_output/data/p02604/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02604/Julia/s365809129.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s365809129", "user_id": "u868531879"}, "prompt_components": {"gold_output": "2900\n900\n0\n0\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n\n X = Vector{int}(undef,N)\n Y = Vector{int}(undef,N)\n P = Vector{int}(undef,N)\n for i in 1:N\n X[i],Y[i],P[i] = readint()\n end\n\n \n kai = Vector{int}(undef,N+1)\n kai .= typemax(int)\n\n xmin = Vector{int}(undef,N)\n ymin = Vector{int}(undef,N)\n sasi = Vector{Bool}(undef,N)\n\n for i in 0:3^N-1\n a = i\n c = 0\n sum = 0\n sasi .= false \n for j in 1:N\n xmin[j] = abs(X[j])\n ymin[j] = abs(Y[j])\n if xmin[j] ==0 || ymin[j]==0\n sasi[j] = true\n end\n end\n\n for j in 1:N\n if a%3 == 1\n c += 1 \n sasi[j]=true\n for k in 1:N\n sasi[k] && continue\n if X[k]==X[j]\n sasi[k] = true\n continue\n end\n xmin[k] = min(xmin[k],abs(X[k]-X[j]))\n end\n elseif a%3 == 2\n c += 1\n sasi[j]=true\n for k in 1:N\n sasi[k] && continue\n if Y[k]==Y[j]\n sasi[k] = true\n continue\n end\n ymin[k] = min(ymin[k],abs(Y[k]-Y[j]))\n end\n end\n a ÷= 3\n end\n\n sum = 0\n for j in 1:N\n sasi[j] && continue\n\n sum += min(xmin[j],ymin[j])*P[j]\n end\n kai[c+1] = min(kai[c+1],sum)\n end\n\n for i in 1:N+1\n println(kai[i])\n end\n\nend\n\nmain()", "problem_context": "Score: 500 points\n\nProblem Statement\n\nNew AtCoder City has an infinite grid of streets, as follows:\n\nAt the center of the city stands a clock tower. Let (0, 0) be the coordinates of this point.\n\nA straight street, which we will call East-West Main Street, runs east-west and passes the clock tower. It corresponds to the x-axis in the two-dimensional coordinate plane.\n\nThere are also other infinitely many streets parallel to East-West Main Street, with a distance of 1 between them. They correspond to the lines \\ldots, y = -2, y = -1, y = 1, y = 2, \\ldots in the two-dimensional coordinate plane.\n\nA straight street, which we will call North-South Main Street, runs north-south and passes the clock tower. It corresponds to the y-axis in the two-dimensional coordinate plane.\n\nThere are also other infinitely many streets parallel to North-South Main Street, with a distance of 1 between them. They correspond to the lines \\ldots, x = -2, x = -1, x = 1, x = 2, \\ldots in the two-dimensional coordinate plane.\n\nThere are N residential areas in New AtCoder City. The i-th area is located at the intersection with the coordinates (X_i, Y_i) and has a population of P_i. Each citizen in the city lives in one of these areas.\n\nThe city currently has only two railroads, stretching infinitely, one along East-West Main Street and the other along North-South Main Street.\n\nM-kun, the mayor, thinks that they are not enough for the commuters, so he decides to choose K streets and build a railroad stretching infinitely along each of those streets.\n\nLet the walking distance of each citizen be the distance from his/her residential area to the nearest railroad.\n\nM-kun wants to build railroads so that the sum of the walking distances of all citizens, S, is minimized.\n\nFor each K = 0, 1, 2, \\dots, N, what is the minimum possible value of S after building railroads?\n\nConstraints\n\n1 \\leq N \\leq 15\n\n-10 \\ 000 \\leq X_i \\leq 10 \\ 000\n\n-10 \\ 000 \\leq Y_i \\leq 10 \\ 000\n\n1 \\leq P_i \\leq 1 \\ 000 \\ 000\n\nThe locations of the N residential areas, (X_i, Y_i), are all distinct.\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 P_1\nX_2 Y_2 P_2\n: : :\nX_N Y_N P_N\n\nOutput\n\nPrint the answer in N+1 lines.\n\nThe i-th line (i = 1, \\ldots, N+1) should contain the minimum possible value of S after building railroads for the case K = i-1.\n\nSample Input 1\n\n3\n1 2 300\n3 3 600\n1 4 800\n\nSample Output 1\n\n2900\n900\n0\n0\n\nWhen K = 0, the residents of Area 1, 2, and 3 have to walk the distances of 1, 3, and 1, respectively, to reach a railroad.\n\nThus, the sum of the walking distances of all citizens, S, is 1 \\times 300 + 3 \\times 600 + 1 \\times 800 = 2900.\n\nWhen K = 1, if we build a railroad along the street corresponding to the line y = 4 in the coordinate plane, the walking distances of the citizens of Area 1, 2, and 3 become 1, 1, and 0, respectively.\n\nThen, S = 1 \\times 300 + 1 \\times 600 + 0 \\times 800 = 900.\n\nWe have many other options for where we build the railroad, but none of them makes S less than 900.\n\nWhen K = 2, if we build a railroad along the street corresponding to the lines x = 1 and x = 3 in the coordinate plane, all citizens can reach a railroad with the walking distance of 0, so S = 0. We can also have S = 0 when K = 3.\n\nThe figure below shows the optimal way to build railroads for the cases K = 0, 1, 2.\n\nThe street painted blue represents the roads along which we build railroads.\n\nSample Input 2\n\n5\n3 5 400\n5 3 700\n5 5 1000\n5 7 700\n7 5 400\n\nSample Output 2\n\n13800\n1600\n0\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the cases K = 1, 2.\n\nSample Input 3\n\n6\n2 5 1000\n5 2 1100\n5 5 1700\n-2 -5 900\n-5 -2 600\n-5 -5 2200\n\nSample Output 3\n\n26700\n13900\n3200\n1200\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the case K = 3.\n\nSample Input 4\n\n8\n2 2 286017\n3 1 262355\n2 -2 213815\n1 -3 224435\n-2 -2 136860\n-3 -1 239338\n-2 2 217647\n-1 3 141903\n\nSample Output 4\n\n2576709\n1569381\n868031\n605676\n366338\n141903\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the case K = 4.", "sample_input": "3\n1 2 300\n3 3 600\n1 4 800\n"}, "reference_outputs": ["2900\n900\n0\n0\n"], "source_document_id": "p02604", "source_text": "Score: 500 points\n\nProblem Statement\n\nNew AtCoder City has an infinite grid of streets, as follows:\n\nAt the center of the city stands a clock tower. Let (0, 0) be the coordinates of this point.\n\nA straight street, which we will call East-West Main Street, runs east-west and passes the clock tower. It corresponds to the x-axis in the two-dimensional coordinate plane.\n\nThere are also other infinitely many streets parallel to East-West Main Street, with a distance of 1 between them. They correspond to the lines \\ldots, y = -2, y = -1, y = 1, y = 2, \\ldots in the two-dimensional coordinate plane.\n\nA straight street, which we will call North-South Main Street, runs north-south and passes the clock tower. It corresponds to the y-axis in the two-dimensional coordinate plane.\n\nThere are also other infinitely many streets parallel to North-South Main Street, with a distance of 1 between them. They correspond to the lines \\ldots, x = -2, x = -1, x = 1, x = 2, \\ldots in the two-dimensional coordinate plane.\n\nThere are N residential areas in New AtCoder City. The i-th area is located at the intersection with the coordinates (X_i, Y_i) and has a population of P_i. Each citizen in the city lives in one of these areas.\n\nThe city currently has only two railroads, stretching infinitely, one along East-West Main Street and the other along North-South Main Street.\n\nM-kun, the mayor, thinks that they are not enough for the commuters, so he decides to choose K streets and build a railroad stretching infinitely along each of those streets.\n\nLet the walking distance of each citizen be the distance from his/her residential area to the nearest railroad.\n\nM-kun wants to build railroads so that the sum of the walking distances of all citizens, S, is minimized.\n\nFor each K = 0, 1, 2, \\dots, N, what is the minimum possible value of S after building railroads?\n\nConstraints\n\n1 \\leq N \\leq 15\n\n-10 \\ 000 \\leq X_i \\leq 10 \\ 000\n\n-10 \\ 000 \\leq Y_i \\leq 10 \\ 000\n\n1 \\leq P_i \\leq 1 \\ 000 \\ 000\n\nThe locations of the N residential areas, (X_i, Y_i), are all distinct.\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 P_1\nX_2 Y_2 P_2\n: : :\nX_N Y_N P_N\n\nOutput\n\nPrint the answer in N+1 lines.\n\nThe i-th line (i = 1, \\ldots, N+1) should contain the minimum possible value of S after building railroads for the case K = i-1.\n\nSample Input 1\n\n3\n1 2 300\n3 3 600\n1 4 800\n\nSample Output 1\n\n2900\n900\n0\n0\n\nWhen K = 0, the residents of Area 1, 2, and 3 have to walk the distances of 1, 3, and 1, respectively, to reach a railroad.\n\nThus, the sum of the walking distances of all citizens, S, is 1 \\times 300 + 3 \\times 600 + 1 \\times 800 = 2900.\n\nWhen K = 1, if we build a railroad along the street corresponding to the line y = 4 in the coordinate plane, the walking distances of the citizens of Area 1, 2, and 3 become 1, 1, and 0, respectively.\n\nThen, S = 1 \\times 300 + 1 \\times 600 + 0 \\times 800 = 900.\n\nWe have many other options for where we build the railroad, but none of them makes S less than 900.\n\nWhen K = 2, if we build a railroad along the street corresponding to the lines x = 1 and x = 3 in the coordinate plane, all citizens can reach a railroad with the walking distance of 0, so S = 0. We can also have S = 0 when K = 3.\n\nThe figure below shows the optimal way to build railroads for the cases K = 0, 1, 2.\n\nThe street painted blue represents the roads along which we build railroads.\n\nSample Input 2\n\n5\n3 5 400\n5 3 700\n5 5 1000\n5 7 700\n7 5 400\n\nSample Output 2\n\n13800\n1600\n0\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the cases K = 1, 2.\n\nSample Input 3\n\n6\n2 5 1000\n5 2 1100\n5 5 1700\n-2 -5 900\n-5 -2 600\n-5 -5 2200\n\nSample Output 3\n\n26700\n13900\n3200\n1200\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the case K = 3.\n\nSample Input 4\n\n8\n2 2 286017\n3 1 262355\n2 -2 213815\n1 -3 224435\n-2 -2 136860\n-3 -1 239338\n-2 2 217647\n-1 3 141903\n\nSample Output 4\n\n2576709\n1569381\n868031\n605676\n366338\n141903\n0\n0\n0\n\nThe figure below shows the optimal way to build railroads for the case K = 4.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3314, "memory_kb": 196872}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s856335407", "group_id": "codeNet:p02606", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n L,R,d = parseMap(split(readline()))\n count = 0\n for i in L:R\n if i%d ==0\n count+=1\n end\n end\n println(\"$count\")\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1594515807, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s856335407.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s856335407", "user_id": "u524573278"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n L,R,d = parseMap(split(readline()))\n count = 0\n for i in L:R\n if i%d ==0\n count+=1\n end\n end\n println(\"$count\")\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 243, "cpu_time_ms": 231, "memory_kb": 162704}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s646054417", "group_id": "codeNet:p02606", "input_text": "readints()=parse.(Int,split(readline()))\nL,R,d=readints()\n\nprint(R÷d-(L-1)÷d)", "language": "Julia", "metadata": {"date": 1594515788, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s646054417.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s646054417", "user_id": "u562051766"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "readints()=parse.(Int,split(readline()))\nL,R,d=readints()\n\nprint(R÷d-(L-1)÷d)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 253, "memory_kb": 168656}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s062896179", "group_id": "codeNet:p02607", "input_text": "function main()\n N = pread(Int)\n a = readvec(Int, N)\n c = 0\n for i in 1:2:N\n if isodd(a[i])\n c += 1\n end\n end\n println(c)\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1594516686, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02607.html", "problem_id": "p02607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02607/input.txt", "sample_output_relpath": "derived/input_output/data/p02607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02607/Julia/s062896179.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s062896179", "user_id": "u729767359"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n N = pread(Int)\n a = readvec(Int, N)\n c = 0\n for i in 1:2:N\n if isodd(a[i])\n c += 1\n end\n end\n println(c)\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N squares assigned the numbers 1,2,3,\\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i.\n\nHow many squares i satisfy both of the following conditions?\n\nThe assigned number, i, is odd.\n\nThe written integer is odd.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, a_i \\leq 100\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 number of squares that satisfy both of the conditions.\n\nSample Input 1\n\n5\n1 3 4 5 7\n\nSample Output 1\n\n2\n\nTwo squares, Square 1 and 5, satisfy both of the conditions.\n\nFor Square 2 and 4, the assigned numbers are not odd.\n\nFor Square 3, the written integer is not odd.\n\nSample Input 2\n\n15\n13 76 46 15 50 98 93 77 31 43 84 90 6 24 14\n\nSample Output 2\n\n3", "sample_input": "5\n1 3 4 5 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02607", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N squares assigned the numbers 1,2,3,\\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i.\n\nHow many squares i satisfy both of the following conditions?\n\nThe assigned number, i, is odd.\n\nThe written integer is odd.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, a_i \\leq 100\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 number of squares that satisfy both of the conditions.\n\nSample Input 1\n\n5\n1 3 4 5 7\n\nSample Output 1\n\n2\n\nTwo squares, Square 1 and 5, satisfy both of the conditions.\n\nFor Square 2 and 4, the assigned numbers are not odd.\n\nFor Square 3, the written integer is not odd.\n\nSample Input 2\n\n15\n13 76 46 15 50 98 93 77 31 43 84 90 6 24 14\n\nSample Output 2\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1683, "cpu_time_ms": 385, "memory_kb": 187332}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s498086100", "group_id": "codeNet:p02607", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n N = parseInt(readline())\n a = parseMap(split(readline()))\n\n num = 0\n for i in 1:2:N\n if a[i] % 2 == 1\n num += 1\n end\n #println(\"$i\")\n end\n\n\n println(\"$num\")\n\n# if mod(a,1000) != 0\n# println(1000-mod(a,1000))\n# else\n# println(0)\n# end\nend\nmain()", "language": "Julia", "metadata": {"date": 1594516090, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02607.html", "problem_id": "p02607", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02607/input.txt", "sample_output_relpath": "derived/input_output/data/p02607/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02607/Julia/s498086100.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s498086100", "user_id": "u524573278"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n N = parseInt(readline())\n a = parseMap(split(readline()))\n\n num = 0\n for i in 1:2:N\n if a[i] % 2 == 1\n num += 1\n end\n #println(\"$i\")\n end\n\n\n println(\"$num\")\n\n# if mod(a,1000) != 0\n# println(1000-mod(a,1000))\n# else\n# println(0)\n# end\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have N squares assigned the numbers 1,2,3,\\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i.\n\nHow many squares i satisfy both of the following conditions?\n\nThe assigned number, i, is odd.\n\nThe written integer is odd.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, a_i \\leq 100\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 number of squares that satisfy both of the conditions.\n\nSample Input 1\n\n5\n1 3 4 5 7\n\nSample Output 1\n\n2\n\nTwo squares, Square 1 and 5, satisfy both of the conditions.\n\nFor Square 2 and 4, the assigned numbers are not odd.\n\nFor Square 3, the written integer is not odd.\n\nSample Input 2\n\n15\n13 76 46 15 50 98 93 77 31 43 84 90 6 24 14\n\nSample Output 2\n\n3", "sample_input": "5\n1 3 4 5 7\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02607", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have N squares assigned the numbers 1,2,3,\\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i.\n\nHow many squares i satisfy both of the following conditions?\n\nThe assigned number, i, is odd.\n\nThe written integer is odd.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, a_i \\leq 100\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 number of squares that satisfy both of the conditions.\n\nSample Input 1\n\n5\n1 3 4 5 7\n\nSample Output 1\n\n2\n\nTwo squares, Square 1 and 5, satisfy both of the conditions.\n\nFor Square 2 and 4, the assigned numbers are not odd.\n\nFor Square 3, the written integer is not odd.\n\nSample Input 2\n\n15\n13 76 46 15 50 98 93 77 31 43 84 90 6 24 14\n\nSample Output 2\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 220, "memory_kb": 161940}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s150941718", "group_id": "codeNet:p02608", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n = readline() |> parseInt\n\n f = zeros(Int, 10000)\n\n for x in 1:100\n for y in 1:100\n for z in 1:100\n m = x*x + y*y + z*z + x*y + y*z + z*x\n m <= 10000 && (f[m] += 1)\n end\n end\n end\n println.(f[1:n])\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1594517217, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s150941718.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s150941718", "user_id": "u630185395"}, "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": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n = readline() |> parseInt\n\n f = zeros(Int, 10000)\n\n for x in 1:100\n for y in 1:100\n for z in 1:100\n m = x*x + y*y + z*z + x*y + y*z + z*x\n m <= 10000 && (f[m] += 1)\n end\n end\n end\n println.(f[1:n])\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 253, "memory_kb": 173224}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s603139916", "group_id": "codeNet:p02608", "input_text": "function main()\n n = parse(Int, readline())\n ans = Dict{Int, Int}()\n for x in 1:100\n for y in 1:100\n for z in 1:100\n ret = g(x,y,z)\n ret > n && break\n if haskey(ans, ret)\n ans[ret] += 1\n else\n ans[ret] = 1\n end\n end\n end\n end\n\n for i in 1:n\n if haskey(ans, i)\n println(ans[i])\n else\n println(0)\n end\n end\nend\n\ng(x,y,z) = x^2 + y^2 + z^2 + x*y + y*z + z*x\n\nmain()", "language": "Julia", "metadata": {"date": 1594516941, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s603139916.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s603139916", "user_id": "u624923345"}, "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": "function main()\n n = parse(Int, readline())\n ans = Dict{Int, Int}()\n for x in 1:100\n for y in 1:100\n for z in 1:100\n ret = g(x,y,z)\n ret > n && break\n if haskey(ans, ret)\n ans[ret] += 1\n else\n ans[ret] = 1\n end\n end\n end\n end\n\n for i in 1:n\n if haskey(ans, i)\n println(ans[i])\n else\n println(0)\n end\n end\nend\n\ng(x,y,z) = x^2 + y^2 + z^2 + x*y + y*z + z*x\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 245, "memory_kb": 163380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s518579655", "group_id": "codeNet:p02608", "input_text": "readint()=parse.(Int,readline())\nfunction check(n)\n Nmax=100\n ff=zeros(Int,n)\n for x in 1:Nmax,y in 1:Nmax,z in 1:Nmax\n s=x^2+y^2+z^2+x*y+y*z+z*x\n if s<=n\n ff[s]+=1\n end\n end\n for i in 1:n\n println(ff[i])\n end\nend\ncheck(readint())", "language": "Julia", "metadata": {"date": 1594516898, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s518579655.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s518579655", "user_id": "u562051766"}, "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": "readint()=parse.(Int,readline())\nfunction check(n)\n Nmax=100\n ff=zeros(Int,n)\n for x in 1:Nmax,y in 1:Nmax,z in 1:Nmax\n s=x^2+y^2+z^2+x*y+y*z+z*x\n if s<=n\n ff[s]+=1\n end\n end\n for i in 1:n\n println(ff[i])\n end\nend\ncheck(readint())", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 257, "memory_kb": 165784}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s421243796", "group_id": "codeNet:p02609", "input_text": "function main()\n N = pread(Int)\n X = reverse(pread(String))\n pc = count(x -> x == '1', X)\n cp = parse(BigInt, reverse(X), base=2) % (pc + 1)\n\n ap = zeros(Int, N)\n am = zeros(Int, N)\n ap[1] = 1\n am[1] = 1\n\n for i in 2:N\n ap[i] = ap[i-1]<<1 % (pc+1)\n end\n cm = 0\n if (pc-1) != 0\n cm = parse(BigInt, reverse(X), base=2) % (pc - 1)\n for i in 2:N\n am[i] = am[i-1] << 1 % (pc-1)\n end\n end\n ans = zeros(Int,N)\n for i in 1:N\n c = (X[i]=='1' ? cm : cp)\n ppm = (pc + (X[i]=='1' ? -1 : 1))\n ppm == 0 && continue\n tmp = (ppm + c + (X[i]=='1' ? -am[i] : ap[i])) % ppm\n cc = 1\n while tmp != 0\n tmp = tmp % count_ones(tmp)\n cc += 1\n end\n ans[i] = cc\n end\n for i in N:-1:1\n println(ans[i])\n end\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1594759772, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02609.html", "problem_id": "p02609", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02609/input.txt", "sample_output_relpath": "derived/input_output/data/p02609/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02609/Julia/s421243796.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s421243796", "user_id": "u729767359"}, "prompt_components": {"gold_output": "2\n1\n1\n", "input_to_evaluate": "function main()\n N = pread(Int)\n X = reverse(pread(String))\n pc = count(x -> x == '1', X)\n cp = parse(BigInt, reverse(X), base=2) % (pc + 1)\n\n ap = zeros(Int, N)\n am = zeros(Int, N)\n ap[1] = 1\n am[1] = 1\n\n for i in 2:N\n ap[i] = ap[i-1]<<1 % (pc+1)\n end\n cm = 0\n if (pc-1) != 0\n cm = parse(BigInt, reverse(X), base=2) % (pc - 1)\n for i in 2:N\n am[i] = am[i-1] << 1 % (pc-1)\n end\n end\n ans = zeros(Int,N)\n for i in 1:N\n c = (X[i]=='1' ? cm : cp)\n ppm = (pc + (X[i]=='1' ? -1 : 1))\n ppm == 0 && continue\n tmp = (ppm + c + (X[i]=='1' ? -am[i] : ap[i])) % ppm\n cc = 1\n while tmp != 0\n tmp = tmp % count_ones(tmp)\n cc += 1\n end\n ans[i] = cc\n end\n for i in N:-1:1\n println(ans[i])\n end\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nLet \\mathrm{popcount}(n) be the number of 1s in the binary representation of n.\nFor example, \\mathrm{popcount}(3) = 2, \\mathrm{popcount}(7) = 3, and \\mathrm{popcount}(0) = 0.\n\nLet f(n) be the number of times the following operation will be done when we repeat it until n becomes 0: \"replace n with the remainder when n is divided by \\mathrm{popcount}(n).\" (It can be proved that, under the constraints of this problem, n always becomes 0 after a finite number of operations.)\n\nFor example, when n=7, it becomes 0 after two operations, as follows:\n\n\\mathrm{popcount}(7)=3, so we divide 7 by 3 and replace it with the remainder, 1.\n\n\\mathrm{popcount}(1)=1, so we divide 1 by 1 and replace it with the remainder, 0.\n\nYou are given an integer X with N digits in binary.\nFor each integer i such that 1 \\leq i \\leq N, let X_i be what X becomes when the i-th bit from the top is inverted.\nFind f(X_1), f(X_2), \\ldots, f(X_N).\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nX is an integer with N digits in binary, possibly with leading zeros.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(X_i).\n\nSample Input 1\n\n3\n011\n\nSample Output 1\n\n2\n1\n1\n\nX_1 = 7, which will change as follows: 7 \\rightarrow 1 \\rightarrow 0. Thus, f(7) = 2.\n\nX_2 = 1, which will change as follows: 1 \\rightarrow 0. Thus, f(1) = 1.\n\nX_3 = 2, which will change as follows: 2 \\rightarrow 0. Thus, f(2) = 1.\n\nSample Input 2\n\n23\n00110111001011011001110\n\nSample Output 2\n\n2\n1\n2\n2\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n3", "sample_input": "3\n011\n"}, "reference_outputs": ["2\n1\n1\n"], "source_document_id": "p02609", "source_text": "Score : 400 points\n\nProblem Statement\n\nLet \\mathrm{popcount}(n) be the number of 1s in the binary representation of n.\nFor example, \\mathrm{popcount}(3) = 2, \\mathrm{popcount}(7) = 3, and \\mathrm{popcount}(0) = 0.\n\nLet f(n) be the number of times the following operation will be done when we repeat it until n becomes 0: \"replace n with the remainder when n is divided by \\mathrm{popcount}(n).\" (It can be proved that, under the constraints of this problem, n always becomes 0 after a finite number of operations.)\n\nFor example, when n=7, it becomes 0 after two operations, as follows:\n\n\\mathrm{popcount}(7)=3, so we divide 7 by 3 and replace it with the remainder, 1.\n\n\\mathrm{popcount}(1)=1, so we divide 1 by 1 and replace it with the remainder, 0.\n\nYou are given an integer X with N digits in binary.\nFor each integer i such that 1 \\leq i \\leq N, let X_i be what X becomes when the i-th bit from the top is inverted.\nFind f(X_1), f(X_2), \\ldots, f(X_N).\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nX is an integer with N digits in binary, possibly with leading zeros.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(X_i).\n\nSample Input 1\n\n3\n011\n\nSample Output 1\n\n2\n1\n1\n\nX_1 = 7, which will change as follows: 7 \\rightarrow 1 \\rightarrow 0. Thus, f(7) = 2.\n\nX_2 = 1, which will change as follows: 1 \\rightarrow 0. Thus, f(1) = 1.\n\nX_3 = 2, which will change as follows: 2 \\rightarrow 0. Thus, f(2) = 1.\n\nSample Input 2\n\n23\n00110111001011011001110\n\nSample Output 2\n\n2\n1\n2\n2\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2375, "cpu_time_ms": 880, "memory_kb": 326164}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s532648550", "group_id": "codeNet:p02609", "input_text": "function main()\n N = pread(Int)\n X = reverse(pread(String))\n pc = count(x -> x == '1', X)\n cp = parse(Int, X[min(32,N):-1:1], base=2) % (pc + 1)\n for i in 33:32:N\n cp += parse(Int, X[min(i+31,N):-1:i], base=2) << 32 % (pc + 1)\n cp %= (pc + 1)\n end\n ap = zeros(Int, N)\n am = zeros(Int, N)\n ap[1] = 1\n am[1] = 1\n for i in 2:N\n ap[i] = ap[i-1]<<1 % (pc+1)\n end\n cm = 0\n if (pc-1) != 0\n cm = parse(Int, X[min(32,N):-1:1], base=2) % (pc - 1)\n for i in 33:32:N\n cm += parse(Int, X[min(i+31,N):-1:i], base=2) << 32 % (pc - 1)\n cm %= (pc - 1)\n end\n for i in 2:N\n am[i] = am[i-1]<<1 % (pc-1)\n end\n end\n ans = zeros(Int,N)\n for i in 1:N\n c = (X[i]=='1' ? cm : cp)\n ppm = (pc + (X[i]=='1' ? -1 : 1))\n if ppm == 0\n push!(ans, 0)\n continue\n end\n tmp = (ppm + c + (X[i]=='1' ? -am[i] : ap[i])) % ppm\n cc = 1\n while tmp != 0\n tmp = tmp % count_ones(tmp)\n cc += 1\n end\n ans[i] = cc\n end\n for i in N:-1:1\n println(ans[i])\n end\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1594757326, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02609.html", "problem_id": "p02609", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02609/input.txt", "sample_output_relpath": "derived/input_output/data/p02609/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02609/Julia/s532648550.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s532648550", "user_id": "u729767359"}, "prompt_components": {"gold_output": "2\n1\n1\n", "input_to_evaluate": "function main()\n N = pread(Int)\n X = reverse(pread(String))\n pc = count(x -> x == '1', X)\n cp = parse(Int, X[min(32,N):-1:1], base=2) % (pc + 1)\n for i in 33:32:N\n cp += parse(Int, X[min(i+31,N):-1:i], base=2) << 32 % (pc + 1)\n cp %= (pc + 1)\n end\n ap = zeros(Int, N)\n am = zeros(Int, N)\n ap[1] = 1\n am[1] = 1\n for i in 2:N\n ap[i] = ap[i-1]<<1 % (pc+1)\n end\n cm = 0\n if (pc-1) != 0\n cm = parse(Int, X[min(32,N):-1:1], base=2) % (pc - 1)\n for i in 33:32:N\n cm += parse(Int, X[min(i+31,N):-1:i], base=2) << 32 % (pc - 1)\n cm %= (pc - 1)\n end\n for i in 2:N\n am[i] = am[i-1]<<1 % (pc-1)\n end\n end\n ans = zeros(Int,N)\n for i in 1:N\n c = (X[i]=='1' ? cm : cp)\n ppm = (pc + (X[i]=='1' ? -1 : 1))\n if ppm == 0\n push!(ans, 0)\n continue\n end\n tmp = (ppm + c + (X[i]=='1' ? -am[i] : ap[i])) % ppm\n cc = 1\n while tmp != 0\n tmp = tmp % count_ones(tmp)\n cc += 1\n end\n ans[i] = cc\n end\n for i in N:-1:1\n println(ans[i])\n end\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nLet \\mathrm{popcount}(n) be the number of 1s in the binary representation of n.\nFor example, \\mathrm{popcount}(3) = 2, \\mathrm{popcount}(7) = 3, and \\mathrm{popcount}(0) = 0.\n\nLet f(n) be the number of times the following operation will be done when we repeat it until n becomes 0: \"replace n with the remainder when n is divided by \\mathrm{popcount}(n).\" (It can be proved that, under the constraints of this problem, n always becomes 0 after a finite number of operations.)\n\nFor example, when n=7, it becomes 0 after two operations, as follows:\n\n\\mathrm{popcount}(7)=3, so we divide 7 by 3 and replace it with the remainder, 1.\n\n\\mathrm{popcount}(1)=1, so we divide 1 by 1 and replace it with the remainder, 0.\n\nYou are given an integer X with N digits in binary.\nFor each integer i such that 1 \\leq i \\leq N, let X_i be what X becomes when the i-th bit from the top is inverted.\nFind f(X_1), f(X_2), \\ldots, f(X_N).\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nX is an integer with N digits in binary, possibly with leading zeros.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(X_i).\n\nSample Input 1\n\n3\n011\n\nSample Output 1\n\n2\n1\n1\n\nX_1 = 7, which will change as follows: 7 \\rightarrow 1 \\rightarrow 0. Thus, f(7) = 2.\n\nX_2 = 1, which will change as follows: 1 \\rightarrow 0. Thus, f(1) = 1.\n\nX_3 = 2, which will change as follows: 2 \\rightarrow 0. Thus, f(2) = 1.\n\nSample Input 2\n\n23\n00110111001011011001110\n\nSample Output 2\n\n2\n1\n2\n2\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n3", "sample_input": "3\n011\n"}, "reference_outputs": ["2\n1\n1\n"], "source_document_id": "p02609", "source_text": "Score : 400 points\n\nProblem Statement\n\nLet \\mathrm{popcount}(n) be the number of 1s in the binary representation of n.\nFor example, \\mathrm{popcount}(3) = 2, \\mathrm{popcount}(7) = 3, and \\mathrm{popcount}(0) = 0.\n\nLet f(n) be the number of times the following operation will be done when we repeat it until n becomes 0: \"replace n with the remainder when n is divided by \\mathrm{popcount}(n).\" (It can be proved that, under the constraints of this problem, n always becomes 0 after a finite number of operations.)\n\nFor example, when n=7, it becomes 0 after two operations, as follows:\n\n\\mathrm{popcount}(7)=3, so we divide 7 by 3 and replace it with the remainder, 1.\n\n\\mathrm{popcount}(1)=1, so we divide 1 by 1 and replace it with the remainder, 0.\n\nYou are given an integer X with N digits in binary.\nFor each integer i such that 1 \\leq i \\leq N, let X_i be what X becomes when the i-th bit from the top is inverted.\nFind f(X_1), f(X_2), \\ldots, f(X_N).\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nX is an integer with N digits in binary, possibly with leading zeros.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(X_i).\n\nSample Input 1\n\n3\n011\n\nSample Output 1\n\n2\n1\n1\n\nX_1 = 7, which will change as follows: 7 \\rightarrow 1 \\rightarrow 0. Thus, f(7) = 2.\n\nX_2 = 1, which will change as follows: 1 \\rightarrow 0. Thus, f(1) = 1.\n\nX_3 = 2, which will change as follows: 2 \\rightarrow 0. Thus, f(2) = 1.\n\nSample Input 2\n\n23\n00110111001011011001110\n\nSample Output 2\n\n2\n1\n2\n2\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2691, "cpu_time_ms": 2211, "memory_kb": 215600}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s352305057", "group_id": "codeNet:p02609", "input_text": "readint()=parse.(Int,readline())\nN=readint()\nS=readline()\npopcount(n)=sum(digits(n,base=2))\nfunction f(n)\n s=0\n while n!=0\n n%=popcount(n)\n s+=1\n end\n s\nend\nfunction bitRev(X,N,i)\n if (X >> (N-i) & 1)==1\n X-=2^(N-i)\n else\n X+=2^(N-i)\n end\n X\nend\n#X=parse(Int,S,base=2)\nSs=split(S,\"\")\nfunction bit2Int(N,Ss)\n X=0\n\tfor i in 1:N\n \t\tSs[i]==\"1\" && (X+=big(2)^(N-i))\n\tend\n X\nend\nX=bit2Int(N,Ss)\nfor i in 1:N\n println(f(bitRev(X,N,i)))\nend", "language": "Julia", "metadata": {"date": 1594521024, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02609.html", "problem_id": "p02609", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02609/input.txt", "sample_output_relpath": "derived/input_output/data/p02609/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02609/Julia/s352305057.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s352305057", "user_id": "u562051766"}, "prompt_components": {"gold_output": "2\n1\n1\n", "input_to_evaluate": "readint()=parse.(Int,readline())\nN=readint()\nS=readline()\npopcount(n)=sum(digits(n,base=2))\nfunction f(n)\n s=0\n while n!=0\n n%=popcount(n)\n s+=1\n end\n s\nend\nfunction bitRev(X,N,i)\n if (X >> (N-i) & 1)==1\n X-=2^(N-i)\n else\n X+=2^(N-i)\n end\n X\nend\n#X=parse(Int,S,base=2)\nSs=split(S,\"\")\nfunction bit2Int(N,Ss)\n X=0\n\tfor i in 1:N\n \t\tSs[i]==\"1\" && (X+=big(2)^(N-i))\n\tend\n X\nend\nX=bit2Int(N,Ss)\nfor i in 1:N\n println(f(bitRev(X,N,i)))\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\nLet \\mathrm{popcount}(n) be the number of 1s in the binary representation of n.\nFor example, \\mathrm{popcount}(3) = 2, \\mathrm{popcount}(7) = 3, and \\mathrm{popcount}(0) = 0.\n\nLet f(n) be the number of times the following operation will be done when we repeat it until n becomes 0: \"replace n with the remainder when n is divided by \\mathrm{popcount}(n).\" (It can be proved that, under the constraints of this problem, n always becomes 0 after a finite number of operations.)\n\nFor example, when n=7, it becomes 0 after two operations, as follows:\n\n\\mathrm{popcount}(7)=3, so we divide 7 by 3 and replace it with the remainder, 1.\n\n\\mathrm{popcount}(1)=1, so we divide 1 by 1 and replace it with the remainder, 0.\n\nYou are given an integer X with N digits in binary.\nFor each integer i such that 1 \\leq i \\leq N, let X_i be what X becomes when the i-th bit from the top is inverted.\nFind f(X_1), f(X_2), \\ldots, f(X_N).\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nX is an integer with N digits in binary, possibly with leading zeros.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(X_i).\n\nSample Input 1\n\n3\n011\n\nSample Output 1\n\n2\n1\n1\n\nX_1 = 7, which will change as follows: 7 \\rightarrow 1 \\rightarrow 0. Thus, f(7) = 2.\n\nX_2 = 1, which will change as follows: 1 \\rightarrow 0. Thus, f(1) = 1.\n\nX_3 = 2, which will change as follows: 2 \\rightarrow 0. Thus, f(2) = 1.\n\nSample Input 2\n\n23\n00110111001011011001110\n\nSample Output 2\n\n2\n1\n2\n2\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n3", "sample_input": "3\n011\n"}, "reference_outputs": ["2\n1\n1\n"], "source_document_id": "p02609", "source_text": "Score : 400 points\n\nProblem Statement\n\nLet \\mathrm{popcount}(n) be the number of 1s in the binary representation of n.\nFor example, \\mathrm{popcount}(3) = 2, \\mathrm{popcount}(7) = 3, and \\mathrm{popcount}(0) = 0.\n\nLet f(n) be the number of times the following operation will be done when we repeat it until n becomes 0: \"replace n with the remainder when n is divided by \\mathrm{popcount}(n).\" (It can be proved that, under the constraints of this problem, n always becomes 0 after a finite number of operations.)\n\nFor example, when n=7, it becomes 0 after two operations, as follows:\n\n\\mathrm{popcount}(7)=3, so we divide 7 by 3 and replace it with the remainder, 1.\n\n\\mathrm{popcount}(1)=1, so we divide 1 by 1 and replace it with the remainder, 0.\n\nYou are given an integer X with N digits in binary.\nFor each integer i such that 1 \\leq i \\leq N, let X_i be what X becomes when the i-th bit from the top is inverted.\nFind f(X_1), f(X_2), \\ldots, f(X_N).\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nX is an integer with N digits in binary, possibly with leading zeros.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(X_i).\n\nSample Input 1\n\n3\n011\n\nSample Output 1\n\n2\n1\n1\n\nX_1 = 7, which will change as follows: 7 \\rightarrow 1 \\rightarrow 0. Thus, f(7) = 2.\n\nX_2 = 1, which will change as follows: 1 \\rightarrow 0. Thus, f(1) = 1.\n\nX_3 = 2, which will change as follows: 2 \\rightarrow 0. Thus, f(2) = 1.\n\nSample Input 2\n\n23\n00110111001011011001110\n\nSample Output 2\n\n2\n1\n2\n2\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2213, "memory_kb": 270776}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s329639925", "group_id": "codeNet:p02609", "input_text": "function main()\n N = pread(Int)\n x = parse(Int, pread(String), base=2)\n for i in 1:N\n a = xor(x, 1<<(N-i))\n tmp = Int(a % count_ones(a))\n c = 1\n while tmp != 0\n tmp = tmp % count_ones(tmp)\n c += 1\n end\n println(c)\n end\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1594520733, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02609.html", "problem_id": "p02609", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02609/input.txt", "sample_output_relpath": "derived/input_output/data/p02609/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02609/Julia/s329639925.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s329639925", "user_id": "u729767359"}, "prompt_components": {"gold_output": "2\n1\n1\n", "input_to_evaluate": "function main()\n N = pread(Int)\n x = parse(Int, pread(String), base=2)\n for i in 1:N\n a = xor(x, 1<<(N-i))\n tmp = Int(a % count_ones(a))\n c = 1\n while tmp != 0\n tmp = tmp % count_ones(tmp)\n c += 1\n end\n println(c)\n end\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nLet \\mathrm{popcount}(n) be the number of 1s in the binary representation of n.\nFor example, \\mathrm{popcount}(3) = 2, \\mathrm{popcount}(7) = 3, and \\mathrm{popcount}(0) = 0.\n\nLet f(n) be the number of times the following operation will be done when we repeat it until n becomes 0: \"replace n with the remainder when n is divided by \\mathrm{popcount}(n).\" (It can be proved that, under the constraints of this problem, n always becomes 0 after a finite number of operations.)\n\nFor example, when n=7, it becomes 0 after two operations, as follows:\n\n\\mathrm{popcount}(7)=3, so we divide 7 by 3 and replace it with the remainder, 1.\n\n\\mathrm{popcount}(1)=1, so we divide 1 by 1 and replace it with the remainder, 0.\n\nYou are given an integer X with N digits in binary.\nFor each integer i such that 1 \\leq i \\leq N, let X_i be what X becomes when the i-th bit from the top is inverted.\nFind f(X_1), f(X_2), \\ldots, f(X_N).\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nX is an integer with N digits in binary, possibly with leading zeros.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(X_i).\n\nSample Input 1\n\n3\n011\n\nSample Output 1\n\n2\n1\n1\n\nX_1 = 7, which will change as follows: 7 \\rightarrow 1 \\rightarrow 0. Thus, f(7) = 2.\n\nX_2 = 1, which will change as follows: 1 \\rightarrow 0. Thus, f(1) = 1.\n\nX_3 = 2, which will change as follows: 2 \\rightarrow 0. Thus, f(2) = 1.\n\nSample Input 2\n\n23\n00110111001011011001110\n\nSample Output 2\n\n2\n1\n2\n2\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n3", "sample_input": "3\n011\n"}, "reference_outputs": ["2\n1\n1\n"], "source_document_id": "p02609", "source_text": "Score : 400 points\n\nProblem Statement\n\nLet \\mathrm{popcount}(n) be the number of 1s in the binary representation of n.\nFor example, \\mathrm{popcount}(3) = 2, \\mathrm{popcount}(7) = 3, and \\mathrm{popcount}(0) = 0.\n\nLet f(n) be the number of times the following operation will be done when we repeat it until n becomes 0: \"replace n with the remainder when n is divided by \\mathrm{popcount}(n).\" (It can be proved that, under the constraints of this problem, n always becomes 0 after a finite number of operations.)\n\nFor example, when n=7, it becomes 0 after two operations, as follows:\n\n\\mathrm{popcount}(7)=3, so we divide 7 by 3 and replace it with the remainder, 1.\n\n\\mathrm{popcount}(1)=1, so we divide 1 by 1 and replace it with the remainder, 0.\n\nYou are given an integer X with N digits in binary.\nFor each integer i such that 1 \\leq i \\leq N, let X_i be what X becomes when the i-th bit from the top is inverted.\nFind f(X_1), f(X_2), \\ldots, f(X_N).\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\nX is an integer with N digits in binary, possibly with leading zeros.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nX\n\nOutput\n\nPrint N lines. The i-th line should contain the value f(X_i).\n\nSample Input 1\n\n3\n011\n\nSample Output 1\n\n2\n1\n1\n\nX_1 = 7, which will change as follows: 7 \\rightarrow 1 \\rightarrow 0. Thus, f(7) = 2.\n\nX_2 = 1, which will change as follows: 1 \\rightarrow 0. Thus, f(1) = 1.\n\nX_3 = 2, which will change as follows: 2 \\rightarrow 0. Thus, f(2) = 1.\n\nSample Input 2\n\n23\n00110111001011011001110\n\nSample Output 2\n\n2\n1\n2\n2\n1\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n2\n1\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1813, "cpu_time_ms": 1595, "memory_kb": 311776}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s392575744", "group_id": "codeNet:p02613", "input_text": "function main()\n \n N = parse(Int, readline())\n\n dict = Dict(\"AC\" => 0, \"WA\" => 0, \"TLE\" => 0, \"RE\" => 0)\n \n for i in 1:N\n S = chomp(readline())\n dict[S] = get(dict, S, 0) + 1\n end\n \n for i in [\"AC\", \"WA\", \"TLE\", \"RE\"]\n println(i, \" x \", dict[i])\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1594078683, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s392575744.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s392575744", "user_id": "u790457721"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "function main()\n \n N = parse(Int, readline())\n\n dict = Dict(\"AC\" => 0, \"WA\" => 0, \"TLE\" => 0, \"RE\" => 0)\n \n for i in 1:N\n S = chomp(readline())\n dict[S] = get(dict, S, 0) + 1\n end\n \n for i in [\"AC\", \"WA\", \"TLE\", \"RE\"]\n println(i, \" x \", dict[i])\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 300, "memory_kb": 203996}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s391423911", "group_id": "codeNet:p02613", "input_text": "function main()\n n = parse(Int, readline())\n ans = zeros(Int, 4)\n for i in 1:n\n s = readline()\n s == \"AC\" && (ans[1] += 1)\n s == \"WA\" && (ans[2] += 1)\n s == \"TLE\" && (ans[3] += 1)\n s == \"RE\" && (ans[4] += 1)\n end\n\n println(\"AC x \", ans[1])\n println(\"WA x \", ans[2])\n println(\"TLE x \", ans[3])\n println(\"RE x \", ans[4])\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1593997815, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s391423911.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s391423911", "user_id": "u624923345"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "function main()\n n = parse(Int, readline())\n ans = zeros(Int, 4)\n for i in 1:n\n s = readline()\n s == \"AC\" && (ans[1] += 1)\n s == \"WA\" && (ans[2] += 1)\n s == \"TLE\" && (ans[3] += 1)\n s == \"RE\" && (ans[4] += 1)\n end\n\n println(\"AC x \", ans[1])\n println(\"WA x \", ans[2])\n println(\"TLE x \", ans[3])\n println(\"RE x \", ans[4])\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 215, "memory_kb": 162744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s710456431", "group_id": "codeNet:p02613", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n S = [\"AC\", \"WA\", \"TLE\", \"RE\"]\n d = Dict{String,int}()\n for moji in S\n get!(d,moji,0)\n end\n for _ in 1:N\n s = readline()\n #get!(d,s,0)\n d[s]+=1\n end\n\n for moji in S\n println(moji,\" x \",d[moji])\n end\n\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1593997516, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s710456431.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s710456431", "user_id": "u868531879"}, "prompt_components": {"gold_output": "AC x 3\nWA x 1\nTLE x 2\nRE x 0\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n S = [\"AC\", \"WA\", \"TLE\", \"RE\"]\n d = Dict{String,int}()\n for moji in S\n get!(d,moji,0)\n end\n for _ in 1:N\n s = readline()\n #get!(d,s,0)\n d[s]+=1\n end\n\n for moji in S\n println(moji,\" x \",d[moji])\n end\n\n\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 407, "cpu_time_ms": 601, "memory_kb": 194940}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s913358629", "group_id": "codeNet:p02614", "input_text": "function main()\n h, w, k = parse.(Int, split(readline()))\n \n c = String[]\n for i in 1:h\n push!(c, readline())\n end\n \n ans = 0\n for i in 0:2^(h+w)-1\n cnt = 0\n for x in 1:h\n for y in 1:w\n# println(i >> (x-1), i >> (y+h-1))\n if (i >> (x-1) ) % 2 == 0 || (i >> (y+h-1)) % 2 == 0\n continue\n elseif c[x][y] == '#'\n cnt += 1\n end\n end\n end\n \n if k == cnt\n ans += 1\n end\n end\n \n println(ans)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1598574908, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s913358629.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s913358629", "user_id": "u906651641"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "function main()\n h, w, k = parse.(Int, split(readline()))\n \n c = String[]\n for i in 1:h\n push!(c, readline())\n end\n \n ans = 0\n for i in 0:2^(h+w)-1\n cnt = 0\n for x in 1:h\n for y in 1:w\n# println(i >> (x-1), i >> (y+h-1))\n if (i >> (x-1) ) % 2 == 0 || (i >> (y+h-1)) % 2 == 0\n continue\n elseif c[x][y] == '#'\n cnt += 1\n end\n end\n end\n \n if k == cnt\n ans += 1\n end\n end\n \n println(ans)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 277, "memory_kb": 175608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s017251525", "group_id": "codeNet:p02615", "input_text": "using DataStructures\n\nfunction main()\n n = parse(Int, readline())\n a = parse.(Int, split(readline()))\n p = sortperm(a, rev=true)\n\n ans = 0\n arrived = [p[1]]\n pq = PriorityQueue{Tuple{Int, Int}, Int}(Base.Order.Reverse)\n pq[(1, 1)] = a[p[1]]\n\n for i in 2:length(p)\n ans += peek(pq)[2]\n loc = peek(pq)[1]\n ll = minimum(loc)\n gl = maximum(loc)\n insert!(arrived, gl, p[i])\n\n nl = gl\n gl += 1\n dequeue!(pq)\n pq[(ll, nl)] = min(a[arrived[ll]], a[arrived[nl]])\n pq[(nl, gl)] = min(a[arrived[nl]], a[arrived[gl]])\n end\n println(ans)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1594002143, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s017251525.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s017251525", "user_id": "u624923345"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "using DataStructures\n\nfunction main()\n n = parse(Int, readline())\n a = parse.(Int, split(readline()))\n p = sortperm(a, rev=true)\n\n ans = 0\n arrived = [p[1]]\n pq = PriorityQueue{Tuple{Int, Int}, Int}(Base.Order.Reverse)\n pq[(1, 1)] = a[p[1]]\n\n for i in 2:length(p)\n ans += peek(pq)[2]\n loc = peek(pq)[1]\n ll = minimum(loc)\n gl = maximum(loc)\n insert!(arrived, gl, p[i])\n\n nl = gl\n gl += 1\n dequeue!(pq)\n pq[(ll, nl)] = min(a[arrived[ll]], a[arrived[nl]])\n pq[(nl, gl)] = min(a[arrived[nl]], a[arrived[gl]])\n end\n println(ans)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 636, "cpu_time_ms": 1630, "memory_kb": 246420}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s620871723", "group_id": "codeNet:p02615", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n=pI(readline())\n a=pM(split(readline()))\n println(sum(a)-minimum(a))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1593999842, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s620871723.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s620871723", "user_id": "u443151804"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n=pI(readline())\n a=pM(split(readline()))\n println(sum(a)-minimum(a))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 361, "memory_kb": 195724}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s282587503", "group_id": "codeNet:p02616", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nconst MOD = 10^9+7\nfunction main()\n N,K = readint()\n A = readint()\n sort!(A)\n \n # 負, 0, 正の区間 \n # searchsorted が基本ですね\n L0 = searchsorted(A,0)\n Lm = 1:(L0.start-1)\n Lp = (L0.stop + 1):N\n \n # 負、0, 正の数\n Nm = length(Lm)\n N0 = length(L0)\n Np = length(Lp)\n\n if N0 > N-K\n println(0)\n return\n end\n\n if K == N\n s = 1\n for a in A\n s *= a\n s %= MOD\n end\n if s < 0\n s += MOD\n end\n println(s)\n return\n end\n\n \n if L0.stop == N\n s = 1\n if K%2 == 1 \n for i in N:-1:N-K+1\n s *= A[i]\n s %= MOD\n\n end\n if s < 0\n s += MOD\n end \n else\n for i in 1:K\n s *= A[i]\n s %= MOD\n end\n end\n \n else\n s = 1\n if K%2 == 1\n s *= A[end]\n end\n B = Vector{int}(undef,N)\n B .= 0\n \n\n Nm = L0.stop\n NPm = Nm÷2 \n for i in 1:NPm\n B[i] = A[2i-1]*A[2i]\n end\n \n p = NPm + 1\n if K%2==1\n for i in N-1:-2:Nm+2\n B[p] = A[i]*A[i-1]\n p += 1\n end\n else\n for i in N:-2:Nm+2\n B[p] = A[i]*A[i-1]\n p += 1\n end\n end\n \n sort!(B,rev=true)\n #println(B)\n for i in 1:K÷2\n s *= B[i]%MOD\n s %= MOD\n end \n\n end\n println(s)\n\n \n\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1594073914, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s282587503.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s282587503", "user_id": "u868531879"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nconst MOD = 10^9+7\nfunction main()\n N,K = readint()\n A = readint()\n sort!(A)\n \n # 負, 0, 正の区間 \n # searchsorted が基本ですね\n L0 = searchsorted(A,0)\n Lm = 1:(L0.start-1)\n Lp = (L0.stop + 1):N\n \n # 負、0, 正の数\n Nm = length(Lm)\n N0 = length(L0)\n Np = length(Lp)\n\n if N0 > N-K\n println(0)\n return\n end\n\n if K == N\n s = 1\n for a in A\n s *= a\n s %= MOD\n end\n if s < 0\n s += MOD\n end\n println(s)\n return\n end\n\n \n if L0.stop == N\n s = 1\n if K%2 == 1 \n for i in N:-1:N-K+1\n s *= A[i]\n s %= MOD\n\n end\n if s < 0\n s += MOD\n end \n else\n for i in 1:K\n s *= A[i]\n s %= MOD\n end\n end\n \n else\n s = 1\n if K%2 == 1\n s *= A[end]\n end\n B = Vector{int}(undef,N)\n B .= 0\n \n\n Nm = L0.stop\n NPm = Nm÷2 \n for i in 1:NPm\n B[i] = A[2i-1]*A[2i]\n end\n \n p = NPm + 1\n if K%2==1\n for i in N-1:-2:Nm+2\n B[p] = A[i]*A[i-1]\n p += 1\n end\n else\n for i in N:-2:Nm+2\n B[p] = A[i]*A[i-1]\n p += 1\n end\n end\n \n sort!(B,rev=true)\n #println(B)\n for i in 1:K÷2\n s *= B[i]%MOD\n s %= MOD\n end \n\n end\n println(s)\n\n \n\n\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1421, "cpu_time_ms": 707, "memory_kb": 217464}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s583622885", "group_id": "codeNet:p02616", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nconst MOD = 10^9+7\nfunction main()\n N,K = readint()\n A = readint()\n sort!(A)\n lr0 = searchsorted(A,0)\n\n if length(lr0) > N-K\n println(0)\n return\n end\n\n if N == K \n s = 1\n for a in A\n s *= a \n s %= MOD\n end\n if s < 0\n s += MOD\n end\n println(s)\n return\n end\n\n s = 1\n if lr0.stop == N\n if K%2 == 1\n for i in N:-1:N-K+1\n s *= A[i]\n s %= MOD\n\n end\n s += MOD\n else\n for i in 1:K\n s *= A[i]\n s %= MOD\n end\n end\n \n else\n if K%2 == 1\n s *= A[end]\n end\n B = Vector{int}(undef,2N)\n \n\n Nm = lr0.stop\n NPm = Nm÷2 \n for i in 1:NPm\n B[i] = A[2i-1]*A[2i]\n end\n \n p = NPm + 1\n if K%2==1\n for i in N-1:-2:Nm+1\n B[p] = A[i]*A[i-1]\n p += 1\n end\n else\n for i in N:-2:Nm+1\n B[p] = A[i]*A[i-1]\n p += 1\n end\n end\n \n sort!(B,rev=true)\n #println(B)\n for i in 1:K÷2\n s *= B[i]%MOD\n s %= MOD\n end \n\n end\n println(s)\n\n \n\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1593981531, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s583622885.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s583622885", "user_id": "u868531879"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nconst MOD = 10^9+7\nfunction main()\n N,K = readint()\n A = readint()\n sort!(A)\n lr0 = searchsorted(A,0)\n\n if length(lr0) > N-K\n println(0)\n return\n end\n\n if N == K \n s = 1\n for a in A\n s *= a \n s %= MOD\n end\n if s < 0\n s += MOD\n end\n println(s)\n return\n end\n\n s = 1\n if lr0.stop == N\n if K%2 == 1\n for i in N:-1:N-K+1\n s *= A[i]\n s %= MOD\n\n end\n s += MOD\n else\n for i in 1:K\n s *= A[i]\n s %= MOD\n end\n end\n \n else\n if K%2 == 1\n s *= A[end]\n end\n B = Vector{int}(undef,2N)\n \n\n Nm = lr0.stop\n NPm = Nm÷2 \n for i in 1:NPm\n B[i] = A[2i-1]*A[2i]\n end\n \n p = NPm + 1\n if K%2==1\n for i in N-1:-2:Nm+1\n B[p] = A[i]*A[i-1]\n p += 1\n end\n else\n for i in N:-2:Nm+1\n B[p] = A[i]*A[i-1]\n p += 1\n end\n end\n \n sort!(B,rev=true)\n #println(B)\n for i in 1:K÷2\n s *= B[i]%MOD\n s %= MOD\n end \n\n end\n println(s)\n\n \n\n\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1191, "cpu_time_ms": 1706, "memory_kb": 285568}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s074937335", "group_id": "codeNet:p02619", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\td = readline() |> parseInt\n\tfor i in 1:d\n\t\tprintln(1)\n\tend\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1594773917, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02619.html", "problem_id": "p02619", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02619/input.txt", "sample_output_relpath": "derived/input_output/data/p02619/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02619/Julia/s074937335.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s074937335", "user_id": "u095714878"}, "prompt_components": {"gold_output": "18398\n35037\n51140\n65837\n79325\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\td = readline() |> parseInt\n\tfor i in 1:d\n\t\tprintln(1)\n\tend\nend\n\nmain()\n", "problem_context": "(Please read problem A first. The maximum score you can get by solving this problem B is 1, which will have almost no effect on your ranking.)\n\nBeginner's Guide\n\nLet's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to check your understanding of the problem specification. Moreover, the source code of the score calculator can often be reused for solving the problem or debugging your solution. So it is worthwhile to write a score calculator unless it is very complicated.\n\nProblem Statement\n\nYou will be given a contest schedule for D days.\nFor each d=1,2,\\ldots,D, calculate the satisfaction at the end of day d.\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.\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\n\nThe constraints and generation methods for the input part are the same as those for Problem A.\n\nFor each d, t_d is an integer satisfying 1\\leq t_d \\leq 26, and your program is expected to work correctly for any value that meets the constraints.\n\nOutput\n\nLet v_d be the satisfaction at the end of day d.\nPrint D integers v_d to Standard Output in the following format:\n\nv_1\nv_2\n\\vdots\nv_D\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\n\nSample Output 1\n\n18398\n35037\n51140\n65837\n79325\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\nWe can build a solution (schedule) for this problem in the order of day 1, day 2, and so on. And for every partial solution we have built, we can calculate the goodness (satisfaction) by using the above score calculator. So we can construct the following algorithm: for each d=1,2,\\ldots,D, we select the contest type that maximizes the satisfaction at the end of day d. You may have already encountered this kind of \"greedy algorithms\" in algorithm contests such as ABC. Greedy algorithms can guarantee the optimality for several problems, but unfortunately, it doesn't ensure optimality for this problem. However, even if it does not ensure optimality, we can still obtain a reasonable solution in many cases. Let's go back to Problem A and implement the greedy algorithm by utilizing the score calculator you just implemented!\n\nGreedy methods can be applied to a variety of problems, are easy to implement, and often run relatively fast compared to other methods. Greedy is often the most powerful method when we need to process huge inputs.\nWe can further improve the score by changing the greedy selection criteria (evaluation function), keeping multiple candidates instead of focusing on one best partial solution (beam search), or using the output of greedy algorithms as an initial solution of other methods.\nFor more information, 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\n"}, "reference_outputs": ["18398\n35037\n51140\n65837\n79325\n"], "source_document_id": "p02619", "source_text": "(Please read problem A first. The maximum score you can get by solving this problem B is 1, which will have almost no effect on your ranking.)\n\nBeginner's Guide\n\nLet's first write a program to calculate the score from a pair of input and output. You can know the total score by submitting your solution, or an official program to calculate a score is often provided for local evaluation as in this contest. Nevertheless, writing a score calculator by yourself is still useful to check your understanding of the problem specification. Moreover, the source code of the score calculator can often be reused for solving the problem or debugging your solution. So it is worthwhile to write a score calculator unless it is very complicated.\n\nProblem Statement\n\nYou will be given a contest schedule for D days.\nFor each d=1,2,\\ldots,D, calculate the satisfaction at the end of day d.\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.\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\n\nThe constraints and generation methods for the input part are the same as those for Problem A.\n\nFor each d, t_d is an integer satisfying 1\\leq t_d \\leq 26, and your program is expected to work correctly for any value that meets the constraints.\n\nOutput\n\nLet v_d be the satisfaction at the end of day d.\nPrint D integers v_d to Standard Output in the following format:\n\nv_1\nv_2\n\\vdots\nv_D\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\n\nSample Output 1\n\n18398\n35037\n51140\n65837\n79325\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\nWe can build a solution (schedule) for this problem in the order of day 1, day 2, and so on. And for every partial solution we have built, we can calculate the goodness (satisfaction) by using the above score calculator. So we can construct the following algorithm: for each d=1,2,\\ldots,D, we select the contest type that maximizes the satisfaction at the end of day d. You may have already encountered this kind of \"greedy algorithms\" in algorithm contests such as ABC. Greedy algorithms can guarantee the optimality for several problems, but unfortunately, it doesn't ensure optimality for this problem. However, even if it does not ensure optimality, we can still obtain a reasonable solution in many cases. Let's go back to Problem A and implement the greedy algorithm by utilizing the score calculator you just implemented!\n\nGreedy methods can be applied to a variety of problems, are easy to implement, and often run relatively fast compared to other methods. Greedy is often the most powerful method when we need to process huge inputs.\nWe can further improve the score by changing the greedy selection criteria (evaluation function), keeping multiple candidates instead of focusing on one best partial solution (beam search), or using the output of greedy algorithms as an initial solution of other methods.\nFor more information, please refer to the editorial that will be published after the contest.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 172, "cpu_time_ms": 211, "memory_kb": 157692}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s361251350", "group_id": "codeNet:p02621", "input_text": "function main()\n a = parse(Int, readline())\n\n println(a + a^2 + a^3)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1600562395, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s361251350.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s361251350", "user_id": "u906651641"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "function main()\n a = parse(Int, readline())\n\n println(a + a^2 + a^3)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 82, "cpu_time_ms": 215, "memory_kb": 155988}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s631132712", "group_id": "codeNet:p02621", "input_text": "s=parse(Int,readline())\nfunction solve(s)\nprint(s+s^2+s^3)\nend\nsolve(s)", "language": "Julia", "metadata": {"date": 1594769564, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s631132712.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s631132712", "user_id": "u765865533"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "s=parse(Int,readline())\nfunction solve(s)\nprint(s+s^2+s^3)\nend\nsolve(s)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 71, "cpu_time_ms": 188, "memory_kb": 153588}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s468411126", "group_id": "codeNet:p02622", "input_text": "function main()\n S = readline()\n T = readline()\n min = 0\n for i in 1:length(S)\n if S[i] != T[i]\n min +=1\n end\n end\n println(min)\nend\nmain()", "language": "Julia", "metadata": {"date": 1594161576, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s468411126.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s468411126", "user_id": "u894839777"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function main()\n S = readline()\n T = readline()\n min = 0\n for i in 1:length(S)\n if S[i] != T[i]\n min +=1\n end\n end\n println(min)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 227, "memory_kb": 158360}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s971941430", "group_id": "codeNet:p02627", "input_text": "a = readline()[1]\n\nif a >= 'a' && a <= 'z'\n print('a')\nelse\n print('A')\nend", "language": "Julia", "metadata": {"date": 1593340905, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s971941430.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s971941430", "user_id": "u217655905"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "a = readline()[1]\n\nif a >= 'a' && a <= 'z'\n print('a')\nelse\n print('A')\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 186, "memory_kb": 152448}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s001381363", "group_id": "codeNet:p02628", "input_text": "n,k = parse.(Int,split(readline(),' '))\na = parse.(Int,split(readline(),' '))\n\nsort!(a)\nc = 0\nfor i in 1:k\n global c\n c = c + a[i]\nend\nprint(c)", "language": "Julia", "metadata": {"date": 1593342705, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s001381363.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s001381363", "user_id": "u217655905"}, "prompt_components": {"gold_output": "210\n", "input_to_evaluate": "n,k = parse.(Int,split(readline(),' '))\na = parse.(Int,split(readline(),' '))\n\nsort!(a)\nc = 0\nfor i in 1:k\n global c\n c = c + a[i]\nend\nprint(c)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 265, "memory_kb": 171272}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s217904495", "group_id": "codeNet:p02629", "input_text": "function main()\n n=parse(Int,readline())\n ans=\"\"\n while n!=0\n n-=1\n n,r=divrem(n,26)\n ans*='a'+r\n end\n println(ans[end:-1:1])\nend\nmain()", "language": "Julia", "metadata": {"date": 1594664679, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s217904495.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s217904495", "user_id": "u443151804"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "function main()\n n=parse(Int,readline())\n ans=\"\"\n while n!=0\n n-=1\n n,r=divrem(n,26)\n ans*='a'+r\n end\n println(ans[end:-1:1])\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 210, "memory_kb": 160896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s440618711", "group_id": "codeNet:p02630", "input_text": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nfunction Replacing()\n data = readlines()\n N = parse(Int, data[1])\n A = parseline(data[2])\n nums = zeros(Int, 10^5)\n for a in A\n nums[a] += 1\n end\n Q = parse(Int, data[3])\n BC = parseline.(data[4:end])\n ans = sum(A)\n ansStr = \"\"\n for bc in BC\n nums[bc[1]] == 0 && continue\n ans += (bc[2] - bc[1]) * nums[bc[1]]\n nums[bc[2]] += nums[bc[1]]\n nums[bc[1]] = 0\n ansStr *= \"$ans\\n\"\n end\n println(ansStr)\nend\nReplacing()", "language": "Julia", "metadata": {"date": 1599493696, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s440618711.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s440618711", "user_id": "u728564399"}, "prompt_components": {"gold_output": "11\n12\n16\n", "input_to_evaluate": "using DataStructures\nparseline(str) = parse.(Int, split(str))\nfunction Replacing()\n data = readlines()\n N = parse(Int, data[1])\n A = parseline(data[2])\n nums = zeros(Int, 10^5)\n for a in A\n nums[a] += 1\n end\n Q = parse(Int, data[3])\n BC = parseline.(data[4:end])\n ans = sum(A)\n ansStr = \"\"\n for bc in BC\n nums[bc[1]] == 0 && continue\n ans += (bc[2] - bc[1]) * nums[bc[1]]\n nums[bc[2]] += nums[bc[1]]\n nums[bc[1]] = 0\n ansStr *= \"$ans\\n\"\n end\n println(ansStr)\nend\nReplacing()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2212, "memory_kb": 274740}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s024765485", "group_id": "codeNet:p02630", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nfunction main()\nN = readline()\nA = parseMap(split(readline()))\nQ = parseInt(readline())\n\n\nD = Dict{Int, Int}()\n\nbefore_sum = sum(A)\nfor a in A\n if a in keys(D)\n D[a] += 1\n else\n D[a] = 1\n end\nend\n\n\nfor _ in 1:Q\n B, C = parseMap(split(readline()))\n if B in keys(D)\n before_sum += D[B] * (C - B)\n else\n println(before_sum)\n continue\n end\n if C in keys(D)\n D[C] += D[B]\n else\n D[C] = D[B]\n end\n D[B] = 0\n println(before_sum)\nend\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1592790419, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s024765485.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s024765485", "user_id": "u879294842"}, "prompt_components": {"gold_output": "11\n12\n16\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nfunction main()\nN = readline()\nA = parseMap(split(readline()))\nQ = parseInt(readline())\n\n\nD = Dict{Int, Int}()\n\nbefore_sum = sum(A)\nfor a in A\n if a in keys(D)\n D[a] += 1\n else\n D[a] = 1\n end\nend\n\n\nfor _ in 1:Q\n B, C = parseMap(split(readline()))\n if B in keys(D)\n before_sum += D[B] * (C - B)\n else\n println(before_sum)\n continue\n end\n if C in keys(D)\n D[C] += D[B]\n else\n D[C] = D[B]\n end\n D[B] = 0\n println(before_sum)\nend\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 394, "memory_kb": 205808}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s051361575", "group_id": "codeNet:p02631", "input_text": "readints()=parse.(Int,split(readline()))\nreadint()=parse.(Int,readline())\nN=readint()\nA=readints()\n\nAxor=xor(A...)\nfor i in 1:N\n Aixor=xor(Axor,A[i])\n print(Aixor)\n print(\" \")\nend", "language": "Julia", "metadata": {"date": 1592841848, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02631.html", "problem_id": "p02631", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02631/input.txt", "sample_output_relpath": "derived/input_output/data/p02631/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02631/Julia/s051361575.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s051361575", "user_id": "u562051766"}, "prompt_components": {"gold_output": "26 5 7 22\n", "input_to_evaluate": "readints()=parse.(Int,split(readline()))\nreadint()=parse.(Int,readline())\nN=readint()\nA=readints()\n\nAxor=xor(A...)\nfor i in 1:N\n Aixor=xor(Axor,A[i])\n print(Aixor)\n print(\" \")\nend", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N Snuke Cats numbered 1, 2, \\ldots, N, where N is even.\n\nEach Snuke Cat wears a red scarf, on which his favorite non-negative integer is written.\n\nRecently, they learned the operation called xor (exclusive OR).\n\nWhat is xor?\n\nFor n non-negative integers x_1, x_2, \\ldots, x_n, their xor, x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~x_n is defined as follows:\n\nWhen x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~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~\\textrm{xor}~5 = 6.\n\nThey wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf.\n\nWe know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i.\nUsing this information, restore the integer written on the scarf of each Snuke Cat.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 200000\n\nN is even.\n\n0 \\leq a_i \\leq 10^9\n\nThere exists a combination of integers on the scarfs that is consistent with the given information.\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 line containing N integers separated with space.\n\nThe i-th of the integers from the left should represent the integer written on the scarf of Snuke Cat i.\n\nIf there are multiple possible solutions, you may print any of them.\n\nSample Input 1\n\n4\n20 11 9 24\n\nSample Output 1\n\n26 5 7 22\n\n5~\\textrm{xor}~7~\\textrm{xor}~22 = 20\n\n26~\\textrm{xor}~7~\\textrm{xor}~22 = 11\n\n26~\\textrm{xor}~5~\\textrm{xor}~22 = 9\n\n26~\\textrm{xor}~5~\\textrm{xor}~7 = 24\n\nThus, this output is consistent with the given information.", "sample_input": "4\n20 11 9 24\n"}, "reference_outputs": ["26 5 7 22\n"], "source_document_id": "p02631", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N Snuke Cats numbered 1, 2, \\ldots, N, where N is even.\n\nEach Snuke Cat wears a red scarf, on which his favorite non-negative integer is written.\n\nRecently, they learned the operation called xor (exclusive OR).\n\nWhat is xor?\n\nFor n non-negative integers x_1, x_2, \\ldots, x_n, their xor, x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~x_n is defined as follows:\n\nWhen x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~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~\\textrm{xor}~5 = 6.\n\nThey wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf.\n\nWe know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i.\nUsing this information, restore the integer written on the scarf of each Snuke Cat.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 200000\n\nN is even.\n\n0 \\leq a_i \\leq 10^9\n\nThere exists a combination of integers on the scarfs that is consistent with the given information.\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 line containing N integers separated with space.\n\nThe i-th of the integers from the left should represent the integer written on the scarf of Snuke Cat i.\n\nIf there are multiple possible solutions, you may print any of them.\n\nSample Input 1\n\n4\n20 11 9 24\n\nSample Output 1\n\n26 5 7 22\n\n5~\\textrm{xor}~7~\\textrm{xor}~22 = 20\n\n26~\\textrm{xor}~7~\\textrm{xor}~22 = 11\n\n26~\\textrm{xor}~5~\\textrm{xor}~22 = 9\n\n26~\\textrm{xor}~5~\\textrm{xor}~7 = 24\n\nThus, this output is consistent with the given information.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 450, "memory_kb": 230672}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s339310264", "group_id": "codeNet:p02631", "input_text": "const double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n A = readint()\n\n b = Array{int,2}(undef,32,N)\n oe = Vector{int}(undef,32)\n oe .= 0\n for i in 1:N\n for j in 1:32\n k = A[i]\n b[j,i] = k >> (j-1) &1\n if i > 2\n oe[j] += b[j,i]\n end\n end\n end\n\n r = Array{int,2}(undef,32,N)\n r .= 0\n\n for i in 1:32\n # odd or even \n oe[i] = oe[i] %2\n\n if b[i,1]%2 == 0\n if b[i,2]%2 == 0\n if oe[i] == 1\n r[i,1] = 1\n r[i,2] = 1\n else\n r[i,1] = 0\n r[i,2] = 0\n end \n else\n if oe[i] == 1\n r[i,1] = 0\n r[i,2] = 1\n else\n r[i,1] = 1\n r[i,2] = 0\n end\n end\n else\n if b[i,2]%2 == 0\n if oe[i] == 1\n r[i,1] = 1\n r[i,2] = 0\n else\n r[i,1] = 0\n r[i,2] = 1\n end \n else\n if oe[i] == 1\n r[i,1] = 0\n r[i,2] = 0\n else\n r[i,1] = 1\n r[i,2] = 1\n end\n end\n end\n end\n\n for i in 2:N-1\n for j in 1:32\n if b[j,i] == b[j,i+1]\n r[j,i+1] = r[j,i]\n else\n if r[j,i]==0\n r[j,i+1] = 1\n else\n r[j,i+1] = 0\n end\n end\n end\n end\n\n for i in 1:N\n s = 0\n for j in 1:32\n s += r[j,i]*(2^(j-1))\n end\n println(s)\n end\n\n \n end\n\n\nmain()", "language": "Julia", "metadata": {"date": 1592792240, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02631.html", "problem_id": "p02631", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02631/input.txt", "sample_output_relpath": "derived/input_output/data/p02631/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02631/Julia/s339310264.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s339310264", "user_id": "u868531879"}, "prompt_components": {"gold_output": "26 5 7 22\n", "input_to_evaluate": "const double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n A = readint()\n\n b = Array{int,2}(undef,32,N)\n oe = Vector{int}(undef,32)\n oe .= 0\n for i in 1:N\n for j in 1:32\n k = A[i]\n b[j,i] = k >> (j-1) &1\n if i > 2\n oe[j] += b[j,i]\n end\n end\n end\n\n r = Array{int,2}(undef,32,N)\n r .= 0\n\n for i in 1:32\n # odd or even \n oe[i] = oe[i] %2\n\n if b[i,1]%2 == 0\n if b[i,2]%2 == 0\n if oe[i] == 1\n r[i,1] = 1\n r[i,2] = 1\n else\n r[i,1] = 0\n r[i,2] = 0\n end \n else\n if oe[i] == 1\n r[i,1] = 0\n r[i,2] = 1\n else\n r[i,1] = 1\n r[i,2] = 0\n end\n end\n else\n if b[i,2]%2 == 0\n if oe[i] == 1\n r[i,1] = 1\n r[i,2] = 0\n else\n r[i,1] = 0\n r[i,2] = 1\n end \n else\n if oe[i] == 1\n r[i,1] = 0\n r[i,2] = 0\n else\n r[i,1] = 1\n r[i,2] = 1\n end\n end\n end\n end\n\n for i in 2:N-1\n for j in 1:32\n if b[j,i] == b[j,i+1]\n r[j,i+1] = r[j,i]\n else\n if r[j,i]==0\n r[j,i+1] = 1\n else\n r[j,i+1] = 0\n end\n end\n end\n end\n\n for i in 1:N\n s = 0\n for j in 1:32\n s += r[j,i]*(2^(j-1))\n end\n println(s)\n end\n\n \n end\n\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N Snuke Cats numbered 1, 2, \\ldots, N, where N is even.\n\nEach Snuke Cat wears a red scarf, on which his favorite non-negative integer is written.\n\nRecently, they learned the operation called xor (exclusive OR).\n\nWhat is xor?\n\nFor n non-negative integers x_1, x_2, \\ldots, x_n, their xor, x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~x_n is defined as follows:\n\nWhen x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~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~\\textrm{xor}~5 = 6.\n\nThey wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf.\n\nWe know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i.\nUsing this information, restore the integer written on the scarf of each Snuke Cat.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 200000\n\nN is even.\n\n0 \\leq a_i \\leq 10^9\n\nThere exists a combination of integers on the scarfs that is consistent with the given information.\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 line containing N integers separated with space.\n\nThe i-th of the integers from the left should represent the integer written on the scarf of Snuke Cat i.\n\nIf there are multiple possible solutions, you may print any of them.\n\nSample Input 1\n\n4\n20 11 9 24\n\nSample Output 1\n\n26 5 7 22\n\n5~\\textrm{xor}~7~\\textrm{xor}~22 = 20\n\n26~\\textrm{xor}~7~\\textrm{xor}~22 = 11\n\n26~\\textrm{xor}~5~\\textrm{xor}~22 = 9\n\n26~\\textrm{xor}~5~\\textrm{xor}~7 = 24\n\nThus, this output is consistent with the given information.", "sample_input": "4\n20 11 9 24\n"}, "reference_outputs": ["26 5 7 22\n"], "source_document_id": "p02631", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N Snuke Cats numbered 1, 2, \\ldots, N, where N is even.\n\nEach Snuke Cat wears a red scarf, on which his favorite non-negative integer is written.\n\nRecently, they learned the operation called xor (exclusive OR).\n\nWhat is xor?\n\nFor n non-negative integers x_1, x_2, \\ldots, x_n, their xor, x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~x_n is defined as follows:\n\nWhen x_1~\\textrm{xor}~x_2~\\textrm{xor}~\\ldots~\\textrm{xor}~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~\\textrm{xor}~5 = 6.\n\nThey wanted to use this operation quickly, so each of them calculated the xor of the integers written on their scarfs except his scarf.\n\nWe know that the xor calculated by Snuke Cat i, that is, the xor of the integers written on the scarfs except the scarf of Snuke Cat i is a_i.\nUsing this information, restore the integer written on the scarf of each Snuke Cat.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 200000\n\nN is even.\n\n0 \\leq a_i \\leq 10^9\n\nThere exists a combination of integers on the scarfs that is consistent with the given information.\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 line containing N integers separated with space.\n\nThe i-th of the integers from the left should represent the integer written on the scarf of Snuke Cat i.\n\nIf there are multiple possible solutions, you may print any of them.\n\nSample Input 1\n\n4\n20 11 9 24\n\nSample Output 1\n\n26 5 7 22\n\n5~\\textrm{xor}~7~\\textrm{xor}~22 = 20\n\n26~\\textrm{xor}~7~\\textrm{xor}~22 = 11\n\n26~\\textrm{xor}~5~\\textrm{xor}~22 = 9\n\n26~\\textrm{xor}~5~\\textrm{xor}~7 = 24\n\nThus, this output is consistent with the given information.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1511, "cpu_time_ms": 593, "memory_kb": 307624}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s849975717", "group_id": "codeNet:p02633", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n \n s = 0\n c = 0\n while true\n c += 1\n s += N\n s %= 360\n if s == 0\n println(c)\n break\n end\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1594162911, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02633.html", "problem_id": "p02633", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02633/input.txt", "sample_output_relpath": "derived/input_output/data/p02633/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02633/Julia/s849975717.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s849975717", "user_id": "u868531879"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n \n s = 0\n c = 0\n while true\n c += 1\n s += N\n s %= 360\n if s == 0\n println(c)\n break\n end\n end\n \nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:\n\nGo one meter in the direction he is facing. Then, turn X degrees counter-clockwise.\n\nConstraints\n\n1 \\leq X \\leq 179\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 number of times Takahashi will do the action before he is at the starting position again.\n\nSample Input 1\n\n90\n\nSample Output 1\n\n4\n\nTakahashi's path is a square.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n360", "sample_input": "90\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02633", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi is standing on a two-dimensional plane, facing north. Find the minimum positive integer K such that Takahashi will be at the starting position again after he does the following action K times:\n\nGo one meter in the direction he is facing. Then, turn X degrees counter-clockwise.\n\nConstraints\n\n1 \\leq X \\leq 179\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 number of times Takahashi will do the action before he is at the starting position again.\n\nSample Input 1\n\n90\n\nSample Output 1\n\n4\n\nTakahashi's path is a square.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n360", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 484, "memory_kb": 185424}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s300566826", "group_id": "codeNet:p02634", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nMOD = 998244353\nfunction main()\n A,B,C,D = readint()\n\n s0 = Array{int,2}(undef,C,D)\n s1 = Array{int,2}(undef,C,D)\n\n s0[A,B] = 1\n s1[A,B] = 0\n\n \n for i in A+1:C\n s0[i,B] = (s0[i-1,B]+s1[i-1,B])* B%MOD\n s1[i,B] = 0\n end\n\n for i in B+1:D\n s0[A,i] = 0\n s1[A,i] = (s0[A,i-1] + s1[A,i-1])*A%MOD\n end\n\n\n for j in B+1:D,i in A+1:C\n s0[i,j] = (s0[i-1,j]+s1[i-1,j])*j%MOD\n s1[i,j] = (s0[i,j-1]+s1[i,j-1]*i)%MOD\n \n end\n\n println((s0[C,D]+s1[C,D])%MOD)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1594597373, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02634.html", "problem_id": "p02634", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02634/input.txt", "sample_output_relpath": "derived/input_output/data/p02634/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02634/Julia/s300566826.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s300566826", "user_id": "u868531879"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nMOD = 998244353\nfunction main()\n A,B,C,D = readint()\n\n s0 = Array{int,2}(undef,C,D)\n s1 = Array{int,2}(undef,C,D)\n\n s0[A,B] = 1\n s1[A,B] = 0\n\n \n for i in A+1:C\n s0[i,B] = (s0[i-1,B]+s1[i-1,B])* B%MOD\n s1[i,B] = 0\n end\n\n for i in B+1:D\n s0[A,i] = 0\n s1[A,i] = (s0[A,i-1] + s1[A,i-1])*A%MOD\n end\n\n\n for j in B+1:D,i in A+1:C\n s0[i,j] = (s0[i-1,j]+s1[i-1,j])*j%MOD\n s1[i,j] = (s0[i,j-1]+s1[i,j-1]*i)%MOD\n \n end\n\n println((s0[C,D]+s1[C,D])%MOD)\n \nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a grid with A horizontal rows and B vertical columns, with the squares painted white. On this grid, we will repeatedly apply the following operation:\n\nAssume that the grid currently has a horizontal rows and b vertical columns. Choose \"vertical\" or \"horizontal\".\n\nIf we choose \"vertical\", insert one row at the top of the grid, resulting in an (a+1) \\times b grid.\n\nIf we choose \"horizontal\", insert one column at the right end of the grid, resulting in an a \\times (b+1) grid.\n\nThen, paint one of the added squares black, and the other squares white.\n\nAssume the grid eventually has C horizontal rows and D vertical columns. Find the number of ways in which the squares can be painted in the end, modulo 998244353.\n\nConstraints\n\n1 \\leq A \\leq C \\leq 3000\n\n1 \\leq B \\leq D \\leq 3000\n\nA, B, C, and D are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of ways in which the squares can be painted in the end, modulo 998244353.\n\nSample Input 1\n\n1 1 2 2\n\nSample Output 1\n\n3\n\nAny two of the three squares other than the bottom-left square can be painted black.\n\nSample Input 2\n\n2 1 3 4\n\nSample Output 2\n\n65\n\nSample Input 3\n\n31 41 59 265\n\nSample Output 3\n\n387222020", "sample_input": "1 1 2 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02634", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a grid with A horizontal rows and B vertical columns, with the squares painted white. On this grid, we will repeatedly apply the following operation:\n\nAssume that the grid currently has a horizontal rows and b vertical columns. Choose \"vertical\" or \"horizontal\".\n\nIf we choose \"vertical\", insert one row at the top of the grid, resulting in an (a+1) \\times b grid.\n\nIf we choose \"horizontal\", insert one column at the right end of the grid, resulting in an a \\times (b+1) grid.\n\nThen, paint one of the added squares black, and the other squares white.\n\nAssume the grid eventually has C horizontal rows and D vertical columns. Find the number of ways in which the squares can be painted in the end, modulo 998244353.\n\nConstraints\n\n1 \\leq A \\leq C \\leq 3000\n\n1 \\leq B \\leq D \\leq 3000\n\nA, B, C, and D are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of ways in which the squares can be painted in the end, modulo 998244353.\n\nSample Input 1\n\n1 1 2 2\n\nSample Output 1\n\n3\n\nAny two of the three squares other than the bottom-left square can be painted black.\n\nSample Input 2\n\n2 1 3 4\n\nSample Output 2\n\n65\n\nSample Input 3\n\n31 41 59 265\n\nSample Output 3\n\n387222020", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2122, "memory_kb": 398708}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s986815244", "group_id": "codeNet:p02639", "input_text": "# SPDX-License-Identifier: X11\n# 2020-08-29\n# Five Variables (100pt)\n\nprintln(findfirst(x -> x == 0, parse.(Int, split(readline(), \" \"))))\n", "language": "Julia", "metadata": {"date": 1598748750, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s986815244.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s986815244", "user_id": "u883424625"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "# SPDX-License-Identifier: X11\n# 2020-08-29\n# Five Variables (100pt)\n\nprintln(findfirst(x -> x == 0, parse.(Int, split(readline(), \" \"))))\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 305, "memory_kb": 172780}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s645892589", "group_id": "codeNet:p02640", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n#1行に数値一つならparseInt(readline())\n#1行に数値複数ならparseMap(split(readline()))を行数分。\n# 例:n,k = readline() |> split |> parseMap\n# a = readline() |> split |> parseMap\nfunction main()\n #a = parseInt(readline())\n X,Y = parseMap(split(readline()))\n #println(\"$X,$Y\")\n if X == 0 && Y == 0\n println(\"Yes\")\n exit()\n end\n if Y < 2*X || Y > 4*X\n println(\"No\")\n exit()\n end\n if Y % 2 != 0\n println(\"No\")\n exit()\n end\n if (Y-2*X) % 2 == 0 && (4*X-Y) % 2 == 0\n y0 = (Y-2*X)/2\n x0 = (4*X-Y)/2\n if x0 > 0 && y0 > 0\n println(\"Yes\")\n else\n if x0==0 && y0 > 0\n println(\"Yes\")\n elseif y0==0 && x0 > 0\n println(\"Yes\")\n\n else\n println(\"No\")\n end\n end\n end\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1592184036, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s645892589.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s645892589", "user_id": "u524573278"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n#1行に数値一つならparseInt(readline())\n#1行に数値複数ならparseMap(split(readline()))を行数分。\n# 例:n,k = readline() |> split |> parseMap\n# a = readline() |> split |> parseMap\nfunction main()\n #a = parseInt(readline())\n X,Y = parseMap(split(readline()))\n #println(\"$X,$Y\")\n if X == 0 && Y == 0\n println(\"Yes\")\n exit()\n end\n if Y < 2*X || Y > 4*X\n println(\"No\")\n exit()\n end\n if Y % 2 != 0\n println(\"No\")\n exit()\n end\n if (Y-2*X) % 2 == 0 && (4*X-Y) % 2 == 0\n y0 = (Y-2*X)/2\n x0 = (4*X-Y)/2\n if x0 > 0 && y0 > 0\n println(\"Yes\")\n else\n if x0==0 && y0 > 0\n println(\"Yes\")\n elseif y0==0 && x0 > 0\n println(\"Yes\")\n\n else\n println(\"No\")\n end\n end\n end\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 879, "cpu_time_ms": 223, "memory_kb": 162624}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s892960038", "group_id": "codeNet:p02640", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n x, y = readline() |> split |> parseArray\n\n z = (4x-y)÷2\n w = (4x-y)%2\n if w==0 && z>=0 && z<=x\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1592183701, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s892960038.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s892960038", "user_id": "u630185395"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n x, y = readline() |> split |> parseArray\n\n z = (4x-y)÷2\n w = (4x-y)%2\n if w==0 && z>=0 && z<=x\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 212, "memory_kb": 161120}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s976801315", "group_id": "codeNet:p02640", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n x, y = readline() |> split |> parseArray\n\n if (4x-y)%2==0\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1592183291, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s976801315.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s976801315", "user_id": "u630185395"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n x, y = readline() |> split |> parseArray\n\n if (4x-y)%2==0\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 220, "memory_kb": 160884}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s330074121", "group_id": "codeNet:p02641", "input_text": "function main()\n\tX,N=map(x->parse(Int,x),split(readline()))\n\tA=map(x->parse(Int,x),split(readline()))\n\tfunction f(T)\n\t\tfor i=1:N\n\t\t\tif A[i]==T\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend\n\tfor k=0:114514\n\t\tif !f(X-k)\n\t\t\tprintln(X-k)\n\t\t\texit()\n\t\telseif !f(X+k)\n\t\t\tprintln(X+k)\n\t\t\texit()\n\t\tend\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1592187249, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s330074121.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s330074121", "user_id": "u657913472"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "function main()\n\tX,N=map(x->parse(Int,x),split(readline()))\n\tA=map(x->parse(Int,x),split(readline()))\n\tfunction f(T)\n\t\tfor i=1:N\n\t\t\tif A[i]==T\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend\n\tfor k=0:114514\n\t\tif !f(X-k)\n\t\t\tprintln(X-k)\n\t\t\texit()\n\t\telseif !f(X+k)\n\t\t\tprintln(X+k)\n\t\t\texit()\n\t\tend\n\tend\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 273, "memory_kb": 168340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s268472545", "group_id": "codeNet:p02641", "input_text": "readstr() = split(readline())\nreadnum(T::Type{<:Number} = Int) = parse.(T, split(readline()))\nlet\n X, N = readnum()\n p = readnum()\n X ∉ p && (println(X); exit())\n tmp = 0\n for ans = 0:101\n ans ∈ p && continue\n if X - ans > 0\n tmp = X - ans\n else\n if ans - X < tmp\n println(ans)\n break\n else\n println(X - tmp)\n break\n end\n end\n end\nend\n", "language": "Julia", "metadata": {"date": 1592184746, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s268472545.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s268472545", "user_id": "u154397310"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "readstr() = split(readline())\nreadnum(T::Type{<:Number} = Int) = parse.(T, split(readline()))\nlet\n X, N = readnum()\n p = readnum()\n X ∉ p && (println(X); exit())\n tmp = 0\n for ans = 0:101\n ans ∈ p && continue\n if X - ans > 0\n tmp = X - ans\n else\n if ans - X < tmp\n println(ans)\n break\n else\n println(X - tmp)\n break\n end\n end\n end\nend\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 258, "memory_kb": 173824}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s086559414", "group_id": "codeNet:p02641", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\n\nX, N = parseMap(split(readline()))\n\nif N != 0\n P = parseMap(split(readline()))\n for e in 0:100\n x = X - e\n if !(x in P)\n println(x)\n break\n end\n x2 = X + e\n if !(x2 in P)\n println(x2)\n break\n end\n end\nelse\n println(X)\nend\n\n\n\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1592183698, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s086559414.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s086559414", "user_id": "u879294842"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\n\nX, N = parseMap(split(readline()))\n\nif N != 0\n P = parseMap(split(readline()))\n for e in 0:100\n x = X - e\n if !(x in P)\n println(x)\n break\n end\n x2 = X + e\n if !(x2 in P)\n println(x2)\n break\n end\n end\nelse\n println(X)\nend\n\n\n\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 239, "memory_kb": 165004}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s437902167", "group_id": "codeNet:p02646", "input_text": "readints()=parse.(Int,split(readline()))\nreadint()=parse.(Int,readline())\n\nA,V=readints()\nB,W=readints()\nT=readint()\n\nD_d=abs(A-B)\nD_v=(V-W)\n\nif D_d <= D_v*T && (D_d % D_v)==0\n print(\"YES\")\nelse\n print(\"No\")\nend", "language": "Julia", "metadata": {"date": 1592097890, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02646.html", "problem_id": "p02646", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02646/input.txt", "sample_output_relpath": "derived/input_output/data/p02646/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02646/Julia/s437902167.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s437902167", "user_id": "u562051766"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "readints()=parse.(Int,split(readline()))\nreadint()=parse.(Int,readline())\n\nA,V=readints()\nB,W=readints()\nT=readint()\n\nD_d=abs(A-B)\nD_v=(V-W)\n\nif D_d <= D_v*T && (D_d % D_v)==0\n print(\"YES\")\nelse\n print(\"No\")\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch the other child.) The child who is \"it\" is now at coordinate A, and he can travel the distance of V per second.\nThe other child is now at coordinate B, and she can travel the distance of W per second.\n\nHe can catch her when his coordinate is the same as hers.\nDetermine whether he can catch her within T seconds (including exactly T seconds later).\nWe assume that both children move optimally.\n\nConstraints\n\n-10^9 \\leq A,B \\leq 10^9\n\n1 \\leq V,W \\leq 10^9\n\n1 \\leq T \\leq 10^9\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 V\nB W\nT\n\nOutput\n\nIf \"it\" can catch the other child, print YES; otherwise, print NO.\n\nSample Input 1\n\n1 2\n3 1\n3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n1 2\n3 2\n3\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n1 2\n3 3\n3\n\nSample Output 3\n\nNO", "sample_input": "1 2\n3 1\n3\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p02646", "source_text": "Score : 200 points\n\nProblem Statement\n\nTwo children are playing tag on a number line. (In the game of tag, the child called \"it\" tries to catch the other child.) The child who is \"it\" is now at coordinate A, and he can travel the distance of V per second.\nThe other child is now at coordinate B, and she can travel the distance of W per second.\n\nHe can catch her when his coordinate is the same as hers.\nDetermine whether he can catch her within T seconds (including exactly T seconds later).\nWe assume that both children move optimally.\n\nConstraints\n\n-10^9 \\leq A,B \\leq 10^9\n\n1 \\leq V,W \\leq 10^9\n\n1 \\leq T \\leq 10^9\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 V\nB W\nT\n\nOutput\n\nIf \"it\" can catch the other child, print YES; otherwise, print NO.\n\nSample Input 1\n\n1 2\n3 1\n3\n\nSample Output 1\n\nYES\n\nSample Input 2\n\n1 2\n3 2\n3\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n1 2\n3 3\n3\n\nSample Output 3\n\nNO", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 246, "memory_kb": 170512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s604625480", "group_id": "codeNet:p02647", "input_text": "# test sub\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction solve(N, K, A)\n for _ in 1:K\n tmp = zeros(Int64, N)\n\n for i in 1:N\n to = maximum([1, i - A[i]])\n en = minimum([N, i + A[i]])\n tmp[to:en] .+= 1\n end\n if A == tmp\n return A\n else\n A = tmp\n end\n end\n return A\nend\n\nfunction print_ans(A)\n for a in A\n print(a, \" \")\n end\n println()\nend\n\n\n\nfunction main()\n\nN, K = parseMap(split(readline()))\n\nA = parseMap(split(readline()))\n\n\nif N * K < 10 ^ 6\n print_ans(solve(N, K ,A))\nelseif K >= N\n print_ans(fill(N, N))\nelse\n print_ans(solve(N, 200, A))\nend\n\n\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1592104249, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s604625480.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s604625480", "user_id": "u785989355"}, "prompt_components": {"gold_output": "1 2 2 1 2\n", "input_to_evaluate": "# test sub\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction solve(N, K, A)\n for _ in 1:K\n tmp = zeros(Int64, N)\n\n for i in 1:N\n to = maximum([1, i - A[i]])\n en = minimum([N, i + A[i]])\n tmp[to:en] .+= 1\n end\n if A == tmp\n return A\n else\n A = tmp\n end\n end\n return A\nend\n\nfunction print_ans(A)\n for a in A\n print(a, \" \")\n end\n println()\nend\n\n\n\nfunction main()\n\nN, K = parseMap(split(readline()))\n\nA = parseMap(split(readline()))\n\n\nif N * K < 10 ^ 6\n print_ans(solve(N, K ,A))\nelseif K >= N\n print_ans(fill(N, N))\nelse\n print_ans(solve(N, 200, A))\nend\n\n\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 723, "cpu_time_ms": 2214, "memory_kb": 342768}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s231643914", "group_id": "codeNet:p02648", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction bsearch(a::Array{Tuple{Int,Int},1},x)\n\tl,r = 0, length(a)+1\n\twhile r-l>1\n\t\tm = (l+r)>>1\n\t\tif a[m][1]<=x\n\t\t\tl = m\n\t\telse\n\t\t\tr = m\n\t\tend\n\tend\n\treturn(l)\nend\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int}[(0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tv,w = readline() |> split |> parseMap\n\t\ta[i] = (v,w)\n\tend\n\tdps = [Dict{Int,Int}() for i in 1:n>>1]\n\tdps[1][0]=0\n\tdps[1][a[1][2]]=a[1][1]\n\tfor iter in 2:n>>1\n\t\tv = iter\n\t\tdp = copy(dps[v>>1])\n\t\t(p,q)=a[v]\n\t\tfor j in keys(dps[v>>1])\n\t\t\tif haskey(dp,j+q)\n\t\t\t\tdp[j+q]=max(dp[v>>1][j+q],dps[v>>1][j]+p)\n\t\t\telse\n\t\t\t\tdp[j+q]=dps[v>>1][j]+p\n\t\t\tend\n\t\tend\n\t\tdps[v] = copy(dp)\n\tend\n\tdpt = [Tuple{Int,Int}[] for i in 1:n>>1]\n\tfor i in 1:n>>1\n\t\ty = Tuple{Int,Int}[(j,dps[i][j]) for j in keys(dps[i])]\n\t\ty = sort(y,by=x->x[1])\n\t\tz = Tuple{Int,Int}[]\n\t\tpush!(z,y[1])\n\t\tfor j in 2:length(y)\n\t\t\tpush!(z,(y[j][1],max(y[j][2],z[j-1][2])))\n\t\tend\n\t\tdpt[i]=copy(z)\n\tend\n\tq = readline() |> parseInt\n\tfor iter in 1:q\n\t\tv,l = readline() |> split |> parseMap\n\t\tdp = Dict{Int,Int}()\n\t\tdp[0]=0\n\t\twhile v>n>>1\n\t\t\t(p,q) = a[v]\n\t\t\ttmp = copy(dp)\n\t\t\ttmp[0]=0\n\t\t\tfor j in keys(dp)\n\t\t\t\tif j+q<=l\n\t\t\t\t\tif haskey(dp,j+q)\n\t\t\t\t\t\ttmp[j+q]=max(dp[j+q],dp[j]+p)\n\t\t\t\t\telse\n\t\t\t\t\t\ttmp[j+q]=dp[j]+p\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tdp = copy(tmp)\n\t\t\tv>>=1\n\t\tend\n\t\tmx = 0\n\t\tfor j in keys(dp)\n\t\t\tk = bsearch(dpt[v],l-j)\n\t\t\tif k>0\n\t\t\t\tmx = max(mx,dp[j]+dpt[v][k][2])\n\t\t\telse\n\t\t\t\tmx = max(mx,dp[j])\n\t\t\tend\n\t\tend\n\t\tprintln(mx)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1592103881, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02648.html", "problem_id": "p02648", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02648/input.txt", "sample_output_relpath": "derived/input_output/data/p02648/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02648/Julia/s231643914.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s231643914", "user_id": "u095714878"}, "prompt_components": {"gold_output": "0\n3\n3\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction bsearch(a::Array{Tuple{Int,Int},1},x)\n\tl,r = 0, length(a)+1\n\twhile r-l>1\n\t\tm = (l+r)>>1\n\t\tif a[m][1]<=x\n\t\t\tl = m\n\t\telse\n\t\t\tr = m\n\t\tend\n\tend\n\treturn(l)\nend\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int}[(0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tv,w = readline() |> split |> parseMap\n\t\ta[i] = (v,w)\n\tend\n\tdps = [Dict{Int,Int}() for i in 1:n>>1]\n\tdps[1][0]=0\n\tdps[1][a[1][2]]=a[1][1]\n\tfor iter in 2:n>>1\n\t\tv = iter\n\t\tdp = copy(dps[v>>1])\n\t\t(p,q)=a[v]\n\t\tfor j in keys(dps[v>>1])\n\t\t\tif haskey(dp,j+q)\n\t\t\t\tdp[j+q]=max(dp[v>>1][j+q],dps[v>>1][j]+p)\n\t\t\telse\n\t\t\t\tdp[j+q]=dps[v>>1][j]+p\n\t\t\tend\n\t\tend\n\t\tdps[v] = copy(dp)\n\tend\n\tdpt = [Tuple{Int,Int}[] for i in 1:n>>1]\n\tfor i in 1:n>>1\n\t\ty = Tuple{Int,Int}[(j,dps[i][j]) for j in keys(dps[i])]\n\t\ty = sort(y,by=x->x[1])\n\t\tz = Tuple{Int,Int}[]\n\t\tpush!(z,y[1])\n\t\tfor j in 2:length(y)\n\t\t\tpush!(z,(y[j][1],max(y[j][2],z[j-1][2])))\n\t\tend\n\t\tdpt[i]=copy(z)\n\tend\n\tq = readline() |> parseInt\n\tfor iter in 1:q\n\t\tv,l = readline() |> split |> parseMap\n\t\tdp = Dict{Int,Int}()\n\t\tdp[0]=0\n\t\twhile v>n>>1\n\t\t\t(p,q) = a[v]\n\t\t\ttmp = copy(dp)\n\t\t\ttmp[0]=0\n\t\t\tfor j in keys(dp)\n\t\t\t\tif j+q<=l\n\t\t\t\t\tif haskey(dp,j+q)\n\t\t\t\t\t\ttmp[j+q]=max(dp[j+q],dp[j]+p)\n\t\t\t\t\telse\n\t\t\t\t\t\ttmp[j+q]=dp[j]+p\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tdp = copy(tmp)\n\t\t\tv>>=1\n\t\tend\n\t\tmx = 0\n\t\tfor j in keys(dp)\n\t\t\tk = bsearch(dpt[v],l-j)\n\t\t\tif k>0\n\t\t\t\tmx = max(mx,dp[j]+dpt[v][k][2])\n\t\t\telse\n\t\t\t\tmx = max(mx,dp[j])\n\t\t\tend\n\t\tend\n\t\tprintln(mx)\n\tend\nend\n\nmain()", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a rooted binary tree with N vertices, where the vertices are numbered 1 to N.\nVertex 1 is the root, and the parent of Vertex i (i \\geq 2) is Vertex \\left[ \\frac{i}{2} \\right].\n\nEach vertex has one item in it. The item in Vertex i has a value of V_i and a weight of W_i.\nNow, process the following query Q times:\n\nGiven are a vertex v of the tree and a positive integer L.\nLet us choose some (possibly none) of the items in v and the ancestors of v so that their total weight is at most L.\nFind the maximum possible total value of the chosen items.\n\nHere, Vertex u is said to be an ancestor of Vertex v when u is an indirect parent of v, that is, there exists a sequence of vertices w_1,w_2,\\ldots,w_k (k\\geq 2) where w_1=v, w_k=u, and w_{i+1} is the parent of w_i for each i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N < 2^{18}\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq V_i \\leq 10^5\n\n1 \\leq W_i \\leq 10^5\n\nFor the values v and L given in each query, 1 \\leq v \\leq N and 1 \\leq L \\leq 10^5.\n\nInput\n\nLet v_i and L_i be the values v and L given in the i-th query.\nThen, Input is given from Standard Input in the following format:\n\nN\nV_1 W_1\n:\nV_N W_N\nQ\nv_1 L_1\n:\nv_Q L_Q\n\nOutput\n\nFor each integer i from 1 through Q,\nthe i-th line should contain the response to the i-th query.\n\nSample Input 1\n\n3\n1 2\n2 3\n3 4\n3\n1 1\n2 5\n3 5\n\nSample Output 1\n\n0\n3\n3\n\nIn the first query, we are given only one choice: the item with (V, W)=(1,2). Since L = 1, we cannot actually choose it, so our response should be 0.\n\nIn the second query, we are given two choices: the items with (V, W)=(1,2) and (V, W)=(2,3). Since L = 5, we can choose both of them, so our response should be 3.\n\nSample Input 2\n\n15\n123 119\n129 120\n132 112\n126 109\n118 103\n115 109\n102 100\n130 120\n105 105\n132 115\n104 102\n107 107\n127 116\n121 104\n121 115\n8\n8 234\n9 244\n10 226\n11 227\n12 240\n13 237\n14 206\n15 227\n\nSample Output 2\n\n256\n255\n250\n247\n255\n259\n223\n253", "sample_input": "3\n1 2\n2 3\n3 4\n3\n1 1\n2 5\n3 5\n"}, "reference_outputs": ["0\n3\n3\n"], "source_document_id": "p02648", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a rooted binary tree with N vertices, where the vertices are numbered 1 to N.\nVertex 1 is the root, and the parent of Vertex i (i \\geq 2) is Vertex \\left[ \\frac{i}{2} \\right].\n\nEach vertex has one item in it. The item in Vertex i has a value of V_i and a weight of W_i.\nNow, process the following query Q times:\n\nGiven are a vertex v of the tree and a positive integer L.\nLet us choose some (possibly none) of the items in v and the ancestors of v so that their total weight is at most L.\nFind the maximum possible total value of the chosen items.\n\nHere, Vertex u is said to be an ancestor of Vertex v when u is an indirect parent of v, that is, there exists a sequence of vertices w_1,w_2,\\ldots,w_k (k\\geq 2) where w_1=v, w_k=u, and w_{i+1} is the parent of w_i for each i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N < 2^{18}\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq V_i \\leq 10^5\n\n1 \\leq W_i \\leq 10^5\n\nFor the values v and L given in each query, 1 \\leq v \\leq N and 1 \\leq L \\leq 10^5.\n\nInput\n\nLet v_i and L_i be the values v and L given in the i-th query.\nThen, Input is given from Standard Input in the following format:\n\nN\nV_1 W_1\n:\nV_N W_N\nQ\nv_1 L_1\n:\nv_Q L_Q\n\nOutput\n\nFor each integer i from 1 through Q,\nthe i-th line should contain the response to the i-th query.\n\nSample Input 1\n\n3\n1 2\n2 3\n3 4\n3\n1 1\n2 5\n3 5\n\nSample Output 1\n\n0\n3\n3\n\nIn the first query, we are given only one choice: the item with (V, W)=(1,2). Since L = 1, we cannot actually choose it, so our response should be 0.\n\nIn the second query, we are given two choices: the items with (V, W)=(1,2) and (V, W)=(2,3). Since L = 5, we can choose both of them, so our response should be 3.\n\nSample Input 2\n\n15\n123 119\n129 120\n132 112\n126 109\n118 103\n115 109\n102 100\n130 120\n105 105\n132 115\n104 102\n107 107\n127 116\n121 104\n121 115\n8\n8 234\n9 244\n10 226\n11 227\n12 240\n13 237\n14 206\n15 227\n\nSample Output 2\n\n256\n255\n250\n247\n255\n259\n223\n253", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1536, "cpu_time_ms": 2189, "memory_kb": 358444}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s666874557", "group_id": "codeNet:p02648", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int}[(0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tv,w = readline() |> split |> parseMap\n\t\ta[i] = (v,w)\n\tend\n\tq = readline() |> parseInt\n\tfor iter in 1:q\n\t\tv,l = readline() |> split |> parseMap\n\t\tdp = Dict{Int,Int}()\n\t\tdp[0]=0\n\t\twhile v>0\n\t\t\t(p,q) = a[v]\n\t\t\ttmp = copy(dp)\n\t\t\ttmp[0]=0\n\t\t\tfor j in keys(dp)\n\t\t\t\tif j+q<=l\n\t\t\t\t\tif haskey(dp,j+q)\n\t\t\t\t\t\ttmp[j+q]=max(dp[j+q],dp[j]+p)\n\t\t\t\t\telse\n\t\t\t\t\t\ttmp[j+q]=dp[j]+p\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tdp = copy(tmp)\n\t\t\tv>>=1\n\t\tend\n\t\tprintln(maximum(values(dp)))\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1592101323, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02648.html", "problem_id": "p02648", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02648/input.txt", "sample_output_relpath": "derived/input_output/data/p02648/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02648/Julia/s666874557.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s666874557", "user_id": "u095714878"}, "prompt_components": {"gold_output": "0\n3\n3\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int}[(0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tv,w = readline() |> split |> parseMap\n\t\ta[i] = (v,w)\n\tend\n\tq = readline() |> parseInt\n\tfor iter in 1:q\n\t\tv,l = readline() |> split |> parseMap\n\t\tdp = Dict{Int,Int}()\n\t\tdp[0]=0\n\t\twhile v>0\n\t\t\t(p,q) = a[v]\n\t\t\ttmp = copy(dp)\n\t\t\ttmp[0]=0\n\t\t\tfor j in keys(dp)\n\t\t\t\tif j+q<=l\n\t\t\t\t\tif haskey(dp,j+q)\n\t\t\t\t\t\ttmp[j+q]=max(dp[j+q],dp[j]+p)\n\t\t\t\t\telse\n\t\t\t\t\t\ttmp[j+q]=dp[j]+p\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tdp = copy(tmp)\n\t\t\tv>>=1\n\t\tend\n\t\tprintln(maximum(values(dp)))\n\tend\nend\n\nmain()", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a rooted binary tree with N vertices, where the vertices are numbered 1 to N.\nVertex 1 is the root, and the parent of Vertex i (i \\geq 2) is Vertex \\left[ \\frac{i}{2} \\right].\n\nEach vertex has one item in it. The item in Vertex i has a value of V_i and a weight of W_i.\nNow, process the following query Q times:\n\nGiven are a vertex v of the tree and a positive integer L.\nLet us choose some (possibly none) of the items in v and the ancestors of v so that their total weight is at most L.\nFind the maximum possible total value of the chosen items.\n\nHere, Vertex u is said to be an ancestor of Vertex v when u is an indirect parent of v, that is, there exists a sequence of vertices w_1,w_2,\\ldots,w_k (k\\geq 2) where w_1=v, w_k=u, and w_{i+1} is the parent of w_i for each i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N < 2^{18}\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq V_i \\leq 10^5\n\n1 \\leq W_i \\leq 10^5\n\nFor the values v and L given in each query, 1 \\leq v \\leq N and 1 \\leq L \\leq 10^5.\n\nInput\n\nLet v_i and L_i be the values v and L given in the i-th query.\nThen, Input is given from Standard Input in the following format:\n\nN\nV_1 W_1\n:\nV_N W_N\nQ\nv_1 L_1\n:\nv_Q L_Q\n\nOutput\n\nFor each integer i from 1 through Q,\nthe i-th line should contain the response to the i-th query.\n\nSample Input 1\n\n3\n1 2\n2 3\n3 4\n3\n1 1\n2 5\n3 5\n\nSample Output 1\n\n0\n3\n3\n\nIn the first query, we are given only one choice: the item with (V, W)=(1,2). Since L = 1, we cannot actually choose it, so our response should be 0.\n\nIn the second query, we are given two choices: the items with (V, W)=(1,2) and (V, W)=(2,3). Since L = 5, we can choose both of them, so our response should be 3.\n\nSample Input 2\n\n15\n123 119\n129 120\n132 112\n126 109\n118 103\n115 109\n102 100\n130 120\n105 105\n132 115\n104 102\n107 107\n127 116\n121 104\n121 115\n8\n8 234\n9 244\n10 226\n11 227\n12 240\n13 237\n14 206\n15 227\n\nSample Output 2\n\n256\n255\n250\n247\n255\n259\n223\n253", "sample_input": "3\n1 2\n2 3\n3 4\n3\n1 1\n2 5\n3 5\n"}, "reference_outputs": ["0\n3\n3\n"], "source_document_id": "p02648", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a rooted binary tree with N vertices, where the vertices are numbered 1 to N.\nVertex 1 is the root, and the parent of Vertex i (i \\geq 2) is Vertex \\left[ \\frac{i}{2} \\right].\n\nEach vertex has one item in it. The item in Vertex i has a value of V_i and a weight of W_i.\nNow, process the following query Q times:\n\nGiven are a vertex v of the tree and a positive integer L.\nLet us choose some (possibly none) of the items in v and the ancestors of v so that their total weight is at most L.\nFind the maximum possible total value of the chosen items.\n\nHere, Vertex u is said to be an ancestor of Vertex v when u is an indirect parent of v, that is, there exists a sequence of vertices w_1,w_2,\\ldots,w_k (k\\geq 2) where w_1=v, w_k=u, and w_{i+1} is the parent of w_i for each i.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N < 2^{18}\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq V_i \\leq 10^5\n\n1 \\leq W_i \\leq 10^5\n\nFor the values v and L given in each query, 1 \\leq v \\leq N and 1 \\leq L \\leq 10^5.\n\nInput\n\nLet v_i and L_i be the values v and L given in the i-th query.\nThen, Input is given from Standard Input in the following format:\n\nN\nV_1 W_1\n:\nV_N W_N\nQ\nv_1 L_1\n:\nv_Q L_Q\n\nOutput\n\nFor each integer i from 1 through Q,\nthe i-th line should contain the response to the i-th query.\n\nSample Input 1\n\n3\n1 2\n2 3\n3 4\n3\n1 1\n2 5\n3 5\n\nSample Output 1\n\n0\n3\n3\n\nIn the first query, we are given only one choice: the item with (V, W)=(1,2). Since L = 1, we cannot actually choose it, so our response should be 0.\n\nIn the second query, we are given two choices: the items with (V, W)=(1,2) and (V, W)=(2,3). Since L = 5, we can choose both of them, so our response should be 3.\n\nSample Input 2\n\n15\n123 119\n129 120\n132 112\n126 109\n118 103\n115 109\n102 100\n130 120\n105 105\n132 115\n104 102\n107 107\n127 116\n121 104\n121 115\n8\n8 234\n9 244\n10 226\n11 227\n12 240\n13 237\n14 206\n15 227\n\nSample Output 2\n\n256\n255\n250\n247\n255\n259\n223\n253", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3317, "memory_kb": 300248}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s174136556", "group_id": "codeNet:p02651", "input_text": "function solve()\n n=parse(Int,readline())\n as=map(x->parse(Int,x),split(readline()))\n s=readline()\n t=Int[]\n ok=false\n for i=n:-1:1\n a=as[i]\n for b=t\n a=min(a,xor(a,b))\n end\n if a!=0\n if s[i]=='1'\n ok=true\n else\n push!(t,a)\n end\n end\n end\n println(ok ? 1 : 0)\nend\nt=parse(Int,readline())\nfor _=1:t\n solve()\nend", "language": "Julia", "metadata": {"date": 1597456927, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02651.html", "problem_id": "p02651", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02651/input.txt", "sample_output_relpath": "derived/input_output/data/p02651/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02651/Julia/s174136556.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s174136556", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n0\n0\n", "input_to_evaluate": "function solve()\n n=parse(Int,readline())\n as=map(x->parse(Int,x),split(readline()))\n s=readline()\n t=Int[]\n ok=false\n for i=n:-1:1\n a=as[i]\n for b=t\n a=min(a,xor(a,b))\n end\n if a!=0\n if s[i]=='1'\n ok=true\n else\n push!(t,a)\n end\n end\n end\n println(ok ? 1 : 0)\nend\nt=parse(Int,readline())\nfor _=1:t\n solve()\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are two persons, numbered 0 and 1, and a variable x whose initial value is 0.\nThe two persons now play a game.\nThe game is played in N rounds. The following should be done in the i-th round (1 \\leq i \\leq N):\n\nPerson S_i does one of the following:\n\nReplace x with x \\oplus A_i, where \\oplus represents bitwise XOR.\n\nDo nothing.\n\nPerson 0 aims to have x=0 at the end of the game, while Person 1 aims to have x \\neq 0 at the end of the game.\n\nDetermine whether x becomes 0 at the end of the game when the two persons play optimally.\n\nSolve T test cases for each input file.\n\nConstraints\n\n1 \\leq T \\leq 100\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^{18}\n\nS is a string of length N consisting of 0 and 1.\n\nAll numbers in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format.\nThe first line is as follows:\n\nT\n\nThen, T test cases follow.\nEach test case is given in the following format:\n\nN\nA_1 A_2 \\cdots A_N\nS\n\nOutput\n\nFor each test case, print a line containing 0 if x becomes 0 at the end of the game, and 1 otherwise.\n\nSample Input 1\n\n3\n2\n1 2\n10\n2\n1 1\n10\n6\n2 3 4 5 6 7\n111000\n\nSample Output 1\n\n1\n0\n0\n\nIn the first test case, if Person 1 replaces x with 0 \\oplus 1=1, we surely have x \\neq 0 at the end of the game, regardless of the choice of Person 0.\n\nIn the second test case, regardless of the choice of Person 1, Person 0 can make x=0 with a suitable choice.", "sample_input": "3\n2\n1 2\n10\n2\n1 1\n10\n6\n2 3 4 5 6 7\n111000\n"}, "reference_outputs": ["1\n0\n0\n"], "source_document_id": "p02651", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are two persons, numbered 0 and 1, and a variable x whose initial value is 0.\nThe two persons now play a game.\nThe game is played in N rounds. The following should be done in the i-th round (1 \\leq i \\leq N):\n\nPerson S_i does one of the following:\n\nReplace x with x \\oplus A_i, where \\oplus represents bitwise XOR.\n\nDo nothing.\n\nPerson 0 aims to have x=0 at the end of the game, while Person 1 aims to have x \\neq 0 at the end of the game.\n\nDetermine whether x becomes 0 at the end of the game when the two persons play optimally.\n\nSolve T test cases for each input file.\n\nConstraints\n\n1 \\leq T \\leq 100\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^{18}\n\nS is a string of length N consisting of 0 and 1.\n\nAll numbers in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format.\nThe first line is as follows:\n\nT\n\nThen, T test cases follow.\nEach test case is given in the following format:\n\nN\nA_1 A_2 \\cdots A_N\nS\n\nOutput\n\nFor each test case, print a line containing 0 if x becomes 0 at the end of the game, and 1 otherwise.\n\nSample Input 1\n\n3\n2\n1 2\n10\n2\n1 1\n10\n6\n2 3 4 5 6 7\n111000\n\nSample Output 1\n\n1\n0\n0\n\nIn the first test case, if Person 1 replaces x with 0 \\oplus 1=1, we surely have x \\neq 0 at the end of the game, regardless of the choice of Person 0.\n\nIn the second test case, regardless of the choice of Person 1, Person 0 can make x=0 with a suitable choice.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 256, "memory_kb": 167192}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s046191180", "group_id": "codeNet:p02651", "input_text": "# Q.1\nfunction A01(x,y)\n if count_zeros(y) > count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n xor(x,A[])\n end\n x\nend\n\nfunction A02(x,y)\n if count_zeros(y) > count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n x = y\n end\n x\nend\n\nfunction A11(x,y)\n if count_zeros(y) < count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n x = x\n end\n x\nend\n\nfunction A12(x,y)\n if count_zeros(y) < count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n x = y\n end\n x\nend\n\nfunction calc(A,S)\n let j=1\n x = Int128(0)\n while j<=length(S)\n jun = parse(Int64,S[j])\n #println(jun)\n y = xor(x,A[j])\n #println(count_zeros(y),\" vs \",count_zeros(x))\n if jun==0\n if count_zeros(y) > count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n #if j!=length(S) && count_zeros(xor(x,A[j+1])) < count_zeros(xor(y,A[j+1]))\n # x = y\n #end\n end\n# x1 = A01(x,y)\n# x2 = A02(x,y)\n else\n if count_zeros(y) < count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n #if j!=length(S) && count_zeros(xor(x,A[j+1])) > count_zeros(xor(y,A[j+1]))\n # x = y\n #end\n end\n# x1 = A11(x,y)\n# x2 = A12(x,y)\n end\n\n #println(\"j = $j, turn: $jun, Aâ±¼ = $(A[j]), x = $x\")\n j += 1\n end\n #println(\"xans = \",x)\n if x==0\n #println(0)\n ans=0\n else\n #println(1)\n ans=1\n end\n ans\n end\nend\n\nfunction calc2(A,S)\n let j=1\n x = Int64(0)\n while j<=length(S)\n jun = parse(Int64,S[j])\n #println(jun)\n y = xor(x,A[j])\n #println(count_zeros(y),\" vs \",count_zeros(x))\n if jun==0\n if count_zeros(y) >= count_zeros(x)\n x = y\n end\n else\n if count_zeros(y) <= count_zeros(x)\n x = y\n end\n end\n #println(\"j = $j, turn: $jun, Aâ±¼ = $(A[j]), x = $x\")\n j += 1\n end\n #println(\"xans = \",x)\n if x==0\n #println(0)\n ans=0\n else\n #println(1)\n ans=1\n end\n ans\n end\nend\n\ntmp=readline()\n#println(\"Input: \",split(tmp))\nT=parse(Int128,tmp)\nlet i=1\n while i<=T\n tmp=readline()\n N=parse(Int64,tmp)\n tmp=readline()\n A=parse.(Int64,split(tmp))\n tmp=readline()\n S=tmp\n #println(\"Input: $N, $A ,$S\")\n #println(length(S))\n if S[N]==\"1\"\n println(1)\n continue\n end\n ans=calc(A,S)\n ans2=1#calc2(A,S)\n if ans==0 || ans2==0\n println(0)\n else\n println(1)\n end\n i += 1\n end\nend\n", "language": "Julia", "metadata": {"date": 1591586192, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02651.html", "problem_id": "p02651", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02651/input.txt", "sample_output_relpath": "derived/input_output/data/p02651/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02651/Julia/s046191180.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s046191180", "user_id": "u524573278"}, "prompt_components": {"gold_output": "1\n0\n0\n", "input_to_evaluate": "# Q.1\nfunction A01(x,y)\n if count_zeros(y) > count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n xor(x,A[])\n end\n x\nend\n\nfunction A02(x,y)\n if count_zeros(y) > count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n x = y\n end\n x\nend\n\nfunction A11(x,y)\n if count_zeros(y) < count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n x = x\n end\n x\nend\n\nfunction A12(x,y)\n if count_zeros(y) < count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n x = y\n end\n x\nend\n\nfunction calc(A,S)\n let j=1\n x = Int128(0)\n while j<=length(S)\n jun = parse(Int64,S[j])\n #println(jun)\n y = xor(x,A[j])\n #println(count_zeros(y),\" vs \",count_zeros(x))\n if jun==0\n if count_zeros(y) > count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n #if j!=length(S) && count_zeros(xor(x,A[j+1])) < count_zeros(xor(y,A[j+1]))\n # x = y\n #end\n end\n# x1 = A01(x,y)\n# x2 = A02(x,y)\n else\n if count_zeros(y) < count_zeros(x)\n x = y\n elseif count_zeros(y) == count_zeros(x)\n #if j!=length(S) && count_zeros(xor(x,A[j+1])) > count_zeros(xor(y,A[j+1]))\n # x = y\n #end\n end\n# x1 = A11(x,y)\n# x2 = A12(x,y)\n end\n\n #println(\"j = $j, turn: $jun, Aâ±¼ = $(A[j]), x = $x\")\n j += 1\n end\n #println(\"xans = \",x)\n if x==0\n #println(0)\n ans=0\n else\n #println(1)\n ans=1\n end\n ans\n end\nend\n\nfunction calc2(A,S)\n let j=1\n x = Int64(0)\n while j<=length(S)\n jun = parse(Int64,S[j])\n #println(jun)\n y = xor(x,A[j])\n #println(count_zeros(y),\" vs \",count_zeros(x))\n if jun==0\n if count_zeros(y) >= count_zeros(x)\n x = y\n end\n else\n if count_zeros(y) <= count_zeros(x)\n x = y\n end\n end\n #println(\"j = $j, turn: $jun, Aâ±¼ = $(A[j]), x = $x\")\n j += 1\n end\n #println(\"xans = \",x)\n if x==0\n #println(0)\n ans=0\n else\n #println(1)\n ans=1\n end\n ans\n end\nend\n\ntmp=readline()\n#println(\"Input: \",split(tmp))\nT=parse(Int128,tmp)\nlet i=1\n while i<=T\n tmp=readline()\n N=parse(Int64,tmp)\n tmp=readline()\n A=parse.(Int64,split(tmp))\n tmp=readline()\n S=tmp\n #println(\"Input: $N, $A ,$S\")\n #println(length(S))\n if S[N]==\"1\"\n println(1)\n continue\n end\n ans=calc(A,S)\n ans2=1#calc2(A,S)\n if ans==0 || ans2==0\n println(0)\n else\n println(1)\n end\n i += 1\n end\nend\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are two persons, numbered 0 and 1, and a variable x whose initial value is 0.\nThe two persons now play a game.\nThe game is played in N rounds. The following should be done in the i-th round (1 \\leq i \\leq N):\n\nPerson S_i does one of the following:\n\nReplace x with x \\oplus A_i, where \\oplus represents bitwise XOR.\n\nDo nothing.\n\nPerson 0 aims to have x=0 at the end of the game, while Person 1 aims to have x \\neq 0 at the end of the game.\n\nDetermine whether x becomes 0 at the end of the game when the two persons play optimally.\n\nSolve T test cases for each input file.\n\nConstraints\n\n1 \\leq T \\leq 100\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^{18}\n\nS is a string of length N consisting of 0 and 1.\n\nAll numbers in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format.\nThe first line is as follows:\n\nT\n\nThen, T test cases follow.\nEach test case is given in the following format:\n\nN\nA_1 A_2 \\cdots A_N\nS\n\nOutput\n\nFor each test case, print a line containing 0 if x becomes 0 at the end of the game, and 1 otherwise.\n\nSample Input 1\n\n3\n2\n1 2\n10\n2\n1 1\n10\n6\n2 3 4 5 6 7\n111000\n\nSample Output 1\n\n1\n0\n0\n\nIn the first test case, if Person 1 replaces x with 0 \\oplus 1=1, we surely have x \\neq 0 at the end of the game, regardless of the choice of Person 0.\n\nIn the second test case, regardless of the choice of Person 1, Person 0 can make x=0 with a suitable choice.", "sample_input": "3\n2\n1 2\n10\n2\n1 1\n10\n6\n2 3 4 5 6 7\n111000\n"}, "reference_outputs": ["1\n0\n0\n"], "source_document_id": "p02651", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are two persons, numbered 0 and 1, and a variable x whose initial value is 0.\nThe two persons now play a game.\nThe game is played in N rounds. The following should be done in the i-th round (1 \\leq i \\leq N):\n\nPerson S_i does one of the following:\n\nReplace x with x \\oplus A_i, where \\oplus represents bitwise XOR.\n\nDo nothing.\n\nPerson 0 aims to have x=0 at the end of the game, while Person 1 aims to have x \\neq 0 at the end of the game.\n\nDetermine whether x becomes 0 at the end of the game when the two persons play optimally.\n\nSolve T test cases for each input file.\n\nConstraints\n\n1 \\leq T \\leq 100\n\n1 \\leq N \\leq 200\n\n1 \\leq A_i \\leq 10^{18}\n\nS is a string of length N consisting of 0 and 1.\n\nAll numbers in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format.\nThe first line is as follows:\n\nT\n\nThen, T test cases follow.\nEach test case is given in the following format:\n\nN\nA_1 A_2 \\cdots A_N\nS\n\nOutput\n\nFor each test case, print a line containing 0 if x becomes 0 at the end of the game, and 1 otherwise.\n\nSample Input 1\n\n3\n2\n1 2\n10\n2\n1 1\n10\n6\n2 3 4 5 6 7\n111000\n\nSample Output 1\n\n1\n0\n0\n\nIn the first test case, if Person 1 replaces x with 0 \\oplus 1=1, we surely have x \\neq 0 at the end of the game, regardless of the choice of Person 0.\n\nIn the second test case, regardless of the choice of Person 1, Person 0 can make x=0 with a suitable choice.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 3216, "cpu_time_ms": 431, "memory_kb": 197880}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s299208454", "group_id": "codeNet:p02657", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nA, B = parseMap(split(readline()))\n\nprintln(A * B)", "language": "Julia", "metadata": {"date": 1592094354, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s299208454.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s299208454", "user_id": "u879294842"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nA, B = parseMap(split(readline()))\n\nprintln(A * B)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 241, "memory_kb": 161704}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s672814295", "group_id": "codeNet:p02657", "input_text": "a,b=parse.(split(readline()))\nprintln(a*b)", "language": "Julia", "metadata": {"date": 1591142154, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s672814295.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s672814295", "user_id": "u095714878"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "a,b=parse.(split(readline()))\nprintln(a*b)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 42, "cpu_time_ms": 1485, "memory_kb": 308556}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s960384566", "group_id": "codeNet:p02657", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n a,b=pM(split(readline()))\n print(*(a,b))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1590973303, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s960384566.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s960384566", "user_id": "u443151804"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n a,b=pM(split(readline()))\n print(*(a,b))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 266, "cpu_time_ms": 220, "memory_kb": 160916}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s575322260", "group_id": "codeNet:p02657", "input_text": "import Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\n\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n if !isdelim(c, delims)\n break\n end\n end\n push!(out, c)\n if eof(s)\n return out\n end\n while !eof(s)\n c = read(s, UInt8)\n if isdelim(c, delims)\n break\n end\n push!(out, c)\n end\n return out\nend\n\ndelimset = Set([0x0a, 0x20])\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nreadvec(tys::Tuple , len::Signed)::Vector{Tuple{tys...}} = @inbounds Tuple{tys...}[reads(tys...) for i in 1:len]\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i = 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nfunction main()\n a,b = reads(Int,Int)\n println(a*b)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1590973252, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s575322260.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s575322260", "user_id": "u729767359"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "import Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\n\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n if !isdelim(c, delims)\n break\n end\n end\n push!(out, c)\n if eof(s)\n return out\n end\n while !eof(s)\n c = read(s, UInt8)\n if isdelim(c, delims)\n break\n end\n push!(out, c)\n end\n return out\nend\n\ndelimset = Set([0x0a, 0x20])\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nreadvec(tys::Tuple , len::Signed)::Vector{Tuple{tys...}} = @inbounds Tuple{tys...}[reads(tys...) for i in 1:len]\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i = 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nfunction main()\n a,b = reads(Int,Int)\n println(a*b)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1462, "cpu_time_ms": 367, "memory_kb": 188624}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s871301652", "group_id": "codeNet:p02660", "input_text": "using Primes: factor\nusing DataStructures: SortedDict\nfunction main()\n n = parse(Int,readline())\n sa = factor(SortedDict, n)\n ret = 0\n for p in sa\n ni = p |> last\n for del in 1:10\n if ni >= del\n ni -= del\n ret += 1\n end\n end\n end\n println(ret)\nend\nmain()", "language": "Julia", "metadata": {"date": 1592782445, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s871301652.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s871301652", "user_id": "u743272507"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "using Primes: factor\nusing DataStructures: SortedDict\nfunction main()\n n = parse(Int,readline())\n sa = factor(SortedDict, n)\n ret = 0\n for p in sa\n ni = p |> last\n for del in 1:10\n if ni >= del\n ni -= del\n ret += 1\n end\n end\n end\n println(ret)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1114, "memory_kb": 223188}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s803546100", "group_id": "codeNet:p02660", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nusing Primes\n\nfunction main()\n n::Int=parseInt(readline())\n sq::Int=trunc(Int,sqrt(n))\n arr::Vector{Int}=Vector{Int}()\n sosu::Vector{Bool}=[true for i in 1:10^6]\n sosu[1]=false\n for i in 3:10^6\n res=true\n for j in 2:trunc(Int,sqrt(i))+1\n if i%j==0\n res=false\n break\n end\n end\n sosu[i]=res\n end\n ans::Int=0\n for i in 2:10^6\n if !sosu[i]\n continue\n end\n res::Int128=i\n while n%res==0\n ans+=1\n n÷=res\n res*=i\n end\n end\n flag::Bool=true\n for i in 2:10^6\n if n%i==0\n flag=false\n end\n end\n if flag && n>1\n ans+=1\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1590978289, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s803546100.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s803546100", "user_id": "u619197965"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nusing Primes\n\nfunction main()\n n::Int=parseInt(readline())\n sq::Int=trunc(Int,sqrt(n))\n arr::Vector{Int}=Vector{Int}()\n sosu::Vector{Bool}=[true for i in 1:10^6]\n sosu[1]=false\n for i in 3:10^6\n res=true\n for j in 2:trunc(Int,sqrt(i))+1\n if i%j==0\n res=false\n break\n end\n end\n sosu[i]=res\n end\n ans::Int=0\n for i in 2:10^6\n if !sosu[i]\n continue\n end\n res::Int128=i\n while n%res==0\n ans+=1\n n÷=res\n res*=i\n end\n end\n flag::Bool=true\n for i in 2:10^6\n if n%i==0\n flag=false\n end\n end\n if flag && n>1\n ans+=1\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 969, "cpu_time_ms": 498, "memory_kb": 182324}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s116921453", "group_id": "codeNet:p02660", "input_text": "import Base.parse\nimport Base.StringVector\nusing Primes\nusing DataStructures\n\nparse(::Type{String}, str::AbstractString) = str\n\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n if !isdelim(c, delims)\n break\n end\n end\n push!(out, c)\n if eof(s)\n return out\n end\n while !eof(s)\n c = read(s, UInt8)\n if isdelim(c, delims)\n break\n end\n push!(out, c)\n end\n return out\nend\n\ndelimset = Set([0x0a, 0x20])\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nreadvec(tys::Tuple , len::Signed)::Vector{Tuple{tys...}} = @inbounds Tuple{tys...}[reads(tys...) for i in 1:len]\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i = 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nfunction main()\n N = pread(Int)\n fs = factor(DataStructures.SortedDict, N)\n ans = 0\n for f in fs\n c = f[2]\n ans += (-1+sqrt(1+8c))÷2\n end\n println(Int(ans))\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1590975979, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s116921453.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s116921453", "user_id": "u729767359"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "import Base.parse\nimport Base.StringVector\nusing Primes\nusing DataStructures\n\nparse(::Type{String}, str::AbstractString) = str\n\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n if !isdelim(c, delims)\n break\n end\n end\n push!(out, c)\n if eof(s)\n return out\n end\n while !eof(s)\n c = read(s, UInt8)\n if isdelim(c, delims)\n break\n end\n push!(out, c)\n end\n return out\nend\n\ndelimset = Set([0x0a, 0x20])\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nreadvec(tys::Tuple , len::Signed)::Vector{Tuple{tys...}} = @inbounds Tuple{tys...}[reads(tys...) for i in 1:len]\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i = 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nfunction main()\n N = pread(Int)\n fs = factor(DataStructures.SortedDict, N)\n ans = 0\n for f in fs\n c = f[2]\n ans += (-1+sqrt(1+8c))÷2\n end\n println(Int(ans))\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1628, "cpu_time_ms": 1343, "memory_kb": 265384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s446336670", "group_id": "codeNet:p02661", "input_text": "function main()\n\tN=parse(Int,readline())\n\tA=Int[]\n\tB=Int[]\n\tfor _=1:N\n\t\ta,b=map(x->parse(Int,x),split(readline()))\n\t\tpush!(A,a)\n\t\tpush!(B,b)\n\tend\n\tsort!(A)\n\tsort!(B)\n\tif N%2==1\n\t\tprintln(B[div(N+1,2)]-A[div(N+1,2)]+1)\n\telse\n\t\tprintln(B[div(N,2)]+B[div(N,2)+1]-A[div(N,2)]-A[div(N,2)+1]+1)\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1591464810, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02661.html", "problem_id": "p02661", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02661/input.txt", "sample_output_relpath": "derived/input_output/data/p02661/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02661/Julia/s446336670.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s446336670", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main()\n\tN=parse(Int,readline())\n\tA=Int[]\n\tB=Int[]\n\tfor _=1:N\n\t\ta,b=map(x->parse(Int,x),split(readline()))\n\t\tpush!(A,a)\n\t\tpush!(B,b)\n\tend\n\tsort!(A)\n\tsort!(B)\n\tif N%2==1\n\t\tprintln(B[div(N+1,2)]-A[div(N+1,2)]+1)\n\telse\n\t\tprintln(B[div(N,2)]+B[div(N,2)+1]-A[div(N,2)]-A[div(N,2)+1]+1)\n\tend\nend\nmain()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nNotes\n\nThe median of X_1, X_2, \\cdots, X_N is defined as follows. Let x_1, x_2, \\cdots, x_N be the result of sorting X_1, X_2, \\cdots, X_N in ascending order.\n\nIf N is odd, the median is x_{(N+1)/2};\n\nif N is even, the median is (x_{N/2} + x_{N/2+1}) / 2.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\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\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n1 2\n2 3\n\nSample Output 1\n\n3\n\nIf X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\nif X_1 = 1 and X_2 = 3, the median is 2;\n\nif X_1 = 2 and X_2 = 2, the median is 2;\n\nif X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\nSample Input 2\n\n3\n100 100\n10 10000\n1 1000000000\n\nSample Output 2\n\n9991", "sample_input": "2\n1 2\n2 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02661", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N integers X_1, X_2, \\cdots, X_N, and we know that A_i \\leq X_i \\leq B_i.\nFind the number of different values that the median of X_1, X_2, \\cdots, X_N can take.\n\nNotes\n\nThe median of X_1, X_2, \\cdots, X_N is defined as follows. Let x_1, x_2, \\cdots, x_N be the result of sorting X_1, X_2, \\cdots, X_N in ascending order.\n\nIf N is odd, the median is x_{(N+1)/2};\n\nif N is even, the median is (x_{N/2} + x_{N/2+1}) / 2.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq A_i \\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\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n1 2\n2 3\n\nSample Output 1\n\n3\n\nIf X_1 = 1 and X_2 = 2, the median is \\frac{3}{2};\n\nif X_1 = 1 and X_2 = 3, the median is 2;\n\nif X_1 = 2 and X_2 = 2, the median is 2;\n\nif X_1 = 2 and X_2 = 3, the median is \\frac{5}{2}.\n\nThus, the median can take three values: \\frac{3}{2}, 2, and \\frac{5}{2}.\n\nSample Input 2\n\n3\n100 100\n10 10000\n1 1000000000\n\nSample Output 2\n\n9991", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 410, "memory_kb": 206556}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s392226493", "group_id": "codeNet:p02665", "input_text": "const double = Float64\nconst int = Int128\n \nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n \n\nfunction main(a::Int128)\n a = a*a\n\n N = readint()[1]\n A = readint()\n \n if A[0] && N==0\n println(-1)\n return\n end\n if A[1] == 1\n if N==0\n println(1)\n return\n else\n println(-1)\n return\n end\n end\n \n sum = 1\n parent = 1\n \n pmaxs = Vector{int}(undef,N+1)\n pmaxs[1] = 1\n \n for i in 2:N+1\n nmax = parent * 2\n if A[i] > nmax \n #println(pmaxs)\n println(-1)\n return\n end\n parent = min(nmax - A[i],a)\n pmaxs[i] = parent\n end \n \n #sum = 1\n sum = 1+ A[N+1]\n ch = A[N+1]\n for i in N:-1:2\n sum += A[i] + min(pmaxs[i],ch)\n ch = A[i] + min(pmaxs[i],ch) \n end \n \n println(sum)\n \n \nend\n \na = Vector{Int128}(undef,1)\na[1] = 2^62\nmain(a[1])", "language": "Julia", "metadata": {"date": 1590895265, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s392226493.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s392226493", "user_id": "u868531879"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "const double = Float64\nconst int = Int128\n \nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n \n\nfunction main(a::Int128)\n a = a*a\n\n N = readint()[1]\n A = readint()\n \n if A[0] && N==0\n println(-1)\n return\n end\n if A[1] == 1\n if N==0\n println(1)\n return\n else\n println(-1)\n return\n end\n end\n \n sum = 1\n parent = 1\n \n pmaxs = Vector{int}(undef,N+1)\n pmaxs[1] = 1\n \n for i in 2:N+1\n nmax = parent * 2\n if A[i] > nmax \n #println(pmaxs)\n println(-1)\n return\n end\n parent = min(nmax - A[i],a)\n pmaxs[i] = parent\n end \n \n #sum = 1\n sum = 1+ A[N+1]\n ch = A[N+1]\n for i in N:-1:2\n sum += A[i] + min(pmaxs[i],ch)\n ch = A[i] + min(pmaxs[i],ch) \n end \n \n println(sum)\n \n \nend\n \na = Vector{Int128}(undef,1)\na[1] = 2^62\nmain(a[1])", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1543, "memory_kb": 315132}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s733855434", "group_id": "codeNet:p02665", "input_text": "const double = Float64\nconst int = Int64\n \nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n \nfunction main()\n N = readint()[1]\n A = readint()\n \n if A[1] == 1\n if N==0\n println(1)\n return\n else\n println(-1)\n return\n end\n end\n \n sum = 1\n parent = 1\n \n pmaxs = Vector{int}(undef,N+1)\n pmaxs[1] = 1\n \n for i in 2:N+1\n nmax = parent * 2\n if A[i] > nmax \n #println(pmaxs)\n println(-1)\n return\n end\n parent = min(nmax - A[i], 10^17)\n pmaxs[i] = parent\n end \n \n #sum = 1\n sum = 1+ A[N+1]\n ch = A[N+1]\n for i in N:-1:2\n sum += A[i] + min(pmaxs[i],ch)\n ch = A[i] + min(pmaxs[i],ch) \n end \n \n println(sum)\n \n \nend\n \nmain()", "language": "Julia", "metadata": {"date": 1590891826, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s733855434.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s733855434", "user_id": "u868531879"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "const double = Float64\nconst int = Int64\n \nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n \nfunction main()\n N = readint()[1]\n A = readint()\n \n if A[1] == 1\n if N==0\n println(1)\n return\n else\n println(-1)\n return\n end\n end\n \n sum = 1\n parent = 1\n \n pmaxs = Vector{int}(undef,N+1)\n pmaxs[1] = 1\n \n for i in 2:N+1\n nmax = parent * 2\n if A[i] > nmax \n #println(pmaxs)\n println(-1)\n return\n end\n parent = min(nmax - A[i], 10^17)\n pmaxs[i] = parent\n end \n \n #sum = 1\n sum = 1+ A[N+1]\n ch = A[N+1]\n for i in N:-1:2\n sum += A[i] + min(pmaxs[i],ch)\n ch = A[i] + min(pmaxs[i],ch) \n end \n \n println(sum)\n \n \nend\n \nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 718, "cpu_time_ms": 271, "memory_kb": 183128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s203278019", "group_id": "codeNet:p02675", "input_text": "function solve()\n n = readline()\n if n[end] in ['2', '4', '5', '7', '9']\n \"hon\"\n elseif n[end] in ['0', '1', '6', '8']\n \"pon\"\n else\n \"bon\"\n end\nend\n\nprintln(solve())", "language": "Julia", "metadata": {"date": 1601081553, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s203278019.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s203278019", "user_id": "u503181529"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "function solve()\n n = readline()\n if n[end] in ['2', '4', '5', '7', '9']\n \"hon\"\n elseif n[end] in ['0', '1', '6', '8']\n \"pon\"\n else\n \"bon\"\n end\nend\n\nprintln(solve())", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 219, "memory_kb": 163276}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s568676720", "group_id": "codeNet:p02675", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nN = parseInt(readline())\n\nh = [2, 4, 5, 7, 9]\np = [0, 1, 6, 8]\nb = [3]\n\nn = N % 10\n\nif n in h\n println(\"hon\")\nelseif n in p\n println(\"pon\")\nelse\n println(\"bon\")\nend\n\n\n", "language": "Julia", "metadata": {"date": 1592087627, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s568676720.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s568676720", "user_id": "u879294842"}, "prompt_components": {"gold_output": "pon\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nN = parseInt(readline())\n\nh = [2, 4, 5, 7, 9]\np = [0, 1, 6, 8]\nb = [3]\n\nn = N % 10\n\nif n in h\n println(\"hon\")\nelseif n in p\n println(\"pon\")\nelse\n println(\"bon\")\nend\n\n\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 194, "memory_kb": 152952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s323104399", "group_id": "codeNet:p02676", "input_text": "K = parse(Int64, readline())\nS = readline()\n\nif K >= length(S)\n println(S)\nelse\n println(S[1:K] * \"...\")\nend\n", "language": "Julia", "metadata": {"date": 1589921619, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s323104399.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s323104399", "user_id": "u273355214"}, "prompt_components": {"gold_output": "nikoand...\n", "input_to_evaluate": "K = parse(Int64, readline())\nS = readline()\n\nif K >= length(S)\n println(S)\nelse\n println(S[1:K] * \"...\")\nend\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 182, "memory_kb": 151764}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s583101724", "group_id": "codeNet:p02677", "input_text": "a,b,c,d=map(x->parse(Int,x),split(readline()))\nprintln((a^2+b^2-2a*cosd(30c-5.5d)b)^.5)", "language": "Julia", "metadata": {"date": 1589929178, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s583101724.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s583101724", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "a,b,c,d=map(x->parse(Int,x),split(readline()))\nprintln((a^2+b^2-2a*cosd(30c-5.5d)b)^.5)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 87, "cpu_time_ms": 589, "memory_kb": 202060}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s787366696", "group_id": "codeNet:p02677", "input_text": "a,b,h,m=parse.(BigFloat,split(readline()))\nd=2*π*abs((h+m/60)/12-m/60)\nprint(sqrt(a^2+b^2-2*a*b*cos(d)))", "language": "Julia", "metadata": {"date": 1589812916, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s787366696.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s787366696", "user_id": "u443151804"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "a,b,h,m=parse.(BigFloat,split(readline()))\nd=2*π*abs((h+m/60)/12-m/60)\nprint(sqrt(a^2+b^2-2*a*b*cos(d)))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 709, "memory_kb": 215112}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s652706451", "group_id": "codeNet:p02677", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\ta,b,h,m = readline() |> split |> parseMap\n\ths = h/6+m/360\n\tms = m/30\n\tprintln(sqrt((a*cos(hs*pi)-b*cos(ms*pi))^2+(a*sin(hs*pi)-b*sin(ms*pi))^2))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1589775420, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s652706451.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s652706451", "user_id": "u095714878"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\ta,b,h,m = readline() |> split |> parseMap\n\ths = h/6+m/360\n\tms = m/30\n\tprintln(sqrt((a*cos(hs*pi)-b*cos(ms*pi))^2+(a*sin(hs*pi)-b*sin(ms*pi))^2))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 257, "cpu_time_ms": 609, "memory_kb": 209360}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s779755535", "group_id": "codeNet:p02677", "input_text": "function main()\n a, b, h, m = parse.(Int, split(readline()))\n\n t = 60*60*h + 60*m\n ta = t*2*pi/43200\n tb = m*2*pi/60\n theta = abs(ta-tb)\n ans = a^2 + b^2 - 2*a*b*cos(theta)\n ans = sqrt(ans)\n println(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1589764968, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s779755535.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s779755535", "user_id": "u624923345"}, "prompt_components": {"gold_output": "5.00000000000000000000\n", "input_to_evaluate": "function main()\n a, b, h, m = parse.(Int, split(readline()))\n\n t = 60*60*h + 60*m\n ta = t*2*pi/43200\n tb = m*2*pi/60\n theta = abs(ta-tb)\n ans = a^2 + b^2 - 2*a*b*cos(theta)\n ans = sqrt(ans)\n println(ans)\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 606, "memory_kb": 212380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s925974384", "group_id": "codeNet:p02678", "input_text": "parseline(str) = parse.(Int, split(str))\nfunction DoubleDots()\n N, M = parseline(readline())\n graph = [Int[] for _ in 1:M]\n for ab in parseline.(readlines())\n isempty(ab) && continue\n a, b = ab\n push!(graph[a], b)\n push!(graph[b], a)\n end\n torch = zeros(Int, N)\n torch[1] = 1\n que = [1]\n while !isempty(que)\n b = popfirst!(que)\n for a in graph[b]\n torch[a]==0 && (push!(que, a); torch[a] = b)\n end\n end\n println(\"Yes\")\n for t in torch[2:end]\n println(t)\n end\nend\nDoubleDots()", "language": "Julia", "metadata": {"date": 1599509235, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s925974384.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s925974384", "user_id": "u728564399"}, "prompt_components": {"gold_output": "Yes\n1\n2\n2\n", "input_to_evaluate": "parseline(str) = parse.(Int, split(str))\nfunction DoubleDots()\n N, M = parseline(readline())\n graph = [Int[] for _ in 1:M]\n for ab in parseline.(readlines())\n isempty(ab) && continue\n a, b = ab\n push!(graph[a], b)\n push!(graph[b], a)\n end\n torch = zeros(Int, N)\n torch[1] = 1\n que = [1]\n while !isempty(que)\n b = popfirst!(que)\n for a in graph[b]\n torch[a]==0 && (push!(que, a); torch[a] = b)\n end\n end\n println(\"Yes\")\n for t in torch[2:end]\n println(t)\n end\nend\nDoubleDots()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 578, "cpu_time_ms": 1531, "memory_kb": 326016}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s324648054", "group_id": "codeNet:p02678", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n,m=pM(split(readline()))\n graph=[Int[] for i=1:n]\n for i=1:m;\n a,b=pM(split(readline()))\n push!(graph[a],b)\n push!(graph[b],a)\n end\n que=Int[1]\n mezirusi=zeros(Int,n)\n mezirusi[1]=1\n while !isempty(que)\n look=popfirst!(que)\n for next=graph[look]\n if mezirusi[next]!=0;continue;end\n mezirusi[next]=look+1\n push!(que,next)\n end\n end\n println(\"Yes\")\n for i=mezirusi[2:end];println(i-1);end\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end\n", "language": "Julia", "metadata": {"date": 1590784157, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s324648054.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s324648054", "user_id": "u443151804"}, "prompt_components": {"gold_output": "Yes\n1\n2\n2\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n,m=pM(split(readline()))\n graph=[Int[] for i=1:n]\n for i=1:m;\n a,b=pM(split(readline()))\n push!(graph[a],b)\n push!(graph[b],a)\n end\n que=Int[1]\n mezirusi=zeros(Int,n)\n mezirusi[1]=1\n while !isempty(que)\n look=popfirst!(que)\n for next=graph[look]\n if mezirusi[next]!=0;continue;end\n mezirusi[next]=look+1\n push!(que,next)\n end\n end\n println(\"Yes\")\n for i=mezirusi[2:end];println(i-1);end\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 656, "cpu_time_ms": 560, "memory_kb": 230188}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s201878479", "group_id": "codeNet:p02679", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\nconst p = 10^9+7\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int}[(0,0) for i in 1:n]\n\tfor i in 1:n\n\t\ts,t = readline() |> split |> parseMap\n\t\ta[i] = (s,t)\n\tend\n\td = Dict{Tuple{Int,Int},Int}()\n\tct = zeros(Int,n)\n\tfor i in 1:n\n\t\tv = (0,0)\n\t\tif a[i][1]!=0||a[i][2]!=0\n\t\t\tg = gcd(a[i][1],a[i][2])\n\t\t\tm = div(a[i][1]*a[i][2],abs(a[i][1]*a[i][2]))\n\t\t\tv = (m*div(abs(a[i][1]),g),div(abs(a[i][2]),g))\n\t\tend\n\t\tif haskey(d,(-m*abs(v[1]),abs(v[2])))\n\t\t\tct[i]=d[(-m*abs(v[1]),abs(v[2]))]\n\t\tend\n\t\tif haskey(d,v)\n\t\t\td[v]+=1\n\t\telse\n\t\t\td[v]=1\n\t\tend\n\tend\n\tbx = ones(Int,n+1)\n\tfor i in 2:n+1\n\t\tbx[i]=bx[i-1]*2%p\n\tend\n\tans = 1\n\tfor i in keys(d)\n\t\tif i==(0,0)\n\t\t\tans = ans*(d[i]+1)%p\n\t\telse\n\t\t\tm = div(abs(i[1]),i[1])\n\t\t\tif haskey(d,(-m*abs(i[2]),abs(i[1])))\n\t\t\t\tif i[1]>0\n\t\t\t\t\tx = d[i]\n\t\t\t\t\ty = d[(-m*abs(i[2]),abs(i[1]))]\n\t\t\t\t\tans = ans*mod(bx[x+y+1]-(bx[x+1]-1)*(bx[y+1]-1)%p,p)%p\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tans = ans*bx[d[i]+1]%p\n\t\t\tend\n\t\tend\n\tend\n\tprintln(mod(ans-1,p))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1589769606, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02679.html", "problem_id": "p02679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02679/input.txt", "sample_output_relpath": "derived/input_output/data/p02679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02679/Julia/s201878479.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s201878479", "user_id": "u095714878"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\nconst p = 10^9+7\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int}[(0,0) for i in 1:n]\n\tfor i in 1:n\n\t\ts,t = readline() |> split |> parseMap\n\t\ta[i] = (s,t)\n\tend\n\td = Dict{Tuple{Int,Int},Int}()\n\tct = zeros(Int,n)\n\tfor i in 1:n\n\t\tv = (0,0)\n\t\tif a[i][1]!=0||a[i][2]!=0\n\t\t\tg = gcd(a[i][1],a[i][2])\n\t\t\tm = div(a[i][1]*a[i][2],abs(a[i][1]*a[i][2]))\n\t\t\tv = (m*div(abs(a[i][1]),g),div(abs(a[i][2]),g))\n\t\tend\n\t\tif haskey(d,(-m*abs(v[1]),abs(v[2])))\n\t\t\tct[i]=d[(-m*abs(v[1]),abs(v[2]))]\n\t\tend\n\t\tif haskey(d,v)\n\t\t\td[v]+=1\n\t\telse\n\t\t\td[v]=1\n\t\tend\n\tend\n\tbx = ones(Int,n+1)\n\tfor i in 2:n+1\n\t\tbx[i]=bx[i-1]*2%p\n\tend\n\tans = 1\n\tfor i in keys(d)\n\t\tif i==(0,0)\n\t\t\tans = ans*(d[i]+1)%p\n\t\telse\n\t\t\tm = div(abs(i[1]),i[1])\n\t\t\tif haskey(d,(-m*abs(i[2]),abs(i[1])))\n\t\t\t\tif i[1]>0\n\t\t\t\t\tx = d[i]\n\t\t\t\t\ty = d[(-m*abs(i[2]),abs(i[1]))]\n\t\t\t\t\tans = ans*mod(bx[x+y+1]-(bx[x+1]-1)*(bx[y+1]-1)%p,p)%p\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tans = ans*bx[d[i]+1]%p\n\t\t\tend\n\t\tend\n\tend\n\tprintln(mod(ans-1,p))\nend\n\nmain()", "problem_context": "Score: 500 points\n\nProblem Statement\n\nWe have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively.\n\nWe will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms cannot be chosen at the same time.\n\nThe i-th and j-th sardines (i \\neq j) are on bad terms if and only if A_i \\cdot A_j + B_i \\cdot B_j = 0.\n\nIn how many ways can we choose the set of sardines to put into the cooler? Since the count can be enormous, print it modulo 1000000007.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n-10^{18} \\leq A_i, B_i \\leq 10^{18}\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 count modulo 1000000007.\n\nSample Input 1\n\n3\n1 2\n-1 1\n2 -1\n\nSample Output 1\n\n5\n\nThere are five ways to choose the set of sardines, as follows:\n\nThe 1-st\n\nThe 1-st and 2-nd\n\nThe 2-nd\n\nThe 2-nd and 3-rd\n\nThe 3-rd\n\nSample Input 2\n\n10\n3 2\n3 2\n-1 1\n2 -1\n-3 -9\n-8 12\n7 7\n8 1\n8 2\n8 4\n\nSample Output 2\n\n479", "sample_input": "3\n1 2\n-1 1\n2 -1\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02679", "source_text": "Score: 500 points\n\nProblem Statement\n\nWe have caught N sardines. The deliciousness and fragrantness of the i-th sardine is A_i and B_i, respectively.\n\nWe will choose one or more of these sardines and put them into a cooler. However, two sardines on bad terms cannot be chosen at the same time.\n\nThe i-th and j-th sardines (i \\neq j) are on bad terms if and only if A_i \\cdot A_j + B_i \\cdot B_j = 0.\n\nIn how many ways can we choose the set of sardines to put into the cooler? Since the count can be enormous, print it modulo 1000000007.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 2 \\times 10^5\n\n-10^{18} \\leq A_i, B_i \\leq 10^{18}\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 count modulo 1000000007.\n\nSample Input 1\n\n3\n1 2\n-1 1\n2 -1\n\nSample Output 1\n\n5\n\nThere are five ways to choose the set of sardines, as follows:\n\nThe 1-st\n\nThe 1-st and 2-nd\n\nThe 2-nd\n\nThe 2-nd and 3-rd\n\nThe 3-rd\n\nSample Input 2\n\n10\n3 2\n3 2\n-1 1\n2 -1\n-3 -9\n-8 12\n7 7\n8 1\n8 2\n8 4\n\nSample Output 2\n\n479", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1058, "cpu_time_ms": 1682, "memory_kb": 311344}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s934988311", "group_id": "codeNet:p02681", "input_text": "function main()\n s = readline()\n t = readline()\n \n char_s = Vector{Char}(s)\n char_t = Vector{Char}(t)\n \n println(char_t[1:length(t)-1] == char_s ? \"Yes\" : \"No\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1600561794, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s934988311.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s934988311", "user_id": "u906651641"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n s = readline()\n t = readline()\n \n char_s = Vector{Char}(s)\n char_t = Vector{Char}(t)\n \n println(char_t[1:length(t)-1] == char_s ? \"Yes\" : \"No\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 194, "memory_kb": 157192}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s705856507", "group_id": "codeNet:p02681", "input_text": "S=chomp(readline())\nT=chomp(readline())\nanser = (S==T[1:(end-1)] ? \"Yes\" : \"No\")\nprint(anser)", "language": "Julia", "metadata": {"date": 1589246321, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s705856507.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s705856507", "user_id": "u562051766"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "S=chomp(readline())\nT=chomp(readline())\nanser = (S==T[1:(end-1)] ? \"Yes\" : \"No\")\nprint(anser)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 170, "memory_kb": 151436}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s687786816", "group_id": "codeNet:p02682", "input_text": "function solve()\n a, b, c, k = [parse(Int, x) for x in split(readline())]\n if k <= a\n k\n elseif k <= a+b\n a\n else\n a - (k-a-b)\n end\nend\n\nprintln(solve())", "language": "Julia", "metadata": {"date": 1599608104, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s687786816.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s687786816", "user_id": "u503181529"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function solve()\n a, b, c, k = [parse(Int, x) for x in split(readline())]\n if k <= a\n k\n elseif k <= a+b\n a\n else\n a - (k-a-b)\n end\nend\n\nprintln(solve())", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 222, "memory_kb": 162236}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s228772190", "group_id": "codeNet:p02682", "input_text": "function f()\n a,b,c,k=map(x->parse(Int,x),split(readline()))\n ans=0\n for i=1:k\n if a != 0\n ans += 1\n a -= 1\n elseif b != 0\n b -= 1\n elseif c != 0\n ans -= 1\n c -= 1\n end\n end\n println(ans)\nend\nf() \n", "language": "Julia", "metadata": {"date": 1589159370, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s228772190.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s228772190", "user_id": "u741792973"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function f()\n a,b,c,k=map(x->parse(Int,x),split(readline()))\n ans=0\n for i=1:k\n if a != 0\n ans += 1\n a -= 1\n elseif b != 0\n b -= 1\n elseif c != 0\n ans -= 1\n c -= 1\n end\n end\n println(ans)\nend\nf() \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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2209, "memory_kb": 164120}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s962455907", "group_id": "codeNet:p02683", "input_text": "function main()\n n, m, x = parse.(Int, split(readline()))\n c = zeros(Int, n);\n a = zeros(Int, n, m);\n for i in 1:n\n xx = parse.(Int, split(readline()))\n c[i] = xx[1]\n a[i, :] = xx[2:end]\n end\n L = n\n comb = Vector{Int}[]\n for i = 0:2^L-1\n cc = Int[]\n str = bitstring(i)\n str[length(str)-L+1:length(str)]\n for j in length(str)-L+1:length(str)\n push!(cc, Int(str[j] - '0'))\n end\n push!(comb, cc)\n end\n\n\n money = Int[]\n ok = false\n idxs = []\n for i in eachindex(comb)\n aa = zeros(Int, m)\n mm = 0\n for j in eachindex(comb[i])\n if comb[i][j] == 1\n for k in 1:m\n aa[k] += a[j, k]\n end\n mm += c[j]\n end\n end\n if all(aa .>= x)\n push!(money, mm)\n push!(idxs, i)\n ok = true\n end\n end\n\n if ok == false\n println(-1)\n else\n println(minimum(money))\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1589162803, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s962455907.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s962455907", "user_id": "u624923345"}, "prompt_components": {"gold_output": "120\n", "input_to_evaluate": "function main()\n n, m, x = parse.(Int, split(readline()))\n c = zeros(Int, n);\n a = zeros(Int, n, m);\n for i in 1:n\n xx = parse.(Int, split(readline()))\n c[i] = xx[1]\n a[i, :] = xx[2:end]\n end\n L = n\n comb = Vector{Int}[]\n for i = 0:2^L-1\n cc = Int[]\n str = bitstring(i)\n str[length(str)-L+1:length(str)]\n for j in length(str)-L+1:length(str)\n push!(cc, Int(str[j] - '0'))\n end\n push!(comb, cc)\n end\n\n\n money = Int[]\n ok = false\n idxs = []\n for i in eachindex(comb)\n aa = zeros(Int, m)\n mm = 0\n for j in eachindex(comb[i])\n if comb[i][j] == 1\n for k in 1:m\n aa[k] += a[j, k]\n end\n mm += c[j]\n end\n end\n if all(aa .>= x)\n push!(money, mm)\n push!(idxs, i)\n ok = true\n end\n end\n\n if ok == false\n println(-1)\n else\n println(minimum(money))\n end\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1052, "cpu_time_ms": 503, "memory_kb": 214532}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s750054536", "group_id": "codeNet:p02683", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\nfunction moveup(x::Array{Int,1},n);k=length(x);for i in 1:k-1;if x[k-i+1]>n-1;x[k-i]+=div(x[k-i+1],n);x[k-i+1]%=n;end;end;x[1]>n-1 ? 0 : x;end\n\nfunction main()\n\tn,m,x = readline() |> split |> parseMap\n\tc = Tuple{Int,Array{Int,1}}[(0,[]) for i in 1:n]\n\tfor i in 1:n\n\t\tt =readline() |> split |> parseMap\n\t\tcx=t[1]\n\t\tb = zeros(Int,m)\n\t\tfor j in 1:m\n\t\t\tb[j]=t[j+1]\n\t\tend\n\t\tc[i]=(cx,b)\n\tend\n\tans = 10^18\n\tw = zeros(Int,n)\n\twhile w!=0\n\t\tsx=zeros(Int,m)\n\t\tct=0\n\t\tfor i in 1:n\n\t\t\tif w[i]==1\n\t\t\t\tct+=c[i][1]\n\t\t\t\tfor j in 1:m\n\t\t\t\t\tsx[j]+=c[i][2][j]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tf = 0\n\t\tfor i in 1:m\n\t\t\tif sx[i]n-1;x[k-i]+=div(x[k-i+1],n);x[k-i+1]%=n;end;end;x[1]>n-1 ? 0 : x;end\n\nfunction main()\n\tn,m,x = readline() |> split |> parseMap\n\tc = Tuple{Int,Array{Int,1}}[(0,[]) for i in 1:n]\n\tfor i in 1:n\n\t\tt =readline() |> split |> parseMap\n\t\tcx=t[1]\n\t\tb = zeros(Int,m)\n\t\tfor j in 1:m\n\t\t\tb[j]=t[j+1]\n\t\tend\n\t\tc[i]=(cx,b)\n\tend\n\tans = 10^18\n\tw = zeros(Int,n)\n\twhile w!=0\n\t\tsx=zeros(Int,m)\n\t\tct=0\n\t\tfor i in 1:n\n\t\t\tif w[i]==1\n\t\t\t\tct+=c[i][1]\n\t\t\t\tfor j in 1:m\n\t\t\t\t\tsx[j]+=c[i][2][j]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tf = 0\n\t\tfor i in 1:m\n\t\t\tif sx[i]b[1]-b[2]\n\t\t1\n\telseif a[1]-a[2]==b[1]-b[2]\n\t\t0\n\telse\n\t\t-1\n\tend\nend\n\nfunction hpush(h::Array{Tuple{Int,Int},1},x::Tuple{Int,Int})\n\tpush!(h,x)\n\tif length(h) > 1\n\t\tl = length(h)\n\t\tk = l>>1\n\t\twhile eval(x,h[k])==1&&k>=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Tuple{Int,Int},1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif eval(z,h[2*k])>=0\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif eval(z,h[2*k])>=0&&eval(z,h[2*k+1])>=0\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = eval(h[2*k],h[2*k+1])>=0 ? 2*k : 2*k+1\n\t\t\t\t\ttmp = h[t]\n\t\t\t\t\th[t] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tx\nend\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int}[]\n\tb = Tuple{Int,Int}[]\n\tf = 0\n\tlx = 0\n\trx = 0\n\tfor i in 1:n\n\t\ts = readline() |> chomp\n\t\tl = 0\n\t\tr = 0\n\t\tfor j in 1:length(s)\n\t\t\tif s[j]=='('\n\t\t\t\tl += 1\n\t\t\telse\n\t\t\t\tif l==0\n\t\t\t\t\tr+=1\n\t\t\t\telse\n\t\t\t\t\tl-=1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif l>r\n\t\t\tpush!(a,(l,r))\n\t\telse\n\t\t\tpush!(b,(l,r))\n\t\tend\n\t\tlx+=l\n\t\trx+=r\n\tend\n\tf = 0\n\tif lx!=rx\n\t\tf = 1\n\tend\n\tlc = 0\n\ta = sort(a,by=x->(x[2],x[2]-x[1]))\n\tfor i in 1:length(a)\n\t\tif lc-a[i][2]<0\n\t\t\tf = 1\n\t\tend\n\t\tlc+=a[i][1]-a[i][2]\n\tend\n\tb = sort(b,by=x->x[2],rev=true)\n\tfor i in 1:length(b)\n\t\tif lc-b[i][2]<0\n\t\t\tf = 1\n\t\tend\n\t\tlc += b[i][1]-b[i][2]\n\tend\n\tprintln(f==0 ? \"Yes\" : \"No\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1589677463, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02686.html", "problem_id": "p02686", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02686/input.txt", "sample_output_relpath": "derived/input_output/data/p02686/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02686/Julia/s683114665.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s683114665", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\nfunction eval(a::Tuple{Int,Int},b::Tuple{Int,Int})\n\tif a[1]-a[2]>b[1]-b[2]\n\t\t1\n\telseif a[1]-a[2]==b[1]-b[2]\n\t\t0\n\telse\n\t\t-1\n\tend\nend\n\nfunction hpush(h::Array{Tuple{Int,Int},1},x::Tuple{Int,Int})\n\tpush!(h,x)\n\tif length(h) > 1\n\t\tl = length(h)\n\t\tk = l>>1\n\t\twhile eval(x,h[k])==1&&k>=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Tuple{Int,Int},1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif eval(z,h[2*k])>=0\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif eval(z,h[2*k])>=0&&eval(z,h[2*k+1])>=0\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = eval(h[2*k],h[2*k+1])>=0 ? 2*k : 2*k+1\n\t\t\t\t\ttmp = h[t]\n\t\t\t\t\th[t] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tx\nend\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int}[]\n\tb = Tuple{Int,Int}[]\n\tf = 0\n\tlx = 0\n\trx = 0\n\tfor i in 1:n\n\t\ts = readline() |> chomp\n\t\tl = 0\n\t\tr = 0\n\t\tfor j in 1:length(s)\n\t\t\tif s[j]=='('\n\t\t\t\tl += 1\n\t\t\telse\n\t\t\t\tif l==0\n\t\t\t\t\tr+=1\n\t\t\t\telse\n\t\t\t\t\tl-=1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tif l>r\n\t\t\tpush!(a,(l,r))\n\t\telse\n\t\t\tpush!(b,(l,r))\n\t\tend\n\t\tlx+=l\n\t\trx+=r\n\tend\n\tf = 0\n\tif lx!=rx\n\t\tf = 1\n\tend\n\tlc = 0\n\ta = sort(a,by=x->(x[2],x[2]-x[1]))\n\tfor i in 1:length(a)\n\t\tif lc-a[i][2]<0\n\t\t\tf = 1\n\t\tend\n\t\tlc+=a[i][1]-a[i][2]\n\tend\n\tb = sort(b,by=x->x[2],rev=true)\n\tfor i in 1:length(b)\n\t\tif lc-b[i][2]<0\n\t\t\tf = 1\n\t\tend\n\t\tlc += b[i][1]-b[i][2]\n\tend\n\tprintln(f==0 ? \"Yes\" : \"No\")\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nA bracket sequence is a string that is one of the following:\n\nAn empty string;\n\nThe concatenation of (, A, and ) in this order, for some bracket sequence A ;\n\nThe concatenation of A and B in this order, for some non-empty bracket sequences A and B /\n\nGiven are N strings S_i. Can a bracket sequence be formed by concatenating all the N strings in some order?\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nThe total length of the strings S_i is at most 10^6.\n\nS_i is a non-empty string consisting of ( and ).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nIf a bracket sequence can be formed by concatenating all the N strings in some order, print Yes; otherwise, print No.\n\nSample Input 1\n\n2\n)\n(()\n\nSample Output 1\n\nYes\n\nConcatenating (() and ) in this order forms a bracket sequence.\n\nSample Input 2\n\n2\n)(\n()\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n4\n((()))\n((((((\n))))))\n()()()\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n3\n(((\n)\n)\n\nSample Output 4\n\nNo", "sample_input": "2\n)\n(()\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02686", "source_text": "Score : 600 points\n\nProblem Statement\n\nA bracket sequence is a string that is one of the following:\n\nAn empty string;\n\nThe concatenation of (, A, and ) in this order, for some bracket sequence A ;\n\nThe concatenation of A and B in this order, for some non-empty bracket sequences A and B /\n\nGiven are N strings S_i. Can a bracket sequence be formed by concatenating all the N strings in some order?\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nThe total length of the strings S_i is at most 10^6.\n\nS_i is a non-empty string consisting of ( and ).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nIf a bracket sequence can be formed by concatenating all the N strings in some order, print Yes; otherwise, print No.\n\nSample Input 1\n\n2\n)\n(()\n\nSample Output 1\n\nYes\n\nConcatenating (() and ) in this order forms a bracket sequence.\n\nSample Input 2\n\n2\n)(\n()\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n4\n((()))\n((((((\n))))))\n()()()\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n3\n(((\n)\n)\n\nSample Output 4\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 477, "memory_kb": 251316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s612668597", "group_id": "codeNet:p02686", "input_text": "const double = Float64\nconst int = Int64\nconst vint = Vector{int}\nconst vdouble = Vector{double}\n\nint(x) = parse(int,x)\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n\n L=0 # )\n R=0 # (((\n\n sL=Array{int,2}(undef,N,2) # )))(\n sR=Array{int,2}(undef,N,2)\n nL=0 ; nR =0\n\n TL = 0\n TR = 0\n\n # input とまえしょり\n for i in 1:N\n s = readline()\n l = 0\n r = 0\n for j in 1:length(s)\n if s[j]=='('\n r += 1\n else\n if r > 0\n r -= 1\n else\n l +=1\n end\n end\n end\n TL += l\n TR += r\n\n if l == 0\n R += r\n elseif r == 0\n L += l\n elseif l > r\n if r < L\n L += l-r\n else\n nL += 1\n sL[nL,1] = l\n sL[nL,2] = r\n end\n else\n if l < R\n R += r-l\n else\n nR += 1\n sR[nR,1] =l \n sR[nR,2] =r\n end\n\n end\n end\n if TL != TR \n println(\"No\")\n return \n end\n\n sL[1:nL,:] = sL[sortperm(sL[1:nL,2]),:]\n sR[1:nR,:] = sR[sortperm(sR[1:nR,1]),:]\n\n flag = true\n for i in 1:nL \n if L >= sL[i,2]\n L += sL[i,1]-sL[i,2]\n else\n frag = false\n break\n end\n end\n for i in 1:nR\n if flag && R >= sR[i,1]\n R += sR[i,2] - sR[i-1]\n else\n flag = false\n break\n end\n end\n if flag \n println(\"Yes\")\n else\n println(\"No\")\n end\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1589182736, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02686.html", "problem_id": "p02686", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02686/input.txt", "sample_output_relpath": "derived/input_output/data/p02686/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02686/Julia/s612668597.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s612668597", "user_id": "u868531879"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "const double = Float64\nconst int = Int64\nconst vint = Vector{int}\nconst vdouble = Vector{double}\n\nint(x) = parse(int,x)\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n N = readint()[1]\n\n L=0 # )\n R=0 # (((\n\n sL=Array{int,2}(undef,N,2) # )))(\n sR=Array{int,2}(undef,N,2)\n nL=0 ; nR =0\n\n TL = 0\n TR = 0\n\n # input とまえしょり\n for i in 1:N\n s = readline()\n l = 0\n r = 0\n for j in 1:length(s)\n if s[j]=='('\n r += 1\n else\n if r > 0\n r -= 1\n else\n l +=1\n end\n end\n end\n TL += l\n TR += r\n\n if l == 0\n R += r\n elseif r == 0\n L += l\n elseif l > r\n if r < L\n L += l-r\n else\n nL += 1\n sL[nL,1] = l\n sL[nL,2] = r\n end\n else\n if l < R\n R += r-l\n else\n nR += 1\n sR[nR,1] =l \n sR[nR,2] =r\n end\n\n end\n end\n if TL != TR \n println(\"No\")\n return \n end\n\n sL[1:nL,:] = sL[sortperm(sL[1:nL,2]),:]\n sR[1:nR,:] = sR[sortperm(sR[1:nR,1]),:]\n\n flag = true\n for i in 1:nL \n if L >= sL[i,2]\n L += sL[i,1]-sL[i,2]\n else\n frag = false\n break\n end\n end\n for i in 1:nR\n if flag && R >= sR[i,1]\n R += sR[i,2] - sR[i-1]\n else\n flag = false\n break\n end\n end\n if flag \n println(\"Yes\")\n else\n println(\"No\")\n end\n\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nA bracket sequence is a string that is one of the following:\n\nAn empty string;\n\nThe concatenation of (, A, and ) in this order, for some bracket sequence A ;\n\nThe concatenation of A and B in this order, for some non-empty bracket sequences A and B /\n\nGiven are N strings S_i. Can a bracket sequence be formed by concatenating all the N strings in some order?\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nThe total length of the strings S_i is at most 10^6.\n\nS_i is a non-empty string consisting of ( and ).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nIf a bracket sequence can be formed by concatenating all the N strings in some order, print Yes; otherwise, print No.\n\nSample Input 1\n\n2\n)\n(()\n\nSample Output 1\n\nYes\n\nConcatenating (() and ) in this order forms a bracket sequence.\n\nSample Input 2\n\n2\n)(\n()\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n4\n((()))\n((((((\n))))))\n()()()\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n3\n(((\n)\n)\n\nSample Output 4\n\nNo", "sample_input": "2\n)\n(()\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02686", "source_text": "Score : 600 points\n\nProblem Statement\n\nA bracket sequence is a string that is one of the following:\n\nAn empty string;\n\nThe concatenation of (, A, and ) in this order, for some bracket sequence A ;\n\nThe concatenation of A and B in this order, for some non-empty bracket sequences A and B /\n\nGiven are N strings S_i. Can a bracket sequence be formed by concatenating all the N strings in some order?\n\nConstraints\n\n1 \\leq N \\leq 10^6\n\nThe total length of the strings S_i is at most 10^6.\n\nS_i is a non-empty string consisting of ( and ).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1\n:\nS_N\n\nOutput\n\nIf a bracket sequence can be formed by concatenating all the N strings in some order, print Yes; otherwise, print No.\n\nSample Input 1\n\n2\n)\n(()\n\nSample Output 1\n\nYes\n\nConcatenating (() and ) in this order forms a bracket sequence.\n\nSample Input 2\n\n2\n)(\n()\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n4\n((()))\n((((((\n))))))\n()()()\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n3\n(((\n)\n)\n\nSample Output 4\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1413, "cpu_time_ms": 2199, "memory_kb": 318228}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s183681111", "group_id": "codeNet:p02687", "input_text": "function main()\n println(readline() == \"ABC\" ? \"ARC\" : \"ABC\")\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1588632073, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s183681111.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s183681111", "user_id": "u481214353"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "function main()\n println(readline() == \"ABC\" ? \"ARC\" : \"ABC\")\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 74, "cpu_time_ms": 188, "memory_kb": 151492}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s831841675", "group_id": "codeNet:p02687", "input_text": "readline() == \"ABC\" ? println(\"ARC\") : println(\"ABC\")", "language": "Julia", "metadata": {"date": 1588554152, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s831841675.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s831841675", "user_id": "u261246129"}, "prompt_components": {"gold_output": "ARC\n", "input_to_evaluate": "readline() == \"ABC\" ? println(\"ARC\") : println(\"ABC\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 53, "cpu_time_ms": 158, "memory_kb": 151596}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s478274912", "group_id": "codeNet:p02688", "input_text": "function main()\n n,k = parse.(Int,split(readline()))\n\n n_arr = zeros(n)\n\n for i in 1:k\n d = readline()\n for n_i in parse.(Int,split(readline()))\n n_arr[n_i] += 1\n end\n end\n println(length(filter(iszero, n_arr)))\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1588626827, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s478274912.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s478274912", "user_id": "u257668305"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n n,k = parse.(Int,split(readline()))\n\n n_arr = zeros(n)\n\n for i in 1:k\n d = readline()\n for n_i in parse.(Int,split(readline()))\n n_arr[n_i] += 1\n end\n end\n println(length(filter(iszero, n_arr)))\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 272, "memory_kb": 176484}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s831128832", "group_id": "codeNet:p02689", "input_text": "parseinput() = map(x -> parse(Int, x), split(readline()))\n\nfunction remove!(a, item)\n deleteat!(a, findall(x->x==item, a))\nend\n\nfunction main()\n n, m = parseinput()\n hs = parseinput()\n cand = [i for i = 1:n]\n for i = 1:m\n a, b = parseinput()\n if in(b, cand) && hs[a] >= hs[b]\n remove!(cand, b)\n elseif in(a, cand) && hs[a] <= hs[b]\n remove!(cand, a)\n end\n end\n println(length(cand))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1588556652, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s831128832.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s831128832", "user_id": "u261246129"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseinput() = map(x -> parse(Int, x), split(readline()))\n\nfunction remove!(a, item)\n deleteat!(a, findall(x->x==item, a))\nend\n\nfunction main()\n n, m = parseinput()\n hs = parseinput()\n cand = [i for i = 1:n]\n for i = 1:m\n a, b = parseinput()\n if in(b, cand) && hs[a] >= hs[b]\n remove!(cand, b)\n elseif in(a, cand) && hs[a] <= hs[b]\n remove!(cand, a)\n end\n end\n println(length(cand))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2210, "memory_kb": 199336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s031467434", "group_id": "codeNet:p02689", "input_text": "const double = Float64\nconst int = Int64\nconst vint = Vector{int}\nconst vdouble = Vector{double}\n\nint(x) = parse(int,x)\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n n,m = readint()\n H = readint()\n G = ones(int,n)\n for i in 1:m\n a,b = readint()\n h1 = H[a]\n h2 = H[b]\n if h1 > h2\n G[b] = 0\n elseif h2 > h1\n G[a] = 0\n else\n G[a] = 0\n G[b] = 0\n end\n end\n println(sum(G))\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1588554701, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s031467434.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s031467434", "user_id": "u868531879"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "const double = Float64\nconst int = Int64\nconst vint = Vector{int}\nconst vdouble = Vector{double}\n\nint(x) = parse(int,x)\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n n,m = readint()\n H = readint()\n G = ones(int,n)\n for i in 1:m\n a,b = readint()\n h1 = H[a]\n h2 = H[b]\n if h1 > h2\n G[b] = 0\n elseif h2 > h1\n G[a] = 0\n else\n G[a] = 0\n G[b] = 0\n end\n end\n println(sum(G))\n\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 485, "cpu_time_ms": 730, "memory_kb": 242736}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s768681386", "group_id": "codeNet:p02690", "input_text": "function IHateFactorization()\n x = parse(Int, readline())\n for a=-118:119, b=-118:119\n if a^5 - b^5 == x\n return println(a, \" \", b)\n end\n end\nend\nIHateFactorization()", "language": "Julia", "metadata": {"date": 1599507894, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s768681386.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s768681386", "user_id": "u728564399"}, "prompt_components": {"gold_output": "2 -1\n", "input_to_evaluate": "function IHateFactorization()\n x = parse(Int, readline())\n for a=-118:119, b=-118:119\n if a^5 - b^5 == x\n return println(a, \" \", b)\n end\n end\nend\nIHateFactorization()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 238, "memory_kb": 160484}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s859547741", "group_id": "codeNet:p02691", "input_text": "n = parse(Int, readline())\n\nline = readline()\nheight = map(x->parse(Int, x), split(line))\n\nlet c = 0\n for j in 1:(n - 1)\n for i in (j + 1):n\n\t if (i - j) == height[i] + height[j]\n\t c = c + 1\n end\n end\n end\n println(c)\nend\n", "language": "Julia", "metadata": {"date": 1588628883, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s859547741.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s859547741", "user_id": "u075757589"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = parse(Int, readline())\n\nline = readline()\nheight = map(x->parse(Int, x), split(line))\n\nlet c = 0\n for j in 1:(n - 1)\n for i in (j + 1):n\n\t if (i - j) == height[i] + height[j]\n\t c = c + 1\n end\n end\n end\n println(c)\nend\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 266, "cpu_time_ms": 2211, "memory_kb": 215092}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s983312602", "group_id": "codeNet:p02692", "input_text": "parseInt(x) = parse(Int,x)\nfunction tie(s)#k[1]->\"A\",k[2]->\"B\",k[3]->\"C\"\n if s == \"A\"\n return 1\n end\n if s == \"B\"\n return 2\n end\n if s == \"C\"\n return 3\n end\nend\n\nfunction check(s1,s2)\n d=Dict()\n d[s1]=1\n d[s2]=2\n if !haskey(d,\"A\")\n return \"A\"\n end\n if !haskey(d,\"B\")\n return \"B\"\n end\n if !haskey(d,\"C\")\n return \"C\"\n end\nend\n\nfunction cmp(s1,s2,s1_2,s2_2)\n d=Dict()\n d[s1]=1\n d[s2]=1\n if haskey(d,s1_2) && haskey(d,s2_2)\n return true\n else\n return false\n end\nend\n\nfunction f()\n k=zeros(Int,3)#k[1]=a,k[2]=b,k[3]=c\n n,k[1],k[2],k[3]=map(x->parseInt(x),split(readline()))\n s=Matrix{SubString{String}}(undef,n,2)\n q=Vector{SubString{String}}(undef,n)\n for i=1:n\n s[i,1],s[i,2]=split.(readline(),\"\")\n end\n for i=1:n\n if k[1]+k[2]+k[3] == 0 #a+b+c=0\n print(\"No\")\n exit()\n end\n if k[tie(s[i,1])] == k[tie(s[i,2])] == 0 #両方0\n print(\"No\")\n exit()\n end\n if k[tie(s[i,1])] == 0 #片方0-left\n q[i]=s[i,1]\n k[tie(s[i,1])] += 1\n k[tie(s[i,2])] -= 1\n elseif k[tie(s[i,2])] == 0 #片方0-right\n q[i]=s[i,2]\n k[tie(s[i,1])] -= 1\n k[tie(s[i,2])] += 1\n #両方1以上\n elseif k[1]+k[2]+k[3] == 2 && k[tie(s[i,1])] == k[tie(s[i,2])] == 1 && cmp(s[i,1],s[i,2],s[i+1,1],s[i+1,2])\n if i != n\n if s[i,1] != check(s[i+1,1],s[i+1,2])\n q[i]=s[i,1]\n k[tie(s[i,1])] += 1\n k[tie(s[i,2])] -= 1\n else\n q[i]=s[i,2]\n k[tie(s[i,1])] -= 1\n k[tie(s[i,2])] += 1\n end\n end\n else\n q[i]=s[i,1]\n k[tie(s[i,1])] += 1\n k[tie(s[i,2])] -= 1\n end \n end\n println(\"Yes\")\n for i=1:n\n println(q[i])\n end\nend \nf()\n \n \n", "language": "Julia", "metadata": {"date": 1588791576, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02692.html", "problem_id": "p02692", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02692/input.txt", "sample_output_relpath": "derived/input_output/data/p02692/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02692/Julia/s983312602.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s983312602", "user_id": "u741792973"}, "prompt_components": {"gold_output": "Yes\nA\nC\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nfunction tie(s)#k[1]->\"A\",k[2]->\"B\",k[3]->\"C\"\n if s == \"A\"\n return 1\n end\n if s == \"B\"\n return 2\n end\n if s == \"C\"\n return 3\n end\nend\n\nfunction check(s1,s2)\n d=Dict()\n d[s1]=1\n d[s2]=2\n if !haskey(d,\"A\")\n return \"A\"\n end\n if !haskey(d,\"B\")\n return \"B\"\n end\n if !haskey(d,\"C\")\n return \"C\"\n end\nend\n\nfunction cmp(s1,s2,s1_2,s2_2)\n d=Dict()\n d[s1]=1\n d[s2]=1\n if haskey(d,s1_2) && haskey(d,s2_2)\n return true\n else\n return false\n end\nend\n\nfunction f()\n k=zeros(Int,3)#k[1]=a,k[2]=b,k[3]=c\n n,k[1],k[2],k[3]=map(x->parseInt(x),split(readline()))\n s=Matrix{SubString{String}}(undef,n,2)\n q=Vector{SubString{String}}(undef,n)\n for i=1:n\n s[i,1],s[i,2]=split.(readline(),\"\")\n end\n for i=1:n\n if k[1]+k[2]+k[3] == 0 #a+b+c=0\n print(\"No\")\n exit()\n end\n if k[tie(s[i,1])] == k[tie(s[i,2])] == 0 #両方0\n print(\"No\")\n exit()\n end\n if k[tie(s[i,1])] == 0 #片方0-left\n q[i]=s[i,1]\n k[tie(s[i,1])] += 1\n k[tie(s[i,2])] -= 1\n elseif k[tie(s[i,2])] == 0 #片方0-right\n q[i]=s[i,2]\n k[tie(s[i,1])] -= 1\n k[tie(s[i,2])] += 1\n #両方1以上\n elseif k[1]+k[2]+k[3] == 2 && k[tie(s[i,1])] == k[tie(s[i,2])] == 1 && cmp(s[i,1],s[i,2],s[i+1,1],s[i+1,2])\n if i != n\n if s[i,1] != check(s[i+1,1],s[i+1,2])\n q[i]=s[i,1]\n k[tie(s[i,1])] += 1\n k[tie(s[i,2])] -= 1\n else\n q[i]=s[i,2]\n k[tie(s[i,1])] -= 1\n k[tie(s[i,2])] += 1\n end\n end\n else\n q[i]=s[i,1]\n k[tie(s[i,1])] += 1\n k[tie(s[i,2])] -= 1\n end \n end\n println(\"Yes\")\n for i=1:n\n println(q[i])\n end\nend \nf()\n \n \n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere is a game that involves three variables, denoted A, B, and C.\n\nAs the game progresses, there will be N events where you are asked to make a choice.\nEach of these choices is represented by a string s_i. If s_i is AB, you must add 1 to A or B then subtract 1 from the other; if s_i is AC, you must add 1 to A or C then subtract 1 from the other; if s_i is BC, you must add 1 to B or C then subtract 1 from the other.\n\nAfter each choice, none of A, B, and C should be negative.\n\nDetermine whether it is possible to make N choices under this condition. If it is possible, also give one such way to make the choices.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq A,B,C \\leq 10^9\n\nN, A, B, C are integers.\n\ns_i is AB, AC, or BC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\ns_1\ns_2\n:\ns_N\n\nOutput\n\nIf it is possible to make N choices under the condition, print Yes; otherwise, print No.\n\nAlso, in the former case, show one such way to make the choices in the subsequent N lines. The (i+1)-th line should contain the name of the variable (A, B, or C) to which you add 1 in the i-th choice.\n\nSample Input 1\n\n2 1 3 0\nAB\nAC\n\nSample Output 1\n\nYes\nA\nC\n\nYou can successfully make two choices, as follows:\n\nIn the first choice, add 1 to A and subtract 1 from B. A becomes 2, and B becomes 2.\n\nIn the second choice, add 1 to C and subtract 1 from A. C becomes 1, and A becomes 1.\n\nSample Input 2\n\n3 1 0 0\nAB\nBC\nAB\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1 0 9 0\nAC\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n8 6 9 1\nAC\nBC\nAB\nBC\nAC\nBC\nAB\nAB\n\nSample Output 4\n\nYes\nC\nB\nB\nC\nC\nB\nA\nA", "sample_input": "2 1 3 0\nAB\nAC\n"}, "reference_outputs": ["Yes\nA\nC\n"], "source_document_id": "p02692", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere is a game that involves three variables, denoted A, B, and C.\n\nAs the game progresses, there will be N events where you are asked to make a choice.\nEach of these choices is represented by a string s_i. If s_i is AB, you must add 1 to A or B then subtract 1 from the other; if s_i is AC, you must add 1 to A or C then subtract 1 from the other; if s_i is BC, you must add 1 to B or C then subtract 1 from the other.\n\nAfter each choice, none of A, B, and C should be negative.\n\nDetermine whether it is possible to make N choices under this condition. If it is possible, also give one such way to make the choices.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq A,B,C \\leq 10^9\n\nN, A, B, C are integers.\n\ns_i is AB, AC, or BC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\ns_1\ns_2\n:\ns_N\n\nOutput\n\nIf it is possible to make N choices under the condition, print Yes; otherwise, print No.\n\nAlso, in the former case, show one such way to make the choices in the subsequent N lines. The (i+1)-th line should contain the name of the variable (A, B, or C) to which you add 1 in the i-th choice.\n\nSample Input 1\n\n2 1 3 0\nAB\nAC\n\nSample Output 1\n\nYes\nA\nC\n\nYou can successfully make two choices, as follows:\n\nIn the first choice, add 1 to A and subtract 1 from B. A becomes 2, and B becomes 2.\n\nIn the second choice, add 1 to C and subtract 1 from A. C becomes 1, and A becomes 1.\n\nSample Input 2\n\n3 1 0 0\nAB\nBC\nAB\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1 0 9 0\nAC\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n8 6 9 1\nAC\nBC\nAB\nBC\nAC\nBC\nAB\nAB\n\nSample Output 4\n\nYes\nC\nB\nB\nC\nC\nB\nA\nA", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2050, "cpu_time_ms": 568, "memory_kb": 260152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s512095833", "group_id": "codeNet:p02692", "input_text": "const teststr = \n\"\"\"\n8 6 9 1\nAC\nBC\nAB\nBC\nAC\nBC\nAB\nAB\n\"\"\"\n\nfunction lines()\n Channel{String}(32) do ch\n ll = readlines()\n lines = isempty(ll) ? split(teststr, \"\\n\") : ll\n for s in lines\n put!(ch, s)\n end\n end\nend\n\nfunction main()\n ch = lines()\n N,A,B,C = parse.(Int, split(take!(ch)))\n c = zeros(Int, 3, N)\n strs=String[]\n for i in 1:N\n str = take!(ch)\n push!(strs, str)\n @views c[:,i] = str==\"AB\" ? [1,-1,0] :\n str==\"AC\" ? [1,0,-1] :\n [0,1,-1]\n end\n ss = ones(Int, N)\n hs = zeros(Int, 3, N)\n @views hs[:,1] .= [A,B,C]\n que = [(1,-1), (1,1)]\n while !isempty(que)\n n, s = pop!(que)\n abc = s>0 ? @views(hs[:,n] .+ c[:,n]) : @views(hs[:,n] .- c[:,n])\n any(abc .< 0) && continue\n ss[n] = s\n if n == N\n println(\"Yes\")\n for i in 1:N\n println(strs[i][ss[i]==1 ? 1 : 2])\n end\n exit(0)\n end\n @views hs[:,n+1] .= abc\n\tpush!(que, (n+1,-1), (n+1,1))\n end\n println(\"No\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1588622964, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02692.html", "problem_id": "p02692", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02692/input.txt", "sample_output_relpath": "derived/input_output/data/p02692/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02692/Julia/s512095833.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s512095833", "user_id": "u481214353"}, "prompt_components": {"gold_output": "Yes\nA\nC\n", "input_to_evaluate": "const teststr = \n\"\"\"\n8 6 9 1\nAC\nBC\nAB\nBC\nAC\nBC\nAB\nAB\n\"\"\"\n\nfunction lines()\n Channel{String}(32) do ch\n ll = readlines()\n lines = isempty(ll) ? split(teststr, \"\\n\") : ll\n for s in lines\n put!(ch, s)\n end\n end\nend\n\nfunction main()\n ch = lines()\n N,A,B,C = parse.(Int, split(take!(ch)))\n c = zeros(Int, 3, N)\n strs=String[]\n for i in 1:N\n str = take!(ch)\n push!(strs, str)\n @views c[:,i] = str==\"AB\" ? [1,-1,0] :\n str==\"AC\" ? [1,0,-1] :\n [0,1,-1]\n end\n ss = ones(Int, N)\n hs = zeros(Int, 3, N)\n @views hs[:,1] .= [A,B,C]\n que = [(1,-1), (1,1)]\n while !isempty(que)\n n, s = pop!(que)\n abc = s>0 ? @views(hs[:,n] .+ c[:,n]) : @views(hs[:,n] .- c[:,n])\n any(abc .< 0) && continue\n ss[n] = s\n if n == N\n println(\"Yes\")\n for i in 1:N\n println(strs[i][ss[i]==1 ? 1 : 2])\n end\n exit(0)\n end\n @views hs[:,n+1] .= abc\n\tpush!(que, (n+1,-1), (n+1,1))\n end\n println(\"No\")\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere is a game that involves three variables, denoted A, B, and C.\n\nAs the game progresses, there will be N events where you are asked to make a choice.\nEach of these choices is represented by a string s_i. If s_i is AB, you must add 1 to A or B then subtract 1 from the other; if s_i is AC, you must add 1 to A or C then subtract 1 from the other; if s_i is BC, you must add 1 to B or C then subtract 1 from the other.\n\nAfter each choice, none of A, B, and C should be negative.\n\nDetermine whether it is possible to make N choices under this condition. If it is possible, also give one such way to make the choices.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq A,B,C \\leq 10^9\n\nN, A, B, C are integers.\n\ns_i is AB, AC, or BC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\ns_1\ns_2\n:\ns_N\n\nOutput\n\nIf it is possible to make N choices under the condition, print Yes; otherwise, print No.\n\nAlso, in the former case, show one such way to make the choices in the subsequent N lines. The (i+1)-th line should contain the name of the variable (A, B, or C) to which you add 1 in the i-th choice.\n\nSample Input 1\n\n2 1 3 0\nAB\nAC\n\nSample Output 1\n\nYes\nA\nC\n\nYou can successfully make two choices, as follows:\n\nIn the first choice, add 1 to A and subtract 1 from B. A becomes 2, and B becomes 2.\n\nIn the second choice, add 1 to C and subtract 1 from A. C becomes 1, and A becomes 1.\n\nSample Input 2\n\n3 1 0 0\nAB\nBC\nAB\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1 0 9 0\nAC\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n8 6 9 1\nAC\nBC\nAB\nBC\nAC\nBC\nAB\nAB\n\nSample Output 4\n\nYes\nC\nB\nB\nC\nC\nB\nA\nA", "sample_input": "2 1 3 0\nAB\nAC\n"}, "reference_outputs": ["Yes\nA\nC\n"], "source_document_id": "p02692", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere is a game that involves three variables, denoted A, B, and C.\n\nAs the game progresses, there will be N events where you are asked to make a choice.\nEach of these choices is represented by a string s_i. If s_i is AB, you must add 1 to A or B then subtract 1 from the other; if s_i is AC, you must add 1 to A or C then subtract 1 from the other; if s_i is BC, you must add 1 to B or C then subtract 1 from the other.\n\nAfter each choice, none of A, B, and C should be negative.\n\nDetermine whether it is possible to make N choices under this condition. If it is possible, also give one such way to make the choices.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq A,B,C \\leq 10^9\n\nN, A, B, C are integers.\n\ns_i is AB, AC, or BC.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C\ns_1\ns_2\n:\ns_N\n\nOutput\n\nIf it is possible to make N choices under the condition, print Yes; otherwise, print No.\n\nAlso, in the former case, show one such way to make the choices in the subsequent N lines. The (i+1)-th line should contain the name of the variable (A, B, or C) to which you add 1 in the i-th choice.\n\nSample Input 1\n\n2 1 3 0\nAB\nAC\n\nSample Output 1\n\nYes\nA\nC\n\nYou can successfully make two choices, as follows:\n\nIn the first choice, add 1 to A and subtract 1 from B. A becomes 2, and B becomes 2.\n\nIn the second choice, add 1 to C and subtract 1 from A. C becomes 1, and A becomes 1.\n\nSample Input 2\n\n3 1 0 0\nAB\nBC\nAB\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1 0 9 0\nAC\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n8 6 9 1\nAC\nBC\nAB\nBC\nAC\nBC\nAB\nAB\n\nSample Output 4\n\nYes\nC\nB\nB\nC\nC\nB\nA\nA", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1069, "memory_kb": 273264}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s877990167", "group_id": "codeNet:p02693", "input_text": "#!/usr/bin/env -S JULIA_VERSION=1.4.0 julia\n# contest: abc165, problem: abc165_a, alphabet: A\nconst YES = \"OK\"\nmacro Y() :( println(YES); return ) end\nconst NO = \"NG\"\nmacro N() :( println(NO); return ) end\n\nfunction solve(K::Int, A::Int, B::Int)\n for i in A:B\n i % K==0 && @Y\n end\n @N\nend\n\nfunction main()\n tokens = Channel{String}(32)\n Task() do\n for line in eachline(@static VERSION < v\"0.6\" ? STDIN : stdin)\n startswith(line, '\\0') && break\n for token in split(chomp(line))\n put!(tokens, token)\n end\n end\n close(tokens)\n end |> schedule\n K = parse(Int, take!(tokens))\n A = parse(Int, take!(tokens))\n B = parse(Int, take!(tokens))\n solve(K, A, B)\nend\n\nif isempty(get(ENV, \"ATCODER_LOCAL\", \"\"))\n isempty(ARGS) && main()\nelse\n @eval begin\n const samples = [(\"7\\n500 600\", \"OK\"), (\"4\\n5 7\", \"NG\"), (\"1\\n11 11\", \"OK\")]\n function test(sampleids...)\n isempty(sampleids) && return test(collect(1:length(samples))...)\n ostdin, ostdout = @static VERSION < v\"0.6\" ? (STDIN, STDOUT) : (stdin, stdout)\n rd, wr = first(redirect_stdout()), last(redirect_stdin())\n try\n map(sampleids) do sampleid\n input, output = samples[sampleid]\n print(ostdout, \"Testing sample #$(sampleid)...\"); flush(ostdout)\n println(wr, input)\n println(wr, \"\\0\")\n t = @elapsed main()\n println()\n result = strip(String(readavailable(rd)))\n if result == output\n println(ostdout, \"OK ($t sec).\")\n true\n else\n println(ostdout, \"ERROR ($t sec)\")\n println(ostdout, \"== expected ==\\n$output\")\n println(ostdout, \"== actual ==\\n$result\\n\")\n false\n end\n end |> all\n finally\n redirect_stdin(ostdin)\n redirect_stdout(ostdout)\n end\n end\n submit() = test() && (program=@__FILE__; run(`echo atcoder-submit $program`))\n !isinteractive() && submit()\n end\nend\n", "language": "Julia", "metadata": {"date": 1589148208, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Julia/s877990167.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s877990167", "user_id": "u481214353"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "#!/usr/bin/env -S JULIA_VERSION=1.4.0 julia\n# contest: abc165, problem: abc165_a, alphabet: A\nconst YES = \"OK\"\nmacro Y() :( println(YES); return ) end\nconst NO = \"NG\"\nmacro N() :( println(NO); return ) end\n\nfunction solve(K::Int, A::Int, B::Int)\n for i in A:B\n i % K==0 && @Y\n end\n @N\nend\n\nfunction main()\n tokens = Channel{String}(32)\n Task() do\n for line in eachline(@static VERSION < v\"0.6\" ? STDIN : stdin)\n startswith(line, '\\0') && break\n for token in split(chomp(line))\n put!(tokens, token)\n end\n end\n close(tokens)\n end |> schedule\n K = parse(Int, take!(tokens))\n A = parse(Int, take!(tokens))\n B = parse(Int, take!(tokens))\n solve(K, A, B)\nend\n\nif isempty(get(ENV, \"ATCODER_LOCAL\", \"\"))\n isempty(ARGS) && main()\nelse\n @eval begin\n const samples = [(\"7\\n500 600\", \"OK\"), (\"4\\n5 7\", \"NG\"), (\"1\\n11 11\", \"OK\")]\n function test(sampleids...)\n isempty(sampleids) && return test(collect(1:length(samples))...)\n ostdin, ostdout = @static VERSION < v\"0.6\" ? (STDIN, STDOUT) : (stdin, stdout)\n rd, wr = first(redirect_stdout()), last(redirect_stdin())\n try\n map(sampleids) do sampleid\n input, output = samples[sampleid]\n print(ostdout, \"Testing sample #$(sampleid)...\"); flush(ostdout)\n println(wr, input)\n println(wr, \"\\0\")\n t = @elapsed main()\n println()\n result = strip(String(readavailable(rd)))\n if result == output\n println(ostdout, \"OK ($t sec).\")\n true\n else\n println(ostdout, \"ERROR ($t sec)\")\n println(ostdout, \"== expected ==\\n$output\")\n println(ostdout, \"== actual ==\\n$result\\n\")\n false\n end\n end |> all\n finally\n redirect_stdin(ostdin)\n redirect_stdout(ostdout)\n end\n end\n submit() = test() && (program=@__FILE__; run(`echo atcoder-submit $program`))\n !isinteractive() && submit()\n end\nend\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1979, "cpu_time_ms": 423, "memory_kb": 179596}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s893250546", "group_id": "codeNet:p02693", "input_text": "k = parse(Int,readline())\na,b = parse.(Int,split(readline()))\n\nfor i in a:b\n if i % k == 0\n println(\"OK\")\n exit(0)\n end\nend\nprintln(\"NG\")\nexit(0)\n\n", "language": "Julia", "metadata": {"date": 1588565083, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Julia/s893250546.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s893250546", "user_id": "u257668305"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "k = parse(Int,readline())\na,b = parse.(Int,split(readline()))\n\nfor i in a:b\n if i % k == 0\n println(\"OK\")\n exit(0)\n end\nend\nprintln(\"NG\")\nexit(0)\n\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 278, "memory_kb": 170400}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s974767939", "group_id": "codeNet:p02693", "input_text": "function f(k,a,b)\n for i=a:b\n if i%k == 0\n print(\"OK\")\n exit()\n end\n end\n print(\"NG\")\nend\nk=parse(Int,readline())\na,b=map(x->parse(Int,x),split(readline()))\nf(k,a,b)\n", "language": "Julia", "metadata": {"date": 1588468584, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Julia/s974767939.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s974767939", "user_id": "u741792973"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "function f(k,a,b)\n for i=a:b\n if i%k == 0\n print(\"OK\")\n exit()\n end\n end\n print(\"NG\")\nend\nk=parse(Int,readline())\na,b=map(x->parse(Int,x),split(readline()))\nf(k,a,b)\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 220, "memory_kb": 162684}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s641822530", "group_id": "codeNet:p02693", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nfunction main()\n K = parseInt(readline())\n A,B = parseMap(split(readline()))\n if K == 1\n println(\"OK\")\n else\n if B - A >= K\n println(\"OK\")\n else \n println(\"NG\")\n end\n end\nend\n\n\nmain()", "language": "Julia", "metadata": {"date": 1588468343, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02693.html", "problem_id": "p02693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02693/input.txt", "sample_output_relpath": "derived/input_output/data/p02693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02693/Julia/s641822530.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s641822530", "user_id": "u879294842"}, "prompt_components": {"gold_output": "OK\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nfunction main()\n K = parseInt(readline())\n A,B = parseMap(split(readline()))\n if K == 1\n println(\"OK\")\n else\n if B - A >= K\n println(\"OK\")\n else \n println(\"NG\")\n end\n end\nend\n\n\nmain()", "problem_context": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "sample_input": "7\n500 600\n"}, "reference_outputs": ["OK\n"], "source_document_id": "p02693", "source_text": "Score: 100 points\n\nProblem Statement\n\nTakahashi the Jumbo will practice golf.\n\nHis objective is to get a carry distance that is a multiple of K, while he can only make a carry distance of between A and B (inclusive).\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 1000\n\n1 \\leq K \\leq 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\nA B\n\nOutput\n\nIf he can achieve the objective, print OK; if he cannot, print NG.\n\nSample Input 1\n\n7\n500 600\n\nSample Output 1\n\nOK\n\nAmong the multiples of 7, for example, 567 lies between 500 and 600.\n\nSample Input 2\n\n4\n5 7\n\nSample Output 2\n\nNG\n\nNo multiple of 4 lies between 5 and 7.\n\nSample Input 3\n\n1\n11 11\n\nSample Output 3\n\nOK", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 337, "cpu_time_ms": 219, "memory_kb": 160520}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s043510347", "group_id": "codeNet:p02694", "input_text": "function main()\n X = parse(Int, readline())\n a = 100\n i = 0\n while a < X\n a = floor(a * 1.01)\n i += 1\n end\n println(\"$i\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1588469853, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s043510347.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s043510347", "user_id": "u261246129"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main()\n X = parse(Int, readline())\n a = 100\n i = 0\n while a < X\n a = floor(a * 1.01)\n i += 1\n end\n println(\"$i\")\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 181, "memory_kb": 154852}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s926675874", "group_id": "codeNet:p02694", "input_text": "function main()\n x = parse(Int, readline())\n\n res = 0\n m = 100\n while m < x\n m = Int(floor(m * 1.01))\n res += 1\n end\n\n println(res)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1588468609, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s926675874.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s926675874", "user_id": "u624923345"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main()\n x = parse(Int, readline())\n\n res = 0\n m = 100\n while m < x\n m = Int(floor(m * 1.01))\n res += 1\n end\n\n println(res)\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 214, "memory_kb": 157672}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s566501889", "group_id": "codeNet:p02695", "input_text": "(()->begin\n n,m,q = readline() |> split |> x->parse.(Int,x)\n arr = fill([], q)\n for i in 1:q\n arr[i] = readline() |> split |> x->parse.(Int,x)\n end\n\n function dfs(n, m)\n result = []\n function dfs_walk(arr)\n if (length(arr) == n + 1)\n push!(result, arr[2:end])\n return;\n end\n push!(arr, arr[end])\n while (arr[end] <= m)\n dfs_walk(copy(arr))\n arr[end] += 1\n end\n end\n dfs_walk([1])\n return result\n end\n ans = 0\n for comb in dfs(n, m)\n tmp = 0\n for (a,b,c,d) in arr\n if comb[b] - comb[a] == c\n tmp += d\n end\n end\n ans = max(ans, tmp)\n end\n println(ans)\nend)()\n", "language": "Julia", "metadata": {"date": 1588649334, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s566501889.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s566501889", "user_id": "u257668305"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "(()->begin\n n,m,q = readline() |> split |> x->parse.(Int,x)\n arr = fill([], q)\n for i in 1:q\n arr[i] = readline() |> split |> x->parse.(Int,x)\n end\n\n function dfs(n, m)\n result = []\n function dfs_walk(arr)\n if (length(arr) == n + 1)\n push!(result, arr[2:end])\n return;\n end\n push!(arr, arr[end])\n while (arr[end] <= m)\n dfs_walk(copy(arr))\n arr[end] += 1\n end\n end\n dfs_walk([1])\n return result\n end\n ans = 0\n for comb in dfs(n, m)\n tmp = 0\n for (a,b,c,d) in arr\n if comb[b] - comb[a] == c\n tmp += d\n end\n end\n ans = max(ans, tmp)\n end\n println(ans)\nend)()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 667, "cpu_time_ms": 679, "memory_kb": 231108}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s181055325", "group_id": "codeNet:p02696", "input_text": "function main()\n a, b, n = parse.(UInt128, split(readline())) \n before = f(one(UInt128), a, b)\n hist = UInt128[before]\n local res\n for x in 2:n\n y = f(UInt128(x), a, b)\n @show y\n push!(hist, y)\n if before == y\n break\n end\n end\n println(UInt128(maximum(hist)))\nend\n\nf(x,a,b)::UInt128 = floor(a*x/b) - a*floor(x/b)\n\nmain()\n", "language": "Julia", "metadata": {"date": 1588473906, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s181055325.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s181055325", "user_id": "u624923345"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n a, b, n = parse.(UInt128, split(readline())) \n before = f(one(UInt128), a, b)\n hist = UInt128[before]\n local res\n for x in 2:n\n y = f(UInt128(x), a, b)\n @show y\n push!(hist, y)\n if before == y\n break\n end\n end\n println(UInt128(maximum(hist)))\nend\n\nf(x,a,b)::UInt128 = floor(a*x/b) - a*floor(x/b)\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 499, "memory_kb": 213472}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s970497873", "group_id": "codeNet:p02696", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nfunction f(A,B,x)\n return div(A * x , B) - A * (div(x , B))\nend\n\nfunction main()\n A,B,N = parseMap(split(readline()))\n ans = -1\n iter = min(B,N)\n for i in 1:iter\n if f(A,B,i) > ans\n ans = f(A,B,i)\n println(i)\n end \n end\n return ans\nend\n\n\nprintln(main())\n", "language": "Julia", "metadata": {"date": 1588473621, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s970497873.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s970497873", "user_id": "u879294842"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nfunction f(A,B,x)\n return div(A * x , B) - A * (div(x , B))\nend\n\nfunction main()\n A,B,N = parseMap(split(readline()))\n ans = -1\n iter = min(B,N)\n for i in 1:iter\n if f(A,B,i) > ans\n ans = f(A,B,i)\n println(i)\n end \n end\n return ans\nend\n\n\nprintln(main())\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 407, "cpu_time_ms": 2211, "memory_kb": 165736}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s069354073", "group_id": "codeNet:p02696", "input_text": "import Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\n\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n if !isdelim(c, delims)\n break\n end\n end\n push!(out, c)\n if eof(s)\n return out\n end\n while !eof(s)\n c = read(s, UInt8)\n if isdelim(c, delims)\n break\n end\n push!(out, c)\n end\n return out\nend\n\ndelimset = Set([0x0a, 0x20])\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nreadvec(tys::Tuple , len::Signed)::Vector{Tuple{tys...}} = @inbounds Tuple{tys...}[reads(tys...) for i in 1:len]\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i = 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nval(a,b,x) = floor(a*x/b) - a * floor(x/b)\n\nfunction main()\n A,B,N = reads(Int,Int,Int)\n if N == 1\n println(1)\n return\n end\n fi = 1\n fv = val(A,B,fi)\n ei = N\n ev = val(A,B,ei)\n ci = (fi+ei)÷2\n cv = val(A,B,ci)\n while true\n if fv < cv\n fi = ci\n fv = cv\n else\n ei = ci\n ev = cv\n end\n ev = val(A,B,ei)\n ci = (fi+ei)÷2\n cv = val(A,B,ci)\n if ci+1 == ei\n println(Int(max(fv,cv,ev)))\n break\n end\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1588470210, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s069354073.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s069354073", "user_id": "u729767359"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "import Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\n\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n if !isdelim(c, delims)\n break\n end\n end\n push!(out, c)\n if eof(s)\n return out\n end\n while !eof(s)\n c = read(s, UInt8)\n if isdelim(c, delims)\n break\n end\n push!(out, c)\n end\n return out\nend\n\ndelimset = Set([0x0a, 0x20])\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nreadvec(tys::Tuple , len::Signed)::Vector{Tuple{tys...}} = @inbounds Tuple{tys...}[reads(tys...) for i in 1:len]\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i = 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nval(a,b,x) = floor(a*x/b) - a * floor(x/b)\n\nfunction main()\n A,B,N = reads(Int,Int,Int)\n if N == 1\n println(1)\n return\n end\n fi = 1\n fv = val(A,B,fi)\n ei = N\n ev = val(A,B,ei)\n ci = (fi+ei)÷2\n cv = val(A,B,ci)\n while true\n if fv < cv\n fi = ci\n fv = cv\n else\n ei = ci\n ev = cv\n end\n ev = val(A,B,ei)\n ci = (fi+ei)÷2\n cv = val(A,B,ci)\n if ci+1 == ei\n println(Int(max(fv,cv,ev)))\n break\n end\n end\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1969, "cpu_time_ms": 407, "memory_kb": 194536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s704426372", "group_id": "codeNet:p02697", "input_text": "import Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\n\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n if !isdelim(c, delims)\n break\n end\n end\n push!(out, c)\n if eof(s)\n return out\n end\n while !eof(s)\n c = read(s, UInt8)\n if isdelim(c, delims)\n break\n end\n push!(out, c)\n end\n return out\nend\n\ndelimset = Set([0x0a, 0x20])\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nreadvec(tys::Tuple , len::Signed)::Vector{Tuple{tys...}} = @inbounds Tuple{tys...}[reads(tys...) for i in 1:len]\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i = 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nfunction main()\n N,M = reads(Int,Int)\n tp = 0\n arr = Set(Int[])\n i = 0\n if isodd(M)\n while i 1;m=(r+l)>>1;if a[m] parseInt\n\ta = readline() |> split |> parseMap\n\te = [Int[] for i in 1:n]\n\tfor i in 1:n-1\n\t\tu,v = readline() |> split |> parseMap\n\t\tpush!(e[u],v)\n\t\tpush!(e[v],u)\n\tend\n\tt = zeros(Int,n)\n\tans = zeros(Int,n)\n\tlis = 10^18*ones(Int,n)\n\tbef=Tuple{Int,Int}[(0,0) for i in 1:n]\n\tsf = zeros(Int,n)\n\tsf[1]=1\n\tt[1]=1\n\tans[1]=1\n\tlis[1]=a[1]\n\tbef[1]=(1,a[1])\n\tstack = Int[1]\n\twhile !isempty(stack)\n\t\tnow = pop!(stack)\n\t\tif sf[now]==0\n\t\t\tpush!(stack,t[now])\n\t\t\tsf[now]=1\n\t\t\tk = bsearch(lis,a[now])+1\n\t\t\tbef[now]=(k,lis[k])\n\t\t\tlis[k]=a[now]\n\t\t\tans[now]=k\n\t\tend\n\t\tf = 0\n\t\tfor i in e[now]\n\t\t\tif t[i]==0\n\t\t\t\tf = 1\n\t\t\t\tt[i]=now\n\t\t\t\tpush!(stack,i)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tif f == 0\n\t\t\tk = bef[now][1]\n\t\t\tlis[k]=bef[now][2]\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tprintln(ans[i])\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1589148541, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02698.html", "problem_id": "p02698", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02698/input.txt", "sample_output_relpath": "derived/input_output/data/p02698/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02698/Julia/s053646853.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s053646853", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\nfunction bsearch(a::Array{Int,1},x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m] parseInt\n\ta = readline() |> split |> parseMap\n\te = [Int[] for i in 1:n]\n\tfor i in 1:n-1\n\t\tu,v = readline() |> split |> parseMap\n\t\tpush!(e[u],v)\n\t\tpush!(e[v],u)\n\tend\n\tt = zeros(Int,n)\n\tans = zeros(Int,n)\n\tlis = 10^18*ones(Int,n)\n\tbef=Tuple{Int,Int}[(0,0) for i in 1:n]\n\tsf = zeros(Int,n)\n\tsf[1]=1\n\tt[1]=1\n\tans[1]=1\n\tlis[1]=a[1]\n\tbef[1]=(1,a[1])\n\tstack = Int[1]\n\twhile !isempty(stack)\n\t\tnow = pop!(stack)\n\t\tif sf[now]==0\n\t\t\tpush!(stack,t[now])\n\t\t\tsf[now]=1\n\t\t\tk = bsearch(lis,a[now])+1\n\t\t\tbef[now]=(k,lis[k])\n\t\t\tlis[k]=a[now]\n\t\t\tans[now]=k\n\t\tend\n\t\tf = 0\n\t\tfor i in e[now]\n\t\t\tif t[i]==0\n\t\t\t\tf = 1\n\t\t\t\tt[i]=now\n\t\t\t\tpush!(stack,i)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tif f == 0\n\t\t\tk = bef[now][1]\n\t\t\tlis[k]=bef[now][2]\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tprintln(ans[i])\n\tend\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i.\nVertex i has an integer a_i written on it.\nFor every integer k from 1 through N, solve the following problem:\n\nWe will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence.\n\nHere, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \\leq i_1 < i_2 < ... < i_M \\leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq a_i \\leq 10^9\n\n1 \\leq u_i , v_i \\leq N\n\nu_i \\neq v_i\n\nThe given graph is a tree.\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\nu_1 v_1\nu_2 v_2\n:\nu_{N-1} v_{N-1}\n\nOutput\n\nPrint N lines. The k-th line, print the length of the longest increasing subsequence of the sequence obtained from the shortest path from Vertex 1 to Vertex k.\n\nSample Input 1\n\n10\n1 2 5 3 4 6 7 3 2 4\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n1 8\n8 9\n9 10\n\nSample Output 1\n\n1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n\nFor example, the sequence A obtained from the shortest path from Vertex 1 to Vertex 5 is 1,2,5,3,4. Its longest increasing subsequence is A_1, A_2, A_4, A_5, with the length of 4.", "sample_input": "10\n1 2 5 3 4 6 7 3 2 4\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n1 8\n8 9\n9 10\n"}, "reference_outputs": ["1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n"], "source_document_id": "p02698", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices, whose i-th edge connects Vertex u_i and Vertex v_i.\nVertex i has an integer a_i written on it.\nFor every integer k from 1 through N, solve the following problem:\n\nWe will make a sequence by lining up the integers written on the vertices along the shortest path from Vertex 1 to Vertex k, in the order they appear. Find the length of the longest increasing subsequence of this sequence.\n\nHere, the longest increasing subsequence of a sequence A of length L is the subsequence A_{i_1} , A_{i_2} , ... , A_{i_M} with the greatest possible value of M such that 1 \\leq i_1 < i_2 < ... < i_M \\leq L and A_{i_1} < A_{i_2} < ... < A_{i_M}.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq a_i \\leq 10^9\n\n1 \\leq u_i , v_i \\leq N\n\nu_i \\neq v_i\n\nThe given graph is a tree.\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\nu_1 v_1\nu_2 v_2\n:\nu_{N-1} v_{N-1}\n\nOutput\n\nPrint N lines. The k-th line, print the length of the longest increasing subsequence of the sequence obtained from the shortest path from Vertex 1 to Vertex k.\n\nSample Input 1\n\n10\n1 2 5 3 4 6 7 3 2 4\n1 2\n2 3\n3 4\n4 5\n3 6\n6 7\n1 8\n8 9\n9 10\n\nSample Output 1\n\n1\n2\n3\n3\n4\n4\n5\n2\n2\n3\n\nFor example, the sequence A obtained from the shortest path from Vertex 1 to Vertex 5 is 1,2,5,3,4. Its longest increasing subsequence is A_1, A_2, A_4, A_5, with the length of 4.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 994, "cpu_time_ms": 2212, "memory_kb": 262040}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s792437774", "group_id": "codeNet:p02699", "input_text": "S,W = parse.(Int,split(readline()))\n\nif S > W\n println(\"safe\")\nelse\n println(\"unsafe\")\nend\n", "language": "Julia", "metadata": {"date": 1588834585, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Julia/s792437774.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s792437774", "user_id": "u879294842"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "S,W = parse.(Int,split(readline()))\n\nif S > W\n println(\"safe\")\nelse\n println(\"unsafe\")\nend\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 251, "memory_kb": 169824}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s005163153", "group_id": "codeNet:p02699", "input_text": "(s,w) = map(x -> parse(Int,x), split(readline()))\nif s <= w\n println(\"unsafe\")\nelse\n println(\"safe\")\nend\n", "language": "Julia", "metadata": {"date": 1588045265, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Julia/s005163153.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s005163153", "user_id": "u106964380"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "(s,w) = map(x -> parse(Int,x), split(readline()))\nif s <= w\n println(\"unsafe\")\nelse\n println(\"safe\")\nend\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 226, "memory_kb": 161772}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s886210928", "group_id": "codeNet:p02699", "input_text": "s,w=parse.(split(readline()))\nprint(w>s?\"safe\":\"unsafe\")", "language": "Julia", "metadata": {"date": 1587959569, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02699.html", "problem_id": "p02699", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02699/input.txt", "sample_output_relpath": "derived/input_output/data/p02699/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02699/Julia/s886210928.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s886210928", "user_id": "u533002064"}, "prompt_components": {"gold_output": "unsafe\n", "input_to_evaluate": "s,w=parse.(split(readline()))\nprint(w>s?\"safe\":\"unsafe\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "sample_input": "4 5\n"}, "reference_outputs": ["unsafe\n"], "source_document_id": "p02699", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are S sheep and W wolves.\n\nIf the number of wolves is greater than or equal to that of sheep, the wolves will attack the sheep.\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nConstraints\n\n1 \\leq S \\leq 100\n\n1 \\leq W \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS W\n\nOutput\n\nIf the wolves will attack the sheep, print unsafe; otherwise, print safe.\n\nSample Input 1\n\n4 5\n\nSample Output 1\n\nunsafe\n\nThere are four sheep and five wolves. The number of wolves is not less than that of sheep, so they will attack them.\n\nSample Input 2\n\n100 2\n\nSample Output 2\n\nsafe\n\nMany a sheep drive away two wolves.\n\nSample Input 3\n\n10 10\n\nSample Output 3\n\nunsafe", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1414, "memory_kb": 308504}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s894410759", "group_id": "codeNet:p02701", "input_text": "function main()\n n = parse.(Int,readline())\n set = Set()\n for i in 1:n\n push!(set, readline())\n end\n println(length(set))\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1588629269, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s894410759.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s894410759", "user_id": "u257668305"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n n = parse.(Int,readline())\n set = Set()\n for i in 1:n\n push!(set, readline())\n end\n println(length(set))\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 141, "cpu_time_ms": 272, "memory_kb": 183852}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s766529555", "group_id": "codeNet:p02701", "input_text": "println(length(Set(readlines()[2..end])))\n", "language": "Julia", "metadata": {"date": 1588122462, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s766529555.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s766529555", "user_id": "u693701349"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "println(length(Set(readlines()[2..end])))\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 42, "cpu_time_ms": 1352, "memory_kb": 290856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s009893966", "group_id": "codeNet:p02704", "input_text": "parseInt(x) = parse(Int,x)\nparseBool(x) = parse(Bool,x)\nparseUInt(x) = parse(UInt64,x)\n# transpose(x::Array{T,3} where T) = permutedims(x,[2,1,3])\nimport LinearAlgebra\n\nfunction exec()\n n = readline() |> parseInt\n s = readline() |> split .|> parseBool\n t = readline() |> split .|> parseBool\n u = readline() |> split .|> parseUInt\n v = readline() |> split .|> parseUInt\n\n tabl = Array{Int8}(undef,n,n,0)\n @inbounds for bits = 0:63\n bittable = fill(Int8(-1),n,n)\n for i = 1:n, j = 1:n\n if (u[i] >> bits) & 1 == (v[j] >> bits) & 1\n bittable[i,j] = (u[i] >> bits) & 1\n end\n end\n for i = 1:n\n if t[i] == 0 && (v[i] >> bits) & 1 == 1\n bittable[:,i] .= 1\n elseif t[i] == 1 && (v[i] >> bits) & 1 == 0\n bittable[:,i] .= 0\n end\n end\n bittable = transpose(bittable)\n\n for i = 1:n\n if s[i] == 0 && (u[i] >> bits) & 1 == 1\n if count(e -> e == 0, view(bittable,:,i)) > 0\n println(-1)\n return\n end\n bittable[:,i] .= 1\n elseif s[i] == 1 && (u[i] >> bits) & 1 == 0\n if count(e -> e == 1, view(bittable,:,i)) > 0\n println(-1)\n return\n end\n bittable[:,i] .= 0\n end\n end\n\n for i = 1:n\n if s[i] == 1 && (u[i] >> bits) & 1 == 1 && \n count(e -> e == 1, view(bittable,:,i)) == 0\n suc = false\n for j = 1:n\n if bittable[j,i] != -1 continue end\n if count(e -> e != 1, view(bittable,j,:)) > 1\n suc = true\n bittable[j,i] = 1\n break\n end\n end\n if !suc\n println(-1)\n return\n end\n end\n end\n\n bittable = transpose(bittable)\n for i = 1:n\n if t[i] == 1 && (v[i] >> bits) & 1 == 1 && \n count(e -> e == 1, view(bittable,:,i)) == 0\n suc = false\n for j = 1:n\n if bittable[j,i] != -1 continue end\n if count(e -> e != 1, view(bittable,j,:)) > 1\n suc = true\n bittable[j,i] = 1\n break\n end\n end\n if !suc\n println(-1)\n return\n end\n end\n end\n\n tabl = cat(tabl, transpose(bittable), dims=3)\n end\n \n for i=1:n\n for j=1:n\n r = UInt64(0)\n for bits = 64:-1:1\n r = r * 2 + (tabl[j,i,bits] == 1 ? 1 : 0)\n end\n print(r, \" \")\n end\n println()\n end\nend\n\nexec()", "language": "Julia", "metadata": {"date": 1588345730, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s009893966.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s009893966", "user_id": "u743272507"}, "prompt_components": {"gold_output": "1 1\n1 0\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nparseBool(x) = parse(Bool,x)\nparseUInt(x) = parse(UInt64,x)\n# transpose(x::Array{T,3} where T) = permutedims(x,[2,1,3])\nimport LinearAlgebra\n\nfunction exec()\n n = readline() |> parseInt\n s = readline() |> split .|> parseBool\n t = readline() |> split .|> parseBool\n u = readline() |> split .|> parseUInt\n v = readline() |> split .|> parseUInt\n\n tabl = Array{Int8}(undef,n,n,0)\n @inbounds for bits = 0:63\n bittable = fill(Int8(-1),n,n)\n for i = 1:n, j = 1:n\n if (u[i] >> bits) & 1 == (v[j] >> bits) & 1\n bittable[i,j] = (u[i] >> bits) & 1\n end\n end\n for i = 1:n\n if t[i] == 0 && (v[i] >> bits) & 1 == 1\n bittable[:,i] .= 1\n elseif t[i] == 1 && (v[i] >> bits) & 1 == 0\n bittable[:,i] .= 0\n end\n end\n bittable = transpose(bittable)\n\n for i = 1:n\n if s[i] == 0 && (u[i] >> bits) & 1 == 1\n if count(e -> e == 0, view(bittable,:,i)) > 0\n println(-1)\n return\n end\n bittable[:,i] .= 1\n elseif s[i] == 1 && (u[i] >> bits) & 1 == 0\n if count(e -> e == 1, view(bittable,:,i)) > 0\n println(-1)\n return\n end\n bittable[:,i] .= 0\n end\n end\n\n for i = 1:n\n if s[i] == 1 && (u[i] >> bits) & 1 == 1 && \n count(e -> e == 1, view(bittable,:,i)) == 0\n suc = false\n for j = 1:n\n if bittable[j,i] != -1 continue end\n if count(e -> e != 1, view(bittable,j,:)) > 1\n suc = true\n bittable[j,i] = 1\n break\n end\n end\n if !suc\n println(-1)\n return\n end\n end\n end\n\n bittable = transpose(bittable)\n for i = 1:n\n if t[i] == 1 && (v[i] >> bits) & 1 == 1 && \n count(e -> e == 1, view(bittable,:,i)) == 0\n suc = false\n for j = 1:n\n if bittable[j,i] != -1 continue end\n if count(e -> e != 1, view(bittable,j,:)) > 1\n suc = true\n bittable[j,i] = 1\n break\n end\n end\n if !suc\n println(-1)\n return\n end\n end\n end\n\n tabl = cat(tabl, transpose(bittable), dims=3)\n end\n \n for i=1:n\n for j=1:n\n r = UInt64(0)\n for bits = 64:-1:1\n r = r * 2 + (tabl[j,i,bits] == 1 ? 1 : 0)\n end\n print(r, \" \")\n end\n println()\n end\nend\n\nexec()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2966, "cpu_time_ms": 2214, "memory_kb": 290952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s477038792", "group_id": "codeNet:p02707", "input_text": "function solve()\n n = parse(Int, readline())\n a = [parse(Int, x) for x in split(readline())]\n\n ans = zeros(Int, n)\n for i=1:length(a)\n ans[a[i]] += 1\n end\n\n for x in ans\n println(x)\n end\nend\n\nsolve()\n", "language": "Julia", "metadata": {"date": 1593047299, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s477038792.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s477038792", "user_id": "u503181529"}, "prompt_components": {"gold_output": "2\n2\n0\n0\n0\n", "input_to_evaluate": "function solve()\n n = parse(Int, readline())\n a = [parse(Int, x) for x in split(readline())]\n\n ans = zeros(Int, n)\n for i=1:length(a)\n ans[a[i]] += 1\n end\n\n for x in ans\n println(x)\n end\nend\n\nsolve()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 359, "memory_kb": 200832}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s747185806", "group_id": "codeNet:p02708", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\n\nfunction main()\n n,k=parseMap(split(readline()))\n mi,ma=0,0\n ans=Int128(0)\n for i in 0:n\n mi+=i\n ma+=n-i\n if i>=k-1\n ans+=ma-mi+1\n end\n end\n println(ans%(10^9+7))\nend\nmain()", "language": "Julia", "metadata": {"date": 1587410740, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s747185806.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s747185806", "user_id": "u619197965"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\n\nfunction main()\n n,k=parseMap(split(readline()))\n mi,ma=0,0\n ans=Int128(0)\n for i in 0:n\n mi+=i\n ma+=n-i\n if i>=k-1\n ans+=ma-mi+1\n end\n end\n println(ans%(10^9+7))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 426, "cpu_time_ms": 238, "memory_kb": 169368}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s526093939", "group_id": "codeNet:p02709", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tb = Tuple{Int,Int,Int}[]\n\tfor i in 1:n\n\t\tfor j in 1:n\n\t\t\tpush!(b,(i,j,a[i]*abs(i-j)))\n\t\tend\n\tend\n\tb = sort(b,by=x->x[3],rev=true)\n\tans = -ones(Int,n)\n\tused = zeros(Int,n)\n\tfor i in 1:n*n\n\t\t(p,q,r) = b[i]\n\t\tif ans[q]==-1&&used[p]==0\n\t\t\tused[p]=1\n\t\t\tans[q]=r\n\t\tend\n\tend\n\tprintln(sum(ans))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1587348937, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02709.html", "problem_id": "p02709", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02709/input.txt", "sample_output_relpath": "derived/input_output/data/p02709/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02709/Julia/s526093939.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s526093939", "user_id": "u095714878"}, "prompt_components": {"gold_output": "20\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tb = Tuple{Int,Int,Int}[]\n\tfor i in 1:n\n\t\tfor j in 1:n\n\t\t\tpush!(b,(i,j,a[i]*abs(i-j)))\n\t\tend\n\tend\n\tb = sort(b,by=x->x[3],rev=true)\n\tans = -ones(Int,n)\n\tused = zeros(Int,n)\n\tfor i in 1:n*n\n\t\t(p,q,r) = b[i]\n\t\tif ans[q]==-1&&used[p]==0\n\t\t\tused[p]=1\n\t\t\tans[q]=r\n\t\tend\n\tend\n\tprintln(sum(ans))\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.\n\nYou can rearrange these children just one time in any order you like.\n\nWhen a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child earns A_x \\times |x-y| happiness points.\n\nFind the maximum total happiness points the children can earn.\n\nConstraints\n\n2 \\leq N \\leq 2000\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 total happiness points the children can earn.\n\nSample Input 1\n\n4\n1 3 4 2\n\nSample Output 1\n\n20\n\nIf we move the 1-st child from the left to the 3-rd position from the left, the 2-nd child to the 4-th position, the 3-rd child to the 1-st position, and the 4-th child to the 2-nd position, the children earns 1 \\times |1-3|+3 \\times |2-4|+4 \\times |3-1|+2 \\times |4-2|=20 happiness points in total.\n\nSample Input 2\n\n6\n5 5 6 1 1 1\n\nSample Output 2\n\n58\n\nSample Input 3\n\n6\n8 6 9 1 2 1\n\nSample Output 3\n\n85", "sample_input": "4\n1 3 4 2\n"}, "reference_outputs": ["20\n"], "source_document_id": "p02709", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N children standing in a line from left to right. The activeness of the i-th child from the left is A_i.\n\nYou can rearrange these children just one time in any order you like.\n\nWhen a child who originally occupies the x-th position from the left in the line moves to the y-th position from the left, that child earns A_x \\times |x-y| happiness points.\n\nFind the maximum total happiness points the children can earn.\n\nConstraints\n\n2 \\leq N \\leq 2000\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 total happiness points the children can earn.\n\nSample Input 1\n\n4\n1 3 4 2\n\nSample Output 1\n\n20\n\nIf we move the 1-st child from the left to the 3-rd position from the left, the 2-nd child to the 4-th position, the 3-rd child to the 1-st position, and the 4-th child to the 2-nd position, the children earns 1 \\times |1-3|+3 \\times |2-4|+4 \\times |3-1|+2 \\times |4-2|=20 happiness points in total.\n\nSample Input 2\n\n6\n5 5 6 1 1 1\n\nSample Output 2\n\n58\n\nSample Input 3\n\n6\n8 6 9 1 2 1\n\nSample Output 3\n\n85", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 464, "cpu_time_ms": 1049, "memory_kb": 425220}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s601393120", "group_id": "codeNet:p02712", "input_text": "(() -> begin\n n = readline() |> x->parse.(Int,x)\n ans = 0\n for i in 1:n\n if i % 3 != 0 && i % 5 != 0\n ans += i\n end\n end\n println(ans)\nend)()", "language": "Julia", "metadata": {"date": 1588650426, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s601393120.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s601393120", "user_id": "u257668305"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "(() -> begin\n n = readline() |> x->parse.(Int,x)\n ans = 0\n for i in 1:n\n if i % 3 != 0 && i % 5 != 0\n ans += i\n end\n end\n println(ans)\nend)()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 224, "memory_kb": 162576}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s114738861", "group_id": "codeNet:p02712", "input_text": "N=parse(Int,readline())\nans=0\nfor i=1:N\n if i%3!=0&&i%5!=0\n global ans+=i\n end\nend\nprintln(ans)", "language": "Julia", "metadata": {"date": 1586947784, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s114738861.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s114738861", "user_id": "u657913472"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "N=parse(Int,readline())\nans=0\nfor i=1:N\n if i%3!=0&&i%5!=0\n global ans+=i\n end\nend\nprintln(ans)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 376, "memory_kb": 199688}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s689450642", "group_id": "codeNet:p02712", "input_text": "N=parse(Int,readline())\n\n\nsN=N*(N+1)÷2\nN3=N÷3\nsN3=3*N3*(N3+1)÷2\nN5=N÷5\nsN5=5*N5*(N5+1)÷2\nN15=N÷15\nsN15=15*N15*(N15+1)÷2\n\nsN-sN3-sN5+sN15", "language": "Julia", "metadata": {"date": 1586740705, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s689450642.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s689450642", "user_id": "u562051766"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "N=parse(Int,readline())\n\n\nsN=N*(N+1)÷2\nN3=N÷3\nsN3=3*N3*(N3+1)÷2\nN5=N÷5\nsN5=5*N5*(N5+1)÷2\nN15=N÷15\nsN15=15*N15*(N15+1)÷2\n\nsN-sN3-sN5+sN15", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 229, "memory_kb": 151744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s112384731", "group_id": "codeNet:p02716", "input_text": "\nfunction main()\n n = parse(Int, readline())\n arr = parse.(Int, split(readline()))\n arr = [tpl for tpl in sort([tpl for tpl in enumerate(arr)], by = tpl -> -tpl[2])]\n\n num = div(n, 2)\n\n ans = 0\n selected_idx = Set()\n for (i, a) in arr\n if num == 0\n break\n end\n if i - 1 in selected_idx || i + 1 in selected_idx\n continue\n end\n\n ans += a\n push!(selected_idx, i)\n num -= 1\n end\n\n print(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1587842751, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02716.html", "problem_id": "p02716", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02716/input.txt", "sample_output_relpath": "derived/input_output/data/p02716/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02716/Julia/s112384731.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s112384731", "user_id": "u002625175"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "\nfunction main()\n n = parse(Int, readline())\n arr = parse.(Int, split(readline()))\n arr = [tpl for tpl in sort([tpl for tpl in enumerate(arr)], by = tpl -> -tpl[2])]\n\n num = div(n, 2)\n\n ans = 0\n selected_idx = Set()\n for (i, a) in arr\n if num == 0\n break\n end\n if i - 1 in selected_idx || i + 1 in selected_idx\n continue\n end\n\n ans += a\n push!(selected_idx, i)\n num -= 1\n end\n\n print(ans)\nend\n\nmain()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence A_1, ..., A_N of length N.\n\nWe will choose exactly \\left\\lfloor \\frac{N}{2} \\right\\rfloor elements from this sequence so that no two adjacent elements are chosen.\n\nFind the maximum possible sum of the chosen elements.\n\nHere \\lfloor x \\rfloor denotes the greatest integer not greater than x.\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n|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_N\n\nOutput\n\nPrint the maximum possible sum of the chosen elements.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n12\n\nChoosing 2, 4, and 6 makes the sum 12, which is the maximum possible value.\n\nSample Input 2\n\n5\n-1000 -100 -10 0 10\n\nSample Output 2\n\n0\n\nChoosing -10 and 10 makes the sum 0, which is the maximum possible value.\n\nSample Input 3\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n5000000000\n\nWatch out for overflow.\n\nSample Input 4\n\n27\n18 -28 18 28 -45 90 -45 23 -53 60 28 -74 -71 35 -26 -62 49 -77 57 24 -70 -93 69 -99 59 57 -49\n\nSample Output 4\n\n295", "sample_input": "6\n1 2 3 4 5 6\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02716", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence A_1, ..., A_N of length N.\n\nWe will choose exactly \\left\\lfloor \\frac{N}{2} \\right\\rfloor elements from this sequence so that no two adjacent elements are chosen.\n\nFind the maximum possible sum of the chosen elements.\n\nHere \\lfloor x \\rfloor denotes the greatest integer not greater than x.\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n|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_N\n\nOutput\n\nPrint the maximum possible sum of the chosen elements.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n12\n\nChoosing 2, 4, and 6 makes the sum 12, which is the maximum possible value.\n\nSample Input 2\n\n5\n-1000 -100 -10 0 10\n\nSample Output 2\n\n0\n\nChoosing -10 and 10 makes the sum 0, which is the maximum possible value.\n\nSample Input 3\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n5000000000\n\nWatch out for overflow.\n\nSample Input 4\n\n27\n18 -28 18 28 -45 90 -45 23 -53 60 28 -74 -71 35 -26 -62 49 -77 57 24 -70 -93 69 -99 59 57 -49\n\nSample Output 4\n\n295", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 490, "memory_kb": 228568}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s808172069", "group_id": "codeNet:p02716", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tdp = -10^18*ones(Int,n,3)\n\tif n==2\n\t\tprintln(max(a[1],a[2]))\n\telse\n\t\tdp[1,1] = a[1]\n\t\tdp[1,2] = 0\n\t\tdp[1,3] = 0\n\t\tdp[2,1] = a[1]\n\t\tdp[2,2] = a[2]\n\t\tdp[2,3] = 0\n\t\tdp[3,1] = a[1]+a[3]\n\t\tdp[3,2] = a[2]\n\t\tdp[3,3] = max(a[1],a[3])\n\t\tfor i in 4:n\n\t\t\tdp[i,1] = dp[i-2,1]+a[i]\n\t\t\tdp[i,2] = max(dp[i-2,2]+a[i],dp[i-3,1]+a[i])\n\t\t\tif i==4\n\t\t\t\tdp[i,3] = max(dp[i-2,3]+a[i],dp[1,2]+a[i],a[i])\n\t\t\telse\n\t\t\t\tdp[i,3] = max(dp[i-2,3]+a[i],dp[i-3,2]+a[i],dp[i-4,1]+a[i])\n\t\t\tend\n\t\tend\n\t\tif n%2==0\n\t\t\tprintln(dp[n,2])\n\t\telse\n\t\t\tprintln(dp[n,3])\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1586772594, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02716.html", "problem_id": "p02716", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02716/input.txt", "sample_output_relpath": "derived/input_output/data/p02716/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02716/Julia/s808172069.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s808172069", "user_id": "u095714878"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tdp = -10^18*ones(Int,n,3)\n\tif n==2\n\t\tprintln(max(a[1],a[2]))\n\telse\n\t\tdp[1,1] = a[1]\n\t\tdp[1,2] = 0\n\t\tdp[1,3] = 0\n\t\tdp[2,1] = a[1]\n\t\tdp[2,2] = a[2]\n\t\tdp[2,3] = 0\n\t\tdp[3,1] = a[1]+a[3]\n\t\tdp[3,2] = a[2]\n\t\tdp[3,3] = max(a[1],a[3])\n\t\tfor i in 4:n\n\t\t\tdp[i,1] = dp[i-2,1]+a[i]\n\t\t\tdp[i,2] = max(dp[i-2,2]+a[i],dp[i-3,1]+a[i])\n\t\t\tif i==4\n\t\t\t\tdp[i,3] = max(dp[i-2,3]+a[i],dp[1,2]+a[i],a[i])\n\t\t\telse\n\t\t\t\tdp[i,3] = max(dp[i-2,3]+a[i],dp[i-3,2]+a[i],dp[i-4,1]+a[i])\n\t\t\tend\n\t\tend\n\t\tif n%2==0\n\t\t\tprintln(dp[n,2])\n\t\telse\n\t\t\tprintln(dp[n,3])\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence A_1, ..., A_N of length N.\n\nWe will choose exactly \\left\\lfloor \\frac{N}{2} \\right\\rfloor elements from this sequence so that no two adjacent elements are chosen.\n\nFind the maximum possible sum of the chosen elements.\n\nHere \\lfloor x \\rfloor denotes the greatest integer not greater than x.\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n|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_N\n\nOutput\n\nPrint the maximum possible sum of the chosen elements.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n12\n\nChoosing 2, 4, and 6 makes the sum 12, which is the maximum possible value.\n\nSample Input 2\n\n5\n-1000 -100 -10 0 10\n\nSample Output 2\n\n0\n\nChoosing -10 and 10 makes the sum 0, which is the maximum possible value.\n\nSample Input 3\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n5000000000\n\nWatch out for overflow.\n\nSample Input 4\n\n27\n18 -28 18 28 -45 90 -45 23 -53 60 28 -74 -71 35 -26 -62 49 -77 57 24 -70 -93 69 -99 59 57 -49\n\nSample Output 4\n\n295", "sample_input": "6\n1 2 3 4 5 6\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02716", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven is an integer sequence A_1, ..., A_N of length N.\n\nWe will choose exactly \\left\\lfloor \\frac{N}{2} \\right\\rfloor elements from this sequence so that no two adjacent elements are chosen.\n\nFind the maximum possible sum of the chosen elements.\n\nHere \\lfloor x \\rfloor denotes the greatest integer not greater than x.\n\nConstraints\n\n2 \\leq N \\leq 2\\times 10^5\n\n|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_N\n\nOutput\n\nPrint the maximum possible sum of the chosen elements.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n12\n\nChoosing 2, 4, and 6 makes the sum 12, which is the maximum possible value.\n\nSample Input 2\n\n5\n-1000 -100 -10 0 10\n\nSample Output 2\n\n0\n\nChoosing -10 and 10 makes the sum 0, which is the maximum possible value.\n\nSample Input 3\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 3\n\n5000000000\n\nWatch out for overflow.\n\nSample Input 4\n\n27\n18 -28 18 28 -45 90 -45 23 -53 60 28 -74 -71 35 -26 -62 49 -77 57 24 -70 -93 69 -99 59 57 -49\n\nSample Output 4\n\n295", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 712, "cpu_time_ms": 422, "memory_kb": 219012}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s299637111", "group_id": "codeNet:p02719", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n N, K = parseMap(split(readline()))\n a = mod(N, K)\n ## K>a \n b = K-a \n println(min(a,b))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1586370321, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s299637111.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s299637111", "user_id": "u429150137"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n N, K = parseMap(split(readline()))\n a = mod(N, K)\n ## K>a \n b = K-a \n println(min(a,b))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 219, "cpu_time_ms": 343, "memory_kb": 111136}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s613627458", "group_id": "codeNet:p02720", "input_text": "function nxt(Q)\n x=shift!(Q)\n if x%10>0\n push!(Q,x*10+x%10-1)\n end\n push!(Q,x*10+x%10)\n if x%10<9\n push!(Q,x*10+x%10+1)\n end\n Q\nend\nfunction main()\n Q=[1,2,3,4,5,6,7,8,9]\n for _=2:parse(Int,readline())\n Q=nxt(Q)\n end\n println(Q[1])\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1586149057, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02720.html", "problem_id": "p02720", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02720/input.txt", "sample_output_relpath": "derived/input_output/data/p02720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02720/Julia/s613627458.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s613627458", "user_id": "u657913472"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "function nxt(Q)\n x=shift!(Q)\n if x%10>0\n push!(Q,x*10+x%10-1)\n end\n push!(Q,x*10+x%10)\n if x%10<9\n push!(Q,x*10+x%10+1)\n end\n Q\nend\nfunction main()\n Q=[1,2,3,4,5,6,7,8,9]\n for _=2:parse(Int,readline())\n Q=nxt(Q)\n end\n println(Q[1])\nend\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\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\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "sample_input": "15\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02720", "source_text": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\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\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 326, "memory_kb": 114992}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s695466645", "group_id": "codeNet:p02720", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\narr=Set{Int}()\nfunction dfs(s)\n push!(arr,parseInt(s))\n if length(s)>10\n return 0\n else\n for i in max(s[end]-1,'0'):min(s[end]+1,'9')\n dfs(s*string(i))\n end\n end\nend\n\nfunction main()\n k=parseInt(readline())\n for i in '1':'9'\n dfs(string(i))\n end\n println(sort(collect(arr))[k])\nend\nmain()", "language": "Julia", "metadata": {"date": 1586103087, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02720.html", "problem_id": "p02720", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02720/input.txt", "sample_output_relpath": "derived/input_output/data/p02720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02720/Julia/s695466645.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s695466645", "user_id": "u619197965"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\narr=Set{Int}()\nfunction dfs(s)\n push!(arr,parseInt(s))\n if length(s)>10\n return 0\n else\n for i in max(s[end]-1,'0'):min(s[end]+1,'9')\n dfs(s*string(i))\n end\n end\nend\n\nfunction main()\n k=parseInt(readline())\n for i in '1':'9'\n dfs(string(i))\n end\n println(sort(collect(arr))[k])\nend\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\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\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "sample_input": "15\n"}, "reference_outputs": ["23\n"], "source_document_id": "p02720", "source_text": "Score : 400 points\n\nProblem Statement\n\nA positive integer X is said to be a lunlun number if and only if the following condition is satisfied:\n\nIn the base ten representation of X (without leading zeros), for every pair of two adjacent digits, the absolute difference of those digits is at most 1.\n\nFor example, 1234, 1, and 334 are lunlun numbers, while none of 31415, 119, or 13579 is.\n\nYou are given a positive integer K. Find the K-th smallest lunlun number.\n\nConstraints\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\nK\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n15\n\nSample Output 1\n\n23\n\nWe will list the 15 smallest lunlun numbers in ascending order:\n\n1,\n2,\n3,\n4,\n5,\n6,\n7,\n8,\n9,\n10,\n11,\n12,\n21,\n22,\n23.\n\nThus, the answer is 23.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nSample Input 3\n\n13\n\nSample Output 3\n\n21\n\nSample Input 4\n\n100000\n\nSample Output 4\n\n3234566667\n\nNote that the answer may not fit into the 32-bit signed integer type.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1404, "memory_kb": 198876}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s373968088", "group_id": "codeNet:p02721", "input_text": "function main()\n N,K,C=map(x->parse(Int,x),split(readline()))\n S=chomp(readline())\n R=zeros(Int,N)\n i=N\n now=K\n while i>=1\n if S[i]=='o'\n R[i]=now\n now-=1\n i-=C\n end\n i-=1\n end\n now=0\n i=1\n while i<=N\n if S[i]=='o'\n now+=1\n if R[i]==now\n println(i)\n end\n i+=C\n end\n i+=1\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1586149177, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s373968088.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s373968088", "user_id": "u657913472"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "function main()\n N,K,C=map(x->parse(Int,x),split(readline()))\n S=chomp(readline())\n R=zeros(Int,N)\n i=N\n now=K\n while i>=1\n if S[i]=='o'\n R[i]=now\n now-=1\n i-=C\n end\n i-=1\n end\n now=0\n i=1\n while i<=N\n if S[i]=='o'\n now+=1\n if R[i]==now\n println(i)\n end\n i+=C\n end\n i+=1\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 752, "memory_kb": 167412}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s799360306", "group_id": "codeNet:p02721", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m] split |> parseMap\n\ts = readline() |> chomp\n\ta = zeros(Int,n)\n\ta[1] = s[1]=='o'?1:0\n\tfor i in 2:n\n\t\ta[i]=s[i]=='o'?a[i-1]+1:a[i-1]\n\tend\n\tb = zeros(Int,n)\n\tbt = zeros(Int,n)\n\tfor i in 1:n\n\t\tif i+c>n\n\t\t\tb[i] = n+1\n\t\telse\n\t\t\tb[i] = bsearch(a,a[i+c]+1)+1\n\t\tend\n\t\tif i-c<=1\n\t\t\tbt[i] = 0\n\t\telse\n\t\t\tbt[i] = bsearch(a,a[i-c-1])+1\n\t\tend\n\tend\n\td = zeros(Int,n)\n\tchk = zeros(Int,n)\n\te = Int[]\n\tfor i in 1:n\n\t\tif s[i]=='o'\n\t\t\tif 1+c>=i\n\t\t\t\td[i] = 1\n\t\t\telse\n\t\t\t\td[i]=d[i-c-1]+1\n\t\t\tend\n\t\telseif i>1\n\t\t\td[i] = d[i-1]\n\t\tend\n\tend\n\tif d[n]==k\n\t\tfor i in 1:n\n\t\t\tif s[i]=='o'\n\t\t\t\tf = 0\n\t\t\t\tl = bt[i]\n\t\t\t\tr = b[i]\n\t\t\t\tif l==0&&r==n+1\n\t\t\t\t\tif d[i]==k\n\t\t\t\t\t\tpush!(e,i)\n\t\t\t\t\tend\n\t\t\t\telseif l==0\n\t\t\t\t\tif d[r]==d[i]+1\n\t\t\t\t\t\tpush!(e,i)\n\t\t\t\t\tend\n\t\t\t\telseif r==n+1\n\t\t\t\t\tif d[l]+1==d[i]&&d[i]==k\n\t\t\t\t\t\tpush!(e,i)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tif d[l]+2==d[i]+1==d[r]\n\t\t\t\t\t\tpush!(e,i)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tm = length(e)\n\tif m==1\n\t\tprintln(e[1])\n\telse\n\t\tfor i in 1:m\n\t\t\tif i==1\n\t\t\t\tif d[e[i]]+1==d[e[i+1]]\n\t\t\t\t\tprintln(e[1])\n\t\t\t\tend\n\t\t\telseif i==m\n\t\t\t\tif d[e[m-1]]+1==d[e[m]]\n\t\t\t\t\tprintln(e[m])\n\t\t\t\tend\n\t\t\telseif d[e[i-1]]+1==d[e[i]]==d[e[i+1]]-1\n\t\t\t\tprintln(e[i])\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1586054424, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s799360306.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s799360306", "user_id": "u095714878"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m] split |> parseMap\n\ts = readline() |> chomp\n\ta = zeros(Int,n)\n\ta[1] = s[1]=='o'?1:0\n\tfor i in 2:n\n\t\ta[i]=s[i]=='o'?a[i-1]+1:a[i-1]\n\tend\n\tb = zeros(Int,n)\n\tbt = zeros(Int,n)\n\tfor i in 1:n\n\t\tif i+c>n\n\t\t\tb[i] = n+1\n\t\telse\n\t\t\tb[i] = bsearch(a,a[i+c]+1)+1\n\t\tend\n\t\tif i-c<=1\n\t\t\tbt[i] = 0\n\t\telse\n\t\t\tbt[i] = bsearch(a,a[i-c-1])+1\n\t\tend\n\tend\n\td = zeros(Int,n)\n\tchk = zeros(Int,n)\n\te = Int[]\n\tfor i in 1:n\n\t\tif s[i]=='o'\n\t\t\tif 1+c>=i\n\t\t\t\td[i] = 1\n\t\t\telse\n\t\t\t\td[i]=d[i-c-1]+1\n\t\t\tend\n\t\telseif i>1\n\t\t\td[i] = d[i-1]\n\t\tend\n\tend\n\tif d[n]==k\n\t\tfor i in 1:n\n\t\t\tif s[i]=='o'\n\t\t\t\tf = 0\n\t\t\t\tl = bt[i]\n\t\t\t\tr = b[i]\n\t\t\t\tif l==0&&r==n+1\n\t\t\t\t\tif d[i]==k\n\t\t\t\t\t\tpush!(e,i)\n\t\t\t\t\tend\n\t\t\t\telseif l==0\n\t\t\t\t\tif d[r]==d[i]+1\n\t\t\t\t\t\tpush!(e,i)\n\t\t\t\t\tend\n\t\t\t\telseif r==n+1\n\t\t\t\t\tif d[l]+1==d[i]&&d[i]==k\n\t\t\t\t\t\tpush!(e,i)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tif d[l]+2==d[i]+1==d[r]\n\t\t\t\t\t\tpush!(e,i)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tm = length(e)\n\tif m==1\n\t\tprintln(e[1])\n\telse\n\t\tfor i in 1:m\n\t\t\tif i==1\n\t\t\t\tif d[e[i]]+1==d[e[i+1]]\n\t\t\t\t\tprintln(e[1])\n\t\t\t\tend\n\t\t\telseif i==m\n\t\t\t\tif d[e[m-1]]+1==d[e[m]]\n\t\t\t\t\tprintln(e[m])\n\t\t\t\tend\n\t\t\telseif d[e[i-1]]+1==d[e[i]]==d[e[i+1]]-1\n\t\t\t\tprintln(e[i])\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1062, "memory_kb": 171492}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s698945622", "group_id": "codeNet:p02723", "input_text": "function f()\n a=readline()\n if a[3]==a[4]\n if a[5]==a[6]\n print(\"Yes\")\n exit()\n end\n end\n print(\"No\")\nend\nf()\n \n", "language": "Julia", "metadata": {"date": 1588438590, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s698945622.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s698945622", "user_id": "u741792973"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function f()\n a=readline()\n if a[3]==a[4]\n if a[5]==a[6]\n print(\"Yes\")\n exit()\n end\n end\n print(\"No\")\nend\nf()\n \n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 166, "cpu_time_ms": 268, "memory_kb": 108156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s025025979", "group_id": "codeNet:p02723", "input_text": "s=readline()\nprint(s[3]==s[4]&&s[5]==s[6] ? \"Yes\":\"No\")", "language": "Julia", "metadata": {"date": 1587845278, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s025025979.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s025025979", "user_id": "u533002064"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s=readline()\nprint(s[3]==s[4]&&s[5]==s[6] ? \"Yes\":\"No\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 55, "cpu_time_ms": 657, "memory_kb": 163580}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s461540606", "group_id": "codeNet:p02724", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n x=parseInt(readline())\n println(x÷500*1000+x%500÷5*5)\nend\nmain()", "language": "Julia", "metadata": {"date": 1585506127, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02724.html", "problem_id": "p02724", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02724/input.txt", "sample_output_relpath": "derived/input_output/data/p02724/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02724/Julia/s461540606.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s461540606", "user_id": "u619197965"}, "prompt_components": {"gold_output": "2020\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n x=parseInt(readline())\n println(x÷500*1000+x%500÷5*5)\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)\n\nTakahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn?\n\n(We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)\n\nConstraints\n\n0 \\leq X \\leq 10^9\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 maximum number of happiness points that can be earned.\n\nSample Input 1\n\n1024\n\nSample Output 1\n\n2020\n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen coins, he gains 2020 happiness points, which is the maximum number of happiness points that can be earned.\n\nSample Input 2\n\n0\n\nSample Output 2\n\n0\n\nHe is penniless - or yenless.\n\nSample Input 3\n\n1000000000\n\nSample Output 3\n\n2000000000\n\nHe is a billionaire - in yen.", "sample_input": "1024\n"}, "reference_outputs": ["2020\n"], "source_document_id": "p02724", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)\n\nTakahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn?\n\n(We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)\n\nConstraints\n\n0 \\leq X \\leq 10^9\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 maximum number of happiness points that can be earned.\n\nSample Input 1\n\n1024\n\nSample Output 1\n\n2020\n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen coins, he gains 2020 happiness points, which is the maximum number of happiness points that can be earned.\n\nSample Input 2\n\n0\n\nSample Output 2\n\n0\n\nHe is penniless - or yenless.\n\nSample Input 3\n\n1000000000\n\nSample Output 3\n\n2000000000\n\nHe is a billionaire - in yen.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 301, "memory_kb": 110088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s388200316", "group_id": "codeNet:p02724", "input_text": "x = parse(Int64, readline())\n# println(x)\n\ncoin500 = 0\ncoin100 = 0\ncoin50 = 0\ncoin10 = 0\ncoin5 = 0\n\ncoin500 = div(x, 500)\nx = x - 500*coin500\n\ncoin5 = div(x, 5)\nx = x - 5*coin5\n\nprintln(1000coin500 + 5coin5)\n", "language": "Julia", "metadata": {"date": 1585444447, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02724.html", "problem_id": "p02724", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02724/input.txt", "sample_output_relpath": "derived/input_output/data/p02724/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02724/Julia/s388200316.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s388200316", "user_id": "u210113718"}, "prompt_components": {"gold_output": "2020\n", "input_to_evaluate": "x = parse(Int64, readline())\n# println(x)\n\ncoin500 = 0\ncoin100 = 0\ncoin50 = 0\ncoin10 = 0\ncoin5 = 0\n\ncoin500 = div(x, 500)\nx = x - 500*coin500\n\ncoin5 = div(x, 5)\nx = x - 5*coin5\n\nprintln(1000coin500 + 5coin5)\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)\n\nTakahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn?\n\n(We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)\n\nConstraints\n\n0 \\leq X \\leq 10^9\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 maximum number of happiness points that can be earned.\n\nSample Input 1\n\n1024\n\nSample Output 1\n\n2020\n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen coins, he gains 2020 happiness points, which is the maximum number of happiness points that can be earned.\n\nSample Input 2\n\n0\n\nSample Output 2\n\n0\n\nHe is penniless - or yenless.\n\nSample Input 3\n\n1000000000\n\nSample Output 3\n\n2000000000\n\nHe is a billionaire - in yen.", "sample_input": "1024\n"}, "reference_outputs": ["2020\n"], "source_document_id": "p02724", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)\n\nTakahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn?\n\n(We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)\n\nConstraints\n\n0 \\leq X \\leq 10^9\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 maximum number of happiness points that can be earned.\n\nSample Input 1\n\n1024\n\nSample Output 1\n\n2020\n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen coins, he gains 2020 happiness points, which is the maximum number of happiness points that can be earned.\n\nSample Input 2\n\n0\n\nSample Output 2\n\n0\n\nHe is penniless - or yenless.\n\nSample Input 3\n\n1000000000\n\nSample Output 3\n\n2000000000\n\nHe is a billionaire - in yen.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 545, "memory_kb": 111076}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s734669580", "group_id": "codeNet:p02725", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n K, N = parseMap(split(readline()))\n A = parseMap(split(readline()))\n A = [A;A[1]+K]\n B = diff(A)\n print(B)\n C = sum(B) - maximum(B)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1586376027, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s734669580.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s734669580", "user_id": "u429150137"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n K, N = parseMap(split(readline()))\n A = parseMap(split(readline()))\n A = [A;A[1]+K]\n B = diff(A)\n print(B)\n C = sum(B) - maximum(B)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 266, "cpu_time_ms": 988, "memory_kb": 168980}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s846859875", "group_id": "codeNet:p02725", "input_text": "K,N=map(x->parse(Int,x),split(readline(),\" \"))\nA=map(x->parse(Int,x),split(readline(),\" \"))\n#K,N=20,3\n#A=[0,5,15]\nmaxD,tmp=0,0\nfor i in 1:N-1\n tmp=A[i+1]-A[i]\n tmp>maxD && (maxD=tmp)\nend \ntmp=A[1]+(K-A[end]) \ntmp > maxD && (maxD=tmp)\nprint(K-maxD)", "language": "Julia", "metadata": {"date": 1585444951, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s846859875.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s846859875", "user_id": "u562051766"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "K,N=map(x->parse(Int,x),split(readline(),\" \"))\nA=map(x->parse(Int,x),split(readline(),\" \"))\n#K,N=20,3\n#A=[0,5,15]\nmaxD,tmp=0,0\nfor i in 1:N-1\n tmp=A[i+1]-A[i]\n tmp>maxD && (maxD=tmp)\nend \ntmp=A[1]+(K-A[end]) \ntmp > maxD && (maxD=tmp)\nprint(K-maxD)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 1938, "memory_kb": 155620}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s002924648", "group_id": "codeNet:p02726", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,x,y=parseMap(split(readline()))\n dis=[[j-i for j in 1:n] for i in 1:n]\n for i in 1:n\n for j in i+1:n\n dis[i][j]=min(dis[i][j],abs(i-x)+abs(j-y)+1)\n end\n end\n for i in 1:n-1\n res=0\n for j in 1:n\n res+=count(x->x==i,dis[j])\n end\n println(res)\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1585515551, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s002924648.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s002924648", "user_id": "u619197965"}, "prompt_components": {"gold_output": "5\n4\n1\n0\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,x,y=parseMap(split(readline()))\n dis=[[j-i for j in 1:n] for i in 1:n]\n for i in 1:n\n for j in i+1:n\n dis[i][j]=min(dis[i][j],abs(i-x)+abs(j-y)+1)\n end\n end\n for i in 1:n-1\n res=0\n for j in 1:n\n res+=count(x->x==i,dis[j])\n end\n println(res)\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 551, "cpu_time_ms": 2115, "memory_kb": 170924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s945701739", "group_id": "codeNet:p02726", "input_text": "N,X,Y=map(x->parse(Int,x),split(readline(),\" \"))\nc=zeros(Int,N-1)\nfor i in 1:(N-1)\n for j in (i+1):N\n t1=abs(i-X)+abs(j-Y)+1\n t2=j-i\n c[ (t1>t2) ? t2 : t1 ]+=1\n end\nend\nfor i in c\n println(i)\nend", "language": "Julia", "metadata": {"date": 1585488956, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s945701739.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s945701739", "user_id": "u562051766"}, "prompt_components": {"gold_output": "5\n4\n1\n0\n", "input_to_evaluate": "N,X,Y=map(x->parse(Int,x),split(readline(),\" \"))\nc=zeros(Int,N-1)\nfor i in 1:(N-1)\n for j in (i+1):N\n t1=abs(i-X)+abs(j-Y)+1\n t2=j-i\n c[ (t1>t2) ? t2 : t1 ]+=1\n end\nend\nfor i in c\n println(i)\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1530, "memory_kb": 166272}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s461706523", "group_id": "codeNet:p02728", "input_text": "const M=10^9+7\nfunction main()\n\tN=parse(Int,readline())\n\tfac=ones(Int,N)\n\tfor i=2:N\n\t\tfac[i]=fac[i-1]*(i-1)%M\n\tend\n\tinvfac=zeros(Int,N)\n\tinvfac[N]=invmod(fac[N],M)\n\tfor i=N-1:-1:1\n\t\tinvfac[i]=invfac[i+1]*i%M\n\tend\n\tG=[Int[] for _=1:N]\n\tfor s=readlines()\n\t\ta,b=map(x->parse(Int,x),split(s))\n\t\tpush!(G[a],b)\n\t\tpush!(G[b],a)\n\tend\n\tc=zeros(Int,N)\n\tdp1=zeros(Int,N)\n\tfunction dfs1(u,p)\n\t\tret=1\n\t\tc[u]=1\n\t\tfor v=G[u]\n\t\t\tif v!=p\n\t\t\t\tret=ret*dfs1(v,u)%M\n\t\t\t\tret=ret*invfac[c[v]+1]%M\n\t\t\t\tc[u]+=c[v]\n\t\t\tend\n\t\tend\n\t\tdp1[u]=ret\n\t\tret*fac[c[u]]%M\n\tend\n\tans=zeros(Int,N)\n\tfunction dfs2(u,p,pr)\n\t\tans[u]=dp1[u]*pr%M*invfac[N-c[u]+1]%M\n\t\tfor v=G[u]\n\t\t\tif v!=p\n\t\t\t\tdfs2(v,u,ans[u]*c[v]%M*invmod(dp1[v],M)%M*fac[N-c[v]]%M)\n\t\t\tend\n\t\tend\n\t\tans[u]=ans[u]*fac[N]%M\n\tend\n\tdfs1(1,0)\n\tdfs2(1,0,1)\n\tprintln.(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1585537510, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02728.html", "problem_id": "p02728", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02728/input.txt", "sample_output_relpath": "derived/input_output/data/p02728/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02728/Julia/s461706523.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s461706523", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n1\n1\n", "input_to_evaluate": "const M=10^9+7\nfunction main()\n\tN=parse(Int,readline())\n\tfac=ones(Int,N)\n\tfor i=2:N\n\t\tfac[i]=fac[i-1]*(i-1)%M\n\tend\n\tinvfac=zeros(Int,N)\n\tinvfac[N]=invmod(fac[N],M)\n\tfor i=N-1:-1:1\n\t\tinvfac[i]=invfac[i+1]*i%M\n\tend\n\tG=[Int[] for _=1:N]\n\tfor s=readlines()\n\t\ta,b=map(x->parse(Int,x),split(s))\n\t\tpush!(G[a],b)\n\t\tpush!(G[b],a)\n\tend\n\tc=zeros(Int,N)\n\tdp1=zeros(Int,N)\n\tfunction dfs1(u,p)\n\t\tret=1\n\t\tc[u]=1\n\t\tfor v=G[u]\n\t\t\tif v!=p\n\t\t\t\tret=ret*dfs1(v,u)%M\n\t\t\t\tret=ret*invfac[c[v]+1]%M\n\t\t\t\tc[u]+=c[v]\n\t\t\tend\n\t\tend\n\t\tdp1[u]=ret\n\t\tret*fac[c[u]]%M\n\tend\n\tans=zeros(Int,N)\n\tfunction dfs2(u,p,pr)\n\t\tans[u]=dp1[u]*pr%M*invfac[N-c[u]+1]%M\n\t\tfor v=G[u]\n\t\t\tif v!=p\n\t\t\t\tdfs2(v,u,ans[u]*c[v]%M*invmod(dp1[v],M)%M*fac[N-c[v]]%M)\n\t\t\tend\n\t\tend\n\t\tans[u]=ans[u]*fac[N]%M\n\tend\n\tdfs1(1,0)\n\tdfs2(1,0,1)\n\tprintln.(ans)\nend\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i.\nFor each k=1, ..., N, solve the problem below:\n\nConsider writing a number on each vertex in the tree in the following manner:\n\nFirst, write 1 on Vertex k.\n\nThen, for each of the numbers 2, ..., N in this order, write the number on the vertex chosen as follows:\n\nChoose a vertex that still does not have a number written on it and is adjacent to a vertex with a number already written on it. If there are multiple such vertices, choose one of them at random.\n\nFind the number of ways in which we can write the numbers on the vertices, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq a_i,b_i \\leq N\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}\n\nOutput\n\nFor each k=1, 2, ..., N in this order, print a line containing the answer to the problem.\n\nSample Input 1\n\n3\n1 2\n1 3\n\nSample Output 1\n\n2\n1\n1\n\nThe graph in this input is as follows:\n\nFor k=1, there are two ways in which we can write the numbers on the vertices, as follows:\n\nWriting 1, 2, 3 on Vertex 1, 2, 3, respectively\n\nWriting 1, 3, 2 on Vertex 1, 2, 3, respectively\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n1\n\nThe graph in this input is as follows:\n\nSample Input 3\n\n5\n1 2\n2 3\n3 4\n3 5\n\nSample Output 3\n\n2\n8\n12\n3\n3\n\nThe graph in this input is as follows:\n\nSample Input 4\n\n8\n1 2\n2 3\n3 4\n3 5\n3 6\n6 7\n6 8\n\nSample Output 4\n\n40\n280\n840\n120\n120\n504\n72\n72\n\nThe graph in this input is as follows:", "sample_input": "3\n1 2\n1 3\n"}, "reference_outputs": ["2\n1\n1\n"], "source_document_id": "p02728", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and b_i.\nFor each k=1, ..., N, solve the problem below:\n\nConsider writing a number on each vertex in the tree in the following manner:\n\nFirst, write 1 on Vertex k.\n\nThen, for each of the numbers 2, ..., N in this order, write the number on the vertex chosen as follows:\n\nChoose a vertex that still does not have a number written on it and is adjacent to a vertex with a number already written on it. If there are multiple such vertices, choose one of them at random.\n\nFind the number of ways in which we can write the numbers on the vertices, modulo (10^9+7).\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq a_i,b_i \\leq N\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}\n\nOutput\n\nFor each k=1, 2, ..., N in this order, print a line containing the answer to the problem.\n\nSample Input 1\n\n3\n1 2\n1 3\n\nSample Output 1\n\n2\n1\n1\n\nThe graph in this input is as follows:\n\nFor k=1, there are two ways in which we can write the numbers on the vertices, as follows:\n\nWriting 1, 2, 3 on Vertex 1, 2, 3, respectively\n\nWriting 1, 3, 2 on Vertex 1, 2, 3, respectively\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n1\n1\n\nThe graph in this input is as follows:\n\nSample Input 3\n\n5\n1 2\n2 3\n3 4\n3 5\n\nSample Output 3\n\n2\n8\n12\n3\n3\n\nThe graph in this input is as follows:\n\nSample Input 4\n\n8\n1 2\n2 3\n3 4\n3 5\n3 6\n6 7\n6 8\n\nSample Output 4\n\n40\n280\n840\n120\n120\n504\n72\n72\n\nThe graph in this input is as follows:", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 796, "cpu_time_ms": 2078, "memory_kb": 238888}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s061562915", "group_id": "codeNet:p02729", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,m=parseMap(split(readline()))\n nC2=Vector{Int}([0 for i in 1:2*10^5+1])\n for i in 3:2*10^5+1\n nC2[i]=(i-1)*(i-2)÷2\n end\n println(nC2[n+1]+nC2[m+1])\nend\nmain()", "language": "Julia", "metadata": {"date": 1584932300, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s061562915.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s061562915", "user_id": "u619197965"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,m=parseMap(split(readline()))\n nC2=Vector{Int}([0 for i in 1:2*10^5+1])\n for i in 3:2*10^5+1\n nC2[i]=(i-1)*(i-2)÷2\n end\n println(nC2[n+1]+nC2[m+1])\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 705, "memory_kb": 169300}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s090287981", "group_id": "codeNet:p02732", "input_text": "readline()\nA=map(x->parse(Int,x),split(readline()))\nans=0\ncnt=zeros(Int,length(A))\nfor a=A\n ans+=cnt[a]\n cnt[a]+=1\nend\nfor a=A\n println(ans-cnt[a]+1)\nend", "language": "Julia", "metadata": {"date": 1585048821, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s090287981.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s090287981", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n2\n3\n2\n3\n", "input_to_evaluate": "readline()\nA=map(x->parse(Int,x),split(readline()))\nans=0\ncnt=zeros(Int,length(A))\nfor a=A\n ans+=cnt[a]\n cnt[a]+=1\nend\nfor a=A\n println(ans-cnt[a]+1)\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 707, "memory_kb": 160836}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s176222256", "group_id": "codeNet:p02733", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction moveup(x::Array{Int,1},n)\n\tk = length(x)\n\tfor i in 1:k-1\n\t\tif x[k-i+1] > n-1\n\t\t\tx[k-i] += div(x[k-i+1],n)\n\t\t\tx[k-i+1] = x[k-i+1]%n\n\t\tend\n\tend\n\tif x[1] > n-1\n\t\t0\n\telse\n\t\tx\n\tend\nend\n\nfunction main()\n\th,w,k = readline() |> split |> parseMap\n\ta = zeros(Int,h,w)\n\tbit = zeros(Int,h-1)\n\tfor i in 1:h\n\t\ts = readline() |> chomp\n\t\tfor j in 1:w\n\t\t\tif s[j]=='1'\n\t\t\t\ta[i,j] = 1\n\t\t\tend\n\t\tend\n\tend\n\tb = zeros(Int,h+1,w+1)\n\tfor i in 1:h\n\t\tfor j in 1:w\n\t\t\tb[i+1,j+1] = b[i,j+1]+a[i,j]\n\t\tend\n\tend\n\tfor j in 1:w\n\t\tfor i in 1:h\n\t\t\tb[i+1,j+1] += b[i+1,j]\n\t\tend\n\tend\n\tans = 10^18\n\twhile bit!=0\n\t\tl = 1\n\t\tlk = 0\n\t\tchk = Int[1]\n\t\tfor i in 1:h-1\n\t\t\tif bit[i]==1\n\t\t\t\tpush!(chk,i+1)\n\t\t\tend\n\t\tend\n\t\tpush!(chk,h+1)\n\t\tfor j in 1:w\n\t\t\tf = 0\n\t\t\tfor i in 2:length(chk)\n\t\t\t\tif b[chk[i],j+1]-b[chk[i],l]-b[chk[i-1],j+1]+b[chk[i-1],l]>k\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tif f==1\n\t\t\t\tlk += 1\n\t\t\t\tl = j\n\t\t\tend\n\t\tend\n\t\tv = 0\n\t\tfor i in 2:length(chk)\n\t\t\tif b[chk[i],w+1]-b[chk[i],w]-b[chk[i-1],w+1]+b[chk[i-1],w]>k\n\t\t\t\tv = 1\n\t\t\tend\n\t\tend\n\t\tif v==0\n\t\t\tans = min(ans,lk+sum(bit))\n\t\tend\n\t\tbit[h-1] += 1\n\t\tbit = moveup(bit,2)\n\tend\n\tprintln(ans)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584932517, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s176222256.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s176222256", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction moveup(x::Array{Int,1},n)\n\tk = length(x)\n\tfor i in 1:k-1\n\t\tif x[k-i+1] > n-1\n\t\t\tx[k-i] += div(x[k-i+1],n)\n\t\t\tx[k-i+1] = x[k-i+1]%n\n\t\tend\n\tend\n\tif x[1] > n-1\n\t\t0\n\telse\n\t\tx\n\tend\nend\n\nfunction main()\n\th,w,k = readline() |> split |> parseMap\n\ta = zeros(Int,h,w)\n\tbit = zeros(Int,h-1)\n\tfor i in 1:h\n\t\ts = readline() |> chomp\n\t\tfor j in 1:w\n\t\t\tif s[j]=='1'\n\t\t\t\ta[i,j] = 1\n\t\t\tend\n\t\tend\n\tend\n\tb = zeros(Int,h+1,w+1)\n\tfor i in 1:h\n\t\tfor j in 1:w\n\t\t\tb[i+1,j+1] = b[i,j+1]+a[i,j]\n\t\tend\n\tend\n\tfor j in 1:w\n\t\tfor i in 1:h\n\t\t\tb[i+1,j+1] += b[i+1,j]\n\t\tend\n\tend\n\tans = 10^18\n\twhile bit!=0\n\t\tl = 1\n\t\tlk = 0\n\t\tchk = Int[1]\n\t\tfor i in 1:h-1\n\t\t\tif bit[i]==1\n\t\t\t\tpush!(chk,i+1)\n\t\t\tend\n\t\tend\n\t\tpush!(chk,h+1)\n\t\tfor j in 1:w\n\t\t\tf = 0\n\t\t\tfor i in 2:length(chk)\n\t\t\t\tif b[chk[i],j+1]-b[chk[i],l]-b[chk[i-1],j+1]+b[chk[i-1],l]>k\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tif f==1\n\t\t\t\tlk += 1\n\t\t\t\tl = j\n\t\t\tend\n\t\tend\n\t\tv = 0\n\t\tfor i in 2:length(chk)\n\t\t\tif b[chk[i],w+1]-b[chk[i],w]-b[chk[i-1],w+1]+b[chk[i-1],w]>k\n\t\t\t\tv = 1\n\t\t\tend\n\t\tend\n\t\tif v==0\n\t\t\tans = min(ans,lk+sum(bit))\n\t\tend\n\t\tbit[h-1] += 1\n\t\tbit = moveup(bit,2)\n\tend\n\tprintln(ans)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1216, "cpu_time_ms": 1585, "memory_kb": 127696}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s699777027", "group_id": "codeNet:p02734", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tp = 998244353\n\tn,s = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tdp = zeros(Int,n,s)\n\tif a[1]<=s\n\t\tdp[1,a[1]] = 1\n\tend\n\tans = dp[1,s]*n\n\tfor i in 2:n\n\t\tif a[i]<=s\n\t\t\tdp[i,a[i]] += i\n\t\tend\n\t\tfor j in 1:s\n\t\t\tif j!=s\n\t\t\t\tdp[i,j]+=dp[i-1,j]\n\t\t\tend\n\t\t\tif j+a[i]<=s\n\t\t\t\tdp[i,j+a[i]]+=dp[i-1,j]\n\t\t\tend\n\t\tend\n\t\tans = (ans+dp[i,s]*(n+1-i)%p)%p\n\tend\n\tprintln(ans)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584930493, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02734.html", "problem_id": "p02734", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02734/input.txt", "sample_output_relpath": "derived/input_output/data/p02734/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02734/Julia/s699777027.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s699777027", "user_id": "u095714878"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tp = 998244353\n\tn,s = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tdp = zeros(Int,n,s)\n\tif a[1]<=s\n\t\tdp[1,a[1]] = 1\n\tend\n\tans = dp[1,s]*n\n\tfor i in 2:n\n\t\tif a[i]<=s\n\t\t\tdp[i,a[i]] += i\n\t\tend\n\t\tfor j in 1:s\n\t\t\tif j!=s\n\t\t\t\tdp[i,j]+=dp[i-1,j]\n\t\t\tend\n\t\t\tif j+a[i]<=s\n\t\t\t\tdp[i,j+a[i]]+=dp[i-1,j]\n\t\t\tend\n\t\tend\n\t\tans = (ans+dp[i,s]*(n+1-i)%p)%p\n\tend\n\tprintln(ans)\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are a sequence of N integers A_1, A_2, \\ldots, A_N and a positive integer S.\n\nFor a pair of integers (L, R) such that 1\\leq L \\leq R \\leq N, let us define f(L, R) as follows:\n\nf(L, R) is the number of sequences of integers (x_1, x_2, \\ldots , x_k) such that L \\leq x_1 < x_2 < \\cdots < x_k \\leq R and A_{x_1}+A_{x_2}+\\cdots +A_{x_k} = S.\n\nFind the sum of f(L, R) over all pairs of integers (L, R) such that 1\\leq L \\leq R\\leq N. Since this sum can be enormous, print it modulo 998244353.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq S \\leq 3000\n\n1 \\leq A_i \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the sum of f(L, R), modulo 998244353.\n\nSample Input 1\n\n3 4\n2 2 4\n\nSample Output 1\n\n5\n\nThe value of f(L, R) for each pair is as follows, for a total of 5.\n\nf(1,1) = 0\n\nf(1,2) = 1 (for the sequence (1, 2))\n\nf(1,3) = 2 (for (1, 2) and (3))\n\nf(2,2) = 0\n\nf(2,3) = 1 (for (3))\n\nf(3,3) = 1 (for (3))\n\nSample Input 2\n\n5 8\n9 9 9 9 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n10 10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n152", "sample_input": "3 4\n2 2 4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02734", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are a sequence of N integers A_1, A_2, \\ldots, A_N and a positive integer S.\n\nFor a pair of integers (L, R) such that 1\\leq L \\leq R \\leq N, let us define f(L, R) as follows:\n\nf(L, R) is the number of sequences of integers (x_1, x_2, \\ldots , x_k) such that L \\leq x_1 < x_2 < \\cdots < x_k \\leq R and A_{x_1}+A_{x_2}+\\cdots +A_{x_k} = S.\n\nFind the sum of f(L, R) over all pairs of integers (L, R) such that 1\\leq L \\leq R\\leq N. Since this sum can be enormous, print it modulo 998244353.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\n\n1 \\leq S \\leq 3000\n\n1 \\leq A_i \\leq 3000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN S\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the sum of f(L, R), modulo 998244353.\n\nSample Input 1\n\n3 4\n2 2 4\n\nSample Output 1\n\n5\n\nThe value of f(L, R) for each pair is as follows, for a total of 5.\n\nf(1,1) = 0\n\nf(1,2) = 1 (for the sequence (1, 2))\n\nf(1,3) = 2 (for (1, 2) and (3))\n\nf(2,2) = 0\n\nf(2,3) = 1 (for (3))\n\nf(3,3) = 1 (for (3))\n\nSample Input 2\n\n5 8\n9 9 9 9 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n10 10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 3\n\n152", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 496, "cpu_time_ms": 944, "memory_kb": 182340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s109823025", "group_id": "codeNet:p02735", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\ts = String[\"\" for i in 1:h]\n\tfor i in 1:h\n\t\ts[i] = readline() |> chomp\n\tend\n\tdp = zeros(Int,h,w)\n\tdp[1,1] = s[1][1]=='#'?1:0\n\tfor i in 2:w\n\t\tdp[1,i]=s[1][i]=='#'&&s[1][i-1]=='.'?dp[1,i-1]+1:dp[1,i-1]\n\tend\n\tfor i in 2:h\n\t\tfor j in 1:w\n\t\t\tdp[i,j] = s[i][j]=='#'&&s[i-1][j]=='.'?dp[i-1,j]+1:dp[i-1,j]\n\t\t\tif j>1\n\t\t\t\tv = s[i][j]=='#'&&s[i][j-1]=='.'?dp[i,j-1]+1:dp[i,j-1]\n\t\t\t\tdp[i,j] = min(dp[i,j],v)\n\t\t\tend\n\t\tend\n\tend\n\tprintln(dp[h,w])\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584844835, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s109823025.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s109823025", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\ts = String[\"\" for i in 1:h]\n\tfor i in 1:h\n\t\ts[i] = readline() |> chomp\n\tend\n\tdp = zeros(Int,h,w)\n\tdp[1,1] = s[1][1]=='#'?1:0\n\tfor i in 2:w\n\t\tdp[1,i]=s[1][i]=='#'&&s[1][i-1]=='.'?dp[1,i-1]+1:dp[1,i-1]\n\tend\n\tfor i in 2:h\n\t\tfor j in 1:w\n\t\t\tdp[i,j] = s[i][j]=='#'&&s[i-1][j]=='.'?dp[i-1,j]+1:dp[i-1,j]\n\t\t\tif j>1\n\t\t\t\tv = s[i][j]=='#'&&s[i][j-1]=='.'?dp[i,j-1]+1:dp[i,j-1]\n\t\t\t\tdp[i,j] = min(dp[i,j],v)\n\t\t\tend\n\t\tend\n\tend\n\tprintln(dp[h,w])\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 587, "cpu_time_ms": 1716, "memory_kb": 123988}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s895829388", "group_id": "codeNet:p02736", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = parseMap(split(chomp(readline()),\"\"))\n\tsa = sum(a)\n\tf = 0\n\tif n==2\n\t\tprintln(abs(a[1]-a[2]))\n\telse\n\t\tif (a[1]==1&&sa==3*(n-1)+1)||(a[n]==1&&sa==1+3*(n-1))||(a[1]==3&&sa==n+2)||(a[n]==3&&sa==n+2)\n\t\t\tprintln(2)\n\t\telse\n\t\t\tbb = Int[]\n\t\t\tb = zeros(Int,n-1)\n\t\t\tl = 1\n\t\t\tpush!(bb,abs(a[1]-a[2]))\n\t\t\tb[1]=abs(a[1]-a[2])\n\t\t\tfor i in 2:n-1\n\t\t\t\tv = abs(a[i]-a[i+1])\n\t\t\t\tb[i]=v\n\t\t\t\tif v!=0||bb[l]!=0\n\t\t\t\t\tpush!(bb,v)\n\t\t\t\t\tl+=1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif length(bb)==1\n\t\t\t\tprintln(bb[1])\n\t\t\telseif length(bb)==2\n\t\t\t\tprintln(abs(bb[1]-bb[2]))\n\t\t\telse\n\t\t\t\twhile length(b)>1\n\t\t\t\t\tc = Int[]\n\t\t\t\t\tm = 1\n\t\t\t\t\tpush!(c,abs(b[1]-b[2]))\n\t\t\t\t\tfor i in 2:length(b)-1\n\t\t\t\t\t\tv = abs(b[i]-b[i+1])\n\t\t\t\t\t\tif v!=0||c[m]!=0\n\t\t\t\t\t\t\tpush!(c,v)\n\t\t\t\t\t\t\tm+=1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tb = copy(c)\n\t\t\t\tend\n\t\t\t\tprintln(b[1])\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584846424, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s895829388.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s895829388", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = parseMap(split(chomp(readline()),\"\"))\n\tsa = sum(a)\n\tf = 0\n\tif n==2\n\t\tprintln(abs(a[1]-a[2]))\n\telse\n\t\tif (a[1]==1&&sa==3*(n-1)+1)||(a[n]==1&&sa==1+3*(n-1))||(a[1]==3&&sa==n+2)||(a[n]==3&&sa==n+2)\n\t\t\tprintln(2)\n\t\telse\n\t\t\tbb = Int[]\n\t\t\tb = zeros(Int,n-1)\n\t\t\tl = 1\n\t\t\tpush!(bb,abs(a[1]-a[2]))\n\t\t\tb[1]=abs(a[1]-a[2])\n\t\t\tfor i in 2:n-1\n\t\t\t\tv = abs(a[i]-a[i+1])\n\t\t\t\tb[i]=v\n\t\t\t\tif v!=0||bb[l]!=0\n\t\t\t\t\tpush!(bb,v)\n\t\t\t\t\tl+=1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif length(bb)==1\n\t\t\t\tprintln(bb[1])\n\t\t\telseif length(bb)==2\n\t\t\t\tprintln(abs(bb[1]-bb[2]))\n\t\t\telse\n\t\t\t\twhile length(b)>1\n\t\t\t\t\tc = Int[]\n\t\t\t\t\tm = 1\n\t\t\t\t\tpush!(c,abs(b[1]-b[2]))\n\t\t\t\t\tfor i in 2:length(b)-1\n\t\t\t\t\t\tv = abs(b[i]-b[i+1])\n\t\t\t\t\t\tif v!=0||c[m]!=0\n\t\t\t\t\t\t\tpush!(c,v)\n\t\t\t\t\t\t\tm+=1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tb = copy(c)\n\t\t\t\tend\n\t\t\t\tprintln(b[1])\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 944, "cpu_time_ms": 2118, "memory_kb": 232176}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s012605984", "group_id": "codeNet:p02736", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = parseMap(split(chomp(readline()),\"\"))\n\tsa = sum(a)\n\tf = 0\n\tif n==2\n\t\tprintln(abs(a[1]-a[2]))\n\telse\n\t\tif (a[1]==1&&sa==3*(n-1)+1)||(a[n]==1&&sa==1+3*(n-1))||(a[1]==3&&sa==n+2)||(a[n]==3&&sa==n+2)\n\t\t\tprintln(2)\n\t\telse\n\t\t\tbb = Int[]\n\t\t\tb = zeros(Int,n-1)\n\t\t\tl = 1\n\t\t\tpush!(bb,abs(a[1]-a[2]))\n\t\t\tb[1]=abs(a[1]-a[2])\n\t\t\tfor i in 2:n-1\n\t\t\t\tv = abs(a[i]-a[i+1])\n\t\t\t\tb[i]=v\n\t\t\t\tif v!=0||bb[l]!=0\n\t\t\t\t\tpush!(bb,v)\n\t\t\t\t\tl+=1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif length(bb)==1\n\t\t\t\tprintln(bb[1])\n\t\t\telseif length(bb)==2\n\t\t\t\tprintln(abs(bb[1]-bb[2]))\n\t\t\telse\n\t\t\t\tc = 0\n\t\t\t\tfor i in 1:n-2\n\t\t\t\t\tv = abs(b[i]-b[i+1])\n\t\t\t\t\tif i==1||i==n-1\n\t\t\t\t\t\tc+=v\n\t\t\t\t\telse\n\t\t\t\t\t\tc+=v*2\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tprintln((c+1)%2)\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584845696, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s012605984.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s012605984", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = parseMap(split(chomp(readline()),\"\"))\n\tsa = sum(a)\n\tf = 0\n\tif n==2\n\t\tprintln(abs(a[1]-a[2]))\n\telse\n\t\tif (a[1]==1&&sa==3*(n-1)+1)||(a[n]==1&&sa==1+3*(n-1))||(a[1]==3&&sa==n+2)||(a[n]==3&&sa==n+2)\n\t\t\tprintln(2)\n\t\telse\n\t\t\tbb = Int[]\n\t\t\tb = zeros(Int,n-1)\n\t\t\tl = 1\n\t\t\tpush!(bb,abs(a[1]-a[2]))\n\t\t\tb[1]=abs(a[1]-a[2])\n\t\t\tfor i in 2:n-1\n\t\t\t\tv = abs(a[i]-a[i+1])\n\t\t\t\tb[i]=v\n\t\t\t\tif v!=0||bb[l]!=0\n\t\t\t\t\tpush!(bb,v)\n\t\t\t\t\tl+=1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif length(bb)==1\n\t\t\t\tprintln(bb[1])\n\t\t\telseif length(bb)==2\n\t\t\t\tprintln(abs(bb[1]-bb[2]))\n\t\t\telse\n\t\t\t\tc = 0\n\t\t\t\tfor i in 1:n-2\n\t\t\t\t\tv = abs(b[i]-b[i+1])\n\t\t\t\t\tif i==1||i==n-1\n\t\t\t\t\t\tc+=v\n\t\t\t\t\telse\n\t\t\t\t\t\tc+=v*2\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tprintln((c+1)%2)\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 845, "cpu_time_ms": 747, "memory_kb": 185304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s250689498", "group_id": "codeNet:p02741", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]\n println(arr[parseInt(readline())])\nend\nmain()", "language": "Julia", "metadata": {"date": 1584241067, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02741.html", "problem_id": "p02741", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02741/input.txt", "sample_output_relpath": "derived/input_output/data/p02741/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02741/Julia/s250689498.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s250689498", "user_id": "u619197965"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n arr=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]\n println(arr[parseInt(readline())])\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nPrint the K-th element of the following sequence of length 32:\n\n1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51\n\nConstraints\n\n1 \\leq K \\leq 32\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the K-th element.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n2\n\nThe 6-th element is 2.\n\nSample Input 2\n\n27\n\nSample Output 2\n\n5\n\nThe 27-th element is 5.", "sample_input": "6\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02741", "source_text": "Score : 100 points\n\nProblem Statement\n\nPrint the K-th element of the following sequence of length 32:\n\n1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51\n\nConstraints\n\n1 \\leq K \\leq 32\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint the K-th element.\n\nSample Input 1\n\n6\n\nSample Output 1\n\n2\n\nThe 6-th element is 2.\n\nSample Input 2\n\n27\n\nSample Output 2\n\n5\n\nThe 27-th element is 5.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 755, "memory_kb": 164860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s344109797", "group_id": "codeNet:p02742", "input_text": "H,W=map(x->parse(Int,x),split(readline(),\" \"))\n\nif (H==1 || W ==1 ) \n a=1\nelse\n a=div(H*W,2)+mod(H*W,2)\nend\n \nprint(a)", "language": "Julia", "metadata": {"date": 1584235827, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s344109797.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s344109797", "user_id": "u562051766"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "H,W=map(x->parse(Int,x),split(readline(),\" \"))\n\nif (H==1 || W ==1 ) \n a=1\nelse\n a=div(H*W,2)+mod(H*W,2)\nend\n \nprint(a)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1178, "memory_kb": 163848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s581492102", "group_id": "codeNet:p02744", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nN = parseInt(readline())\n\n\nfunction return_all_pettern(x) #bit全探索\n count_pettern = x ^ 2\n b = []\n for i in count_pettern - 1:-1:0\n bit = bin(i, x)\n bits = []\n for j in 1:x\n push!(bits, bit[j])\n end\n bits = [bits .== '1']\n push!(b, bits)\n end\n #println(length(b))\n return b\nend\n\n\nfunction arrayprinter(A)\n for a in A\n print(a)\n end\n println(\"\")\nend\n\nfunction solver(N)\n s = 'a':'x'\n #println(s)\n pettrens = return_all_pettern(N)\n flag = true\n for pettern in pettrens\n #println(pettern)\n h = 1\n ans = []\n if sum(pettern[1]) == 0 || sum(pettern[1]) == 1 \n if flag == true\n arrayprinter(s[1:N])\n flag = false\n end\n else\n a_flag = pettern[1][1] \n push!(ans,'a')\n for j in 2:N\n if a_flag \n if pettern[1][j]\n push!(ans,'a')\n else\n h += 1\n push!(ans,s[h])\n end\n else\n if pettern[1][j]\n push!(ans,'b')\n else\n h += 1\n push!(ans,'b')\n end\n end\n end\n arrayprinter(ans)\n end\n #println(flag)\n end\nend\n\n\nif N == 1\n println(\"a\")\nelseif N == 2\n println(\"aa\")\n println(\"ab\")\nelse\n solver(N)\nend", "language": "Julia", "metadata": {"date": 1584238880, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02744.html", "problem_id": "p02744", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02744/input.txt", "sample_output_relpath": "derived/input_output/data/p02744/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02744/Julia/s581492102.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s581492102", "user_id": "u879294842"}, "prompt_components": {"gold_output": "a\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nN = parseInt(readline())\n\n\nfunction return_all_pettern(x) #bit全探索\n count_pettern = x ^ 2\n b = []\n for i in count_pettern - 1:-1:0\n bit = bin(i, x)\n bits = []\n for j in 1:x\n push!(bits, bit[j])\n end\n bits = [bits .== '1']\n push!(b, bits)\n end\n #println(length(b))\n return b\nend\n\n\nfunction arrayprinter(A)\n for a in A\n print(a)\n end\n println(\"\")\nend\n\nfunction solver(N)\n s = 'a':'x'\n #println(s)\n pettrens = return_all_pettern(N)\n flag = true\n for pettern in pettrens\n #println(pettern)\n h = 1\n ans = []\n if sum(pettern[1]) == 0 || sum(pettern[1]) == 1 \n if flag == true\n arrayprinter(s[1:N])\n flag = false\n end\n else\n a_flag = pettern[1][1] \n push!(ans,'a')\n for j in 2:N\n if a_flag \n if pettern[1][j]\n push!(ans,'a')\n else\n h += 1\n push!(ans,s[h])\n end\n else\n if pettern[1][j]\n push!(ans,'b')\n else\n h += 1\n push!(ans,'b')\n end\n end\n end\n arrayprinter(ans)\n end\n #println(flag)\n end\nend\n\n\nif N == 1\n println(\"a\")\nelseif N == 2\n println(\"aa\")\n println(\"ab\")\nelse\n solver(N)\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\nIn this problem, we only consider strings consisting of lowercase English letters.\n\nStrings s and t are said to be isomorphic when the following conditions are satisfied:\n\n|s| = |t| holds.\n\nFor every pair i, j, one of the following holds:\n\ns_i = s_j and t_i = t_j.\n\ns_i \\neq s_j and t_i \\neq t_j.\n\nFor example, abcac and zyxzx are isomorphic, while abcac and ppppp are not.\n\nA string s is said to be in normal form when the following condition is satisfied:\n\nFor every string t that is isomorphic to s, s \\leq t holds. Here \\leq denotes lexicographic comparison.\n\nFor example, abcac is in normal form, but zyxzx is not since it is isomorphic to abcac, which is lexicographically smaller than zyxzx.\n\nYou are given an integer N.\nPrint all strings of length N that are in normal form, in lexicographically ascending order.\n\nConstraints\n\n1 \\leq N \\leq 10\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\nAssume that there are K strings of length N that are in normal form: w_1, \\ldots, w_K in lexicographical order.\nOutput should be in the following format:\n\nw_1\n:\nw_K\n\nSample Input 1\n\n1\n\nSample Output 1\n\na\n\nSample Input 2\n\n2\n\nSample Output 2\n\naa\nab", "sample_input": "1\n"}, "reference_outputs": ["a\n"], "source_document_id": "p02744", "source_text": "Score : 400 points\n\nProblem Statement\n\nIn this problem, we only consider strings consisting of lowercase English letters.\n\nStrings s and t are said to be isomorphic when the following conditions are satisfied:\n\n|s| = |t| holds.\n\nFor every pair i, j, one of the following holds:\n\ns_i = s_j and t_i = t_j.\n\ns_i \\neq s_j and t_i \\neq t_j.\n\nFor example, abcac and zyxzx are isomorphic, while abcac and ppppp are not.\n\nA string s is said to be in normal form when the following condition is satisfied:\n\nFor every string t that is isomorphic to s, s \\leq t holds. Here \\leq denotes lexicographic comparison.\n\nFor example, abcac is in normal form, but zyxzx is not since it is isomorphic to abcac, which is lexicographically smaller than zyxzx.\n\nYou are given an integer N.\nPrint all strings of length N that are in normal form, in lexicographically ascending order.\n\nConstraints\n\n1 \\leq N \\leq 10\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\nAssume that there are K strings of length N that are in normal form: w_1, \\ldots, w_K in lexicographical order.\nOutput should be in the following format:\n\nw_1\n:\nw_K\n\nSample Input 1\n\n1\n\nSample Output 1\n\na\n\nSample Input 2\n\n2\n\nSample Output 2\n\naa\nab", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1643, "cpu_time_ms": 507, "memory_kb": 115328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s154164262", "group_id": "codeNet:p02747", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=chomp(readline())\n if length(s)%2==1 && \"hi\"^(length(s)÷2)!=s\n println(\"No\")\n else\n println(\"Yes\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1584934580, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02747.html", "problem_id": "p02747", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02747/input.txt", "sample_output_relpath": "derived/input_output/data/p02747/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02747/Julia/s154164262.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s154164262", "user_id": "u619197965"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=chomp(readline())\n if length(s)%2==1 && \"hi\"^(length(s)÷2)!=s\n println(\"No\")\n else\n println(\"Yes\")\n end\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nA Hitachi string is a concatenation of one or more copies of the string hi.\n\nFor example, hi and hihi are Hitachi strings, while ha and hii are not.\n\nGiven a string S, determine whether S is a Hitachi string.\n\nConstraints\n\nThe length of S is between 1 and 10 (inclusive).\n\nS is a string 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 a Hitachi string, print Yes; otherwise, print No.\n\nSample Input 1\n\nhihi\n\nSample Output 1\n\nYes\n\nhihi is the concatenation of two copies of hi, so it is a Hitachi string.\n\nSample Input 2\n\nhi\n\nSample Output 2\n\nYes\n\nSample Input 3\n\nha\n\nSample Output 3\n\nNo", "sample_input": "hihi\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02747", "source_text": "Score : 100 points\n\nProblem Statement\n\nA Hitachi string is a concatenation of one or more copies of the string hi.\n\nFor example, hi and hihi are Hitachi strings, while ha and hii are not.\n\nGiven a string S, determine whether S is a Hitachi string.\n\nConstraints\n\nThe length of S is between 1 and 10 (inclusive).\n\nS is a string 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 a Hitachi string, print Yes; otherwise, print No.\n\nSample Input 1\n\nhihi\n\nSample Output 1\n\nYes\n\nhihi is the concatenation of two copies of hi, so it is a Hitachi string.\n\nSample Input 2\n\nhi\n\nSample Output 2\n\nYes\n\nSample Input 3\n\nha\n\nSample Output 3\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 737, "memory_kb": 163392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s511533221", "group_id": "codeNet:p02748", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n A,B,m=pM(split(readline()))\n a=pM(split(readline()))\n b=pM(split(readline()))\n ans=Int[minimum(a)+minimum(b)]\n for i=1:m\n x,y,c=pM(split(readline()))\n push!(ans,a[x]+b[y]-c)\n end\n println(minimum(ans))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1591754438, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02748.html", "problem_id": "p02748", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02748/input.txt", "sample_output_relpath": "derived/input_output/data/p02748/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02748/Julia/s511533221.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s511533221", "user_id": "u443151804"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n A,B,m=pM(split(readline()))\n a=pM(split(readline()))\n b=pM(split(readline()))\n ans=Int[minimum(a)+minimum(b)]\n for i=1:m\n x,y,c=pM(split(readline()))\n push!(ans,a[x]+b[y]-c)\n end\n println(minimum(ans))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are visiting a large electronics store to buy a refrigerator and a microwave.\n\nThe store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \\le i \\le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \\le j \\le B ) is sold at b_j yen.\n\nYou have M discount tickets. With the i-th ticket ( 1 \\le i \\le M ), you can get a discount of c_i yen from the total price when buying the x_i-th refrigerator and the y_i-th microwave together. Only one ticket can be used at a time.\n\nYou are planning to buy one refrigerator and one microwave. Find the minimum amount of money required.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\le A \\le 10^5\n\n1 \\le B \\le 10^5\n\n1 \\le M \\le 10^5\n\n1 \\le a_i , b_i , c_i \\le 10^5\n\n1 \\le x_i \\le A\n\n1 \\le y_i \\le B\n\nc_i \\le a_{x_i} + b_{y_i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B M\na_1 a_2 ... a_A\nb_1 b_2 ... b_B\nx_1 y_1 c_1\n\\vdots\nx_M y_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 1\n3 3\n3 3 3\n1 2 1\n\nSample Output 1\n\n5\n\nWith the ticket, you can get the 1-st refrigerator and the 2-nd microwave for 3+3-1=5 yen.\n\nSample Input 2\n\n1 1 2\n10\n10\n1 1 5\n1 1 10\n\nSample Output 2\n\n10\n\nNote that you cannot use more than one ticket at a time.\n\nSample Input 3\n\n2 2 1\n3 5\n3 5\n2 2 2\n\nSample Output 3\n\n6\n\nYou can get the 1-st refrigerator and the 1-st microwave for 6 yen, which is the minimum amount to pay in this case.\nNote that using a ticket is optional.", "sample_input": "2 3 1\n3 3\n3 3 3\n1 2 1\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02748", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are visiting a large electronics store to buy a refrigerator and a microwave.\n\nThe store sells A kinds of refrigerators and B kinds of microwaves. The i-th refrigerator ( 1 \\le i \\le A ) is sold at a_i yen (the currency of Japan), and the j-th microwave ( 1 \\le j \\le B ) is sold at b_j yen.\n\nYou have M discount tickets. With the i-th ticket ( 1 \\le i \\le M ), you can get a discount of c_i yen from the total price when buying the x_i-th refrigerator and the y_i-th microwave together. Only one ticket can be used at a time.\n\nYou are planning to buy one refrigerator and one microwave. Find the minimum amount of money required.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\le A \\le 10^5\n\n1 \\le B \\le 10^5\n\n1 \\le M \\le 10^5\n\n1 \\le a_i , b_i , c_i \\le 10^5\n\n1 \\le x_i \\le A\n\n1 \\le y_i \\le B\n\nc_i \\le a_{x_i} + b_{y_i}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B M\na_1 a_2 ... a_A\nb_1 b_2 ... b_B\nx_1 y_1 c_1\n\\vdots\nx_M y_M c_M\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2 3 1\n3 3\n3 3 3\n1 2 1\n\nSample Output 1\n\n5\n\nWith the ticket, you can get the 1-st refrigerator and the 2-nd microwave for 3+3-1=5 yen.\n\nSample Input 2\n\n1 1 2\n10\n10\n1 1 5\n1 1 10\n\nSample Output 2\n\n10\n\nNote that you cannot use more than one ticket at a time.\n\nSample Input 3\n\n2 2 1\n3 5\n3 5\n2 2 2\n\nSample Output 3\n\n6\n\nYou can get the 1-st refrigerator and the 1-st microwave for 6 yen, which is the minimum amount to pay in this case.\nNote that using a ticket is optional.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 438, "cpu_time_ms": 735, "memory_kb": 166676}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s699768268", "group_id": "codeNet:p02749", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\te = [Int[] for i in 1:n]\n\tfor i in 1:n-1\n\t\ta,b = readline() |> split |> parseMap\n\t\tpush!(e[a],b)\n\t\tpush!(e[b],a)\n\tend\n\tchk = -ones(Int,n)\n\tchk[1] = 0\n\tstack = Int[1]\n\twhile !isempty(stack)\n\t\tnow = pop!(stack)\n\t\tfor i in e[now]\n\t\t\tif chk[i] == -1\n\t\t\t\tpush!(stack,i)\n\t\t\t\tchk[i]=(chk[now]+1)%2\n\t\t\tend\n\t\tend\n\tend\n\tans = zeros(Int,n)\n\tz = sum(chk)\n\tsx = 1\n\tsy = 2\n\tsz = 3\n\tif sum(chk)<=div(n,3)\n\t\tfor i in 1:n\n\t\t\tif chk[i]==1\n\t\t\t\tans[i] = sz\n\t\t\t\tsz += 3\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telseif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telseif sum(chk)>2*div(n,3)\n\t\tfor i in 1:n\n\t\t\tif chk[i]==0\n\t\t\t\tans[i] = sz\n\t\t\t\tsz += 3\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telseif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telse\n\t\tfor i in 1:n\n\t\t\tif chk[i]==0\n\t\t\t\tif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:n-1\n\t\tprint(ans[i], \" \")\n\tend\n\tprintln(ans[n])\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1583721791, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02749.html", "problem_id": "p02749", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02749/input.txt", "sample_output_relpath": "derived/input_output/data/p02749/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02749/Julia/s699768268.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s699768268", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1 2 5 4 3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\te = [Int[] for i in 1:n]\n\tfor i in 1:n-1\n\t\ta,b = readline() |> split |> parseMap\n\t\tpush!(e[a],b)\n\t\tpush!(e[b],a)\n\tend\n\tchk = -ones(Int,n)\n\tchk[1] = 0\n\tstack = Int[1]\n\twhile !isempty(stack)\n\t\tnow = pop!(stack)\n\t\tfor i in e[now]\n\t\t\tif chk[i] == -1\n\t\t\t\tpush!(stack,i)\n\t\t\t\tchk[i]=(chk[now]+1)%2\n\t\t\tend\n\t\tend\n\tend\n\tans = zeros(Int,n)\n\tz = sum(chk)\n\tsx = 1\n\tsy = 2\n\tsz = 3\n\tif sum(chk)<=div(n,3)\n\t\tfor i in 1:n\n\t\t\tif chk[i]==1\n\t\t\t\tans[i] = sz\n\t\t\t\tsz += 3\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telseif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telseif sum(chk)>2*div(n,3)\n\t\tfor i in 1:n\n\t\t\tif chk[i]==0\n\t\t\t\tans[i] = sz\n\t\t\t\tsz += 3\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telseif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telse\n\t\tfor i in 1:n\n\t\t\tif chk[i]==0\n\t\t\t\tif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:n-1\n\t\tprint(ans[i], \" \")\n\tend\n\tprintln(ans[n])\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices. The vertices are numbered 1 to N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nTakahashi loves the number 3. He is seeking a permutation p_1, p_2, \\ldots , p_N of integers from 1 to N satisfying the following condition:\n\nFor every pair of vertices (i, j), if the distance between Vertex i and Vertex j is 3, the sum or product of p_i and p_j is a multiple of 3.\n\nHere the distance between Vertex i and Vertex j is the number of edges contained in the shortest path from Vertex i to Vertex j.\n\nHelp Takahashi by finding a permutation that satisfies the condition.\n\nConstraints\n\n2\\leq N\\leq 2\\times 10^5\n\n1\\leq a_i, b_i \\leq N\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\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nIf no permutation satisfies the condition, print -1.\n\nOtherwise, print a permutation satisfying the condition, with space in between.\nIf there are multiple solutions, you can print any of them.\n\nSample Input 1\n\n5\n1 2\n1 3\n3 4\n3 5\n\nSample Output 1\n\n1 2 5 4 3\n\nThe distance between two vertices is 3 for the two pairs (2, 4) and (2, 5).\n\np_2 + p_4 = 6\n\np_2\\times p_5 = 6\n\nThus, this permutation satisfies the condition.", "sample_input": "5\n1 2\n1 3\n3 4\n3 5\n"}, "reference_outputs": ["1 2 5 4 3\n"], "source_document_id": "p02749", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices. The vertices are numbered 1 to N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nTakahashi loves the number 3. He is seeking a permutation p_1, p_2, \\ldots , p_N of integers from 1 to N satisfying the following condition:\n\nFor every pair of vertices (i, j), if the distance between Vertex i and Vertex j is 3, the sum or product of p_i and p_j is a multiple of 3.\n\nHere the distance between Vertex i and Vertex j is the number of edges contained in the shortest path from Vertex i to Vertex j.\n\nHelp Takahashi by finding a permutation that satisfies the condition.\n\nConstraints\n\n2\\leq N\\leq 2\\times 10^5\n\n1\\leq a_i, b_i \\leq N\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\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nIf no permutation satisfies the condition, print -1.\n\nOtherwise, print a permutation satisfying the condition, with space in between.\nIf there are multiple solutions, you can print any of them.\n\nSample Input 1\n\n5\n1 2\n1 3\n3 4\n3 5\n\nSample Output 1\n\n1 2 5 4 3\n\nThe distance between two vertices is 3 for the two pairs (2, 4) and (2, 5).\n\np_2 + p_4 = 6\n\np_2\\times p_5 = 6\n\nThus, this permutation satisfies the condition.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1156, "memory_kb": 174648}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s126026062", "group_id": "codeNet:p02749", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\te = [Int[] for i in 1:n]\n\tfor i in 1:n-1\n\t\ta,b = readline() |> split |> parseMap\n\t\tpush!(e[a],b)\n\t\tpush!(e[b],a)\n\tend\n\tchk = -ones(Int,n)\n\tchk[1] = 0\n\tstack = Int[1]\n\twhile !isempty(stack)\n\t\tnow = pop!(stack)\n\t\tfor i in e[now]\n\t\t\tif chk[i] == -1\n\t\t\t\tpush!(stack,i)\n\t\t\t\tchk[i]=(chk[now]+1)%2\n\t\t\tend\n\t\tend\n\tend\n\tans = zeros(Int,n)\n\tz = sum(chk)\n\tsx = 1\n\tsy = 2\n\tsz = 3\n\tif sum(chk)<=div(n,3)\n\t\tfor i in 1:n\n\t\t\tif chk[i]==1\n\t\t\t\tans[i] = sz\n\t\t\t\tsz += 3\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telseif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telseif sum(chk)>=div(n,3)\n\t\tfor i in 1:n\n\t\t\tif chk[i]==0\n\t\t\t\tans[i] = sz\n\t\t\t\tsz += 3\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telseif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telse\n\t\tfor i in 1:n\n\t\t\tif chk[i]==0\n\t\t\t\tif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:n-1\n\t\tprint(ans[i], \" \")\n\tend\n\tprintln(ans[n])\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1583721670, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02749.html", "problem_id": "p02749", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02749/input.txt", "sample_output_relpath": "derived/input_output/data/p02749/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02749/Julia/s126026062.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s126026062", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1 2 5 4 3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\te = [Int[] for i in 1:n]\n\tfor i in 1:n-1\n\t\ta,b = readline() |> split |> parseMap\n\t\tpush!(e[a],b)\n\t\tpush!(e[b],a)\n\tend\n\tchk = -ones(Int,n)\n\tchk[1] = 0\n\tstack = Int[1]\n\twhile !isempty(stack)\n\t\tnow = pop!(stack)\n\t\tfor i in e[now]\n\t\t\tif chk[i] == -1\n\t\t\t\tpush!(stack,i)\n\t\t\t\tchk[i]=(chk[now]+1)%2\n\t\t\tend\n\t\tend\n\tend\n\tans = zeros(Int,n)\n\tz = sum(chk)\n\tsx = 1\n\tsy = 2\n\tsz = 3\n\tif sum(chk)<=div(n,3)\n\t\tfor i in 1:n\n\t\t\tif chk[i]==1\n\t\t\t\tans[i] = sz\n\t\t\t\tsz += 3\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telseif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telseif sum(chk)>=div(n,3)\n\t\tfor i in 1:n\n\t\t\tif chk[i]==0\n\t\t\t\tans[i] = sz\n\t\t\t\tsz += 3\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telseif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telse\n\t\tfor i in 1:n\n\t\t\tif chk[i]==0\n\t\t\t\tif sx<=n\n\t\t\t\t\tans[i] = sx\n\t\t\t\t\tsx += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif sy<=n\n\t\t\t\t\tans[i] = sy\n\t\t\t\t\tsy += 3\n\t\t\t\telse\n\t\t\t\t\tans[i] = sz\n\t\t\t\t\tsz += 3\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:n-1\n\t\tprint(ans[i], \" \")\n\tend\n\tprintln(ans[n])\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices. The vertices are numbered 1 to N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nTakahashi loves the number 3. He is seeking a permutation p_1, p_2, \\ldots , p_N of integers from 1 to N satisfying the following condition:\n\nFor every pair of vertices (i, j), if the distance between Vertex i and Vertex j is 3, the sum or product of p_i and p_j is a multiple of 3.\n\nHere the distance between Vertex i and Vertex j is the number of edges contained in the shortest path from Vertex i to Vertex j.\n\nHelp Takahashi by finding a permutation that satisfies the condition.\n\nConstraints\n\n2\\leq N\\leq 2\\times 10^5\n\n1\\leq a_i, b_i \\leq N\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\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nIf no permutation satisfies the condition, print -1.\n\nOtherwise, print a permutation satisfying the condition, with space in between.\nIf there are multiple solutions, you can print any of them.\n\nSample Input 1\n\n5\n1 2\n1 3\n3 4\n3 5\n\nSample Output 1\n\n1 2 5 4 3\n\nThe distance between two vertices is 3 for the two pairs (2, 4) and (2, 5).\n\np_2 + p_4 = 6\n\np_2\\times p_5 = 6\n\nThus, this permutation satisfies the condition.", "sample_input": "5\n1 2\n1 3\n3 4\n3 5\n"}, "reference_outputs": ["1 2 5 4 3\n"], "source_document_id": "p02749", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices. The vertices are numbered 1 to N, and the i-th edge connects Vertex a_i and Vertex b_i.\n\nTakahashi loves the number 3. He is seeking a permutation p_1, p_2, \\ldots , p_N of integers from 1 to N satisfying the following condition:\n\nFor every pair of vertices (i, j), if the distance between Vertex i and Vertex j is 3, the sum or product of p_i and p_j is a multiple of 3.\n\nHere the distance between Vertex i and Vertex j is the number of edges contained in the shortest path from Vertex i to Vertex j.\n\nHelp Takahashi by finding a permutation that satisfies the condition.\n\nConstraints\n\n2\\leq N\\leq 2\\times 10^5\n\n1\\leq a_i, b_i \\leq N\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\na_2 b_2\n\\vdots\na_{N-1} b_{N-1}\n\nOutput\n\nIf no permutation satisfies the condition, print -1.\n\nOtherwise, print a permutation satisfying the condition, with space in between.\nIf there are multiple solutions, you can print any of them.\n\nSample Input 1\n\n5\n1 2\n1 3\n3 4\n3 5\n\nSample Output 1\n\n1 2 5 4 3\n\nThe distance between two vertices is 3 for the two pairs (2, 4) and (2, 5).\n\np_2 + p_4 = 6\n\np_2\\times p_5 = 6\n\nThus, this permutation satisfies the condition.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1297, "cpu_time_ms": 1159, "memory_kb": 173612}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s030196416", "group_id": "codeNet:p02753", "input_text": "s=readline()\nprint(s==\"AAA\"||s==\"BBB\"?\"Yes\":\"No\")", "language": "Julia", "metadata": {"date": 1585067270, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s030196416.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s030196416", "user_id": "u443151804"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s=readline()\nprint(s==\"AAA\"||s==\"BBB\"?\"Yes\":\"No\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 49, "cpu_time_ms": 261, "memory_kb": 108156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s332283304", "group_id": "codeNet:p02754", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,a,b=parseMap(split(readline()))\n println(div(n,(a+b))+min(n%(a+b),a))\nend\nmain()", "language": "Julia", "metadata": {"date": 1583648155, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s332283304.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s332283304", "user_id": "u619197965"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,a,b=parseMap(split(readline()))\n println(div(n,(a+b))+min(n%(a+b),a))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 375, "memory_kb": 113328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s052011614", "group_id": "codeNet:p02755", "input_text": "a, b = map(x -> parse(Int64, x), split(readline()))\nfor x = 0:10000\n if floor(.08x) == a && floor(.1x) == b\n println(x)\n exit()\n end\nend\nprintln(-1)\n", "language": "Julia", "metadata": {"date": 1584822961, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s052011614.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s052011614", "user_id": "u161323909"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "a, b = map(x -> parse(Int64, x), split(readline()))\nfor x = 0:10000\n if floor(.08x) == a && floor(.1x) == b\n println(x)\n exit()\n end\nend\nprintln(-1)\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 386, "memory_kb": 112416}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s924662938", "group_id": "codeNet:p02756", "input_text": "parseline(str=readline()) = parse.(Int, split(str))\nfunction StringFormation()\n S = readline()\n Q = parseline()\n queries = split.(readlines())\n inverse = false\n ans = [S]\n for q in queries\n l = length(q)\n l≡0 && continue\n if l≡1\n inverse = !inverse\n else\n head = q[2]==\"1\" ? true : false\n head = inverse ? !head : head\n head ? pushfirst!(ans, q[3]) : push!(ans, q[3])\n end\n end\n ret = prod(ans)\n println(inverse ? ret[end:-1:1] : ret)\nend\nStringFormation()", "language": "Julia", "metadata": {"date": 1599601174, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02756.html", "problem_id": "p02756", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02756/input.txt", "sample_output_relpath": "derived/input_output/data/p02756/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02756/Julia/s924662938.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s924662938", "user_id": "u728564399"}, "prompt_components": {"gold_output": "cpa\n", "input_to_evaluate": "parseline(str=readline()) = parse.(Int, split(str))\nfunction StringFormation()\n S = readline()\n Q = parseline()\n queries = split.(readlines())\n inverse = false\n ans = [S]\n for q in queries\n l = length(q)\n l≡0 && continue\n if l≡1\n inverse = !inverse\n else\n head = q[2]==\"1\" ? true : false\n head = inverse ? !head : head\n head ? pushfirst!(ans, q[3]) : push!(ans, q[3])\n end\n end\n ret = prod(ans)\n println(inverse ? ret[end:-1:1] : ret)\nend\nStringFormation()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a string S consisting of lowercase English letters.\n\nStarting with this string, he will produce a new one in the procedure given as follows.\n\nThe procedure consists of Q operations. In Operation i (1 \\leq i \\leq Q), an integer T_i is provided, which means the following:\n\nIf T_i = 1: reverse the string S.\n\nIf T_i = 2: An integer F_i and a lowercase English letter C_i are additionally provided.\n\nIf F_i = 1 : Add C_i to the beginning of the string S.\n\nIf F_i = 2 : Add C_i to the end of the string S.\n\nHelp Takahashi by finding the final string that results from the procedure.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of lowercase English letters.\n\n1 \\leq Q \\leq 2 \\times 10^5\n\nT_i = 1 or 2.\n\nF_i = 1 or 2, if provided.\n\nC_i is a lowercase English letter, if provided.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nQ\nQuery_1\n:\nQuery_Q\n\nIn the 3-rd through the (Q+2)-th lines, Query_i is one of the following:\n\n1\n\nwhich means T_i = 1, and:\n\n2 F_i C_i\n\nwhich means T_i = 2.\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\na\n4\n2 1 p\n1\n2 2 c\n1\n\nSample Output 1\n\ncpa\n\nThere will be Q = 4 operations. Initially, S is a.\n\nOperation 1: Add p at the beginning of S. S becomes pa.\n\nOperation 2: Reverse S. S becomes ap.\n\nOperation 3: Add c at the end of S. S becomes apc.\n\nOperation 4: Reverse S. S becomes cpa.\n\nThus, the resulting string is cpa.\n\nSample Input 2\n\na\n6\n2 2 a\n2 1 b\n1\n2 2 c\n1\n1\n\nSample Output 2\n\naabc\n\nThere will be Q = 6 operations. Initially, S is a.\n\nOperation 1: S becomes aa.\n\nOperation 2: S becomes baa.\n\nOperation 3: S becomes aab.\n\nOperation 4: S becomes aabc.\n\nOperation 5: S becomes cbaa.\n\nOperation 6: S becomes aabc.\n\nThus, the resulting string is aabc.\n\nSample Input 3\n\ny\n1\n2 1 x\n\nSample Output 3\n\nxy", "sample_input": "a\n4\n2 1 p\n1\n2 2 c\n1\n"}, "reference_outputs": ["cpa\n"], "source_document_id": "p02756", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a string S consisting of lowercase English letters.\n\nStarting with this string, he will produce a new one in the procedure given as follows.\n\nThe procedure consists of Q operations. In Operation i (1 \\leq i \\leq Q), an integer T_i is provided, which means the following:\n\nIf T_i = 1: reverse the string S.\n\nIf T_i = 2: An integer F_i and a lowercase English letter C_i are additionally provided.\n\nIf F_i = 1 : Add C_i to the beginning of the string S.\n\nIf F_i = 2 : Add C_i to the end of the string S.\n\nHelp Takahashi by finding the final string that results from the procedure.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of lowercase English letters.\n\n1 \\leq Q \\leq 2 \\times 10^5\n\nT_i = 1 or 2.\n\nF_i = 1 or 2, if provided.\n\nC_i is a lowercase English letter, if provided.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nQ\nQuery_1\n:\nQuery_Q\n\nIn the 3-rd through the (Q+2)-th lines, Query_i is one of the following:\n\n1\n\nwhich means T_i = 1, and:\n\n2 F_i C_i\n\nwhich means T_i = 2.\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\na\n4\n2 1 p\n1\n2 2 c\n1\n\nSample Output 1\n\ncpa\n\nThere will be Q = 4 operations. Initially, S is a.\n\nOperation 1: Add p at the beginning of S. S becomes pa.\n\nOperation 2: Reverse S. S becomes ap.\n\nOperation 3: Add c at the end of S. S becomes apc.\n\nOperation 4: Reverse S. S becomes cpa.\n\nThus, the resulting string is cpa.\n\nSample Input 2\n\na\n6\n2 2 a\n2 1 b\n1\n2 2 c\n1\n1\n\nSample Output 2\n\naabc\n\nThere will be Q = 6 operations. Initially, S is a.\n\nOperation 1: S becomes aa.\n\nOperation 2: S becomes baa.\n\nOperation 3: S becomes aab.\n\nOperation 4: S becomes aabc.\n\nOperation 5: S becomes cbaa.\n\nOperation 6: S becomes aabc.\n\nThus, the resulting string is aabc.\n\nSample Input 3\n\ny\n1\n2 1 x\n\nSample Output 3\n\nxy", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 566, "cpu_time_ms": 821, "memory_kb": 328896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s711819835", "group_id": "codeNet:p02756", "input_text": "parseline(str=readline()) = parse.(Int, split(str))\nfunction StringFormation()\n S = readline()\n Q = parseline()\n queries = split.(readlines())\n inverse = false\n ans = [s]\n for q in queries\n l = length(q)\n l≡0 && continue\n if l≡1\n inverse = !inverse\n else\n head = q[2]==\"1\" ? true : false\n head = inverse ? !head : head\n head ? pushfirst!(S, q[3]) : push!(S, q[3])\n end\n end\n println(prod(inverse ? ans[end:-1:1] : ans))\nend\nStringFormation()", "language": "Julia", "metadata": {"date": 1599601026, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02756.html", "problem_id": "p02756", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02756/input.txt", "sample_output_relpath": "derived/input_output/data/p02756/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02756/Julia/s711819835.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s711819835", "user_id": "u728564399"}, "prompt_components": {"gold_output": "cpa\n", "input_to_evaluate": "parseline(str=readline()) = parse.(Int, split(str))\nfunction StringFormation()\n S = readline()\n Q = parseline()\n queries = split.(readlines())\n inverse = false\n ans = [s]\n for q in queries\n l = length(q)\n l≡0 && continue\n if l≡1\n inverse = !inverse\n else\n head = q[2]==\"1\" ? true : false\n head = inverse ? !head : head\n head ? pushfirst!(S, q[3]) : push!(S, q[3])\n end\n end\n println(prod(inverse ? ans[end:-1:1] : ans))\nend\nStringFormation()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a string S consisting of lowercase English letters.\n\nStarting with this string, he will produce a new one in the procedure given as follows.\n\nThe procedure consists of Q operations. In Operation i (1 \\leq i \\leq Q), an integer T_i is provided, which means the following:\n\nIf T_i = 1: reverse the string S.\n\nIf T_i = 2: An integer F_i and a lowercase English letter C_i are additionally provided.\n\nIf F_i = 1 : Add C_i to the beginning of the string S.\n\nIf F_i = 2 : Add C_i to the end of the string S.\n\nHelp Takahashi by finding the final string that results from the procedure.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of lowercase English letters.\n\n1 \\leq Q \\leq 2 \\times 10^5\n\nT_i = 1 or 2.\n\nF_i = 1 or 2, if provided.\n\nC_i is a lowercase English letter, if provided.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nQ\nQuery_1\n:\nQuery_Q\n\nIn the 3-rd through the (Q+2)-th lines, Query_i is one of the following:\n\n1\n\nwhich means T_i = 1, and:\n\n2 F_i C_i\n\nwhich means T_i = 2.\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\na\n4\n2 1 p\n1\n2 2 c\n1\n\nSample Output 1\n\ncpa\n\nThere will be Q = 4 operations. Initially, S is a.\n\nOperation 1: Add p at the beginning of S. S becomes pa.\n\nOperation 2: Reverse S. S becomes ap.\n\nOperation 3: Add c at the end of S. S becomes apc.\n\nOperation 4: Reverse S. S becomes cpa.\n\nThus, the resulting string is cpa.\n\nSample Input 2\n\na\n6\n2 2 a\n2 1 b\n1\n2 2 c\n1\n1\n\nSample Output 2\n\naabc\n\nThere will be Q = 6 operations. Initially, S is a.\n\nOperation 1: S becomes aa.\n\nOperation 2: S becomes baa.\n\nOperation 3: S becomes aab.\n\nOperation 4: S becomes aabc.\n\nOperation 5: S becomes cbaa.\n\nOperation 6: S becomes aabc.\n\nThus, the resulting string is aabc.\n\nSample Input 3\n\ny\n1\n2 1 x\n\nSample Output 3\n\nxy", "sample_input": "a\n4\n2 1 p\n1\n2 2 c\n1\n"}, "reference_outputs": ["cpa\n"], "source_document_id": "p02756", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has a string S consisting of lowercase English letters.\n\nStarting with this string, he will produce a new one in the procedure given as follows.\n\nThe procedure consists of Q operations. In Operation i (1 \\leq i \\leq Q), an integer T_i is provided, which means the following:\n\nIf T_i = 1: reverse the string S.\n\nIf T_i = 2: An integer F_i and a lowercase English letter C_i are additionally provided.\n\nIf F_i = 1 : Add C_i to the beginning of the string S.\n\nIf F_i = 2 : Add C_i to the end of the string S.\n\nHelp Takahashi by finding the final string that results from the procedure.\n\nConstraints\n\n1 \\leq |S| \\leq 10^5\n\nS consists of lowercase English letters.\n\n1 \\leq Q \\leq 2 \\times 10^5\n\nT_i = 1 or 2.\n\nF_i = 1 or 2, if provided.\n\nC_i is a lowercase English letter, if provided.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\nQ\nQuery_1\n:\nQuery_Q\n\nIn the 3-rd through the (Q+2)-th lines, Query_i is one of the following:\n\n1\n\nwhich means T_i = 1, and:\n\n2 F_i C_i\n\nwhich means T_i = 2.\n\nOutput\n\nPrint the resulting string.\n\nSample Input 1\n\na\n4\n2 1 p\n1\n2 2 c\n1\n\nSample Output 1\n\ncpa\n\nThere will be Q = 4 operations. Initially, S is a.\n\nOperation 1: Add p at the beginning of S. S becomes pa.\n\nOperation 2: Reverse S. S becomes ap.\n\nOperation 3: Add c at the end of S. S becomes apc.\n\nOperation 4: Reverse S. S becomes cpa.\n\nThus, the resulting string is cpa.\n\nSample Input 2\n\na\n6\n2 2 a\n2 1 b\n1\n2 2 c\n1\n1\n\nSample Output 2\n\naabc\n\nThere will be Q = 6 operations. Initially, S is a.\n\nOperation 1: S becomes aa.\n\nOperation 2: S becomes baa.\n\nOperation 3: S becomes aab.\n\nOperation 4: S becomes aabc.\n\nOperation 5: S becomes cbaa.\n\nOperation 6: S becomes aabc.\n\nThus, the resulting string is aabc.\n\nSample Input 3\n\ny\n1\n2 1 x\n\nSample Output 3\n\nxy", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1577, "memory_kb": 349332}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s528470661", "group_id": "codeNet:p02759", "input_text": "n = parse(Int64, readline())\nprintln(div(n + 1, 2))", "language": "Julia", "metadata": {"date": 1583210889, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s528470661.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s528470661", "user_id": "u962609087"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = parse(Int64, readline())\nprintln(div(n + 1, 2))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 51, "cpu_time_ms": 289, "memory_kb": 108284}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s910230003", "group_id": "codeNet:p02760", "input_text": "A=Int[]\nfor _=1:3\n\tfor a=parse.(split(readline()))\n\t\tpush!(A,a)\n\tend\nend\nok=zeros(Int,9)\nfor _=1:parse(readline())\n\tb=parse(readline())\n\tfor i=1:9\n\t\tif A[i]==b\n\t\t\tok[i]=1\n\t\tend\n\tend\nend\nprintln(ok[1]*ok[2]*ok[3]+ok[4]*ok[5]*ok[6]+ok[7]*ok[8]*ok[9]+ok[1]*ok[4]*ok[7]+ok[2]*ok[5]*ok[8]+ok[3]*ok[6]*ok[9]+ok[1]*ok[5]*ok[9]+ok[3]*ok[5]*ok[7]>0 ? \"Yes\" : \"No\")\n", "language": "Julia", "metadata": {"date": 1583131103, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s910230003.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s910230003", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "A=Int[]\nfor _=1:3\n\tfor a=parse.(split(readline()))\n\t\tpush!(A,a)\n\tend\nend\nok=zeros(Int,9)\nfor _=1:parse(readline())\n\tb=parse(readline())\n\tfor i=1:9\n\t\tif A[i]==b\n\t\t\tok[i]=1\n\t\tend\n\tend\nend\nprintln(ok[1]*ok[2]*ok[3]+ok[4]*ok[5]*ok[6]+ok[7]*ok[8]*ok[9]+ok[1]*ok[4]*ok[7]+ok[2]*ok[5]*ok[8]+ok[3]*ok[6]*ok[9]+ok[1]*ok[5]*ok[9]+ok[3]*ok[5]*ok[7]>0 ? \"Yes\" : \"No\")\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1021, "memory_kb": 177152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s734885840", "group_id": "codeNet:p02760", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ta = zeros(Int,3,3)\n\tfor i in 1:3\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tchk = zeros(Int,3,3)\n\tf = 0\n\tn = readline() |> parseInt\n\tfor i in 1:n\n\t\tb = readline() |> parseInt\n\t\tfor i in 1:3\n\t\t\tfor j in 1:3\n\t\t\t\tif a[i,j] == b\n\t\t\t\t\tchk[i,j] = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:3\n\t\tif sum(chk[i,:])==3\n\t\t\tf = 1\n\t\tend\n\t\tif sum(chk[:,i])==3\n\t\t\tf = 1\n\t\tend\n\tend\n\tif chk[1,1]+chk[2,2]+chk[3,3]==3\n\t\tf = 1\n\tend\n\tif chk[3,1]+chk[2,2]+chk[1,3]==3\n\t\tf = 1\n\tend\n\tprintln(f==1?\"Yes\":\"No\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1583116980, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s734885840.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s734885840", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ta = zeros(Int,3,3)\n\tfor i in 1:3\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tchk = zeros(Int,3,3)\n\tf = 0\n\tn = readline() |> parseInt\n\tfor i in 1:n\n\t\tb = readline() |> parseInt\n\t\tfor i in 1:3\n\t\t\tfor j in 1:3\n\t\t\t\tif a[i,j] == b\n\t\t\t\t\tchk[i,j] = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:3\n\t\tif sum(chk[i,:])==3\n\t\t\tf = 1\n\t\tend\n\t\tif sum(chk[:,i])==3\n\t\t\tf = 1\n\t\tend\n\tend\n\tif chk[1,1]+chk[2,2]+chk[3,3]==3\n\t\tf = 1\n\tend\n\tif chk[3,1]+chk[2,2]+chk[1,3]==3\n\t\tf = 1\n\tend\n\tprintln(f==1?\"Yes\":\"No\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 949, "memory_kb": 173224}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s319372231", "group_id": "codeNet:p02762", "input_text": "N,M,K=map(x->parse(Int64,x),split(readline()))\n\nYuko=zeros(Bool,N,N)\nBlock=zeros(Bool,N,N)\n\nfor i in 1:M\n A,B=map(x->parse(Int64,x),split(readline()))\n Yuko[A,B]=true\n Yuko[B,A]=true\nend\nfor i in 1:K\n A,B=map(x->parse(Int64,x),split(readline()))\n Block[A,B]=true\n Block[B,A]=true\nend\na2a(V1,V2)= [(V1[i] || V2[i]) for i in 1:length(V1)]\nTomo=copy(Yuko)\nfor i in 1:N\n tmp=copy(Tomo[i,:])\n flag=true\n while flag\n for j in 1:N\n if Tomo[i,j]==true\n #println(\"add\",i,\",\",j)\n #Tomo[i,:]+=Tomo[j,:]\n Tomo[i,:]=a2a(Tomo[i,:],Tomo[j,:])\n end\n end\n if tmp == Tomo[i,:]\n flag=false\n end\n tmp=copy(Tomo[i,:])\n end\nend\n\ncTomo=zeros(Int,N)\nfor i in 1:N ,j in 1:N\n if (Tomo[i,j] && (!Yuko[i,j] && !Block[i,j]))\n i!=j && (cTomo[i]+=1)\n end\nend\n\nprint(cTomo[1])\nfor i in 2:N\n print(\" \",cTomo[i])\nend\n", "language": "Julia", "metadata": {"date": 1583465020, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02762.html", "problem_id": "p02762", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02762/input.txt", "sample_output_relpath": "derived/input_output/data/p02762/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02762/Julia/s319372231.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s319372231", "user_id": "u562051766"}, "prompt_components": {"gold_output": "0 1 0 1\n", "input_to_evaluate": "N,M,K=map(x->parse(Int64,x),split(readline()))\n\nYuko=zeros(Bool,N,N)\nBlock=zeros(Bool,N,N)\n\nfor i in 1:M\n A,B=map(x->parse(Int64,x),split(readline()))\n Yuko[A,B]=true\n Yuko[B,A]=true\nend\nfor i in 1:K\n A,B=map(x->parse(Int64,x),split(readline()))\n Block[A,B]=true\n Block[B,A]=true\nend\na2a(V1,V2)= [(V1[i] || V2[i]) for i in 1:length(V1)]\nTomo=copy(Yuko)\nfor i in 1:N\n tmp=copy(Tomo[i,:])\n flag=true\n while flag\n for j in 1:N\n if Tomo[i,j]==true\n #println(\"add\",i,\",\",j)\n #Tomo[i,:]+=Tomo[j,:]\n Tomo[i,:]=a2a(Tomo[i,:],Tomo[j,:])\n end\n end\n if tmp == Tomo[i,:]\n flag=false\n end\n tmp=copy(Tomo[i,:])\n end\nend\n\ncTomo=zeros(Int,N)\nfor i in 1:N ,j in 1:N\n if (Tomo[i,j] && (!Yuko[i,j] && !Block[i,j]))\n i!=j && (cTomo[i]+=1)\n end\nend\n\nprint(cTomo[1])\nfor i in 2:N\n print(\" \",cTomo[i])\nend\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "sample_input": "4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n"}, "reference_outputs": ["0 1 0 1\n"], "source_document_id": "p02762", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 946, "cpu_time_ms": 2130, "memory_kb": 164288}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s719791437", "group_id": "codeNet:p02762", "input_text": "type UF\n\tn::Int\n\tpr::Array{Int}\n\tsz::Array{Int}\n\tUF(n)=new(n,1:n,ones(Int,n))\nend\nfunction find(uf::UF,a::Int)\n\tif uf.pr[a]==a\n\t\ta\n\telse\n\t\tuf.pr[a]=find(uf,uf.pr[a])\n\tend\nend\nsame(uf::UF,a::Int,b::Int)=find(uf,a)==find(uf,b)\nfunction unite(uf::UF,a::Int,b::Int)\n\tap=find(uf,a)\n\tbp=find(uf,b)\n\tif ap==bp\n\t\tfalse\n\telse\n\t\tif uf.sz[ap]parse(Int,x),split(readline()))\n\tuf=UF(N)\n\tG=[Int[] for _=1:N]\n\tfor _=1:M\n\t\ta,b=map(x->parse(Int,x),split(readline()))\n\t\tpush!(G[a],b)\n\t\tpush!(G[b],a)\n\t\tunite(uf,a,b)\n\tend\n\tfor _=1:K\n\t\ta,b=map(x->parse(Int,x),split(readline()))\n\t\tpush!(G[a],b)\n\t\tpush!(G[b],a)\n\tend\n\tfor i=1:N\n\t\tans=size(uf,i)\n\t\tfor v=G[i]\n\t\t\tif same(uf,i,v)\n\t\t\t\tans-=1\n\t\t\tend\n\t\tend\n\t\tprintln(ans-1)\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1583131465, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02762.html", "problem_id": "p02762", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02762/input.txt", "sample_output_relpath": "derived/input_output/data/p02762/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02762/Julia/s719791437.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s719791437", "user_id": "u657913472"}, "prompt_components": {"gold_output": "0 1 0 1\n", "input_to_evaluate": "type UF\n\tn::Int\n\tpr::Array{Int}\n\tsz::Array{Int}\n\tUF(n)=new(n,1:n,ones(Int,n))\nend\nfunction find(uf::UF,a::Int)\n\tif uf.pr[a]==a\n\t\ta\n\telse\n\t\tuf.pr[a]=find(uf,uf.pr[a])\n\tend\nend\nsame(uf::UF,a::Int,b::Int)=find(uf,a)==find(uf,b)\nfunction unite(uf::UF,a::Int,b::Int)\n\tap=find(uf,a)\n\tbp=find(uf,b)\n\tif ap==bp\n\t\tfalse\n\telse\n\t\tif uf.sz[ap]parse(Int,x),split(readline()))\n\tuf=UF(N)\n\tG=[Int[] for _=1:N]\n\tfor _=1:M\n\t\ta,b=map(x->parse(Int,x),split(readline()))\n\t\tpush!(G[a],b)\n\t\tpush!(G[b],a)\n\t\tunite(uf,a,b)\n\tend\n\tfor _=1:K\n\t\ta,b=map(x->parse(Int,x),split(readline()))\n\t\tpush!(G[a],b)\n\t\tpush!(G[b],a)\n\tend\n\tfor i=1:N\n\t\tans=size(uf,i)\n\t\tfor v=G[i]\n\t\t\tif same(uf,i,v)\n\t\t\t\tans-=1\n\t\t\tend\n\t\tend\n\t\tprintln(ans-1)\n\tend\nend\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "sample_input": "4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n"}, "reference_outputs": ["0 1 0 1\n"], "source_document_id": "p02762", "source_text": "Score : 400 points\n\nProblem Statement\n\nAn SNS has N users - User 1, User 2, \\cdots, User N.\n\nBetween these N users, there are some relationships - M friendships and K blockships.\n\nFor each i = 1, 2, \\cdots, M, there is a bidirectional friendship between User A_i and User B_i.\n\nFor each i = 1, 2, \\cdots, K, there is a bidirectional blockship between User C_i and User D_i.\n\nWe define User a to be a friend candidate for User b when all of the following four conditions are satisfied:\n\na \\neq b.\n\nThere is not a friendship between User a and User b.\n\nThere is not a blockship between User a and User b.\n\nThere exists a sequence c_0, c_1, c_2, \\cdots, c_L consisting of integers between 1 and N (inclusive) such that c_0 = a, c_L = b, and there is a friendship between User c_i and c_{i+1} for each i = 0, 1, \\cdots, L - 1.\n\nFor each user i = 1, 2, ... N, how many friend candidates does it have?\n\nConstraints\n\nAll values in input are integers.\n\n2 ≤ N ≤ 10^5\n\n0 \\leq M \\leq 10^5\n\n0 \\leq K \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n1 \\leq C_i, D_i \\leq N\n\nC_i \\neq D_i\n\n(A_i, B_i) \\neq (A_j, B_j) (i \\neq j)\n\n(A_i, B_i) \\neq (B_j, A_j)\n\n(C_i, D_i) \\neq (C_j, D_j) (i \\neq j)\n\n(C_i, D_i) \\neq (D_j, C_j)\n\n(A_i, B_i) \\neq (C_j, D_j)\n\n(A_i, B_i) \\neq (D_j, C_j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\nA_1 B_1\n\\vdots\nA_M B_M\nC_1 D_1\n\\vdots\nC_K D_K\n\nOutput\n\nPrint the answers in order, with space in between.\n\nSample Input 1\n\n4 4 1\n2 1\n1 3\n3 2\n3 4\n4 1\n\nSample Output 1\n\n0 1 0 1\n\nThere is a friendship between User 2 and 3, and between 3 and 4. Also, there is no friendship or blockship between User 2 and 4. Thus, User 4 is a friend candidate for User 2.\n\nHowever, neither User 1 or 3 is a friend candidate for User 2, so User 2 has one friend candidate.\n\nSample Input 2\n\n5 10 0\n1 2\n1 3\n1 4\n1 5\n3 2\n2 4\n2 5\n4 3\n5 3\n4 5\n\nSample Output 2\n\n0 0 0 0 0\n\nEveryone is a friend of everyone else and has no friend candidate.\n\nSample Input 3\n\n10 9 3\n10 1\n6 7\n8 2\n2 5\n8 4\n7 3\n10 9\n6 4\n5 8\n2 6\n7 5\n3 1\n\nSample Output 3\n\n1 3 5 4 3 3 3 3 1 0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 901, "cpu_time_ms": 2113, "memory_kb": 171252}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s385766474", "group_id": "codeNet:p02764", "input_text": "const N,K=map(x->parse(Int,x),split(readline()))\nconst X=Float64[]\nconst Y=Float64[]\nconst C=Float64[]\nfor _=1:N\n\tx,y,c=map(x->parse(Float64,x),split(readline()))\n\tpush!(X,x)\n\tpush!(Y,y)\n\tpush!(C,c)\nend\nfunction check(M)\n\tA=Pair{Float64,Float64}[]\n\tfor i=1:N\n\t\tpush!(A,X[i]=>Y[i])\n\tend\n\tr=[M/c for c=C]\n\tfor i=1:N,j=i+1:N\n\t\td=sqrt((X[i]-X[j])^2+(Y[i]-Y[j])^2)\n\t\tri=r[i]\n\t\trj=r[j]\n\t\tif dY[i]+ri*sin(t+a))\n\t\tpush!(A,X[i]+ri*cos(t-a)=>Y[i]+ri*sin(t-a))\n\tend\n\tret=false;\n\tfor (x,y)=A\n\t\tcnt=0\n\t\tfor i=1:N\n\t\t\tif sqrt((X[i]-x)^2+(Y[i]-y)^2)<=r[i]+1e-10\n\t\t\t\tcnt+=1\n\t\t\tend\n\t\tend\n\t\tif cnt>=K\n\t\t\tret=true\n\t\tend\n\tend\n\tret\nend\nfunction main()\n\tL=0\n\tR=1e9\n\tfor _=1:100\n\t\tM=(L+R)/2\n\t\tif check(M)\n\t\t\tR=M\n\t\telse\n\t\t\tL=M\n\t\tend\n\tend\n\tprintln(R)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1583138636, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02764.html", "problem_id": "p02764", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02764/input.txt", "sample_output_relpath": "derived/input_output/data/p02764/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02764/Julia/s385766474.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s385766474", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2.4\n", "input_to_evaluate": "const N,K=map(x->parse(Int,x),split(readline()))\nconst X=Float64[]\nconst Y=Float64[]\nconst C=Float64[]\nfor _=1:N\n\tx,y,c=map(x->parse(Float64,x),split(readline()))\n\tpush!(X,x)\n\tpush!(Y,y)\n\tpush!(C,c)\nend\nfunction check(M)\n\tA=Pair{Float64,Float64}[]\n\tfor i=1:N\n\t\tpush!(A,X[i]=>Y[i])\n\tend\n\tr=[M/c for c=C]\n\tfor i=1:N,j=i+1:N\n\t\td=sqrt((X[i]-X[j])^2+(Y[i]-Y[j])^2)\n\t\tri=r[i]\n\t\trj=r[j]\n\t\tif dY[i]+ri*sin(t+a))\n\t\tpush!(A,X[i]+ri*cos(t-a)=>Y[i]+ri*sin(t-a))\n\tend\n\tret=false;\n\tfor (x,y)=A\n\t\tcnt=0\n\t\tfor i=1:N\n\t\t\tif sqrt((X[i]-x)^2+(Y[i]-y)^2)<=r[i]+1e-10\n\t\t\t\tcnt+=1\n\t\t\tend\n\t\tend\n\t\tif cnt>=K\n\t\t\tret=true\n\t\tend\n\tend\n\tret\nend\nfunction main()\n\tL=0\n\tR=1e9\n\tfor _=1:100\n\t\tM=(L+R)/2\n\t\tif check(M)\n\t\t\tR=M\n\t\telse\n\t\t\tL=M\n\t\tend\n\tend\n\tprintln(R)\nend\nmain()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nTakahashi wants to grill N pieces of meat on a grilling net, which can be seen as a two-dimensional plane. The coordinates of the i-th piece of meat are \\left(x_i, y_i\\right), and its hardness is c_i.\n\nTakahashi can use one heat source to grill the meat. If he puts the heat source at coordinates \\left(X, Y\\right), where X and Y are real numbers, the i-th piece of meat will be ready to eat in c_i \\times \\sqrt{\\left(X - x_i\\right)^2 + \\left(Y-y_i\\right)^2} seconds.\n\nTakahashi wants to eat K pieces of meat. Find the time required to have K or more pieces of meat ready if he put the heat source to minimize this time.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 60\n\n1 \\leq K \\leq N\n\n-1000 \\leq x_i , y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) \\left(i \\neq j \\right)\n\n1 \\leq c_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\n\\vdots\nx_N y_N c_N\n\nOutput\n\nPrint the answer.\n\nIt will be considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n\nSample Output 1\n\n2.4\n\nIf we put the heat source at \\left(-0.2, 0\\right), the 1-st, 2-nd, and 3-rd pieces of meat will be ready to eat within 2.4 seconds. This is the optimal place to put the heat source.\n\nSample Input 2\n\n10 5\n-879 981 26\n890 -406 81\n512 859 97\n362 -955 25\n128 553 17\n-885 763 2\n449 310 57\n-656 -204 11\n-270 76 40\n184 170 16\n\nSample Output 2\n\n7411.2252", "sample_input": "4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n"}, "reference_outputs": ["2.4\n"], "source_document_id": "p02764", "source_text": "Score : 600 points\n\nProblem Statement\n\nTakahashi wants to grill N pieces of meat on a grilling net, which can be seen as a two-dimensional plane. The coordinates of the i-th piece of meat are \\left(x_i, y_i\\right), and its hardness is c_i.\n\nTakahashi can use one heat source to grill the meat. If he puts the heat source at coordinates \\left(X, Y\\right), where X and Y are real numbers, the i-th piece of meat will be ready to eat in c_i \\times \\sqrt{\\left(X - x_i\\right)^2 + \\left(Y-y_i\\right)^2} seconds.\n\nTakahashi wants to eat K pieces of meat. Find the time required to have K or more pieces of meat ready if he put the heat source to minimize this time.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 60\n\n1 \\leq K \\leq N\n\n-1000 \\leq x_i , y_i \\leq 1000\n\n\\left(x_i, y_i\\right) \\neq \\left(x_j, y_j\\right) \\left(i \\neq j \\right)\n\n1 \\leq c_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nx_1 y_1 c_1\n\\vdots\nx_N y_N c_N\n\nOutput\n\nPrint the answer.\n\nIt will be considered correct if its absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n4 3\n-1 0 3\n0 0 3\n1 0 2\n1 1 40\n\nSample Output 1\n\n2.4\n\nIf we put the heat source at \\left(-0.2, 0\\right), the 1-st, 2-nd, and 3-rd pieces of meat will be ready to eat within 2.4 seconds. This is the optimal place to put the heat source.\n\nSample Input 2\n\n10 5\n-879 981 26\n890 -406 81\n512 859 97\n362 -955 25\n128 553 17\n-885 763 2\n449 310 57\n-656 -204 11\n-270 76 40\n184 170 16\n\nSample Output 2\n\n7411.2252", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 868, "cpu_time_ms": 1526, "memory_kb": 161932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s925700181", "group_id": "codeNet:p02765", "input_text": "n,r=parse.(split(readline()))\nprint(n<10?r+100(10-n):r)", "language": "Julia", "metadata": {"date": 1585074458, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s925700181.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s925700181", "user_id": "u443151804"}, "prompt_components": {"gold_output": "3719\n", "input_to_evaluate": "n,r=parse.(split(readline()))\nprint(n<10?r+100(10-n):r)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 55, "cpu_time_ms": 541, "memory_kb": 120968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s863469924", "group_id": "codeNet:p02765", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,r=parseMap(split(readline()))\n println(ifelse(n>=10,r,r+100*(10-n)))\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1582676480, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s863469924.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s863469924", "user_id": "u619197965"}, "prompt_components": {"gold_output": "3719\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,r=parseMap(split(readline()))\n println(ifelse(n>=10,r,r+100*(10-n)))\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 339, "memory_kb": 112144}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s806329638", "group_id": "codeNet:p02766", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,k=parseMap(split(readline()))\n println(ndigits(n,k))\nend\nmain()", "language": "Julia", "metadata": {"date": 1582677016, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s806329638.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s806329638", "user_id": "u619197965"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,k=parseMap(split(readline()))\n println(ndigits(n,k))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 356, "memory_kb": 110008}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s797242684", "group_id": "codeNet:p02766", "input_text": "function main()\n \n (N,K) = map(x -> parse(Int,x), split(readline()))\n \n println(floor(Int,log(K,N))+1)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1582515153, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s797242684.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s797242684", "user_id": "u790457721"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function main()\n \n (N,K) = map(x -> parse(Int,x), split(readline()))\n \n println(floor(Int,log(K,N))+1)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 978, "memory_kb": 172152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s871932220", "group_id": "codeNet:p02766", "input_text": "parseInt(x) = parse(Int, x)\nn,k = parseInt.(split(readline()))\nnum = 1\ncnt = 0\nwhile num <= n\n global num *= k\n global cnt+=1\nprintln(cnt)", "language": "Julia", "metadata": {"date": 1582441918, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s871932220.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s871932220", "user_id": "u106297876"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nn,k = parseInt.(split(readline()))\nnum = 1\ncnt = 0\nwhile num <= n\n global num *= k\n global cnt+=1\nprintln(cnt)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1171, "memory_kb": 204624}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s376255559", "group_id": "codeNet:p02766", "input_text": "parseInt(x) = parse(Int, x)\nn,k = parseInt.(split(readline()))\nprintln(length(string(n, base = k)))\n", "language": "Julia", "metadata": {"date": 1582439342, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s376255559.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s376255559", "user_id": "u106297876"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nn,k = parseInt.(split(readline()))\nprintln(length(string(n, base = k)))\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1568, "memory_kb": 204216}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s689760738", "group_id": "codeNet:p02768", "input_text": "function K_kuri(N,P,M)\n ( P ≤ 0 ) && return 1\n ( P%2==0 ) && return K_kuri(N,P÷2,M)^2 % M\n N*K_kuri(N,P-1,M) % M\nend\n\nfunction CmbMod(a,b,M)\n A=B=1\n for i in 1:b\n A*=(a-i+1)%M\n B*=K_kuri(i,M-2,M)\n A%=M\n B%=M\n end\n A*B%M\nend\n\ninput=split(readline())\nMOD=10^9+7\nN,a,b=map(x->parse(Int,x),input)\n\nprint((K_kuri(2,N,MOD)-1-CmbMod(N,a,MOD)-CmbMod(N,b,MOD)+3MOD)%MOD)\n", "language": "Julia", "metadata": {"date": 1582665041, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s689760738.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s689760738", "user_id": "u562051766"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "function K_kuri(N,P,M)\n ( P ≤ 0 ) && return 1\n ( P%2==0 ) && return K_kuri(N,P÷2,M)^2 % M\n N*K_kuri(N,P-1,M) % M\nend\n\nfunction CmbMod(a,b,M)\n A=B=1\n for i in 1:b\n A*=(a-i+1)%M\n B*=K_kuri(i,M-2,M)\n A%=M\n B%=M\n end\n A*B%M\nend\n\ninput=split(readline())\nMOD=10^9+7\nN,a,b=map(x->parse(Int,x),input)\n\nprint((K_kuri(2,N,MOD)-1-CmbMod(N,a,MOD)-CmbMod(N,b,MOD)+3MOD)%MOD)\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 712, "memory_kb": 112924}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s021187860", "group_id": "codeNet:p02769", "input_text": "parseInt(x) = parse(Int, x);\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x);\n\nN_MAX = 2 * 10^5;\nfac = Array{Int}(N_MAX+1);\ninv = Array{Int}(N_MAX+1);\nMOD = 10^9 + 7;\n#初期化\nfunction COMINIT();fac[1] = 1;for i in 1:N_MAX-1;fac[i+1] = fac[i] * (i+1) % MOD;end;for i in 1:N_MAX;inv[i] = powermod(fac[i], MOD-2, MOD);end;end;\n#nCk\nfunction Comb(n, k);if n <= 0 || k < 0;return 0;end;if k > n;return 0;end;if k == 0 || n == k;return 1;end;return ((fac[n] * inv[k]) % MOD * inv[n-k])%MOD;end;\nfunction H(n, m);return Comb(n + m, m);end;\nfunction main();COMINIT();n,k = parseInt.(split(readline()));m = min(k, n-1);ans = 0;for i in 0:m;ans += (Comb(n,i) * H(n-1-i,i)) % MOD;ans %= MOD;end;println(ans);end;\nmain();\n\n", "language": "Julia", "metadata": {"date": 1582427391, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02769.html", "problem_id": "p02769", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02769/input.txt", "sample_output_relpath": "derived/input_output/data/p02769/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02769/Julia/s021187860.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s021187860", "user_id": "u106297876"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x) = parse(Int, x);\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x);\n\nN_MAX = 2 * 10^5;\nfac = Array{Int}(N_MAX+1);\ninv = Array{Int}(N_MAX+1);\nMOD = 10^9 + 7;\n#初期化\nfunction COMINIT();fac[1] = 1;for i in 1:N_MAX-1;fac[i+1] = fac[i] * (i+1) % MOD;end;for i in 1:N_MAX;inv[i] = powermod(fac[i], MOD-2, MOD);end;end;\n#nCk\nfunction Comb(n, k);if n <= 0 || k < 0;return 0;end;if k > n;return 0;end;if k == 0 || n == k;return 1;end;return ((fac[n] * inv[k]) % MOD * inv[n-k])%MOD;end;\nfunction H(n, m);return Comb(n + m, m);end;\nfunction main();COMINIT();n,k = parseInt.(split(readline()));m = min(k, n-1);ans = 0;for i in 0:m;ans += (Comb(n,i) * H(n-1-i,i)) % MOD;ans %= MOD;end;println(ans);end;\nmain();\n\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a building with n rooms, numbered 1 to n.\n\nWe can move from any room to any other room in the building.\n\nLet us call the following event a move: a person in some room i goes to another room j~ (i \\neq j).\n\nInitially, there was one person in each room in the building.\n\nAfter that, we know that there were exactly k moves happened up to now.\n\nWe are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible?\n\nFind the count modulo (10^9 + 7).\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq n \\leq 2 \\times 10^5\n\n2 \\leq k \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn k\n\nOutput\n\nPrint the number of possible combinations of numbers of people in the n rooms now, modulo (10^9 + 7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nLet c_1, c_2, and c_3 be the number of people in Room 1, 2, and 3 now, respectively. There are 10 possible combination of (c_1, c_2, c_3):\n\n(0, 0, 3)\n\n(0, 1, 2)\n\n(0, 2, 1)\n\n(0, 3, 0)\n\n(1, 0, 2)\n\n(1, 1, 1)\n\n(1, 2, 0)\n\n(2, 0, 1)\n\n(2, 1, 0)\n\n(3, 0, 0)\n\nFor example, (c_1, c_2, c_3) will be (0, 1, 2) if the person in Room 1 goes to Room 2 and then one of the persons in Room 2 goes to Room 3.\n\nSample Input 2\n\n200000 1000000000\n\nSample Output 2\n\n607923868\n\nPrint the count modulo (10^9 + 7).\n\nSample Input 3\n\n15 6\n\nSample Output 3\n\n22583772", "sample_input": "3 2\n"}, "reference_outputs": ["10\n"], "source_document_id": "p02769", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a building with n rooms, numbered 1 to n.\n\nWe can move from any room to any other room in the building.\n\nLet us call the following event a move: a person in some room i goes to another room j~ (i \\neq j).\n\nInitially, there was one person in each room in the building.\n\nAfter that, we know that there were exactly k moves happened up to now.\n\nWe are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible?\n\nFind the count modulo (10^9 + 7).\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq n \\leq 2 \\times 10^5\n\n2 \\leq k \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn k\n\nOutput\n\nPrint the number of possible combinations of numbers of people in the n rooms now, modulo (10^9 + 7).\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n10\n\nLet c_1, c_2, and c_3 be the number of people in Room 1, 2, and 3 now, respectively. There are 10 possible combination of (c_1, c_2, c_3):\n\n(0, 0, 3)\n\n(0, 1, 2)\n\n(0, 2, 1)\n\n(0, 3, 0)\n\n(1, 0, 2)\n\n(1, 1, 1)\n\n(1, 2, 0)\n\n(2, 0, 1)\n\n(2, 1, 0)\n\n(3, 0, 0)\n\nFor example, (c_1, c_2, c_3) will be (0, 1, 2) if the person in Room 1 goes to Room 2 and then one of the persons in Room 2 goes to Room 3.\n\nSample Input 2\n\n200000 1000000000\n\nSample Output 2\n\n607923868\n\nPrint the count modulo (10^9 + 7).\n\nSample Input 3\n\n15 6\n\nSample Output 3\n\n22583772", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 725, "cpu_time_ms": 1366, "memory_kb": 156824}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s175841345", "group_id": "codeNet:p02770", "input_text": "const lines=readlines()\nconst k,q=map(x->parse(Int,x),split(shift!(lines)))\nconst d=map(x->parse(Int,x),split(shift!(lines)))\nfor t=lines\n const n,x,m=map(x->parse(Int,x),split(t))\n s=Int[0]\n pre=0\n for i=1:k\n pre+=mod1(d[i],m)\n push!(s,pre)\n end\n println(n-1-div(x%m+div(n-1,k)*pre+s[mod1(n,k)],m))\nend", "language": "Julia", "metadata": {"date": 1582514105, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s175841345.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s175841345", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "const lines=readlines()\nconst k,q=map(x->parse(Int,x),split(shift!(lines)))\nconst d=map(x->parse(Int,x),split(shift!(lines)))\nfor t=lines\n const n,x,m=map(x->parse(Int,x),split(t))\n s=Int[0]\n pre=0\n for i=1:k\n pre+=mod1(d[i],m)\n push!(s,pre)\n end\n println(n-1-div(x%m+div(n-1,k)*pre+s[mod1(n,k)],m))\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2113, "memory_kb": 156172}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s823388281", "group_id": "codeNet:p02770", "input_text": "const lines=readlines()\nconst k,q=map(x->parse(Int,x),split(shift!(lines)))\nconst d=map(x->parse(Int,x),split(shift!(lines)))\nfor s=lines\n n,x,m=map(x->parse(Int,x),split(s))\n b=x%m\n for i=1:k\n b+=mod1(d[i],m)*div(n-i-1+k,k)\n end\n println(n-1-div(b,m))\nend", "language": "Julia", "metadata": {"date": 1582513477, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s823388281.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s823388281", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "const lines=readlines()\nconst k,q=map(x->parse(Int,x),split(shift!(lines)))\nconst d=map(x->parse(Int,x),split(shift!(lines)))\nfor s=lines\n n,x,m=map(x->parse(Int,x),split(s))\n b=x%m\n for i=1:k\n b+=mod1(d[i],m)*div(n-i-1+k,k)\n end\n println(n-1-div(b,m))\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2113, "memory_kb": 156552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s908875875", "group_id": "codeNet:p02771", "input_text": "A,B,C=split(chomp(readline()),\" \")\nif (A==B && A!=C) || (A==C && B!=C) || (B==C && A!=C)\n print(\"Yes\")\nelse\n print(\"No\")\nend", "language": "Julia", "metadata": {"date": 1584388785, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s908875875.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s908875875", "user_id": "u562051766"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "A,B,C=split(chomp(readline()),\" \")\nif (A==B && A!=C) || (A==C && B!=C) || (B==C && A!=C)\n print(\"Yes\")\nelse\n print(\"No\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 677, "memory_kb": 138744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s464281423", "group_id": "codeNet:p02771", "input_text": "S = Set(split(readline()))\nif length(S) == 2\n println(\"Yes\")\nelse\n println(\"No\")\nend", "language": "Julia", "metadata": {"date": 1582875498, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s464281423.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s464281423", "user_id": "u665598835"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "S = Set(split(readline()))\nif length(S) == 2\n println(\"Yes\")\nelse\n println(\"No\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 396, "memory_kb": 112540}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s122748058", "group_id": "codeNet:p02773", "input_text": "#!/usr/bin/env -S JULIA_VERSION=0.5.0 julia\n# contest: abc155, problem: abc155_c, alphabet: C\n\nfunction solve(N::Int, S::Vector{String})\n c = Dict{String, Int}()\n for s in S\n c[s] = get(c, s, 0) + 1\n end\n maxc = maximum(last, c)\n for s in sort(collect(filter(x->last(x) == maxc, c)))\n println(first(s))\n end\nend\n\nfunction main()\n tokens = Channel{String}(32)\n Task() do\n for line in eachline(@static VERSION < v\"0.6\" ? STDIN : stdin)\n startswith(line, '\\0') && break\n for token in split(chomp(line))\n put!(tokens, token)\n end\n end\n close(tokens)\n end |> schedule\n N = parse(Int, take!(tokens))\n S = similar(Vector{String}, N)\n for i in 1:N\n S[i] = take!(tokens)\n end\n solve(N, S)\nend\n\nif isempty(get(ENV, \"ATCODER_LOCAL\", \"\"))\n isempty(ARGS) && main()\nelse\n @eval begin\n const samples = [(\"7\\nbeat\\nvet\\nbeet\\nbed\\nvet\\nbet\\nbeet\", \"beet\\nvet\"), (\"8\\nbuffalo\\nbuffalo\\nbuffalo\\nbuffalo\\nbuffalo\\nbuffalo\\nbuffalo\\nbuffalo\", \"buffalo\"), (\"7\\nbass\\nbass\\nkick\\nkick\\nbass\\nkick\\nkick\", \"kick\"), (\"4\\nushi\\ntapu\\nnichia\\nkun\", \"kun\\nnichia\\ntapu\\nushi\")]\n function test(sampleids...)\n isempty(sampleids) && return test(collect(1:length(samples))...)\n ostdin, ostdout = @static VERSION < v\"0.6\" ? (STDIN, STDOUT) : (stdin, stdout)\n rd, wr = first(redirect_stdout()), last(redirect_stdin())\n try\n map(sampleids) do sampleid\n input, output = samples[sampleid]\n print(ostdout, \"Testing sample #$(sampleid)...\"); flush(ostdout)\n println(wr, input)\n println(wr, \"\\0\")\n t = @elapsed main()\n println()\n result = strip(String(readavailable(rd)))\n if result == output\n println(ostdout, \"OK ($t sec).\")\n true\n else\n println(ostdout, \"ERROR ($t sec)\")\n println(ostdout, \"== expected ==\\n$output\")\n println(ostdout, \"== actual ==\\n$result\\n\")\n false\n end\n end |> all\n finally\n redirect_stdin(ostdin)\n redirect_stdout(ostdout)\n end\n end\n submit() = test() && (prog = @__FILE__; run(`atcoder-submit $prog`))\n !isinteractive() && submit()\n end\nend\n", "language": "Julia", "metadata": {"date": 1589312635, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s122748058.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s122748058", "user_id": "u481214353"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "#!/usr/bin/env -S JULIA_VERSION=0.5.0 julia\n# contest: abc155, problem: abc155_c, alphabet: C\n\nfunction solve(N::Int, S::Vector{String})\n c = Dict{String, Int}()\n for s in S\n c[s] = get(c, s, 0) + 1\n end\n maxc = maximum(last, c)\n for s in sort(collect(filter(x->last(x) == maxc, c)))\n println(first(s))\n end\nend\n\nfunction main()\n tokens = Channel{String}(32)\n Task() do\n for line in eachline(@static VERSION < v\"0.6\" ? STDIN : stdin)\n startswith(line, '\\0') && break\n for token in split(chomp(line))\n put!(tokens, token)\n end\n end\n close(tokens)\n end |> schedule\n N = parse(Int, take!(tokens))\n S = similar(Vector{String}, N)\n for i in 1:N\n S[i] = take!(tokens)\n end\n solve(N, S)\nend\n\nif isempty(get(ENV, \"ATCODER_LOCAL\", \"\"))\n isempty(ARGS) && main()\nelse\n @eval begin\n const samples = [(\"7\\nbeat\\nvet\\nbeet\\nbed\\nvet\\nbet\\nbeet\", \"beet\\nvet\"), (\"8\\nbuffalo\\nbuffalo\\nbuffalo\\nbuffalo\\nbuffalo\\nbuffalo\\nbuffalo\\nbuffalo\", \"buffalo\"), (\"7\\nbass\\nbass\\nkick\\nkick\\nbass\\nkick\\nkick\", \"kick\"), (\"4\\nushi\\ntapu\\nnichia\\nkun\", \"kun\\nnichia\\ntapu\\nushi\")]\n function test(sampleids...)\n isempty(sampleids) && return test(collect(1:length(samples))...)\n ostdin, ostdout = @static VERSION < v\"0.6\" ? (STDIN, STDOUT) : (stdin, stdout)\n rd, wr = first(redirect_stdout()), last(redirect_stdin())\n try\n map(sampleids) do sampleid\n input, output = samples[sampleid]\n print(ostdout, \"Testing sample #$(sampleid)...\"); flush(ostdout)\n println(wr, input)\n println(wr, \"\\0\")\n t = @elapsed main()\n println()\n result = strip(String(readavailable(rd)))\n if result == output\n println(ostdout, \"OK ($t sec).\")\n true\n else\n println(ostdout, \"ERROR ($t sec)\")\n println(ostdout, \"== expected ==\\n$output\")\n println(ostdout, \"== actual ==\\n$result\\n\")\n false\n end\n end |> all\n finally\n redirect_stdin(ostdin)\n redirect_stdout(ostdout)\n end\n end\n submit() = test() && (prog = @__FILE__; run(`atcoder-submit $prog`))\n !isinteractive() && submit()\n end\nend\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2215, "cpu_time_ms": 2115, "memory_kb": 175740}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s915609206", "group_id": "codeNet:p02773", "input_text": "function main()\n \n N = parse(Int,readline())\n \n S = String[]\n S_0 = String[]\n \n for i in 1:N\n \n push!(S,chomp(readline()))\n \n if in(S[i],S_0) == false\n push!(S_0,S[i])\n end\n \n end\n\n sort!(S_0)\n \n num_max = 0\n \n dict = Dict{String,Int64}()\n \n for i in 1:N\n \n if haskey(dict,S[i])\n dict[S[i]] += 1\n else\n dict[S[i]] = 1\n end\n \n end\n \n num_max = maximum(values(dict))\n \n for i in 1:length(S_0)\n \n if dict[S_0[i]] == num_max\n println(S_0[i])\n end\n \n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1581948318, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s915609206.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s915609206", "user_id": "u790457721"}, "prompt_components": {"gold_output": "beet\nvet\n", "input_to_evaluate": "function main()\n \n N = parse(Int,readline())\n \n S = String[]\n S_0 = String[]\n \n for i in 1:N\n \n push!(S,chomp(readline()))\n \n if in(S[i],S_0) == false\n push!(S_0,S[i])\n end\n \n end\n\n sort!(S_0)\n \n num_max = 0\n \n dict = Dict{String,Int64}()\n \n for i in 1:N\n \n if haskey(dict,S[i])\n dict[S[i]] += 1\n else\n dict[S[i]] = 1\n end\n \n end\n \n num_max = maximum(values(dict))\n \n for i in 1:length(S_0)\n \n if dict[S_0[i]] == num_max\n println(S_0[i])\n end\n \n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2111, "memory_kb": 155004}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s975110413", "group_id": "codeNet:p02777", "input_text": "s,t=split(readline())\nx,y=parse.(split(readline()))\nu=chomp(readline())\nif s==u\n x-=1\nelse\n y-=1\nend\nprintln(\"$x $y\")", "language": "Julia", "metadata": {"date": 1581283855, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s975110413.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s975110413", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2 4\n", "input_to_evaluate": "s,t=split(readline())\nx,y=parse.(split(readline()))\nu=chomp(readline())\nif s==u\n x-=1\nelse\n y-=1\nend\nprintln(\"$x $y\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 119, "cpu_time_ms": 1047, "memory_kb": 173356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s487083227", "group_id": "codeNet:p02778", "input_text": "print(\"x\"^length(readline()))", "language": "Julia", "metadata": {"date": 1587891422, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02778.html", "problem_id": "p02778", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02778/input.txt", "sample_output_relpath": "derived/input_output/data/p02778/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02778/Julia/s487083227.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s487083227", "user_id": "u443151804"}, "prompt_components": {"gold_output": "xxxxxxx\n", "input_to_evaluate": "print(\"x\"^length(readline()))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is a string S. Replace every character in S with x and print the result.\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\nReplace every character in S with x and print the result.\n\nSample Input 1\n\nsardine\n\nSample Output 1\n\nxxxxxxx\n\nReplacing every character in S with x results in xxxxxxx.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\nxxxx\n\nSample Input 3\n\ngone\n\nSample Output 3\n\nxxxx", "sample_input": "sardine\n"}, "reference_outputs": ["xxxxxxx\n"], "source_document_id": "p02778", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is a string S. Replace every character in S with x and print the result.\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\nReplace every character in S with x and print the result.\n\nSample Input 1\n\nsardine\n\nSample Output 1\n\nxxxxxxx\n\nReplacing every character in S with x results in xxxxxxx.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\nxxxx\n\nSample Input 3\n\ngone\n\nSample Output 3\n\nxxxx", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 29, "cpu_time_ms": 324, "memory_kb": 111608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s322032910", "group_id": "codeNet:p02778", "input_text": "S = chomp(readline())\nlen = length(S)\nprint(\"x\"^len)", "language": "Julia", "metadata": {"date": 1581278643, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02778.html", "problem_id": "p02778", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02778/input.txt", "sample_output_relpath": "derived/input_output/data/p02778/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02778/Julia/s322032910.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s322032910", "user_id": "u879294842"}, "prompt_components": {"gold_output": "xxxxxxx\n", "input_to_evaluate": "S = chomp(readline())\nlen = length(S)\nprint(\"x\"^len)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven is a string S. Replace every character in S with x and print the result.\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\nReplace every character in S with x and print the result.\n\nSample Input 1\n\nsardine\n\nSample Output 1\n\nxxxxxxx\n\nReplacing every character in S with x results in xxxxxxx.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\nxxxx\n\nSample Input 3\n\ngone\n\nSample Output 3\n\nxxxx", "sample_input": "sardine\n"}, "reference_outputs": ["xxxxxxx\n"], "source_document_id": "p02778", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven is a string S. Replace every character in S with x and print the result.\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\nReplace every character in S with x and print the result.\n\nSample Input 1\n\nsardine\n\nSample Output 1\n\nxxxxxxx\n\nReplacing every character in S with x results in xxxxxxx.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\nxxxx\n\nSample Input 3\n\ngone\n\nSample Output 3\n\nxxxx", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 583, "memory_kb": 113072}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s066020604", "group_id": "codeNet:p02779", "input_text": "n=parse(Int,readline())\nprintln(n>length(unique(sort(map(x->parse(Int,x),split(readline()))))) ? \"NO\" : \"YES\")", "language": "Julia", "metadata": {"date": 1581283917, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s066020604.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s066020604", "user_id": "u657913472"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "n=parse(Int,readline())\nprintln(n>length(unique(sort(map(x->parse(Int,x),split(readline()))))) ? \"NO\" : \"YES\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 110, "cpu_time_ms": 521, "memory_kb": 137088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s584739545", "group_id": "codeNet:p02780", "input_text": "function main()\n \n (N, K) = map(x -> parse(Int,x), split(readline()))\n P = map(x -> parse(Int,x), split(readline()))\n \n exp = []\n \n for n in P\n push!(exp, (n+1)/2)\n end\n \n ans = 0\n \n for i in 1:N-K+1\n ans = max(ans, sum(exp[i:i+K-1]))\n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1587302446, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s584739545.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s584739545", "user_id": "u790457721"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "function main()\n \n (N, K) = map(x -> parse(Int,x), split(readline()))\n P = map(x -> parse(Int,x), split(readline()))\n \n exp = []\n \n for n in P\n push!(exp, (n+1)/2)\n end\n \n ans = 0\n \n for i in 1:N-K+1\n ans = max(ans, sum(exp[i:i+K-1]))\n end\n \n println(ans)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2114, "memory_kb": 173956}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s637696478", "group_id": "codeNet:p02780", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,k=parseMap(split(readline()))\n p=parseMap(split(readline()))\n res=sum(Vector(p[1:k]))\n m=res\n for i in k+1:n\n res+=p[i]-p[i-k]\n m=max(res,m)\n end\n println((k+m)/2)\nend\nmain()", "language": "Julia", "metadata": {"date": 1582300520, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s637696478.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s637696478", "user_id": "u619197965"}, "prompt_components": {"gold_output": "7.000000000000\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,k=parseMap(split(readline()))\n p=parseMap(split(readline()))\n res=sum(Vector(p[1:k]))\n m=res\n for i in k+1:n\n res+=p[i]-p[i-k]\n m=max(res,m)\n end\n println((k+m)/2)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 433, "memory_kb": 124808}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s719630896", "group_id": "codeNet:p02781", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ta = parseMap(split(chomp(readline()),\"\"))\n\tk = readline() |> parseInt\n\tn = length(a)\n\tdp = zeros(Int,n,k+1,2)\n\tdp[1,2,1] = a[1]-1\n\tdp[1,2,2] = 1\n\tdp[1,1,1] = 1\n\tfor i in 2:n\n\t\tfor j in 1:k+1\n\t\t\tdp[i,j,1] += dp[i-1,j,1]+dp[i-1,j,2]\n\t\t\tif a[i] == 0\n\t\t\t\tdp[i,j,2] = dp[i-1,j,2]\n\t\t\telse\n\t\t\t\tdp[i,j,2] = 0\n\t\t\tend\n\t\t\tif j>1\n\t\t\t\tdp[i,j,1] += dp[i-1,j-1,1]*9+dp[i-1,j-1,2]*(max(a[i]-1,0))\n\t\t\t\tif a[i]>0\n\t\t\t\t\tdp[i,j,2] = dp[i-1,j-1,2]\n\t\t\t\telse\n\t\t\t\t\tdp[i,j,2] = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tprintln(dp[n,k+1,1]+dp[n,k+1,2])\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1581284424, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02781.html", "problem_id": "p02781", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02781/input.txt", "sample_output_relpath": "derived/input_output/data/p02781/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02781/Julia/s719630896.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s719630896", "user_id": "u095714878"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ta = parseMap(split(chomp(readline()),\"\"))\n\tk = readline() |> parseInt\n\tn = length(a)\n\tdp = zeros(Int,n,k+1,2)\n\tdp[1,2,1] = a[1]-1\n\tdp[1,2,2] = 1\n\tdp[1,1,1] = 1\n\tfor i in 2:n\n\t\tfor j in 1:k+1\n\t\t\tdp[i,j,1] += dp[i-1,j,1]+dp[i-1,j,2]\n\t\t\tif a[i] == 0\n\t\t\t\tdp[i,j,2] = dp[i-1,j,2]\n\t\t\telse\n\t\t\t\tdp[i,j,2] = 0\n\t\t\tend\n\t\t\tif j>1\n\t\t\t\tdp[i,j,1] += dp[i-1,j-1,1]*9+dp[i-1,j-1,2]*(max(a[i]-1,0))\n\t\t\t\tif a[i]>0\n\t\t\t\t\tdp[i,j,2] = dp[i-1,j-1,2]\n\t\t\t\telse\n\t\t\t\t\tdp[i,j,2] = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tprintln(dp[n,k+1,1]+dp[n,k+1,2])\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n1 \\leq N < 10^{100}\n\n1 \\leq K \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n100\n1\n\nSample Output 1\n\n19\n\nThe following 19 integers satisfy the condition:\n\n1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100\n\nSample Input 2\n\n25\n2\n\nSample Output 2\n\n14\n\nThe following 14 integers satisfy the condition:\n\n11,12,13,14,15,16,17,18,19,21,22,23,24,25\n\nSample Input 3\n\n314159\n2\n\nSample Output 3\n\n937\n\nSample Input 4\n\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n\nSample Output 4\n\n117879300", "sample_input": "100\n1\n"}, "reference_outputs": ["19\n"], "source_document_id": "p02781", "source_text": "Score : 500 points\n\nProblem Statement\n\nFind the number of integers between 1 and N (inclusive) that contains exactly K non-zero digits when written in base ten.\n\nConstraints\n\n1 \\leq N < 10^{100}\n\n1 \\leq K \\leq 3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nK\n\nOutput\n\nPrint the count.\n\nSample Input 1\n\n100\n1\n\nSample Output 1\n\n19\n\nThe following 19 integers satisfy the condition:\n\n1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100\n\nSample Input 2\n\n25\n2\n\nSample Output 2\n\n14\n\nThe following 14 integers satisfy the condition:\n\n11,12,13,14,15,16,17,18,19,21,22,23,24,25\n\nSample Input 3\n\n314159\n2\n\nSample Output 3\n\n937\n\nSample Input 4\n\n9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999\n3\n\nSample Output 4\n\n117879300", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 776, "memory_kb": 168540}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s666200715", "group_id": "codeNet:p02784", "input_text": "function main()\n a,b = parse.(split(readline()))\n if a<=sum(parse.(split(readline())))\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1580750695, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02784.html", "problem_id": "p02784", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02784/input.txt", "sample_output_relpath": "derived/input_output/data/p02784/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02784/Julia/s666200715.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s666200715", "user_id": "u926678805"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n a,b = parse.(split(readline()))\n if a<=sum(parse.(split(readline())))\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\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\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "sample_input": "10 3\n4 5 6\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02784", "source_text": "Score : 200 points\n\nProblem Statement\n\nRaccoon is fighting with a monster.\n\nThe health of the monster is H.\n\nRaccoon can use N kinds of special moves. Using the i-th move decreases the monster's health by A_i.\nThere is no other way to decrease the monster's health.\n\nRaccoon wins when the monster's health becomes 0 or below.\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nConstraints\n\n1 \\leq H \\leq 10^9\n\n1 \\leq N \\leq 10^5\n\n1 \\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\nH N\nA_1 A_2 ... A_N\n\nOutput\n\nIf Raccoon can win without using the same move twice or more, print Yes; otherwise, print No.\n\nSample Input 1\n\n10 3\n4 5 6\n\nSample Output 1\n\nYes\n\nThe monster's health will become 0 or below after, for example, using the second and third moves.\n\nSample Input 2\n\n20 3\n4 5 6\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n210 5\n31 41 59 26 53\n\nSample Output 3\n\nYes\n\nSample Input 4\n\n211 5\n31 41 59 26 53\n\nSample Output 4\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2111, "memory_kb": 152332}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s487801705", "group_id": "codeNet:p02785", "input_text": "function main()\n \n (N,K) = map(x -> parse(Int,x), split(readline()))\n \n H = map(x -> parse(Int,x), split(readline()))\n sort!(H,rev = true)\n \n ans = 0\n\n for i in K+1:N\n \n ans += H[i]\n \n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1580936000, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s487801705.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s487801705", "user_id": "u790457721"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "function main()\n \n (N,K) = map(x -> parse(Int,x), split(readline()))\n \n H = map(x -> parse(Int,x), split(readline()))\n sort!(H,rev = true)\n \n ans = 0\n\n for i in K+1:N\n \n ans += H[i]\n \n end\n \n println(ans)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 564, "memory_kb": 142436}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s576724640", "group_id": "codeNet:p02788", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m]<=x;l=m;else;r=m;end;end;l;end\nfunction bsearchg(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m] split |> parseMap\n\tb = Tuple{Int,Int}[(0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tp,q = readline() |> split |> parseMap\n\t\tb[i]=(p,q)\n\tend\n\tb = sort(b,by=x->x[1])\n\tx = [b[i][1] for i in 1:n]\n\th = [b[i][2] for i in 1:n]\n\tlm = Int[0]\n\tv = Int[0]\n\ts = 0\n\tm = 1\n\tfor i in 1:n\n\t\tr = bsearch(x,x[i]+2*d)\n\t\tl = bsearchg(lm,x[i]-2*d)\n\t\tif l==0\n\t\t\ty = cld(max(h[i]-v[m],0),a)\n\t\telse\n\t\t\ty = cld(max(h[i]-v[m]+v[l],0),a)\n\t\tend\n\t\tif y > 0\n\t\t\tpush!(lm,x[i])\n\t\t\ts += y\n\t\t\tpush!(v,v[m]+y)\n\t\t\tm += 1\n\t\tend\n\tend\n\tprintln(s)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1580073559, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s576724640.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s576724640", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m]<=x;l=m;else;r=m;end;end;l;end\nfunction bsearchg(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m] split |> parseMap\n\tb = Tuple{Int,Int}[(0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tp,q = readline() |> split |> parseMap\n\t\tb[i]=(p,q)\n\tend\n\tb = sort(b,by=x->x[1])\n\tx = [b[i][1] for i in 1:n]\n\th = [b[i][2] for i in 1:n]\n\tlm = Int[0]\n\tv = Int[0]\n\ts = 0\n\tm = 1\n\tfor i in 1:n\n\t\tr = bsearch(x,x[i]+2*d)\n\t\tl = bsearchg(lm,x[i]-2*d)\n\t\tif l==0\n\t\t\ty = cld(max(h[i]-v[m],0),a)\n\t\telse\n\t\t\ty = cld(max(h[i]-v[m]+v[l],0),a)\n\t\tend\n\t\tif y > 0\n\t\t\tpush!(lm,x[i])\n\t\t\ts += y\n\t\t\tpush!(v,v[m]+y)\n\t\t\tm += 1\n\t\tend\n\tend\n\tprintln(s)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 837, "cpu_time_ms": 1332, "memory_kb": 180420}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s645570570", "group_id": "codeNet:p02789", "input_text": "function main()\n n,m = map(x -> parse(Int, x), split(readline()))\n print(n == m ? \"Yes\" : \"No\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1582578439, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s645570570.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s645570570", "user_id": "u158131514"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n n,m = map(x -> parse(Int, x), split(readline()))\n print(n == m ? \"Yes\" : \"No\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 113, "cpu_time_ms": 818, "memory_kb": 167708}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s003157519", "group_id": "codeNet:p02789", "input_text": "NM = readline()\nif NM[1] == NM[end]\n println(\"Yes\")\nelse\n println(\"No\")\nend", "language": "Julia", "metadata": {"date": 1581790145, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s003157519.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s003157519", "user_id": "u665598835"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "NM = readline()\nif NM[1] == NM[end]\n println(\"Yes\")\nelse\n println(\"No\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 81, "cpu_time_ms": 1080, "memory_kb": 168012}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s031892745", "group_id": "codeNet:p02789", "input_text": "n,m=parse.(split(readline()))\nprintln(n==m?\"Yes\":\"No\")", "language": "Julia", "metadata": {"date": 1579709881, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s031892745.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s031892745", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n,m=parse.(split(readline()))\nprintln(n==m?\"Yes\":\"No\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 54, "cpu_time_ms": 997, "memory_kb": 176500}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s940620368", "group_id": "codeNet:p02790", "input_text": "function parseInt(x)\n parse(Int, x)\nend\n\nfunction main()\n a,b = split(readline())\n print(min(a, b) ^ parseInt(max(a, b)))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1582578894, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s940620368.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s940620368", "user_id": "u158131514"}, "prompt_components": {"gold_output": "3333\n", "input_to_evaluate": "function parseInt(x)\n parse(Int, x)\nend\n\nfunction main()\n a,b = split(readline())\n print(min(a, b) ^ parseInt(max(a, b)))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 142, "cpu_time_ms": 385, "memory_kb": 111728}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s778068194", "group_id": "codeNet:p02791", "input_text": "N = parse(Int, readline())\nP = parse.(Int, split(readline()))\nminimum = P[1]\ncount = 0\nfor i in P\n if i <= minimum\n global minimum = i\n global count += 1\n end\nend\nprintln(count)", "language": "Julia", "metadata": {"date": 1581791858, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s778068194.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s778068194", "user_id": "u665598835"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N = parse(Int, readline())\nP = parse.(Int, split(readline()))\nminimum = P[1]\ncount = 0\nfor i in P\n if i <= minimum\n global minimum = i\n global count += 1\n end\nend\nprintln(count)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1456, "memory_kb": 160268}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s460698942", "group_id": "codeNet:p02792", "input_text": "D=zeros(Int,10,10)\nfor i=1:parse(Int,readline())\n\tx=i\n\twhile x>=10\n\t\tx=div(x,10)\n\tend\n\tD[x+1,i%10+1]+=1\nend\nans=0\nfor i=1:10,j=1:10\n\tans+=D[i,j]*D[j,i]\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1579467778, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s460698942.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s460698942", "user_id": "u657913472"}, "prompt_components": {"gold_output": "17\n", "input_to_evaluate": "D=zeros(Int,10,10)\nfor i=1:parse(Int,readline())\n\tx=i\n\twhile x>=10\n\t\tx=div(x,10)\n\tend\n\tD[x+1,i%10+1]+=1\nend\nans=0\nfor i=1:10,j=1:10\n\tans+=D[i,j]*D[j,i]\nend\nprintln(ans)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 699, "memory_kb": 171912}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s766500838", "group_id": "codeNet:p02793", "input_text": "#=\nB:\n- Julia version:0.5.2\n- Author: abap\n- Date: 2020-01-12\n=#\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nN = parseInt(readline())\nA = parseMap(split(readline()))\nx = lcm(A)\nans :: BigInt\nans = 0\nfor i in A\n\tans += x / i\nend\nanser = ans % (10^9 + 7)\nprintln(Int64(anser))", "language": "Julia", "metadata": {"date": 1579468453, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s766500838.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s766500838", "user_id": "u879294842"}, "prompt_components": {"gold_output": "13\n", "input_to_evaluate": "#=\nB:\n- Julia version:0.5.2\n- Author: abap\n- Date: 2020-01-12\n=#\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nN = parseInt(readline())\nA = parseMap(split(readline()))\nx = lcm(A)\nans :: BigInt\nans = 0\nfor i in A\n\tans += x / i\nend\nanser = ans % (10^9 + 7)\nprintln(Int64(anser))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 317, "cpu_time_ms": 1192, "memory_kb": 198336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s696709815", "group_id": "codeNet:p02794", "input_text": "const N=parse(Int,readline())\nconst U=Int[]\nconst V=Int[]\nconst G=[Int[] for _=1:N]\nfor i=1:N-1\n\tu,v=map(x->parse(Int,x),split(readline()))\n\tpush!(U,u)\n\tpush!(V,v)\n\tpush!(G[u],v)\n\tpush!(G[v],u)\nend\nconst depth=zeros(Int,N)\nconst subtree=zeros(Int,N)\nfunction dfs(u,p,d)\n\tdepth[u]=d\n\tsubtree[u]=2^u\n\tfor v=G[u]\n\t\tif v!=p\n\t\t\tsubtree[u]+=dfs(v,u,d+1)\n\t\tend\n\tend\n\tsubtree[u]\nend\ndfs(1,0,0)\nconst M=parse(Int,readline())\nconst check=zeros(Int,N-1)\nfor i=1:M\n\ta,b=map(x->parse(Int,x),split(readline()))\n\ttest=2^a+2^b\n\tfor j=1:N-1\n\t\tw=depth[U[j]]>j)%2==1\n\t\t\t\tparity+=1\n\t\t\tend\n\t\tend\n\t\tans+=parity%2==0 ? now : -now\n\tend\n\tprintln(ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1579469718, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02794.html", "problem_id": "p02794", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02794/input.txt", "sample_output_relpath": "derived/input_output/data/p02794/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02794/Julia/s696709815.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s696709815", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const N=parse(Int,readline())\nconst U=Int[]\nconst V=Int[]\nconst G=[Int[] for _=1:N]\nfor i=1:N-1\n\tu,v=map(x->parse(Int,x),split(readline()))\n\tpush!(U,u)\n\tpush!(V,v)\n\tpush!(G[u],v)\n\tpush!(G[v],u)\nend\nconst depth=zeros(Int,N)\nconst subtree=zeros(Int,N)\nfunction dfs(u,p,d)\n\tdepth[u]=d\n\tsubtree[u]=2^u\n\tfor v=G[u]\n\t\tif v!=p\n\t\t\tsubtree[u]+=dfs(v,u,d+1)\n\t\tend\n\tend\n\tsubtree[u]\nend\ndfs(1,0,0)\nconst M=parse(Int,readline())\nconst check=zeros(Int,N-1)\nfor i=1:M\n\ta,b=map(x->parse(Int,x),split(readline()))\n\ttest=2^a+2^b\n\tfor j=1:N-1\n\t\tw=depth[U[j]]>j)%2==1\n\t\t\t\tparity+=1\n\t\t\tend\n\t\tend\n\t\tans+=parity%2==0 ? now : -now\n\tend\n\tprintln(ans)\nend\nmain()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices numbered 1 to N.\nThe i-th edge in this tree connects Vertex a_i and Vertex b_i.\n\nConsider painting each of these edges white or black. There are 2^{N-1} such ways to paint the edges. Among them, how many satisfy all of the following M restrictions?\n\nThe i-th (1 \\leq i \\leq M) restriction is represented by two integers u_i and v_i, which mean that the path connecting Vertex u_i and Vertex v_i must contain at least one edge painted black.\n\nConstraints\n\n2 \\leq N \\leq 50\n\n1 \\leq a_i,b_i \\leq N\n\nThe graph given in input is a tree.\n\n1 \\leq M \\leq \\min(20,\\frac{N(N-1)}{2})\n\n1 \\leq u_i < v_i \\leq N\n\nIf i \\not= j, either u_i \\not=u_j or v_i\\not=v_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 b_1\n:\na_{N-1} b_{N-1}\nM\nu_1 v_1\n:\nu_M v_M\n\nOutput\n\nPrint the number of ways to paint the edges that satisfy all of the M conditions.\n\nSample Input 1\n\n3\n1 2\n2 3\n1\n1 3\n\nSample Output 1\n\n3\n\nThe tree in this input is shown below:\n\nAll of the M restrictions will be satisfied if Edge 1 and 2 are respectively painted (white, black), (black, white), or (black, black), so the answer is 3.\n\nSample Input 2\n\n2\n1 2\n1\n1 2\n\nSample Output 2\n\n1\n\nThe tree in this input is shown below:\n\nAll of the M restrictions will be satisfied only if Edge 1 is painted black, so the answer is 1.\n\nSample Input 3\n\n5\n1 2\n3 2\n3 4\n5 3\n3\n1 3\n2 4\n2 5\n\nSample Output 3\n\n9\n\nThe tree in this input is shown below:\n\nSample Input 4\n\n8\n1 2\n2 3\n4 3\n2 5\n6 3\n6 7\n8 6\n5\n2 7\n3 5\n1 6\n2 8\n7 8\n\nSample Output 4\n\n62\n\nThe tree in this input is shown below:", "sample_input": "3\n1 2\n2 3\n1\n1 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02794", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a tree with N vertices numbered 1 to N.\nThe i-th edge in this tree connects Vertex a_i and Vertex b_i.\n\nConsider painting each of these edges white or black. There are 2^{N-1} such ways to paint the edges. Among them, how many satisfy all of the following M restrictions?\n\nThe i-th (1 \\leq i \\leq M) restriction is represented by two integers u_i and v_i, which mean that the path connecting Vertex u_i and Vertex v_i must contain at least one edge painted black.\n\nConstraints\n\n2 \\leq N \\leq 50\n\n1 \\leq a_i,b_i \\leq N\n\nThe graph given in input is a tree.\n\n1 \\leq M \\leq \\min(20,\\frac{N(N-1)}{2})\n\n1 \\leq u_i < v_i \\leq N\n\nIf i \\not= j, either u_i \\not=u_j or v_i\\not=v_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 b_1\n:\na_{N-1} b_{N-1}\nM\nu_1 v_1\n:\nu_M v_M\n\nOutput\n\nPrint the number of ways to paint the edges that satisfy all of the M conditions.\n\nSample Input 1\n\n3\n1 2\n2 3\n1\n1 3\n\nSample Output 1\n\n3\n\nThe tree in this input is shown below:\n\nAll of the M restrictions will be satisfied if Edge 1 and 2 are respectively painted (white, black), (black, white), or (black, black), so the answer is 3.\n\nSample Input 2\n\n2\n1 2\n1\n1 2\n\nSample Output 2\n\n1\n\nThe tree in this input is shown below:\n\nAll of the M restrictions will be satisfied only if Edge 1 is painted black, so the answer is 1.\n\nSample Input 3\n\n5\n1 2\n3 2\n3 4\n5 3\n3\n1 3\n2 4\n2 5\n\nSample Output 3\n\n9\n\nThe tree in this input is shown below:\n\nSample Input 4\n\n8\n1 2\n2 3\n4 3\n2 5\n6 3\n6 7\n8 6\n5\n2 7\n3 5\n1 6\n2 8\n7 8\n\nSample Output 4\n\n62\n\nThe tree in this input is shown below:", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 893, "cpu_time_ms": 1219, "memory_kb": 173336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s598174723", "group_id": "codeNet:p02795", "input_text": "function main()\n \n H = parse(Int,readline())\n W = parse(Int,readline())\n N = parse(Int,readline())\n \n a = max(H,W)\n \n println(ceil(Int,N/a))\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1579387733, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02795.html", "problem_id": "p02795", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02795/input.txt", "sample_output_relpath": "derived/input_output/data/p02795/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02795/Julia/s598174723.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s598174723", "user_id": "u790457721"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n \n H = parse(Int,readline())\n W = parse(Int,readline())\n N = parse(Int,readline())\n \n a = max(H,W)\n \n println(ceil(Int,N/a))\n \nend\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns, where all the squares are initially white.\n\nYou will perform some number of painting operations on the grid.\nIn one operation, you can do one of the following two actions:\n\nChoose one row, then paint all the squares in that row black.\n\nChoose one column, then paint all the squares in that column black.\n\nAt least how many operations do you need in order to have N or more black squares in the grid?\nIt is guaranteed that, under the conditions in Constraints, having N or more black squares is always possible by performing some number of operations.\n\nConstraints\n\n1 \\leq H \\leq 100\n\n1 \\leq W \\leq 100\n\n1 \\leq N \\leq H \\times W\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH\nW\nN\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3\n7\n10\n\nSample Output 1\n\n2\n\nYou can have 14 black squares in the grid by performing the \"row\" operation twice, on different rows.\n\nSample Input 2\n\n14\n12\n112\n\nSample Output 2\n\n8\n\nSample Input 3\n\n2\n100\n200\n\nSample Output 3\n\n2", "sample_input": "3\n7\n10\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02795", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have a grid with H rows and W columns, where all the squares are initially white.\n\nYou will perform some number of painting operations on the grid.\nIn one operation, you can do one of the following two actions:\n\nChoose one row, then paint all the squares in that row black.\n\nChoose one column, then paint all the squares in that column black.\n\nAt least how many operations do you need in order to have N or more black squares in the grid?\nIt is guaranteed that, under the conditions in Constraints, having N or more black squares is always possible by performing some number of operations.\n\nConstraints\n\n1 \\leq H \\leq 100\n\n1 \\leq W \\leq 100\n\n1 \\leq N \\leq H \\times W\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH\nW\nN\n\nOutput\n\nPrint the minimum number of operations needed.\n\nSample Input 1\n\n3\n7\n10\n\nSample Output 1\n\n2\n\nYou can have 14 black squares in the grid by performing the \"row\" operation twice, on different rows.\n\nSample Input 2\n\n14\n12\n112\n\nSample Output 2\n\n8\n\nSample Input 3\n\n2\n100\n200\n\nSample Output 3\n\n2", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 353, "memory_kb": 110440}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s249082304", "group_id": "codeNet:p02796", "input_text": "function main() \n\n N = parse(Int,readline())\n R = [(0,0,0) for i in 1:N]\n \n for i in 1:N\n \n (a,b) = map(x -> parse(Int,x), split(readline()))\n R[i] = (a-b,a,a+b)\n \n end\n\n sort!(R, by = R -> R[2])\n \n count = N\n \n for i in 1:N-1\n \n if R[i][3] > R[i+1][1]\n count -= 1\n R[i+1] = (-10^10,-10^10,-10^10)\n end\n \n end\n\n println(count)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1579390788, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s249082304.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s249082304", "user_id": "u790457721"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main() \n\n N = parse(Int,readline())\n R = [(0,0,0) for i in 1:N]\n \n for i in 1:N\n \n (a,b) = map(x -> parse(Int,x), split(readline()))\n R[i] = (a-b,a,a+b)\n \n end\n\n sort!(R, by = R -> R[2])\n \n count = N\n \n for i in 1:N-1\n \n if R[i][3] > R[i+1][1]\n count -= 1\n R[i+1] = (-10^10,-10^10,-10^10)\n end\n \n end\n\n println(count)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1533, "memory_kb": 155388}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s762523722", "group_id": "codeNet:p02797", "input_text": "#=\nC:\n- Julia version: \n- Author: abap\n- Date: 2020-01-18\n=#\nN,K,S = parse.(split(readline()))\nA = fill(1, N)\nif N - K < S\nfor i in 1:K\n\tA[i] = S\nend\nfor k in A\n\tprint(\"$k \")\nend\nelse\n A = fill(S + 1, N)\n for i in 1:K\n A[i] = S\n\tend\n\tfor k in A\n\t\tprint(\"$k \")\n\tend\nend\n\nprintln(\"\")", "language": "Julia", "metadata": {"date": 1579381565, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s762523722.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s762523722", "user_id": "u879294842"}, "prompt_components": {"gold_output": "1 2 3 4\n", "input_to_evaluate": "#=\nC:\n- Julia version: \n- Author: abap\n- Date: 2020-01-18\n=#\nN,K,S = parse.(split(readline()))\nA = fill(1, N)\nif N - K < S\nfor i in 1:K\n\tA[i] = S\nend\nfor k in A\n\tprint(\"$k \")\nend\nelse\n A = fill(S + 1, N)\n for i in 1:K\n A[i] = S\n\tend\n\tfor k in A\n\t\tprint(\"$k \")\n\tend\nend\n\nprintln(\"\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1103, "memory_kb": 197508}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s900647576", "group_id": "codeNet:p02801", "input_text": "println(readline()[1]+1)", "language": "Julia", "metadata": {"date": 1582659130, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s900647576.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s900647576", "user_id": "u619197965"}, "prompt_components": {"gold_output": "b\n", "input_to_evaluate": "println(readline()[1]+1)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 24, "cpu_time_ms": 283, "memory_kb": 107244}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s457254015", "group_id": "codeNet:p02802", "input_text": "#=\nC:\n- Julia version: \n- Author: abap\n- Date: 2020-01-12\n=#\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nN,M = parseMap(split(readline()))\nd = Dict()\nwa = 0\nac = 0\nfor i in 1:M\n\t#println(d)\n\tp,s = split(readline())\n\tp = parseInt(p)\n\t#println(\"$p $s\")\n\tif !(in(p,keys(d)))\n\t\tpush!(d,p=>\"wa\")\n\tend\n\tif s == \"WA\" && d[p] == \"wa\"\n\t\twa += 1\n\t\t#print(\"$(d[p]) なので、wa\")\n\telseif s == \"AC\" && d[p] == \"wa\"\n\t\td[p] = \"a\"\n\t\tac += 1\n\t\t#println(\"ac\")\n\tend\nend\nprintln(\"$ac $wa\")", "language": "Julia", "metadata": {"date": 1578883721, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s457254015.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s457254015", "user_id": "u879294842"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "#=\nC:\n- Julia version: \n- Author: abap\n- Date: 2020-01-12\n=#\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nN,M = parseMap(split(readline()))\nd = Dict()\nwa = 0\nac = 0\nfor i in 1:M\n\t#println(d)\n\tp,s = split(readline())\n\tp = parseInt(p)\n\t#println(\"$p $s\")\n\tif !(in(p,keys(d)))\n\t\tpush!(d,p=>\"wa\")\n\tend\n\tif s == \"WA\" && d[p] == \"wa\"\n\t\twa += 1\n\t\t#print(\"$(d[p]) なので、wa\")\n\telseif s == \"AC\" && d[p] == \"wa\"\n\t\td[p] = \"a\"\n\t\tac += 1\n\t\t#println(\"ac\")\n\tend\nend\nprintln(\"$ac $wa\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1037, "memory_kb": 168744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s542850765", "group_id": "codeNet:p02802", "input_text": "#=\nC:\n- Julia version: \n- Author: abap\n- Date: 2020-01-12\n=#\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nN,M = parseMap(split(readline()))\nd = Dict()\nwa = 0\nac = 0\nfor i in 1:M\n\tp,s = split(readline())\n\tp = parseInt(p)\n\tif !(in(7777,keys(d)))\n\t\tpush!(d,p=>\"no\")\n\tend\n\tif s == \"WA\" && (d[p] == \"no\" || d[p] == \"wa\")\n\t\twa += 1\n\telseif s == \"AC\" && (d[p] == \"no\" || d[p] == \"wa\")\n\t\td[p] = \"a\"\n\t\tac += 1\n\tend\nend\nprintln(\"$ac $wa\")", "language": "Julia", "metadata": {"date": 1578882879, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s542850765.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s542850765", "user_id": "u879294842"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "#=\nC:\n- Julia version: \n- Author: abap\n- Date: 2020-01-12\n=#\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nN,M = parseMap(split(readline()))\nd = Dict()\nwa = 0\nac = 0\nfor i in 1:M\n\tp,s = split(readline())\n\tp = parseInt(p)\n\tif !(in(7777,keys(d)))\n\t\tpush!(d,p=>\"no\")\n\tend\n\tif s == \"WA\" && (d[p] == \"no\" || d[p] == \"wa\")\n\t\twa += 1\n\telseif s == \"AC\" && (d[p] == \"no\" || d[p] == \"wa\")\n\t\td[p] = \"a\"\n\t\tac += 1\n\tend\nend\nprintln(\"$ac $wa\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 470, "cpu_time_ms": 997, "memory_kb": 182088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s317886114", "group_id": "codeNet:p02802", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\ta = Tuple{Int,Int}[(0,0) for i in 1:n]\n\tac = Dict{Int,Int}()\n\twa = 0\n\tfor i in 1:m\n\t\tp,x = readline() |> chomp |> split\n\t\tp = parseInt(p)\n\t\tif x==\"AC\"\n\t\t\tac[p]=1\n\t\telse\n\t\t\twa += 1\n\t\tend\n\tend\n\tprintln(length(ac),\" \",wa)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1578882652, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s317886114.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s317886114", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\ta = Tuple{Int,Int}[(0,0) for i in 1:n]\n\tac = Dict{Int,Int}()\n\twa = 0\n\tfor i in 1:m\n\t\tp,x = readline() |> chomp |> split\n\t\tp = parseInt(p)\n\t\tif x==\"AC\"\n\t\t\tac[p]=1\n\t\telse\n\t\t\twa += 1\n\t\tend\n\tend\n\tprintln(length(ac),\" \",wa)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 821, "memory_kb": 165772}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s436449713", "group_id": "codeNet:p02803", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n H,W = readint()\n S = String[]\n for _ in 1:H\n s = readline()\n append!(S,[s])\n end\n\n Lmax = H*W + 1\n d = Array{int,4}(undef, H,W,H,W)\n d .= H*W + 1\n\n mat = Array{int,4}(undef,H,W,H,W)\n mat .= 0\n\n for i in 1:H, j in 1:W\n S[i][j] == '#' && continue\n \n\n if i+1 <=H && S[i+1][j] == '.'\n mat[i,j,i+1,j] = 1\n mat[i+1,j,i,j] = 1\n end\n if j+1 <= W &&S[i][j+1] == '.'\n mat[i,j,i,j+1] = 1\n mat[i,j+1,i,j] = 1\n end\n end\n\n for i1 in 1:H, j1 in 1:W\n for i2 in 1:H, j2 in 1:W\n i1 == i2 && j1 == j2 && (d[i1,j1,i2,j2]=0)\n if mat[i1,j1, i2, j2] == 1\n d[i1,j1,i2,j2] = 1\n end\n end\n end\n for i1 in 1:H, j1 in 1:W\n for i2 in 1:H, j2 in 1:W\n for i3 in 1:H, j3 in 1:W\n d[i2,j2,i3,j3] = min(d[i2,j2,i3,j3] , d[i2,j2,i1,j1] + d[i3,j3,i1,j1])\n end\n end\n end\n\n s = 0\n for i in 1:H, j in 1:W\n for i2 in 1:H, j2 in 1:W\n if d[i,j,i2,j2] > s && d[i,j,i2,j2] s && d[i,j,i2,j2] parseInt\n\ta = zeros(Int,n,2)\n\tfor i in 1:n\n\t\ta[i,:]=readline() |> split |> parseMap\n\tend\n\tr = 0\n\trp = (0,0)\n\tfor i in 1:n-1\n\t\tx1 = a[i,1]\n\t\ty1 = a[i,2]\n\t\tfor j in i+1:n\n\t\t\tx2 = a[j,1]\n\t\t\ty2 = a[j,2]\n\t\t\tv = abs(x2-x1)^2+abs(y2-y1)^2\n\t\t\tif v>r\n\t\t\t\tr = v\n\t\t\t\trp = (i,j)\n\t\t\tend\n\t\tend\n\tend\n\tcx = 0.5*(a[rp[1],1]+a[rp[2],1])\n\tcy = 0.5*(a[rp[1],2]+a[rp[2],2])\n\tf = (a[rp[1],1]-a[rp[2],1])\n\tg = (a[rp[1],2]-a[rp[2],2])\n\th = cy*g-cx*f\n\tq = 0\n\tqx = 0\n\tfor i in 1:n\n\t\tif i!=rp[1]&&i!=rp[2]\n\t\t\tx = a[i,1]\n\t\t\ty = a[i,2]\n\t\t\tv = abs(f*x+g*y+h)\n\t\t\tif v>q\n\t\t\t\tq = v\n\t\t\t\tqx = i\n\t\t\tend\n\t\tend\n\tend\n\tif qx==0\n\t\tva = a[rp[1],:]\n\t\tvb = a[rp[2],:]\n\t\tprintln(sqrt((va[1]-vb[1])^2+(va[2]-vb[2])^2)*0.5)\n\telse\n\t\tva = a[rp[1],:]\n\t\tvb = a[rp[2],:]\n\t\tvc = a[qx,:]\n\t\tla = sqrt((va[1]-vb[1])^2+(va[2]-vb[2])^2)\n\t\tlb = sqrt((vc[1]-vb[1])^2+(vc[2]-vb[2])^2)\n\t\tlc = sqrt((va[1]-vc[1])^2+(va[2]-vc[2])^2)\n\t\tss = (la+lb+lc)*0.5\n\t\ts = sqrt(ss*(ss-la)*(ss-lb)*(ss-lc))\n\t\tra = acos((lb^2+lc^2-la^2)/(2*lb*lc))\n\t\tprintln(min(0.5*la/sin(pi-ra),sqrt((va[1]-vb[1])^2+(va[2]-vb[2])^2)*0.5))\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1578887205, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02805.html", "problem_id": "p02805", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02805/input.txt", "sample_output_relpath": "derived/input_output/data/p02805/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02805/Julia/s516902035.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s516902035", "user_id": "u095714878"}, "prompt_components": {"gold_output": "0.500000000000000000\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = zeros(Int,n,2)\n\tfor i in 1:n\n\t\ta[i,:]=readline() |> split |> parseMap\n\tend\n\tr = 0\n\trp = (0,0)\n\tfor i in 1:n-1\n\t\tx1 = a[i,1]\n\t\ty1 = a[i,2]\n\t\tfor j in i+1:n\n\t\t\tx2 = a[j,1]\n\t\t\ty2 = a[j,2]\n\t\t\tv = abs(x2-x1)^2+abs(y2-y1)^2\n\t\t\tif v>r\n\t\t\t\tr = v\n\t\t\t\trp = (i,j)\n\t\t\tend\n\t\tend\n\tend\n\tcx = 0.5*(a[rp[1],1]+a[rp[2],1])\n\tcy = 0.5*(a[rp[1],2]+a[rp[2],2])\n\tf = (a[rp[1],1]-a[rp[2],1])\n\tg = (a[rp[1],2]-a[rp[2],2])\n\th = cy*g-cx*f\n\tq = 0\n\tqx = 0\n\tfor i in 1:n\n\t\tif i!=rp[1]&&i!=rp[2]\n\t\t\tx = a[i,1]\n\t\t\ty = a[i,2]\n\t\t\tv = abs(f*x+g*y+h)\n\t\t\tif v>q\n\t\t\t\tq = v\n\t\t\t\tqx = i\n\t\t\tend\n\t\tend\n\tend\n\tif qx==0\n\t\tva = a[rp[1],:]\n\t\tvb = a[rp[2],:]\n\t\tprintln(sqrt((va[1]-vb[1])^2+(va[2]-vb[2])^2)*0.5)\n\telse\n\t\tva = a[rp[1],:]\n\t\tvb = a[rp[2],:]\n\t\tvc = a[qx,:]\n\t\tla = sqrt((va[1]-vb[1])^2+(va[2]-vb[2])^2)\n\t\tlb = sqrt((vc[1]-vb[1])^2+(vc[2]-vb[2])^2)\n\t\tlc = sqrt((va[1]-vc[1])^2+(va[2]-vc[2])^2)\n\t\tss = (la+lb+lc)*0.5\n\t\ts = sqrt(ss*(ss-la)*(ss-lb)*(ss-lc))\n\t\tra = acos((lb^2+lc^2-la^2)/(2*lb*lc))\n\t\tprintln(min(0.5*la/sin(pi-ra),sqrt((va[1]-vb[1])^2+(va[2]-vb[2])^2)*0.5))\n\tend\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are N points (x_i, y_i) in a two-dimensional plane.\n\nFind the minimum radius of a circle such that all the points are inside or on it.\n\nConstraints\n\n2 \\leq N \\leq 50\n\n0 \\leq x_i \\leq 1000\n\n0 \\leq y_i \\leq 1000\n\nThe given N points are all different.\n\nThe values in input are all 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 radius of a circle such that all the N points are inside or on it.\n\nYour output will be considered correct if the absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n2\n0 0\n1 0\n\nSample Output 1\n\n0.500000000000000000\n\nBoth points are contained in the circle centered at (0.5,0) with a radius of 0.5.\n\nSample Input 2\n\n3\n0 0\n0 1\n1 0\n\nSample Output 2\n\n0.707106781186497524\n\nSample Input 3\n\n10\n10 9\n5 9\n2 0\n0 0\n2 7\n3 3\n2 5\n10 0\n3 7\n1 9\n\nSample Output 3\n\n6.726812023536805158\n\nIf the absolute or relative error from our answer is at most 10^{-6}, the output will be considered correct.", "sample_input": "2\n0 0\n1 0\n"}, "reference_outputs": ["0.500000000000000000\n"], "source_document_id": "p02805", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are N points (x_i, y_i) in a two-dimensional plane.\n\nFind the minimum radius of a circle such that all the points are inside or on it.\n\nConstraints\n\n2 \\leq N \\leq 50\n\n0 \\leq x_i \\leq 1000\n\n0 \\leq y_i \\leq 1000\n\nThe given N points are all different.\n\nThe values in input are all 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 radius of a circle such that all the N points are inside or on it.\n\nYour output will be considered correct if the absolute or relative error from our answer is at most 10^{-6}.\n\nSample Input 1\n\n2\n0 0\n1 0\n\nSample Output 1\n\n0.500000000000000000\n\nBoth points are contained in the circle centered at (0.5,0) with a radius of 0.5.\n\nSample Input 2\n\n3\n0 0\n0 1\n1 0\n\nSample Output 2\n\n0.707106781186497524\n\nSample Input 3\n\n10\n10 9\n5 9\n2 0\n0 0\n2 7\n3 3\n2 5\n10 0\n3 7\n1 9\n\nSample Output 3\n\n6.726812023536805158\n\nIf the absolute or relative error from our answer is at most 10^{-6}, the output will be considered correct.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1185, "cpu_time_ms": 533, "memory_kb": 117960}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s912625245", "group_id": "codeNet:p02806", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n st=[split(readline()) for i in 1:n]\n x=readline()\n ans=0\n flg=false\n for i in 1:n\n if flg\n ans+=parseInt(st[i][2])\n end\n if st[i][1]==x\n flg=true\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1583790359, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02806.html", "problem_id": "p02806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02806/input.txt", "sample_output_relpath": "derived/input_output/data/p02806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02806/Julia/s912625245.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s912625245", "user_id": "u619197965"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n st=[split(readline()) for i in 1:n]\n x=readline()\n ans=0\n flg=false\n for i in 1:n\n if flg\n ans+=parseInt(st[i][2])\n end\n if st[i][1]==x\n flg=true\n end\n end\n println(ans)\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nNiwango created a playlist of N songs.\nThe title and the duration of the i-th song are s_i and t_i seconds, respectively.\nIt is guaranteed that s_1,\\ldots,s_N are all distinct.\n\nNiwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.)\nHowever, he fell asleep during his work, and he woke up after all the songs were played.\nAccording to his record, it turned out that he fell asleep at the very end of the song titled X.\n\nFind the duration of time when some song was played while Niwango was asleep.\n\nConstraints\n\n1 \\leq N \\leq 50\n\ns_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.\n\ns_1,\\ldots,s_N are distinct.\n\nThere exists an integer i such that s_i = X.\n\n1 \\leq t_i \\leq 1000\n\nt_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1 t_1\n\\vdots\ns_{N} t_N\nX\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\ndwango 2\nsixth 5\nprelims 25\ndwango\n\nSample Output 1\n\n30\n\nWhile Niwango was asleep, two songs were played: sixth and prelims.\n\nThe answer is the total duration of these songs, 30.\n\nSample Input 2\n\n1\nabcde 1000\nabcde\n\nSample Output 2\n\n0\n\nNo songs were played while Niwango was asleep.\n\nIn such a case, the total duration of songs is 0.\n\nSample Input 3\n\n15\nypnxn 279\nkgjgwx 464\nqquhuwq 327\nrxing 549\npmuduhznoaqu 832\ndagktgdarveusju 595\nwunfagppcoi 200\ndhavrncwfw 720\njpcmigg 658\nwrczqxycivdqn 639\nmcmkkbnjfeod 992\nhtqvkgkbhtytsz 130\ntwflegsjz 467\ndswxxrxuzzfhkp 989\nszfwtzfpnscgue 958\npmuduhznoaqu\n\nSample Output 3\n\n6348", "sample_input": "3\ndwango 2\nsixth 5\nprelims 25\ndwango\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02806", "source_text": "Score : 200 points\n\nProblem Statement\n\nNiwango created a playlist of N songs.\nThe title and the duration of the i-th song are s_i and t_i seconds, respectively.\nIt is guaranteed that s_1,\\ldots,s_N are all distinct.\n\nNiwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.)\nHowever, he fell asleep during his work, and he woke up after all the songs were played.\nAccording to his record, it turned out that he fell asleep at the very end of the song titled X.\n\nFind the duration of time when some song was played while Niwango was asleep.\n\nConstraints\n\n1 \\leq N \\leq 50\n\ns_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.\n\ns_1,\\ldots,s_N are distinct.\n\nThere exists an integer i such that s_i = X.\n\n1 \\leq t_i \\leq 1000\n\nt_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1 t_1\n\\vdots\ns_{N} t_N\nX\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\ndwango 2\nsixth 5\nprelims 25\ndwango\n\nSample Output 1\n\n30\n\nWhile Niwango was asleep, two songs were played: sixth and prelims.\n\nThe answer is the total duration of these songs, 30.\n\nSample Input 2\n\n1\nabcde 1000\nabcde\n\nSample Output 2\n\n0\n\nNo songs were played while Niwango was asleep.\n\nIn such a case, the total duration of songs is 0.\n\nSample Input 3\n\n15\nypnxn 279\nkgjgwx 464\nqquhuwq 327\nrxing 549\npmuduhznoaqu 832\ndagktgdarveusju 595\nwunfagppcoi 200\ndhavrncwfw 720\njpcmigg 658\nwrczqxycivdqn 639\nmcmkkbnjfeod 992\nhtqvkgkbhtytsz 130\ntwflegsjz 467\ndswxxrxuzzfhkp 989\nszfwtzfpnscgue 958\npmuduhznoaqu\n\nSample Output 3\n\n6348", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 832, "memory_kb": 169968}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s401617203", "group_id": "codeNet:p02806", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\td = Dict{String,Int}()\n\tct = 0\n\tfor i in 1:n\n\t\ts,t = readline() |> chomp |> split\n\t\tct += parseInt(t)\n\t\td[s]=ct\n\tend\n\tx = readline() |> chomp\n\tprintln(ct-d[x])\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1578828089, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02806.html", "problem_id": "p02806", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02806/input.txt", "sample_output_relpath": "derived/input_output/data/p02806/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02806/Julia/s401617203.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s401617203", "user_id": "u095714878"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\td = Dict{String,Int}()\n\tct = 0\n\tfor i in 1:n\n\t\ts,t = readline() |> chomp |> split\n\t\tct += parseInt(t)\n\t\td[s]=ct\n\tend\n\tx = readline() |> chomp\n\tprintln(ct-d[x])\nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nNiwango created a playlist of N songs.\nThe title and the duration of the i-th song are s_i and t_i seconds, respectively.\nIt is guaranteed that s_1,\\ldots,s_N are all distinct.\n\nNiwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.)\nHowever, he fell asleep during his work, and he woke up after all the songs were played.\nAccording to his record, it turned out that he fell asleep at the very end of the song titled X.\n\nFind the duration of time when some song was played while Niwango was asleep.\n\nConstraints\n\n1 \\leq N \\leq 50\n\ns_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.\n\ns_1,\\ldots,s_N are distinct.\n\nThere exists an integer i such that s_i = X.\n\n1 \\leq t_i \\leq 1000\n\nt_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1 t_1\n\\vdots\ns_{N} t_N\nX\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\ndwango 2\nsixth 5\nprelims 25\ndwango\n\nSample Output 1\n\n30\n\nWhile Niwango was asleep, two songs were played: sixth and prelims.\n\nThe answer is the total duration of these songs, 30.\n\nSample Input 2\n\n1\nabcde 1000\nabcde\n\nSample Output 2\n\n0\n\nNo songs were played while Niwango was asleep.\n\nIn such a case, the total duration of songs is 0.\n\nSample Input 3\n\n15\nypnxn 279\nkgjgwx 464\nqquhuwq 327\nrxing 549\npmuduhznoaqu 832\ndagktgdarveusju 595\nwunfagppcoi 200\ndhavrncwfw 720\njpcmigg 658\nwrczqxycivdqn 639\nmcmkkbnjfeod 992\nhtqvkgkbhtytsz 130\ntwflegsjz 467\ndswxxrxuzzfhkp 989\nszfwtzfpnscgue 958\npmuduhznoaqu\n\nSample Output 3\n\n6348", "sample_input": "3\ndwango 2\nsixth 5\nprelims 25\ndwango\n"}, "reference_outputs": ["30\n"], "source_document_id": "p02806", "source_text": "Score : 200 points\n\nProblem Statement\n\nNiwango created a playlist of N songs.\nThe title and the duration of the i-th song are s_i and t_i seconds, respectively.\nIt is guaranteed that s_1,\\ldots,s_N are all distinct.\n\nNiwango was doing some work while playing this playlist. (That is, all the songs were played once, in the order they appear in the playlist, without any pause in between.)\nHowever, he fell asleep during his work, and he woke up after all the songs were played.\nAccording to his record, it turned out that he fell asleep at the very end of the song titled X.\n\nFind the duration of time when some song was played while Niwango was asleep.\n\nConstraints\n\n1 \\leq N \\leq 50\n\ns_i and X are strings of length between 1 and 100 (inclusive) consisting of lowercase English letters.\n\ns_1,\\ldots,s_N are distinct.\n\nThere exists an integer i such that s_i = X.\n\n1 \\leq t_i \\leq 1000\n\nt_i is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1 t_1\n\\vdots\ns_{N} t_N\nX\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\ndwango 2\nsixth 5\nprelims 25\ndwango\n\nSample Output 1\n\n30\n\nWhile Niwango was asleep, two songs were played: sixth and prelims.\n\nThe answer is the total duration of these songs, 30.\n\nSample Input 2\n\n1\nabcde 1000\nabcde\n\nSample Output 2\n\n0\n\nNo songs were played while Niwango was asleep.\n\nIn such a case, the total duration of songs is 0.\n\nSample Input 3\n\n15\nypnxn 279\nkgjgwx 464\nqquhuwq 327\nrxing 549\npmuduhznoaqu 832\ndagktgdarveusju 595\nwunfagppcoi 200\ndhavrncwfw 720\njpcmigg 658\nwrczqxycivdqn 639\nmcmkkbnjfeod 992\nhtqvkgkbhtytsz 130\ntwflegsjz 467\ndswxxrxuzzfhkp 989\nszfwtzfpnscgue 958\npmuduhznoaqu\n\nSample Output 3\n\n6348", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 352, "memory_kb": 111756}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s584718982", "group_id": "codeNet:p02812", "input_text": "function main()\n \n N = parse(Int,readline())\n S = split(chomp(readline()),\"\")\n \n count = 0\n \n for i in 1:N-2\n \n if S[i] == \"A\" && S[i+1] == \"B\" && S[i+2] == \"C\"\n count += 1\n end\n \n end\n \n println(count)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1580536193, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s584718982.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s584718982", "user_id": "u790457721"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n \n N = parse(Int,readline())\n S = split(chomp(readline()),\"\")\n \n count = 0\n \n for i in 1:N-2\n \n if S[i] == \"A\" && S[i+1] == \"B\" && S[i+2] == \"C\"\n count += 1\n end\n \n end\n \n println(count)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 343, "memory_kb": 110216}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s937504412", "group_id": "codeNet:p02813", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\narr=Vector{Vector{Int}}()\nfunction dfs(n,array,cnt)\n if n==cnt\n push!(arr,array)\n return 0\n end\n for i in 1:n\n if !(i in array)\n dfs(n,vcat(array,[i]),cnt+1)\n end\n end\nend\n\nfunction main()\n n=parseInt(readline())\n p=parseMap(split(readline()))\n q=parseMap(split(readline()))\n dfs(n,Vector{Int}(),0)\n a=findfirst(x->x==p,arr)\n b=findfirst(x->x==q,arr)\n println(abs(a-b))\nend\nmain()", "language": "Julia", "metadata": {"date": 1584979396, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s937504412.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s937504412", "user_id": "u619197965"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\narr=Vector{Vector{Int}}()\nfunction dfs(n,array,cnt)\n if n==cnt\n push!(arr,array)\n return 0\n end\n for i in 1:n\n if !(i in array)\n dfs(n,vcat(array,[i]),cnt+1)\n end\n end\nend\n\nfunction main()\n n=parseInt(readline())\n p=parseMap(split(readline()))\n q=parseMap(split(readline()))\n dfs(n,Vector{Int}(),0)\n a=findfirst(x->x==p,arr)\n b=findfirst(x->x==q,arr)\n println(abs(a-b))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 461, "memory_kb": 141332}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s850508319", "group_id": "codeNet:p02814", "input_text": "parseline(str=readline()) = parse.(Int, split(str))\nfunction SemiCommonMultiple()\n N, M = parseline()\n A = parseline()\n a = div.(A, 2)\n temp = a\n zero = zeros(Int, N)\n while temp≠zero\n temp_ = temp.%2\n if 0 in temp_\n temp_==zero && (temp = div.(temp, 2); continue)\n return println(0)\n else\n break\n end\n end\n X = lcm(a)\n println(X>M ? 0 : (M - X)÷2X + 1)\nend\nSemiCommonMultiple()", "language": "Julia", "metadata": {"date": 1599670975, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s850508319.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s850508319", "user_id": "u728564399"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseline(str=readline()) = parse.(Int, split(str))\nfunction SemiCommonMultiple()\n N, M = parseline()\n A = parseline()\n a = div.(A, 2)\n temp = a\n zero = zeros(Int, N)\n while temp≠zero\n temp_ = temp.%2\n if 0 in temp_\n temp_==zero && (temp = div.(temp, 2); continue)\n return println(0)\n else\n break\n end\n end\n X = lcm(a)\n println(X>M ? 0 : (M - X)÷2X + 1)\nend\nSemiCommonMultiple()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 469, "cpu_time_ms": 1405, "memory_kb": 279168}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s610837389", "group_id": "codeNet:p02814", "input_text": "function main()\n\tN,M=map(x->parse(Int,x),split(readline()))\n\tg=0\n\tc=-1\n\tfor a=map(x->parse(Int,x),split(readline()))\n\t\ta>>=1\n\t\tg=gcd(g,a)\n\t\tt=0\n\t\twhile a%2==0\n\t\t\ta>>=1\n\t\t\tt+=1\n\t\tend\n\t\tif c<0\n\t\t\tc=t\n\t\telseif c!=t\n\t\t\tprintln(0)\n\t\t\texit()\n\t\tend\n\tend\n\tif g>M\n\t\tprintln(0)\n\telse\n\t\tt=div(M,g)\n\t\tprintln(div(t+1,2))\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1578728178, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s610837389.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s610837389", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n\tN,M=map(x->parse(Int,x),split(readline()))\n\tg=0\n\tc=-1\n\tfor a=map(x->parse(Int,x),split(readline()))\n\t\ta>>=1\n\t\tg=gcd(g,a)\n\t\tt=0\n\t\twhile a%2==0\n\t\t\ta>>=1\n\t\t\tt+=1\n\t\tend\n\t\tif c<0\n\t\t\tc=t\n\t\telseif c!=t\n\t\t\tprintln(0)\n\t\t\texit()\n\t\tend\n\tend\n\tif g>M\n\t\tprintln(0)\n\telse\n\t\tt=div(M,g)\n\t\tprintln(div(t+1,2))\n\tend\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 846, "memory_kb": 168112}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s082875704", "group_id": "codeNet:p02814", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tb = [a[i]>>1 for i in 1:n]\n\tx = lcm(b)\n\tf = 10^18\n\tfor i in 1:n\n\t\tif b[i]%2==0\n\t\t\tf = min(f,b[i])\n\t\tend\n\tend\n\tprintln(f==10^18?(div(m,x)+1)>>1:(div(min(m,2*f),x)+1)>>1)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1578712244, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s082875704.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s082875704", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tb = [a[i]>>1 for i in 1:n]\n\tx = lcm(b)\n\tf = 10^18\n\tfor i in 1:n\n\t\tif b[i]%2==0\n\t\t\tf = min(f,b[i])\n\t\tend\n\tend\n\tprintln(f==10^18?(div(m,x)+1)>>1:(div(min(m,2*f),x)+1)>>1)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 361, "cpu_time_ms": 893, "memory_kb": 170776}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s937324775", "group_id": "codeNet:p02816", "input_text": "function Zalgo(s)\n\tN=length(s)\n\tret=zeros(Int,N)\n\tret[1]=N\n\ti=1\n\tj=0\n\twhile iparse(Int,x),split(readline()))\n\tB=map(x->parse(Int,x),split(readline()))\n\ta=zeros(Int,3N)\n\tfor i=1:N\n\t\ta[i]=B[i]$B[mod1(i+1,N)]\n\t\ta[i+N]=a[i+2N]=A[i]$A[mod1(i+1,N)]\n\tend\n\tL=Zalgo(a)\n\tfor k=1:N\n\t\tif L[k+N]>=N\n\t\t\tprintln(\"$(k-1) $(A[k]$B[1])\")\n\t\tend\n\tend\nend\nmain()", "language": "Julia", "metadata": {"date": 1578735125, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02816.html", "problem_id": "p02816", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02816/input.txt", "sample_output_relpath": "derived/input_output/data/p02816/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02816/Julia/s937324775.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s937324775", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 3\n", "input_to_evaluate": "function Zalgo(s)\n\tN=length(s)\n\tret=zeros(Int,N)\n\tret[1]=N\n\ti=1\n\tj=0\n\twhile iparse(Int,x),split(readline()))\n\tB=map(x->parse(Int,x),split(readline()))\n\ta=zeros(Int,3N)\n\tfor i=1:N\n\t\ta[i]=B[i]$B[mod1(i+1,N)]\n\t\ta[i+N]=a[i+2N]=A[i]$A[mod1(i+1,N)]\n\tend\n\tL=Zalgo(a)\n\tfor k=1:N\n\t\tif L[k+N]>=N\n\t\t\tprintln(\"$(k-1) $(A[k]$B[1])\")\n\t\tend\n\tend\nend\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are two sequences a=\\{a_0,\\ldots,a_{N-1}\\} and b=\\{b_0,\\ldots,b_{N-1}\\} of N non-negative integers each.\n\nSnuke will choose an integer k such that 0 \\leq k < N and an integer x not less than 0, to make a new sequence of length N, a'=\\{a_0',\\ldots,a_{N-1}'\\}, as follows:\n\na_i'= a_{i+k \\mod N}\\ XOR \\ x\n\nFind all pairs (k,x) such that a' will be equal to b.\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i,b_i < 2^{30}\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_{N-1}\nb_0 b_1 ... b_{N-1}\n\nOutput\n\nPrint all pairs (k, x) such that a' and b will be equal, using one line for each pair, in ascending order of k (ascending order of x for pairs with the same k).\n\nIf there are no such pairs, the output should be empty.\n\nSample Input 1\n\n3\n0 2 1\n1 2 3\n\nSample Output 1\n\n1 3\n\nIf (k,x)=(1,3),\n\na_0'=(a_1\\ XOR \\ 3)=1\n\na_1'=(a_2\\ XOR \\ 3)=2\n\na_2'=(a_0\\ XOR \\ 3)=3\n\nand we have a' = b.\n\nSample Input 2\n\n5\n0 0 0 0 0\n2 2 2 2 2\n\nSample Output 2\n\n0 2\n1 2\n2 2\n3 2\n4 2\n\nSample Input 3\n\n6\n0 1 3 7 6 4\n1 5 4 6 2 3\n\nSample Output 3\n\n2 2\n5 5\n\nSample Input 4\n\n2\n1 2\n0 0\n\nSample Output 4\n\nNo pairs may satisfy the condition.", "sample_input": "3\n0 2 1\n1 2 3\n"}, "reference_outputs": ["1 3\n"], "source_document_id": "p02816", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are two sequences a=\\{a_0,\\ldots,a_{N-1}\\} and b=\\{b_0,\\ldots,b_{N-1}\\} of N non-negative integers each.\n\nSnuke will choose an integer k such that 0 \\leq k < N and an integer x not less than 0, to make a new sequence of length N, a'=\\{a_0',\\ldots,a_{N-1}'\\}, as follows:\n\na_i'= a_{i+k \\mod N}\\ XOR \\ x\n\nFind all pairs (k,x) such that a' will be equal to b.\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n0 \\leq a_i,b_i < 2^{30}\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_{N-1}\nb_0 b_1 ... b_{N-1}\n\nOutput\n\nPrint all pairs (k, x) such that a' and b will be equal, using one line for each pair, in ascending order of k (ascending order of x for pairs with the same k).\n\nIf there are no such pairs, the output should be empty.\n\nSample Input 1\n\n3\n0 2 1\n1 2 3\n\nSample Output 1\n\n1 3\n\nIf (k,x)=(1,3),\n\na_0'=(a_1\\ XOR \\ 3)=1\n\na_1'=(a_2\\ XOR \\ 3)=2\n\na_2'=(a_0\\ XOR \\ 3)=3\n\nand we have a' = b.\n\nSample Input 2\n\n5\n0 0 0 0 0\n2 2 2 2 2\n\nSample Output 2\n\n0 2\n1 2\n2 2\n3 2\n4 2\n\nSample Input 3\n\n6\n0 1 3 7 6 4\n1 5 4 6 2 3\n\nSample Output 3\n\n2 2\n5 5\n\nSample Input 4\n\n2\n1 2\n0 0\n\nSample Output 4\n\nNo pairs may satisfy the condition.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 589, "cpu_time_ms": 1114, "memory_kb": 173808}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s842566177", "group_id": "codeNet:p02817", "input_text": "s, t = split(readline())\n\nprintln(t,s)", "language": "Julia", "metadata": {"date": 1598422897, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s842566177.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s842566177", "user_id": "u906651641"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "s, t = split(readline())\n\nprintln(t,s)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 38, "cpu_time_ms": 208, "memory_kb": 156628}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s795479594", "group_id": "codeNet:p02817", "input_text": "a,b=split(readline())\nprint(b+a)", "language": "Julia", "metadata": {"date": 1585088644, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s795479594.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s795479594", "user_id": "u443151804"}, "prompt_components": {"gold_output": "atcoder\n", "input_to_evaluate": "a,b=split(readline())\nprint(b+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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 32, "cpu_time_ms": 1471, "memory_kb": 161792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s836895357", "group_id": "codeNet:p02818", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n a,b,k=parseMap(split(readline()))\n a,b=max(0,a-k),ifelse(a<=k,max(0,b-(k-a)),b)\n println(\"$a $b\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1582689388, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s836895357.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s836895357", "user_id": "u619197965"}, "prompt_components": {"gold_output": "0 2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n a,b,k=parseMap(split(readline()))\n a,b=max(0,a-k),ifelse(a<=k,max(0,b-(k-a)),b)\n println(\"$a $b\")\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 335, "memory_kb": 111480}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s922234907", "group_id": "codeNet:p02819", "input_text": "function check(n)\n \n for i in 2:round(Int,sqrt(n))\n \n if n % i == 0\n return false\n end\n \n end\n \n return true\n \nend\n\nfunction main()\n \n X = parse(Int, readline())\n \n prime = false\n \n while prime == false\n \n\tprime = check(X)\n X += 1\n \n end\n\t\n println(X-1)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577941677, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s922234907.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s922234907", "user_id": "u790457721"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "function check(n)\n \n for i in 2:round(Int,sqrt(n))\n \n if n % i == 0\n return false\n end\n \n end\n \n return true\n \nend\n\nfunction main()\n \n X = parse(Int, readline())\n \n prime = false\n \n while prime == false\n \n\tprime = check(X)\n X += 1\n \n end\n\t\n println(X-1)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 308, "memory_kb": 112284}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s934423993", "group_id": "codeNet:p02819", "input_text": "N=parse(readline())\nwhile 1>0\n f=0\n for i=2:isqrt(N)\n if N%i==0\n f+=1\n end\n end\n if f==0\n println(N)\n exit()\n end\n N+=1\nend", "language": "Julia", "metadata": {"date": 1577676974, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s934423993.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s934423993", "user_id": "u657913472"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "N=parse(readline())\nwhile 1>0\n f=0\n for i=2:isqrt(N)\n if N%i==0\n f+=1\n end\n end\n if f==0\n println(N)\n exit()\n end\n N+=1\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 795, "memory_kb": 167448}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s177175103", "group_id": "codeNet:p02820", "input_text": "parseline(str=readline()) = parse.(Int, split(str))\nfunction PredictionAndRestriction()\n N, K = parseline()\n R, S, P = parseline()\n score = zeros(Int, N)\n T = readline()\n for n in 1:N\n if T[n]=='r'\n score[n] = P\n elseif T[n]=='s'\n score[n] = R\n else\n score[n] = S\n end\n end\n for k in 1:K\n now = k + K\n while now ≤ N\n T[now-K] == T[now] && (score[now]=0)\n now += K\n end\n end\n println(sum(score))\nend\nPredictionAndRestriction()", "language": "Julia", "metadata": {"date": 1599885118, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s177175103.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s177175103", "user_id": "u728564399"}, "prompt_components": {"gold_output": "27\n", "input_to_evaluate": "parseline(str=readline()) = parse.(Int, split(str))\nfunction PredictionAndRestriction()\n N, K = parseline()\n R, S, P = parseline()\n score = zeros(Int, N)\n T = readline()\n for n in 1:N\n if T[n]=='r'\n score[n] = P\n elseif T[n]=='s'\n score[n] = R\n else\n score[n] = S\n end\n end\n for k in 1:K\n now = k + K\n while now ≤ N\n T[now-K] == T[now] && (score[now]=0)\n now += K\n end\n end\n println(sum(score))\nend\nPredictionAndRestriction()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 558, "cpu_time_ms": 289, "memory_kb": 176172}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s399345765", "group_id": "codeNet:p02820", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,k=parseMap(split(readline()))\n r,s,p=parseMap(split(readline()))\n t=chomp(readline())\n good=\"\"\n win=Dict{Char,Char}('r'=>'p','s'=>'r','p'=>'s')\n point=Dict{Char,Int}('r'=>r,'s'=>s,'p'=>p)\n ans=0\n good=join([win[i] for i in t])\n ok=[true for i in 1:n]\n for i in 1:n\n if i<=k || good[i-k]!=good[i] || !ok[i-k]\n ans+=point[good[i]]\n else\n ok[i]=false\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1583033545, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s399345765.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s399345765", "user_id": "u619197965"}, "prompt_components": {"gold_output": "27\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,k=parseMap(split(readline()))\n r,s,p=parseMap(split(readline()))\n t=chomp(readline())\n good=\"\"\n win=Dict{Char,Char}('r'=>'p','s'=>'r','p'=>'s')\n point=Dict{Char,Int}('r'=>r,'s'=>s,'p'=>p)\n ans=0\n good=join([win[i] for i in t])\n ok=[true for i in 1:n]\n for i in 1:n\n if i<=k || good[i-k]!=good[i] || !ok[i-k]\n ans+=point[good[i]]\n else\n ok[i]=false\n end\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 567, "cpu_time_ms": 728, "memory_kb": 133144}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s590436263", "group_id": "codeNet:p02823", "input_text": "\n\n\nparseInt(x) = parse(Int,x)\nN,A,B= parseInt.(split(readline()))\n\nprintln(min(A-1,N-B) + 1 + cld((B-A-1),2))", "language": "Julia", "metadata": {"date": 1579624831, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s590436263.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s590436263", "user_id": "u879294842"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "\n\n\nparseInt(x) = parse(Int,x)\nN,A,B= parseInt.(split(readline()))\n\nprintln(min(A-1,N-B) + 1 + cld((B-A-1),2))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 811, "memory_kb": 169108}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s264920554", "group_id": "codeNet:p02823", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,a,b = readline() |> split |> parseMap\n\tif a%2==b%2\n\t\tprintln(min(n-min(a,b)-1,max(a,b)-1,(b-a)>>1))\n\telse\n\t\tprintln(min(n-min(a,b)-1,max(a,b)-1))\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577596028, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s264920554.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s264920554", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,a,b = readline() |> split |> parseMap\n\tif a%2==b%2\n\t\tprintln(min(n-min(a,b)-1,max(a,b)-1,(b-a)>>1))\n\telse\n\t\tprintln(min(n-min(a,b)-1,max(a,b)-1))\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 801, "memory_kb": 168444}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s939677138", "group_id": "codeNet:p02825", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tif n%3 != 0\n\t\tprintln(-1)\n\telse\n\t\tfor i in 1:n\n\t\t\tfor j in 1:n-1\n\t\t\t\tif (i%3==0&&j%3!=0)||(i%3!=0&&j%3==0)\n\t\t\t\t\tprint(\"a \")\n\t\t\t\telse\n\t\t\t\t\tprint(\". \")\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (i%3==0&&n%3!=0)||(i%3!=0&&n%3==0)\n\t\t\t\tprintln(\"a\")\n\t\t\telse\n\t\t\t\tprintln(\".\")\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577594094, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02825.html", "problem_id": "p02825", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02825/input.txt", "sample_output_relpath": "derived/input_output/data/p02825/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02825/Julia/s939677138.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s939677138", "user_id": "u095714878"}, "prompt_components": {"gold_output": "aabb..\nb..zz.\nba....\n.a..aa\n..a..b\n..a..b\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tif n%3 != 0\n\t\tprintln(-1)\n\telse\n\t\tfor i in 1:n\n\t\t\tfor j in 1:n-1\n\t\t\t\tif (i%3==0&&j%3!=0)||(i%3!=0&&j%3==0)\n\t\t\t\t\tprint(\"a \")\n\t\t\t\telse\n\t\t\t\t\tprint(\". \")\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (i%3==0&&n%3!=0)||(i%3!=0&&n%3==0)\n\t\t\t\tprintln(\"a\")\n\t\t\telse\n\t\t\t\tprintln(\".\")\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 900 points\n\nProblem Statement\n\nLet us consider a grid of squares with N rows and N columns. You want to put some domino pieces on this grid.\nEach domino piece covers two squares that have a common side. Each square can be covered by at most one piece.\n\nFor each row of the grid, let's define its quality as the number of domino pieces that cover at least one square in this row.\nWe define the quality of each column similarly.\n\nFind a way to put at least one domino piece on the grid so that the quality of every row is equal to the quality of every column,\nor determine that such a placement doesn't exist.\n\nConstraints\n\n2 \\le N \\le 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf the required domino placement doesn't exist, print a single integer -1.\n\nOtherwise, output your placement as N strings of N characters each.\nIf a square is not covered, the corresponding character must be . (a dot).\nOtherwise, it must contain a lowercase English letter.\nSquares covered by the same domino piece must contain the same letter.\nIf two squares have a common side but belong to different pieces, they must contain different letters.\n\nSample Input 1\n\n6\n\nSample Output 1\n\naabb..\nb..zz.\nba....\n.a..aa\n..a..b\n..a..b\n\nThe quality of every row and every column is 2.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1", "sample_input": "6\n"}, "reference_outputs": ["aabb..\nb..zz.\nba....\n.a..aa\n..a..b\n..a..b\n"], "source_document_id": "p02825", "source_text": "Score : 900 points\n\nProblem Statement\n\nLet us consider a grid of squares with N rows and N columns. You want to put some domino pieces on this grid.\nEach domino piece covers two squares that have a common side. Each square can be covered by at most one piece.\n\nFor each row of the grid, let's define its quality as the number of domino pieces that cover at least one square in this row.\nWe define the quality of each column similarly.\n\nFind a way to put at least one domino piece on the grid so that the quality of every row is equal to the quality of every column,\nor determine that such a placement doesn't exist.\n\nConstraints\n\n2 \\le N \\le 1000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf the required domino placement doesn't exist, print a single integer -1.\n\nOtherwise, output your placement as N strings of N characters each.\nIf a square is not covered, the corresponding character must be . (a dot).\nOtherwise, it must contain a lowercase English letter.\nSquares covered by the same domino piece must contain the same letter.\nIf two squares have a common side but belong to different pieces, they must contain different letters.\n\nSample Input 1\n\n6\n\nSample Output 1\n\naabb..\nb..zz.\nba....\n.a..aa\n..a..b\n..a..b\n\nThe quality of every row and every column is 2.\n\nSample Input 2\n\n2\n\nSample Output 2\n\n-1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 374, "memory_kb": 112136}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s791827866", "group_id": "codeNet:p02829", "input_text": "function main()\n a = parse(Int, readline())\n b = parse(Int, readline())\n println(6-a-b)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1577232295, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s791827866.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s791827866", "user_id": "u916743460"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n a = parse(Int, readline())\n b = parse(Int, readline())\n println(6-a-b)\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 103, "cpu_time_ms": 301, "memory_kb": 109856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s200556797", "group_id": "codeNet:p02829", "input_text": "a = parse(Int, readline())\nb = parse(Int, readline())\nprintln(6-a-b)\n", "language": "Julia", "metadata": {"date": 1577232235, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s200556797.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s200556797", "user_id": "u916743460"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a = parse(Int, readline())\nb = parse(Int, readline())\nprintln(6-a-b)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 291, "memory_kb": 108284}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s833453868", "group_id": "codeNet:p02829", "input_text": "println(6-parse(readline())-parse(readline()))", "language": "Julia", "metadata": {"date": 1577071669, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s833453868.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s833453868", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "println(6-parse(readline())-parse(readline()))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 46, "cpu_time_ms": 645, "memory_kb": 162608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s873555720", "group_id": "codeNet:p02830", "input_text": "n=parse(Int,readline())\na,b=split(readline())\nfor i=1:n\n print(a[i],b[i])\nend", "language": "Julia", "metadata": {"date": 1588290120, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s873555720.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s873555720", "user_id": "u443151804"}, "prompt_components": {"gold_output": "icpc\n", "input_to_evaluate": "n=parse(Int,readline())\na,b=split(readline())\nfor i=1:n\n print(a[i],b[i])\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 78, "cpu_time_ms": 870, "memory_kb": 164100}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s470707050", "group_id": "codeNet:p02831", "input_text": "print(lcm(parse.(split(readline()))))", "language": "Julia", "metadata": {"date": 1589005207, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s470707050.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s470707050", "user_id": "u443151804"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "print(lcm(parse.(split(readline()))))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1190, "memory_kb": 176952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s766642746", "group_id": "codeNet:p02831", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ta,b = readline() |> split |> parseMap\n\tprintln(lcm(a,b))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577067608, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s766642746.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s766642746", "user_id": "u095714878"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ta,b = readline() |> split |> parseMap\n\tprintln(lcm(a,b))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 815, "memory_kb": 170492}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s373477617", "group_id": "codeNet:p02832", "input_text": "function main()\n \n N = parse(Int, readline())\n a = map(x -> parse(Int, x), split(readline()))\n \n cnt = 0\n check = 1\n \n for i in a\n if i == check\n check += 1\n else\n cnt += 1\n end\n end\n \n if cnt == N\n println(-1)\n else\n println(cnt)\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1588002002, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s373477617.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s373477617", "user_id": "u790457721"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n \n N = parse(Int, readline())\n a = map(x -> parse(Int, x), split(readline()))\n \n cnt = 0\n check = 1\n \n for i in a\n if i == check\n check += 1\n else\n cnt += 1\n end\n end\n \n if cnt == N\n println(-1)\n else\n println(cnt)\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 289, "cpu_time_ms": 721, "memory_kb": 166136}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s411166720", "group_id": "codeNet:p02832", "input_text": "N=parse(readline())\nc=1\nfor a=map(x->parse(Int,x),split(readline()))\n if c==a\n c+=1\n end\nend\nprintln(c==1 ? -1 : N-c+1)", "language": "Julia", "metadata": {"date": 1577071763, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s411166720.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s411166720", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N=parse(readline())\nc=1\nfor a=map(x->parse(Int,x),split(readline()))\n if c==a\n c+=1\n end\nend\nprintln(c==1 ? -1 : N-c+1)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 124, "cpu_time_ms": 716, "memory_kb": 168344}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s536974712", "group_id": "codeNet:p02835", "input_text": "parseInt(x) = parse(Int, x)\na,b,c = parseInt.(split(readline()))\nif a + b + c >= 22\n println(\"bust\")\nelse\n println(\"win\")\nend", "language": "Julia", "metadata": {"date": 1582332593, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02835.html", "problem_id": "p02835", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02835/input.txt", "sample_output_relpath": "derived/input_output/data/p02835/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02835/Julia/s536974712.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s536974712", "user_id": "u106297876"}, "prompt_components": {"gold_output": "win\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\na,b,c = parseInt.(split(readline()))\nif a + b + c >= 22\n println(\"bust\")\nelse\n println(\"win\")\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven are three integers A_1, A_2, and A_3.\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nConstraints\n\n1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nSample Input 1\n\n5 7 9\n\nSample Output 1\n\nwin\n\n5+7+9=21, so print win.\n\nSample Input 2\n\n13 7 2\n\nSample Output 2\n\nbust\n\n13+7+2=22, so print bust.", "sample_input": "5 7 9\n"}, "reference_outputs": ["win\n"], "source_document_id": "p02835", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven are three integers A_1, A_2, and A_3.\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nConstraints\n\n1 \\leq A_i \\leq 13 \\ \\ (i=1,2,3)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA_1 A_2 A_3\n\nOutput\n\nIf A_1+A_2+A_3 is greater than or equal to 22, print bust; otherwise, print win.\n\nSample Input 1\n\n5 7 9\n\nSample Output 1\n\nwin\n\n5+7+9=21, so print win.\n\nSample Input 2\n\n13 7 2\n\nSample Output 2\n\nbust\n\n13+7+2=22, so print bust.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 406, "memory_kb": 114136}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s733309119", "group_id": "codeNet:p02837", "input_text": "xor(a,b)=a$b\nN=parse(Int,readline())\nA=zeros(Int,N)\nB=zeros(Int,N)\nfor i=1:N\n\ta=parse(Int,readline())\n\tfor _=1:a\n\t\tx,y=map(x->parse(Int,x),split(readline()))\n\t\tif y==1\n\t\t\tA[i]=xor(A[i],2^(x-1))\n\t\telse\n\t\t\tB[i]=xor(B[i],2^(x-1))\n\t\tend\n\tend\nend\nans=0\nfor m=0:2^N-1\n\tt=m\n\tf=(2^N-1)&~m\n\tcnt=0\n\tfor i=1:N\n\t\tif (m>>(i-1))%2==1\n\t\t\tt=t|A[i]\n\t\t\tf=f|B[i]\n\t\t\tcnt+=1\n\t\tend\n\tend\n\tif (t&f)==0\n\t\tans=max(ans,cnt)\n\tend\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1577420074, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02837.html", "problem_id": "p02837", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02837/input.txt", "sample_output_relpath": "derived/input_output/data/p02837/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02837/Julia/s733309119.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s733309119", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "xor(a,b)=a$b\nN=parse(Int,readline())\nA=zeros(Int,N)\nB=zeros(Int,N)\nfor i=1:N\n\ta=parse(Int,readline())\n\tfor _=1:a\n\t\tx,y=map(x->parse(Int,x),split(readline()))\n\t\tif y==1\n\t\t\tA[i]=xor(A[i],2^(x-1))\n\t\telse\n\t\t\tB[i]=xor(B[i],2^(x-1))\n\t\tend\n\tend\nend\nans=0\nfor m=0:2^N-1\n\tt=m\n\tf=(2^N-1)&~m\n\tcnt=0\n\tfor i=1:N\n\t\tif (m>>(i-1))%2==1\n\t\t\tt=t|A[i]\n\t\t\tf=f|B[i]\n\t\t\tcnt+=1\n\t\tend\n\tend\n\tif (t&f)==0\n\t\tans=max(ans,cnt)\n\tend\nend\nprintln(ans)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "sample_input": "3\n1\n2 1\n1\n1 1\n1\n2 0\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02837", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 591, "memory_kb": 149888}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s383923132", "group_id": "codeNet:p02837", "input_text": "#=\nC:\n- Julia version: \n- Author: abap\n- Date: 2019-12-21\n=#\n\nfunction return_all_pettern(x) #bit全探索\n count_pettern = x ^ 2\n b = []\n for i in 0:count_pettern - 1\n bit = bin(i, x)\n bits = []\n for j in 1:x\n push!(bits, bit[j])\n end\n bits = [bits .== '1']\n push!(b, bits)\n end\n #println(length(b))\n return b\nend\n\n\nfunction main()\nXY = Dict{Int64, Array{Any,1}}() # xıとyıの格納先\nN = parse(Int,readline())\nfor i in 1:N\n A = parse(Int,readline())\n for j in 1:A\n xy = parse.(split(readline()))\n xy[2] = xy[2] == 1\n push!(XY,i=>xy) # i = 発言者 xy = 主張\n end\nend\npetterns = return_all_pettern(length(keys(XY))) # 全ての部分集合を取得\nres_said = []\nfor i in 1:length(petterns) # それぞれの部分集合についての結果の格納先\n push!(res_said,[])\nend\nfor jj in 1:length(petterns) # 特定の格納先に入れるためにインデックスを回す\n pettern = petterns[jj]\n honest_list = collect(1:N)[sum(pettern)]\n for k in honest_list\n push!(res_said[jj],[k,1]) # 発言している人は本物\n push!(res_said[jj], [XY[k][1],Bool(XY[k][2]) ] ) # 本物の言っている人も本物\n end\nend\nglobal kari_ans = []\nfor i in 1:length(petterns) # それぞれの仮の答えについての結果の格納先\n push!(kari_ans,[])\nend\n\nfor kk in 1:length(petterns) # 特定の格納先に入れるためにインデックスを回す\n res = res_said[kk]\n if res == []\n ans = 0\n else\n for ik in res\n push!(kari_ans[kk],[ik[1],ik[2]])\n end\n end\nend\nans_list = []\nfor kari in kari_ans\n #println(kari)\n honest_count = 0\n kari = unique(kari)\n for i in kari # それぞれの結果について検証する\n #println(i)\n if i[2] == 0\n another_ans = [i[1],1] # 違う答えがないかチェック\n else\n another_ans = [i[1],0]\n #=count = 0\n for jj in kari\n if jj == i\n count += 1\n end\n end\n if count == 1\n honest_count += 1 # 同じ答えが何回もあるときはカウントしない\n end=#\n end\n if another_ans in kari\n honest_count = 0\n break\n end\n end\n push!(ans_list,honest_count)\nend\nprintln(maximum(ans_list))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577039317, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02837.html", "problem_id": "p02837", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02837/input.txt", "sample_output_relpath": "derived/input_output/data/p02837/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02837/Julia/s383923132.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s383923132", "user_id": "u879294842"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "#=\nC:\n- Julia version: \n- Author: abap\n- Date: 2019-12-21\n=#\n\nfunction return_all_pettern(x) #bit全探索\n count_pettern = x ^ 2\n b = []\n for i in 0:count_pettern - 1\n bit = bin(i, x)\n bits = []\n for j in 1:x\n push!(bits, bit[j])\n end\n bits = [bits .== '1']\n push!(b, bits)\n end\n #println(length(b))\n return b\nend\n\n\nfunction main()\nXY = Dict{Int64, Array{Any,1}}() # xıとyıの格納先\nN = parse(Int,readline())\nfor i in 1:N\n A = parse(Int,readline())\n for j in 1:A\n xy = parse.(split(readline()))\n xy[2] = xy[2] == 1\n push!(XY,i=>xy) # i = 発言者 xy = 主張\n end\nend\npetterns = return_all_pettern(length(keys(XY))) # 全ての部分集合を取得\nres_said = []\nfor i in 1:length(petterns) # それぞれの部分集合についての結果の格納先\n push!(res_said,[])\nend\nfor jj in 1:length(petterns) # 特定の格納先に入れるためにインデックスを回す\n pettern = petterns[jj]\n honest_list = collect(1:N)[sum(pettern)]\n for k in honest_list\n push!(res_said[jj],[k,1]) # 発言している人は本物\n push!(res_said[jj], [XY[k][1],Bool(XY[k][2]) ] ) # 本物の言っている人も本物\n end\nend\nglobal kari_ans = []\nfor i in 1:length(petterns) # それぞれの仮の答えについての結果の格納先\n push!(kari_ans,[])\nend\n\nfor kk in 1:length(petterns) # 特定の格納先に入れるためにインデックスを回す\n res = res_said[kk]\n if res == []\n ans = 0\n else\n for ik in res\n push!(kari_ans[kk],[ik[1],ik[2]])\n end\n end\nend\nans_list = []\nfor kari in kari_ans\n #println(kari)\n honest_count = 0\n kari = unique(kari)\n for i in kari # それぞれの結果について検証する\n #println(i)\n if i[2] == 0\n another_ans = [i[1],1] # 違う答えがないかチェック\n else\n another_ans = [i[1],0]\n #=count = 0\n for jj in kari\n if jj == i\n count += 1\n end\n end\n if count == 1\n honest_count += 1 # 同じ答えが何回もあるときはカウントしない\n end=#\n end\n if another_ans in kari\n honest_count = 0\n break\n end\n end\n push!(ans_list,honest_count)\nend\nprintln(maximum(ans_list))\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "sample_input": "3\n1\n2 1\n1\n1 1\n1\n2 0\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02837", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N people numbered 1 to N. Each of them is either an honest person whose testimonies are always correct or an unkind person whose testimonies may be correct or not.\n\nPerson i gives A_i testimonies. The j-th testimony by Person i is represented by two integers x_{ij} and y_{ij}. If y_{ij} = 1, the testimony says Person x_{ij} is honest; if y_{ij} = 0, it says Person x_{ij} is unkind.\n\nHow many honest persons can be among those N people at most?\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 15\n\n0 \\leq A_i \\leq N - 1\n\n1 \\leq x_{ij} \\leq N\n\nx_{ij} \\neq i\n\nx_{ij_1} \\neq x_{ij_2} (j_1 \\neq j_2)\n\ny_{ij} = 0, 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA_1\nx_{11} y_{11}\nx_{12} y_{12}\n:\nx_{1A_1} y_{1A_1}\nA_2\nx_{21} y_{21}\nx_{22} y_{22}\n:\nx_{2A_2} y_{2A_2}\n:\nA_N\nx_{N1} y_{N1}\nx_{N2} y_{N2}\n:\nx_{NA_N} y_{NA_N}\n\nOutput\n\nPrint the maximum possible number of honest persons among the N people.\n\nSample Input 1\n\n3\n1\n2 1\n1\n1 1\n1\n2 0\n\nSample Output 1\n\n2\n\nIf Person 1 and Person 2 are honest and Person 3 is unkind, we have two honest persons without inconsistencies, which is the maximum possible number of honest persons.\n\nSample Input 2\n\n3\n2\n2 1\n3 0\n2\n3 1\n1 0\n2\n1 1\n2 0\n\nSample Output 2\n\n0\n\nAssuming that one or more of them are honest immediately leads to a contradiction.\n\nSample Input 3\n\n2\n1\n2 0\n1\n1 0\n\nSample Output 3\n\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1562, "memory_kb": 198580}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s559665873", "group_id": "codeNet:p02838", "input_text": "function count(i,A)\n\tret=0\n\tfor a=A\n\t\tret+=(a>>i)%2\n\tend\n\tret\nend\nfunction main()\n\tN=parse(Int,readline())\n\tA=map(x->parse(Int,x),split(readline()))\n\tans=0\n\tmod=10^9+7\n\tfor i=59:-1:0\n\t\tc=count(i,A)\n\t\tans=(ans*2+c*(N-c))%mod\n\tend\n\tprintln(ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1575862448, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02838.html", "problem_id": "p02838", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02838/input.txt", "sample_output_relpath": "derived/input_output/data/p02838/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02838/Julia/s559665873.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s559665873", "user_id": "u657913472"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "function count(i,A)\n\tret=0\n\tfor a=A\n\t\tret+=(a>>i)%2\n\tend\n\tret\nend\nfunction main()\n\tN=parse(Int,readline())\n\tA=map(x->parse(Int,x),split(readline()))\n\tans=0\n\tmod=10^9+7\n\tfor i=59:-1:0\n\t\tc=count(i,A)\n\t\tans=(ans*2+c*(N-c))%mod\n\tend\n\tprintln(ans)\nend\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n0 \\leq A_i < 2^{60}\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 value \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n6\n\nWe have (1\\mbox{ XOR } 2)+(1\\mbox{ XOR } 3)+(2\\mbox{ XOR } 3)=3+2+1=6.\n\nSample Input 2\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 2\n\n237\n\nSample Input 3\n\n10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n\nSample Output 3\n\n103715602\n\nPrint the sum modulo (10^9+7).", "sample_input": "3\n1 2 3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p02838", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have N integers. The i-th integer is A_i.\n\nFind \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nWhat is \\mbox{ XOR }?\n\nThe XOR of integers A and B, A \\mbox{ XOR } B, is defined as follows:\n\nWhen A \\mbox{ XOR } B is written in base two, the digit in the 2^k's place (k \\geq 0) is 1 if either A or B, but not both, has 1 in the 2^k's place, and 0 otherwise.\n\nFor example, 3 \\mbox{ XOR } 5 = 6. (In base two: 011 \\mbox{ XOR } 101 = 110.)\n\nConstraints\n\n2 \\leq N \\leq 3 \\times 10^5\n\n0 \\leq A_i < 2^{60}\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 value \\sum_{i=1}^{N-1}\\sum_{j=i+1}^{N} (A_i \\mbox{ XOR } A_j), modulo (10^9+7).\n\nSample Input 1\n\n3\n1 2 3\n\nSample Output 1\n\n6\n\nWe have (1\\mbox{ XOR } 2)+(1\\mbox{ XOR } 3)+(2\\mbox{ XOR } 3)=3+2+1=6.\n\nSample Input 2\n\n10\n3 1 4 1 5 9 2 6 5 3\n\nSample Output 2\n\n237\n\nSample Input 3\n\n10\n3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820\n\nSample Output 3\n\n103715602\n\nPrint the sum modulo (10^9+7).", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 1249, "memory_kb": 170656}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s575490968", "group_id": "codeNet:p02839", "input_text": "function parse_int(x)\n parse(Int, x)\nend\nfunction MAP()\n map(parse_int, split(readline(), \" \"))\nend\nfunction intinput()\n parse(Int, readline())\nend\nfunction solve()\n H, W = MAP()\n A = reshape(MAP(), 1, W)\n for i = 1:H-1\n A = [A; reshape(MAP(), 1, W)]\n end\n B = reshape(MAP(), 1, W)\n for i = 1:H-1\n B = [B; reshape(MAP(), 1, W)]\n end\n dp = falses(H, W, 12601)\n dp[1, 1, abs(A[1, 1] - B[1, 1]) + 1] = true\n for i = 2:H\n for k = 1:12601\n difference = abs(A[i, 1] - B[i, 1])\n if dp[i - 1, 1, k]\n dp[i, 1, k + difference] = true\n dp[i, 1, abs(k - 1 - difference) + 1] = true\n end\n end\n end\n for j = 2:W\n for k = 1:12601\n difference = abs(A[1, j] - B[1, j])\n if dp[1, j - 1, k]\n dp[1, j, k + difference] = true\n dp[1, j, abs(k - 1 - difference) + 1] = true\n end\n end\n end\n for i = 2:H, j = 2:W\n difference = abs(A[i, j] - B[i, j]) \n for k = 1:12601\n if dp[i - 1, j, k] || dp[i, j - 1, k]\n dp[i, j, k + difference] = true\n dp[i, j, abs(k - 1 - difference) + 1] = true\n end\n end\n end\n ans = 0\n for i = 1:12601\n if dp[H, W, i]\n ans = i\n break\n end\n end\n println(\"$(ans - 1)\")\nend\nsolve()", "language": "Julia", "metadata": {"date": 1593302383, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s575490968.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s575490968", "user_id": "u656341025"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "function parse_int(x)\n parse(Int, x)\nend\nfunction MAP()\n map(parse_int, split(readline(), \" \"))\nend\nfunction intinput()\n parse(Int, readline())\nend\nfunction solve()\n H, W = MAP()\n A = reshape(MAP(), 1, W)\n for i = 1:H-1\n A = [A; reshape(MAP(), 1, W)]\n end\n B = reshape(MAP(), 1, W)\n for i = 1:H-1\n B = [B; reshape(MAP(), 1, W)]\n end\n dp = falses(H, W, 12601)\n dp[1, 1, abs(A[1, 1] - B[1, 1]) + 1] = true\n for i = 2:H\n for k = 1:12601\n difference = abs(A[i, 1] - B[i, 1])\n if dp[i - 1, 1, k]\n dp[i, 1, k + difference] = true\n dp[i, 1, abs(k - 1 - difference) + 1] = true\n end\n end\n end\n for j = 2:W\n for k = 1:12601\n difference = abs(A[1, j] - B[1, j])\n if dp[1, j - 1, k]\n dp[1, j, k + difference] = true\n dp[1, j, abs(k - 1 - difference) + 1] = true\n end\n end\n end\n for i = 2:H, j = 2:W\n difference = abs(A[i, j] - B[i, j]) \n for k = 1:12601\n if dp[i - 1, j, k] || dp[i, j - 1, k]\n dp[i, j, k + difference] = true\n dp[i, j, abs(k - 1 - difference) + 1] = true\n end\n end\n end\n ans = 0\n for i = 1:12601\n if dp[H, W, i]\n ans = i\n break\n end\n end\n println(\"$(ans - 1)\")\nend\nsolve()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2215, "memory_kb": 324456}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s752454797", "group_id": "codeNet:p02839", "input_text": "function parse_int(x)\n parse(Int, x)\nend\nfunction MAP()\n map(parse_int, split(readline(), \" \"))\nend\nfunction intinput()\n parse(Int, readline())\nend\nfunction solve()\n H, W = MAP()\n a = MAP()\n a = reshape(a, 1, W)\n A = copy(a)\n for i = 1:H-1\n a = MAP()\n a = reshape(a, 1, W)\n A = [A; a]\n end\n b = MAP()\n b = reshape(b, 1, W)\n B = copy(b)\n for i = 1:H-1\n b = MAP()\n b = reshape(b, 1, W)\n B = [B; b]\n end\n dp = falses(H, W, 12601)\n for i = 1:H, j = 1:W\n difference = abs(A[i, j] - B[i, j])\n if i == 1 && j == 1\n dp[i, j, difference + 1] = true\n continue\n end\n if i == 1\n for k = 1:12601\n if dp[i, j - 1, k]\n dp[i, j, k + difference] = true\n dp[i, j, abs(k - 1 - difference) + 1] = true\n end\n end\n continue\n end\n if j == 1\n for k = 1:12601\n if dp[i - 1, j, k]\n dp[i, j, k + difference] = true\n dp[i, j, abs(k - 1 - difference) + 1] = true\n end\n end\n continue\n end\n \n for k = 1:12601\n if dp[i - 1, j, k] || dp[i, j - 1, k]\n dp[i, j, k + difference] = true\n dp[i, j, abs(k - 1 - difference) + 1] = true\n end\n end\n end\n ans = 0\n for i = 1:12601\n if dp[H, W, i]\n ans = i\n break\n end\n end\n println(\"$(ans - 1)\")\nend\nsolve()", "language": "Julia", "metadata": {"date": 1593301058, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s752454797.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s752454797", "user_id": "u656341025"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "function parse_int(x)\n parse(Int, x)\nend\nfunction MAP()\n map(parse_int, split(readline(), \" \"))\nend\nfunction intinput()\n parse(Int, readline())\nend\nfunction solve()\n H, W = MAP()\n a = MAP()\n a = reshape(a, 1, W)\n A = copy(a)\n for i = 1:H-1\n a = MAP()\n a = reshape(a, 1, W)\n A = [A; a]\n end\n b = MAP()\n b = reshape(b, 1, W)\n B = copy(b)\n for i = 1:H-1\n b = MAP()\n b = reshape(b, 1, W)\n B = [B; b]\n end\n dp = falses(H, W, 12601)\n for i = 1:H, j = 1:W\n difference = abs(A[i, j] - B[i, j])\n if i == 1 && j == 1\n dp[i, j, difference + 1] = true\n continue\n end\n if i == 1\n for k = 1:12601\n if dp[i, j - 1, k]\n dp[i, j, k + difference] = true\n dp[i, j, abs(k - 1 - difference) + 1] = true\n end\n end\n continue\n end\n if j == 1\n for k = 1:12601\n if dp[i - 1, j, k]\n dp[i, j, k + difference] = true\n dp[i, j, abs(k - 1 - difference) + 1] = true\n end\n end\n continue\n end\n \n for k = 1:12601\n if dp[i - 1, j, k] || dp[i, j - 1, k]\n dp[i, j, k + difference] = true\n dp[i, j, abs(k - 1 - difference) + 1] = true\n end\n end\n end\n ans = 0\n for i = 1:12601\n if dp[H, W, i]\n ans = i\n break\n end\n end\n println(\"$(ans - 1)\")\nend\nsolve()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1610, "cpu_time_ms": 2213, "memory_kb": 282552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s454594310", "group_id": "codeNet:p02839", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction calc(dp::Array{Array{Bool,1},1},a::Array{Int,2},b::Array{Int,2},x::Int,y::Int,h::Int,w::Int,i::Int,base::Int)\n\tif dp[(x-1)*w+y][i]\n\t\tif y split |> parseMap\n\ta = zeros(Int,h,w)\n\tb = zeros(Int,h,w)\n\tms = 0\n\tfor i in 1:h\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tb[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tfor j in 1:w\n\t\t\tms = max(ms,a[i,j]-b[i,j],b[i,j]-a[i,j])\n\t\tend\n\tend\n\tbase = (h+w)*ms\n\tdp = [Bool[false for x in 1:2*base+1] for i in 1:h*w]\n\tdp[1][base+1+a[1,1]-b[1,1]] = true\n\tdp[1][base+1-a[1,1]+b[1,1]] = true\n\n\tz = base\n\n\tprintln(z)\nend\n\nmain()\n\n", "language": "Julia", "metadata": {"date": 1575900322, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s454594310.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s454594310", "user_id": "u095714878"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction calc(dp::Array{Array{Bool,1},1},a::Array{Int,2},b::Array{Int,2},x::Int,y::Int,h::Int,w::Int,i::Int,base::Int)\n\tif dp[(x-1)*w+y][i]\n\t\tif y split |> parseMap\n\ta = zeros(Int,h,w)\n\tb = zeros(Int,h,w)\n\tms = 0\n\tfor i in 1:h\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tb[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tfor j in 1:w\n\t\t\tms = max(ms,a[i,j]-b[i,j],b[i,j]-a[i,j])\n\t\tend\n\tend\n\tbase = (h+w)*ms\n\tdp = [Bool[false for x in 1:2*base+1] for i in 1:h*w]\n\tdp[1][base+1+a[1,1]-b[1,1]] = true\n\tdp[1][base+1-a[1,1]+b[1,1]] = true\n\n\tz = base\n\n\tprintln(z)\nend\n\nmain()\n\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1116, "cpu_time_ms": 2116, "memory_kb": 156676}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s286539307", "group_id": "codeNet:p02839", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\ta = zeros(Int,h,w)\n\tb = zeros(Int,h,w)\n\tms = 0\n\tfor i in 1:h\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tb[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tfor j in 1:w\n\t\t\tms = max(ms,abs(a[i,j]-b[i,j]))\n\t\tend\n\tend\n\tms *=(h+w)\n\tdp = [Bool[false for x in 1:2*ms+1] for i in 1:h*w]\n\tdp[1][ms+1+a[1,1]-b[1,1]] = true\n\tdp[1][ms+1-a[1,1]+b[1,1]] = true\n\tfor x in 1:h\n\t\tfor y in 1:w\n\t\t\tfor i in 1:2*ms+1\n\t\t\t\tif dp[(x-1)*w+y][i]\n\t\t\t\t\tif y split |> parseMap\n\ta = zeros(Int,h,w)\n\tb = zeros(Int,h,w)\n\tms = 0\n\tfor i in 1:h\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tb[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tfor j in 1:w\n\t\t\tms = max(ms,abs(a[i,j]-b[i,j]))\n\t\tend\n\tend\n\tms *=(h+w)\n\tdp = [Bool[false for x in 1:2*ms+1] for i in 1:h*w]\n\tdp[1][ms+1+a[1,1]-b[1,1]] = true\n\tdp[1][ms+1-a[1,1]+b[1,1]] = true\n\tfor x in 1:h\n\t\tfor y in 1:w\n\t\t\tfor i in 1:2*ms+1\n\t\t\t\tif dp[(x-1)*w+y][i]\n\t\t\t\t\tif y split |> parseMap\n\ta = zeros(Int,h,w)\n\tb = zeros(Int,h,w)\n\tfor i in 1:h\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tb[i,:] = readline() |> split |> parseMap\n\tend\n\tdp = [Array{Int,1}[zeros(Int,321) for i in 1:w] for i in 1:h]\n\tdp[1][1][161+a[1,1]-b[1,1]] = 1\n\tdp[1][1][161-a[1,1]+b[1,1]] = 1\n\tfor x in 1:h\n\tfor y in 1:w\n\t\tif y split |> parseMap\n\ta = zeros(Int,h,w)\n\tb = zeros(Int,h,w)\n\tfor i in 1:h\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tb[i,:] = readline() |> split |> parseMap\n\tend\n\tdp = [Array{Int,1}[zeros(Int,321) for i in 1:w] for i in 1:h]\n\tdp[1][1][161+a[1,1]-b[1,1]] = 1\n\tdp[1][1][161-a[1,1]+b[1,1]] = 1\n\tfor x in 1:h\n\tfor y in 1:w\n\t\tif y split |> parseMap\n\ta = zeros(Int,h,w)\n\tb = zeros(Int,h,w)\n\tfor i in 1:h\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tb[i,:] = readline() |> split |> parseMap\n\tend\n\tdp = [[zeros(Int,321) for i in 1:w] for i in 1:h]\nend\nmain()", "language": "Julia", "metadata": {"date": 1575863626, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s398369570.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s398369570", "user_id": "u095714878"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\ta = zeros(Int,h,w)\n\tb = zeros(Int,h,w)\n\tfor i in 1:h\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tb[i,:] = readline() |> split |> parseMap\n\tend\n\tdp = [[zeros(Int,321) for i in 1:w] for i in 1:h]\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 939, "memory_kb": 191328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s247042311", "group_id": "codeNet:p02839", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\ta = zeros(Int,h,w)\n\tb = zeros(Int,h,w)\n\tfor i in 1:h\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tb[i,:] = readline() |> split |> parseMap\n\tend\n\tdp = [[zeros(Int,321) for i in 1:w] for i in 1:h]\n\tdp[1][1][161+a[1,1]-b[1,1]] = 1\n\tdp[1][1][161-a[1,1]+b[1,1]] = 1\n\tfor co in 1:h\n\tfor ro in 1:w\n\tx = co\n\ty = ro\n\t\tif y split |> parseMap\n\ta = zeros(Int,h,w)\n\tb = zeros(Int,h,w)\n\tfor i in 1:h\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:h\n\t\tb[i,:] = readline() |> split |> parseMap\n\tend\n\tdp = [[zeros(Int,321) for i in 1:w] for i in 1:h]\n\tdp[1][1][161+a[1,1]-b[1,1]] = 1\n\tdp[1][1][161-a[1,1]+b[1,1]] = 1\n\tfor co in 1:h\n\tfor ro in 1:w\n\tx = co\n\ty = ro\n\t\tif yparse(Int,x),split(readline()))\n\tif D==0\n\t\tprintln(X==0 ? 1 : N+1)\n\t\texit()\n\tend\n\tif D<0\n\t\tD=-D\n\t\tX=-X\n\tend\n\tS=Dict{Int,Array{Pair{Int,Int}}}()\n\tfor k=0:N\n\t\tL=fld(k*X,D)\n\t\tU=L+div(k*(k-1),2)=>L+N*k-div(k*(k+1),2)\n\t\tx=get(S,mod(k*X,D),Pair{Int,Int}[])\n\t\tpush!(x,U)\n\t\tS[mod(k*X,D)]=x\n\tend\n\tans=0\n\tfor (_,a)=S\n\t\tans+=f(sort(a))\n\tend\n\tprintln(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1577423726, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02840.html", "problem_id": "p02840", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02840/input.txt", "sample_output_relpath": "derived/input_output/data/p02840/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02840/Julia/s735396531.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s735396531", "user_id": "u657913472"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "function f(kv)\n\tpre=-10^18\n\tret=0\n\tfor (l,r)=kv\n\t\tret+=max(0,r-max(pre,l-1))\n\t\tpre=max(pre,r)\n\tend\n\tret\nend\nfunction main()\n\tN,X,D=map(x->parse(Int,x),split(readline()))\n\tif D==0\n\t\tprintln(X==0 ? 1 : N+1)\n\t\texit()\n\tend\n\tif D<0\n\t\tD=-D\n\t\tX=-X\n\tend\n\tS=Dict{Int,Array{Pair{Int,Int}}}()\n\tfor k=0:N\n\t\tL=fld(k*X,D)\n\t\tU=L+div(k*(k-1),2)=>L+N*k-div(k*(k+1),2)\n\t\tx=get(S,mod(k*X,D),Pair{Int,Int}[])\n\t\tpush!(x,U)\n\t\tS[mod(k*X,D)]=x\n\tend\n\tans=0\n\tfor (_,a)=S\n\t\tans+=f(sort(a))\n\tend\n\tprintln(ans)\nend\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have an integer sequence A of length N, where A_1 = X, A_{i+1} = A_i + D (1 \\leq i < N ) holds.\n\nTakahashi will take some (possibly all or none) of the elements in this sequence, and Aoki will take all of the others.\n\nLet S and T be the sum of the numbers taken by Takahashi and Aoki, respectively. How many possible values of S - T are there?\n\nConstraints\n\n-10^8 \\leq X, D \\leq 10^8\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 X D\n\nOutput\n\nPrint the number of possible values of S - T.\n\nSample Input 1\n\n3 4 2\n\nSample Output 1\n\n8\n\nA is (4, 6, 8).\n\nThere are eight ways for (Takahashi, Aoki) to take the elements: ((), (4, 6, 8)), ((4), (6, 8)), ((6), (4, 8)), ((8), (4, 6))), ((4, 6), (8))), ((4, 8), (6))), ((6, 8), (4))), and ((4, 6, 8), ()).\n\nThe values of S - T in these ways are -18, -10, -6, -2, 2, 6, 10, and 18, respectively, so there are eight possible values of S - T.\n\nSample Input 2\n\n2 3 -3\n\nSample Output 2\n\n2\n\nA is (3, 0). There are two possible values of S - T: -3 and 3.\n\nSample Input 3\n\n100 14 20\n\nSample Output 3\n\n49805", "sample_input": "3 4 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02840", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have an integer sequence A of length N, where A_1 = X, A_{i+1} = A_i + D (1 \\leq i < N ) holds.\n\nTakahashi will take some (possibly all or none) of the elements in this sequence, and Aoki will take all of the others.\n\nLet S and T be the sum of the numbers taken by Takahashi and Aoki, respectively. How many possible values of S - T are there?\n\nConstraints\n\n-10^8 \\leq X, D \\leq 10^8\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 X D\n\nOutput\n\nPrint the number of possible values of S - T.\n\nSample Input 1\n\n3 4 2\n\nSample Output 1\n\n8\n\nA is (4, 6, 8).\n\nThere are eight ways for (Takahashi, Aoki) to take the elements: ((), (4, 6, 8)), ((4), (6, 8)), ((6), (4, 8)), ((8), (4, 6))), ((4, 6), (8))), ((4, 8), (6))), ((6, 8), (4))), and ((4, 6, 8), ()).\n\nThe values of S - T in these ways are -18, -10, -6, -2, 2, 6, 10, and 18, respectively, so there are eight possible values of S - T.\n\nSample Input 2\n\n2 3 -3\n\nSample Output 2\n\n2\n\nA is (3, 0). There are two possible values of S - T: -3 and 3.\n\nSample Input 3\n\n100 14 20\n\nSample Output 3\n\n49805", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 492, "cpu_time_ms": 2113, "memory_kb": 180488}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s254637580", "group_id": "codeNet:p02840", "input_text": "function main()\n\tN,X,D=map(x->parse(Int,x),split(readline()))\n\tif D==0\n\t\tprintln(X==0 ? 1 : N+1)\n\t\texit()\n\tend\n\tif D<0\n\t\tD=-D\n\t\tX=-X\n\tend\n\tS=Dict{Int,Array{Pair{Int,Int}}}()\n\tfor k=0:N\n\t\tL=fld(k*X,D)\n\t\tU=L+div(k*(k-1),2)=>L+N*k-div(k*(k+1),2)\n\t\tx=get(S,mod(k*X,D),Pair{Int,Int}[])\n\t\tpush!(x,U)\n\t\tS[mod(k*X,D)]=x\n\tend\n\tans=0\n\tfor (_,a)=S\n\t\tpre=-10^18\n\t\tfor (l,r)=sort(a)\n\t\t\tans+=max(0,r-max(pre,l)+1)\n\t\t\tpre=max(pre,r+1)\n\t\tend\n\tend\n\tprintln(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1577423622, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02840.html", "problem_id": "p02840", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02840/input.txt", "sample_output_relpath": "derived/input_output/data/p02840/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02840/Julia/s254637580.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s254637580", "user_id": "u657913472"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "function main()\n\tN,X,D=map(x->parse(Int,x),split(readline()))\n\tif D==0\n\t\tprintln(X==0 ? 1 : N+1)\n\t\texit()\n\tend\n\tif D<0\n\t\tD=-D\n\t\tX=-X\n\tend\n\tS=Dict{Int,Array{Pair{Int,Int}}}()\n\tfor k=0:N\n\t\tL=fld(k*X,D)\n\t\tU=L+div(k*(k-1),2)=>L+N*k-div(k*(k+1),2)\n\t\tx=get(S,mod(k*X,D),Pair{Int,Int}[])\n\t\tpush!(x,U)\n\t\tS[mod(k*X,D)]=x\n\tend\n\tans=0\n\tfor (_,a)=S\n\t\tpre=-10^18\n\t\tfor (l,r)=sort(a)\n\t\t\tans+=max(0,r-max(pre,l)+1)\n\t\t\tpre=max(pre,r+1)\n\t\tend\n\tend\n\tprintln(ans)\nend\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have an integer sequence A of length N, where A_1 = X, A_{i+1} = A_i + D (1 \\leq i < N ) holds.\n\nTakahashi will take some (possibly all or none) of the elements in this sequence, and Aoki will take all of the others.\n\nLet S and T be the sum of the numbers taken by Takahashi and Aoki, respectively. How many possible values of S - T are there?\n\nConstraints\n\n-10^8 \\leq X, D \\leq 10^8\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 X D\n\nOutput\n\nPrint the number of possible values of S - T.\n\nSample Input 1\n\n3 4 2\n\nSample Output 1\n\n8\n\nA is (4, 6, 8).\n\nThere are eight ways for (Takahashi, Aoki) to take the elements: ((), (4, 6, 8)), ((4), (6, 8)), ((6), (4, 8)), ((8), (4, 6))), ((4, 6), (8))), ((4, 8), (6))), ((6, 8), (4))), and ((4, 6, 8), ()).\n\nThe values of S - T in these ways are -18, -10, -6, -2, 2, 6, 10, and 18, respectively, so there are eight possible values of S - T.\n\nSample Input 2\n\n2 3 -3\n\nSample Output 2\n\n2\n\nA is (3, 0). There are two possible values of S - T: -3 and 3.\n\nSample Input 3\n\n100 14 20\n\nSample Output 3\n\n49805", "sample_input": "3 4 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02840", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have an integer sequence A of length N, where A_1 = X, A_{i+1} = A_i + D (1 \\leq i < N ) holds.\n\nTakahashi will take some (possibly all or none) of the elements in this sequence, and Aoki will take all of the others.\n\nLet S and T be the sum of the numbers taken by Takahashi and Aoki, respectively. How many possible values of S - T are there?\n\nConstraints\n\n-10^8 \\leq X, D \\leq 10^8\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 X D\n\nOutput\n\nPrint the number of possible values of S - T.\n\nSample Input 1\n\n3 4 2\n\nSample Output 1\n\n8\n\nA is (4, 6, 8).\n\nThere are eight ways for (Takahashi, Aoki) to take the elements: ((), (4, 6, 8)), ((4), (6, 8)), ((6), (4, 8)), ((8), (4, 6))), ((4, 6), (8))), ((4, 8), (6))), ((6, 8), (4))), and ((4, 6, 8), ()).\n\nThe values of S - T in these ways are -18, -10, -6, -2, 2, 6, 10, and 18, respectively, so there are eight possible values of S - T.\n\nSample Input 2\n\n2 3 -3\n\nSample Output 2\n\n2\n\nA is (3, 0). There are two possible values of S - T: -3 and 3.\n\nSample Input 3\n\n100 14 20\n\nSample Output 3\n\n49805", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 455, "cpu_time_ms": 2113, "memory_kb": 170632}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s515770215", "group_id": "codeNet:p02840", "input_text": "function main()\n\tN,X,D=map(x->parse(Int,x),split(readline()))\n\tif D==0\n\t\tprintln(X==0 ? 1 : N+1)\n\t\texit()\n\tend\n\tif D<0\n\t\tD=-D\n\t\tX=-X\n\tend\n\tS=Dict{Int,Array{Pair{Int,Int}}}()\n\tfor k=0:N\n\t\tL=fld(k*X,D)\n\t\tU=L+div(k*(k-1),2)=>L+N*k-div(k*(k+1),2)\n\t\tx=get(S,k*X%D,Pair{Int,Int}[])\n\t\tpush!(x,U)\n\t\tS[k*X%D]=x\n\tend\n\tans=0\n\tfor (_,a)=S\n\t\tpre=-10^18\n\t\tfor (l,r)=sort(a)\n\t\t\tans+=r-max(pre,l)+1\n\t\t\tpre=r+1\n\t\tend\n\tend\n\tprintln(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1577423209, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02840.html", "problem_id": "p02840", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02840/input.txt", "sample_output_relpath": "derived/input_output/data/p02840/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02840/Julia/s515770215.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s515770215", "user_id": "u657913472"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "function main()\n\tN,X,D=map(x->parse(Int,x),split(readline()))\n\tif D==0\n\t\tprintln(X==0 ? 1 : N+1)\n\t\texit()\n\tend\n\tif D<0\n\t\tD=-D\n\t\tX=-X\n\tend\n\tS=Dict{Int,Array{Pair{Int,Int}}}()\n\tfor k=0:N\n\t\tL=fld(k*X,D)\n\t\tU=L+div(k*(k-1),2)=>L+N*k-div(k*(k+1),2)\n\t\tx=get(S,k*X%D,Pair{Int,Int}[])\n\t\tpush!(x,U)\n\t\tS[k*X%D]=x\n\tend\n\tans=0\n\tfor (_,a)=S\n\t\tpre=-10^18\n\t\tfor (l,r)=sort(a)\n\t\t\tans+=r-max(pre,l)+1\n\t\t\tpre=r+1\n\t\tend\n\tend\n\tprintln(ans)\nend\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have an integer sequence A of length N, where A_1 = X, A_{i+1} = A_i + D (1 \\leq i < N ) holds.\n\nTakahashi will take some (possibly all or none) of the elements in this sequence, and Aoki will take all of the others.\n\nLet S and T be the sum of the numbers taken by Takahashi and Aoki, respectively. How many possible values of S - T are there?\n\nConstraints\n\n-10^8 \\leq X, D \\leq 10^8\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 X D\n\nOutput\n\nPrint the number of possible values of S - T.\n\nSample Input 1\n\n3 4 2\n\nSample Output 1\n\n8\n\nA is (4, 6, 8).\n\nThere are eight ways for (Takahashi, Aoki) to take the elements: ((), (4, 6, 8)), ((4), (6, 8)), ((6), (4, 8)), ((8), (4, 6))), ((4, 6), (8))), ((4, 8), (6))), ((6, 8), (4))), and ((4, 6, 8), ()).\n\nThe values of S - T in these ways are -18, -10, -6, -2, 2, 6, 10, and 18, respectively, so there are eight possible values of S - T.\n\nSample Input 2\n\n2 3 -3\n\nSample Output 2\n\n2\n\nA is (3, 0). There are two possible values of S - T: -3 and 3.\n\nSample Input 3\n\n100 14 20\n\nSample Output 3\n\n49805", "sample_input": "3 4 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02840", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have an integer sequence A of length N, where A_1 = X, A_{i+1} = A_i + D (1 \\leq i < N ) holds.\n\nTakahashi will take some (possibly all or none) of the elements in this sequence, and Aoki will take all of the others.\n\nLet S and T be the sum of the numbers taken by Takahashi and Aoki, respectively. How many possible values of S - T are there?\n\nConstraints\n\n-10^8 \\leq X, D \\leq 10^8\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 X D\n\nOutput\n\nPrint the number of possible values of S - T.\n\nSample Input 1\n\n3 4 2\n\nSample Output 1\n\n8\n\nA is (4, 6, 8).\n\nThere are eight ways for (Takahashi, Aoki) to take the elements: ((), (4, 6, 8)), ((4), (6, 8)), ((6), (4, 8)), ((8), (4, 6))), ((4, 6), (8))), ((4, 8), (6))), ((6, 8), (4))), and ((4, 6, 8), ()).\n\nThe values of S - T in these ways are -18, -10, -6, -2, 2, 6, 10, and 18, respectively, so there are eight possible values of S - T.\n\nSample Input 2\n\n2 3 -3\n\nSample Output 2\n\n2\n\nA is (3, 0). There are two possible values of S - T: -3 and 3.\n\nSample Input 3\n\n100 14 20\n\nSample Output 3\n\n49805", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2113, "memory_kb": 170832}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s565090246", "group_id": "codeNet:p02841", "input_text": "function main()\n \n (M1,D1) = map(x -> parse(Int,x), split(readline()))\n (M2,D2) = map(x -> parse(Int,x), split(readline()))\n \n if M1 == M2\n println(0)\n else\n println(1)\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577840845, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s565090246.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s565090246", "user_id": "u790457721"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "function main()\n \n (M1,D1) = map(x -> parse(Int,x), split(readline()))\n (M2,D2) = map(x -> parse(Int,x), split(readline()))\n \n if M1 == M2\n println(0)\n else\n println(1)\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 374, "memory_kb": 111168}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s316374702", "group_id": "codeNet:p02842", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tf = 0\n\tfor i in 1:n\n\t\tif n<=i*1.08 parseInt\n\tf = 0\n\tfor i in 1:n\n\t\tif n<=i*1.080\n dp[i]=dp[i-(100+j)+1]+1\n end\n end\n catch\n continue\n end\n end\n println(ifelse(dp[x]>0,1,0))\nend\nmain()", "language": "Julia", "metadata": {"date": 1583460211, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02843.html", "problem_id": "p02843", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02843/input.txt", "sample_output_relpath": "derived/input_output/data/p02843/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02843/Julia/s718065327.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s718065327", "user_id": "u619197965"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n x=parseInt(readline())\n dp=[0 for i in 1:100010]\n for i in 1:6\n dp[100+i]=1\n end\n for i in 101:x+1\n try\n for j in 0:5\n if dp[i-(100+j)+1]>0\n dp[i]=dp[i-(100+j)+1]+1\n end\n end\n catch\n continue\n end\n end\n println(ifelse(dp[x]>0,1,0))\nend\nmain()", "problem_context": "Score: 300 points\n\nProblem Statement\n\nAtCoder Mart sells 1000000 of each of the six items below:\n\nRiceballs, priced at 100 yen (the currency of Japan) each\n\nSandwiches, priced at 101 yen each\n\nCookies, priced at 102 yen each\n\nCakes, priced at 103 yen each\n\nCandies, priced at 104 yen each\n\nComputers, priced at 105 yen each\n\nTakahashi wants to buy some of them that cost exactly X yen in total.\nDetermine whether this is possible.\n\n(Ignore consumption tax.)\n\nConstraints\n\n1 \\leq X \\leq 100000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf it is possible to buy some set of items that cost exactly X yen in total, print 1; otherwise, print 0.\n\nSample Input 1\n\n615\n\nSample Output 1\n\n1\n\nFor example, we can buy one of each kind of item, which will cost 100+101+102+103+104+105=615 yen in total.\n\nSample Input 2\n\n217\n\nSample Output 2\n\n0\n\nNo set of items costs 217 yen in total.", "sample_input": "615\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02843", "source_text": "Score: 300 points\n\nProblem Statement\n\nAtCoder Mart sells 1000000 of each of the six items below:\n\nRiceballs, priced at 100 yen (the currency of Japan) each\n\nSandwiches, priced at 101 yen each\n\nCookies, priced at 102 yen each\n\nCakes, priced at 103 yen each\n\nCandies, priced at 104 yen each\n\nComputers, priced at 105 yen each\n\nTakahashi wants to buy some of them that cost exactly X yen in total.\nDetermine whether this is possible.\n\n(Ignore consumption tax.)\n\nConstraints\n\n1 \\leq X \\leq 100000\n\nX is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX\n\nOutput\n\nIf it is possible to buy some set of items that cost exactly X yen in total, print 1; otherwise, print 0.\n\nSample Input 1\n\n615\n\nSample Output 1\n\n1\n\nFor example, we can buy one of each kind of item, which will cost 100+101+102+103+104+105=615 yen in total.\n\nSample Input 2\n\n217\n\nSample Output 2\n\n0\n\nNo set of items costs 217 yen in total.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 512, "cpu_time_ms": 353, "memory_kb": 112584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s364142681", "group_id": "codeNet:p02844", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n s=chomp(readline())\n ans=0\n for i in 0:999\n t=lpad(i,3,\"0\")\n tmp=1\n for j in 1:n\n if s[j]==t[tmp]\n tmp+=1\n end\n if tmp>3\n ans+=1\n break\n end\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1587262393, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02844.html", "problem_id": "p02844", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02844/input.txt", "sample_output_relpath": "derived/input_output/data/p02844/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02844/Julia/s364142681.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s364142681", "user_id": "u619197965"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n s=chomp(readline())\n ans=0\n for i in 0:999\n t=lpad(i,3,\"0\")\n tmp=1\n for j in 1:n\n if s[j]==t[tmp]\n tmp+=1\n end\n if tmp>3\n ans+=1\n break\n end\n end\n end\n println(ans)\nend\nmain()", "problem_context": "Score: 400 points\n\nProblem Statement\n\nAtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code.\n\nThe company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code.\n\nHow many different PIN codes can he set this way?\n\nBoth the lucky number and the PIN code may begin with a 0.\n\nConstraints\n\n4 \\leq N \\leq 30000\n\nS is a string of length N consisting of digits.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of different PIN codes Takahashi can set.\n\nSample Input 1\n\n4\n0224\n\nSample Output 1\n\n3\n\nTakahashi has the following options:\n\nErase the first digit of S and set 224.\n\nErase the second digit of S and set 024.\n\nErase the third digit of S and set 024.\n\nErase the fourth digit of S and set 022.\n\nThus, he can set three different PIN codes: 022, 024, and 224.\n\nSample Input 2\n\n6\n123123\n\nSample Output 2\n\n17\n\nSample Input 3\n\n19\n3141592653589793238\n\nSample Output 3\n\n329", "sample_input": "4\n0224\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02844", "source_text": "Score: 400 points\n\nProblem Statement\n\nAtCoder Inc. has decided to lock the door of its office with a 3-digit PIN code.\n\nThe company has an N-digit lucky number, S. Takahashi, the president, will erase N-3 digits from S and concatenate the remaining 3 digits without changing the order to set the PIN code.\n\nHow many different PIN codes can he set this way?\n\nBoth the lucky number and the PIN code may begin with a 0.\n\nConstraints\n\n4 \\leq N \\leq 30000\n\nS is a string of length N consisting of digits.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS\n\nOutput\n\nPrint the number of different PIN codes Takahashi can set.\n\nSample Input 1\n\n4\n0224\n\nSample Output 1\n\n3\n\nTakahashi has the following options:\n\nErase the first digit of S and set 224.\n\nErase the second digit of S and set 024.\n\nErase the third digit of S and set 024.\n\nErase the fourth digit of S and set 022.\n\nThus, he can set three different PIN codes: 022, 024, and 224.\n\nSample Input 2\n\n6\n123123\n\nSample Output 2\n\n17\n\nSample Input 3\n\n19\n3141592653589793238\n\nSample Output 3\n\n329", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 167212}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s021269585", "group_id": "codeNet:p02845", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tmod = 10^9+7\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tif a[1] != 0\n\t\tprintln(0)\n\telse\n\tdp = zeros(Int,n)\n\tdp[1] = 1\n\tr = 1\n\tg = 0\n\tb = 0\n\tfor i in 2:n\n\t\tk = 0\n\t\tf = 0\n\t\tif a[i]==r\n\t\t\tr += 1\n\t\t\tf = 1\n\t\t\tk += 1\n\t\tend\n\t\tif a[i]==g\n\t\t\tif f == 0\n\t\t\t\tg += 1\n\t\t\t\tf += 1\n\t\t\tend\n\t\t\tk += 1\n\t\tend\n\t\tif a[i]==b\n\t\t\tif f == 0\n\t\t\t\tb += 1\n\t\t\t\tf += 1\n\t\t\tend\n\t\t\tk += 1\n\t\tend\n\t\tdp[i] = (dp[i-1]*k)%mod\n\tend\n\tdp[n] = (dp[n]*3)%mod\n\tprintln(dp[n])\nend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1575254561, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s021269585.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s021269585", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tmod = 10^9+7\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tif a[1] != 0\n\t\tprintln(0)\n\telse\n\tdp = zeros(Int,n)\n\tdp[1] = 1\n\tr = 1\n\tg = 0\n\tb = 0\n\tfor i in 2:n\n\t\tk = 0\n\t\tf = 0\n\t\tif a[i]==r\n\t\t\tr += 1\n\t\t\tf = 1\n\t\t\tk += 1\n\t\tend\n\t\tif a[i]==g\n\t\t\tif f == 0\n\t\t\t\tg += 1\n\t\t\t\tf += 1\n\t\t\tend\n\t\t\tk += 1\n\t\tend\n\t\tif a[i]==b\n\t\t\tif f == 0\n\t\t\t\tb += 1\n\t\t\t\tf += 1\n\t\t\tend\n\t\t\tk += 1\n\t\tend\n\t\tdp[i] = (dp[i-1]*k)%mod\n\tend\n\tdp[n] = (dp[n]*3)%mod\n\tprintln(dp[n])\nend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1595, "memory_kb": 171168}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s021409262", "group_id": "codeNet:p02846", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tta,tb = readline() |> split |> parseMap\n\taa,ab = readline() |> split |> parseMap\n\tba,bb = readline() |> split |> parseMap\n\tif aa*ta+ab*tb==ba*ta+bb*tb\n\t\tprintln(\"infinity\")\n\telseif (aaba&&aa*ta+ab*tb>ba*ta+bb*tb)\n\t\tprintln(0)\n\telseif aa split |> parseMap\n\taa,ab = readline() |> split |> parseMap\n\tba,bb = readline() |> split |> parseMap\n\tif aa*ta+ab*tb==ba*ta+bb*tb\n\t\tprintln(\"infinity\")\n\telseif (aaba&&aa*ta+ab*tb>ba*ta+bb*tb)\n\t\tprintln(0)\n\telseif aa 90\n ans -= 26\n end\n print(ans)\nend\n", "language": "Julia", "metadata": {"date": 1575245235, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s919686211.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s919686211", "user_id": "u538373180"}, "prompt_components": {"gold_output": "CDEZAB\n", "input_to_evaluate": "N = strip(readline())\nn = parse(Int, N)\nS = collect(strip(readline()))\n\nfor s in S\n ans = s + n\n if Int(ans) > 90\n ans -= 26\n end\n print(ans)\nend\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 153, "cpu_time_ms": 286, "memory_kb": 112160}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s124438826", "group_id": "codeNet:p02854", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n l=[0 for i in 1:n+1]\n r=[0 for i in 1:n+1]\n for i in 2:n+1\n l[i]=l[i-1]+a[i-1]\n end\n for i in 2:n+1\n r[i]=r[i-1]+a[n-i+2]\n end\n ans=10^10\n for i in 2:n\n ans=min(ans,abs(l[i]-r[n-i+2]))\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1583791981, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02854.html", "problem_id": "p02854", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02854/input.txt", "sample_output_relpath": "derived/input_output/data/p02854/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02854/Julia/s124438826.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s124438826", "user_id": "u619197965"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n l=[0 for i in 1:n+1]\n r=[0 for i in 1:n+1]\n for i in 2:n+1\n l[i]=l[i-1]+a[i-1]\n end\n for i in 2:n+1\n r[i]=r[i-1]+a[n-i+2]\n end\n ans=10^10\n for i in 2:n\n ans=min(ans,abs(l[i]-r[n-i+2]))\n end\n println(ans)\nend\nmain()", "problem_context": "Score: 200 points\n\nProblem Statement\n\nTakahashi, who works at DISCO, is standing before an iron bar.\nThe bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters.\n\nTakahashi wanted to choose a notch and cut the bar at that point into two parts with the same length.\nHowever, this may not be possible as is, so he will do the following operations some number of times before he does the cut:\n\nChoose one section and expand it, increasing its length by 1 millimeter. Doing this operation once costs 1 yen (the currency of Japan).\n\nChoose one section of length at least 2 millimeters and shrink it, decreasing its length by 1 millimeter. Doing this operation once costs 1 yen.\n\nFind the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 2020202020\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 an integer representing the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nSample Input 1\n\n3\n2 4 3\n\nSample Output 1\n\n3\n\nThe initial lengths of the sections are [2, 4, 3] (in millimeters). Takahashi can cut the bar equally after doing the following operations for 3 yen:\n\nShrink the second section from the left. The lengths of the sections are now [2, 3, 3].\n\nShrink the first section from the left. The lengths of the sections are now [1, 3, 3].\n\nShrink the second section from the left. The lengths of the sections are now [1, 2, 3], and we can cut the bar at the second notch from the left into two parts of length 3 each.\n\nSample Input 2\n\n12\n100 104 102 105 103 103 101 105 104 102 104 101\n\nSample Output 2\n\n0", "sample_input": "3\n2 4 3\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02854", "source_text": "Score: 200 points\n\nProblem Statement\n\nTakahashi, who works at DISCO, is standing before an iron bar.\nThe bar has N-1 notches, which divide the bar into N sections. The i-th section from the left has a length of A_i millimeters.\n\nTakahashi wanted to choose a notch and cut the bar at that point into two parts with the same length.\nHowever, this may not be possible as is, so he will do the following operations some number of times before he does the cut:\n\nChoose one section and expand it, increasing its length by 1 millimeter. Doing this operation once costs 1 yen (the currency of Japan).\n\nChoose one section of length at least 2 millimeters and shrink it, decreasing its length by 1 millimeter. Doing this operation once costs 1 yen.\n\nFind the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 2020202020\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 an integer representing the minimum amount of money needed before cutting the bar into two parts with the same length.\n\nSample Input 1\n\n3\n2 4 3\n\nSample Output 1\n\n3\n\nThe initial lengths of the sections are [2, 4, 3] (in millimeters). Takahashi can cut the bar equally after doing the following operations for 3 yen:\n\nShrink the second section from the left. The lengths of the sections are now [2, 3, 3].\n\nShrink the first section from the left. The lengths of the sections are now [1, 3, 3].\n\nShrink the second section from the left. The lengths of the sections are now [1, 2, 3], and we can cut the bar at the second notch from the left into two parts of length 3 each.\n\nSample Input 2\n\n12\n100 104 102 105 103 103 101 105 104 102 104 101\n\nSample Output 2\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 638, "cpu_time_ms": 517, "memory_kb": 130336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s975258903", "group_id": "codeNet:p02856", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\th,w,k = readline() |> split |> parseMap\n\ta = String[\"\" for i in 1:h]\n\tfs = 0\n\tls = 0\n\tv = [Int[0] for i in 1:h]\n\tfor i in 1:h\n\t\ta[i] = readline() |> chomp\n\t\tfor j in 1:w\n\t\t\tif a[i][j]=='#'\n\t\t\t\tif fs == 0\n\t\t\t\t\tfs = i\n\t\t\t\tend\n\t\t\t\tls = i\n\t\t\t\tpush!(v[i],j)\n\t\t\tend\n\t\tend\n\tend\n\tx = 1\n\to = zeros(Int,h,w)\n\tfor i in 1:h\n\t\tif length(v[i])>1\n\t\t\tfor j in 2:length(v[i])-1\n\t\t\t\tfor k in v[i][j-1]+1:v[i][j]\n\t\t\t\t\to[i,k]=x\n\t\t\t\tend\n\t\t\t\tx += 1\n\t\t\tend\n\t\t\tfor k in v[i][length(v[i])-1]+1:w\n\t\t\t\to[i,k]=x\n\t\t\tend\n\t\t\tx += 1\n\t\tend\n\tend\n\tfor i in 1:fs-1\n\t\tfor j in 1:w\n\t\t\to[i,j] = o[fs,j]\n\t\tend\n\tend\n\tfor i in ls+1:h\n\t\tfor j in 1:w\n\t\t\to[i,j] = o[ls,j]\n\t\tend\n\tend\n\tfor i in 1:h\n\t\tfor j in 1:w-1\n\t\t\tprint(o[i,j],\" \")\n\t\tend\n\t\tprintln(o[i,w])\n\tend\nend\nmain()", "language": "Julia", "metadata": {"date": 1574566818, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s975258903.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s975258903", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\th,w,k = readline() |> split |> parseMap\n\ta = String[\"\" for i in 1:h]\n\tfs = 0\n\tls = 0\n\tv = [Int[0] for i in 1:h]\n\tfor i in 1:h\n\t\ta[i] = readline() |> chomp\n\t\tfor j in 1:w\n\t\t\tif a[i][j]=='#'\n\t\t\t\tif fs == 0\n\t\t\t\t\tfs = i\n\t\t\t\tend\n\t\t\t\tls = i\n\t\t\t\tpush!(v[i],j)\n\t\t\tend\n\t\tend\n\tend\n\tx = 1\n\to = zeros(Int,h,w)\n\tfor i in 1:h\n\t\tif length(v[i])>1\n\t\t\tfor j in 2:length(v[i])-1\n\t\t\t\tfor k in v[i][j-1]+1:v[i][j]\n\t\t\t\t\to[i,k]=x\n\t\t\t\tend\n\t\t\t\tx += 1\n\t\t\tend\n\t\t\tfor k in v[i][length(v[i])-1]+1:w\n\t\t\t\to[i,k]=x\n\t\t\tend\n\t\t\tx += 1\n\t\tend\n\tend\n\tfor i in 1:fs-1\n\t\tfor j in 1:w\n\t\t\to[i,j] = o[fs,j]\n\t\tend\n\tend\n\tfor i in ls+1:h\n\t\tfor j in 1:w\n\t\t\to[i,j] = o[ls,j]\n\t\tend\n\tend\n\tfor i in 1:h\n\t\tfor j in 1:w-1\n\t\t\tprint(o[i,j],\" \")\n\t\tend\n\t\tprintln(o[i,w])\n\tend\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 834, "cpu_time_ms": 927, "memory_kb": 147920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s658008301", "group_id": "codeNet:p02860", "input_text": "n=parse(Int,readline())\ns=chomp(readline())\nprint(s==s[1:cld(n,2)]^2 ? \"Yes\" : \"No\")", "language": "Julia", "metadata": {"date": 1588293399, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02860.html", "problem_id": "p02860", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02860/input.txt", "sample_output_relpath": "derived/input_output/data/p02860/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02860/Julia/s658008301.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s658008301", "user_id": "u443151804"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n=parse(Int,readline())\ns=chomp(readline())\nprint(s==s[1:cld(n,2)]^2 ? \"Yes\" : \"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\nConstraints\n\n1 \\leq N \\leq 100\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\nIf S is a concatenation of two copies of some string, print Yes; otherwise, print No.\n\nSample Input 1\n\n6\nabcabc\n\nSample Output 1\n\nYes\n\nLet T = abc, and S = T + T.\n\nSample Input 2\n\n6\nabcadc\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1\nz\n\nSample Output 3\n\nNo", "sample_input": "6\nabcabc\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02860", "source_text": "Score : 200 points\n\nProblem Statement\n\nGiven are a positive integer N and a string S of length N consisting of lowercase English letters.\n\nDetermine whether the string is a concatenation of two copies of some string.\nThat is, determine whether there is a string T such that S = T + T.\n\nConstraints\n\n1 \\leq N \\leq 100\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\nIf S is a concatenation of two copies of some string, print Yes; otherwise, print No.\n\nSample Input 1\n\n6\nabcabc\n\nSample Output 1\n\nYes\n\nLet T = abc, and S = T + T.\n\nSample Input 2\n\n6\nabcadc\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n1\nz\n\nSample Output 3\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 84, "cpu_time_ms": 267, "memory_kb": 107076}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s047026763", "group_id": "codeNet:p02861", "input_text": "function main()\n \n N = parse(Int,readline())\n x = zeros(N)\n y = zeros(N)\n \n for i in 1:N\n (x[i],y[i]) = map(x -> parse(Int,x), split(readline()))\n end\n \n route_sum = 0\n \n for i in 1:N, j in 1:N\n \n route_sum += sqrt((x[i]-x[j])^2+(y[i]-y[j])^2)\n \n end\n \n println(route_sum / N)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1582655093, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s047026763.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s047026763", "user_id": "u790457721"}, "prompt_components": {"gold_output": "2.2761423749\n", "input_to_evaluate": "function main()\n \n N = parse(Int,readline())\n x = zeros(N)\n y = zeros(N)\n \n for i in 1:N\n (x[i],y[i]) = map(x -> parse(Int,x), split(readline()))\n end\n \n route_sum = 0\n \n for i in 1:N, j in 1:N\n \n route_sum += sqrt((x[i]-x[j])^2+(y[i]-y[j])^2)\n \n end\n \n println(route_sum / N)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 417, "memory_kb": 113032}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s539258884", "group_id": "codeNet:p02862", "input_text": "#=\nD:\n- Julia version: \n- Author: abap\n- Date: 2019-11-16\n=#\nx,y = parse.(split(readline()))\n\nX,Y = 0,0\nfor i in 1:x\n X += 2\n Y += 1\n print(X,Y)\n if (x - X)/(y - Y) == 1/2\n global yoko = x\n global tate = x - X\n break\n end\nend\ncount = factorial(tate + yoko)/(factorial(tate)+factorial(yoko))\nprintln(count % (10^9 +7))", "language": "Julia", "metadata": {"date": 1573962046, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s539258884.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s539258884", "user_id": "u879294842"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "#=\nD:\n- Julia version: \n- Author: abap\n- Date: 2019-11-16\n=#\nx,y = parse.(split(readline()))\n\nX,Y = 0,0\nfor i in 1:x\n X += 2\n Y += 1\n print(X,Y)\n if (x - X)/(y - Y) == 1/2\n global yoko = x\n global tate = x - X\n break\n end\nend\ncount = factorial(tate + yoko)/(factorial(tate)+factorial(yoko))\nprintln(count % (10^9 +7))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1912, "memory_kb": 173280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s977047984", "group_id": "codeNet:p02863", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,t = readline() |> split |> parseMap\n a = Tuple{Int,Int}[(0,0) for i in 1:n]\n for i in 1:n\n p,q = readline() |> split |> parseMap\n a[i] = (p,q)\n end\n a = sort(a,by=x->x[1])\n dp = -ones(Int,n+1,t+1)\n dp[1,1] = 0\n for i in 1:n\n for j in 1:t\n if dp[i,j]>-1\n dp[i+1,j] = max(dp[i+1,j],dp[i,j])\n dp[i+1,min(j+a[i][1],t+1)] = max(dp[i+1,min(j+a[i][1],t+1)], dp[i,j]+a[i][2])\n end\n end\n end\n println(maximum(dp))\nend\nmain()", "language": "Julia", "metadata": {"date": 1574000718, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s977047984.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s977047984", "user_id": "u095714878"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,t = readline() |> split |> parseMap\n a = Tuple{Int,Int}[(0,0) for i in 1:n]\n for i in 1:n\n p,q = readline() |> split |> parseMap\n a[i] = (p,q)\n end\n a = sort(a,by=x->x[1])\n dp = -ones(Int,n+1,t+1)\n dp[1,1] = 0\n for i in 1:n\n for j in 1:t\n if dp[i,j]>-1\n dp[i+1,j] = max(dp[i+1,j],dp[i,j])\n dp[i+1,min(j+a[i][1],t+1)] = max(dp[i+1,min(j+a[i][1],t+1)], dp[i,j]+a[i][2])\n end\n end\n end\n println(maximum(dp))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 632, "cpu_time_ms": 780, "memory_kb": 259680}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s080765993", "group_id": "codeNet:p02864", "input_text": "const N,K=map(x->parse(Int,x),split(readline()))\nconst H=map(x->parse(Int,x),split(readline()))\nconst dp=ones(Int,N+1,N+1)*10^13\nfunction main()\n\tdp[1,1]=0\n\tfor i=1:N,j=2:N+1,k=1:i\n\t\tdp[i+1,j]=min(dp[i+1,j],dp[k,j-1]+max(0,H[i]-(k==1 ? 0 : H[k-1])))\n\tend\n\tans=10^13\n\tfor i=1:N+1\n\t\tans=min(ans,dp[i,N-K+1])\n\tend\n\tprintln(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1573962774, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02864.html", "problem_id": "p02864", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02864/input.txt", "sample_output_relpath": "derived/input_output/data/p02864/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02864/Julia/s080765993.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s080765993", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "const N,K=map(x->parse(Int,x),split(readline()))\nconst H=map(x->parse(Int,x),split(readline()))\nconst dp=ones(Int,N+1,N+1)*10^13\nfunction main()\n\tdp[1,1]=0\n\tfor i=1:N,j=2:N+1,k=1:i\n\t\tdp[i+1,j]=min(dp[i+1,j],dp[k,j-1]+max(0,H[i]-(k==1 ? 0 : H[k-1])))\n\tend\n\tans=10^13\n\tfor i=1:N+1\n\t\tans=min(ans,dp[i,N-K+1])\n\tend\n\tprintln(ans)\nend\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe will create an artwork by painting black some squares in a white square grid with 10^9 rows and N columns.\n\nThe current plan is as follows: for the i-th column from the left, we will paint the H_i bottommost squares and will not paint the other squares in that column.\n\nBefore starting to work, you can choose at most K columns (possibly zero) and change the values of H_i for these columns to any integers of your choice between 0 and 10^9 (inclusive).\n\nDifferent values can be chosen for different columns.\n\nThen, you will create the modified artwork by repeating the following operation:\n\nChoose one or more consecutive squares in one row and paint them black. (Squares already painted black can be painted again, but squares not to be painted according to the modified plan should not be painted.)\n\nFind the minimum number of times you need to perform this operation.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n0 \\leq K \\leq N\n\n0 \\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_2 ... H_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 1\n2 3 4 1\n\nSample Output 1\n\n3\n\nFor example, by changing the value of H_3 to 2, you can create the modified artwork by the following three operations:\n\nPaint black the 1-st through 4-th squares from the left in the 1-st row from the bottom.\n\nPaint black the 1-st through 3-rd squares from the left in the 2-nd row from the bottom.\n\nPaint black the 2-nd square from the left in the 3-rd row from the bottom.\n\nSample Input 2\n\n6 2\n8 6 9 1 2 1\n\nSample Output 2\n\n7\n\nSample Input 3\n\n10 0\n1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000\n\nSample Output 3\n\n4999999996", "sample_input": "4 1\n2 3 4 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02864", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe will create an artwork by painting black some squares in a white square grid with 10^9 rows and N columns.\n\nThe current plan is as follows: for the i-th column from the left, we will paint the H_i bottommost squares and will not paint the other squares in that column.\n\nBefore starting to work, you can choose at most K columns (possibly zero) and change the values of H_i for these columns to any integers of your choice between 0 and 10^9 (inclusive).\n\nDifferent values can be chosen for different columns.\n\nThen, you will create the modified artwork by repeating the following operation:\n\nChoose one or more consecutive squares in one row and paint them black. (Squares already painted black can be painted again, but squares not to be painted according to the modified plan should not be painted.)\n\nFind the minimum number of times you need to perform this operation.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n0 \\leq K \\leq N\n\n0 \\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_2 ... H_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 1\n2 3 4 1\n\nSample Output 1\n\n3\n\nFor example, by changing the value of H_3 to 2, you can create the modified artwork by the following three operations:\n\nPaint black the 1-st through 4-th squares from the left in the 1-st row from the bottom.\n\nPaint black the 1-st through 3-rd squares from the left in the 2-nd row from the bottom.\n\nPaint black the 2-nd square from the left in the 3-rd row from the bottom.\n\nSample Input 2\n\n6 2\n8 6 9 1 2 1\n\nSample Output 2\n\n7\n\nSample Input 3\n\n10 0\n1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000\n\nSample Output 3\n\n4999999996", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 906, "memory_kb": 170340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s332295719", "group_id": "codeNet:p02864", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,k = readline() |> split |> parseMap\n h = readline() |> split |> parseMap\n if n==k\n println(0)\n else\n t = Tuple{Int,Int}[(0,0) for i in 1:n]\n for i in 1:n\n t[i] = (i,h[i])\n end\n t = sort(t,rev=true,by=x->x[2])\n for i in k:-1:1\n if t[i][1] == 1\n h[t[i][1]] = h[2]\n elseif t[i][1] == n\n h[t[i][1]] = h[n-1]\n else\n h[t[i][1]] = min(h[t[i][1]-1],h[t[i][1]+1])\n end\n end\n s = 0\n x = sort(h)\n for i in 1:n\n c = 0\n f = 0\n q = i==1?x[i]:x[i]-x[i-1]\n for i in 1:n\n if h[i] == 0 && f == 1\n f = 0\n elseif h[i] > 0 && f == 0\n f = 1\n c += 1\n end\n h[i]-=q\n end\n s += c*q\n end\n println(s)\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1573960014, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02864.html", "problem_id": "p02864", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02864/input.txt", "sample_output_relpath": "derived/input_output/data/p02864/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02864/Julia/s332295719.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s332295719", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,k = readline() |> split |> parseMap\n h = readline() |> split |> parseMap\n if n==k\n println(0)\n else\n t = Tuple{Int,Int}[(0,0) for i in 1:n]\n for i in 1:n\n t[i] = (i,h[i])\n end\n t = sort(t,rev=true,by=x->x[2])\n for i in k:-1:1\n if t[i][1] == 1\n h[t[i][1]] = h[2]\n elseif t[i][1] == n\n h[t[i][1]] = h[n-1]\n else\n h[t[i][1]] = min(h[t[i][1]-1],h[t[i][1]+1])\n end\n end\n s = 0\n x = sort(h)\n for i in 1:n\n c = 0\n f = 0\n q = i==1?x[i]:x[i]-x[i-1]\n for i in 1:n\n if h[i] == 0 && f == 1\n f = 0\n elseif h[i] > 0 && f == 0\n f = 1\n c += 1\n end\n h[i]-=q\n end\n s += c*q\n end\n println(s)\n end\nend\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe will create an artwork by painting black some squares in a white square grid with 10^9 rows and N columns.\n\nThe current plan is as follows: for the i-th column from the left, we will paint the H_i bottommost squares and will not paint the other squares in that column.\n\nBefore starting to work, you can choose at most K columns (possibly zero) and change the values of H_i for these columns to any integers of your choice between 0 and 10^9 (inclusive).\n\nDifferent values can be chosen for different columns.\n\nThen, you will create the modified artwork by repeating the following operation:\n\nChoose one or more consecutive squares in one row and paint them black. (Squares already painted black can be painted again, but squares not to be painted according to the modified plan should not be painted.)\n\nFind the minimum number of times you need to perform this operation.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n0 \\leq K \\leq N\n\n0 \\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_2 ... H_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 1\n2 3 4 1\n\nSample Output 1\n\n3\n\nFor example, by changing the value of H_3 to 2, you can create the modified artwork by the following three operations:\n\nPaint black the 1-st through 4-th squares from the left in the 1-st row from the bottom.\n\nPaint black the 1-st through 3-rd squares from the left in the 2-nd row from the bottom.\n\nPaint black the 2-nd square from the left in the 3-rd row from the bottom.\n\nSample Input 2\n\n6 2\n8 6 9 1 2 1\n\nSample Output 2\n\n7\n\nSample Input 3\n\n10 0\n1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000\n\nSample Output 3\n\n4999999996", "sample_input": "4 1\n2 3 4 1\n"}, "reference_outputs": ["3\n"], "source_document_id": "p02864", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe will create an artwork by painting black some squares in a white square grid with 10^9 rows and N columns.\n\nThe current plan is as follows: for the i-th column from the left, we will paint the H_i bottommost squares and will not paint the other squares in that column.\n\nBefore starting to work, you can choose at most K columns (possibly zero) and change the values of H_i for these columns to any integers of your choice between 0 and 10^9 (inclusive).\n\nDifferent values can be chosen for different columns.\n\nThen, you will create the modified artwork by repeating the following operation:\n\nChoose one or more consecutive squares in one row and paint them black. (Squares already painted black can be painted again, but squares not to be painted according to the modified plan should not be painted.)\n\nFind the minimum number of times you need to perform this operation.\n\nConstraints\n\n1 \\leq N \\leq 300\n\n0 \\leq K \\leq N\n\n0 \\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_2 ... H_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 1\n2 3 4 1\n\nSample Output 1\n\n3\n\nFor example, by changing the value of H_3 to 2, you can create the modified artwork by the following three operations:\n\nPaint black the 1-st through 4-th squares from the left in the 1-st row from the bottom.\n\nPaint black the 1-st through 3-rd squares from the left in the 2-nd row from the bottom.\n\nPaint black the 2-nd square from the left in the 3-rd row from the bottom.\n\nSample Input 2\n\n6 2\n8 6 9 1 2 1\n\nSample Output 2\n\n7\n\nSample Input 3\n\n10 0\n1 1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000\n\nSample Output 3\n\n4999999996", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1077, "cpu_time_ms": 1068, "memory_kb": 175640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s056451690", "group_id": "codeNet:p02865", "input_text": "f(n)=print(trunc(Int64,(n-1)/2))\nf(readline())", "language": "Julia", "metadata": {"date": 1575584740, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02865.html", "problem_id": "p02865", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02865/input.txt", "sample_output_relpath": "derived/input_output/data/p02865/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02865/Julia/s056451690.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s056451690", "user_id": "u295140952"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "f(n)=print(trunc(Int64,(n-1)/2))\nf(readline())", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHow many ways are there to choose two distinct positive integers totaling N, disregarding the order?\n\nConstraints\n\n1 \\leq N \\leq 10^6\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 answer.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n\nThere is only one way to choose two distinct integers totaling 4: to choose 1 and 3. (Choosing 3 and 1 is not considered different from this.)\n\nSample Input 2\n\n999999\n\nSample Output 2\n\n499999", "sample_input": "4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02865", "source_text": "Score : 100 points\n\nProblem Statement\n\nHow many ways are there to choose two distinct positive integers totaling N, disregarding the order?\n\nConstraints\n\n1 \\leq N \\leq 10^6\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 answer.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n\nThere is only one way to choose two distinct integers totaling 4: to choose 1 and 3. (Choosing 3 and 1 is not considered different from this.)\n\nSample Input 2\n\n999999\n\nSample Output 2\n\n499999", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 46, "cpu_time_ms": 1383, "memory_kb": 149220}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s445933592", "group_id": "codeNet:p02866", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nfunction main()\n mod = 998244353\n n = readline() |> parseInt\n d = readline() |> split |> parseMap\n a = zeros(Int,n)\n for i in 1:n\n a[d[i]+1] += 1\n end\n mx = maximum(d)\n q = 1\n for i in 2:mx+1\n if a[i] == 0\n q = 0\n end\n for j in 1:a[i]\n q = (q*a[i-1])%mod\n end\n end\n println(q)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1573357363, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02866.html", "problem_id": "p02866", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02866/input.txt", "sample_output_relpath": "derived/input_output/data/p02866/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02866/Julia/s445933592.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s445933592", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nfunction main()\n mod = 998244353\n n = readline() |> parseInt\n d = readline() |> split |> parseMap\n a = zeros(Int,n)\n for i in 1:n\n a[d[i]+1] += 1\n end\n mx = maximum(d)\n q = 1\n for i in 2:mx+1\n if a[i] == 0\n q = 0\n end\n for j in 1:a[i]\n q = (q*a[i-1])%mod\n end\n end\n println(q)\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven is an integer sequence D_1,...,D_N of N elements. Find the number, modulo 998244353, of trees with N vertices numbered 1 to N that satisfy the following condition:\n\nFor every integer i from 1 to N, the distance between Vertex 1 and Vertex i is D_i.\n\nNotes\n\nA tree of N vertices is a connected undirected graph with N vertices and N-1 edges, and the distance between two vertices are the number of edges in the shortest path between them.\n\nTwo trees are considered different if and only if there are two vertices x and y such that there is an edge between x and y in one of those trees and not in the other.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq D_i \\leq N-1\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 answer.\n\nSample Input 1\n\n4\n0 1 1 2\n\nSample Output 1\n\n2\n\nFor example, a tree with edges (1,2), (1,3), and (2,4) satisfies the condition.\n\nSample Input 2\n\n4\n1 1 1 1\n\nSample Output 2\n\n0\n\nSample Input 3\n\n7\n0 3 2 1 2 2 1\n\nSample Output 3\n\n24", "sample_input": "4\n0 1 1 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02866", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven is an integer sequence D_1,...,D_N of N elements. Find the number, modulo 998244353, of trees with N vertices numbered 1 to N that satisfy the following condition:\n\nFor every integer i from 1 to N, the distance between Vertex 1 and Vertex i is D_i.\n\nNotes\n\nA tree of N vertices is a connected undirected graph with N vertices and N-1 edges, and the distance between two vertices are the number of edges in the shortest path between them.\n\nTwo trees are considered different if and only if there are two vertices x and y such that there is an edge between x and y in one of those trees and not in the other.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n0 \\leq D_i \\leq N-1\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 answer.\n\nSample Input 1\n\n4\n0 1 1 2\n\nSample Output 1\n\n2\n\nFor example, a tree with edges (1,2), (1,3), and (2,4) satisfies the condition.\n\nSample Input 2\n\n4\n1 1 1 1\n\nSample Output 2\n\n0\n\nSample Input 3\n\n7\n0 3 2 1 2 2 1\n\nSample Output 3\n\n24", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 467, "cpu_time_ms": 887, "memory_kb": 177560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s366724118", "group_id": "codeNet:p02867", "input_text": "#=\nC:\n- Julia version:\n- Author: abap\n- Date: 2019-11-09\n=#\nparseInt(x::SubString{String}) = parse(Int,x)\n\n\nfunction main()\n count::Int64 = 0\n N::Int64 = parse(readline())\n A::Array{Int64} = parseInt.(split(readline()))\n B::Array{Int64} = parseInt.(split(readline()))\n sort!(A,alg = QuickSort)\n sort!(B,alg = QuickSort)\n @simd for i in 1:N\n if B[i] < A[N]\n @inbounds A[N], B[i] = B[i], A[N]\n sort!(A,alg = QuickSort)\n count += 1\n end\n end\n if count > N - 2\n println(\"No\")\n else\n println(\"Yes\")\n end\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1573355535, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02867.html", "problem_id": "p02867", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02867/input.txt", "sample_output_relpath": "derived/input_output/data/p02867/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02867/Julia/s366724118.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s366724118", "user_id": "u879294842"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "#=\nC:\n- Julia version:\n- Author: abap\n- Date: 2019-11-09\n=#\nparseInt(x::SubString{String}) = parse(Int,x)\n\n\nfunction main()\n count::Int64 = 0\n N::Int64 = parse(readline())\n A::Array{Int64} = parseInt.(split(readline()))\n B::Array{Int64} = parseInt.(split(readline()))\n sort!(A,alg = QuickSort)\n sort!(B,alg = QuickSort)\n @simd for i in 1:N\n if B[i] < A[N]\n @inbounds A[N], B[i] = B[i], A[N]\n sort!(A,alg = QuickSort)\n count += 1\n end\n end\n if count > N - 2\n println(\"No\")\n else\n println(\"Yes\")\n end\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N.\nDetermine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \\leq B_i holds:\n\nChoose two distinct integers x and y between 1 and N (inclusive), and swap the values of A_x and A_y.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i,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\nB_1 B_2 ... B_N\n\nOutput\n\nIf the objective is achievable, print Yes; if it is not, print No.\n\nSample Input 1\n\n3\n1 3 2\n1 2 3\n\nSample Output 1\n\nYes\n\nWe should swap the values of A_2 and A_3.\n\nSample Input 2\n\n3\n1 2 3\n2 2 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n6\n3 1 2 6 3 4\n2 2 8 3 4 3\n\nSample Output 3\n\nYes", "sample_input": "3\n1 3 2\n1 2 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02867", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are two integer sequences of N elements each: A_1,...,A_N and B_1,...,B_N.\nDetermine if it is possible to do the following operation at most N-2 times (possibly zero) so that, for every integer i from 1 to N, A_i \\leq B_i holds:\n\nChoose two distinct integers x and y between 1 and N (inclusive), and swap the values of A_x and A_y.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq A_i,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\nB_1 B_2 ... B_N\n\nOutput\n\nIf the objective is achievable, print Yes; if it is not, print No.\n\nSample Input 1\n\n3\n1 3 2\n1 2 3\n\nSample Output 1\n\nYes\n\nWe should swap the values of A_2 and A_3.\n\nSample Input 2\n\n3\n1 2 3\n2 2 2\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n6\n3 1 2 6 3 4\n2 2 8 3 4 3\n\nSample Output 3\n\nYes", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2115, "memory_kb": 130640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s197409676", "group_id": "codeNet:p02868", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction eval(a::Tuple{Int,Int},b::Tuple{Int,Int})\n\tif a[2] 1\n\t\tl = length(h)\n\t\tk = l>>1\n\t\twhile eval(x,h[k])==1&&k>=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Tuple{Int,Int},1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif eval(h[2*k],z)>=0\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif eval(z,h[2*k])>=0&&eval(z,h[2*k+1])>=0\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = eval(h[2*k],h[2*k+1])>=0?2*k:2*k+1\n\t\t\t\t\ttmp = h[t]\n\t\t\t\t\th[t] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tx\nend\n\nfunction main()\n n,m = readline() |> split |> parseMap\n e = [Tuple{Int,Int}[] for i in 1:n]\n for i in 2:n\n push!(e[i],(i-1,0))\n end\n for i in 1:m\n l,r,c = readline() |> split |> parseMap\n push!(e[l],(r,c))\n push!(e[r],(l,c))\n end\n dis = -ones(Int, length(e))\n\th = Array{Tuple{Int,Int},1}()\n\tpush!(h,(1,0))\n\twhile !isempty(h)\n\t\tv,w = hpop(h)\n\t\tdis[v] = dis[v]<0?w:min(dis[v],w)\n\t\tfor i in 1:length(e[v])\n\t\t\tif dis[e[v][i][1]]<0 || dis[e[v][i][1]]>w+e[v][i][2]\n\t\t\t\tdis[e[v][i][1]] = w+e[v][i][2]\n\t\t\t\thpush(h,(e[v][i][1],w+e[v][i][2]))\n\t\t\tend\n\t\tend\n\tend\n\tprintln(dis[n]) \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1573359120, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02868.html", "problem_id": "p02868", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02868/input.txt", "sample_output_relpath": "derived/input_output/data/p02868/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02868/Julia/s197409676.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s197409676", "user_id": "u095714878"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction eval(a::Tuple{Int,Int},b::Tuple{Int,Int})\n\tif a[2] 1\n\t\tl = length(h)\n\t\tk = l>>1\n\t\twhile eval(x,h[k])==1&&k>=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Tuple{Int,Int},1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif eval(h[2*k],z)>=0\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif eval(z,h[2*k])>=0&&eval(z,h[2*k+1])>=0\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = eval(h[2*k],h[2*k+1])>=0?2*k:2*k+1\n\t\t\t\t\ttmp = h[t]\n\t\t\t\t\th[t] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tx\nend\n\nfunction main()\n n,m = readline() |> split |> parseMap\n e = [Tuple{Int,Int}[] for i in 1:n]\n for i in 2:n\n push!(e[i],(i-1,0))\n end\n for i in 1:m\n l,r,c = readline() |> split |> parseMap\n push!(e[l],(r,c))\n push!(e[r],(l,c))\n end\n dis = -ones(Int, length(e))\n\th = Array{Tuple{Int,Int},1}()\n\tpush!(h,(1,0))\n\twhile !isempty(h)\n\t\tv,w = hpop(h)\n\t\tdis[v] = dis[v]<0?w:min(dis[v],w)\n\t\tfor i in 1:length(e[v])\n\t\t\tif dis[e[v][i][1]]<0 || dis[e[v][i][1]]>w+e[v][i][2]\n\t\t\t\tdis[e[v][i][1]] = w+e[v][i][2]\n\t\t\t\thpush(h,(e[v][i][1],w+e[v][i][2]))\n\t\t\tend\n\t\tend\n\tend\n\tprintln(dis[n]) \nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have N points numbered 1 to N arranged in a line in this order.\n\nTakahashi decides to make an undirected graph, using these points as the vertices.\nIn the beginning, the graph has no edge. Takahashi will do M operations to add edges in this graph.\nThe i-th operation is as follows:\n\nThe operation uses integers L_i and R_i between 1 and N (inclusive), and a positive integer C_i. For every pair of integers (s, t) such that L_i \\leq s < t \\leq R_i, add an edge of length C_i between Vertex s and Vertex t.\n\nThe integers L_1, ..., L_M, R_1, ..., R_M, C_1, ..., C_M are all given as input.\n\nTakahashi wants to solve the shortest path problem in the final graph obtained. Find the length of the shortest path from Vertex 1 to Vertex N in the final graph.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i < R_i \\leq N\n\n1 \\leq C_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 C_1\n:\nL_M R_M C_M\n\nOutput\n\nPrint the length of the shortest path from Vertex 1 to Vertex N in the final graph.\nIf there is no shortest path, print -1 instead.\n\nSample Input 1\n\n4 3\n1 3 2\n2 4 3\n1 4 6\n\nSample Output 1\n\n5\n\nWe have an edge of length 2 between Vertex 1 and Vertex 2, and an edge of length 3 between Vertex 2 and Vertex 4, so there is a path of length 5 between Vertex 1 and Vertex 4.\n\nSample Input 2\n\n4 2\n1 2 1\n3 4 2\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n10 7\n1 5 18\n3 4 8\n1 3 5\n4 7 10\n5 9 8\n6 10 5\n8 10 3\n\nSample Output 3\n\n28", "sample_input": "4 3\n1 3 2\n2 4 3\n1 4 6\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02868", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have N points numbered 1 to N arranged in a line in this order.\n\nTakahashi decides to make an undirected graph, using these points as the vertices.\nIn the beginning, the graph has no edge. Takahashi will do M operations to add edges in this graph.\nThe i-th operation is as follows:\n\nThe operation uses integers L_i and R_i between 1 and N (inclusive), and a positive integer C_i. For every pair of integers (s, t) such that L_i \\leq s < t \\leq R_i, add an edge of length C_i between Vertex s and Vertex t.\n\nThe integers L_1, ..., L_M, R_1, ..., R_M, C_1, ..., C_M are all given as input.\n\nTakahashi wants to solve the shortest path problem in the final graph obtained. Find the length of the shortest path from Vertex 1 to Vertex N in the final graph.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq L_i < R_i \\leq N\n\n1 \\leq C_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nL_1 R_1 C_1\n:\nL_M R_M C_M\n\nOutput\n\nPrint the length of the shortest path from Vertex 1 to Vertex N in the final graph.\nIf there is no shortest path, print -1 instead.\n\nSample Input 1\n\n4 3\n1 3 2\n2 4 3\n1 4 6\n\nSample Output 1\n\n5\n\nWe have an edge of length 2 between Vertex 1 and Vertex 2, and an edge of length 3 between Vertex 2 and Vertex 4, so there is a path of length 5 between Vertex 1 and Vertex 4.\n\nSample Input 2\n\n4 2\n1 2 1\n3 4 2\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n10 7\n1 5 18\n3 4 8\n1 3 5\n4 7 10\n5 9 8\n6 10 5\n8 10 3\n\nSample Output 3\n\n28", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1564, "cpu_time_ms": 995, "memory_kb": 172448}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s613628794", "group_id": "codeNet:p02873", "input_text": "S=chomp(readline())\nN=length(S)\nid=1\nans=0\nwhile id<=N\n\tL=R=0\n\twhile id<=N&&S[id]=='<'\n\t\tid+=1\n\t\tL+=1\n\tend\n\twhile id<=N&&S[id]=='>'\n\t\tid+=1\n\t\tR+=1\n\tend\n\tans+=div(L*(L+1),2)+div(R*(R+1),2)-min(L,R)\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1573291905, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s613628794.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s613628794", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "S=chomp(readline())\nN=length(S)\nid=1\nans=0\nwhile id<=N\n\tL=R=0\n\twhile id<=N&&S[id]=='<'\n\t\tid+=1\n\t\tL+=1\n\tend\n\twhile id<=N&&S[id]=='>'\n\t\tid+=1\n\t\tR+=1\n\tend\n\tans+=div(L*(L+1),2)+div(R*(R+1),2)-min(L,R)\nend\nprintln(ans)\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 911, "memory_kb": 165328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s854624717", "group_id": "codeNet:p02880", "input_text": "print(parse(Int,readline()) in [i*j for i=1:9, j=1:9] ? \"Yes\" : \"No\")", "language": "Julia", "metadata": {"date": 1588293975, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s854624717.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s854624717", "user_id": "u443151804"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "print(parse(Int,readline()) in [i*j for i=1:9, j=1:9] ? \"Yes\" : \"No\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 347, "memory_kb": 110340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s433400797", "group_id": "codeNet:p02881", "input_text": "N=parse(Int,readline())\nT=N+1\nfor i=2:isqrt(N)\n if N%i==0\n T=i+div(N,i)-2\n end\nend\nprintln(T)", "language": "Julia", "metadata": {"date": 1572236745, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s433400797.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s433400797", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "N=parse(Int,readline())\nT=N+1\nfor i=2:isqrt(N)\n if N%i==0\n T=i+div(N,i)-2\n end\nend\nprintln(T)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 661, "memory_kb": 154128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s175360808", "group_id": "codeNet:p02881", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n = readline() |> parseInt\n\n ans=0\n m=floor(Int,sqrt(n))\n for i in m:-1:1\n if n%i==0\n ans=i-1+n÷i-1\n break\n end\n end\n\n println(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1572228697, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s175360808.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s175360808", "user_id": "u630185395"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n = readline() |> parseInt\n\n ans=0\n m=floor(Int,sqrt(n))\n for i in m:-1:1\n if n%i==0\n ans=i-1+n÷i-1\n break\n end\n end\n\n println(ans)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 661, "memory_kb": 163304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s017045126", "group_id": "codeNet:p02882", "input_text": "a,b,x = parse.(Int,split(readline()))\n\nif 2x <= a^2 * b\n y = 2x / (a*b)\n print(rad2deg(atan(b/y)))\nelse\n y = 2(a^2*b - x) /a^2\n print(rad2deg(atan(y/a)))\nend", "language": "Julia", "metadata": {"date": 1590018472, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s017045126.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s017045126", "user_id": "u183840468"}, "prompt_components": {"gold_output": "45.0000000000\n", "input_to_evaluate": "a,b,x = parse.(Int,split(readline()))\n\nif 2x <= a^2 * b\n y = 2x / (a*b)\n print(rad2deg(atan(b/y)))\nelse\n y = 2(a^2*b - x) /a^2\n print(rad2deg(atan(y/a)))\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 1928, "memory_kb": 225228}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s301051175", "group_id": "codeNet:p02883", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n, k = readline() |> split |> parseArray\n a = readline() |> split |> parseArray\n f = readline() |> split |> parseArray\n\n sort!(a)\n sort!(f, rev=true)\n\n prev = maximum(a.*f)\n curr = div(prev, 2)\n ans = 10^18 + 1\n while true\n k′ = 0\n for i in 1:n\n if curr >= a[i] * f[i]\n continue\n end\n k′ += a[i] - floor(Int, curr / f[i])\n end\n # println(\"$(curr) $(prev) $(k′)\")\n m = max(div(abs(prev - curr), 2), 1)\n prev = curr\n if k′ <= k\n ans = curr\n curr -= m\n curr = max(curr, 0)\n else\n curr += m\n end\n if curr == prev || curr == ans\n break\n end\n end\n\n println(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1591710260, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s301051175.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s301051175", "user_id": "u630185395"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n, k = readline() |> split |> parseArray\n a = readline() |> split |> parseArray\n f = readline() |> split |> parseArray\n\n sort!(a)\n sort!(f, rev=true)\n\n prev = maximum(a.*f)\n curr = div(prev, 2)\n ans = 10^18 + 1\n while true\n k′ = 0\n for i in 1:n\n if curr >= a[i] * f[i]\n continue\n end\n k′ += a[i] - floor(Int, curr / f[i])\n end\n # println(\"$(curr) $(prev) $(k′)\")\n m = max(div(abs(prev - curr), 2), 1)\n prev = curr\n if k′ <= k\n ans = curr\n curr -= m\n curr = max(curr, 0)\n else\n curr += m\n end\n if curr == prev || curr == ans\n break\n end\n end\n\n println(ans)\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 775, "cpu_time_ms": 1001, "memory_kb": 174576}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s824543519", "group_id": "codeNet:p02883", "input_text": "function f(A,F,X)\n\tT=0\n\tfor (a,b)=zip(A,F)\n\t\tt=a*b-X\n\t\tif t>0\n\t\t\tT+=cld(t,b)\n\t\tend\n\tend\n\tT\nend\nfunction main()\n\tN,K=map(x->parse(Int,x),split(readline()))\n\tA=sort(map(x->parse(Int,x),split(readline())))\n\tF=reverse(sort(map(x->parse(Int,x),split(readline()))))\n\tL=-1\n\tR=2^40\n\twhile R-L>1\n\t\tM=(L+R)>>1\n\t\tif f(A,F,M)<=K\n\t\t\tR=M\n\t\telse\n\t\t\tL=M\n\t\tend\n\tend\n\tprintln(R)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1572238845, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s824543519.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s824543519", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function f(A,F,X)\n\tT=0\n\tfor (a,b)=zip(A,F)\n\t\tt=a*b-X\n\t\tif t>0\n\t\t\tT+=cld(t,b)\n\t\tend\n\tend\n\tT\nend\nfunction main()\n\tN,K=map(x->parse(Int,x),split(readline()))\n\tA=sort(map(x->parse(Int,x),split(readline())))\n\tF=reverse(sort(map(x->parse(Int,x),split(readline()))))\n\tL=-1\n\tR=2^40\n\twhile R-L>1\n\t\tM=(L+R)>>1\n\t\tif f(A,F,M)<=K\n\t\t\tR=M\n\t\telse\n\t\t\tL=M\n\t\tend\n\tend\n\tprintln(R)\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 372, "cpu_time_ms": 789, "memory_kb": 144556}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s380166059", "group_id": "codeNet:p02885", "input_text": "a,b=parse.(split(readline()))\nprint(max(0,a-2b))", "language": "Julia", "metadata": {"date": 1585086079, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02885.html", "problem_id": "p02885", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02885/input.txt", "sample_output_relpath": "derived/input_output/data/p02885/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02885/Julia/s380166059.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s380166059", "user_id": "u443151804"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "a,b=parse.(split(readline()))\nprint(max(0,a-2b))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThe window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)\n\nWe will close the window so as to minimize the total horizontal length of the uncovered part of the window.\nFind the total horizontal length of the uncovered parts of the window then.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\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\nPrint the total horizontal length of the uncovered parts of the window.\n\nSample Input 1\n\n12 4\n\nSample Output 1\n\n4\n\nWe have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.\n\nSample Input 2\n\n20 15\n\nSample Output 2\n\n0\n\nIf the window is completely covered, print 0.\n\nSample Input 3\n\n20 30\n\nSample Output 3\n\n0\n\nEach curtain may be longer than the window.", "sample_input": "12 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02885", "source_text": "Score : 100 points\n\nProblem Statement\n\nThe window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)\n\nWe will close the window so as to minimize the total horizontal length of the uncovered part of the window.\nFind the total horizontal length of the uncovered parts of the window then.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\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\nPrint the total horizontal length of the uncovered parts of the window.\n\nSample Input 1\n\n12 4\n\nSample Output 1\n\n4\n\nWe have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.\n\nSample Input 2\n\n20 15\n\nSample Output 2\n\n0\n\nIf the window is completely covered, print 0.\n\nSample Input 3\n\n20 30\n\nSample Output 3\n\n0\n\nEach curtain may be longer than the window.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 48, "cpu_time_ms": 571, "memory_kb": 118888}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s022472352", "group_id": "codeNet:p02885", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n a,b = readline() |> split |> parseArray\n\n ans=min(0,a-2b)\n println(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1571533349, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02885.html", "problem_id": "p02885", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02885/input.txt", "sample_output_relpath": "derived/input_output/data/p02885/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02885/Julia/s022472352.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s022472352", "user_id": "u630185395"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n a,b = readline() |> split |> parseArray\n\n ans=min(0,a-2b)\n println(ans)\nend\n\nmain()\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThe window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)\n\nWe will close the window so as to minimize the total horizontal length of the uncovered part of the window.\nFind the total horizontal length of the uncovered parts of the window then.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\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\nPrint the total horizontal length of the uncovered parts of the window.\n\nSample Input 1\n\n12 4\n\nSample Output 1\n\n4\n\nWe have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.\n\nSample Input 2\n\n20 15\n\nSample Output 2\n\n0\n\nIf the window is completely covered, print 0.\n\nSample Input 3\n\n20 30\n\nSample Output 3\n\n0\n\nEach curtain may be longer than the window.", "sample_input": "12 4\n"}, "reference_outputs": ["4\n"], "source_document_id": "p02885", "source_text": "Score : 100 points\n\nProblem Statement\n\nThe window of Takahashi's room has a width of A. There are two curtains hung over the window, each of which has a horizontal length of B. (Vertically, the curtains are long enough to cover the whole window.)\n\nWe will close the window so as to minimize the total horizontal length of the uncovered part of the window.\nFind the total horizontal length of the uncovered parts of the window then.\n\nConstraints\n\n1 \\leq A \\leq 100\n\n1 \\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\nPrint the total horizontal length of the uncovered parts of the window.\n\nSample Input 1\n\n12 4\n\nSample Output 1\n\n4\n\nWe have a window with a horizontal length of 12, and two curtains, each of length 4, that cover both ends of the window, for example. The uncovered part has a horizontal length of 4.\n\nSample Input 2\n\n20 15\n\nSample Output 2\n\n0\n\nIf the window is completely covered, print 0.\n\nSample Input 3\n\n20 30\n\nSample Output 3\n\n0\n\nEach curtain may be longer than the window.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 737, "memory_kb": 116572}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s221436577", "group_id": "codeNet:p02886", "input_text": "N = readline()\nd = parse(split(readline()))\nlen = length(d)\nsum = 0\nfor i in 1:len\n for j in i:len\n sum += d[i]*d[j]\n end\nend\nprintln(sum)", "language": "Julia", "metadata": {"date": 1575270331, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s221436577.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s221436577", "user_id": "u879294842"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "N = readline()\nd = parse(split(readline()))\nlen = length(d)\nsum = 0\nfor i in 1:len\n for j in i:len\n sum += d[i]*d[j]\n end\nend\nprintln(sum)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1870, "memory_kb": 216832}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s932900671", "group_id": "codeNet:p02886", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n = readline() |> parseInt\n d = readline() |> split |> parseArray\n\n ans=sum(d[i]*d[j] for i in 1:n-1 for j in i+1:n)\n println(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1571533574, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s932900671.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s932900671", "user_id": "u630185395"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n = readline() |> parseInt\n d = readline() |> split |> parseArray\n\n ans=sum(d[i]*d[j] for i in 1:n-1 for j in i+1:n)\n println(ans)\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 255, "cpu_time_ms": 1806, "memory_kb": 123972}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s614286163", "group_id": "codeNet:p02887", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = readline() |> chomp\n\tk = 1\n\tfor i in 2:n\n\t\tif s[i]!=s[i-1]\n\t\t\tk += 1\n\t\tend\n\tend\n\tprintln(k)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1572089661, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02887.html", "problem_id": "p02887", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02887/input.txt", "sample_output_relpath": "derived/input_output/data/p02887/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02887/Julia/s614286163.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s614286163", "user_id": "u095714878"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = readline() |> chomp\n\tk = 1\n\tfor i in 2:n\n\t\tif s[i]!=s[i-1]\n\t\t\tk += 1\n\t\tend\n\tend\n\tprintln(k)\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S.\n\nAdjacent slimes with the same color will fuse into one larger slime without changing the color. If there were a slime adjacent to this group of slimes before fusion, that slime is now adjacent to the new larger slime.\n\nUltimately, how many slimes will be there?\n\nConstraints\n\n1 \\leq N \\leq 10^5\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 final number of slimes.\n\nSample Input 1\n\n10\naabbbbaaca\n\nSample Output 1\n\n5\n\nUltimately, these slimes will fuse into abaca.\n\nSample Input 2\n\n5\naaaaa\n\nSample Output 2\n\n1\n\nAll the slimes will fuse into one.\n\nSample Input 3\n\n20\nxxzaffeeeeddfkkkkllq\n\nSample Output 3\n\n10", "sample_input": "10\naabbbbaaca\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02887", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N slimes lining up from left to right. The colors of these slimes will be given as a string S of length N consisting of lowercase English letters. The i-th slime from the left has the color that corresponds to the i-th character of S.\n\nAdjacent slimes with the same color will fuse into one larger slime without changing the color. If there were a slime adjacent to this group of slimes before fusion, that slime is now adjacent to the new larger slime.\n\nUltimately, how many slimes will be there?\n\nConstraints\n\n1 \\leq N \\leq 10^5\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 final number of slimes.\n\nSample Input 1\n\n10\naabbbbaaca\n\nSample Output 1\n\n5\n\nUltimately, these slimes will fuse into abaca.\n\nSample Input 2\n\n5\naaaaa\n\nSample Output 2\n\n1\n\nAll the slimes will fuse into one.\n\nSample Input 3\n\n20\nxxzaffeeeeddfkkkkllq\n\nSample Output 3\n\n10", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 780, "memory_kb": 168936}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s983530964", "group_id": "codeNet:p02888", "input_text": "parseline(str=readline()) = parse.(Int, split(str))\nfunction binarysearches(arr, left, right)\n r = searchsortedfirst(arr, right) - 1\n l = searchsortedlast(arr, left) + 1\n ans = r - l + 1\n return max(0, ans)\nend\nfunction Triangles()\n N = parse(Int, readline())\n L = sort(parseline())\n ans = 0\n for n in N:-1:2\n for m in n-1:-1:1\n b = binarysearches(L, L[n]-L[m], L[n]+L[m])\n ans += L[n]<2L[m] ? b - 2 : b - 1\n end\n end\n println(ans÷3)\nend\nTriangles()", "language": "Julia", "metadata": {"date": 1599843039, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02888.html", "problem_id": "p02888", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02888/input.txt", "sample_output_relpath": "derived/input_output/data/p02888/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02888/Julia/s983530964.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s983530964", "user_id": "u728564399"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseline(str=readline()) = parse.(Int, split(str))\nfunction binarysearches(arr, left, right)\n r = searchsortedfirst(arr, right) - 1\n l = searchsortedlast(arr, left) + 1\n ans = r - l + 1\n return max(0, ans)\nend\nfunction Triangles()\n N = parse(Int, readline())\n L = sort(parseline())\n ans = 0\n for n in N:-1:2\n for m in n-1:-1:1\n b = binarysearches(L, L[n]-L[m], L[n]+L[m])\n ans += L[n]<2L[m] ? b - 2 : b - 1\n end\n end\n println(ans÷3)\nend\nTriangles()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:\n\na < b + c\n\nb < c + a\n\nc < a + b\n\nHow many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq L_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nConstraints\n\nPrint the number of different triangles that can be formed.\n\nSample Input 1\n\n4\n3 4 2 1\n\nSample Output 1\n\n1\n\nOnly one triangle can be formed: the triangle formed by the first, second, and third sticks.\n\nSample Input 2\n\n3\n1 1000 1\n\nSample Output 2\n\n0\n\nNo triangles can be formed.\n\nSample Input 3\n\n7\n218 786 704 233 645 728 389\n\nSample Output 3\n\n23", "sample_input": "4\n3 4 2 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02888", "source_text": "Score : 400 points\n\nProblem Statement\n\nTakahashi has N sticks that are distinguishable from each other. The length of the i-th stick is L_i.\n\nHe is going to form a triangle using three of these sticks. Let a, b, and c be the lengths of the three sticks used. Here, all of the following conditions must be satisfied:\n\na < b + c\n\nb < c + a\n\nc < a + b\n\nHow many different triangles can be formed? Two triangles are considered different when there is a stick used in only one of them.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 2 \\times 10^3\n\n1 \\leq L_i \\leq 10^3\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nConstraints\n\nPrint the number of different triangles that can be formed.\n\nSample Input 1\n\n4\n3 4 2 1\n\nSample Output 1\n\n1\n\nOnly one triangle can be formed: the triangle formed by the first, second, and third sticks.\n\nSample Input 2\n\n3\n1 1000 1\n\nSample Output 2\n\n0\n\nNo triangles can be formed.\n\nSample Input 3\n\n7\n218 786 704 233 645 728 389\n\nSample Output 3\n\n23", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 384, "memory_kb": 176988}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s975185733", "group_id": "codeNet:p02889", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m,l = readline() |> split |> parseMap\n\tg = zeros(Int,n,n)\n\td = 10^12*ones(Int,n,n)\n\te = 10^12*ones(Int,n,n)\n\tfor i in 1:n\n\t\td[i,i] = 0\n\tend\n\tfor i in 1:m\n\t\ta,b,c = readline() |> split |> parseMap\n\t\tg[a,b] = c\n\t\tg[b,a] = c\n\t\td[a,b] = c\n\t\td[b,a] = c\n\tend\n\tfor k in 1:n\n\t\tfor i in 1:n\n\t\t\tfor j in 1:n\n\t\t\t\td[i,j] = min(d[i,j], d[i,k] + d[k,j])\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tfor j in 1:n\n\t\t\tif d[i,j] <=l\n\t\t\t\te[i,j] = 1\n\t\t\tend\n\t\tend\n\tend\n\tfor k in 1:n\n\t\tfor i in 1:n\n\t\t\tfor j in 1:n\n\t\t\t\te[i,j] = min(e[i,j], e[i,k] + e[k,j])\n\t\t\tend\n\t\tend\n\tend\n\tq = readline() |> parseInt\n\tfor i in 1:q\n\t\ts,t = readline() |> split |> parseMap\n\t\tprintln(e[s,t]<10^11?e[s,t]-1:-1)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1571650176, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02889.html", "problem_id": "p02889", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02889/input.txt", "sample_output_relpath": "derived/input_output/data/p02889/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02889/Julia/s975185733.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s975185733", "user_id": "u095714878"}, "prompt_components": {"gold_output": "0\n1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m,l = readline() |> split |> parseMap\n\tg = zeros(Int,n,n)\n\td = 10^12*ones(Int,n,n)\n\te = 10^12*ones(Int,n,n)\n\tfor i in 1:n\n\t\td[i,i] = 0\n\tend\n\tfor i in 1:m\n\t\ta,b,c = readline() |> split |> parseMap\n\t\tg[a,b] = c\n\t\tg[b,a] = c\n\t\td[a,b] = c\n\t\td[b,a] = c\n\tend\n\tfor k in 1:n\n\t\tfor i in 1:n\n\t\t\tfor j in 1:n\n\t\t\t\td[i,j] = min(d[i,j], d[i,k] + d[k,j])\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tfor j in 1:n\n\t\t\tif d[i,j] <=l\n\t\t\t\te[i,j] = 1\n\t\t\tend\n\t\tend\n\tend\n\tfor k in 1:n\n\t\tfor i in 1:n\n\t\t\tfor j in 1:n\n\t\t\t\te[i,j] = min(e[i,j], e[i,k] + e[k,j])\n\t\t\tend\n\t\tend\n\tend\n\tq = readline() |> parseInt\n\tfor i in 1:q\n\t\ts,t = readline() |> split |> parseMap\n\t\tprintln(e[s,t]<10^11?e[s,t]-1:-1)\n\tend\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N towns numbered 1 to N and M roads. The i-th road connects Town A_i and Town B_i bidirectionally and has a length of C_i.\n\nTakahashi will travel between these towns by car, passing through these roads. The fuel tank of his car can contain at most L liters of fuel, and one liter of fuel is consumed for each unit distance traveled. When visiting a town while traveling, he can full the tank (or choose not to do so). Travel that results in the tank becoming empty halfway on the road cannot be done.\n\nProcess the following Q queries:\n\nThe tank is now full. Find the minimum number of times he needs to full his tank while traveling from Town s_i to Town t_i. If Town t_i is unreachable, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 300\n\n0 \\leq M \\leq \\frac{N(N-1)}{2}\n\n1 \\leq L \\leq 10^9\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n\\left(A_i, B_i\\right) \\neq \\left(A_j, B_j\\right) (if i \\neq j)\n\n\\left(A_i, B_i\\right) \\neq \\left(B_j, A_j\\right) (if i \\neq j)\n\n1 \\leq C_i \\leq 10^9\n\n1 \\leq Q \\leq N\\left(N-1\\right)\n\n1 \\leq s_i, t_i \\leq N\n\ns_i \\neq t_i\n\n\\left(s_i, t_i\\right) \\neq \\left(s_j, t_j\\right) (if i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M L\nA_1 B_1 C_1\n:\nA_M B_M C_M\nQ\ns_1 t_1\n:\ns_Q t_Q\n\nOutput\n\nPrint Q lines.\n\nThe i-th line should contain the minimum number of times the tank needs to be fulled while traveling from Town s_i to Town t_i. If Town t_i is unreachable, the line should contain -1 instead.\n\nSample Input 1\n\n3 2 5\n1 2 3\n2 3 3\n2\n3 2\n1 3\n\nSample Output 1\n\n0\n1\n\nTo travel from Town 3 to Town 2, we can use the second road to reach Town 2 without fueling the tank on the way.\n\nTo travel from Town 1 to Town 3, we can first use the first road to get to Town 2, full the tank, and use the second road to reach Town 3.\n\nSample Input 2\n\n4 0 1\n1\n2 1\n\nSample Output 2\n\n-1\n\nThere may be no road at all.\n\nSample Input 3\n\n5 4 4\n1 2 2\n2 3 2\n3 4 3\n4 5 2\n20\n2 1\n3 1\n4 1\n5 1\n1 2\n3 2\n4 2\n5 2\n1 3\n2 3\n4 3\n5 3\n1 4\n2 4\n3 4\n5 4\n1 5\n2 5\n3 5\n4 5\n\nSample Output 3\n\n0\n0\n1\n2\n0\n0\n1\n2\n0\n0\n0\n1\n1\n1\n0\n0\n2\n2\n1\n0", "sample_input": "3 2 5\n1 2 3\n2 3 3\n2\n3 2\n1 3\n"}, "reference_outputs": ["0\n1\n"], "source_document_id": "p02889", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N towns numbered 1 to N and M roads. The i-th road connects Town A_i and Town B_i bidirectionally and has a length of C_i.\n\nTakahashi will travel between these towns by car, passing through these roads. The fuel tank of his car can contain at most L liters of fuel, and one liter of fuel is consumed for each unit distance traveled. When visiting a town while traveling, he can full the tank (or choose not to do so). Travel that results in the tank becoming empty halfway on the road cannot be done.\n\nProcess the following Q queries:\n\nThe tank is now full. Find the minimum number of times he needs to full his tank while traveling from Town s_i to Town t_i. If Town t_i is unreachable, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 300\n\n0 \\leq M \\leq \\frac{N(N-1)}{2}\n\n1 \\leq L \\leq 10^9\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\n\\left(A_i, B_i\\right) \\neq \\left(A_j, B_j\\right) (if i \\neq j)\n\n\\left(A_i, B_i\\right) \\neq \\left(B_j, A_j\\right) (if i \\neq j)\n\n1 \\leq C_i \\leq 10^9\n\n1 \\leq Q \\leq N\\left(N-1\\right)\n\n1 \\leq s_i, t_i \\leq N\n\ns_i \\neq t_i\n\n\\left(s_i, t_i\\right) \\neq \\left(s_j, t_j\\right) (if i \\neq j)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M L\nA_1 B_1 C_1\n:\nA_M B_M C_M\nQ\ns_1 t_1\n:\ns_Q t_Q\n\nOutput\n\nPrint Q lines.\n\nThe i-th line should contain the minimum number of times the tank needs to be fulled while traveling from Town s_i to Town t_i. If Town t_i is unreachable, the line should contain -1 instead.\n\nSample Input 1\n\n3 2 5\n1 2 3\n2 3 3\n2\n3 2\n1 3\n\nSample Output 1\n\n0\n1\n\nTo travel from Town 3 to Town 2, we can use the second road to reach Town 2 without fueling the tank on the way.\n\nTo travel from Town 1 to Town 3, we can first use the first road to get to Town 2, full the tank, and use the second road to reach Town 3.\n\nSample Input 2\n\n4 0 1\n1\n2 1\n\nSample Output 2\n\n-1\n\nThere may be no road at all.\n\nSample Input 3\n\n5 4 4\n1 2 2\n2 3 2\n3 4 3\n4 5 2\n20\n2 1\n3 1\n4 1\n5 1\n1 2\n3 2\n4 2\n5 2\n1 3\n2 3\n4 3\n5 3\n1 4\n2 4\n3 4\n5 4\n1 5\n2 5\n3 5\n4 5\n\nSample Output 3\n\n0\n0\n1\n2\n0\n0\n1\n2\n0\n0\n0\n1\n1\n1\n0\n0\n2\n2\n1\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 783, "cpu_time_ms": 933, "memory_kb": 160248}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s367779937", "group_id": "codeNet:p02897", "input_text": "n=parse(readline())\nprint((n-n%2)/2n))\n", "language": "Julia", "metadata": {"date": 1585085816, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02897.html", "problem_id": "p02897", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02897/input.txt", "sample_output_relpath": "derived/input_output/data/p02897/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02897/Julia/s367779937.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s367779937", "user_id": "u443151804"}, "prompt_components": {"gold_output": "0.5000000000\n", "input_to_evaluate": "n=parse(readline())\nprint((n-n%2)/2n))\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer N.\n\nTakahashi chooses an integer a from the positive integers not greater than N with equal probability.\n\nFind the probability that a is odd.\n\nConstraints\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 probability that a is odd.\nYour output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n0.5000000000\n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among them, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\nSample Input 2\n\n5\n\nSample Output 2\n\n0.6000000000\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1.0000000000", "sample_input": "4\n"}, "reference_outputs": ["0.5000000000\n"], "source_document_id": "p02897", "source_text": "Score : 100 points\n\nProblem Statement\n\nGiven is an integer N.\n\nTakahashi chooses an integer a from the positive integers not greater than N with equal probability.\n\nFind the probability that a is odd.\n\nConstraints\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 probability that a is odd.\nYour output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n0.5000000000\n\nThere are four positive integers not greater than 4: 1, 2, 3, and 4. Among them, we have two odd numbers: 1 and 3. Thus, the answer is \\frac{2}{4} = 0.5.\n\nSample Input 2\n\n5\n\nSample Output 2\n\n0.6000000000\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1.0000000000", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 39, "cpu_time_ms": 749, "memory_kb": 139728}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s627382666", "group_id": "codeNet:p02898", "input_text": "N,K=map(x->parse(Int,x),split(readline()))\ncnt=0\nfor x=map(x->parse(Int,x),split(readline()))\n cnt+=x>=K\nend\nprintln(cnt)", "language": "Julia", "metadata": {"date": 1569724461, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s627382666.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s627382666", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N,K=map(x->parse(Int,x),split(readline()))\ncnt=0\nfor x=map(x->parse(Int,x),split(readline()))\n cnt+=x>=K\nend\nprintln(cnt)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 804, "memory_kb": 166400}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s465478708", "group_id": "codeNet:p02899", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n num=Tuple{Int,Int}[(a[i],i) for i in 1:n]\n sort!(num,by=x->x[1])\n println(join([num[i][2] for i in 1:n],\" \"))\nend\nmain()", "language": "Julia", "metadata": {"date": 1582743847, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s465478708.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s465478708", "user_id": "u619197965"}, "prompt_components": {"gold_output": "3 1 2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n num=Tuple{Int,Int}[(a[i],i) for i in 1:n]\n sort!(num,by=x->x[1])\n println(join([num[i][2] for i in 1:n],\" \"))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 547, "memory_kb": 139404}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s346029225", "group_id": "codeNet:p02900", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ta,b = readline() |> split |> parseMap\n\tq = gcd(a,b)\n\ta = Int[]\n\ti = 1\n\twhile i<=sqrt(q)\n\t\tif q%i == 0\n\t\t\tpush!(a,i)\n\t\t\tpush!(a,div(q,i))\n\t\tend\n\t\ti+=1\n\tend\n\ta = sort(a)\n\tf = ones(Int,length(a))\n\tfor j in 1:length(a)\n\t\tfor k in j+1:length(a)\n\t\t\tif gcd(a[j],a[k])>1\n\t\t\t\tf[k] = 0\n\t\t\tend\n\t\tend\n\tend\n\tf[length(a)] = 0\n\tprintln(sum(f))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1569806407, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s346029225.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s346029225", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ta,b = readline() |> split |> parseMap\n\tq = gcd(a,b)\n\ta = Int[]\n\ti = 1\n\twhile i<=sqrt(q)\n\t\tif q%i == 0\n\t\t\tpush!(a,i)\n\t\t\tpush!(a,div(q,i))\n\t\tend\n\t\ti+=1\n\tend\n\ta = sort(a)\n\tf = ones(Int,length(a))\n\tfor j in 1:length(a)\n\t\tfor k in j+1:length(a)\n\t\t\tif gcd(a[j],a[k])>1\n\t\t\t\tf[k] = 0\n\t\t\tend\n\t\tend\n\tend\n\tf[length(a)] = 0\n\tprintln(sum(f))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1719, "memory_kb": 167704}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s394437880", "group_id": "codeNet:p02901", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\tdp = (10^9)*ones(Int,m+1,2^n)\n\tdp[1,1] = 0\n\tfor i in 1:m\n\t\ta,b = readline() |> split |> parseMap\n\t\tc = readline() |> split |> parseMap\n\t\td = 0\n\t\tfor j in 1:b\n\t\t\td += 2^(c[j]-1)\n\t\tend\n\t\tfor j in 1:2^n\n\t\t\tdp[i+1,j] = dp[i,j]\n\t\tend\n\t\tfor j in 1:2^n\n\t\t\tdp[i+1,((j-1)|d)+1] = min(dp[i+1,((j-1)|d)+1],dp[i,j]+a)\n\t\tend\n\tend\n\tif dp[m+1,2^n] == 10^9\n\t\tprintln(-1)\n\telse\n\t\tprintln(dp[m+1,2^n])\n\tend\nend\nmain()", "language": "Julia", "metadata": {"date": 1570318697, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02901.html", "problem_id": "p02901", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02901/input.txt", "sample_output_relpath": "derived/input_output/data/p02901/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02901/Julia/s394437880.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s394437880", "user_id": "u095714878"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\tdp = (10^9)*ones(Int,m+1,2^n)\n\tdp[1,1] = 0\n\tfor i in 1:m\n\t\ta,b = readline() |> split |> parseMap\n\t\tc = readline() |> split |> parseMap\n\t\td = 0\n\t\tfor j in 1:b\n\t\t\td += 2^(c[j]-1)\n\t\tend\n\t\tfor j in 1:2^n\n\t\t\tdp[i+1,j] = dp[i,j]\n\t\tend\n\t\tfor j in 1:2^n\n\t\t\tdp[i+1,((j-1)|d)+1] = min(dp[i+1,((j-1)|d)+1],dp[i,j]+a)\n\t\tend\n\tend\n\tif dp[m+1,2^n] == 10^9\n\t\tprintln(-1)\n\telse\n\t\tprintln(dp[m+1,2^n])\n\tend\nend\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.\n\nFind the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 12\n\n1 \\leq M \\leq 10^3\n\n1 \\leq a_i \\leq 10^5\n\n1 \\leq b_i \\leq N\n\n1 \\leq c_{i1} < c_{i2} < ... < c_{i{b_i}} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\nc_{11} c_{12} ... c_{1{b_1}}\n:\na_M b_M\nc_{M1} c_{M2} ... c_{M{b_M}}\n\nOutput\n\nPrint the minimum cost required to unlock all the treasure boxes.\nIf it is impossible to unlock all of them, print -1.\n\nSample Input 1\n\n2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n\nSample Output 1\n\n25\n\nWe can unlock all the boxes by purchasing the first and second keys, at the cost of 25 yen, which is the minimum cost required.\n\nSample Input 2\n\n12 1\n100000 1\n2\n\nSample Output 2\n\n-1\n\nWe cannot unlock all the boxes.\n\nSample Input 3\n\n4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n\nSample Output 3\n\n69942", "sample_input": "2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n"}, "reference_outputs": ["25\n"], "source_document_id": "p02901", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.\n\nFind the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 12\n\n1 \\leq M \\leq 10^3\n\n1 \\leq a_i \\leq 10^5\n\n1 \\leq b_i \\leq N\n\n1 \\leq c_{i1} < c_{i2} < ... < c_{i{b_i}} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\nc_{11} c_{12} ... c_{1{b_1}}\n:\na_M b_M\nc_{M1} c_{M2} ... c_{M{b_M}}\n\nOutput\n\nPrint the minimum cost required to unlock all the treasure boxes.\nIf it is impossible to unlock all of them, print -1.\n\nSample Input 1\n\n2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n\nSample Output 1\n\n25\n\nWe can unlock all the boxes by purchasing the first and second keys, at the cost of 25 yen, which is the minimum cost required.\n\nSample Input 2\n\n12 1\n100000 1\n2\n\nSample Output 2\n\n-1\n\nWe cannot unlock all the boxes.\n\nSample Input 3\n\n4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n\nSample Output 3\n\n69942", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 537, "cpu_time_ms": 530, "memory_kb": 176076}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s507410187", "group_id": "codeNet:p02901", "input_text": "function main()\n\tN,M=map(x->parse(Int,x),split(readline()))\n\tA=zeros(Int,M)\n\tC=zeros(Int,M)\n\tfor i=1:M\n\t\ta,b=map(x->parse(Int,x),split(readline()))\n\t\tA[i]=a\n\t\tfor c=map(x->parse(Int,x),split(readline()))\n\t\t\tC[i]+=1<<(c-1)\n\t\tend\n\tend\n\tdp=ones(Int,2^N)*1145141919\n\tdp[1]=0\n\tfor i=1:2^N\n\t\tid=i-1\n\t\tfor j=1:M\n\t\t\tdp[(id|C[j])+1]=min(dp[(id|C[j])+1],dp[i]+A[j])\n\t\tend\n\tend\n\tans=dp[end]\n\tprintln(ans < 1145141919 ? ans : -1)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1569724773, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02901.html", "problem_id": "p02901", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02901/input.txt", "sample_output_relpath": "derived/input_output/data/p02901/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02901/Julia/s507410187.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s507410187", "user_id": "u657913472"}, "prompt_components": {"gold_output": "25\n", "input_to_evaluate": "function main()\n\tN,M=map(x->parse(Int,x),split(readline()))\n\tA=zeros(Int,M)\n\tC=zeros(Int,M)\n\tfor i=1:M\n\t\ta,b=map(x->parse(Int,x),split(readline()))\n\t\tA[i]=a\n\t\tfor c=map(x->parse(Int,x),split(readline()))\n\t\t\tC[i]+=1<<(c-1)\n\t\tend\n\tend\n\tdp=ones(Int,2^N)*1145141919\n\tdp[1]=0\n\tfor i=1:2^N\n\t\tid=i-1\n\t\tfor j=1:M\n\t\t\tdp[(id|C[j])+1]=min(dp[(id|C[j])+1],dp[i]+A[j])\n\t\tend\n\tend\n\tans=dp[end]\n\tprintln(ans < 1145141919 ? ans : -1)\nend\nmain()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.\n\nFind the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 12\n\n1 \\leq M \\leq 10^3\n\n1 \\leq a_i \\leq 10^5\n\n1 \\leq b_i \\leq N\n\n1 \\leq c_{i1} < c_{i2} < ... < c_{i{b_i}} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\nc_{11} c_{12} ... c_{1{b_1}}\n:\na_M b_M\nc_{M1} c_{M2} ... c_{M{b_M}}\n\nOutput\n\nPrint the minimum cost required to unlock all the treasure boxes.\nIf it is impossible to unlock all of them, print -1.\n\nSample Input 1\n\n2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n\nSample Output 1\n\n25\n\nWe can unlock all the boxes by purchasing the first and second keys, at the cost of 25 yen, which is the minimum cost required.\n\nSample Input 2\n\n12 1\n100000 1\n2\n\nSample Output 2\n\n-1\n\nWe cannot unlock all the boxes.\n\nSample Input 3\n\n4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n\nSample Output 3\n\n69942", "sample_input": "2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n"}, "reference_outputs": ["25\n"], "source_document_id": "p02901", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have N locked treasure boxes, numbered 1 to N.\n\nA shop sells M keys. The i-th key is sold for a_i yen (the currency of Japan), and it can unlock b_i of the boxes: Box c_{i1}, c_{i2}, ..., c_{i{b_i}}. Each key purchased can be used any number of times.\n\nFind the minimum cost required to unlock all the treasure boxes. If it is impossible to unlock all of them, print -1.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 12\n\n1 \\leq M \\leq 10^3\n\n1 \\leq a_i \\leq 10^5\n\n1 \\leq b_i \\leq N\n\n1 \\leq c_{i1} < c_{i2} < ... < c_{i{b_i}} \\leq N\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_1 b_1\nc_{11} c_{12} ... c_{1{b_1}}\n:\na_M b_M\nc_{M1} c_{M2} ... c_{M{b_M}}\n\nOutput\n\nPrint the minimum cost required to unlock all the treasure boxes.\nIf it is impossible to unlock all of them, print -1.\n\nSample Input 1\n\n2 3\n10 1\n1\n15 1\n2\n30 2\n1 2\n\nSample Output 1\n\n25\n\nWe can unlock all the boxes by purchasing the first and second keys, at the cost of 25 yen, which is the minimum cost required.\n\nSample Input 2\n\n12 1\n100000 1\n2\n\nSample Output 2\n\n-1\n\nWe cannot unlock all the boxes.\n\nSample Input 3\n\n4 6\n67786 3\n1 3 4\n3497 1\n2\n44908 3\n2 3 4\n2156 3\n2 3 4\n26230 1\n2\n86918 1\n3\n\nSample Output 3\n\n69942", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 168728}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s556088206", "group_id": "codeNet:p02903", "input_text": "H,W,A,B=map(x->parse(Int,x),split(readline()))\nfor i=1:H\n\tfor j=1:W\n\t\tprint((i<=A)!=(j<=B) ? 1 : 0)\n\tend\n\tprintln()\nend\n", "language": "Julia", "metadata": {"date": 1573242282, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s556088206.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s556088206", "user_id": "u657913472"}, "prompt_components": {"gold_output": "100\n010\n001\n", "input_to_evaluate": "H,W,A,B=map(x->parse(Int,x),split(readline()))\nfor i=1:H\n\tfor j=1:W\n\t\tprint((i<=A)!=(j<=B) ? 1 : 0)\n\tend\n\tprintln()\nend\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 927, "memory_kb": 154552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s343247602", "group_id": "codeNet:p02903", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n h,w,a,b = readline() |> split |> parseArray\n\n # if 2a split |> parseArray\n\n # if 2a r\n\t\tuf[l] = r\n\tend\nend\n\nfunction evalma(st::Array{Int,1},ll,rr)\n\tr = 0\n\twhile 2^r>i-sl>>i>1\n\t\t\tif (sl>>i)%2==0\n\t\t\t\tv=max(v,st[sl>>i+1])\n\t\t\tend\n\t\t\tif (sr>>i)%2==1\n\t\t\t\tv = max(v,st[sr>>i-1])\n\t\t\tend\n\t\tend\n\tend\n\tv\nend\n\nfunction evalmi(st::Array{Int,1},ll,rr)\n\tr = 0\n\twhile 2^r>i-sl>>i>1\n\t\t\tif (sl>>i)%2==0\n\t\t\t\tv=min(v,st[sl>>i+1])\n\t\t\tend\n\t\t\tif (sr>>i)%2==1\n\t\t\t\tv = min(v,st[sr>>i-1])\n\t\t\tend\n\t\tend\n\tend\n\tv\nend\n\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\tp = readline() |> split |> parseMap\n\tve = zeros(Int,n)\n\tfor i in 2:n\n\t\tve[i] = ve[i-1]\n\t\tif p[i]>j] = max(stma[(hd+i)>>j],p[i])\n\t\t\tstmi[(hd+i)>>j] = min(stmi[(hd+i)>>j],p[i])\n\t\tend\n\tend\n\tuf = Int[i for i in 1:n-k+2]\n\tf = 1\n\tif ve[k] == 0\n\t\tf = 0\n\t\tunite(uf,1,n-k+2)\n\tend\n\tfor i in 2:n-k+1\n\t\tif ve[i+k-1]-ve[i]==0\n\t\t\tf = 0\n\t\t\tunite(uf,i,n-k+2)\n\t\telse\n\t\t\tma = evalma(stma,i,i+k-2)\n\t\t\tmi = evalmi(stmi,i,i+k-2)\n\t\t\tif p[i-1]ma\n\t\t\t\tunite(uf,i,i-1)\n\t\t\tend\n\t\tend\n\tend\n\tprintln(length(Set(uf))-f)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1576604437, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02904.html", "problem_id": "p02904", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02904/input.txt", "sample_output_relpath": "derived/input_output/data/p02904/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02904/Julia/s150757529.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s150757529", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction root(uf::Array{Int,1},x)\n\ts=x\n\twhile uf[s]!=s\n\t\ts=uf[s]\n\tend\n\ts\nend\nfunction same(uf::Array{Int,1},x,y)\n\troot(uf,x)==root(uf,y)?true:false\nend\nfunction unite(uf::Array{Int,1},x,y)\n\tl = root(uf,x)\n\tr = root(uf,y)\n\tif l < r\n\t\tuf[r] = l\n\telseif l > r\n\t\tuf[l] = r\n\tend\nend\n\nfunction evalma(st::Array{Int,1},ll,rr)\n\tr = 0\n\twhile 2^r>i-sl>>i>1\n\t\t\tif (sl>>i)%2==0\n\t\t\t\tv=max(v,st[sl>>i+1])\n\t\t\tend\n\t\t\tif (sr>>i)%2==1\n\t\t\t\tv = max(v,st[sr>>i-1])\n\t\t\tend\n\t\tend\n\tend\n\tv\nend\n\nfunction evalmi(st::Array{Int,1},ll,rr)\n\tr = 0\n\twhile 2^r>i-sl>>i>1\n\t\t\tif (sl>>i)%2==0\n\t\t\t\tv=min(v,st[sl>>i+1])\n\t\t\tend\n\t\t\tif (sr>>i)%2==1\n\t\t\t\tv = min(v,st[sr>>i-1])\n\t\t\tend\n\t\tend\n\tend\n\tv\nend\n\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\tp = readline() |> split |> parseMap\n\tve = zeros(Int,n)\n\tfor i in 2:n\n\t\tve[i] = ve[i-1]\n\t\tif p[i]>j] = max(stma[(hd+i)>>j],p[i])\n\t\t\tstmi[(hd+i)>>j] = min(stmi[(hd+i)>>j],p[i])\n\t\tend\n\tend\n\tuf = Int[i for i in 1:n-k+2]\n\tf = 1\n\tif ve[k] == 0\n\t\tf = 0\n\t\tunite(uf,1,n-k+2)\n\tend\n\tfor i in 2:n-k+1\n\t\tif ve[i+k-1]-ve[i]==0\n\t\t\tf = 0\n\t\t\tunite(uf,i,n-k+2)\n\t\telse\n\t\t\tma = evalma(stma,i,i+k-2)\n\t\t\tmi = evalmi(stmi,i,i+k-2)\n\t\t\tif p[i-1]ma\n\t\t\t\tunite(uf,i,i-1)\n\t\t\tend\n\t\tend\n\tend\n\tprintln(length(Set(uf))-f)\nend\n\nmain()\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nSnuke has a permutation (P_0,P_1,\\cdots,P_{N-1}) of (0,1,\\cdots,N-1).\n\nNow, he will perform the following operation exactly once:\n\nChoose K consecutive elements in P and sort them in ascending order.\n\nFind the number of permutations that can be produced as P after the operation.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n2 \\leq K \\leq N\n\n0 \\leq P_i \\leq N-1\n\nP_0,P_1,\\cdots,P_{N-1} are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nP_0 P_1 \\cdots P_{N-1}\n\nOutput\n\nPrint the number of permutations that can be produced as P after the operation.\n\nSample Input 1\n\n5 3\n0 2 1 4 3\n\nSample Output 1\n\n2\n\nTwo permutations can be produced as P after the operation: (0,1,2,4,3) and (0,2,1,3,4).\n\nSample Input 2\n\n4 4\n0 1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10 4\n2 0 1 3 7 5 4 6 8 9\n\nSample Output 3\n\n6", "sample_input": "5 3\n0 2 1 4 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02904", "source_text": "Score : 700 points\n\nProblem Statement\n\nSnuke has a permutation (P_0,P_1,\\cdots,P_{N-1}) of (0,1,\\cdots,N-1).\n\nNow, he will perform the following operation exactly once:\n\nChoose K consecutive elements in P and sort them in ascending order.\n\nFind the number of permutations that can be produced as P after the operation.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\n2 \\leq K \\leq N\n\n0 \\leq P_i \\leq N-1\n\nP_0,P_1,\\cdots,P_{N-1} are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nP_0 P_1 \\cdots P_{N-1}\n\nOutput\n\nPrint the number of permutations that can be produced as P after the operation.\n\nSample Input 1\n\n5 3\n0 2 1 4 3\n\nSample Output 1\n\n2\n\nTwo permutations can be produced as P after the operation: (0,1,2,4,3) and (0,2,1,3,4).\n\nSample Input 2\n\n4 4\n0 1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n10 4\n2 0 1 3 7 5 4 6 8 9\n\nSample Output 3\n\n6", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1743, "cpu_time_ms": 683, "memory_kb": 148424}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s233097147", "group_id": "codeNet:p02909", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n d=Dict{String,String}([\"Sunny\"=>\"Cloudy\",\"Cloudy\"=>\"Rainy\",\"Rainy\"=>\"Sunny\"])\n println(d[chomp(readline())])\nend\nmain()", "language": "Julia", "metadata": {"date": 1582744794, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s233097147.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s233097147", "user_id": "u619197965"}, "prompt_components": {"gold_output": "Cloudy\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n d=Dict{String,String}([\"Sunny\"=>\"Cloudy\",\"Cloudy\"=>\"Rainy\",\"Rainy\"=>\"Sunny\"])\n println(d[chomp(readline())])\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 229, "cpu_time_ms": 749, "memory_kb": 164908}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s609193780", "group_id": "codeNet:p02909", "input_text": "function main()\n \n S = chomp(readline())\n \n next = Dict(\"Sunny\" => \"Cloudy\", \"Cloudy\" => \"Rainy\", \"Rainy\" => \"Sunny\")\n \n pritln(next[S])\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1580513319, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s609193780.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s609193780", "user_id": "u790457721"}, "prompt_components": {"gold_output": "Cloudy\n", "input_to_evaluate": "function main()\n \n S = chomp(readline())\n \n next = Dict(\"Sunny\" => \"Cloudy\", \"Cloudy\" => \"Rainy\", \"Rainy\" => \"Sunny\")\n \n pritln(next[S])\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 593, "memory_kb": 128632}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s151919621", "group_id": "codeNet:p02910", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n s=chomp(readline())\n flg=true\n for i in 1:length(s)\n if i%2==1 && !in(s[i],\"RUD\")\n flg=false\n elseif i%2==0 && !in(s[i],\"LUD\")\n flg=false\n end\n end\n println(ifelse(flg,\"Yes\",\"No\"))\nend\nmain()", "language": "Julia", "metadata": {"date": 1582751900, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s151919621.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s151919621", "user_id": "u619197965"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n s=chomp(readline())\n flg=true\n for i in 1:length(s)\n if i%2==1 && !in(s[i],\"RUD\")\n flg=false\n elseif i%2==0 && !in(s[i],\"LUD\")\n flg=false\n end\n end\n println(ifelse(flg,\"Yes\",\"No\"))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 308, "memory_kb": 109664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s233808092", "group_id": "codeNet:p02910", "input_text": "function main()\n s = readline() |> chomp\n for i = 1:length(s)\n if i & 1 == 0 && s[i] == 'R'\n return println(\"No\")\n elseif i & 1 == 1 && s[i] == 'L'\n return println(\"No\")\n end\n end\n println(\"Yes\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1581056449, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s233808092.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s233808092", "user_id": "u541055501"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n s = readline() |> chomp\n for i = 1:length(s)\n if i & 1 == 0 && s[i] == 'R'\n return println(\"No\")\n elseif i & 1 == 1 && s[i] == 'L'\n return println(\"No\")\n end\n end\n println(\"Yes\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 789, "memory_kb": 165616}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s306452599", "group_id": "codeNet:p02910", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ts = readline() |> chomp\n\tn = length(s)\n\tf = 0\n\tfor i in 1:n\n\t\tif i%2==1&&s[i]=='L'\n\t\t\t\tf = 1\n\t\t\t\tbreak\n\t\telseif i%2==0&&s[i]=='R'\n\t\t\tf = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tprintln(f==0?\"Yes\":\"No\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1568623348, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s306452599.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s306452599", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ts = readline() |> chomp\n\tn = length(s)\n\tf = 0\n\tfor i in 1:n\n\t\tif i%2==1&&s[i]=='L'\n\t\t\t\tf = 1\n\t\t\t\tbreak\n\t\telseif i%2==0&&s[i]=='R'\n\t\t\tf = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tprintln(f==0?\"Yes\":\"No\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 305, "memory_kb": 109684}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s002430787", "group_id": "codeNet:p02911", "input_text": "# n, k, q = parse.(Int, readline() |> split)\nn, k, q = map(split(readline(), \" \")) do x\n parse(Int, x)\nend\n\nA = zeros(Int, n)\nfor i in 1:q\n a_i = parse(Int, readline())\n A[a_i] += 1\nend\n\nfor a in A\n println(a > q - k ? \"Yes\" : \"No\")\nend", "language": "Julia", "metadata": {"date": 1568598144, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s002430787.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s002430787", "user_id": "u775999110"}, "prompt_components": {"gold_output": "No\nNo\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "# n, k, q = parse.(Int, readline() |> split)\nn, k, q = map(split(readline(), \" \")) do x\n parse(Int, x)\nend\n\nA = zeros(Int, n)\nfor i in 1:q\n a_i = parse(Int, readline())\n A[a_i] += 1\nend\n\nfor a in A\n println(a > q - k ? \"Yes\" : \"No\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 789, "memory_kb": 163256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s974324534", "group_id": "codeNet:p02914", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction toBit(x,r)\n\ta = zeros(Int16,r)\n\tfor i in 0:r-1\n\t\tif (x>>i)%2==1\n\t\t\ta[r-i] = 1\n\t\tend\n\tend\n\ta\nend\nfunction fromBit(a::Array{Int16,1},r)\n\tx = 0\n\tfor i in 1:r\n\t\tx += a[i]*(2^(r-i))\n\tend\n\tx\nend\n\nfunction bsnand(a::Array{Int16,1},b::Array{Int16,1},r)\n\tx = zeros(Int16,r)\n\tfor i in 1:r\n\t\tx[i] = a[i]==0&&b[i]==1?1:0\n\tend\n\tx\nend\nfunction bsxor(a::Array{Int16,1},b::Array{Int16,1},r)\n\tx = zeros(Int16,r)\n\tfor i in 1:r\n\t\tx[i] = a[i]!=b[i]?1:0\n\tend\n\tx\nend\nfunction bsabs(a::Array{Int16,1},b::Array{Int16,1},r)\n\tx = zeros(Int16,r)\n\tfor i in 1:r\n\t\tx[i] = (a[i]+b[i])%2\n\tend\n\tx\nend\n\nfunction GaussJordan(a::Array{Array{Int16,1},1},n,m)\n\to = min(n,m)\n\tundone = 1\n\tfor i in 1:o\n\t\tfor j in undone:m\n\t\t\tf = 0\n\t\t\tfor k in i:n\n\t\t\t\tif a[k][j] != 0\n\t\t\t\t\ttmp = a[i]\n\t\t\t\t\ta[i] = a[k]\n\t\t\t\t\ta[k] = tmp\n\t\t\t\t\tfor l in k+1:n\n\t\t\t\t\t\tif a[l][j]>0\n\t\t\t\t\t\t\ta[l][j:m] = bsabs(a[l][j:m],a[i][j:m],m-j+1)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tif f == 1\n\t\t\t\tundone=j+1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tcan = m\n\tfor i in 1:o\n\t\tj = 0\n\t\tfor q in 1:can\n\t\t\tif a[o-i+1][q] != 0\n\t\t\t\tj = q\n\t\t\t\tcan = q-1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tif j>0\n\t\t\tfor k in i+1:o\n\t\t\t\tif a[o-k+1][j]>0\n\t\t\t\t\ta[o-k+1][j:m] = bsabs(a[o-k+1][j:m],a[o-i+1][j:m],m-j+1)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\ta\nend\n\n\nfunction main()\n\tn = readline() |> parseInt\n\tar = readline() |> split |> parseMap\n\to = 0\n\tfor i in 1:n\n\t\to = o$ar[i]\n\tend\n\tx = toBit(o,60)\n\tg = [toBit(ar[i],60) for i in 1:n]\n\tfor i in 1:n\n\t\tg[i] = bsnand(x,g[i],60)\n\tend\n\tg=GaussJordan(g,n,60)\n\tyg = g[1]\n\tfor i in 2:min(n,60)\n\t\tyg = bsxor(yg,g[i],60)\n\tend\n\ty = fromBit(yg,60)\n\tprintln(2*y+fromBit(x,60))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1572184845, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02914.html", "problem_id": "p02914", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02914/input.txt", "sample_output_relpath": "derived/input_output/data/p02914/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02914/Julia/s974324534.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s974324534", "user_id": "u095714878"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction toBit(x,r)\n\ta = zeros(Int16,r)\n\tfor i in 0:r-1\n\t\tif (x>>i)%2==1\n\t\t\ta[r-i] = 1\n\t\tend\n\tend\n\ta\nend\nfunction fromBit(a::Array{Int16,1},r)\n\tx = 0\n\tfor i in 1:r\n\t\tx += a[i]*(2^(r-i))\n\tend\n\tx\nend\n\nfunction bsnand(a::Array{Int16,1},b::Array{Int16,1},r)\n\tx = zeros(Int16,r)\n\tfor i in 1:r\n\t\tx[i] = a[i]==0&&b[i]==1?1:0\n\tend\n\tx\nend\nfunction bsxor(a::Array{Int16,1},b::Array{Int16,1},r)\n\tx = zeros(Int16,r)\n\tfor i in 1:r\n\t\tx[i] = a[i]!=b[i]?1:0\n\tend\n\tx\nend\nfunction bsabs(a::Array{Int16,1},b::Array{Int16,1},r)\n\tx = zeros(Int16,r)\n\tfor i in 1:r\n\t\tx[i] = (a[i]+b[i])%2\n\tend\n\tx\nend\n\nfunction GaussJordan(a::Array{Array{Int16,1},1},n,m)\n\to = min(n,m)\n\tundone = 1\n\tfor i in 1:o\n\t\tfor j in undone:m\n\t\t\tf = 0\n\t\t\tfor k in i:n\n\t\t\t\tif a[k][j] != 0\n\t\t\t\t\ttmp = a[i]\n\t\t\t\t\ta[i] = a[k]\n\t\t\t\t\ta[k] = tmp\n\t\t\t\t\tfor l in k+1:n\n\t\t\t\t\t\tif a[l][j]>0\n\t\t\t\t\t\t\ta[l][j:m] = bsabs(a[l][j:m],a[i][j:m],m-j+1)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tif f == 1\n\t\t\t\tundone=j+1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tcan = m\n\tfor i in 1:o\n\t\tj = 0\n\t\tfor q in 1:can\n\t\t\tif a[o-i+1][q] != 0\n\t\t\t\tj = q\n\t\t\t\tcan = q-1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tif j>0\n\t\t\tfor k in i+1:o\n\t\t\t\tif a[o-k+1][j]>0\n\t\t\t\t\ta[o-k+1][j:m] = bsabs(a[o-k+1][j:m],a[o-i+1][j:m],m-j+1)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\ta\nend\n\n\nfunction main()\n\tn = readline() |> parseInt\n\tar = readline() |> split |> parseMap\n\to = 0\n\tfor i in 1:n\n\t\to = o$ar[i]\n\tend\n\tx = toBit(o,60)\n\tg = [toBit(ar[i],60) for i in 1:n]\n\tfor i in 1:n\n\t\tg[i] = bsnand(x,g[i],60)\n\tend\n\tg=GaussJordan(g,n,60)\n\tyg = g[1]\n\tfor i in 2:min(n,60)\n\t\tyg = bsxor(yg,g[i],60)\n\tend\n\ty = fromBit(yg,60)\n\tprintln(2*y+fromBit(x,60))\nend\n\nmain()", "problem_context": "Score: 600 points\n\nProblem Statement\n\nWe have N non-negative integers: A_1, A_2, ..., A_N.\n\nConsider painting at least one and at most N-1 integers among them in red, and painting the rest in blue.\n\nLet the beauty of the painting be the \\mbox{XOR} of the integers painted in red, plus the \\mbox{XOR} of the integers painted in blue.\n\nFind the maximum possible beauty of the painting.\n\nWhat is \\mbox{XOR}?\n\nThe bitwise \\mbox{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\nWhen 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\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i < 2^{60}\\ (1 \\leq 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 maximum possible beauty of the painting.\n\nSample Input 1\n\n3\n3 6 5\n\nSample Output 1\n\n12\n\nIf we paint 3, 6, 5 in blue, red, blue, respectively, the beauty will be (6) + (3 \\oplus 5) = 12.\n\nThere is no way to paint the integers resulting in greater beauty than 12, so the answer is 12.\n\nSample Input 2\n\n4\n23 36 66 65\n\nSample Output 2\n\n188\n\nSample Input 3\n\n20\n1008288677408720767 539403903321871999 1044301017184589821 215886900497862655 504277496111605629 972104334925272829 792625803473366909 972333547668684797 467386965442856573 755861732751878143 1151846447448561405 467257771752201853 683930041385277311 432010719984459389 319104378117934975 611451291444233983 647509226592964607 251832107792119421 827811265410084479 864032478037725181\n\nSample Output 3\n\n2012721721873704572\n\nA_i and the answer may not fit into a 32-bit integer type.", "sample_input": "3\n3 6 5\n"}, "reference_outputs": ["12\n"], "source_document_id": "p02914", "source_text": "Score: 600 points\n\nProblem Statement\n\nWe have N non-negative integers: A_1, A_2, ..., A_N.\n\nConsider painting at least one and at most N-1 integers among them in red, and painting the rest in blue.\n\nLet the beauty of the painting be the \\mbox{XOR} of the integers painted in red, plus the \\mbox{XOR} of the integers painted in blue.\n\nFind the maximum possible beauty of the painting.\n\nWhat is \\mbox{XOR}?\n\nThe bitwise \\mbox{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\nWhen 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\n2 \\leq N \\leq 10^5\n\n0 \\leq A_i < 2^{60}\\ (1 \\leq 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 maximum possible beauty of the painting.\n\nSample Input 1\n\n3\n3 6 5\n\nSample Output 1\n\n12\n\nIf we paint 3, 6, 5 in blue, red, blue, respectively, the beauty will be (6) + (3 \\oplus 5) = 12.\n\nThere is no way to paint the integers resulting in greater beauty than 12, so the answer is 12.\n\nSample Input 2\n\n4\n23 36 66 65\n\nSample Output 2\n\n188\n\nSample Input 3\n\n20\n1008288677408720767 539403903321871999 1044301017184589821 215886900497862655 504277496111605629 972104334925272829 792625803473366909 972333547668684797 467386965442856573 755861732751878143 1151846447448561405 467257771752201853 683930041385277311 432010719984459389 319104378117934975 611451291444233983 647509226592964607 251832107792119421 827811265410084479 864032478037725181\n\nSample Output 3\n\n2012721721873704572\n\nA_i and the answer may not fit into a 32-bit integer type.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1704, "cpu_time_ms": 2111, "memory_kb": 213652}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s370652512", "group_id": "codeNet:p02915", "input_text": "N = parse(Int,readline())\nprint(N*N*N)", "language": "Julia", "metadata": {"date": 1567995490, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02915.html", "problem_id": "p02915", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02915/input.txt", "sample_output_relpath": "derived/input_output/data/p02915/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02915/Julia/s370652512.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s370652512", "user_id": "u894839777"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "N = parse(Int,readline())\nprint(N*N*N)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi is going to set a 3-character password.\n\nHow many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?\n\nConstraints\n\n1 \\leq N \\leq 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 possible passwords.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n8\n\nThere are eight possible passwords: 111, 112, 121, 122, 211, 212, 221, and 222.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nThere is only one possible password if you can only use one kind of character.", "sample_input": "2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p02915", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi is going to set a 3-character password.\n\nHow many possible passwords are there if each of its characters must be a digit between 1 and N (inclusive)?\n\nConstraints\n\n1 \\leq N \\leq 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 possible passwords.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n8\n\nThere are eight possible passwords: 111, 112, 121, 122, 211, 212, 221, and 222.\n\nSample Input 2\n\n1\n\nSample Output 2\n\n1\n\nThere is only one possible password if you can only use one kind of character.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 38, "cpu_time_ms": 709, "memory_kb": 162780}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s676785987", "group_id": "codeNet:p02916", "input_text": "n=parse(Int,readline())\na,b,c=[(x->parse(Int,x)).(split(i)) for i in readlines()]\nans=sum([b...,[c[a[i]] for i=1:n-1 if a[i]+1==a[i+1]]...])\nprint(ans)", "language": "Julia", "metadata": {"date": 1588299826, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02916.html", "problem_id": "p02916", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02916/input.txt", "sample_output_relpath": "derived/input_output/data/p02916/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02916/Julia/s676785987.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s676785987", "user_id": "u443151804"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "n=parse(Int,readline())\na,b,c=[(x->parse(Int,x)).(split(i)) for i in readlines()]\nans=sum([b...,[c[a[i]] for i=1:n-1 if a[i]+1==a[i+1]]...])\nprint(ans)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \\ldots, Dish N) once.\n\nThe i-th dish (1 \\leq i \\leq N) he ate was Dish A_i.\n\nWhen he eats Dish i (1 \\leq i \\leq N), he gains B_i satisfaction points.\n\nAdditionally, when he eats Dish i+1 just after eating Dish i (1 \\leq i \\leq N - 1), he gains C_i more satisfaction points.\n\nFind the sum of the satisfaction points he gained.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 20\n\n1 \\leq A_i \\leq N\n\nA_1, A_2, ..., A_N are all different.\n\n1 \\leq B_i \\leq 50\n\n1 \\leq C_i \\leq 50\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\nC_1 C_2 ... C_{N-1}\n\nOutput\n\nPrint the sum of the satisfaction points Takahashi gained, as an integer.\n\nSample Input 1\n\n3\n3 1 2\n2 5 4\n3 6\n\nSample Output 1\n\n14\n\nTakahashi gained 14 satisfaction points in total, as follows:\n\nFirst, he ate Dish 3 and gained 4 satisfaction points.\n\nNext, he ate Dish 1 and gained 2 satisfaction points.\n\nLastly, he ate Dish 2 and gained 5 + 3 = 8 satisfaction points.\n\nSample Input 2\n\n4\n2 3 4 1\n13 5 8 24\n45 9 15\n\nSample Output 2\n\n74\n\nSample Input 3\n\n2\n1 2\n50 50\n50\n\nSample Output 3\n\n150", "sample_input": "3\n3 1 2\n2 5 4\n3 6\n"}, "reference_outputs": ["14\n"], "source_document_id": "p02916", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi went to an all-you-can-eat buffet with N kinds of dishes and ate all of them (Dish 1, Dish 2, \\ldots, Dish N) once.\n\nThe i-th dish (1 \\leq i \\leq N) he ate was Dish A_i.\n\nWhen he eats Dish i (1 \\leq i \\leq N), he gains B_i satisfaction points.\n\nAdditionally, when he eats Dish i+1 just after eating Dish i (1 \\leq i \\leq N - 1), he gains C_i more satisfaction points.\n\nFind the sum of the satisfaction points he gained.\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 20\n\n1 \\leq A_i \\leq N\n\nA_1, A_2, ..., A_N are all different.\n\n1 \\leq B_i \\leq 50\n\n1 \\leq C_i \\leq 50\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\nC_1 C_2 ... C_{N-1}\n\nOutput\n\nPrint the sum of the satisfaction points Takahashi gained, as an integer.\n\nSample Input 1\n\n3\n3 1 2\n2 5 4\n3 6\n\nSample Output 1\n\n14\n\nTakahashi gained 14 satisfaction points in total, as follows:\n\nFirst, he ate Dish 3 and gained 4 satisfaction points.\n\nNext, he ate Dish 1 and gained 2 satisfaction points.\n\nLastly, he ate Dish 2 and gained 5 + 3 = 8 satisfaction points.\n\nSample Input 2\n\n4\n2 3 4 1\n13 5 8 24\n45 9 15\n\nSample Output 2\n\n74\n\nSample Input 3\n\n2\n1 2\n50 50\n50\n\nSample Output 3\n\n150", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1111, "memory_kb": 171232}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s785037757", "group_id": "codeNet:p02917", "input_text": "b=parse.(Int,split(readlines()[2]))\nprintln(b[1]+sum(Int[min(b[i-1],b[i]) for i=2:length(b)])+b[end])", "language": "Julia", "metadata": {"date": 1601382329, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s785037757.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s785037757", "user_id": "u443151804"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "b=parse.(Int,split(readlines()[2]))\nprintln(b[1]+sum(Int[min(b[i-1],b[i]) for i=2:length(b)])+b[end])", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 328, "memory_kb": 181456}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s874923044", "group_id": "codeNet:p02917", "input_text": "N=parse(readline())\nB=parse.(split(readline()))\nA=[]\npush!(A,B[1])\nfor i in 1:N-2\n push!(A,min(B[i],B[i+1]))\nend\npush!(A,B[N-1])\nprintln(sum(A))", "language": "Julia", "metadata": {"date": 1567906718, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s874923044.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s874923044", "user_id": "u879294842"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "N=parse(readline())\nB=parse.(split(readline()))\nA=[]\npush!(A,B[1])\nfor i in 1:N-2\n push!(A,min(B[i],B[i+1]))\nend\npush!(A,B[N-1])\nprintln(sum(A))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 145, "cpu_time_ms": 1295, "memory_kb": 176184}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s253124286", "group_id": "codeNet:p02918", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n,k = readline() |> split |> parseArray\n s = readline() |> strip |> collect\n\n ans=0\n n>1&&s[1]=='R'&&s[2]=='R' && (ans+=1)\n for i in 2:n-1\n s[i]=='R'&&s[i+1]=='R' && (ans+=1)\n s[i]=='L'&&s[i-1]=='L' && (ans+=1)\n end\n n>1&&s[end-1]=='L'&&s[end]=='L' && (ans+=1)\n\n ans=min(ans+2k, n-1)\n\n println(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1568520680, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s253124286.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s253124286", "user_id": "u630185395"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n,k = readline() |> split |> parseArray\n s = readline() |> strip |> collect\n\n ans=0\n n>1&&s[1]=='R'&&s[2]=='R' && (ans+=1)\n for i in 2:n-1\n s[i]=='R'&&s[i+1]=='R' && (ans+=1)\n s[i]=='L'&&s[i-1]=='L' && (ans+=1)\n end\n n>1&&s[end-1]=='L'&&s[end]=='L' && (ans+=1)\n\n ans=min(ans+2k, n-1)\n\n println(ans)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 434, "cpu_time_ms": 809, "memory_kb": 165760}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s667422311", "group_id": "codeNet:p02919", "input_text": "const N=parse(Int,readline())\nconst P=map(x->parse(Int,x),split(readline()))\nconst A=zeros(Int,N)\nconst B=zeros(Int,N)\nconst Ta=zeros(Int,17,N)\nfunction init()\n\tB[1]=1\n\tfor i=1:N\n\t\tA[P[i]]=i\n\t\tif i>1\n\t\t\tB[i]=B[i>>1]+1\n\t\tend\n\t\tTa[1,i]=P[i]\n\tend\n\tfor k=2:16\n\t\tL=1<<(k-2)\n\t\tfor i=1:N-L+1\n\t\t\tTa[k,i]=Ta[k-1,i]\n\t\t\tif i+L+L<=N+1&&Ta[k,i]=R\n\t\treturn 0\n\tend\n\tb=B[R-L]\n\tX=max(Ta[b,L],Ta[b,R-(1<<(b-1))])\n\tX\nend\ninit()\nfunction main()\n\tans=0\n\tfor i=N-1:-1:1\n\t\tid=A[i]\n\t\tL1L=0\n\t\tL1R=id\n\t\tif query(1,id)1\n\t\t\tL1M=div(L1R+L1L,2)\n\t\t\tif query(L1M,id)>i\n\t\t\t\tL1L=L1M\n\t\t\telse\n\t\t\t\tL1R=L1M\n\t\t\tend\n\t\tend\n\t\tL1=id-L1L\n\t\tL2L=0\n\t\tL2R=L1L\n\t\twhile L2R-L2L>1\n\t\t\tL2M=div(L2R+L2L,2)\n\t\t\tif query(L2M,L1L)>i\n\t\t\t\tL2L=L2M\n\t\t\telse\n\t\t\t\tL2R=L2M\n\t\t\tend\n\t\tend\n\t\tL2=L1L-L2L\n\t\tR1L=id+1\n\t\tR1R=N+1\n\t\tif query(id,N+1)==i\n\t\t\tR1L=N+1\n\t\tend\n\t\twhile R1R-R1L>1\n\t\t\tR1M=div(R1R+R1L,2)\n\t\t\tif query(id,R1M)>i\n\t\t\t\tR1R=R1M\n\t\t\telse\n\t\t\t\tR1L=R1M\n\t\t\tend\n\t\tend\n\t\tR1=R1L-id\n\t\tR2L=R1R\n\t\tR2R=N+1\n\t\tif query(R1R,N+1)1\n\t\t\tR2M=div(R2R+R2L,2)\n\t\t\tif query(R1R,R2M)>i\n\t\t\t\tR2R=R2M\n\t\t\telse\n\t\t\t\tR2L=R2M\n\t\t\tend\n\t\tend\n\t\tR2=R2L-R1L\n\t\tans+=i*(L1*R2+R1*L2)\n\tend\n\tprintln(ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1567893102, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02919.html", "problem_id": "p02919", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02919/input.txt", "sample_output_relpath": "derived/input_output/data/p02919/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02919/Julia/s667422311.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s667422311", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "const N=parse(Int,readline())\nconst P=map(x->parse(Int,x),split(readline()))\nconst A=zeros(Int,N)\nconst B=zeros(Int,N)\nconst Ta=zeros(Int,17,N)\nfunction init()\n\tB[1]=1\n\tfor i=1:N\n\t\tA[P[i]]=i\n\t\tif i>1\n\t\t\tB[i]=B[i>>1]+1\n\t\tend\n\t\tTa[1,i]=P[i]\n\tend\n\tfor k=2:16\n\t\tL=1<<(k-2)\n\t\tfor i=1:N-L+1\n\t\t\tTa[k,i]=Ta[k-1,i]\n\t\t\tif i+L+L<=N+1&&Ta[k,i]=R\n\t\treturn 0\n\tend\n\tb=B[R-L]\n\tX=max(Ta[b,L],Ta[b,R-(1<<(b-1))])\n\tX\nend\ninit()\nfunction main()\n\tans=0\n\tfor i=N-1:-1:1\n\t\tid=A[i]\n\t\tL1L=0\n\t\tL1R=id\n\t\tif query(1,id)1\n\t\t\tL1M=div(L1R+L1L,2)\n\t\t\tif query(L1M,id)>i\n\t\t\t\tL1L=L1M\n\t\t\telse\n\t\t\t\tL1R=L1M\n\t\t\tend\n\t\tend\n\t\tL1=id-L1L\n\t\tL2L=0\n\t\tL2R=L1L\n\t\twhile L2R-L2L>1\n\t\t\tL2M=div(L2R+L2L,2)\n\t\t\tif query(L2M,L1L)>i\n\t\t\t\tL2L=L2M\n\t\t\telse\n\t\t\t\tL2R=L2M\n\t\t\tend\n\t\tend\n\t\tL2=L1L-L2L\n\t\tR1L=id+1\n\t\tR1R=N+1\n\t\tif query(id,N+1)==i\n\t\t\tR1L=N+1\n\t\tend\n\t\twhile R1R-R1L>1\n\t\t\tR1M=div(R1R+R1L,2)\n\t\t\tif query(id,R1M)>i\n\t\t\t\tR1R=R1M\n\t\t\telse\n\t\t\t\tR1L=R1M\n\t\t\tend\n\t\tend\n\t\tR1=R1L-id\n\t\tR2L=R1R\n\t\tR2R=N+1\n\t\tif query(R1R,N+1)1\n\t\t\tR2M=div(R2R+R2L,2)\n\t\t\tif query(R1R,R2M)>i\n\t\t\t\tR2R=R2M\n\t\t\telse\n\t\t\t\tR2L=R2M\n\t\t\tend\n\t\tend\n\t\tR2=R2L-R1L\n\t\tans+=i*(L1*R2+R1*L2)\n\tend\n\tprintln(ans)\nend\nmain()\n", "problem_context": "Score: 500 points\n\nProblem Statement\n\nGiven is a permutation P of \\{1, 2, \\ldots, N\\}.\n\nFor a pair (L, R) (1 \\le L \\lt R \\le N), let X_{L, R} be the second largest value among P_L, P_{L+1}, \\ldots, P_R.\n\nFind \\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L+1}^{N} X_{L,R}.\n\nConstraints\n\n2 \\le N \\le 10^5\n\n1 \\le P_i \\le N\n\nP_i \\neq P_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\nP_1 P_2 \\ldots P_N\n\nOutput\n\nPrint \\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L+1}^{N} X_{L,R}.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n5\n\nX_{1, 2} = 2, X_{1, 3} = 2, and X_{2, 3} = 1, so the sum is 2 + 2 + 1 = 5.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n30\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n136", "sample_input": "3\n2 3 1\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02919", "source_text": "Score: 500 points\n\nProblem Statement\n\nGiven is a permutation P of \\{1, 2, \\ldots, N\\}.\n\nFor a pair (L, R) (1 \\le L \\lt R \\le N), let X_{L, R} be the second largest value among P_L, P_{L+1}, \\ldots, P_R.\n\nFind \\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L+1}^{N} X_{L,R}.\n\nConstraints\n\n2 \\le N \\le 10^5\n\n1 \\le P_i \\le N\n\nP_i \\neq P_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\nP_1 P_2 \\ldots P_N\n\nOutput\n\nPrint \\displaystyle \\sum_{L=1}^{N-1} \\sum_{R=L+1}^{N} X_{L,R}.\n\nSample Input 1\n\n3\n2 3 1\n\nSample Output 1\n\n5\n\nX_{1, 2} = 2, X_{1, 3} = 2, and X_{2, 3} = 1, so the sum is 2 + 2 + 1 = 5.\n\nSample Input 2\n\n5\n1 2 3 4 5\n\nSample Output 2\n\n30\n\nSample Input 3\n\n8\n8 2 7 3 4 5 6 1\n\nSample Output 3\n\n136", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1264, "cpu_time_ms": 805, "memory_kb": 167632}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s586487867", "group_id": "codeNet:p02920", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction heap(a::Array{Int,1})\n\th = [a[1]]\n\tfor i in 2:length(a)\n\t\thpush(h,a[i])\n\tend\n\th\nend\n\nfunction hpush(h::Array{Int,1},x)\n\tpush!(h,x)\n\tl = length(h)\n\tif l>1\n\t\tk = div(l,2)\n\t\twhile h[k]=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Int,1})\n\tx = h[1]\n\tz = pop!(h)\n\tif length(h)>0\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k]<=z&&h[2*k+1]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k] parseInt\n\ts = readline() |> split |> parseMap\n\ts = sort(s,rev=true)\n\to = Int[n]\n\tfor i in 0:n-1\n\t\tfor j in 1:2^i\n\t\t\tpush!(o,n-1-i)\n\t\tend\n\tend\n\th = Int[s[1] for i in 1:n]\n\tf = 0\n\tfor i in 2:2^n\n\t\ta = hpop(h)\n\t\tif s[i]>=a\n\t\t\tf = 1\n\t\t\tbreak\n\t\telse\n\t\t\tfor j in 1:o[i]\n\t\t\t\thpush(h,s[i])\n\t\t\tend\n\t\tend\n\tend\n\tprintln(f==0?\"Yes\":\"No\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1571553882, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02920.html", "problem_id": "p02920", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02920/input.txt", "sample_output_relpath": "derived/input_output/data/p02920/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02920/Julia/s586487867.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s586487867", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction heap(a::Array{Int,1})\n\th = [a[1]]\n\tfor i in 2:length(a)\n\t\thpush(h,a[i])\n\tend\n\th\nend\n\nfunction hpush(h::Array{Int,1},x)\n\tpush!(h,x)\n\tl = length(h)\n\tif l>1\n\t\tk = div(l,2)\n\t\twhile h[k]=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Int,1})\n\tx = h[1]\n\tz = pop!(h)\n\tif length(h)>0\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k]<=z&&h[2*k+1]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k] parseInt\n\ts = readline() |> split |> parseMap\n\ts = sort(s,rev=true)\n\to = Int[n]\n\tfor i in 0:n-1\n\t\tfor j in 1:2^i\n\t\t\tpush!(o,n-1-i)\n\t\tend\n\tend\n\th = Int[s[1] for i in 1:n]\n\tf = 0\n\tfor i in 2:2^n\n\t\ta = hpop(h)\n\t\tif s[i]>=a\n\t\t\tf = 1\n\t\t\tbreak\n\t\telse\n\t\t\tfor j in 1:o[i]\n\t\t\t\thpush(h,s[i])\n\t\t\tend\n\t\tend\n\tend\n\tprintln(f==0?\"Yes\":\"No\")\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have one slime.\n\nYou can set the health of this slime to any integer value of your choice.\n\nA slime reproduces every second by spawning another slime that has strictly less health. You can freely choose the health of each new slime. The first reproduction of our slime will happen in one second.\n\nDetermine if it is possible to set the healths of our first slime and the subsequent slimes spawn so that the multiset of the healths of the 2^N slimes that will exist in N seconds equals a multiset S.\n\nHere S is a multiset containing 2^N (possibly duplicated) integers: S_1,~S_2,~...,~S_{2^N}.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 18\n\n1 \\leq S_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 S_2 ... S_{2^N}\n\nOutput\n\nIf it is possible to set the healths of the first slime and the subsequent slimes spawn so that the multiset of the healths of the 2^N slimes that will exist in N seconds equals S, print Yes; otherwise, print No.\n\nSample Input 1\n\n2\n4 2 3 1\n\nSample Output 1\n\nYes\n\nWe will show one way to make the multiset of the healths of the slimes that will exist in 2 seconds equal to S.\n\nFirst, set the health of the first slime to 4.\n\nBy letting the first slime spawn a slime whose health is 3, the healths of the slimes that exist in 1 second can be 4,~3.\n\nThen, by letting the first slime spawn a slime whose health is 2, and letting the second slime spawn a slime whose health is 1, the healths of the slimes that exist in 2 seconds can be 4,~3,~2,~1, which is equal to S as multisets.\n\nSample Input 2\n\n2\n1 2 3 1\n\nSample Output 2\n\nYes\n\nS may contain multiple instances of the same integer.\n\nSample Input 3\n\n1\n1 1\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n5\n4 3 5 3 1 2 7 8 7 4 6 3 7 2 3 6 2 7 3 2 6 7 3 4 6 7 3 4 2 5 2 3\n\nSample Output 4\n\nNo", "sample_input": "2\n4 2 3 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02920", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have one slime.\n\nYou can set the health of this slime to any integer value of your choice.\n\nA slime reproduces every second by spawning another slime that has strictly less health. You can freely choose the health of each new slime. The first reproduction of our slime will happen in one second.\n\nDetermine if it is possible to set the healths of our first slime and the subsequent slimes spawn so that the multiset of the healths of the 2^N slimes that will exist in N seconds equals a multiset S.\n\nHere S is a multiset containing 2^N (possibly duplicated) integers: S_1,~S_2,~...,~S_{2^N}.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 18\n\n1 \\leq S_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 S_2 ... S_{2^N}\n\nOutput\n\nIf it is possible to set the healths of the first slime and the subsequent slimes spawn so that the multiset of the healths of the 2^N slimes that will exist in N seconds equals S, print Yes; otherwise, print No.\n\nSample Input 1\n\n2\n4 2 3 1\n\nSample Output 1\n\nYes\n\nWe will show one way to make the multiset of the healths of the slimes that will exist in 2 seconds equal to S.\n\nFirst, set the health of the first slime to 4.\n\nBy letting the first slime spawn a slime whose health is 3, the healths of the slimes that exist in 1 second can be 4,~3.\n\nThen, by letting the first slime spawn a slime whose health is 2, and letting the second slime spawn a slime whose health is 1, the healths of the slimes that exist in 2 seconds can be 4,~3,~2,~1, which is equal to S as multisets.\n\nSample Input 2\n\n2\n1 2 3 1\n\nSample Output 2\n\nYes\n\nS may contain multiple instances of the same integer.\n\nSample Input 3\n\n1\n1 1\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n5\n4 3 5 3 1 2 7 8 7 4 6 3 7 2 3 6 2 7 3 2 6 7 3 4 6 7 3 4 2 5 2 3\n\nSample Output 4\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1198, "cpu_time_ms": 616, "memory_kb": 139072}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s703769200", "group_id": "codeNet:p02920", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction heap(a::Array{Int,1})\n\th = [a[1]]\n\tfor i in 2:length(a)\n\t\thpush(h,a[i])\n\tend\n\th\nend\n\nfunction hpush(h::Array{Int,1},x)\n\tpush!(h,x)\n\tl = length(h)\n\tif l>1\n\t\tk = div(l,2)\n\t\twhile h[k]=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(div(k,2),1)\n\t\t\tl = div(l,2)\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Int,1})\n\tx = h[1]\n\tz = pop!(h)\n\tif length(h)>0\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k]<=z&&h[2*k+1]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k] parseInt\n\ts = readline() |> split |> parseMap\n\ts = sort(s,rev=true)\n\to = Int[n]\n\tfor r in 0:n-1\n\t\tfor times in 1:2^r\n\t\t\tpush!(o,n-1-r)\n\t\tend\n\tend\n\th = Int[s[1] for i in 1:n]\n\tf = 0\n\tfor i in 2:2^n\n\t\ta = hpop(h)\n\t\tif s[i]>=a\n\t\t\tf = 1\n\t\t\tbreak\n\t\telse\n\t\t\tfor j in 1:o[i]\n\t\t\t\thpush(h,s[i])\n\t\t\tend\n\t\tend\n\tend\n\tprintln(f==0?\"Yes\":\"No\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1571553391, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02920.html", "problem_id": "p02920", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02920/input.txt", "sample_output_relpath": "derived/input_output/data/p02920/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02920/Julia/s703769200.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s703769200", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction heap(a::Array{Int,1})\n\th = [a[1]]\n\tfor i in 2:length(a)\n\t\thpush(h,a[i])\n\tend\n\th\nend\n\nfunction hpush(h::Array{Int,1},x)\n\tpush!(h,x)\n\tl = length(h)\n\tif l>1\n\t\tk = div(l,2)\n\t\twhile h[k]=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(div(k,2),1)\n\t\t\tl = div(l,2)\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Int,1})\n\tx = h[1]\n\tz = pop!(h)\n\tif length(h)>0\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k]<=z&&h[2*k+1]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k] parseInt\n\ts = readline() |> split |> parseMap\n\ts = sort(s,rev=true)\n\to = Int[n]\n\tfor r in 0:n-1\n\t\tfor times in 1:2^r\n\t\t\tpush!(o,n-1-r)\n\t\tend\n\tend\n\th = Int[s[1] for i in 1:n]\n\tf = 0\n\tfor i in 2:2^n\n\t\ta = hpop(h)\n\t\tif s[i]>=a\n\t\t\tf = 1\n\t\t\tbreak\n\t\telse\n\t\t\tfor j in 1:o[i]\n\t\t\t\thpush(h,s[i])\n\t\t\tend\n\t\tend\n\tend\n\tprintln(f==0?\"Yes\":\"No\")\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have one slime.\n\nYou can set the health of this slime to any integer value of your choice.\n\nA slime reproduces every second by spawning another slime that has strictly less health. You can freely choose the health of each new slime. The first reproduction of our slime will happen in one second.\n\nDetermine if it is possible to set the healths of our first slime and the subsequent slimes spawn so that the multiset of the healths of the 2^N slimes that will exist in N seconds equals a multiset S.\n\nHere S is a multiset containing 2^N (possibly duplicated) integers: S_1,~S_2,~...,~S_{2^N}.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 18\n\n1 \\leq S_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 S_2 ... S_{2^N}\n\nOutput\n\nIf it is possible to set the healths of the first slime and the subsequent slimes spawn so that the multiset of the healths of the 2^N slimes that will exist in N seconds equals S, print Yes; otherwise, print No.\n\nSample Input 1\n\n2\n4 2 3 1\n\nSample Output 1\n\nYes\n\nWe will show one way to make the multiset of the healths of the slimes that will exist in 2 seconds equal to S.\n\nFirst, set the health of the first slime to 4.\n\nBy letting the first slime spawn a slime whose health is 3, the healths of the slimes that exist in 1 second can be 4,~3.\n\nThen, by letting the first slime spawn a slime whose health is 2, and letting the second slime spawn a slime whose health is 1, the healths of the slimes that exist in 2 seconds can be 4,~3,~2,~1, which is equal to S as multisets.\n\nSample Input 2\n\n2\n1 2 3 1\n\nSample Output 2\n\nYes\n\nS may contain multiple instances of the same integer.\n\nSample Input 3\n\n1\n1 1\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n5\n4 3 5 3 1 2 7 8 7 4 6 3 7 2 3 6 2 7 3 2 6 7 3 4 6 7 3 4 2 5 2 3\n\nSample Output 4\n\nNo", "sample_input": "2\n4 2 3 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p02920", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have one slime.\n\nYou can set the health of this slime to any integer value of your choice.\n\nA slime reproduces every second by spawning another slime that has strictly less health. You can freely choose the health of each new slime. The first reproduction of our slime will happen in one second.\n\nDetermine if it is possible to set the healths of our first slime and the subsequent slimes spawn so that the multiset of the healths of the 2^N slimes that will exist in N seconds equals a multiset S.\n\nHere S is a multiset containing 2^N (possibly duplicated) integers: S_1,~S_2,~...,~S_{2^N}.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 18\n\n1 \\leq S_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 S_2 ... S_{2^N}\n\nOutput\n\nIf it is possible to set the healths of the first slime and the subsequent slimes spawn so that the multiset of the healths of the 2^N slimes that will exist in N seconds equals S, print Yes; otherwise, print No.\n\nSample Input 1\n\n2\n4 2 3 1\n\nSample Output 1\n\nYes\n\nWe will show one way to make the multiset of the healths of the slimes that will exist in 2 seconds equal to S.\n\nFirst, set the health of the first slime to 4.\n\nBy letting the first slime spawn a slime whose health is 3, the healths of the slimes that exist in 1 second can be 4,~3.\n\nThen, by letting the first slime spawn a slime whose health is 2, and letting the second slime spawn a slime whose health is 1, the healths of the slimes that exist in 2 seconds can be 4,~3,~2,~1, which is equal to S as multisets.\n\nSample Input 2\n\n2\n1 2 3 1\n\nSample Output 2\n\nYes\n\nS may contain multiple instances of the same integer.\n\nSample Input 3\n\n1\n1 1\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n5\n4 3 5 3 1 2 7 8 7 4 6 3 7 2 3 6 2 7 3 2 6 7 3 4 6 7 3 4 2 5 2 3\n\nSample Output 4\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1210, "cpu_time_ms": 625, "memory_kb": 139032}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s776550752", "group_id": "codeNet:p02921", "input_text": "a,b=readlines()\nc=0\nfor i=1:3\n c += ifelse(a[i]==b[i],1,0)\nend\nprintln(c)", "language": "Julia", "metadata": {"date": 1573068005, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s776550752.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s776550752", "user_id": "u179539980"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a,b=readlines()\nc=0\nfor i=1:3\n c += ifelse(a[i]==b[i],1,0)\nend\nprintln(c)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 74, "cpu_time_ms": 358, "memory_kb": 110216}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s054512943", "group_id": "codeNet:p02921", "input_text": "function test()\n w = Dict(\"Sunny\"=>\"Cloudy\", \"Cloudy\"=>\"Rainy\", \"Rainy\"=>\"Sunny\")\n s = readline()\n println(w[s])\nend\n\ntest()", "language": "Julia", "metadata": {"date": 1570552358, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s054512943.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s054512943", "user_id": "u821989875"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function test()\n w = Dict(\"Sunny\"=>\"Cloudy\", \"Cloudy\"=>\"Rainy\", \"Rainy\"=>\"Sunny\")\n s = readline()\n println(w[s])\nend\n\ntest()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 726, "memory_kb": 140032}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s090923539", "group_id": "codeNet:p02922", "input_text": "A, B = parse.(split(readline()))\nup = A - 1\nwant = B - 1\nprintln(Int(cld(want, up)))\n \n", "language": "Julia", "metadata": {"date": 1578855781, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s090923539.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s090923539", "user_id": "u879294842"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "A, B = parse.(split(readline()))\nup = A - 1\nwant = B - 1\nprintln(Int(cld(want, up)))\n \n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 87, "cpu_time_ms": 570, "memory_kb": 121592}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s377532861", "group_id": "codeNet:p02922", "input_text": "parseInt(x) = parse(Int,x)\n\nfunction main()\n A,B = map(parseInt,split(readline()))\n if A < B\n r = div(B-A,A-1)\n rem(B-A,A-1) == 0 ? c=r+1 : c=r+2\n else\n c = 1\n end\n println(c)\nend\n\nmain()\n\n", "language": "Julia", "metadata": {"date": 1567368303, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s377532861.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s377532861", "user_id": "u709180765"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nfunction main()\n A,B = map(parseInt,split(readline()))\n if A < B\n r = div(B-A,A-1)\n rem(B-A,A-1) == 0 ? c=r+1 : c=r+2\n else\n c = 1\n end\n println(c)\nend\n\nmain()\n\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 352, "memory_kb": 109848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s435371597", "group_id": "codeNet:p02922", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ta,b = readline() |> split |> parseMap\n\tk = 0\n\tnow = 1\n\twhile now split |> parseMap\n\tk = 0\n\tnow = 1\n\twhile now= h[i+1]\n\t s += 1\n\t else\n\t ans = max(ans, s)\n\t s = 0\n\t end\n\tend\n\tprint(max(ans, s))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1567366503, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s357886777.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s357886777", "user_id": "u792064825"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n\tn = parse(readline())\n\th = map(parse, split(readline()))\n\ts = 0\n\tans = 0\n\tfor i = 1:n-1\n\t if h[i] >= h[i+1]\n\t s += 1\n\t else\n\t ans = max(ans, s)\n\t s = 0\n\t end\n\tend\n\tprint(max(ans, s))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2111, "memory_kb": 165176}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s649691221", "group_id": "codeNet:p02924", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tprintln(div(n*(n-1),2))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1567365615, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s649691221.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s649691221", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tprintln(div(n*(n-1),2))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 794, "memory_kb": 168580}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s564816708", "group_id": "codeNet:p02925", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = zeros(Int,n,n-1)\n\tfor i in 1:n\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tnow = ones(Int,n)\n\tfin = 0\n\tf = 0\n\tk = 0\n\tnxt = Int[i for i in 1:n]\n\twhile fin parseInt\n\ta = zeros(Int,n,n-1)\n\tfor i in 1:n\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tnow = ones(Int,n)\n\tfin = 0\n\tf = 0\n\tk = 0\n\tnxt = Int[i for i in 1:n]\n\twhile fin parseInt\n\ta = zeros(Int,n,n-1)\n\tfor i in 1:n\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tnow = ones(Int,n)\n\tfin = 0\n\tf = 0\n\tk = 0\n\twhile fin parseInt\n\ta = zeros(Int,n,n-1)\n\tfor i in 1:n\n\t\ta[i,:] = readline() |> split |> parseMap\n\tend\n\tnow = ones(Int,n)\n\tfin = 0\n\tf = 0\n\tk = 0\n\twhile fin parseInt\n\ta = [Array{Int,1}(n-1) for i in 1:n]\n\tfor i in 1:n\n\t\ta[i] = readline() |> split |> parseMap\n\tend\n\tf = 0\n\tk = 0\n\tl = (n-1)*n\n\tb = Set{Int}(Int[i for i in 1:n])\n\twhile l>0\n\t\tt = 0\n\t\tc = Set{Int}(Int[])\n\t\tfor i in b\n\t\t\tif !isempty(a[i])\n\t\t\t\tj = a[i][1]\n\t\t\t\tif !isempty(a[j])\n\t\t\t\t\tif a[j][1] == i\n\t\t\t\t\t\tpush!(c,i)\n\t\t\t\t\t\tpush!(c,j)\n\t\t\t\t\t\tt += 1\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tf = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tl -= length(c)\n\t\tif t>0\n\t\t\tk += 1\n\t\t\tfor i in c\n\t\t\t\tif !isempty(a[i])\n\t\t\t\t\tshift!(a[i])\n\t\t\t\tend\n\t\t\tend\n\t\t\tb = copy(c)\n\t\telse\n\t\t\tf = 1\n\t\tend\n\t\tif f == 1\n\t\t\tbreak\n\t\tend\n\tend\n\tprintln(f==0?k:-1)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1572334179, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s692778569.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s692778569", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = [Array{Int,1}(n-1) for i in 1:n]\n\tfor i in 1:n\n\t\ta[i] = readline() |> split |> parseMap\n\tend\n\tf = 0\n\tk = 0\n\tl = (n-1)*n\n\tb = Set{Int}(Int[i for i in 1:n])\n\twhile l>0\n\t\tt = 0\n\t\tc = Set{Int}(Int[])\n\t\tfor i in b\n\t\t\tif !isempty(a[i])\n\t\t\t\tj = a[i][1]\n\t\t\t\tif !isempty(a[j])\n\t\t\t\t\tif a[j][1] == i\n\t\t\t\t\t\tpush!(c,i)\n\t\t\t\t\t\tpush!(c,j)\n\t\t\t\t\t\tt += 1\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tf = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tl -= length(c)\n\t\tif t>0\n\t\t\tk += 1\n\t\t\tfor i in c\n\t\t\t\tif !isempty(a[i])\n\t\t\t\t\tshift!(a[i])\n\t\t\t\tend\n\t\t\tend\n\t\t\tb = copy(c)\n\t\telse\n\t\t\tf = 1\n\t\tend\n\t\tif f == 1\n\t\t\tbreak\n\t\tend\n\tend\n\tprintln(f==0?k:-1)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 728, "cpu_time_ms": 2113, "memory_kb": 164400}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s562068128", "group_id": "codeNet:p02926", "input_text": "n = parse(Int64, strip(readline()))\npoints = Complex[]\nfor i in 1:n\n a,b = map(x->parse(Int64, x), split(readline()))\n push!(points, a + b*1im)\nend\nsort!(points, by=angle)\npoints = vcat(points, points)\n\nlim = 0\nloc = 0+0im\nbest = 0\nfor i in 1:n\n if i != 1\n loc -= points[i-1]\n end\n while lim < i + n - 1 && abs2(loc) <= abs2(loc + points[lim+1])\n lim += 1\n loc += points[lim]\n end\n if best < abs2(loc)\n best = abs2(loc)\n end\nend\nprintln(sqrt(best))", "language": "Julia", "metadata": {"date": 1567387027, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s562068128.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s562068128", "user_id": "u419818973"}, "prompt_components": {"gold_output": "10.000000000000000000000000000000000000000000000000\n", "input_to_evaluate": "n = parse(Int64, strip(readline()))\npoints = Complex[]\nfor i in 1:n\n a,b = map(x->parse(Int64, x), split(readline()))\n push!(points, a + b*1im)\nend\nsort!(points, by=angle)\npoints = vcat(points, points)\n\nlim = 0\nloc = 0+0im\nbest = 0\nfor i in 1:n\n if i != 1\n loc -= points[i-1]\n end\n while lim < i + n - 1 && abs2(loc) <= abs2(loc + points[lim+1])\n lim += 1\n loc += points[lim]\n end\n if best < abs2(loc)\n best = abs2(loc)\n end\nend\nprintln(sqrt(best))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1034, "memory_kb": 171700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s346591008", "group_id": "codeNet:p02926", "input_text": "const B=700\nfunction f(X,Y,x,y)\n\tz=x[:]\n\tw=y[:]\n\tfor i=1:B\n\t\ttx=X+x[i]\n\t\tty=Y+y[i]\n\t\ttheta=atan2(ty,tx)\n\t\tif ty<0\n\t\t\ttheta+=2*pi\n\t\tend\n\t\tid=floor(Int,theta*B/(2*pi))+1\n\t\tif hypot(z[id],w[id])parse(Int,x),split(readline()))\n\t\tif X!=0||Y!=0\n\t\t\tx,y=f(X,Y,x,y)\n\t\tend\n\tend\n\tans=0\n\tfor i=1:B\n\t\tans=max(ans,hypot(x[i],y[i]))\n\tend\n\tprintln(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1567369289, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s346591008.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s346591008", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10.000000000000000000000000000000000000000000000000\n", "input_to_evaluate": "const B=700\nfunction f(X,Y,x,y)\n\tz=x[:]\n\tw=y[:]\n\tfor i=1:B\n\t\ttx=X+x[i]\n\t\tty=Y+y[i]\n\t\ttheta=atan2(ty,tx)\n\t\tif ty<0\n\t\t\ttheta+=2*pi\n\t\tend\n\t\tid=floor(Int,theta*B/(2*pi))+1\n\t\tif hypot(z[id],w[id])parse(Int,x),split(readline()))\n\t\tif X!=0||Y!=0\n\t\t\tx,y=f(X,Y,x,y)\n\t\tend\n\tend\n\tans=0\n\tfor i=1:B\n\t\tans=max(ans,hypot(x[i],y[i]))\n\tend\n\tprintln(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 502, "cpu_time_ms": 454, "memory_kb": 114996}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s928445959", "group_id": "codeNet:p02926", "input_text": "const B=600\nfunction f(X,Y,x,y)\n\tz=x[:]\n\tw=y[:]\n\tfor i=1:B\n\t\ttx=X+x[i]\n\t\tty=Y+y[i]\n\t\ttheta=atan2(ty,tx)\n\t\tif ty<0\n\t\t\ttheta+=2*pi\n\t\tend\n\t\tid=floor(Int,theta*B/(2*pi))+1\n\t\tif hypot(z[id],w[id])parse(Int,x),split(readline()))\n\t\tif X!=0||Y!=0\n\t\t\tx,y=f(X,Y,x,y)\n\t\tend\n\tend\n\tans=0\n\tfor i=1:B\n\t\tans=max(ans,hypot(x[i],y[i]))\n\tend\n\tprintln(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1567369262, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s928445959.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s928445959", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10.000000000000000000000000000000000000000000000000\n", "input_to_evaluate": "const B=600\nfunction f(X,Y,x,y)\n\tz=x[:]\n\tw=y[:]\n\tfor i=1:B\n\t\ttx=X+x[i]\n\t\tty=Y+y[i]\n\t\ttheta=atan2(ty,tx)\n\t\tif ty<0\n\t\t\ttheta+=2*pi\n\t\tend\n\t\tid=floor(Int,theta*B/(2*pi))+1\n\t\tif hypot(z[id],w[id])parse(Int,x),split(readline()))\n\t\tif X!=0||Y!=0\n\t\t\tx,y=f(X,Y,x,y)\n\t\tend\n\tend\n\tans=0\n\tfor i=1:B\n\t\tans=max(ans,hypot(x[i],y[i]))\n\tend\n\tprintln(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 502, "cpu_time_ms": 909, "memory_kb": 171984}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s834376705", "group_id": "codeNet:p02926", "input_text": "const B=500\nfunction f(X,Y,x,y)\n\tz=x[:]\n\tw=y[:]\n\tfor i=1:B\n\t\ttx=X+x[i]\n\t\tty=Y+y[i]\n\t\ttheta=atan2(ty,tx)\n\t\tif ty<0\n\t\t\ttheta+=2*pi\n\t\tend\n\t\tid=floor(Int,theta*B/(2*pi))+1\n\t\tif hypot(z[id],w[id])parse(Int,x),split(readline()))\n\t\tif X!=0||Y!=0\n\t\t\tx,y=f(X,Y,x,y)\n\t\tend\n\tend\n\tans=0\n\tfor i=1:B\n\t\tans=max(ans,hypot(x[i],y[i]))\n\tend\n\tprintln(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1567369180, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s834376705.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s834376705", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10.000000000000000000000000000000000000000000000000\n", "input_to_evaluate": "const B=500\nfunction f(X,Y,x,y)\n\tz=x[:]\n\tw=y[:]\n\tfor i=1:B\n\t\ttx=X+x[i]\n\t\tty=Y+y[i]\n\t\ttheta=atan2(ty,tx)\n\t\tif ty<0\n\t\t\ttheta+=2*pi\n\t\tend\n\t\tid=floor(Int,theta*B/(2*pi))+1\n\t\tif hypot(z[id],w[id])parse(Int,x),split(readline()))\n\t\tif X!=0||Y!=0\n\t\t\tx,y=f(X,Y,x,y)\n\t\tend\n\tend\n\tans=0\n\tfor i=1:B\n\t\tans=max(ans,hypot(x[i],y[i]))\n\tend\n\tprintln(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 502, "cpu_time_ms": 451, "memory_kb": 115276}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s944548125", "group_id": "codeNet:p02926", "input_text": "const B=5000\nfunction f(X,Y,x,y)\n\tz=x[:]\n\tw=y[:]\n\tfor i=1:B\n\t\ttx=X+x[i]\n\t\tty=Y+y[i]\n\t\ttheta=atan(ty,tx)\n\t\tif ty<0\n\t\t\ttheta+=2*pi\n\t\tend\n\t\tid=floor(Int,theta*B/(2*pi))+1\n\t\tif hypot(z[id],w[id])parse(Int,x),split(readline()))\n\t\tif X!=0||Y!=0\n\t\t\tx,y=f(X,Y,x,y)\n\t\tend\n\tend\n\tans=0\n\tfor i=1:B\n\t\tans=max(ans,hypot(x[i],y[i]))\n\tend\n\tprintln(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1567369115, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s944548125.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s944548125", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10.000000000000000000000000000000000000000000000000\n", "input_to_evaluate": "const B=5000\nfunction f(X,Y,x,y)\n\tz=x[:]\n\tw=y[:]\n\tfor i=1:B\n\t\ttx=X+x[i]\n\t\tty=Y+y[i]\n\t\ttheta=atan(ty,tx)\n\t\tif ty<0\n\t\t\ttheta+=2*pi\n\t\tend\n\t\tid=floor(Int,theta*B/(2*pi))+1\n\t\tif hypot(z[id],w[id])parse(Int,x),split(readline()))\n\t\tif X!=0||Y!=0\n\t\t\tx,y=f(X,Y,x,y)\n\t\tend\n\tend\n\tans=0\n\tfor i=1:B\n\t\tans=max(ans,hypot(x[i],y[i]))\n\tend\n\tprintln(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 502, "cpu_time_ms": 1866, "memory_kb": 221692}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s691083875", "group_id": "codeNet:p02928", "input_text": "function main()\n\tN,K=map(x->parse(Int,x),split(readline()))\n\tA=map(x->parse(Int,x),split(readline()))\n\tans=0\n\tmod=10^9+7\n\tfor i=1:N\n\t\ta=A[i]\n\t\tcnt=0\n\t\tfor j=1:i-1\n\t\t\tif A[j]>a\n\t\t\t\tcnt+=1\n\t\t\tend\n\t\tend\n\t\tans+=cnt*K%mod\n\t\tfor j=i+1:N\n\t\t\tif A[j]>a\n\t\t\t\tcnt+=1\n\t\t\tend\n\t\tend\n\t\tans+=cnt*div(K*(K-1),2)%mod\n\tend\n\tprintln(ans%mod)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1582847683, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s691083875.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s691083875", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main()\n\tN,K=map(x->parse(Int,x),split(readline()))\n\tA=map(x->parse(Int,x),split(readline()))\n\tans=0\n\tmod=10^9+7\n\tfor i=1:N\n\t\ta=A[i]\n\t\tcnt=0\n\t\tfor j=1:i-1\n\t\t\tif A[j]>a\n\t\t\t\tcnt+=1\n\t\t\tend\n\t\tend\n\t\tans+=cnt*K%mod\n\t\tfor j=i+1:N\n\t\t\tif A[j]>a\n\t\t\t\tcnt+=1\n\t\t\tend\n\t\tend\n\t\tans+=cnt*div(K*(K-1),2)%mod\n\tend\n\tprintln(ans%mod)\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1285, "memory_kb": 168268}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s243798332", "group_id": "codeNet:p02929", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tp = 10^9+7\n\tn = readline() |> parseInt\n\ts = readline() |> chomp\n\tlr = zeros(Int,2n)\n\tlr[1] = -1\n\tf = 0\n\tbc = 1\n\twc = 0\n\tfor i in 2:2n\n\t\tif s[i]==s[i-1]\n\t\t\tlr[i]=lr[i-1]*(-1)\n\t\telse\n\t\t\tlr[i]=lr[i-1]\n\t\tend\n\t\tif s[i]=='B'\n\t\t\tbc += 1\n\t\telse\n\t\t\twc += 1\n\t\tend\n\tend\n\tans = 1\n\tlc = 0\n\trc = 0\n\tfor i in 1:2n\n\t\tif lr[i]==1\n\t\t\tans = ans*(lc-rc)%p\n\t\t\trc += 1\n\t\telse\n\t\t\tlc += 1\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tans = ans*i%p\n\tend\n\tprintln(bc==wc?ans:0)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1581839203, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s243798332.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s243798332", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tp = 10^9+7\n\tn = readline() |> parseInt\n\ts = readline() |> chomp\n\tlr = zeros(Int,2n)\n\tlr[1] = -1\n\tf = 0\n\tbc = 1\n\twc = 0\n\tfor i in 2:2n\n\t\tif s[i]==s[i-1]\n\t\t\tlr[i]=lr[i-1]*(-1)\n\t\telse\n\t\t\tlr[i]=lr[i-1]\n\t\tend\n\t\tif s[i]=='B'\n\t\t\tbc += 1\n\t\telse\n\t\t\twc += 1\n\t\tend\n\tend\n\tans = 1\n\tlc = 0\n\trc = 0\n\tfor i in 1:2n\n\t\tif lr[i]==1\n\t\t\tans = ans*(lc-rc)%p\n\t\t\trc += 1\n\t\telse\n\t\t\tlc += 1\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tans = ans*i%p\n\tend\n\tprintln(bc==wc?ans:0)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 550, "cpu_time_ms": 841, "memory_kb": 168528}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s366045843", "group_id": "codeNet:p02930", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tk = 0\n\tif n==3\n\t\tprintln(\"1 2\")\n\t\tprintln(\"1\")\n\telseif n%2 == 1\n\t\tfor i in 1:n-1\n\t\t\tfor j in i+1:n-1\n\t\t\t\tprint(2, \" \")\n\t\t\tend\n\t\t\tprintln(2)\n\t\tend\t\t\n\telse\n\t\ta = zeros(Int,n-1,n)\n\t\tfor i in 1:n-1\n\t\t\tfor j in i+1:n\n\t\t\t\tif abs(i-j)%2==0\n\t\t\t\t\ta[i,j] = 2\n\t\t\t\telse\n\t\t\t\t\ta[i,j] = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tfor i in 1:n-1\n\t\t\tfor j in i+1:n-1\n\t\t\t\tprint(a[i,j], \" \")\n\t\t\tend\n\t\t\tprintln(a[i,n])\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1566697769, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02930.html", "problem_id": "p02930", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02930/input.txt", "sample_output_relpath": "derived/input_output/data/p02930/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02930/Julia/s366045843.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s366045843", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1 2\n1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tk = 0\n\tif n==3\n\t\tprintln(\"1 2\")\n\t\tprintln(\"1\")\n\telseif n%2 == 1\n\t\tfor i in 1:n-1\n\t\t\tfor j in i+1:n-1\n\t\t\t\tprint(2, \" \")\n\t\t\tend\n\t\t\tprintln(2)\n\t\tend\t\t\n\telse\n\t\ta = zeros(Int,n-1,n)\n\t\tfor i in 1:n-1\n\t\t\tfor j in i+1:n\n\t\t\t\tif abs(i-j)%2==0\n\t\t\t\t\ta[i,j] = 2\n\t\t\t\telse\n\t\t\t\t\ta[i,j] = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tfor i in 1:n-1\n\t\t\tfor j in i+1:n-1\n\t\t\t\tprint(a[i,j], \" \")\n\t\t\tend\n\t\t\tprintln(a[i,n])\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score: 600 points\n\nProblem Statement\n\nAtCoder's head office consists of N rooms numbered 1 to N. For any two rooms, there is a direct passage connecting these rooms.\n\nFor security reasons, Takahashi the president asked you to set a level for every passage, which is a positive integer and must satisfy the following condition:\n\nFor each room i\\ (1 \\leq i \\leq N), if we leave Room i, pass through some passages whose levels are all equal and get back to Room i, the number of times we pass through a passage is always even.\n\nYour task is to set levels to the passages so that the highest level of a passage is minimized.\n\nConstraints\n\nN is an integer between 2 and 500 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint one way to set levels to the passages so that the objective is achieved, as follows:\n\na_{1,2} a_{1,3} ... a_{1,N}\na_{2,3} ... a_{2,N}\n.\n.\n.\na_{N-1,N}\n\nHere a_{i,j} is the level of the passage connecting Room i and Room j.\n\nIf there are multiple solutions, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 2\n1\n\nThe following image describes this output:\n\nFor example, if we leave Room 2, traverse the path 2 \\to 3 \\to 2 \\to 3 \\to 2 \\to 1 \\to 2 while only passing passages of level 1 and get back to Room 2, we pass through a passage six times.", "sample_input": "3\n"}, "reference_outputs": ["1 2\n1\n"], "source_document_id": "p02930", "source_text": "Score: 600 points\n\nProblem Statement\n\nAtCoder's head office consists of N rooms numbered 1 to N. For any two rooms, there is a direct passage connecting these rooms.\n\nFor security reasons, Takahashi the president asked you to set a level for every passage, which is a positive integer and must satisfy the following condition:\n\nFor each room i\\ (1 \\leq i \\leq N), if we leave Room i, pass through some passages whose levels are all equal and get back to Room i, the number of times we pass through a passage is always even.\n\nYour task is to set levels to the passages so that the highest level of a passage is minimized.\n\nConstraints\n\nN is an integer between 2 and 500 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint one way to set levels to the passages so that the objective is achieved, as follows:\n\na_{1,2} a_{1,3} ... a_{1,N}\na_{2,3} ... a_{2,N}\n.\n.\n.\na_{N-1,N}\n\nHere a_{i,j} is the level of the passage connecting Room i and Room j.\n\nIf there are multiple solutions, any of them will be accepted.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n1 2\n1\n\nThe following image describes this output:\n\nFor example, if we leave Room 2, traverse the path 2 \\to 3 \\to 2 \\to 3 \\to 2 \\to 1 \\to 2 while only passing passages of level 1 and get back to Room 2, we pass through a passage six times.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1920, "memory_kb": 131480}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s077210925", "group_id": "codeNet:p02934", "input_text": "readline()\nprintln(1/sum(1/parse(a) for a=split(readline())))", "language": "Julia", "metadata": {"date": 1567623096, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s077210925.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s077210925", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7.5\n", "input_to_evaluate": "readline()\nprintln(1/sum(1/parse(a) for a=split(readline())))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 366, "memory_kb": 110848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s931185401", "group_id": "codeNet:p02935", "input_text": "parseint(x) = parse(Int, x)\nparselist(l) = map(parseint, l)\n\navg(x, y) = (x+y)/2\n\nfunction main()\n n = readline() |> parseint\n v = readline() |> split |> parselist\n sort!(v)\n ans = v[1]\n for i = 2:n\n ans = avg(ans, v[i])\n end\n println(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1581114897, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s931185401.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s931185401", "user_id": "u541055501"}, "prompt_components": {"gold_output": "3.5\n", "input_to_evaluate": "parseint(x) = parse(Int, x)\nparselist(l) = map(parseint, l)\n\navg(x, y) = (x+y)/2\n\nfunction main()\n n = readline() |> parseint\n v = readline() |> split |> parselist\n sort!(v)\n ans = v[1]\n for i = 2:n\n ans = avg(ans, v[i])\n end\n println(ans)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 405, "memory_kb": 113148}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s529876261", "group_id": "codeNet:p02937", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m] chomp\n\ttt = readline() |> chomp\n\ts = Int[Int(ss[i])-96 for i in 1:length(ss)]\n\tt = Int[Int(tt[i])-96 for i in 1:length(tt)]\n\tn = length(s)\n\td = Dict{Int,Array{Int,1}}()\n\tdp = -ones(Int,n+1,26)\n\tfor i in 1:n\n\t\tif haskey(d,s[i])\n\t\t\tpush!(d[s[i]],i)\n\t\telse\n\t\t\td[s[i]] = Int[i]\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tpush!(d[s[i]],n+i)\n\tend\n\tfor i in 1:n\n\t\tfor j in keys(d)\n\t\t\tdp[i,j]=d[j][bsearch(d[j],i)]\n\t\tend\n\tend\n\tk = 0\n\tnow = 0\n\tfor i in 1:length(t)\n\t\tif dp[now+1,t[i]]<0\n\t\t\tk = -1\n\t\t\tbreak\n\t\telse\n\t\t\tnow = dp[now+1,t[i]]\n\t\t\tif now>=n\n\t\t\t\tk += n\n\t\t\t\tnow = now%n\n\t\t\tend\n\t\tend\n\tend\n\tprintln(k==-1?-1:k+now)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584790282, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s529876261.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s529876261", "user_id": "u095714878"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m] chomp\n\ttt = readline() |> chomp\n\ts = Int[Int(ss[i])-96 for i in 1:length(ss)]\n\tt = Int[Int(tt[i])-96 for i in 1:length(tt)]\n\tn = length(s)\n\td = Dict{Int,Array{Int,1}}()\n\tdp = -ones(Int,n+1,26)\n\tfor i in 1:n\n\t\tif haskey(d,s[i])\n\t\t\tpush!(d[s[i]],i)\n\t\telse\n\t\t\td[s[i]] = Int[i]\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tpush!(d[s[i]],n+i)\n\tend\n\tfor i in 1:n\n\t\tfor j in keys(d)\n\t\t\tdp[i,j]=d[j][bsearch(d[j],i)]\n\t\tend\n\tend\n\tk = 0\n\tnow = 0\n\tfor i in 1:length(t)\n\t\tif dp[now+1,t[i]]<0\n\t\t\tk = -1\n\t\t\tbreak\n\t\telse\n\t\t\tnow = dp[now+1,t[i]]\n\t\t\tif now>=n\n\t\t\t\tk += n\n\t\t\t\tnow = now%n\n\t\t\tend\n\t\tend\n\tend\n\tprintln(k==-1?-1:k+now)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 988, "memory_kb": 199884}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s501235600", "group_id": "codeNet:p02937", "input_text": "s=chomp(readline())\nt=chomp(readline())\nN=length(s)\nnxt=zeros(Int,N,26)\nnownxt=-ones(Int,26)\nfor i=2*N:-1:1\n\tif i<=N\n\t\tfor j=1:26\n\t\t\tnxt[i,j]=nownxt[j]\n\t\tend\n\tend\n\tnownxt[Int(s[mod1(i,N)])-96]=i-1\nend\np=-1\nans=0\nfor c=t\n\tq=0\n\tif p<0\n\t\tq=nownxt[Int(c)-96]\n\telse\n\t\tq=nxt[p+1,Int(c)-96]\n\tend\n\tif q<0\n\t\tprintln(-1)\n\t\texit()\n\tend\n\tans+=q-p\n\tp=q%N\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1567625099, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s501235600.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s501235600", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "s=chomp(readline())\nt=chomp(readline())\nN=length(s)\nnxt=zeros(Int,N,26)\nnownxt=-ones(Int,26)\nfor i=2*N:-1:1\n\tif i<=N\n\t\tfor j=1:26\n\t\t\tnxt[i,j]=nownxt[j]\n\t\tend\n\tend\n\tnownxt[Int(s[mod1(i,N)])-96]=i-1\nend\np=-1\nans=0\nfor c=t\n\tq=0\n\tif p<0\n\t\tq=nownxt[Int(c)-96]\n\telse\n\t\tq=nxt[p+1,Int(c)-96]\n\tend\n\tif q<0\n\t\tprintln(-1)\n\t\texit()\n\tend\n\tans+=q-p\n\tp=q%N\nend\nprintln(ans)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 359, "cpu_time_ms": 815, "memory_kb": 154136}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s550036931", "group_id": "codeNet:p02939", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\nfunction main()\n s=chomp(readline())\n n=length(s)\n ans=1\n pre=s[1]\n lookat=2\n while lookat<=n\n ans+=1\n if lookat==n-1 && s[end-1]==s[end]\n lookat+=2\n elseif pre==s[lookat]\n pre=s[lookat:lookat+1]\n lookat+=2\n else\n pre=s[lookat]\n lookat+=1\n end\n end\n println(ans)\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end\n", "language": "Julia", "metadata": {"date": 1595878830, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s550036931.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s550036931", "user_id": "u443151804"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\nfunction main()\n s=chomp(readline())\n n=length(s)\n ans=1\n pre=s[1]\n lookat=2\n while lookat<=n\n ans+=1\n if lookat==n-1 && s[end-1]==s[end]\n lookat+=2\n elseif pre==s[lookat]\n pre=s[lookat:lookat+1]\n lookat+=2\n else\n pre=s[lookat]\n lookat+=1\n end\n end\n println(ans)\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 455, "cpu_time_ms": 228, "memory_kb": 159996}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s573017335", "group_id": "codeNet:p02939", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=chomp(readline())\n n=length(s)\n ans=0\n before,now=\"\",\"\"\n for i in s\n now*=string(i)\n if before!=now\n before,now=now,\"\"\n ans+=1\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1586575072, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s573017335.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s573017335", "user_id": "u619197965"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=chomp(readline())\n n=length(s)\n ans=0\n before,now=\"\",\"\"\n for i in s\n now*=string(i)\n if before!=now\n before,now=now,\"\"\n ans+=1\n end\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 438, "cpu_time_ms": 911, "memory_kb": 206556}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s035231200", "group_id": "codeNet:p02939", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=split(readline(),\"\")\n i=2\n while i parse(Int,x), split(readline()))\n \n println(max(A+B,A-B,A*B))\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1580511668, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s315534838.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s315534838", "user_id": "u790457721"}, "prompt_components": {"gold_output": "-10\n", "input_to_evaluate": "vfunction main()\n \n (A,B) = map(x -> parse(Int,x), split(readline()))\n \n println(max(A+B,A-B,A*B))\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1132, "memory_kb": 195588}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s714896671", "group_id": "codeNet:p02945", "input_text": "ny=split(readline())\na=parse(Int,ny[1])\nb=parse(Int,ny[2])\n\nc=a+b\nd=a-b\ne=a*b\n\nprint(max(c,d,e))", "language": "Julia", "metadata": {"date": 1565489632, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s714896671.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s714896671", "user_id": "u563499869"}, "prompt_components": {"gold_output": "-10\n", "input_to_evaluate": "ny=split(readline())\na=parse(Int,ny[1])\nb=parse(Int,ny[2])\n\nc=a+b\nd=a-b\ne=a*b\n\nprint(max(c,d,e))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 96, "cpu_time_ms": 275, "memory_kb": 108944}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s764377063", "group_id": "codeNet:p02946", "input_text": "#=\nB:\n- Julia version: 0.5.2\n- Author: abap\n- Date: 2019-12-29\n=#\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nK,X = parseMap(split(readline()))\n\nfor i in X-(K-1):X+(K-1)\n\tprint(\"$i \")\nend\n\nprintln(\"\")", "language": "Julia", "metadata": {"date": 1577643349, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s764377063.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s764377063", "user_id": "u879294842"}, "prompt_components": {"gold_output": "5 6 7 8 9\n", "input_to_evaluate": "#=\nB:\n- Julia version: 0.5.2\n- Author: abap\n- Date: 2019-12-29\n=#\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nK,X = parseMap(split(readline()))\n\nfor i in X-(K-1):X+(K-1)\n\tprint(\"$i \")\nend\n\nprintln(\"\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 853, "memory_kb": 171540}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s301161111", "group_id": "codeNet:p02947", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n array=Vector{String}()\n for i in 1:n\n s=chomp(readline())\n push!(array,join(sort(collect(s))))\n end\n sort!(array)\n pat=[0 for i in 1:10^5]\n for i in 2:10^5\n pat[i]=pat[i-1]+i-1\n end\n ans=0\n cnt=1\n for i in 1:n\n if i==n\n ans+=pat[cnt]\n elseif array[i]!=array[i+1]\n ans+=pat[cnt]\n cnt=1\n else\n cnt+=1\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1582780652, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s301161111.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s301161111", "user_id": "u619197965"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n array=Vector{String}()\n for i in 1:n\n s=chomp(readline())\n push!(array,join(sort(collect(s))))\n end\n sort!(array)\n pat=[0 for i in 1:10^5]\n for i in 2:10^5\n pat[i]=pat[i-1]+i-1\n end\n ans=0\n cnt=1\n for i in 1:n\n if i==n\n ans+=pat[cnt]\n elseif array[i]!=array[i+1]\n ans+=pat[cnt]\n cnt=1\n else\n cnt+=1\n end\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 593, "cpu_time_ms": 996, "memory_kb": 175544}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s127377159", "group_id": "codeNet:p02947", "input_text": "parseint(x) = parse(Int, x)\nreadint() = readline() |> parseint\nreadstr() = readline() |> chomp\nreadstrlist(n) = [readstr() for _ = 1:n]\n\nfunction encode(s)\n code::BigInt = 0\n for c in s\n code += BigInt(11) ^ (c - 'a')\n end\n code\nend\n\nc2(n) = (n*(n-1))>>1\n\nfunction main()\n n = readint()\n s = readstrlist(n)\n s = encode.(s)\n sort!(s)\n append!(s, -1)\n ans = 0\n num = 1\n for i = 1:n\n if s[i] == s[i+1]\n num += 1\n else\n ans += c2(num)\n num = 1\n end\n end\n println(ans)\nend\n\nmain()\n\n", "language": "Julia", "metadata": {"date": 1581117550, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s127377159.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s127377159", "user_id": "u541055501"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseint(x) = parse(Int, x)\nreadint() = readline() |> parseint\nreadstr() = readline() |> chomp\nreadstrlist(n) = [readstr() for _ = 1:n]\n\nfunction encode(s)\n code::BigInt = 0\n for c in s\n code += BigInt(11) ^ (c - 'a')\n end\n code\nend\n\nc2(n) = (n*(n-1))>>1\n\nfunction main()\n n = readint()\n s = readstrlist(n)\n s = encode.(s)\n sort!(s)\n append!(s, -1)\n ans = 0\n num = 1\n for i = 1:n\n if s[i] == s[i+1]\n num += 1\n else\n ans += c2(num)\n num = 1\n end\n end\n println(ans)\nend\n\nmain()\n\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 580, "cpu_time_ms": 1664, "memory_kb": 178168}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s049291945", "group_id": "codeNet:p02947", "input_text": "#=\nC:\n- Julia version: 0.5.2\n- Author: abap\n- Date: 2019-12-29\n=#\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nN = parseInt(readline())\n\nfunction readStr()\n\ts = chomp(readline())\n\tS = []\n\tfor j in s\n\t\tpush!(S, j)\n\tend\n\treturn sort!(S)\nend\n\nfunction main()\nA = Array{Char}[]\nfor i in 1:N\n\tx = readStr()\n\tpush!(A, x)\nend\nres::Int64 = 0\nB = Set(A)\nfor k in B\n\tcount = 0\n\tfor kk in 1:N\n\t\tif k == @inbouds A[kk]\n\t\t\tcount += 1\n\t\tend\n\tend\n\tres += (count * (count - 1 )) / 2\nend\nprintln(res)\n\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577647028, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s049291945.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s049291945", "user_id": "u879294842"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "#=\nC:\n- Julia version: 0.5.2\n- Author: abap\n- Date: 2019-12-29\n=#\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nN = parseInt(readline())\n\nfunction readStr()\n\ts = chomp(readline())\n\tS = []\n\tfor j in s\n\t\tpush!(S, j)\n\tend\n\treturn sort!(S)\nend\n\nfunction main()\nA = Array{Char}[]\nfor i in 1:N\n\tx = readStr()\n\tpush!(A, x)\nend\nres::Int64 = 0\nB = Set(A)\nfor k in B\n\tcount = 0\n\tfor kk in 1:N\n\t\tif k == @inbouds A[kk]\n\t\t\tcount += 1\n\t\tend\n\tend\n\tres += (count * (count - 1 )) / 2\nend\nprintln(res)\n\n\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 542, "cpu_time_ms": 1152, "memory_kb": 201548}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s759437787", "group_id": "codeNet:p02947", "input_text": "parseInt(x) = parse(Int,x)\n\nfunction f(s,N)\n a = []\n for i = 1:N\n push!(a,zeros(Int,10))\n end\n for i = 1:N\n for j = 1:10 \n a[i][j] = Int(s[i][j])\n end\n a[i] = sort(a[i])\n end\n return(a)\nend\n\nfunction main()\n N = parseInt(readline())\n s = []\n for i = 1:N\n push!(s,chomp(readline()))\n end\n a = f(s,N)\n c = BigInt(0)\n while length(a) != 0\n tmp = 0\n b = filter(x -> !(x in [a[1]]),a)\n tmp = length(a)-length(b)-1\n c += div(tmp*(tmp+1),2)\n a = b\n end\n println(c)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1565492923, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s759437787.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s759437787", "user_id": "u709180765"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nfunction f(s,N)\n a = []\n for i = 1:N\n push!(a,zeros(Int,10))\n end\n for i = 1:N\n for j = 1:10 \n a[i][j] = Int(s[i][j])\n end\n a[i] = sort(a[i])\n end\n return(a)\nend\n\nfunction main()\n N = parseInt(readline())\n s = []\n for i = 1:N\n push!(s,chomp(readline()))\n end\n a = f(s,N)\n c = BigInt(0)\n while length(a) != 0\n tmp = 0\n b = filter(x -> !(x in [a[1]]),a)\n tmp = length(a)-length(b)-1\n c += div(tmp*(tmp+1),2)\n a = b\n end\n println(c)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2114, "memory_kb": 177344}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s019977382", "group_id": "codeNet:p02947", "input_text": "parseInt(x) = parse(Int,x)\n\nfunction main()\n N = parseInt(readline())\n s = []\n a = []\n for i = 1:N\n push!(s,chomp(readline()))\n push!(a,zeros(Int,26))\n end\n for i = 1:N\n for j = 1:10\n for k = 'a':'z'\n s[i][j] == k ? a[i][Int(k)-96] += 1 : tmp = 0\n end\n end\n end\n c = 0\n l = zeros(Int,N)\n for i = 1:N\n tmp = 0\n if l[i] == 0\n for j = (i+1):N\n if a[i] == a[j]\n tmp += 1\n l[j] = 1\n end\n end\n c += div(tmp*(tmp+1),2)\n end\n end\n println(c)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1565489120, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s019977382.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s019977382", "user_id": "u709180765"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nfunction main()\n N = parseInt(readline())\n s = []\n a = []\n for i = 1:N\n push!(s,chomp(readline()))\n push!(a,zeros(Int,26))\n end\n for i = 1:N\n for j = 1:10\n for k = 'a':'z'\n s[i][j] == k ? a[i][Int(k)-96] += 1 : tmp = 0\n end\n end\n end\n c = 0\n l = zeros(Int,N)\n for i = 1:N\n tmp = 0\n if l[i] == 0\n for j = (i+1):N\n if a[i] == a[j]\n tmp += 1\n l[j] = 1\n end\n end\n c += div(tmp*(tmp+1),2)\n end\n end\n println(c)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 542, "cpu_time_ms": 2111, "memory_kb": 166864}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s713596411", "group_id": "codeNet:p02950", "input_text": "p=parse(readline());B=eye(Int,p);for i=1:p;B[p,i]=p-1;for j=p-1:-1:2;B[j,i]=B[j+1,i]*(i-1)%p;end;end;println.(B*(x->parse(Int,x)).(split(readline())).%p)", "language": "Julia", "metadata": {"date": 1565489352, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02950.html", "problem_id": "p02950", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02950/input.txt", "sample_output_relpath": "derived/input_output/data/p02950/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02950/Julia/s713596411.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s713596411", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 1\n", "input_to_evaluate": "p=parse(readline());B=eye(Int,p);for i=1:p;B[p,i]=p-1;for j=p-1:-1:2;B[j,i]=B[j+1,i]*(i-1)%p;end;end;println.(B*(x->parse(Int,x)).(split(readline())).%p)", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are a prime number p and a sequence of p integers a_0, \\ldots, a_{p-1} consisting of zeros and ones.\n\nFind a polynomial of degree at most p-1, f(x) = b_{p-1} x^{p-1} + b_{p-2} x^{p-2} + \\ldots + b_0, satisfying the following conditions:\n\nFor each i (0 \\leq i \\leq p-1), b_i is an integer such that 0 \\leq b_i \\leq p-1.\n\nFor each i (0 \\leq i \\leq p-1), f(i) \\equiv a_i \\pmod p.\n\nConstraints\n\n2 \\leq p \\leq 2999\n\np is a prime number.\n\n0 \\leq a_i \\leq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\np\na_0 a_1 \\ldots a_{p-1}\n\nOutput\n\nPrint b_0, b_1, \\ldots, b_{p-1} of a polynomial f(x) satisfying the conditions, in this order, with spaces in between.\n\nIt can be proved that a solution always exists. If multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n2\n1 0\n\nSample Output 1\n\n1 1\n\nf(x) = x + 1 satisfies the conditions, as follows:\n\nf(0) = 0 + 1 = 1 \\equiv 1 \\pmod 2\n\nf(1) = 1 + 1 = 2 \\equiv 0 \\pmod 2\n\nSample Input 2\n\n3\n0 0 0\n\nSample Output 2\n\n0 0 0\n\nf(x) = 0 is also valid.\n\nSample Input 3\n\n5\n0 1 0 1 0\n\nSample Output 3\n\n0 2 0 1 3", "sample_input": "2\n1 0\n"}, "reference_outputs": ["1 1\n"], "source_document_id": "p02950", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are a prime number p and a sequence of p integers a_0, \\ldots, a_{p-1} consisting of zeros and ones.\n\nFind a polynomial of degree at most p-1, f(x) = b_{p-1} x^{p-1} + b_{p-2} x^{p-2} + \\ldots + b_0, satisfying the following conditions:\n\nFor each i (0 \\leq i \\leq p-1), b_i is an integer such that 0 \\leq b_i \\leq p-1.\n\nFor each i (0 \\leq i \\leq p-1), f(i) \\equiv a_i \\pmod p.\n\nConstraints\n\n2 \\leq p \\leq 2999\n\np is a prime number.\n\n0 \\leq a_i \\leq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\np\na_0 a_1 \\ldots a_{p-1}\n\nOutput\n\nPrint b_0, b_1, \\ldots, b_{p-1} of a polynomial f(x) satisfying the conditions, in this order, with spaces in between.\n\nIt can be proved that a solution always exists. If multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n2\n1 0\n\nSample Output 1\n\n1 1\n\nf(x) = x + 1 satisfies the conditions, as follows:\n\nf(0) = 0 + 1 = 1 \\equiv 1 \\pmod 2\n\nf(1) = 1 + 1 = 2 \\equiv 0 \\pmod 2\n\nSample Input 2\n\n3\n0 0 0\n\nSample Output 2\n\n0 0 0\n\nf(x) = 0 is also valid.\n\nSample Input 3\n\n5\n0 1 0 1 0\n\nSample Output 3\n\n0 2 0 1 3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 153, "cpu_time_ms": 2113, "memory_kb": 202680}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s520902703", "group_id": "codeNet:p02950", "input_text": "p=parse(readline());B=eye(Int,p);for i=1:p;B[p,i]=p-1;for j=p-1:-1:2;B[j,i]=B[j+1,i]*(i-1);end;end;println.(B*parse.(split(readline())).%p)", "language": "Julia", "metadata": {"date": 1565489259, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02950.html", "problem_id": "p02950", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02950/input.txt", "sample_output_relpath": "derived/input_output/data/p02950/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02950/Julia/s520902703.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s520902703", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 1\n", "input_to_evaluate": "p=parse(readline());B=eye(Int,p);for i=1:p;B[p,i]=p-1;for j=p-1:-1:2;B[j,i]=B[j+1,i]*(i-1);end;end;println.(B*parse.(split(readline())).%p)", "problem_context": "Score : 600 points\n\nProblem Statement\n\nGiven are a prime number p and a sequence of p integers a_0, \\ldots, a_{p-1} consisting of zeros and ones.\n\nFind a polynomial of degree at most p-1, f(x) = b_{p-1} x^{p-1} + b_{p-2} x^{p-2} + \\ldots + b_0, satisfying the following conditions:\n\nFor each i (0 \\leq i \\leq p-1), b_i is an integer such that 0 \\leq b_i \\leq p-1.\n\nFor each i (0 \\leq i \\leq p-1), f(i) \\equiv a_i \\pmod p.\n\nConstraints\n\n2 \\leq p \\leq 2999\n\np is a prime number.\n\n0 \\leq a_i \\leq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\np\na_0 a_1 \\ldots a_{p-1}\n\nOutput\n\nPrint b_0, b_1, \\ldots, b_{p-1} of a polynomial f(x) satisfying the conditions, in this order, with spaces in between.\n\nIt can be proved that a solution always exists. If multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n2\n1 0\n\nSample Output 1\n\n1 1\n\nf(x) = x + 1 satisfies the conditions, as follows:\n\nf(0) = 0 + 1 = 1 \\equiv 1 \\pmod 2\n\nf(1) = 1 + 1 = 2 \\equiv 0 \\pmod 2\n\nSample Input 2\n\n3\n0 0 0\n\nSample Output 2\n\n0 0 0\n\nf(x) = 0 is also valid.\n\nSample Input 3\n\n5\n0 1 0 1 0\n\nSample Output 3\n\n0 2 0 1 3", "sample_input": "2\n1 0\n"}, "reference_outputs": ["1 1\n"], "source_document_id": "p02950", "source_text": "Score : 600 points\n\nProblem Statement\n\nGiven are a prime number p and a sequence of p integers a_0, \\ldots, a_{p-1} consisting of zeros and ones.\n\nFind a polynomial of degree at most p-1, f(x) = b_{p-1} x^{p-1} + b_{p-2} x^{p-2} + \\ldots + b_0, satisfying the following conditions:\n\nFor each i (0 \\leq i \\leq p-1), b_i is an integer such that 0 \\leq b_i \\leq p-1.\n\nFor each i (0 \\leq i \\leq p-1), f(i) \\equiv a_i \\pmod p.\n\nConstraints\n\n2 \\leq p \\leq 2999\n\np is a prime number.\n\n0 \\leq a_i \\leq 1\n\nInput\n\nInput is given from Standard Input in the following format:\n\np\na_0 a_1 \\ldots a_{p-1}\n\nOutput\n\nPrint b_0, b_1, \\ldots, b_{p-1} of a polynomial f(x) satisfying the conditions, in this order, with spaces in between.\n\nIt can be proved that a solution always exists. If multiple solutions exist, any of them will be accepted.\n\nSample Input 1\n\n2\n1 0\n\nSample Output 1\n\n1 1\n\nf(x) = x + 1 satisfies the conditions, as follows:\n\nf(0) = 0 + 1 = 1 \\equiv 1 \\pmod 2\n\nf(1) = 1 + 1 = 2 \\equiv 0 \\pmod 2\n\nSample Input 2\n\n3\n0 0 0\n\nSample Output 2\n\n0 0 0\n\nf(x) = 0 is also valid.\n\nSample Input 3\n\n5\n0 1 0 1 0\n\nSample Output 3\n\n0 2 0 1 3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 203184}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s588091384", "group_id": "codeNet:p02951", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n a,b,c=parseMap(split(readline()))\n println(max(0,c-a+b))\nend\nmain()", "language": "Julia", "metadata": {"date": 1582781042, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s588091384.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s588091384", "user_id": "u619197965"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n a,b,c=parseMap(split(readline()))\n println(max(0,c-a+b))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 177, "cpu_time_ms": 698, "memory_kb": 154244}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s645319855", "group_id": "codeNet:p02952", "input_text": "N = chomp(readline())\nketa = length(N)\nans = 0\nfor i in 1:2:keta\n ans += (10^i - 10^(i-1)) \nend\nprintln(ans)\n ", "language": "Julia", "metadata": {"date": 1581290174, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s645319855.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s645319855", "user_id": "u879294842"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "N = chomp(readline())\nketa = length(N)\nans = 0\nfor i in 1:2:keta\n ans += (10^i - 10^(i-1)) \nend\nprintln(ans)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 783, "memory_kb": 162076}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s625387683", "group_id": "codeNet:p02954", "input_text": "function main()\n\tL=R=p=0\n\ts=chomp(readline())\n\tN=length(s)\n\tans=zeros(Int,N)\n\tfor i=1:N\n\t\tif s[i]=='R'\n\t\t\tR+=1\n\t\t\tp=i\n\t\telse\n\t\t\tL+=1\n\t\t\tif i==N||s[i+1]=='R'\n\t\t\t\tans[p]=ans[p+1]=div(L+R,2)\n\t\t\t\tif (L+R)%2==1\n\t\t\t\t\tans[p+L%2]+=1\n\t\t\t\tend\n\t\t\t\tL=R=0\n\t\t\tend\n\t\tend\n\tend\n\tprintln.(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1564971534, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s625387683.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s625387683", "user_id": "u657913472"}, "prompt_components": {"gold_output": "0 1 2 1 1\n", "input_to_evaluate": "function main()\n\tL=R=p=0\n\ts=chomp(readline())\n\tN=length(s)\n\tans=zeros(Int,N)\n\tfor i=1:N\n\t\tif s[i]=='R'\n\t\t\tR+=1\n\t\t\tp=i\n\t\telse\n\t\t\tL+=1\n\t\t\tif i==N||s[i+1]=='R'\n\t\t\t\tans[p]=ans[p+1]=div(L+R,2)\n\t\t\t\tif (L+R)%2==1\n\t\t\t\t\tans[p+L%2]+=1\n\t\t\t\tend\n\t\t\t\tL=R=0\n\t\t\tend\n\t\tend\n\tend\n\tprintln.(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 862, "memory_kb": 172436}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s866033854", "group_id": "codeNet:p02955", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n,k = readline() |> split |> parseArray\n a = readline() |> split |> parseArray\n\n ans=0\n escape=false\n for d in reverse(divisor(sum(a)))\n d_i=filter(x -> x!=0, sort(a.%d))\n l=length(d_i)\n for i in 1:l\n sum(d_i[1:i])!=sum(d-d_i[i+1:end]) && continue\n sum(d_i[1:i])>k && continue\n ans=d\n escape=true\n break\n end\n escape && break\n end\n println(ans)\nend\n\nfunction divisor(x::Int)\n a=Int[]\n for i in 1:floor(sqrt(x))\n x%i!=0 && continue\n push!(a, i)\n push!(a, x÷i)\n end\n sort!(a)\n a\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1568516128, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s866033854.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s866033854", "user_id": "u630185395"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n,k = readline() |> split |> parseArray\n a = readline() |> split |> parseArray\n\n ans=0\n escape=false\n for d in reverse(divisor(sum(a)))\n d_i=filter(x -> x!=0, sort(a.%d))\n l=length(d_i)\n for i in 1:l\n sum(d_i[1:i])!=sum(d-d_i[i+1:end]) && continue\n sum(d_i[1:i])>k && continue\n ans=d\n escape=true\n break\n end\n escape && break\n end\n println(ans)\nend\n\nfunction divisor(x::Int)\n a=Int[]\n for i in 1:floor(sqrt(x))\n x%i!=0 && continue\n push!(a, i)\n push!(a, x÷i)\n end\n sort!(a)\n a\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1777, "memory_kb": 173828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s113981374", "group_id": "codeNet:p02956", "input_text": "const lines=readlines()\nconst N=parse(Int,shift!(lines))\nconst up=zeros(Int,N)\nconst down=zeros(Int,N)\nfunction add(A,i,a)\n\twhile i<=N\n\t\tA[i]+=a\n\t\ti+=i&-i\n\tend\nend\nfunction sum(A,i)\n\tret=0\n\twhile i>0\n\t\tret+=A[i]\n\t\ti-=i&-i\n\tend\n\tret\nend\nconst mod=998244353\nconst F=zeros(Int,N+1)\nfunction bsearch(A,x)\n\tL=0\n\tR=N\n\twhile R-L>1\n\t\tM=div(L+R,2)\n\t\tif A[M]>=x\n\t\t\tR=M\n\t\telse\n\t\t\tL=M\n\t\tend\n\tend\n\tR\nend\nfunction main()\n\tF[1]=1\n\tX=Int[]\n\tY=Int[]\n\txy=Pair{Int,Int}[]\n\tfor i=1:N\n\t\tF[i+1]=F[i]*2%mod\n\t\tx,y=map(x->parse(Int,x),split(shift!(lines)))\n\t\tpush!(X,x)\n\t\tpush!(Y,y)\n\t\tpush!(xy,x=>y)\n\tend\n\tsort!(X)\n\tsort!(Y)\n\tfor i=1:N\n\t\tx=bsearch(X,xy[i].first)\n\t\ty=bsearch(Y,xy[i].second)\n\t\txy[i]=x=>y\n\t\tadd(down,y,1)\n\tend\n\tsort!(xy)\n\tans=0\n\tfor i=1:N\n\t\ty=xy[i].second\n\t\tadd(down,xy[i].second,-1)\n\t\ta=sum(up,y)\n\t\tb=i-1-a\n\t\tc=sum(down,y)\n\t\td=N-i-c\n\t\taX=(F[a+1]+F[d+1]+mod-1)%mod\n\t\taY=(F[b+1]+F[c+1]+mod-1)%mod\n\t\tans=(ans+F[N+1]-aX*aY%mod+mod)%mod\n\t\tadd(up,y,1)\n\tend\n\tprintln(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1564972671, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02956.html", "problem_id": "p02956", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02956/input.txt", "sample_output_relpath": "derived/input_output/data/p02956/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02956/Julia/s113981374.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s113981374", "user_id": "u657913472"}, "prompt_components": {"gold_output": "13\n", "input_to_evaluate": "const lines=readlines()\nconst N=parse(Int,shift!(lines))\nconst up=zeros(Int,N)\nconst down=zeros(Int,N)\nfunction add(A,i,a)\n\twhile i<=N\n\t\tA[i]+=a\n\t\ti+=i&-i\n\tend\nend\nfunction sum(A,i)\n\tret=0\n\twhile i>0\n\t\tret+=A[i]\n\t\ti-=i&-i\n\tend\n\tret\nend\nconst mod=998244353\nconst F=zeros(Int,N+1)\nfunction bsearch(A,x)\n\tL=0\n\tR=N\n\twhile R-L>1\n\t\tM=div(L+R,2)\n\t\tif A[M]>=x\n\t\t\tR=M\n\t\telse\n\t\t\tL=M\n\t\tend\n\tend\n\tR\nend\nfunction main()\n\tF[1]=1\n\tX=Int[]\n\tY=Int[]\n\txy=Pair{Int,Int}[]\n\tfor i=1:N\n\t\tF[i+1]=F[i]*2%mod\n\t\tx,y=map(x->parse(Int,x),split(shift!(lines)))\n\t\tpush!(X,x)\n\t\tpush!(Y,y)\n\t\tpush!(xy,x=>y)\n\tend\n\tsort!(X)\n\tsort!(Y)\n\tfor i=1:N\n\t\tx=bsearch(X,xy[i].first)\n\t\ty=bsearch(Y,xy[i].second)\n\t\txy[i]=x=>y\n\t\tadd(down,y,1)\n\tend\n\tsort!(xy)\n\tans=0\n\tfor i=1:N\n\t\ty=xy[i].second\n\t\tadd(down,xy[i].second,-1)\n\t\ta=sum(up,y)\n\t\tb=i-1-a\n\t\tc=sum(down,y)\n\t\td=N-i-c\n\t\taX=(F[a+1]+F[d+1]+mod-1)%mod\n\t\taY=(F[b+1]+F[c+1]+mod-1)%mod\n\t\tans=(ans+F[N+1]-aX*aY%mod+mod)%mod\n\t\tadd(up,y,1)\n\tend\n\tprintln(ans)\nend\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a set S of N points in a two-dimensional plane. The coordinates of the i-th point are (x_i, y_i). The N points have distinct x-coordinates and distinct y-coordinates.\n\nFor a non-empty subset T of S, let f(T) be the number of points contained in the smallest rectangle, whose sides are parallel to the coordinate axes, that contains all the points in T. More formally, we define f(T) as follows:\n\nf(T) := (the number of integers i (1 \\leq i \\leq N) such that a \\leq x_i \\leq b and c \\leq y_i \\leq d, where a, b, c, and d are the minimum x-coordinate, the maximum x-coordinate, the minimum y-coordinate, and the maximum y-coordinate of the points in T)\n\nFind the sum of f(T) over all non-empty subset T of S. Since it can be enormous, print the sum modulo 998244353.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n-10^9 \\leq x_i, y_i \\leq 10^9\n\nx_i \\neq x_j (i \\neq j)\n\ny_i \\neq y_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\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the sum of f(T) over all non-empty subset T of S, modulo 998244353.\n\nSample Input 1\n\n3\n-1 3\n2 1\n3 -2\n\nSample Output 1\n\n13\n\nLet the first, second, and third points be P_1, P_2, and P_3, respectively. S = \\{P_1, P_2, P_3\\} has seven non-empty subsets, and f has the following values for each of them:\n\nf(\\{P_1\\}) = 1\n\nf(\\{P_2\\}) = 1\n\nf(\\{P_3\\}) = 1\n\nf(\\{P_1, P_2\\}) = 2\n\nf(\\{P_2, P_3\\}) = 2\n\nf(\\{P_3, P_1\\}) = 3\n\nf(\\{P_1, P_2, P_3\\}) = 3\n\nThe sum of these is 13.\n\nSample Input 2\n\n4\n1 4\n2 1\n3 3\n4 2\n\nSample Output 2\n\n34\n\nSample Input 3\n\n10\n19 -11\n-3 -12\n5 3\n3 -15\n8 -14\n-9 -20\n10 -9\n0 2\n-7 17\n6 -6\n\nSample Output 3\n\n7222\n\nBe sure to print the sum modulo 998244353.", "sample_input": "3\n-1 3\n2 1\n3 -2\n"}, "reference_outputs": ["13\n"], "source_document_id": "p02956", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a set S of N points in a two-dimensional plane. The coordinates of the i-th point are (x_i, y_i). The N points have distinct x-coordinates and distinct y-coordinates.\n\nFor a non-empty subset T of S, let f(T) be the number of points contained in the smallest rectangle, whose sides are parallel to the coordinate axes, that contains all the points in T. More formally, we define f(T) as follows:\n\nf(T) := (the number of integers i (1 \\leq i \\leq N) such that a \\leq x_i \\leq b and c \\leq y_i \\leq d, where a, b, c, and d are the minimum x-coordinate, the maximum x-coordinate, the minimum y-coordinate, and the maximum y-coordinate of the points in T)\n\nFind the sum of f(T) over all non-empty subset T of S. Since it can be enormous, print the sum modulo 998244353.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n-10^9 \\leq x_i, y_i \\leq 10^9\n\nx_i \\neq x_j (i \\neq j)\n\ny_i \\neq y_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\nx_1 y_1\n:\nx_N y_N\n\nOutput\n\nPrint the sum of f(T) over all non-empty subset T of S, modulo 998244353.\n\nSample Input 1\n\n3\n-1 3\n2 1\n3 -2\n\nSample Output 1\n\n13\n\nLet the first, second, and third points be P_1, P_2, and P_3, respectively. S = \\{P_1, P_2, P_3\\} has seven non-empty subsets, and f has the following values for each of them:\n\nf(\\{P_1\\}) = 1\n\nf(\\{P_2\\}) = 1\n\nf(\\{P_3\\}) = 1\n\nf(\\{P_1, P_2\\}) = 2\n\nf(\\{P_2, P_3\\}) = 2\n\nf(\\{P_3, P_1\\}) = 3\n\nf(\\{P_1, P_2, P_3\\}) = 3\n\nThe sum of these is 13.\n\nSample Input 2\n\n4\n1 4\n2 1\n3 3\n4 2\n\nSample Output 2\n\n34\n\nSample Input 3\n\n10\n19 -11\n-3 -12\n5 3\n3 -15\n8 -14\n-9 -20\n10 -9\n0 2\n-7 17\n6 -6\n\nSample Output 3\n\n7222\n\nBe sure to print the sum modulo 998244353.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 966, "cpu_time_ms": 1146, "memory_kb": 166668}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s955745719", "group_id": "codeNet:p02957", "input_text": "A,B = parse.(split(readline()))\nif A % 2 != B % 2\n println(\"IMPOSSIBLE\")\nelse\n println(Int((A + B) / 2))\nend", "language": "Julia", "metadata": {"date": 1583013695, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s955745719.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s955745719", "user_id": "u879294842"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "A,B = parse.(split(readline()))\nif A % 2 != B % 2\n println(\"IMPOSSIBLE\")\nelse\n println(Int((A + B) / 2))\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 582, "memory_kb": 120212}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s488840629", "group_id": "codeNet:p02958", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nN = parse(readline())\np = parseMap(split(readline()))\nsort_p = sort(p)\ncount = 0\nfor i in 1:N\n if p[i] != sort_p[i]\n count += 1\n end\nend \n\nprintln(count > 2 ? \"NO\":\"YES\")", "language": "Julia", "metadata": {"date": 1583013962, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s488840629.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s488840629", "user_id": "u879294842"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nN = parse(readline())\np = parseMap(split(readline()))\nsort_p = sort(p)\ncount = 0\nfor i in 1:N\n if p[i] != sort_p[i]\n count += 1\n end\nend \n\nprintln(count > 2 ? \"NO\":\"YES\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 438, "memory_kb": 114564}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s828729801", "group_id": "codeNet:p02959", "input_text": "n=parse(Int,readline())\n\nan=readline()\nan1=split(an)\nX=Any[]\nfor i=1:n+1\n X= push!(X , parse(Int,an1[i]))\nend\n\nbn=readline()\nbn1=split(bn)\nY=Any[]\nfor i=1:n\n Y= push!(Y , parse(Int,bn1[i]))\nend\n\n\n\n\nk=0\n\nfor i=1:n\n if X[i]parse(Int,x),readlines())\nB=A[:]\nsort!(B)\nfor a=A\n println(a==B[end]?B[end-1]:B[end])\nend", "language": "Julia", "metadata": {"date": 1563678298, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s367328275.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s367328275", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n3\n4\n", "input_to_evaluate": "readline()\nA=map(x->parse(Int,x),readlines())\nB=A[:]\nsort!(B)\nfor a=A\n println(a==B[end]?B[end-1]:B[end])\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 110, "cpu_time_ms": 889, "memory_kb": 167520}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s690670411", "group_id": "codeNet:p02972", "input_text": "N=parse(Int,readline())\nA=map(x->parse(Int,x),split(readline()))\nB=zeros(Int,N)\nfor i=N:-1:1\n\tnow=A[i]\n\tfor j=i:i:N\n\t\tnow+=B[j]\n\tend\n\tB[i]=now%2\nend\nprintln(sum(B))\nfor i=1:N\n\tif B[i]==1\n\t\tprintln(i)\n\tend\nend\n", "language": "Julia", "metadata": {"date": 1563678470, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s690670411.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s690670411", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n1\n", "input_to_evaluate": "N=parse(Int,readline())\nA=map(x->parse(Int,x),split(readline()))\nB=zeros(Int,N)\nfor i=N:-1:1\n\tnow=A[i]\n\tfor j=i:i:N\n\t\tnow+=B[j]\n\tend\n\tB[i]=now%2\nend\nprintln(sum(B))\nfor i=1:N\n\tif B[i]==1\n\t\tprintln(i)\n\tend\nend\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1198, "memory_kb": 165524}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s873130185", "group_id": "codeNet:p02973", "input_text": "N=parse(Int,readline())\nK=-ones(Int,N)\nfor _=1:N\n\tA=parse(Int,readline())\n\tL=0\n\tR=N\n\twhile R-L>1\n\t\tM=div(L+R,2)\n\t\tif K[M]=0\n\tid+=1\nend\nprintln(id)\n", "language": "Julia", "metadata": {"date": 1563678882, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02973.html", "problem_id": "p02973", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02973/input.txt", "sample_output_relpath": "derived/input_output/data/p02973/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02973/Julia/s873130185.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s873130185", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N=parse(Int,readline())\nK=-ones(Int,N)\nfor _=1:N\n\tA=parse(Int,readline())\n\tL=0\n\tR=N\n\twhile R-L>1\n\t\tM=div(L+R,2)\n\t\tif K[M]=0\n\tid+=1\nend\nprintln(id)\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a sequence with N integers: A = \\{ A_1, A_2, \\cdots, A_N \\}.\nFor each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:\n\nIf A_i and A_j (i < j) are painted with the same color, A_i < A_j.\n\nFind the minimum number of colors required to satisfy the condition.\n\nConstraints\n\n1 \\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\n:\nA_N\n\nOutput\n\nPrint the minimum number of colors required to satisfy the condition.\n\nSample Input 1\n\n5\n2\n1\n4\n5\n3\n\nSample Output 1\n\n2\n\nWe can satisfy the condition with two colors by, for example, painting 2 and 3 red and painting 1, 4, and 5 blue.\n\nSample Input 2\n\n4\n0\n0\n0\n0\n\nSample Output 2\n\n4\n\nWe have to paint all the integers with distinct colors.", "sample_input": "5\n2\n1\n4\n5\n3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02973", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a sequence with N integers: A = \\{ A_1, A_2, \\cdots, A_N \\}.\nFor each of these N integers, we will choose a color and paint the integer with that color. Here the following condition must be satisfied:\n\nIf A_i and A_j (i < j) are painted with the same color, A_i < A_j.\n\nFind the minimum number of colors required to satisfy the condition.\n\nConstraints\n\n1 \\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\n:\nA_N\n\nOutput\n\nPrint the minimum number of colors required to satisfy the condition.\n\nSample Input 1\n\n5\n2\n1\n4\n5\n3\n\nSample Output 1\n\n2\n\nWe can satisfy the condition with two colors by, for example, painting 2 and 3 red and painting 1, 4, and 5 blue.\n\nSample Input 2\n\n4\n0\n0\n0\n0\n\nSample Output 2\n\n4\n\nWe have to paint all the integers with distinct colors.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 219, "cpu_time_ms": 1349, "memory_kb": 209568}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s905216043", "group_id": "codeNet:p02974", "input_text": "#include \nusing namespace std;\n\nconstexpr int64_t mod = 1'000'000'007;\n\nint main(){ \n int n, k;\n cin >> n >> k;\n static int64_t dp[50+1][50+1][50*50+1];\n dp[1][0][0] = 1;\n dp[1][1][2] = 1;\n for(int i=2;i<=n;i++){\n for(int j=0;j<=i;j++){\n for(int c=0;c<=k;c++){\n dp[i][j][c] = 0;\n if(c-2*j >= 0)\n dp[i][j][c] = (dp[i][j][c] + (2*j+1)*dp[i-1][j][c-2*j]) % mod;\n if(j+1 <= 50 && c-2*j >= 0)\n dp[i][j][c] = (dp[i][j][c] + (j+1)*(j+1)*dp[i-1][j+1][c-2*j]) % mod;\n if(j-1 >= 0 && c-2*j >= 0)\n dp[i][j][c] = (dp[i][j][c] + dp[i-1][j-1][c-2*j]) % mod;\n }\n }\n }\n\n cout << dp[n][0][k] << endl;\n \n return 0;\n}", "language": "Julia", "metadata": {"date": 1563941392, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02974.html", "problem_id": "p02974", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02974/input.txt", "sample_output_relpath": "derived/input_output/data/p02974/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02974/Julia/s905216043.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s905216043", "user_id": "u726604439"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "#include \nusing namespace std;\n\nconstexpr int64_t mod = 1'000'000'007;\n\nint main(){ \n int n, k;\n cin >> n >> k;\n static int64_t dp[50+1][50+1][50*50+1];\n dp[1][0][0] = 1;\n dp[1][1][2] = 1;\n for(int i=2;i<=n;i++){\n for(int j=0;j<=i;j++){\n for(int c=0;c<=k;c++){\n dp[i][j][c] = 0;\n if(c-2*j >= 0)\n dp[i][j][c] = (dp[i][j][c] + (2*j+1)*dp[i-1][j][c-2*j]) % mod;\n if(j+1 <= 50 && c-2*j >= 0)\n dp[i][j][c] = (dp[i][j][c] + (j+1)*(j+1)*dp[i-1][j+1][c-2*j]) % mod;\n if(j-1 >= 0 && c-2*j >= 0)\n dp[i][j][c] = (dp[i][j][c] + dp[i-1][j-1][c-2*j]) % mod;\n }\n }\n }\n\n cout << dp[n][0][k] << endl;\n \n return 0;\n}", "problem_context": "Score : 600 points\n\nProblem Statement\n\nLet us define the oddness of a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n} as \\sum_{i = 1}^n |i - p_i|.\n\nFind the number of permutations of {1,\\ 2,\\ ...,\\ n} of oddness k, modulo 10^9+7.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq n \\leq 50\n\n0 \\leq k \\leq n^2\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn k\n\nOutput\n\nPrint the number of permutations of {1,\\ 2,\\ ...,\\ n} of oddness k, modulo 10^9+7.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n2\n\nThere are six permutations of {1,\\ 2,\\ 3}. Among them, two have oddness of 2: {2,\\ 1,\\ 3} and {1,\\ 3,\\ 2}.\n\nSample Input 2\n\n39 14\n\nSample Output 2\n\n74764168", "sample_input": "3 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02974", "source_text": "Score : 600 points\n\nProblem Statement\n\nLet us define the oddness of a permutation p = {p_1,\\ p_2,\\ ...,\\ p_n} of {1,\\ 2,\\ ...,\\ n} as \\sum_{i = 1}^n |i - p_i|.\n\nFind the number of permutations of {1,\\ 2,\\ ...,\\ n} of oddness k, modulo 10^9+7.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq n \\leq 50\n\n0 \\leq k \\leq n^2\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn k\n\nOutput\n\nPrint the number of permutations of {1,\\ 2,\\ ...,\\ n} of oddness k, modulo 10^9+7.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n2\n\nThere are six permutations of {1,\\ 2,\\ 3}. Among them, two have oddness of 2: {2,\\ 1,\\ 3} and {1,\\ 3,\\ 2}.\n\nSample Input 2\n\n39 14\n\nSample Output 2\n\n74764168", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 799, "cpu_time_ms": 705, "memory_kb": 143716}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s831008104", "group_id": "codeNet:p02975", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tif sum(a) == 0\n\t\tprintln(\"Yes\")\n\telseif n%3!=0\n\t\tprintln(\"No\")\n\telse\n\t\td = Dict{Int,Int}()\n\t\tfor i in 1:n\n\t\t\tif haskey(d,a[i])\n\t\t\t\td[a[i]] += 1\n\t\t\telse\n\t\t\t\td[a[i]] = 1\n\t\t\tend\n\t\tend\n\t\tf = 0\n\t\tfor j in values(d)\n\t\t\tif j != div(n,3)\n\t\t\t\tf = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tprintln(f==0?\"Yes\":\"No\")\n\tend\t\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1563185668, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s831008104.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s831008104", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tif sum(a) == 0\n\t\tprintln(\"Yes\")\n\telseif n%3!=0\n\t\tprintln(\"No\")\n\telse\n\t\td = Dict{Int,Int}()\n\t\tfor i in 1:n\n\t\t\tif haskey(d,a[i])\n\t\t\t\td[a[i]] += 1\n\t\t\telse\n\t\t\t\td[a[i]] = 1\n\t\t\tend\n\t\tend\n\t\tf = 0\n\t\tfor j in values(d)\n\t\t\tif j != div(n,3)\n\t\t\t\tf = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tprintln(f==0?\"Yes\":\"No\")\n\tend\t\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 420, "memory_kb": 119548}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s592394677", "group_id": "codeNet:p02975", "input_text": "N=parse(Int,readline())\nM=Dict{Int,Int}()\nfor a=map(x->parse(Int,x),split(readline()))\n\tM[a]=get(M,a,0)+1\nend\nif N%3!=0\n\tprintln(get(M,0,0)==N?\"Yes\":\"No\")\nelse\n\tT=div(N,3)\n\tcum=0\n\tflag=true\n\tfor (k,v)=M\n\t\tif v%T!=0\n\t\t\tflag=false\n\t\telse\n\t\t\twhile v>=T\n\t\t\t\tv-=T\n\t\t\t\tcum$=k\n\t\t\tend\n\t\tend\n\tend\n\tif cum!=0\n\t\tflag=false\n\tend\n\tprintln(flag?\"Yes\":\"No\")\nend\n", "language": "Julia", "metadata": {"date": 1563162022, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s592394677.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s592394677", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N=parse(Int,readline())\nM=Dict{Int,Int}()\nfor a=map(x->parse(Int,x),split(readline()))\n\tM[a]=get(M,a,0)+1\nend\nif N%3!=0\n\tprintln(get(M,0,0)==N?\"Yes\":\"No\")\nelse\n\tT=div(N,3)\n\tcum=0\n\tflag=true\n\tfor (k,v)=M\n\t\tif v%T!=0\n\t\t\tflag=false\n\t\telse\n\t\t\twhile v>=T\n\t\t\t\tv-=T\n\t\t\t\tcum$=k\n\t\t\tend\n\t\tend\n\tend\n\tif cum!=0\n\t\tflag=false\n\tend\n\tprintln(flag?\"Yes\":\"No\")\nend\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 347, "cpu_time_ms": 957, "memory_kb": 170696}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s875614724", "group_id": "codeNet:p02976", "input_text": "const N,M=parse.(split(readline()))\nconst G=[[Int[] for _=1:3] for _=1:N]\nif M%2==1\n\tprintln(-1)\n\texit()\nend\nfor s=readlines()\n\ta,b=map(x->parse(Int,x),split(s))\n\tpush!(G[a][1],b)\n\tpush!(G[b][1],a)\n\tpush!(G[a][2],length(G[b][1]))\n\tpush!(G[b][2],length(G[a][1]))\n\tpush!(G[a][3],-1)\n\tpush!(G[b][3],-1)\nend\nvis=zeros(Int,N)\n@inbounds function dfs(u,p)\n\tvis[u]=1\n\tcnt=0\n\tpar=-1\n\tfor i=1:length(G[u][1])\n\t\tif vis[G[u][1][i]]==0\n\t\t\tdfs(G[u][1][i],u)\n\t\tend\n\t\tif G[u][1][i]!=p&&G[u][3][i]!=0\n\t\t\tif G[u][3][i]==-1\n\t\t\t\tG[u][3][i]=1\n\t\t\t\tG[G[u][1][i]][3][G[u][2][i]]=0\n\t\t\tend\n\t\t\tcnt+=1\n\t\tend\n\t\tif G[u][1][i]==p\n\t\t\tpar=i\n\t\tend\n\tend\n\tif cnt%2==1\n\t\tG[u][3][par]=1\n\t\tG[p][3][G[u][2][par]]=0\n\tend\nend\ndfs(1,0)\nfor u=1:N\n\tfor i=1:length(G[u][1])\n\t\tif G[u][3][i]==1\n\t\t\tprintln(\"$u $(G[u][1][i])\")\n\t\tend\n\tend\nend", "language": "Julia", "metadata": {"date": 1563175367, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02976.html", "problem_id": "p02976", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02976/input.txt", "sample_output_relpath": "derived/input_output/data/p02976/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02976/Julia/s875614724.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s875614724", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 2\n1 4\n3 2\n3 4\n", "input_to_evaluate": "const N,M=parse.(split(readline()))\nconst G=[[Int[] for _=1:3] for _=1:N]\nif M%2==1\n\tprintln(-1)\n\texit()\nend\nfor s=readlines()\n\ta,b=map(x->parse(Int,x),split(s))\n\tpush!(G[a][1],b)\n\tpush!(G[b][1],a)\n\tpush!(G[a][2],length(G[b][1]))\n\tpush!(G[b][2],length(G[a][1]))\n\tpush!(G[a][3],-1)\n\tpush!(G[b][3],-1)\nend\nvis=zeros(Int,N)\n@inbounds function dfs(u,p)\n\tvis[u]=1\n\tcnt=0\n\tpar=-1\n\tfor i=1:length(G[u][1])\n\t\tif vis[G[u][1][i]]==0\n\t\t\tdfs(G[u][1][i],u)\n\t\tend\n\t\tif G[u][1][i]!=p&&G[u][3][i]!=0\n\t\t\tif G[u][3][i]==-1\n\t\t\t\tG[u][3][i]=1\n\t\t\t\tG[G[u][1][i]][3][G[u][2][i]]=0\n\t\t\tend\n\t\t\tcnt+=1\n\t\tend\n\t\tif G[u][1][i]==p\n\t\t\tpar=i\n\t\tend\n\tend\n\tif cnt%2==1\n\t\tG[u][3][par]=1\n\t\tG[p][3][G[u][2][par]]=0\n\tend\nend\ndfs(1,0)\nfor u=1:N\n\tfor i=1:length(G[u][1])\n\t\tif G[u][3][i]==1\n\t\t\tprintln(\"$u $(G[u][1][i])\")\n\t\tend\n\tend\nend", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given a simple connected undirected graph with N vertices and M edges. The vertices are numbered 1 to N, and the i-th edge connects Vertex A_i and Vertex B_i.\nTakahashi will assign one of the two possible directions to each of the edges in the graph to make a directed graph.\nDetermine if it is possible to make a directed graph with an even number of edges going out from every vertex. If the answer is yes, construct one such graph.\n\nNotes\n\nAn undirected graph is said to be simple when it contains no self-loops or multiple edges.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\nN-1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N (1\\leq i\\leq M)\n\nThe given graph is simple and connected.\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 it is impossible to assign directions\b to satisfy the requirement, print -1.\nOtherwise, print an assignment of directions that satisfies the requirement, in the following format:\n\nC_1 D_1\n:\nC_M D_M\n\nHere each pair (C_i, D_i) means that there is an edge directed from Vertex C_i to Vertex D_i. The edges may be printed in any order.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 1\n\nSample Output 1\n\n1 2\n1 4\n3 2\n3 4\n\nAfter this assignment of directions, Vertex 1 and 3 will each have two outgoing edges, and Vertex 2 and 4 will each have zero outgoing edges.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 4\n2 5\n4 5\n\nSample Output 2\n\n-1", "sample_input": "4 4\n1 2\n2 3\n3 4\n4 1\n"}, "reference_outputs": ["1 2\n1 4\n3 2\n3 4\n"], "source_document_id": "p02976", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given a simple connected undirected graph with N vertices and M edges. The vertices are numbered 1 to N, and the i-th edge connects Vertex A_i and Vertex B_i.\nTakahashi will assign one of the two possible directions to each of the edges in the graph to make a directed graph.\nDetermine if it is possible to make a directed graph with an even number of edges going out from every vertex. If the answer is yes, construct one such graph.\n\nNotes\n\nAn undirected graph is said to be simple when it contains no self-loops or multiple edges.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\nN-1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N (1\\leq i\\leq M)\n\nThe given graph is simple and connected.\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 it is impossible to assign directions\b to satisfy the requirement, print -1.\nOtherwise, print an assignment of directions that satisfies the requirement, in the following format:\n\nC_1 D_1\n:\nC_M D_M\n\nHere each pair (C_i, D_i) means that there is an edge directed from Vertex C_i to Vertex D_i. The edges may be printed in any order.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 1\n\nSample Output 1\n\n1 2\n1 4\n3 2\n3 4\n\nAfter this assignment of directions, Vertex 1 and 3 will each have two outgoing edges, and Vertex 2 and 4 will each have zero outgoing edges.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 4\n2 5\n4 5\n\nSample Output 2\n\n-1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2117, "memory_kb": 233732}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s087363562", "group_id": "codeNet:p02977", "input_text": "N=parse(readline())\nif ispow2(N)\n\tprintln(\"No\")\n\texit()\nend\nprintln(\"Yes\")\nfor i=2:2:N-1\n\tprintln(\"1 $i\")\n\tprintln(\"$i $(i+1)\")\n\tprintln(\"1 $(i+1+N)\")\n\tprintln(\"$(i+1+N) $(i+N)\")\nend\nprintln(\"3 $(N+1)\")\nif N%2==0\n\tM=prevpow(2,N)\n\tprintln(\"$M $N\")\n\tprintln(\"$((M$N$1)+N) $(2N)\")\nend", "language": "Julia", "metadata": {"date": 1563173886, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02977.html", "problem_id": "p02977", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02977/input.txt", "sample_output_relpath": "derived/input_output/data/p02977/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02977/Julia/s087363562.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s087363562", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n1 2\n2 3\n3 4\n4 5\n5 6\n", "input_to_evaluate": "N=parse(readline())\nif ispow2(N)\n\tprintln(\"No\")\n\texit()\nend\nprintln(\"Yes\")\nfor i=2:2:N-1\n\tprintln(\"1 $i\")\n\tprintln(\"$i $(i+1)\")\n\tprintln(\"1 $(i+1+N)\")\n\tprintln(\"$(i+1+N) $(i+N)\")\nend\nprintln(\"3 $(N+1)\")\nif N%2==0\n\tM=prevpow(2,N)\n\tprintln(\"$M $N\")\n\tprintln(\"$((M$N$1)+N) $(2N)\")\nend", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N. Determine if there exists a tree with 2N vertices numbered 1 to 2N satisfying the following condition, and show one such tree if the answer is yes.\n\nAssume that, for each integer i between 1 and N (inclusive), Vertex i and N+i have the weight i. Then, for each integer i between 1 and N, the bitwise XOR of the weights of the vertices on the path between Vertex i and N+i (including themselves) is i.\n\nConstraints\n\nN is an integer.\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\nIf there exists a tree satisfying the condition in the statement, print Yes; otherwise, print No.\nThen, if such a tree exists, print the 2N-1 edges of such a tree in the subsequent 2N-1 lines, in the following format:\n\na_{1} b_{1}\n\\vdots\na_{2N-1} b_{2N-1}\n\nHere each pair (a_i, b_i) means that there is an edge connecting Vertex a_i and b_i. The edges may be printed in any order.\n\nSample Input 1\n\n3\n\nSample Output 1\n\nYes\n1 2\n2 3\n3 4\n4 5\n5 6\n\nThe sample output represents the following graph:\n\nSample Input 2\n\n1\n\nSample Output 2\n\nNo\n\nThere is no tree satisfying the condition.", "sample_input": "3\n"}, "reference_outputs": ["Yes\n1 2\n2 3\n3 4\n4 5\n5 6\n"], "source_document_id": "p02977", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N. Determine if there exists a tree with 2N vertices numbered 1 to 2N satisfying the following condition, and show one such tree if the answer is yes.\n\nAssume that, for each integer i between 1 and N (inclusive), Vertex i and N+i have the weight i. Then, for each integer i between 1 and N, the bitwise XOR of the weights of the vertices on the path between Vertex i and N+i (including themselves) is i.\n\nConstraints\n\nN is an integer.\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\nIf there exists a tree satisfying the condition in the statement, print Yes; otherwise, print No.\nThen, if such a tree exists, print the 2N-1 edges of such a tree in the subsequent 2N-1 lines, in the following format:\n\na_{1} b_{1}\n\\vdots\na_{2N-1} b_{2N-1}\n\nHere each pair (a_i, b_i) means that there is an edge connecting Vertex a_i and b_i. The edges may be printed in any order.\n\nSample Input 1\n\n3\n\nSample Output 1\n\nYes\n1 2\n2 3\n3 4\n4 5\n5 6\n\nThe sample output represents the following graph:\n\nSample Input 2\n\n1\n\nSample Output 2\n\nNo\n\nThere is no tree satisfying the condition.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 884, "memory_kb": 163884}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s417274004", "group_id": "codeNet:p02981", "input_text": "a,b,c=parse.(split(readline()))\nprint(min(a*b,c))", "language": "Julia", "metadata": {"date": 1585098601, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s417274004.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s417274004", "user_id": "u443151804"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "a,b,c=parse.(split(readline()))\nprint(min(a*b,c))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 49, "cpu_time_ms": 524, "memory_kb": 121884}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s271511040", "group_id": "codeNet:p02981", "input_text": "function main()\n \n (N,A,B) = map(x -> parse(Int,x), split(readline()))\n \n println(min(A*N,B))\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1579659647, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s271511040.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s271511040", "user_id": "u790457721"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "function main()\n \n (N,A,B) = map(x -> parse(Int,x), split(readline()))\n \n println(min(A*N,B))\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 344, "memory_kb": 111708}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s253672124", "group_id": "codeNet:p02981", "input_text": "function main()\n \n (N,A,B) = map(x -> parse(Int,x), split(readline()))\n \n ptintln(min(A*N,B))\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1579659560, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s253672124.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s253672124", "user_id": "u790457721"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "function main()\n \n (N,A,B) = map(x -> parse(Int,x), split(readline()))\n \n ptintln(min(A*N,B))\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1261, "memory_kb": 203028}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s883258651", "group_id": "codeNet:p02982", "input_text": "parseint(x) = parse(Int, x)\nreadint() = readline() |> parseint\nreadints() = map(parseint, readline() |> split)\n\nfunction main()\n n, d = readints()\n x = [readints() for _ = 1:n]\n cnt = 0\n for i = 1:n-1, j = i+1:n\n s = 0\n for k = 1:d\n s += (x[i][k] - x[j][k])^2\n end\n l = 0\n r = 100\n while r - l > 1\n m = l + div(r - l, 2)\n if m*m <= s\n l = m\n else\n r = m\n end\n end\n if l*l == s\n cnt += 1\n end\n end\n println(cnt)\nend\n\nmain()\n\n", "language": "Julia", "metadata": {"date": 1581136132, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02982.html", "problem_id": "p02982", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02982/input.txt", "sample_output_relpath": "derived/input_output/data/p02982/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02982/Julia/s883258651.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s883258651", "user_id": "u541055501"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseint(x) = parse(Int, x)\nreadint() = readline() |> parseint\nreadints() = map(parseint, readline() |> split)\n\nfunction main()\n n, d = readints()\n x = [readints() for _ = 1:n]\n cnt = 0\n for i = 1:n-1, j = i+1:n\n s = 0\n for k = 1:d\n s += (x[i][k] - x[j][k])^2\n end\n l = 0\n r = 100\n while r - l > 1\n m = l + div(r - l, 2)\n if m*m <= s\n l = m\n else\n r = m\n end\n end\n if l*l == s\n cnt += 1\n end\n end\n println(cnt)\nend\n\nmain()\n\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N points in a D-dimensional space.\n\nThe coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).\n\nThe distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \\sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.\n\nHow many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10\n\n1 \\leq D \\leq 10\n\n-20 \\leq X_{ij} \\leq 20\n\nNo two given points have the same coordinates. That is, if i \\neq j, there exists k such that X_{ik} \\neq X_{jk}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_{11} X_{12} ... X_{1D}\nX_{21} X_{22} ... X_{2D}\n\\vdots\nX_{N1} X_{N2} ... X_{ND}\n\nOutput\n\nPrint the number of pairs (i, j) (i < j) such that the distance between the i-th point and the j-th point is an integer.\n\nSample Input 1\n\n3 2\n1 2\n5 5\n-2 8\n\nSample Output 1\n\n1\n\nThe number of pairs with an integer distance is one, as follows:\n\nThe distance between the first point and the second point is \\sqrt{|1-5|^2 + |2-5|^2} = 5, which is an integer.\n\nThe distance between the second point and the third point is \\sqrt{|5-(-2)|^2 + |5-8|^2} = \\sqrt{58}, which is not an integer.\n\nThe distance between the third point and the first point is \\sqrt{|-2-1|^2+|8-2|^2} = 3\\sqrt{5}, which is not an integer.\n\nSample Input 2\n\n3 4\n-3 7 8 2\n-12 1 10 2\n-2 8 9 3\n\nSample Output 2\n\n2\n\nSample Input 3\n\n5 1\n1\n2\n3\n4\n5\n\nSample Output 3\n\n10", "sample_input": "3 2\n1 2\n5 5\n-2 8\n"}, "reference_outputs": ["1\n"], "source_document_id": "p02982", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N points in a D-dimensional space.\n\nThe coordinates of the i-th point are (X_{i1}, X_{i2}, ..., X_{iD}).\n\nThe distance between two points with coordinates (y_1, y_2, ..., y_D) and (z_1, z_2, ..., z_D) is \\sqrt{(y_1 - z_1)^2 + (y_2 - z_2)^2 + ... + (y_D - z_D)^2}.\n\nHow many pairs (i, j) (i < j) are there such that the distance between the i-th point and the j-th point is an integer?\n\nConstraints\n\nAll values in input are integers.\n\n2 \\leq N \\leq 10\n\n1 \\leq D \\leq 10\n\n-20 \\leq X_{ij} \\leq 20\n\nNo two given points have the same coordinates. That is, if i \\neq j, there exists k such that X_{ik} \\neq X_{jk}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN D\nX_{11} X_{12} ... X_{1D}\nX_{21} X_{22} ... X_{2D}\n\\vdots\nX_{N1} X_{N2} ... X_{ND}\n\nOutput\n\nPrint the number of pairs (i, j) (i < j) such that the distance between the i-th point and the j-th point is an integer.\n\nSample Input 1\n\n3 2\n1 2\n5 5\n-2 8\n\nSample Output 1\n\n1\n\nThe number of pairs with an integer distance is one, as follows:\n\nThe distance between the first point and the second point is \\sqrt{|1-5|^2 + |2-5|^2} = 5, which is an integer.\n\nThe distance between the second point and the third point is \\sqrt{|5-(-2)|^2 + |5-8|^2} = \\sqrt{58}, which is not an integer.\n\nThe distance between the third point and the first point is \\sqrt{|-2-1|^2+|8-2|^2} = 3\\sqrt{5}, which is not an integer.\n\nSample Input 2\n\n3 4\n-3 7 8 2\n-12 1 10 2\n-2 8 9 3\n\nSample Output 2\n\n2\n\nSample Input 3\n\n5 1\n1\n2\n3\n4\n5\n\nSample Output 3\n\n10", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 449, "memory_kb": 118956}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s940079710", "group_id": "codeNet:p02986", "input_text": "const lines=readlines()\nparseInt(s)=map(x->parse(Int,x),split(s))\nconst N,Q=parseInt(shift!(lines))\nconst G=[Tuple{Int,Int,Int}[] for _=1:N]\nfunction init()\n\tfor _=2:N\n\t\ta,b,c,d=parseInt(shift!(lines))\n\t\tpush!(G[a],(b,c,d))\n\t\tpush!(G[b],(a,c,d))\n\tend\nend\ninit()\nconst depth=zeros(Int,N)\nconst parent=[zeros(Int,N) for _=1:18]\nconst tour=Pair{Int,Int}[]\nconst L=zeros(Int,N)\nfunction dfs(u,p,de)\n\tdepth[u]=de\n\tparent[1][u]=p\n\tL[u]=length(tour)+1\n\tfor (v,c,d)=G[u]\n\t\tif v!=p\n\t\t\tpush!(tour,c=>d)\n\t\t\tdfs(v,u,de+1)\n\t\t\tpush!(tour,c=>-d)\n\t\tend\n\tend\nend\ndfs(1,0,0)\nconst edge=[Int[] for _=1:N-1]\nconst edgesum=[Int[0] for _=1:N-1]\nconst edgecnt=[Int[0] for _=1:N-1]\nfunction edgeinit()\n\tnow=zeros(Int,N-1)\n\tcnt=zeros(Int,N-1)\n\tfor i=1:length(tour)\n\t\tc,d=tour[i]\n\t\tcnt[c]+=d>0?1:-1\n\t\tnow[c]+=d\n\t\tpush!(edge[c],i)\n\t\tpush!(edgesum[c],now[c])\n\t\tpush!(edgecnt[c],cnt[c])\n\tend\nend\nedgeinit()\nconst cumsum=Int[0]\nfunction cumsuminit()\n\tnow=0\n\tfor (c,d)=tour\n\t\tpush!(cumsum,now+=d)\n\tend\nend\ncumsuminit()\nfunction lca(u,v)\n\tif depth[u]>depth[v]\n\t\tu,v=v,u\n\tend\n\tfor k=1:18\n\t\tif ((depth[v]-depth[u])>>(k-1))%2==1\n\t\t\tv=parent[k][v]\n\t\tend\n\tend\n\tif u==v\n\t\treturn u\n\tend\n\tfor k=18:-1:1\n\t\tif parent[k][u]!=parent[k][v]\n\t\t\tu=parent[k][u]\n\t\t\tv=parent[k][v]\n\t\tend\n\tend\n\tparent[1][u]\nend\nfunction lcainit()\n\tfor k=2:18\n\t\tfor i=1:N\n\t\t\tif parent[k-1][i]>0\n\t\t\t\tparent[k][i]=parent[k-1][parent[k-1][i]]\n\t\t\telse\n\t\t\t\tparent[k][i]=0\n\t\t\tend\n\t\tend\n\tend\nend\nlcainit()\nfunction bsearch(A,x)\n\tL=0\n\tR=length(A)\n\twhile R-L>1\n\t\tM=div(L+R,2)\n\t\tif A[M]>=x\n\t\t\tR=M\n\t\telse\n\t\t\tL=M\n\t\tend\n\tend\n\tL\nend\nfunction get(l,r,c)\n\tlid=bsearch(edge[c],l)\n\trid=bsearch(edge[c],r)\n\tedgecnt[c][rid+1]-edgecnt[c][lid+1],edgesum[c][rid+1]-edgesum[c][lid+1]\nend\nfunction calc(u,v,x,y)\n\tflag=false\n\tif L[u]>L[v]\n\t\tu,v=v,u\n\t\tflag=true\n\tend\n\tret=cumsum[L[v]]-cumsum[L[u]]\n\tcnt,sum=get(L[u],L[v],x)\n\tret-=sum\n\tret+=cnt*y\n\tif flag\n\t\tret=-ret\n\tend\n\tret\nend\nfunction query(u,v,x,y)\n\tpa=lca(u,v)\n\tcalc(pa,u,x,y)+calc(pa,v,x,y)\nend\nfunction solve()\n\tfor s=lines\n\t\tx,y,u,v=parseInt(s)\n\t\tprintln(query(u,v,x,y))\n\tend\nend\nsolve()\n", "language": "Julia", "metadata": {"date": 1562567317, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02986.html", "problem_id": "p02986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02986/input.txt", "sample_output_relpath": "derived/input_output/data/p02986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02986/Julia/s940079710.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s940079710", "user_id": "u657913472"}, "prompt_components": {"gold_output": "130\n200\n60\n", "input_to_evaluate": "const lines=readlines()\nparseInt(s)=map(x->parse(Int,x),split(s))\nconst N,Q=parseInt(shift!(lines))\nconst G=[Tuple{Int,Int,Int}[] for _=1:N]\nfunction init()\n\tfor _=2:N\n\t\ta,b,c,d=parseInt(shift!(lines))\n\t\tpush!(G[a],(b,c,d))\n\t\tpush!(G[b],(a,c,d))\n\tend\nend\ninit()\nconst depth=zeros(Int,N)\nconst parent=[zeros(Int,N) for _=1:18]\nconst tour=Pair{Int,Int}[]\nconst L=zeros(Int,N)\nfunction dfs(u,p,de)\n\tdepth[u]=de\n\tparent[1][u]=p\n\tL[u]=length(tour)+1\n\tfor (v,c,d)=G[u]\n\t\tif v!=p\n\t\t\tpush!(tour,c=>d)\n\t\t\tdfs(v,u,de+1)\n\t\t\tpush!(tour,c=>-d)\n\t\tend\n\tend\nend\ndfs(1,0,0)\nconst edge=[Int[] for _=1:N-1]\nconst edgesum=[Int[0] for _=1:N-1]\nconst edgecnt=[Int[0] for _=1:N-1]\nfunction edgeinit()\n\tnow=zeros(Int,N-1)\n\tcnt=zeros(Int,N-1)\n\tfor i=1:length(tour)\n\t\tc,d=tour[i]\n\t\tcnt[c]+=d>0?1:-1\n\t\tnow[c]+=d\n\t\tpush!(edge[c],i)\n\t\tpush!(edgesum[c],now[c])\n\t\tpush!(edgecnt[c],cnt[c])\n\tend\nend\nedgeinit()\nconst cumsum=Int[0]\nfunction cumsuminit()\n\tnow=0\n\tfor (c,d)=tour\n\t\tpush!(cumsum,now+=d)\n\tend\nend\ncumsuminit()\nfunction lca(u,v)\n\tif depth[u]>depth[v]\n\t\tu,v=v,u\n\tend\n\tfor k=1:18\n\t\tif ((depth[v]-depth[u])>>(k-1))%2==1\n\t\t\tv=parent[k][v]\n\t\tend\n\tend\n\tif u==v\n\t\treturn u\n\tend\n\tfor k=18:-1:1\n\t\tif parent[k][u]!=parent[k][v]\n\t\t\tu=parent[k][u]\n\t\t\tv=parent[k][v]\n\t\tend\n\tend\n\tparent[1][u]\nend\nfunction lcainit()\n\tfor k=2:18\n\t\tfor i=1:N\n\t\t\tif parent[k-1][i]>0\n\t\t\t\tparent[k][i]=parent[k-1][parent[k-1][i]]\n\t\t\telse\n\t\t\t\tparent[k][i]=0\n\t\t\tend\n\t\tend\n\tend\nend\nlcainit()\nfunction bsearch(A,x)\n\tL=0\n\tR=length(A)\n\twhile R-L>1\n\t\tM=div(L+R,2)\n\t\tif A[M]>=x\n\t\t\tR=M\n\t\telse\n\t\t\tL=M\n\t\tend\n\tend\n\tL\nend\nfunction get(l,r,c)\n\tlid=bsearch(edge[c],l)\n\trid=bsearch(edge[c],r)\n\tedgecnt[c][rid+1]-edgecnt[c][lid+1],edgesum[c][rid+1]-edgesum[c][lid+1]\nend\nfunction calc(u,v,x,y)\n\tflag=false\n\tif L[u]>L[v]\n\t\tu,v=v,u\n\t\tflag=true\n\tend\n\tret=cumsum[L[v]]-cumsum[L[u]]\n\tcnt,sum=get(L[u],L[v],x)\n\tret-=sum\n\tret+=cnt*y\n\tif flag\n\t\tret=-ret\n\tend\n\tret\nend\nfunction query(u,v,x,y)\n\tpa=lca(u,v)\n\tcalc(pa,u,x,y)+calc(pa,v,x,y)\nend\nfunction solve()\n\tfor s=lines\n\t\tx,y,u,v=parseInt(s)\n\t\tprintln(query(u,v,x,y))\n\tend\nend\nsolve()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere is a tree with N vertices numbered 1 to N.\nThe i-th edge in this tree connects Vertex a_i and Vertex b_i, and the color and length of that edge are c_i and d_i, respectively.\nHere the color of each edge is represented by an integer between 1 and N-1 (inclusive). The same integer corresponds to the same color, and different integers correspond to different colors.\n\nAnswer the following Q queries:\n\nQuery j (1 \\leq j \\leq Q): assuming that the length of every edge whose color is x_j is changed to y_j, find the distance between Vertex u_j and Vertex v_j. (The changes of the lengths of edges do not affect the subsequent queries.)\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq a_i, b_i \\leq N\n\n1 \\leq c_i \\leq N-1\n\n1 \\leq d_i \\leq 10^4\n\n1 \\leq x_j \\leq N-1\n\n1 \\leq y_j \\leq 10^4\n\n1 \\leq u_j < v_j \\leq N\n\nThe given graph is a tree.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\na_1 b_1 c_1 d_1\n:\na_{N-1} b_{N-1} c_{N-1} d_{N-1}\nx_1 y_1 u_1 v_1\n:\nx_Q y_Q u_Q v_Q\n\nOutput\n\nPrint Q lines. The j-th line (1 \\leq j \\leq Q) should contain the answer to Query j.\n\nSample Input 1\n\n5 3\n1 2 1 10\n1 3 2 20\n2 4 4 30\n5 2 1 40\n1 100 1 4\n1 100 1 5\n3 1000 3 4\n\nSample Output 1\n\n130\n200\n60\n\nThe graph in this input is as follows:\n\nHere the edges of Color 1 are shown as solid red lines, the edge of Color 2 is shown as a bold green line, and the edge of Color 4 is shown as a blue dashed line.\n\nQuery 1: Assuming that the length of every edge whose color is 1 is changed to 100, the distance between Vertex 1 and Vertex 4 is 100 + 30 = 130.\n\nQuery 2: Assuming that the length of every edge whose color is 1 is changed to 100, the distance between Vertex 1 and Vertex 5 is 100 + 100 = 200.\n\nQuery 3: Assuming that the length of every edge whose color is 3 is changed to 1000 (there is no such edge), the distance between Vertex 3 and Vertex 4 is 20 + 10 + 30 = 60. Note that the edges of Color 1 now have their original lengths.", "sample_input": "5 3\n1 2 1 10\n1 3 2 20\n2 4 4 30\n5 2 1 40\n1 100 1 4\n1 100 1 5\n3 1000 3 4\n"}, "reference_outputs": ["130\n200\n60\n"], "source_document_id": "p02986", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere is a tree with N vertices numbered 1 to N.\nThe i-th edge in this tree connects Vertex a_i and Vertex b_i, and the color and length of that edge are c_i and d_i, respectively.\nHere the color of each edge is represented by an integer between 1 and N-1 (inclusive). The same integer corresponds to the same color, and different integers correspond to different colors.\n\nAnswer the following Q queries:\n\nQuery j (1 \\leq j \\leq Q): assuming that the length of every edge whose color is x_j is changed to y_j, find the distance between Vertex u_j and Vertex v_j. (The changes of the lengths of edges do not affect the subsequent queries.)\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq a_i, b_i \\leq N\n\n1 \\leq c_i \\leq N-1\n\n1 \\leq d_i \\leq 10^4\n\n1 \\leq x_j \\leq N-1\n\n1 \\leq y_j \\leq 10^4\n\n1 \\leq u_j < v_j \\leq N\n\nThe given graph is a tree.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\na_1 b_1 c_1 d_1\n:\na_{N-1} b_{N-1} c_{N-1} d_{N-1}\nx_1 y_1 u_1 v_1\n:\nx_Q y_Q u_Q v_Q\n\nOutput\n\nPrint Q lines. The j-th line (1 \\leq j \\leq Q) should contain the answer to Query j.\n\nSample Input 1\n\n5 3\n1 2 1 10\n1 3 2 20\n2 4 4 30\n5 2 1 40\n1 100 1 4\n1 100 1 5\n3 1000 3 4\n\nSample Output 1\n\n130\n200\n60\n\nThe graph in this input is as follows:\n\nHere the edges of Color 1 are shown as solid red lines, the edge of Color 2 is shown as a bold green line, and the edge of Color 4 is shown as a blue dashed line.\n\nQuery 1: Assuming that the length of every edge whose color is 1 is changed to 100, the distance between Vertex 1 and Vertex 4 is 100 + 30 = 130.\n\nQuery 2: Assuming that the length of every edge whose color is 1 is changed to 100, the distance between Vertex 1 and Vertex 5 is 100 + 100 = 200.\n\nQuery 3: Assuming that the length of every edge whose color is 3 is changed to 1000 (there is no such edge), the distance between Vertex 3 and Vertex 4 is 20 + 10 + 30 = 60. Note that the edges of Color 1 now have their original lengths.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2051, "cpu_time_ms": 1756, "memory_kb": 285596}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s138685088", "group_id": "codeNet:p02987", "input_text": "function main()\n \n S = split(chomp(readline()),\"\")\n \n sort!(S)\n \n if S[1]*S[3] == S[2]*S[4]\n println(\"Yes\")\n else\n println(\"No\")\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1579657677, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s138685088.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s138685088", "user_id": "u790457721"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n \n S = split(chomp(readline()),\"\")\n \n sort!(S)\n \n if S[1]*S[3] == S[2]*S[4]\n println(\"Yes\")\n else\n println(\"No\")\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 162, "cpu_time_ms": 823, "memory_kb": 167944}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s642024627", "group_id": "codeNet:p02987", "input_text": "show(length(Set(readline()))==3?\"Yes\":\"No\")", "language": "Julia", "metadata": {"date": 1561864132, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s642024627.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s642024627", "user_id": "u729133443"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "show(length(Set(readline()))==3?\"Yes\":\"No\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 326, "memory_kb": 112140}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s162664697", "group_id": "codeNet:p02987", "input_text": "cnt=zeros(Int,114514)\nc=0\nfor s=chomp(readline())\n\tc+=(cnt[Int(s)]+=1)==2\nend\nprintln(c==2?\"Yes\":\"No\")\n", "language": "Julia", "metadata": {"date": 1561859926, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s162664697.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s162664697", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "cnt=zeros(Int,114514)\nc=0\nfor s=chomp(readline())\n\tc+=(cnt[Int(s)]+=1)==2\nend\nprintln(c==2?\"Yes\":\"No\")\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 103, "cpu_time_ms": 738, "memory_kb": 163268}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s288993054", "group_id": "codeNet:p02987", "input_text": "str = readline();\narr = split(str, \"\");\nsort!(arr)\nif (arr[1] == arr[2] && arr[3] == arr[4] && arr[1] != arr[3])\n println(\"Yes\")\nelse\n println(\"No\")\nend", "language": "Julia", "metadata": {"date": 1561859608, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s288993054.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s288993054", "user_id": "u505825680"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "str = readline();\narr = split(str, \"\");\nsort!(arr)\nif (arr[1] == arr[2] && arr[3] == arr[4] && arr[1] != arr[3])\n println(\"Yes\")\nelse\n println(\"No\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 158, "cpu_time_ms": 990, "memory_kb": 170440}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s849792870", "group_id": "codeNet:p02988", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n p=parseMap(split(readline()))\n ans=0\n for i in 3:n\n if maximum(p[i-2:i])!=p[i-1] && minimum(p[i-2:i])!=p[i-1]\n ans+=1\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1582833561, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s849792870.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s849792870", "user_id": "u619197965"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n p=parseMap(split(readline()))\n ans=0\n for i in 3:n\n if maximum(p[i-2:i])!=p[i-1] && minimum(p[i-2:i])!=p[i-1]\n ans+=1\n end\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 458, "memory_kb": 113748}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s785591189", "group_id": "codeNet:p02988", "input_text": "parseInt(x) = parse(Int,x)\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n = parseInt(readline())\n p = map(parseInt,split(readline()))\n k=0\n for i=2:(n-1)\n if p[i-1] >= p[i] >= p[i+1]\n if p[i+1] >= p[i] >= p[i-1]\n k = k+1\n end\n end\n end\n println(k)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1561856817, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s785591189.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s785591189", "user_id": "u709180765"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n n = parseInt(readline())\n p = map(parseInt,split(readline()))\n k=0\n for i=2:(n-1)\n if p[i-1] >= p[i] >= p[i+1]\n if p[i+1] >= p[i] >= p[i-1]\n k = k+1\n end\n end\n end\n println(k)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1072, "memory_kb": 121788}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s976207443", "group_id": "codeNet:p02989", "input_text": "n=parse(readline())\nd=sort(parse.(split(readline())))\nshow(d[n÷2+1]-d[n÷2])", "language": "Julia", "metadata": {"date": 1561874018, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s976207443.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s976207443", "user_id": "u729133443"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n=parse(readline())\nd=sort(parse.(split(readline())))\nshow(d[n÷2+1]-d[n÷2])", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2113, "memory_kb": 171756}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s880069863", "group_id": "codeNet:p02990", "input_text": "n, k = map(x->parse(BigInt,x),split(readline()))\nfor i = 1:k\n println(binomial(n-k+1,i)*binomial(k-1,i-1)%(10^9+7))\nend\n", "language": "Julia", "metadata": {"date": 1562085434, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Julia/s880069863.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s880069863", "user_id": "u081445141"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "n, k = map(x->parse(BigInt,x),split(readline()))\nfor i = 1:k\n println(binomial(n-k+1,i)*binomial(k-1,i-1)%(10^9+7))\nend\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 478, "memory_kb": 115832}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s257188637", "group_id": "codeNet:p02990", "input_text": "parseInt(x::SubString{String}) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction abmp(a,b,p);if b==0;1;elseif b%2==0;k=abmp(a,div(b,2),p);(k*k)%p;else;(a*abmp(a,b-1,p))%p;end;end;;\nfunction binarr(n,p);z=1;for i in 1:n;z=z*i%p;end;fac=Array{Int}(n+1);inv=Array{Int}(n+1);inv[n+1]=abmp(z,p-2,p)\nfor i in 0:n-1;inv[n-i]=(inv[n+1-i]*(n-i))%p;end;for i in 0:n;fac[i+1]=(((z*inv[i+1])%p)*inv[n+1-i])%p;end;fac;end;\n\nfunction main()\n\tp = 1000000007\n\tn,k = readline() |> split |> parseMap\n\ta = binarr(n-k+1,p)\n\tb = binarr(k-1,p)\n\tfor i in 1:min(k,n-k+1)\n\t\tprintln(a[i+1]*b[i]%p)\n\tend\n\tif k>n-k+1\n\t\tfor i in n-k+2:k\n\t\t\tprintln(b[i])\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1561862731, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02990.html", "problem_id": "p02990", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02990/input.txt", "sample_output_relpath": "derived/input_output/data/p02990/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02990/Julia/s257188637.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s257188637", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n6\n1\n", "input_to_evaluate": "parseInt(x::SubString{String}) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction abmp(a,b,p);if b==0;1;elseif b%2==0;k=abmp(a,div(b,2),p);(k*k)%p;else;(a*abmp(a,b-1,p))%p;end;end;;\nfunction binarr(n,p);z=1;for i in 1:n;z=z*i%p;end;fac=Array{Int}(n+1);inv=Array{Int}(n+1);inv[n+1]=abmp(z,p-2,p)\nfor i in 0:n-1;inv[n-i]=(inv[n+1-i]*(n-i))%p;end;for i in 0:n;fac[i+1]=(((z*inv[i+1])%p)*inv[n+1-i])%p;end;fac;end;\n\nfunction main()\n\tp = 1000000007\n\tn,k = readline() |> split |> parseMap\n\ta = binarr(n-k+1,p)\n\tb = binarr(k-1,p)\n\tfor i in 1:min(k,n-k+1)\n\t\tprintln(a[i+1]*b[i]%p)\n\tend\n\tif k>n-k+1\n\t\tfor i in n-k+2:k\n\t\t\tprintln(b[i])\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "sample_input": "5 3\n"}, "reference_outputs": ["3\n6\n1\n"], "source_document_id": "p02990", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls.\n\nFirst, Snuke will arrange the N balls in a row from left to right.\n\nThen, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive blue balls. He will collect all the blue balls in the fewest moves possible.\n\nHow many ways are there for Snuke to arrange the N balls in a row so that Takahashi will need exactly i moves to collect all the blue balls? Compute this number modulo 10^9+7 for each i such that 1 \\leq i \\leq K.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 2000\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint K lines. The i-th line (1 \\leq i \\leq K) should contain the number of ways to arrange the N balls so that Takahashi will need exactly i moves to collect all the blue balls, modulo 10^9+7.\n\nSample Input 1\n\n5 3\n\nSample Output 1\n\n3\n6\n1\n\nThere are three ways to arrange the balls so that Takahashi will need exactly one move: (B, B, B, R, R), (R, B, B, B, R), and (R, R, B, B, B). (R and B stands for red and blue, respectively).\n\nThere are six ways to arrange the balls so that Takahashi will need exactly two moves: (B, B, R, B, R), (B, B, R, R, B), (R, B, B, R, B), (R, B, R, B, B), (B, R, B, B, R), and (B, R, R, B, B).\n\nThere is one way to arrange the balls so that Takahashi will need exactly three moves: (B, R, B, R, B).\n\nSample Input 2\n\n2000 3\n\nSample Output 2\n\n1998\n3990006\n327341989\n\nBe sure to print the numbers of arrangements modulo 10^9+7.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 840, "memory_kb": 168508}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s232766720", "group_id": "codeNet:p02991", "input_text": "const lines=readlines()\ninput()=shift!(lines)\nint(x)=parse(Int,x)\nfunction intLine()\n s=input()|>split\n int(s[1]),int(s[2])\nend\nfunction bfs(n,e,s,t)\n f=ones(Int,(n,3))*-3\n f[s,1]=0\n q=Array{Pair{Int,Int}}([s=>1])\n while !isempty(q)\n v,m=shift!(q)\n u=m>2?1:m+1\n for w=e[v]\n if f[w,u]<0\n f[w,u]=f[v,m]+1\n push!(q,w=>u)\n end\n end\n end\n f[t,1]÷3\nend\nfunction main()\n n,m=intLine()\n e=Array{Int,1}[[]for i=1:n]\n for i=1:m\n u,v=intLine()\n push!(e[u],v)\n end\n s,t=intLine()\n show(bfs(n,e,s,t))\nend\nmain()", "language": "Julia", "metadata": {"date": 1562004455, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02991.html", "problem_id": "p02991", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02991/input.txt", "sample_output_relpath": "derived/input_output/data/p02991/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02991/Julia/s232766720.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s232766720", "user_id": "u729133443"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "const lines=readlines()\ninput()=shift!(lines)\nint(x)=parse(Int,x)\nfunction intLine()\n s=input()|>split\n int(s[1]),int(s[2])\nend\nfunction bfs(n,e,s,t)\n f=ones(Int,(n,3))*-3\n f[s,1]=0\n q=Array{Pair{Int,Int}}([s=>1])\n while !isempty(q)\n v,m=shift!(q)\n u=m>2?1:m+1\n for w=e[v]\n if f[w,u]<0\n f[w,u]=f[v,m]+1\n push!(q,w=>u)\n end\n end\n end\n f[t,1]÷3\nend\nfunction main()\n n,m=intLine()\n e=Array{Int,1}[[]for i=1:n]\n for i=1:m\n u,v=intLine()\n push!(e[u],v)\n end\n s,t=intLine()\n show(bfs(n,e,s,t))\nend\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nKen loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G.\nG consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.\n\nFirst, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken-ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.\n\nDetermine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq M \\leq \\min(10^5, N (N-1))\n\n1 \\leq u_i, v_i \\leq N(1 \\leq i \\leq M)\n\nu_i \\neq v_i (1 \\leq i \\leq M)\n\nIf i \\neq j, (u_i, v_i) \\neq (u_j, v_j).\n\n1 \\leq S, T \\leq N\n\nS \\neq T\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nu_1 v_1\n:\nu_M v_M\nS T\n\nOutput\n\nIf Ken cannot reach Vertex T from Vertex S by repeating ken-ken-pa, print -1.\nIf he can, print the minimum number of ken-ken-pa needed to reach vertex T.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 1\n1 3\n\nSample Output 1\n\n2\n\nKen can reach Vertex 3 from Vertex 1 in two ken-ken-pa, as follows: 1 \\rightarrow 2 \\rightarrow 3 \\rightarrow 4 in the first ken-ken-pa, then 4 \\rightarrow 1 \\rightarrow 2 \\rightarrow 3 in the second ken-ken-pa. This is the minimum number of ken-ken-pa needed.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n3 1\n1 2\n\nSample Output 2\n\n-1\n\nAny number of ken-ken-pa will bring Ken back to Vertex 1, so he cannot reach Vertex 2, though he can pass through it in the middle of a ken-ken-pa.\n\nSample Input 3\n\n2 0\n1 2\n\nSample Output 3\n\n-1\n\nVertex S and Vertex T may be disconnected.\n\nSample Input 4\n\n6 8\n1 2\n2 3\n3 4\n4 5\n5 1\n1 4\n1 5\n4 6\n1 6\n\nSample Output 4\n\n2", "sample_input": "4 4\n1 2\n2 3\n3 4\n4 1\n1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02991", "source_text": "Score : 500 points\n\nProblem Statement\n\nKen loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G.\nG consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.\n\nFirst, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken-ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.\n\nDetermine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq M \\leq \\min(10^5, N (N-1))\n\n1 \\leq u_i, v_i \\leq N(1 \\leq i \\leq M)\n\nu_i \\neq v_i (1 \\leq i \\leq M)\n\nIf i \\neq j, (u_i, v_i) \\neq (u_j, v_j).\n\n1 \\leq S, T \\leq N\n\nS \\neq T\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nu_1 v_1\n:\nu_M v_M\nS T\n\nOutput\n\nIf Ken cannot reach Vertex T from Vertex S by repeating ken-ken-pa, print -1.\nIf he can, print the minimum number of ken-ken-pa needed to reach vertex T.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 1\n1 3\n\nSample Output 1\n\n2\n\nKen can reach Vertex 3 from Vertex 1 in two ken-ken-pa, as follows: 1 \\rightarrow 2 \\rightarrow 3 \\rightarrow 4 in the first ken-ken-pa, then 4 \\rightarrow 1 \\rightarrow 2 \\rightarrow 3 in the second ken-ken-pa. This is the minimum number of ken-ken-pa needed.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n3 1\n1 2\n\nSample Output 2\n\n-1\n\nAny number of ken-ken-pa will bring Ken back to Vertex 1, so he cannot reach Vertex 2, though he can pass through it in the middle of a ken-ken-pa.\n\nSample Input 3\n\n2 0\n1 2\n\nSample Output 3\n\n-1\n\nVertex S and Vertex T may be disconnected.\n\nSample Input 4\n\n6 8\n1 2\n2 3\n3 4\n4 5\n5 1\n1 4\n1 5\n4 6\n1 6\n\nSample Output 4\n\n2", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 635, "cpu_time_ms": 669, "memory_kb": 165044}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s214462142", "group_id": "codeNet:p02991", "input_text": "parseInt(x::SubString{String}) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction hpush(h::Array{Tuple{Int,Int},1},x::Tuple{Int,Int})\n\tpush!(h,x)\n\tif length(h) > 1\n\t\tl = length(h)\n\t\tk = div(l,2)\n\t\twhile h[k][2]>x[2]&&k>=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(div(k,2),1)\n\t\t\tl = div(l,2)\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Tuple{Int,Int},1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>=l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>=l\n\t\t\t\tif h[2*k][2]>=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k][2]>=z[2]&&h[2*k+1][2]>=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k][2] split |> parseMap\n\te = [Int[] for i in 1:3*n]\n\tfor i in 1:m\n\t\tu,v = readline() |> split |> parseMap\n\t\tpush!(e[u],n+v)\n\t\tpush!(e[n+u],2*n+v)\n\t\tpush!(e[2*n+u],v)\n\tend\n\ts,t = readline() |> split |> parseMap\n\tdis = -ones(Int,3*n)\n\th = Array{Tuple{Int,Int},1}()\n\tpush!(h,(s,0))\n\twhile !isempty(h)\n\t\tv,w = hpop(h)\n\t\tif v == t\n\t\t\tbreak\n\t\tend\n\t\tfor i in 1:length(e[v])\n\t\t\tif dis[e[v][i]]<0 || dis[e[v][i]]>w+1\n\t\t\t\tdis[e[v][i]] = w+1\n\t\t\t\thpush(h,(e[v][i],w+1))\n\t\t\tend\n\t\tend\n\tend\n\tprintln(dis[t]>=0?div(dis[t],3):-1)\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1561987972, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02991.html", "problem_id": "p02991", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02991/input.txt", "sample_output_relpath": "derived/input_output/data/p02991/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02991/Julia/s214462142.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s214462142", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x::SubString{String}) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction hpush(h::Array{Tuple{Int,Int},1},x::Tuple{Int,Int})\n\tpush!(h,x)\n\tif length(h) > 1\n\t\tl = length(h)\n\t\tk = div(l,2)\n\t\twhile h[k][2]>x[2]&&k>=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(div(k,2),1)\n\t\t\tl = div(l,2)\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Tuple{Int,Int},1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>=l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>=l\n\t\t\t\tif h[2*k][2]>=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k][2]>=z[2]&&h[2*k+1][2]>=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k][2] split |> parseMap\n\te = [Int[] for i in 1:3*n]\n\tfor i in 1:m\n\t\tu,v = readline() |> split |> parseMap\n\t\tpush!(e[u],n+v)\n\t\tpush!(e[n+u],2*n+v)\n\t\tpush!(e[2*n+u],v)\n\tend\n\ts,t = readline() |> split |> parseMap\n\tdis = -ones(Int,3*n)\n\th = Array{Tuple{Int,Int},1}()\n\tpush!(h,(s,0))\n\twhile !isempty(h)\n\t\tv,w = hpop(h)\n\t\tif v == t\n\t\t\tbreak\n\t\tend\n\t\tfor i in 1:length(e[v])\n\t\t\tif dis[e[v][i]]<0 || dis[e[v][i]]>w+1\n\t\t\t\tdis[e[v][i]] = w+1\n\t\t\t\thpush(h,(e[v][i],w+1))\n\t\t\tend\n\t\tend\n\tend\n\tprintln(dis[t]>=0?div(dis[t],3):-1)\n\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nKen loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G.\nG consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.\n\nFirst, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken-ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.\n\nDetermine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq M \\leq \\min(10^5, N (N-1))\n\n1 \\leq u_i, v_i \\leq N(1 \\leq i \\leq M)\n\nu_i \\neq v_i (1 \\leq i \\leq M)\n\nIf i \\neq j, (u_i, v_i) \\neq (u_j, v_j).\n\n1 \\leq S, T \\leq N\n\nS \\neq T\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nu_1 v_1\n:\nu_M v_M\nS T\n\nOutput\n\nIf Ken cannot reach Vertex T from Vertex S by repeating ken-ken-pa, print -1.\nIf he can, print the minimum number of ken-ken-pa needed to reach vertex T.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 1\n1 3\n\nSample Output 1\n\n2\n\nKen can reach Vertex 3 from Vertex 1 in two ken-ken-pa, as follows: 1 \\rightarrow 2 \\rightarrow 3 \\rightarrow 4 in the first ken-ken-pa, then 4 \\rightarrow 1 \\rightarrow 2 \\rightarrow 3 in the second ken-ken-pa. This is the minimum number of ken-ken-pa needed.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n3 1\n1 2\n\nSample Output 2\n\n-1\n\nAny number of ken-ken-pa will bring Ken back to Vertex 1, so he cannot reach Vertex 2, though he can pass through it in the middle of a ken-ken-pa.\n\nSample Input 3\n\n2 0\n1 2\n\nSample Output 3\n\n-1\n\nVertex S and Vertex T may be disconnected.\n\nSample Input 4\n\n6 8\n1 2\n2 3\n3 4\n4 5\n5 1\n1 4\n1 5\n4 6\n1 6\n\nSample Output 4\n\n2", "sample_input": "4 4\n1 2\n2 3\n3 4\n4 1\n1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02991", "source_text": "Score : 500 points\n\nProblem Statement\n\nKen loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G.\nG consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.\n\nFirst, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken-ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.\n\nDetermine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq M \\leq \\min(10^5, N (N-1))\n\n1 \\leq u_i, v_i \\leq N(1 \\leq i \\leq M)\n\nu_i \\neq v_i (1 \\leq i \\leq M)\n\nIf i \\neq j, (u_i, v_i) \\neq (u_j, v_j).\n\n1 \\leq S, T \\leq N\n\nS \\neq T\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nu_1 v_1\n:\nu_M v_M\nS T\n\nOutput\n\nIf Ken cannot reach Vertex T from Vertex S by repeating ken-ken-pa, print -1.\nIf he can, print the minimum number of ken-ken-pa needed to reach vertex T.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 1\n1 3\n\nSample Output 1\n\n2\n\nKen can reach Vertex 3 from Vertex 1 in two ken-ken-pa, as follows: 1 \\rightarrow 2 \\rightarrow 3 \\rightarrow 4 in the first ken-ken-pa, then 4 \\rightarrow 1 \\rightarrow 2 \\rightarrow 3 in the second ken-ken-pa. This is the minimum number of ken-ken-pa needed.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n3 1\n1 2\n\nSample Output 2\n\n-1\n\nAny number of ken-ken-pa will bring Ken back to Vertex 1, so he cannot reach Vertex 2, though he can pass through it in the middle of a ken-ken-pa.\n\nSample Input 3\n\n2 0\n1 2\n\nSample Output 3\n\n-1\n\nVertex S and Vertex T may be disconnected.\n\nSample Input 4\n\n6 8\n1 2\n2 3\n3 4\n4 5\n5 1\n1 4\n1 5\n4 6\n1 6\n\nSample Output 4\n\n2", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1399, "cpu_time_ms": 832, "memory_kb": 166464}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s763628615", "group_id": "codeNet:p02991", "input_text": "const lines=readlines()\ninput()=shift!(lines)\nint(x)=parse(Int,x)\nintLine()=map(int,split(input()))\nfunction inE(e)\n u,v=intLine()\n push!(e[u],v)\nend\nfunction main()\n n,m=intLine()\n e=Array{Int,1}[[]for i=1:n]\n for i=1:m;inE(e);end\n s,t=intLine()\n f=ones(Int,(n,3))*-3\n f[s,1]=0\n q=Array{Int,1}[[s,1]]\n while !isempty(q)\n v,m=shift!(q)\n u=m>2?1:m+1\n for w=e[v]\n if f[w,u]<0\n f[w,u]=f[v,m]+1\n push!(q,[w,u])\n end\n end\n end\n show(f[t,1]÷3)\nend\nmain()", "language": "Julia", "metadata": {"date": 1561976282, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02991.html", "problem_id": "p02991", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02991/input.txt", "sample_output_relpath": "derived/input_output/data/p02991/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02991/Julia/s763628615.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s763628615", "user_id": "u729133443"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "const lines=readlines()\ninput()=shift!(lines)\nint(x)=parse(Int,x)\nintLine()=map(int,split(input()))\nfunction inE(e)\n u,v=intLine()\n push!(e[u],v)\nend\nfunction main()\n n,m=intLine()\n e=Array{Int,1}[[]for i=1:n]\n for i=1:m;inE(e);end\n s,t=intLine()\n f=ones(Int,(n,3))*-3\n f[s,1]=0\n q=Array{Int,1}[[s,1]]\n while !isempty(q)\n v,m=shift!(q)\n u=m>2?1:m+1\n for w=e[v]\n if f[w,u]<0\n f[w,u]=f[v,m]+1\n push!(q,[w,u])\n end\n end\n end\n show(f[t,1]÷3)\nend\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nKen loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G.\nG consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.\n\nFirst, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken-ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.\n\nDetermine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq M \\leq \\min(10^5, N (N-1))\n\n1 \\leq u_i, v_i \\leq N(1 \\leq i \\leq M)\n\nu_i \\neq v_i (1 \\leq i \\leq M)\n\nIf i \\neq j, (u_i, v_i) \\neq (u_j, v_j).\n\n1 \\leq S, T \\leq N\n\nS \\neq T\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nu_1 v_1\n:\nu_M v_M\nS T\n\nOutput\n\nIf Ken cannot reach Vertex T from Vertex S by repeating ken-ken-pa, print -1.\nIf he can, print the minimum number of ken-ken-pa needed to reach vertex T.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 1\n1 3\n\nSample Output 1\n\n2\n\nKen can reach Vertex 3 from Vertex 1 in two ken-ken-pa, as follows: 1 \\rightarrow 2 \\rightarrow 3 \\rightarrow 4 in the first ken-ken-pa, then 4 \\rightarrow 1 \\rightarrow 2 \\rightarrow 3 in the second ken-ken-pa. This is the minimum number of ken-ken-pa needed.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n3 1\n1 2\n\nSample Output 2\n\n-1\n\nAny number of ken-ken-pa will bring Ken back to Vertex 1, so he cannot reach Vertex 2, though he can pass through it in the middle of a ken-ken-pa.\n\nSample Input 3\n\n2 0\n1 2\n\nSample Output 3\n\n-1\n\nVertex S and Vertex T may be disconnected.\n\nSample Input 4\n\n6 8\n1 2\n2 3\n3 4\n4 5\n5 1\n1 4\n1 5\n4 6\n1 6\n\nSample Output 4\n\n2", "sample_input": "4 4\n1 2\n2 3\n3 4\n4 1\n1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02991", "source_text": "Score : 500 points\n\nProblem Statement\n\nKen loves ken-ken-pa (Japanese version of hopscotch). Today, he will play it on a directed graph G.\nG consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.\n\nFirst, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken-ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.\n\nDetermine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n0 \\leq M \\leq \\min(10^5, N (N-1))\n\n1 \\leq u_i, v_i \\leq N(1 \\leq i \\leq M)\n\nu_i \\neq v_i (1 \\leq i \\leq M)\n\nIf i \\neq j, (u_i, v_i) \\neq (u_j, v_j).\n\n1 \\leq S, T \\leq N\n\nS \\neq T\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nu_1 v_1\n:\nu_M v_M\nS T\n\nOutput\n\nIf Ken cannot reach Vertex T from Vertex S by repeating ken-ken-pa, print -1.\nIf he can, print the minimum number of ken-ken-pa needed to reach vertex T.\n\nSample Input 1\n\n4 4\n1 2\n2 3\n3 4\n4 1\n1 3\n\nSample Output 1\n\n2\n\nKen can reach Vertex 3 from Vertex 1 in two ken-ken-pa, as follows: 1 \\rightarrow 2 \\rightarrow 3 \\rightarrow 4 in the first ken-ken-pa, then 4 \\rightarrow 1 \\rightarrow 2 \\rightarrow 3 in the second ken-ken-pa. This is the minimum number of ken-ken-pa needed.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n3 1\n1 2\n\nSample Output 2\n\n-1\n\nAny number of ken-ken-pa will bring Ken back to Vertex 1, so he cannot reach Vertex 2, though he can pass through it in the middle of a ken-ken-pa.\n\nSample Input 3\n\n2 0\n1 2\n\nSample Output 3\n\n-1\n\nVertex S and Vertex T may be disconnected.\n\nSample Input 4\n\n6 8\n1 2\n2 3\n3 4\n4 5\n5 1\n1 4\n1 5\n4 6\n1 6\n\nSample Output 4\n\n2", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 843, "memory_kb": 167320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s468959735", "group_id": "codeNet:p02992", "input_text": "M=10^9+7;n,k=readline()|>split.|>x->parse(Int,x);j=isqrt(n);let x=c=[(i->n÷i-n÷(i+1)).(1:n÷j-1);fill(1,j)];print((i->x=cumsum(reverse(x)).*c.%M).(1:k)[k][end])end", "language": "Julia", "metadata": {"date": 1594356914, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p02992.html", "problem_id": "p02992", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02992/input.txt", "sample_output_relpath": "derived/input_output/data/p02992/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02992/Julia/s468959735.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s468959735", "user_id": "u743272507"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "M=10^9+7;n,k=readline()|>split.|>x->parse(Int,x);j=isqrt(n);let x=c=[(i->n÷i-n÷(i+1)).(1:n÷j-1);fill(1,j)];print((i->x=cumsum(reverse(x)).*c.%M).(1:k)[k][end])end", "problem_context": "Score : 600 points\n\nProblem Statement\n\nFind the number of sequences of length K consisting of positive integers such that the product of any two adjacent elements is at most N, modulo 10^9+7.\n\nConstraints\n\n1\\leq N\\leq 10^9\n\n1 2\\leq K\\leq 100 (fixed at 21:33 JST)\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 sequences, modulo 10^9+7.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n5\n\n(1,1), (1,2), (1,3), (2,1), and (3,1) satisfy the condition.\n\nSample Input 2\n\n10 3\n\nSample Output 2\n\n147\n\nSample Input 3\n\n314159265 35\n\nSample Output 3\n\n457397712", "sample_input": "3 2\n"}, "reference_outputs": ["5\n"], "source_document_id": "p02992", "source_text": "Score : 600 points\n\nProblem Statement\n\nFind the number of sequences of length K consisting of positive integers such that the product of any two adjacent elements is at most N, modulo 10^9+7.\n\nConstraints\n\n1\\leq N\\leq 10^9\n\n1 2\\leq K\\leq 100 (fixed at 21:33 JST)\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 sequences, modulo 10^9+7.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\n5\n\n(1,1), (1,2), (1,3), (2,1), and (3,1) satisfy the condition.\n\nSample Input 2\n\n10 3\n\nSample Output 2\n\n147\n\nSample Input 3\n\n314159265 35\n\nSample Output 3\n\n457397712", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 792, "memory_kb": 293508}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s575096056", "group_id": "codeNet:p02993", "input_text": "s=readline()\nprint(s[1]==s[2]||s[2]==s[3]||s[3]==s[4]?\"Bad\":\"Good\")", "language": "Julia", "metadata": {"date": 1585097683, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02993.html", "problem_id": "p02993", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02993/input.txt", "sample_output_relpath": "derived/input_output/data/p02993/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02993/Julia/s575096056.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s575096056", "user_id": "u443151804"}, "prompt_components": {"gold_output": "Bad\n", "input_to_evaluate": "s=readline()\nprint(s[1]==s[2]||s[2]==s[3]||s[3]==s[4]?\"Bad\":\"Good\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThe door of Snuke's laboratory is locked with a security code.\n\nThe security code is a 4-digit number. We say the security code is hard to enter when it contains two consecutive digits that are the same.\n\nYou are given the current security code S. If S is hard to enter, print Bad; otherwise, print Good.\n\nConstraints\n\nS is a 4-character string consisting of digits.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is hard to enter, print Bad; otherwise, print Good.\n\nSample Input 1\n\n3776\n\nSample Output 1\n\nBad\n\nThe second and third digits are the same, so 3776 is hard to enter.\n\nSample Input 2\n\n8080\n\nSample Output 2\n\nGood\n\nThere are no two consecutive digits that are the same, so 8080 is not hard to enter.\n\nSample Input 3\n\n1333\n\nSample Output 3\n\nBad\n\nSample Input 4\n\n0024\n\nSample Output 4\n\nBad", "sample_input": "3776\n"}, "reference_outputs": ["Bad\n"], "source_document_id": "p02993", "source_text": "Score : 100 points\n\nProblem Statement\n\nThe door of Snuke's laboratory is locked with a security code.\n\nThe security code is a 4-digit number. We say the security code is hard to enter when it contains two consecutive digits that are the same.\n\nYou are given the current security code S. If S is hard to enter, print Bad; otherwise, print Good.\n\nConstraints\n\nS is a 4-character string consisting of digits.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S is hard to enter, print Bad; otherwise, print Good.\n\nSample Input 1\n\n3776\n\nSample Output 1\n\nBad\n\nThe second and third digits are the same, so 3776 is hard to enter.\n\nSample Input 2\n\n8080\n\nSample Output 2\n\nGood\n\nThere are no two consecutive digits that are the same, so 8080 is not hard to enter.\n\nSample Input 3\n\n1333\n\nSample Output 3\n\nBad\n\nSample Input 4\n\n0024\n\nSample Output 4\n\nBad", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 265, "memory_kb": 107176}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s051541293", "group_id": "codeNet:p02994", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N,L = readline() |> split |> parseArray\n\n ix=collect(1:N)\n _,i=findmin(abs(ix+L-1))\n result=sum(ix+L-1)-(i+L-1)\n\n println(result)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1561253040, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s051541293.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s051541293", "user_id": "u630185395"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N,L = readline() |> split |> parseArray\n\n ix=collect(1:N)\n _,i=findmin(abs(ix+L-1))\n result=sum(ix+L-1)-(i+L-1)\n\n println(result)\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 255, "cpu_time_ms": 806, "memory_kb": 169580}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s490173467", "group_id": "codeNet:p02995", "input_text": "a,b,c,d=parse.(split(readline()))\nf(x)=b÷x-~-a÷x\nprint(b-a+1-f(c)-f(d)+f(lcm(c,d)))", "language": "Julia", "metadata": {"date": 1561239195, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02995.html", "problem_id": "p02995", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02995/input.txt", "sample_output_relpath": "derived/input_output/data/p02995/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02995/Julia/s490173467.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s490173467", "user_id": "u729133443"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a,b,c,d=parse.(split(readline()))\nf(x)=b÷x-~-a÷x\nprint(b-a+1-f(c)-f(d)+f(lcm(c,d)))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "sample_input": "4 9 2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02995", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 85, "cpu_time_ms": 1229, "memory_kb": 175664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s095191456", "group_id": "codeNet:p02995", "input_text": "a,b,c,d=parse.(split(readline()))\na-=1\nf(x)=b÷x-a÷x\nprintln(b-a-f(c)-f(d)+f(lcm(c,d)))", "language": "Julia", "metadata": {"date": 1561237393, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02995.html", "problem_id": "p02995", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02995/input.txt", "sample_output_relpath": "derived/input_output/data/p02995/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02995/Julia/s095191456.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s095191456", "user_id": "u729133443"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a,b,c,d=parse.(split(readline()))\na-=1\nf(x)=b÷x-a÷x\nprintln(b-a-f(c)-f(d)+f(lcm(c,d)))", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "sample_input": "4 9 2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02995", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 898, "memory_kb": 172992}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s095914089", "group_id": "codeNet:p02995", "input_text": "parseInt(x) = parse(Int128,x)\n\nfunction main()\n (A,B,C,D) = map(parseInt, split(readline()))\n if B/C < 1 \n dc = 0\n else\n if A/C < 1\n dc = Int(floor(B/C))\n else\n dc = Int(floor(B/C))-Int(ceil(A/C))+1\n end\n end\n if B/D < 1 \n dd = 0\n else\n if A/D < 1\n dd = Int(floor(B/D))\n else\n dd = Int(floor(B/D))-Int(ceil(A/D))+1\n end\n end\n E = lcm(C,D)\n if B/E < 1 \n de = 0\n else\n if A/E < 1\n de = Int(floor(B/E))\n else\n de = Int(floor(B/E))-Int(ceil(A/E))+1\n end\n end\n k = (B-A+1)-(dc+dd-de)\n println(k)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1561235154, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p02995.html", "problem_id": "p02995", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p02995/input.txt", "sample_output_relpath": "derived/input_output/data/p02995/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p02995/Julia/s095914089.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s095914089", "user_id": "u709180765"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int128,x)\n\nfunction main()\n (A,B,C,D) = map(parseInt, split(readline()))\n if B/C < 1 \n dc = 0\n else\n if A/C < 1\n dc = Int(floor(B/C))\n else\n dc = Int(floor(B/C))-Int(ceil(A/C))+1\n end\n end\n if B/D < 1 \n dd = 0\n else\n if A/D < 1\n dd = Int(floor(B/D))\n else\n dd = Int(floor(B/D))-Int(ceil(A/D))+1\n end\n end\n E = lcm(C,D)\n if B/E < 1 \n de = 0\n else\n if A/E < 1\n de = Int(floor(B/E))\n else\n de = Int(floor(B/E))-Int(ceil(A/E))+1\n end\n end\n k = (B-A+1)-(dc+dd-de)\n println(k)\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "sample_input": "4 9 2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p02995", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nConstraints\n\n1\\leq A\\leq B\\leq 10^{18}\n\n1\\leq C,D\\leq 10^9\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the number of integers between A and B (inclusive) that can be evenly divided by neither C nor D.\n\nSample Input 1\n\n4 9 2 3\n\nSample Output 1\n\n2\n\n5 and 7 satisfy the condition.\n\nSample Input 2\n\n10 40 6 8\n\nSample Output 2\n\n23\n\nSample Input 3\n\n314159265358979323 846264338327950288 419716939 937510582\n\nSample Output 3\n\n532105071133627368", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 948, "memory_kb": 171320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s322245448", "group_id": "codeNet:p02996", "input_text": "#read test\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\t#buf = zeros(UInt8,100)\n\t#println(length(buf))\n\tbuf = read(STDIN,5000000)\n\t#println(size(buf))\n\tstr = transcode(String,buf)\n\tstr = split(str,\"\\n\")\n\t#println(length(str[1]))\n\ta = Array{Int}(2,n)\n\tfor i in 1:n\n\t\ta[:,i] = str[i] |> split |> parseMap\n\tend\n\ta = sortcols(a, by=z->z[2])\n\tt = 0\n\tflg = 0\n\tfor i in 1:n\n\t\tt += a[1,i]\n\t\tif t > a[2,i]\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tprintln(flg==0?\"Yes\":\"No\")\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1561270112, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s322245448.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s322245448", "user_id": "u330661451"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "#read test\nparseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\t#buf = zeros(UInt8,100)\n\t#println(length(buf))\n\tbuf = read(STDIN,5000000)\n\t#println(size(buf))\n\tstr = transcode(String,buf)\n\tstr = split(str,\"\\n\")\n\t#println(length(str[1]))\n\ta = Array{Int}(2,n)\n\tfor i in 1:n\n\t\ta[:,i] = str[i] |> split |> parseMap\n\tend\n\ta = sortcols(a, by=z->z[2])\n\tt = 0\n\tflg = 0\n\tfor i in 1:n\n\t\tt += a[1,i]\n\t\tif t > a[2,i]\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tprintln(flg==0?\"Yes\":\"No\")\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 556, "cpu_time_ms": 1319, "memory_kb": 164516}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s198678087", "group_id": "codeNet:p02997", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N,K = readline() |> split |> parseArray\n\n b=binomial(N-1,2)\n if K>b\n println(-1)\n return\n end\n\n M=N-1+(b-K)\n println(M)\n\n for i in 2:N\n println(\"1 $i\")\n end\n # for i in 2:min(M-N+2,N)\n # println(\"$i $(i%N+1)\")\n # end\n # for i in 2:min(M-2N+3,N)\n # println(\"$i $((i+1)%N+1)\")\n # end\n\n for j in 1:M÷(N-1)+1\n for i in 2:min(M-j*(N-1)+1,N)\n println(\"$i $((i+j-1)%N+1)\")\n end\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1561240785, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s198678087.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s198678087", "user_id": "u630185395"}, "prompt_components": {"gold_output": "5\n4 3\n1 2\n3 1\n4 5\n2 3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N,K = readline() |> split |> parseArray\n\n b=binomial(N-1,2)\n if K>b\n println(-1)\n return\n end\n\n M=N-1+(b-K)\n println(M)\n\n for i in 2:N\n println(\"1 $i\")\n end\n # for i in 2:min(M-N+2,N)\n # println(\"$i $(i%N+1)\")\n # end\n # for i in 2:min(M-2N+3,N)\n # println(\"$i $((i+1)%N+1)\")\n # end\n\n for j in 1:M÷(N-1)+1\n for i in 2:min(M-j*(N-1)+1,N)\n println(\"$i $((i+j-1)%N+1)\")\n end\n end\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 537, "cpu_time_ms": 888, "memory_kb": 168392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s288545811", "group_id": "codeNet:p02999", "input_text": "function main()\n \n (X,A) = map(x -> parse(Int,x), split(readline()))\n \n if X < A\n println(0)\n else\n println(10)\n end\n \nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1579548337, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s288545811.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s288545811", "user_id": "u790457721"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "function main()\n \n (X,A) = map(x -> parse(Int,x), split(readline()))\n \n if X < A\n println(0)\n else\n println(10)\n end\n \nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 343, "memory_kb": 110900}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s393096067", "group_id": "codeNet:p03000", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n, x = readline() |> split |> parseMap\n l = readline() |> split |> parseMap\n counter = 0\n place = 0\n for i in l\n if place > x\n break\n end\n counter += 1\n place += i\n end\n println(counter)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1560855512, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s393096067.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s393096067", "user_id": "u092650292"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n, x = readline() |> split |> parseMap\n l = readline() |> split |> parseMap\n counter = 0\n place = 0\n for i in l\n if place > x\n break\n end\n counter += 1\n place += i\n end\n println(counter)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 448, "memory_kb": 112392}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s580435422", "group_id": "codeNet:p03000", "input_text": "parseInt(x) = parse(Int,x)\n\nfunction main()\n (N,X) = map(parseInt,split(readline()))\n L = map(parseInt,split(readline()))\n D = zeros(Int64,N+1)\n for i=1:N\n D[i+1] = D[i]+L[i]\n end\n j = 0 \n for i = 1:(N+1)\n if X >= D[i]\n j = i \n end\n end\n println(j)\nend\n \nmain()", "language": "Julia", "metadata": {"date": 1560713136, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s580435422.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s580435422", "user_id": "u709180765"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nfunction main()\n (N,X) = map(parseInt,split(readline()))\n L = map(parseInt,split(readline()))\n D = zeros(Int64,N+1)\n for i=1:N\n D[i+1] = D[i]+L[i]\n end\n j = 0 \n for i = 1:(N+1)\n if X >= D[i]\n j = i \n end\n end\n println(j)\nend\n \nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 285, "cpu_time_ms": 866, "memory_kb": 171300}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s274139685", "group_id": "codeNet:p03001", "input_text": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n W,H,x,y = readint() \n\n print(W*H/2, \" \")\n if x == W/2 && y == H/2\n println(\"1\")\n else\n println(\"0\")\n end\n \nend\n\n\n\nmain()", "language": "Julia", "metadata": {"date": 1593955326, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s274139685.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s274139685", "user_id": "u868531879"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "using DataStructures\nconst double = Float64\nconst int = Int64\n\nparseint(x) = parse(int, x)\nreadint() = map(parseint, split(readline()))\n\nfunction main()\n W,H,x,y = readint() \n\n print(W*H/2, \" \")\n if x == W/2 && y == H/2\n println(\"1\")\n else\n println(\"0\")\n end\n \nend\n\n\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 773, "memory_kb": 213904}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s564526715", "group_id": "codeNet:p03001", "input_text": "function main()\n \n (W, H, x, y) = map(x -> parse(Int, x), split(readline()))\n \n A = W * H\n \n max_x = max(A * (x/W), A * ((W-x)/W))\n max_y = max(A * (y/H), A * ((H-y)/H))\n\n if 2x == W && 2y == H\n println(max_x, \" \", \"1\")\n else\n println(min(max_x, max_y), \" \", \"0\")\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1587202489, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s564526715.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s564526715", "user_id": "u790457721"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "function main()\n \n (W, H, x, y) = map(x -> parse(Int, x), split(readline()))\n \n A = W * H\n \n max_x = max(A * (x/W), A * ((W-x)/W))\n max_y = max(A * (y/H), A * ((H-y)/H))\n\n if 2x == W && 2y == H\n println(max_x, \" \", \"1\")\n else\n println(min(max_x, max_y), \" \", \"0\")\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 927, "memory_kb": 175732}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s723637570", "group_id": "codeNet:p03001", "input_text": "function main()\n \n (W,H,x,y) = map(x -> parse(Int,x), split(readline()))\n \n if W-x == 0 || x == 0\n A1 = W*H\n else\n \tA1 = min(x*H,(W-x)*H)\n end\n \n if H-y == 0 || y == 0\n A2 = W*H\n else\n \tA2 = min(W*y,W*(H-y))\n end\n \n if A1 == A2\n println(A1, \" 1\")\n else\n println(max(A1,A2), \" 0\")\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1586512066, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s723637570.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s723637570", "user_id": "u790457721"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "function main()\n \n (W,H,x,y) = map(x -> parse(Int,x), split(readline()))\n \n if W-x == 0 || x == 0\n A1 = W*H\n else\n \tA1 = min(x*H,(W-x)*H)\n end\n \n if H-y == 0 || y == 0\n A2 = W*H\n else\n \tA2 = min(W*y,W*(H-y))\n end\n \n if A1 == A2\n println(A1, \" 1\")\n else\n println(max(A1,A2), \" 0\")\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 702, "memory_kb": 162752}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s588343521", "group_id": "codeNet:p03001", "input_text": "lines=readlines(open(\"/dev/fd/0\"))\ninput()=shift!(lines)\nint(s::String)=parse(Int,s)\nintSub(s::SubString{String})=parse(Int,s)\nintLine(s::Array{SubString{String},1})=map(intSub,s)\nfunction main()\n w,h,x,y=intLine(split(input()))\n println(.5w*h,' ',+(.5(w+h)==x+y))\nend\nmain()", "language": "Julia", "metadata": {"date": 1561006231, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s588343521.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s588343521", "user_id": "u729133443"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "lines=readlines(open(\"/dev/fd/0\"))\ninput()=shift!(lines)\nint(s::String)=parse(Int,s)\nintSub(s::SubString{String})=parse(Int,s)\nintLine(s::Array{SubString{String},1})=map(intSub,s)\nfunction main()\n w,h,x,y=intLine(split(input()))\n println(.5w*h,' ',+(.5(w+h)==x+y))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 396, "memory_kb": 112780}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s472068099", "group_id": "codeNet:p03001", "input_text": "a,b,c,d=map(x->parse(Int64,x),split(readline()))\n@printf(\"%.9f\\n\",a*b/2)\nif c*2==a&d*2==b\n\tprintln(1)\nelse\n\tprintln(0)\nend\n", "language": "Julia", "metadata": {"date": 1560995158, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s472068099.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s472068099", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3.000000 0\n", "input_to_evaluate": "a,b,c,d=map(x->parse(Int64,x),split(readline()))\n@printf(\"%.9f\\n\",a*b/2)\nif c*2==a&d*2==b\n\tprintln(1)\nelse\n\tprintln(0)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 375, "memory_kb": 112524}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s571415034", "group_id": "codeNet:p03003", "input_text": "n,m=map(x->parse(Int,x),split(readline()))\ns=map(x->parse(Int,x),split(readline()))\nt=map(x->parse(Int,x),split(readline()))\nsum=ones(Int,m+1)\nmod=10^9+7\nfor ss=s\n\tsum[2:m+1]+=cumsum([ss==tt?sum%mod:0 for (tt,sum) in zip(t,sum[1:m])])\nend\nprintln(sum[m+1]%mod)", "language": "Julia", "metadata": {"date": 1561019541, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s571415034.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s571415034", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n,m=map(x->parse(Int,x),split(readline()))\ns=map(x->parse(Int,x),split(readline()))\nt=map(x->parse(Int,x),split(readline()))\nsum=ones(Int,m+1)\nmod=10^9+7\nfor ss=s\n\tsum[2:m+1]+=cumsum([ss==tt?sum%mod:0 for (tt,sum) in zip(t,sum[1:m])])\nend\nprintln(sum[m+1]%mod)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 260, "cpu_time_ms": 1200, "memory_kb": 154124}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s603574099", "group_id": "codeNet:p03003", "input_text": "n,m=map(x->parse(Int,x),split(readline()))\ns=map(x->parse(Int,x),split(readline()))\nt=map(x->parse(Int,x),split(readline()))\ndp=zeros(Int,m+1)\nsum=ones(Int,m+1)\nmod=10^9+7\ni=0\nwhile iparse(Int,x),split(readline()))\ns=map(x->parse(Int,x),split(readline()))\nt=map(x->parse(Int,x),split(readline()))\ndp=zeros(Int,m+1)\nsum=ones(Int,m+1)\nmod=10^9+7\ni=0\nwhile i parse(Int,x), split(readline()))\n \n k = zeros(Int,K)\n\n for i in 1:K\n\n if i == K\n k[i] = N\n else\n k[i] = 1\n N -= 1\n end\n \n end\n \n println(k[end]-1)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1579064901, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s760153738.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s760153738", "user_id": "u790457721"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n \n (N,K) = map(x -> parse(Int,x), split(readline()))\n \n k = zeros(Int,K)\n\n for i in 1:K\n\n if i == K\n k[i] = N\n else\n k[i] = 1\n N -= 1\n end\n \n end\n \n println(k[end]-1)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 359, "memory_kb": 110904}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s572879733", "group_id": "codeNet:p03005", "input_text": "k,n=map(x->parse(Int,x),split(readline()))\nprintln(n==1?0:k-n)", "language": "Julia", "metadata": {"date": 1568039092, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s572879733.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s572879733", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "k,n=map(x->parse(Int,x),split(readline()))\nprintln(n==1?0:k-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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 340, "memory_kb": 110212}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s991544555", "group_id": "codeNet:p03006", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n data=[parseMap(split(readline())) for i in 1:n]\n arr=Vector{Tuple{Int,Int}}()\n for i in 1:n\n for j in 1:n\n if i==j\n continue\n end\n push!(arr,(data[i][1]-data[j][1],data[i][2]-data[j][2]))\n end\n end\n cnt=Dict{Tuple{Int,Int},Int}()\n M=0\n for i in arr\n if haskey(cnt,i)\n cnt[i]+=1\n else\n cnt[i]=1\n end\n M=max(M,cnt[i])\n end\n println(n-M)\nend\nmain()", "language": "Julia", "metadata": {"date": 1586300886, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s991544555.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s991544555", "user_id": "u619197965"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n data=[parseMap(split(readline())) for i in 1:n]\n arr=Vector{Tuple{Int,Int}}()\n for i in 1:n\n for j in 1:n\n if i==j\n continue\n end\n push!(arr,(data[i][1]-data[j][1],data[i][2]-data[j][2]))\n end\n end\n cnt=Dict{Tuple{Int,Int},Int}()\n M=0\n for i in arr\n if haskey(cnt,i)\n cnt[i]+=1\n else\n cnt[i]=1\n end\n M=max(M,cnt[i])\n end\n println(n-M)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 722, "cpu_time_ms": 909, "memory_kb": 173208}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s082226174", "group_id": "codeNet:p03007", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\ta = sort(a)\n\tm = 0\n\th = div(n,2)\n\tfor i in 1:n\n\t\tif i<=h\n\t\t\tm -= a[i]\n\t\telseif i == h+1 && a[i] < 0\n\t\t\tm -=a[i]\n\t\telse\n\t\t\tm += a[i]\n\t\tend\n\tend\n\tprintln(m)\n\tb = Array{Int}(n)\n\tt = 1\n\tif a[h+1] < 0\n\t\tfor i in 1:h\n\t\t\tb[t] = a[n-i+1]\n\t\t\tt += 1\n\t\t\tb[t] = a[i]\n\t\t\tt += 1\n\t\tend\n\telse\n\t\tfor i in 1:h\n\t\t\tb[t] = a[i]\n\t\t\tt += 1\n\t\t\tb[t] = a[n-i+1]\n\t\t\tt += 1\n\t\tend\n\tend\n\tif n%2 == 1\n\t\tb[n] = a[h+1]\n\tend\n\tk = 1\n\tif a[h+1] < 0\n\t\tt += 1\n\tend\n\twhile length(b)>1\n\t\tx = shift!(b)\n\t\ty = shift!(b)\n\t\tif length(b) == 0\n\t\t\tprintln(max(x,y), \" \", min(x,y))\n\t\t\tpush!(b,x-y)\n\t\telseif k%2 == 1\n\t\t\tprintln(x, \" \", y)\n\t\t\tpush!(b, x-y)\n\t\telse\n\t\t\tprintln(y, \" \", x)\n\t\t\tpush!(b, y-x)\n\t\tend\n\t\tk += 1\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1560649350, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s082226174.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s082226174", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n-1 1\n2 -2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\ta = sort(a)\n\tm = 0\n\th = div(n,2)\n\tfor i in 1:n\n\t\tif i<=h\n\t\t\tm -= a[i]\n\t\telseif i == h+1 && a[i] < 0\n\t\t\tm -=a[i]\n\t\telse\n\t\t\tm += a[i]\n\t\tend\n\tend\n\tprintln(m)\n\tb = Array{Int}(n)\n\tt = 1\n\tif a[h+1] < 0\n\t\tfor i in 1:h\n\t\t\tb[t] = a[n-i+1]\n\t\t\tt += 1\n\t\t\tb[t] = a[i]\n\t\t\tt += 1\n\t\tend\n\telse\n\t\tfor i in 1:h\n\t\t\tb[t] = a[i]\n\t\t\tt += 1\n\t\t\tb[t] = a[n-i+1]\n\t\t\tt += 1\n\t\tend\n\tend\n\tif n%2 == 1\n\t\tb[n] = a[h+1]\n\tend\n\tk = 1\n\tif a[h+1] < 0\n\t\tt += 1\n\tend\n\twhile length(b)>1\n\t\tx = shift!(b)\n\t\ty = shift!(b)\n\t\tif length(b) == 0\n\t\t\tprintln(max(x,y), \" \", min(x,y))\n\t\t\tpush!(b,x-y)\n\t\telseif k%2 == 1\n\t\t\tprintln(x, \" \", y)\n\t\t\tpush!(b, x-y)\n\t\telse\n\t\t\tprintln(y, \" \", x)\n\t\t\tpush!(b, y-x)\n\t\tend\n\t\tk += 1\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 854, "cpu_time_ms": 904, "memory_kb": 171036}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s780557002", "group_id": "codeNet:p03007", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\ta = sort(a)\n\tm = 0\n\th = div(n,2)\n\tfor i in 1:n\n\t\tif i<=h\n\t\t\tm -= a[i]\n\t\telse\n\t\t\tm += a[i]\n\t\tend\n\tend\n\tprintln(m)\n\tb = Array{Int}(n)\n\tt = 1\n\tfor i in 1:h\n\t\tb[t] = a[i]\n\t\tt += 1\n\t\tb[t] = a[n-i+1]\n\t\tt += 1\n\tend\n\tif n%2 == 1\n\t\tb[n] = a[h+1]\n\tend\n\tk = 1\n\twhile length(b)>1\n\t\tx = shift!(b)\n\t\ty = shift!(b)\n\t\tif length(b) == 0\n\t\t\tprintln(max(x,y), \" \", min(x,y))\n\t\t\tpush!(b,x-y)\n\t\telseif k%2 == 1\n\t\t\tprintln(x, \" \", y)\n\t\t\tpush!(b, x-y)\n\t\telse\n\t\t\tprintln(y, \" \", x)\n\t\t\tpush!(b, y-x)\n\t\tend\n\t\tk += 1\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1560648705, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s780557002.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s780557002", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n-1 1\n2 -2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\ta = sort(a)\n\tm = 0\n\th = div(n,2)\n\tfor i in 1:n\n\t\tif i<=h\n\t\t\tm -= a[i]\n\t\telse\n\t\t\tm += a[i]\n\t\tend\n\tend\n\tprintln(m)\n\tb = Array{Int}(n)\n\tt = 1\n\tfor i in 1:h\n\t\tb[t] = a[i]\n\t\tt += 1\n\t\tb[t] = a[n-i+1]\n\t\tt += 1\n\tend\n\tif n%2 == 1\n\t\tb[n] = a[h+1]\n\tend\n\tk = 1\n\twhile length(b)>1\n\t\tx = shift!(b)\n\t\ty = shift!(b)\n\t\tif length(b) == 0\n\t\t\tprintln(max(x,y), \" \", min(x,y))\n\t\t\tpush!(b,x-y)\n\t\telseif k%2 == 1\n\t\t\tprintln(x, \" \", y)\n\t\t\tpush!(b, x-y)\n\t\telse\n\t\t\tprintln(y, \" \", x)\n\t\t\tpush!(b, y-x)\n\t\tend\n\t\tk += 1\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 676, "cpu_time_ms": 982, "memory_kb": 171292}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s676515154", "group_id": "codeNet:p03010", "input_text": "N = parse(Int64, strip(readline()))\nnx = 1\npop = 1\nres = zeros(Int64, N, N)\nfor i in 1:N\n for j in i+1:N\n res[i,j] = res[j,i] = nx\n nx,pop = nx+pop,nx\n end\nend\n\nfor i in 1:N\n println(join(map(string, res[i,:]), ' '))\nend", "language": "Julia", "metadata": {"date": 1560745035, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s676515154.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s676515154", "user_id": "u419818973"}, "prompt_components": {"gold_output": "0 6 15\n6 0 21\n15 21 0\n", "input_to_evaluate": "N = parse(Int64, strip(readline()))\nnx = 1\npop = 1\nres = zeros(Int64, N, N)\nfor i in 1:N\n for j in i+1:N\n res[i,j] = res[j,i] = nx\n nx,pop = nx+pop,nx\n end\nend\n\nfor i in 1:N\n println(join(map(string, res[i,:]), ' '))\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 229, "cpu_time_ms": 904, "memory_kb": 165624}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s306190008", "group_id": "codeNet:p03011", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n p,q,r=parseMap(split(readline()))\n println(min(p+q,q+r))\nend\nmain()", "language": "Julia", "metadata": {"date": 1582866836, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s306190008.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s306190008", "user_id": "u619197965"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n p,q,r=parseMap(split(readline()))\n println(min(p+q,q+r))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 177, "cpu_time_ms": 342, "memory_kb": 112264}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s885469286", "group_id": "codeNet:p03011", "input_text": "A = parse.(split(readline()))\nsort!(A)\nprintln(A[2]+A[1])", "language": "Julia", "metadata": {"date": 1579666203, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s885469286.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s885469286", "user_id": "u879294842"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "A = parse.(split(readline()))\nsort!(A)\nprintln(A[2]+A[1])", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 569, "memory_kb": 120596}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s308047734", "group_id": "codeNet:p03011", "input_text": "pqr = parse.([Int], split(readline()))\nprintln(sum(pqr) - maximum(pqr))", "language": "Julia", "metadata": {"date": 1560991933, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s308047734.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s308047734", "user_id": "u872191059"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "pqr = parse.([Int], split(readline()))\nprintln(sum(pqr) - maximum(pqr))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 71, "cpu_time_ms": 588, "memory_kb": 119556}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s051607146", "group_id": "codeNet:p03012", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\n\nN = parseInt(readline())\n\nW = parseMap(split(readline()))\n\nmin_abs = 100000\n\nfor i in 1:N-1\n min_abs = min(min_abs, abs(sum(W[1:i]) - sum(W[i+1:N])))\nend\n\n\nprintln(min_abs)\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1592968838, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s051607146.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s051607146", "user_id": "u879294842"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\n\nN = parseInt(readline())\n\nW = parseMap(split(readline()))\n\nmin_abs = 100000\n\nfor i in 1:N-1\n min_abs = min(min_abs, abs(sum(W[1:i]) - sum(W[i+1:N])))\nend\n\n\nprintln(min_abs)\n\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 259, "memory_kb": 165620}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s559998581", "group_id": "codeNet:p03012", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N = readline() |> parseInt\n W = readline() |> split |> parseArray\n\n minimum(1:N) do i\n abs(sum(W[1:i]) - sum(W[i+1:end]))\n end |> println\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1560129653, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s559998581.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s559998581", "user_id": "u630185395"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N = readline() |> parseInt\n W = readline() |> split |> parseArray\n\n minimum(1:N) do i\n abs(sum(W[1:i]) - sum(W[i+1:end]))\n end |> println\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 845, "memory_kb": 168744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s452681582", "group_id": "codeNet:p03012", "input_text": "parseInt(x) = parse(Int,x)\n\nfunction main()\n N = parseInt(readline())\n W = map(parseInt,split(readline()))\n S = zeros(Int64,N)\n for i=1:N\n S[i] = abs(sum(W[i+1:N])-sum(W[1:i]))\n end\n println(minimum(S))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1560129602, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s452681582.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s452681582", "user_id": "u709180765"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nfunction main()\n N = parseInt(readline())\n W = map(parseInt,split(readline()))\n S = zeros(Int64,N)\n for i=1:N\n S[i] = abs(sum(W[i+1:N])-sum(W[1:i]))\n end\n println(minimum(S))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1005, "memory_kb": 123080}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s798648542", "group_id": "codeNet:p03013", "input_text": "const MOD = Int(10^9+7)\n\nfunction solve()\n N, M = parse.(Int, split(readline()))\n a = zeros(Int, M)\n for i = 1:M\n a[i] = parse(Int, readline())\n end\n\n if N == 1\n println(1)\n return 0\n end\n\n dp = zeros(Int, N)\n dp[1] = 1\n dp[2] = 2\n\n for i = 1:M dp[a[i]] = -1 end\n\n for i = 2:N\n println(dp)\n if dp[i] < 0 continue end\n\n if i + 1 <= N\n if dp[i+1] >= 0\n dp[i+1] = (dp[i+1] + dp[i])%MOD\n end\n end\n\n if i + 2 <= N\n if dp[i+2] >= 0\n dp[i+2] = (dp[i+2] + dp[i])%MOD\n end\n end\n end\n\n println(dp[N])\nend\n\nsolve()\n", "language": "Julia", "metadata": {"date": 1600495754, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s798648542.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s798648542", "user_id": "u909017535"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "const MOD = Int(10^9+7)\n\nfunction solve()\n N, M = parse.(Int, split(readline()))\n a = zeros(Int, M)\n for i = 1:M\n a[i] = parse(Int, readline())\n end\n\n if N == 1\n println(1)\n return 0\n end\n\n dp = zeros(Int, N)\n dp[1] = 1\n dp[2] = 2\n\n for i = 1:M dp[a[i]] = -1 end\n\n for i = 2:N\n println(dp)\n if dp[i] < 0 continue end\n\n if i + 1 <= N\n if dp[i+1] >= 0\n dp[i+1] = (dp[i+1] + dp[i])%MOD\n end\n end\n\n if i + 2 <= N\n if dp[i+2] >= 0\n dp[i+2] = (dp[i+2] + dp[i])%MOD\n end\n end\n end\n\n println(dp[N])\nend\n\nsolve()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 680, "cpu_time_ms": 2288, "memory_kb": 235120}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s874932547", "group_id": "codeNet:p03013", "input_text": "function main()\n \n (N, M) = map(x -> parse(Int, x), split(readline()))\n \n a = zeros(Int, 2M)\n for i in 1:M\n a[i] = parse(Int, readline()) + 1\n end\n \n ans = zeros(Int, 2N)\n num = 1\n \n for i in 1:N+1\n if i == 1\n ans[i] = 1\n elseif i == 2\n if a[num] == 2\n ans[i] = 0\n num += 1\n else\n ans[i] = 1\n end\n elseif a[num] == i\n num += 1\n else\n ans[i] = ans[i-1] + ans[i-2]\n ans[i] %= 1000000007\n end\n end\n \n println(ans[N+1])\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1588102328, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s874932547.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s874932547", "user_id": "u790457721"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function main()\n \n (N, M) = map(x -> parse(Int, x), split(readline()))\n \n a = zeros(Int, 2M)\n for i in 1:M\n a[i] = parse(Int, readline()) + 1\n end\n \n ans = zeros(Int, 2N)\n num = 1\n \n for i in 1:N+1\n if i == 1\n ans[i] = 1\n elseif i == 2\n if a[num] == 2\n ans[i] = 0\n num += 1\n else\n ans[i] = 1\n end\n elseif a[num] == i\n num += 1\n else\n ans[i] = ans[i-1] + ans[i-2]\n ans[i] %= 1000000007\n end\n end\n \n println(ans[N+1])\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1132, "memory_kb": 190340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s818414977", "group_id": "codeNet:p03014", "input_text": "function main()\n\tH,W=map(x->parse(Int,x),split(readline()))\n\tdp=zeros(Int,4,H,W)\n\tS=readlines()\n\tfor j=1:W\n\t\tdp[1,1,j]=S[1][j]=='.'?1:0\n\tend\n\tfor x=2:H,j=1:W\n\t\tdp[1,x,j]=S[x][j]=='.'?dp[1,x-1,j]+1:0\n\tend\n\tfor j=1:W\n\t\tdp[2,H,j]=S[H][j]=='.'?1:0\n\tend\n\tfor x=H-1:-1:1,j=1:W\n\t\tdp[2,x,j]=S[x][j]=='.'?dp[2,x+1,j]+1:0\n\tend\n\tfor j=1:H\n\t\tdp[3,j,1]=S[j][1]=='.'?1:0\n\tend\n\tfor y=2:W,j=1:H\n\t\tdp[3,j,y]=S[j][y]=='.'?dp[3,j,y-1]+1:0\n\tend\n\tfor j=1:H\n\t\tdp[4,j,W]=S[j][W]=='.'?1:0\n\tend\n\tfor y=W-1:-1:1,j=1:H\n\t\tdp[4,j,y]=S[j][y]=='.'?dp[4,j,y+1]+1:0\n\tend\n\tans=0\n\tfor i=1:H,j=1:W\n\t\tans=max(ans,dp[1,i,j]+dp[2,i,j]+dp[3,i,j]+dp[4,i,j]-3)\n\tend\n\tprintln(ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561192099, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s818414977.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s818414977", "user_id": "u657913472"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "function main()\n\tH,W=map(x->parse(Int,x),split(readline()))\n\tdp=zeros(Int,4,H,W)\n\tS=readlines()\n\tfor j=1:W\n\t\tdp[1,1,j]=S[1][j]=='.'?1:0\n\tend\n\tfor x=2:H,j=1:W\n\t\tdp[1,x,j]=S[x][j]=='.'?dp[1,x-1,j]+1:0\n\tend\n\tfor j=1:W\n\t\tdp[2,H,j]=S[H][j]=='.'?1:0\n\tend\n\tfor x=H-1:-1:1,j=1:W\n\t\tdp[2,x,j]=S[x][j]=='.'?dp[2,x+1,j]+1:0\n\tend\n\tfor j=1:H\n\t\tdp[3,j,1]=S[j][1]=='.'?1:0\n\tend\n\tfor y=2:W,j=1:H\n\t\tdp[3,j,y]=S[j][y]=='.'?dp[3,j,y-1]+1:0\n\tend\n\tfor j=1:H\n\t\tdp[4,j,W]=S[j][W]=='.'?1:0\n\tend\n\tfor y=W-1:-1:1,j=1:H\n\t\tdp[4,j,y]=S[j][y]=='.'?dp[4,j,y+1]+1:0\n\tend\n\tans=0\n\tfor i=1:H,j=1:W\n\t\tans=max(ans,dp[1,i,j]+dp[2,i,j]+dp[3,i,j]+dp[4,i,j]-3)\n\tend\n\tprintln(ans)\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2113, "memory_kb": 267200}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s186960429", "group_id": "codeNet:p03023", "input_text": "println(180(parse(readline())-2))", "language": "Julia", "metadata": {"date": 1568038818, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s186960429.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s186960429", "user_id": "u657913472"}, "prompt_components": {"gold_output": "180\n", "input_to_evaluate": "println(180(parse(readline())-2))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 33, "cpu_time_ms": 297, "memory_kb": 106764}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s103134760", "group_id": "codeNet:p03026", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N = readline() |> parseInt\n a,b=zeros(Int,N-1),zeros(Int,N-1)\n for i in 1:N-1\n a[i],b[i]=readline() |> split |> parseArray\n end\n c=readline() |> split |> parseArray\n\n sort!(c)\n\n t=[[] for i in 1:N]\n for i in 1:N-1\n push!(t[a[i]], b[i])\n push!(t[b[i]], a[i])\n end\n\n d=zeros(Int,N)\n\n dfs(i, i_prev)=begin\n d[i]=pop!(c) #大きいものから取り出す\n for j in t[i]\n if j==i_prev\n continue\n end\n dfs(j, i)\n end\n end\n dfs(a[1], 0)\n\n M=sum(1:N-1)do i\n min(d[a[i]], d[b[i]])\n end\n println(M)\n\n print(d[1])\n for i in 2:N\n print(\" \")\n print(d[i])\n end\n println()\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1559484409, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s103134760.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s103134760", "user_id": "u630185395"}, "prompt_components": {"gold_output": "10\n1 2 3 4 5\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N = readline() |> parseInt\n a,b=zeros(Int,N-1),zeros(Int,N-1)\n for i in 1:N-1\n a[i],b[i]=readline() |> split |> parseArray\n end\n c=readline() |> split |> parseArray\n\n sort!(c)\n\n t=[[] for i in 1:N]\n for i in 1:N-1\n push!(t[a[i]], b[i])\n push!(t[b[i]], a[i])\n end\n\n d=zeros(Int,N)\n\n dfs(i, i_prev)=begin\n d[i]=pop!(c) #大きいものから取り出す\n for j in t[i]\n if j==i_prev\n continue\n end\n dfs(j, i)\n end\n end\n dfs(a[1], 0)\n\n M=sum(1:N-1)do i\n min(d[a[i]], d[b[i]])\n end\n println(M)\n\n print(d[1])\n for i in 2:N\n print(\" \")\n print(d[i])\n end\n println()\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 748, "cpu_time_ms": 989, "memory_kb": 181244}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s657309056", "group_id": "codeNet:p03029", "input_text": "a,p=parse.(readline()|>split)\ndiv(3a+p,2)|>print", "language": "Julia", "metadata": {"date": 1581149548, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s657309056.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s657309056", "user_id": "u541055501"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "a,p=parse.(readline()|>split)\ndiv(3a+p,2)|>print", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 48, "cpu_time_ms": 538, "memory_kb": 117940}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s951946441", "group_id": "codeNet:p03029", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n A,P = readline() |> split |> parseMap\n A *= 3;\n result = (A + P)/2\n \n print(Int64(floor(result)))\nend\nmain()", "language": "Julia", "metadata": {"date": 1558919242, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s951946441.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s951946441", "user_id": "u267950110"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n A,P = readline() |> split |> parseMap\n A *= 3;\n result = (A + P)/2\n \n print(Int64(floor(result)))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 724, "memory_kb": 167896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s658754969", "group_id": "codeNet:p03030", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n array=Tuple{String,Int,Int}[(\"\",0,i) for i in 1:n]\n for i in 1:n\n s,p=split(readline())\n array[i]=(s,parseInt(p),i)\n end\n sort!(array,by=x->x[2],rev=true)\n sort!(array,by=x->x[1])\n for i in 1:n\n println(array[i][3])\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1582943206, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s658754969.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s658754969", "user_id": "u619197965"}, "prompt_components": {"gold_output": "3\n4\n6\n1\n5\n2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n array=Tuple{String,Int,Int}[(\"\",0,i) for i in 1:n]\n for i in 1:n\n s,p=split(readline())\n array[i]=(s,parseInt(p),i)\n end\n sort!(array,by=x->x[2],rev=true)\n sort!(array,by=x->x[1])\n for i in 1:n\n println(array[i][3])\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 404, "cpu_time_ms": 971, "memory_kb": 172028}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s035020669", "group_id": "codeNet:p03030", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = String[]\n\tp = Int[]\n\tfor i in 1:n\n\t\ta,b = readline() |> split\n\t\tpush!(s,a)\n\t\tpush!(p,parseInt(b))\n\tend\n\tt = String[]\n\tfor i in 1:n\n\t\tif !(s[i] in t)\n\t\t\tpush!(t,s[i])\n\t\tend\n\tend\n\tt = sort(t)\n\td = Dict{String,Int}()\n\tfor i in 1:length(t)\n\t\td[t[i]] = i\n\tend\n\ta = Array{Int}(3,n)\n\tfor i in 1:n\n\t\ta[1,i] = i\n\t\ta[2,i] = d[s[i]]\n\t\ta[3,i] = p[i]\n\tend\n\ta = sortcols(a,by=x->x[3],rev=true)\n\ta = sortcols(a,by=x->x[2])\n\tfor i in 1:n\n\t\tprintln(a[1,i])\n\tend\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1558927798, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s035020669.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s035020669", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n4\n6\n1\n5\n2\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = String[]\n\tp = Int[]\n\tfor i in 1:n\n\t\ta,b = readline() |> split\n\t\tpush!(s,a)\n\t\tpush!(p,parseInt(b))\n\tend\n\tt = String[]\n\tfor i in 1:n\n\t\tif !(s[i] in t)\n\t\t\tpush!(t,s[i])\n\t\tend\n\tend\n\tt = sort(t)\n\td = Dict{String,Int}()\n\tfor i in 1:length(t)\n\t\td[t[i]] = i\n\tend\n\ta = Array{Int}(3,n)\n\tfor i in 1:n\n\t\ta[1,i] = i\n\t\ta[2,i] = d[s[i]]\n\t\ta[3,i] = p[i]\n\tend\n\ta = sortcols(a,by=x->x[3],rev=true)\n\ta = sortcols(a,by=x->x[2])\n\tfor i in 1:n\n\t\tprintln(a[1,i])\n\tend\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 721, "memory_kb": 127748}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s337673859", "group_id": "codeNet:p03031", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,m=parseMap(split(readline()))\n data=[parseMap(split(readline())) for i in 1:m]\n p=parseMap(split(readline()))\n ans=0\n for i in 0:(1<parse(Int,x),split(readline()))\ns=zeros(Int,M,N)\nfor i=1:M\n\tt=map(x->parse(Int,x),split(readline()))\n\tfor j=t[2:end]\n\t\ts[i,j]=1\n\tend\nend\np=map(x->parse(Int,x),split(readline()))\nans=0\nfor i=0:(1<>(k-1))%2*s[j,k]\n\t\tend\n\t\tif now%2!=0\n\t\t\tflag=false\n\t\tend\n\tend\n\tans+=flag\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1561248923, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s775237144.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s775237144", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "N,M=map(x->parse(Int,x),split(readline()))\ns=zeros(Int,M,N)\nfor i=1:M\n\tt=map(x->parse(Int,x),split(readline()))\n\tfor j=t[2:end]\n\t\ts[i,j]=1\n\tend\nend\np=map(x->parse(Int,x),split(readline()))\nans=0\nfor i=0:(1<>(k-1))%2*s[j,k]\n\t\tend\n\t\tif now%2!=0\n\t\t\tflag=false\n\t\tend\n\tend\n\tans+=flag\nend\nprintln(ans)\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 358, "cpu_time_ms": 478, "memory_kb": 118664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s070456873", "group_id": "codeNet:p03033", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction refresh(st::Array{Int,1},lt::Array{Int,1},x,rt)\n\tif x<=rt\n\t\tst[x<<1] = min(st[x<<1],lt[x])\n\t\tst[x<<1+1] = min(st[x<<1+1],lt[x])\n\t\tlt[x] = 10^18\n\tend\nend\n\nfunction main()\n\tn,q = readline() |> split |> parseMap\n\ta = Tuple{Int,Int,Int}[(0,0,0) for i in 1:n]\n\td = Dict{Int,Int}()\n\tfor i in 1:n\n\t\tx,y,z = readline() |> split |> parseMap\n\t\ta[i] = (x-z,y-z-1,z)\n\t\tif y-z-1>-1\n\t\t\td[max(x-z,0)]=1\n\t\t\td[max(y-z-1,0)]=1\n\t\tend\n\tend\n\tb = zeros(Int,q)\n\tfor i in 1:q\n\t\tb[i]=readline() |> parseInt\n\t\td[b[i]]=1\n\tend\n\tm = length(d)\n\ttl = zeros(Int,m)\n\tz = 1\n\tfor i in keys(d)\n\t\ttl[z]=i\n\t\tz += 1\n\tend\n\ttl = sort(tl)\n\tfor i in 1:m\n\t\td[tl[i]] = i\n\tend\n\tk = 0\n\twhile 2^k-1\n\t\t\tll = d[max(a[iter][1],0)]\n\t\t\trr = d[max(a[iter][2],0)]\n\t\t\tv = a[iter][3]\n\t\t\trp = Int[]\n\t\t\trw = Tuple{Int,Int}[]\n\t\t\tfor i in k:-1:0\n\t\t\t\tl = (rt+ll)>>i\n\t\t\t\tr = (rt+rr)>>i\n\t\t\t\tpush!(rp,l)\n\t\t\t\tif l1\n\t\t\t\t\tif l%2==0\n\t\t\t\t\t\tpush!(rw,(l+1,i))\n\t\t\t\t\tend\n\t\t\t\t\tif r%2==1\n\t\t\t\t\t\tpush!(rw,(r-1,i))\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tfor i in rp\n\t\t\t\trefresh(st,lt,i,rt)\n\t\t\tend\n\t\t\tfor i in rw\n\t\t\t\tlt[i[1]]=min(v,lt[i[1]])\n\t\t\t\tst[i[1]]=min(v,st[i[1]])\n\t\t\tend\n\t\t\tfor i in length(rp):-1:1\n\t\t\t\tif rp[i]<=rt\n\t\t\t\t\tst[rp[i]]=min(st[rp[i]<<1],st[rp[i]<<1+1])\n\t\t\t\telse\n\t\t\t\t\tst[rp[i]]=min(st[rp[i]],v)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:2^(k+1)-1\n\t\trefresh(st,lt,i,rt)\n\tend\n\nend\nmain()", "language": "Julia", "metadata": {"date": 1579380759, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s070456873.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s070456873", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n2\n10\n-1\n13\n-1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction refresh(st::Array{Int,1},lt::Array{Int,1},x,rt)\n\tif x<=rt\n\t\tst[x<<1] = min(st[x<<1],lt[x])\n\t\tst[x<<1+1] = min(st[x<<1+1],lt[x])\n\t\tlt[x] = 10^18\n\tend\nend\n\nfunction main()\n\tn,q = readline() |> split |> parseMap\n\ta = Tuple{Int,Int,Int}[(0,0,0) for i in 1:n]\n\td = Dict{Int,Int}()\n\tfor i in 1:n\n\t\tx,y,z = readline() |> split |> parseMap\n\t\ta[i] = (x-z,y-z-1,z)\n\t\tif y-z-1>-1\n\t\t\td[max(x-z,0)]=1\n\t\t\td[max(y-z-1,0)]=1\n\t\tend\n\tend\n\tb = zeros(Int,q)\n\tfor i in 1:q\n\t\tb[i]=readline() |> parseInt\n\t\td[b[i]]=1\n\tend\n\tm = length(d)\n\ttl = zeros(Int,m)\n\tz = 1\n\tfor i in keys(d)\n\t\ttl[z]=i\n\t\tz += 1\n\tend\n\ttl = sort(tl)\n\tfor i in 1:m\n\t\td[tl[i]] = i\n\tend\n\tk = 0\n\twhile 2^k-1\n\t\t\tll = d[max(a[iter][1],0)]\n\t\t\trr = d[max(a[iter][2],0)]\n\t\t\tv = a[iter][3]\n\t\t\trp = Int[]\n\t\t\trw = Tuple{Int,Int}[]\n\t\t\tfor i in k:-1:0\n\t\t\t\tl = (rt+ll)>>i\n\t\t\t\tr = (rt+rr)>>i\n\t\t\t\tpush!(rp,l)\n\t\t\t\tif l1\n\t\t\t\t\tif l%2==0\n\t\t\t\t\t\tpush!(rw,(l+1,i))\n\t\t\t\t\tend\n\t\t\t\t\tif r%2==1\n\t\t\t\t\t\tpush!(rw,(r-1,i))\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tfor i in rp\n\t\t\t\trefresh(st,lt,i,rt)\n\t\t\tend\n\t\t\tfor i in rw\n\t\t\t\tlt[i[1]]=min(v,lt[i[1]])\n\t\t\t\tst[i[1]]=min(v,st[i[1]])\n\t\t\tend\n\t\t\tfor i in length(rp):-1:1\n\t\t\t\tif rp[i]<=rt\n\t\t\t\t\tst[rp[i]]=min(st[rp[i]<<1],st[rp[i]<<1+1])\n\t\t\t\telse\n\t\t\t\t\tst[rp[i]]=min(st[rp[i]],v)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:2^(k+1)-1\n\t\trefresh(st,lt,i,rt)\n\tend\n\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1566, "cpu_time_ms": 2115, "memory_kb": 252824}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s928298726", "group_id": "codeNet:p03034", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = readline() |> split |> parseMap\n\tm = (n-1)>>1+1\n\ta = Int[]\n\tk = 1\n\twhile k<=sqrt(n-m-1)\n\t\tif k*k==(n-m-1)\n\t\t\tpush!(a,k)\n\t\telseif (n-m-1)%k==0\n\t\t\tpush!(a,k)\n\t\t\tpush!(a,div(n-m-1,k))\n\t\tend\n\t\tk += 1\n\tend\n\tv = 0\n\tfor i in a\n\t\tl = zeros(Int,n>>1)\n\t\tr = zeros(Int,n>>1)\n\t\tfor j in 1+i:i:n>>1\n\t\t\tl[j] = l[j-i]+s[j]\n\t\t\tr[j] = r[j-i]+s[n-j+1]\n\t\tend\n\t\tfor j in 1:i:n>>1\n\t\t\tv = max(v,l[j]+r[j],l[n>>1]-l[n>>1-j]+r[n>>1]-r[n>>1-j])\n\t\tend\n\t\tv = max(v,l[n>>1]+r[n>>1])\n\tend\n\tprintln(v)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1576465082, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03034.html", "problem_id": "p03034", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03034/input.txt", "sample_output_relpath": "derived/input_output/data/p03034/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03034/Julia/s928298726.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s928298726", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = readline() |> split |> parseMap\n\tm = (n-1)>>1+1\n\ta = Int[]\n\tk = 1\n\twhile k<=sqrt(n-m-1)\n\t\tif k*k==(n-m-1)\n\t\t\tpush!(a,k)\n\t\telseif (n-m-1)%k==0\n\t\t\tpush!(a,k)\n\t\t\tpush!(a,div(n-m-1,k))\n\t\tend\n\t\tk += 1\n\tend\n\tv = 0\n\tfor i in a\n\t\tl = zeros(Int,n>>1)\n\t\tr = zeros(Int,n>>1)\n\t\tfor j in 1+i:i:n>>1\n\t\t\tl[j] = l[j-i]+s[j]\n\t\t\tr[j] = r[j-i]+s[n-j+1]\n\t\tend\n\t\tfor j in 1:i:n>>1\n\t\t\tv = max(v,l[j]+r[j],l[n>>1]-l[n>>1-j]+r[n>>1]-r[n>>1-j])\n\t\tend\n\t\tv = max(v,l[n>>1]+r[n>>1])\n\tend\n\tprintln(v)\nend\n\nmain()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere is an infinitely large pond, which we consider as a number line.\nIn this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1.\nOn the lotus at coordinate i, an integer s_i is written.\n\nYou are standing on the lotus at coordinate 0. You will play a game that proceeds as follows:\n\n1. Choose positive integers A and B. Your score is initially 0.\n\n2. Let x be your current coordinate, and y = x+A. The lotus at coordinate x disappears, and you move to coordinate y.\n\nIf y = N-1, the game ends.\n\nIf y \\neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.\n\nIf y \\neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.\n\n3. Let x be your current coordinate, and y = x-B. The lotus at coordinate x disappears, and you move to coordinate y.\n\nIf y = N-1, the game ends.\n\nIf y \\neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.\n\nIf y \\neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.\n\n4. Go back to step 2.\n\nYou want to end the game with as high a score as possible.\nWhat is the score obtained by the optimal choice of A and B?\n\nConstraints\n\n3 \\leq N \\leq 10^5\n\n-10^9 \\leq s_i \\leq 10^9\n\ns_0=s_{N-1}=0\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_0 s_1 ...... s_{N-1}\n\nOutput\n\nPrint the score obtained by the optimal choice of A and B.\n\nSample Input 1\n\n5\n0 2 5 1 0\n\nSample Output 1\n\n3\n\nIf you choose A = 3 and B = 2, the game proceeds as follows:\n\nMove to coordinate 0 + 3 = 3. Your score increases by s_3 = 1.\n\nMove to coordinate 3 - 2 = 1. Your score increases by s_1 = 2.\n\nMove to coordinate 1 + 3 = 4. The game ends with a score of 3.\n\nThere is no way to end the game with a score of 4 or higher, so the answer is 3. Note that you cannot land the lotus at coordinate 2 without drowning later.\n\nSample Input 2\n\n6\n0 10 -7 -4 -13 0\n\nSample Output 2\n\n0\n\nThe optimal strategy here is to land the final lotus immediately by choosing A = 5 (the value of B does not matter).\n\nSample Input 3\n\n11\n0 -4 0 -99 31 14 -15 -39 43 18 0\n\nSample Output 3\n\n59", "sample_input": "5\n0 2 5 1 0\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03034", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere is an infinitely large pond, which we consider as a number line.\nIn this pond, there are N lotuses floating at coordinates 0, 1, 2, ..., N-2 and N-1.\nOn the lotus at coordinate i, an integer s_i is written.\n\nYou are standing on the lotus at coordinate 0. You will play a game that proceeds as follows:\n\n1. Choose positive integers A and B. Your score is initially 0.\n\n2. Let x be your current coordinate, and y = x+A. The lotus at coordinate x disappears, and you move to coordinate y.\n\nIf y = N-1, the game ends.\n\nIf y \\neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.\n\nIf y \\neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.\n\n3. Let x be your current coordinate, and y = x-B. The lotus at coordinate x disappears, and you move to coordinate y.\n\nIf y = N-1, the game ends.\n\nIf y \\neq N-1 and there is a lotus floating at coordinate y, your score increases by s_y.\n\nIf y \\neq N-1 and there is no lotus floating at coordinate y, you drown. Your score decreases by 10^{100} points, and the game ends.\n\n4. Go back to step 2.\n\nYou want to end the game with as high a score as possible.\nWhat is the score obtained by the optimal choice of A and B?\n\nConstraints\n\n3 \\leq N \\leq 10^5\n\n-10^9 \\leq s_i \\leq 10^9\n\ns_0=s_{N-1}=0\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_0 s_1 ...... s_{N-1}\n\nOutput\n\nPrint the score obtained by the optimal choice of A and B.\n\nSample Input 1\n\n5\n0 2 5 1 0\n\nSample Output 1\n\n3\n\nIf you choose A = 3 and B = 2, the game proceeds as follows:\n\nMove to coordinate 0 + 3 = 3. Your score increases by s_3 = 1.\n\nMove to coordinate 3 - 2 = 1. Your score increases by s_1 = 2.\n\nMove to coordinate 1 + 3 = 4. The game ends with a score of 3.\n\nThere is no way to end the game with a score of 4 or higher, so the answer is 3. Note that you cannot land the lotus at coordinate 2 without drowning later.\n\nSample Input 2\n\n6\n0 10 -7 -4 -13 0\n\nSample Output 2\n\n0\n\nThe optimal strategy here is to land the final lotus immediately by choosing A = 5 (the value of B does not matter).\n\nSample Input 3\n\n11\n0 -4 0 -99 31 14 -15 -39 43 18 0\n\nSample Output 3\n\n59", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 621, "cpu_time_ms": 778, "memory_kb": 144556}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s070369034", "group_id": "codeNet:p03035", "input_text": "A,B = parse.(split(readline()))\n\nif A > 12\n println(B)\nelseif A > 5\n println(Int(B/2))\nelse\n println(0)\nend", "language": "Julia", "metadata": {"date": 1584283395, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s070369034.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s070369034", "user_id": "u879294842"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "A,B = parse.(split(readline()))\n\nif A > 12\n println(B)\nelseif A > 5\n println(Int(B/2))\nelse\n println(0)\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 598, "memory_kb": 118180}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s060120702", "group_id": "codeNet:p03035", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n a,b=parseMap(split(readline()))\n if a>=13\n println(b)\n elseif a>=6\n println(div(b,2))\n else\n println(0)\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1582947061, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s060120702.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s060120702", "user_id": "u619197965"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n a,b=parseMap(split(readline()))\n if a>=13\n println(b)\n elseif a>=6\n println(div(b,2))\n else\n println(0)\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 388, "memory_kb": 113000}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s123650281", "group_id": "codeNet:p03035", "input_text": "lines=readlines(open(\"/dev/fd/0\"))\ninput()=shift!(lines)\nint(s::String)=parse(Int,s)\nintSub(s::SubString{String})=parse(Int,s)\nintLine(s::Array{SubString{String},1})=map(intSub,s)\nfunction main()\n a,b=intLine(split(input()))\n println(ifelse(a>12,b,ifelse(a>5,floor(Int,b/2),0)))\nend\nmain()", "language": "Julia", "metadata": {"date": 1561026430, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s123650281.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s123650281", "user_id": "u729133443"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "lines=readlines(open(\"/dev/fd/0\"))\ninput()=shift!(lines)\nint(s::String)=parse(Int,s)\nintSub(s::SubString{String})=parse(Int,s)\nintLine(s::Array{SubString{String},1})=map(intSub,s)\nfunction main()\n a,b=intLine(split(input()))\n println(ifelse(a>12,b,ifelse(a>5,floor(Int,b/2),0)))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 357, "memory_kb": 110848}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s118796106", "group_id": "codeNet:p03035", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n A, B = readline() |> split |> parseArray\n\n result = if A>=13\n B\n elseif A>=6\n div(B,2)\n else\n 0\n end\n\n println(result)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1558832536, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s118796106.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s118796106", "user_id": "u630185395"}, "prompt_components": {"gold_output": "100\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n A, B = readline() |> split |> parseArray\n\n result = if A>=13\n B\n elseif A>=6\n div(B,2)\n else\n 0\n end\n\n println(result)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 854, "memory_kb": 168640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s810091104", "group_id": "codeNet:p03036", "input_text": "parseint(x) = parse(Int, x)\nparseintmap(x::Array{SubString{String},1}) = map(parseint, x)\n\nfunction solve(r::Int, d::Int, x::Int)\n for _ in 1:10\n x = r*x-d\n println(x)\n end\nend\n\nfunction main()\n r, d, x= readline() |> split |> parseintmap\n solve(r, d, x)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1559337456, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s810091104.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s810091104", "user_id": "u503181529"}, "prompt_components": {"gold_output": "30\n50\n90\n170\n330\n650\n1290\n2570\n5130\n10250\n", "input_to_evaluate": "parseint(x) = parse(Int, x)\nparseintmap(x::Array{SubString{String},1}) = map(parseint, x)\n\nfunction solve(r::Int, d::Int, x::Int)\n for _ in 1:10\n x = r*x-d\n println(x)\n end\nend\n\nfunction main()\n r, d, x= readline() |> split |> parseintmap\n solve(r, d, x)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 952, "memory_kb": 165540}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s834391920", "group_id": "codeNet:p03036", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tr,d,x = readline() |> split |> parseMap\n\tfor i in 1:10\n\t\tx = r*x-d\n\t\tprintln(x)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1559172170, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s834391920.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s834391920", "user_id": "u095714878"}, "prompt_components": {"gold_output": "30\n50\n90\n170\n330\n650\n1290\n2570\n5130\n10250\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tr,d,x = readline() |> split |> parseMap\n\tfor i in 1:10\n\t\tx = r*x-d\n\t\tprintln(x)\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 826, "memory_kb": 169096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s599034757", "group_id": "codeNet:p03037", "input_text": "parseInt(x) = parse(Int,x)\n\nfunction main()\n (N,M) = map(parseInt, split(readline()))\n L = zeros(Int,M)\n R = zeros(Int,M)\n for i = 1:M\n (L[i],R[i]) = map(parseInt, split(readline()))\n end\n l = maximum(L)\n r = minimum(R)\n println(max(r-l+1,0))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1562198542, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s599034757.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s599034757", "user_id": "u709180765"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nfunction main()\n (N,M) = map(parseInt, split(readline()))\n L = zeros(Int,M)\n R = zeros(Int,M)\n for i = 1:M\n (L[i],R[i]) = map(parseInt, split(readline()))\n end\n l = maximum(L)\n r = minimum(R)\n println(max(r-l+1,0))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1356, "memory_kb": 153044}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s677634065", "group_id": "codeNet:p03037", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N,M = readline() |> split |> parseArray\n L,R=zeros(M),zeros(M)\n for i in 1:M\n L[i],R[i] = readline() |> split |> parseArray\n end\n\n c=0\n for i in 1:M\n if L[i]==1&&R[i]>=M\n c+=1\n end\n end\n\n println(c)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1558832801, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s677634065.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s677634065", "user_id": "u630185395"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N,M = readline() |> split |> parseArray\n L,R=zeros(M),zeros(M)\n for i in 1:M\n L[i],R[i] = readline() |> split |> parseArray\n end\n\n c=0\n for i in 1:M\n if L[i]==1&&R[i]>=M\n c+=1\n end\n end\n\n println(c)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 341, "cpu_time_ms": 912, "memory_kb": 167544}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s848160051", "group_id": "codeNet:p03038", "input_text": "parseInt(x) = parse(Int,x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N,M = readline() |> split |> parseArray\n A = readline() |> split |> parseArray\n sort!(A)\n D::Array{Int64} = []\n \n roop = 0\n for line in readlines()\n B,C = line |> split |> parseArray \n for i = 1:B\n push!(D,C)\n roop += 1\n if roop == length(A)\n break\n end\n end\n if roop == length(A)\n break\n end\n end\n \n if length(D) < length(A)\n for i = length(D) + 1:length(A)\n push!(D,0) \n end\n end\n \n sort!(D,rev=true)\n \n for i = 1:length(A)\n if A[i] < D[i]\n A[i] = D[i]\n else\n break\n end\n end\n \n print(sum(A))\nend\nmain()", "language": "Julia", "metadata": {"date": 1558911222, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s848160051.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s848160051", "user_id": "u267950110"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N,M = readline() |> split |> parseArray\n A = readline() |> split |> parseArray\n sort!(A)\n D::Array{Int64} = []\n \n roop = 0\n for line in readlines()\n B,C = line |> split |> parseArray \n for i = 1:B\n push!(D,C)\n roop += 1\n if roop == length(A)\n break\n end\n end\n if roop == length(A)\n break\n end\n end\n \n if length(D) < length(A)\n for i = length(D) + 1:length(A)\n push!(D,0) \n end\n end\n \n sort!(D,rev=true)\n \n for i = 1:length(A)\n if A[i] < D[i]\n A[i] = D[i]\n else\n break\n end\n end\n \n print(sum(A))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 709, "cpu_time_ms": 664, "memory_kb": 153960}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s632324174", "group_id": "codeNet:p03038", "input_text": "let\n N, M = map(x -> parse(Int, x), split(readline()))\n A = map(x -> parse(Int, x), split(readline()))\n change(A,term) = for i=1:term[1] if A[i] <= term[2] A[i] = term[2] else break end end\n while (M=M-1) >= 0 sort!(A); change(A, map(x -> parse(Int, x), split(readline()))) end\n print(sum(A))\nend\n", "language": "Julia", "metadata": {"date": 1558849595, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s632324174.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s632324174", "user_id": "u937119374"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "let\n N, M = map(x -> parse(Int, x), split(readline()))\n A = map(x -> parse(Int, x), split(readline()))\n change(A,term) = for i=1:term[1] if A[i] <= term[2] A[i] = term[2] else break end end\n while (M=M-1) >= 0 sort!(A); change(A, map(x -> parse(Int, x), split(readline()))) end\n print(sum(A))\nend\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 151560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s623977724", "group_id": "codeNet:p03040", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction heap(a::Array{Int,1})\n\th = [a[1]]\n\tfor i in 2:length(a)\n\t\thpush(h,a[i])\n\tend\n\th\nend\n\nfunction hpush(h::Array{Int,1},x)\n\tpush!(h,x)\n\tl = length(h)\n\tif l>1\n\t\tk = l>>1\n\t\twhile h[k]>x&&k>=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Int,1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k]>=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k]>=z&&h[2*k+1]>=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k]1\n\t\tk = l>>1\n\t\twhile h[k]=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\nend\n\nfunction hpopb(h::Array{Int,1})\n\tx = h[1]\n\tz = pop!(h)\n\tif length(h)>0\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k]<=z&&h[2*k+1]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k] parseInt\n\tl = Int[]\n\tls = 0\n\tlt = 0\n\tr = Int[]\n\trs = 0\n\trt = 0\n\ty = 0\n\tfor i in 1:q\n\t\ta = readline() |> split |> parseMap\n\t\tif a[1] == 1\n\t\t\ty += a[3]\n\t\t\tif ls == 0\n\t\t\t\tpush!(l,a[2])\n\t\t\t\tls += 1\n\t\t\t\tlt += a[2]\n\t\t\telseif rs == 0\n\t\t\t\tif l[1]1\n\t\tk = l>>1\n\t\twhile h[k]>x&&k>=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Int,1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k]>=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k]>=z&&h[2*k+1]>=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k]1\n\t\tk = l>>1\n\t\twhile h[k]=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\nend\n\nfunction hpopb(h::Array{Int,1})\n\tx = h[1]\n\tz = pop!(h)\n\tif length(h)>0\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k]<=z&&h[2*k+1]<=z\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k] parseInt\n\tl = Int[]\n\tls = 0\n\tlt = 0\n\tr = Int[]\n\trs = 0\n\trt = 0\n\ty = 0\n\tfor i in 1:q\n\t\ta = readline() |> split |> parseMap\n\t\tif a[1] == 1\n\t\t\ty += a[3]\n\t\t\tif ls == 0\n\t\t\t\tpush!(l,a[2])\n\t\t\t\tls += 1\n\t\t\t\tlt += a[2]\n\t\t\telseif rs == 0\n\t\t\t\tif l[1] split |> parseArray\n S = readline() |> parseInt\n result = S[1:K-1] * lowercase(S[K:K]) * S[K+1:end]\n println(result)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1558317448, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03041.html", "problem_id": "p03041", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03041/input.txt", "sample_output_relpath": "derived/input_output/data/p03041/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03041/Julia/s997004432.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s997004432", "user_id": "u630185395"}, "prompt_components": {"gold_output": "aBC\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N, K = readline() |> split |> parseArray\n S = readline() |> parseInt\n result = S[1:K-1] * lowercase(S[K:K]) * S[K+1:end]\n println(result)\nend\n\nmain()\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "sample_input": "3 1\nABC\n"}, "reference_outputs": ["aBC\n"], "source_document_id": "p03041", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).\nPrint the string S after lowercasing the K-th character in it.\n\nConstraints\n\n1 ≤ N ≤ 50\n\n1 ≤ K ≤ N\n\nS is a string of length N consisting of A, B and C.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nS\n\nOutput\n\nPrint the string S after lowercasing the K-th character in it.\n\nSample Input 1\n\n3 1\nABC\n\nSample Output 1\n\naBC\n\nSample Input 2\n\n4 3\nCABA\n\nSample Output 2\n\nCAbA", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1326, "memory_kb": 202012}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s959271777", "group_id": "codeNet:p03043", "input_text": "let\n N, K = map(x -> parse(Int, x), split(readline()))\n function Σ(n,K)\n sum = 0\n for i = 1:n\n if i == K break end\n sum += (1/n) * (1/2)^ceil(pow)\n end\n return sum\n end \n print(Σ(N, K))\nend\n", "language": "Julia", "metadata": {"date": 1558319906, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03043.html", "problem_id": "p03043", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03043/input.txt", "sample_output_relpath": "derived/input_output/data/p03043/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03043/Julia/s959271777.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s959271777", "user_id": "u937119374"}, "prompt_components": {"gold_output": "0.145833333333\n", "input_to_evaluate": "let\n N, K = map(x -> parse(Int, x), split(readline()))\n function Σ(n,K)\n sum = 0\n for i = 1:n\n if i == K break end\n sum += (1/n) * (1/2)^ceil(pow)\n end\n return sum\n end \n print(Σ(N, K))\nend\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:\n\nThrow the die. The current score is the result of the die.\n\nAs long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.\n\nThe game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.\n\nYou are given N and K. Find the probability that Snuke wins the game.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 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 probability that Snuke wins the game. The output is considered correct when the absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n3 10\n\nSample Output 1\n\n0.145833333333\n\nIf the die shows 1, Snuke needs to get four consecutive heads from four coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^4 = \\frac{1}{48}.\n\nIf the die shows 2, Snuke needs to get three consecutive heads from three coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^3 = \\frac{1}{24}.\n\nIf the die shows 3, Snuke needs to get two consecutive heads from two coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^2 = \\frac{1}{12}.\n\nThus, the probability that Snuke wins is \\frac{1}{48} + \\frac{1}{24} + \\frac{1}{12} = \\frac{7}{48} \\simeq 0.1458333333.\n\nSample Input 2\n\n100000 5\n\nSample Output 2\n\n0.999973749998", "sample_input": "3 10\n"}, "reference_outputs": ["0.145833333333\n"], "source_document_id": "p03043", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:\n\nThrow the die. The current score is the result of the die.\n\nAs long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.\n\nThe game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.\n\nYou are given N and K. Find the probability that Snuke wins the game.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ K ≤ 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 probability that Snuke wins the game. The output is considered correct when the absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n3 10\n\nSample Output 1\n\n0.145833333333\n\nIf the die shows 1, Snuke needs to get four consecutive heads from four coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^4 = \\frac{1}{48}.\n\nIf the die shows 2, Snuke needs to get three consecutive heads from three coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^3 = \\frac{1}{24}.\n\nIf the die shows 3, Snuke needs to get two consecutive heads from two coin flips to obtain a score of 10 or above. The probability of this happening is \\frac{1}{3} \\times (\\frac{1}{2})^2 = \\frac{1}{12}.\n\nThus, the probability that Snuke wins is \\frac{1}{48} + \\frac{1}{24} + \\frac{1}{12} = \\frac{7}{48} \\simeq 0.1458333333.\n\nSample Input 2\n\n100000 5\n\nSample Output 2\n\n0.999973749998", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 219, "cpu_time_ms": 2112, "memory_kb": 136908}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s263085564", "group_id": "codeNet:p03044", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N = readline() |> parseInt\n e = [Tuple{Int, Int}[] for i in 1:N]\n for i in 1:N - 1\n u, v, w = readline() |> split |> parseArray\n push!(e[u], (v, w))\n push!(e[v], (u, w))\n end\n\n a = zeros(N)\n a[1] = 1\n\n function dfs(u)\n for (v, w) in e[u]\n if a[v] == 0\n a[v] = -((w%2)*2-1) * a[u]\n dfs(v)\n end\n end\n end\n\n dfs(1)\n\n for j in 1:N\n println(a[j] == 1 ? 1 : 0)\n end\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1558827486, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s263085564.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s263085564", "user_id": "u630185395"}, "prompt_components": {"gold_output": "0\n0\n1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N = readline() |> parseInt\n e = [Tuple{Int, Int}[] for i in 1:N]\n for i in 1:N - 1\n u, v, w = readline() |> split |> parseArray\n push!(e[u], (v, w))\n push!(e[v], (u, w))\n end\n\n a = zeros(N)\n a[1] = 1\n\n function dfs(u)\n for (v, w) in e[u]\n if a[v] == 0\n a[v] = -((w%2)*2-1) * a[u]\n dfs(v)\n end\n end\n end\n\n dfs(1)\n\n for j in 1:N\n println(a[j] == 1 ? 1 : 0)\n end\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 871, "memory_kb": 186616}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s865896593", "group_id": "codeNet:p03044", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N = readline() |> parseInt\n e = [Tuple{Int, Int}[] for i in 1:N]\n for i in 1:N - 1\n u, v, w = readline() |> split |> parseArray\n push!(e[u], (v, w))\n push!(e[v], (u, w))\n end\n\n a = zeros(N)\n ux = [1]\n a[ux[end]] = 1\n while true\n @label loop\n u = ux[end]\n for (v, w) in e[u]\n if a[v] == 0\n a[v] = -((w%2)*2-1) * a[u]\n push!(ux, v)\n @goto loop\n end\n end\n pop!(ux)\n if length(ux) == 0\n break\n end\n end\n\n for j in 1:N\n println(a[j] == 1 ? 1 : 0)\n end\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1558826709, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s865896593.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s865896593", "user_id": "u630185395"}, "prompt_components": {"gold_output": "0\n0\n1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N = readline() |> parseInt\n e = [Tuple{Int, Int}[] for i in 1:N]\n for i in 1:N - 1\n u, v, w = readline() |> split |> parseArray\n push!(e[u], (v, w))\n push!(e[v], (u, w))\n end\n\n a = zeros(N)\n ux = [1]\n a[ux[end]] = 1\n while true\n @label loop\n u = ux[end]\n for (v, w) in e[u]\n if a[v] == 0\n a[v] = -((w%2)*2-1) * a[u]\n push!(ux, v)\n @goto loop\n end\n end\n pop!(ux)\n if length(ux) == 0\n break\n end\n end\n\n for j in 1:N\n println(a[j] == 1 ? 1 : 0)\n end\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2111, "memory_kb": 164288}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s687574495", "group_id": "codeNet:p03045", "input_text": "function main()\n\tlines=readlines()\n\tN,M=map(x->parse(Int,x),split(shift!(lines)))\n\tG=[Array{Int}(0) for _=1:N]\n\tfor s=lines\n\t\tu,v,w=map(x->parse(Int,x),split(s))\n\t\tpush!(G[u],v)\n\t\tpush!(G[v],u)\n\tend\n\tused=[false for _=1:N]\n\tfunction dfs(u)\n\t\tused[u]=true\n\t\tfor v=G[u]\n\t\t\tif !used[v]\n\t\t\t\tdfs(v)\n\t\t\tend\n\t\tend\n\tend\n\tans=0\n\tfor i=1:N\n\t\tif !used[i]\n\t\t\tdfs(i)\n\t\t\tans+=1\n\t\tend\n\tend\n\tprintln(ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561279512, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03045.html", "problem_id": "p03045", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03045/input.txt", "sample_output_relpath": "derived/input_output/data/p03045/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03045/Julia/s687574495.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s687574495", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n\tlines=readlines()\n\tN,M=map(x->parse(Int,x),split(shift!(lines)))\n\tG=[Array{Int}(0) for _=1:N]\n\tfor s=lines\n\t\tu,v,w=map(x->parse(Int,x),split(s))\n\t\tpush!(G[u],v)\n\t\tpush!(G[v],u)\n\tend\n\tused=[false for _=1:N]\n\tfunction dfs(u)\n\t\tused[u]=true\n\t\tfor v=G[u]\n\t\t\tif !used[v]\n\t\t\t\tdfs(v)\n\t\t\tend\n\t\tend\n\tend\n\tans=0\n\tfor i=1:N\n\t\tif !used[i]\n\t\t\tdfs(i)\n\t\t\tans+=1\n\t\tend\n\tend\n\tprintln(ans)\nend\nmain()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N cards placed face down in a row. On each card, an integer 1 or 2 is written.\n\nLet A_i be the integer written on the i-th card.\n\nYour objective is to guess A_1, A_2, ..., A_N correctly.\n\nYou know the following facts:\n\nFor each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number.\n\nYou are a magician and can use the following magic any number of times:\n\nMagic: Choose one card and know the integer A_i written on it. The cost of using this magic is 1.\n\nWhat is the minimum cost required to determine all of A_1, A_2, ..., A_N?\n\nIt is guaranteed that there is no contradiction in given input.\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\n1 \\leq Z_i \\leq 100\n\nThe pairs (X_i, Y_i) are distinct.\n\nThere is no contradiction in input. (That is, there exist integers A_1, A_2, ..., A_N that satisfy the conditions.)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 Y_1 Z_1\nX_2 Y_2 Z_2\n\\vdots\nX_M Y_M Z_M\n\nOutput\n\nPrint the minimum total cost required to determine all of A_1, A_2, ..., A_N.\n\nSample Input 1\n\n3 1\n1 2 1\n\nSample Output 1\n\n2\n\nYou can determine all of A_1, A_2, A_3 by using the magic for the first and third cards.\n\nSample Input 2\n\n6 5\n1 2 1\n2 3 2\n1 3 3\n4 5 4\n5 6 5\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1\n1 100000 100\n\nSample Output 3\n\n99999", "sample_input": "3 1\n1 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03045", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N cards placed face down in a row. On each card, an integer 1 or 2 is written.\n\nLet A_i be the integer written on the i-th card.\n\nYour objective is to guess A_1, A_2, ..., A_N correctly.\n\nYou know the following facts:\n\nFor each i = 1, 2, ..., M, the value A_{X_i} + A_{Y_i} + Z_i is an even number.\n\nYou are a magician and can use the following magic any number of times:\n\nMagic: Choose one card and know the integer A_i written on it. The cost of using this magic is 1.\n\nWhat is the minimum cost required to determine all of A_1, A_2, ..., A_N?\n\nIt is guaranteed that there is no contradiction in given input.\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\n1 \\leq Z_i \\leq 100\n\nThe pairs (X_i, Y_i) are distinct.\n\nThere is no contradiction in input. (That is, there exist integers A_1, A_2, ..., A_N that satisfy the conditions.)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nX_1 Y_1 Z_1\nX_2 Y_2 Z_2\n\\vdots\nX_M Y_M Z_M\n\nOutput\n\nPrint the minimum total cost required to determine all of A_1, A_2, ..., A_N.\n\nSample Input 1\n\n3 1\n1 2 1\n\nSample Output 1\n\n2\n\nYou can determine all of A_1, A_2, A_3 by using the magic for the first and third cards.\n\nSample Input 2\n\n6 5\n1 2 1\n2 3 2\n1 3 3\n4 5 4\n5 6 5\n\nSample Output 2\n\n2\n\nSample Input 3\n\n100000 1\n1 100000 100\n\nSample Output 3\n\n99999", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 932, "memory_kb": 191960}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s424383517", "group_id": "codeNet:p03048", "input_text": "function main()\n RR,GG,BB,N=map(x->parse(Int,x),split(readline()))\n num=[RR,GG,BB]\n R=maximum(num)\n B=minimum(num)\n G=RR+GG+BB-R-B\n ans=0\n if R==G && G==B && N%R==0\n temp=N/R\n ans=Int(floor((temp+1)*(temp+2)/2))\n elseif R==G || G==B\n for rr=N:-R:0\n if rr%B==0\n ans+=Int(rr/B)+1\n end\n end\n else\n for rr=N:-R:0,rg=rr:-G:0\n ans+=rg%B==0\n end\n end\n println(ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1568122532, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s424383517.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s424383517", "user_id": "u870468721"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function main()\n RR,GG,BB,N=map(x->parse(Int,x),split(readline()))\n num=[RR,GG,BB]\n R=maximum(num)\n B=minimum(num)\n G=RR+GG+BB-R-B\n ans=0\n if R==G && G==B && N%R==0\n temp=N/R\n ans=Int(floor((temp+1)*(temp+2)/2))\n elseif R==G || G==B\n for rr=N:-R:0\n if rr%B==0\n ans+=Int(rr/B)+1\n end\n end\n else\n for rr=N:-R:0,rg=rr:-G:0\n ans+=rg%B==0\n end\n end\n println(ans)\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 420, "cpu_time_ms": 429, "memory_kb": 117636}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s883958556", "group_id": "codeNet:p03048", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n # R, G, B, N = map(parseInt, split(readline()))\n R, G, B, N = readline() |> split |> parseArray\n\n # box = sort([R,G,B],rev=true)\n c = 0\n # f(i::Int, j::Int)::Bool = (N-R*i-G*j)%B==0\n f(i::Int, j::Int)::Bool = mod(N-R*i-G*j,B)==0\n # g(i::Int)::Int=div(N-box[1]*i,box[2])\n g(i::Int)::Int=floor(Int, (N-R*i)/G)\n for i=0:div(N,R)\n for j=0:g(i)\n if f(i, j)\n c += 1\n end\n end\n end\n println(c)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1558217660, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s883958556.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s883958556", "user_id": "u630185395"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n # R, G, B, N = map(parseInt, split(readline()))\n R, G, B, N = readline() |> split |> parseArray\n\n # box = sort([R,G,B],rev=true)\n c = 0\n # f(i::Int, j::Int)::Bool = (N-R*i-G*j)%B==0\n f(i::Int, j::Int)::Bool = mod(N-R*i-G*j,B)==0\n # g(i::Int)::Int=div(N-box[1]*i,box[2])\n g(i::Int)::Int=floor(Int, (N-R*i)/G)\n for i=0:div(N,R)\n for j=0:g(i)\n if f(i, j)\n c += 1\n end\n end\n end\n println(c)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 540, "cpu_time_ms": 2112, "memory_kb": 167280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s700074153", "group_id": "codeNet:p03048", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n R, G, B, N = map(parseInt, split(readline()))\n\n box = sort([R,G,B],rev=true)\n c = 0\n f(i::Int, j::Int)::Bool = (N-box[1]*i-box[2]*j)%box[3]==0\n g(i::Int)::Int=div(N-box[1]*i,box[2])\n for i=0:div(N,box[1])\n for j=0:g(i)\n if f(i, j)\n c += 1\n end\n end\n end\n println(c)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1558215321, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s700074153.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s700074153", "user_id": "u630185395"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n R, G, B, N = map(parseInt, split(readline()))\n\n box = sort([R,G,B],rev=true)\n c = 0\n f(i::Int, j::Int)::Bool = (N-box[1]*i-box[2]*j)%box[3]==0\n g(i::Int)::Int=div(N-box[1]*i,box[2])\n for i=0:div(N,box[1])\n for j=0:g(i)\n if f(i, j)\n c += 1\n end\n end\n end\n println(c)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 172572}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s582205871", "group_id": "codeNet:p03048", "input_text": "stoi(s::String) = parse(Int, s)\n\nfunction solve()\n R, G, B, N = map(stoi, split(readline()))\n\n ans = 0\n for r in 0:div(N, R), g in 0:div(N, G)\n t = N - R*r - G*g\n t < 0 && continue\n mod(t, B) == 0 && (ans += 1)\n end\n\n println(ans)\n\n return nothing\nend\n\nsolve()", "language": "Julia", "metadata": {"date": 1557679682, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s582205871.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s582205871", "user_id": "u796269639"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "stoi(s::String) = parse(Int, s)\n\nfunction solve()\n R, G, B, N = map(stoi, split(readline()))\n\n ans = 0\n for r in 0:div(N, R), g in 0:div(N, G)\n t = N - R*r - G*g\n t < 0 && continue\n mod(t, B) == 0 && (ans += 1)\n end\n\n println(ans)\n\n return nothing\nend\n\nsolve()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1919, "memory_kb": 219376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s292547294", "group_id": "codeNet:p03048", "input_text": "stoi(s) = parse(Int, s)\n\nfunction solve()\n R, G, B, N = map(stoi, split(chomp(readline())))\n\n ans = 0\n for r in 0:div(N, R), g in 0:div(N, G)\n b = div(N - R*r - G*g, B)\n b < 0 && continue\n if R*r + G*g + B*b == N\n ans += 1\n end\n end\n\n println(ans)\n\n return nothing\nend\n\nsolve()", "language": "Julia", "metadata": {"date": 1557679349, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s292547294.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s292547294", "user_id": "u796269639"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "stoi(s) = parse(Int, s)\n\nfunction solve()\n R, G, B, N = map(stoi, split(chomp(readline())))\n\n ans = 0\n for r in 0:div(N, R), g in 0:div(N, G)\n b = div(N - R*r - G*g, B)\n b < 0 && continue\n if R*r + G*g + B*b == N\n ans += 1\n end\n end\n\n println(ans)\n\n return nothing\nend\n\nsolve()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2113, "memory_kb": 169280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s636213305", "group_id": "codeNet:p03049", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n N = readline() |> parseInt\n s = Array{String}(N)\n for i=1:N\n s[i]=readline()|>strip\n end\n\n # w=count(b->b,map(ss->contains(ss,\"AB\"),s))\n w=sum(map(ss->(split(ss,\"AB\")|>length)-1,s))\n x=count(b->b,map(ss->ss[1]!='B'&&ss[end]=='A',s))\n y=count(b->b,map(ss->ss[1]=='B'&&ss[end]!='A',s))\n z=count(b->b,map(ss->ss[1]=='B'&&ss[end]=='A',s))\n # println([x,y,z,w])\n result=z-1+(x>=1?1:0)+(y>=1?1:0)+((x>=1&&y>=1)?min(x-1,y-1):0)+w\n\n println(result)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1557686074, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s636213305.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s636213305", "user_id": "u630185395"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n N = readline() |> parseInt\n s = Array{String}(N)\n for i=1:N\n s[i]=readline()|>strip\n end\n\n # w=count(b->b,map(ss->contains(ss,\"AB\"),s))\n w=sum(map(ss->(split(ss,\"AB\")|>length)-1,s))\n x=count(b->b,map(ss->ss[1]!='B'&&ss[end]=='A',s))\n y=count(b->b,map(ss->ss[1]=='B'&&ss[end]!='A',s))\n z=count(b->b,map(ss->ss[1]=='B'&&ss[end]=='A',s))\n # println([x,y,z,w])\n result=z-1+(x>=1?1:0)+(y>=1?1:0)+((x>=1&&y>=1)?min(x-1,y-1):0)+w\n\n println(result)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 912, "memory_kb": 175016}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s073152034", "group_id": "codeNet:p03049", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = [\"\" for i in 1:n]\n\tfor i in 1:n\n\t\ts[i] = chomp(readline())\n\tend\n\tk = 0\n\th = 0\n\tt = 0\n\tb = 0\n\tfor i in 1:n\n\t\tl = length(s[i])\n\t\tfor j in 2:l\n\t\t\tif s[i][j-1] == 'A' && s[i][j] == 'B'\n\t\t\t\tk += 1\n\t\t\tend\n\t\tend\n\t\tif s[i][1] == 'B' && s[i][l] == 'A'\n\t\t\tb += 1\n\t\telseif s[i][1] == 'B'\n\t\t\th += 1\n\t\telseif s[i][l] == 'A'\n\t\t\tt += 1\n\t\tend\n\tend\n\tif b >= h && b >= t\n\t\tk += t+h+b-min(t,h)-1\n\telseif b<= h && b <= t\n\t\tk += 2*b + min(t-b,h-b)\n\telse\n\t\tk += 2*min(t,h) + b-min(t,h)\n\tend\n\tprintln(k)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1557625643, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s073152034.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s073152034", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = [\"\" for i in 1:n]\n\tfor i in 1:n\n\t\ts[i] = chomp(readline())\n\tend\n\tk = 0\n\th = 0\n\tt = 0\n\tb = 0\n\tfor i in 1:n\n\t\tl = length(s[i])\n\t\tfor j in 2:l\n\t\t\tif s[i][j-1] == 'A' && s[i][j] == 'B'\n\t\t\t\tk += 1\n\t\t\tend\n\t\tend\n\t\tif s[i][1] == 'B' && s[i][l] == 'A'\n\t\t\tb += 1\n\t\telseif s[i][1] == 'B'\n\t\t\th += 1\n\t\telseif s[i][l] == 'A'\n\t\t\tt += 1\n\t\tend\n\tend\n\tif b >= h && b >= t\n\t\tk += t+h+b-min(t,h)-1\n\telseif b<= h && b <= t\n\t\tk += 2*b + min(t-b,h-b)\n\telse\n\t\tk += 2*min(t,h) + b-min(t,h)\n\tend\n\tprintln(k)\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 623, "cpu_time_ms": 861, "memory_kb": 174808}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s870370403", "group_id": "codeNet:p03049", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = [\"\" for i in 1:n]\n\tfor i in 1:n\n\t\ts[i] = chomp(readline())\n\tend\n\tk = 0\n\th = 0\n\tt = 0\n\tb = 0\n\tfor i in 1:n\n\t\tl = length(s[i])\n\t\tfor j in 2:l\n\t\t\tif s[i][j-1] == 'A' && s[i][j] == 'B'\n\t\t\t\tk += 1\n\t\t\tend\n\t\tend\n\t\tif s[i][1] == 'B' && s[i][l] == 'A'\n\t\t\tb += 1\n\t\telseif s[i][1] == 'B'\n\t\t\th += 1\n\t\telseif s[i][l] == 'A'\n\t\t\tt += 1\n\t\tend\n\tend\n\tif h+b>t||b+t>h\n\t\tz = max(min(h+b,t),min(h,b+t))\n\t\tk += z + b-abs(h-t)\n\telseif h+b<=t\n\t\tk += h+b\n\telseif b+t<=h\n\t\tk += b+t\n\tend\n\tprintln(k)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1557625130, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s870370403.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s870370403", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = [\"\" for i in 1:n]\n\tfor i in 1:n\n\t\ts[i] = chomp(readline())\n\tend\n\tk = 0\n\th = 0\n\tt = 0\n\tb = 0\n\tfor i in 1:n\n\t\tl = length(s[i])\n\t\tfor j in 2:l\n\t\t\tif s[i][j-1] == 'A' && s[i][j] == 'B'\n\t\t\t\tk += 1\n\t\t\tend\n\t\tend\n\t\tif s[i][1] == 'B' && s[i][l] == 'A'\n\t\t\tb += 1\n\t\telseif s[i][1] == 'B'\n\t\t\th += 1\n\t\telseif s[i][l] == 'A'\n\t\t\tt += 1\n\t\tend\n\tend\n\tif h+b>t||b+t>h\n\t\tz = max(min(h+b,t),min(h,b+t))\n\t\tk += z + b-abs(h-t)\n\telseif h+b<=t\n\t\tk += h+b\n\telseif b+t<=h\n\t\tk += b+t\n\tend\n\tprintln(k)\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 744, "memory_kb": 119380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s384670592", "group_id": "codeNet:p03050", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N = readline() |> parseInt\n\n result=0\n # for i in 1:N\n # N÷i!=N%i&&continue\n # result+=i\n # end\n for i in 1:floor(Int, sqrt(N))\n (N==i^2 || (N-i)%i!=0) && continue\n result+=(N-i)÷i\n end\n println(result)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1558222070, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s384670592.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s384670592", "user_id": "u630185395"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n N = readline() |> parseInt\n\n result=0\n # for i in 1:N\n # N÷i!=N%i&&continue\n # result+=i\n # end\n for i in 1:floor(Int, sqrt(N))\n (N==i^2 || (N-i)%i!=0) && continue\n result+=(N-i)÷i\n end\n println(result)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 344, "cpu_time_ms": 771, "memory_kb": 165268}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s147965459", "group_id": "codeNet:p03054", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\th,w,n = readline() |> split |> parseMap\n\ty,x = readline() |> split |> parseMap\n\ts = chomp(readline())\n\tt = chomp(readline())\n\tsl = zeros(Int,n)\n\tsr = zeros(Int,n)\n\tsu = zeros(Int,n)\n\tsd = zeros(Int,n)\n\ttl = zeros(Int,n)\n\ttr = zeros(Int,n)\n\ttu = zeros(Int,n)\n\ttd = zeros(Int,n)\n\tif s[1] == 'L'\n\t\tsl[1] = 1\n\telseif s[1] == 'R'\n\t\tsr[1] = 1\n\telseif s[1] == 'U'\n\t\tsu[1] = 1\n\telse\n\t\tsd[1] = 1\n\tend\n\tif t[1] == 'L' && x+sr[1]>1\n\t\ttl[1] = 1\n\telseif t[1] == 'R' && x-sl[1]1\n\t\ttu[1] = 1\n\telseif t[1] == 'D' && y-su[1] 1\n\t\t\ttl[i] += 1\n\t\telseif t[i] == 'R' && x-sl[i]+tr[i] < w\n\t\t\ttr[i] += 1\n\t\telseif t[i] == 'U' && y+sd[i]-tu[i] < 1\n\t\t\ttu[i] += 1\n\t\telseif t[i] == 'D' && y-su[i]+td[i] < h\n\t\t\ttd[i] += 1\n\t\tend\n\tend\n\tflg = 0\n\tif x-sl[1] < 1 || x+sr[1] > w || y-sd[1]<0 || y+su[1] > h\n\t\tflg = 1\n\telse\n\t\tfor i in 2:n\n\t\t\tif x-sl[i]+tr[i-1] < 1 || x+sr[i]-tl[i-1] > w || y-su[i]+td[i-1] < 0 || y+sd[i]-tu[i-1]>h\n\t\t\t\tflg = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tprintln(flg == 1?\"NO\":\"YES\")\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1557022378, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03054.html", "problem_id": "p03054", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03054/input.txt", "sample_output_relpath": "derived/input_output/data/p03054/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03054/Julia/s147965459.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s147965459", "user_id": "u095714878"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\th,w,n = readline() |> split |> parseMap\n\ty,x = readline() |> split |> parseMap\n\ts = chomp(readline())\n\tt = chomp(readline())\n\tsl = zeros(Int,n)\n\tsr = zeros(Int,n)\n\tsu = zeros(Int,n)\n\tsd = zeros(Int,n)\n\ttl = zeros(Int,n)\n\ttr = zeros(Int,n)\n\ttu = zeros(Int,n)\n\ttd = zeros(Int,n)\n\tif s[1] == 'L'\n\t\tsl[1] = 1\n\telseif s[1] == 'R'\n\t\tsr[1] = 1\n\telseif s[1] == 'U'\n\t\tsu[1] = 1\n\telse\n\t\tsd[1] = 1\n\tend\n\tif t[1] == 'L' && x+sr[1]>1\n\t\ttl[1] = 1\n\telseif t[1] == 'R' && x-sl[1]1\n\t\ttu[1] = 1\n\telseif t[1] == 'D' && y-su[1] 1\n\t\t\ttl[i] += 1\n\t\telseif t[i] == 'R' && x-sl[i]+tr[i] < w\n\t\t\ttr[i] += 1\n\t\telseif t[i] == 'U' && y+sd[i]-tu[i] < 1\n\t\t\ttu[i] += 1\n\t\telseif t[i] == 'D' && y-su[i]+td[i] < h\n\t\t\ttd[i] += 1\n\t\tend\n\tend\n\tflg = 0\n\tif x-sl[1] < 1 || x+sr[1] > w || y-sd[1]<0 || y+su[1] > h\n\t\tflg = 1\n\telse\n\t\tfor i in 2:n\n\t\t\tif x-sl[i]+tr[i-1] < 1 || x+sr[i]-tl[i-1] > w || y-su[i]+td[i-1] < 0 || y+sd[i]-tu[i-1]>h\n\t\t\t\tflg = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tprintln(flg == 1?\"NO\":\"YES\")\nend\nmain()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a rectangular grid of squares 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.\nOn this grid, there is a piece, which is initially placed at square (s_r,s_c).\n\nTakahashi and Aoki will play a game, where each player has a string of length N.\nTakahashi's string is S, and Aoki's string is T. S and T both consist of four kinds of letters: L, R, U and D.\n\nThe game consists of N steps. The i-th step proceeds as follows:\n\nFirst, Takahashi performs a move. He either moves the piece in the direction of S_i, or does not move the piece.\n\nSecond, Aoki performs a move. He either moves the piece in the direction of T_i, or does not move the piece.\n\nHere, to move the piece in the direction of L, R, U and D, is to move the piece from square (r,c) to square (r,c-1), (r,c+1), (r-1,c) and (r+1,c), respectively. If the destination square does not exist, the piece is removed from the grid, and the game ends, even if less than N steps are done.\n\nTakahashi wants to remove the piece from the grid in one of the N steps.\nAoki, on the other hand, wants to finish the N steps with the piece remaining on the grid.\nDetermine if the piece will remain on the grid at the end of the game when both players play optimally.\n\nConstraints\n\n2 \\leq H,W \\leq 2 \\times 10^5\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq s_r \\leq H\n\n1 \\leq s_c \\leq W\n\n|S|=|T|=N\n\nS and T consists of the four kinds of letters L, R, U and D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W N\ns_r s_c\nS\nT\n\nOutput\n\nIf the piece will remain on the grid at the end of the game, print YES; otherwise, print NO.\n\nSample Input 1\n\n2 3 3\n2 2\nRRL\nLUD\n\nSample Output 1\n\nYES\n\nHere is one possible progress of the game:\n\nTakahashi moves the piece right. The piece is now at (2,3).\n\nAoki moves the piece left. The piece is now at (2,2).\n\nTakahashi does not move the piece. The piece remains at (2,2).\n\nAoki moves the piece up. The piece is now at (1,2).\n\nTakahashi moves the piece left. The piece is now at (1,1).\n\nAoki does not move the piece. The piece remains at (1,1).\n\nSample Input 2\n\n4 3 5\n2 2\nUDRRR\nLLDUD\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n5 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD\n\nSample Output 3\n\nNO", "sample_input": "2 3 3\n2 2\nRRL\nLUD\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03054", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a rectangular grid of squares 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.\nOn this grid, there is a piece, which is initially placed at square (s_r,s_c).\n\nTakahashi and Aoki will play a game, where each player has a string of length N.\nTakahashi's string is S, and Aoki's string is T. S and T both consist of four kinds of letters: L, R, U and D.\n\nThe game consists of N steps. The i-th step proceeds as follows:\n\nFirst, Takahashi performs a move. He either moves the piece in the direction of S_i, or does not move the piece.\n\nSecond, Aoki performs a move. He either moves the piece in the direction of T_i, or does not move the piece.\n\nHere, to move the piece in the direction of L, R, U and D, is to move the piece from square (r,c) to square (r,c-1), (r,c+1), (r-1,c) and (r+1,c), respectively. If the destination square does not exist, the piece is removed from the grid, and the game ends, even if less than N steps are done.\n\nTakahashi wants to remove the piece from the grid in one of the N steps.\nAoki, on the other hand, wants to finish the N steps with the piece remaining on the grid.\nDetermine if the piece will remain on the grid at the end of the game when both players play optimally.\n\nConstraints\n\n2 \\leq H,W \\leq 2 \\times 10^5\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq s_r \\leq H\n\n1 \\leq s_c \\leq W\n\n|S|=|T|=N\n\nS and T consists of the four kinds of letters L, R, U and D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W N\ns_r s_c\nS\nT\n\nOutput\n\nIf the piece will remain on the grid at the end of the game, print YES; otherwise, print NO.\n\nSample Input 1\n\n2 3 3\n2 2\nRRL\nLUD\n\nSample Output 1\n\nYES\n\nHere is one possible progress of the game:\n\nTakahashi moves the piece right. The piece is now at (2,3).\n\nAoki moves the piece left. The piece is now at (2,2).\n\nTakahashi does not move the piece. The piece remains at (2,2).\n\nAoki moves the piece up. The piece is now at (1,2).\n\nTakahashi moves the piece left. The piece is now at (1,1).\n\nAoki does not move the piece. The piece remains at (1,1).\n\nSample Input 2\n\n4 3 5\n2 2\nUDRRR\nLLDUD\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n5 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD\n\nSample Output 3\n\nNO", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1462, "cpu_time_ms": 989, "memory_kb": 175708}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s023856185", "group_id": "codeNet:p03054", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\th,w,n = readline() |> split |> parseMap\n\ty,x = readline() |> split |> parseMap\n\ts = chomp(readline())\n\tt = chomp(readline())\n\tsl = zeros(Int,n)\n\tsr = zeros(Int,n)\n\tsu = zeros(Int,n)\n\tsd = zeros(Int,n)\n\ttl = zeros(Int,n)\n\ttr = zeros(Int,n)\n\ttu = zeros(Int,n)\n\ttd = zeros(Int,n)\n\tif s[1] == 'L'\n\t\tsl[1] = 1\n\telseif s[1] == 'R'\n\t\tsr[1] = 1\n\telseif s[1] == 'U'\n\t\tsu[1] = 1\n\telse\n\t\tsd[1] = 1\n\tend\n\tif t[1] == 'L' && x>1\n\t\ttl[1] = 1\n\telseif t[1] == 'R' && x1\n\t\ttu[1] = 1\n\telse\n\t\ttd[1] = 1 && y 1\n\t\t\ttl[i] += 1\n\t\telseif t[i] == 'R' && x-sl[i]+tr[i] < w\n\t\t\ttr[i] += 1\n\t\telseif t[i] == 'U' && y+sd[i]-tu[i] < 1\n\t\t\ttu[i] += 1\n\t\telseif t[i] == 'D' && y-su[i]-td[i] < h\n\t\t\ttd[i] += 1\n\t\tend\n\tend\n\tflg = 0\n\tif x-sl[1] < 1 || x+sr[1] > w || y-sd[1]<0 || y+su[1] > h\n\t\tflg = 1\n\telse\n\t\tfor i in 2:n\n\t\t\tif x-sl[i]+tr[i-1] < 1 || x+sr[i]-tl[i-1] > w || y-sd[i]+tu[i-1] < 0 || y+su[i]-td[i-1]>h\n\t\t\t\tflg = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tprintln(flg == 1?\"NO\":\"YES\")\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1557019978, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03054.html", "problem_id": "p03054", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03054/input.txt", "sample_output_relpath": "derived/input_output/data/p03054/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03054/Julia/s023856185.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s023856185", "user_id": "u095714878"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\th,w,n = readline() |> split |> parseMap\n\ty,x = readline() |> split |> parseMap\n\ts = chomp(readline())\n\tt = chomp(readline())\n\tsl = zeros(Int,n)\n\tsr = zeros(Int,n)\n\tsu = zeros(Int,n)\n\tsd = zeros(Int,n)\n\ttl = zeros(Int,n)\n\ttr = zeros(Int,n)\n\ttu = zeros(Int,n)\n\ttd = zeros(Int,n)\n\tif s[1] == 'L'\n\t\tsl[1] = 1\n\telseif s[1] == 'R'\n\t\tsr[1] = 1\n\telseif s[1] == 'U'\n\t\tsu[1] = 1\n\telse\n\t\tsd[1] = 1\n\tend\n\tif t[1] == 'L' && x>1\n\t\ttl[1] = 1\n\telseif t[1] == 'R' && x1\n\t\ttu[1] = 1\n\telse\n\t\ttd[1] = 1 && y 1\n\t\t\ttl[i] += 1\n\t\telseif t[i] == 'R' && x-sl[i]+tr[i] < w\n\t\t\ttr[i] += 1\n\t\telseif t[i] == 'U' && y+sd[i]-tu[i] < 1\n\t\t\ttu[i] += 1\n\t\telseif t[i] == 'D' && y-su[i]-td[i] < h\n\t\t\ttd[i] += 1\n\t\tend\n\tend\n\tflg = 0\n\tif x-sl[1] < 1 || x+sr[1] > w || y-sd[1]<0 || y+su[1] > h\n\t\tflg = 1\n\telse\n\t\tfor i in 2:n\n\t\t\tif x-sl[i]+tr[i-1] < 1 || x+sr[i]-tl[i-1] > w || y-sd[i]+tu[i-1] < 0 || y+su[i]-td[i-1]>h\n\t\t\t\tflg = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tprintln(flg == 1?\"NO\":\"YES\")\nend\nmain()\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nWe have a rectangular grid of squares 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.\nOn this grid, there is a piece, which is initially placed at square (s_r,s_c).\n\nTakahashi and Aoki will play a game, where each player has a string of length N.\nTakahashi's string is S, and Aoki's string is T. S and T both consist of four kinds of letters: L, R, U and D.\n\nThe game consists of N steps. The i-th step proceeds as follows:\n\nFirst, Takahashi performs a move. He either moves the piece in the direction of S_i, or does not move the piece.\n\nSecond, Aoki performs a move. He either moves the piece in the direction of T_i, or does not move the piece.\n\nHere, to move the piece in the direction of L, R, U and D, is to move the piece from square (r,c) to square (r,c-1), (r,c+1), (r-1,c) and (r+1,c), respectively. If the destination square does not exist, the piece is removed from the grid, and the game ends, even if less than N steps are done.\n\nTakahashi wants to remove the piece from the grid in one of the N steps.\nAoki, on the other hand, wants to finish the N steps with the piece remaining on the grid.\nDetermine if the piece will remain on the grid at the end of the game when both players play optimally.\n\nConstraints\n\n2 \\leq H,W \\leq 2 \\times 10^5\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq s_r \\leq H\n\n1 \\leq s_c \\leq W\n\n|S|=|T|=N\n\nS and T consists of the four kinds of letters L, R, U and D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W N\ns_r s_c\nS\nT\n\nOutput\n\nIf the piece will remain on the grid at the end of the game, print YES; otherwise, print NO.\n\nSample Input 1\n\n2 3 3\n2 2\nRRL\nLUD\n\nSample Output 1\n\nYES\n\nHere is one possible progress of the game:\n\nTakahashi moves the piece right. The piece is now at (2,3).\n\nAoki moves the piece left. The piece is now at (2,2).\n\nTakahashi does not move the piece. The piece remains at (2,2).\n\nAoki moves the piece up. The piece is now at (1,2).\n\nTakahashi moves the piece left. The piece is now at (1,1).\n\nAoki does not move the piece. The piece remains at (1,1).\n\nSample Input 2\n\n4 3 5\n2 2\nUDRRR\nLLDUD\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n5 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD\n\nSample Output 3\n\nNO", "sample_input": "2 3 3\n2 2\nRRL\nLUD\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03054", "source_text": "Score : 600 points\n\nProblem Statement\n\nWe have a rectangular grid of squares 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.\nOn this grid, there is a piece, which is initially placed at square (s_r,s_c).\n\nTakahashi and Aoki will play a game, where each player has a string of length N.\nTakahashi's string is S, and Aoki's string is T. S and T both consist of four kinds of letters: L, R, U and D.\n\nThe game consists of N steps. The i-th step proceeds as follows:\n\nFirst, Takahashi performs a move. He either moves the piece in the direction of S_i, or does not move the piece.\n\nSecond, Aoki performs a move. He either moves the piece in the direction of T_i, or does not move the piece.\n\nHere, to move the piece in the direction of L, R, U and D, is to move the piece from square (r,c) to square (r,c-1), (r,c+1), (r-1,c) and (r+1,c), respectively. If the destination square does not exist, the piece is removed from the grid, and the game ends, even if less than N steps are done.\n\nTakahashi wants to remove the piece from the grid in one of the N steps.\nAoki, on the other hand, wants to finish the N steps with the piece remaining on the grid.\nDetermine if the piece will remain on the grid at the end of the game when both players play optimally.\n\nConstraints\n\n2 \\leq H,W \\leq 2 \\times 10^5\n\n2 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq s_r \\leq H\n\n1 \\leq s_c \\leq W\n\n|S|=|T|=N\n\nS and T consists of the four kinds of letters L, R, U and D.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W N\ns_r s_c\nS\nT\n\nOutput\n\nIf the piece will remain on the grid at the end of the game, print YES; otherwise, print NO.\n\nSample Input 1\n\n2 3 3\n2 2\nRRL\nLUD\n\nSample Output 1\n\nYES\n\nHere is one possible progress of the game:\n\nTakahashi moves the piece right. The piece is now at (2,3).\n\nAoki moves the piece left. The piece is now at (2,2).\n\nTakahashi does not move the piece. The piece remains at (2,2).\n\nAoki moves the piece up. The piece is now at (1,2).\n\nTakahashi moves the piece left. The piece is now at (1,1).\n\nAoki does not move the piece. The piece remains at (1,1).\n\nSample Input 2\n\n4 3 5\n2 2\nUDRRR\nLLDUD\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n5 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD\n\nSample Output 3\n\nNO", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1424, "cpu_time_ms": 1536, "memory_kb": 209216}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s658305376", "group_id": "codeNet:p03055", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction bfsTree(e::Array{Array{Int,1}},p)\n\tn=length(e)\n\tvst=zeros(Int,n)\n\tvst.-=1\n\tvst[p]=0\n\tvc=1\n\tstack=Int[]\n\tfor i in 1:length(e[p])\n\t\tpush!(stack,e[p][i])\n\t\tvst[e[p][i]]=1\n\t\tvc+=1\n\tend\n\tbef=0\n\tnow=p\n\twhile !isempty(stack)&&vc parseInt\n\te = [Int[] for i in 1:n]\n\tfor i in 1:n-1\n\t\ta,b = readline() |> split |> parseMap\n\t\tpush!(e[a],b)\n\t\tpush!(e[b],a)\n\tend\n\tf = bfsTree(e,1)\n\tu = indmax(f)\n\tg = bfsTree(e,u)\n\td = maximum(g)\n\tprintln(d%3==1?\"Second\":\"First\")\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1557056902, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03055.html", "problem_id": "p03055", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03055/input.txt", "sample_output_relpath": "derived/input_output/data/p03055/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03055/Julia/s658305376.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s658305376", "user_id": "u095714878"}, "prompt_components": {"gold_output": "First\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction bfsTree(e::Array{Array{Int,1}},p)\n\tn=length(e)\n\tvst=zeros(Int,n)\n\tvst.-=1\n\tvst[p]=0\n\tvc=1\n\tstack=Int[]\n\tfor i in 1:length(e[p])\n\t\tpush!(stack,e[p][i])\n\t\tvst[e[p][i]]=1\n\t\tvc+=1\n\tend\n\tbef=0\n\tnow=p\n\twhile !isempty(stack)&&vc parseInt\n\te = [Int[] for i in 1:n]\n\tfor i in 1:n-1\n\t\ta,b = readline() |> split |> parseMap\n\t\tpush!(e[a],b)\n\t\tpush!(e[b],a)\n\tend\n\tf = bfsTree(e,1)\n\tu = indmax(f)\n\tg = bfsTree(e,u)\n\td = maximum(g)\n\tprintln(d%3==1?\"Second\":\"First\")\nend\nmain()\n", "problem_context": "Score : 800 points\n\nProblem Statement\n\nTakahashi and Aoki will play a game on a tree.\nThe tree has N vertices numbered 1 to N, and the i-th of the N-1 edges connects Vertex a_i and Vertex b_i.\n\nAt the beginning of the game, each vertex contains a coin.\nStarting from Takahashi, he and Aoki will alternately perform the following operation:\n\nChoose a vertex v that contains one or more coins, and remove all the coins from v.\n\nThen, move each coin remaining on the tree to the vertex that is nearest to v among the adjacent vertices of the coin's current vertex.\n\nThe player who becomes unable to play, loses the game.\nThat is, the player who takes his turn when there is no coin remaining on the tree, loses the game.\nDetermine the winner of the game when both players play optimally.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq a_i, b_i \\leq N\n\na_i \\neq b_i\n\nThe graph given as input is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n:\na_{N-1} b_{N-1}\n\nOutput\n\nPrint First if Takahashi will win, and print Second if Aoki will win.\n\nSample Input 1\n\n3\n1 2\n2 3\n\nSample Output 1\n\nFirst\n\nHere is one possible progress of the game:\n\nTakahashi removes the coin from Vertex 1. Now, Vertex 1 and Vertex 2 contain one coin each.\n\nAoki removes the coin from Vertex 2. Now, Vertex 2 contains one coin.\n\nTakahashi removes the coin from Vertex 2. Now, there is no coin remaining on the tree.\n\nAoki takes his turn when there is no coin on the tree and loses.\n\nSample Input 2\n\n6\n1 2\n2 3\n2 4\n4 6\n5 6\n\nSample Output 2\n\nSecond\n\nSample Input 3\n\n7\n1 7\n7 4\n3 4\n7 5\n6 3\n2 1\n\nSample Output 3\n\nFirst", "sample_input": "3\n1 2\n2 3\n"}, "reference_outputs": ["First\n"], "source_document_id": "p03055", "source_text": "Score : 800 points\n\nProblem Statement\n\nTakahashi and Aoki will play a game on a tree.\nThe tree has N vertices numbered 1 to N, and the i-th of the N-1 edges connects Vertex a_i and Vertex b_i.\n\nAt the beginning of the game, each vertex contains a coin.\nStarting from Takahashi, he and Aoki will alternately perform the following operation:\n\nChoose a vertex v that contains one or more coins, and remove all the coins from v.\n\nThen, move each coin remaining on the tree to the vertex that is nearest to v among the adjacent vertices of the coin's current vertex.\n\nThe player who becomes unable to play, loses the game.\nThat is, the player who takes his turn when there is no coin remaining on the tree, loses the game.\nDetermine the winner of the game when both players play optimally.\n\nConstraints\n\n1 \\leq N \\leq 2 \\times 10^5\n\n1 \\leq a_i, b_i \\leq N\n\na_i \\neq b_i\n\nThe graph given as input is a tree.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n:\na_{N-1} b_{N-1}\n\nOutput\n\nPrint First if Takahashi will win, and print Second if Aoki will win.\n\nSample Input 1\n\n3\n1 2\n2 3\n\nSample Output 1\n\nFirst\n\nHere is one possible progress of the game:\n\nTakahashi removes the coin from Vertex 1. Now, Vertex 1 and Vertex 2 contain one coin each.\n\nAoki removes the coin from Vertex 2. Now, Vertex 2 contains one coin.\n\nTakahashi removes the coin from Vertex 2. Now, there is no coin remaining on the tree.\n\nAoki takes his turn when there is no coin on the tree and loses.\n\nSample Input 2\n\n6\n1 2\n2 3\n2 4\n4 6\n5 6\n\nSample Output 2\n\nSecond\n\nSample Input 3\n\n7\n1 7\n7 4\n3 4\n7 5\n6 3\n2 1\n\nSample Output 3\n\nFirst", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1064, "memory_kb": 169420}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s650603444", "group_id": "codeNet:p03059", "input_text": "parseInt(x) = parse(Int,x)\nfunction main()\n\tn = map(parseInt, split(readline()))[1]\n a = map(parseInt, split(readline()))\n gl = zeros(Int,1,n)\n gr = zeros(Int,1,n)\n for i = 1 : n-1\t\n \tgl[i+1] = gcd(gl[i],a[i])\n gr[i+1] = gcd(gr[i],a[end-i+1])\n end\n g = zeros(Int,n)\n for i = 1 : n\n g[i] = gcd(gl[i],gr[i])\n end\n println(Int64(maximum(g)))\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1556745973, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s650603444.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s650603444", "user_id": "u338200052"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nfunction main()\n\tn = map(parseInt, split(readline()))[1]\n a = map(parseInt, split(readline()))\n gl = zeros(Int,1,n)\n gr = zeros(Int,1,n)\n for i = 1 : n-1\t\n \tgl[i+1] = gcd(gl[i],a[i])\n gr[i+1] = gcd(gr[i],a[end-i+1])\n end\n g = zeros(Int,n)\n for i = 1 : n\n g[i] = gcd(gl[i],gr[i])\n end\n println(Int64(maximum(g)))\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1462, "memory_kb": 207404}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s696415190", "group_id": "codeNet:p03059", "input_text": "parseInt(x) = parse(Int,x)\nfunction main()\n a, b ,t = map(parseInt, split(readline()))\n #a, b ,t = [3 5 7]\n println(Int64(floor(t/a )*b))\nend\nmain()", "language": "Julia", "metadata": {"date": 1556741103, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s696415190.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s696415190", "user_id": "u338200052"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nfunction main()\n a, b ,t = map(parseInt, split(readline()))\n #a, b ,t = [3 5 7]\n println(Int64(floor(t/a )*b))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 868, "memory_kb": 165260}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s214134118", "group_id": "codeNet:p03060", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n v=parseMap(split(readline()))\n c=parseMap(split(readline()))\n ans=0\n for i in 1:n\n if v[i]>=c[i]\n ans+=v[i]-c[i]\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1583033936, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s214134118.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s214134118", "user_id": "u619197965"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n v=parseMap(split(readline()))\n c=parseMap(split(readline()))\n ans=0\n for i in 1:n\n if v[i]>=c[i]\n ans+=v[i]-c[i]\n end\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 350, "memory_kb": 110204}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s699047155", "group_id": "codeNet:p03060", "input_text": "function main()\n readline() # skip\n input = readdlm(STDIN, Int)\n V = input[1, :]\n C = input[2, :]\n\n Z = (V - C)\n result = sum(Z[Z .> 0])\n println(result)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1557469940, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s699047155.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s699047155", "user_id": "u630185395"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "function main()\n readline() # skip\n input = readdlm(STDIN, Int)\n V = input[1, :]\n C = input[2, :]\n\n Z = (V - C)\n result = sum(Z[Z .> 0])\n println(result)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1979, "memory_kb": 157556}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s989555449", "group_id": "codeNet:p03060", "input_text": "n=parse(Int,readline())\na=map(x->parse(Int,x),split(readline()))\nb=map(x->parse(Int,x),split(readline()))\ns=0\nfor i=1:n\n\tif a[i]>b[i]\n\t\ts+=a[i]-b[i]\n\tend\nend\nprintln(s)", "language": "Julia", "metadata": {"date": 1556415994, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s989555449.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s989555449", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "n=parse(Int,readline())\na=map(x->parse(Int,x),split(readline()))\nb=map(x->parse(Int,x),split(readline()))\ns=0\nfor i=1:n\n\tif a[i]>b[i]\n\t\ts+=a[i]-b[i]\n\tend\nend\nprintln(s)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1426, "memory_kb": 126316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s935957276", "group_id": "codeNet:p03062", "input_text": "N=parse(Int,readline())\nA=map(x->parse(Int,x),split(readline()))\nsort!(A)\nfor i=1:2:N-1\n\tif A[i]+A[i+1]<0\n\t\tA[i]*=-1\n\t\tA[i+1]*=-1\n\tend\nend\nprintln(+(A...))\n", "language": "Julia", "metadata": {"date": 1561281474, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s935957276.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s935957276", "user_id": "u657913472"}, "prompt_components": {"gold_output": "19\n", "input_to_evaluate": "N=parse(Int,readline())\nA=map(x->parse(Int,x),split(readline()))\nsort!(A)\nfor i=1:2:N-1\n\tif A[i]+A[i+1]<0\n\t\tA[i]*=-1\n\t\tA[i+1]*=-1\n\tend\nend\nprintln(+(A...))\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 477, "memory_kb": 137124}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s153755357", "group_id": "codeNet:p03063", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = chomp(readline())\n\tc = 0\n\tcc = 0\n\tfor i in 0:n-1\n\t\tif s[n-i] == '.'\n\t\t\tcc = n-i\n\t\t\tbreak\n\t\tend\n\tend\n\tfor i in 1:cc\n\t\tif s[i] == '.'\n\t\t\tc += 1\n\t\tend\n\tend\n\tif c == cc\n\t\tprintln(0)\n\telse\n\t\tprintln(min(c,cc-c)\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1555809342, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03063.html", "problem_id": "p03063", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03063/input.txt", "sample_output_relpath": "derived/input_output/data/p03063/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03063/Julia/s153755357.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s153755357", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ts = chomp(readline())\n\tc = 0\n\tcc = 0\n\tfor i in 0:n-1\n\t\tif s[n-i] == '.'\n\t\t\tcc = n-i\n\t\t\tbreak\n\t\tend\n\tend\n\tfor i in 1:cc\n\t\tif s[i] == '.'\n\t\t\tc += 1\n\t\tend\n\tend\n\tif c == cc\n\t\tprintln(0)\n\telse\n\t\tprintln(min(c,cc-c)\n\tend\nend\nmain()\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": "p03063", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1156, "memory_kb": 197964}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s988916998", "group_id": "codeNet:p03067", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a,b,c=parseMap(split(readline()))\n if a<=c<=b\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1587574204, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s988916998.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s988916998", "user_id": "u619197965"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a,b,c=parseMap(split(readline()))\n if a<=c<=b\n println(\"Yes\")\n else\n println(\"No\")\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 338, "memory_kb": 110816}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s894505287", "group_id": "codeNet:p03068", "input_text": "let\n N = parse(Int, readline())\n S = readline()\n K = parse(Int, readline())\n\n target = S[K:K]\n ret = \"\"\n \n for s in S\n s = string(s)\n if s == target\n ret *= s\n else \n ret *= \"*\"\n end\n end\n\n println(ret)\nend\n", "language": "Julia", "metadata": {"date": 1556579842, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s894505287.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s894505287", "user_id": "u937119374"}, "prompt_components": {"gold_output": "*rr*r\n", "input_to_evaluate": "let\n N = parse(Int, readline())\n S = readline()\n K = parse(Int, readline())\n\n target = S[K:K]\n ret = \"\"\n \n for s in S\n s = string(s)\n if s == target\n ret *= s\n else \n ret *= \"*\"\n end\n end\n\n println(ret)\nend\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 783, "memory_kb": 170508}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s152656727", "group_id": "codeNet:p03069", "input_text": "readline_() = readline() |> chomp\n# a b c d e -> Array{SubString{String},1}\nreadline_array_string() = readline() |> chomp |> split\n# 1 2 3 4 5 -> Array{Int64, 1}\nreadline_array_int() = [parse(Int, x) for x in readline() |> chomp |> split]\nread_int() = parse(Int, readline() |> chomp)\n\nfunction omit(str)\n count = 0\n l = length(str)\n ind = Int[]\n i = 1\n while i <= l-1\n if str[i:i+1] == \"#.\"\n count += 1\n i += 2\n else\n push!(ind, i)\n i += 1\n end\n end\n\n if l >= 2\n if str[l-1:l] != \"#.\"\n push!(ind, l)\n end\n end\n\n if count == 0\n return 0\n else\n count += omit(str[ind])\n end\n return count\nend\n\nn = read_int()\nstr = readline_()\nvalue = omit(str)\nprint(value)", "language": "Julia", "metadata": {"date": 1555843902, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s152656727.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s152656727", "user_id": "u858970803"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "readline_() = readline() |> chomp\n# a b c d e -> Array{SubString{String},1}\nreadline_array_string() = readline() |> chomp |> split\n# 1 2 3 4 5 -> Array{Int64, 1}\nreadline_array_int() = [parse(Int, x) for x in readline() |> chomp |> split]\nread_int() = parse(Int, readline() |> chomp)\n\nfunction omit(str)\n count = 0\n l = length(str)\n ind = Int[]\n i = 1\n while i <= l-1\n if str[i:i+1] == \"#.\"\n count += 1\n i += 2\n else\n push!(ind, i)\n i += 1\n end\n end\n\n if l >= 2\n if str[l-1:l] != \"#.\"\n push!(ind, l)\n end\n end\n\n if count == 0\n return 0\n else\n count += omit(str[ind])\n end\n return count\nend\n\nn = read_int()\nstr = readline_()\nvalue = omit(str)\nprint(value)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2125, "memory_kb": 308292}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s122157887", "group_id": "codeNet:p03069", "input_text": "# abcde -> String\nreadline_() = readline() |> chomp\n# a b c d e -> Array{SubString{String},1}\nreadline_array_string() = readline() |> chomp |> split\n# 1 2 3 4 5 -> Array{Int64, 1}\nreadline_array_int() = [parse(Int, x) for x in readline() |> chomp |> split]\nread_int() = parse(Int, readline() |> chomp)\n\nfunction main(n, str)\n firstblack = 0\n for (i, s) in enumerate(str)\n if s == '#'\n firstblack = i\n break\n end\n end\n\n if firstblack == 0\n print(0)\n return\n end\n count = 0\n for i = firstblack:n\n if str[i] == '#'\n count += 1\n end\n end\n m = n - firstblack + 1\n a = m - count\n print(min(a, count))\nend\n\nn = read_int()\nstr = readline_()\n\nmain(n, str)", "language": "Julia", "metadata": {"date": 1555810150, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s122157887.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s122157887", "user_id": "u858970803"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "# abcde -> String\nreadline_() = readline() |> chomp\n# a b c d e -> Array{SubString{String},1}\nreadline_array_string() = readline() |> chomp |> split\n# 1 2 3 4 5 -> Array{Int64, 1}\nreadline_array_int() = [parse(Int, x) for x in readline() |> chomp |> split]\nread_int() = parse(Int, readline() |> chomp)\n\nfunction main(n, str)\n firstblack = 0\n for (i, s) in enumerate(str)\n if s == '#'\n firstblack = i\n break\n end\n end\n\n if firstblack == 0\n print(0)\n return\n end\n count = 0\n for i = firstblack:n\n if str[i] == '#'\n count += 1\n end\n end\n m = n - firstblack + 1\n a = m - count\n print(min(a, count))\nend\n\nn = read_int()\nstr = readline_()\n\nmain(n, str)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1170, "memory_kb": 116856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s242657390", "group_id": "codeNet:p03071", "input_text": "a,b=map(x->parse(Int,x),split(readline()))\nif a==b\n print(a+b)\nelse\n print(max(a,b)*2-1)\nend", "language": "Julia", "metadata": {"date": 1556365613, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s242657390.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s242657390", "user_id": "u657913472"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "a,b=map(x->parse(Int,x),split(readline()))\nif a==b\n print(a+b)\nelse\n print(max(a,b)*2-1)\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 94, "cpu_time_ms": 317, "memory_kb": 109536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s463816667", "group_id": "codeNet:p03072", "input_text": "n = parse(Int, strip(readline()))\nA = map(x->parse(Int, x), split(readline()))\ncnt = 0\nfor i in 1:length(A)\n cnt += all(A[1:i-1] .<= A[i])\nend\nprintln(cnt)", "language": "Julia", "metadata": {"date": 1555215466, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s463816667.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s463816667", "user_id": "u419818973"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n = parse(Int, strip(readline()))\nA = map(x->parse(Int, x), split(readline()))\ncnt = 0\nfor i in 1:length(A)\n cnt += all(A[1:i-1] .<= A[i])\nend\nprintln(cnt)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 374, "memory_kb": 110476}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s093878146", "group_id": "codeNet:p03073", "input_text": "x=[Int(y)%2 for y=readline()|>chomp]\ns=(1:length(x)).%2\nmin(sum.(abs.([s-x,1.-s-x]))...)|>show", "language": "Julia", "metadata": {"date": 1555221007, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s093878146.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s093878146", "user_id": "u858970803"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "x=[Int(y)%2 for y=readline()|>chomp]\ns=(1:length(x)).%2\nmin(sum.(abs.([s-x,1.-s-x]))...)|>show", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 94, "cpu_time_ms": 491, "memory_kb": 124940}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s164145995", "group_id": "codeNet:p03074", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\ts = chomp(readline())\n\ta = Int[]\n\tb = Int[0]\n\tf = s[1]=='0'?0:1\n\tt = 1\n\tfor i in 2:n\n\t\tif s[i-1] != s[i]\n\t\t\tpush!(a,f)\n\t\t\tf = f==0?1:0\n\t\t\tpush!(b,t)\n\t\t\tb[length(b)] += b[length(b)-1]\n\t\t\tt = 1\n\t\telse\n\t\t\tt += 1\n\t\tend\n\tend\n\tif t != 0\n\t\tpush!(a,f)\n\t\tpush!(b,t)\n\t\tb[length(b)] += b[length(b)-1]\n\tend\n\tl = length(a)\n\tif l == 1\n\t\tprintln(n)\n\telse\n\t\tm = 0\n\t\tif k%2 == 0\n\t\t\tfor i in 1:l\n\t\t\t\tif a[i] == 1\n\t\t\t\t\tx = b[min(i+k+1,l+1)]-b[max(i-k,1)]\n\t\t\t\t\tm = max(m,x)\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tfor i in 1:l\n\t\t\t\tif a[i] == 0\n\t\t\t\t\tx = b[min(i+k+1,l+1)]-b[max(i-k,1)]\n\t\t\t\t\tm = max(m,x)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tprintln(m)\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1557516842, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s164145995.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s164145995", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\ts = chomp(readline())\n\ta = Int[]\n\tb = Int[0]\n\tf = s[1]=='0'?0:1\n\tt = 1\n\tfor i in 2:n\n\t\tif s[i-1] != s[i]\n\t\t\tpush!(a,f)\n\t\t\tf = f==0?1:0\n\t\t\tpush!(b,t)\n\t\t\tb[length(b)] += b[length(b)-1]\n\t\t\tt = 1\n\t\telse\n\t\t\tt += 1\n\t\tend\n\tend\n\tif t != 0\n\t\tpush!(a,f)\n\t\tpush!(b,t)\n\t\tb[length(b)] += b[length(b)-1]\n\tend\n\tl = length(a)\n\tif l == 1\n\t\tprintln(n)\n\telse\n\t\tm = 0\n\t\tif k%2 == 0\n\t\t\tfor i in 1:l\n\t\t\t\tif a[i] == 1\n\t\t\t\t\tx = b[min(i+k+1,l+1)]-b[max(i-k,1)]\n\t\t\t\t\tm = max(m,x)\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\tfor i in 1:l\n\t\t\t\tif a[i] == 0\n\t\t\t\t\tx = b[min(i+k+1,l+1)]-b[max(i-k,1)]\n\t\t\t\t\tm = max(m,x)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tprintln(m)\n\tend\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 408, "memory_kb": 118668}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s283121137", "group_id": "codeNet:p03074", "input_text": "function calc_seq(xs)\n seq = Int[]\n count = 1\n for i = 1:length(xs)-1\n if xs[i] == xs[i+1]\n count += 1\n else\n push!(seq, count)\n count = 1\n end\n end\n push!(seq, count)\n seq\nend\n\nfunction main(n, k, xs)\n seq = calc_seq(xs)\n if xs[1] == 0\n seq = vcat(0, seq)\n end\n m = length(seq)\n biggest = 0\n val = sum(seq[1:min(2k+1, m)])\n for i = 3:2:m\n val += sum(seq[min(2k+i-1, m):min(2k+i, m)]) - sum(seq[max(1, i-2):max(1, i-1)])\n if biggest < val\n biggest = val\n end\n end\n print(biggest)\nend\n\nn, k = [parse(Int, x) for x in split(chomp(readline()))]\nstr = chomp(readline())\nxs = zeros(Int, n)\n\nfor (i, s) in enumerate(str)\n xs[i] = parse(Int, s)\nend\n\nmain(n, k, xs)", "language": "Julia", "metadata": {"date": 1555255842, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s283121137.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s283121137", "user_id": "u858970803"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function calc_seq(xs)\n seq = Int[]\n count = 1\n for i = 1:length(xs)-1\n if xs[i] == xs[i+1]\n count += 1\n else\n push!(seq, count)\n count = 1\n end\n end\n push!(seq, count)\n seq\nend\n\nfunction main(n, k, xs)\n seq = calc_seq(xs)\n if xs[1] == 0\n seq = vcat(0, seq)\n end\n m = length(seq)\n biggest = 0\n val = sum(seq[1:min(2k+1, m)])\n for i = 3:2:m\n val += sum(seq[min(2k+i-1, m):min(2k+i, m)]) - sum(seq[max(1, i-2):max(1, i-1)])\n if biggest < val\n biggest = val\n end\n end\n print(biggest)\nend\n\nn, k = [parse(Int, x) for x in split(chomp(readline()))]\nstr = chomp(readline())\nxs = zeros(Int, n)\n\nfor (i, s) in enumerate(str)\n xs[i] = parse(Int, s)\nend\n\nmain(n, k, xs)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 798, "cpu_time_ms": 737, "memory_kb": 160256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s598418790", "group_id": "codeNet:p03074", "input_text": "function calc_seq(xs)\n seq = Int[]\n count = 1\n for i = 1:length(xs)-1\n if xs[i] == xs[i+1]\n count += 1\n else\n push!(seq, count)\n count = 1\n end\n end\n push!(seq, count)\n seq\nend\n\nfunction main(n, k, xs)\n seq = calc_seq(xs)\n m = length(seq)\n val = Int[]\n if xs[1] == 1\n for i = 1:2:m\n push!(val, sum(seq[i:min(2k+i, m)]))\n end\n else\n push!(val, sum(seq[1:min(2k, m)]))\n for i = 2:2:m\n push!(val, sum(seq[i:min(2k+i, m)]))\n end\n end\n print(max(val...))\nend\n\nn, k = [parse(Int, x) for x in split(chomp(readline()))]\nstr = chomp(readline())\nxs = zeros(Int, n)\n\nfor (i, s) in enumerate(str)\n xs[i] = parse(Int, s)\nend\n\nmain(n, k, xs)", "language": "Julia", "metadata": {"date": 1555246488, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s598418790.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s598418790", "user_id": "u858970803"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function calc_seq(xs)\n seq = Int[]\n count = 1\n for i = 1:length(xs)-1\n if xs[i] == xs[i+1]\n count += 1\n else\n push!(seq, count)\n count = 1\n end\n end\n push!(seq, count)\n seq\nend\n\nfunction main(n, k, xs)\n seq = calc_seq(xs)\n m = length(seq)\n val = Int[]\n if xs[1] == 1\n for i = 1:2:m\n push!(val, sum(seq[i:min(2k+i, m)]))\n end\n else\n push!(val, sum(seq[1:min(2k, m)]))\n for i = 2:2:m\n push!(val, sum(seq[i:min(2k+i, m)]))\n end\n end\n print(max(val...))\nend\n\nn, k = [parse(Int, x) for x in split(chomp(readline()))]\nstr = chomp(readline())\nxs = zeros(Int, n)\n\nfor (i, s) in enumerate(str)\n xs[i] = parse(Int, s)\nend\n\nmain(n, k, xs)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 780, "cpu_time_ms": 2113, "memory_kb": 175952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s056944398", "group_id": "codeNet:p03075", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ta = readline() |> parseInt\n\tb = readline() |> parseInt\n\tc = readline() |> parseInt\n\td = readline() |> parseInt\n\te = readline() |> parseInt\n\tk = readline() |> parseInt\n\tprintln(e-a<=k?\"Yay!\":\":(\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1554740782, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s056944398.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s056944398", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ta = readline() |> parseInt\n\tb = readline() |> parseInt\n\tc = readline() |> parseInt\n\td = readline() |> parseInt\n\te = readline() |> parseInt\n\tk = readline() |> parseInt\n\tprintln(e-a<=k?\"Yay!\":\":(\")\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 797, "memory_kb": 164904}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s685185114", "group_id": "codeNet:p03075", "input_text": "a = int(readline())\nb = int(readline())\nc = int(readline())\nd = int(readline())\ne = int(readline())\nk = int(readline())\n\nif e-a > k \n print(\":(\")\nelse\n print(\"Yay!\")\nend\n", "language": "Julia", "metadata": {"date": 1554585213, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s685185114.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s685185114", "user_id": "u896335804"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "a = int(readline())\nb = int(readline())\nc = int(readline())\nd = int(readline())\ne = int(readline())\nk = int(readline())\n\nif e-a > k \n print(\":(\")\nelse\n print(\"Yay!\")\nend\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1204, "memory_kb": 198560}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s639221042", "group_id": "codeNet:p03076", "input_text": "parseInt(x) = parse(Int, x)\nmin1=9\nminsoe=1\narray=[0 for i in 1:5]\nfor i in 1:5\n array[i]=parseInt(readline())\n if (array[i]%10)<=(min1%10) && array[i]%10>0\n min1=array[i]\n minsoe=i\n end\nend\ntime=0\nfor i in 1:5\n if i != minsoe\n time+=div(array[i]+9,10)*10\n end\nend\ntime+=array[minsoe]\nprintln(time)", "language": "Julia", "metadata": {"date": 1554579326, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s639221042.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s639221042", "user_id": "u913110564"}, "prompt_components": {"gold_output": "215\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nmin1=9\nminsoe=1\narray=[0 for i in 1:5]\nfor i in 1:5\n array[i]=parseInt(readline())\n if (array[i]%10)<=(min1%10) && array[i]%10>0\n min1=array[i]\n minsoe=i\n end\nend\ntime=0\nfor i in 1:5\n if i != minsoe\n time+=div(array[i]+9,10)*10\n end\nend\ntime+=array[minsoe]\nprintln(time)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 712, "memory_kb": 165408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s844852916", "group_id": "codeNet:p03078", "input_text": "I()=parse.(split(readline()));k=I()[4];s=a->sort([i+j for i=I()for j=a],rev=1>0)[1:min(end,k)];println.(s(s(I())))", "language": "Julia", "metadata": {"date": 1561429002, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s844852916.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s844852916", "user_id": "u729133443"}, "prompt_components": {"gold_output": "19\n17\n15\n14\n13\n12\n10\n8\n", "input_to_evaluate": "I()=parse.(split(readline()));k=I()[4];s=a->sort([i+j for i=I()for j=a],rev=1>0)[1:min(end,k)];println.(s(s(I())))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1598, "memory_kb": 218512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s108034893", "group_id": "codeNet:p03078", "input_text": "xyzk = [parse(Int, x) for x in split(readline(), \" \")]\nK = xyzk[4]\nxs = xyzk[1:3]\nas = [parse(Int, x) for x in split(readline(), \" \")]\nbs = [parse(Int, x) for x in split(readline(), \" \")]\ncs = [parse(Int, x) for x in split(readline(), \" \")]\n\nas = sort(as, rev=true)\nbs = sort(bs, rev=true)\ncs = sort(cs, rev=true)\n\nA = zeros(Int, xs...)\nB = zeros(Int, xs...)\nC = zeros(Int, xs...)\n\nfor i = 1:xs[1]\n for j = 1:xs[2]\n for k = 1:xs[3]\n A[i, j, k] = as[i]\n B[i, j, k] = bs[j]\n C[i, j, k] = cs[k]\n end\n end\nend\n\nX = A + B + C\n\nfunction surround(O)\n x, y, z = size(O)\n S = zeros(Int, size(O))\n for i = 1:x\n for j = 1:y\n for k = 1:z\n if i > 1\n if O[i - 1, j, k] == 1 && O[i, j, k] == 0\n S[i, j, k] = 1\n end\n end\n if j > 1\n if O[i, j - 1, k] == 1 && O[i, j, k] == 0\n S[i, j, k] = 1\n end\n end\n if k > 1\n if O[i, j, k - 1] == 1 && O[i, j, k] == 0\n S[i, j, k] = 1\n end\n end\n end\n end\n end\n return S\nend\n\nis = [1, 1, 1]\nO = zeros(Int, xs...)\nO[is] = 1\n\nfor n = 1:K\n print(X[is...])\n S = surround(O)\n SX = S .* X\n is = indmax(SX)\n O[is] = 1\n if n != K\n println()\n end\nend", "language": "Julia", "metadata": {"date": 1554691622, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s108034893.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s108034893", "user_id": "u858970803"}, "prompt_components": {"gold_output": "19\n17\n15\n14\n13\n12\n10\n8\n", "input_to_evaluate": "xyzk = [parse(Int, x) for x in split(readline(), \" \")]\nK = xyzk[4]\nxs = xyzk[1:3]\nas = [parse(Int, x) for x in split(readline(), \" \")]\nbs = [parse(Int, x) for x in split(readline(), \" \")]\ncs = [parse(Int, x) for x in split(readline(), \" \")]\n\nas = sort(as, rev=true)\nbs = sort(bs, rev=true)\ncs = sort(cs, rev=true)\n\nA = zeros(Int, xs...)\nB = zeros(Int, xs...)\nC = zeros(Int, xs...)\n\nfor i = 1:xs[1]\n for j = 1:xs[2]\n for k = 1:xs[3]\n A[i, j, k] = as[i]\n B[i, j, k] = bs[j]\n C[i, j, k] = cs[k]\n end\n end\nend\n\nX = A + B + C\n\nfunction surround(O)\n x, y, z = size(O)\n S = zeros(Int, size(O))\n for i = 1:x\n for j = 1:y\n for k = 1:z\n if i > 1\n if O[i - 1, j, k] == 1 && O[i, j, k] == 0\n S[i, j, k] = 1\n end\n end\n if j > 1\n if O[i, j - 1, k] == 1 && O[i, j, k] == 0\n S[i, j, k] = 1\n end\n end\n if k > 1\n if O[i, j, k - 1] == 1 && O[i, j, k] == 0\n S[i, j, k] = 1\n end\n end\n end\n end\n end\n return S\nend\n\nis = [1, 1, 1]\nO = zeros(Int, xs...)\nO[is] = 1\n\nfor n = 1:K\n print(X[is...])\n S = surround(O)\n SX = S .* X\n is = indmax(SX)\n O[is] = 1\n if n != K\n println()\n end\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1463, "cpu_time_ms": 912, "memory_kb": 134920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s438015808", "group_id": "codeNet:p03079", "input_text": "a,b,c=map(x->parce(int x),split(readline())\nif a==b==c\n print(\"Yes\")\nelse\n print(\"No\")\nend\n", "language": "Julia", "metadata": {"date": 1554031485, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s438015808.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s438015808", "user_id": "u896335804"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a,b,c=map(x->parce(int x),split(readline())\nif a==b==c\n print(\"Yes\")\nelse\n print(\"No\")\nend\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1162, "memory_kb": 198436}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s136475115", "group_id": "codeNet:p03080", "input_text": "readline()\nR=B=0\nfor c=chomp(readline())\n if c=='R'\n R+=1\n else\n B+=1\n end\nend\nprintln(R>B?\"Yes\":\"No\")", "language": "Julia", "metadata": {"date": 1568036757, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s136475115.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s136475115", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "readline()\nR=B=0\nfor c=chomp(readline())\n if c=='R'\n R+=1\n else\n B+=1\n end\nend\nprintln(R>B?\"Yes\":\"No\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 297, "memory_kb": 107396}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s248016315", "group_id": "codeNet:p03080", "input_text": "function readline_STDIN()\n return Base.readline(Base.STDIN)\nend\n\nfunction exawizards2019_B()\n\n # STEP.01\n # read out the number of people\n num_people = Base.parse(Base.Int64, readline_STDIN())\n\n # STEP.02\n # read out the string which represents the colors of the people\n colors_people = readline_STDIN()\n\n # STEP.03\n # count up the number of hats\n num_hats_red = Base.zero(num_people)\n num_hats_blue = num_hats_red\n\n for itr in Base.range(1, 1, num_people)\n if colors_people[itr] == \"R\"\n num_hats_red += 1\n else\n num_hats_blue += 1\n end\n end\n\n # STEP.04\n # output the result\n if num_hats_red > num_hats_blue\n Base.println(Base.STDOUT, \"Yes\")\n else\n Base.println(Base.STDOUT, \"No\")\n end\n\n # STEP.TRUE_END\n return Base.nothing\n\nend\n\nMain.exawizards2019_B()", "language": "Julia", "metadata": {"date": 1554162426, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s248016315.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s248016315", "user_id": "u484703930"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function readline_STDIN()\n return Base.readline(Base.STDIN)\nend\n\nfunction exawizards2019_B()\n\n # STEP.01\n # read out the number of people\n num_people = Base.parse(Base.Int64, readline_STDIN())\n\n # STEP.02\n # read out the string which represents the colors of the people\n colors_people = readline_STDIN()\n\n # STEP.03\n # count up the number of hats\n num_hats_red = Base.zero(num_people)\n num_hats_blue = num_hats_red\n\n for itr in Base.range(1, 1, num_people)\n if colors_people[itr] == \"R\"\n num_hats_red += 1\n else\n num_hats_blue += 1\n end\n end\n\n # STEP.04\n # output the result\n if num_hats_red > num_hats_blue\n Base.println(Base.STDOUT, \"Yes\")\n else\n Base.println(Base.STDOUT, \"No\")\n end\n\n # STEP.TRUE_END\n return Base.nothing\n\nend\n\nMain.exawizards2019_B()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 872, "cpu_time_ms": 295, "memory_kb": 108156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s376143866", "group_id": "codeNet:p03080", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = reqadline() |> parseInt\n\ts = chomp(readline())\n\tr = 0\n\tb = 0\n\tfor i in 1:n\n\t\tif s[i] == 'R'\n\t\t\tr += 1\n\t\telse\n\t\t\tb += 1\n\t\tend\n\tend\n\tprintln(r>b?\"Yes\":\"No\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1553976118, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s376143866.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s376143866", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = reqadline() |> parseInt\n\ts = chomp(readline())\n\tr = 0\n\tb = 0\n\tfor i in 1:n\n\t\tif s[i] == 'R'\n\t\t\tr += 1\n\t\telse\n\t\t\tb += 1\n\t\tend\n\tend\n\tprintln(r>b?\"Yes\":\"No\")\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1205, "memory_kb": 204012}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s462781893", "group_id": "codeNet:p03081", "input_text": "parseInt(x) = parse(Int,x)\n\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n N,Q = readline() |> split |> parseMap\n s = readline()\n s = s[1:length(s)-1]\n order = []\n for i in 1:Q\n t,d = readline() |> split\n push!(order,[t[1],d[1]])\n end\n\n function judge(a,mode)\n now = a\n flag = true\n if mode=='L'\n for i in 1:Q\n if s[now]==order[i][1]\n if order[i][2]=='L'\n if now==1\n flag = false\n return flag\n else\n now-=1\n end\n else\n if now==N\n return flag\n else\n now+=1\n end\n end\n end\n end\n else\n for i in 1:Q\n \t\tif s[now]==order[i][1]\n if order[i][2]=='L'\n if now==1\n return flag\n else\n now-=1\n end\n else\n if now==N\n flag = false\n return flag\n else\n now+=1\n end\n end\n end\n end\n end\n return true\n end\n \n function bisect(l,r,mode)\n if r-l==1\n if mode=='L'\n return r\n else\n return l\n end\n else\n x=Int(floor((l+r)/2))\n if judge(x,mode)\n if mode=='L'\n return bisect(l,x,mode)\n else\n return bisect(x,r,mode)\n end\n else\n if mode=='L'\n return bisect(x,r,mode)\n else\n return bisect(l,x,mode)\n end\n end\n end\n end\n\n if N==1\n if judge(1,'L') && judge(1,'R')\n println(1)\n else\n println(0)\n end\n else\n if judge(1,'R') && judge(N,'L')\n \t\tif judge(N,'R')\n \t\tR = N\n \t\telse\n \t\tR = bisect(1,N,'R')\n \t\tend\n \t\tif judge(1,'L')\n \t\tL = 1\n \t\telse\n \t\tL = bisect(1,N,'L')\n \t\tend\n println(R-L+1)\n \telse\n \t\tprintln(0)\n \tend\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1560998982, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03081.html", "problem_id": "p03081", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03081/input.txt", "sample_output_relpath": "derived/input_output/data/p03081/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03081/Julia/s462781893.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s462781893", "user_id": "u785989355"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n N,Q = readline() |> split |> parseMap\n s = readline()\n s = s[1:length(s)-1]\n order = []\n for i in 1:Q\n t,d = readline() |> split\n push!(order,[t[1],d[1]])\n end\n\n function judge(a,mode)\n now = a\n flag = true\n if mode=='L'\n for i in 1:Q\n if s[now]==order[i][1]\n if order[i][2]=='L'\n if now==1\n flag = false\n return flag\n else\n now-=1\n end\n else\n if now==N\n return flag\n else\n now+=1\n end\n end\n end\n end\n else\n for i in 1:Q\n \t\tif s[now]==order[i][1]\n if order[i][2]=='L'\n if now==1\n return flag\n else\n now-=1\n end\n else\n if now==N\n flag = false\n return flag\n else\n now+=1\n end\n end\n end\n end\n end\n return true\n end\n \n function bisect(l,r,mode)\n if r-l==1\n if mode=='L'\n return r\n else\n return l\n end\n else\n x=Int(floor((l+r)/2))\n if judge(x,mode)\n if mode=='L'\n return bisect(l,x,mode)\n else\n return bisect(x,r,mode)\n end\n else\n if mode=='L'\n return bisect(x,r,mode)\n else\n return bisect(l,x,mode)\n end\n end\n end\n end\n\n if N==1\n if judge(1,'L') && judge(1,'R')\n println(1)\n else\n println(0)\n end\n else\n if judge(1,'R') && judge(N,'L')\n \t\tif judge(N,'R')\n \t\tR = N\n \t\telse\n \t\tR = bisect(1,N,'R')\n \t\tend\n \t\tif judge(1,'L')\n \t\tL = 1\n \t\telse\n \t\tL = bisect(1,N,'L')\n \t\tend\n println(R-L+1)\n \telse\n \t\tprintln(0)\n \tend\n end\nend\n\nmain()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N squares numbered 1 to N from left to right.\nEach square has a character written on it, and Square i has a letter s_i. Besides, there is initially one golem on each square.\n\nSnuke cast Q spells to move the golems.\n\nThe i-th spell consisted of two characters t_i and d_i, where d_i is L or R.\nWhen Snuke cast this spell, for each square with the character t_i, all golems on that square moved to the square adjacent to the left if d_i is L, and moved to the square adjacent to the right if d_i is R.\n\nHowever, when a golem tried to move left from Square 1 or move right from Square N, it disappeared.\n\nFind the number of golems remaining after Snuke cast the Q spells.\n\nConstraints\n\n1 \\leq N,Q \\leq 2 \\times 10^{5}\n\n|s| = N\n\ns_i and t_i are uppercase English letters.\n\nd_i is L or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\ns\nt_1 d_1\n\\vdots\nt_{Q} d_Q\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 4\nABC\nA L\nB L\nB R\nA R\n\nSample Output 1\n\n2\n\nInitially, there is one golem on each square.\n\nIn the first spell, the golem on Square 1 tries to move left and disappears.\n\nIn the second spell, the golem on Square 2 moves left.\n\nIn the third spell, no golem moves.\n\nIn the fourth spell, the golem on Square 1 moves right.\n\nAfter the four spells are cast, there is one golem on Square 2 and one golem on Square 3, for a total of two golems remaining.\n\nSample Input 2\n\n8 3\nAABCBDBA\nA L\nB R\nA R\n\nSample Output 2\n\n5\n\nAfter the three spells are cast, there is one golem on Square 2, two golems on Square 4 and two golems on Square 6, for a total of five golems remaining.\n\nNote that a single spell may move multiple golems.\n\nSample Input 3\n\n10 15\nSNCZWRCEWB\nB R\nR R\nE R\nW R\nZ L\nS R\nQ L\nW L\nB R\nC L\nA L\nN L\nE R\nZ L\nS L\n\nSample Output 3\n\n3", "sample_input": "3 4\nABC\nA L\nB L\nB R\nA R\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03081", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere are N squares numbered 1 to N from left to right.\nEach square has a character written on it, and Square i has a letter s_i. Besides, there is initially one golem on each square.\n\nSnuke cast Q spells to move the golems.\n\nThe i-th spell consisted of two characters t_i and d_i, where d_i is L or R.\nWhen Snuke cast this spell, for each square with the character t_i, all golems on that square moved to the square adjacent to the left if d_i is L, and moved to the square adjacent to the right if d_i is R.\n\nHowever, when a golem tried to move left from Square 1 or move right from Square N, it disappeared.\n\nFind the number of golems remaining after Snuke cast the Q spells.\n\nConstraints\n\n1 \\leq N,Q \\leq 2 \\times 10^{5}\n\n|s| = N\n\ns_i and t_i are uppercase English letters.\n\nd_i is L or R.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Q\ns\nt_1 d_1\n\\vdots\nt_{Q} d_Q\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 4\nABC\nA L\nB L\nB R\nA R\n\nSample Output 1\n\n2\n\nInitially, there is one golem on each square.\n\nIn the first spell, the golem on Square 1 tries to move left and disappears.\n\nIn the second spell, the golem on Square 2 moves left.\n\nIn the third spell, no golem moves.\n\nIn the fourth spell, the golem on Square 1 moves right.\n\nAfter the four spells are cast, there is one golem on Square 2 and one golem on Square 3, for a total of two golems remaining.\n\nSample Input 2\n\n8 3\nAABCBDBA\nA L\nB R\nA R\n\nSample Output 2\n\n5\n\nAfter the three spells are cast, there is one golem on Square 2, two golems on Square 4 and two golems on Square 6, for a total of five golems remaining.\n\nNote that a single spell may move multiple golems.\n\nSample Input 3\n\n10 15\nSNCZWRCEWB\nB R\nR R\nE R\nW R\nZ L\nS R\nQ L\nW L\nB R\nC L\nA L\nN L\nE R\nZ L\nS L\n\nSample Output 3\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2605, "cpu_time_ms": 2113, "memory_kb": 167052}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s287123201", "group_id": "codeNet:p03085", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n d=Dict{Char,Char}('A'=>'T','T'=>'A','C'=>'G','G'=>'C')\n println(d[chomp(readline())])\nend\nmain()", "language": "Julia", "metadata": {"date": 1583069464, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03085.html", "problem_id": "p03085", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03085/input.txt", "sample_output_relpath": "derived/input_output/data/p03085/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03085/Julia/s287123201.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s287123201", "user_id": "u619197965"}, "prompt_components": {"gold_output": "T\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n d=Dict{Char,Char}('A'=>'T','T'=>'A','C'=>'G','G'=>'C')\n println(d[chomp(readline())])\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nOn the Planet AtCoder, there are four types of bases: A, C, G and T. A bonds with T, and C bonds with G.\n\nYou are given a letter b as input, which is A, C, G or T. Write a program that prints the letter representing the base that bonds with the base b.\n\nConstraints\n\nb is one of the letters A, C, G and T.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nb\n\nOutput\n\nPrint the letter representing the base that bonds with the base b.\n\nSample Input 1\n\nA\n\nSample Output 1\n\nT\n\nSample Input 2\n\nG\n\nSample Output 2\n\nC", "sample_input": "A\n"}, "reference_outputs": ["T\n"], "source_document_id": "p03085", "source_text": "Score : 100 points\n\nProblem Statement\n\nOn the Planet AtCoder, there are four types of bases: A, C, G and T. A bonds with T, and C bonds with G.\n\nYou are given a letter b as input, which is A, C, G or T. Write a program that prints the letter representing the base that bonds with the base b.\n\nConstraints\n\nb is one of the letters A, C, G and T.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nb\n\nOutput\n\nPrint the letter representing the base that bonds with the base b.\n\nSample Input 1\n\nA\n\nSample Output 1\n\nT\n\nSample Input 2\n\nG\n\nSample Output 2\n\nC", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 206, "cpu_time_ms": 1264, "memory_kb": 199808}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s043916185", "group_id": "codeNet:p03086", "input_text": "print(length(match(r\"(A|G|C|T)*\",readline()).match))", "language": "Julia", "metadata": {"date": 1588443053, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03086.html", "problem_id": "p03086", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03086/input.txt", "sample_output_relpath": "derived/input_output/data/p03086/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03086/Julia/s043916185.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s043916185", "user_id": "u443151804"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "print(length(match(r\"(A|G|C|T)*\",readline()).match))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\n\nHere, a ACGT string is a string that contains no characters other than A, C, G and T.\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\nS is a string of length between 1 and 10 (inclusive).\n\nEach character in S is an uppercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest ACGT string that is a substring of S.\n\nSample Input 1\n\nATCODER\n\nSample Output 1\n\n3\n\nAmong the ACGT strings that are substrings of ATCODER, the longest one is ATC.\n\nSample Input 2\n\nHATAGAYA\n\nSample Output 2\n\n5\n\nAmong the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.\n\nSample Input 3\n\nSHINJUKU\n\nSample Output 3\n\n0\n\nAmong the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).", "sample_input": "ATCODER\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03086", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\n\nHere, a ACGT string is a string that contains no characters other than A, C, G and T.\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\nS is a string of length between 1 and 10 (inclusive).\n\nEach character in S is an uppercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest ACGT string that is a substring of S.\n\nSample Input 1\n\nATCODER\n\nSample Output 1\n\n3\n\nAmong the ACGT strings that are substrings of ATCODER, the longest one is ATC.\n\nSample Input 2\n\nHATAGAYA\n\nSample Output 2\n\n5\n\nAmong the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.\n\nSample Input 3\n\nSHINJUKU\n\nSample Output 3\n\n0\n\nAmong the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 686, "memory_kb": 161696}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s794782268", "group_id": "codeNet:p03086", "input_text": "input = chomp(readline())\n\nfunction isbase(c)\n if c == 'A'\n true\n elseif c == 'C'\n true\n elseif c == 'G'\n true\n elseif c == 'T'\n true\n else\n false\n end\nend\n\nxs = zeros(Int, length(input))\nn = length(xs)\n\nfor (i, c) in enumerate(input)\n if isbase(c)\n xs[i] = 1\n end\nend\n\nys = Int[]\n\nval = 0\nfor i = 1:n\n if xs[i] == 1\n val += 1\n if i+1 > n || xs[i+1] == 0\n push!(ys, val)\n val = 0\n end\n end\nend\n\nprint(max(ys...))", "language": "Julia", "metadata": {"date": 1555572389, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03086.html", "problem_id": "p03086", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03086/input.txt", "sample_output_relpath": "derived/input_output/data/p03086/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03086/Julia/s794782268.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s794782268", "user_id": "u858970803"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "input = chomp(readline())\n\nfunction isbase(c)\n if c == 'A'\n true\n elseif c == 'C'\n true\n elseif c == 'G'\n true\n elseif c == 'T'\n true\n else\n false\n end\nend\n\nxs = zeros(Int, length(input))\nn = length(xs)\n\nfor (i, c) in enumerate(input)\n if isbase(c)\n xs[i] = 1\n end\nend\n\nys = Int[]\n\nval = 0\nfor i = 1:n\n if xs[i] == 1\n val += 1\n if i+1 > n || xs[i+1] == 0\n push!(ys, val)\n val = 0\n end\n end\nend\n\nprint(max(ys...))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\n\nHere, a ACGT string is a string that contains no characters other than A, C, G and T.\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\nS is a string of length between 1 and 10 (inclusive).\n\nEach character in S is an uppercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest ACGT string that is a substring of S.\n\nSample Input 1\n\nATCODER\n\nSample Output 1\n\n3\n\nAmong the ACGT strings that are substrings of ATCODER, the longest one is ATC.\n\nSample Input 2\n\nHATAGAYA\n\nSample Output 2\n\n5\n\nAmong the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.\n\nSample Input 3\n\nSHINJUKU\n\nSample Output 3\n\n0\n\nAmong the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).", "sample_input": "ATCODER\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03086", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S consisting of uppercase English letters. Find the length of the longest ACGT string that is a substring (see Notes) of S.\n\nHere, a ACGT string is a string that contains no characters other than A, C, G and T.\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\nS is a string of length between 1 and 10 (inclusive).\n\nEach character in S is an uppercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest ACGT string that is a substring of S.\n\nSample Input 1\n\nATCODER\n\nSample Output 1\n\n3\n\nAmong the ACGT strings that are substrings of ATCODER, the longest one is ATC.\n\nSample Input 2\n\nHATAGAYA\n\nSample Output 2\n\n5\n\nAmong the ACGT strings that are substrings of HATAGAYA, the longest one is ATAGA.\n\nSample Input 3\n\nSHINJUKU\n\nSample Output 3\n\n0\n\nAmong the ACGT strings that are substrings of SHINJUKU, the longest one is (the empty string).", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 527, "cpu_time_ms": 1384, "memory_kb": 149972}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s198677872", "group_id": "codeNet:p03087", "input_text": "n, q = [parse(Int, x) for x in split(chomp(readline()))]\nstr = readline() |> chomp\n\nac = zeros(Int, n)\ncount = 0\nfor i = 1:n-1\n if str[i] == 'A' && str[i+1] == 'C'\n count += 1\n end\n ac[i+1] = count\nend\n\nval = zeros(Int, q)\n\nfor i = 1:q\n l, r = [parse(Int, x) for x in split(chomp(readline()))]\n val = ac[r] - ac[l]\n println(val)\nend", "language": "Julia", "metadata": {"date": 1555578387, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s198677872.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s198677872", "user_id": "u858970803"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "n, q = [parse(Int, x) for x in split(chomp(readline()))]\nstr = readline() |> chomp\n\nac = zeros(Int, n)\ncount = 0\nfor i = 1:n-1\n if str[i] == 'A' && str[i+1] == 'C'\n count += 1\n end\n ac[i+1] = count\nend\n\nval = zeros(Int, q)\n\nfor i = 1:q\n l, r = [parse(Int, x) for x in split(chomp(readline()))]\n val = ac[r] - ac[l]\n println(val)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1511, "memory_kb": 156576}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s034798761", "group_id": "codeNet:p03087", "input_text": "n, q = [parse(Int, x) for x in split(chomp(readline()))]\nstr = readline() |> chomp\n\nac = zeros(Int, n-1)\nfor i = 1:n-1\n if str[i:i+1] == \"AC\"\n ac[i] = 1\n end\nend\n\nval = zeros(Int, q)\n\ntexts = readlines()\nlines = split(chomp(texts), \"\\n\")\n\nfor (i, line) in enumerate(lines)\n l, r = [parse(Int, x) for x in split(line)]\n val[i] = sum(ac[l:r-1])\nend\n\nfor v in val\n println(v)\nend", "language": "Julia", "metadata": {"date": 1555574796, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s034798761.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s034798761", "user_id": "u858970803"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "n, q = [parse(Int, x) for x in split(chomp(readline()))]\nstr = readline() |> chomp\n\nac = zeros(Int, n-1)\nfor i = 1:n-1\n if str[i:i+1] == \"AC\"\n ac[i] = 1\n end\nend\n\nval = zeros(Int, q)\n\ntexts = readlines()\nlines = split(chomp(texts), \"\\n\")\n\nfor (i, line) in enumerate(lines)\n l, r = [parse(Int, x) for x in split(line)]\n val[i] = sum(ac[l:r-1])\nend\n\nfor v in val\n println(v)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1980, "memory_kb": 217844}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s721706123", "group_id": "codeNet:p03087", "input_text": "n, q = [parse(Int, x) for x in split(chomp(readline()))]\nstr = readline() |> chomp\n\nval = zeros(Int, q)\nfor i = 1:q\n l, r = [parse(Int, x) for x in split(chomp(readline()))]\n substr = str[l:r]\n n_substr = length(substr)\n count = 0\n for j = 1:n_substr-1\n if substr[j:j+1] == \"AC\"\n count += 1\n end\n end\n val[i] = count\nend\n\nfor v in val\n println(v)\nend", "language": "Julia", "metadata": {"date": 1555572976, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s721706123.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s721706123", "user_id": "u858970803"}, "prompt_components": {"gold_output": "2\n0\n3\n", "input_to_evaluate": "n, q = [parse(Int, x) for x in split(chomp(readline()))]\nstr = readline() |> chomp\n\nval = zeros(Int, q)\nfor i = 1:q\n l, r = [parse(Int, x) for x in split(chomp(readline()))]\n substr = str[l:r]\n n_substr = length(substr)\n count = 0\n for j = 1:n_substr-1\n if substr[j:j+1] == \"AC\"\n count += 1\n end\n end\n val[i] = count\nend\n\nfor v in val\n println(v)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 399, "cpu_time_ms": 2112, "memory_kb": 155264}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s393645765", "group_id": "codeNet:p03088", "input_text": "idx(x,y,z) = (x-1)*16 + (y-1)*4 + (z-1) + 1\nconst mod = 10^9+7\n\nfunction calc(n::Int64)\n A = zeros(Int128,64,64)\n\n # ACGT = 1234\n for i=1:4, j=1:4, k=1:4, l=1:4\n if (j==1 && k==3 && l==2) continue end #*AGC\n if (j==1 && k==2 && l==3) continue end #*ACG\n if (j==3 && k==1 && l==2) continue end #*GAC\n if (i==1 && k==3 && l==2) continue end #A*GC\n A[idx(i,j,k), idx(j,k,l)] = 1\n end\n\n ans = A^0\n while n > 0\n\n if (n%2 == 1)\n ans = (ans * A) .% mod\n end\n\n A = (A * A) .% mod\n\n n = n ÷ 2\n end\n return ans\nend\n\nfunction main()\n n = parse(Int, readline())\n A = calc(n)\n\n ans = 0\n for i=1:4^3\n ans += A[idx(4,4,4),i]\n ans %= mod\n end\n println(ans)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1554636805, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03088.html", "problem_id": "p03088", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03088/input.txt", "sample_output_relpath": "derived/input_output/data/p03088/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03088/Julia/s393645765.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s393645765", "user_id": "u743272507"}, "prompt_components": {"gold_output": "61\n", "input_to_evaluate": "idx(x,y,z) = (x-1)*16 + (y-1)*4 + (z-1) + 1\nconst mod = 10^9+7\n\nfunction calc(n::Int64)\n A = zeros(Int128,64,64)\n\n # ACGT = 1234\n for i=1:4, j=1:4, k=1:4, l=1:4\n if (j==1 && k==3 && l==2) continue end #*AGC\n if (j==1 && k==2 && l==3) continue end #*ACG\n if (j==3 && k==1 && l==2) continue end #*GAC\n if (i==1 && k==3 && l==2) continue end #A*GC\n A[idx(i,j,k), idx(j,k,l)] = 1\n end\n\n ans = A^0\n while n > 0\n\n if (n%2 == 1)\n ans = (ans * A) .% mod\n end\n\n A = (A * A) .% mod\n\n n = n ÷ 2\n end\n return ans\nend\n\nfunction main()\n n = parse(Int, readline())\n A = calc(n)\n\n ans = 0\n for i=1:4^3\n ans += A[idx(4,4,4),i]\n ans %= mod\n end\n println(ans)\nend\n\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7:\n\nThe string does not contain characters other than A, C, G and T.\n\nThe string does not contain AGC as a substring.\n\nThe condition above cannot be violated by swapping two adjacent characters once.\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\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of strings of length N that satisfy the following conditions, modulo 10^9+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n61\n\nThere are 4^3 = 64 strings of length 3 that do not contain characters other than A, C, G and T. Among them, only AGC, ACG and GAC violate the condition, so the answer is 64 - 3 = 61.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n230\n\nSample Input 3\n\n100\n\nSample Output 3\n\n388130742\n\nBe sure to print the number of strings modulo 10^9+7.", "sample_input": "3\n"}, "reference_outputs": ["61\n"], "source_document_id": "p03088", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Find the number of strings of length N that satisfy the following conditions, modulo 10^9+7:\n\nThe string does not contain characters other than A, C, G and T.\n\nThe string does not contain AGC as a substring.\n\nThe condition above cannot be violated by swapping two adjacent characters once.\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\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the number of strings of length N that satisfy the following conditions, modulo 10^9+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n61\n\nThere are 4^3 = 64 strings of length 3 that do not contain characters other than A, C, G and T. Among them, only AGC, ACG and GAC violate the condition, so the answer is 64 - 3 = 61.\n\nSample Input 2\n\n4\n\nSample Output 2\n\n230\n\nSample Input 3\n\n100\n\nSample Output 3\n\n388130742\n\nBe sure to print the number of strings modulo 10^9+7.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 783, "cpu_time_ms": 1594, "memory_kb": 200952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s904786942", "group_id": "codeNet:p03089", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tb = readline() |> split |> parseMap\n\tflg = 0\n\tans = Int[]\n\tfor i in 1:n\n\t\tif b[i] > i\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tt = length(b)\n\t\tfor j in 0:t-1\n\t\t\tif b[t-j] == t-j\n\t\t\t\tt = t-j\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tif t == 0\n\t\t\tflg = 1\n\t\t\tbreak\n\t\telse\n\t\t\tpush!(ans,t)\n\t\t\tdeleteat!(b,t)\n\t\tend\n\tend\n\tif flg == 1\n\t\tprintln(-1)\n\telse\n\t\tfor i in 0:n-1\n\t\t\tprintln(ans[n-i])\n\t\tend\n\tend\nend\nmain()", "language": "Julia", "metadata": {"date": 1553379977, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s904786942.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s904786942", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n1\n2\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tb = readline() |> split |> parseMap\n\tflg = 0\n\tans = Int[]\n\tfor i in 1:n\n\t\tif b[i] > i\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tt = length(b)\n\t\tfor j in 0:t-1\n\t\t\tif b[t-j] == t-j\n\t\t\t\tt = t-j\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tif t == 0\n\t\t\tflg = 1\n\t\t\tbreak\n\t\telse\n\t\t\tpush!(ans,t)\n\t\t\tdeleteat!(b,t)\n\t\tend\n\tend\n\tif flg == 1\n\t\tprintln(-1)\n\telse\n\t\tfor i in 0:n-1\n\t\t\tprintln(ans[n-i])\n\t\tend\n\tend\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1550, "memory_kb": 129276}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s872846082", "group_id": "codeNet:p03090", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tt = div(n*(n+1),2)\n\tif n%2 == 1\n\t\tprintln(div((n-1)*(n-1),2))\n\t\ts = t-n\n\t\tfor i in 1:n\n\t\t\tfor j in i+1:n\n\t\t\t\tif t-i-j != s\n\t\t\t\t\tprintln(i, \" \", j)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telse\n\t\tprintln(div((n-1)*(n-1)-1,2))\n\t\ts = t-n-1\n\t\tfor i in 1:n\n\t\t\tfor j in i+1:n\n\t\t\t\tif t-i-j != s\n\t\t\t\t\tprintln(i, \" \", j)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend\nmain()", "language": "Julia", "metadata": {"date": 1553378604, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03090.html", "problem_id": "p03090", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03090/input.txt", "sample_output_relpath": "derived/input_output/data/p03090/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03090/Julia/s872846082.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s872846082", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n1 3\n2 3\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tt = div(n*(n+1),2)\n\tif n%2 == 1\n\t\tprintln(div((n-1)*(n-1),2))\n\t\ts = t-n\n\t\tfor i in 1:n\n\t\t\tfor j in i+1:n\n\t\t\t\tif t-i-j != s\n\t\t\t\t\tprintln(i, \" \", j)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\telse\n\t\tprintln(div((n-1)*(n-1)-1,2))\n\t\ts = t-n-1\n\t\tfor i in 1:n\n\t\t\tfor j in i+1:n\n\t\t\t\tif t-i-j != s\n\t\t\t\t\tprintln(i, \" \", j)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend\nmain()", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N.\nBuild an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\nThe graph is simple and connected.\n\nThere exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.\n\nIt can be proved that at least one such graph exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print the number of edges, M, in the graph you made. In the i-th of the following M lines, print two integers a_i and b_i, representing the endpoints of the i-th edge.\n\nThe output will be judged correct if the graph satisfies the conditions.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n1 3\n2 3\n\nFor every vertex, the sum of the indices of the vertices adjacent to that vertex is 3.", "sample_input": "3\n"}, "reference_outputs": ["2\n1 3\n2 3\n"], "source_document_id": "p03090", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer N.\nBuild an undirected graph with N vertices with indices 1 to N that satisfies the following two conditions:\n\nThe graph is simple and connected.\n\nThere exists an integer S such that, for every vertex, the sum of the indices of the vertices adjacent to that vertex is S.\n\nIt can be proved that at least one such graph exists under the constraints of this problem.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIn the first line, print the number of edges, M, in the graph you made. In the i-th of the following M lines, print two integers a_i and b_i, representing the endpoints of the i-th edge.\n\nThe output will be judged correct if the graph satisfies the conditions.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n2\n1 3\n2 3\n\nFor every vertex, the sum of the indices of the vertices adjacent to that vertex is 3.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 338, "memory_kb": 110212}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s969767882", "group_id": "codeNet:p03095", "input_text": "N=parse(Int,readline())\ncnt=zeros(Int,26)\nfor c=chomp(readline())\n\tcnt[Int(c)-96]+=1\nend\nans=1\nfor i=1:26\n\tans=ans*(cnt[i]+1)%(10^9+7)\nend\nprintln(ans-1)\n", "language": "Julia", "metadata": {"date": 1568023540, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s969767882.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s969767882", "user_id": "u657913472"}, "prompt_components": {"gold_output": "15\n", "input_to_evaluate": "N=parse(Int,readline())\ncnt=zeros(Int,26)\nfor c=chomp(readline())\n\tcnt[Int(c)-96]+=1\nend\nans=1\nfor i=1:26\n\tans=ans*(cnt[i]+1)%(10^9+7)\nend\nprintln(ans-1)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 371, "memory_kb": 119212}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s550980129", "group_id": "codeNet:p03101", "input_text": "H,W = parse.(split(readline()))\nh,w = parse.(split(readline()))\nprintln((H - h + W - w))\n\n", "language": "Julia", "metadata": {"date": 1579644423, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s550980129.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s550980129", "user_id": "u879294842"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "H,W = parse.(split(readline()))\nh,w = parse.(split(readline()))\nprintln((H - h + W - w))\n\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 963, "memory_kb": 174536}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s810142971", "group_id": "codeNet:p03101", "input_text": "function main()\n \n (H,W) = map(x -> parse(Int,x), split(readline()))\n (h,w) = map(x -> parse(Int,x), split(readline()))\n \n println((H-h)*(W-w))\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1579423492, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s810142971.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s810142971", "user_id": "u790457721"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n \n (H,W) = map(x -> parse(Int,x), split(readline()))\n (h,w) = map(x -> parse(Int,x), split(readline()))\n \n println((H-h)*(W-w))\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 375, "memory_kb": 111952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s958704741", "group_id": "codeNet:p03101", "input_text": "const lines=readlines(open(\"/dev/fd/0\"))\ninput()=shift!(lines)\nint(s::String)=parse(Int32,s)\nintSub(s::SubString{String})=parse(Int32,s)\nintLine()=map(intSub,split(input()))\nfunction main()\n H,W=intLine()\n h,w=intLine()\n println((H-h)*(W-w))\nend\nmain()", "language": "Julia", "metadata": {"date": 1561083470, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s958704741.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s958704741", "user_id": "u729133443"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "const lines=readlines(open(\"/dev/fd/0\"))\ninput()=shift!(lines)\nint(s::String)=parse(Int32,s)\nintSub(s::SubString{String})=parse(Int32,s)\nintLine()=map(intSub,split(input()))\nfunction main()\n H,W=intLine()\n h,w=intLine()\n println((H-h)*(W-w))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 261, "cpu_time_ms": 448, "memory_kb": 116296}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s544651884", "group_id": "codeNet:p03101", "input_text": "parseInt(x) = parse(Int,x)\nfunction main()\n\tH,W = map(parseInt, split(readline()))\n \th,w = map(parseInt, split(readline()))\n println(Int64(H*W - h*W - H*w + h*w))\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1556821759, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s544651884.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s544651884", "user_id": "u338200052"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nfunction main()\n\tH,W = map(parseInt, split(readline()))\n \th,w = map(parseInt, split(readline()))\n println(Int64(H*W - h*W - H*w + h*w))\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 824, "memory_kb": 165400}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s295741311", "group_id": "codeNet:p03102", "input_text": "parseInt(x) = parse(Int, x)\nn,m,c = readline() |> split .|> parseInt\nb = readline() |> split .|> parseInt |> Vector\nA = fill(0,n,m)\nfor i = 1:n\n A[i,:] .= readline() |> split .|> parseInt\nend\nans = A*b .+ c\nret = 0\nfor i in ans\n if i > 0 \n \tglobal ret += 1 \n end\nend\nprintln(ret)", "language": "Julia", "metadata": {"date": 1597943052, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s295741311.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s295741311", "user_id": "u743272507"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nn,m,c = readline() |> split .|> parseInt\nb = readline() |> split .|> parseInt |> Vector\nA = fill(0,n,m)\nfor i = 1:n\n A[i,:] .= readline() |> split .|> parseInt\nend\nans = A*b .+ c\nret = 0\nfor i in ans\n if i > 0 \n \tglobal ret += 1 \n end\nend\nprintln(ret)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 521, "memory_kb": 216528}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s520299969", "group_id": "codeNet:p03102", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,m,c=parseMap(split(readline()))\n b=parseMap(split(readline()))\n a=[parseMap(split(readline())) for i in 1:n]\n ans=0\n for i in 1:n\n res=c\n for j in 1:m\n res+=a[i][j]*b[j]\n end\n if res>0\n ans+=1\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1583071544, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s520299969.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s520299969", "user_id": "u619197965"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,m,c=parseMap(split(readline()))\n b=parseMap(split(readline()))\n a=[parseMap(split(readline())) for i in 1:n]\n ans=0\n for i in 1:n\n res=c\n for j in 1:m\n res+=a[i][j]*b[j]\n end\n if res>0\n ans+=1\n end\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 411, "cpu_time_ms": 393, "memory_kb": 112824}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s950351804", "group_id": "codeNet:p03102", "input_text": "parseInt(x) = parse(Int,x)\n\nfunction main()\n\tN,M,C = map(parseInt, split(readline()))\n \tb = map(parseInt, split(readline()))\n ans = 0\n \tfor i = 1:N\n \t\ta = map(parseInt, split(readline()))\n \tif sum(a.*b) + C > 0\n \t\tans += 1\n end\n end\n println(Int64(ans))\nend\nmain()", "language": "Julia", "metadata": {"date": 1556822656, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s950351804.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s950351804", "user_id": "u338200052"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nfunction main()\n\tN,M,C = map(parseInt, split(readline()))\n \tb = map(parseInt, split(readline()))\n ans = 0\n \tfor i = 1:N\n \t\ta = map(parseInt, split(readline()))\n \tif sum(a.*b) + C > 0\n \t\tans += 1\n end\n end\n println(Int64(ans))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 478, "memory_kb": 114952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s078854290", "group_id": "codeNet:p03102", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,m,c = readline() |> split |> parseMap\n\tb = readline() |> split |> parseMap\n\tk = 0\n\tfor i in 1:n\n\t\ta = readline() |> split |> parseMap\n\t\tt = c\n\t\tfor j in 1:m\n\t\t\tt += a[j]*b[j]\n\t\tend\n\t\tif t > 0\n\t\t\tk += 1\n\t\tend\n\tend\n\tprintln(k)\nend\nmain()", "language": "Julia", "metadata": {"date": 1552161918, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s078854290.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s078854290", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,m,c = readline() |> split |> parseMap\n\tb = readline() |> split |> parseMap\n\tk = 0\n\tfor i in 1:n\n\t\ta = readline() |> split |> parseMap\n\t\tt = c\n\t\tfor j in 1:m\n\t\t\tt += a[j]*b[j]\n\t\tend\n\t\tif t > 0\n\t\t\tk += 1\n\t\tend\n\tend\n\tprintln(k)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 336, "cpu_time_ms": 1014, "memory_kb": 167616}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s215599227", "group_id": "codeNet:p03103", "input_text": "inpl() = map(parse,split(readline()))\n(N,M) = inpl()\nA = Array{Int}(N)\nB = Array{Int}(N)\nfor i = 1:N\n (A[i],B[i]) = inpl()\nend\norder = sortperm(A)\nans = 0\nfor i = 1:N\n if B[order[i]] >= M\n ans += M*A[order[i]]\n break\n else\n M -= B[order[i]]\n ans += B[order[i]]*A[order[i]]\n end\nend\nprintln(ans)", "language": "Julia", "metadata": {"date": 1553245716, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s215599227.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s215599227", "user_id": "u894258749"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "inpl() = map(parse,split(readline()))\n(N,M) = inpl()\nA = Array{Int}(N)\nB = Array{Int}(N)\nfor i = 1:N\n (A[i],B[i]) = inpl()\nend\norder = sortperm(A)\nans = 0\nfor i = 1:N\n if B[order[i]] >= M\n ans += M*A[order[i]]\n break\n else\n M -= B[order[i]]\n ans += B[order[i]]*A[order[i]]\n end\nend\nprintln(ans)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2111, "memory_kb": 152252}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s257326813", "group_id": "codeNet:p03106", "input_text": "function mkdivisor(n::Int) \n divisors=Int[] \n for i=1:div(n^0.5,1) \n if n%i==0 \n push!(divisors,i) \n if i!= fld(n,i); push!(divisors,fld(n,i));end\n end\n end\n sort!(divisors)\n return divisors\nend\n\nmacro p(z);:((x->parse(Int,x)).(split($z)));end\na,b,k=@p(readline())\nprint([i for i=mkdivisor(a) if i in mkdivisor(b)][end-k+1])", "language": "Julia", "metadata": {"date": 1590223599, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s257326813.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s257326813", "user_id": "u443151804"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function mkdivisor(n::Int) \n divisors=Int[] \n for i=1:div(n^0.5,1) \n if n%i==0 \n push!(divisors,i) \n if i!= fld(n,i); push!(divisors,fld(n,i));end\n end\n end\n sort!(divisors)\n return divisors\nend\n\nmacro p(z);:((x->parse(Int,x)).(split($z)));end\na,b,k=@p(readline())\nprint([i for i=mkdivisor(a) if i in mkdivisor(b)][end-k+1])", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 557, "memory_kb": 120240}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s640992375", "group_id": "codeNet:p03107", "input_text": "function main()\n global s = readline()\n so = s[:]\n while length(s) >1 && s != \"1\"^length(s) && s != \"0\"^length(s) \n i = length(s) \n while i >1\n if i == 2\n if s[1:2] == \"00\" || s[1:2] ==\"11\" \n \n elseif length(s) >=3\n global s = s[3:end]\n else \n global s = \"\"\n end\n elseif i != length(s)\n if (parse(Int, s[i]) $ parse(Int, s[i-1])) == 1\n s = s[1:i-2] * s[i+1:end]\n i -=1\n end\n else\n if (parse(Int, s[i]) $ parse(Int, s[i-1])) == 1\n global s = s[1:i-2]\n i -=1\n end\n end\n i -=1\n end\n end\n println(Int64(length(so) - length(s)))\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1556830272, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s640992375.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s640992375", "user_id": "u338200052"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function main()\n global s = readline()\n so = s[:]\n while length(s) >1 && s != \"1\"^length(s) && s != \"0\"^length(s) \n i = length(s) \n while i >1\n if i == 2\n if s[1:2] == \"00\" || s[1:2] ==\"11\" \n \n elseif length(s) >=3\n global s = s[3:end]\n else \n global s = \"\"\n end\n elseif i != length(s)\n if (parse(Int, s[i]) $ parse(Int, s[i-1])) == 1\n s = s[1:i-2] * s[i+1:end]\n i -=1\n end\n else\n if (parse(Int, s[i]) $ parse(Int, s[i-1])) == 1\n global s = s[1:i-2]\n i -=1\n end\n end\n i -=1\n end\n end\n println(Int64(length(so) - length(s)))\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 694, "cpu_time_ms": 639, "memory_kb": 129420}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s767452281", "group_id": "codeNet:p03109", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n s=parseMap(split(readline(),'/'))\n if s[1]<2019 || (s[2]<=4 && s[3]<=30)\n println(\"Heisei\")\n else\n println(\"TBD\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1583084498, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s767452281.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s767452281", "user_id": "u619197965"}, "prompt_components": {"gold_output": "Heisei\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n s=parseMap(split(readline(),'/'))\n if s[1]<2019 || (s[2]<=4 && s[3]<=30)\n println(\"Heisei\")\n else\n println(\"TBD\")\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 356, "memory_kb": 115756}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s372219396", "group_id": "codeNet:p03109", "input_text": "parseInt(x) = parse(Int,x)\nfunction main()\n s = readline()\n y,m,d = map(parseInt,split(a))\n if y<2019\n println(\"heisei\")\n elseif y>2019\n println(\"TBD\")\n elseif m<=4\n println(\"heisei\")\n else\n println(\"TBD\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1556884259, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s372219396.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s372219396", "user_id": "u338200052"}, "prompt_components": {"gold_output": "Heisei\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nfunction main()\n s = readline()\n y,m,d = map(parseInt,split(a))\n if y<2019\n println(\"heisei\")\n elseif y>2019\n println(\"TBD\")\n elseif m<=4\n println(\"heisei\")\n else\n println(\"TBD\")\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1356, "memory_kb": 197656}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s353292667", "group_id": "codeNet:p03110", "input_text": "macro p(z);:((x->parse(Int,x)).(split($z)));end\nf(s) = s == \"BTC\" ? 380000 : 1\nfunction main()\n sum_money=0\n for i=1:parse(Int,readline())\n a,b=split(readline())\n sum_money+=parse(Float64,a)*f(b)\n end\n print(sum_money)\nend\nmain()", "language": "Julia", "metadata": {"date": 1590331539, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s353292667.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s353292667", "user_id": "u443151804"}, "prompt_components": {"gold_output": "48000.0\n", "input_to_evaluate": "macro p(z);:((x->parse(Int,x)).(split($z)));end\nf(s) = s == \"BTC\" ? 380000 : 1\nfunction main()\n sum_money=0\n for i=1:parse(Int,readline())\n a,b=split(readline())\n sum_money+=parse(Float64,a)*f(b)\n end\n print(sum_money)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 763, "memory_kb": 166952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s414914290", "group_id": "codeNet:p03111", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nn,a,b,c=parseMap(split(readline()))\nl=[parseInt(readline()) for i in 1:n]\nans=10^9\n\nfunction dfs(cnt,one,two,three,mp)\n global ans\n if cnt==n+1\n if 0 in [one,two,three]\n return 0\n end\n ans=min(ans,mp+abs(one-a)+abs(two-b)+abs(three-c)-30)\n else\n dfs(cnt+1,one+l[cnt],two,three,mp+10)\n dfs(cnt+1,one,two+l[cnt],three,mp+10)\n dfs(cnt+1,one,two,three+l[cnt],mp+10)\n dfs(cnt+1,one,two,three,mp)\n end\nend\n\nfunction main()\n global ans\n dfs(1,0,0,0,0)\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1587245085, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s414914290.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s414914290", "user_id": "u619197965"}, "prompt_components": {"gold_output": "23\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nn,a,b,c=parseMap(split(readline()))\nl=[parseInt(readline()) for i in 1:n]\nans=10^9\n\nfunction dfs(cnt,one,two,three,mp)\n global ans\n if cnt==n+1\n if 0 in [one,two,three]\n return 0\n end\n ans=min(ans,mp+abs(one-a)+abs(two-b)+abs(three-c)-30)\n else\n dfs(cnt+1,one+l[cnt],two,three,mp+10)\n dfs(cnt+1,one,two+l[cnt],three,mp+10)\n dfs(cnt+1,one,two,three+l[cnt],mp+10)\n dfs(cnt+1,one,two,three,mp)\n end\nend\n\nfunction main()\n global ans\n dfs(1,0,0,0,0)\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 744, "cpu_time_ms": 951, "memory_kb": 171076}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s753229022", "group_id": "codeNet:p03112", "input_text": "function main()\n const lines=readlines()\n state=0\n input()=lines[state+=1]\n int(s::String)=parse(Int,s)\n intSub(s::SubString{String})=parse(Int,s)\n intLine(s::Array{SubString{String},1})=map(intSub,s)\n const INF=2^60\n a,b,q=input()|>split|>intLine\n s=Array{Int}(a+2)\n s[1],s[a+2]=-INF,INF\n for i in 2:a+1\n s[i]=int(input())\n end\n t=Array{Int}(b+2)\n t[1],t[b+2]=-INF,INF\n for i in 2:b+1\n t[i]=int(input())\n end\n for _ in 1:q\n x=int(input())\n m=INF\n i=searchsortedlast(s,x)\n j=searchsortedlast(t,x)\n for v in view(s,i:i+1)\n for w in view(t,j:j+1)\n m=min(m,abs(x-v)+abs(v-w),abs(x-w)+abs(w-v))\n end\n end\n println(m)\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1561251106, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03112.html", "problem_id": "p03112", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03112/input.txt", "sample_output_relpath": "derived/input_output/data/p03112/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03112/Julia/s753229022.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s753229022", "user_id": "u729133443"}, "prompt_components": {"gold_output": "350\n1400\n301\n399\n", "input_to_evaluate": "function main()\n const lines=readlines()\n state=0\n input()=lines[state+=1]\n int(s::String)=parse(Int,s)\n intSub(s::SubString{String})=parse(Int,s)\n intLine(s::Array{SubString{String},1})=map(intSub,s)\n const INF=2^60\n a,b,q=input()|>split|>intLine\n s=Array{Int}(a+2)\n s[1],s[a+2]=-INF,INF\n for i in 2:a+1\n s[i]=int(input())\n end\n t=Array{Int}(b+2)\n t[1],t[b+2]=-INF,INF\n for i in 2:b+1\n t[i]=int(input())\n end\n for _ in 1:q\n x=int(input())\n m=INF\n i=searchsortedlast(s,x)\n j=searchsortedlast(t,x)\n for v in view(s,i:i+1)\n for w in view(t,j:j+1)\n m=min(m,abs(x-v)+abs(v-w),abs(x-w)+abs(w-v))\n end\n end\n println(m)\n end\nend\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nAlong a road running in an east-west direction, there are A shrines and B temples.\nThe i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road.\n\nAnswer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.)\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq s_1 < s_2 < ... < s_A \\leq 10^{10}\n\n1 \\leq t_1 < t_2 < ... < t_B \\leq 10^{10}\n\n1 \\leq x_i \\leq 10^{10}\n\ns_1, ..., s_A, t_1, ..., t_B, x_1, ..., x_Q are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B Q\ns_1\n:\ns_A\nt_1\n:\nt_B\nx_1\n:\nx_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\n2 3 4\n100\n600\n400\n900\n1000\n150\n2000\n899\n799\n\nSample Output 1\n\n350\n1400\n301\n399\n\nThere are two shrines and three temples. The shrines are located at distances of 100, 600 meters from the west end of the road, and the temples are located at distances of 400, 900, 1000 meters from the west end of the road.\n\nQuery 1: If we start from a point at a distance of 150 meters from the west end of the road, the optimal move is first to walk 50 meters west to visit a shrine, then to walk 300 meters east to visit a temple.\n\nQuery 2: If we start from a point at a distance of 2000 meters from the west end of the road, the optimal move is first to walk 1000 meters west to visit a temple, then to walk 400 meters west to visit a shrine. We will pass by another temple on the way, but it is fine.\n\nQuery 3: If we start from a point at a distance of 899 meters from the west end of the road, the optimal move is first to walk 1 meter east to visit a temple, then to walk 300 meters west to visit a shrine.\n\nQuery 4: If we start from a point at a distance of 799 meters from the west end of the road, the optimal move is first to walk 199 meters west to visit a shrine, then to walk 200 meters west to visit a temple.\n\nSample Input 2\n\n1 1 3\n1\n10000000000\n2\n9999999999\n5000000000\n\nSample Output 2\n\n10000000000\n10000000000\n14999999998\n\nThe road is quite long, and we may need to travel a distance that does not fit into a 32-bit integer.", "sample_input": "2 3 4\n100\n600\n400\n900\n1000\n150\n2000\n899\n799\n"}, "reference_outputs": ["350\n1400\n301\n399\n"], "source_document_id": "p03112", "source_text": "Score : 400 points\n\nProblem Statement\n\nAlong a road running in an east-west direction, there are A shrines and B temples.\nThe i-th shrine from the west is located at a distance of s_i meters from the west end of the road, and the i-th temple from the west is located at a distance of t_i meters from the west end of the road.\n\nAnswer the following Q queries:\n\nQuery i (1 \\leq i \\leq Q): If we start from a point at a distance of x_i meters from the west end of the road and freely travel along the road, what is the minimum distance that needs to be traveled in order to visit one shrine and one temple? (It is allowed to pass by more shrines and temples than required.)\n\nConstraints\n\n1 \\leq A, B \\leq 10^5\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq s_1 < s_2 < ... < s_A \\leq 10^{10}\n\n1 \\leq t_1 < t_2 < ... < t_B \\leq 10^{10}\n\n1 \\leq x_i \\leq 10^{10}\n\ns_1, ..., s_A, t_1, ..., t_B, x_1, ..., x_Q are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B Q\ns_1\n:\ns_A\nt_1\n:\nt_B\nx_1\n:\nx_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\n2 3 4\n100\n600\n400\n900\n1000\n150\n2000\n899\n799\n\nSample Output 1\n\n350\n1400\n301\n399\n\nThere are two shrines and three temples. The shrines are located at distances of 100, 600 meters from the west end of the road, and the temples are located at distances of 400, 900, 1000 meters from the west end of the road.\n\nQuery 1: If we start from a point at a distance of 150 meters from the west end of the road, the optimal move is first to walk 50 meters west to visit a shrine, then to walk 300 meters east to visit a temple.\n\nQuery 2: If we start from a point at a distance of 2000 meters from the west end of the road, the optimal move is first to walk 1000 meters west to visit a temple, then to walk 400 meters west to visit a shrine. We will pass by another temple on the way, but it is fine.\n\nQuery 3: If we start from a point at a distance of 899 meters from the west end of the road, the optimal move is first to walk 1 meter east to visit a temple, then to walk 300 meters west to visit a shrine.\n\nQuery 4: If we start from a point at a distance of 799 meters from the west end of the road, the optimal move is first to walk 199 meters west to visit a shrine, then to walk 200 meters west to visit a temple.\n\nSample Input 2\n\n1 1 3\n1\n10000000000\n2\n9999999999\n5000000000\n\nSample Output 2\n\n10000000000\n10000000000\n14999999998\n\nThe road is quite long, and we may need to travel a distance that does not fit into a 32-bit integer.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 782, "cpu_time_ms": 790, "memory_kb": 176152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s406891193", "group_id": "codeNet:p03125", "input_text": "function main()\n \n (A,B) = map(x -> parse(Int,x), split(readline()))\n \n if B % A == 0\n println(A+B)\n else\n println(B-A)\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1578155216, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03125.html", "problem_id": "p03125", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03125/input.txt", "sample_output_relpath": "derived/input_output/data/p03125/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03125/Julia/s406891193.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s406891193", "user_id": "u790457721"}, "prompt_components": {"gold_output": "16\n", "input_to_evaluate": "function main()\n \n (A,B) = map(x -> parse(Int,x), split(readline()))\n \n if B % A == 0\n println(A+B)\n else\n println(B-A)\n end\n \nend\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nSample Input 1\n\n4 12\n\nSample Output 1\n\n16\n\nAs 4 is a divisor of 12, 4 + 12 = 16 should be printed.\n\nSample Input 2\n\n8 20\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n2\n\n1 is a divisor of 1.", "sample_input": "4 12\n"}, "reference_outputs": ["16\n"], "source_document_id": "p03125", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nSample Input 1\n\n4 12\n\nSample Output 1\n\n16\n\nAs 4 is a divisor of 12, 4 + 12 = 16 should be printed.\n\nSample Input 2\n\n8 20\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n2\n\n1 is a divisor of 1.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 768, "memory_kb": 166824}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s694582297", "group_id": "codeNet:p03125", "input_text": "a,b=map(x->parse(x),split(readline()))\nif b%a==0\n println(a+b)\nelse\n println(b-a)\nend", "language": "Julia", "metadata": {"date": 1550373340, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03125.html", "problem_id": "p03125", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03125/input.txt", "sample_output_relpath": "derived/input_output/data/p03125/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03125/Julia/s694582297.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s694582297", "user_id": "u657913472"}, "prompt_components": {"gold_output": "16\n", "input_to_evaluate": "a,b=map(x->parse(x),split(readline()))\nif b%a==0\n println(a+b)\nelse\n println(b-a)\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nSample Input 1\n\n4 12\n\nSample Output 1\n\n16\n\nAs 4 is a divisor of 12, 4 + 12 = 16 should be printed.\n\nSample Input 2\n\n8 20\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n2\n\n1 is a divisor of 1.", "sample_input": "4 12\n"}, "reference_outputs": ["16\n"], "source_document_id": "p03125", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given positive integers A and B.\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq A \\leq B \\leq 20\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf A is a divisor of B, print A + B; otherwise, print B - A.\n\nSample Input 1\n\n4 12\n\nSample Output 1\n\n16\n\nAs 4 is a divisor of 12, 4 + 12 = 16 should be printed.\n\nSample Input 2\n\n8 20\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n2\n\n1 is a divisor of 1.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 87, "cpu_time_ms": 767, "memory_kb": 162896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s758704763", "group_id": "codeNet:p03126", "input_text": "parseInt(x) = parse(Int, x)\nparseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,m=parseMap(split(readline()))\n food=[0 for i in 1:m]\n for i in 1:n\n a=parseMap(split(readline()))\n for j in 2:a[1]+1\n food[a[j]]+=1\n end\n end\n println(sum([div(i,n) for i in food]))\nend\nmain()", "language": "Julia", "metadata": {"date": 1583107038, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03126.html", "problem_id": "p03126", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03126/input.txt", "sample_output_relpath": "derived/input_output/data/p03126/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03126/Julia/s758704763.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s758704763", "user_id": "u619197965"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n,m=parseMap(split(readline()))\n food=[0 for i in 1:m]\n for i in 1:n\n a=parseMap(split(readline()))\n for j in 2:a[1]+1\n food[a[j]]+=1\n end\n end\n println(sum([div(i,n) for i in food]))\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nKatsusando loves omelette rice.\n\nBesides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.\n\nTo prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.\n\nThe i-th person answered that he/she only likes the A_{i1}-th, A_{i2}-th, ..., A_{iK_i}-th food.\n\nFind the number of the foods liked by all the N people.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 30\n\n1 \\leq K_i \\leq M\n\n1 \\leq A_{ij} \\leq M\n\nFor each i (1 \\leq i \\leq N), A_{i1}, A_{i2}, ..., A_{iK_i} are distinct.\n\nConstraints\n\nInput is given from Standard Input in the following format:\n\nN M\nK_1 A_{11} A_{12} ... A_{1K_1}\nK_2 A_{21} A_{22} ... A_{2K_2}\n:\nK_N A_{N1} A_{N2} ... A_{NK_N}\n\nOutput\n\nPrint the number of the foods liked by all the N people.\n\nSample Input 1\n\n3 4\n2 1 3\n3 1 2 3\n2 3 2\n\nSample Output 1\n\n1\n\nAs only the third food is liked by all the three people, 1 should be printed.\n\nSample Input 2\n\n5 5\n4 2 3 4 5\n4 1 3 4 5\n4 1 2 4 5\n4 1 2 3 5\n4 1 2 3 4\n\nSample Output 2\n\n0\n\nKatsusando's hypothesis turned out to be wrong.\n\nSample Input 3\n\n1 30\n3 5 10 30\n\nSample Output 3\n\n3", "sample_input": "3 4\n2 1 3\n3 1 2 3\n2 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03126", "source_text": "Score : 200 points\n\nProblem Statement\n\nKatsusando loves omelette rice.\n\nBesides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.\n\nTo prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.\n\nThe i-th person answered that he/she only likes the A_{i1}-th, A_{i2}-th, ..., A_{iK_i}-th food.\n\nFind the number of the foods liked by all the N people.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 30\n\n1 \\leq K_i \\leq M\n\n1 \\leq A_{ij} \\leq M\n\nFor each i (1 \\leq i \\leq N), A_{i1}, A_{i2}, ..., A_{iK_i} are distinct.\n\nConstraints\n\nInput is given from Standard Input in the following format:\n\nN M\nK_1 A_{11} A_{12} ... A_{1K_1}\nK_2 A_{21} A_{22} ... A_{2K_2}\n:\nK_N A_{N1} A_{N2} ... A_{NK_N}\n\nOutput\n\nPrint the number of the foods liked by all the N people.\n\nSample Input 1\n\n3 4\n2 1 3\n3 1 2 3\n2 3 2\n\nSample Output 1\n\n1\n\nAs only the third food is liked by all the three people, 1 should be printed.\n\nSample Input 2\n\n5 5\n4 2 3 4 5\n4 1 3 4 5\n4 1 2 4 5\n4 1 2 3 5\n4 1 2 3 4\n\nSample Output 2\n\n0\n\nKatsusando's hypothesis turned out to be wrong.\n\nSample Input 3\n\n1 30\n3 5 10 30\n\nSample Output 3\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 922, "memory_kb": 173132}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s947598892", "group_id": "codeNet:p03126", "input_text": "parseInt(x) = parse(Int,x)\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\nfunction main()\n n,m = map(parseInt, split(readline()))\n temp = 1:m\n for i in 1:N\n a = readline() |> split |> parseMap\n temp = filter(x->(x in a[2:end]),temp)\n end\n println(Int64(length(temp)))\nend\nmain()", "language": "Julia", "metadata": {"date": 1556915230, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03126.html", "problem_id": "p03126", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03126/input.txt", "sample_output_relpath": "derived/input_output/data/p03126/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03126/Julia/s947598892.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s947598892", "user_id": "u338200052"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\nfunction main()\n n,m = map(parseInt, split(readline()))\n temp = 1:m\n for i in 1:N\n a = readline() |> split |> parseMap\n temp = filter(x->(x in a[2:end]),temp)\n end\n println(Int64(length(temp)))\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nKatsusando loves omelette rice.\n\nBesides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.\n\nTo prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.\n\nThe i-th person answered that he/she only likes the A_{i1}-th, A_{i2}-th, ..., A_{iK_i}-th food.\n\nFind the number of the foods liked by all the N people.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 30\n\n1 \\leq K_i \\leq M\n\n1 \\leq A_{ij} \\leq M\n\nFor each i (1 \\leq i \\leq N), A_{i1}, A_{i2}, ..., A_{iK_i} are distinct.\n\nConstraints\n\nInput is given from Standard Input in the following format:\n\nN M\nK_1 A_{11} A_{12} ... A_{1K_1}\nK_2 A_{21} A_{22} ... A_{2K_2}\n:\nK_N A_{N1} A_{N2} ... A_{NK_N}\n\nOutput\n\nPrint the number of the foods liked by all the N people.\n\nSample Input 1\n\n3 4\n2 1 3\n3 1 2 3\n2 3 2\n\nSample Output 1\n\n1\n\nAs only the third food is liked by all the three people, 1 should be printed.\n\nSample Input 2\n\n5 5\n4 2 3 4 5\n4 1 3 4 5\n4 1 2 4 5\n4 1 2 3 5\n4 1 2 3 4\n\nSample Output 2\n\n0\n\nKatsusando's hypothesis turned out to be wrong.\n\nSample Input 3\n\n1 30\n3 5 10 30\n\nSample Output 3\n\n3", "sample_input": "3 4\n2 1 3\n3 1 2 3\n2 3 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03126", "source_text": "Score : 200 points\n\nProblem Statement\n\nKatsusando loves omelette rice.\n\nBesides, he loves crème brûlée, tenderloin steak and so on, and believes that these foods are all loved by everyone.\n\nTo prove that hypothesis, he conducted a survey on M kinds of foods and asked N people whether they like these foods or not.\n\nThe i-th person answered that he/she only likes the A_{i1}-th, A_{i2}-th, ..., A_{iK_i}-th food.\n\nFind the number of the foods liked by all the N people.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N, M \\leq 30\n\n1 \\leq K_i \\leq M\n\n1 \\leq A_{ij} \\leq M\n\nFor each i (1 \\leq i \\leq N), A_{i1}, A_{i2}, ..., A_{iK_i} are distinct.\n\nConstraints\n\nInput is given from Standard Input in the following format:\n\nN M\nK_1 A_{11} A_{12} ... A_{1K_1}\nK_2 A_{21} A_{22} ... A_{2K_2}\n:\nK_N A_{N1} A_{N2} ... A_{NK_N}\n\nOutput\n\nPrint the number of the foods liked by all the N people.\n\nSample Input 1\n\n3 4\n2 1 3\n3 1 2 3\n2 3 2\n\nSample Output 1\n\n1\n\nAs only the third food is liked by all the three people, 1 should be printed.\n\nSample Input 2\n\n5 5\n4 2 3 4 5\n4 1 3 4 5\n4 1 2 4 5\n4 1 2 3 5\n4 1 2 3 4\n\nSample Output 2\n\n0\n\nKatsusando's hypothesis turned out to be wrong.\n\nSample Input 3\n\n1 30\n3 5 10 30\n\nSample Output 3\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 614, "memory_kb": 130064}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s139588087", "group_id": "codeNet:p03127", "input_text": "function main()\n \n N = parse(Int, readline())\n A = map(x -> parse(Int,x), split(readline()))\n\n println(gcd(a))\n \nend\n \nmain()", "language": "Julia", "metadata": {"date": 1578160367, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s139588087.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s139588087", "user_id": "u790457721"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n \n N = parse(Int, readline())\n A = map(x -> parse(Int,x), split(readline()))\n\n println(gcd(a))\n \nend\n \nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 640, "memory_kb": 136684}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s508262810", "group_id": "codeNet:p03127", "input_text": "function GCD(a,b)# a>b\n \n check = false\n \n while check == false\n \n if a % b != 0\n r = a % b\n a = b\n b = r\n else\n check = true\n return b\n end\n \n end\n \nend\n\nfunction main()\n \n N = parse(Int, readline())\n A = map(x -> parse(Int,x), split(readline()))\n \n sort!(A)\n \n println(GCD(A[1],A[2]))\n \nend\n \nmain()", "language": "Julia", "metadata": {"date": 1578159231, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s508262810.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s508262810", "user_id": "u790457721"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function GCD(a,b)# a>b\n \n check = false\n \n while check == false\n \n if a % b != 0\n r = a % b\n a = b\n b = r\n else\n check = true\n return b\n end\n \n end\n \nend\n\nfunction main()\n \n N = parse(Int, readline())\n A = map(x -> parse(Int,x), split(readline()))\n \n sort!(A)\n \n println(GCD(A[1],A[2]))\n \nend\n \nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 425, "memory_kb": 117756}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s583873090", "group_id": "codeNet:p03127", "input_text": "parseInt(x) = parse(Int,x)\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\nfunction main()\n N = map(parseInt, split(readline()))[1]\n a = map(parseInt, split(readline()))\n g = a[1]\n for i = 1:N-1\n g = gcd(g,a[i+1])\n end\n println(Int64(g))\nend\nmain()", "language": "Julia", "metadata": {"date": 1556915911, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s583873090.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s583873090", "user_id": "u338200052"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\nfunction main()\n N = map(parseInt, split(readline()))[1]\n a = map(parseInt, split(readline()))\n g = a[1]\n for i = 1:N-1\n g = gcd(g,a[i+1])\n end\n println(Int64(g))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 423, "memory_kb": 127304}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s737457748", "group_id": "codeNet:p03128", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tv = [2,5,5,4,5,6,3,7,6]\n\tn,m = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\ta = sort(a,rev=true)\n\tdp = -ones(Int,n+1)\n\tdp[1] = 0\n\tfor i in 1:n+1\n\t\tif dp[i]>=0\n\t\t\tfor j in a\n\t\t\t\tif i+v[j]<=n+1\n\t\t\t\t\tdp[i+v[j]]=max(dp[i+v[j]],dp[i]+1)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tk = n+1\n\twhile k>1\n\t\tfor j in a\n\t\t\tif k-v[j]>0\n\t\t\t\tif dp[k-v[j]]==dp[k]-1\n\t\t\t\t\tprint(j)\n\t\t\t\t\tk -= v[j]\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tprintln(\"\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1572623867, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s737457748.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s737457748", "user_id": "u095714878"}, "prompt_components": {"gold_output": "777773\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tv = [2,5,5,4,5,6,3,7,6]\n\tn,m = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\ta = sort(a,rev=true)\n\tdp = -ones(Int,n+1)\n\tdp[1] = 0\n\tfor i in 1:n+1\n\t\tif dp[i]>=0\n\t\t\tfor j in a\n\t\t\t\tif i+v[j]<=n+1\n\t\t\t\t\tdp[i+v[j]]=max(dp[i+v[j]],dp[i]+1)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tk = n+1\n\twhile k>1\n\t\tfor j in a\n\t\t\tif k-v[j]>0\n\t\t\t\tif dp[k-v[j]]==dp[k]-1\n\t\t\t\t\tprint(j)\n\t\t\t\t\tk -= v[j]\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tprintln(\"\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 553, "cpu_time_ms": 467, "memory_kb": 115076}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s890202209", "group_id": "codeNet:p03129", "input_text": "import Base.readline\nfunction readint\n parse(Int, strip(readline()))\nend\n\nL = readint()\n\nstarted = 0\nnotstarted = 0\n\nfor _ in 1:L\n a = readint()\n notstarted, started = notstarted + a, min(started + mod(a + 1, 2), notstarted)\nend\n\nprintln(min(notstarted, started))", "language": "Julia", "metadata": {"date": 1550536989, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03129.html", "problem_id": "p03129", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03129/input.txt", "sample_output_relpath": "derived/input_output/data/p03129/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03129/Julia/s890202209.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s890202209", "user_id": "u419818973"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "import Base.readline\nfunction readint\n parse(Int, strip(readline()))\nend\n\nL = readint()\n\nstarted = 0\nnotstarted = 0\n\nfor _ in 1:L\n a = readint()\n notstarted, started = notstarted + a, min(started + mod(a + 1, 2), notstarted)\nend\n\nprintln(min(notstarted, started))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nDetermine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1.\n\nConstraints\n\n1\\leq N,K\\leq 100\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\nIf we can choose K integers as above, print YES; otherwise, print NO.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\nYES\n\nWe can choose 1 and 3.\n\nSample Input 2\n\n5 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n31 10\n\nSample Output 3\n\nYES\n\nSample Input 4\n\n10 90\n\nSample Output 4\n\nNO", "sample_input": "3 2\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03129", "source_text": "Score : 100 points\n\nProblem Statement\n\nDetermine if we can choose K different integers between 1 and N (inclusive) so that no two of them differ by 1.\n\nConstraints\n\n1\\leq N,K\\leq 100\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\nIf we can choose K integers as above, print YES; otherwise, print NO.\n\nSample Input 1\n\n3 2\n\nSample Output 1\n\nYES\n\nWe can choose 1 and 3.\n\nSample Input 2\n\n5 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n31 10\n\nSample Output 3\n\nYES\n\nSample Input 4\n\n10 90\n\nSample Output 4\n\nNO", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 272, "cpu_time_ms": 1139, "memory_kb": 196724}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s355290059", "group_id": "codeNet:p03130", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\td = zeros(Int,4)\n\tfor i in 1:3\n\t\ta,b = readline() |> split |> parseMap\n\t\td[a]+=1\n\t\td[b]+=1\n\tend\n\tprintln(maximum(d)==2?\"YES\":\"NO\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584962975, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s355290059.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s355290059", "user_id": "u095714878"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\td = zeros(Int,4)\n\tfor i in 1:3\n\t\ta,b = readline() |> split |> parseMap\n\t\td[a]+=1\n\t\td[b]+=1\n\tend\n\tprintln(maximum(d)==2?\"YES\":\"NO\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 346, "memory_kb": 110208}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s283895883", "group_id": "codeNet:p03132", "input_text": "import Base.readline\nfunction readline(T)\n map(x->parse(T, x), split(readline()))\nend\n\nL = readline(Int)[1]\nA = map(_->readline(Int)[1], 1:L)\n\nstarted = 0\nnotstarted = 0\n\nfor a in A\n notstarted, started = notstarted + a, min(started + mod(a + 1, 2), notstarted)\nend\n\nprintln(min(notstarted, started))", "language": "Julia", "metadata": {"date": 1550536866, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03132.html", "problem_id": "p03132", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03132/input.txt", "sample_output_relpath": "derived/input_output/data/p03132/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03132/Julia/s283895883.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s283895883", "user_id": "u419818973"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "import Base.readline\nfunction readline(T)\n map(x->parse(T, x), split(readline()))\nend\n\nL = readline(Int)[1]\nA = map(_->readline(Int)[1], 1:L)\n\nstarted = 0\nnotstarted = 0\n\nfor a in A\n notstarted, started = notstarted + a, min(started + mod(a + 1, 2), notstarted)\nend\n\nprintln(min(notstarted, started))", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSnuke stands on a number line. He has L ears, and he will walk along the line continuously under the following conditions:\n\nHe never visits a point with coordinate less than 0, or a point with coordinate greater than L.\n\nHe starts walking at a point with integer coordinate, and also finishes walking at a point with integer coordinate.\n\nHe only changes direction at a point with integer coordinate.\n\nEach time when Snuke passes a point with coordinate i-0.5, where i is an integer, he put a stone in his i-th ear.\n\nAfter Snuke finishes walking, Ringo will repeat the following operations in some order so that, for each i, Snuke's i-th ear contains A_i stones:\n\nPut a stone in one of Snuke's ears.\n\nRemove a stone from one of Snuke's ears.\n\nFind the minimum number of operations required when Ringo can freely decide how Snuke walks.\n\nConstraints\n\n1 \\leq L \\leq 2\\times 10^5\n\n0 \\leq A_i \\leq 10^9(1\\leq i\\leq L)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\nA_1\n:\nA_L\n\nOutput\n\nPrint the minimum number of operations required when Ringo can freely decide how Snuke walks.\n\nSample Input 1\n\n4\n1\n0\n2\n3\n\nSample Output 1\n\n1\n\nAssume that Snuke walks as follows:\n\nHe starts walking at coordinate 3 and finishes walking at coordinate 4, visiting coordinates 3,4,3,2,3,4 in this order.\n\nThen, Snuke's four ears will contain 0,0,2,3 stones, respectively.\nRingo can satisfy the requirement by putting one stone in the first ear.\n\nSample Input 2\n\n8\n2\n0\n0\n2\n1\n3\n4\n1\n\nSample Output 2\n\n3\n\nSample Input 3\n\n7\n314159265\n358979323\n846264338\n327950288\n419716939\n937510582\n0\n\nSample Output 3\n\n1", "sample_input": "4\n1\n0\n2\n3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03132", "source_text": "Score : 600 points\n\nProblem Statement\n\nSnuke stands on a number line. He has L ears, and he will walk along the line continuously under the following conditions:\n\nHe never visits a point with coordinate less than 0, or a point with coordinate greater than L.\n\nHe starts walking at a point with integer coordinate, and also finishes walking at a point with integer coordinate.\n\nHe only changes direction at a point with integer coordinate.\n\nEach time when Snuke passes a point with coordinate i-0.5, where i is an integer, he put a stone in his i-th ear.\n\nAfter Snuke finishes walking, Ringo will repeat the following operations in some order so that, for each i, Snuke's i-th ear contains A_i stones:\n\nPut a stone in one of Snuke's ears.\n\nRemove a stone from one of Snuke's ears.\n\nFind the minimum number of operations required when Ringo can freely decide how Snuke walks.\n\nConstraints\n\n1 \\leq L \\leq 2\\times 10^5\n\n0 \\leq A_i \\leq 10^9(1\\leq i\\leq L)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\nA_1\n:\nA_L\n\nOutput\n\nPrint the minimum number of operations required when Ringo can freely decide how Snuke walks.\n\nSample Input 1\n\n4\n1\n0\n2\n3\n\nSample Output 1\n\n1\n\nAssume that Snuke walks as follows:\n\nHe starts walking at coordinate 3 and finishes walking at coordinate 4, visiting coordinates 3,4,3,2,3,4 in this order.\n\nThen, Snuke's four ears will contain 0,0,2,3 stones, respectively.\nRingo can satisfy the requirement by putting one stone in the first ear.\n\nSample Input 2\n\n8\n2\n0\n0\n2\n1\n3\n4\n1\n\nSample Output 2\n\n3\n\nSample Input 3\n\n7\n314159265\n358979323\n846264338\n327950288\n419716939\n937510582\n0\n\nSample Output 3\n\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 306, "cpu_time_ms": 2116, "memory_kb": 153604}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s593668153", "group_id": "codeNet:p03133", "input_text": "function reader(pos::Int)\n global membuff\n val = 0\n sign = 1\n @inbounds r = membuff[pos]\n pos += 1\n while r < 0x30 || 0x39 < r\n sign = r == '-' ? -1 : sign\n @inbounds r = membuff[pos]\n pos += 1\n end\n while 0x30 <= r <= 0x39\n val = val * 10 + r - 0x30 \n @inbounds r = membuff[pos]\n pos += 1\n end\n return val*sign, pos\nend\n\nconst io = VERSION > v\"1.0\" ? stdin : STDIN\nconst membuff = read(io,1145141919)\n\n#using LinearAlgebra: rank\nfunction main()\n pos = 1\n N, pos = reader(pos)\n M, pos = reader(pos)\n a = zeros(Int,(M,N))\n for i=1:N, j=1:M\n @inbounds a[j,i], pos = reader(pos)\n end\n r = rank(a)\n mod = 998244353\n ans = powermod(2, N+M-1, mod) - powermod(2, N+M-r-1, mod)\n println( ans < 0 ? ans + mod : ans )\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1549944488, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03133.html", "problem_id": "p03133", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03133/input.txt", "sample_output_relpath": "derived/input_output/data/p03133/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03133/Julia/s593668153.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s593668153", "user_id": "u743272507"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "function reader(pos::Int)\n global membuff\n val = 0\n sign = 1\n @inbounds r = membuff[pos]\n pos += 1\n while r < 0x30 || 0x39 < r\n sign = r == '-' ? -1 : sign\n @inbounds r = membuff[pos]\n pos += 1\n end\n while 0x30 <= r <= 0x39\n val = val * 10 + r - 0x30 \n @inbounds r = membuff[pos]\n pos += 1\n end\n return val*sign, pos\nend\n\nconst io = VERSION > v\"1.0\" ? stdin : STDIN\nconst membuff = read(io,1145141919)\n\n#using LinearAlgebra: rank\nfunction main()\n pos = 1\n N, pos = reader(pos)\n M, pos = reader(pos)\n a = zeros(Int,(M,N))\n for i=1:N, j=1:M\n @inbounds a[j,i], pos = reader(pos)\n end\n r = rank(a)\n mod = 998244353\n ans = powermod(2, N+M-1, mod) - powermod(2, N+M-r-1, mod)\n println( ans < 0 ? ans + mod : ans )\nend\n\nmain()", "problem_context": "Score : 800 points\n\nProblem Statement\n\nThere is a square grid with N rows and M columns.\nEach square contains an integer: 0 or 1. The square at the i-th row from the top and the j-th column from the left contains a_{ij}.\n\nAmong the 2^{N+M} possible pairs of a subset A of the rows and a subset B of the columns, find the number of the pairs that satisfy the following condition, modulo 998244353:\n\nThe sum of the |A||B| numbers contained in the intersection of the rows belonging to A and the columns belonging to B, is odd.\n\nConstraints\n\n1 \\leq N,M \\leq 300\n\n0 \\leq a_{i,j} \\leq 1(1\\leq i\\leq N,1\\leq j\\leq M)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_{11} ... a_{1M}\n:\na_{N1} ... a_{NM}\n\nOutput\n\nPrint the number of the pairs of a subset of the rows and a subset of the columns that satisfy the condition, modulo 998244353.\n\nSample Input 1\n\n2 2\n0 1\n1 0\n\nSample Output 1\n\n6\n\nFor example, if A consists of the first row and B consists of both columns, the sum of the numbers contained in the intersection is 0+1=1.\n\nSample Input 2\n\n2 3\n0 0 0\n0 1 0\n\nSample Output 2\n\n8", "sample_input": "2 2\n0 1\n1 0\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03133", "source_text": "Score : 800 points\n\nProblem Statement\n\nThere is a square grid with N rows and M columns.\nEach square contains an integer: 0 or 1. The square at the i-th row from the top and the j-th column from the left contains a_{ij}.\n\nAmong the 2^{N+M} possible pairs of a subset A of the rows and a subset B of the columns, find the number of the pairs that satisfy the following condition, modulo 998244353:\n\nThe sum of the |A||B| numbers contained in the intersection of the rows belonging to A and the columns belonging to B, is odd.\n\nConstraints\n\n1 \\leq N,M \\leq 300\n\n0 \\leq a_{i,j} \\leq 1(1\\leq i\\leq N,1\\leq j\\leq M)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\na_{11} ... a_{1M}\n:\na_{N1} ... a_{NM}\n\nOutput\n\nPrint the number of the pairs of a subset of the rows and a subset of the columns that satisfy the condition, modulo 998244353.\n\nSample Input 1\n\n2 2\n0 1\n1 0\n\nSample Output 1\n\n6\n\nFor example, if A consists of the first row and B consists of both columns, the sum of the numbers contained in the intersection is 0+1=1.\n\nSample Input 2\n\n2 3\n0 0 0\n0 1 0\n\nSample Output 2\n\n8", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 828, "cpu_time_ms": 1023, "memory_kb": 177472}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s513741791", "group_id": "codeNet:p03136", "input_text": "function f()\n n = parse(Int, readline())\n l = map(x->parse(Int, x), split(chomp(readline()), \" \"))\n l_max = findmax(l)[1]\n l[findmax(l)[2]] = 0\n l_sum = sum(l)\n if l_max < l_sum\n print(\"Yes\")\n else\n print(\"No\")\n end\nend\nf()", "language": "Julia", "metadata": {"date": 1549246420, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03136.html", "problem_id": "p03136", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03136/input.txt", "sample_output_relpath": "derived/input_output/data/p03136/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03136/Julia/s513741791.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s513741791", "user_id": "u444677772"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function f()\n n = parse(Int, readline())\n l = map(x->parse(Int, x), split(chomp(readline()), \" \"))\n l_max = findmax(l)[1]\n l[findmax(l)[2]] = 0\n l_sum = sum(l)\n if l_max < l_sum\n print(\"Yes\")\n else\n print(\"No\")\n end\nend\nf()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.\n\nYou can use the following theorem:\n\nTheorem: an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10\n\n1 \\leq L_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nOutput\n\nIf an N-sided polygon satisfying the condition can be drawn, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\n3 8 5 1\n\nSample Output 1\n\nYes\n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can be drawn on a plane.\n\nSample Input 2\n\n4\n3 8 4 1\n\nSample Output 2\n\nNo\n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon cannot be drawn on a plane.\n\nSample Input 3\n\n10\n1 8 10 5 8 12 34 100 11 3\n\nSample Output 3\n\nNo", "sample_input": "4\n3 8 5 1\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03136", "source_text": "Score : 200 points\n\nProblem Statement\n\nDetermine if an N-sided polygon (not necessarily convex) with sides of length L_1, L_2, ..., L_N can be drawn in a two-dimensional plane.\n\nYou can use the following theorem:\n\nTheorem: an N-sided polygon satisfying the condition can be drawn if and only if the longest side is strictly shorter than the sum of the lengths of the other N-1 sides.\n\nConstraints\n\nAll values in input are integers.\n\n3 \\leq N \\leq 10\n\n1 \\leq L_i \\leq 100\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_N\n\nOutput\n\nIf an N-sided polygon satisfying the condition can be drawn, print Yes; otherwise, print No.\n\nSample Input 1\n\n4\n3 8 5 1\n\nSample Output 1\n\nYes\n\nSince 8 < 9 = 3 + 5 + 1, it follows from the theorem that such a polygon can be drawn on a plane.\n\nSample Input 2\n\n4\n3 8 4 1\n\nSample Output 2\n\nNo\n\nSince 8 \\geq 8 = 3 + 4 + 1, it follows from the theorem that such a polygon cannot be drawn on a plane.\n\nSample Input 3\n\n10\n1 8 10 5 8 12 34 100 11 3\n\nSample Output 3\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 261, "cpu_time_ms": 840, "memory_kb": 173020}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s698750623", "group_id": "codeNet:p03137", "input_text": "N,M=map(x->parse(Int,x),split(readline()))\nX=sort(map(x->parse(Int,x),split(readline())))\nL=Array{Int}(0)\nfor i=2:M\n\tpush!(L,X[i]-X[i-1])\nend\nsort!(L)\nans=X[end]-X[1]\nfor i=1:N-1\n\tif i<=length(L)\n\t\tans-=L[end-i+1]\n\tend\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1561289111, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s698750623.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s698750623", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "N,M=map(x->parse(Int,x),split(readline()))\nX=sort(map(x->parse(Int,x),split(readline())))\nL=Array{Int}(0)\nfor i=2:M\n\tpush!(L,X[i]-X[i-1])\nend\nsort!(L)\nans=X[end]-X[1]\nfor i=1:N-1\n\tif i<=length(L)\n\t\tans-=L[end-i+1]\n\tend\nend\nprintln(ans)\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 556, "memory_kb": 146816}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s479771330", "group_id": "codeNet:p03142", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction tsort(e::Array{Int,2},n,m)\n\tg = [Int[] for i in 1:n]\n\td = zeros(Int,n)\n\tv = zeros(Int,n)\n\tfor i in 1:m\n\t\tpush!(g[e[1,i]],e[2,i])\n\t\td[e[2,i]] += 1\n\tend\n\ts = Int[]\n\tfor i in 1:n\n\t\tif d[i] == 0\n\t\t\tpush!(s,i)\n\t\tend\n\tend\n\tl = Int[]\n\twhile !isempty(s)\n\t\tt = pop!(s)\n\t\tpush!(l,t)\n\t\tfor i in 1:length(g[t])\n\t\t\td[g[t][i]] -= 1\n\t\t\tif d[g[t][i]] == 0\n\t\t\t\tpush!(s,g[t][i])\n\t\t\tend\n\t\tend\n\tend\n\tif length(l) == n\n\t\tl\n\telse\n\t\tfalse\n\tend\nend\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\te = zeros(Int,2,n-1+m)\n\tg = [Int[] for i in 1:n]\n\tfor i in 1:n-1+m\n\t\te[:,i] = readline() |> split |> parseMap\n\t\tpush!(g[e[2,i]],e[1,i])\n\tend\n\tts = tsort(e,n,n+m-1)\n\tnm = zeros(Int,n)\n\tfor i in 1:n\n\t\tnm[ts[i]] = i\n\tend\n\tt = zeros(Int,n)\n\tfor i in n:-1:1\n\t\tmx = 0\n\t\tmi = 0\n\t\tfor j in g[ts[i]]\n\t\t\tif nm[j]>mx\n\t\t\t\tmx = nm[j]\n\t\t\t\tmi = j\n\t\t\tend\n\t\tend\n\t\tt[ts[i]]=mi\n\tend\n\tfor i in 1:n\n\t\tprintln(t[i])\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1585567239, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03142.html", "problem_id": "p03142", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03142/input.txt", "sample_output_relpath": "derived/input_output/data/p03142/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03142/Julia/s479771330.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s479771330", "user_id": "u095714878"}, "prompt_components": {"gold_output": "0\n1\n2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction tsort(e::Array{Int,2},n,m)\n\tg = [Int[] for i in 1:n]\n\td = zeros(Int,n)\n\tv = zeros(Int,n)\n\tfor i in 1:m\n\t\tpush!(g[e[1,i]],e[2,i])\n\t\td[e[2,i]] += 1\n\tend\n\ts = Int[]\n\tfor i in 1:n\n\t\tif d[i] == 0\n\t\t\tpush!(s,i)\n\t\tend\n\tend\n\tl = Int[]\n\twhile !isempty(s)\n\t\tt = pop!(s)\n\t\tpush!(l,t)\n\t\tfor i in 1:length(g[t])\n\t\t\td[g[t][i]] -= 1\n\t\t\tif d[g[t][i]] == 0\n\t\t\t\tpush!(s,g[t][i])\n\t\t\tend\n\t\tend\n\tend\n\tif length(l) == n\n\t\tl\n\telse\n\t\tfalse\n\tend\nend\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\te = zeros(Int,2,n-1+m)\n\tg = [Int[] for i in 1:n]\n\tfor i in 1:n-1+m\n\t\te[:,i] = readline() |> split |> parseMap\n\t\tpush!(g[e[2,i]],e[1,i])\n\tend\n\tts = tsort(e,n,n+m-1)\n\tnm = zeros(Int,n)\n\tfor i in 1:n\n\t\tnm[ts[i]] = i\n\tend\n\tt = zeros(Int,n)\n\tfor i in n:-1:1\n\t\tmx = 0\n\t\tmi = 0\n\t\tfor j in g[ts[i]]\n\t\t\tif nm[j]>mx\n\t\t\t\tmx = nm[j]\n\t\t\t\tmi = j\n\t\t\tend\n\t\tend\n\t\tt[ts[i]]=mi\n\tend\n\tfor i in 1:n\n\t\tprintln(t[i])\n\tend\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a rooted tree (see Notes) with N vertices numbered 1 to N.\nEach of the vertices, except the root, has a directed edge coming from its parent.\nNote that the root may not be Vertex 1.\n\nTakahashi has added M new directed edges to this graph.\nEach of these M edges, u \\rightarrow v, extends from some vertex u to its descendant v.\n\nYou are given the directed graph with N vertices and N-1+M edges after Takahashi added edges.\nMore specifically, you are given N-1+M pairs of integers, (A_1, B_1), ..., (A_{N-1+M}, B_{N-1+M}), which represent that the i-th edge extends from Vertex A_i to Vertex B_i.\n\nRestore the original rooted tree.\n\nNotes\n\nFor \"tree\" and other related terms in graph theory, see the article in Wikipedia, for example.\n\nConstraints\n\n3 \\leq N\n\n1 \\leq M\n\nN + M \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\nIf i \\neq j, (A_i, B_i) \\neq (A_j, B_j).\n\nThe graph in input can be obtained by adding M edges satisfying the condition in the problem statement to a rooted tree with N vertices.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_{N-1+M} B_{N-1+M}\n\nOutput\n\nPrint N lines.\nIn the i-th line, print 0 if Vertex i is the root of the original tree, and otherwise print the integer representing the parent of Vertex i in the original tree.\n\nNote that it can be shown that the original tree is uniquely determined.\n\nSample Input 1\n\n3 1\n1 2\n1 3\n2 3\n\nSample Output 1\n\n0\n1\n2\n\nThe graph in this input is shown below:\n\nIt can be seen that this graph is obtained by adding the edge 1 \\rightarrow 3 to the rooted tree 1 \\rightarrow 2 \\rightarrow 3.\n\nSample Input 2\n\n6 3\n2 1\n2 3\n4 1\n4 2\n6 1\n2 6\n4 6\n6 5\n\nSample Output 2\n\n6\n4\n2\n0\n6\n2", "sample_input": "3 1\n1 2\n1 3\n2 3\n"}, "reference_outputs": ["0\n1\n2\n"], "source_document_id": "p03142", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a rooted tree (see Notes) with N vertices numbered 1 to N.\nEach of the vertices, except the root, has a directed edge coming from its parent.\nNote that the root may not be Vertex 1.\n\nTakahashi has added M new directed edges to this graph.\nEach of these M edges, u \\rightarrow v, extends from some vertex u to its descendant v.\n\nYou are given the directed graph with N vertices and N-1+M edges after Takahashi added edges.\nMore specifically, you are given N-1+M pairs of integers, (A_1, B_1), ..., (A_{N-1+M}, B_{N-1+M}), which represent that the i-th edge extends from Vertex A_i to Vertex B_i.\n\nRestore the original rooted tree.\n\nNotes\n\nFor \"tree\" and other related terms in graph theory, see the article in Wikipedia, for example.\n\nConstraints\n\n3 \\leq N\n\n1 \\leq M\n\nN + M \\leq 10^5\n\n1 \\leq A_i, B_i \\leq N\n\nA_i \\neq B_i\n\nIf i \\neq j, (A_i, B_i) \\neq (A_j, B_j).\n\nThe graph in input can be obtained by adding M edges satisfying the condition in the problem statement to a rooted tree with N vertices.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 B_1\n:\nA_{N-1+M} B_{N-1+M}\n\nOutput\n\nPrint N lines.\nIn the i-th line, print 0 if Vertex i is the root of the original tree, and otherwise print the integer representing the parent of Vertex i in the original tree.\n\nNote that it can be shown that the original tree is uniquely determined.\n\nSample Input 1\n\n3 1\n1 2\n1 3\n2 3\n\nSample Output 1\n\n0\n1\n2\n\nThe graph in this input is shown below:\n\nIt can be seen that this graph is obtained by adding the edge 1 \\rightarrow 3 to the rooted tree 1 \\rightarrow 2 \\rightarrow 3.\n\nSample Input 2\n\n6 3\n2 1\n2 3\n4 1\n4 2\n6 1\n2 6\n4 6\n6 5\n\nSample Output 2\n\n6\n4\n2\n0\n6\n2", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 988, "cpu_time_ms": 1000, "memory_kb": 171668}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s872293266", "group_id": "codeNet:p03145", "input_text": "c,a,b=parse.(split(readline()))\nprint(div(c*a,2))", "language": "Julia", "metadata": {"date": 1589590989, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03145.html", "problem_id": "p03145", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03145/input.txt", "sample_output_relpath": "derived/input_output/data/p03145/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03145/Julia/s872293266.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s872293266", "user_id": "u443151804"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "c,a,b=parse.(split(readline()))\nprint(div(c*a,2))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a right triangle ABC with ∠ABC=90°.\n\nGiven the lengths of the three sides, |AB|,|BC| and |CA|, find the area of the right triangle ABC.\n\nIt is guaranteed that the area of the triangle ABC is an integer.\n\nConstraints\n\n1 \\leq |AB|,|BC|,|CA| \\leq 100\n\nAll values in input are integers.\n\nThe area of the triangle ABC is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\n|AB| |BC| |CA|\n\nOutput\n\nPrint the area of the triangle ABC.\n\nSample Input 1\n\n3 4 5\n\nSample Output 1\n\n6\n\nThis triangle has an area of 6.\n\nSample Input 2\n\n5 12 13\n\nSample Output 2\n\n30\n\nThis triangle has an area of 30.\n\nSample Input 3\n\n45 28 53\n\nSample Output 3\n\n630\n\nThis triangle has an area of 630.", "sample_input": "3 4 5\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03145", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a right triangle ABC with ∠ABC=90°.\n\nGiven the lengths of the three sides, |AB|,|BC| and |CA|, find the area of the right triangle ABC.\n\nIt is guaranteed that the area of the triangle ABC is an integer.\n\nConstraints\n\n1 \\leq |AB|,|BC|,|CA| \\leq 100\n\nAll values in input are integers.\n\nThe area of the triangle ABC is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\n|AB| |BC| |CA|\n\nOutput\n\nPrint the area of the triangle ABC.\n\nSample Input 1\n\n3 4 5\n\nSample Output 1\n\n6\n\nThis triangle has an area of 6.\n\nSample Input 2\n\n5 12 13\n\nSample Output 2\n\n30\n\nThis triangle has an area of 30.\n\nSample Input 3\n\n45 28 53\n\nSample Output 3\n\n630\n\nThis triangle has an area of 630.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 49, "cpu_time_ms": 1089, "memory_kb": 173592}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s870503893", "group_id": "codeNet:p03145", "input_text": "parseInt(x) = parse(Int, x)\nparseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n a,b,c=parseMap(split(readline()))\n println(div(a*b,2))\nend\nmain()", "language": "Julia", "metadata": {"date": 1583207347, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03145.html", "problem_id": "p03145", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03145/input.txt", "sample_output_relpath": "derived/input_output/data/p03145/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03145/Julia/s870503893.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s870503893", "user_id": "u619197965"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n a,b,c=parseMap(split(readline()))\n println(div(a*b,2))\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a right triangle ABC with ∠ABC=90°.\n\nGiven the lengths of the three sides, |AB|,|BC| and |CA|, find the area of the right triangle ABC.\n\nIt is guaranteed that the area of the triangle ABC is an integer.\n\nConstraints\n\n1 \\leq |AB|,|BC|,|CA| \\leq 100\n\nAll values in input are integers.\n\nThe area of the triangle ABC is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\n|AB| |BC| |CA|\n\nOutput\n\nPrint the area of the triangle ABC.\n\nSample Input 1\n\n3 4 5\n\nSample Output 1\n\n6\n\nThis triangle has an area of 6.\n\nSample Input 2\n\n5 12 13\n\nSample Output 2\n\n30\n\nThis triangle has an area of 30.\n\nSample Input 3\n\n45 28 53\n\nSample Output 3\n\n630\n\nThis triangle has an area of 630.", "sample_input": "3 4 5\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03145", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a right triangle ABC with ∠ABC=90°.\n\nGiven the lengths of the three sides, |AB|,|BC| and |CA|, find the area of the right triangle ABC.\n\nIt is guaranteed that the area of the triangle ABC is an integer.\n\nConstraints\n\n1 \\leq |AB|,|BC|,|CA| \\leq 100\n\nAll values in input are integers.\n\nThe area of the triangle ABC is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\n|AB| |BC| |CA|\n\nOutput\n\nPrint the area of the triangle ABC.\n\nSample Input 1\n\n3 4 5\n\nSample Output 1\n\n6\n\nThis triangle has an area of 6.\n\nSample Input 2\n\n5 12 13\n\nSample Output 2\n\n30\n\nThis triangle has an area of 30.\n\nSample Input 3\n\n45 28 53\n\nSample Output 3\n\n630\n\nThis triangle has an area of 630.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 339, "memory_kb": 109716}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s743208504", "group_id": "codeNet:p03146", "input_text": "parseInt(x) = parse(Int, x)\nparseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n s=parseInt(readline())\n arr=Vector{Int}([s])\n res=s\n ans=1\n while true\n if res%2==0\n res=div(res,2)\n else\n res=3*res+1\n end\n ans+=1\n for i in 1:length(arr)\n if res==arr[i]\n println(ans)\n exit(0)\n end\n end\n push!(arr,res)\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1583208331, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03146.html", "problem_id": "p03146", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03146/input.txt", "sample_output_relpath": "derived/input_output/data/p03146/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03146/Julia/s743208504.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s743208504", "user_id": "u619197965"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseFloat(x) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n s=parseInt(readline())\n arr=Vector{Int}([s])\n res=s\n ans=1\n while true\n if res%2==0\n res=div(res,2)\n else\n res=3*res+1\n end\n ans+=1\n for i in 1:length(arr)\n if res==arr[i]\n println(ans)\n exit(0)\n end\n end\n push!(arr,res)\n end\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nA sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows:\n\nThe first term s is given as input.\n\nLet f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.\n\na_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.\n\nFind the minimum integer m that satisfies the following condition:\n\nThere exists an integer n such that a_m = a_n (m > n).\n\nConstraints\n\n1 \\leq s \\leq 100\n\nAll values in input are integers.\n\nIt is guaranteed that all elements in a and the minimum m that satisfies the condition are at most 1000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum integer m that satisfies the condition.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n5\n\na=\\{8,4,2,1,4,2,1,4,2,1,......\\}. As a_5=a_2, the answer is 5.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n18\n\na=\\{7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,4,2,1,......\\}.\n\nSample Input 3\n\n54\n\nSample Output 3\n\n114", "sample_input": "8\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03146", "source_text": "Score : 200 points\n\nProblem Statement\n\nA sequence a=\\{a_1,a_2,a_3,......\\} is determined as follows:\n\nThe first term s is given as input.\n\nLet f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.\n\na_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.\n\nFind the minimum integer m that satisfies the following condition:\n\nThere exists an integer n such that a_m = a_n (m > n).\n\nConstraints\n\n1 \\leq s \\leq 100\n\nAll values in input are integers.\n\nIt is guaranteed that all elements in a and the minimum m that satisfies the condition are at most 1000000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint the minimum integer m that satisfies the condition.\n\nSample Input 1\n\n8\n\nSample Output 1\n\n5\n\na=\\{8,4,2,1,4,2,1,4,2,1,......\\}. As a_5=a_2, the answer is 5.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n18\n\na=\\{7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,4,2,1,......\\}.\n\nSample Input 3\n\n54\n\nSample Output 3\n\n114", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 515, "cpu_time_ms": 750, "memory_kb": 165364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s103740404", "group_id": "codeNet:p03147", "input_text": "function main()\n \n N = parse(Int,readline())\n h = map(x -> parse(Int,x), split(readline()))\n \n ans = 0\n check = 1\n save = 0\n \n for i in 1:N\n if N == 1\n ans = h[1]\n elseif i < N && h[i] > h[i+1]\n ans += h[i] - save\n if h[i+1] - save <= 0\n save = 0\n else\n save = h[i+1]\n end\n elseif i == N && h[i-1] < h[i]\n ans += h[i] - save\n end\n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1583445435, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s103740404.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s103740404", "user_id": "u790457721"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n \n N = parse(Int,readline())\n h = map(x -> parse(Int,x), split(readline()))\n \n ans = 0\n check = 1\n save = 0\n \n for i in 1:N\n if N == 1\n ans = h[1]\n elseif i < N && h[i] > h[i+1]\n ans += h[i] - save\n if h[i+1] - save <= 0\n save = 0\n else\n save = h[i+1]\n end\n elseif i == N && h[i-1] < h[i]\n ans += h[i] - save\n end\n end\n \n println(ans)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 389, "memory_kb": 110656}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s067847844", "group_id": "codeNet:p03147", "input_text": "readline()\nans=0\npre=0\nfor h=map(x->parse(Int,x),split(readline()))\n\tans+=max(h-pre,0)\n\tpre=h\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1561269079, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s067847844.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s067847844", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "readline()\nans=0\npre=0\nfor h=map(x->parse(Int,x),split(readline()))\n\tans+=max(h-pre,0)\n\tpre=h\nend\nprintln(ans)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 375, "memory_kb": 112396}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s527039158", "group_id": "codeNet:p03148", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\npointSum(pointD, typeNum) = pointD + (typeNum * typeNum)\n\nfunction main()\n n, k = readline() |> split |> parseMap\n sushi = zeros(Int, n, 2)\n for i in 1:n\n sushi[i,2], sushi[i,1] = readline() |> split |> parseMap\n # 種類が後の方が都合がよいので\n end\n sushi = sortslices(sushi, dims=1, rev=true)\n\n pointD = 0\n typeNum = 0\n types = zeros(Int, n)\n for i in 1:k\n pointD += sushi[i, 1]\n types[sushi[i, 2]] += 1\n if types[sushi[i, 2]] == 1\n typeNum += 1\n end\n end\n\n ans = pointSum(pointD, typeNum)\n\n iRemove = k\n iAdd = k + 1\n\n while typeNum < k\n while iRemove > 1\n if types[sushi[iRemove, 2]] > 1\n pointD -= sushi[iRemove, 1]\n types[sushi[iRemove, 2]] -= 1\n break\n end\n iRemove -= 1\n end\n if iRemove == 1 break end\n iRemove -= 1\n\n while iAdd <= n\n if types[sushi[iAdd, 2]] == 0\n pointD += sushi[iAdd, 1]\n types[sushi[iAdd, 2]] += 1\n typeNum += 1\n break\n end\n iAdd += 1\n end\n if iAdd > n break end\n iAdd += 1\n\n ans = max(ans, pointSum(pointD, typeNum))\n end\n println(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1558025433, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s527039158.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s527039158", "user_id": "u712822150"}, "prompt_components": {"gold_output": "26\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\npointSum(pointD, typeNum) = pointD + (typeNum * typeNum)\n\nfunction main()\n n, k = readline() |> split |> parseMap\n sushi = zeros(Int, n, 2)\n for i in 1:n\n sushi[i,2], sushi[i,1] = readline() |> split |> parseMap\n # 種類が後の方が都合がよいので\n end\n sushi = sortslices(sushi, dims=1, rev=true)\n\n pointD = 0\n typeNum = 0\n types = zeros(Int, n)\n for i in 1:k\n pointD += sushi[i, 1]\n types[sushi[i, 2]] += 1\n if types[sushi[i, 2]] == 1\n typeNum += 1\n end\n end\n\n ans = pointSum(pointD, typeNum)\n\n iRemove = k\n iAdd = k + 1\n\n while typeNum < k\n while iRemove > 1\n if types[sushi[iRemove, 2]] > 1\n pointD -= sushi[iRemove, 1]\n types[sushi[iRemove, 2]] -= 1\n break\n end\n iRemove -= 1\n end\n if iRemove == 1 break end\n iRemove -= 1\n\n while iAdd <= n\n if types[sushi[iAdd, 2]] == 0\n pointD += sushi[iAdd, 1]\n types[sushi[iAdd, 2]] += 1\n typeNum += 1\n break\n end\n iAdd += 1\n end\n if iAdd > n break end\n iAdd += 1\n\n ans = max(ans, pointSum(pointD, typeNum))\n end\n println(ans)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1408, "cpu_time_ms": 822, "memory_kb": 169096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s979528247", "group_id": "codeNet:p03148", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\ta = Array{Int}(3,n)\n\tfor i in 1:n\n\t\ta[1:2,i] = readline() |> split |> parseMap\n\t\ta[3,i] = 0\n\tend\n\ta = sortcols(a,by=x->x[2],rev=true)\n\tpt1 = sum(a[2,1:k])+length(Set(a[1,1:k]))^2\n\tpt2 = 0\n\tt = 0\n\tsp = Int[]\n\tfor i in 1:n\n\t\tif a[1,i] in sp || t >= k\n\t\telse\n\t\t\tpush!(sp,a[1,i])\n\t\t\tpt2 += a[2,i]\n\t\t\ta[3,i] = 1\n\t\t\tt += 1\n\t\tend\n\tend\n\tpt2 += t^2\n\tnow = 2\n\twhile t < k\n\t\tif a[3,now] == 0\n\t\t\tpt2 += a[2,now]\n\t\t\tt += 1\n\t\t\tnow += 1\n\t\tend\n\tend\n\tprintln(max(pt1,pt2))\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1548018603, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s979528247.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s979528247", "user_id": "u095714878"}, "prompt_components": {"gold_output": "26\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\ta = Array{Int}(3,n)\n\tfor i in 1:n\n\t\ta[1:2,i] = readline() |> split |> parseMap\n\t\ta[3,i] = 0\n\tend\n\ta = sortcols(a,by=x->x[2],rev=true)\n\tpt1 = sum(a[2,1:k])+length(Set(a[1,1:k]))^2\n\tpt2 = 0\n\tt = 0\n\tsp = Int[]\n\tfor i in 1:n\n\t\tif a[1,i] in sp || t >= k\n\t\telse\n\t\t\tpush!(sp,a[1,i])\n\t\t\tpt2 += a[2,i]\n\t\t\ta[3,i] = 1\n\t\t\tt += 1\n\t\tend\n\tend\n\tpt2 += t^2\n\tnow = 2\n\twhile t < k\n\t\tif a[3,now] == 0\n\t\t\tpt2 += a[2,now]\n\t\t\tt += 1\n\t\t\tnow += 1\n\t\tend\n\tend\n\tprintln(max(pt1,pt2))\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2113, "memory_kb": 163988}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s990539770", "group_id": "codeNet:p03149", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n if sort(split(readline()))==[\"1\",\"4\",\"7\",\"9\"]\n println(\"YES\")\n else\n println(\"NO\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1587506042, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s990539770.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s990539770", "user_id": "u619197965"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n if sort(split(readline()))==[\"1\",\"4\",\"7\",\"9\"]\n println(\"YES\")\n else\n println(\"NO\")\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 450, "memory_kb": 114128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s870638862", "group_id": "codeNet:p03149", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ta,b,c,d = readline() |> split |> parseMap\n\tf = zeros(Int,10)\n\tf[a+1]+=1\n\tf[b+1]+=1\n\tf[c+1]+=1\n\tf[d+1]+=1\n\tif f[2]==1&&f[10]==1&&f[8]==1&&f[5]==1\n\t\tprintln(\"YES\")\n\telse\n\t\tprintln(\"NO\")\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584210358, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s870638862.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s870638862", "user_id": "u095714878"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\ta,b,c,d = readline() |> split |> parseMap\n\tf = zeros(Int,10)\n\tf[a+1]+=1\n\tf[b+1]+=1\n\tf[c+1]+=1\n\tf[d+1]+=1\n\tif f[2]==1&&f[10]==1&&f[8]==1&&f[5]==1\n\t\tprintln(\"YES\")\n\telse\n\t\tprintln(\"NO\")\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 821, "memory_kb": 167544}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s148140762", "group_id": "codeNet:p03149", "input_text": "A=sort(map(x->parse(Int,x),split(readline())))\nn=0\nfor a=A\n n=n*10+a\nend\nprintln(n==1479?\"YES\":\"NO\")", "language": "Julia", "metadata": {"date": 1568017195, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s148140762.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s148140762", "user_id": "u657913472"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "A=sort(map(x->parse(Int,x),split(readline())))\nn=0\nfor a=A\n n=n*10+a\nend\nprintln(n==1479?\"YES\":\"NO\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 408, "memory_kb": 110724}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s060290552", "group_id": "codeNet:p03155", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,h,w=[parseInt(readline()) for _ in 1:3]\n println((n-h+1)*(n-w+1))\nend\nmain()", "language": "Julia", "metadata": {"date": 1593181359, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p03155.html", "problem_id": "p03155", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03155/input.txt", "sample_output_relpath": "derived/input_output/data/p03155/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03155/Julia/s060290552.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s060290552", "user_id": "u619197965"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,h,w=[parseInt(readline()) for _ in 1:3]\n println((n-h+1)*(n-w+1))\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIt has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board.\n\nThe bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns.\n\nHow many ways are there to choose where to put the notice so that it completely covers exactly HW squares?\n\nConstraints\n\n1 \\leq H, W \\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\nH\nW\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n2\n3\n\nSample Output 1\n\n2\n\nThere are two ways to put the notice, as follows:\n\n### ...\n### ###\n... ###\n\nHere, # represents a square covered by the notice, and . represents a square not covered.\n\nSample Input 2\n\n100\n1\n1\n\nSample Output 2\n\n10000\n\nSample Input 3\n\n5\n4\n2\n\nSample Output 3\n\n8", "sample_input": "3\n2\n3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03155", "source_text": "Score : 100 points\n\nProblem Statement\n\nIt has been decided that a programming contest sponsored by company A will be held, so we will post the notice on a bulletin board.\n\nThe bulletin board is in the form of a grid with N rows and N columns, and the notice will occupy a rectangular region with H rows and W columns.\n\nHow many ways are there to choose where to put the notice so that it completely covers exactly HW squares?\n\nConstraints\n\n1 \\leq H, W \\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\nH\nW\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3\n2\n3\n\nSample Output 1\n\n2\n\nThere are two ways to put the notice, as follows:\n\n### ...\n### ###\n... ###\n\nHere, # represents a square covered by the notice, and . represents a square not covered.\n\nSample Input 2\n\n100\n1\n1\n\nSample Output 2\n\n10000\n\nSample Input 3\n\n5\n4\n2\n\nSample Output 3\n\n8", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 242, "memory_kb": 165468}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s130997398", "group_id": "codeNet:p03156", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a,b=parseMap(split(readline()))\n p=parseMap(split(readline()))\n cnt=zeros(Int,3)\n for i in p\n if i<=a\n cnt[1]+=1\n elseif i<=b\n cnt[2]+=1\n else\n cnt[3]+=1\n end\n end\n println(minimum(cnt))\nend\nmain()", "language": "Julia", "metadata": {"date": 1593181555, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p03156.html", "problem_id": "p03156", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03156/input.txt", "sample_output_relpath": "derived/input_output/data/p03156/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03156/Julia/s130997398.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s130997398", "user_id": "u619197965"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a,b=parseMap(split(readline()))\n p=parseMap(split(readline()))\n cnt=zeros(Int,3)\n for i in p\n if i<=a\n cnt[1]+=1\n elseif i<=b\n cnt[2]+=1\n else\n cnt[3]+=1\n end\n end\n println(minimum(cnt))\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou have written N problems to hold programming contests.\nThe i-th problem will have a score of P_i points if used in a contest.\n\nWith these problems, you would like to hold as many contests as possible under the following condition:\n\nA contest has three problems. The first problem has a score not greater than A points, the second has a score between A + 1 and B points (inclusive), and the third has a score not less than B + 1 points.\n\nThe same problem should not be used in multiple contests.\nAt most how many contests can be held?\n\nConstraints\n\n3 \\leq N \\leq 100\n\n1 \\leq P_i \\leq 20 (1 \\leq i \\leq N)\n\n1 \\leq A < B < 20\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA B\nP_1 P_2 ... P_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n5 15\n1 10 16 2 7 20 12\n\nSample Output 1\n\n2\n\nTwo contests can be held by putting the first, second, third problems and the fourth, fifth, sixth problems together.\n\nSample Input 2\n\n8\n3 8\n5 5 5 10 10 10 15 20\n\nSample Output 2\n\n0\n\nNo contest can be held, because there is no problem with a score of A = 3 or less.\n\nSample Input 3\n\n3\n5 6\n5 6 10\n\nSample Output 3\n\n1", "sample_input": "7\n5 15\n1 10 16 2 7 20 12\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03156", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou have written N problems to hold programming contests.\nThe i-th problem will have a score of P_i points if used in a contest.\n\nWith these problems, you would like to hold as many contests as possible under the following condition:\n\nA contest has three problems. The first problem has a score not greater than A points, the second has a score between A + 1 and B points (inclusive), and the third has a score not less than B + 1 points.\n\nThe same problem should not be used in multiple contests.\nAt most how many contests can be held?\n\nConstraints\n\n3 \\leq N \\leq 100\n\n1 \\leq P_i \\leq 20 (1 \\leq i \\leq N)\n\n1 \\leq A < B < 20\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nA B\nP_1 P_2 ... P_N\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n7\n5 15\n1 10 16 2 7 20 12\n\nSample Output 1\n\n2\n\nTwo contests can be held by putting the first, second, third problems and the fourth, fifth, sixth problems together.\n\nSample Input 2\n\n8\n3 8\n5 5 5 10 10 10 15 20\n\nSample Output 2\n\n0\n\nNo contest can be held, because there is no problem with a score of A = 3 or less.\n\nSample Input 3\n\n3\n5 6\n5 6 10\n\nSample Output 3\n\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 274, "memory_kb": 170256}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s943202668", "group_id": "codeNet:p03157", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction root(uf::Array{Int,1},x);s=x;while uf[s]>0;s=uf[s];end;s;end\nsame(uf::Array{Int,1},x,y)=root(uf,x)==root(uf,y)?true:false;\nfunction unite(uf::Array{Int,1},x,y);l=root(uf,x);r=root(uf,y);if l!=r;if uf[l] split |> parseMap\n\tg = String[\"\" for i in 1:h]\n\tc = zeros(Int,h*w)\n\tuf = -ones(Int,h*w)\n\tfor i in 1:h\n\t\tg[i] = readline() |> chomp\n\tend\n\tfor i in 1:h\n\t\tfor j in 1:w\n\t\t\tx = (i-1)*w+j\n\t\t\tif g[i][j]=='#'\n\t\t\t\tc[x] = 1\n\t\t\tend\n\t\t\tif i>1\n\t\t\t\tif c[(i-2)*w+j]!=c[x]\n\t\t\t\t\tunite(uf,(i-2)*w+j,x)\n\t\t\t\tend\n\t\t\tend\n\t\t\tif j>1\n\t\t\t\tif c[(i-1)*w+j-1]!=c[x]\n\t\t\t\t\tunite(uf,(i-1)*w+j-1,x)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tbd = Dict{Int,Int}()\n\twd = Dict{Int,Int}()\n\tfor i in 1:h*w\n\t\tr = root(uf,i)\n\t\tif c[i]==0\n\t\t\tif haskey(wd,r)\n\t\t\t\twd[r] += 1\n\t\t\telse\n\t\t\t\twd[r] = 1\n\t\t\tend\n\t\telse\n\t\t\tif haskey(bd,r)\n\t\t\t\tbd[r] += 1\n\t\t\telse\n\t\t\t\tbd[r] = 1\n\t\t\tend\n\t\tend\n\tend\n\tans = 0\n\tfor i in keys(bd)\n\t\tif haskey(wd,i)\n\t\t\tans += bd[i]*wd[i]\n\t\tend\n\tend\n\tprintln(ans)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1581269621, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03157.html", "problem_id": "p03157", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03157/input.txt", "sample_output_relpath": "derived/input_output/data/p03157/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03157/Julia/s943202668.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s943202668", "user_id": "u095714878"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction root(uf::Array{Int,1},x);s=x;while uf[s]>0;s=uf[s];end;s;end\nsame(uf::Array{Int,1},x,y)=root(uf,x)==root(uf,y)?true:false;\nfunction unite(uf::Array{Int,1},x,y);l=root(uf,x);r=root(uf,y);if l!=r;if uf[l] split |> parseMap\n\tg = String[\"\" for i in 1:h]\n\tc = zeros(Int,h*w)\n\tuf = -ones(Int,h*w)\n\tfor i in 1:h\n\t\tg[i] = readline() |> chomp\n\tend\n\tfor i in 1:h\n\t\tfor j in 1:w\n\t\t\tx = (i-1)*w+j\n\t\t\tif g[i][j]=='#'\n\t\t\t\tc[x] = 1\n\t\t\tend\n\t\t\tif i>1\n\t\t\t\tif c[(i-2)*w+j]!=c[x]\n\t\t\t\t\tunite(uf,(i-2)*w+j,x)\n\t\t\t\tend\n\t\t\tend\n\t\t\tif j>1\n\t\t\t\tif c[(i-1)*w+j-1]!=c[x]\n\t\t\t\t\tunite(uf,(i-1)*w+j-1,x)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tbd = Dict{Int,Int}()\n\twd = Dict{Int,Int}()\n\tfor i in 1:h*w\n\t\tr = root(uf,i)\n\t\tif c[i]==0\n\t\t\tif haskey(wd,r)\n\t\t\t\twd[r] += 1\n\t\t\telse\n\t\t\t\twd[r] = 1\n\t\t\tend\n\t\telse\n\t\t\tif haskey(bd,r)\n\t\t\t\tbd[r] += 1\n\t\t\telse\n\t\t\t\tbd[r] = 1\n\t\t\tend\n\t\tend\n\tend\n\tans = 0\n\tfor i in keys(bd)\n\t\tif haskey(wd,i)\n\t\t\tans += bd[i]*wd[i]\n\t\tend\n\tend\n\tprintln(ans)\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns, where each square is painted black or white.\n\nYou are given H strings S_1, S_2, ..., S_H, each of length W.\nIf the square at the i-th row from the top and the j-th column from the left is painted black, the j-th character in the string S_i is #; if that square is painted white, the j-th character in the string S_i is ..\n\nFind the number of pairs of a black square c_1 and a white square c_2 that satisfy the following condition:\n\nThere is a path from the square c_1 to the square c_2 where we repeatedly move to a vertically or horizontally adjacent square through an alternating sequence of black and white squares: black, white, black, white...\n\nConstraints\n\n1 \\leq H, W \\leq 400\n\n|S_i| = W (1 \\leq i \\leq H)\n\nFor each i (1 \\leq i \\leq H), the string S_i consists of characters # and ..\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\nS_2\n:\nS_H\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n.#.\n..#\n#..\n\nSample Output 1\n\n10\n\nSome of the pairs satisfying the condition are ((1, 2), (3, 3)) and ((3, 1), (3, 2)), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.\n\nSample Input 2\n\n2 4\n....\n....\n\nSample Output 2\n\n0\n\nSample Input 3\n\n4 3\n###\n###\n...\n###\n\nSample Output 3\n\n6", "sample_input": "3 3\n.#.\n..#\n#..\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03157", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns, where each square is painted black or white.\n\nYou are given H strings S_1, S_2, ..., S_H, each of length W.\nIf the square at the i-th row from the top and the j-th column from the left is painted black, the j-th character in the string S_i is #; if that square is painted white, the j-th character in the string S_i is ..\n\nFind the number of pairs of a black square c_1 and a white square c_2 that satisfy the following condition:\n\nThere is a path from the square c_1 to the square c_2 where we repeatedly move to a vertically or horizontally adjacent square through an alternating sequence of black and white squares: black, white, black, white...\n\nConstraints\n\n1 \\leq H, W \\leq 400\n\n|S_i| = W (1 \\leq i \\leq H)\n\nFor each i (1 \\leq i \\leq H), the string S_i consists of characters # and ..\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nS_1\nS_2\n:\nS_H\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n3 3\n.#.\n..#\n#..\n\nSample Output 1\n\n10\n\nSome of the pairs satisfying the condition are ((1, 2), (3, 3)) and ((3, 1), (3, 2)), where (i, j) denotes the square at the i-th row from the top and the j-th column from the left.\n\nSample Input 2\n\n2 4\n....\n....\n\nSample Output 2\n\n0\n\nSample Input 3\n\n4 3\n###\n###\n...\n###\n\nSample Output 3\n\n6", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1132, "cpu_time_ms": 913, "memory_kb": 173700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s066435759", "group_id": "codeNet:p03171", "input_text": "function solve5a1()\n ma=readlines()\n ma=map(x->chomp(x),ma)\n ma=map(split,ma)\n #ma=map(x->map(y->parse(Int,y),x),ma)\n ma=map(x->parse.(x),ma)\n n=ma[1][1]\n ar=ma[2]\n dp=zeros(Int,n,n)\n for i in 1:n\n dp[1,i]=ifelse(iseven(n),-ar[i],ar[i])\n end\n for i0 in 1:n-1,j in 1:n-i0\n i=i0+1\n if iseven(n-i0)\n # dp[i+1,j]=dp[i,j]-ar[i+j]\n dp[i,j]=min(dp[i-1,j]-ar[i0+j],dp[i-1,j+1]-ar[j])\n # end\n else\n # dp[i+1,j]=dp[i,j]\n dp[i,j]=max(dp[i-1,j]+ar[i0+j],dp[i-1,j+1]+ar[j])\n end\n end\n print(dp[n,1])\nend\nsolve5a1()\n", "language": "Julia", "metadata": {"date": 1586107857, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03171.html", "problem_id": "p03171", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03171/input.txt", "sample_output_relpath": "derived/input_output/data/p03171/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03171/Julia/s066435759.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s066435759", "user_id": "u494674330"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "function solve5a1()\n ma=readlines()\n ma=map(x->chomp(x),ma)\n ma=map(split,ma)\n #ma=map(x->map(y->parse(Int,y),x),ma)\n ma=map(x->parse.(x),ma)\n n=ma[1][1]\n ar=ma[2]\n dp=zeros(Int,n,n)\n for i in 1:n\n dp[1,i]=ifelse(iseven(n),-ar[i],ar[i])\n end\n for i0 in 1:n-1,j in 1:n-i0\n i=i0+1\n if iseven(n-i0)\n # dp[i+1,j]=dp[i,j]-ar[i+j]\n dp[i,j]=min(dp[i-1,j]-ar[i0+j],dp[i-1,j+1]-ar[j])\n # end\n else\n # dp[i+1,j]=dp[i,j]\n dp[i,j]=max(dp[i-1,j]+ar[i0+j],dp[i-1,j+1]+ar[j])\n end\n end\n print(dp[n,1])\nend\nsolve5a1()\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\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 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "sample_input": "4\n10 80 90 30\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03171", "source_text": "Score : 100 points\n\nProblem Statement\n\nTaro and Jiro will play the following game against each other.\n\nInitially, they are given a sequence a = (a_1, a_2, \\ldots, a_N).\nUntil a becomes empty, the two players perform the following operation alternately, starting from Taro:\n\nRemove the element at the beginning or the end of a. The player earns x points, where x is the removed element.\n\nLet X and Y be Taro's and Jiro's total score at the end of the game, respectively.\nTaro tries to maximize X - Y, while Jiro tries to minimize X - Y.\n\nAssuming that the two players play optimally, find the resulting value of X - Y.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 3000\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 \\ldots a_N\n\nOutput\n\nPrint the resulting value of X - Y, assuming that the two players play optimally.\n\nSample Input 1\n\n4\n10 80 90 30\n\nSample Output 1\n\n10\n\nThe game proceeds as follows when the two players play optimally (the element being removed is written bold):\n\nTaro: (10, 80, 90, 30) → (10, 80, 90)\n\nJiro: (10, 80, 90) → (10, 80)\n\nTaro: (10, 80) → (10)\n\nJiro: (10) → ()\n\nHere, X = 30 + 80 = 110 and Y = 90 + 10 = 100.\n\nSample Input 2\n\n3\n10 100 10\n\nSample Output 2\n\n-80\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (10, 100, 10) → (100, 10)\n\nJiro: (100, 10) → (10)\n\nTaro: (10) → ()\n\nHere, X = 10 + 10 = 20 and Y = 100.\n\nSample Input 3\n\n1\n10\n\nSample Output 3\n\n10\n\nSample Input 4\n\n10\n1000000000 1 1000000000 1 1000000000 1 1000000000 1 1000000000 1\n\nSample Output 4\n\n4999999995\n\nThe answer may not fit into a 32-bit integer type.\n\nSample Input 5\n\n6\n4 2 9 7 1 5\n\nSample Output 5\n\n2\n\nThe game proceeds, for example, as follows when the two players play optimally:\n\nTaro: (4, 2, 9, 7, 1, 5) → (4, 2, 9, 7, 1)\n\nJiro: (4, 2, 9, 7, 1) → (2, 9, 7, 1)\n\nTaro: (2, 9, 7, 1) → (2, 9, 7)\n\nJiro: (2, 9, 7) → (2, 9)\n\nTaro: (2, 9) → (2)\n\nJiro: (2) → ()\n\nHere, X = 5 + 1 + 9 = 15 and Y = 4 + 7 + 2 = 13.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2113, "memory_kb": 222232}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s480537074", "group_id": "codeNet:p03173", "input_text": "function solve()\n ma=readlines()\n ma=map(x->chomp(x),ma)\n ma=map(split,ma)\n ma=map(x->parse.(x),ma)\n n=ma[1][1]\n ar=ma[2]\n function fn(cum1)\n if length(cum1)==2 return 0\n else\n p=0\n min=10^10\n for i in 2:length(cum1)-1\n z=cum1[i+1]-cum1[i-1]\n if zchomp(x),ma)\n ma=map(split,ma)\n ma=map(x->parse.(x),ma)\n n=ma[1][1]\n ar=ma[2]\n function fn(cum1)\n if length(cum1)==2 return 0\n else\n p=0\n min=10^10\n for i in 2:length(cum1)-1\n z=cum1[i+1]-cum1[i-1]\n if z split |> parseMap\n\ts = 0\n\tfor i in 1:n\n\t\ta,b = readline() |> split |> parseMap\n\t\tif h<=a && w<=b\n\t\t\ts += 1\n\t\tend\n\tend\n\tprintln(s)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1561342181, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s364778130.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s364778130", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,h,w = readline() |> split |> parseMap\n\ts = 0\n\tfor i in 1:n\n\t\ta,b = readline() |> split |> parseMap\n\t\tif h<=a && w<=b\n\t\t\ts += 1\n\t\tend\n\tend\n\tprintln(s)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 842, "memory_kb": 168576}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s184457731", "group_id": "codeNet:p03194", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,p=parseMap(split(readline()))\n if n==1\n println(p)\n else\n lim=trunc(Int,ceil(p^(1/n)))\n res=1\n for i in 1:lim\n if p%i^n==0\n res=i\n end\n end\n println(res)\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1587580861, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s184457731.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s184457731", "user_id": "u619197965"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,p=parseMap(split(readline()))\n if n==1\n println(p)\n else\n lim=trunc(Int,ceil(p^(1/n)))\n res=1\n for i in 1:lim\n if p%i^n==0\n res=i\n end\n end\n println(res)\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 473, "cpu_time_ms": 740, "memory_kb": 145044}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s073765415", "group_id": "codeNet:p03195", "input_text": "N = parse(Int64, readline(STDIN))\ndata = [parse(Int64,readline(STDIN)) for _ in 1:N]\nprintln(length(filter(isodd, data)) > 0 ? \"first\" : \"second\")", "language": "Julia", "metadata": {"date": 1545537043, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03195.html", "problem_id": "p03195", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03195/input.txt", "sample_output_relpath": "derived/input_output/data/p03195/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03195/Julia/s073765415.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s073765415", "user_id": "u583595144"}, "prompt_components": {"gold_output": "first\n", "input_to_evaluate": "N = parse(Int64, readline(STDIN))\ndata = [parse(Int64,readline(STDIN)) for _ in 1:N]\nprintln(length(filter(isodd, data)) > 0 ? \"first\" : \"second\")", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.\n\nYou and Lunlun the dachshund alternately perform the following operation (starting from you):\n\nChoose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.\n\nThe one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?\n\nConstraints\n\n1 \\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\na_2\n:\na_N\n\nOutput\n\nIf you will win, print first; if Lunlun will win, print second.\n\nSample Input 1\n\n2\n1\n2\n\nSample Output 1\n\nfirst\n\nLet Color 1 be red, and Color 2 be blue. In this case, the tree bears one red apple and two blue apples.\n\nYou should eat the red apple in your first turn. Lunlun is then forced to eat one of the blue apples, and you can win by eating the other in your next turn.\n\nNote that you are also allowed to eat two apples in your first turn, one red and one blue (not a winning move, though).\n\nSample Input 2\n\n3\n100000\n30000\n20000\n\nSample Output 2\n\nsecond", "sample_input": "2\n1\n2\n"}, "reference_outputs": ["first\n"], "source_document_id": "p03195", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.\n\nYou and Lunlun the dachshund alternately perform the following operation (starting from you):\n\nChoose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.\n\nThe one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?\n\nConstraints\n\n1 \\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\na_2\n:\na_N\n\nOutput\n\nIf you will win, print first; if Lunlun will win, print second.\n\nSample Input 1\n\n2\n1\n2\n\nSample Output 1\n\nfirst\n\nLet Color 1 be red, and Color 2 be blue. In this case, the tree bears one red apple and two blue apples.\n\nYou should eat the red apple in your first turn. Lunlun is then forced to eat one of the blue apples, and you can win by eating the other in your next turn.\n\nNote that you are also allowed to eat two apples in your first turn, one red and one blue (not a winning move, though).\n\nSample Input 2\n\n3\n100000\n30000\n20000\n\nSample Output 2\n\nsecond", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 765, "memory_kb": 168316}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s936586132", "group_id": "codeNet:p03196", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,p=map(parseInt,split(readline()))\n\ty = Int[]\n\tx = p\n\ti = 2\n\tif n*log(i) > log(x)\n\t\tprint(1)\n\telse\n\t\twhile x > 1 && i <= x^(1/n)\n\t\t\tif x%(i^n) == 0\n\t\t\t\tpush!(y,i)\n\t\t\t\tx = div(x, i^n)\n\t\t\telse\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\t\tk = 1\n\t\tfor i in 1:length(y)\n\t\t\tk *= y[i]\n\t\tend\n\t\tprint(k)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1545534411, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03196.html", "problem_id": "p03196", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03196/input.txt", "sample_output_relpath": "derived/input_output/data/p03196/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03196/Julia/s936586132.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s936586132", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,p=map(parseInt,split(readline()))\n\ty = Int[]\n\tx = p\n\ti = 2\n\tif n*log(i) > log(x)\n\t\tprint(1)\n\telse\n\t\twhile x > 1 && i <= x^(1/n)\n\t\t\tif x%(i^n) == 0\n\t\t\t\tpush!(y,i)\n\t\t\t\tx = div(x, i^n)\n\t\t\telse\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\t\tk = 1\n\t\tfor i in 1:length(y)\n\t\t\tk *= y[i]\n\t\tend\n\t\tprint(k)\n\tend\nend\n\nmain()", "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": "p03196", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 152860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s301498339", "group_id": "codeNet:p03197", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn = parseInt(readline())\n\ta = Array{Int}(n)\n\tfor i in 1:n\n\t\ta[i] = readline() |> parseInt\n\tend\n\ta = sort(a)\n\tsum = a[1]\n\tfor i in 2:n-1\n\t\tif a[i] != a[i-1]\n\t\t\tsum += a[i]\n\t\tend\n\tend\n\tif sum%2 == 1\n\t\tprint(\"first\")\n\telse\n\t\tprint(\"second\")\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1545537459, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03197.html", "problem_id": "p03197", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03197/input.txt", "sample_output_relpath": "derived/input_output/data/p03197/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03197/Julia/s301498339.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s301498339", "user_id": "u095714878"}, "prompt_components": {"gold_output": "first\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn = parseInt(readline())\n\ta = Array{Int}(n)\n\tfor i in 1:n\n\t\ta[i] = readline() |> parseInt\n\tend\n\ta = sort(a)\n\tsum = a[1]\n\tfor i in 2:n-1\n\t\tif a[i] != a[i-1]\n\t\t\tsum += a[i]\n\t\tend\n\tend\n\tif sum%2 == 1\n\t\tprint(\"first\")\n\telse\n\t\tprint(\"second\")\n\tend\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.\n\nYou and Lunlun the dachshund alternately perform the following operation (starting from you):\n\nChoose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.\n\nThe one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?\n\nConstraints\n\n1 \\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\na_2\n:\na_N\n\nOutput\n\nIf you will win, print first; if Lunlun will win, print second.\n\nSample Input 1\n\n2\n1\n2\n\nSample Output 1\n\nfirst\n\nLet Color 1 be red, and Color 2 be blue. In this case, the tree bears one red apple and two blue apples.\n\nYou should eat the red apple in your first turn. Lunlun is then forced to eat one of the blue apples, and you can win by eating the other in your next turn.\n\nNote that you are also allowed to eat two apples in your first turn, one red and one blue (not a winning move, though).\n\nSample Input 2\n\n3\n100000\n30000\n20000\n\nSample Output 2\n\nsecond", "sample_input": "2\n1\n2\n"}, "reference_outputs": ["first\n"], "source_document_id": "p03197", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.\n\nYou and Lunlun the dachshund alternately perform the following operation (starting from you):\n\nChoose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.\n\nThe one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?\n\nConstraints\n\n1 \\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\na_2\n:\na_N\n\nOutput\n\nIf you will win, print first; if Lunlun will win, print second.\n\nSample Input 1\n\n2\n1\n2\n\nSample Output 1\n\nfirst\n\nLet Color 1 be red, and Color 2 be blue. In this case, the tree bears one red apple and two blue apples.\n\nYou should eat the red apple in your first turn. Lunlun is then forced to eat one of the blue apples, and you can win by eating the other in your next turn.\n\nNote that you are also allowed to eat two apples in your first turn, one red and one blue (not a winning move, though).\n\nSample Input 2\n\n3\n100000\n30000\n20000\n\nSample Output 2\n\nsecond", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 864, "memory_kb": 165588}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s462160567", "group_id": "codeNet:p03197", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,p=map(parseInt,split(readline()))\n\ty = Int[]\n\tx = p\n\ti = 2\n\tif n*log(i) > log(x)\n\t\tprint(1)\n\telseif n == 1\n\t\tprint(p)\n\telse\n\t\twhile i^n <= x\n\t\t\tif x%(i^n) == 0\n\t\t\t\tpush!(y,i)\n\t\t\t\tx = div(x, i^n)\n\t\t\telse\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\t\tk = 1\n\t\tfor i in 1:length(y)\n\t\t\tk *= y[i]\n\t\tend\n\t\tprint(k)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1545534568, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03197.html", "problem_id": "p03197", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03197/input.txt", "sample_output_relpath": "derived/input_output/data/p03197/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03197/Julia/s462160567.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s462160567", "user_id": "u095714878"}, "prompt_components": {"gold_output": "first\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,p=map(parseInt,split(readline()))\n\ty = Int[]\n\tx = p\n\ti = 2\n\tif n*log(i) > log(x)\n\t\tprint(1)\n\telseif n == 1\n\t\tprint(p)\n\telse\n\t\twhile i^n <= x\n\t\t\tif x%(i^n) == 0\n\t\t\t\tpush!(y,i)\n\t\t\t\tx = div(x, i^n)\n\t\t\telse\n\t\t\t\ti += 1\n\t\t\tend\n\t\tend\n\t\tk = 1\n\t\tfor i in 1:length(y)\n\t\t\tk *= y[i]\n\t\tend\n\t\tprint(k)\n\tend\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.\n\nYou and Lunlun the dachshund alternately perform the following operation (starting from you):\n\nChoose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.\n\nThe one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?\n\nConstraints\n\n1 \\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\na_2\n:\na_N\n\nOutput\n\nIf you will win, print first; if Lunlun will win, print second.\n\nSample Input 1\n\n2\n1\n2\n\nSample Output 1\n\nfirst\n\nLet Color 1 be red, and Color 2 be blue. In this case, the tree bears one red apple and two blue apples.\n\nYou should eat the red apple in your first turn. Lunlun is then forced to eat one of the blue apples, and you can win by eating the other in your next turn.\n\nNote that you are also allowed to eat two apples in your first turn, one red and one blue (not a winning move, though).\n\nSample Input 2\n\n3\n100000\n30000\n20000\n\nSample Output 2\n\nsecond", "sample_input": "2\n1\n2\n"}, "reference_outputs": ["first\n"], "source_document_id": "p03197", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is an apple tree that bears apples of N colors. The N colors of these apples are numbered 1 to N, and there are a_i apples of Color i.\n\nYou and Lunlun the dachshund alternately perform the following operation (starting from you):\n\nChoose one or more apples from the tree and eat them. Here, the apples chosen at the same time must all have different colors.\n\nThe one who eats the last apple from the tree will be declared winner. If both you and Lunlun play optimally, which will win?\n\nConstraints\n\n1 \\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\na_2\n:\na_N\n\nOutput\n\nIf you will win, print first; if Lunlun will win, print second.\n\nSample Input 1\n\n2\n1\n2\n\nSample Output 1\n\nfirst\n\nLet Color 1 be red, and Color 2 be blue. In this case, the tree bears one red apple and two blue apples.\n\nYou should eat the red apple in your first turn. Lunlun is then forced to eat one of the blue apples, and you can win by eating the other in your next turn.\n\nNote that you are also allowed to eat two apples in your first turn, one red and one blue (not a winning move, though).\n\nSample Input 2\n\n3\n100000\n30000\n20000\n\nSample Output 2\n\nsecond", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 785, "memory_kb": 144476}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s840057727", "group_id": "codeNet:p03200", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=chomp(readline())\n n=length(s)\n ans=0\n for _ in 1:5\n for i in n-1:-1:1\n if s[i:i+1]==\"BW\"\n s=s[1:i-1]*\"WB\"*s[i+2:end]\n ans+=1\n end\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1585345903, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s840057727.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s840057727", "user_id": "u619197965"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=chomp(readline())\n n=length(s)\n ans=0\n for _ in 1:5\n for i in n-1:-1:1\n if s[i:i+1]==\"BW\"\n s=s[1:i-1]*\"WB\"*s[i+2:end]\n ans+=1\n end\n end\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2115, "memory_kb": 154200}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s104395747", "group_id": "codeNet:p03200", "input_text": "function rank(s)\n rankB = [i for (i, c) = enumerate(s) if c == 'B']\n rankW = [i for (i, c) = enumerate(s) if c == 'W']\n return rankB, rankW\nend\n\nfunction main()\n s = chomp(readline())\n n = length(s)\n\n rankB, rankW = rank(s)\n nb = length(rankB)\n nw = n - nb\n\n if length(rankB) < length(rankW)\n rank_given = rankB\n rank_desired = Vector{Int}(nw+1:n)\n else\n rank_given = rankW\n rank_desired = Vector{Int}(1:nw)\n end\n\n rank_given - rank_desired |> sum |> print\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1544957683, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s104395747.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s104395747", "user_id": "u689739702"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function rank(s)\n rankB = [i for (i, c) = enumerate(s) if c == 'B']\n rankW = [i for (i, c) = enumerate(s) if c == 'W']\n return rankB, rankW\nend\n\nfunction main()\n s = chomp(readline())\n n = length(s)\n\n rankB, rankW = rank(s)\n nb = length(rankB)\n nw = n - nb\n\n if length(rankB) < length(rankW)\n rank_given = rankB\n rank_desired = Vector{Int}(nw+1:n)\n else\n rank_given = rankW\n rank_desired = Vector{Int}(1:nw)\n end\n\n rank_given - rank_desired |> sum |> print\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 975, "memory_kb": 173788}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s275405646", "group_id": "codeNet:p03201", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m]<=x;l=m;else;r=m;end;end;l;end\n\nfunction main()\n n = readline() |> parseInt\n a = readline() |> split |> parseMap |> sort\n d = Dict{Int,Int}()\n for i in 1:n\n if haskey(d,a[i])\n d[a[i]]+=1\n else\n d[a[i]]=1\n end\n end\n x = 0\n for i in n:-1:1\n r = 0\n while 2^r<=a[i]\n r+=1\n end\n t = bsearch(a,2^r-a[i])\n if 00&&d[a[i]]>0\n x+=1\n d[a[t]]-=1\n d[a[i]]-=1\n end\n end\n end\n end\n\n println(x)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584702312, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s275405646.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s275405646", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m]<=x;l=m;else;r=m;end;end;l;end\n\nfunction main()\n n = readline() |> parseInt\n a = readline() |> split |> parseMap |> sort\n d = Dict{Int,Int}()\n for i in 1:n\n if haskey(d,a[i])\n d[a[i]]+=1\n else\n d[a[i]]=1\n end\n end\n x = 0\n for i in n:-1:1\n r = 0\n while 2^r<=a[i]\n r+=1\n end\n t = bsearch(a,2^r-a[i])\n if 00&&d[a[i]]>0\n x+=1\n d[a[t]]-=1\n d[a[i]]-=1\n end\n end\n end\n end\n\n println(x)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 803, "cpu_time_ms": 646, "memory_kb": 140960}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s141512417", "group_id": "codeNet:p03203", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nfunction main()\n\th,w,n = readline() |> split |> parseMap\n\ta = Array{Int}(2,n)\n\tfor i in 1:n\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\ta = sortcols(a,by=x->(x[1],x[2]))\n\tcount = 0\n\tstack = 0\n\tflg = 0\n\tfor i in 1:n\n\t\tif a[1,i] == a[2,i]+stack\n\t\t\tstack += 1\n\t\t\tcount = a[1,i]\n\t\telseif a[1,i] > a[2,i]+stack\n\t\t\tcount = a[1,i]\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tif flg == 0\n\t\tcount = h+1\n\tend\n\tprintln(count-1)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1546130718, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03203.html", "problem_id": "p03203", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03203/input.txt", "sample_output_relpath": "derived/input_output/data/p03203/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03203/Julia/s141512417.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s141512417", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\n\nfunction main()\n\th,w,n = readline() |> split |> parseMap\n\ta = Array{Int}(2,n)\n\tfor i in 1:n\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\ta = sortcols(a,by=x->(x[1],x[2]))\n\tcount = 0\n\tstack = 0\n\tflg = 0\n\tfor i in 1:n\n\t\tif a[1,i] == a[2,i]+stack\n\t\t\tstack += 1\n\t\t\tcount = a[1,i]\n\t\telseif a[1,i] > a[2,i]+stack\n\t\t\tcount = a[1,i]\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tif flg == 0\n\t\tcount = h+1\n\tend\n\tprintln(count-1)\nend\n\nmain()\n", "problem_context": "Score : 800 points\n\nProblem Statement\n\nTakahashi and Aoki will play a game using a grid with H rows and W columns of square cells.\nThere are N obstacles on this grid; the i-th obstacle is at (X_i,Y_i).\nHere, we represent the cell at the i-th row and j-th column (1 \\leq i \\leq H, 1 \\leq j \\leq W) by (i,j).\nThere is no obstacle at (1,1), and there is a piece placed there at (1,1).\n\nStarting from Takahashi, he and Aoki alternately perform one of the following actions:\n\nMove the piece to an adjacent cell.\nHere, let the position of the piece be (x,y). Then Takahashi can only move the piece to (x+1,y), and Aoki can only move the piece to (x,y+1).\nIf the destination cell does not exist or it is occupied by an obstacle, this action cannot be taken.\n\nDo not move the piece, and end his turn without affecting the grid.\n\nThe game ends when the piece does not move twice in a row.\n\nTakahashi would like to perform as many actions (including not moving the piece) as possible before the game ends, while Aoki would like to perform as few actions as possible before the game ends.\nHow many actions will Takahashi end up performing?\n\nConstraints\n\n1 \\leq H,W \\leq 2\\times 10^5\n\n0 \\leq N \\leq 2\\times 10^5\n\n1 \\leq X_i \\leq H\n\n1 \\leq Y_i \\leq W\n\nIf i \\neq j, (X_i,Y_i) \\neq (X_j,Y_j)\n\n(X_i,Y_i) \\neq (1,1)\n\nX_i and Y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W N\nX_1 Y_1\n:\nX_N Y_N\n\nOutput\n\nPrint the number of actions Takahashi will end up performing.\n\nSample Input 1\n\n3 3 1\n3 2\n\nSample Output 1\n\n2\n\nFor example, the game proceeds as follows:\n\nTakahashi moves the piece to (2,1).\n\nAoki does not move the piece.\n\nTakahashi moves the piece to (3,1).\n\nAoki does not move the piece.\n\nTakahashi does not move the piece.\n\nTakahashi performs three actions in this case, but if both players play optimally, Takahashi will perform only two actions before the game ends.\n\nSample Input 2\n\n10 10 14\n4 3\n2 2\n7 3\n9 10\n7 7\n8 1\n10 10\n5 4\n3 4\n2 8\n6 4\n4 4\n5 8\n9 2\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100000 100000 0\n\nSample Output 3\n\n100000", "sample_input": "3 3 1\n3 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03203", "source_text": "Score : 800 points\n\nProblem Statement\n\nTakahashi and Aoki will play a game using a grid with H rows and W columns of square cells.\nThere are N obstacles on this grid; the i-th obstacle is at (X_i,Y_i).\nHere, we represent the cell at the i-th row and j-th column (1 \\leq i \\leq H, 1 \\leq j \\leq W) by (i,j).\nThere is no obstacle at (1,1), and there is a piece placed there at (1,1).\n\nStarting from Takahashi, he and Aoki alternately perform one of the following actions:\n\nMove the piece to an adjacent cell.\nHere, let the position of the piece be (x,y). Then Takahashi can only move the piece to (x+1,y), and Aoki can only move the piece to (x,y+1).\nIf the destination cell does not exist or it is occupied by an obstacle, this action cannot be taken.\n\nDo not move the piece, and end his turn without affecting the grid.\n\nThe game ends when the piece does not move twice in a row.\n\nTakahashi would like to perform as many actions (including not moving the piece) as possible before the game ends, while Aoki would like to perform as few actions as possible before the game ends.\nHow many actions will Takahashi end up performing?\n\nConstraints\n\n1 \\leq H,W \\leq 2\\times 10^5\n\n0 \\leq N \\leq 2\\times 10^5\n\n1 \\leq X_i \\leq H\n\n1 \\leq Y_i \\leq W\n\nIf i \\neq j, (X_i,Y_i) \\neq (X_j,Y_j)\n\n(X_i,Y_i) \\neq (1,1)\n\nX_i and Y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W N\nX_1 Y_1\n:\nX_N Y_N\n\nOutput\n\nPrint the number of actions Takahashi will end up performing.\n\nSample Input 1\n\n3 3 1\n3 2\n\nSample Output 1\n\n2\n\nFor example, the game proceeds as follows:\n\nTakahashi moves the piece to (2,1).\n\nAoki does not move the piece.\n\nTakahashi moves the piece to (3,1).\n\nAoki does not move the piece.\n\nTakahashi does not move the piece.\n\nTakahashi performs three actions in this case, but if both players play optimally, Takahashi will perform only two actions before the game ends.\n\nSample Input 2\n\n10 10 14\n4 3\n2 2\n7 3\n9 10\n7 7\n8 1\n10 10\n5 4\n3 4\n2 8\n6 4\n4 4\n5 8\n9 2\n\nSample Output 2\n\n6\n\nSample Input 3\n\n100000 100000 0\n\nSample Output 3\n\n100000", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 511, "cpu_time_ms": 1376, "memory_kb": 160840}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s600513814", "group_id": "codeNet:p03207", "input_text": "n=parse(Int,readline())\ns=0\nm=0\nfor i in 1..n\n x=parse(Int,readline())\n s+=x\n if m\nusing namespace std;\nint main(){\n int n,k,l = 1e9;\n cin >> n >> k;\n vector a(n);\n for(int i = 0; i < n; i++){\n cin >> a[i];\n }\n for(int i = 0; i < n; i++){\n for(int j = i + 1; j < n; j++){\n for(int k = j + 1; k < n; k++){\n int d = max({a[i],a[j],a[k]}) - min({a[i],a[j],a[k]});\n if(d < l)\n l = d;\n }\n }\n }\n cout << l << endl;\n}\n", "language": "Julia", "metadata": {"date": 1579736009, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s937495687.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s937495687", "user_id": "u962609087"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "#include\nusing namespace std;\nint main(){\n int n,k,l = 1e9;\n cin >> n >> k;\n vector a(n);\n for(int i = 0; i < n; i++){\n cin >> a[i];\n }\n for(int i = 0; i < n; i++){\n for(int j = i + 1; j < n; j++){\n for(int k = j + 1; k < n; k++){\n int d = max({a[i],a[j],a[k]}) - min({a[i],a[j],a[k]});\n if(d < l)\n l = d;\n }\n }\n }\n cout << l << endl;\n}\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 469, "cpu_time_ms": 1132, "memory_kb": 196868}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s396310217", "group_id": "codeNet:p03209", "input_text": "N,X=map(x->parse(Int,x),split(readline()))\nS=0\nwhile N>=0\n\tT=2<T-2\n\t\tS+=div(T,2)\n\t\tX-=T-1\n\telse\n\t\tX-=1\n\tend\nend\nprintln(S)", "language": "Julia", "metadata": {"date": 1561295887, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s396310217.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s396310217", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N,X=map(x->parse(Int,x),split(readline()))\nS=0\nwhile N>=0\n\tT=2<T-2\n\t\tS+=div(T,2)\n\t\tX-=T-1\n\telse\n\t\tX-=1\n\tend\nend\nprintln(S)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 137, "cpu_time_ms": 361, "memory_kb": 110832}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s794981500", "group_id": "codeNet:p03209", "input_text": "N,X=map(x->parse(Int,x),split(readline()))\nS=0\nwhile X>0\n\tT=2<T-2>=0\n\t\tS+=div(T,2)\n\t\tX-=T-1\n\telse\n\t\tX-=1\n\tend\nend\nprintln(S)\n", "language": "Julia", "metadata": {"date": 1561295566, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s794981500.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s794981500", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N,X=map(x->parse(Int,x),split(readline()))\nS=0\nwhile X>0\n\tT=2<T-2>=0\n\t\tS+=div(T,2)\n\t\tX-=T-1\n\telse\n\t\tX-=1\n\tend\nend\nprintln(S)\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 342, "memory_kb": 110336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s383475053", "group_id": "codeNet:p03209", "input_text": "N,X=map(x->parse(Int,x),split(readline()))\nS=0\nwhile X>0\n\tT=2<=0&&X>T-2\n\t\tS+=div(T,2)\n\t\tX-=T-1\n\telse\n\t\tX-=1\n\tend\nend\nprintln(S)\n", "language": "Julia", "metadata": {"date": 1561295501, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s383475053.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s383475053", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N,X=map(x->parse(Int,x),split(readline()))\nS=0\nwhile X>0\n\tT=2<=0&&X>T-2\n\t\tS+=div(T,2)\n\t\tX-=T-1\n\telse\n\t\tX-=1\n\tend\nend\nprintln(S)\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 145, "cpu_time_ms": 387, "memory_kb": 113532}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s263403307", "group_id": "codeNet:p03211", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n s=chomp(readline())\n println(minimum([abs(753-pI(s[i-2:i])) for i=3:length(s)]))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end\n", "language": "Julia", "metadata": {"date": 1591755418, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03211.html", "problem_id": "p03211", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03211/input.txt", "sample_output_relpath": "derived/input_output/data/p03211/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03211/Julia/s263403307.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s263403307", "user_id": "u443151804"}, "prompt_components": {"gold_output": "34\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n s=chomp(readline())\n println(minimum([abs(753-pI(s[i-2:i])) for i=3:length(s)]))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere is a string S consisting of digits 1, 2, ..., 9.\nLunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)\n\nThe master's favorite number is 753. The closer to this number, the better.\nWhat is the minimum possible (absolute) difference between X and 753?\n\nConstraints\n\nS is a string of length between 4 and 10 (inclusive).\n\nEach character in S is 1, 2, ..., or 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum possible difference between X and 753.\n\nSample Input 1\n\n1234567876\n\nSample Output 1\n\n34\n\nTaking out the seventh to ninth characters results in X = 787, and the difference between this and 753 is 787 - 753 = 34. The difference cannot be made smaller, no matter where X is taken from.\n\nNote that the digits cannot be rearranged. For example, taking out 567 and rearranging it to 765 is not allowed.\n\nWe cannot take out three digits that are not consecutive from S, either. For example, taking out the seventh digit 7, the ninth digit 7 and the tenth digit 6 to obtain 776 is not allowed.\n\nSample Input 2\n\n35753\n\nSample Output 2\n\n0\n\nIf 753 itself can be taken out, the answer is 0.\n\nSample Input 3\n\n1111111111\n\nSample Output 3\n\n642\n\nNo matter where X is taken from, X = 111, with the difference 753 - 111 = 642.", "sample_input": "1234567876\n"}, "reference_outputs": ["34\n"], "source_document_id": "p03211", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere is a string S consisting of digits 1, 2, ..., 9.\nLunlun, the Dachshund, will take out three consecutive digits from S, treat them as a single integer X and bring it to her master. (She cannot rearrange the digits.)\n\nThe master's favorite number is 753. The closer to this number, the better.\nWhat is the minimum possible (absolute) difference between X and 753?\n\nConstraints\n\nS is a string of length between 4 and 10 (inclusive).\n\nEach character in S is 1, 2, ..., or 9.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the minimum possible difference between X and 753.\n\nSample Input 1\n\n1234567876\n\nSample Output 1\n\n34\n\nTaking out the seventh to ninth characters results in X = 787, and the difference between this and 753 is 787 - 753 = 34. The difference cannot be made smaller, no matter where X is taken from.\n\nNote that the digits cannot be rearranged. For example, taking out 567 and rearranging it to 765 is not allowed.\n\nWe cannot take out three digits that are not consecutive from S, either. For example, taking out the seventh digit 7, the ninth digit 7 and the tenth digit 6 to obtain 776 is not allowed.\n\nSample Input 2\n\n35753\n\nSample Output 2\n\n0\n\nIf 753 itself can be taken out, the answer is 0.\n\nSample Input 3\n\n1111111111\n\nSample Output 3\n\n642\n\nNo matter where X is taken from, X = 111, with the difference 753 - 111 = 642.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 307, "cpu_time_ms": 903, "memory_kb": 167780}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s421481718", "group_id": "codeNet:p03212", "input_text": "N=parse(Int,readline())\ndfs(A,a,b,c)=A>N ? 0 : (a>0&&b>0&&c>0)+dfs(A*10+3,a+1,b,c)+dfs(A*10+5,a,b+1,c)+dfs(A*10+7,a,b,c+1)\nprintln(dfs(0,0,0,0))", "language": "Julia", "metadata": {"date": 1561296169, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s421481718.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s421481718", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N=parse(Int,readline())\ndfs(A,a,b,c)=A>N ? 0 : (a>0&&b>0&&c>0)+dfs(A*10+3,a+1,b,c)+dfs(A*10+5,a,b+1,c)+dfs(A*10+7,a,b,c+1)\nprintln(dfs(0,0,0,0))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 310, "memory_kb": 107992}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s999925490", "group_id": "codeNet:p03213", "input_text": "N=parse(Int,readline())\nA=zeros(Int,100)\nfor i=1:N\n\tfor j=2:i\n\t\twhile i%j==0\n\t\t\tA[j]+=1\n\t\t\ti=div(i,j)\n\t\tend\n\tend\nend\nB=zeros(Int,100)\nfor a=A\n\tfor i=1:a+1\n\t\tB[i]+=1\n\tend\nend\nprintln(B[75]+B[25]*(B[3]-1)+B[15]*(B[5]-1)+div(B[5]*(B[5]-1)*(B[3]-2),2))", "language": "Julia", "metadata": {"date": 1561296736, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03213.html", "problem_id": "p03213", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03213/input.txt", "sample_output_relpath": "derived/input_output/data/p03213/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03213/Julia/s999925490.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s999925490", "user_id": "u657913472"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "N=parse(Int,readline())\nA=zeros(Int,100)\nfor i=1:N\n\tfor j=2:i\n\t\twhile i%j==0\n\t\t\tA[j]+=1\n\t\t\ti=div(i,j)\n\t\tend\n\tend\nend\nB=zeros(Int,100)\nfor a=A\n\tfor i=1:a+1\n\t\tB[i]+=1\n\tend\nend\nprintln(B[75]+B[25]*(B[3]-1)+B[15]*(B[5]-1)+div(B[5]*(B[5]-1)*(B[3]-2),2))", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Among the divisors of N! (= 1 \\times 2 \\times ... \\times N), how many Shichi-Go numbers (literally \"Seven-Five numbers\") are there?\n\nHere, a Shichi-Go number is a positive integer that has exactly 75 divisors.\n\nNote\n\nWhen a positive integer A divides a positive integer B, A is said to a divisor of B.\nFor example, 6 has four divisors: 1, 2, 3 and 6.\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\nPrint the number of the Shichi-Go numbers that are divisors of N!.\n\nSample Input 1\n\n9\n\nSample Output 1\n\n0\n\nThere are no Shichi-Go numbers among the divisors of 9! = 1 \\times 2 \\times ... \\times 9 = 362880.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1\n\nThere is one Shichi-Go number among the divisors of 10! = 3628800: 32400.\n\nSample Input 3\n\n100\n\nSample Output 3\n\n543", "sample_input": "9\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03213", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given an integer N. Among the divisors of N! (= 1 \\times 2 \\times ... \\times N), how many Shichi-Go numbers (literally \"Seven-Five numbers\") are there?\n\nHere, a Shichi-Go number is a positive integer that has exactly 75 divisors.\n\nNote\n\nWhen a positive integer A divides a positive integer B, A is said to a divisor of B.\nFor example, 6 has four divisors: 1, 2, 3 and 6.\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\nPrint the number of the Shichi-Go numbers that are divisors of N!.\n\nSample Input 1\n\n9\n\nSample Output 1\n\n0\n\nThere are no Shichi-Go numbers among the divisors of 9! = 1 \\times 2 \\times ... \\times 9 = 362880.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n1\n\nThere is one Shichi-Go number among the divisors of 10! = 3628800: 32400.\n\nSample Input 3\n\n100\n\nSample Output 3\n\n543", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 344, "memory_kb": 110524}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s758706491", "group_id": "codeNet:p03214", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn = parseInt(readline())\n\ta = map(parseInt, split(readline()))\n\tavg = sum(a)/n\n\tb = abs(a-avg)\n\tl = 1\n\tfor i in 2:n\n\t\tif b[i] < b[l]\n\t\t\tl = i\n\t\tend\n\tend\n\tprintln(l-1)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1543107895, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s758706491.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s758706491", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn = parseInt(readline())\n\ta = map(parseInt, split(readline()))\n\tavg = sum(a)/n\n\tb = abs(a-avg)\n\tl = 1\n\tfor i in 2:n\n\t\tif b[i] < b[l]\n\t\t\tl = i\n\t\tend\n\tend\n\tprintln(l-1)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 224, "cpu_time_ms": 425, "memory_kb": 116208}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s675849131", "group_id": "codeNet:p03219", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn, m = parseInt(split(readline()))\n\tx = Array{Int}(2,m)\n\tfor i in 1:m\n\t x[:,i] = parseInt(split(readline()))\n\tend\n\tprint(\"G\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541395221, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s675849131.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s675849131", "user_id": "u095714878"}, "prompt_components": {"gold_output": "110\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn, m = parseInt(split(readline()))\n\tx = Array{Int}(2,m)\n\tfor i in 1:m\n\t x[:,i] = parseInt(split(readline()))\n\tend\n\tprint(\"G\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 184, "cpu_time_ms": 1298, "memory_kb": 147712}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s192451950", "group_id": "codeNet:p03220", "input_text": "parseInt(x) = parse(Int, x)\nfunction main()\n\tn = parseInt(readline())\n\tt,a = map(parseInt, split(readline()))\n\th = map(parseInt, split(readline()))\n\tmin = 1000\n\tnum = 0\n\tl = Array{Float64}(n)\n\tfor i in 1:n\n\t\tl[i] = abs(a-t+0.006*h[i])\n\t\tif l[i] <= min\n\t\t\tmin = l[i]\n\t\t\tnum = i\n\t\tend\n\tend\n\tprint(num)\nend\nmain()", "language": "Julia", "metadata": {"date": 1541383683, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03220.html", "problem_id": "p03220", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03220/input.txt", "sample_output_relpath": "derived/input_output/data/p03220/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03220/Julia/s192451950.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s192451950", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nfunction main()\n\tn = parseInt(readline())\n\tt,a = map(parseInt, split(readline()))\n\th = map(parseInt, split(readline()))\n\tmin = 1000\n\tnum = 0\n\tl = Array{Float64}(n)\n\tfor i in 1:n\n\t\tl[i] = abs(a-t+0.006*h[i])\n\t\tif l[i] <= min\n\t\t\tmin = l[i]\n\t\t\tnum = i\n\t\tend\n\tend\n\tprint(num)\nend\nmain()", "problem_context": "Score: 200 points\n\nProblem Statement\n\nA country decides to build a palace.\n\nIn this country, the average temperature of a point at an elevation of x meters is T-x \\times 0.006 degrees Celsius.\n\nThere are N places proposed for the place. The elevation of Place i is H_i meters.\n\nAmong them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.\n\nPrint the index of the place where the palace should be built.\n\nIt is guaranteed that the solution is unique.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n0 \\leq T \\leq 50\n\n-60 \\leq A \\leq T\n\n0 \\leq H_i \\leq 10^5\n\nAll values in input are integers.\n\nThe solution is unique.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nT A\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the index of the place where the palace should be built.\n\nSample Input 1\n\n2\n12 5\n1000 2000\n\nSample Output 1\n\n1\n\nThe average temperature of Place 1 is 12-1000 \\times 0.006=6 degrees Celsius.\n\nThe average temperature of Place 2 is 12-2000 \\times 0.006=0 degrees Celsius.\n\nThus, the palace should be built at Place 1.\n\nSample Input 2\n\n3\n21 -11\n81234 94124 52141\n\nSample Output 2\n\n3", "sample_input": "2\n12 5\n1000 2000\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03220", "source_text": "Score: 200 points\n\nProblem Statement\n\nA country decides to build a palace.\n\nIn this country, the average temperature of a point at an elevation of x meters is T-x \\times 0.006 degrees Celsius.\n\nThere are N places proposed for the place. The elevation of Place i is H_i meters.\n\nAmong them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.\n\nPrint the index of the place where the palace should be built.\n\nIt is guaranteed that the solution is unique.\n\nConstraints\n\n1 \\leq N \\leq 1000\n\n0 \\leq T \\leq 50\n\n-60 \\leq A \\leq T\n\n0 \\leq H_i \\leq 10^5\n\nAll values in input are integers.\n\nThe solution is unique.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nT A\nH_1 H_2 ... H_N\n\nOutput\n\nPrint the index of the place where the palace should be built.\n\nSample Input 1\n\n2\n12 5\n1000 2000\n\nSample Output 1\n\n1\n\nThe average temperature of Place 1 is 12-1000 \\times 0.006=6 degrees Celsius.\n\nThe average temperature of Place 2 is 12-2000 \\times 0.006=0 degrees Celsius.\n\nThus, the palace should be built at Place 1.\n\nSample Input 2\n\n3\n21 -11\n81234 94124 52141\n\nSample Output 2\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 365, "memory_kb": 110336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s870271260", "group_id": "codeNet:p03221", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn, m = parseInt.(split(readline()))\n\tx = Array{Int}(2,m)\n\tfor i in 1:m\n\t x[:,i] = map(parseInt, split(readline()))\n\tend\n\tprint(\"G\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541395349, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03221.html", "problem_id": "p03221", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03221/input.txt", "sample_output_relpath": "derived/input_output/data/p03221/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03221/Julia/s870271260.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s870271260", "user_id": "u095714878"}, "prompt_components": {"gold_output": "000001000002\n000002000001\n000001000001\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn, m = parseInt.(split(readline()))\n\tx = Array{Int}(2,m)\n\tfor i in 1:m\n\t x[:,i] = map(parseInt, split(readline()))\n\tend\n\tprint(\"G\")\nend\n\nmain()", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "sample_input": "2 3\n1 32\n2 63\n1 12\n"}, "reference_outputs": ["000001000002\n000002000001\n000001000001\n"], "source_document_id": "p03221", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1473, "memory_kb": 153744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s689864865", "group_id": "codeNet:p03221", "input_text": "n, m = parse.(input(readline()))\nfor i in 1:m\n readline(STDIN)\nend\n\nprint(\"G\")", "language": "Julia", "metadata": {"date": 1541395004, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03221.html", "problem_id": "p03221", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03221/input.txt", "sample_output_relpath": "derived/input_output/data/p03221/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03221/Julia/s689864865.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s689864865", "user_id": "u095714878"}, "prompt_components": {"gold_output": "000001000002\n000002000001\n000001000001\n", "input_to_evaluate": "n, m = parse.(input(readline()))\nfor i in 1:m\n readline(STDIN)\nend\n\nprint(\"G\")", "problem_context": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "sample_input": "2 3\n1 32\n2 63\n1 12\n"}, "reference_outputs": ["000001000002\n000002000001\n000001000001\n"], "source_document_id": "p03221", "source_text": "Score: 300 points\n\nProblem Statement\n\nIn Republic of Atcoder, there are N prefectures, and a total of M cities that belong to those prefectures.\n\nCity i is established in year Y_i and belongs to Prefecture P_i.\n\nYou can assume that there are no multiple cities that are established in the same year.\n\nIt is decided to allocate a 12-digit ID number to each city.\n\nIf City i is the x-th established city among the cities that belong to Prefecture i, the first six digits of the ID number of City i is P_i, and the last six digits of the ID number is x.\n\nHere, if P_i or x (or both) has less than six digits, zeros are added to the left until it has six digits.\n\nFind the ID numbers for all the cities.\n\nNote that there can be a prefecture with no cities.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq P_i \\leq N\n\n1 \\leq Y_i \\leq 10^9\n\nY_i are all different.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nP_1 Y_1\n:\nP_M Y_M\n\nOutput\n\nPrint the ID numbers for all the cities, in ascending order of indices (City 1, City 2, ...).\n\nSample Input 1\n\n2 3\n1 32\n2 63\n1 12\n\nSample Output 1\n\n000001000002\n000002000001\n000001000001\n\nAs City 1 is the second established city among the cities that belong to Prefecture 1, its ID number is 000001000002.\n\nAs City 2 is the first established city among the cities that belong to Prefecture 2, its ID number is 000002000001.\n\nAs City 3 is the first established city among the cities that belong to Prefecture 1, its ID number is 000001000001.\n\nSample Input 2\n\n2 3\n2 55\n2 77\n2 99\n\nSample Output 2\n\n000002000001\n000002000002\n000002000003", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 556, "memory_kb": 127240}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s779527395", "group_id": "codeNet:p03222", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction pos(i,j,w)\n\tif w == 1\n\t\t1\n\telseif j <= 2 || j >= w+1\n \tif i == j\n \t\tfib(w)\n \telse\n \t\tfib(w-1)\n \tend\n elseif i <= 2 || i >= w+1\n\t\tfib(w-1)\n\telseif i == j\n\t\tfib(i-1)*fib(w+2-i)\n\telse\n\t\tfib(min(i,j)-1)*fib(w+2-max(i,j))\n\tend\nend\n\nfunction fib(k)\n\tif k == 1\n\t\t1\n\telseif k == 2\n\t\t1\n\telse\n\t\tx = Array{Int}(k)\n\t\tx[1] = 1\n\t\tx[2] = 1\n\t\tfor i in 3:k\n\t\t\tx[i] = x[i-2]+x[i-1]\n\t\tend\n\t\tx[k]\n\tend\nend\n\nfunction main()\n\th,w,k = readline() |> split |> parseMap\n\tdp = Array{Int}(h+1,w+2)\n\tcount = 0\n\tfor i in 1:w+2\n\t\tdp[1,i] = 0\n\tend\n\tfor i in 1:h+1\n\t\tdp[i,1] = 0\n\t\tdp[i,w+2] = 0\n\tend\n dp[1,2] = 1\n\tfor i in 2:h+1\n\t\tfor j in 2:w+1\n\t\t\tdp[i,j] = ((dp[i-1,j-1]*pos(j-1,j,w))%1000000007 + (dp[i-1,j]*pos(j,j,w))%1000000007 + (dp[i-1,j+1]*pos(j+1,j,w))%1000000007)%1000000007\n\t\tend\n\tend\n\tprintln(dp[h+1,k+1]%1000000007)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1546641023, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s779527395.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s779527395", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction pos(i,j,w)\n\tif w == 1\n\t\t1\n\telseif j <= 2 || j >= w+1\n \tif i == j\n \t\tfib(w)\n \telse\n \t\tfib(w-1)\n \tend\n elseif i <= 2 || i >= w+1\n\t\tfib(w-1)\n\telseif i == j\n\t\tfib(i-1)*fib(w+2-i)\n\telse\n\t\tfib(min(i,j)-1)*fib(w+2-max(i,j))\n\tend\nend\n\nfunction fib(k)\n\tif k == 1\n\t\t1\n\telseif k == 2\n\t\t1\n\telse\n\t\tx = Array{Int}(k)\n\t\tx[1] = 1\n\t\tx[2] = 1\n\t\tfor i in 3:k\n\t\t\tx[i] = x[i-2]+x[i-1]\n\t\tend\n\t\tx[k]\n\tend\nend\n\nfunction main()\n\th,w,k = readline() |> split |> parseMap\n\tdp = Array{Int}(h+1,w+2)\n\tcount = 0\n\tfor i in 1:w+2\n\t\tdp[1,i] = 0\n\tend\n\tfor i in 1:h+1\n\t\tdp[i,1] = 0\n\t\tdp[i,w+2] = 0\n\tend\n dp[1,2] = 1\n\tfor i in 2:h+1\n\t\tfor j in 2:w+1\n\t\t\tdp[i,j] = ((dp[i-1,j-1]*pos(j-1,j,w))%1000000007 + (dp[i-1,j]*pos(j,j,w))%1000000007 + (dp[i-1,j+1]*pos(j+1,j,w))%1000000007)%1000000007\n\t\tend\n\tend\n\tprintln(dp[h+1,k+1]%1000000007)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 931, "cpu_time_ms": 423, "memory_kb": 113832}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s179841561", "group_id": "codeNet:p03227", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=chomp(readline())\n if length(s)==2\n println(s)\n else\n println(reverse(s))\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1584484151, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s179841561.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s179841561", "user_id": "u619197965"}, "prompt_components": {"gold_output": "cba\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=chomp(readline())\n if length(s)==2\n println(s)\n else\n println(reverse(s))\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 848, "memory_kb": 164816}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s468776138", "group_id": "codeNet:p03227", "input_text": "s=readline()\nprint(length(s)<4?s:s[end:-1:1])", "language": "Julia", "metadata": {"date": 1561229395, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s468776138.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s468776138", "user_id": "u729133443"}, "prompt_components": {"gold_output": "cba\n", "input_to_evaluate": "s=readline()\nprint(length(s)<4?s:s[end:-1:1])", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 45, "cpu_time_ms": 281, "memory_kb": 107640}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s686114607", "group_id": "codeNet:p03227", "input_text": "function main()\n\ts = split(readline(), \"\")\n\tif length(s) == 2\n\t\tfor i in 1:2\n\t\t\tprint(s[i])\n\t\tend\n\telse\n\t\tfor i in 0:2\n\t\t\tprint(s[3-i])\n\t\tend\n\tend\n\tprintln()\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1540688793, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s686114607.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s686114607", "user_id": "u095714878"}, "prompt_components": {"gold_output": "cba\n", "input_to_evaluate": "function main()\n\ts = split(readline(), \"\")\n\tif length(s) == 2\n\t\tfor i in 1:2\n\t\t\tprint(s[i])\n\t\tend\n\telse\n\t\tfor i in 0:2\n\t\t\tprint(s[3-i])\n\t\tend\n\tend\n\tprintln()\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 169, "cpu_time_ms": 435, "memory_kb": 113684}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s848270304", "group_id": "codeNet:p03229", "input_text": "function parseInt(x) parse(Int, x) end\nfunction conInt(x) convert(Int, x) end\n\nfunction main()\n\tn = parseInt(readline())\n\tx = Int[]\n\tsum = 0\n\tfor i in 1:n\n\t\tpush!(x, parseInt(readline()))\n\tend\n\ty = sort(x)\n\tsum += y[n]-y[1]\n\tif n%2 == 1\n\t\tfor i in 1:conInt((n-3)/2)\n\t\t\tsum += y[n-i]-y[i]\n\t\t\tsum += y[n+1-i]-y[i+1]\n\t\tend\n\t\tsum += max(y[conInt((n+1)/2)]-y[conInt((n-1)/2)], y[conInt((n+3)/2)]-y[conInt((n+1)/2)])\n\telse\n\t\tfor i in 1:conInt((n-4)/2)\n\t\t\tsum += y[n-i]-y[i]\n\t\t\tsum += y[n+1-i]-y[i+1]\n\t\tend\n\t\tsum += max(y[conInt(n/2)]-y[conInt((n-2)/2)]+y[conInt((n+4)/2)]-y[conInt((n+2)/2)], y[conInt((n+2)/2)]-y[conInt((n-2)/2)]+y[conInt((n+4)/2)]-y[conInt(n/2)])\n\tend\n\tprintln(sum)\nend\nmain()", "language": "Julia", "metadata": {"date": 1540694226, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s848270304.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s848270304", "user_id": "u095714878"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\nfunction conInt(x) convert(Int, x) end\n\nfunction main()\n\tn = parseInt(readline())\n\tx = Int[]\n\tsum = 0\n\tfor i in 1:n\n\t\tpush!(x, parseInt(readline()))\n\tend\n\ty = sort(x)\n\tsum += y[n]-y[1]\n\tif n%2 == 1\n\t\tfor i in 1:conInt((n-3)/2)\n\t\t\tsum += y[n-i]-y[i]\n\t\t\tsum += y[n+1-i]-y[i+1]\n\t\tend\n\t\tsum += max(y[conInt((n+1)/2)]-y[conInt((n-1)/2)], y[conInt((n+3)/2)]-y[conInt((n+1)/2)])\n\telse\n\t\tfor i in 1:conInt((n-4)/2)\n\t\t\tsum += y[n-i]-y[i]\n\t\t\tsum += y[n+1-i]-y[i+1]\n\t\tend\n\t\tsum += max(y[conInt(n/2)]-y[conInt((n-2)/2)]+y[conInt((n+4)/2)]-y[conInt((n+2)/2)], y[conInt((n+2)/2)]-y[conInt((n-2)/2)]+y[conInt((n+4)/2)]-y[conInt(n/2)])\n\tend\n\tprintln(sum)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1500, "memory_kb": 145672}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s753086415", "group_id": "codeNet:p03231", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,m=parseMap(split(readline()))\n s=chomp(readline())\n t=chomp(readline())\n l=BigInt(lcm(n,m))\n ans=l\n s_=[i*l÷n+1 for i in 0:n-1]\n t_=[i*l÷m+1 for i in 0:m-1]\n for i in 1:n\n num=searchsortedfirst(t_,s_[i])\n if num<=m && s_[i]==t_[num] && s[i]!=t[num]\n ans=-1\n break\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1586467428, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03231.html", "problem_id": "p03231", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03231/input.txt", "sample_output_relpath": "derived/input_output/data/p03231/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03231/Julia/s753086415.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s753086415", "user_id": "u619197965"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,m=parseMap(split(readline()))\n s=chomp(readline())\n t=chomp(readline())\n l=BigInt(lcm(n,m))\n ans=l\n s_=[i*l÷n+1 for i in 0:n-1]\n t_=[i*l÷m+1 for i in 0:m-1]\n for i in 1:n\n num=searchsortedfirst(t_,s_[i])\n if num<=m && s_[i]==t_[num] && s[i]!=t[num]\n ans=-1\n break\n end\n end\n println(ans)\nend\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N and another string T of length M.\nThese strings consist of lowercase English letters.\n\nA string X is called a good string when the following conditions are all met:\n\nLet L be the length of X. L is divisible by both N and M.\n\nConcatenating the 1-st, (\\frac{L}{N}+1)-th, (2 \\times \\frac{L}{N}+1)-th, ..., ((N-1)\\times\\frac{L}{N}+1)-th characters of X, without changing the order, results in S.\n\nConcatenating the 1-st, (\\frac{L}{M}+1)-th, (2 \\times \\frac{L}{M}+1)-th, ..., ((M-1)\\times\\frac{L}{M}+1)-th characters of X, without changing the order, results in T.\n\nDetermine if there exists a good string. If it exists, find the length of the shortest such string.\n\nConstraints\n\n1 \\leq N,M \\leq 10^5\n\nS and T consist of lowercase English letters.\n\n|S|=N\n\n|T|=M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nS\nT\n\nOutput\n\nIf a good string does not exist, print -1; if it exists, print the length of the shortest such string.\n\nSample Input 1\n\n3 2\nacp\nae\n\nSample Output 1\n\n6\n\nFor example, the string accept is a good string.\nThere is no good string shorter than this, so the answer is 6.\n\nSample Input 2\n\n6 3\nabcdef\nabc\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n15 9\ndnsusrayukuaiia\ndujrunuma\n\nSample Output 3\n\n45", "sample_input": "3 2\nacp\nae\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03231", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S of length N and another string T of length M.\nThese strings consist of lowercase English letters.\n\nA string X is called a good string when the following conditions are all met:\n\nLet L be the length of X. L is divisible by both N and M.\n\nConcatenating the 1-st, (\\frac{L}{N}+1)-th, (2 \\times \\frac{L}{N}+1)-th, ..., ((N-1)\\times\\frac{L}{N}+1)-th characters of X, without changing the order, results in S.\n\nConcatenating the 1-st, (\\frac{L}{M}+1)-th, (2 \\times \\frac{L}{M}+1)-th, ..., ((M-1)\\times\\frac{L}{M}+1)-th characters of X, without changing the order, results in T.\n\nDetermine if there exists a good string. If it exists, find the length of the shortest such string.\n\nConstraints\n\n1 \\leq N,M \\leq 10^5\n\nS and T consist of lowercase English letters.\n\n|S|=N\n\n|T|=M\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nS\nT\n\nOutput\n\nIf a good string does not exist, print -1; if it exists, print the length of the shortest such string.\n\nSample Input 1\n\n3 2\nacp\nae\n\nSample Output 1\n\n6\n\nFor example, the string accept is a good string.\nThere is no good string shorter than this, so the answer is 6.\n\nSample Input 2\n\n6 3\nabcdef\nabc\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n15 9\ndnsusrayukuaiia\ndujrunuma\n\nSample Output 3\n\n45", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 758, "memory_kb": 174708}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s178675031", "group_id": "codeNet:p03232", "input_text": "M=10^9+7\ni=s=r=big\"0\"\nA=(x->parse(Int,x)).(split(readlines()[2]))\nfor a=A\ns+=invmod(i+=1,M)\nr+=a*~-s+A[end+1-i]s\nend\nprint(factorial(i)r%M)", "language": "Julia", "metadata": {"date": 1571960689, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03232.html", "problem_id": "p03232", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03232/input.txt", "sample_output_relpath": "derived/input_output/data/p03232/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03232/Julia/s178675031.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s178675031", "user_id": "u657913472"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "M=10^9+7\ni=s=r=big\"0\"\nA=(x->parse(Int,x)).(split(readlines()[2]))\nfor a=A\ns+=invmod(i+=1,M)\nr+=a*~-s+A[end+1-i]s\nend\nprint(factorial(i)r%M)", "problem_context": "Score : 600 points\n\nProblem Statement\n\nThere are N blocks arranged in a row, numbered 1 to N from left to right.\nEach block has a weight, and the weight of Block i is A_i.\nSnuke will perform the following operation on these blocks N times:\n\nChoose one block that is still not removed, and remove it.\nThe cost of this operation is the sum of the weights of the blocks that are connected to the block being removed (including itself).\nHere, two blocks x and y ( x \\leq y ) are connected when, for all z ( x \\leq z \\leq y ), Block z is still not removed.\n\nThere are N! possible orders in which Snuke removes the blocks.\nFor all of those N! orders, find the total cost of the N operations, and calculate the sum of those N! total costs.\nAs the answer can be extremely large, compute the sum modulo 10^9+7.\n\nConstraints\n\n1 \\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 A_2 ... A_N\n\nOutput\n\nFor all of the N! orders, find the total cost of the N operations, and print the sum of those N! total costs, modulo 10^9+7.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n9\n\nFirst, we will consider the order \"Block 1 -> Block 2\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 2, as only Block 2 remains.\nThus, the total cost of the two operations for this order is 3+2=5.\n\nThen, we will consider the order \"Block 2 -> Block 1\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 1, as only Block 1 remains.\nThus, the total cost of the two operations for this order is 3+1=4.\n\nTherefore, the answer is 5+4=9.\n\nSample Input 2\n\n4\n1 1 1 1\n\nSample Output 2\n\n212\n\nSample Input 3\n\n10\n1 2 4 8 16 32 64 128 256 512\n\nSample Output 3\n\n880971923", "sample_input": "2\n1 2\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03232", "source_text": "Score : 600 points\n\nProblem Statement\n\nThere are N blocks arranged in a row, numbered 1 to N from left to right.\nEach block has a weight, and the weight of Block i is A_i.\nSnuke will perform the following operation on these blocks N times:\n\nChoose one block that is still not removed, and remove it.\nThe cost of this operation is the sum of the weights of the blocks that are connected to the block being removed (including itself).\nHere, two blocks x and y ( x \\leq y ) are connected when, for all z ( x \\leq z \\leq y ), Block z is still not removed.\n\nThere are N! possible orders in which Snuke removes the blocks.\nFor all of those N! orders, find the total cost of the N operations, and calculate the sum of those N! total costs.\nAs the answer can be extremely large, compute the sum modulo 10^9+7.\n\nConstraints\n\n1 \\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 A_2 ... A_N\n\nOutput\n\nFor all of the N! orders, find the total cost of the N operations, and print the sum of those N! total costs, modulo 10^9+7.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n9\n\nFirst, we will consider the order \"Block 1 -> Block 2\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 2, as only Block 2 remains.\nThus, the total cost of the two operations for this order is 3+2=5.\n\nThen, we will consider the order \"Block 2 -> Block 1\".\nIn the first operation, the cost of the operation is 1+2=3, as Block 1 and 2 are connected.\nIn the second operation, the cost of the operation is 1, as only Block 1 remains.\nThus, the total cost of the two operations for this order is 3+1=4.\n\nTherefore, the answer is 5+4=9.\n\nSample Input 2\n\n4\n1 1 1 1\n\nSample Output 2\n\n212\n\nSample Input 3\n\n10\n1 2 4 8 16 32 64 128 256 512\n\nSample Output 3\n\n880971923", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1036, "memory_kb": 164896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s635337066", "group_id": "codeNet:p03233", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tv = Array{Int}(2,n)\n\tfor i in 1:n\n\t\tv[:,i] = readline() |> split |> parseMap\n\tend\n\tnum = [i for i in 1:n]\n\tsy = sum(v[1,:])\n\tsz = sum(v[2,:])\n\tx = [i for i in 1:n]\n\tg = Array{Int}(2,2*n)\n\tg[1,1:n] = x\n\tg[1,n+1:2*n] = x\n\tg[2,1:n] = v[1,:]\n\tg[2,n+1:2*n] = v[2,:]\n\tg = sortcols(g,by=y->y[2])\n\tsw = 0\n\tif length(Set(g[1,1:n])) < n\n\t\tsw = sum(g[2,1:n])\n\telseif g[1,n] != g[1,n+1]\n\t\tsw = sum(g[2,1:n+1])-g[2,n]\n\telse\n\t\tsw = min(sum(g[2,1:n+2])-g[2,n]-g[2,n+1],sum(g[2,1:n+1])-g[2,n-1])\n\tend\n\tprint(min(sy,sz,sw))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1545824135, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03233.html", "problem_id": "p03233", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03233/input.txt", "sample_output_relpath": "derived/input_output/data/p03233/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03233/Julia/s635337066.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s635337066", "user_id": "u095714878"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tv = Array{Int}(2,n)\n\tfor i in 1:n\n\t\tv[:,i] = readline() |> split |> parseMap\n\tend\n\tnum = [i for i in 1:n]\n\tsy = sum(v[1,:])\n\tsz = sum(v[2,:])\n\tx = [i for i in 1:n]\n\tg = Array{Int}(2,2*n)\n\tg[1,1:n] = x\n\tg[1,n+1:2*n] = x\n\tg[2,1:n] = v[1,:]\n\tg[2,n+1:2*n] = v[2,:]\n\tg = sortcols(g,by=y->y[2])\n\tsw = 0\n\tif length(Set(g[1,1:n])) < n\n\t\tsw = sum(g[2,1:n])\n\telseif g[1,n] != g[1,n+1]\n\t\tsw = sum(g[2,1:n+1])-g[2,n]\n\telse\n\t\tsw = min(sum(g[2,1:n+2])-g[2,n]-g[2,n+1],sum(g[2,1:n+1])-g[2,n-1])\n\tend\n\tprint(min(sy,sz,sw))\nend\n\nmain()", "problem_context": "Score : 700 points\n\nProblem Statement\n\nWe have a directed weighted graph with N vertices.\nEach vertex has two integers written on it, and the integers written on Vertex i are A_i and B_i.\n\nIn this graph, there is an edge from Vertex x to Vertex y for all pairs 1 \\leq x,y \\leq N, and its weight is {\\rm min}(A_x,B_y).\n\nWe will consider a directed cycle in this graph that visits every vertex exactly once.\nFind the minimum total weight of the edges in such a cycle.\n\nConstraints\n\n2 \\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\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the minimum total weight of the edges in such a cycle.\n\nSample Input 1\n\n3\n1 5\n4 2\n6 3\n\nSample Output 1\n\n7\n\nConsider the cycle 1→3→2→1. The weights of those edges are {\\rm min}(A_1,B_3)=1, {\\rm min}(A_3,B_2)=2 and {\\rm min}(A_2,B_1)=4, for a total of 7.\nAs there is no cycle with a total weight of less than 7, the answer is 7.\n\nSample Input 2\n\n4\n1 5\n2 6\n3 7\n4 8\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6\n19 92\n64 64\n78 48\n57 33\n73 6\n95 73\n\nSample Output 3\n\n227", "sample_input": "3\n1 5\n4 2\n6 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03233", "source_text": "Score : 700 points\n\nProblem Statement\n\nWe have a directed weighted graph with N vertices.\nEach vertex has two integers written on it, and the integers written on Vertex i are A_i and B_i.\n\nIn this graph, there is an edge from Vertex x to Vertex y for all pairs 1 \\leq x,y \\leq N, and its weight is {\\rm min}(A_x,B_y).\n\nWe will consider a directed cycle in this graph that visits every vertex exactly once.\nFind the minimum total weight of the edges in such a cycle.\n\nConstraints\n\n2 \\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\nA_2 B_2\n:\nA_N B_N\n\nOutput\n\nPrint the minimum total weight of the edges in such a cycle.\n\nSample Input 1\n\n3\n1 5\n4 2\n6 3\n\nSample Output 1\n\n7\n\nConsider the cycle 1→3→2→1. The weights of those edges are {\\rm min}(A_1,B_3)=1, {\\rm min}(A_3,B_2)=2 and {\\rm min}(A_2,B_1)=4, for a total of 7.\nAs there is no cycle with a total weight of less than 7, the answer is 7.\n\nSample Input 2\n\n4\n1 5\n2 6\n3 7\n4 8\n\nSample Output 2\n\n10\n\nSample Input 3\n\n6\n19 92\n64 64\n78 48\n57 33\n73 6\n95 73\n\nSample Output 3\n\n227", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 651, "cpu_time_ms": 2121, "memory_kb": 171272}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s559117407", "group_id": "codeNet:p03238", "input_text": "n = parse(Int32, readline())\nif n == 1\n println(\"Hello World\")\nelse\n b = parse(Int32, readline())\n c = parse(Int32, readline())\n println(\"$(b + c)\")\nend", "language": "Julia", "metadata": {"date": 1539304119, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s559117407.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s559117407", "user_id": "u394853232"}, "prompt_components": {"gold_output": "Hello World\n", "input_to_evaluate": "n = parse(Int32, readline())\nif n == 1\n println(\"Hello World\")\nelse\n b = parse(Int32, readline())\n c = parse(Int32, readline())\n println(\"$(b + c)\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 847, "memory_kb": 169700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s754500798", "group_id": "codeNet:p03239", "input_text": "function main()\n \n (N,T) = map(x -> parse(Int,x), split(readline()))\n \n \n ans = 10000\n \n for i in 1:N\n \n (c,t) = map(x -> parse(Int,x), split(readline()))\n \n if t <= T\n ans = min(ans,c)\n end\n \n end\n \n if ans == 10000\n println(\"TLE\")\n else\n println(ans)\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1582134378, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s754500798.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s754500798", "user_id": "u790457721"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function main()\n \n (N,T) = map(x -> parse(Int,x), split(readline()))\n \n \n ans = 10000\n \n for i in 1:N\n \n (c,t) = map(x -> parse(Int,x), split(readline()))\n \n if t <= T\n ans = min(ans,c)\n end\n \n end\n \n if ans == 10000\n println(\"TLE\")\n else\n println(ans)\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 436, "memory_kb": 115956}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s664349438", "group_id": "codeNet:p03241", "input_text": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\nfunction bsearch(a,x);l,r=0,length(a)+1;while r-l>1;m=(r+l)>>1;if a[m] split |> parseMap\n\ti = 1\n\ta = Int[]\n\twhile i1;m=(r+l)>>1;if a[m] split |> parseMap\n\ti = 1\n\ta = Int[]\n\twhile i split |> parseMap\n\tprintln(m%n)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1590623437, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s288403492.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s288403492", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x)=parse(Int, x)\nparseMap(x::Array{SubString{String},1})=map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\tprintln(m%n)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 349, "memory_kb": 112076}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s409774689", "group_id": "codeNet:p03241", "input_text": "function main()\n\tn = parse.(split(readline()))\n\ti = 1\n\td = 0\n\twhile i <= sqrt(n[2]) && i <= n[2]/n[1]\n\t\ti += 1\n\t\tif n[2] % i == 0\n\t\t\td = i\n\t\tend\n\tend\n\tprint(d)\nend\n\n\nmain()\n", "language": "Julia", "metadata": {"date": 1540382471, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s409774689.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s409774689", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n\tn = parse.(split(readline()))\n\ti = 1\n\td = 0\n\twhile i <= sqrt(n[2]) && i <= n[2]/n[1]\n\t\ti += 1\n\t\tif n[2] % i == 0\n\t\t\td = i\n\t\tend\n\tend\n\tprint(d)\nend\n\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 556, "memory_kb": 123656}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s425496108", "group_id": "codeNet:p03242", "input_text": "a=readline()\nb=\"aaa\"\nfor i=1:3\nif a[i]==\"1\"\nb[i]==\"9\"\nelse b[i]==\"1\"\nend\nend\nprintln(parse(Int,b))", "language": "Julia", "metadata": {"date": 1538530943, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s425496108.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s425496108", "user_id": "u666862724"}, "prompt_components": {"gold_output": "991\n", "input_to_evaluate": "a=readline()\nb=\"aaa\"\nfor i=1:3\nif a[i]==\"1\"\nb[i]==\"9\"\nelse b[i]==\"1\"\nend\nend\nprintln(parse(Int,b))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1266, "memory_kb": 200156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s200788605", "group_id": "codeNet:p03243", "input_text": "println(111cld(parse(readlen()),111))", "language": "Julia", "metadata": {"date": 1561218455, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s200788605.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s200788605", "user_id": "u729133443"}, "prompt_components": {"gold_output": "111\n", "input_to_evaluate": "println(111cld(parse(readlen()),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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 700, "memory_kb": 142276}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s140810614", "group_id": "codeNet:p03244", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction main()\n n=parseInt(readline())\n v=parseMap(split(readline()))\n cnt=Dict{Int,Int}()\n for i in v\n try\n cnt[i]+=1\n catch\n cnt[i]=1\n end\n end\n OddMax=[0,0,0,0] #奇数で1番目に多い数,その個数,2番目に多い数,その個数\n EvenMax=[0,0,0,0] #偶数で1番目に多い数,その個数,2番目に多い数,その個数\n # for (i,val) in enumerate(v)\n # num=cnt[val]\n # if i%2==1\n # if OddMax[2] k\n\t\t\t\tfor i in 2:init\n\t\t\t\t\tprintln(i-1, \" \", i)\n\t\t\t\tend\n\t\t\t\tfor i in init+1:n\n\t\t\t\t\tprintln(1, \" \", i)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tth = s[div(n,2)]=='1'?1:0\n\t\t\t\tnow = 1\n\t\t\t\tfor i in 2:k\n\t\t\t\t\tprintln(now, \" \", i+1)\n\t\t\t\t\tif s[i] == '1'\n\t\t\t\t\t\tnow += 1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif th == 0\n\t\t\t\t\tfor i in k+1:n\n\t\t\t\t\t\tprintln(1, \" \", i)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tprintln(1, \" \", k+1)\n\t\t\t\t\tfor i in k+2:n\n\t\t\t\t\t\tprintln(k+1, \" \", i)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend\nmain()", "language": "Julia", "metadata": {"date": 1551491068, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03248.html", "problem_id": "p03248", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03248/input.txt", "sample_output_relpath": "derived/input_output/data/p03248/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03248/Julia/s902453058.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s902453058", "user_id": "u095714878"}, "prompt_components": {"gold_output": "-1\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ts = chomp(readline())\n\tn = length(s)\n\tif s[1] == '0' || s[n-1] == '0' || s[n] == '1'\n\t\tprintln(-1)\n\telse\n\t\tflg = 0\n\t\tk = div(n-1,2)\n\t\tfor i in 1:k\n\t\t\tif s[i+1] != s[n-1-i]\n\t\t\t\tflg = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tif flg == 1\n\t\t\tprintln(-1)\n\t\telse\n\t\t\tinit = n\n\t\t\tfor i in 1:n-2\n\t\t\t\tif s[i] == '0'\n\t\t\t\t\tinit = i\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tif init > k\n\t\t\t\tfor i in 2:init\n\t\t\t\t\tprintln(i-1, \" \", i)\n\t\t\t\tend\n\t\t\t\tfor i in init+1:n\n\t\t\t\t\tprintln(1, \" \", i)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tth = s[div(n,2)]=='1'?1:0\n\t\t\t\tnow = 1\n\t\t\t\tfor i in 2:k\n\t\t\t\t\tprintln(now, \" \", i+1)\n\t\t\t\t\tif s[i] == '1'\n\t\t\t\t\t\tnow += 1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tif th == 0\n\t\t\t\t\tfor i in k+1:n\n\t\t\t\t\t\tprintln(1, \" \", i)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tprintln(1, \" \", k+1)\n\t\t\t\t\tfor i in k+2:n\n\t\t\t\t\t\tprintln(k+1, \" \", i)\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend\nmain()", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "sample_input": "1111\n"}, "reference_outputs": ["-1\n"], "source_document_id": "p03248", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given a string s of length n.\nDoes a tree with n vertices that satisfies the following conditions exist?\n\nThe vertices are numbered 1,2,..., n.\n\nThe edges are numbered 1,2,..., n-1, and Edge i connects Vertex u_i and v_i.\n\nIf the i-th character in s is 1, we can have a connected component of size i by removing one edge from the tree.\n\nIf the i-th character in s is 0, we cannot have a connected component of size i by removing any one edge from the tree.\n\nIf such a tree exists, construct one such tree.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\ns is a string of length n consisting of 0 and 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf a tree with n vertices that satisfies the conditions does not exist, print -1.\n\nIf a tree with n vertices that satisfies the conditions exist, print n-1 lines.\nThe i-th line should contain u_i and v_i with a space in between.\nIf there are multiple trees that satisfy the conditions, any such tree will be accepted.\n\nSample Input 1\n\n1111\n\nSample Output 1\n\n-1\n\nIt is impossible to have a connected component of size n after removing one edge from a tree with n vertices.\n\nSample Input 2\n\n1110\n\nSample Output 2\n\n1 2\n2 3\n3 4\n\nIf Edge 1 or Edge 3 is removed, we will have a connected component of size 1 and another of size 3. If Edge 2 is removed, we will have two connected components, each of size 2.\n\nSample Input 3\n\n1010\n\nSample Output 3\n\n1 2\n1 3\n1 4\n\nRemoving any edge will result in a connected component of size 1 and another of size 3.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 695, "memory_kb": 155776}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s472196916", "group_id": "codeNet:p03252", "input_text": "function main()\n\ts = readline()\n\tt = readline()\n\tds = Dict{Char, Int}()\n\tdt = Dict{Char, Int}()\n\tss = Array{Int}(length(s))\n\tst = Array{Int}(length(s))\n\tfor i in 1:length(s)\n\t\tif haskey(ds, s[i])\n\t\t\tds[s[i]] += 1\n\t\telse\n\t\t\tds[s[i]] = 1\n\t\tend\n\t\tss[i] = ds[s[i]]\n\tend\n\tfor i in 1:length(s)\n\t\tif haskey(dt, t[i])\n\t\t\tdt[t[i]] += 1\n\t\telse\n\t\t\tdt[t[i]] = 1\n\t\tend\n\t\tst[i] = dt[t[i]]\n\tend\n\tif ss == st\n\t\tprint(\"Yes\")\n\telse\n\t\tprint(\"No\")\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541191525, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s472196916.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s472196916", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n\ts = readline()\n\tt = readline()\n\tds = Dict{Char, Int}()\n\tdt = Dict{Char, Int}()\n\tss = Array{Int}(length(s))\n\tst = Array{Int}(length(s))\n\tfor i in 1:length(s)\n\t\tif haskey(ds, s[i])\n\t\t\tds[s[i]] += 1\n\t\telse\n\t\t\tds[s[i]] = 1\n\t\tend\n\t\tss[i] = ds[s[i]]\n\tend\n\tfor i in 1:length(s)\n\t\tif haskey(dt, t[i])\n\t\t\tdt[t[i]] += 1\n\t\telse\n\t\t\tdt[t[i]] = 1\n\t\tend\n\t\tst[i] = dt[t[i]]\n\tend\n\tif ss == st\n\t\tprint(\"Yes\")\n\telse\n\t\tprint(\"No\")\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 674, "memory_kb": 154172}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s922201879", "group_id": "codeNet:p03253", "input_text": "N,M=map(x->parse(Int,x),split(readline()))\ni=2\nans=1\nmod=10^9+7\np(a,b)=b>0 ? p(a*a%mod,b>>1)*(b%2>0 ? a : 1)%mod : 1\nfunction comb(a,b)\n\tx=y=1\n\tfor i=1:b\n\t\ty=y*i%mod\n\t\tx=x*(a-i+1)%mod\n\tend\n\tx*p(y,mod-2)%mod\nend\nwhile i*i<=M\n\tc=0\n\twhile M%i==0\n\t\tc+=1\n\t\tM=div(M,i)\n\tend\n\tans=ans*comb(c+N-1,c)%mod\n\ti+=1\nend\nif M>1\n\tans=ans*N%mod\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1561300596, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03253.html", "problem_id": "p03253", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03253/input.txt", "sample_output_relpath": "derived/input_output/data/p03253/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03253/Julia/s922201879.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s922201879", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "N,M=map(x->parse(Int,x),split(readline()))\ni=2\nans=1\nmod=10^9+7\np(a,b)=b>0 ? p(a*a%mod,b>>1)*(b%2>0 ? a : 1)%mod : 1\nfunction comb(a,b)\n\tx=y=1\n\tfor i=1:b\n\t\ty=y*i%mod\n\t\tx=x*(a-i+1)%mod\n\tend\n\tx*p(y,mod-2)%mod\nend\nwhile i*i<=M\n\tc=0\n\twhile M%i==0\n\t\tc+=1\n\t\tM=div(M,i)\n\tend\n\tans=ans*comb(c+N-1,c)%mod\n\ti+=1\nend\nif M>1\n\tans=ans*N%mod\nend\nprintln(ans)\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\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 number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "sample_input": "2 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03253", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\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 number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 344, "cpu_time_ms": 403, "memory_kb": 111820}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s261191006", "group_id": "codeNet:p03253", "input_text": "const MOD = Int64(10^9 + 7)\n\nfunction main()\n n, m = map(s -> parse(Int64, s), split(readline()))\n answer = Int64(1)\n i = Int64(2)\n\n while i * i <= m\n if mod(m, i) == 0\n count = Int64(0)\n while mod(m, i) == 0\n count += 1\n m /= i\n end\n answer = mod(answer * modcomb(n + count - 1, count), MOD)\n end\n i += 1\n end\n\n if m > 1\n answer = mod(answer * n, MOD)\n end\n\n println(answer)\nend\n\nfunction modcomb(n::Integer, k::Integer)\n if n - k < k return modcomb(n, n - k) end\n numer = one(n)\n denom = one(n)\n for i = 0:k - 1\n numer = mod(numer * (n - i), MOD)\n denom = mod(denom * (i + 1), MOD)\n end\n return mod(numer * modpow(denom, MOD - 2), MOD)\nend\n\nfunction modpow(a::Integer, p::Integer)\n if p == 0\n return one(a)\n elseif mod(p, 2) == 0\n return mod(modpow(a, div(p, 2))^2, MOD)\n else\n return mod(a * modpow(a, p - 1), MOD)\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1554969410, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03253.html", "problem_id": "p03253", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03253/input.txt", "sample_output_relpath": "derived/input_output/data/p03253/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03253/Julia/s261191006.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s261191006", "user_id": "u081445141"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "const MOD = Int64(10^9 + 7)\n\nfunction main()\n n, m = map(s -> parse(Int64, s), split(readline()))\n answer = Int64(1)\n i = Int64(2)\n\n while i * i <= m\n if mod(m, i) == 0\n count = Int64(0)\n while mod(m, i) == 0\n count += 1\n m /= i\n end\n answer = mod(answer * modcomb(n + count - 1, count), MOD)\n end\n i += 1\n end\n\n if m > 1\n answer = mod(answer * n, MOD)\n end\n\n println(answer)\nend\n\nfunction modcomb(n::Integer, k::Integer)\n if n - k < k return modcomb(n, n - k) end\n numer = one(n)\n denom = one(n)\n for i = 0:k - 1\n numer = mod(numer * (n - i), MOD)\n denom = mod(denom * (i + 1), MOD)\n end\n return mod(numer * modpow(denom, MOD - 2), MOD)\nend\n\nfunction modpow(a::Integer, p::Integer)\n if p == 0\n return one(a)\n elseif mod(p, 2) == 0\n return mod(modpow(a, div(p, 2))^2, MOD)\n else\n return mod(a * modpow(a, p - 1), MOD)\n end\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\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 number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "sample_input": "2 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03253", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\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 number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 914, "cpu_time_ms": 461, "memory_kb": 117884}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s230329892", "group_id": "codeNet:p03253", "input_text": "const MOD = Int64(10^9 + 7)\n\nfunction main()\n n, m = map(s -> parse(Int64, s), split(readline()))\n answer = Int64(1)\n i = Int64(2)\n\n while i * i <= m\n if m % i == 0\n count = Int64(0)\n while m % i == 0\n count += 1\n m /= i\n end\n answer *= modcomb(n + count - 1, count)\n answer %= MOD\n end\n i += 1\n end\n\n if m > 1\n answer *= n\n answer %= MOD\n end\n\n println(answer)\nend\n\nfunction modcomb(n::Integer, k::Integer)\n if n - k < k return modcomb(n, n - k) end\n numer = one(n)\n denom = one(n)\n for i = 0:k - 1\n numer *= n - i\n denom *= i + 1\n numer %= MOD\n denom %= MOD\n end\n return numer * modpow(denom, MOD - 2) % MOD\nend\n\nfunction modpow(a::Integer, p::Integer)\n if p == 0\n return 1\n elseif p % 2 == 0\n return modpow(a, Int64(p / 2))^2 % MOD\n else\n return a * modpow(a, p - 1) % MOD\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1553337730, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03253.html", "problem_id": "p03253", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03253/input.txt", "sample_output_relpath": "derived/input_output/data/p03253/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03253/Julia/s230329892.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s230329892", "user_id": "u081445141"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "const MOD = Int64(10^9 + 7)\n\nfunction main()\n n, m = map(s -> parse(Int64, s), split(readline()))\n answer = Int64(1)\n i = Int64(2)\n\n while i * i <= m\n if m % i == 0\n count = Int64(0)\n while m % i == 0\n count += 1\n m /= i\n end\n answer *= modcomb(n + count - 1, count)\n answer %= MOD\n end\n i += 1\n end\n\n if m > 1\n answer *= n\n answer %= MOD\n end\n\n println(answer)\nend\n\nfunction modcomb(n::Integer, k::Integer)\n if n - k < k return modcomb(n, n - k) end\n numer = one(n)\n denom = one(n)\n for i = 0:k - 1\n numer *= n - i\n denom *= i + 1\n numer %= MOD\n denom %= MOD\n end\n return numer * modpow(denom, MOD - 2) % MOD\nend\n\nfunction modpow(a::Integer, p::Integer)\n if p == 0\n return 1\n elseif p % 2 == 0\n return modpow(a, Int64(p / 2))^2 % MOD\n else\n return a * modpow(a, p - 1) % MOD\n end\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\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 number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "sample_input": "2 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03253", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\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 number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 886, "cpu_time_ms": 389, "memory_kb": 114692}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s519630454", "group_id": "codeNet:p03253", "input_text": "const MOD = Int64(10^9 + 7)\n\nfunction main()\n n, m = map(s -> parse(Int64, s), split(readline()))\n answer = Int64(1)\n i = Int64(2)\n\n while i * i <= m\n if m % i == 0\n count = Int64(0)\n while m % i == 0\n count += 1\n m /= i\n end\n answer *= comb(n + count - 1, count)\n answer %= MOD\n end\n i += 1\n end\n\n if m > 1\n answer *= n\n answer %= MOD\n end\n\n println(answer)\nend\n\nfunction comb(n::Integer, k::Integer)\n if (n - k < k) return comb(n, n - k) end\n nume = Int64(1)\n deno = Int64(1)\n for i = 0:k - 1\n nume *= n - i\n deno *= i + 1\n nume %= MOD\n deno %= MOD\n end\n return nume * modpow(deno, MOD - 2) % MOD\nend\n\nfunction modpow(a::Integer, p::Integer)\n if p == 0\n return 1\n elseif p % 2 == 0\n return modpow(a, Int64(p / 2))^2 % MOD\n else\n return a * modpow(a, p - 1) % MOD\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1552907012, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03253.html", "problem_id": "p03253", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03253/input.txt", "sample_output_relpath": "derived/input_output/data/p03253/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03253/Julia/s519630454.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s519630454", "user_id": "u081445141"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "const MOD = Int64(10^9 + 7)\n\nfunction main()\n n, m = map(s -> parse(Int64, s), split(readline()))\n answer = Int64(1)\n i = Int64(2)\n\n while i * i <= m\n if m % i == 0\n count = Int64(0)\n while m % i == 0\n count += 1\n m /= i\n end\n answer *= comb(n + count - 1, count)\n answer %= MOD\n end\n i += 1\n end\n\n if m > 1\n answer *= n\n answer %= MOD\n end\n\n println(answer)\nend\n\nfunction comb(n::Integer, k::Integer)\n if (n - k < k) return comb(n, n - k) end\n nume = Int64(1)\n deno = Int64(1)\n for i = 0:k - 1\n nume *= n - i\n deno *= i + 1\n nume %= MOD\n deno %= MOD\n end\n return nume * modpow(deno, MOD - 2) % MOD\nend\n\nfunction modpow(a::Integer, p::Integer)\n if p == 0\n return 1\n elseif p % 2 == 0\n return modpow(a, Int64(p / 2))^2 % MOD\n else\n return a * modpow(a, p - 1) % MOD\n end\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\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 number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "sample_input": "2 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03253", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\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 number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 875, "cpu_time_ms": 958, "memory_kb": 170000}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s217273790", "group_id": "codeNet:p03253", "input_text": "function main()\n n, m = map(s -> parse(Int, s), split(readline()))\n mod = 10^9 + 7\n ans = 1\n i = 2\n\n while i * i <= m\n if m % i == 0\n count = 0\n while m % i == 0\n count += 1\n m /= i\n end\n ans *= comb(n + count - 1, count, mod)\n ans %= mod\n end\n i += 1\n end\n\n if m > 1\n ans *= n\n ans %= mod\n end\n\n println(ans)\nend\n\nfunction comb(n, k, m)\n if (n - k < k) return comb(n, n - k, m) end\n nume = 1\n deno = 1\n for i = 0:k - 1\n nume *= n - i\n deno *= i + 1\n nume %= m\n deno %= m\n end\n return (nume * modpow(deno, m - 2, m)) % m\nend\n\nfunction modpow(a, p, m)\n if p == 0\n return 1\n elseif p % 2 == 0\n return modpow(a, p / 2, m)^2 % m\n else\n return a * modpow(a, p - 1, m) % m\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1539389303, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03253.html", "problem_id": "p03253", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03253/input.txt", "sample_output_relpath": "derived/input_output/data/p03253/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03253/Julia/s217273790.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s217273790", "user_id": "u081445141"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function main()\n n, m = map(s -> parse(Int, s), split(readline()))\n mod = 10^9 + 7\n ans = 1\n i = 2\n\n while i * i <= m\n if m % i == 0\n count = 0\n while m % i == 0\n count += 1\n m /= i\n end\n ans *= comb(n + count - 1, count, mod)\n ans %= mod\n end\n i += 1\n end\n\n if m > 1\n ans *= n\n ans %= mod\n end\n\n println(ans)\nend\n\nfunction comb(n, k, m)\n if (n - k < k) return comb(n, n - k, m) end\n nume = 1\n deno = 1\n for i = 0:k - 1\n nume *= n - i\n deno *= i + 1\n nume %= m\n deno %= m\n end\n return (nume * modpow(deno, m - 2, m)) % m\nend\n\nfunction modpow(a, p, m)\n if p == 0\n return 1\n elseif p % 2 == 0\n return modpow(a, p / 2, m)^2 % m\n else\n return a * modpow(a, p - 1, m) % m\n end\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\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 number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "sample_input": "2 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03253", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou are given positive integers N and M.\n\nHow many sequences a of length N consisting of positive integers satisfy a_1 \\times a_2 \\times ... \\times a_N = M? Find the count modulo 10^9+7.\n\nHere, two sequences a' and a'' are considered different when there exists some i such that a_i' \\neq a_i''.\n\nConstraints\n\nAll values in input are integers.\n\n1 \\leq N \\leq 10^5\n\n1 \\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 number of the sequences consisting of positive integers that satisfy the condition, modulo 10^9 + 7.\n\nSample Input 1\n\n2 6\n\nSample Output 1\n\n4\n\nFour sequences satisfy the condition: \\{a_1, a_2\\} = \\{1, 6\\}, \\{2, 3\\}, \\{3, 2\\} and \\{6, 1\\}.\n\nSample Input 2\n\n3 12\n\nSample Output 2\n\n18\n\nSample Input 3\n\n100000 1000000000\n\nSample Output 3\n\n957870001", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 778, "cpu_time_ms": 399, "memory_kb": 113192}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s062762570", "group_id": "codeNet:p03254", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n,x=pM(split(readline()))\n a=sort(pM(split(readline())))\n ans=0\n while x>0 && !isempty(a)\n v=splice!(a,1)\n if x>=v; ans+=1; end\n x-v\n end\n println(ans)\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1591737329, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s062762570.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s062762570", "user_id": "u443151804"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n,x=pM(split(readline()))\n a=sort(pM(split(readline())))\n ans=0\n while x>0 && !isempty(a)\n v=splice!(a,1)\n if x>=v; ans+=1; end\n x-v\n end\n println(ans)\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 814, "memory_kb": 169204}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s974451678", "group_id": "codeNet:p03264", "input_text": "function main()\n\tk = parse(Int64, readline(STDIN))\n\tif k % 2 == 0\n\t\ty=k*k/4\n\telse\n\t\ty=(k+1)*(k-1)/4\n\tend\n\tprintln(y)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1535851280, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s974451678.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s974451678", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n\tk = parse(Int64, readline(STDIN))\n\tif k % 2 == 0\n\t\ty=k*k/4\n\telse\n\t\ty=(k+1)*(k-1)/4\n\tend\n\tprintln(y)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 562, "memory_kb": 114668}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s636099029", "group_id": "codeNet:p03264", "input_text": " function Main()\n \tx = readline()\n if x%2 == 0\n \ty=x*x/4\n else\n y=(x+1)*(x-1)/4\n end\n println(y)\n end\n \n Main()", "language": "Julia", "metadata": {"date": 1535850616, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s636099029.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s636099029", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": " function Main()\n \tx = readline()\n if x%2 == 0\n \ty=x*x/4\n else\n y=(x+1)*(x-1)/4\n end\n println(y)\n end\n \n 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 140952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s955427316", "group_id": "codeNet:p03265", "input_text": "function main()\n \n (x1,y1,x2,y2) = map(x -> parse(Int,x), split(readline()))\n \n c1 = [x1;y1]\n c2 = [x2;y2]\n \n c3 = [0 1;-1 0]*(c1-c2) + c2\n c4 = [0 1;-1 0]*(c2-c3) + c3\n \n println(c3[1,1],\" \",c3[2,1],\" \",c4[1,1],\" \",c4[2,1])\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1581532837, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s955427316.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s955427316", "user_id": "u790457721"}, "prompt_components": {"gold_output": "-1 1 -1 0\n", "input_to_evaluate": "function main()\n \n (x1,y1,x2,y2) = map(x -> parse(Int,x), split(readline()))\n \n c1 = [x1;y1]\n c2 = [x2;y2]\n \n c3 = [0 1;-1 0]*(c1-c2) + c2\n c4 = [0 1;-1 0]*(c2-c3) + c3\n \n println(c3[1,1],\" \",c3[2,1],\" \",c4[1,1],\" \",c4[2,1])\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 936, "memory_kb": 168876}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s635216739", "group_id": "codeNet:p03265", "input_text": "const lines=readlines()\nstate=0\ninput()=lines[global state+=1]\nint(s::String)=parse(Int32,s)\nintSub(s::SubString{String})=parse(Int32,s)\nfloatSub(s::SubString{String})=parse(Float64,s)\nintLine()=map(intSub,split(input()))\nfunction main()\n a,b,c,d=intLine()\n println(\"$(c-d+b) $(d+c-a) $(a-d+b) $(b+c-a)\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1561220163, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s635216739.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s635216739", "user_id": "u729133443"}, "prompt_components": {"gold_output": "-1 1 -1 0\n", "input_to_evaluate": "const lines=readlines()\nstate=0\ninput()=lines[global state+=1]\nint(s::String)=parse(Int32,s)\nintSub(s::SubString{String})=parse(Int32,s)\nfloatSub(s::SubString{String})=parse(Float64,s)\nintLine()=map(intSub,split(input()))\nfunction main()\n a,b,c,d=intLine()\n println(\"$(c-d+b) $(d+c-a) $(a-d+b) $(b+c-a)\")\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 937, "memory_kb": 175172}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s764094309", "group_id": "codeNet:p03266", "input_text": "function main()\n\tx = parse.(split(readline()))\n\tcount = 0\n\tn = x[1]\n\tk = x[2]\n\tq = div(2*n,k)\n\tfor i in 1:q\n\t\tfor j in 1:n\n\t\t\ta = j\n\t\t\tb = k*i-j\n\t\t\tif b>0 && b<=n && a%k == b%k\n\t\t\t\tx = a%k\n\t\t\t\tif k-x <= n\n\t\t\t\t\tcount += 1\n\t\t\t\t\tz = div(n-k+x,k)\n\t\t\t\t\tcount += z\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tprint(count)\nend\n \nmain()", "language": "Julia", "metadata": {"date": 1541453108, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s764094309.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s764094309", "user_id": "u095714878"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "function main()\n\tx = parse.(split(readline()))\n\tcount = 0\n\tn = x[1]\n\tk = x[2]\n\tq = div(2*n,k)\n\tfor i in 1:q\n\t\tfor j in 1:n\n\t\t\ta = j\n\t\t\tb = k*i-j\n\t\t\tif b>0 && b<=n && a%k == b%k\n\t\t\t\tx = a%k\n\t\t\t\tif k-x <= n\n\t\t\t\t\tcount += 1\n\t\t\t\t\tz = div(n-k+x,k)\n\t\t\t\t\tcount += z\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tprint(count)\nend\n \nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 154376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s430066593", "group_id": "codeNet:p03266", "input_text": "function main()\n\tx = split(readline())\n\tn = parse(Int64, x[1])\n\tk = parse(Int64, x[2])\n\tcount = 0\n\tfor i in 1:n\n\t\tfor j in 1:n\n\t\t\tfor l in 1:n\n\t\t\t\tif k % (i+j) == 0\n\t\t\t\t\tif k % (j+l) == 0\n\t\t\t\t\t\tif k % (i+l) == 0\n\t\t\t\t\t\t\tcount +=1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tprintln(count)\nend", "language": "Julia", "metadata": {"date": 1535853408, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s430066593.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s430066593", "user_id": "u095714878"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "function main()\n\tx = split(readline())\n\tn = parse(Int64, x[1])\n\tk = parse(Int64, x[2])\n\tcount = 0\n\tfor i in 1:n\n\t\tfor j in 1:n\n\t\t\tfor l in 1:n\n\t\t\t\tif k % (i+j) == 0\n\t\t\t\t\tif k % (j+l) == 0\n\t\t\t\t\t\tif k % (i+l) == 0\n\t\t\t\t\t\t\tcount +=1\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tprintln(count)\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 559, "memory_kb": 109008}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s011613331", "group_id": "codeNet:p03267", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tl = readline() |> parseInt\n\tn = 0\n\twhile 2^n<=l\n\t\tn+=1\n\tend\n\ta = Tuple{Int,Int,Int}[]\n\tk = 0\n\tfor i in 1:n-1\n\t\tpush!(a,(i,i+1,2^(i-1)))\n\t\tpush!(a,(i,i+1,0))\n\t\tif 2^(i-1)+2^(n-1)<=l\n\t\t\tpush!(a,(i,n,l-(2^(i-1))))\n\t\tend\n\tend\n\tm = length(a)\n\tprintln(m)\n\tfor i in 1:m\n\t\tprintln(a[i][1],\" \",a[i][2],\" \",a[i][3])\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1572533096, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03267.html", "problem_id": "p03267", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03267/input.txt", "sample_output_relpath": "derived/input_output/data/p03267/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03267/Julia/s011613331.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s011613331", "user_id": "u095714878"}, "prompt_components": {"gold_output": "8 10\n1 2 0\n2 3 0\n3 4 0\n1 5 0\n2 6 0\n3 7 0\n4 8 0\n5 6 1\n6 7 1\n7 8 1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tl = readline() |> parseInt\n\tn = 0\n\twhile 2^n<=l\n\t\tn+=1\n\tend\n\ta = Tuple{Int,Int,Int}[]\n\tk = 0\n\tfor i in 1:n-1\n\t\tpush!(a,(i,i+1,2^(i-1)))\n\t\tpush!(a,(i,i+1,0))\n\t\tif 2^(i-1)+2^(n-1)<=l\n\t\t\tpush!(a,(i,n,l-(2^(i-1))))\n\t\tend\n\tend\n\tm = length(a)\n\tprintln(m)\n\tfor i in 1:m\n\t\tprintln(a[i][1],\" \",a[i][2],\" \",a[i][3])\n\tend\nend\n\nmain()", "problem_context": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer L. Construct a directed graph that satisfies the conditions below. The graph may contain multiple edges between the same pair of vertices. It can be proved that such a graph always exists.\n\nThe number of vertices, N, is at most 20. The vertices are given ID numbers from 1 to N.\n\nThe number of edges, M, is at most 60. Each edge has an integer length between 0 and 10^6 (inclusive).\n\nEvery edge is directed from the vertex with the smaller ID to the vertex with the larger ID. That is, 1,2,...,N is one possible topological order of the vertices.\n\nThere are exactly L different paths from Vertex 1 to Vertex N. The lengths of these paths are all different, and they are integers between 0 and L-1.\n\nHere, the length of a path is the sum of the lengths of the edges contained in that path, and two paths are considered different when the sets of the edges contained in those paths are different.\n\nConstraints\n\n2 \\leq L \\leq 10^6\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nIn the first line, print N and M, the number of the vertices and edges in your graph.\nIn the i-th of the following M lines, print three integers u_i,v_i and w_i, representing the starting vertex, the ending vertex and the length of the i-th edge.\nIf there are multiple solutions, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n8 10\n1 2 0\n2 3 0\n3 4 0\n1 5 0\n2 6 0\n3 7 0\n4 8 0\n5 6 1\n6 7 1\n7 8 1\n\nIn the graph represented by the sample output, there are four paths from Vertex 1 to N=8:\n\n1 → 2 → 3 → 4 → 8 with length 0\n\n1 → 2 → 3 → 7 → 8 with length 1\n\n1 → 2 → 6 → 7 → 8 with length 2\n\n1 → 5 → 6 → 7 → 8 with length 3\n\nThere are other possible solutions.\n\nSample Input 2\n\n5\n\nSample Output 2\n\n5 7\n1 2 0\n2 3 1\n3 4 0\n4 5 0\n2 4 0\n1 3 3\n3 5 1", "sample_input": "4\n"}, "reference_outputs": ["8 10\n1 2 0\n2 3 0\n3 4 0\n1 5 0\n2 6 0\n3 7 0\n4 8 0\n5 6 1\n6 7 1\n7 8 1\n"], "source_document_id": "p03267", "source_text": "Score : 700 points\n\nProblem Statement\n\nYou are given an integer L. Construct a directed graph that satisfies the conditions below. The graph may contain multiple edges between the same pair of vertices. It can be proved that such a graph always exists.\n\nThe number of vertices, N, is at most 20. The vertices are given ID numbers from 1 to N.\n\nThe number of edges, M, is at most 60. Each edge has an integer length between 0 and 10^6 (inclusive).\n\nEvery edge is directed from the vertex with the smaller ID to the vertex with the larger ID. That is, 1,2,...,N is one possible topological order of the vertices.\n\nThere are exactly L different paths from Vertex 1 to Vertex N. The lengths of these paths are all different, and they are integers between 0 and L-1.\n\nHere, the length of a path is the sum of the lengths of the edges contained in that path, and two paths are considered different when the sets of the edges contained in those paths are different.\n\nConstraints\n\n2 \\leq L \\leq 10^6\n\nL is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nL\n\nOutput\n\nIn the first line, print N and M, the number of the vertices and edges in your graph.\nIn the i-th of the following M lines, print three integers u_i,v_i and w_i, representing the starting vertex, the ending vertex and the length of the i-th edge.\nIf there are multiple solutions, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n8 10\n1 2 0\n2 3 0\n3 4 0\n1 5 0\n2 6 0\n3 7 0\n4 8 0\n5 6 1\n6 7 1\n7 8 1\n\nIn the graph represented by the sample output, there are four paths from Vertex 1 to N=8:\n\n1 → 2 → 3 → 4 → 8 with length 0\n\n1 → 2 → 3 → 7 → 8 with length 1\n\n1 → 2 → 6 → 7 → 8 with length 2\n\n1 → 5 → 6 → 7 → 8 with length 3\n\nThere are other possible solutions.\n\nSample Input 2\n\n5\n\nSample Output 2\n\n5 7\n1 2 0\n2 3 1\n3 4 0\n4 5 0\n2 4 0\n1 3 3\n3 5 1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 346, "memory_kb": 111184}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s606718349", "group_id": "codeNet:p03273", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n h,w=parse.(Int,split(readline()))\n a=[chomp(readline()) for i = 1:h]\n tate=Bool[false for i=1:h]\n yoko=Bool[false for i=1:w]\n for i=1:h\n for j=1:w\n if a[i][j]=='#'; tate[i]=true; yoko[j]=true; end\n end\n end\n for i=1:h\n flag=false\n for j=1:w\n if tate[i]==true && yoko[j]==true; print(a[i][j]);flag=true; end\n end\n if flag == true; println(); end\n end\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1594171793, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s606718349.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s606718349", "user_id": "u443151804"}, "prompt_components": {"gold_output": "###\n###\n.##\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n h,w=parse.(Int,split(readline()))\n a=[chomp(readline()) for i = 1:h]\n tate=Bool[false for i=1:h]\n yoko=Bool[false for i=1:w]\n for i=1:h\n for j=1:w\n if a[i][j]=='#'; tate[i]=true; yoko[j]=true; end\n end\n end\n for i=1:h\n flag=false\n for j=1:w\n if tate[i]==true && yoko[j]==true; print(a[i][j]);flag=true; end\n end\n if flag == true; println(); end\n end\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 609, "cpu_time_ms": 302, "memory_kb": 179100}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s347482135", "group_id": "codeNet:p03274", "input_text": "N,K=map(x->parse(Int,x),split(readline()))\nX=map(x->parse(Int,x),split(readline()))\nans=10^15\nfor i=K:N\n\tL=X[i-K+1]\n\tR=X[i]\n\tif R<0\n\t\tans=min(ans,-L)\n\telseif L>0\n\t\tans=min(ans,R)\n\telse\n\t\tans=min(ans,R-2L,-L+2R)\n\tend\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1561302254, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s347482135.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s347482135", "user_id": "u657913472"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "N,K=map(x->parse(Int,x),split(readline()))\nX=map(x->parse(Int,x),split(readline()))\nans=10^15\nfor i=K:N\n\tL=X[i-K+1]\n\tR=X[i]\n\tif R<0\n\t\tans=min(ans,-L)\n\telseif L>0\n\t\tans=min(ans,R)\n\telse\n\t\tans=min(ans,R-2L,-L+2R)\n\tend\nend\nprintln(ans)\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 438, "memory_kb": 128280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s123984238", "group_id": "codeNet:p03274", "input_text": "function parseInt(x) parse(Int, x) end\nfunction main()\n n = parseInt.(split(readline()))\n x = parseInt.(split(readline()))\n y = [0 for i in 1:n[1]-n[2]+1]\n for i in 1:n[1]-n[2]+1\n z = x[i+n[2]-1]\n if x[i]*z >= 0\n y[i] = max(abs(x[i]),abs(z))\n else\n if x[i] > z\n y[i] = -(z*2)+x[i]\n else\n y[i] = z-x[i]*2\n end\n end\n end\n print(minimum(y))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1540906334, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s123984238.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s123984238", "user_id": "u095714878"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\nfunction main()\n n = parseInt.(split(readline()))\n x = parseInt.(split(readline()))\n y = [0 for i in 1:n[1]-n[2]+1]\n for i in 1:n[1]-n[2]+1\n z = x[i+n[2]-1]\n if x[i]*z >= 0\n y[i] = max(abs(x[i]),abs(z))\n else\n if x[i] > z\n y[i] = -(z*2)+x[i]\n else\n y[i] = z-x[i]*2\n end\n end\n end\n print(minimum(y))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 401, "cpu_time_ms": 533, "memory_kb": 135984}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s648147366", "group_id": "codeNet:p03280", "input_text": "a,b=map(x->parse(Int,x),split(readline()))\nprint((a-1)*(b-1))", "language": "Julia", "metadata": {"date": 1534745398, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s648147366.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s648147366", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "a,b=map(x->parse(Int,x),split(readline()))\nprint((a-1)*(b-1))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 775, "memory_kb": 163148}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s992468664", "group_id": "codeNet:p03281", "input_text": "n=parse(Int,readline())\nc=0\nfor i=1:n\n\tm=0\n\tfor j=1:i\n\t\tm+=i%j<1?1:0\n\tend\n\tc+=m==i%2*8?1:0\nend\nprint(c)\n", "language": "Julia", "metadata": {"date": 1534747891, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s992468664.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s992468664", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "n=parse(Int,readline())\nc=0\nfor i=1:n\n\tm=0\n\tfor j=1:i\n\t\tm+=i%j<1?1:0\n\tend\n\tc+=m==i%2*8?1:0\nend\nprint(c)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 104, "cpu_time_ms": 303, "memory_kb": 109860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s183257316", "group_id": "codeNet:p03282", "input_text": "function main()\n \n S = map(x -> parse(Int,x), split(chomp(readline()),\"\"))\n K = parse(BigInt,readline())\n \n if K <= length(S) && S[K] == 1\n check = true\n for i in 1:K\n if S[i] != 1\n println(S[i])\n check = false\n break\n end\n end\n if check\n println(1)\n end\n else\n for i in S\n if i != 1\n println(i)\n break\n end\n end\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584881995, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s183257316.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s183257316", "user_id": "u790457721"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n \n S = map(x -> parse(Int,x), split(chomp(readline()),\"\"))\n K = parse(BigInt,readline())\n \n if K <= length(S) && S[K] == 1\n check = true\n for i in 1:K\n if S[i] != 1\n println(S[i])\n check = false\n break\n end\n end\n if check\n println(1)\n end\n else\n for i in S\n if i != 1\n println(i)\n break\n end\n end\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 420, "cpu_time_ms": 483, "memory_kb": 121244}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s618398791", "group_id": "codeNet:p03283", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn, m, q = readline() |> split |> parseMap\n\tnn = zeros(Int, n, n)\n\tfor i in 1:m\n\t\tl,r = readline() |> split |> parseMap\n\t\tnn[min(l,r),max(l,r)] += 1\n\tend\n\tfor i in 1:q\n\t\ts,t = readline() |> split |> parseMap\n\t\tsum = 0\n \tg = max(s,t)\n \tl = min(s,t)\n\t\tfor i in l:g\n\t\t\tfor j in l:i\n\t\t\t\tsum += nn[j,i]\n\t\t\tend\n\t\tend\n\t\tprintln(sum)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1542821010, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03283.html", "problem_id": "p03283", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03283/input.txt", "sample_output_relpath": "derived/input_output/data/p03283/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03283/Julia/s618398791.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s618398791", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn, m, q = readline() |> split |> parseMap\n\tnn = zeros(Int, n, n)\n\tfor i in 1:m\n\t\tl,r = readline() |> split |> parseMap\n\t\tnn[min(l,r),max(l,r)] += 1\n\tend\n\tfor i in 1:q\n\t\ts,t = readline() |> split |> parseMap\n\t\tsum = 0\n \tg = max(s,t)\n \tl = min(s,t)\n\t\tfor i in l:g\n\t\t\tfor j in l:i\n\t\t\t\tsum += nn[j,i]\n\t\t\tend\n\t\tend\n\t\tprintln(sum)\n\tend\nend\n\nmain()", "problem_context": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "sample_input": "2 3 1\n1 1\n1 2\n2 2\n1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03283", "source_text": "Score: 400 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is a east-west railroad and N cities along it, numbered 1, 2, 3, ..., N from west to east.\nA company called AtCoder Express possesses M trains, and the train i runs from City L_i to City R_i (it is possible that L_i = R_i).\nTakahashi the king is interested in the following Q matters:\n\nThe number of the trains that runs strictly within the section from City p_i to City q_i, that is, the number of trains j such that p_i \\leq L_j and R_j \\leq q_i.\n\nAlthough he is genius, this is too much data to process by himself. Find the answer for each of these Q queries to help him.\n\nConstraints\n\nN is an integer between 1 and 500 (inclusive).\n\nM is an integer between 1 and 200 \\ 000 (inclusive).\n\nQ is an integer between 1 and 100 \\ 000 (inclusive).\n\n1 \\leq L_i \\leq R_i \\leq N (1 \\leq i \\leq M)\n\n1 \\leq p_i \\leq q_i \\leq N (1 \\leq i \\leq Q)\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M Q\nL_1 R_1\nL_2 R_2\n:\nL_M R_M\np_1 q_1\np_2 q_2\n:\np_Q q_Q\n\nOutput\n\nPrint Q lines. The i-th line should contain the number of the trains that runs strictly within the section from City p_i to City q_i.\n\nSample Input 1\n\n2 3 1\n1 1\n1 2\n2 2\n1 2\n\nSample Output 1\n\n3\n\nAs all the trains runs within the section from City 1 to City 2, the answer to the only query is 3.\n\nSample Input 2\n\n10 3 2\n1 5\n2 8\n7 10\n1 7\n3 10\n\nSample Output 2\n\n1\n1\n\nThe first query is on the section from City 1 to 7. There is only one train that runs strictly within that section: Train 1.\nThe second query is on the section from City 3 to 10. There is only one train that runs strictly within that section: Train 3.\n\nSample Input 3\n\n10 10 10\n1 6\n2 9\n4 5\n4 7\n4 7\n5 8\n6 6\n6 7\n7 9\n10 10\n1 8\n1 9\n1 10\n2 8\n2 9\n2 10\n3 8\n3 9\n3 10\n1 10\n\nSample Output 3\n\n7\n9\n10\n6\n8\n9\n6\n7\n8\n10", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 3164, "memory_kb": 171568}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s246774781", "group_id": "codeNet:p03284", "input_text": "const lines=readlines(open(\"/dev/fd/0\"))\nlet\n state=0\n global input\n input()=lines[state+=1]\nend\nint(s::String)=parse(Int32,s)\nintSub(s::SubString{String})=parse(Int32,s)\nintLine()=map(intSub,split(input()))\nfunction main()\n n,k=intLine()\n println(cld(n,k)-div(n,k))\nend\nmain()", "language": "Julia", "metadata": {"date": 1561146033, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03284.html", "problem_id": "p03284", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03284/input.txt", "sample_output_relpath": "derived/input_output/data/p03284/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03284/Julia/s246774781.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s246774781", "user_id": "u729133443"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "const lines=readlines(open(\"/dev/fd/0\"))\nlet\n state=0\n global input\n input()=lines[state+=1]\nend\nint(s::String)=parse(Int32,s)\nintSub(s::SubString{String})=parse(Int32,s)\nintLine()=map(intSub,split(input()))\nfunction main()\n n,k=intLine()\n println(cld(n,k)-div(n,k))\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\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 minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "7 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03284", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\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 minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 472, "memory_kb": 116448}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s453629532", "group_id": "codeNet:p03284", "input_text": "function main()\n s = chomp(readline())\n a, b = [], []\n nw = a\n for i in 1:length(s)\n if s[i] == ' '\n nw = b\n else\n push!(nw,s[i]-'0')\n end\n end\n n, K = 0, 0\n d = 1\n for i in length(a):-1:1\n n += a[i]*d\n d *= 10\n end\n d = 1\n for i in length(b):-1:1\n K += d*b[i]\n d *= 10\n end\n (n % K == 0) ? println(0) : println(1)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1534036934, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03284.html", "problem_id": "p03284", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03284/input.txt", "sample_output_relpath": "derived/input_output/data/p03284/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03284/Julia/s453629532.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s453629532", "user_id": "u509674552"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n s = chomp(readline())\n a, b = [], []\n nw = a\n for i in 1:length(s)\n if s[i] == ' '\n nw = b\n else\n push!(nw,s[i]-'0')\n end\n end\n n, K = 0, 0\n d = 1\n for i in length(a):-1:1\n n += a[i]*d\n d *= 10\n end\n d = 1\n for i in length(b):-1:1\n K += d*b[i]\n d *= 10\n end\n (n % K == 0) ? println(0) : println(1)\nend\n\nmain()\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\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 minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "sample_input": "7 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03284", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has decided to distribute N AtCoder Crackers to K users of as evenly as possible.\nWhen all the crackers are distributed, find the minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nConstraints\n\n1 \\leq N,K \\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 minimum possible (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user.\n\nSample Input 1\n\n7 3\n\nSample Output 1\n\n1\n\nWhen the users receive two, two and three crackers, respectively, the (absolute) difference between the largest number of crackers received by a user and the smallest number received by a user, is 1.\n\nSample Input 2\n\n100 10\n\nSample Output 2\n\n0\n\nThe crackers can be distributed evenly.\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1169, "memory_kb": 169440}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s321166799", "group_id": "codeNet:p03285", "input_text": "function main()\n \n N = parse(Int,readline())\n \n check = true\n \n for i in 1:N, j in 1:N\n \n if N == 4i+7j\n check = false\n println(\"Yes\")\n break\n end\n \n end\n \n if check\n println(\"No\")\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1581531374, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03285.html", "problem_id": "p03285", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03285/input.txt", "sample_output_relpath": "derived/input_output/data/p03285/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03285/Julia/s321166799.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s321166799", "user_id": "u790457721"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n \n N = parse(Int,readline())\n \n check = true\n \n for i in 1:N, j in 1:N\n \n if N == 4i+7j\n check = false\n println(\"Yes\")\n break\n end\n \n end\n \n if check\n println(\"No\")\n end\n \nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nLa Confiserie d'ABC sells cakes at 4 dollars each and doughnuts at 7 dollars each.\nDetermine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.\n\nConstraints\n\nN is an integer between 1 and 100, inclusive.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there is a way to buy some cakes and some doughnuts for exactly N dollars, print Yes; otherwise, print No.\n\nSample Input 1\n\n11\n\nSample Output 1\n\nYes\n\nIf you buy one cake and one doughnut, the total will be 4 + 7 = 11 dollars.\n\nSample Input 2\n\n40\n\nSample Output 2\n\nYes\n\nIf you buy ten cakes, the total will be 4 \\times 10 = 40 dollars.\n\nSample Input 3\n\n3\n\nSample Output 3\n\nNo\n\nThe prices of cakes (4 dollars) and doughnuts (7 dollars) are both higher than 3 dollars, so there is no such way.", "sample_input": "11\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03285", "source_text": "Score : 200 points\n\nProblem Statement\n\nLa Confiserie d'ABC sells cakes at 4 dollars each and doughnuts at 7 dollars each.\nDetermine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.\n\nConstraints\n\nN is an integer between 1 and 100, inclusive.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf there is a way to buy some cakes and some doughnuts for exactly N dollars, print Yes; otherwise, print No.\n\nSample Input 1\n\n11\n\nSample Output 1\n\nYes\n\nIf you buy one cake and one doughnut, the total will be 4 + 7 = 11 dollars.\n\nSample Input 2\n\n40\n\nSample Output 2\n\nYes\n\nIf you buy ten cakes, the total will be 4 \\times 10 = 40 dollars.\n\nSample Input 3\n\n3\n\nSample Output 3\n\nNo\n\nThe prices of cakes (4 dollars) and doughnuts (7 dollars) are both higher than 3 dollars, so there is no such way.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 342, "memory_kb": 111736}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s045817469", "group_id": "codeNet:p03286", "input_text": "function main()\n \n N = parse(Int, readline())\n answer = []\n \n if N % -2 == 0\n push!(answer, 0)\n else\n push!(answer, 1)\n N -= 1\n end\n\n i = 2\n while N != 0\n if N % 2^i == 0\n push!(answer, 0)\n else\n push!(answer, 1)\n N -= (-2)^(i-1)\n end\n i += 1\n end\n \n reverse!(answer)\n \n for i in answer\n print(i)\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1534280496, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03286.html", "problem_id": "p03286", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03286/input.txt", "sample_output_relpath": "derived/input_output/data/p03286/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03286/Julia/s045817469.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s045817469", "user_id": "u373796790"}, "prompt_components": {"gold_output": "1011\n", "input_to_evaluate": "function main()\n \n N = parse(Int, readline())\n answer = []\n \n if N % -2 == 0\n push!(answer, 0)\n else\n push!(answer, 1)\n N -= 1\n end\n\n i = 2\n while N != 0\n if N % 2^i == 0\n push!(answer, 0)\n else\n push!(answer, 1)\n N -= (-2)^(i-1)\n end\n i += 1\n end\n \n reverse!(answer)\n \n for i in answer\n print(i)\n end\n \nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nGiven an integer N, find the base -2 representation of N.\n\nHere, S is the base -2 representation of N when the following are all satisfied:\n\nS is a string consisting of 0 and 1.\n\nUnless S = 0, the initial character of S is 1.\n\nLet S = S_k S_{k-1} ... S_0, then S_0 \\times (-2)^0 + S_1 \\times (-2)^1 + ... + S_k \\times (-2)^k = N.\n\nIt can be proved that, for any integer M, the base -2 representation of M is uniquely determined.\n\nConstraints\n\nEvery value in input is integer.\n\n-10^9 \\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 base -2 representation of N.\n\nSample Input 1\n\n-9\n\nSample Output 1\n\n1011\n\nAs (-2)^0 + (-2)^1 + (-2)^3 = 1 + (-2) + (-8) = -9, 1011 is the base -2 representation of -9.\n\nSample Input 2\n\n123456789\n\nSample Output 2\n\n11000101011001101110100010101\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "sample_input": "-9\n"}, "reference_outputs": ["1011\n"], "source_document_id": "p03286", "source_text": "Score : 300 points\n\nProblem Statement\n\nGiven an integer N, find the base -2 representation of N.\n\nHere, S is the base -2 representation of N when the following are all satisfied:\n\nS is a string consisting of 0 and 1.\n\nUnless S = 0, the initial character of S is 1.\n\nLet S = S_k S_{k-1} ... S_0, then S_0 \\times (-2)^0 + S_1 \\times (-2)^1 + ... + S_k \\times (-2)^k = N.\n\nIt can be proved that, for any integer M, the base -2 representation of M is uniquely determined.\n\nConstraints\n\nEvery value in input is integer.\n\n-10^9 \\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 base -2 representation of N.\n\nSample Input 1\n\n-9\n\nSample Output 1\n\n1011\n\nAs (-2)^0 + (-2)^1 + (-2)^3 = 1 + (-2) + (-8) = -9, 1011 is the base -2 representation of -9.\n\nSample Input 2\n\n123456789\n\nSample Output 2\n\n11000101011001101110100010101\n\nSample Input 3\n\n0\n\nSample Output 3\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 866, "memory_kb": 165684}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s631772628", "group_id": "codeNet:p03288", "input_text": "R = parse(Int,readline())\nif R < 1200\n print(\"ABC\\n\")\nelseif R < 2800\n print(\"ARC\\n\")\nelse\n print(\"AGC\\n\")\nend\n", "language": "Julia", "metadata": {"date": 1533986844, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s631772628.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s631772628", "user_id": "u509674552"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "R = parse(Int,readline())\nif R < 1200\n print(\"ABC\\n\")\nelseif R < 2800\n print(\"ARC\\n\")\nelse\n print(\"AGC\\n\")\nend\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 750, "memory_kb": 163216}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s340694073", "group_id": "codeNet:p03289", "input_text": "S=chomp(readline())\nif S[1]!='A'\n\tprintln(\"WA\")\n\texit()\nend\nc=0\nfor i=3:length(S)-1\n\tif S[i]=='C'\n\t\tc+=1\n\tend\nend\nif c!=1\n\tprintln(\"WA\")\n\texit()\nend\nc=0\nfor t=S\n\tif t<='Z'\n\t\tc+=1\n\tend\nend\nif c!=2\n\tprintln(\"WA\")\nelse\n\tprintln(\"AC\")\nend\n", "language": "Julia", "metadata": {"date": 1561332376, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03289.html", "problem_id": "p03289", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03289/input.txt", "sample_output_relpath": "derived/input_output/data/p03289/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03289/Julia/s340694073.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s340694073", "user_id": "u657913472"}, "prompt_components": {"gold_output": "AC\n", "input_to_evaluate": "S=chomp(readline())\nif S[1]!='A'\n\tprintln(\"WA\")\n\texit()\nend\nc=0\nfor i=3:length(S)-1\n\tif S[i]=='C'\n\t\tc+=1\n\tend\nend\nif c!=1\n\tprintln(\"WA\")\n\texit()\nend\nc=0\nfor t=S\n\tif t<='Z'\n\t\tc+=1\n\tend\nend\nif c!=2\n\tprintln(\"WA\")\nelse\n\tprintln(\"AC\")\nend\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S. Each character of S is uppercase or lowercase English letter.\nDetermine if S satisfies all of the following conditions:\n\nThe initial character of S is an uppercase A.\n\nThere is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).\n\nAll letters except the A and C mentioned above are lowercase.\n\nConstraints\n\n4 ≤ |S| ≤ 10 (|S| is the length of the string S.)\n\nEach character of S is uppercase or lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S satisfies all of the conditions in the problem statement, print AC; otherwise, print WA.\n\nSample Input 1\n\nAtCoder\n\nSample Output 1\n\nAC\n\nThe first letter is A, the third letter is C and the remaining letters are all lowercase, so all the conditions are satisfied.\n\nSample Input 2\n\nACoder\n\nSample Output 2\n\nWA\n\nThe second letter should not be C.\n\nSample Input 3\n\nAcycliC\n\nSample Output 3\n\nWA\n\nThe last letter should not be C, either.\n\nSample Input 4\n\nAtCoCo\n\nSample Output 4\n\nWA\n\nThere should not be two or more occurrences of C.\n\nSample Input 5\n\nAtcoder\n\nSample Output 5\n\nWA\n\nThe number of C should not be zero, either.", "sample_input": "AtCoder\n"}, "reference_outputs": ["AC\n"], "source_document_id": "p03289", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S. Each character of S is uppercase or lowercase English letter.\nDetermine if S satisfies all of the following conditions:\n\nThe initial character of S is an uppercase A.\n\nThere is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).\n\nAll letters except the A and C mentioned above are lowercase.\n\nConstraints\n\n4 ≤ |S| ≤ 10 (|S| is the length of the string S.)\n\nEach character of S is uppercase or lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S satisfies all of the conditions in the problem statement, print AC; otherwise, print WA.\n\nSample Input 1\n\nAtCoder\n\nSample Output 1\n\nAC\n\nThe first letter is A, the third letter is C and the remaining letters are all lowercase, so all the conditions are satisfied.\n\nSample Input 2\n\nACoder\n\nSample Output 2\n\nWA\n\nThe second letter should not be C.\n\nSample Input 3\n\nAcycliC\n\nSample Output 3\n\nWA\n\nThe last letter should not be C, either.\n\nSample Input 4\n\nAtCoCo\n\nSample Output 4\n\nWA\n\nThere should not be two or more occurrences of C.\n\nSample Input 5\n\nAtcoder\n\nSample Output 5\n\nWA\n\nThe number of C should not be zero, either.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 310, "memory_kb": 108612}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s807154138", "group_id": "codeNet:p03289", "input_text": "function main()\n\ts = collect(readline())\n\tl = length(s)\n\tflg = 0\n\tcheck = 0\n\tif s[1] != 'A'\n\t\tflg = 1\n\tend\n\tfor i in 2:l\n\t\tfor j in 65:90\n\t\t\tif s[i] == Char(j)\n\t\t\t\tif 3 <= i <= l-1 && check == 0 && s[i] == 'C'\n\t\t\t\t\tcheck += 1\n\t\t\t\telse\n\t\t\t\t\tflg = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tif check == 0\n\t\tflg = 1\n\tend\n\tif flg == 0\n\t\tprint(\"AC\")\n\telse\n\t\tprint(\"WA\")\n\tend\nend\nmain()", "language": "Julia", "metadata": {"date": 1540814229, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03289.html", "problem_id": "p03289", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03289/input.txt", "sample_output_relpath": "derived/input_output/data/p03289/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03289/Julia/s807154138.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s807154138", "user_id": "u095714878"}, "prompt_components": {"gold_output": "AC\n", "input_to_evaluate": "function main()\n\ts = collect(readline())\n\tl = length(s)\n\tflg = 0\n\tcheck = 0\n\tif s[1] != 'A'\n\t\tflg = 1\n\tend\n\tfor i in 2:l\n\t\tfor j in 65:90\n\t\t\tif s[i] == Char(j)\n\t\t\t\tif 3 <= i <= l-1 && check == 0 && s[i] == 'C'\n\t\t\t\t\tcheck += 1\n\t\t\t\telse\n\t\t\t\t\tflg = 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tif check == 0\n\t\tflg = 1\n\tend\n\tif flg == 0\n\t\tprint(\"AC\")\n\telse\n\t\tprint(\"WA\")\n\tend\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S. Each character of S is uppercase or lowercase English letter.\nDetermine if S satisfies all of the following conditions:\n\nThe initial character of S is an uppercase A.\n\nThere is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).\n\nAll letters except the A and C mentioned above are lowercase.\n\nConstraints\n\n4 ≤ |S| ≤ 10 (|S| is the length of the string S.)\n\nEach character of S is uppercase or lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S satisfies all of the conditions in the problem statement, print AC; otherwise, print WA.\n\nSample Input 1\n\nAtCoder\n\nSample Output 1\n\nAC\n\nThe first letter is A, the third letter is C and the remaining letters are all lowercase, so all the conditions are satisfied.\n\nSample Input 2\n\nACoder\n\nSample Output 2\n\nWA\n\nThe second letter should not be C.\n\nSample Input 3\n\nAcycliC\n\nSample Output 3\n\nWA\n\nThe last letter should not be C, either.\n\nSample Input 4\n\nAtCoCo\n\nSample Output 4\n\nWA\n\nThere should not be two or more occurrences of C.\n\nSample Input 5\n\nAtcoder\n\nSample Output 5\n\nWA\n\nThe number of C should not be zero, either.", "sample_input": "AtCoder\n"}, "reference_outputs": ["AC\n"], "source_document_id": "p03289", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given a string S. Each character of S is uppercase or lowercase English letter.\nDetermine if S satisfies all of the following conditions:\n\nThe initial character of S is an uppercase A.\n\nThere is exactly one occurrence of C between the third character from the beginning and the second to last character (inclusive).\n\nAll letters except the A and C mentioned above are lowercase.\n\nConstraints\n\n4 ≤ |S| ≤ 10 (|S| is the length of the string S.)\n\nEach character of S is uppercase or lowercase English letter.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nIf S satisfies all of the conditions in the problem statement, print AC; otherwise, print WA.\n\nSample Input 1\n\nAtCoder\n\nSample Output 1\n\nAC\n\nThe first letter is A, the third letter is C and the remaining letters are all lowercase, so all the conditions are satisfied.\n\nSample Input 2\n\nACoder\n\nSample Output 2\n\nWA\n\nThe second letter should not be C.\n\nSample Input 3\n\nAcycliC\n\nSample Output 3\n\nWA\n\nThe last letter should not be C, either.\n\nSample Input 4\n\nAtCoCo\n\nSample Output 4\n\nWA\n\nThere should not be two or more occurrences of C.\n\nSample Input 5\n\nAtcoder\n\nSample Output 5\n\nWA\n\nThe number of C should not be zero, either.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 366, "cpu_time_ms": 311, "memory_kb": 110140}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s786459404", "group_id": "codeNet:p03290", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n d,g=parseMap(split(readline()))\n pc=[parseMap(split(readline())) for i in 1:d]\n ans=10^9\n for i in 0:(1<=g\n ans=min(ans,cnt)\n else\n # 点数が足りなかった場合、no_max点の問題を解いて足りるか試していく\n for j in 1:pc[no_max][1]\n point+=100*no_max\n cnt+=1\n if j==pc[no_max][1]\n point+=pc[no_max][2]\n end\n if point>=g\n ans=min(ans,cnt)\n end\n end\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1585865977, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03290.html", "problem_id": "p03290", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03290/input.txt", "sample_output_relpath": "derived/input_output/data/p03290/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03290/Julia/s786459404.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s786459404", "user_id": "u619197965"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n d,g=parseMap(split(readline()))\n pc=[parseMap(split(readline())) for i in 1:d]\n ans=10^9\n for i in 0:(1<=g\n ans=min(ans,cnt)\n else\n # 点数が足りなかった場合、no_max点の問題を解いて足りるか試していく\n for j in 1:pc[no_max][1]\n point+=100*no_max\n cnt+=1\n if j==pc[no_max][1]\n point+=pc[no_max][2]\n end\n if point>=g\n ans=min(ans,cnt)\n end\n end\n end\n end\n println(ans)\nend\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "sample_input": "2 700\n3 500\n5 800\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03290", "source_text": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1155, "cpu_time_ms": 789, "memory_kb": 170932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s020976805", "group_id": "codeNet:p03290", "input_text": "ans=114514\nD,G=map(x->parse(Int,x),split(readline()))\nP=Array{Int}(0)\nC=Array{Int}(0)\nfor i=1:D\n\tp,c=map(x->parse(Int,x),split(readline()))\n\tpush!(P,p)\n\tpush!(C,c)\nend\nfor i=0:(1<>(j-1))%2==1\n\t\t\tnow+=C[j]+P[j]*j*100\n\t\t\tc+=P[j]\n\t\telse\n\t\t\th=j\n\t\tend\n\tend\n\tif h>0\n\t\tt=cld(max(G-now,0),h*100)\n\t\tif P[h]>=t\n\t\t\tnow+=t*h*100\n\t\t\tc+=t\n\t\tend\n\tend\n\tif now>=G\n\t\tans=min(ans,c)\n\tend\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1561333002, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03290.html", "problem_id": "p03290", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03290/input.txt", "sample_output_relpath": "derived/input_output/data/p03290/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03290/Julia/s020976805.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s020976805", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "ans=114514\nD,G=map(x->parse(Int,x),split(readline()))\nP=Array{Int}(0)\nC=Array{Int}(0)\nfor i=1:D\n\tp,c=map(x->parse(Int,x),split(readline()))\n\tpush!(P,p)\n\tpush!(C,c)\nend\nfor i=0:(1<>(j-1))%2==1\n\t\t\tnow+=C[j]+P[j]*j*100\n\t\t\tc+=P[j]\n\t\telse\n\t\t\th=j\n\t\tend\n\tend\n\tif h>0\n\t\tt=cld(max(G-now,0),h*100)\n\t\tif P[h]>=t\n\t\t\tnow+=t*h*100\n\t\t\tc+=t\n\t\tend\n\tend\n\tif now>=G\n\t\tans=min(ans,c)\n\tend\nend\nprintln(ans)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "sample_input": "2 700\n3 500\n5 800\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03290", "source_text": "Score : 300 points\n\nProblem Statement\n\nA programming competition site AtCode provides algorithmic problems.\nEach problem is allocated a score based on its difficulty.\nCurrently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points.\nThese p_1 + … + p_D problems are all of the problems available on AtCode.\n\nA user of AtCode has a value called total score.\nThe total score of a user is the sum of the following two elements:\n\nBase score: the sum of the scores of all problems solved by the user.\n\nPerfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).\n\nTakahashi, who is the new user of AtCode, has not solved any problem.\nHis objective is to have a total score of G or more points.\nAt least how many problems does he need to solve for this objective?\n\nConstraints\n\n1 ≤ D ≤ 10\n\n1 ≤ p_i ≤ 100\n\n100 ≤ c_i ≤ 10^6\n\n100 ≤ G\n\nAll values in input are integers.\n\nc_i and G are all multiples of 100.\n\nIt is possible to have a total score of G or more points.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nD G\np_1 c_1\n:\np_D c_D\n\nOutput\n\nPrint the minimum number of problems that needs to be solved in order to have a total score of G or more points. Note that this objective is always achievable (see Constraints).\n\nSample Input 1\n\n2 700\n3 500\n5 800\n\nSample Output 1\n\n3\n\nIn this case, there are three problems each with 100 points and five problems each with 200 points. The perfect bonus for solving all the 100-point problems is 500 points, and the perfect bonus for solving all the 200-point problems is 800 points. Takahashi's objective is to have a total score of 700 points or more.\n\nOne way to achieve this objective is to solve four 200-point problems and earn a base score of 800 points. However, if we solve three 100-point problems, we can earn the perfect bonus of 500 points in addition to the base score of 300 points, for a total score of 800 points, and we can achieve the objective with fewer problems.\n\nSample Input 2\n\n2 2000\n3 500\n5 800\n\nSample Output 2\n\n7\n\nThis case is similar to Sample Input 1, but the Takahashi's objective this time is 2000 points or more. In this case, we inevitably need to solve all five 200-point problems, and by solving two 100-point problems additionally we have the total score of 2000 points.\n\nSample Input 3\n\n2 400\n3 500\n5 800\n\nSample Output 3\n\n2\n\nThis case is again similar to Sample Input 1, but the Takahashi's objective this time is 400 points or more. In this case, we only need to solve two 200-point problems to achieve the objective.\n\nSample Input 4\n\n5 25000\n20 1000\n40 1000\n50 1000\n30 1000\n1 1000\n\nSample Output 4\n\n66\n\nThere is only one 500-point problem, but the perfect bonus can be earned even in such a case.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 421, "memory_kb": 112908}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s201710413", "group_id": "codeNet:p03291", "input_text": "function main()\n \"\"\"ver. 0.5.0\n\n ref:\n https://qiita.com/phigasui/items/2db20b36fb85e161e0ae\n https://nbviewer.jupyter.org/github/bicycle1885/Julia-Tutorial/blob/master/Julia%E3%82%AF%E3%83%83%E3%82%AF%E3%83%96%E3%83%83%E3%82%AF.ipynb\n https://nbviewer.jupyter.org/github/bicycle1885/Julia-Tutorial/blob/master/Julia%E9%AB%98%E9%80%9F%E3%83%81%E3%83%A5%E3%83%BC%E3%83%88%E3%83%AA%E3%82%A2%E3%83%AB.ipynb\n \"\"\"\n const S = readline() |> chomp\n const ans = f(S)\n\n @assert ans == ans\n println(ans)\nend\n\nfunction f(S::String)\n const n = length(S)\n # Int: Int64\n const aa = zeros(Int, n)\n const cc = zeros(Int, n)\n const q = [0 for _ = 1:n]\n aa[1] = convert(Int, S[1] == 'A')\n cc[1] = convert(Int, S[1] == 'C')\n q[1] = convert(Int, S[1] == '?')\n for i = 2:n\n aa[i] = aa[i - 1] + Int(S[i] == 'A')\n cc[i] = cc[i - 1] + Int(S[i] == 'C')\n q[i] = q[i - 1] + Int(S[i] == '?')\n end\n\n ans = 0\n const MOD = 10^9 + 7\n for i = 2:n - 1\n a = aa[i - 1]\n c = cc[n] - cc[i]\n l = q[i - 1] \n r = q[n] - q[i]\n # ABC の作り方\n # AB?: ? 1つをCに割り当てる\n # ?BC: ? 1つをAに割り当てる\n # ?B?: ? 2つをACに割り当てる\n if S[i] == 'B' || S[i] == '?'\n ac = a * c * (3^(l + r)) % MOD\n (aq, qc, qq) = (0, 0, 0)\n if l + r - 1 >= 0\n aq = a * r * (3^(l + r - 1)) % MOD\n qc = l * c * (3^(l + r - 1)) % MOD\n end\n if l + r - 2 >= 0\n qq = l * r * (3^(l + r - 2)) % MOD\n end\n # println(a, c, l, r, (ac, aq, qc, qq))\n ans += ac + aq + qc + qq\n ans = ans % MOD\n end\n end\n\n return ans\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1556658091, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03291.html", "problem_id": "p03291", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03291/input.txt", "sample_output_relpath": "derived/input_output/data/p03291/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03291/Julia/s201710413.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s201710413", "user_id": "u875361824"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "function main()\n \"\"\"ver. 0.5.0\n\n ref:\n https://qiita.com/phigasui/items/2db20b36fb85e161e0ae\n https://nbviewer.jupyter.org/github/bicycle1885/Julia-Tutorial/blob/master/Julia%E3%82%AF%E3%83%83%E3%82%AF%E3%83%96%E3%83%83%E3%82%AF.ipynb\n https://nbviewer.jupyter.org/github/bicycle1885/Julia-Tutorial/blob/master/Julia%E9%AB%98%E9%80%9F%E3%83%81%E3%83%A5%E3%83%BC%E3%83%88%E3%83%AA%E3%82%A2%E3%83%AB.ipynb\n \"\"\"\n const S = readline() |> chomp\n const ans = f(S)\n\n @assert ans == ans\n println(ans)\nend\n\nfunction f(S::String)\n const n = length(S)\n # Int: Int64\n const aa = zeros(Int, n)\n const cc = zeros(Int, n)\n const q = [0 for _ = 1:n]\n aa[1] = convert(Int, S[1] == 'A')\n cc[1] = convert(Int, S[1] == 'C')\n q[1] = convert(Int, S[1] == '?')\n for i = 2:n\n aa[i] = aa[i - 1] + Int(S[i] == 'A')\n cc[i] = cc[i - 1] + Int(S[i] == 'C')\n q[i] = q[i - 1] + Int(S[i] == '?')\n end\n\n ans = 0\n const MOD = 10^9 + 7\n for i = 2:n - 1\n a = aa[i - 1]\n c = cc[n] - cc[i]\n l = q[i - 1] \n r = q[n] - q[i]\n # ABC の作り方\n # AB?: ? 1つをCに割り当てる\n # ?BC: ? 1つをAに割り当てる\n # ?B?: ? 2つをACに割り当てる\n if S[i] == 'B' || S[i] == '?'\n ac = a * c * (3^(l + r)) % MOD\n (aq, qc, qq) = (0, 0, 0)\n if l + r - 1 >= 0\n aq = a * r * (3^(l + r - 1)) % MOD\n qc = l * c * (3^(l + r - 1)) % MOD\n end\n if l + r - 2 >= 0\n qq = l * r * (3^(l + r - 2)) % MOD\n end\n # println(a, c, l, r, (ac, aq, qc, qq))\n ans += ac + aq + qc + qq\n ans = ans % MOD\n end\n end\n\n return ans\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThe ABC number of a string T is the number of triples of integers (i, j, k) that satisfy all of the following conditions:\n\n1 ≤ i < j < k ≤ |T| (|T| is the length of T.)\n\nT_i = A (T_i is the i-th character of T from the beginning.)\n\nT_j = B\n\nT_k = C\n\nFor example, when T = ABCBC, there are three triples of integers (i, j, k) that satisfy the conditions: (1, 2, 3), (1, 2, 5), (1, 4, 5). Thus, the ABC number of T is 3.\n\nYou are given a string S. Each character of S is A, B, C or ?.\n\nLet Q be the number of occurrences of ? in S. We can make 3^Q strings by replacing each occurrence of ? in S with A, B or C. Find the sum of the ABC numbers of all these strings.\n\nThis sum can be extremely large, so print the sum modulo 10^9 + 7.\n\nConstraints\n\n3 ≤ |S| ≤ 10^5\n\nEach character of S is A, B, C or ?.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the sum of the ABC numbers of all the 3^Q strings, modulo 10^9 + 7.\n\nSample Input 1\n\nA??C\n\nSample Output 1\n\n8\n\nIn this case, Q = 2, and we can make 3^Q = 9 strings by by replacing each occurrence of ? with A, B or C. The ABC number of each of these strings is as follows:\n\nAAAC: 0\n\nAABC: 2\n\nAACC: 0\n\nABAC: 1\n\nABBC: 2\n\nABCC: 2\n\nACAC: 0\n\nACBC: 1\n\nACCC: 0\n\nThe sum of these is 0 + 2 + 0 + 1 + 2 + 2 + 0 + 1 + 0 = 8, so we print 8 modulo 10^9 + 7, that is, 8.\n\nSample Input 2\n\nABCBC\n\nSample Output 2\n\n3\n\nWhen Q = 0, we print the ABC number of S itself, modulo 10^9 + 7. This string is the same as the one given as an example in the problem statement, and its ABC number is 3.\n\nSample Input 3\n\n????C?????B??????A???????\n\nSample Output 3\n\n979596887\n\nIn this case, the sum of the ABC numbers of all the 3^Q strings is 2291979612924, and we should print this number modulo 10^9 + 7, that is, 979596887.", "sample_input": "A??C\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03291", "source_text": "Score : 400 points\n\nProblem Statement\n\nThe ABC number of a string T is the number of triples of integers (i, j, k) that satisfy all of the following conditions:\n\n1 ≤ i < j < k ≤ |T| (|T| is the length of T.)\n\nT_i = A (T_i is the i-th character of T from the beginning.)\n\nT_j = B\n\nT_k = C\n\nFor example, when T = ABCBC, there are three triples of integers (i, j, k) that satisfy the conditions: (1, 2, 3), (1, 2, 5), (1, 4, 5). Thus, the ABC number of T is 3.\n\nYou are given a string S. Each character of S is A, B, C or ?.\n\nLet Q be the number of occurrences of ? in S. We can make 3^Q strings by replacing each occurrence of ? in S with A, B or C. Find the sum of the ABC numbers of all these strings.\n\nThis sum can be extremely large, so print the sum modulo 10^9 + 7.\n\nConstraints\n\n3 ≤ |S| ≤ 10^5\n\nEach character of S is A, B, C or ?.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the sum of the ABC numbers of all the 3^Q strings, modulo 10^9 + 7.\n\nSample Input 1\n\nA??C\n\nSample Output 1\n\n8\n\nIn this case, Q = 2, and we can make 3^Q = 9 strings by by replacing each occurrence of ? with A, B or C. The ABC number of each of these strings is as follows:\n\nAAAC: 0\n\nAABC: 2\n\nAACC: 0\n\nABAC: 1\n\nABBC: 2\n\nABCC: 2\n\nACAC: 0\n\nACBC: 1\n\nACCC: 0\n\nThe sum of these is 0 + 2 + 0 + 1 + 2 + 2 + 0 + 1 + 0 = 8, so we print 8 modulo 10^9 + 7, that is, 8.\n\nSample Input 2\n\nABCBC\n\nSample Output 2\n\n3\n\nWhen Q = 0, we print the ABC number of S itself, modulo 10^9 + 7. This string is the same as the one given as an example in the problem statement, and its ABC number is 3.\n\nSample Input 3\n\n????C?????B??????A???????\n\nSample Output 3\n\n979596887\n\nIn this case, the sum of the ABC numbers of all the 3^Q strings is 2291979612924, and we should print this number modulo 10^9 + 7, that is, 979596887.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1804, "cpu_time_ms": 787, "memory_kb": 168096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s639631843", "group_id": "codeNet:p03292", "input_text": " a = parse.(split(readline()))\n b = sort(a)\n l = length(b)\n if l % 2 == 0\n \tprint(b[l/2])\n else\n print(b[(l+1)/2)])\nend\n end\n \n main()", "language": "Julia", "metadata": {"date": 1540463034, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s639631843.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s639631843", "user_id": "u095714878"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": " a = parse.(split(readline()))\n b = sort(a)\n l = length(b)\n if l % 2 == 0\n \tprint(b[l/2])\n else\n print(b[(l+1)/2)])\nend\n end\n \n main()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 181, "cpu_time_ms": 1508, "memory_kb": 214668}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s825388327", "group_id": "codeNet:p03292", "input_text": "a,b,c=sort(parse.(Int,split(readline())))\nprintln(c-a)", "language": "Julia", "metadata": {"date": 1535869692, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s825388327.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s825388327", "user_id": "u726630158"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "a,b,c=sort(parse.(Int,split(readline())))\nprintln(c-a)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 54, "cpu_time_ms": 1369, "memory_kb": 152276}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s992443627", "group_id": "codeNet:p03294", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n ans=0\n for i in a\n ans+=i-1\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1583536634, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s992443627.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s992443627", "user_id": "u619197965"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n ans=0\n for i in a\n ans+=i-1\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 449, "cpu_time_ms": 951, "memory_kb": 165516}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s799459103", "group_id": "codeNet:p03294", "input_text": "parseInt(x) = parse(Int,x)\n\n\nfunction main()\n\tn = parseInt(readline())\n\ta = map(parseInt, split(readline()))\n\tsum = 0\n\tfor i in 1:n\n\t\tsum += a[i]-1\n\tend\n\tprint(sum)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541882913, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s799459103.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s799459103", "user_id": "u095714878"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\n\nfunction main()\n\tn = parseInt(readline())\n\ta = map(parseInt, split(readline()))\n\tsum = 0\n\tfor i in 1:n\n\t\tsum += a[i]-1\n\tend\n\tprint(sum)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 908, "memory_kb": 171016}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s016075844", "group_id": "codeNet:p03295", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\ta = Array{Int}(2,m)\n\tfor i in 1:m\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\ta = sortcols(a, by=x->x[1],rev=true)\n\tcount = 0\n\tmcut = 0\n\tfor i in 1:m\n\t\tif a[2,i] < mcut\n\t\t\tcount += 1\n\t\t\tmcut = a[2,i]+1\n\t\tend\n\tend\n\tprintln(count)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1573231582, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s016075844.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s016075844", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\ta = Array{Int}(2,m)\n\tfor i in 1:m\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\ta = sortcols(a, by=x->x[1],rev=true)\n\tcount = 0\n\tmcut = 0\n\tfor i in 1:m\n\t\tif a[2,i] < mcut\n\t\t\tcount += 1\n\t\t\tmcut = a[2,i]+1\n\t\tend\n\tend\n\tprintln(count)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1124, "memory_kb": 182180}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s089974279", "group_id": "codeNet:p03295", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\ta = Array{Int}(2,m)\n\tfor i in 1:m\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\tcount = 0\n\tmcut = 0\n\tfor i in 1:m\n\t\tif a[1,i] > mcut\n\t\t\tcount += 1\n\t\t\tmcut = a[2,i]-1\n\t\tend\n\tend\n\tprintln(count)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1546622440, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s089974279.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s089974279", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\ta = Array{Int}(2,m)\n\tfor i in 1:m\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\tcount = 0\n\tmcut = 0\n\tfor i in 1:m\n\t\tif a[1,i] > mcut\n\t\t\tcount += 1\n\t\t\tmcut = a[2,i]-1\n\t\tend\n\tend\n\tprintln(count)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 995, "memory_kb": 169888}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s460719942", "group_id": "codeNet:p03305", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction hpush(h::Array{Tuple{Int,Int},1},x::Tuple{Int,Int})\n\tpush!(h,x)\n\tif length(h) > 1\n\t\tl = length(h)\n\t\tk = div(l,2)\n\t\twhile h[k][2]>x[2]&&k>=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(div(k,2),1)\n\t\t\tl = div(l,2)\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Tuple{Int,Int},1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>=l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>=l\n\t\t\t\tif h[2*k][2]>=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k][2]>=z[2]&&h[2*k+1][2]>=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k][2]w+1\n\t\t\t\tdis[e[v][i][1]] = w+e[v][i][2]\n\t\t\t\thpush(h,(e[v][i][1],w+e[v][i][2]))\n\t\t\tend\n\t\tend\n\tend\n\tdis\nend\n\nfunction main()\n\tn,m,s,t = readline() |> split |> parseMap\n\te = [Tuple{Int,Int}[] for i in 1:n]\n\tf = [Tuple{Int,Int}[] for i in 1:n]\n\tfor i in 1:m\n\t\tu,v,a,b = readline() |> split |> parseMap\n\t\tpush!(e[u],(v,a))\n\t\tpush!(e[v],(u,a))\n\t\tpush!(f[u],(v,b))\n\t\tpush!(f[v],(u,b))\n\tend\n\tdy = dijkstra(e,s)\n\tds = dijkstra(f,t)\n\tx = Array{Tuple{Int,Int},1}(n)\n\tfor i in 1:n\n\t\tx[i] = (i,dy[i]+ds[i])\n\tend\n\tx = sort(x,by=x->x[2])\n\tprintln(\"hoge\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1565569085, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s460719942.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s460719942", "user_id": "u095714878"}, "prompt_components": {"gold_output": "999999999999998\n999999999999989\n999999999999979\n999999999999897\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction hpush(h::Array{Tuple{Int,Int},1},x::Tuple{Int,Int})\n\tpush!(h,x)\n\tif length(h) > 1\n\t\tl = length(h)\n\t\tk = div(l,2)\n\t\twhile h[k][2]>x[2]&&k>=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(div(k,2),1)\n\t\t\tl = div(l,2)\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Tuple{Int,Int},1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>=l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>=l\n\t\t\t\tif h[2*k][2]>=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif h[2*k][2]>=z[2]&&h[2*k+1][2]>=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k][2]w+1\n\t\t\t\tdis[e[v][i][1]] = w+e[v][i][2]\n\t\t\t\thpush(h,(e[v][i][1],w+e[v][i][2]))\n\t\t\tend\n\t\tend\n\tend\n\tdis\nend\n\nfunction main()\n\tn,m,s,t = readline() |> split |> parseMap\n\te = [Tuple{Int,Int}[] for i in 1:n]\n\tf = [Tuple{Int,Int}[] for i in 1:n]\n\tfor i in 1:m\n\t\tu,v,a,b = readline() |> split |> parseMap\n\t\tpush!(e[u],(v,a))\n\t\tpush!(e[v],(u,a))\n\t\tpush!(f[u],(v,b))\n\t\tpush!(f[v],(u,b))\n\tend\n\tdy = dijkstra(e,s)\n\tds = dijkstra(f,t)\n\tx = Array{Tuple{Int,Int},1}(n)\n\tfor i in 1:n\n\t\tx[i] = (i,dy[i]+ds[i])\n\tend\n\tx = sort(x,by=x->x[2])\n\tprintln(\"hoge\")\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1646, "cpu_time_ms": 2115, "memory_kb": 727476}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s898405595", "group_id": "codeNet:p03306", "input_text": "#include \n\n#define rep(n) for(int i=0;i Pll;\ntypedef pair Pii;\n\nconst ll MOD = 1000000007;\nconst long double EPS = 10e-10;\n\nstruct State{\n int node, a, depth;\n State(int node, int a, int depth): node(node), a(a), depth(depth) {}\n};\n\nbool used[100000];\nint s[100000];\nint n,m;\nvector G[100000];\n\nint main(){\n std::ios::sync_with_stdio(0); cin.tie(0);\n cin >> n >> m;\n int a,b,ss;\n rep(m){\n cin >> a >> b >> ss;\n a--; b--;\n G[a].emplace_back(b, ss);\n G[b].emplace_back(a, ss);\n }\n\n int upper_lim = INT_MAX, lower_lim = 0;\n queue que;\n que.emplace(State(0, 0, 0));\n while(!que.empty()){\n State t = que.front(); que.pop();\n used[t.node] = true;\n for(Pii child: G[t.node]){\n int a = t.a;\n if(t.depth % 2){\n a -= child.second;\n lower_lim = max(lower_lim, a);\n }else{\n a += child.second;\n upper_lim = min(upper_lim, a);\n }\n if(used[child.first]) continue;\n que.emplace(State(child.first, a, t.depth+1));\n }\n }\n cout << (upper_lim>lower_lim?upper_lim-lower_lim-1:0) << \"\\n\";\n}", "language": "Julia", "metadata": {"date": 1531341983, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03306.html", "problem_id": "p03306", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03306/input.txt", "sample_output_relpath": "derived/input_output/data/p03306/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03306/Julia/s898405595.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s898405595", "user_id": "u986399983"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "#include \n\n#define rep(n) for(int i=0;i Pll;\ntypedef pair Pii;\n\nconst ll MOD = 1000000007;\nconst long double EPS = 10e-10;\n\nstruct State{\n int node, a, depth;\n State(int node, int a, int depth): node(node), a(a), depth(depth) {}\n};\n\nbool used[100000];\nint s[100000];\nint n,m;\nvector G[100000];\n\nint main(){\n std::ios::sync_with_stdio(0); cin.tie(0);\n cin >> n >> m;\n int a,b,ss;\n rep(m){\n cin >> a >> b >> ss;\n a--; b--;\n G[a].emplace_back(b, ss);\n G[b].emplace_back(a, ss);\n }\n\n int upper_lim = INT_MAX, lower_lim = 0;\n queue que;\n que.emplace(State(0, 0, 0));\n while(!que.empty()){\n State t = que.front(); que.pop();\n used[t.node] = true;\n for(Pii child: G[t.node]){\n int a = t.a;\n if(t.depth % 2){\n a -= child.second;\n lower_lim = max(lower_lim, a);\n }else{\n a += child.second;\n upper_lim = min(upper_lim, a);\n }\n if(used[child.first]) continue;\n que.emplace(State(child.first, a, t.depth+1));\n }\n }\n cout << (upper_lim>lower_lim?upper_lim-lower_lim-1:0) << \"\\n\";\n}", "problem_context": "Score : 600 points\n\nProblem Statement\n\nKenkoooo found a simple connected graph.\nThe vertices are numbered 1 through n.\nThe i-th edge connects Vertex u_i and v_i, and has a fixed integer s_i.\n\nKenkoooo is trying to write a positive integer in each vertex so that the following condition is satisfied:\n\nFor every edge i, the sum of the positive integers written in Vertex u_i and v_i is equal to s_i.\n\nFind the number of such ways to write positive integers in the vertices.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n1 \\leq m \\leq 10^5\n\n1 \\leq u_i < v_i \\leq n\n\n2 \\leq s_i \\leq 10^9\n\nIf i\\neq j, then u_i \\neq u_j or v_i \\neq v_j.\n\nThe graph is connected.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\nu_1 v_1 s_1\n:\nu_m v_m s_m\n\nOutput\n\nPrint the number of ways to write positive integers in the vertices so that the condition is satisfied.\n\nSample Input 1\n\n3 3\n1 2 3\n2 3 5\n1 3 4\n\nSample Output 1\n\n1\n\nThe condition will be satisfied if we write 1,2 and 3 in vertices 1,2 and 3, respectively.\nThere is no other way to satisfy the condition, so the answer is 1.\n\nSample Input 2\n\n4 3\n1 2 6\n2 3 7\n3 4 5\n\nSample Output 2\n\n3\n\nLet a,b,c and d be the numbers to write in vertices 1,2,3 and 4, respectively.\nThere are three quadruples (a,b,c,d) that satisfy the condition:\n\n(a,b,c,d)=(1,5,2,3)\n\n(a,b,c,d)=(2,4,3,2)\n\n(a,b,c,d)=(3,3,4,1)\n\nSample Input 3\n\n8 7\n1 2 1000000000\n2 3 2\n3 4 1000000000\n4 5 2\n5 6 1000000000\n6 7 2\n7 8 1000000000\n\nSample Output 3\n\n0", "sample_input": "3 3\n1 2 3\n2 3 5\n1 3 4\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03306", "source_text": "Score : 600 points\n\nProblem Statement\n\nKenkoooo found a simple connected graph.\nThe vertices are numbered 1 through n.\nThe i-th edge connects Vertex u_i and v_i, and has a fixed integer s_i.\n\nKenkoooo is trying to write a positive integer in each vertex so that the following condition is satisfied:\n\nFor every edge i, the sum of the positive integers written in Vertex u_i and v_i is equal to s_i.\n\nFind the number of such ways to write positive integers in the vertices.\n\nConstraints\n\n2 \\leq n \\leq 10^5\n\n1 \\leq m \\leq 10^5\n\n1 \\leq u_i < v_i \\leq n\n\n2 \\leq s_i \\leq 10^9\n\nIf i\\neq j, then u_i \\neq u_j or v_i \\neq v_j.\n\nThe graph is connected.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\nu_1 v_1 s_1\n:\nu_m v_m s_m\n\nOutput\n\nPrint the number of ways to write positive integers in the vertices so that the condition is satisfied.\n\nSample Input 1\n\n3 3\n1 2 3\n2 3 5\n1 3 4\n\nSample Output 1\n\n1\n\nThe condition will be satisfied if we write 1,2 and 3 in vertices 1,2 and 3, respectively.\nThere is no other way to satisfy the condition, so the answer is 1.\n\nSample Input 2\n\n4 3\n1 2 6\n2 3 7\n3 4 5\n\nSample Output 2\n\n3\n\nLet a,b,c and d be the numbers to write in vertices 1,2,3 and 4, respectively.\nThere are three quadruples (a,b,c,d) that satisfy the condition:\n\n(a,b,c,d)=(1,5,2,3)\n\n(a,b,c,d)=(2,4,3,2)\n\n(a,b,c,d)=(3,3,4,1)\n\nSample Input 3\n\n8 7\n1 2 1000000000\n2 3 2\n3 4 1000000000\n4 5 2\n5 6 1000000000\n6 7 2\n7 8 1000000000\n\nSample Output 3\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1503, "cpu_time_ms": 1148, "memory_kb": 195964}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s692241808", "group_id": "codeNet:p03307", "input_text": "println(lcm(2,parse(readline())))", "language": "Julia", "metadata": {"date": 1561335877, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s692241808.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s692241808", "user_id": "u657913472"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "println(lcm(2,parse(readline())))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 33, "cpu_time_ms": 307, "memory_kb": 109592}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s018141189", "group_id": "codeNet:p03307", "input_text": "function parseInt(x) parse(Int64, x) end\n\nfunction main()\n a = readline() |> parseInt\n println(a % 2 == 0 ? a : a * 2)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1530789087, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s018141189.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s018141189", "user_id": "u123135189"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "function parseInt(x) parse(Int64, x) end\n\nfunction main()\n a = readline() |> parseInt\n println(a % 2 == 0 ? a : a * 2)\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 137, "cpu_time_ms": 353, "memory_kb": 111472}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s764732335", "group_id": "codeNet:p03308", "input_text": "function parseInt(x) parse(Int64, x) end\n\nfunction main()\n n = readline() |> parseInt\n a = readline() |> split |> x -> parseInt.(x)\n println(maximum(a) - minimum(a))\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1530500303, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s764732335.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s764732335", "user_id": "u123135189"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "function parseInt(x) parse(Int64, x) end\n\nfunction main()\n n = readline() |> parseInt\n a = readline() |> split |> x -> parseInt.(x)\n println(maximum(a) - minimum(a))\nend\n\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1769, "memory_kb": 135976}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s122694267", "group_id": "codeNet:p03309", "input_text": "N=parse(Int,readline())\nA=map(x->parse(Int,x),split(readline()))\nfor i=1:N\n\tA[i]-=i\nend\nsort!(A)\nans=0\nfor i=1:N\n\tans+=abs(A[i]-A[(N+1)>>1])\nend\nprintln(ans)\n", "language": "Julia", "metadata": {"date": 1561336023, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s122694267.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s122694267", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N=parse(Int,readline())\nA=map(x->parse(Int,x),split(readline()))\nfor i=1:N\n\tA[i]-=i\nend\nsort!(A)\nans=0\nfor i=1:N\n\tans+=abs(A[i]-A[(N+1)>>1])\nend\nprintln(ans)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 158, "cpu_time_ms": 704, "memory_kb": 153996}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s098040982", "group_id": "codeNet:p03309", "input_text": "function parseInt(x) parse(Int, x) end\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = map(parseInt, readline() |> split)\n\tb = Array{Int}(n)\n\tfor i in 1:n\n\t\tb[i] = a[i] -i\n\tend\n\tm = median(b)\n\tsum = 0\n\tfor i in 1:n\n\t\tsum += abs(b[i]-m)\n\tend\n\tprintln(convert(Int, sum))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541244830, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s098040982.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s098040982", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = map(parseInt, readline() |> split)\n\tb = Array{Int}(n)\n\tfor i in 1:n\n\t\tb[i] = a[i] -i\n\tend\n\tm = median(b)\n\tsum = 0\n\tfor i in 1:n\n\t\tsum += abs(b[i]-m)\n\tend\n\tprintln(convert(Int, sum))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 700, "memory_kb": 154624}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s344869797", "group_id": "codeNet:p03315", "input_text": "function main()\n \n s = split(readline(),\"\")\n \n ans = 0\n \n for i in 1:4\n \n if s[i] == \"+\"\n ans += 1\n else\n ans -= 1\n end\n \n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1579320208, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s344869797.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s344869797", "user_id": "u790457721"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n \n s = split(readline(),\"\")\n \n ans = 0\n \n for i in 1:4\n \n if s[i] == \"+\"\n ans += 1\n else\n ans -= 1\n end\n \n end\n \n println(ans)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 330, "memory_kb": 110032}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s781664811", "group_id": "codeNet:p03315", "input_text": "function main()\n\tn = split(readline(), \"\")\n\tt = 0\n\tfor i in 1:length(n)\n\t\tif n[i] == \"+\"\n\t\t\tt += 1\n\t\telse\n\t\t\tt -= 1\n\t\tend\n\tend\n\tprint(t)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1540471421, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s781664811.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s781664811", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n\tn = split(readline(), \"\")\n\tt = 0\n\tfor i in 1:length(n)\n\t\tif n[i] == \"+\"\n\t\t\tt += 1\n\t\telse\n\t\t\tt -= 1\n\t\tend\n\tend\n\tprint(t)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 148, "cpu_time_ms": 313, "memory_kb": 110112}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s760800112", "group_id": "codeNet:p03316", "input_text": "function main()\n\tn = parse(readline())\n\tm = n\n\ts = 0\n\ti = 1\n\twhile n >= 10^(i-1)\n\t\ts += (m%10^i)/(10^(i-1))\n\t\tm -= m%10^i\n\t\ti += 1\n\tend\n\tif n%s == 0\n\t\tprint(\"Yes\")\n\telse\n\t\tprint(\"No\")\n\tend\nend\n \nmain()", "language": "Julia", "metadata": {"date": 1540642465, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s760800112.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s760800112", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n\tn = parse(readline())\n\tm = n\n\ts = 0\n\ti = 1\n\twhile n >= 10^(i-1)\n\t\ts += (m%10^i)/(10^(i-1))\n\t\tm -= m%10^i\n\t\ti += 1\n\tend\n\tif n%s == 0\n\t\tprint(\"Yes\")\n\telse\n\t\tprint(\"No\")\n\tend\nend\n \nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 824, "memory_kb": 167916}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s293920260", "group_id": "codeNet:p03317", "input_text": "function parseInt(x) parse(Int, x) end\n\n\nfunction main()\n n = parseInt.(split(readline()))\n a = parseInt.(split(readline()))\n\tq = (n[1]-1)%(n[2]-1)\n p = convert(Int, (n[1]-1-q)/(n[2]-1))\n if q == 0\n print(p)\n else\n\t print(p+1)\n end\n end\n\nmain()", "language": "Julia", "metadata": {"date": 1540572519, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03317.html", "problem_id": "p03317", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03317/input.txt", "sample_output_relpath": "derived/input_output/data/p03317/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03317/Julia/s293920260.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s293920260", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\n\n\nfunction main()\n n = parseInt.(split(readline()))\n a = parseInt.(split(readline()))\n\tq = (n[1]-1)%(n[2]-1)\n p = convert(Int, (n[1]-1-q)/(n[2]-1))\n if q == 0\n print(p)\n else\n\t print(p+1)\n end\n end\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\n\nOn this sequence, Snuke can perform the following operation:\n\nChoose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.\n\nSnuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.\nFind the minimum number of operations required.\nIt can be proved that, Under the constraints of this problem, this objective is always achievable.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 100000\n\nA_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 3\n2 3 1 4\n\nSample Output 1\n\n2\n\nOne optimal strategy is as follows:\n\nIn the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\nIn the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\nSample Input 2\n\n3 3\n1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n8 3\n7 3 1 8 4 6 2 5\n\nSample Output 3\n\n4", "sample_input": "4 3\n2 3 1 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03317", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\n\nOn this sequence, Snuke can perform the following operation:\n\nChoose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.\n\nSnuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.\nFind the minimum number of operations required.\nIt can be proved that, Under the constraints of this problem, this objective is always achievable.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 100000\n\nA_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 3\n2 3 1 4\n\nSample Output 1\n\n2\n\nOne optimal strategy is as follows:\n\nIn the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\nIn the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\nSample Input 2\n\n3 3\n1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n8 3\n7 3 1 8 4 6 2 5\n\nSample Output 3\n\n4", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 454, "memory_kb": 120020}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s679323097", "group_id": "codeNet:p03317", "input_text": "function parseInt(x) parse(Int, x) end\n\n\nfunction main()\n n = parseInt.(split(readline()))\n a = parseInt.(split(readline()))\n if n[1] == n[2]\n print(1)\n else\n num = 0\n count = 0\n for i in 1:n[1]\n if a[i] == 1\n num = i\n end\n end\n x = n[1]-num\n y = x%(n[2]-1)\n z = convert(Int, (x-y)/(n[2]-1))\n count += z\n v = (num-1)%(n[2]-1)\n w = convert(Int, (num-1-v)/(n[2]-1))\n count += w\n if n[1]-1 - (n[2]-1)*(z+w) < n[2]\n count += 1\n else\n count+= 2\n end\n print(count)\n end\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1540571505, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03317.html", "problem_id": "p03317", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03317/input.txt", "sample_output_relpath": "derived/input_output/data/p03317/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03317/Julia/s679323097.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s679323097", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\n\n\nfunction main()\n n = parseInt.(split(readline()))\n a = parseInt.(split(readline()))\n if n[1] == n[2]\n print(1)\n else\n num = 0\n count = 0\n for i in 1:n[1]\n if a[i] == 1\n num = i\n end\n end\n x = n[1]-num\n y = x%(n[2]-1)\n z = convert(Int, (x-y)/(n[2]-1))\n count += z\n v = (num-1)%(n[2]-1)\n w = convert(Int, (num-1-v)/(n[2]-1))\n count += w\n if n[1]-1 - (n[2]-1)*(z+w) < n[2]\n count += 1\n else\n count+= 2\n end\n print(count)\n end\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\n\nOn this sequence, Snuke can perform the following operation:\n\nChoose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.\n\nSnuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.\nFind the minimum number of operations required.\nIt can be proved that, Under the constraints of this problem, this objective is always achievable.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 100000\n\nA_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 3\n2 3 1 4\n\nSample Output 1\n\n2\n\nOne optimal strategy is as follows:\n\nIn the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\nIn the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\nSample Input 2\n\n3 3\n1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n8 3\n7 3 1 8 4 6 2 5\n\nSample Output 3\n\n4", "sample_input": "4 3\n2 3 1 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03317", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a sequence of length N: A_1, A_2, ..., A_N. Initially, this sequence is a permutation of 1, 2, ..., N.\n\nOn this sequence, Snuke can perform the following operation:\n\nChoose K consecutive elements in the sequence. Then, replace the value of each chosen element with the minimum value among the chosen elements.\n\nSnuke would like to make all the elements in this sequence equal by repeating the operation above some number of times.\nFind the minimum number of operations required.\nIt can be proved that, Under the constraints of this problem, this objective is always achievable.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 100000\n\nA_1, A_2, ..., A_N is a permutation of 1, 2, ..., N.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4 3\n2 3 1 4\n\nSample Output 1\n\n2\n\nOne optimal strategy is as follows:\n\nIn the first operation, choose the first, second and third elements. The sequence A becomes 1, 1, 1, 4.\n\nIn the second operation, choose the second, third and fourth elements. The sequence A becomes 1, 1, 1, 1.\n\nSample Input 2\n\n3 3\n1 2 3\n\nSample Output 2\n\n1\n\nSample Input 3\n\n8 3\n7 3 1 8 4 6 2 5\n\nSample Output 3\n\n4", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 515, "cpu_time_ms": 489, "memory_kb": 128260}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s149556549", "group_id": "codeNet:p03318", "input_text": "function nsn(x)\n s=dec(x)\n n=parse(s)\n sn=sum(x->x-'0',s)\n n / sn\nend\n\nfunction main()\n k = readline() |> parse\n for x=1:min(81,k)\n n = x % 9\n if n == 0\n n = 9\n end\n keta = cld(x, 9) - 1\n println(n, repeat(\"9\",keta))\n end\n for x=1:(k-81)\n println(x, repeat(\"9\",9))\n end\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1529808357, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03318.html", "problem_id": "p03318", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03318/input.txt", "sample_output_relpath": "derived/input_output/data/p03318/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03318/Julia/s149556549.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s149556549", "user_id": "u123135189"}, "prompt_components": {"gold_output": "1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n", "input_to_evaluate": "function nsn(x)\n s=dec(x)\n n=parse(s)\n sn=sum(x->x-'0',s)\n n / sn\nend\n\nfunction main()\n k = readline() |> parse\n for x=1:min(81,k)\n n = x % 9\n if n == 0\n n = 9\n end\n keta = cld(x, 9) - 1\n println(n, repeat(\"9\",keta))\n end\n for x=1:(k-81)\n println(x, repeat(\"9\",9))\n end\nend\n\nmain()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\n\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq \\frac{m}{S(m)} holds.\n\nGiven an integer K, list the K smallest Snuke numbers.\n\nConstraints\n\n1 \\leq K\n\nThe K-th smallest Snuke number is not greater than 10^{15}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th smallest Snuke number.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n19", "sample_input": "10\n"}, "reference_outputs": ["1\n2\n3\n4\n5\n6\n7\n8\n9\n19\n"], "source_document_id": "p03318", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet S(n) denote the sum of the digits in the decimal notation of n.\nFor example, S(123) = 1 + 2 + 3 = 6.\n\nWe will call an integer n a Snuke number when, for all positive integers m such that m > n, \\frac{n}{S(n)} \\leq \\frac{m}{S(m)} holds.\n\nGiven an integer K, list the K smallest Snuke numbers.\n\nConstraints\n\n1 \\leq K\n\nThe K-th smallest Snuke number is not greater than 10^{15}.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint K lines. The i-th line should contain the i-th smallest Snuke number.\n\nSample Input 1\n\n10\n\nSample Output 1\n\n1\n2\n3\n4\n5\n6\n7\n8\n9\n19", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 744, "memory_kb": 163136}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s772724535", "group_id": "codeNet:p03323", "input_text": "function abc100_b()\n\n\t# STEP.01\n\t# get the number of the slice of cake\n\tD, N = Base.parse.( Int, Base.split( Base.readline( Base.STDIN ) ) )\n\n\tif Base.isequal( N, 100 )\n\t\tnum_presents = 101*100^D\n\telse\n\t\tnum_presents = 100^D\n\tend\n\n\t# STEP.02\n\tBase.println( Base.STDOUT, num_presents )\n\n\t# STEP.TRUE_END\n\treturn Core.nothing\n\nend\n\n#==================================================================================================#\n\nMain.abc100_b()\n", "language": "Julia", "metadata": {"date": 1550786591, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03323.html", "problem_id": "p03323", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03323/input.txt", "sample_output_relpath": "derived/input_output/data/p03323/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03323/Julia/s772724535.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s772724535", "user_id": "u484703930"}, "prompt_components": {"gold_output": "Yay!\n", "input_to_evaluate": "function abc100_b()\n\n\t# STEP.01\n\t# get the number of the slice of cake\n\tD, N = Base.parse.( Int, Base.split( Base.readline( Base.STDIN ) ) )\n\n\tif Base.isequal( N, 100 )\n\t\tnum_presents = 101*100^D\n\telse\n\t\tnum_presents = 100^D\n\tend\n\n\t# STEP.02\n\tBase.println( Base.STDOUT, num_presents )\n\n\t# STEP.TRUE_END\n\treturn Core.nothing\n\nend\n\n#==================================================================================================#\n\nMain.abc100_b()\n", "problem_context": "Score: 100 points\n\nProblem Statement\n\nE869120's and square1001's 16-th birthday is coming soon.\n\nTakahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces.\n\nE869120 and square1001 were just about to eat A and B of those pieces, respectively,\n\nwhen they found a note attached to the cake saying that \"the same person should not take two adjacent pieces of cake\".\n\nCan both of them obey the instruction in the note and take desired numbers of pieces of cake?\n\nConstraints\n\nA and B are integers between 1 and 16 (inclusive).\n\nA+B is at most 16.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf both E869120 and square1001 can obey the instruction in the note and take desired numbers of pieces of cake, print Yay!; otherwise, print :(.\n\nSample Input 1\n\n5 4\n\nSample Output 1\n\nYay!\n\nBoth of them can take desired number of pieces as follows:\n\nSample Input 2\n\n8 8\n\nSample Output 2\n\nYay!\n\nBoth of them can take desired number of pieces as follows:\n\nSample Input 3\n\n11 4\n\nSample Output 3\n\n:(\n\nIn this case, there is no way for them to take desired number of pieces, unfortunately.", "sample_input": "5 4\n"}, "reference_outputs": ["Yay!\n"], "source_document_id": "p03323", "source_text": "Score: 100 points\n\nProblem Statement\n\nE869120's and square1001's 16-th birthday is coming soon.\n\nTakahashi from AtCoder Kingdom gave them a round cake cut into 16 equal fan-shaped pieces.\n\nE869120 and square1001 were just about to eat A and B of those pieces, respectively,\n\nwhen they found a note attached to the cake saying that \"the same person should not take two adjacent pieces of cake\".\n\nCan both of them obey the instruction in the note and take desired numbers of pieces of cake?\n\nConstraints\n\nA and B are integers between 1 and 16 (inclusive).\n\nA+B is at most 16.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nIf both E869120 and square1001 can obey the instruction in the note and take desired numbers of pieces of cake, print Yay!; otherwise, print :(.\n\nSample Input 1\n\n5 4\n\nSample Output 1\n\nYay!\n\nBoth of them can take desired number of pieces as follows:\n\nSample Input 2\n\n8 8\n\nSample Output 2\n\nYay!\n\nBoth of them can take desired number of pieces as follows:\n\nSample Input 3\n\n11 4\n\nSample Output 3\n\n:(\n\nIn this case, there is no way for them to take desired number of pieces, unfortunately.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1399, "memory_kb": 150144}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s811888222", "group_id": "codeNet:p03325", "input_text": "o(x)=even(x/2)?o(x/2)+1:0\nN=parse(Int,readline())\na=parse.(split(readline()))\nprint(sum(o(i)for i=a))", "language": "Julia", "metadata": {"date": 1587947576, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03325.html", "problem_id": "p03325", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03325/input.txt", "sample_output_relpath": "derived/input_output/data/p03325/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03325/Julia/s811888222.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s811888222", "user_id": "u533002064"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "o(x)=even(x/2)?o(x/2)+1:0\nN=parse(Int,readline())\na=parse.(split(readline()))\nprint(sum(o(i)for i=a))", "problem_context": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (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 the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "sample_input": "3\n5 2 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03325", "source_text": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (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 the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1698, "memory_kb": 224904}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s440214563", "group_id": "codeNet:p03325", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n n = readline() |> parseInt\n a = readline() |> split |> parseMap\n\n ans = 0\n for i in 1:n\n while mod(a[i],2) == 0\n a[i] /= 2\n ans += 1\n end\n end\n\n println(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1557945230, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03325.html", "problem_id": "p03325", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03325/input.txt", "sample_output_relpath": "derived/input_output/data/p03325/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03325/Julia/s440214563.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s440214563", "user_id": "u712822150"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n n = readline() |> parseInt\n a = readline() |> split |> parseMap\n\n ans = 0\n for i in 1:n\n while mod(a[i],2) == 0\n a[i] /= 2\n ans += 1\n end\n end\n\n println(ans)\nend\n\nmain()\n", "problem_context": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (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 the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "sample_input": "3\n5 2 4\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03325", "source_text": "Score: 300 points\n\nProblem Statement\n\nAs AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.\n\nSnuke, an employee, would like to play with this sequence.\n\nSpecifically, he would like to repeat the following operation as many times as possible:\n\nFor every i satisfying 1 \\leq i \\leq N, perform one of the following: \"divide a_i by 2\" and \"multiply a_i by 3\".\nHere, choosing \"multiply a_i by 3\" for every i is not allowed, and the value of a_i after the operation must be an integer.\n\nAt most how many operations can be performed?\n\nConstraints\n\nN is an integer between 1 and 10 \\ 000 (inclusive).\n\na_i is an integer between 1 and 1 \\ 000 \\ 000 \\ 000 (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 the maximum number of operations that Snuke can perform.\n\nSample Input 1\n\n3\n5 2 4\n\nSample Output 1\n\n3\n\nThe sequence is initially {5, 2, 4}. Three operations can be performed as follows:\n\nFirst, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.\n\nNext, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.\n\nFinally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.\n\nSample Input 2\n\n4\n631 577 243 199\n\nSample Output 2\n\n0\n\nNo operation can be performed since all the elements are odd. Thus, the answer is 0.\n\nSample Input 3\n\n10\n2184 2126 1721 1800 1024 2528 3360 1945 1280 1776\n\nSample Output 3\n\n39", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 375, "memory_kb": 112360}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s662473600", "group_id": "codeNet:p03326", "input_text": "function main()\n\tlines=readlines()\n\tN,M=map(x->parse(Int,x),split(shift!(lines)))\n\tX=Array{Int}(0)\n\tY=Array{Int}(0)\n\tZ=Array{Int}(0)\n\tfor s=lines\n\t\tx,y,z=map(x->parse(Int,x),split(s))\n\t\tpush!(X,x)\n\t\tpush!(Y,y)\n\t\tpush!(Z,z)\n\tend\n\tans=0\n\tfor i=0:7\n\t\tif i%2==1\n\t\t\tZ=-Z\n\t\tend\n\t\tif i%4==2\n\t\t\tY=-Y\n\t\tend\n\t\tif i==4\n\t\t\tX=-X\n\t\tend\n\t\tnow=X+Y+Z\n\t\tsort!(now)\n\t\tret=0\n\t\tfor j=1:M\n\t\t\tret+=now[N-j+1]\n\t\tend\n\t\tans=max(ans,ret)\n\tend\n\tprintln(ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561336935, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03326.html", "problem_id": "p03326", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03326/input.txt", "sample_output_relpath": "derived/input_output/data/p03326/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03326/Julia/s662473600.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s662473600", "user_id": "u657913472"}, "prompt_components": {"gold_output": "56\n", "input_to_evaluate": "function main()\n\tlines=readlines()\n\tN,M=map(x->parse(Int,x),split(shift!(lines)))\n\tX=Array{Int}(0)\n\tY=Array{Int}(0)\n\tZ=Array{Int}(0)\n\tfor s=lines\n\t\tx,y,z=map(x->parse(Int,x),split(s))\n\t\tpush!(X,x)\n\t\tpush!(Y,y)\n\t\tpush!(Z,z)\n\tend\n\tans=0\n\tfor i=0:7\n\t\tif i%2==1\n\t\t\tZ=-Z\n\t\tend\n\t\tif i%4==2\n\t\t\tY=-Y\n\t\tend\n\t\tif i==4\n\t\t\tX=-X\n\t\tend\n\t\tnow=X+Y+Z\n\t\tsort!(now)\n\t\tret=0\n\t\tfor j=1:M\n\t\t\tret+=now[N-j+1]\n\t\tend\n\t\tans=max(ans,ret)\n\tend\n\tprintln(ans)\nend\nmain()\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nTakahashi became a pastry chef and opened a shop La Confiserie d'ABC to celebrate AtCoder Beginner Contest 100.\n\nThe shop sells N kinds of cakes.\n\nEach kind of cake has three parameters \"beauty\", \"tastiness\" and \"popularity\". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i.\n\nThese values may be zero or negative.\n\nRingo has decided to have M pieces of cakes here. He will choose the set of cakes as follows:\n\nDo not have two or more pieces of the same kind of cake.\n\nUnder the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity).\n\nFind the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.\n\nConstraints\n\nN is an integer between 1 and 1 \\ 000 (inclusive).\n\nM is an integer between 0 and N (inclusive).\n\nx_i, y_i, z_i \\ (1 \\leq i \\leq N) are integers between -10 \\ 000 \\ 000 \\ 000 and 10 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nx_1 y_1 z_1\nx_2 y_2 z_2\n: :\nx_N y_N z_N\n\nOutput\n\nPrint the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.\n\nSample Input 1\n\n5 3\n3 1 4\n1 5 9\n2 6 5\n3 5 8\n9 7 9\n\nSample Output 1\n\n56\n\nConsider having the 2-nd, 4-th and 5-th kinds of cakes. The total beauty, tastiness and popularity will be as follows:\n\nBeauty: 1 + 3 + 9 = 13\n\nTastiness: 5 + 5 + 7 = 17\n\nPopularity: 9 + 8 + 9 = 26\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 13 + 17 + 26 = 56. This is the maximum value.\n\nSample Input 2\n\n5 3\n1 -2 3\n-4 5 -6\n7 -8 -9\n-10 11 -12\n13 -14 15\n\nSample Output 2\n\n54\n\nConsider having the 1-st, 3-rd and 5-th kinds of cakes. The total beauty, tastiness and popularity will be as follows:\n\nBeauty: 1 + 7 + 13 = 21\n\nTastiness: (-2) + (-8) + (-14) = -24\n\nPopularity: 3 + (-9) + 15 = 9\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 21 + 24 + 9 = 54. This is the maximum value.\n\nSample Input 3\n\n10 5\n10 -80 21\n23 8 38\n-94 28 11\n-26 -2 18\n-69 72 79\n-26 -86 -54\n-72 -50 59\n21 65 -32\n40 -94 87\n-62 18 82\n\nSample Output 3\n\n638\n\nIf we have the 3-rd, 4-th, 5-th, 7-th and 10-th kinds of cakes, the total beauty, tastiness and popularity will be -323, 66 and 249, respectively.\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 323 + 66 + 249 = 638. This is the maximum value.\n\nSample Input 4\n\n3 2\n2000000000 -9000000000 4000000000\n7000000000 -5000000000 3000000000\n6000000000 -1000000000 8000000000\n\nSample Output 4\n\n30000000000\n\nThe values of the beauty, tastiness and popularity of the cakes and the value to be printed may not fit into 32-bit integers.", "sample_input": "5 3\n3 1 4\n1 5 9\n2 6 5\n3 5 8\n9 7 9\n"}, "reference_outputs": ["56\n"], "source_document_id": "p03326", "source_text": "Score: 400 points\n\nProblem Statement\n\nTakahashi became a pastry chef and opened a shop La Confiserie d'ABC to celebrate AtCoder Beginner Contest 100.\n\nThe shop sells N kinds of cakes.\n\nEach kind of cake has three parameters \"beauty\", \"tastiness\" and \"popularity\". The i-th kind of cake has the beauty of x_i, the tastiness of y_i and the popularity of z_i.\n\nThese values may be zero or negative.\n\nRingo has decided to have M pieces of cakes here. He will choose the set of cakes as follows:\n\nDo not have two or more pieces of the same kind of cake.\n\nUnder the condition above, choose the set of cakes to maximize (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity).\n\nFind the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.\n\nConstraints\n\nN is an integer between 1 and 1 \\ 000 (inclusive).\n\nM is an integer between 0 and N (inclusive).\n\nx_i, y_i, z_i \\ (1 \\leq i \\leq N) are integers between -10 \\ 000 \\ 000 \\ 000 and 10 \\ 000 \\ 000 \\ 000 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nx_1 y_1 z_1\nx_2 y_2 z_2\n: :\nx_N y_N z_N\n\nOutput\n\nPrint the maximum possible value of (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) for the set of cakes that Ringo chooses.\n\nSample Input 1\n\n5 3\n3 1 4\n1 5 9\n2 6 5\n3 5 8\n9 7 9\n\nSample Output 1\n\n56\n\nConsider having the 2-nd, 4-th and 5-th kinds of cakes. The total beauty, tastiness and popularity will be as follows:\n\nBeauty: 1 + 3 + 9 = 13\n\nTastiness: 5 + 5 + 7 = 17\n\nPopularity: 9 + 8 + 9 = 26\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 13 + 17 + 26 = 56. This is the maximum value.\n\nSample Input 2\n\n5 3\n1 -2 3\n-4 5 -6\n7 -8 -9\n-10 11 -12\n13 -14 15\n\nSample Output 2\n\n54\n\nConsider having the 1-st, 3-rd and 5-th kinds of cakes. The total beauty, tastiness and popularity will be as follows:\n\nBeauty: 1 + 7 + 13 = 21\n\nTastiness: (-2) + (-8) + (-14) = -24\n\nPopularity: 3 + (-9) + 15 = 9\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 21 + 24 + 9 = 54. This is the maximum value.\n\nSample Input 3\n\n10 5\n10 -80 21\n23 8 38\n-94 28 11\n-26 -2 18\n-69 72 79\n-26 -86 -54\n-72 -50 59\n21 65 -32\n40 -94 87\n-62 18 82\n\nSample Output 3\n\n638\n\nIf we have the 3-rd, 4-th, 5-th, 7-th and 10-th kinds of cakes, the total beauty, tastiness and popularity will be -323, 66 and 249, respectively.\n\nThe value (the absolute value of the total beauty) + (the absolute value of the total tastiness) + (the absolute value of the total popularity) here is 323 + 66 + 249 = 638. This is the maximum value.\n\nSample Input 4\n\n3 2\n2000000000 -9000000000 4000000000\n7000000000 -5000000000 3000000000\n6000000000 -1000000000 8000000000\n\nSample Output 4\n\n30000000000\n\nThe values of the beauty, tastiness and popularity of the cakes and the value to be printed may not fit into 32-bit integers.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 448, "memory_kb": 117132}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s552640749", "group_id": "codeNet:p03327", "input_text": "function parseInt(x) parse(Int, x) end\n\nfunction main()\n\tn = readline() |> n -> parseInt(n)\n\tprint(ifelse(n<1000, \"ABC\", \"ABD\"))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1540472085, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03327.html", "problem_id": "p03327", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03327/input.txt", "sample_output_relpath": "derived/input_output/data/p03327/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03327/Julia/s552640749.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s552640749", "user_id": "u095714878"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\n\nfunction main()\n\tn = readline() |> n -> parseInt(n)\n\tprint(ifelse(n<1000, \"ABC\", \"ABD\"))\nend\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nDecades have passed since the beginning of AtCoder Beginner Contest.\n\nThe contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?\n\nIn the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.\n\nYou are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nConstraints\n\n1 \\leq N \\leq 1998\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 first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nSample Input 1\n\n999\n\nSample Output 1\n\nABC\n\nThe 999-th round of AtCoder Beginner Contest is labeled as ABC999.\n\nSample Input 2\n\n1000\n\nSample Output 2\n\nABD\n\nThe 1000-th round of AtCoder Beginner Contest is labeled as ABD001.\n\nSample Input 3\n\n1481\n\nSample Output 3\n\nABD\n\nThe 1481-th round of AtCoder Beginner Contest is labeled as ABD482.", "sample_input": "999\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03327", "source_text": "Score : 100 points\n\nProblem Statement\n\nDecades have passed since the beginning of AtCoder Beginner Contest.\n\nThe contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?\n\nIn the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.\n\nYou are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nConstraints\n\n1 \\leq N \\leq 1998\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 first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nSample Input 1\n\n999\n\nSample Output 1\n\nABC\n\nThe 999-th round of AtCoder Beginner Contest is labeled as ABC999.\n\nSample Input 2\n\n1000\n\nSample Output 2\n\nABD\n\nThe 1000-th round of AtCoder Beginner Contest is labeled as ABD001.\n\nSample Input 3\n\n1481\n\nSample Output 3\n\nABD\n\nThe 1481-th round of AtCoder Beginner Contest is labeled as ABD482.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 264, "memory_kb": 109836}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s476266164", "group_id": "codeNet:p03327", "input_text": "function parseInt(x) parse(Int, x) end\n\nfunction main()\n\tn = readline() |> parseInt(n)\n\tif n < 1000\n\t\tprint(\"ABC\")\n\telse\n\t\tprint(\"ABD\")\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1540471914, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03327.html", "problem_id": "p03327", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03327/input.txt", "sample_output_relpath": "derived/input_output/data/p03327/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03327/Julia/s476266164.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s476266164", "user_id": "u095714878"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\n\nfunction main()\n\tn = readline() |> parseInt(n)\n\tif n < 1000\n\t\tprint(\"ABC\")\n\telse\n\t\tprint(\"ABD\")\n\tend\nend\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nDecades have passed since the beginning of AtCoder Beginner Contest.\n\nThe contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?\n\nIn the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.\n\nYou are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nConstraints\n\n1 \\leq N \\leq 1998\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 first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nSample Input 1\n\n999\n\nSample Output 1\n\nABC\n\nThe 999-th round of AtCoder Beginner Contest is labeled as ABC999.\n\nSample Input 2\n\n1000\n\nSample Output 2\n\nABD\n\nThe 1000-th round of AtCoder Beginner Contest is labeled as ABD001.\n\nSample Input 3\n\n1481\n\nSample Output 3\n\nABD\n\nThe 1481-th round of AtCoder Beginner Contest is labeled as ABD482.", "sample_input": "999\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03327", "source_text": "Score : 100 points\n\nProblem Statement\n\nDecades have passed since the beginning of AtCoder Beginner Contest.\n\nThe contests are labeled as ABC001, ABC002, ... from the first round, but after the 999-th round ABC999, a problem occurred: how the future rounds should be labeled?\n\nIn the end, the labels for the rounds from the 1000-th to the 1998-th are decided: ABD001, ABD002, ..., ABD999.\n\nYou are given an integer N between 1 and 1998 (inclusive). Print the first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nConstraints\n\n1 \\leq N \\leq 1998\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 first three characters of the label of the N-th round of AtCoder Beginner Contest.\n\nSample Input 1\n\n999\n\nSample Output 1\n\nABC\n\nThe 999-th round of AtCoder Beginner Contest is labeled as ABC999.\n\nSample Input 2\n\n1000\n\nSample Output 2\n\nABD\n\nThe 1000-th round of AtCoder Beginner Contest is labeled as ABD001.\n\nSample Input 3\n\n1481\n\nSample Output 3\n\nABD\n\nThe 1481-th round of AtCoder Beginner Contest is labeled as ABD482.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 556, "memory_kb": 128376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s275670895", "group_id": "codeNet:p03328", "input_text": "a,b=map(x->parse(Int,x),split(readline()))\nprintln(div((b-a)*(b-a+1),2)-b)", "language": "Julia", "metadata": {"date": 1561339155, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03328.html", "problem_id": "p03328", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03328/input.txt", "sample_output_relpath": "derived/input_output/data/p03328/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03328/Julia/s275670895.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s275670895", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a,b=map(x->parse(Int,x),split(readline()))\nprintln(div((b-a)*(b-a+1),2)-b)", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.\n\nIt had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower.\n\nAssuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover.\n\nAssume also that the depth of the snow cover is always at least 1 meter.\n\nConstraints\n\n1 \\leq a < b < 499500(=1+2+3+...+999)\n\nAll values in input are integers.\n\nThere is no input that contradicts the assumption.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the depth of the snow cover is x meters, print x as an integer.\n\nSample Input 1\n\n8 13\n\nSample Output 1\n\n2\n\nThe heights of the two towers are 10 meters and 15 meters, respectively.\nThus, we can see that the depth of the snow cover is 2 meters.\n\nSample Input 2\n\n54 65\n\nSample Output 2\n\n1", "sample_input": "8 13\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03328", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn some village, there are 999 towers that are 1,(1+2),(1+2+3),...,(1+2+3+...+999) meters high from west to east, at intervals of 1 meter.\n\nIt had been snowing for a while before it finally stopped. For some two adjacent towers located 1 meter apart, we measured the lengths of the parts of those towers that are not covered with snow, and the results are a meters for the west tower, and b meters for the east tower.\n\nAssuming that the depth of snow cover and the altitude are the same everywhere in the village, find the amount of the snow cover.\n\nAssume also that the depth of the snow cover is always at least 1 meter.\n\nConstraints\n\n1 \\leq a < b < 499500(=1+2+3+...+999)\n\nAll values in input are integers.\n\nThere is no input that contradicts the assumption.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the depth of the snow cover is x meters, print x as an integer.\n\nSample Input 1\n\n8 13\n\nSample Output 1\n\n2\n\nThe heights of the two towers are 10 meters and 15 meters, respectively.\nThus, we can see that the depth of the snow cover is 2 meters.\n\nSample Input 2\n\n54 65\n\nSample Output 2\n\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 74, "cpu_time_ms": 338, "memory_kb": 110088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s932811514", "group_id": "codeNet:p03329", "input_text": "function main()\n\tdp=zeros(Int,100001)\n\tfor i=2:100001\n\t\tdp[i]=dp[i-1]+1\n\t\tfor j=1:10\n\t\t\tif i>6^j\n\t\t\t\tdp[i]=min(dp[i],dp[i-6^j]+1)\n\t\t\tend\n\t\t\tif i>9^j\n\t\t\t\tdp[i]=min(dp[i],dp[i-9^j]+1)\n\t\t\tend\n\t\tend\n\tend\n\tprintln(dp[parse(Int,readline())+1])\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561339308, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03329.html", "problem_id": "p03329", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03329/input.txt", "sample_output_relpath": "derived/input_output/data/p03329/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03329/Julia/s932811514.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s932811514", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function main()\n\tdp=zeros(Int,100001)\n\tfor i=2:100001\n\t\tdp[i]=dp[i-1]+1\n\t\tfor j=1:10\n\t\t\tif i>6^j\n\t\t\t\tdp[i]=min(dp[i],dp[i-6^j]+1)\n\t\t\tend\n\t\t\tif i>9^j\n\t\t\t\tdp[i]=min(dp[i],dp[i-9^j]+1)\n\t\t\tend\n\t\tend\n\tend\n\tprintln(dp[parse(Int,readline())+1])\nend\nmain()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTo make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:\n\n1 yen (the currency of Japan)\n\n6 yen, 6^2(=36) yen, 6^3(=216) yen, ...\n\n9 yen, 9^2(=81) yen, 9^3(=729) yen, ...\n\nAt least how many operations are required to withdraw exactly N yen in total?\n\nIt is not allowed to re-deposit the money you withdrew.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf at least x operations are required to withdraw exactly N yen in total, print x.\n\nSample Input 1\n\n127\n\nSample Output 1\n\n4\n\nBy withdrawing 1 yen, 9 yen, 36(=6^2) yen and 81(=9^2) yen, we can withdraw 127 yen in four operations.\n\nSample Input 2\n\n3\n\nSample Output 2\n\n3\n\nBy withdrawing 1 yen three times, we can withdraw 3 yen in three operations.\n\nSample Input 3\n\n44852\n\nSample Output 3\n\n16", "sample_input": "127\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03329", "source_text": "Score : 300 points\n\nProblem Statement\n\nTo make it difficult to withdraw money, a certain bank allows its customers to withdraw only one of the following amounts in one operation:\n\n1 yen (the currency of Japan)\n\n6 yen, 6^2(=36) yen, 6^3(=216) yen, ...\n\n9 yen, 9^2(=81) yen, 9^3(=729) yen, ...\n\nAt least how many operations are required to withdraw exactly N yen in total?\n\nIt is not allowed to re-deposit the money you withdrew.\n\nConstraints\n\n1 \\leq N \\leq 100000\n\nN is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nIf at least x operations are required to withdraw exactly N yen in total, print x.\n\nSample Input 1\n\n127\n\nSample Output 1\n\n4\n\nBy withdrawing 1 yen, 9 yen, 36(=6^2) yen and 81(=9^2) yen, we can withdraw 127 yen in four operations.\n\nSample Input 2\n\n3\n\nSample Output 2\n\n3\n\nBy withdrawing 1 yen three times, we can withdraw 3 yen in three operations.\n\nSample Input 3\n\n44852\n\nSample Output 3\n\n16", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 345, "memory_kb": 110988}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s919877019", "group_id": "codeNet:p03331", "input_text": "function main()\n n = parse.(split(chomp(readline()), \"\"))\n sum = 0\n for i in 1:length(n)\n sum += n[i]\n end\n print(sum)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541019263, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03331.html", "problem_id": "p03331", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03331/input.txt", "sample_output_relpath": "derived/input_output/data/p03331/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03331/Julia/s919877019.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s919877019", "user_id": "u095714878"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "function main()\n n = parse.(split(chomp(readline()), \"\"))\n sum = 0\n for i in 1:length(n)\n sum += n[i]\n end\n print(sum)\nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has two positive integers A and B.\n\nIt is known that A plus B equals N.\nFind the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\" (in base 10).\n\nConstraints\n\n2 ≤ N ≤ 10^5\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 possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\".\n\nSample Input 1\n\n15\n\nSample Output 1\n\n6\n\nWhen A=2 and B=13, the sums of their digits are 2 and 4, which minimizes the value in question.\n\nSample Input 2\n\n100000\n\nSample Output 2\n\n10", "sample_input": "15\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03331", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has two positive integers A and B.\n\nIt is known that A plus B equals N.\nFind the minimum possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\" (in base 10).\n\nConstraints\n\n2 ≤ N ≤ 10^5\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 possible value of \"the sum of the digits of A\" plus \"the sum of the digits of B\".\n\nSample Input 1\n\n15\n\nSample Output 1\n\n6\n\nWhen A=2 and B=13, the sums of their digits are 2 and 4, which minimizes the value in question.\n\nSample Input 2\n\n100000\n\nSample Output 2\n\n10", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 543, "memory_kb": 119692}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s296346530", "group_id": "codeNet:p03332", "input_text": "function cmb(n,k)\n\tx = 1\n\tfor i in 0:k-1\n\t\tx *= (n-i)/(k-i)\n\t\tx = x%998244353\n\tend\n\treturn(convert(Int,x))\nend\n\nfunction main()\n\tn,a,b,k = map(x->parse(Int,x), split(readline()))\n\tcount = 0\n\tfor i in 0:n\n\t\tif (k-i*a)%b==0\n\t\t\tj = div(k-i*a,b)\n\t\t\tif i+j <= n\n\t\t\t\tcount += cmb(n,i)*cmb(n,j)\n\t\t\tend\n\t\tend\n\tend\n\tprint(count)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1546102215, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03332.html", "problem_id": "p03332", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03332/input.txt", "sample_output_relpath": "derived/input_output/data/p03332/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03332/Julia/s296346530.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s296346530", "user_id": "u095714878"}, "prompt_components": {"gold_output": "40\n", "input_to_evaluate": "function cmb(n,k)\n\tx = 1\n\tfor i in 0:k-1\n\t\tx *= (n-i)/(k-i)\n\t\tx = x%998244353\n\tend\n\treturn(convert(Int,x))\nend\n\nfunction main()\n\tn,a,b,k = map(x->parse(Int,x), split(readline()))\n\tcount = 0\n\tfor i in 0:n\n\t\tif (k-i*a)%b==0\n\t\t\tj = div(k-i*a,b)\n\t\t\tif i+j <= n\n\t\t\t\tcount += cmb(n,i)*cmb(n,j)\n\t\t\tend\n\t\tend\n\tend\n\tprint(count)\nend\n\nmain()", "problem_context": "Score : 700 points\n\nProblem Statement\n\nTakahashi has a tower which is divided into N layers.\nInitially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower.\nHe defines the beauty of the tower as follows:\n\nThe beauty of the tower is the sum of the scores of the N layers, where the score of a layer is A if the layer is painted red, A+B if the layer is painted green, B if the layer is painted blue, and 0 if the layer is uncolored.\n\nHere, A and B are positive integer constants given beforehand. Also note that a layer may not be painted in two or more colors.\n\nTakahashi is planning to paint the tower so that the beauty of the tower becomes exactly K.\nHow many such ways are there to paint the tower? Find the count modulo 998244353.\nTwo ways to paint the tower are considered different when there exists a layer that is painted in different colors, or a layer that is painted in some color in one of the ways and not in the other.\n\nConstraints\n\n1 ≤ N ≤ 3×10^5\n\n1 ≤ A,B ≤ 3×10^5\n\n0 ≤ K ≤ 18×10^{10}\n\nAll values in the input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B K\n\nOutput\n\nPrint the number of the ways to paint tiles, modulo 998244353.\n\nSample Input 1\n\n4 1 2 5\n\nSample Output 1\n\n40\n\nIn this case, a red layer worth 1 points, a green layer worth 3 points and the blue layer worth 2 points. The beauty of the tower is 5 when we have one of the following sets of painted layers:\n\n1 green, 1 blue\n\n1 red, 2 blues\n\n2 reds, 1 green\n\n3 reds, 1 blue\n\nThe total number of the ways to produce them is 40.\n\nSample Input 2\n\n2 5 6 0\n\nSample Output 2\n\n1\n\nThe beauty of the tower is 0 only when all the layers are uncolored. Thus, the answer is 1.\n\nSample Input 3\n\n90081 33447 90629 6391049189\n\nSample Output 3\n\n577742975", "sample_input": "4 1 2 5\n"}, "reference_outputs": ["40\n"], "source_document_id": "p03332", "source_text": "Score : 700 points\n\nProblem Statement\n\nTakahashi has a tower which is divided into N layers.\nInitially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower.\nHe defines the beauty of the tower as follows:\n\nThe beauty of the tower is the sum of the scores of the N layers, where the score of a layer is A if the layer is painted red, A+B if the layer is painted green, B if the layer is painted blue, and 0 if the layer is uncolored.\n\nHere, A and B are positive integer constants given beforehand. Also note that a layer may not be painted in two or more colors.\n\nTakahashi is planning to paint the tower so that the beauty of the tower becomes exactly K.\nHow many such ways are there to paint the tower? Find the count modulo 998244353.\nTwo ways to paint the tower are considered different when there exists a layer that is painted in different colors, or a layer that is painted in some color in one of the ways and not in the other.\n\nConstraints\n\n1 ≤ N ≤ 3×10^5\n\n1 ≤ A,B ≤ 3×10^5\n\n0 ≤ K ≤ 18×10^{10}\n\nAll values in the input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B K\n\nOutput\n\nPrint the number of the ways to paint tiles, modulo 998244353.\n\nSample Input 1\n\n4 1 2 5\n\nSample Output 1\n\n40\n\nIn this case, a red layer worth 1 points, a green layer worth 3 points and the blue layer worth 2 points. The beauty of the tower is 5 when we have one of the following sets of painted layers:\n\n1 green, 1 blue\n\n1 red, 2 blues\n\n2 reds, 1 green\n\n3 reds, 1 blue\n\nThe total number of the ways to produce them is 40.\n\nSample Input 2\n\n2 5 6 0\n\nSample Output 2\n\n1\n\nThe beauty of the tower is 0 only when all the layers are uncolored. Thus, the answer is 1.\n\nSample Input 3\n\n90081 33447 90629 6391049189\n\nSample Output 3\n\n577742975", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1449, "memory_kb": 241200}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s136463080", "group_id": "codeNet:p03337", "input_text": "a,b=parse.(Int,split(readline()))\nc=[a+b,a-b,a*b]\nprintln(findmax(c)[1])", "language": "Julia", "metadata": {"date": 1601075067, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p03337.html", "problem_id": "p03337", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03337/input.txt", "sample_output_relpath": "derived/input_output/data/p03337/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03337/Julia/s136463080.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s136463080", "user_id": "u062736195"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "a,b=parse.(Int,split(readline()))\nc=[a+b,a-b,a*b]\nprintln(findmax(c)[1])", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers A and B.\nFind the largest value among A+B, A-B and A \\times B.\n\nConstraints\n\n-1000 \\leq A,B \\leq 1000\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 largest value among A+B, A-B and A \\times B.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\n4\n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\nSample Input 2\n\n4 -2\n\nSample Output 2\n\n6\n\nThe largest is 4 - (-2) = 6.\n\nSample Input 3\n\n0 0\n\nSample Output 3\n\n0", "sample_input": "3 1\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03337", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given two integers A and B.\nFind the largest value among A+B, A-B and A \\times B.\n\nConstraints\n\n-1000 \\leq A,B \\leq 1000\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 largest value among A+B, A-B and A \\times B.\n\nSample Input 1\n\n3 1\n\nSample Output 1\n\n4\n\n3+1=4, 3-1=2 and 3 \\times 1=3. The largest among them is 4.\n\nSample Input 2\n\n4 -2\n\nSample Output 2\n\n6\n\nThe largest is 4 - (-2) = 6.\n\nSample Input 3\n\n0 0\n\nSample Output 3\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 72, "cpu_time_ms": 310, "memory_kb": 176348}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s813548457", "group_id": "codeNet:p03345", "input_text": "array = parse.(split(readline()))\nans = array[4] % 2 == 0 ? array[1] - array[2] : array[2] - array[1]\nprintln(abs(ans) > 10^18 ? \"Unfair\" : ans)", "language": "Julia", "metadata": {"date": 1567298547, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03345.html", "problem_id": "p03345", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03345/input.txt", "sample_output_relpath": "derived/input_output/data/p03345/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03345/Julia/s813548457.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s813548457", "user_id": "u568955728"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "array = parse.(split(readline()))\nans = array[4] % 2 == 0 ? array[1] - array[2] : array[2] - array[1]\nprintln(abs(ans) > 10^18 ? \"Unfair\" : ans)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi, Nakahashi and Hikuhashi have integers A, B and C, respectively.\nAfter repeating the following operation K times, find the integer Takahashi will get minus the integer Nakahashi will get:\n\nEach of them simultaneously calculate the sum of the integers that the other two people have, then replace his own integer with the result.\n\nHowever, if the absolute value of the answer exceeds 10^{18}, print Unfair instead.\n\nConstraints\n\n1 \\leq A,B,C \\leq 10^9\n\n0 \\leq K \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the integer Takahashi will get minus the integer Nakahashi will get, after repeating the following operation K times.\nIf the absolute value of the answer exceeds 10^{18}, print Unfair instead.\n\nSample Input 1\n\n1 2 3 1\n\nSample Output 1\n\n1\n\nAfter one operation, Takahashi, Nakahashi and Hikuhashi have 5, 4 and 3, respectively. We should print 5-4=1.\n\nSample Input 2\n\n2 3 2 0\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n1000000000 1000000000 1000000000 1000000000000000000\n\nSample Output 3\n\n0", "sample_input": "1 2 3 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03345", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi, Nakahashi and Hikuhashi have integers A, B and C, respectively.\nAfter repeating the following operation K times, find the integer Takahashi will get minus the integer Nakahashi will get:\n\nEach of them simultaneously calculate the sum of the integers that the other two people have, then replace his own integer with the result.\n\nHowever, if the absolute value of the answer exceeds 10^{18}, print Unfair instead.\n\nConstraints\n\n1 \\leq A,B,C \\leq 10^9\n\n0 \\leq K \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the integer Takahashi will get minus the integer Nakahashi will get, after repeating the following operation K times.\nIf the absolute value of the answer exceeds 10^{18}, print Unfair instead.\n\nSample Input 1\n\n1 2 3 1\n\nSample Output 1\n\n1\n\nAfter one operation, Takahashi, Nakahashi and Hikuhashi have 5, 4 and 3, respectively. We should print 5-4=1.\n\nSample Input 2\n\n2 3 2 0\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n1000000000 1000000000 1000000000 1000000000000000000\n\nSample Output 3\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 966, "memory_kb": 175744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s077224726", "group_id": "codeNet:p03345", "input_text": "in_ = parse.(split(readline()))\n\nfor i in 1:in_[4]\n a = in_[1]\n b = in_[2]\n c = in_[3]\n in_[1] = b + c\n in_[2] = a + c\n in_[3] = a + b\nend\n\nans = in_[1]-in_[2]\n\nif ans > 10^18\n print(\"Unfair\")\nelse\n print(ans)\nend\n", "language": "Julia", "metadata": {"date": 1526866831, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03345.html", "problem_id": "p03345", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03345/input.txt", "sample_output_relpath": "derived/input_output/data/p03345/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03345/Julia/s077224726.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s077224726", "user_id": "u624923345"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "in_ = parse.(split(readline()))\n\nfor i in 1:in_[4]\n a = in_[1]\n b = in_[2]\n c = in_[3]\n in_[1] = b + c\n in_[2] = a + c\n in_[3] = a + b\nend\n\nans = in_[1]-in_[2]\n\nif ans > 10^18\n print(\"Unfair\")\nelse\n print(ans)\nend\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi, Nakahashi and Hikuhashi have integers A, B and C, respectively.\nAfter repeating the following operation K times, find the integer Takahashi will get minus the integer Nakahashi will get:\n\nEach of them simultaneously calculate the sum of the integers that the other two people have, then replace his own integer with the result.\n\nHowever, if the absolute value of the answer exceeds 10^{18}, print Unfair instead.\n\nConstraints\n\n1 \\leq A,B,C \\leq 10^9\n\n0 \\leq K \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the integer Takahashi will get minus the integer Nakahashi will get, after repeating the following operation K times.\nIf the absolute value of the answer exceeds 10^{18}, print Unfair instead.\n\nSample Input 1\n\n1 2 3 1\n\nSample Output 1\n\n1\n\nAfter one operation, Takahashi, Nakahashi and Hikuhashi have 5, 4 and 3, respectively. We should print 5-4=1.\n\nSample Input 2\n\n2 3 2 0\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n1000000000 1000000000 1000000000 1000000000000000000\n\nSample Output 3\n\n0", "sample_input": "1 2 3 1\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03345", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi, Nakahashi and Hikuhashi have integers A, B and C, respectively.\nAfter repeating the following operation K times, find the integer Takahashi will get minus the integer Nakahashi will get:\n\nEach of them simultaneously calculate the sum of the integers that the other two people have, then replace his own integer with the result.\n\nHowever, if the absolute value of the answer exceeds 10^{18}, print Unfair instead.\n\nConstraints\n\n1 \\leq A,B,C \\leq 10^9\n\n0 \\leq K \\leq 10^{18}\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B C K\n\nOutput\n\nPrint the integer Takahashi will get minus the integer Nakahashi will get, after repeating the following operation K times.\nIf the absolute value of the answer exceeds 10^{18}, print Unfair instead.\n\nSample Input 1\n\n1 2 3 1\n\nSample Output 1\n\n1\n\nAfter one operation, Takahashi, Nakahashi and Hikuhashi have 5, 4 and 3, respectively. We should print 5-4=1.\n\nSample Input 2\n\n2 3 2 0\n\nSample Output 2\n\n-1\n\nSample Input 3\n\n1000000000 1000000000 1000000000 1000000000000000000\n\nSample Output 3\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2113, "memory_kb": 153608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s811610259", "group_id": "codeNet:p03346", "input_text": "n=parse(readline())\ns=zeros(Int,n+1)\nfor i in 1:n\n p=parse(readline())\n s[p+1]=s[p]+1\nend\nprint(n-maximum(s))", "language": "Julia", "metadata": {"date": 1561316552, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03346.html", "problem_id": "p03346", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03346/input.txt", "sample_output_relpath": "derived/input_output/data/p03346/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03346/Julia/s811610259.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s811610259", "user_id": "u729133443"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n=parse(readline())\ns=zeros(Int,n+1)\nfor i in 1:n\n p=parse(readline())\n s[p+1]=s[p]+1\nend\nprint(n-maximum(s))", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a sequence (P_1,P_2,...,P_N) which is a permutation of the integers from 1 through N.\nYou would like to sort this sequence in ascending order by repeating the following operation:\n\nChoose an element in the sequence and move it to the beginning or the end of the sequence.\n\nFind the minimum number of operations required.\nIt can be proved that it is actually possible to sort the sequence using this operation.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n(P_1,P_2,...,P_N) is a permutation of (1,2,...,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\n:\nP_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4\n1\n3\n2\n4\n\nSample Output 1\n\n2\n\nFor example, the sequence can be sorted in ascending order as follows:\n\nMove 2 to the beginning. The sequence is now (2,1,3,4).\n\nMove 1 to the beginning. The sequence is now (1,2,3,4).\n\nSample Input 2\n\n6\n3\n2\n5\n1\n4\n6\n\nSample Output 2\n\n4\n\nSample Input 3\n\n8\n6\n3\n1\n2\n7\n4\n8\n5\n\nSample Output 3\n\n5", "sample_input": "4\n1\n3\n2\n4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03346", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a sequence (P_1,P_2,...,P_N) which is a permutation of the integers from 1 through N.\nYou would like to sort this sequence in ascending order by repeating the following operation:\n\nChoose an element in the sequence and move it to the beginning or the end of the sequence.\n\nFind the minimum number of operations required.\nIt can be proved that it is actually possible to sort the sequence using this operation.\n\nConstraints\n\n1 \\leq N \\leq 2\\times 10^5\n\n(P_1,P_2,...,P_N) is a permutation of (1,2,...,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\n:\nP_N\n\nOutput\n\nPrint the minimum number of operations required.\n\nSample Input 1\n\n4\n1\n3\n2\n4\n\nSample Output 1\n\n2\n\nFor example, the sequence can be sorted in ascending order as follows:\n\nMove 2 to the beginning. The sequence is now (2,1,3,4).\n\nMove 1 to the beginning. The sequence is now (1,2,3,4).\n\nSample Input 2\n\n6\n3\n2\n5\n1\n4\n6\n\nSample Output 2\n\n4\n\nSample Input 3\n\n8\n6\n3\n1\n2\n7\n4\n8\n5\n\nSample Output 3\n\n5", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 147916}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s287831344", "group_id": "codeNet:p03351", "input_text": "a,b,c,d=parse.(split(readline()))\nprint(abs(a-c)>d&&(abs(a-b)>d||abs(b-c)>d)?\"No\":\"Yes\")", "language": "Julia", "metadata": {"date": 1561161030, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03351.html", "problem_id": "p03351", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03351/input.txt", "sample_output_relpath": "derived/input_output/data/p03351/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03351/Julia/s287831344.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s287831344", "user_id": "u729133443"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "a,b,c,d=parse.(split(readline()))\nprint(abs(a-c)>d&&(abs(a-b)>d||abs(b-c)>d)?\"No\":\"Yes\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThree people, A, B and C, are trying to communicate using transceivers.\nThey are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively.\nTwo people can directly communicate when the distance between them is at most d meters.\nDetermine if A and C can communicate, either directly or indirectly.\nHere, A and C can indirectly communicate when A and B can directly communicate and also B and C can directly communicate.\n\nConstraints\n\n1 ≤ a,b,c ≤ 100\n\n1 ≤ d ≤ 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nIf A and C can communicate, print Yes; if they cannot, print No.\n\nSample Input 1\n\n4 7 9 3\n\nSample Output 1\n\nYes\n\nA and B can directly communicate, and also B and C can directly communicate, so we should print Yes.\n\nSample Input 2\n\n100 10 1 2\n\nSample Output 2\n\nNo\n\nThey cannot communicate in this case.\n\nSample Input 3\n\n10 10 10 1\n\nSample Output 3\n\nYes\n\nThere can be multiple people at the same position.\n\nSample Input 4\n\n1 100 2 10\n\nSample Output 4\n\nYes", "sample_input": "4 7 9 3\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03351", "source_text": "Score : 100 points\n\nProblem Statement\n\nThree people, A, B and C, are trying to communicate using transceivers.\nThey are standing along a number line, and the coordinates of A, B and C are a, b and c (in meters), respectively.\nTwo people can directly communicate when the distance between them is at most d meters.\nDetermine if A and C can communicate, either directly or indirectly.\nHere, A and C can indirectly communicate when A and B can directly communicate and also B and C can directly communicate.\n\nConstraints\n\n1 ≤ a,b,c ≤ 100\n\n1 ≤ d ≤ 100\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\na b c d\n\nOutput\n\nIf A and C can communicate, print Yes; if they cannot, print No.\n\nSample Input 1\n\n4 7 9 3\n\nSample Output 1\n\nYes\n\nA and B can directly communicate, and also B and C can directly communicate, so we should print Yes.\n\nSample Input 2\n\n100 10 1 2\n\nSample Output 2\n\nNo\n\nThey cannot communicate in this case.\n\nSample Input 3\n\n10 10 10 1\n\nSample Output 3\n\nYes\n\nThere can be multiple people at the same position.\n\nSample Input 4\n\n1 100 2 10\n\nSample Output 4\n\nYes", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 552, "memory_kb": 121976}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s868238303", "group_id": "codeNet:p03352", "input_text": "function main()\n \n X = parse(Int, readline())\n \n ans = 0\n\n if X == 1\n ans = 1\n else\n \n for i in 1:X\n \n for j in 2:X\n \n \tif X < i^j\n \tbreak\n \telse\n \tans = i^j\n \tend\n \n end\n \n end\n \n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577563353, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s868238303.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s868238303", "user_id": "u790457721"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "function main()\n \n X = parse(Int, readline())\n \n ans = 0\n\n if X == 1\n ans = 1\n else\n \n for i in 1:X\n \n for j in 2:X\n \n \tif X < i^j\n \tbreak\n \telse\n \tans = i^j\n \tend\n \n end\n \n end\n \n end\n \n println(ans)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 272, "cpu_time_ms": 300, "memory_kb": 110088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s036300017", "group_id": "codeNet:p03352", "input_text": "function main()\n \n X = parse(Int, readline())\n \n ans = 0\n\n for i in 1:X, j in 2:X\n \n if X < i^j || i^j <= 0\n continue\n else\n ans = i^j\n end\n \n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577562919, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s036300017.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s036300017", "user_id": "u790457721"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "function main()\n \n X = parse(Int, readline())\n \n ans = 0\n\n for i in 1:X, j in 2:X\n \n if X < i^j || i^j <= 0\n continue\n else\n ans = i^j\n end\n \n end\n \n println(ans)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 381, "memory_kb": 107684}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s245884795", "group_id": "codeNet:p03354", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction root(uf::Array{Int,1},x)\n\ts = x\n\twhile uf[s] != s\n\t\ts = uf[s]\n\tend\n\ts\nend\n\nfunction find(uf::Array{Int,1},x,y)\n\ts = x\n\tt = y\n\twhile uf[s] != s\n\t\ts = uf[s]\n\tend\n\twhile uf[t] != t\n\t\tt = uf[t]\n\tend\n\ts==t?true:false\nend\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\tp = readline() |> split |> parseMap\n\tuf = [i for i in 1:n]\n\tfor i in 1:m\n\t\tx,y = readline() |> split |> parseMap\n\t\tl = root(uf,x)\n\t\tr = root(uf,y)\n\t\tif l < r\n\t\t\tuf[r] = l\n\t\telse\n\t\t\tuf[l] = r\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tuf[i] = root(uf,uf[i])\n\tend\n\tprintln(uf)\n\tcount = 0\n\tfor i in 1:n\n\t\tif uf[p[i]] == uf[i]\n\t\t\tcount += 1\n\t\tend\n\tend\n\tprintln(count)\nend\nmain()", "language": "Julia", "metadata": {"date": 1550958429, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03354.html", "problem_id": "p03354", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03354/input.txt", "sample_output_relpath": "derived/input_output/data/p03354/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03354/Julia/s245884795.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s245884795", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction root(uf::Array{Int,1},x)\n\ts = x\n\twhile uf[s] != s\n\t\ts = uf[s]\n\tend\n\ts\nend\n\nfunction find(uf::Array{Int,1},x,y)\n\ts = x\n\tt = y\n\twhile uf[s] != s\n\t\ts = uf[s]\n\tend\n\twhile uf[t] != t\n\t\tt = uf[t]\n\tend\n\ts==t?true:false\nend\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\tp = readline() |> split |> parseMap\n\tuf = [i for i in 1:n]\n\tfor i in 1:m\n\t\tx,y = readline() |> split |> parseMap\n\t\tl = root(uf,x)\n\t\tr = root(uf,y)\n\t\tif l < r\n\t\t\tuf[r] = l\n\t\telse\n\t\t\tuf[l] = r\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tuf[i] = root(uf,uf[i])\n\tend\n\tprintln(uf)\n\tcount = 0\n\tfor i in 1:n\n\t\tif uf[p[i]] == uf[i]\n\t\t\tcount += 1\n\t\tend\n\tend\n\tprintln(count)\nend\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have a permutation of the integers from 1 through N, p_1, p_2, .., p_N.\nWe also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M).\nAtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N) such that p_i = i is maximized:\n\nChoose j such that 1 ≤ j ≤ M, and swap p_{x_j} and p_{y_j}.\n\nFind the maximum possible number of i such that p_i = i after operations.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ M ≤ 10^5\n\np is a permutation of integers from 1 through N.\n\n1 ≤ x_j,y_j ≤ N\n\nx_j ≠ y_j\n\nIf i ≠ j, \\{x_i,y_i\\} ≠ \\{x_j,y_j\\}.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 p_2 .. p_N\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the maximum possible number of i such that p_i = i after operations.\n\nSample Input 1\n\n5 2\n5 3 1 4 2\n1 3\n5 4\n\nSample Output 1\n\n2\n\nIf we perform the operation by choosing j=1, p becomes 1 3 5 4 2, which is optimal, so the answer is 2.\n\nSample Input 2\n\n3 2\n3 2 1\n1 2\n2 3\n\nSample Output 2\n\n3\n\nIf we perform the operation by, for example, choosing j=1, j=2, j=1 in this order, p becomes 1 2 3, which is obviously optimal.\nNote that we may choose the same j any number of times.\n\nSample Input 3\n\n10 8\n5 3 6 8 7 10 9 1 2 4\n3 1\n4 1\n5 9\n2 5\n6 5\n3 5\n8 9\n7 9\n\nSample Output 3\n\n8\n\nSample Input 4\n\n5 1\n1 2 3 4 5\n1 5\n\nSample Output 4\n\n5\n\nWe do not have to perform the operation.", "sample_input": "5 2\n5 3 1 4 2\n1 3\n5 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03354", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have a permutation of the integers from 1 through N, p_1, p_2, .., p_N.\nWe also have M pairs of two integers between 1 and N (inclusive), represented as (x_1,y_1), (x_2,y_2), .., (x_M,y_M).\nAtCoDeer the deer is going to perform the following operation on p as many times as desired so that the number of i (1 ≤ i ≤ N) such that p_i = i is maximized:\n\nChoose j such that 1 ≤ j ≤ M, and swap p_{x_j} and p_{y_j}.\n\nFind the maximum possible number of i such that p_i = i after operations.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ M ≤ 10^5\n\np is a permutation of integers from 1 through N.\n\n1 ≤ x_j,y_j ≤ N\n\nx_j ≠ y_j\n\nIf i ≠ j, \\{x_i,y_i\\} ≠ \\{x_j,y_j\\}.\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\np_1 p_2 .. p_N\nx_1 y_1\nx_2 y_2\n:\nx_M y_M\n\nOutput\n\nPrint the maximum possible number of i such that p_i = i after operations.\n\nSample Input 1\n\n5 2\n5 3 1 4 2\n1 3\n5 4\n\nSample Output 1\n\n2\n\nIf we perform the operation by choosing j=1, p becomes 1 3 5 4 2, which is optimal, so the answer is 2.\n\nSample Input 2\n\n3 2\n3 2 1\n1 2\n2 3\n\nSample Output 2\n\n3\n\nIf we perform the operation by, for example, choosing j=1, j=2, j=1 in this order, p becomes 1 2 3, which is obviously optimal.\nNote that we may choose the same j any number of times.\n\nSample Input 3\n\n10 8\n5 3 6 8 7 10 9 1 2 4\n3 1\n4 1\n5 9\n2 5\n6 5\n3 5\n8 9\n7 9\n\nSample Output 3\n\n8\n\nSample Input 4\n\n5 1\n1 2 3 4 5\n1 5\n\nSample Output 4\n\n5\n\nWe do not have to perform the operation.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 722, "cpu_time_ms": 1149, "memory_kb": 185692}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s612177937", "group_id": "codeNet:p03356", "input_text": "n,m=map(x->parse(Int,x),split(readline()))\nP=map(x->parse(Int,x),split(readline()))\nr=[]\np=[]\nfor i=1:n\n\tpush!(r,0)\n\tpush!(p,i)\nend\nfunction f(u)\n\tif u==p[u]\n\t\tu\n\telse\n\t\tp[u]=f(p[u])\n\tend\nend\nfor i=1:m\n\ta,b=map(x->parse(Int,x),split(readline()))\n\ta=f(a)\n\tb=f(b)\n\tif a!=b\n\t\tif r[a]parse(Int,x),split(readline()))\nP=map(x->parse(Int,x),split(readline()))\nr=[]\np=[]\nfor i=1:n\n\tpush!(r,0)\n\tpush!(p,i)\nend\nfunction f(u)\n\tif u==p[u]\n\t\tu\n\telse\n\t\tp[u]=f(p[u])\n\tend\nend\nfor i=1:m\n\ta,b=map(x->parse(Int,x),split(readline()))\n\ta=f(a)\n\tb=f(b)\n\tif a!=b\n\t\tif r[a]parse(Int,x),split(readline()))\nK=parse(Int,readline())\nprintln(sum(A)+maximum(A)*(2^K-1))", "language": "Julia", "metadata": {"date": 1561340941, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s279233940.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s279233940", "user_id": "u657913472"}, "prompt_components": {"gold_output": "30\n", "input_to_evaluate": "A=map(x->parse(Int,x),split(readline()))\nK=parse(Int,readline())\nprintln(sum(A)+maximum(A)*(2^K-1))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 330, "memory_kb": 110096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s865849998", "group_id": "codeNet:p03362", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tm = 55555\n\ta = zeros(Int,m)\n\ta[1] = 1\n\tk = 2\n\twhile k <= sqrt(m)\n\t\tfor i in 2*k:k:m\n\t\t\ta[i] = 1\n\t\tend\n\t\tk += 1\n\tend\n\tt = 0\n\ti = 1\n\twhile t <= n\n\t\tif a[i] == 0 && i%5 == 1\n\t\t\tif t == n\n\t\t\t\tprint(i)\n\t\t\telse\n\t\t\t\tprint(i, \" \")\n\t\t\tend\n\t\t\tt += 1\n\t\tend\n\t\ti += 1\n\tend\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1547792472, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03362.html", "problem_id": "p03362", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03362/input.txt", "sample_output_relpath": "derived/input_output/data/p03362/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03362/Julia/s865849998.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s865849998", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3 5 7 11 31\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tm = 55555\n\ta = zeros(Int,m)\n\ta[1] = 1\n\tk = 2\n\twhile k <= sqrt(m)\n\t\tfor i in 2*k:k:m\n\t\t\ta[i] = 1\n\t\tend\n\t\tk += 1\n\tend\n\tt = 0\n\ti = 1\n\twhile t <= n\n\t\tif a[i] == 0 && i%5 == 1\n\t\t\tif t == n\n\t\t\t\tprint(i)\n\t\t\telse\n\t\t\t\tprint(i, \" \")\n\t\t\tend\n\t\t\tt += 1\n\t\tend\n\t\ti += 1\n\tend\nend\n\nmain()\n", "problem_context": "Score: 400 points\n\nProblem Statement\n\nPrint a sequence a_1, a_2, ..., a_N whose length is N that satisfies the following conditions:\n\na_i (1 \\leq i \\leq N) is a prime number at most 55 555.\n\nThe values of a_1, a_2, ..., a_N are all different.\n\nIn every choice of five different integers from a_1, a_2, ..., a_N, the sum of those integers is a composite number.\n\nIf there are multiple such sequences, printing any of them is accepted.\n\nNotes\n\nAn integer N not less than 2 is called a prime number if it cannot be divided evenly by any integers except 1 and N, and called a composite number otherwise.\n\nConstraints\n\nN is an integer between 5 and 55 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N numbers a_1, a_2, a_3, ..., a_N in a line, with spaces in between.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n3 5 7 11 31\n\nLet us see if this output actually satisfies the conditions.\n\nFirst, 3, 5, 7, 11 and 31 are all different, and all of them are prime numbers.\n\nThe only way to choose five among them is to choose all of them, whose sum is a_1+a_2+a_3+a_4+a_5=57, which is a composite number.\n\nThere are also other possible outputs, such as 2 3 5 7 13, 11 13 17 19 31 and 7 11 5 31 3.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n2 3 5 7 11 13\n\n2, 3, 5, 7, 11, 13 are all different prime numbers.\n\n2+3+5+7+11=28 is a composite number.\n\n2+3+5+7+13=30 is a composite number.\n\n2+3+5+11+13=34 is a composite number.\n\n2+3+7+11+13=36 is a composite number.\n\n2+5+7+11+13=38 is a composite number.\n\n3+5+7+11+13=39 is a composite number.\n\nThus, the sequence 2 3 5 7 11 13 satisfies the conditions.\n\nSample Input 3\n\n8\n\nSample Output 3\n\n2 5 7 13 19 37 67 79", "sample_input": "5\n"}, "reference_outputs": ["3 5 7 11 31\n"], "source_document_id": "p03362", "source_text": "Score: 400 points\n\nProblem Statement\n\nPrint a sequence a_1, a_2, ..., a_N whose length is N that satisfies the following conditions:\n\na_i (1 \\leq i \\leq N) is a prime number at most 55 555.\n\nThe values of a_1, a_2, ..., a_N are all different.\n\nIn every choice of five different integers from a_1, a_2, ..., a_N, the sum of those integers is a composite number.\n\nIf there are multiple such sequences, printing any of them is accepted.\n\nNotes\n\nAn integer N not less than 2 is called a prime number if it cannot be divided evenly by any integers except 1 and N, and called a composite number otherwise.\n\nConstraints\n\nN is an integer between 5 and 55 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint N numbers a_1, a_2, a_3, ..., a_N in a line, with spaces in between.\n\nSample Input 1\n\n5\n\nSample Output 1\n\n3 5 7 11 31\n\nLet us see if this output actually satisfies the conditions.\n\nFirst, 3, 5, 7, 11 and 31 are all different, and all of them are prime numbers.\n\nThe only way to choose five among them is to choose all of them, whose sum is a_1+a_2+a_3+a_4+a_5=57, which is a composite number.\n\nThere are also other possible outputs, such as 2 3 5 7 13, 11 13 17 19 31 and 7 11 5 31 3.\n\nSample Input 2\n\n6\n\nSample Output 2\n\n2 3 5 7 11 13\n\n2, 3, 5, 7, 11, 13 are all different prime numbers.\n\n2+3+5+7+11=28 is a composite number.\n\n2+3+5+7+13=30 is a composite number.\n\n2+3+5+11+13=34 is a composite number.\n\n2+3+7+11+13=36 is a composite number.\n\n2+5+7+11+13=38 is a composite number.\n\n3+5+7+11+13=39 is a composite number.\n\nThus, the sequence 2 3 5 7 11 13 satisfies the conditions.\n\nSample Input 3\n\n8\n\nSample Output 3\n\n2 5 7 13 19 37 67 79", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 835, "memory_kb": 164160}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s170775366", "group_id": "codeNet:p03369", "input_text": "println((7+count(c->c=='o',collect(readline())))*100)", "language": "Julia", "metadata": {"date": 1561341793, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03369.html", "problem_id": "p03369", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03369/input.txt", "sample_output_relpath": "derived/input_output/data/p03369/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03369/Julia/s170775366.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s170775366", "user_id": "u657913472"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "println((7+count(c->c=='o',collect(readline())))*100)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nIn \"Takahashi-ya\", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).\n\nA customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is o, it means the ramen should be topped with boiled egg; if that character is x, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.\n\nWrite a program that, when S is given, prints the price of the corresponding bowl of ramen.\n\nConstraints\n\nS is a string of length 3.\n\nEach character in S is o or x.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the price of the bowl of ramen corresponding to S.\n\nSample Input 1\n\noxo\n\nSample Output 1\n\n900\n\nThe price of a ramen topped with two kinds of toppings, boiled egg and green onions, is 700 + 100 \\times 2 = 900 yen.\n\nSample Input 2\n\nooo\n\nSample Output 2\n\n1000\n\nThe price of a ramen topped with all three kinds of toppings is 700 + 100 \\times 3 = 1000 yen.\n\nSample Input 3\n\nxxx\n\nSample Output 3\n\n700\n\nThe price of a ramen without any toppings is 700 yen.", "sample_input": "oxo\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03369", "source_text": "Score : 100 points\n\nProblem Statement\n\nIn \"Takahashi-ya\", a ramen restaurant, a bowl of ramen costs 700 yen (the currency of Japan), plus 100 yen for each kind of topping (boiled egg, sliced pork, green onions).\n\nA customer ordered a bowl of ramen and told which toppings to put on his ramen to a clerk. The clerk took a memo of the order as a string S. S is three characters long, and if the first character in S is o, it means the ramen should be topped with boiled egg; if that character is x, it means the ramen should not be topped with boiled egg. Similarly, the second and third characters in S mean the presence or absence of sliced pork and green onions on top of the ramen.\n\nWrite a program that, when S is given, prints the price of the corresponding bowl of ramen.\n\nConstraints\n\nS is a string of length 3.\n\nEach character in S is o or x.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the price of the bowl of ramen corresponding to S.\n\nSample Input 1\n\noxo\n\nSample Output 1\n\n900\n\nThe price of a ramen topped with two kinds of toppings, boiled egg and green onions, is 700 + 100 \\times 2 = 900 yen.\n\nSample Input 2\n\nooo\n\nSample Output 2\n\n1000\n\nThe price of a ramen topped with all three kinds of toppings is 700 + 100 \\times 3 = 1000 yen.\n\nSample Input 3\n\nxxx\n\nSample Output 3\n\n700\n\nThe price of a ramen without any toppings is 700 yen.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 53, "cpu_time_ms": 925, "memory_kb": 167692}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s455712212", "group_id": "codeNet:p03370", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction getcod(cod,lim)\n if cod==0 || cod==lim+1\n return false\n else\n return true\n end\nend\n\nfunction main()\n n,x=parseMap(split(readline()))\n a=sort([parseInt(readline()) for i in 1:n])\n println(n+div(x-sum(a),a[1]))\nend\nmain()", "language": "Julia", "metadata": {"date": 1583804775, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03370.html", "problem_id": "p03370", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03370/input.txt", "sample_output_relpath": "derived/input_output/data/p03370/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03370/Julia/s455712212.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s455712212", "user_id": "u619197965"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction getcod(cod,lim)\n if cod==0 || cod==lim+1\n return false\n else\n return true\n end\nend\n\nfunction main()\n n,x=parseMap(split(readline()))\n a=sort([parseInt(readline()) for i in 1:n])\n println(n+div(x-sum(a),a[1]))\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAkaki, a patissier, can make N kinds of doughnut using only a certain powder called \"Okashi no Moto\" (literally \"material of pastry\", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams of Moto. She cannot make a non-integer number of doughnuts, such as 0.5 doughnuts.\n\nNow, she has X grams of Moto. She decides to make as many doughnuts as possible for a party tonight. However, since the tastes of the guests differ, she will obey the following condition:\n\nFor each of the N kinds of doughnuts, make at least one doughnut of that kind.\n\nAt most how many doughnuts can be made here? She does not necessarily need to consume all of her Moto. Also, under the constraints of this problem, it is always possible to obey the condition.\n\nConstraints\n\n2 ≤ N ≤ 100\n\n1 ≤ m_i ≤ 1000\n\nm_1 + m_2 + ... + m_N ≤ X ≤ 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\nm_1\nm_2\n:\nm_N\n\nOutput\n\nPrint the maximum number of doughnuts that can be made under the condition.\n\nSample Input 1\n\n3 1000\n120\n100\n140\n\nSample Output 1\n\n9\n\nShe has 1000 grams of Moto and can make three kinds of doughnuts. If she makes one doughnut for each of the three kinds, she consumes 120 + 100 + 140 = 360 grams of Moto. From the 640 grams of Moto that remains here, she can make additional six Doughnuts 2. This is how she can made a total of nine doughnuts, which is the maximum.\n\nSample Input 2\n\n4 360\n90\n90\n90\n90\n\nSample Output 2\n\n4\n\nMaking one doughnut for each of the four kinds consumes all of her Moto.\n\nSample Input 3\n\n5 3000\n150\n130\n150\n130\n110\n\nSample Output 3\n\n26", "sample_input": "3 1000\n120\n100\n140\n"}, "reference_outputs": ["9\n"], "source_document_id": "p03370", "source_text": "Score : 200 points\n\nProblem Statement\n\nAkaki, a patissier, can make N kinds of doughnut using only a certain powder called \"Okashi no Moto\" (literally \"material of pastry\", simply called Moto below) as ingredient. These doughnuts are called Doughnut 1, Doughnut 2, ..., Doughnut N. In order to make one Doughnut i (1 ≤ i ≤ N), she needs to consume m_i grams of Moto. She cannot make a non-integer number of doughnuts, such as 0.5 doughnuts.\n\nNow, she has X grams of Moto. She decides to make as many doughnuts as possible for a party tonight. However, since the tastes of the guests differ, she will obey the following condition:\n\nFor each of the N kinds of doughnuts, make at least one doughnut of that kind.\n\nAt most how many doughnuts can be made here? She does not necessarily need to consume all of her Moto. Also, under the constraints of this problem, it is always possible to obey the condition.\n\nConstraints\n\n2 ≤ N ≤ 100\n\n1 ≤ m_i ≤ 1000\n\nm_1 + m_2 + ... + m_N ≤ X ≤ 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\nm_1\nm_2\n:\nm_N\n\nOutput\n\nPrint the maximum number of doughnuts that can be made under the condition.\n\nSample Input 1\n\n3 1000\n120\n100\n140\n\nSample Output 1\n\n9\n\nShe has 1000 grams of Moto and can make three kinds of doughnuts. If she makes one doughnut for each of the three kinds, she consumes 120 + 100 + 140 = 360 grams of Moto. From the 640 grams of Moto that remains here, she can make additional six Doughnuts 2. This is how she can made a total of nine doughnuts, which is the maximum.\n\nSample Input 2\n\n4 360\n90\n90\n90\n90\n\nSample Output 2\n\n4\n\nMaking one doughnut for each of the four kinds consumes all of her Moto.\n\nSample Input 3\n\n5 3000\n150\n130\n150\n130\n110\n\nSample Output 3\n\n26", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1041, "memory_kb": 117248}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s168944550", "group_id": "codeNet:p03371", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n a,b,c,x,y=pM(split(readline()))\n min(max(x,y)*2c,min(x,y)*min(a+b,2c)+(max(x,y)==x ? a : b)*(max(x,y)-min(x,y))) |> println\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1591913573, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s168944550.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s168944550", "user_id": "u443151804"}, "prompt_components": {"gold_output": "7900\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n a,b,c,x,y=pM(split(readline()))\n min(max(x,y)*2c,min(x,y)*min(a+b,2c)+(max(x,y)==x ? a : b)*(max(x,y)-min(x,y))) |> println\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 940, "memory_kb": 167348}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s996282896", "group_id": "codeNet:p03371", "input_text": "a,b,c,x,y=map(x->parse(Int,x),split(readline()))\nc=c*2\nans=min(x,y)*min(a+b,c)\nif xparse(Int,x),split(readline()))\nc=c*2\nans=min(x,y)*min(a+b,c)\nif x split |> x->parseInt.(x)\n\tif (a+b)<2*c\n\t\tprint(a*x+b*y)\n\telseif x >= y\n\t\tp = c*2*y\n\t\tx -= y\n\t\tp += min(a*x, 2*c*x)\n\t\tprint(p)\n\telse\n\t\tp = c*2*x\n\t\ty -= x\n\t\tp += min(b*y, 2*c*y)\n\t\tprint(p)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541949360, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s319746919.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s319746919", "user_id": "u095714878"}, "prompt_components": {"gold_output": "7900\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nfunction main()\n\ta,b,c,x,y = readline() |> split |> x->parseInt.(x)\n\tif (a+b)<2*c\n\t\tprint(a*x+b*y)\n\telseif x >= y\n\t\tp = c*2*y\n\t\tx -= y\n\t\tp += min(a*x, 2*c*x)\n\t\tprint(p)\n\telse\n\t\tp = c*2*x\n\t\ty -= x\n\t\tp += min(b*y, 2*c*y)\n\t\tprint(p)\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 919, "memory_kb": 171272}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s978654475", "group_id": "codeNet:p03377", "input_text": "function main()\n a, b, x = split(readline())\n a = parse(Int, a)\n b = parse(Int, b)\n x = parse(Int, x) \n if a <= x && a + b >= x\n println(\"YES\")\n else\n println(\"NO\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1523848511, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s978654475.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s978654475", "user_id": "u125505541"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "function main()\n a, b, x = split(readline())\n a = parse(Int, a)\n b = parse(Int, b)\n x = parse(Int, x) \n if a <= x && a + b >= x\n println(\"YES\")\n else\n println(\"NO\")\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 218, "cpu_time_ms": 314, "memory_kb": 110336}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s518361243", "group_id": "codeNet:p03377", "input_text": "a, b, x= parse.(Int, split(readline(STDIN)))\nif a <= x && x <= b\n println(\"YES\")\nelse\n println(\"NO\")\nend", "language": "Julia", "metadata": {"date": 1523846652, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s518361243.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s518361243", "user_id": "u125505541"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "a, b, x= parse.(Int, split(readline(STDIN)))\nif a <= x && x <= b\n println(\"YES\")\nelse\n println(\"NO\")\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 110, "cpu_time_ms": 1394, "memory_kb": 149896}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s514885116", "group_id": "codeNet:p03378", "input_text": "function main()\n \n (N,M,X) = map(x -> parse(Int,x), split(readline()))\n A = map(x -> parse(Int,x), split(readline()))\n \n ans1 = 0\n \n for i in X:N\n if in(i,A)\n ans1 += 1\n end\n end\n \n ans2 = 0\n \n for i in X:-1:0\n if in(i,A)\n ans2 += 1\n end\n end\n \n println(min(ans1,ans2))\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1582039584, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s514885116.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s514885116", "user_id": "u790457721"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n \n (N,M,X) = map(x -> parse(Int,x), split(readline()))\n A = map(x -> parse(Int,x), split(readline()))\n \n ans1 = 0\n \n for i in X:N\n if in(i,A)\n ans1 += 1\n end\n end\n \n ans2 = 0\n \n for i in X:-1:0\n if in(i,A)\n ans2 += 1\n end\n end\n \n println(min(ans1,ans2))\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 936, "memory_kb": 166940}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s422467995", "group_id": "codeNet:p03379", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n x=parseMap(split(readline()))\n sx=sort(x)\n med1=sx[div(n,2)]\n med2=sx[div(n,2)+1]\n for i in 1:n\n if x[i]<=med1\n println(med2)\n else\n println(med1)\n end\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1583881596, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03379.html", "problem_id": "p03379", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03379/input.txt", "sample_output_relpath": "derived/input_output/data/p03379/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03379/Julia/s422467995.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s422467995", "user_id": "u619197965"}, "prompt_components": {"gold_output": "4\n3\n3\n4\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n x=parseMap(split(readline()))\n sx=sort(x)\n med1=sx[div(n,2)]\n med2=sx[div(n,2)+1]\n for i in 1:n\n if x[i]<=med1\n println(med2)\n else\n println(med1)\n end\n end\nend\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWhen l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.\n\nYou are given N numbers X_1, X_2, ..., X_N, where N is an even number.\nFor each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i.\n\nFind B_i for each i = 1, 2, ..., N.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nN is even.\n\n1 \\leq X_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\nX_1 X_2 ... X_N\n\nOutput\n\nPrint N lines.\nThe i-th line should contain B_i.\n\nSample Input 1\n\n4\n2 4 4 3\n\nSample Output 1\n\n4\n3\n3\n4\n\nSince the median of X_2, X_3, X_4 is 4, B_1 = 4.\n\nSince the median of X_1, X_3, X_4 is 3, B_2 = 3.\n\nSince the median of X_1, X_2, X_4 is 3, B_3 = 3.\n\nSince the median of X_1, X_2, X_3 is 4, B_4 = 4.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n2\n1\n\nSample Input 3\n\n6\n5 5 4 4 3 3\n\nSample Output 3\n\n4\n4\n4\n4\n4\n4", "sample_input": "4\n2 4 4 3\n"}, "reference_outputs": ["4\n3\n3\n4\n"], "source_document_id": "p03379", "source_text": "Score : 300 points\n\nProblem Statement\n\nWhen l is an odd number, the median of l numbers a_1, a_2, ..., a_l is the (\\frac{l+1}{2})-th largest value among a_1, a_2, ..., a_l.\n\nYou are given N numbers X_1, X_2, ..., X_N, where N is an even number.\nFor each i = 1, 2, ..., N, let the median of X_1, X_2, ..., X_N excluding X_i, that is, the median of X_1, X_2, ..., X_{i-1}, X_{i+1}, ..., X_N be B_i.\n\nFind B_i for each i = 1, 2, ..., N.\n\nConstraints\n\n2 \\leq N \\leq 200000\n\nN is even.\n\n1 \\leq X_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\nX_1 X_2 ... X_N\n\nOutput\n\nPrint N lines.\nThe i-th line should contain B_i.\n\nSample Input 1\n\n4\n2 4 4 3\n\nSample Output 1\n\n4\n3\n3\n4\n\nSince the median of X_2, X_3, X_4 is 4, B_1 = 4.\n\nSince the median of X_1, X_3, X_4 is 3, B_2 = 3.\n\nSince the median of X_1, X_2, X_4 is 3, B_3 = 3.\n\nSince the median of X_1, X_2, X_3 is 4, B_4 = 4.\n\nSample Input 2\n\n2\n1 2\n\nSample Output 2\n\n2\n1\n\nSample Input 3\n\n6\n5 5 4 4 3 3\n\nSample Output 3\n\n4\n4\n4\n4\n4\n4", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 567, "cpu_time_ms": 605, "memory_kb": 153356}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s911833448", "group_id": "codeNet:p03380", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\ta = sort(a)\n\tx=div(a[n]+1,2)\n\ts = x-a[1]\n\tsx = a[1]\n\tfor i in 1:n-1\n\t\tif abs(a[i]-x) parseInt\n\ta = readline() |> split |> parseMap\n\ta = sort(a)\n\tx=div(a[n]+1,2)\n\ts = x-a[1]\n\tsx = a[1]\n\tfor i in 1:n-1\n\t\tif abs(a[i]-x) 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 474, "memory_kb": 119996}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s103583941", "group_id": "codeNet:p03382", "input_text": "x = Int64(parse(readline(STDIN)))\na = map(parse, split(readline(STDIN)))\n \na_max = maximum(a)\n\ntmp = Int64(2000000001)\nans = Int64(0)\nfor i in a\n\tif tmp > abs(i*2 - a_max) && i != a_max\n \tans = i\n tmp = abs(i*2 - a_max)\n end\nend\nprintln(\"$a_max $ans\")", "language": "Julia", "metadata": {"date": 1523841773, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03382.html", "problem_id": "p03382", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03382/input.txt", "sample_output_relpath": "derived/input_output/data/p03382/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03382/Julia/s103583941.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s103583941", "user_id": "u768301880"}, "prompt_components": {"gold_output": "11 6\n", "input_to_evaluate": "x = Int64(parse(readline(STDIN)))\na = map(parse, split(readline(STDIN)))\n \na_max = maximum(a)\n\ntmp = Int64(2000000001)\nans = Int64(0)\nfor i in a\n\tif tmp > abs(i*2 - a_max) && i != a_max\n \tans = i\n tmp = abs(i*2 - a_max)\n end\nend\nprintln(\"$a_max $ans\")", "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": "p03382", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 146664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s336110451", "group_id": "codeNet:p03386", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a,b,k=parseMap(split(readline()))\n if a+k parseInt\n\tfor i in 1:q\n\t\ta,b = readline() |> split |> parseMap\n\t\tc = a*b\n\t\tcount = 0\n\t\tx = 1\n\t\twhile x < sqrt(c)\n\t\t\ty = ceil(Int, c/x)-1\n\t\t\tif x != a && y != b\n\t\t\t\tcount += 1\n\t\t\tend\n\t\t\tif x != b && y != a && x != y\n\t\t\t\tcount += 1\n\t\t\tend\n\t\t\tx += 1\n\t\tend\n\t\tprintln(count)\n\tend\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1547879322, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03388.html", "problem_id": "p03388", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03388/input.txt", "sample_output_relpath": "derived/input_output/data/p03388/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03388/Julia/s946535427.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s946535427", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n12\n4\n11\n14\n57\n31\n671644785\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tq = readline() |> parseInt\n\tfor i in 1:q\n\t\ta,b = readline() |> split |> parseMap\n\t\tc = a*b\n\t\tcount = 0\n\t\tx = 1\n\t\twhile x < sqrt(c)\n\t\t\ty = ceil(Int, c/x)-1\n\t\t\tif x != a && y != b\n\t\t\t\tcount += 1\n\t\t\tend\n\t\t\tif x != b && y != a && x != y\n\t\t\t\tcount += 1\n\t\t\tend\n\t\t\tx += 1\n\t\tend\n\t\tprintln(count)\n\tend\nend\n\nmain()\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\n10^{10^{10}} participants, including Takahashi, competed in two programming contests.\nIn each contest, all participants had distinct ranks from first through 10^{10^{10}}-th.\n\nThe score of a participant is the product of his/her ranks in the two contests.\n\nProcess the following Q queries:\n\nIn the i-th query, you are given two positive integers A_i and B_i. Assuming that Takahashi was ranked A_i-th in the first contest and B_i-th in the second contest, find the maximum possible number of participants whose scores are smaller than Takahashi's.\n\nConstraints\n\n1 \\leq Q \\leq 100\n\n1\\leq A_i,B_i\\leq 10^9(1\\leq i\\leq Q)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nA_1 B_1\n:\nA_Q B_Q\n\nOutput\n\nFor each query, print the maximum possible number of participants whose scores are smaller than Takahashi's.\n\nSample Input 1\n\n8\n1 4\n10 5\n3 3\n4 11\n8 9\n22 40\n8 36\n314159265 358979323\n\nSample Output 1\n\n1\n12\n4\n11\n14\n57\n31\n671644785\n\nLet us denote a participant who was ranked x-th in the first contest and y-th in the second contest as (x,y).\n\nIn the first query, (2,1) is a possible candidate of a participant whose score is smaller than Takahashi's. There are never two or more participants whose scores are smaller than Takahashi's, so we should print 1.", "sample_input": "8\n1 4\n10 5\n3 3\n4 11\n8 9\n22 40\n8 36\n314159265 358979323\n"}, "reference_outputs": ["1\n12\n4\n11\n14\n57\n31\n671644785\n"], "source_document_id": "p03388", "source_text": "Score : 700 points\n\nProblem Statement\n\n10^{10^{10}} participants, including Takahashi, competed in two programming contests.\nIn each contest, all participants had distinct ranks from first through 10^{10^{10}}-th.\n\nThe score of a participant is the product of his/her ranks in the two contests.\n\nProcess the following Q queries:\n\nIn the i-th query, you are given two positive integers A_i and B_i. Assuming that Takahashi was ranked A_i-th in the first contest and B_i-th in the second contest, find the maximum possible number of participants whose scores are smaller than Takahashi's.\n\nConstraints\n\n1 \\leq Q \\leq 100\n\n1\\leq A_i,B_i\\leq 10^9(1\\leq i\\leq Q)\n\nAll values in input are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nQ\nA_1 B_1\n:\nA_Q B_Q\n\nOutput\n\nFor each query, print the maximum possible number of participants whose scores are smaller than Takahashi's.\n\nSample Input 1\n\n8\n1 4\n10 5\n3 3\n4 11\n8 9\n22 40\n8 36\n314159265 358979323\n\nSample Output 1\n\n1\n12\n4\n11\n14\n57\n31\n671644785\n\nLet us denote a participant who was ranked x-th in the first contest and y-th in the second contest as (x,y).\n\nIn the first query, (2,1) is a possible candidate of a participant whose score is smaller than Takahashi's. There are never two or more participants whose scores are smaller than Takahashi's, so we should print 1.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 404, "cpu_time_ms": 2111, "memory_kb": 111820}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s638411940", "group_id": "codeNet:p03393", "input_text": "s=chomp(readline())\nif length(s)<26\n\tfor i='a':'z'\n\t\tc=0\n\t\tfor t=s\n\t\t\tc+=t==i\n\t\tend\n\t\tif c==0\n\t\t\tprintln(s,i)\n\t\t\texit()\n\t\tend\n\tend\nelse\n\tfor j=25:-1:1\n\t\tif s[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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 356, "memory_kb": 110604}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s907312772", "group_id": "codeNet:p03400", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n=pI(readline())\n d,x=pM(split(readline()))\n for i=1:n\n a=pI(readline())\n x+=1+fld((d-1),a)\n end\n println(x)\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1591753216, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03400.html", "problem_id": "p03400", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03400/input.txt", "sample_output_relpath": "derived/input_output/data/p03400/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03400/Julia/s907312772.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s907312772", "user_id": "u443151804"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n=pI(readline())\n d,x=pM(split(readline()))\n for i=1:n\n a=pI(readline())\n x+=1+fld((d-1),a)\n end\n println(x)\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSome number of chocolate pieces were prepared for a training camp.\nThe camp had N participants and lasted for D days.\nThe i-th participant (1 \\leq i \\leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on.\nAs a result, there were X chocolate pieces remaining at the end of the camp. During the camp, nobody except the participants ate chocolate pieces.\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq D \\leq 100\n\n1 \\leq X \\leq 100\n\n1 \\leq A_i \\leq 100 (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\nD X\nA_1\nA_2\n:\nA_N\n\nOutput\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nSample Input 1\n\n3\n7 1\n2\n5\n10\n\nSample Output 1\n\n8\n\nThe camp has 3 participants and lasts for 7 days.\nEach participant eats chocolate pieces as follows:\n\nThe first participant eats one chocolate piece on Day 1, 3, 5 and 7, for a total of four.\n\nThe second participant eats one chocolate piece on Day 1 and 6, for a total of two.\n\nThe third participant eats one chocolate piece only on Day 1, for a total of one.\n\nSince the number of pieces remaining at the end of the camp is one, the number of pieces prepared at the beginning of the camp is 1 + 4 + 2 + 1 = 8.\n\nSample Input 2\n\n2\n8 20\n1\n10\n\nSample Output 2\n\n29\n\nSample Input 3\n\n5\n30 44\n26\n18\n81\n18\n6\n\nSample Output 3\n\n56", "sample_input": "3\n7 1\n2\n5\n10\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03400", "source_text": "Score : 200 points\n\nProblem Statement\n\nSome number of chocolate pieces were prepared for a training camp.\nThe camp had N participants and lasted for D days.\nThe i-th participant (1 \\leq i \\leq N) ate one chocolate piece on each of the following days in the camp: the 1-st day, the (A_i + 1)-th day, the (2A_i + 1)-th day, and so on.\nAs a result, there were X chocolate pieces remaining at the end of the camp. During the camp, nobody except the participants ate chocolate pieces.\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq D \\leq 100\n\n1 \\leq X \\leq 100\n\n1 \\leq A_i \\leq 100 (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\nD X\nA_1\nA_2\n:\nA_N\n\nOutput\n\nFind the number of chocolate pieces prepared at the beginning of the camp.\n\nSample Input 1\n\n3\n7 1\n2\n5\n10\n\nSample Output 1\n\n8\n\nThe camp has 3 participants and lasts for 7 days.\nEach participant eats chocolate pieces as follows:\n\nThe first participant eats one chocolate piece on Day 1, 3, 5 and 7, for a total of four.\n\nThe second participant eats one chocolate piece on Day 1 and 6, for a total of two.\n\nThe third participant eats one chocolate piece only on Day 1, for a total of one.\n\nSince the number of pieces remaining at the end of the camp is one, the number of pieces prepared at the beginning of the camp is 1 + 4 + 2 + 1 = 8.\n\nSample Input 2\n\n2\n8 20\n1\n10\n\nSample Output 2\n\n29\n\nSample Input 3\n\n5\n30 44\n26\n18\n81\n18\n6\n\nSample Output 3\n\n56", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 343, "cpu_time_ms": 714, "memory_kb": 166588}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s168377430", "group_id": "codeNet:p03401", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n l=[0 for i in 1:n+1]\n r=[0 for i in 1:n+1]\n l[2],r[2]=abs(a[1]),abs(a[end])\n for i in 3:n+1\n l[i]=l[i-1]+abs(a[i-1]-a[i-2])\n end\n for i in 3:n+1\n r[i]=r[i-1]+abs(a[n-i+2]-a[n-i+3])\n end\n println(l[1]+r[n]+abs(a[2]))\n for i in 2:n-1\n println(l[i]+r[n-i+1]+abs(a[i+1]-a[i-1]))\n end\n println(l[n]+r[1]+abs(a[end-1]))\nend\nmain()", "language": "Julia", "metadata": {"date": 1583891546, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03401.html", "problem_id": "p03401", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03401/input.txt", "sample_output_relpath": "derived/input_output/data/p03401/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03401/Julia/s168377430.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s168377430", "user_id": "u619197965"}, "prompt_components": {"gold_output": "12\n8\n10\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n l=[0 for i in 1:n+1]\n r=[0 for i in 1:n+1]\n l[2],r[2]=abs(a[1]),abs(a[end])\n for i in 3:n+1\n l[i]=l[i-1]+abs(a[i-1]-a[i-2])\n end\n for i in 3:n+1\n r[i]=r[i-1]+abs(a[n-i+2]-a[n-i+3])\n end\n println(l[1]+r[n]+abs(a[2]))\n for i in 2:n-1\n println(l[i]+r[n-i+1]+abs(a[i+1]-a[i-1]))\n end\n println(l[n]+r[1]+abs(a[end-1]))\nend\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (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_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "sample_input": "3\n3 5 -1\n"}, "reference_outputs": ["12\n8\n10\n"], "source_document_id": "p03401", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N sightseeing spots on the x-axis, numbered 1, 2, ..., N.\nSpot i is at the point with coordinate A_i.\nIt costs |a - b| yen (the currency of Japan) to travel from a point with coordinate a to another point with coordinate b along the axis.\n\nYou planned a trip along the axis.\nIn this plan, you first depart from the point with coordinate 0, then visit the N spots in the order they are numbered, and finally return to the point with coordinate 0.\n\nHowever, something came up just before the trip, and you no longer have enough time to visit all the N spots, so you decided to choose some i and cancel the visit to Spot i.\nYou will visit the remaining spots as planned in the order they are numbered.\nYou will also depart from and return to the point with coordinate 0 at the beginning and the end, as planned.\n\nFor each i = 1, 2, ..., N, find the total cost of travel during the trip when the visit to Spot i is canceled.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n-5000 \\leq A_i \\leq 5000 (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_2 ... A_N\n\nOutput\n\nPrint N lines.\nIn the i-th line, print the total cost of travel during the trip when the visit to Spot i is canceled.\n\nSample Input 1\n\n3\n3 5 -1\n\nSample Output 1\n\n12\n8\n10\n\nSpot 1, 2 and 3 are at the points with coordinates 3, 5 and -1, respectively.\nFor each i, the course of the trip and the total cost of travel when the visit to Spot i is canceled, are as follows:\n\nFor i = 1, the course of the trip is 0 \\rightarrow 5 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 5 + 6 + 1 = 12 yen.\n\nFor i = 2, the course of the trip is 0 \\rightarrow 3 \\rightarrow -1 \\rightarrow 0 and the total cost of travel is 3 + 4 + 1 = 8 yen.\n\nFor i = 3, the course of the trip is 0 \\rightarrow 3 \\rightarrow 5 \\rightarrow 0 and the total cost of travel is 3 + 2 + 5 = 10 yen.\n\nSample Input 2\n\n5\n1 1 1 2 0\n\nSample Output 2\n\n4\n4\n4\n2\n4\n\nSample Input 3\n\n6\n-679 -2409 -3258 3095 -3291 -4462\n\nSample Output 3\n\n21630\n21630\n19932\n8924\n21630\n19288", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 751, "cpu_time_ms": 523, "memory_kb": 134792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s926804957", "group_id": "codeNet:p03402", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ta,b = readline() |> split |> parseMap\n\tx = zeros(Int,100,100)\n\tprintln(\"100 100\")\n\tfor i in 1:a-1\n\t\tif div(i,48)%2 == 1\n\t\t\tx[div(i,48)+2,2*(i%47)+2] = 1\n\t\telse\n\t\t\tx[div(i,48)+2,2*(i%47)+3] = 1\n\t\tend\n\tend\n\tfor i in 1:b-1\n\t\tif div(i,48)%2 == 1\n\t\t\tx[52+div(i,48),2*(i%47)+2] = 1\n\t\telse\n\t\t\tx[52+div(i,48),2*(i%47)+3] = 1\n\t\tend\n\tend\n\tfor i in 1:50\n\t\tfor j in 1:100\n\t\t\tif x[i,j] == 1\n\t\t\t\tprint('.')\n\t\t\telse\n\t\t\t\tprint('#')\n\t\t\tend\n\t\tend\n\t println(\"\")\n\tend\n\tfor i in 51:100\n\t\tfor j in 1:100\n\t\t\tif x[i,j] == 1\n\t\t\t\tprint('#')\n\t\t\telse\n\t\t\t\tprint('.')\n\t\t\tend\n\t\tend\n\t\tprintln(\"\")\n\tend\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1548028969, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03402.html", "problem_id": "p03402", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03402/input.txt", "sample_output_relpath": "derived/input_output/data/p03402/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03402/Julia/s926804957.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s926804957", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3 3\n##.\n..#\n#.#\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ta,b = readline() |> split |> parseMap\n\tx = zeros(Int,100,100)\n\tprintln(\"100 100\")\n\tfor i in 1:a-1\n\t\tif div(i,48)%2 == 1\n\t\t\tx[div(i,48)+2,2*(i%47)+2] = 1\n\t\telse\n\t\t\tx[div(i,48)+2,2*(i%47)+3] = 1\n\t\tend\n\tend\n\tfor i in 1:b-1\n\t\tif div(i,48)%2 == 1\n\t\t\tx[52+div(i,48),2*(i%47)+2] = 1\n\t\telse\n\t\t\tx[52+div(i,48),2*(i%47)+3] = 1\n\t\tend\n\tend\n\tfor i in 1:50\n\t\tfor j in 1:100\n\t\t\tif x[i,j] == 1\n\t\t\t\tprint('.')\n\t\t\telse\n\t\t\t\tprint('#')\n\t\t\tend\n\t\tend\n\t println(\"\")\n\tend\n\tfor i in 51:100\n\t\tfor j in 1:100\n\t\t\tif x[i,j] == 1\n\t\t\t\tprint('#')\n\t\t\telse\n\t\t\t\tprint('.')\n\t\t\tend\n\t\tend\n\t\tprintln(\"\")\n\tend\nend\n\nmain()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given two integers A and B.\n\nPrint a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:\n\nLet the size of the grid be h \\times w (h vertical, w horizontal). Both h and w are at most 100.\n\nThe set of the squares painted white is divided into exactly A connected components.\n\nThe set of the squares painted black is divided into exactly B connected components.\n\nIt can be proved that there always exist one or more solutions under the conditions specified in Constraints section.\nIf there are multiple solutions, any of them may be printed.\n\nNotes\n\nTwo squares painted white, c_1 and c_2, are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.\n\nA set of squares painted white, S, forms a connected component when the following conditions are met:\n\nAny two squares in S are connected.\n\nNo pair of a square painted white that is not included in S and a square included in S is connected.\n\nA connected component of squares painted black is defined similarly.\n\nConstraints\n\n1 \\leq A \\leq 500\n\n1 \\leq B \\leq 500\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nOutput should be in the following format:\n\nIn the first line, print integers h and w representing the size of the grid you constructed, with a space in between.\n\nThen, print h more lines. The i-th (1 \\leq i \\leq h) of these lines should contain a string s_i as follows:\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted white, the j-th character in s_i should be ..\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted black, the j-th character in s_i should be #.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n3 3\n##.\n..#\n#.#\n\nThis output corresponds to the grid below:\n\nSample Input 2\n\n7 8\n\nSample Output 2\n\n3 5\n#.#.#\n.#.#.\n#.#.#\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n4 2\n..\n#.\n##\n##\n\nSample Input 4\n\n3 14\n\nSample Output 4\n\n8 18\n..................\n..................\n....##.......####.\n....#.#.....#.....\n...#...#....#.....\n..#.###.#...#.....\n.#.......#..#.....\n#.........#..####.", "sample_input": "2 3\n"}, "reference_outputs": ["3 3\n##.\n..#\n#.#\n"], "source_document_id": "p03402", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given two integers A and B.\n\nPrint a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:\n\nLet the size of the grid be h \\times w (h vertical, w horizontal). Both h and w are at most 100.\n\nThe set of the squares painted white is divided into exactly A connected components.\n\nThe set of the squares painted black is divided into exactly B connected components.\n\nIt can be proved that there always exist one or more solutions under the conditions specified in Constraints section.\nIf there are multiple solutions, any of them may be printed.\n\nNotes\n\nTwo squares painted white, c_1 and c_2, are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.\n\nA set of squares painted white, S, forms a connected component when the following conditions are met:\n\nAny two squares in S are connected.\n\nNo pair of a square painted white that is not included in S and a square included in S is connected.\n\nA connected component of squares painted black is defined similarly.\n\nConstraints\n\n1 \\leq A \\leq 500\n\n1 \\leq B \\leq 500\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nOutput should be in the following format:\n\nIn the first line, print integers h and w representing the size of the grid you constructed, with a space in between.\n\nThen, print h more lines. The i-th (1 \\leq i \\leq h) of these lines should contain a string s_i as follows:\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted white, the j-th character in s_i should be ..\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted black, the j-th character in s_i should be #.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n3 3\n##.\n..#\n#.#\n\nThis output corresponds to the grid below:\n\nSample Input 2\n\n7 8\n\nSample Output 2\n\n3 5\n#.#.#\n.#.#.\n#.#.#\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n4 2\n..\n#.\n##\n##\n\nSample Input 4\n\n3 14\n\nSample Output 4\n\n8 18\n..................\n..................\n....##.......####.\n....#.#.....#.....\n...#...#....#.....\n..#.###.#...#.....\n.#.......#..#.....\n#.........#..####.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 684, "cpu_time_ms": 398, "memory_kb": 113056}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s032885824", "group_id": "codeNet:p03404", "input_text": "a,b=map(x->parse(Int,x)-1,split(readline()))\nprintln(\"40 100\")\nfor i=0:9\n\tfor j=1:50\n\t\tif a>0\n\t\t\ta-=1\n\t\t\tprint(\"#.\")\n\t\telse\n\t\t\tprint(\"##\")\n\t\tend\n\tend\n\tprintln()\n\tprintln(\"####################################################################################################\")\nend\nfor i=0:9\n\tprintln(\"....................................................................................................\")\n\tfor j=1:50\n\t\tif b>0\n\t\t\tb-=1\n\t\t\tprint(\"#.\")\n\t\telse\n\t\t\tprint(\"..\")\n\t\tend\n\tend\n\tprintln()\nend\n", "language": "Julia", "metadata": {"date": 1539918614, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03404.html", "problem_id": "p03404", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03404/input.txt", "sample_output_relpath": "derived/input_output/data/p03404/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03404/Julia/s032885824.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s032885824", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3 3\n##.\n..#\n#.#\n", "input_to_evaluate": "a,b=map(x->parse(Int,x)-1,split(readline()))\nprintln(\"40 100\")\nfor i=0:9\n\tfor j=1:50\n\t\tif a>0\n\t\t\ta-=1\n\t\t\tprint(\"#.\")\n\t\telse\n\t\t\tprint(\"##\")\n\t\tend\n\tend\n\tprintln()\n\tprintln(\"####################################################################################################\")\nend\nfor i=0:9\n\tprintln(\"....................................................................................................\")\n\tfor j=1:50\n\t\tif b>0\n\t\t\tb-=1\n\t\t\tprint(\"#.\")\n\t\telse\n\t\t\tprint(\"..\")\n\t\tend\n\tend\n\tprintln()\nend\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given two integers A and B.\n\nPrint a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:\n\nLet the size of the grid be h \\times w (h vertical, w horizontal). Both h and w are at most 100.\n\nThe set of the squares painted white is divided into exactly A connected components.\n\nThe set of the squares painted black is divided into exactly B connected components.\n\nIt can be proved that there always exist one or more solutions under the conditions specified in Constraints section.\nIf there are multiple solutions, any of them may be printed.\n\nNotes\n\nTwo squares painted white, c_1 and c_2, are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.\n\nA set of squares painted white, S, forms a connected component when the following conditions are met:\n\nAny two squares in S are connected.\n\nNo pair of a square painted white that is not included in S and a square included in S is connected.\n\nA connected component of squares painted black is defined similarly.\n\nConstraints\n\n1 \\leq A \\leq 500\n\n1 \\leq B \\leq 500\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nOutput should be in the following format:\n\nIn the first line, print integers h and w representing the size of the grid you constructed, with a space in between.\n\nThen, print h more lines. The i-th (1 \\leq i \\leq h) of these lines should contain a string s_i as follows:\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted white, the j-th character in s_i should be ..\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted black, the j-th character in s_i should be #.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n3 3\n##.\n..#\n#.#\n\nThis output corresponds to the grid below:\n\nSample Input 2\n\n7 8\n\nSample Output 2\n\n3 5\n#.#.#\n.#.#.\n#.#.#\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n4 2\n..\n#.\n##\n##\n\nSample Input 4\n\n3 14\n\nSample Output 4\n\n8 18\n..................\n..................\n....##.......####.\n....#.#.....#.....\n...#...#....#.....\n..#.###.#...#.....\n.#.......#..#.....\n#.........#..####.", "sample_input": "2 3\n"}, "reference_outputs": ["3 3\n##.\n..#\n#.#\n"], "source_document_id": "p03404", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given two integers A and B.\n\nPrint a grid where each square is painted white or black that satisfies the following conditions, in the format specified in Output section:\n\nLet the size of the grid be h \\times w (h vertical, w horizontal). Both h and w are at most 100.\n\nThe set of the squares painted white is divided into exactly A connected components.\n\nThe set of the squares painted black is divided into exactly B connected components.\n\nIt can be proved that there always exist one or more solutions under the conditions specified in Constraints section.\nIf there are multiple solutions, any of them may be printed.\n\nNotes\n\nTwo squares painted white, c_1 and c_2, are called connected when the square c_2 can be reached from the square c_1 passing only white squares by repeatedly moving up, down, left or right to an adjacent square.\n\nA set of squares painted white, S, forms a connected component when the following conditions are met:\n\nAny two squares in S are connected.\n\nNo pair of a square painted white that is not included in S and a square included in S is connected.\n\nA connected component of squares painted black is defined similarly.\n\nConstraints\n\n1 \\leq A \\leq 500\n\n1 \\leq B \\leq 500\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA B\n\nOutput\n\nOutput should be in the following format:\n\nIn the first line, print integers h and w representing the size of the grid you constructed, with a space in between.\n\nThen, print h more lines. The i-th (1 \\leq i \\leq h) of these lines should contain a string s_i as follows:\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted white, the j-th character in s_i should be ..\n\nIf the square at the i-th row and j-th column (1 \\leq j \\leq w) in the grid is painted black, the j-th character in s_i should be #.\n\nSample Input 1\n\n2 3\n\nSample Output 1\n\n3 3\n##.\n..#\n#.#\n\nThis output corresponds to the grid below:\n\nSample Input 2\n\n7 8\n\nSample Output 2\n\n3 5\n#.#.#\n.#.#.\n#.#.#\n\nSample Input 3\n\n1 1\n\nSample Output 3\n\n4 2\n..\n#.\n##\n##\n\nSample Input 4\n\n3 14\n\nSample Output 4\n\n8 18\n..................\n..................\n....##.......####.\n....#.#.....#.....\n...#...#....#.....\n..#.###.#...#.....\n.#.......#..#.....\n#.........#..####.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 897, "memory_kb": 168940}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s260353863", "group_id": "codeNet:p03408", "input_text": "function main()\n \n dict = Dict{String,Int64}()\n \n N = parse(Int,readline())\n S = [\"\" for i in 1:N]\n for i in 1:N\n S[i] = chomp(readline())\n dict[S[i]] = get(dict,S[i],0) + 1\n end\n\n M = parse(Int,readline())\n T = [\"\" for i in 1:M]\n for i in 1:M\n T[i] = chomp(readline())\n end\n \n count = 0\n ans = 0\n \n for (i,j) in dict\n \n count = j\n \n for k in 1:M\n if i == T[k]\n count -= 1\n end\n end\n \n ans = max(ans,count)\n \n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1582042847, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03408.html", "problem_id": "p03408", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03408/input.txt", "sample_output_relpath": "derived/input_output/data/p03408/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03408/Julia/s260353863.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s260353863", "user_id": "u790457721"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n \n dict = Dict{String,Int64}()\n \n N = parse(Int,readline())\n S = [\"\" for i in 1:N]\n for i in 1:N\n S[i] = chomp(readline())\n dict[S[i]] = get(dict,S[i],0) + 1\n end\n\n M = parse(Int,readline())\n T = [\"\" for i in 1:M]\n for i in 1:M\n T[i] = chomp(readline())\n end\n \n count = 0\n ans = 0\n \n for (i,j) in dict\n \n count = j\n \n for k in 1:M\n if i == T[k]\n count -= 1\n end\n end\n \n ans = max(ans,count)\n \n end\n \n println(ans)\n \nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N blue cards and M red cards.\nA string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i.\n\nTakahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will earn 1 yen (the currency of Japan); each time he finds a red card with that string, he will lose 1 yen.\n\nHere, we only consider the case where the string announced by Takahashi and the string on the card are exactly the same. For example, if he announces atcoder, he will not earn money even if there are blue cards with atcoderr, atcode, btcoder, and so on. (On the other hand, he will not lose money even if there are red cards with such strings, either.)\n\nAt most how much can he earn on balance?\n\nNote that the same string may be written on multiple cards.\n\nConstraints\n\nN and M are integers.\n\n1 \\leq N, M \\leq 100\n\ns_1, s_2, ..., s_N, t_1, t_2, ..., t_M are all strings of lengths between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\nM\nt_1\nt_2\n:\nt_M\n\nOutput\n\nIf Takahashi can earn at most X yen on balance, print X.\n\nSample Input 1\n\n3\napple\norange\napple\n1\ngrape\n\nSample Output 1\n\n2\n\nHe can earn 2 yen by announcing apple.\n\nSample Input 2\n\n3\napple\norange\napple\n5\napple\napple\napple\napple\napple\n\nSample Output 2\n\n1\n\nIf he announces apple, he will lose 3 yen. If he announces orange, he can earn 1 yen.\n\nSample Input 3\n\n1\nvoldemort\n10\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\n\nSample Output 3\n\n0\n\nIf he announces voldemort, he will lose 9 yen. If he announces orange, for example, he can avoid losing a yen.\n\nSample Input 4\n\n6\nred\nred\nblue\nyellow\nyellow\nred\n5\nred\nred\nyellow\ngreen\nblue\n\nSample Output 4\n\n1", "sample_input": "3\napple\norange\napple\n1\ngrape\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03408", "source_text": "Score : 200 points\n\nProblem Statement\n\nTakahashi has N blue cards and M red cards.\nA string is written on each card. The string written on the i-th blue card is s_i, and the string written on the i-th red card is t_i.\n\nTakahashi will now announce a string, and then check every card. Each time he finds a blue card with the string announced by him, he will earn 1 yen (the currency of Japan); each time he finds a red card with that string, he will lose 1 yen.\n\nHere, we only consider the case where the string announced by Takahashi and the string on the card are exactly the same. For example, if he announces atcoder, he will not earn money even if there are blue cards with atcoderr, atcode, btcoder, and so on. (On the other hand, he will not lose money even if there are red cards with such strings, either.)\n\nAt most how much can he earn on balance?\n\nNote that the same string may be written on multiple cards.\n\nConstraints\n\nN and M are integers.\n\n1 \\leq N, M \\leq 100\n\ns_1, s_2, ..., s_N, t_1, t_2, ..., t_M are all strings of lengths between 1 and 10 (inclusive) consisting of lowercase English letters.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\ns_1\ns_2\n:\ns_N\nM\nt_1\nt_2\n:\nt_M\n\nOutput\n\nIf Takahashi can earn at most X yen on balance, print X.\n\nSample Input 1\n\n3\napple\norange\napple\n1\ngrape\n\nSample Output 1\n\n2\n\nHe can earn 2 yen by announcing apple.\n\nSample Input 2\n\n3\napple\norange\napple\n5\napple\napple\napple\napple\napple\n\nSample Output 2\n\n1\n\nIf he announces apple, he will lose 3 yen. If he announces orange, he can earn 1 yen.\n\nSample Input 3\n\n1\nvoldemort\n10\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\nvoldemort\n\nSample Output 3\n\n0\n\nIf he announces voldemort, he will lose 9 yen. If he announces orange, for example, he can avoid losing a yen.\n\nSample Input 4\n\n6\nred\nred\nblue\nyellow\nyellow\nred\n5\nred\nred\nyellow\ngreen\nblue\n\nSample Output 4\n\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 513, "cpu_time_ms": 392, "memory_kb": 113156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s004631716", "group_id": "codeNet:p03409", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tred = Array{Int}(2,n)\n\tblu = Array{Int}(2,n)\n\tfor i in 1:n\n\t\tred[1:2,i] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:n\n\t\tblu[1:2,i] = readline() |> split |> parseMap\n\tend\n\tred = sortcols(red, by=x->x[2], rev=true)\n\tblu = sortcols(blu, by=x->x[1])\n\tr = zeros(Int,n)\n\tfor i in 1:n\n\t\tfor j in 1:n\n\t\t\tif red[1,j] < blu[1,i] && red[2,j] < blu[2,i] && r[j] == 0\n\t\t\t\tr[j] = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tprintln(sum(r))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1550407558, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03409.html", "problem_id": "p03409", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03409/input.txt", "sample_output_relpath": "derived/input_output/data/p03409/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03409/Julia/s004631716.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s004631716", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tred = Array{Int}(2,n)\n\tblu = Array{Int}(2,n)\n\tfor i in 1:n\n\t\tred[1:2,i] = readline() |> split |> parseMap\n\tend\n\tfor i in 1:n\n\t\tblu[1:2,i] = readline() |> split |> parseMap\n\tend\n\tred = sortcols(red, by=x->x[2], rev=true)\n\tblu = sortcols(blu, by=x->x[1])\n\tr = zeros(Int,n)\n\tfor i in 1:n\n\t\tfor j in 1:n\n\t\t\tif red[1,j] < blu[1,i] && red[2,j] < blu[2,i] && r[j] == 0\n\t\t\t\tr[j] = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tprintln(sum(r))\nend\n\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nOn a two-dimensional plane, there are N red points and N blue points.\nThe coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i).\n\nA red point and a blue point can form a friendly pair when, the x-coordinate of the red point is smaller than that of the blue point, and the y-coordinate of the red point is also smaller than that of the blue point.\n\nAt most how many friendly pairs can you form? Note that a point cannot belong to multiple pairs.\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq a_i, b_i, c_i, d_i < 2N\n\na_1, a_2, ..., a_N, c_1, c_2, ..., c_N are all different.\n\nb_1, b_2, ..., b_N, d_1, d_2, ..., d_N are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n:\na_N b_N\nc_1 d_1\nc_2 d_2\n:\nc_N d_N\n\nOutput\n\nPrint the maximum number of friendly pairs.\n\nSample Input 1\n\n3\n2 0\n3 1\n1 3\n4 2\n0 4\n5 5\n\nSample Output 1\n\n2\n\nFor example, you can pair (2, 0) and (4, 2), then (3, 1) and (5, 5).\n\nSample Input 2\n\n3\n0 0\n1 1\n5 2\n2 3\n3 4\n4 5\n\nSample Output 2\n\n2\n\nFor example, you can pair (0, 0) and (2, 3), then (1, 1) and (3, 4).\n\nSample Input 3\n\n2\n2 2\n3 3\n0 0\n1 1\n\nSample Output 3\n\n0\n\nIt is possible that no pair can be formed.\n\nSample Input 4\n\n5\n0 0\n7 3\n2 2\n4 8\n1 6\n8 5\n6 9\n5 4\n9 1\n3 7\n\nSample Output 4\n\n5\n\nSample Input 5\n\n5\n0 0\n1 1\n5 5\n6 6\n7 7\n2 2\n3 3\n4 4\n8 8\n9 9\n\nSample Output 5\n\n4", "sample_input": "3\n2 0\n3 1\n1 3\n4 2\n0 4\n5 5\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03409", "source_text": "Score : 400 points\n\nProblem Statement\n\nOn a two-dimensional plane, there are N red points and N blue points.\nThe coordinates of the i-th red point are (a_i, b_i), and the coordinates of the i-th blue point are (c_i, d_i).\n\nA red point and a blue point can form a friendly pair when, the x-coordinate of the red point is smaller than that of the blue point, and the y-coordinate of the red point is also smaller than that of the blue point.\n\nAt most how many friendly pairs can you form? Note that a point cannot belong to multiple pairs.\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 100\n\n0 \\leq a_i, b_i, c_i, d_i < 2N\n\na_1, a_2, ..., a_N, c_1, c_2, ..., c_N are all different.\n\nb_1, b_2, ..., b_N, d_1, d_2, ..., d_N are all different.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 b_1\na_2 b_2\n:\na_N b_N\nc_1 d_1\nc_2 d_2\n:\nc_N d_N\n\nOutput\n\nPrint the maximum number of friendly pairs.\n\nSample Input 1\n\n3\n2 0\n3 1\n1 3\n4 2\n0 4\n5 5\n\nSample Output 1\n\n2\n\nFor example, you can pair (2, 0) and (4, 2), then (3, 1) and (5, 5).\n\nSample Input 2\n\n3\n0 0\n1 1\n5 2\n2 3\n3 4\n4 5\n\nSample Output 2\n\n2\n\nFor example, you can pair (0, 0) and (2, 3), then (1, 1) and (3, 4).\n\nSample Input 3\n\n2\n2 2\n3 3\n0 0\n1 1\n\nSample Output 3\n\n0\n\nIt is possible that no pair can be formed.\n\nSample Input 4\n\n5\n0 0\n7 3\n2 2\n4 8\n1 6\n8 5\n6 9\n5 4\n9 1\n3 7\n\nSample Output 4\n\n5\n\nSample Input 5\n\n5\n0 0\n1 1\n5 5\n6 6\n7 7\n2 2\n3 3\n4 4\n8 8\n9 9\n\nSample Output 5\n\n4", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 558, "cpu_time_ms": 757, "memory_kb": 128712}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s170208442", "group_id": "codeNet:p03415", "input_text": "function main()\n \n A = split(chomp(readline()),\"\")\n B = split(chomp(readline()),\"\")\n C = split(chomp(readline()),\"\")\n \n println(A[1]*B[2]*C[3])\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1579221823, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s170208442.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s170208442", "user_id": "u790457721"}, "prompt_components": {"gold_output": "abc\n", "input_to_evaluate": "function main()\n \n A = split(chomp(readline()),\"\")\n B = split(chomp(readline()),\"\")\n C = split(chomp(readline()),\"\")\n \n println(A[1]*B[2]*C[3])\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 861, "memory_kb": 165632}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s884943480", "group_id": "codeNet:p03417", "input_text": "function main()\n \n (N,M) = map(x -> parse(Int,x), split(readline()))\n\n println(abs(N*M - (2N+2M) + 4))\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1585235923, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s884943480.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s884943480", "user_id": "u790457721"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "function main()\n \n (N,M) = map(x -> parse(Int,x), split(readline()))\n\n println(abs(N*M - (2N+2M) + 4))\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 360, "memory_kb": 110204}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s389917879", "group_id": "codeNet:p03417", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,m = map(parseInt, split(readline()))\n\tif n == 1&& m == 1\n\t\tprint(1)\n\telseif n == 1 || m == 1\n\t\tprint(max(n,m)-2)\n\telse\n\t\tprint((n-2)*(m-2))\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1542037403, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s389917879.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s389917879", "user_id": "u095714878"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,m = map(parseInt, split(readline()))\n\tif n == 1&& m == 1\n\t\tprint(1)\n\telseif n == 1 || m == 1\n\t\tprint(max(n,m)-2)\n\telse\n\t\tprint((n-2)*(m-2))\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 880, "memory_kb": 164632}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s360204220", "group_id": "codeNet:p03423", "input_text": "println(div(parse(Int,readline()),3))", "language": "Julia", "metadata": {"date": 1561350129, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s360204220.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s360204220", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "println(div(parse(Int,readline()),3))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 302, "memory_kb": 109492}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s416581110", "group_id": "codeNet:p03424", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n println(ifelse(length(collect(Set(split(readline()))))==4,\"Four\",\"Three\"))\nend\nmain()", "language": "Julia", "metadata": {"date": 1583942810, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03424.html", "problem_id": "p03424", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03424/input.txt", "sample_output_relpath": "derived/input_output/data/p03424/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03424/Julia/s416581110.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s416581110", "user_id": "u619197965"}, "prompt_components": {"gold_output": "Four\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n println(ifelse(length(collect(Set(split(readline()))))==4,\"Four\",\"Three\"))\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn Japan, people make offerings called hina arare, colorful crackers, on March 3.\n\nWe have a bag that contains N hina arare. (From here, we call them arare.)\n\nIt is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow.\n\nWe have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: P, white: W, green: G, yellow: Y.\n\nIf the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS_i is P, W, G or Y.\n\nThere always exist i, j and k such that S_i=P, S_j=W and S_k=G.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 S_2 ... S_N\n\nOutput\n\nIf the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.\n\nSample Input 1\n\n6\nG W Y P Y W\n\nSample Output 1\n\nFour\n\nThe bag contained arare in four colors, so you should print Four.\n\nSample Input 2\n\n9\nG W W G P W P G G\n\nSample Output 2\n\nThree\n\nThe bag contained arare in three colors, so you should print Three.\n\nSample Input 3\n\n8\nP Y W G Y W Y Y\n\nSample Output 3\n\nFour", "sample_input": "6\nG W Y P Y W\n"}, "reference_outputs": ["Four\n"], "source_document_id": "p03424", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn Japan, people make offerings called hina arare, colorful crackers, on March 3.\n\nWe have a bag that contains N hina arare. (From here, we call them arare.)\n\nIt is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow.\n\nWe have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: P, white: W, green: G, yellow: Y.\n\nIf the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS_i is P, W, G or Y.\n\nThere always exist i, j and k such that S_i=P, S_j=W and S_k=G.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 S_2 ... S_N\n\nOutput\n\nIf the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.\n\nSample Input 1\n\n6\nG W Y P Y W\n\nSample Output 1\n\nFour\n\nThe bag contained arare in four colors, so you should print Four.\n\nSample Input 2\n\n9\nG W W G P W P G G\n\nSample Output 2\n\nThree\n\nThe bag contained arare in three colors, so you should print Three.\n\nSample Input 3\n\n8\nP Y W G Y W Y Y\n\nSample Output 3\n\nFour", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 633, "memory_kb": 129244}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s254291952", "group_id": "codeNet:p03424", "input_text": "N = readline(STDIN)\narare = split(readline(STDIN), ' ')\n\nif length(unique(arare)) == 3\n println(\"Three\")\nelseif length(unique(arare)) == 4\n println(\"Four\")\nend", "language": "Julia", "metadata": {"date": 1520353864, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03424.html", "problem_id": "p03424", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03424/input.txt", "sample_output_relpath": "derived/input_output/data/p03424/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03424/Julia/s254291952.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s254291952", "user_id": "u494542429"}, "prompt_components": {"gold_output": "Four\n", "input_to_evaluate": "N = readline(STDIN)\narare = split(readline(STDIN), ' ')\n\nif length(unique(arare)) == 3\n println(\"Three\")\nelseif length(unique(arare)) == 4\n println(\"Four\")\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nIn Japan, people make offerings called hina arare, colorful crackers, on March 3.\n\nWe have a bag that contains N hina arare. (From here, we call them arare.)\n\nIt is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow.\n\nWe have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: P, white: W, green: G, yellow: Y.\n\nIf the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS_i is P, W, G or Y.\n\nThere always exist i, j and k such that S_i=P, S_j=W and S_k=G.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 S_2 ... S_N\n\nOutput\n\nIf the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.\n\nSample Input 1\n\n6\nG W Y P Y W\n\nSample Output 1\n\nFour\n\nThe bag contained arare in four colors, so you should print Four.\n\nSample Input 2\n\n9\nG W W G P W P G G\n\nSample Output 2\n\nThree\n\nThe bag contained arare in three colors, so you should print Three.\n\nSample Input 3\n\n8\nP Y W G Y W Y Y\n\nSample Output 3\n\nFour", "sample_input": "6\nG W Y P Y W\n"}, "reference_outputs": ["Four\n"], "source_document_id": "p03424", "source_text": "Score : 200 points\n\nProblem Statement\n\nIn Japan, people make offerings called hina arare, colorful crackers, on March 3.\n\nWe have a bag that contains N hina arare. (From here, we call them arare.)\n\nIt is known that the bag either contains arare in three colors: pink, white and green, or contains arare in four colors: pink, white, green and yellow.\n\nWe have taken out the arare in the bag one by one, and the color of the i-th arare was S_i, where colors are represented as follows - pink: P, white: W, green: G, yellow: Y.\n\nIf the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.\n\nConstraints\n\n1 \\leq N \\leq 100\n\nS_i is P, W, G or Y.\n\nThere always exist i, j and k such that S_i=P, S_j=W and S_k=G.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nS_1 S_2 ... S_N\n\nOutput\n\nIf the number of colors of the arare in the bag was three, print Three; if the number of colors was four, print Four.\n\nSample Input 1\n\n6\nG W Y P Y W\n\nSample Output 1\n\nFour\n\nThe bag contained arare in four colors, so you should print Four.\n\nSample Input 2\n\n9\nG W W G P W P G G\n\nSample Output 2\n\nThree\n\nThe bag contained arare in three colors, so you should print Three.\n\nSample Input 3\n\n8\nP Y W G Y W Y Y\n\nSample Output 3\n\nFour", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 413, "memory_kb": 111804}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s525257619", "group_id": "codeNet:p03425", "input_text": "function main()\n \n N = parse(Int,readline())\n \n dict = Dict('M' => 0, 'A' => 0, 'R' => 0, 'C' => 0, 'H' => 0)\n \n for i in 1:N\n S = readline()\n if haskey(dict,S[1])\n dict[S[1]] += 1\n end\n end\n \n values = [dict['M'], dict['A'], dict['R'], dict['C'], dict['H']]\n \n ans = 0\n \n for i in 1:5, j in i+1:5, k in j+1:5\n ans += values[i]*values[j]*values[k]\n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1583598989, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s525257619.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s525257619", "user_id": "u790457721"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n \n N = parse(Int,readline())\n \n dict = Dict('M' => 0, 'A' => 0, 'R' => 0, 'C' => 0, 'H' => 0)\n \n for i in 1:N\n S = readline()\n if haskey(dict,S[1])\n dict[S[1]] += 1\n end\n end\n \n values = [dict['M'], dict['A'], dict['R'], dict['C'], dict['H']]\n \n ans = 0\n \n for i in 1:5, j in i+1:5, k in j+1:5\n ans += values[i]*values[j]*values[k]\n end\n \n println(ans)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 458, "memory_kb": 125700}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s911960184", "group_id": "codeNet:p03427", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n=chomp(readline())\n l=length(n)\n println(n==\"9\"^l ? 9*l : pI(n[1])+9*l-10)\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1591917613, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s911960184.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s911960184", "user_id": "u443151804"}, "prompt_components": {"gold_output": "18\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n=chomp(readline())\n l=length(n)\n println(n==\"9\"^l ? 9*l : pI(n[1])+9*l-10)\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 300, "memory_kb": 108284}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s320380346", "group_id": "codeNet:p03428", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\ninpr(v1::Tuple{Int,Int},v2::Tuple{Int,Int})=v1[1]*v2[1]+v1[2]*v2[2]\nnorm(v1::Tuple{Int,Int})=sqrt(v1[1]^2+v1[2]^2)\ncalc(v1::Tuple{Int,Int},v2::Tuple{Int,Int})=inpr(v1,v2)/(norm(v1)*norm(v2))\n\nfunction accos(x::Float64)\n\tif x<-1.0\n\t\t3.141592653589793\n\telseif x<1.0\n\t\tacos(x)\n\telse\n\t\t0.0\n\tend\nend\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int,Int}[(0,0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tx,y = readline() |> split |> parseMap\n\t\ta[i] = (x,y,i)\n\tend\n\tb = copy(a)\n\ta = sort(a,by=x->(x[1],x[2]))\n\tvg = zeros(Float64,n,n,n)\n\tfor i in 1:n\n\t\tfor j in 1:n-1\n\t\t\tfor k in j:n\n\t\t\t\tv1 = (a[j][1]-a[i][1],a[j][2]-a[i][2])\n\t\t\t\tv2 = (a[k][1]-a[i][1],a[k][2]-a[i][2])\n\t\t\t\tval = accos(calc(v1,v2))\n\t\t\t\tvg[i,j,k] = val\n\t\t\t\tvg[i,k,j] = val\n\t\t\tend\n\t\tend\n\tend\n\tcf = Int[1]\n\tv1 = (0,-1)\n\txc = 0\n\ttheta = 0.0\n\tfor i in 2:n\n\t\tv2 = (a[i][1]-a[1][1],a[i][2]-a[1][2])\n\t\tval = acos(calc(v1,v2))\n\t\tif theta parseInt\n\ta = Tuple{Int,Int,Int}[(0,0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tx,y = readline() |> split |> parseMap\n\t\ta[i] = (x,y,i)\n\tend\n\tb = copy(a)\n\ta = sort(a,by=x->(x[1],x[2]))\n\tvg = zeros(Float64,n,n,n)\n\tfor i in 1:n\n\t\tfor j in 1:n-1\n\t\t\tfor k in j:n\n\t\t\t\tv1 = (a[j][1]-a[i][1],a[j][2]-a[i][2])\n\t\t\t\tv2 = (a[k][1]-a[i][1],a[k][2]-a[i][2])\n\t\t\t\tval = accos(calc(v1,v2))\n\t\t\t\tvg[i,j,k] = val\n\t\t\t\tvg[i,k,j] = val\n\t\t\tend\n\t\tend\n\tend\n\tcf = Int[1]\n\tv1 = (0,-1)\n\txc = 0\n\ttheta = 0.0\n\tfor i in 2:n\n\t\tv2 = (a[i][1]-a[1][1],a[i][2]-a[1][2])\n\t\tval = acos(calc(v1,v2))\n\t\tif theta parse(Int, x), split(readline()))\n\n sort!(a, rev=true)\n\n alice = 0\n bob = 0\n for i = 1:N \n if i % 2 == 1\n alice += a[i]\n else\n bob += a[i]\n end\n end\n\n println(alice - bob)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1521663389, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s945808149.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s945808149", "user_id": "u845674689"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n N = parse(Int, readline())\n a = map(x -> parse(Int, x), split(readline()))\n\n sort!(a, rev=true)\n\n alice = 0\n bob = 0\n for i = 1:N \n if i % 2 == 1\n alice += a[i]\n else\n bob += a[i]\n end\n end\n\n println(alice - bob)\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 418, "memory_kb": 112300}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s550650630", "group_id": "codeNet:p03435", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n c=[parseMap(split(readline())) for i in 1:3]\n ans=\"No\"\n for a1 in -100:100\n for a2 in -100:100\n for a3 in -100:100\n flg=true\n for i in 1:3\n if !(c[i][1]-a1==c[i][2]-a2==c[i][3]-a3)\n flg=false\n end\n end\n if flg\n ans=\"Yes\"\n end\n end\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1585966642, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s550650630.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s550650630", "user_id": "u619197965"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n c=[parseMap(split(readline())) for i in 1:3]\n ans=\"No\"\n for a1 in -100:100\n for a2 in -100:100\n for a3 in -100:100\n flg=true\n for i in 1:3\n if !(c[i][1]-a1==c[i][2]-a2==c[i][3]-a3)\n flg=false\n end\n end\n if flg\n ans=\"Yes\"\n end\n end\n end\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 778, "memory_kb": 167452}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s891316204", "group_id": "codeNet:p03436", "input_text": "white = 0\nHW = parse.(split(readline()))\nH,W = HW[1], HW[2]\nC = []\nfor i in 1:H\n s = chomp(readline())\n white += count(c -> c == '.', s)\n push!(C,s)\nend \nst = [1,1]\ngo = [H ,W]\n\ndx = [1,-1,0,0]\ndy = [0,0,1,-1]\nfunction BFS(graph,start,goal)\n que = []\n push!(que,start)\n dist = [[-1 for i in 1:W] for j in 1:H]\n dist[start[1]][start[2]] = 0\n while isempty(que) == false\n x,y = shift!(que)\n if [x,y] == goal\n break\n else\n for i in 1:4\n if 0 c == '.', s)\n push!(C,s)\nend \nst = [1,1]\ngo = [H ,W]\n\ndx = [1,-1,0,0]\ndy = [0,0,1,-1]\nfunction BFS(graph,start,goal)\n que = []\n push!(que,start)\n dist = [[-1 for i in 1:W] for j in 1:H]\n dist[start[1]][start[2]] = 0\n while isempty(que) == false\n x,y = shift!(que)\n if [x,y] == goal\n break\n else\n for i in 1:4\n if 0 split |> parseMap\n\tif x%y!=0\n\t\tprintln(x)\n\telse\n\t\tprintln(-1)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1585221535, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s376223067.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s376223067", "user_id": "u095714878"}, "prompt_components": {"gold_output": "16\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tx,y = readline() |> split |> parseMap\n\tif x%y!=0\n\t\tprintln(x)\n\telse\n\t\tprintln(-1)\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 342, "memory_kb": 110204}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s334918641", "group_id": "codeNet:p03447", "input_text": "(X, A, B) = parse.([Int], split(readline()))\nprint((X - A) % B)", "language": "Julia", "metadata": {"date": 1518123615, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s334918641.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s334918641", "user_id": "u078814967"}, "prompt_components": {"gold_output": "84\n", "input_to_evaluate": "(X, A, B) = parse.([Int], split(readline()))\nprint((X - A) % B)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 63, "cpu_time_ms": 872, "memory_kb": 137592}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s229680896", "group_id": "codeNet:p03449", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = parseInt(readline())\n\ta = readline() |> split |> parseMap\n\tb = readline() |> split |> parseMap\n if n == 1\n print(a[1]+b[1])\n else\n\t \taa = Array{Int}(n)\n\t \taa[1] = a[1]\n\t\tbb = Array{Int}(n)\n\t\tbb[n] = b[n]\n\t\tsum = Array{Int}(n)\n\t\tfor i in 2:n\n\t\t\taa[i] = aa[i-1]+a[i]\n\t\t\tbb[n+1-i] = bb[n+2-i] + b[n+1-i]\n\t\tend\n\t\tfor i in 1:n\n\t\t\tsum[i] = aa[i]+bb[i]\n\t\tend\n\t\tprint(maximum(sum))\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541642698, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s229680896.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s229680896", "user_id": "u095714878"}, "prompt_components": {"gold_output": "14\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = parseInt(readline())\n\ta = readline() |> split |> parseMap\n\tb = readline() |> split |> parseMap\n if n == 1\n print(a[1]+b[1])\n else\n\t \taa = Array{Int}(n)\n\t \taa[1] = a[1]\n\t\tbb = Array{Int}(n)\n\t\tbb[n] = b[n]\n\t\tsum = Array{Int}(n)\n\t\tfor i in 2:n\n\t\t\taa[i] = aa[i-1]+a[i]\n\t\t\tbb[n+1-i] = bb[n+2-i] + b[n+1-i]\n\t\tend\n\t\tfor i in 1:n\n\t\t\tsum[i] = aa[i]+bb[i]\n\t\tend\n\t\tprint(maximum(sum))\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 512, "cpu_time_ms": 371, "memory_kb": 111612}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s783722861", "group_id": "codeNet:p03450", "input_text": "function main()\n\tN,M=map(x->parse(Int32,x),split(readline()))\n\tG=[Array{Pair{Int32,Int32}}(0) for _=1:N]\n\tfor s=readlines()\n\t\tL,R,D=map(x->parse(Int32,x),split(s))\n\t\tpush!(G[L],R=>D)\n\t\tpush!(G[R],L=>-D)\n\tend\n\tdist=ones(Int,N)*1145141919810\n\tfunction dfs(u,x)\n\t\tdist[u]=x\n\t\tret=true\n\t\tfor (v,t)=G[u]\n\t\t\tif dist[v]!=1145141919810\n\t\t\t\tif x+t!=dist[v]\n\t\t\t\t\tret=false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif !dfs(v,x+t)\n\t\t\t\t\tret=false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tret\n\tend\n\tflag=true\n\tfor i=1:N\n\t\tif dist[i]==1145141919810\n\t\t\tif !dfs(i,0)\n\t\t\t\tflag=false\n\t\t\tend\n\t\tend\n\tend\n\tif flag\n\t\tprintln(\"Yes\")\n\telse\n\t\tprintln(\"No\")\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561356542, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s783722861.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Memory Limit Exceeded", "submission_id": "s783722861", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n\tN,M=map(x->parse(Int32,x),split(readline()))\n\tG=[Array{Pair{Int32,Int32}}(0) for _=1:N]\n\tfor s=readlines()\n\t\tL,R,D=map(x->parse(Int32,x),split(s))\n\t\tpush!(G[L],R=>D)\n\t\tpush!(G[R],L=>-D)\n\tend\n\tdist=ones(Int,N)*1145141919810\n\tfunction dfs(u,x)\n\t\tdist[u]=x\n\t\tret=true\n\t\tfor (v,t)=G[u]\n\t\t\tif dist[v]!=1145141919810\n\t\t\t\tif x+t!=dist[v]\n\t\t\t\t\tret=false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif !dfs(v,x+t)\n\t\t\t\t\tret=false\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tret\n\tend\n\tflag=true\n\tfor i=1:N\n\t\tif dist[i]==1145141919810\n\t\t\tif !dfs(i,0)\n\t\t\t\tflag=false\n\t\t\tend\n\t\tend\n\tend\n\tif flag\n\t\tprintln(\"Yes\")\n\telse\n\t\tprintln(\"No\")\n\tend\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 608, "cpu_time_ms": 1645, "memory_kb": 254084}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s706268109", "group_id": "codeNet:p03457", "input_text": "function main()\n \n N = parse(Int,readline())\n \n T = 0\n X = 0\n Y = 0\n \n check = true\n \n for i in 1:N\n \n (t, x, y) = map(x -> parse(Int,x), split(readline()))\n D_t = t - T\n D_x = abs(x - X)\n D_y = abs(y - Y)\n T = t\n X = x\n Y = y\n \n if D_x + D_y > D_t || (D_t - D_x + D_y) % 2 != 0\n check = false\n end\n \n end\n \n if check\n println(\"Yes\")\n else\n println(\"No\")\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1586279348, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s706268109.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s706268109", "user_id": "u790457721"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n \n N = parse(Int,readline())\n \n T = 0\n X = 0\n Y = 0\n \n check = true\n \n for i in 1:N\n \n (t, x, y) = map(x -> parse(Int,x), split(readline()))\n D_t = t - T\n D_x = abs(x - X)\n D_y = abs(y - Y)\n T = t\n X = x\n Y = y\n \n if D_x + D_y > D_t || (D_t - D_x + D_y) % 2 != 0\n check = false\n end\n \n end\n \n if check\n println(\"Yes\")\n else\n println(\"No\")\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 436, "cpu_time_ms": 1384, "memory_kb": 151296}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s995092674", "group_id": "codeNet:p03457", "input_text": "const lines=readlines()\nstate=0\ninput()=lines[global state+=1]\nint(s::String)=parse(Int,s)\nintSub(s::SubString{String})=parse(Int,s)\nintSplit(s::Array{SubString{String},1})=map(intSub,s)\nintLine()=input()|>split|>intSplit\nfunction main()\n n=int(input())\n for i=1:n\n t,x,y=intLine()\n end\n println(\"速度実験\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1561282581, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s995092674.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s995092674", "user_id": "u729133443"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "const lines=readlines()\nstate=0\ninput()=lines[global state+=1]\nint(s::String)=parse(Int,s)\nintSub(s::SubString{String})=parse(Int,s)\nintSplit(s::Array{SubString{String},1})=map(intSub,s)\nintLine()=input()|>split|>intSplit\nfunction main()\n n=int(input())\n for i=1:n\n t,x,y=intLine()\n end\n println(\"速度実験\")\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 341, "cpu_time_ms": 540, "memory_kb": 154480}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s931215920", "group_id": "codeNet:p03458", "input_text": "function calc(T,x,y,K)\n\tg(a,b,c,d)=T[c+1,d+1]-T[c+1,b]-T[a,d+1]+T[a,b]\n\tif x<=K\n\t\tif y<=K\n\t\t\tg(x,y,x+K-1,y+K-1)+g(1,1,x-1,y-1)+g(x+K,1,2K,y-1)+g(1,y+K,x-1,2K)+g(x+K,y+K,2K,2K)\n\t\telse\n\t\t\tg(x,y,x+K-1,2K)+g(x,1,x+K-1,y-K-1)+g(1,y-K,x-1,y-1)+g(x+K,y-K,2K,y-1)\n\t\tend\n\telse\n\t\tif y<=K\n\t\t\tcalc(T,x-K,y+K,K)\n\t\telse\n\t\t\tcalc(T,x-K,y-K,K)\n\t\tend\n\tend\nend\nfunction main()\n\tlines=readlines()\n\tN,K=map(x->parse(Int,x),split(shift!(lines)))\n\tsum=zeros(Int,2K+1,2K+1)\n\tfor s=lines\n\t\tx,y,c=split(s)\n\t\tsum[mod1(parse(Int,x),2K)+1,mod1(parse(Int,y)+(c==\"B\" ? K : 0),2K)+1]+=1\n\tend\n\tfor i=2:2K+1,j=2:2K+1\n\t\tsum[i,j]+=sum[i-1,j]+sum[i,j-1]-sum[i-1,j-1]\n\tend\n\tans=0\n\tfor i=1:2K,j=1:2K\n\t\tans=max(ans,calc(sum,i,j,K))\n\tend\n\tprintln(ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561361161, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s931215920.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s931215920", "user_id": "u657913472"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function calc(T,x,y,K)\n\tg(a,b,c,d)=T[c+1,d+1]-T[c+1,b]-T[a,d+1]+T[a,b]\n\tif x<=K\n\t\tif y<=K\n\t\t\tg(x,y,x+K-1,y+K-1)+g(1,1,x-1,y-1)+g(x+K,1,2K,y-1)+g(1,y+K,x-1,2K)+g(x+K,y+K,2K,2K)\n\t\telse\n\t\t\tg(x,y,x+K-1,2K)+g(x,1,x+K-1,y-K-1)+g(1,y-K,x-1,y-1)+g(x+K,y-K,2K,y-1)\n\t\tend\n\telse\n\t\tif y<=K\n\t\t\tcalc(T,x-K,y+K,K)\n\t\telse\n\t\t\tcalc(T,x-K,y-K,K)\n\t\tend\n\tend\nend\nfunction main()\n\tlines=readlines()\n\tN,K=map(x->parse(Int,x),split(shift!(lines)))\n\tsum=zeros(Int,2K+1,2K+1)\n\tfor s=lines\n\t\tx,y,c=split(s)\n\t\tsum[mod1(parse(Int,x),2K)+1,mod1(parse(Int,y)+(c==\"B\" ? K : 0),2K)+1]+=1\n\tend\n\tfor i=2:2K+1,j=2:2K+1\n\t\tsum[i,j]+=sum[i-1,j]+sum[i,j-1]-sum[i-1,j-1]\n\tend\n\tans=0\n\tfor i=1:2K,j=1:2K\n\t\tans=max(ans,calc(sum,i,j,K))\n\tend\n\tprintln(ans)\nend\nmain()\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 722, "cpu_time_ms": 802, "memory_kb": 182440}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s714398708", "group_id": "codeNet:p03464", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tk = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tlb = zeros(Int,k)\n\tub = zeros(Int,k)\n\tlb[k]=2\n\tub[k]=2\n\tf = 0\n\tif a[k]!=2\n\t\tf = 1\n\tend\n\tfor i in k-1:-1:1\n\t\tif div(a[i],a[i+1])>lb[i+1]\n\t\t\tf = 1\n\t\telse\n\t\t\tlb[i]=cld(a[i+1],a[i])*a[i]\n\t\t\tub[i]=cld(a[i+1],a[i])*a[i]+a[i]-1\n\t\tend\n\tend\n\tif f == 1\n\t\tprintln(-1)\n\telse\n\t\tprintln(lb[1],\" \",ub[1])\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584893188, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s714398708.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s714398708", "user_id": "u095714878"}, "prompt_components": {"gold_output": "6 8\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tk = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tlb = zeros(Int,k)\n\tub = zeros(Int,k)\n\tlb[k]=2\n\tub[k]=2\n\tf = 0\n\tif a[k]!=2\n\t\tf = 1\n\tend\n\tfor i in k-1:-1:1\n\t\tif div(a[i],a[i+1])>lb[i+1]\n\t\t\tf = 1\n\t\telse\n\t\t\tlb[i]=cld(a[i+1],a[i])*a[i]\n\t\t\tub[i]=cld(a[i+1],a[i])*a[i]+a[i]-1\n\t\tend\n\tend\n\tif f == 1\n\t\tprintln(-1)\n\telse\n\t\tprintln(lb[1],\" \",ub[1])\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 476, "cpu_time_ms": 427, "memory_kb": 119988}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s862143477", "group_id": "codeNet:p03464", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tif a[n] != 2\n\t\tprintln(0)\n\telse\n\t\tflg = 0\n\t\tb = Array{Int}(n)\n\t\tc = Array{Int}(n)\n\t\tb[n] = 2\n\t\tc[n] = 2\n\t\tfor i in 1:n-1\n\t\t\tif div(b[n-i+1],a[n-i+1])==div(c[n-i+1],a[n-i+1])&&b[n-i+1]%a[n-i+1]>0&&c[n-i+1]%a[n-i+1]>0\n\t\t\t\tflg = 1\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tb[n-i] = ceil(Int,b[n-i+1]/a[n-i+1])*a[n-i+1]\n\t\t\t\tc[n-i] = floor(Int,c[n-i+1]/a[n-i+1])*a[n-i+1]+a[n-i+1]-1\n\t\t\tend\n\t\tend\n\t\tb[1] = ceil(Int,b[1]/a[1])*a[1]\n\t\tc[1] = floor(Int,c[1]/a[1])*a[1]+a[1]-1\n\t\tif flg == 1\n\t\t\tprintln(-1)\n\t\telse\n\t\t\tprintln(b[1], \" \", c[1])\n\t\tend\n\tend\nend\nmain()", "language": "Julia", "metadata": {"date": 1552091079, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s862143477.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s862143477", "user_id": "u095714878"}, "prompt_components": {"gold_output": "6 8\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tif a[n] != 2\n\t\tprintln(0)\n\telse\n\t\tflg = 0\n\t\tb = Array{Int}(n)\n\t\tc = Array{Int}(n)\n\t\tb[n] = 2\n\t\tc[n] = 2\n\t\tfor i in 1:n-1\n\t\t\tif div(b[n-i+1],a[n-i+1])==div(c[n-i+1],a[n-i+1])&&b[n-i+1]%a[n-i+1]>0&&c[n-i+1]%a[n-i+1]>0\n\t\t\t\tflg = 1\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\tb[n-i] = ceil(Int,b[n-i+1]/a[n-i+1])*a[n-i+1]\n\t\t\t\tc[n-i] = floor(Int,c[n-i+1]/a[n-i+1])*a[n-i+1]+a[n-i+1]-1\n\t\t\tend\n\t\tend\n\t\tb[1] = ceil(Int,b[1]/a[1])*a[1]\n\t\tc[1] = floor(Int,c[1]/a[1])*a[1]+a[1]-1\n\t\tif flg == 1\n\t\t\tprintln(-1)\n\t\telse\n\t\t\tprintln(b[1], \" \", c[1])\n\t\tend\n\tend\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 696, "cpu_time_ms": 457, "memory_kb": 120024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s660613258", "group_id": "codeNet:p03469", "input_text": "#ABC 085 A - Already 2018\nfunction main()\n A = String(readline())\n print(replace(A , \"2017\", \"2018\"))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1537748009, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03469.html", "problem_id": "p03469", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03469/input.txt", "sample_output_relpath": "derived/input_output/data/p03469/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03469/Julia/s660613258.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s660613258", "user_id": "u373796790"}, "prompt_components": {"gold_output": "2018/01/07\n", "input_to_evaluate": "#ABC 085 A - Already 2018\nfunction main()\n A = String(readline())\n print(replace(A , \"2017\", \"2018\"))\nend\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nOn some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in yyyy/mm/dd format. For example, January 23, 2018 should be written as 2018/01/23.\n\nAfter finishing the document, she noticed that she had mistakenly wrote 2017 at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to 2018 and prints it.\n\nConstraints\n\nS is a string of length 10.\n\nThe first eight characters in S are 2017/01/.\n\nThe last two characters in S are digits and represent an integer between 1 and 31 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nReplace the first four characters in S with 2018 and print it.\n\nSample Input 1\n\n2017/01/07\n\nSample Output 1\n\n2018/01/07\n\nSample Input 2\n\n2017/01/31\n\nSample Output 2\n\n2018/01/31", "sample_input": "2017/01/07\n"}, "reference_outputs": ["2018/01/07\n"], "source_document_id": "p03469", "source_text": "Score : 100 points\n\nProblem Statement\n\nOn some day in January 2018, Takaki is writing a document. The document has a column where the current date is written in yyyy/mm/dd format. For example, January 23, 2018 should be written as 2018/01/23.\n\nAfter finishing the document, she noticed that she had mistakenly wrote 2017 at the beginning of the date column. Write a program that, when the string that Takaki wrote in the date column, S, is given as input, modifies the first four characters in S to 2018 and prints it.\n\nConstraints\n\nS is a string of length 10.\n\nThe first eight characters in S are 2017/01/.\n\nThe last two characters in S are digits and represent an integer between 1 and 31 (inclusive).\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nReplace the first four characters in S with 2018 and print it.\n\nSample Input 1\n\n2017/01/07\n\nSample Output 1\n\n2018/01/07\n\nSample Input 2\n\n2017/01/31\n\nSample Output 2\n\n2018/01/31", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 119, "cpu_time_ms": 263, "memory_kb": 108156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s919761461", "group_id": "codeNet:p03470", "input_text": "N=parse(Int,readline())\nD=Dict{Int,Int}()\nfor s=readlines()\n x=parse(Int,s)\n D[x]=0\nend\nprintln(length(D))", "language": "Julia", "metadata": {"date": 1561448837, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03470.html", "problem_id": "p03470", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03470/input.txt", "sample_output_relpath": "derived/input_output/data/p03470/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03470/Julia/s919761461.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s919761461", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "N=parse(Int,readline())\nD=Dict{Int,Int}()\nfor s=readlines()\n x=parse(Int,s)\n D[x]=0\nend\nprintln(length(D))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.\n\nLunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ d_i ≤ 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1\n:\nd_N\n\nOutput\n\nPrint the maximum number of layers in a kagami mochi that can be made.\n\nSample Input 1\n\n4\n10\n8\n8\n6\n\nSample Output 1\n\n3\n\nIf we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.\n\nSample Input 2\n\n3\n15\n15\n15\n\nSample Output 2\n\n1\n\nWhen all the mochi have the same diameter, we can only have a 1-layered kagami mochi.\n\nSample Input 3\n\n7\n50\n30\n50\n100\n50\n80\n30\n\nSample Output 3\n\n4", "sample_input": "4\n10\n8\n8\n6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03470", "source_text": "Score : 200 points\n\nProblem Statement\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.\n\nLunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ d_i ≤ 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1\n:\nd_N\n\nOutput\n\nPrint the maximum number of layers in a kagami mochi that can be made.\n\nSample Input 1\n\n4\n10\n8\n8\n6\n\nSample Output 1\n\n3\n\nIf we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.\n\nSample Input 2\n\n3\n15\n15\n15\n\nSample Output 2\n\n1\n\nWhen all the mochi have the same diameter, we can only have a 1-layered kagami mochi.\n\nSample Input 3\n\n7\n50\n30\n50\n100\n50\n80\n30\n\nSample Output 3\n\n4", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 330, "memory_kb": 109524}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s124729016", "group_id": "codeNet:p03470", "input_text": "n=parse(readline())\nmochi=Int[]\nfor _ in 1:n\n push!(mochi,parse(readline()))\nend\nprintln length(unique(mochi))", "language": "Julia", "metadata": {"date": 1535870781, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03470.html", "problem_id": "p03470", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03470/input.txt", "sample_output_relpath": "derived/input_output/data/p03470/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03470/Julia/s124729016.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s124729016", "user_id": "u726630158"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "n=parse(readline())\nmochi=Int[]\nfor _ in 1:n\n push!(mochi,parse(readline()))\nend\nprintln length(unique(mochi))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.\n\nLunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ d_i ≤ 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1\n:\nd_N\n\nOutput\n\nPrint the maximum number of layers in a kagami mochi that can be made.\n\nSample Input 1\n\n4\n10\n8\n8\n6\n\nSample Output 1\n\n3\n\nIf we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.\n\nSample Input 2\n\n3\n15\n15\n15\n\nSample Output 2\n\n1\n\nWhen all the mochi have the same diameter, we can only have a 1-layered kagami mochi.\n\nSample Input 3\n\n7\n50\n30\n50\n100\n50\n80\n30\n\nSample Output 3\n\n4", "sample_input": "4\n10\n8\n8\n6\n"}, "reference_outputs": ["3\n"], "source_document_id": "p03470", "source_text": "Score : 200 points\n\nProblem Statement\n\nAn X-layered kagami mochi (X ≥ 1) is a pile of X round mochi (rice cake) stacked vertically where each mochi (except the bottom one) has a smaller diameter than that of the mochi directly below it. For example, if you stack three mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, you have a 3-layered kagami mochi; if you put just one mochi, you have a 1-layered kagami mochi.\n\nLunlun the dachshund has N round mochi, and the diameter of the i-th mochi is d_i centimeters. When we make a kagami mochi using some or all of them, at most how many layers can our kagami mochi have?\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ d_i ≤ 100\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nd_1\n:\nd_N\n\nOutput\n\nPrint the maximum number of layers in a kagami mochi that can be made.\n\nSample Input 1\n\n4\n10\n8\n8\n6\n\nSample Output 1\n\n3\n\nIf we stack the mochi with diameters of 10, 8 and 6 centimeters from bottom to top in this order, we have a 3-layered kagami mochi, which is the maximum number of layers.\n\nSample Input 2\n\n3\n15\n15\n15\n\nSample Output 2\n\n1\n\nWhen all the mochi have the same diameter, we can only have a 1-layered kagami mochi.\n\nSample Input 3\n\n7\n50\n30\n50\n100\n50\n80\n30\n\nSample Output 3\n\n4", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 561, "memory_kb": 126112}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s937059870", "group_id": "codeNet:p03473", "input_text": "print(48-parse(readline()))", "language": "Julia", "metadata": {"date": 1561162655, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03473.html", "problem_id": "p03473", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03473/input.txt", "sample_output_relpath": "derived/input_output/data/p03473/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03473/Julia/s937059870.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s937059870", "user_id": "u729133443"}, "prompt_components": {"gold_output": "27\n", "input_to_evaluate": "print(48-parse(readline()))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nHow many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?\n\nConstraints\n\n1≤M≤23\n\nM is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM\n\nOutput\n\nIf we have x hours until New Year at M o'clock on 30th, December, print x.\n\nSample Input 1\n\n21\n\nSample Output 1\n\n27\n\nWe have 27 hours until New Year at 21 o'clock on 30th, December.\n\nSample Input 2\n\n12\n\nSample Output 2\n\n36", "sample_input": "21\n"}, "reference_outputs": ["27\n"], "source_document_id": "p03473", "source_text": "Score : 100 points\n\nProblem Statement\n\nHow many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?\n\nConstraints\n\n1≤M≤23\n\nM is an integer.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nM\n\nOutput\n\nIf we have x hours until New Year at M o'clock on 30th, December, print x.\n\nSample Input 1\n\n21\n\nSample Output 1\n\n27\n\nWe have 27 hours until New Year at 21 o'clock on 30th, December.\n\nSample Input 2\n\n12\n\nSample Output 2\n\n36", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 27, "cpu_time_ms": 276, "memory_kb": 108156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s938178426", "group_id": "codeNet:p03474", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn = parseInt.(split(readline()))\n\tk = (split(readline(), \"-\"))\n\tif length(k[1])==n[1] && length(k[2])-1 ==n[2]\n\t\tprint(\"Yes\")\n\telse\n\t\tprint(\"No\")\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541010307, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s938178426.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s938178426", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn = parseInt.(split(readline()))\n\tk = (split(readline(), \"-\"))\n\tif length(k[1])==n[1] && length(k[2])-1 ==n[2]\n\t\tprint(\"Yes\")\n\telse\n\t\tprint(\"No\")\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 423, "memory_kb": 116180}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s469657738", "group_id": "codeNet:p03475", "input_text": "function main()\n\tN=parse(Int,readline())\n\tC=Int[]\n\tS=Int[]\n\tF=Int[]\n\tfor s=readlines()\n\t\tc,s,f=map(x->parse(Int,x),split(s))\n\t\tpush!(C,c)\n\t\tpush!(S,s)\n\t\tpush!(F,f)\n\tend\n\tfor i=1:N\n\t\tnow=0\n\t\tfor j=i:N-1\n\t\t\tnow=max(cld(now,F[j])*F[j],S[j])+C[j]\n\t\tend\n\t\tprintln(now)\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561449819, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s469657738.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s469657738", "user_id": "u657913472"}, "prompt_components": {"gold_output": "12\n11\n0\n", "input_to_evaluate": "function main()\n\tN=parse(Int,readline())\n\tC=Int[]\n\tS=Int[]\n\tF=Int[]\n\tfor s=readlines()\n\t\tc,s,f=map(x->parse(Int,x),split(s))\n\t\tpush!(C,c)\n\t\tpush!(S,s)\n\t\tpush!(F,f)\n\tend\n\tfor i=1:N\n\t\tnow=0\n\t\tfor j=i:N-1\n\t\t\tnow=max(cld(now,F[j])*F[j],S[j])+C[j]\n\t\tend\n\t\tprintln(now)\n\tend\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 374, "memory_kb": 110856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s632681136", "group_id": "codeNet:p03476", "input_text": "parseInt(x) = parse(Int,x)\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n q = parseInt(readline())\n for i in 1:q\n l,r = parseMap(split(readline()))\n end\n print(\"ほらね\")\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1543561695, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s632681136.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s632681136", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n q = parseInt(readline())\n for i in 1:q\n l,r = parseMap(split(readline()))\n end\n print(\"ほらね\")\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 506, "memory_kb": 155004}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s981186379", "group_id": "codeNet:p03476", "input_text": "function parseInt(x) parse(Int, x) end\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction startNum(x)\n\tif (x+1)%4 == 0\n\t\treturn(x+2)\n\telse\n\t\treturn(x)\n\tend\nend\n\nfunction isPrime(x)\n\tif x <= 1\n\t\treturn(0)\n\telseif x == 2\n\t\treturn(1)\n\telseif x%2 == 0\n\t\treturn(0)\n\telse\n\t\ti = 3\n\t\tflg = 0\n\t\twhile i <= floor(sqrt(x))\n\t\t\tif x%i == 0\n\t\t\t\treturn(0)\n\t\t\t\tflg = 1\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\ti += 2\n\t\t\tend\n\t\tend\n\t\tif flg == 0\n\t\t\treturn(1)\n\t\tend\n\tend\nend\n\nfunction isBPrime(x)\n if isPrime(x) == 1 && isPrime(div(x+1,2)) == 1\n return(1)\n else\n return(0)\n end\nend\n\nfunction main()\n q = parseInt(readline())\n for i in 1:q\n l, r = parseMap(split(readline()))\n count = 0\n if l <= 3 <= r\n count += 1\n end\n l = startNum(l)\n while l <= r\n count += isBPrime(l)\n l += 4\n end\n println(count)\n end\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541526376, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s981186379.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s981186379", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction startNum(x)\n\tif (x+1)%4 == 0\n\t\treturn(x+2)\n\telse\n\t\treturn(x)\n\tend\nend\n\nfunction isPrime(x)\n\tif x <= 1\n\t\treturn(0)\n\telseif x == 2\n\t\treturn(1)\n\telseif x%2 == 0\n\t\treturn(0)\n\telse\n\t\ti = 3\n\t\tflg = 0\n\t\twhile i <= floor(sqrt(x))\n\t\t\tif x%i == 0\n\t\t\t\treturn(0)\n\t\t\t\tflg = 1\n\t\t\t\tbreak\n\t\t\telse\n\t\t\t\ti += 2\n\t\t\tend\n\t\tend\n\t\tif flg == 0\n\t\t\treturn(1)\n\t\tend\n\tend\nend\n\nfunction isBPrime(x)\n if isPrime(x) == 1 && isPrime(div(x+1,2)) == 1\n return(1)\n else\n return(0)\n end\nend\n\nfunction main()\n q = parseInt(readline())\n for i in 1:q\n l, r = parseMap(split(readline()))\n count = 0\n if l <= 3 <= r\n count += 1\n end\n l = startNum(l)\n while l <= r\n count += isBPrime(l)\n l += 4\n end\n println(count)\n end\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 850, "cpu_time_ms": 2111, "memory_kb": 112644}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s121626101", "group_id": "codeNet:p03477", "input_text": "A,B,C,D=map(x->parse(Int,x),split(readline()))\nif A+Bparse(Int,x),split(readline()))\nif A+BR, 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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 141, "cpu_time_ms": 318, "memory_kb": 110092}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s057700563", "group_id": "codeNet:p03479", "input_text": "A,B=map(x->parse(Int,x),split(readline()))\nprintln(ndigits(B÷A,2))", "language": "Julia", "metadata": {"date": 1561450542, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s057700563.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s057700563", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "A,B=map(x->parse(Int,x),split(readline()))\nprintln(ndigits(B÷A,2))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 346, "memory_kb": 110588}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s541530048", "group_id": "codeNet:p03480", "input_text": "s=chomp(readline())\nans=0\nT=length(s)\nfor i=1:T-1\n if s[i]!=s[i+1]\n ans=min(ans,max(i,T-i))\n end\nend\nprintln(ans)", "language": "Julia", "metadata": {"date": 1561450769, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03480.html", "problem_id": "p03480", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03480/input.txt", "sample_output_relpath": "derived/input_output/data/p03480/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03480/Julia/s541530048.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s541530048", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "s=chomp(readline())\nans=0\nT=length(s)\nfor i=1:T-1\n if s[i]!=s[i+1]\n ans=min(ans,max(i,T-i))\n end\nend\nprintln(ans)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "sample_input": "010\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03480", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a string S consisting of 0 and 1.\nFind the maximum integer K not greater than |S| such that we can turn all the characters of S into 0 by repeating the following operation some number of times.\n\nChoose a contiguous segment [l,r] in S whose length is at least K (that is, r-l+1\\geq K must be satisfied). For each integer i such that l\\leq i\\leq r, do the following: if S_i is 0, replace it with 1; if S_i is 1, replace it with 0.\n\nConstraints\n\n1\\leq |S|\\leq 10^5\n\nS_i(1\\leq i\\leq N) is either 0 or 1.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the maximum integer K such that we can turn all the characters of S into 0 by repeating the operation some number of times.\n\nSample Input 1\n\n010\n\nSample Output 1\n\n2\n\nWe can turn all the characters of S into 0 by the following operations:\n\nPerform the operation on the segment S[1,3] with length 3. S is now 101.\n\nPerform the operation on the segment S[1,2] with length 2. S is now 011.\n\nPerform the operation on the segment S[2,3] with length 2. S is now 000.\n\nSample Input 2\n\n100000000\n\nSample Output 2\n\n8\n\nSample Input 3\n\n00001111\n\nSample Output 3\n\n4", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 354, "memory_kb": 119260}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s251456934", "group_id": "codeNet:p03485", "input_text": "a,b = parse.(Int,split(readline()))\nprintln(convert(Int,round((a+b)/2)))", "language": "Julia", "metadata": {"date": 1601129233, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p03485.html", "problem_id": "p03485", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03485/input.txt", "sample_output_relpath": "derived/input_output/data/p03485/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03485/Julia/s251456934.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s251456934", "user_id": "u739563361"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "a,b = parse.(Int,split(readline()))\nprintln(convert(Int,round((a+b)/2)))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given two positive integers a and b.\nLet x be the average of a and b.\nPrint x rounded up to the nearest integer.\n\nConstraints\n\na and b are integers.\n\n1 \\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 x rounded up to the nearest integer.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n2\n\nThe average of 1 and 3 is 2.0, and it will be rounded up to the nearest integer, 2.\n\nSample Input 2\n\n7 4\n\nSample Output 2\n\n6\n\nThe average of 7 and 4 is 5.5, and it will be rounded up to the nearest integer, 6.\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\n5", "sample_input": "1 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03485", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given two positive integers a and b.\nLet x be the average of a and b.\nPrint x rounded up to the nearest integer.\n\nConstraints\n\na and b are integers.\n\n1 \\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 x rounded up to the nearest integer.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\n2\n\nThe average of 1 and 3 is 2.0, and it will be rounded up to the nearest integer, 2.\n\nSample Input 2\n\n7 4\n\nSample Output 2\n\n6\n\nThe average of 7 and 4 is 5.5, and it will be rounded up to the nearest integer, 6.\n\nSample Input 3\n\n5 5\n\nSample Output 3\n\n5", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 72, "cpu_time_ms": 285, "memory_kb": 171088}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s752710308", "group_id": "codeNet:p03486", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\ts = sort(collect(readline()))\n\tt = sort(collect(readline()), rev=true)\n\tflg = 0\n\tsameflg = 0\n\tfor i in 1:min(length(s),length(t))\n\t\tif s[i] > t[i]\n\t\t\tflg = 1\n\t\t\tbreak\n\t\telseif s[i] == t[i]\n\t\t\tsameflg += 1\n\t\telse\n\t\t\tbreak\n\t\tend\n\tend\n\tif sameflg == length(t) && length(t) <= length(s)\n\t\tflg = 1\n\tend\n\tif flg == 0\n\t\tprint(\"Yes\")\n\telse\n\t\tprint(\"No\")\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541099980, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03486.html", "problem_id": "p03486", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03486/input.txt", "sample_output_relpath": "derived/input_output/data/p03486/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03486/Julia/s752710308.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s752710308", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\ts = sort(collect(readline()))\n\tt = sort(collect(readline()), rev=true)\n\tflg = 0\n\tsameflg = 0\n\tfor i in 1:min(length(s),length(t))\n\t\tif s[i] > t[i]\n\t\t\tflg = 1\n\t\t\tbreak\n\t\telseif s[i] == t[i]\n\t\t\tsameflg += 1\n\t\telse\n\t\t\tbreak\n\t\tend\n\tend\n\tif sameflg == length(t) && length(t) <= length(s)\n\t\tflg = 1\n\tend\n\tif flg == 0\n\t\tprint(\"Yes\")\n\telse\n\t\tprint(\"No\")\n\tend\nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given strings s and t, consisting of lowercase English letters.\nYou will create a string s' by freely rearranging the characters in s.\nYou will also create a string t' by freely rearranging the characters in t.\nDetermine whether it is possible to satisfy s' < t' for the lexicographic order.\n\nNotes\n\nFor a string a = a_1 a_2 ... a_N of length N and a string b = b_1 b_2 ... b_M of length M, we say a < b for the lexicographic order if either one of the following two conditions holds true:\n\nN < M and a_1 = b_1, a_2 = b_2, ..., a_N = b_N.\n\nThere exists i (1 \\leq i \\leq N, M) such that a_1 = b_1, a_2 = b_2, ..., a_{i - 1} = b_{i - 1} and a_i < b_i. Here, letters are compared using alphabetical order.\n\nFor example, xy < xya and atcoder < atlas.\n\nConstraints\n\nThe lengths of s and t are between 1 and 100 (inclusive).\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 it is possible to satisfy s' < t', print Yes; if it is not, print No.\n\nSample Input 1\n\nyx\naxy\n\nSample Output 1\n\nYes\n\nWe can, for example, rearrange yx into xy and axy into yxa. Then, xy < yxa.\n\nSample Input 2\n\nratcode\natlas\n\nSample Output 2\n\nYes\n\nWe can, for example, rearrange ratcode into acdeort and atlas into tslaa. Then, acdeort < tslaa.\n\nSample Input 3\n\ncd\nabc\n\nSample Output 3\n\nNo\n\nNo matter how we rearrange cd and abc, we cannot achieve our objective.\n\nSample Input 4\n\nw\nww\n\nSample Output 4\n\nYes\n\nSample Input 5\n\nzzz\nzzz\n\nSample Output 5\n\nNo", "sample_input": "yx\naxy\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03486", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given strings s and t, consisting of lowercase English letters.\nYou will create a string s' by freely rearranging the characters in s.\nYou will also create a string t' by freely rearranging the characters in t.\nDetermine whether it is possible to satisfy s' < t' for the lexicographic order.\n\nNotes\n\nFor a string a = a_1 a_2 ... a_N of length N and a string b = b_1 b_2 ... b_M of length M, we say a < b for the lexicographic order if either one of the following two conditions holds true:\n\nN < M and a_1 = b_1, a_2 = b_2, ..., a_N = b_N.\n\nThere exists i (1 \\leq i \\leq N, M) such that a_1 = b_1, a_2 = b_2, ..., a_{i - 1} = b_{i - 1} and a_i < b_i. Here, letters are compared using alphabetical order.\n\nFor example, xy < xya and atcoder < atlas.\n\nConstraints\n\nThe lengths of s and t are between 1 and 100 (inclusive).\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 it is possible to satisfy s' < t', print Yes; if it is not, print No.\n\nSample Input 1\n\nyx\naxy\n\nSample Output 1\n\nYes\n\nWe can, for example, rearrange yx into xy and axy into yxa. Then, xy < yxa.\n\nSample Input 2\n\nratcode\natlas\n\nSample Output 2\n\nYes\n\nWe can, for example, rearrange ratcode into acdeort and atlas into tslaa. Then, acdeort < tslaa.\n\nSample Input 3\n\ncd\nabc\n\nSample Output 3\n\nNo\n\nNo matter how we rearrange cd and abc, we cannot achieve our objective.\n\nSample Input 4\n\nw\nww\n\nSample Output 4\n\nYes\n\nSample Input 5\n\nzzz\nzzz\n\nSample Output 5\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 980, "memory_kb": 174844}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s428876213", "group_id": "codeNet:p03486", "input_text": "s=join(sort(split(readline(),\"\")))\nt=join(reverse(sort(split(readline(),\"\"))))\nprint(sx==i,b)\n temp+=a\n c[i]=a\n end\n else\n break\n end\n end\n temp2=0\n for i in c\n a,b=i\n if a>=b\n temp2+=b\n else\n temp2+=b-a\n end\n \n end\nprint(temp2) \nend\nmain()", "language": "Julia", "metadata": {"date": 1564808309, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Julia/s944865411.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s944865411", "user_id": "u539005641"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "p(x)=parse(Int64,x)\n \nfunction main()\n a=parse(Int64, readline())\n b=map(p,split(readline()))\n c=Dict{Int64,Int64}()\n n=length(b)\n temp=0\n for i in b\n if temp !== n\n if !haskey(c,i)\n a = count(x->x==i,b)\n temp+=a\n c[i]=a\n end\n else\n break\n end\n end\n temp2=0\n for i in c\n a,b=i\n if a>=b\n temp2+=b\n else\n temp2+=b-a\n end\n \n end\nprint(temp2) \nend\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\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 number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\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 number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 450, "cpu_time_ms": 2112, "memory_kb": 153468}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s063220766", "group_id": "codeNet:p03487", "input_text": "p(x)=parse(Int64,x)\n \nfunction main()\n a=parse(Int64, readline())\n b=map(p,split(readline()))\n c=Dict{Int64,Int64}()\n n=length(b)\n temp=0\n for i in b\n if temp !== n\n if haskey(c,i)\n a = count(x->x==i,b)\n temp+=a\n a[i]=a\n end\n else\n break\n end\n end\n temp2=0\n for i in c\n a,b=i\n if a>=b\n temp2+=b\n else\n temp2+=b-a\n end\n \n end\nprint(temp2) \nend\nmain()\n\n ", "language": "Julia", "metadata": {"date": 1564808006, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Julia/s063220766.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s063220766", "user_id": "u539005641"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "p(x)=parse(Int64,x)\n \nfunction main()\n a=parse(Int64, readline())\n b=map(p,split(readline()))\n c=Dict{Int64,Int64}()\n n=length(b)\n temp=0\n for i in b\n if temp !== n\n if haskey(c,i)\n a = count(x->x==i,b)\n temp+=a\n a[i]=a\n end\n else\n break\n end\n end\n temp2=0\n for i in c\n a,b=i\n if a>=b\n temp2+=b\n else\n temp2+=b-a\n end\n \n end\nprint(temp2) \nend\nmain()\n\n ", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\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 number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\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 number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 455, "cpu_time_ms": 421, "memory_kb": 127760}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s751362807", "group_id": "codeNet:p03487", "input_text": "parseInt(x) = parse(Int,x)\n\nfunction main()\n n = parseInt(readline())\n a = map(parseInt, split(readline()))\n print(\"この記事はみゅーもり Advent Calender 2018のために作成されました\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1542314365, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03487.html", "problem_id": "p03487", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03487/input.txt", "sample_output_relpath": "derived/input_output/data/p03487/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03487/Julia/s751362807.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s751362807", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nfunction main()\n n = parseInt(readline())\n a = map(parseInt, split(readline()))\n print(\"この記事はみゅーもり Advent Calender 2018のために作成されました\")\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\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 number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "sample_input": "4\n3 3 3 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03487", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a sequence of positive integers of length N, a = (a_1, a_2, ..., a_N).\nYour objective is to remove some of the elements in a so that a will be a good sequence.\n\nHere, an sequence b is a good sequence when the following condition holds true:\n\nFor each element x in b, the value x occurs exactly x times in b.\n\nFor example, (3, 3, 3), (4, 2, 4, 1, 4, 2, 4) and () (an empty sequence) are good sequences, while (3, 3, 3, 3) and (2, 4, 1, 4, 2) are not.\n\nFind the minimum number of elements that needs to be removed so that a will be a good sequence.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\na_i is an integer.\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 number of elements that needs to be removed so that a will be a good sequence.\n\nSample Input 1\n\n4\n3 3 3 3\n\nSample Output 1\n\n1\n\nWe can, for example, remove one occurrence of 3. Then, (3, 3, 3) is a good sequence.\n\nSample Input 2\n\n5\n2 4 1 4 2\n\nSample Output 2\n\n2\n\nWe can, for example, remove two occurrences of 4. Then, (2, 1, 2) is a good sequence.\n\nSample Input 3\n\n6\n1 2 2 3 3 3\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1\n1000000000\n\nSample Output 4\n\n1\n\nRemove one occurrence of 10^9. Then, () is a good sequence.\n\nSample Input 5\n\n8\n2 7 1 8 2 8 1 8\n\nSample Output 5\n\n5", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 775, "memory_kb": 165396}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s035857793", "group_id": "codeNet:p03488", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ts = chomp(readline())\n\tx,y = readline() |> split |> parseMap\n\th = Int[]\n\tv = Int[]\n\tf = 0\n\tc = 0\n\tfor i in 1:length(s)\n\t\tif s[i] == 'T'\n\t\t\tif f == 0\n\t\t\t\tpush!(h,c)\n\t\t\t\tf = 1\n\t\t\telse\n\t\t\t\tpush!(v,c)\n\t\t\t\tf = 0\n\t\t\tend\n\t\t\tc = 0\n\t\telse\n\t\t\tc += 1\n\t\tend\n\tend\n\tif s[length(s)] == 'F'\n\t\tif f == 0\n\t\t\tpush!(h,c)\n\t\telse\n\t\t\tpush!(v,c)\n\t\tend\n\tend\n\tsh = sum(h)\n\tdph = zeros(Int,length(h), 2*sh+1)\n\tif length(h)>0\n\t\tdph[1,sh+1+h[1]] = 1\n\tend\n\tfor i in 2:length(h)\n\t\tfor j in 1:2*sh+1\n\t\t\tif j <= h[i]\n\t\t\t\tdph[i,j] = dph[i-1,j+h[i]]\n\t\t\telseif j >= 2*sh+1-h[i]\n\t\t\t\tdph[i,j] = dph[i-1,j-h[i]]\n\t\t\telse\n\t\t\t\tdph[i,j] = max(dph[i-1,j+h[i]], dph[i-1,j-h[i]])\n\t\t\tend\n\t\tend\n\tend\n\tsv = sum(v)\n\tdpv = zeros(Int,length(v), 2*sv+1)\n\tif length(v)>0\n\t\tdpv[1,sv+1+v[1]] = 1\n\tend\n\tfor i in 2:length(v)\n\t\tfor j in 1:2*sv+1\n\t\t\tif j <= v[i]\n\t\t\t\tdpv[i,j] = dpv[i-1,j+v[i]]\n\t\t\telseif j >= 2*sv+1-v[i]\n\t\t\t\tdpv[i,j] = dpv[i-1,j-v[i]]\n\t\t\telse\n\t\t\t\tdpv[i,j] = max(dpv[i-1,j+h[i]], dpv[i-1,j-h[i]])\n\t\t\tend\n\t\tend\n\tend\n\tif sh+x+1<0||sh+x+1>2*sh+1||sv+y+1<0||sv+y+1>2*sv+1\n\t\tprintln(\"No\")\n\telse\n\t\tprintln(dph[length(h),sh+x+1]==1&&dpv[length(v),sv+y+1]==1?\"Yes\":\"No\")\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1556546509, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03488.html", "problem_id": "p03488", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03488/input.txt", "sample_output_relpath": "derived/input_output/data/p03488/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03488/Julia/s035857793.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s035857793", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ts = chomp(readline())\n\tx,y = readline() |> split |> parseMap\n\th = Int[]\n\tv = Int[]\n\tf = 0\n\tc = 0\n\tfor i in 1:length(s)\n\t\tif s[i] == 'T'\n\t\t\tif f == 0\n\t\t\t\tpush!(h,c)\n\t\t\t\tf = 1\n\t\t\telse\n\t\t\t\tpush!(v,c)\n\t\t\t\tf = 0\n\t\t\tend\n\t\t\tc = 0\n\t\telse\n\t\t\tc += 1\n\t\tend\n\tend\n\tif s[length(s)] == 'F'\n\t\tif f == 0\n\t\t\tpush!(h,c)\n\t\telse\n\t\t\tpush!(v,c)\n\t\tend\n\tend\n\tsh = sum(h)\n\tdph = zeros(Int,length(h), 2*sh+1)\n\tif length(h)>0\n\t\tdph[1,sh+1+h[1]] = 1\n\tend\n\tfor i in 2:length(h)\n\t\tfor j in 1:2*sh+1\n\t\t\tif j <= h[i]\n\t\t\t\tdph[i,j] = dph[i-1,j+h[i]]\n\t\t\telseif j >= 2*sh+1-h[i]\n\t\t\t\tdph[i,j] = dph[i-1,j-h[i]]\n\t\t\telse\n\t\t\t\tdph[i,j] = max(dph[i-1,j+h[i]], dph[i-1,j-h[i]])\n\t\t\tend\n\t\tend\n\tend\n\tsv = sum(v)\n\tdpv = zeros(Int,length(v), 2*sv+1)\n\tif length(v)>0\n\t\tdpv[1,sv+1+v[1]] = 1\n\tend\n\tfor i in 2:length(v)\n\t\tfor j in 1:2*sv+1\n\t\t\tif j <= v[i]\n\t\t\t\tdpv[i,j] = dpv[i-1,j+v[i]]\n\t\t\telseif j >= 2*sv+1-v[i]\n\t\t\t\tdpv[i,j] = dpv[i-1,j-v[i]]\n\t\t\telse\n\t\t\t\tdpv[i,j] = max(dpv[i-1,j+h[i]], dpv[i-1,j-h[i]])\n\t\t\tend\n\t\tend\n\tend\n\tif sh+x+1<0||sh+x+1>2*sh+1||sv+y+1<0||sv+y+1>2*sv+1\n\t\tprintln(\"No\")\n\telse\n\t\tprintln(dph[length(h),sh+x+1]==1&&dpv[length(v),sv+y+1]==1?\"Yes\":\"No\")\n\tend\nend\nmain()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nA robot is put at the origin in a two-dimensional plane.\nInitially, the robot is facing in the positive x-axis direction.\n\nThis robot will be given an instruction sequence s.\ns consists of the following two kinds of letters, and will be executed in order from front to back.\n\nF : Move in the current direction by distance 1.\n\nT : Turn 90 degrees, either clockwise or counterclockwise.\n\nThe objective of the robot is to be at coordinates (x, y) after all the instructions are executed.\nDetermine whether this objective is achievable.\n\nConstraints\n\ns consists of F and T.\n\n1 \\leq |s| \\leq 8 000\n\nx and y are integers.\n\n|x|, |y| \\leq |s|\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nx y\n\nOutput\n\nIf the objective is achievable, print Yes; if it is not, print No.\n\nSample Input 1\n\nFTFFTFFF\n4 2\n\nSample Output 1\n\nYes\n\nThe objective can be achieved by, for example, turning counterclockwise in the first T and turning clockwise in the second T.\n\nSample Input 2\n\nFTFFTFFF\n-2 -2\n\nSample Output 2\n\nYes\n\nThe objective can be achieved by, for example, turning clockwise in the first T and turning clockwise in the second T.\n\nSample Input 3\n\nFF\n1 0\n\nSample Output 3\n\nNo\n\nSample Input 4\n\nTF\n1 0\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nFFTTFF\n0 0\n\nSample Output 5\n\nYes\n\nThe objective can be achieved by, for example, turning counterclockwise in the first T and turning counterclockwise in the second T.\n\nSample Input 6\n\nTTTT\n1 0\n\nSample Output 6\n\nNo", "sample_input": "FTFFTFFF\n4 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03488", "source_text": "Score : 500 points\n\nProblem Statement\n\nA robot is put at the origin in a two-dimensional plane.\nInitially, the robot is facing in the positive x-axis direction.\n\nThis robot will be given an instruction sequence s.\ns consists of the following two kinds of letters, and will be executed in order from front to back.\n\nF : Move in the current direction by distance 1.\n\nT : Turn 90 degrees, either clockwise or counterclockwise.\n\nThe objective of the robot is to be at coordinates (x, y) after all the instructions are executed.\nDetermine whether this objective is achievable.\n\nConstraints\n\ns consists of F and T.\n\n1 \\leq |s| \\leq 8 000\n\nx and y are integers.\n\n|x|, |y| \\leq |s|\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns\nx y\n\nOutput\n\nIf the objective is achievable, print Yes; if it is not, print No.\n\nSample Input 1\n\nFTFFTFFF\n4 2\n\nSample Output 1\n\nYes\n\nThe objective can be achieved by, for example, turning counterclockwise in the first T and turning clockwise in the second T.\n\nSample Input 2\n\nFTFFTFFF\n-2 -2\n\nSample Output 2\n\nYes\n\nThe objective can be achieved by, for example, turning clockwise in the first T and turning clockwise in the second T.\n\nSample Input 3\n\nFF\n1 0\n\nSample Output 3\n\nNo\n\nSample Input 4\n\nTF\n1 0\n\nSample Output 4\n\nNo\n\nSample Input 5\n\nFFTTFF\n0 0\n\nSample Output 5\n\nYes\n\nThe objective can be achieved by, for example, turning counterclockwise in the first T and turning counterclockwise in the second T.\n\nSample Input 6\n\nTTTT\n1 0\n\nSample Output 6\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1234, "cpu_time_ms": 1096, "memory_kb": 252708}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s063584843", "group_id": "codeNet:p03494", "input_text": "function main()\n\tn = parse(readline())\n\ta = parse.(split(readline()))\n\tmin = 999999999\n\tfor i in 1:n\n\t\tcheck = 0\n\t\tq = 2\n\t\twhile a[i]%q ==0\n\t\t\tcheck = check+1\n\t\t\tq = q*2\n\t\tend\n\t\tif check < min\n\t\t\tmin = check\n\t\tend\n\tend\n\tprint(min)\nend\n\n\nmain()", "language": "Julia", "metadata": {"date": 1540161057, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s063584843.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s063584843", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n\tn = parse(readline())\n\ta = parse.(split(readline()))\n\tmin = 999999999\n\tfor i in 1:n\n\t\tcheck = 0\n\t\tq = 2\n\t\twhile a[i]%q ==0\n\t\t\tcheck = check+1\n\t\t\tq = q*2\n\t\tend\n\t\tif check < min\n\t\t\tmin = check\n\t\tend\n\tend\n\tprint(min)\nend\n\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 243, "cpu_time_ms": 571, "memory_kb": 121600}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s247180606", "group_id": "codeNet:p03494", "input_text": "function main()\n N = readline()\n count = 0\n a = parse.(split(readline()))\n while all(iseven.(a))\n count += 1\n a= div.(a,2) \n end\n println(\"$count\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1522198850, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s247180606.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s247180606", "user_id": "u506664060"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n N = readline()\n count = 0\n a = parse.(split(readline()))\n while all(iseven.(a))\n count += 1\n a= div.(a,2) \n end\n println(\"$count\")\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 646, "memory_kb": 125836}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s196902525", "group_id": "codeNet:p03495", "input_text": "function main()\n \n (N,K) = map(x -> parse(Int,x), split(readline()))\n A = map(x -> parse(Int,x), split(readline()))\n \n dict = Dict()\n \n for i in A\n dict[i] = get(dict,i,0) + 1\n end\n \n vals = []\n for i in values(dict)\n push!(vals,i)\n end\n \n sort!(vals)\n \n cnt_keys = 0\n for i in keys(dict)\n cnt_keys += 1\n end\n \n ans = 0\n num = 1\n \n while cnt_keys > K\n ans += vals[num]\n cnt_keys -= 1\n num += 1\n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1586368789, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03495.html", "problem_id": "p03495", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03495/input.txt", "sample_output_relpath": "derived/input_output/data/p03495/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03495/Julia/s196902525.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s196902525", "user_id": "u790457721"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n \n (N,K) = map(x -> parse(Int,x), split(readline()))\n A = map(x -> parse(Int,x), split(readline()))\n \n dict = Dict()\n \n for i in A\n dict[i] = get(dict,i,0) + 1\n end\n \n vals = []\n for i in values(dict)\n push!(vals,i)\n end\n \n sort!(vals)\n \n cnt_keys = 0\n for i in keys(dict)\n cnt_keys += 1\n end\n \n ans = 0\n num = 1\n \n while cnt_keys > K\n ans += vals[num]\n cnt_keys -= 1\n num += 1\n end\n \n println(ans)\n \nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTakahashi has N balls. Initially, an integer A_i is written on the i-th ball.\n\nHe would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.\n\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 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 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nSample Input 1\n\n5 2\n1 1 2 2 5\n\nSample Output 1\n\n1\n\nFor example, if we rewrite the integer on the fifth ball to 2, there are two different integers written on the balls: 1 and 2.\nOn the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print 1.\n\nSample Input 2\n\n4 4\n1 1 2 2\n\nSample Output 2\n\n0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything.\n\nSample Input 3\n\n10 3\n5 1 3 2 4 1 1 2 3 4\n\nSample Output 3\n\n3", "sample_input": "5 2\n1 1 2 2 5\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03495", "source_text": "Score : 300 points\n\nProblem Statement\n\nTakahashi has N balls. Initially, an integer A_i is written on the i-th ball.\n\nHe would like to rewrite the integer on some balls so that there are at most K different integers written on the N balls.\n\nFind the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nConstraints\n\n1 \\leq K \\leq N \\leq 200000\n\n1 \\leq A_i \\leq 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 A_2 ... A_N\n\nOutput\n\nPrint the minimum number of balls that Takahashi needs to rewrite the integers on them.\n\nSample Input 1\n\n5 2\n1 1 2 2 5\n\nSample Output 1\n\n1\n\nFor example, if we rewrite the integer on the fifth ball to 2, there are two different integers written on the balls: 1 and 2.\nOn the other hand, it is not possible to rewrite the integers on zero balls so that there are at most two different integers written on the balls, so we should print 1.\n\nSample Input 2\n\n4 4\n1 1 2 2\n\nSample Output 2\n\n0\n\nAlready in the beginning, there are two different integers written on the balls, so we do not need to rewrite anything.\n\nSample Input 3\n\n10 3\n5 1 3 2 4 1 1 2 3 4\n\nSample Output 3\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 473, "cpu_time_ms": 1004, "memory_kb": 166068}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s228422707", "group_id": "codeNet:p03496", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\ts = maximum(a)\n\tis = indmax(a)\n\tt = minimum(a)\n\tit = indmin(a)\n\tprintln(2*n-2)\n\tif s>-t\n\t\tfor i in 1:n\n\t\t\tif i!=is\n\t\t\t\ta[i] += s\n\t\t\t\tprintln(is, \" \", i)\n\t\t\tend\n\t\tend\n\t\tfor i in 2:n\n\t\t\tprintln(i-1, \" \",i)\n\t\tend\n\telse\n\t\tfor i in 1:n\n\t\t\tif i!=it\n\t\t\t\ta[i] += t\n\t\t\t\tprintln(it, \" \",i)\n\t\t\tend\n\t\tend\n\t\tfor i in 1:n-1\n\t\t\tprintln(n-i+1, \" \", n-i)\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1566865561, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03496.html", "problem_id": "p03496", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03496/input.txt", "sample_output_relpath": "derived/input_output/data/p03496/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03496/Julia/s228422707.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s228422707", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n2 3\n3 3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\ts = maximum(a)\n\tis = indmax(a)\n\tt = minimum(a)\n\tit = indmin(a)\n\tprintln(2*n-2)\n\tif s>-t\n\t\tfor i in 1:n\n\t\t\tif i!=is\n\t\t\t\ta[i] += s\n\t\t\t\tprintln(is, \" \", i)\n\t\t\tend\n\t\tend\n\t\tfor i in 2:n\n\t\t\tprintln(i-1, \" \",i)\n\t\tend\n\telse\n\t\tfor i in 1:n\n\t\t\tif i!=it\n\t\t\t\ta[i] += t\n\t\t\t\tprintln(it, \" \",i)\n\t\t\tend\n\t\tend\n\t\tfor i in 1:n-1\n\t\t\tprintln(n-i+1, \" \", n-i)\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSnuke has an integer sequence, a, of length N. The i-th element of a (1-indexed) is a_{i}.\n\nHe can perform the following operation any number of times:\n\nOperation: Choose integers x and y between 1 and N (inclusive), and add a_x to a_y.\n\nHe would like to perform this operation between 0 and 2N times (inclusive) so that a satisfies the condition below. Show one such sequence of operations.\nIt can be proved that such a sequence of operations always exists under the constraints in this problem.\n\nCondition: a_1 \\leq a_2 \\leq ... \\leq a_{N}\n\nConstraints\n\n2 \\leq N \\leq 50\n\n-10^{6} \\leq a_i \\leq 10^{6}\n\nAll input values 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\nLet m be the number of operations in your solution. In the first line, print m.\nIn the i-th of the subsequent m lines, print the numbers x and y chosen in the i-th operation, with a space in between.\nThe output will be considered correct if m is between 0 and 2N (inclusive) and a satisfies the condition after the m operations.\n\nSample Input 1\n\n3\n-2 5 -1\n\nSample Output 1\n\n2\n2 3\n3 3\n\nAfter the first operation, a = (-2,5,4).\n\nAfter the second operation, a = (-2,5,8), and the condition is now satisfied.\n\nSample Input 2\n\n2\n-1 -3\n\nSample Output 2\n\n1\n2 1\n\nAfter the first operation, a = (-4,-3) and the condition is now satisfied.\n\nSample Input 3\n\n5\n0 0 0 0 0\n\nSample Output 3\n\n0\n\nThe condition is satisfied already in the beginning.", "sample_input": "3\n-2 5 -1\n"}, "reference_outputs": ["2\n2 3\n3 3\n"], "source_document_id": "p03496", "source_text": "Score : 600 points\n\nProblem Statement\n\nSnuke has an integer sequence, a, of length N. The i-th element of a (1-indexed) is a_{i}.\n\nHe can perform the following operation any number of times:\n\nOperation: Choose integers x and y between 1 and N (inclusive), and add a_x to a_y.\n\nHe would like to perform this operation between 0 and 2N times (inclusive) so that a satisfies the condition below. Show one such sequence of operations.\nIt can be proved that such a sequence of operations always exists under the constraints in this problem.\n\nCondition: a_1 \\leq a_2 \\leq ... \\leq a_{N}\n\nConstraints\n\n2 \\leq N \\leq 50\n\n-10^{6} \\leq a_i \\leq 10^{6}\n\nAll input values 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\nLet m be the number of operations in your solution. In the first line, print m.\nIn the i-th of the subsequent m lines, print the numbers x and y chosen in the i-th operation, with a space in between.\nThe output will be considered correct if m is between 0 and 2N (inclusive) and a satisfies the condition after the m operations.\n\nSample Input 1\n\n3\n-2 5 -1\n\nSample Output 1\n\n2\n2 3\n3 3\n\nAfter the first operation, a = (-2,5,4).\n\nAfter the second operation, a = (-2,5,8), and the condition is now satisfied.\n\nSample Input 2\n\n2\n-1 -3\n\nSample Output 2\n\n1\n2 1\n\nAfter the first operation, a = (-4,-3) and the condition is now satisfied.\n\nSample Input 3\n\n5\n0 0 0 0 0\n\nSample Output 3\n\n0\n\nThe condition is satisfied already in the beginning.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 809, "memory_kb": 168744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s484693493", "group_id": "codeNet:p03498", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tif minimum(a)>0\n\t\tprintln(n-1)\n\t\tfor i in 1:n-1\n\t\t\tprintln(i,\" \",i+1)\n\t\tend\n\telseif maximum(a)<0\n\t\tprintln(n-1)\n\t\tfor i in n:-1:2\n\t\t\tprintln(i,\" \",i-1)\n\t\tend\n\telse\n\t\tr = indmax(a)\n\t\tl = indmin(a)\n\t\tprintln(2*n-1)\n\t\tif a[r]>-a[l]\n\t\t\tfor i in 1:n\n\t\t\t\tprintln(r,\" \",i)\n\t\t\tend\n\t\t\tfor i in 1:n-1\n\t\t\t\tprintln(i,\" \",i+1)\n\t\t\tend\n\t\telse\n\t\t\tfor i in 1:n\n\t\t\t\tprintln(l,\" \",i)\n\t\t\tend\n\t\t\tfor i in n:-1:2\n\t\t\t\tprintln(i,\" \",i-1)\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584793356, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03498.html", "problem_id": "p03498", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03498/input.txt", "sample_output_relpath": "derived/input_output/data/p03498/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03498/Julia/s484693493.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s484693493", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n2 3\n3 3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tif minimum(a)>0\n\t\tprintln(n-1)\n\t\tfor i in 1:n-1\n\t\t\tprintln(i,\" \",i+1)\n\t\tend\n\telseif maximum(a)<0\n\t\tprintln(n-1)\n\t\tfor i in n:-1:2\n\t\t\tprintln(i,\" \",i-1)\n\t\tend\n\telse\n\t\tr = indmax(a)\n\t\tl = indmin(a)\n\t\tprintln(2*n-1)\n\t\tif a[r]>-a[l]\n\t\t\tfor i in 1:n\n\t\t\t\tprintln(r,\" \",i)\n\t\t\tend\n\t\t\tfor i in 1:n-1\n\t\t\t\tprintln(i,\" \",i+1)\n\t\t\tend\n\t\telse\n\t\t\tfor i in 1:n\n\t\t\t\tprintln(l,\" \",i)\n\t\t\tend\n\t\t\tfor i in n:-1:2\n\t\t\t\tprintln(i,\" \",i-1)\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nSnuke has an integer sequence, a, of length N. The i-th element of a (1-indexed) is a_{i}.\n\nHe can perform the following operation any number of times:\n\nOperation: Choose integers x and y between 1 and N (inclusive), and add a_x to a_y.\n\nHe would like to perform this operation between 0 and 2N times (inclusive) so that a satisfies the condition below. Show one such sequence of operations.\nIt can be proved that such a sequence of operations always exists under the constraints in this problem.\n\nCondition: a_1 \\leq a_2 \\leq ... \\leq a_{N}\n\nConstraints\n\n2 \\leq N \\leq 50\n\n-10^{6} \\leq a_i \\leq 10^{6}\n\nAll input values 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\nLet m be the number of operations in your solution. In the first line, print m.\nIn the i-th of the subsequent m lines, print the numbers x and y chosen in the i-th operation, with a space in between.\nThe output will be considered correct if m is between 0 and 2N (inclusive) and a satisfies the condition after the m operations.\n\nSample Input 1\n\n3\n-2 5 -1\n\nSample Output 1\n\n2\n2 3\n3 3\n\nAfter the first operation, a = (-2,5,4).\n\nAfter the second operation, a = (-2,5,8), and the condition is now satisfied.\n\nSample Input 2\n\n2\n-1 -3\n\nSample Output 2\n\n1\n2 1\n\nAfter the first operation, a = (-4,-3) and the condition is now satisfied.\n\nSample Input 3\n\n5\n0 0 0 0 0\n\nSample Output 3\n\n0\n\nThe condition is satisfied already in the beginning.", "sample_input": "3\n-2 5 -1\n"}, "reference_outputs": ["2\n2 3\n3 3\n"], "source_document_id": "p03498", "source_text": "Score : 600 points\n\nProblem Statement\n\nSnuke has an integer sequence, a, of length N. The i-th element of a (1-indexed) is a_{i}.\n\nHe can perform the following operation any number of times:\n\nOperation: Choose integers x and y between 1 and N (inclusive), and add a_x to a_y.\n\nHe would like to perform this operation between 0 and 2N times (inclusive) so that a satisfies the condition below. Show one such sequence of operations.\nIt can be proved that such a sequence of operations always exists under the constraints in this problem.\n\nCondition: a_1 \\leq a_2 \\leq ... \\leq a_{N}\n\nConstraints\n\n2 \\leq N \\leq 50\n\n-10^{6} \\leq a_i \\leq 10^{6}\n\nAll input values 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\nLet m be the number of operations in your solution. In the first line, print m.\nIn the i-th of the subsequent m lines, print the numbers x and y chosen in the i-th operation, with a space in between.\nThe output will be considered correct if m is between 0 and 2N (inclusive) and a satisfies the condition after the m operations.\n\nSample Input 1\n\n3\n-2 5 -1\n\nSample Output 1\n\n2\n2 3\n3 3\n\nAfter the first operation, a = (-2,5,4).\n\nAfter the second operation, a = (-2,5,8), and the condition is now satisfied.\n\nSample Input 2\n\n2\n-1 -3\n\nSample Output 2\n\n1\n2 1\n\nAfter the first operation, a = (-4,-3) and the condition is now satisfied.\n\nSample Input 3\n\n5\n0 0 0 0 0\n\nSample Output 3\n\n0\n\nThe condition is satisfied already in the beginning.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 418, "memory_kb": 114860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s354250600", "group_id": "codeNet:p03501", "input_text": "n,a,b = parse.(Int,split(readline()))\nprintln(a*n <= b ? a*n : b)", "language": "Julia", "metadata": {"date": 1601216653, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p03501.html", "problem_id": "p03501", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03501/input.txt", "sample_output_relpath": "derived/input_output/data/p03501/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03501/Julia/s354250600.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s354250600", "user_id": "u739563361"}, "prompt_components": {"gold_output": "119\n", "input_to_evaluate": "n,a,b = parse.(Int,split(readline()))\nprintln(a*n <= b ? a*n : b)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are parking at a parking lot. You can choose from the following two fee plans:\n\nPlan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours.\n\nPlan 2: The fee will be B yen, regardless of the duration.\n\nFind the minimum fee when you park for N hours.\n\nConstraints\n\n1≤N≤20\n\n1≤A≤100\n\n1≤B≤2000\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\nWhen the minimum fee is x yen, print the value of x.\n\nSample Input 1\n\n7 17 120\n\nSample Output 1\n\n119\n\nIf you choose Plan 1, the fee will be 7×17=119 yen.\n\nIf you choose Plan 2, the fee will be 120 yen.\n\nThus, the minimum fee is 119 yen.\n\nSample Input 2\n\n5 20 100\n\nSample Output 2\n\n100\n\nThe fee might be the same in the two plans.\n\nSample Input 3\n\n6 18 100\n\nSample Output 3\n\n100", "sample_input": "7 17 120\n"}, "reference_outputs": ["119\n"], "source_document_id": "p03501", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are parking at a parking lot. You can choose from the following two fee plans:\n\nPlan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours.\n\nPlan 2: The fee will be B yen, regardless of the duration.\n\nFind the minimum fee when you park for N hours.\n\nConstraints\n\n1≤N≤20\n\n1≤A≤100\n\n1≤B≤2000\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\nWhen the minimum fee is x yen, print the value of x.\n\nSample Input 1\n\n7 17 120\n\nSample Output 1\n\n119\n\nIf you choose Plan 1, the fee will be 7×17=119 yen.\n\nIf you choose Plan 2, the fee will be 120 yen.\n\nThus, the minimum fee is 119 yen.\n\nSample Input 2\n\n5 20 100\n\nSample Output 2\n\n100\n\nThe fee might be the same in the two plans.\n\nSample Input 3\n\n6 18 100\n\nSample Output 3\n\n100", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 65, "cpu_time_ms": 276, "memory_kb": 171860}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s586151328", "group_id": "codeNet:p03501", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,a,b=parseMap(split(readline()))\n println(min(a*n,b))\nend\nmain()", "language": "Julia", "metadata": {"date": 1584160515, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03501.html", "problem_id": "p03501", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03501/input.txt", "sample_output_relpath": "derived/input_output/data/p03501/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03501/Julia/s586151328.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s586151328", "user_id": "u619197965"}, "prompt_components": {"gold_output": "119\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,a,b=parseMap(split(readline()))\n println(min(a*n,b))\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are parking at a parking lot. You can choose from the following two fee plans:\n\nPlan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours.\n\nPlan 2: The fee will be B yen, regardless of the duration.\n\nFind the minimum fee when you park for N hours.\n\nConstraints\n\n1≤N≤20\n\n1≤A≤100\n\n1≤B≤2000\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\nWhen the minimum fee is x yen, print the value of x.\n\nSample Input 1\n\n7 17 120\n\nSample Output 1\n\n119\n\nIf you choose Plan 1, the fee will be 7×17=119 yen.\n\nIf you choose Plan 2, the fee will be 120 yen.\n\nThus, the minimum fee is 119 yen.\n\nSample Input 2\n\n5 20 100\n\nSample Output 2\n\n100\n\nThe fee might be the same in the two plans.\n\nSample Input 3\n\n6 18 100\n\nSample Output 3\n\n100", "sample_input": "7 17 120\n"}, "reference_outputs": ["119\n"], "source_document_id": "p03501", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are parking at a parking lot. You can choose from the following two fee plans:\n\nPlan 1: The fee will be A×T yen (the currency of Japan) when you park for T hours.\n\nPlan 2: The fee will be B yen, regardless of the duration.\n\nFind the minimum fee when you park for N hours.\n\nConstraints\n\n1≤N≤20\n\n1≤A≤100\n\n1≤B≤2000\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\nWhen the minimum fee is x yen, print the value of x.\n\nSample Input 1\n\n7 17 120\n\nSample Output 1\n\n119\n\nIf you choose Plan 1, the fee will be 7×17=119 yen.\n\nIf you choose Plan 2, the fee will be 120 yen.\n\nThus, the minimum fee is 119 yen.\n\nSample Input 2\n\n5 20 100\n\nSample Output 2\n\n100\n\nThe fee might be the same in the two plans.\n\nSample Input 3\n\n6 18 100\n\nSample Output 3\n\n100", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 383, "cpu_time_ms": 726, "memory_kb": 165456}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s426370807", "group_id": "codeNet:p03504", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,c = readline() |> split |> parseMap\n\ta = Array{Int}(3,n)\n\tfor i in 1:n\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\tb = Array{Int}(3,2*n)\n\tnow = 1\n\tfor i in 1:n\n\t\tb[1,now] = a[1,i]\n\t\tb[2,now] = a[3,i]\n\t\tb[3,now] = 0\n\t\tnow += 1\n\t\tb[1,now] = a[2,i]\n\t\tb[2,now] = a[3,i]\n\t\tb[3,now] = 1\n\t\tnow += 1\n\tend\n\tb = sortcols(b,by=x->(x[1],x[3]))\n\tcount = 0\n\tk = zeros(Int,c)\n\tfor i in 1:2*n\n\t\tif b[3,i] == 0\n\t\t\tk[b[2,i]] = 1\n\t\t\tcount = max(count,sum(k))\n\t\telse\n\t\t\tk[b[2,i]] = 0\n\t\tend\n\tend\n\tprintln(count)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1556154034, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s426370807.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s426370807", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,c = readline() |> split |> parseMap\n\ta = Array{Int}(3,n)\n\tfor i in 1:n\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\tb = Array{Int}(3,2*n)\n\tnow = 1\n\tfor i in 1:n\n\t\tb[1,now] = a[1,i]\n\t\tb[2,now] = a[3,i]\n\t\tb[3,now] = 0\n\t\tnow += 1\n\t\tb[1,now] = a[2,i]\n\t\tb[2,now] = a[3,i]\n\t\tb[3,now] = 1\n\t\tnow += 1\n\tend\n\tb = sortcols(b,by=x->(x[1],x[3]))\n\tcount = 0\n\tk = zeros(Int,c)\n\tfor i in 1:2*n\n\t\tif b[3,i] == 0\n\t\t\tk[b[2,i]] = 1\n\t\t\tcount = max(count,sum(k))\n\t\telse\n\t\t\tk[b[2,i]] = 0\n\t\tend\n\tend\n\tprintln(count)\nend\nmain()\n", "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 split |> parseMap\n\ta = Array{Int}(3,n)\n\tfor i in 1:n\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\tb = Array{Int}(3,2*n)\n\tnow = 1\n\tfor i in 1:n\n\t\tb[1,now] = a[1,i]\n\t\tb[2,now] = a[3,i]\n\t\tb[3,now] = 0\n\t\tnow += 1\n\t\tb[1,now] = a[2,i]\n\t\tb[2,now] = a[3,i]\n\t\tb[3,now] = 1\n\t\tnow += 1\n\tend\n\tb = sortcols(b,by=x->(x[1],x[3]))\n\tcount = 0\n\tk = zeros(Int,c)\n\tfor i in 1:n\n\t\tif b[3,i] == 0\n\t\t\tk[b[2,i]] = 1\n\t\t\tcount = max(count,sum(k))\n\t\telse\n\t\t\tk[b[2,i]] = 0\n\t\tend\n\tend\n\tprintln(count)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1556153581, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s558860520.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s558860520", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,c = readline() |> split |> parseMap\n\ta = Array{Int}(3,n)\n\tfor i in 1:n\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\tb = Array{Int}(3,2*n)\n\tnow = 1\n\tfor i in 1:n\n\t\tb[1,now] = a[1,i]\n\t\tb[2,now] = a[3,i]\n\t\tb[3,now] = 0\n\t\tnow += 1\n\t\tb[1,now] = a[2,i]\n\t\tb[2,now] = a[3,i]\n\t\tb[3,now] = 1\n\t\tnow += 1\n\tend\n\tb = sortcols(b,by=x->(x[1],x[3]))\n\tcount = 0\n\tk = zeros(Int,c)\n\tfor i in 1:n\n\t\tif b[3,i] == 0\n\t\t\tk[b[2,i]] = 1\n\t\t\tcount = max(count,sum(k))\n\t\telse\n\t\t\tk[b[2,i]] = 0\n\t\tend\n\tend\n\tprintln(count)\nend\nmain()\n", "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 chomp\n\tc = 1\n\tac = 0\n\tf = 0\n\tt = ['K','H','B','R', '-']\n\tfor i in min(9,length(s))\n\t\tif s[i] == t[c]\n\t\t\tc += 1\n\t\t\tac = 0\n\t\telseif ac == 0 && s[i] == 'A'\n\t\t\tac += 1\n\t\telse\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tprintln(flg == 0?\"YES\":\"NO\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1562974200, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03523.html", "problem_id": "p03523", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03523/input.txt", "sample_output_relpath": "derived/input_output/data/p03523/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03523/Julia/s250262787.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s250262787", "user_id": "u095714878"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ts = readline() |> chomp\n\tc = 1\n\tac = 0\n\tf = 0\n\tt = ['K','H','B','R', '-']\n\tfor i in min(9,length(s))\n\t\tif s[i] == t[c]\n\t\t\tc += 1\n\t\t\tac = 0\n\t\telseif ac == 0 && s[i] == 'A'\n\t\t\tac += 1\n\t\telse\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tprintln(flg == 0?\"YES\":\"NO\")\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S.\n\nTakahashi can insert the character A at any position in this string any number of times.\n\nCan he change S into AKIHABARA?\n\nConstraints\n\n1 \\leq |S| \\leq 50\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 it is possible to change S into AKIHABARA, print YES; otherwise, print NO.\n\nSample Input 1\n\nKIHBR\n\nSample Output 1\n\nYES\n\nInsert one A at each of the four positions: the beginning, immediately after H, immediately after B and the end.\n\nSample Input 2\n\nAKIBAHARA\n\nSample Output 2\n\nNO\n\nThe correct spell is AKIHABARA.\n\nSample Input 3\n\nAAKIAHBAARA\n\nSample Output 3\n\nNO", "sample_input": "KIHBR\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03523", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given a string S.\n\nTakahashi can insert the character A at any position in this string any number of times.\n\nCan he change S into AKIHABARA?\n\nConstraints\n\n1 \\leq |S| \\leq 50\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 it is possible to change S into AKIHABARA, print YES; otherwise, print NO.\n\nSample Input 1\n\nKIHBR\n\nSample Output 1\n\nYES\n\nInsert one A at each of the four positions: the beginning, immediately after H, immediately after B and the end.\n\nSample Input 2\n\nAKIBAHARA\n\nSample Output 2\n\nNO\n\nThe correct spell is AKIHABARA.\n\nSample Input 3\n\nAAKIAHBAARA\n\nSample Output 3\n\nNO", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 360, "cpu_time_ms": 1509, "memory_kb": 198584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s734903950", "group_id": "codeNet:p03525", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction moveup(x::Array{Int,1},n)\n\tk = length(x)\n\tfor i in 1:k-1\n\t\tif x[k-i+1] > n-1\n\t\t\tx[k-i] += div(x[k-i+1],n)\n\t\t\tx[k-i+1] = x[k-i+1]%n\n\t\tend\n\tend\n\tif x[1] > n-1\n\t\t0\n\telse\n\t\tx\n\tend\nend\n\nfunction main()\n\tn = readline() |> parseInt\n\td = readline() |> split |> parseMap\n\tz = zeros(Int,13)\n\tfor i in 1:n\n\t\tz[d[i]+1]+=1\n\tend\n\tf = z[1]\n\tfor i in 2:13\n\t\tif z[i]>2\n\t\t\tf = 1\n\t\tend\n\tend\n\tif f>0\n\t\tprintln(0)\n\telse\n\t\ta = Int[]\n\t\tbase = zeros(Int,24)\n\t\tbase[1] = 1\n\t\tfor i in 1:12\n\t\t\tif z[i+1]==1\n\t\t\t\tpush!(a,i)\n\t\t\telseif z[i+1]>1\n\t\t\t\tbase[i+1]+=1\n\t\t\t\tbase[25-i]+=1\n\t\t\tend\n\t\tend\n\t\tl = length(a)\n\t\tz = zeros(Int,l)\n\t\tq = 0\n\t\twhile z!=0\n\t\t\tc = copy(base)\n\t\t\tfor i in 1:l\n\t\t\t\tif z[i]==0\n\t\t\t\t\tc[a[i]+1]+=1\n\t\t\t\telse\n\t\t\t\t\tc[25-a[i]]+=1\n\t\t\t\tend\n\t\t\tend\n\t\t\tdis = 24\n\t\t\tnd = 1\n\t\t\tfor i in 2:24\n\t\t\t\tif c[i]>1\n\t\t\t\t\tdis = 0\n\t\t\t\telseif c[i]==1\n\t\t\t\t\tdis = min(dis,nd)\n\t\t\t\t\tnd = 1\n\t\t\t\telse\n\t\t\t\t\tnd += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif c[1]>1\n\t\t\t\tdis = 0\n\t\t\telseif c[1]==1\n\t\t\t\tdis = min(dis,nd)\n\t\t\t\tnd = 1\n\t\t\tend\n\t\t\tq = max(q,dis)\n\t\t\tif isempty(z)\n\t\t\t\tz=0\n\t\t\telse\n\t\t\t\tz[l]+=1\n\t\t\t\tz=moveup(z,2)\n\t\t\tend\n\t\tend\n\t\tprintln(q)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584884179, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03525.html", "problem_id": "p03525", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03525/input.txt", "sample_output_relpath": "derived/input_output/data/p03525/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03525/Julia/s734903950.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s734903950", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction moveup(x::Array{Int,1},n)\n\tk = length(x)\n\tfor i in 1:k-1\n\t\tif x[k-i+1] > n-1\n\t\t\tx[k-i] += div(x[k-i+1],n)\n\t\t\tx[k-i+1] = x[k-i+1]%n\n\t\tend\n\tend\n\tif x[1] > n-1\n\t\t0\n\telse\n\t\tx\n\tend\nend\n\nfunction main()\n\tn = readline() |> parseInt\n\td = readline() |> split |> parseMap\n\tz = zeros(Int,13)\n\tfor i in 1:n\n\t\tz[d[i]+1]+=1\n\tend\n\tf = z[1]\n\tfor i in 2:13\n\t\tif z[i]>2\n\t\t\tf = 1\n\t\tend\n\tend\n\tif f>0\n\t\tprintln(0)\n\telse\n\t\ta = Int[]\n\t\tbase = zeros(Int,24)\n\t\tbase[1] = 1\n\t\tfor i in 1:12\n\t\t\tif z[i+1]==1\n\t\t\t\tpush!(a,i)\n\t\t\telseif z[i+1]>1\n\t\t\t\tbase[i+1]+=1\n\t\t\t\tbase[25-i]+=1\n\t\t\tend\n\t\tend\n\t\tl = length(a)\n\t\tz = zeros(Int,l)\n\t\tq = 0\n\t\twhile z!=0\n\t\t\tc = copy(base)\n\t\t\tfor i in 1:l\n\t\t\t\tif z[i]==0\n\t\t\t\t\tc[a[i]+1]+=1\n\t\t\t\telse\n\t\t\t\t\tc[25-a[i]]+=1\n\t\t\t\tend\n\t\t\tend\n\t\t\tdis = 24\n\t\t\tnd = 1\n\t\t\tfor i in 2:24\n\t\t\t\tif c[i]>1\n\t\t\t\t\tdis = 0\n\t\t\t\telseif c[i]==1\n\t\t\t\t\tdis = min(dis,nd)\n\t\t\t\t\tnd = 1\n\t\t\t\telse\n\t\t\t\t\tnd += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif c[1]>1\n\t\t\t\tdis = 0\n\t\t\telseif c[1]==1\n\t\t\t\tdis = min(dis,nd)\n\t\t\t\tnd = 1\n\t\t\tend\n\t\t\tq = max(q,dis)\n\t\t\tif isempty(z)\n\t\t\t\tz=0\n\t\t\telse\n\t\t\t\tz[l]+=1\n\t\t\t\tz=moveup(z,2)\n\t\t\tend\n\t\tend\n\t\tprintln(q)\n\tend\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nIn CODE FESTIVAL XXXX, there are N+1 participants from all over the world, including Takahashi.\n\nTakahashi checked and found that the time gap (defined below) between the local times in his city and the i-th person's city was D_i hours.\nThe time gap between two cities is defined as follows. For two cities A and B, if the local time in city B is d o'clock at the moment when the local time in city A is 0 o'clock, then the time gap between these two cities is defined to be min(d,24-d) hours.\nHere, we are using 24-hour notation.\nThat is, the local time in the i-th person's city is either d o'clock or 24-d o'clock at the moment when the local time in Takahashi's city is 0 o'clock, for example.\n\nThen, for each pair of two people chosen from the N+1 people, he wrote out the time gap between their cities. Let the smallest time gap among them be s hours.\n\nFind the maximum possible value of s.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n0 \\leq D_i \\leq 12\n\nAll input values 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 maximum possible value of s.\n\nSample Input 1\n\n3\n7 12 8\n\nSample Output 1\n\n4\n\nFor example, consider the situation where it is 7, 12 and 16 o'clock in each person's city at the moment when it is 0 o'clock in Takahashi's city. In this case, the time gap between the second and third persons' cities is 4 hours.\n\nSample Input 2\n\n2\n11 11\n\nSample Output 2\n\n2\n\nSample Input 3\n\n1\n0\n\nSample Output 3\n\n0\n\nNote that Takahashi himself is also a participant.", "sample_input": "3\n7 12 8\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03525", "source_text": "Score : 500 points\n\nProblem Statement\n\nIn CODE FESTIVAL XXXX, there are N+1 participants from all over the world, including Takahashi.\n\nTakahashi checked and found that the time gap (defined below) between the local times in his city and the i-th person's city was D_i hours.\nThe time gap between two cities is defined as follows. For two cities A and B, if the local time in city B is d o'clock at the moment when the local time in city A is 0 o'clock, then the time gap between these two cities is defined to be min(d,24-d) hours.\nHere, we are using 24-hour notation.\nThat is, the local time in the i-th person's city is either d o'clock or 24-d o'clock at the moment when the local time in Takahashi's city is 0 o'clock, for example.\n\nThen, for each pair of two people chosen from the N+1 people, he wrote out the time gap between their cities. Let the smallest time gap among them be s hours.\n\nFind the maximum possible value of s.\n\nConstraints\n\n1 \\leq N \\leq 50\n\n0 \\leq D_i \\leq 12\n\nAll input values 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 maximum possible value of s.\n\nSample Input 1\n\n3\n7 12 8\n\nSample Output 1\n\n4\n\nFor example, consider the situation where it is 7, 12 and 16 o'clock in each person's city at the moment when it is 0 o'clock in Takahashi's city. In this case, the time gap between the second and third persons' cities is 4 hours.\n\nSample Input 2\n\n2\n11 11\n\nSample Output 2\n\n2\n\nSample Input 3\n\n1\n0\n\nSample Output 3\n\n0\n\nNote that Takahashi himself is also a participant.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1188, "cpu_time_ms": 444, "memory_kb": 116780}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s287006180", "group_id": "codeNet:p03543", "input_text": "n = string(readline())\na=0\nfor i=1:9\n occursin(\"$i$i$i\",n) ? a=1 : a = 0\nend\nif a == 0\n println(\"No\")\nelse println(\"Yes\")\nend", "language": "Julia", "metadata": {"date": 1601218041, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p03543.html", "problem_id": "p03543", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03543/input.txt", "sample_output_relpath": "derived/input_output/data/p03543/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03543/Julia/s287006180.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s287006180", "user_id": "u739563361"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n = string(readline())\na=0\nfor i=1:9\n occursin(\"$i$i$i\",n) ? a=1 : a = 0\nend\nif a == 0\n println(\"No\")\nelse println(\"Yes\")\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n1000 ≤ N ≤ 9999\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 good, print Yes; otherwise, print No.\n\nSample Input 1\n\n1118\n\nSample Output 1\n\nYes\n\nN is good, since it contains three consecutive 1.\n\nSample Input 2\n\n7777\n\nSample Output 2\n\nYes\n\nAn integer is also good when all the digits are the same.\n\nSample Input 3\n\n1234\n\nSample Output 3\n\nNo", "sample_input": "1118\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03543", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n1000 ≤ N ≤ 9999\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 good, print Yes; otherwise, print No.\n\nSample Input 1\n\n1118\n\nSample Output 1\n\nYes\n\nN is good, since it contains three consecutive 1.\n\nSample Input 2\n\n7777\n\nSample Output 2\n\nYes\n\nAn integer is also good when all the digits are the same.\n\nSample Input 3\n\n1234\n\nSample Output 3\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 220, "memory_kb": 159692}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s390520254", "group_id": "codeNet:p03543", "input_text": "function main()\n x = parse.(split(readline(), \"\"))\n if x[1]==x[2]==x[3] || x[2]==x[3]==x[4]\n print(\"Yes\")\n else\n print(\"No\")\n end\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1540726350, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03543.html", "problem_id": "p03543", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03543/input.txt", "sample_output_relpath": "derived/input_output/data/p03543/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03543/Julia/s390520254.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s390520254", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n x = parse.(split(readline(), \"\"))\n if x[1]==x[2]==x[3] || x[2]==x[3]==x[4]\n print(\"Yes\")\n else\n print(\"No\")\n end\nend\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n1000 ≤ N ≤ 9999\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 good, print Yes; otherwise, print No.\n\nSample Input 1\n\n1118\n\nSample Output 1\n\nYes\n\nN is good, since it contains three consecutive 1.\n\nSample Input 2\n\n7777\n\nSample Output 2\n\nYes\n\nAn integer is also good when all the digits are the same.\n\nSample Input 3\n\n1234\n\nSample Output 3\n\nNo", "sample_input": "1118\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03543", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe call a 4-digit integer with three or more consecutive same digits, such as 1118, good.\n\nYou are given a 4-digit integer N. Answer the question: Is N good?\n\nConstraints\n\n1000 ≤ N ≤ 9999\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 good, print Yes; otherwise, print No.\n\nSample Input 1\n\n1118\n\nSample Output 1\n\nYes\n\nN is good, since it contains three consecutive 1.\n\nSample Input 2\n\n7777\n\nSample Output 2\n\nYes\n\nAn integer is also good when all the digits are the same.\n\nSample Input 3\n\n1234\n\nSample Output 3\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1110, "memory_kb": 176028}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s698495804", "group_id": "codeNet:p03545", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a=readline()\n res=[[] for i in 1:4]\n push!(res[1],a[1])\n for i in 2:4\n for j in res[i-1]\n push!(res[i],join([j,'+',a[i]]))\n push!(res[i],join([j,'-',a[i]]))\n end\n end\n for i in res[4]\n num=parseInt(i[1])\n for j in 1:3\n if i[2*j]=='+'\n num+=parseInt(i[2*j+1])\n else\n num-=parseInt(i[2*j+1])\n end\n end\n if num==7\n println(i*\"=7\")\n break\n end\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1584311297, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03545.html", "problem_id": "p03545", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03545/input.txt", "sample_output_relpath": "derived/input_output/data/p03545/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03545/Julia/s698495804.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s698495804", "user_id": "u619197965"}, "prompt_components": {"gold_output": "1+2+2+2=7\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a=readline()\n res=[[] for i in 1:4]\n push!(res[1],a[1])\n for i in 2:4\n for j in res[i-1]\n push!(res[i],join([j,'+',a[i]]))\n push!(res[i],join([j,'-',a[i]]))\n end\n end\n for i in res[4]\n num=parseInt(i[1])\n for j in 1:3\n if i[2*j]=='+'\n num+=parseInt(i[2*j+1])\n else\n num-=parseInt(i[2*j+1])\n end\n end\n if num==7\n println(i*\"=7\")\n break\n end\n end\nend\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSitting in a station waiting room, Joisino is gazing at her train ticket.\n\nThe ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).\n\nIn the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with + or - so that the formula holds.\n\nThe given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.\n\nConstraints\n\n0≤A,B,C,D≤9\n\nAll input values are integers.\n\nIt is guaranteed that there is a solution.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nABCD\n\nOutput\n\nPrint the formula you made, including the part =7.\n\nUse the signs + and -.\n\nDo not print a space between a digit and a sign.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n1+2+2+2=7\n\nThis is the only valid solution.\n\nSample Input 2\n\n0290\n\nSample Output 2\n\n0-2+9+0=7\n\n0 - 2 + 9 - 0 = 7 is also a valid solution.\n\nSample Input 3\n\n3242\n\nSample Output 3\n\n3+2+4-2=7", "sample_input": "1222\n"}, "reference_outputs": ["1+2+2+2=7\n"], "source_document_id": "p03545", "source_text": "Score : 300 points\n\nProblem Statement\n\nSitting in a station waiting room, Joisino is gazing at her train ticket.\n\nThe ticket is numbered with four digits A, B, C and D in this order, each between 0 and 9 (inclusive).\n\nIn the formula A op1 B op2 C op3 D = 7, replace each of the symbols op1, op2 and op3 with + or - so that the formula holds.\n\nThe given input guarantees that there is a solution. If there are multiple solutions, any of them will be accepted.\n\nConstraints\n\n0≤A,B,C,D≤9\n\nAll input values are integers.\n\nIt is guaranteed that there is a solution.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nABCD\n\nOutput\n\nPrint the formula you made, including the part =7.\n\nUse the signs + and -.\n\nDo not print a space between a digit and a sign.\n\nSample Input 1\n\n1222\n\nSample Output 1\n\n1+2+2+2=7\n\nThis is the only valid solution.\n\nSample Input 2\n\n0290\n\nSample Output 2\n\n0-2+9+0=7\n\n0 - 2 + 9 - 0 = 7 is also a valid solution.\n\nSample Input 3\n\n3242\n\nSample Output 3\n\n3+2+4-2=7", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 937, "cpu_time_ms": 1284, "memory_kb": 199824}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s226776044", "group_id": "codeNet:p03546", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction func(x)\n\ts = 0\n\twhile x > 0\n\t\ts += x%10\n\t\tx = div(x,10)\n\tend\n\ts\nend\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\tc = Array{Int}(10,10)\n\tfor i in 1:10\n\t\tc[:,i] = readline() |> split |> parseMap\n\tend\n\ta = Array{Int}(w,h)\n\tfor i in 1:h\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\t\n\tfor i in 1:10\n\t\tfor j in 1:10\n\t\t\tfor k in 1:10\n\t\t\t\tc[i,j] = min(c[i,j],c[i,k]+c[k,j])\n\t\t\tend\n\t\tend\n\tend\n\ttotal = 0\n\tfor i in 1:w\n\t\tfor j in 1:h\n\t\t\tif a[i,j] != -1\n\t\t\t\ttotal += c[2,a[i,j]+1]\n\t\t\tend\n\t\tend\n\tend\n\tprintln(total)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1547541472, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03546.html", "problem_id": "p03546", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03546/input.txt", "sample_output_relpath": "derived/input_output/data/p03546/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03546/Julia/s226776044.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s226776044", "user_id": "u095714878"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction func(x)\n\ts = 0\n\twhile x > 0\n\t\ts += x%10\n\t\tx = div(x,10)\n\tend\n\ts\nend\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\tc = Array{Int}(10,10)\n\tfor i in 1:10\n\t\tc[:,i] = readline() |> split |> parseMap\n\tend\n\ta = Array{Int}(w,h)\n\tfor i in 1:h\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\t\n\tfor i in 1:10\n\t\tfor j in 1:10\n\t\t\tfor k in 1:10\n\t\t\t\tc[i,j] = min(c[i,j],c[i,k]+c[k,j])\n\t\t\tend\n\t\tend\n\tend\n\ttotal = 0\n\tfor i in 1:w\n\t\tfor j in 1:h\n\t\t\tif a[i,j] != -1\n\t\t\t\ttotal += c[2,a[i,j]+1]\n\t\t\tend\n\t\tend\n\tend\n\tprintln(total)\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nJoisino the magical girl has decided to turn every single digit that exists on this world into 1.\n\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\n\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).\n\nYou are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:\n\nIf A_{i,j}≠-1, the square contains a digit A_{i,j}.\n\nIf A_{i,j}=-1, the square does not contain a digit.\n\nFind the minimum total amount of MP required to turn every digit on this wall into 1 in the end.\n\nConstraints\n\n1≤H,W≤200\n\n1≤c_{i,j}≤10^3 (i≠j)\n\nc_{i,j}=0 (i=j)\n\n-1≤A_{i,j}≤9\n\nAll input values are integers.\n\nThere is at least one digit on the wall.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nc_{0,0} ... c_{0,9}\n:\nc_{9,0} ... c_{9,9}\nA_{1,1} ... A_{1,W}\n:\nA_{H,1} ... A_{H,W}\n\nOutput\n\nPrint the minimum total amount of MP required to turn every digit on the wall into 1 in the end.\n\nSample Input 1\n\n2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n\nSample Output 1\n\n12\n\nTo turn a single 8 into 1, it is optimal to first turn 8 into 4, then turn 4 into 9, and finally turn 9 into 1, costing 6 MP.\n\nThe wall contains two 8s, so the minimum total MP required is 6×2=12.\n\nSample Input 2\n\n5 5\n0 999 999 999 999 999 999 999 999 999\n999 0 999 999 999 999 999 999 999 999\n999 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 999 999 999 999 999\n999 999 999 999 0 999 999 999 999 999\n999 999 999 999 999 0 999 999 999 999\n999 999 999 999 999 999 0 999 999 999\n999 999 999 999 999 999 999 0 999 999\n999 999 999 999 999 999 999 999 0 999\n999 999 999 999 999 999 999 999 999 0\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n\nSample Output 2\n\n0\n\nNote that she may not need to change any digit.\n\nSample Input 3\n\n3 5\n0 4 3 6 2 7 2 5 3 3\n4 0 5 3 7 5 3 7 2 7\n5 7 0 7 2 9 3 2 9 1\n3 6 2 0 2 4 6 4 2 3\n3 5 7 4 0 6 9 7 6 7\n9 8 5 2 2 0 4 7 6 5\n5 4 6 3 2 3 0 5 4 3\n3 6 2 3 4 2 4 0 8 9\n4 6 5 4 3 5 3 2 0 8\n2 1 3 4 5 7 8 6 4 0\n3 5 2 6 1\n2 5 3 2 1\n6 9 2 5 6\n\nSample Output 3\n\n47", "sample_input": "2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n"}, "reference_outputs": ["12\n"], "source_document_id": "p03546", "source_text": "Score : 400 points\n\nProblem Statement\n\nJoisino the magical girl has decided to turn every single digit that exists on this world into 1.\n\nRewriting a digit i with j (0≤i,j≤9) costs c_{i,j} MP (Magic Points).\n\nShe is now standing before a wall. The wall is divided into HW squares in H rows and W columns, and at least one square contains a digit between 0 and 9 (inclusive).\n\nYou are given A_{i,j} that describes the square at the i-th row from the top and j-th column from the left, as follows:\n\nIf A_{i,j}≠-1, the square contains a digit A_{i,j}.\n\nIf A_{i,j}=-1, the square does not contain a digit.\n\nFind the minimum total amount of MP required to turn every digit on this wall into 1 in the end.\n\nConstraints\n\n1≤H,W≤200\n\n1≤c_{i,j}≤10^3 (i≠j)\n\nc_{i,j}=0 (i=j)\n\n-1≤A_{i,j}≤9\n\nAll input values are integers.\n\nThere is at least one digit on the wall.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nH W\nc_{0,0} ... c_{0,9}\n:\nc_{9,0} ... c_{9,9}\nA_{1,1} ... A_{1,W}\n:\nA_{H,1} ... A_{H,W}\n\nOutput\n\nPrint the minimum total amount of MP required to turn every digit on the wall into 1 in the end.\n\nSample Input 1\n\n2 4\n0 9 9 9 9 9 9 9 9 9\n9 0 9 9 9 9 9 9 9 9\n9 9 0 9 9 9 9 9 9 9\n9 9 9 0 9 9 9 9 9 9\n9 9 9 9 0 9 9 9 9 2\n9 9 9 9 9 0 9 9 9 9\n9 9 9 9 9 9 0 9 9 9\n9 9 9 9 9 9 9 0 9 9\n9 9 9 9 2 9 9 9 0 9\n9 2 9 9 9 9 9 9 9 0\n-1 -1 -1 -1\n8 1 1 8\n\nSample Output 1\n\n12\n\nTo turn a single 8 into 1, it is optimal to first turn 8 into 4, then turn 4 into 9, and finally turn 9 into 1, costing 6 MP.\n\nThe wall contains two 8s, so the minimum total MP required is 6×2=12.\n\nSample Input 2\n\n5 5\n0 999 999 999 999 999 999 999 999 999\n999 0 999 999 999 999 999 999 999 999\n999 999 0 999 999 999 999 999 999 999\n999 999 999 0 999 999 999 999 999 999\n999 999 999 999 0 999 999 999 999 999\n999 999 999 999 999 0 999 999 999 999\n999 999 999 999 999 999 0 999 999 999\n999 999 999 999 999 999 999 0 999 999\n999 999 999 999 999 999 999 999 0 999\n999 999 999 999 999 999 999 999 999 0\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n1 1 1 1 1\n\nSample Output 2\n\n0\n\nNote that she may not need to change any digit.\n\nSample Input 3\n\n3 5\n0 4 3 6 2 7 2 5 3 3\n4 0 5 3 7 5 3 7 2 7\n5 7 0 7 2 9 3 2 9 1\n3 6 2 0 2 4 6 4 2 3\n3 5 7 4 0 6 9 7 6 7\n9 8 5 2 2 0 4 7 6 5\n5 4 6 3 2 3 0 5 4 3\n3 6 2 3 4 2 4 0 8 9\n4 6 5 4 3 5 3 2 0 8\n2 1 3 4 5 7 8 6 4 0\n3 5 2 6 1\n2 5 3 2 1\n6 9 2 5 6\n\nSample Output 3\n\n47", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 451, "memory_kb": 117516}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s024897982", "group_id": "codeNet:p03547", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n x,y=split(readline())\n if x==y\n println(\"=\")\n elseif x\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1584320821, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s024897982.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s024897982", "user_id": "u619197965"}, "prompt_components": {"gold_output": "<\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n x,y=split(readline())\n if x==y\n println(\"=\")\n elseif x\")\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 547, "cpu_time_ms": 373, "memory_kb": 114568}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s952183383", "group_id": "codeNet:p03550", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,z,w = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tif n == 1\n\t\tprintln(abs(a[n]-w))\n\telse\n\t\tprintln(max(abs(a[n]-w),abs(a[n]-a[n-1])))\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1547342192, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03550.html", "problem_id": "p03550", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03550/input.txt", "sample_output_relpath": "derived/input_output/data/p03550/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03550/Julia/s952183383.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s952183383", "user_id": "u095714878"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,z,w = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tif n == 1\n\t\tprintln(abs(a[n]-w))\n\telse\n\t\tprintln(max(abs(a[n]-w),abs(a[n]-a[n-1])))\nend\n\nmain()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03550", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 560, "memory_kb": 128484}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s095452469", "group_id": "codeNet:p03552", "input_text": "N, Z, W = parse.(split(readline(STDIN)))\na = parse.(split(readline(STDIN)))\n\nans = max(abs(W - a[N]), N > 1 ? abs(a[N-1] - a[N]) : typemin(Int))\n\nprintln(ans)", "language": "Julia", "metadata": {"date": 1511410513, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Julia/s095452469.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s095452469", "user_id": "u639989198"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "N, Z, W = parse.(split(readline(STDIN)))\na = parse.(split(readline(STDIN)))\n\nans = max(abs(W - a[N]), N > 1 ? abs(a[N-1] - a[N]) : typemin(Int))\n\nprintln(ans)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 158, "cpu_time_ms": 1089, "memory_kb": 178740}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s341847664", "group_id": "codeNet:p03552", "input_text": "N, Z, W = parse.(split(readline(STDIN)))\na = parse.(split(readline(STDIN)))\nunshift!(a, W)\nN += 1\n\ndpx, dpy = fill(-1, N), fill(-1, N)\n\nfunction f(isx, pos)\n if isx\n if dpx[pos] < 0\n dpx[pos] = max(abs(a[pos] - a[N]), pos < N-1 ? maximum([f(false, p) for p in pos+1:N-1]) : typemin(Int64))\n end\n return dpx[pos]\n else\n if dpy[pos] < 0\n dpy[pos] = min(abs(a[pos] - a[N]), pos < N-1 ? minimum([f(true, p) for p in pos+1:N-1]) : typemax(Int64))\n end\n return dpy[pos]\n end\nend\n\nans = f(true, 1)\nprintln(ans)", "language": "Julia", "metadata": {"date": 1511407975, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03552.html", "problem_id": "p03552", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03552/input.txt", "sample_output_relpath": "derived/input_output/data/p03552/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03552/Julia/s341847664.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s341847664", "user_id": "u639989198"}, "prompt_components": {"gold_output": "900\n", "input_to_evaluate": "N, Z, W = parse.(split(readline(STDIN)))\na = parse.(split(readline(STDIN)))\nunshift!(a, W)\nN += 1\n\ndpx, dpy = fill(-1, N), fill(-1, N)\n\nfunction f(isx, pos)\n if isx\n if dpx[pos] < 0\n dpx[pos] = max(abs(a[pos] - a[N]), pos < N-1 ? maximum([f(false, p) for p in pos+1:N-1]) : typemin(Int64))\n end\n return dpx[pos]\n else\n if dpy[pos] < 0\n dpy[pos] = min(abs(a[pos] - a[N]), pos < N-1 ? minimum([f(true, p) for p in pos+1:N-1]) : typemax(Int64))\n end\n return dpy[pos]\n end\nend\n\nans = f(true, 1)\nprintln(ans)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "sample_input": "3 100 100\n10 1000 100\n"}, "reference_outputs": ["900\n"], "source_document_id": "p03552", "source_text": "Score : 500 points\n\nProblem Statement\n\nWe have a deck consisting of N cards. Each card has an integer written on it. The integer on the i-th card from the top is a_i.\n\nTwo people X and Y will play a game using this deck. Initially, X has a card with Z written on it in his hand, and Y has a card with W written on it in his hand. Then, starting from X, they will alternately perform the following action:\n\nDraw some number of cards from the top of the deck. Then, discard the card in his hand and keep the last drawn card instead. Here, at least one card must be drawn.\n\nThe game ends when there is no more card in the deck. The score of the game is the absolute difference of the integers written on the cards in the two players' hand.\n\nX will play the game so that the score will be maximized, and Y will play the game so that the score will be minimized. What will be the score of the game?\n\nConstraints\n\nAll input values are integers.\n\n1 \\leq N \\leq 2000\n\n1 \\leq Z, W, a_i \\leq 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN Z W\na_1 a_2 ... a_N\n\nOutput\n\nPrint the score.\n\nSample Input 1\n\n3 100 100\n10 1000 100\n\nSample Output 1\n\n900\n\nIf X draws two cards first, Y will draw the last card, and the score will be |1000 - 100| = 900.\n\nSample Input 2\n\n3 100 1000\n10 100 100\n\nSample Output 2\n\n900\n\nIf X draws all the cards first, the score will be |1000 - 100| = 900.\n\nSample Input 3\n\n5 1 1\n1 1 1 1 1\n\nSample Output 3\n\n0\n\nSample Input 4\n\n1 1 1\n1000000000\n\nSample Output 4\n\n999999999", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1427, "memory_kb": 184884}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s628063925", "group_id": "codeNet:p03556", "input_text": "n = parse(Int, readline())\nprint(floor(Int, sqrt(n))^2)", "language": "Julia", "metadata": {"date": 1541162148, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s628063925.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s628063925", "user_id": "u095714878"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "n = parse(Int, readline())\nprint(floor(Int, sqrt(n))^2)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 55, "cpu_time_ms": 273, "memory_kb": 109736}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s452093813", "group_id": "codeNet:p03557", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction maxp(a,x)\n\tcount = 0\n\tfor i in 1:length(a)\n\t\tif a[i] < x\n\t\t\tcount += 1\n\t\tend\n\tend\n\treturn(count)\nend\n\nfunction main()\n\tn = parseInt(readline())\n\ta = parseMap(split(readline()))\n\ta = sort(a)\n\tb = parseMap(split(readline()))\n\tb = sort(b)\n\tbb = Int[]\n\tc = parseMap(split(readline()))\n\tc = sort(c)\n\tcc = Int[]\n\tfor i in 1:n\n\t\tpush!(cc, maxp(b,c[i]))\n\tend\n\tfor i in 1:n\n\t\tpush!(bb, maxp(a,b[i]))\n\tend\n\tsum = 0\n\tfor i in 1:length(cc)\n\t\tfor j in 1:cc[i]\n\t\t\tsum += bb[j]\n\t\tend\n\tend\n\tprint(sum)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541427773, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03557.html", "problem_id": "p03557", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03557/input.txt", "sample_output_relpath": "derived/input_output/data/p03557/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03557/Julia/s452093813.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s452093813", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction maxp(a,x)\n\tcount = 0\n\tfor i in 1:length(a)\n\t\tif a[i] < x\n\t\t\tcount += 1\n\t\tend\n\tend\n\treturn(count)\nend\n\nfunction main()\n\tn = parseInt(readline())\n\ta = parseMap(split(readline()))\n\ta = sort(a)\n\tb = parseMap(split(readline()))\n\tb = sort(b)\n\tbb = Int[]\n\tc = parseMap(split(readline()))\n\tc = sort(c)\n\tcc = Int[]\n\tfor i in 1:n\n\t\tpush!(cc, maxp(b,c[i]))\n\tend\n\tfor i in 1:n\n\t\tpush!(bb, maxp(a,b[i]))\n\tend\n\tsum = 0\n\tfor i in 1:length(cc)\n\t\tfor j in 1:cc[i]\n\t\t\tsum += bb[j]\n\t\tend\n\tend\n\tprint(sum)\nend\n\nmain()", "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": "p03557", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 593, "cpu_time_ms": 2112, "memory_kb": 137724}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s441644741", "group_id": "codeNet:p03563", "input_text": "a=parse(Int,readline())\nb=parse(Int,readline())\nprint(b*2-a)", "language": "Julia", "metadata": {"date": 1543802073, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s441644741.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s441644741", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2032\n", "input_to_evaluate": "a=parse(Int,readline())\nb=parse(Int,readline())\nprint(b*2-a)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 60, "cpu_time_ms": 1483, "memory_kb": 117240}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s173203203", "group_id": "codeNet:p03567", "input_text": "function main()\n \n S = chomp(readline())\n \n check = false\n \n for i in 1:length(S)-1\n if S[i] == 'A' && S[i+1] == 'C'\n check = true\n break\n end\n end\n \n if check\n println(\"Yes\")\n else\n println(\"No\")\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1583629669, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03567.html", "problem_id": "p03567", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03567/input.txt", "sample_output_relpath": "derived/input_output/data/p03567/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03567/Julia/s173203203.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s173203203", "user_id": "u790457721"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n \n S = chomp(readline())\n \n check = false\n \n for i in 1:length(S)-1\n if S[i] == 'A' && S[i+1] == 'C'\n check = true\n break\n end\n end\n \n if check\n println(\"Yes\")\n else\n println(\"No\")\n end\n \nend\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke built an online judge to hold a programming contest.\n\nWhen a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring.\n(The judge can return any two-character substring of S.)\n\nDetermine whether the judge can return the string AC as the verdict to a program.\n\nConstraints\n\n2 \\leq |S| \\leq 5\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 the judge can return the string AC as a verdict to a program, print Yes; if it cannot, print No.\n\nSample Input 1\n\nBACD\n\nSample Output 1\n\nYes\n\nThe string AC appears in BACD as a contiguous substring (the second and third characters).\n\nSample Input 2\n\nABCD\n\nSample Output 2\n\nNo\n\nAlthough the string ABCD contains both A and C (the first and third characters), the string AC does not appear in ABCD as a contiguous substring.\n\nSample Input 3\n\nCABD\n\nSample Output 3\n\nNo\n\nSample Input 4\n\nACACA\n\nSample Output 4\n\nYes\n\nSample Input 5\n\nXX\n\nSample Output 5\n\nNo", "sample_input": "BACD\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03567", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke built an online judge to hold a programming contest.\n\nWhen a program is submitted to the judge, the judge returns a verdict, which is a two-character string that appears in the string S as a contiguous substring.\n(The judge can return any two-character substring of S.)\n\nDetermine whether the judge can return the string AC as the verdict to a program.\n\nConstraints\n\n2 \\leq |S| \\leq 5\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 the judge can return the string AC as a verdict to a program, print Yes; if it cannot, print No.\n\nSample Input 1\n\nBACD\n\nSample Output 1\n\nYes\n\nThe string AC appears in BACD as a contiguous substring (the second and third characters).\n\nSample Input 2\n\nABCD\n\nSample Output 2\n\nNo\n\nAlthough the string ABCD contains both A and C (the first and third characters), the string AC does not appear in ABCD as a contiguous substring.\n\nSample Input 3\n\nCABD\n\nSample Output 3\n\nNo\n\nSample Input 4\n\nACACA\n\nSample Output 4\n\nYes\n\nSample Input 5\n\nXX\n\nSample Output 5\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 293, "memory_kb": 108040}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s577963999", "group_id": "codeNet:p03568", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nsumdigits(n) = sum(digits(n))\n\nn=parseInt(readline())\narr=Set{String}()\nfunction dfs(cnt,s)\n if n==cnt\n push!(arr,s)\n return 0\n end\n for i in [\"0\",\"1\",\"2\"]\n dfs(cnt+1,s*i)\n end\nend\n\nfunction main()\n a=parseMap(split(readline()))\n dfs(0,\"\")\n ans=0\n for i in arr\n for j in 1:n\n if i[j]=='0' && a[j]%2==0\n ans+=1\n break\n elseif i[j]=='1' && (a[j]-1)%2==0\n ans+=1\n break\n elseif i[j]=='2' && (a[j]+1)%2==0\n ans+=1\n break\n end\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1585355757, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03568.html", "problem_id": "p03568", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03568/input.txt", "sample_output_relpath": "derived/input_output/data/p03568/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03568/Julia/s577963999.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s577963999", "user_id": "u619197965"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nsumdigits(n) = sum(digits(n))\n\nn=parseInt(readline())\narr=Set{String}()\nfunction dfs(cnt,s)\n if n==cnt\n push!(arr,s)\n return 0\n end\n for i in [\"0\",\"1\",\"2\"]\n dfs(cnt+1,s*i)\n end\nend\n\nfunction main()\n a=parseMap(split(readline()))\n dfs(0,\"\")\n ans=0\n for i in arr\n for j in 1:n\n if i[j]=='0' && a[j]%2==0\n ans+=1\n break\n elseif i[j]=='1' && (a[j]-1)%2==0\n ans+=1\n break\n elseif i[j]=='2' && (a[j]+1)%2==0\n ans+=1\n break\n end\n end\n end\n println(ans)\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are similar when |x_i - y_i| \\leq 1 holds for all i (1 \\leq i \\leq N).\n\nIn particular, any integer sequence is similar to itself.\n\nYou are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N.\n\nHow many integer sequences b_1, b_2, ..., b_N are there such that b_1, b_2, ..., b_N is similar to A and the product of all elements, b_1 b_2 ... b_N, is even?\n\nConstraints\n\n1 \\leq N \\leq 10\n\n1 \\leq A_i \\leq 100\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 integer sequences that satisfy the condition.\n\nSample Input 1\n\n2\n2 3\n\nSample Output 1\n\n7\n\nThere are seven integer sequences that satisfy the condition:\n\n1, 2\n\n1, 4\n\n2, 2\n\n2, 3\n\n2, 4\n\n3, 2\n\n3, 4\n\nSample Input 2\n\n3\n3 3 3\n\nSample Output 2\n\n26\n\nSample Input 3\n\n1\n100\n\nSample Output 3\n\n1\n\nSample Input 4\n\n10\n90 52 56 71 44 8 13 30 57 84\n\nSample Output 4\n\n58921", "sample_input": "2\n2 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03568", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe will say that two integer sequences of length N, x_1, x_2, ..., x_N and y_1, y_2, ..., y_N, are similar when |x_i - y_i| \\leq 1 holds for all i (1 \\leq i \\leq N).\n\nIn particular, any integer sequence is similar to itself.\n\nYou are given an integer N and an integer sequence of length N, A_1, A_2, ..., A_N.\n\nHow many integer sequences b_1, b_2, ..., b_N are there such that b_1, b_2, ..., b_N is similar to A and the product of all elements, b_1 b_2 ... b_N, is even?\n\nConstraints\n\n1 \\leq N \\leq 10\n\n1 \\leq A_i \\leq 100\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 integer sequences that satisfy the condition.\n\nSample Input 1\n\n2\n2 3\n\nSample Output 1\n\n7\n\nThere are seven integer sequences that satisfy the condition:\n\n1, 2\n\n1, 4\n\n2, 2\n\n2, 3\n\n2, 4\n\n3, 2\n\n3, 4\n\nSample Input 2\n\n3\n3 3 3\n\nSample Output 2\n\n26\n\nSample Input 3\n\n1\n100\n\nSample Output 3\n\n1\n\nSample Input 4\n\n10\n90 52 56 71 44 8 13 30 57 84\n\nSample Output 4\n\n58921", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 848, "cpu_time_ms": 503, "memory_kb": 142200}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s226016566", "group_id": "codeNet:p03573", "input_text": "function main()\n \n (A,B,C) = map(x -> parse(Int,x), split(readline()))\n \n if A == B\n println(C)\n elseif B == C\n println(A)\n else\n println(B)\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1578956506, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s226016566.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s226016566", "user_id": "u790457721"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "function main()\n \n (A,B,C) = map(x -> parse(Int,x), split(readline()))\n \n if A == B\n println(C)\n elseif B == C\n println(A)\n else\n println(B)\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 351, "memory_kb": 110220}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s288960600", "group_id": "codeNet:p03575", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction root(par::Vector{Int},x::Int)\n index=par[x]\n while par[index]!=index\n index=par[index]\n end\n return index\nend\n\nfunction unite(par::Vector{Int},x::Int,y::Int)\n rx,ry=root(par,x),root(par,y)\n if rx==ry\n return\n elseif rx>ry\n rx,ry=ry,rx\n end\n par[ry]=rx\nend\n\nfunction same(par::Vector{Int},x::Int,y::Int)\n return root(par,x)==root(par,y)\nend\n\nfunction main()\n n,m=parseMap(split(readline()))\n data=[parseMap(split(readline())) for i in 1:m]\n ans=0\n # 取り除く辺を全探索してUnion-Findを構築\n for ng in 1:m\n par=[i for i in 1:n]\n for i in 1:m\n if i==ng\n continue\n end\n unite(par,data[i][1],data[i][2])\n end\n renketsu=true\n r=root(par,1)\n for i in 2:n\n if root(par,i)!=r\n renketsu=false\n break\n end\n end\n if !renketsu\n ans+=1\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1587851492, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s288960600.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s288960600", "user_id": "u619197965"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction root(par::Vector{Int},x::Int)\n index=par[x]\n while par[index]!=index\n index=par[index]\n end\n return index\nend\n\nfunction unite(par::Vector{Int},x::Int,y::Int)\n rx,ry=root(par,x),root(par,y)\n if rx==ry\n return\n elseif rx>ry\n rx,ry=ry,rx\n end\n par[ry]=rx\nend\n\nfunction same(par::Vector{Int},x::Int,y::Int)\n return root(par,x)==root(par,y)\nend\n\nfunction main()\n n,m=parseMap(split(readline()))\n data=[parseMap(split(readline())) for i in 1:m]\n ans=0\n # 取り除く辺を全探索してUnion-Findを構築\n for ng in 1:m\n par=[i for i in 1:n]\n for i in 1:m\n if i==ng\n continue\n end\n unite(par,data[i][1],data[i][2])\n end\n renketsu=true\n r=root(par,1)\n for i in 2:n\n if root(par,i)!=r\n renketsu=false\n break\n end\n end\n if !renketsu\n ans+=1\n end\n end\n println(ans)\nend\nmain()", "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 split |> parseMap\n\ta = Array{Int}(2,n)\n\tfor i in 1:n\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\ta = sortcols(a,by=x->x[1])\n\tm = 9223372036854775807\n\tfor i in 1:n-k+1\n\t\tx = a[1,i+k-1]-a[1,i]\n\t\tuy = a[2,i]\n\t\tly = a[2,i]\n\t\tfor j in i+1:i+k-1\n\t\t\tuy = max(uy, a[2,j])\n\t\t\tly = min(ly, a[2,j])\n\t\tend\n\t\tm = min(m, x*(uy-ly))\n end\n\n\tprintln(m)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1550315988, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03576.html", "problem_id": "p03576", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03576/input.txt", "sample_output_relpath": "derived/input_output/data/p03576/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03576/Julia/s111014351.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s111014351", "user_id": "u095714878"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\ta = Array{Int}(2,n)\n\tfor i in 1:n\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\ta = sortcols(a,by=x->x[1])\n\tm = 9223372036854775807\n\tfor i in 1:n-k+1\n\t\tx = a[1,i+k-1]-a[1,i]\n\t\tuy = a[2,i]\n\t\tly = a[2,i]\n\t\tfor j in i+1:i+k-1\n\t\t\tuy = max(uy, a[2,j])\n\t\t\tly = min(ly, a[2,j])\n\t\tend\n\t\tm = min(m, x*(uy-ly))\n end\n\n\tprintln(m)\nend\n\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have N points in a two-dimensional plane.\n\nThe coordinates of the i-th point (1 \\leq i \\leq N) are (x_i,y_i).\n\nLet us consider a rectangle whose sides are parallel to the coordinate axes that contains K or more of the N points in its interior.\n\nHere, points on the sides of the rectangle are considered to be in the interior.\n\nFind the minimum possible area of such a rectangle.\n\nConstraints\n\n2 \\leq K \\leq N \\leq 50\n\n-10^9 \\leq x_i,y_i \\leq 10^9 (1 \\leq i \\leq N)\n\nx_i≠x_j (1 \\leq i0;s=uf[s];end;s;end\nsame(uf::Array{Int,1},x,y)=root(uf,x)==root(uf,y)?true:false;\nfunction unite(uf::Array{Int,1},x,y);l=root(uf,x);r=root(uf,y);if l!=r;if uf[l] split |> parseMap\n\td = zeros(Int,n)\n\te = Tuple{Int,Int}[(0,0) for i in 1:m]\n\tfor i in 1:m\n\t\ta,b = readline() |> split |> parseMap\n\t\td[a] += 1\n\t\td[b] += 1\n\t\te[i] = (a,b)\n\tend\n\tfo = 0\n\tfn = 0\n\tfor i in 1:n\n\t\tif d[i]==1\n\t\t\tfo += 1\n\t\telseif d[i]==n-1\n\t\t\tfn += 1\n\t\tend\n\tend\n\tif fo==n-1&&fn==1\n\t\tprintln(0)\n\telse\n\t\tuf = -ones(Int,2*n)\n\t\tfor i in 1:m\n\t\t\tunite(uf,e[i][1],e[i][2]+n)\n\t\t\tunite(uf,e[i][1]+n,e[i][2])\n\t\tend\n\t\tf = 0\n\t\tfor i in 1:n\n\t\t\tif same(uf,i,n+i)\n\t\t\t\tf = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tprintln(f==0?(n>>1)^2-m:div(n*(n-1),2)-m)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584013709, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03579.html", "problem_id": "p03579", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03579/input.txt", "sample_output_relpath": "derived/input_output/data/p03579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03579/Julia/s286629302.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s286629302", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction root(uf::Array{Int,1},x);s=x;while uf[s]>0;s=uf[s];end;s;end\nsame(uf::Array{Int,1},x,y)=root(uf,x)==root(uf,y)?true:false;\nfunction unite(uf::Array{Int,1},x,y);l=root(uf,x);r=root(uf,y);if l!=r;if uf[l] split |> parseMap\n\td = zeros(Int,n)\n\te = Tuple{Int,Int}[(0,0) for i in 1:m]\n\tfor i in 1:m\n\t\ta,b = readline() |> split |> parseMap\n\t\td[a] += 1\n\t\td[b] += 1\n\t\te[i] = (a,b)\n\tend\n\tfo = 0\n\tfn = 0\n\tfor i in 1:n\n\t\tif d[i]==1\n\t\t\tfo += 1\n\t\telseif d[i]==n-1\n\t\t\tfn += 1\n\t\tend\n\tend\n\tif fo==n-1&&fn==1\n\t\tprintln(0)\n\telse\n\t\tuf = -ones(Int,2*n)\n\t\tfor i in 1:m\n\t\t\tunite(uf,e[i][1],e[i][2]+n)\n\t\t\tunite(uf,e[i][1]+n,e[i][2])\n\t\tend\n\t\tf = 0\n\t\tfor i in 1:n\n\t\t\tif same(uf,i,n+i)\n\t\t\t\tf = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\tprintln(f==0?(n>>1)^2-m:div(n*(n-1),2)-m)\n\tend\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\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\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "sample_input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03579", "source_text": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\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\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 951, "cpu_time_ms": 576, "memory_kb": 158664}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s155583370", "group_id": "codeNet:p03579", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction root(uf::Array{Int,1},x);s=x;while uf[s]>0;s=uf[s];end;s;end\nsame(uf::Array{Int,1},x,y)=root(uf,x)==root(uf,y)?true:false;\nfunction unite(uf::Array{Int,1},x,y);l=root(uf,x);r=root(uf,y);if l!=r;if uf[l] split |> parseMap\n\td = zeros(Int,n)\n\te = Tuple{Int,Int}[(0,0) for i in 1:m]\n\tfor i in 1:m\n\t\ta,b = readline() |> split |> parseMap\n\t\td[a] += 1\n\t\td[b] += 1\n\t\te[i] = (a,b)\n\tend\n\tfo = 0\n\tfn = 0\n\tfor i in 1:n\n\t\tif d[i]==1\n\t\t\tfo += 1\n\t\telseif d[i]==n-1\n\t\t\tfn += 1\n\t\tend\n\tend\n\tif fo==n-1&&fn==1\n\t\tprintln(0)\n\telse\n\t\tif n%2==1\n\t\t\tprintln(div(n*(n-1),2)-m)\n\t\telse\n\t\t\tuf = -ones(Int,2*n)\n\t\t\tfor i in 1:m\n\t\t\t\tunite(uf,e[i][1],e[i][2]+n)\n\t\t\t\tunite(uf,e[i][1]+n,e[i][2])\n\t\t\tend\n\t\t\tf = 0\n\t\t\tfor i in 1:n\n\t\t\t\tif same(uf,i,n+i)\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tprintln(f==0?div(n*(n-1),2)-div((n>>1)*(n>>1+1),2)-m:div(n*(n-1),2)-m)\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584013190, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03579.html", "problem_id": "p03579", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03579/input.txt", "sample_output_relpath": "derived/input_output/data/p03579/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03579/Julia/s155583370.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s155583370", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction root(uf::Array{Int,1},x);s=x;while uf[s]>0;s=uf[s];end;s;end\nsame(uf::Array{Int,1},x,y)=root(uf,x)==root(uf,y)?true:false;\nfunction unite(uf::Array{Int,1},x,y);l=root(uf,x);r=root(uf,y);if l!=r;if uf[l] split |> parseMap\n\td = zeros(Int,n)\n\te = Tuple{Int,Int}[(0,0) for i in 1:m]\n\tfor i in 1:m\n\t\ta,b = readline() |> split |> parseMap\n\t\td[a] += 1\n\t\td[b] += 1\n\t\te[i] = (a,b)\n\tend\n\tfo = 0\n\tfn = 0\n\tfor i in 1:n\n\t\tif d[i]==1\n\t\t\tfo += 1\n\t\telseif d[i]==n-1\n\t\t\tfn += 1\n\t\tend\n\tend\n\tif fo==n-1&&fn==1\n\t\tprintln(0)\n\telse\n\t\tif n%2==1\n\t\t\tprintln(div(n*(n-1),2)-m)\n\t\telse\n\t\t\tuf = -ones(Int,2*n)\n\t\t\tfor i in 1:m\n\t\t\t\tunite(uf,e[i][1],e[i][2]+n)\n\t\t\t\tunite(uf,e[i][1]+n,e[i][2])\n\t\t\tend\n\t\t\tf = 0\n\t\t\tfor i in 1:n\n\t\t\t\tif same(uf,i,n+i)\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tprintln(f==0?div(n*(n-1),2)-div((n>>1)*(n>>1+1),2)-m:div(n*(n-1),2)-m)\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\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\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "sample_input": "6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03579", "source_text": "Score : 500 points\n\nProblem Statement\n\nRng has a connected undirected graph with N vertices.\nCurrently, there are M edges in the graph, and the i-th edge connects Vertices A_i and B_i.\n\nRng will add new edges to the graph by repeating the following operation:\n\nOperation: Choose u and v (u \\neq v) such that Vertex v can be reached by traversing exactly three edges from Vertex u, and add an edge connecting Vertices u and v. It is not allowed to add an edge if there is already an edge connecting Vertices u and v.\n\nFind the maximum possible number of edges that can be added.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i,B_i \\leq N\n\nThe graph has no self-loops or multiple edges.\n\nThe graph is connected.\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\nFind the maximum possible number of edges that can be added.\n\nSample Input 1\n\n6 5\n1 2\n2 3\n3 4\n4 5\n5 6\n\nSample Output 1\n\n4\n\nIf we add edges as shown below, four edges can be added, and no more.\n\nSample Input 2\n\n5 5\n1 2\n2 3\n3 1\n5 4\n5 1\n\nSample Output 2\n\n5\n\nFive edges can be added, for example, as follows:\n\nAdd an edge connecting Vertex 5 and Vertex 3.\n\nAdd an edge connecting Vertex 5 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 1.\n\nAdd an edge connecting Vertex 4 and Vertex 2.\n\nAdd an edge connecting Vertex 4 and Vertex 3.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1047, "cpu_time_ms": 581, "memory_kb": 159180}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s608182348", "group_id": "codeNet:p03583", "input_text": "function main()\n\tN=parse(Int,readline())\n\tfor h=1:3500,w=1:3500\n\t\ta=N*h*w\n\t\tb=4*h*w-N*(h+w)\n\t\tif b>0&&a%b==0\n\t\t\tprintln(\"$h $w $(div(a,b))\")\n\t\t\texit()\n\t\tend\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1582365669, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03583.html", "problem_id": "p03583", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03583/input.txt", "sample_output_relpath": "derived/input_output/data/p03583/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03583/Julia/s608182348.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s608182348", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 2 2\n", "input_to_evaluate": "function main()\n\tN=parse(Int,readline())\n\tfor h=1:3500,w=1:3500\n\t\ta=N*h*w\n\t\tb=4*h*w-N*(h+w)\n\t\tif b>0&&a%b==0\n\t\t\tprintln(\"$h $w $(div(a,b))\")\n\t\t\texit()\n\t\tend\n\tend\nend\nmain()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFind a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.\n\nIf there are multiple solutions, any of them will be accepted.\n\nConstraints\n\nIt is guaranteed that, for the given integer N, there exists a solution such that h,n,w \\leq 3500.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutputs\n\nPrint a triple of positive integers h, n and w that satisfies the condition, in the following format:\n\nh n w\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1 2 2\n\n4/2 = 1/1 + 1/2 + 1/2.\n\nSample Input 2\n\n3485\n\nSample Output 2\n\n872 1012974 1539173474040\n\nIt is allowed to use an integer exceeding 3500 in a solution.\n\nSample Input 3\n\n4664\n\nSample Output 3\n\n3498 3498 3498", "sample_input": "2\n"}, "reference_outputs": ["1 2 2\n"], "source_document_id": "p03583", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer N.\n\nFind a triple of positive integers h, n and w such that 4/N = 1/h + 1/n + 1/w.\n\nIf there are multiple solutions, any of them will be accepted.\n\nConstraints\n\nIt is guaranteed that, for the given integer N, there exists a solution such that h,n,w \\leq 3500.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\n\nOutputs\n\nPrint a triple of positive integers h, n and w that satisfies the condition, in the following format:\n\nh n w\n\nSample Input 1\n\n2\n\nSample Output 1\n\n1 2 2\n\n4/2 = 1/1 + 1/2 + 1/2.\n\nSample Input 2\n\n3485\n\nSample Output 2\n\n872 1012974 1539173474040\n\nIt is allowed to use an integer exceeding 3500 in a solution.\n\nSample Input 3\n\n4664\n\nSample Output 3\n\n3498 3498 3498", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 322, "memory_kb": 111456}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s124009673", "group_id": "codeNet:p03587", "input_text": "print(count(x->x=='1',readline()))", "language": "Julia", "metadata": {"date": 1561229287, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03587.html", "problem_id": "p03587", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03587/input.txt", "sample_output_relpath": "derived/input_output/data/p03587/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03587/Julia/s124009673.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s124009673", "user_id": "u729133443"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "print(count(x->x=='1',readline()))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke prepared 6 problems for a upcoming programming contest.\nFor each of those problems, Rng judged whether it can be used in the contest or not.\n\nYou are given a string S of length 6.\nIf the i-th character of s is 1, it means that the i-th problem prepared by Snuke is accepted to be used; 0 means that the problem is not accepted.\n\nHow many problems prepared by Snuke are accepted to be used in the contest?\n\nConstraints\n\nThe length of S is 6.\n\nS consists of 0 and 1.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutputs\n\nPrint the number of problems prepared by Snuke that are accepted to be used in the contest.\n\nSample Input 1\n\n111100\n\nSample Output 1\n\n4\n\nThe first, second, third and fourth problems are accepted, for a total of four.\n\nSample Input 2\n\n001001\n\nSample Output 2\n\n2\n\nSample Input 3\n\n000000\n\nSample Output 3\n\n0", "sample_input": "111100\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03587", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke prepared 6 problems for a upcoming programming contest.\nFor each of those problems, Rng judged whether it can be used in the contest or not.\n\nYou are given a string S of length 6.\nIf the i-th character of s is 1, it means that the i-th problem prepared by Snuke is accepted to be used; 0 means that the problem is not accepted.\n\nHow many problems prepared by Snuke are accepted to be used in the contest?\n\nConstraints\n\nThe length of S is 6.\n\nS consists of 0 and 1.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutputs\n\nPrint the number of problems prepared by Snuke that are accepted to be used in the contest.\n\nSample Input 1\n\n111100\n\nSample Output 1\n\n4\n\nThe first, second, third and fourth problems are accepted, for a total of four.\n\nSample Input 2\n\n001001\n\nSample Output 2\n\n2\n\nSample Input 3\n\n000000\n\nSample Output 3\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 34, "cpu_time_ms": 283, "memory_kb": 109792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s738636935", "group_id": "codeNet:p03588", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tp = 0\n\tq = 0\n\tfor i in 1:n\n\t\ta,b = readline() |> split |> parseMap\n\t\tif p parseInt\n\tp = 0\n\tq = 0\n\tfor i in 1:n\n\t\ta,b = readline() |> split |> parseMap\n\t\tif pparse(Int,x),split(readline()))\nflag=false\nfor i=0:N,j=0:M\n if K==i*M+j*N-i*j\n flag=true\n end\nend\nprintln(flag?\"Yes\":\"No\")", "language": "Julia", "metadata": {"date": 1568046379, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03592.html", "problem_id": "p03592", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03592/input.txt", "sample_output_relpath": "derived/input_output/data/p03592/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03592/Julia/s482602613.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s482602613", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N,M,K=map(x->parse(Int,x),split(readline()))\nflag=false\nfor i=0:N,j=0:M\n if K==i*M+j*N-i*j\n flag=true\n end\nend\nprintln(flag?\"Yes\":\"No\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "sample_input": "2 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03592", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe have a grid with N rows and M columns of squares. Initially, all the squares are white.\n\nThere is a button attached to each row and each column.\nWhen a button attached to a row is pressed, the colors of all the squares in that row are inverted; that is, white squares become black and vice versa.\nWhen a button attached to a column is pressed, the colors of all the squares in that column are inverted.\n\nTakahashi can freely press the buttons any number of times. Determine whether he can have exactly K black squares in the grid.\n\nConstraints\n\n1 \\leq N,M \\leq 1000\n\n0 \\leq K \\leq NM\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M K\n\nOutput\n\nIf Takahashi can have exactly K black squares in the grid, print Yes; otherwise, print No.\n\nSample Input 1\n\n2 2 2\n\nSample Output 1\n\nYes\n\nPress the buttons in the order of the first row, the first column.\n\nSample Input 2\n\n2 2 1\n\nSample Output 2\n\nNo\n\nSample Input 3\n\n3 5 8\n\nSample Output 3\n\nYes\n\nPress the buttons in the order of the first column, third column, second row, fifth column.\n\nSample Input 4\n\n7 9 20\n\nSample Output 4\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1674, "memory_kb": 211136}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s174398093", "group_id": "codeNet:p03593", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\td = zeros(Int,26)\n\tfor i in 1:h\n\t\ta = readline() |> chomp\n\t\tfor j in 1:w\n\t\t\td[Int(a[j])-96] += 1\n\t\tend\n\tend\n\tx = (h>>1)*(w>>1)\n\ty = h%2*(w>>1)+w%2*(h>>1)\n\tz = h*w%2\n\tct = 0\n\tfor i in 1:26\n\t\tif d[i]%2==1\n\t\t\tct += 1\n\t\tend\n\tend\n\tif ct!=z\n\t\tprintln(\"No\")\n\telse\n\t\tct = 0\n\t\tfor i in 1:26\n\t\t\tif d[i]%4==2\n\t\t\t\tct += 1\n\t\t\tend\n\t\tend\n\t\tif ct>y\n\t\t\tprintln(\"No\")\n\t\telse\n\t\t\tprintln(\"Yes\")\n\t\tend\n\tend\n\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1583855430, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03593.html", "problem_id": "p03593", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03593/input.txt", "sample_output_relpath": "derived/input_output/data/p03593/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03593/Julia/s174398093.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s174398093", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\td = zeros(Int,26)\n\tfor i in 1:h\n\t\ta = readline() |> chomp\n\t\tfor j in 1:w\n\t\t\td[Int(a[j])-96] += 1\n\t\tend\n\tend\n\tx = (h>>1)*(w>>1)\n\ty = h%2*(w>>1)+w%2*(h>>1)\n\tz = h*w%2\n\tct = 0\n\tfor i in 1:26\n\t\tif d[i]%2==1\n\t\t\tct += 1\n\t\tend\n\tend\n\tif ct!=z\n\t\tprintln(\"No\")\n\telse\n\t\tct = 0\n\t\tfor i in 1:26\n\t\t\tif d[i]%4==2\n\t\t\t\tct += 1\n\t\t\tend\n\t\tend\n\t\tif ct>y\n\t\t\tprintln(\"No\")\n\t\telse\n\t\t\tprintln(\"Yes\")\n\t\tend\n\tend\n\nend\n\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have an H-by-W matrix.\nLet a_{ij} be the element at the i-th row from the top and j-th column from the left.\nIn this matrix, each a_{ij} is a lowercase English letter.\n\nSnuke is creating another H-by-W matrix, A', by freely rearranging the elements in A.\nHere, he wants to satisfy the following condition:\n\nEvery row and column in A' can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\nNote\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are all palindromes, while ab, abab and abcda are not.\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_{12}...a_{1W}\n:\na_{H1}a_{H2}...a_{HW}\n\nOutput\n\nIf Snuke can create a matrix satisfying the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 4\naabb\naabb\naacc\n\nSample Output 1\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba\n\nSample Input 2\n\n2 2\naa\nbb\n\nSample Output 2\n\nNo\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in A.\n\nSample Input 3\n\n5 1\nt\nw\ne\ne\nt\n\nSample Output 3\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt\n\nSample Input 4\n\n2 5\nabxba\nabyba\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n1 1\nz\n\nSample Output 5\n\nYes", "sample_input": "3 4\naabb\naabb\naacc\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03593", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have an H-by-W matrix.\nLet a_{ij} be the element at the i-th row from the top and j-th column from the left.\nIn this matrix, each a_{ij} is a lowercase English letter.\n\nSnuke is creating another H-by-W matrix, A', by freely rearranging the elements in A.\nHere, he wants to satisfy the following condition:\n\nEvery row and column in A' can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\nNote\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are all palindromes, while ab, abab and abcda are not.\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_{12}...a_{1W}\n:\na_{H1}a_{H2}...a_{HW}\n\nOutput\n\nIf Snuke can create a matrix satisfying the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 4\naabb\naabb\naacc\n\nSample Output 1\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba\n\nSample Input 2\n\n2 2\naa\nbb\n\nSample Output 2\n\nNo\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in A.\n\nSample Input 3\n\n5 1\nt\nw\ne\ne\nt\n\nSample Output 3\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt\n\nSample Input 4\n\n2 5\nabxba\nabyba\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n1 1\nz\n\nSample Output 5\n\nYes", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 542, "cpu_time_ms": 742, "memory_kb": 166172}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s254585172", "group_id": "codeNet:p03593", "input_text": "function main()\n\tH,W=map(x->parse(Int,x),split(readline()))\n\tcnt=zeros(Int,26)\n\tfor _=1:H\n\t\tfor c=chomp(readline())\n\t\t\tcnt[Int(c)-96]+=1\n\t\tend\n\tend\n\tc4=c2=c1=0\n\tif H%2==1&&W%2==1\n\t\tc1=1\n\t\tc2=div(H-1,2)+div(W-1,2)\n\telseif H%2==1&&W%2==0\n\t\tc2=div(W,2)\n\telseif H%2==0&&W%2==1\n\t\tc2=div(H,2)\n\tend\n\tc4=div(H*W-c1-2c2,4)\n\tfor i=1:26\n\t\tt=min(c4,div(cnt[i],4))\n\t\tc4-=t\n\t\tcnt[i]-=4t\n\tend\n\tfor i=1:26\n\t\tt=min(c2,div(cnt[i],2))\n\t\tc2-=t\n\t\tcnt[i]-=2t\n\tend\n\tprintln(c4==c2==0&&sum(cnt)==c1 ? \"Yes\" : \"No\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1582888218, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03593.html", "problem_id": "p03593", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03593/input.txt", "sample_output_relpath": "derived/input_output/data/p03593/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03593/Julia/s254585172.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s254585172", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n\tH,W=map(x->parse(Int,x),split(readline()))\n\tcnt=zeros(Int,26)\n\tfor _=1:H\n\t\tfor c=chomp(readline())\n\t\t\tcnt[Int(c)-96]+=1\n\t\tend\n\tend\n\tc4=c2=c1=0\n\tif H%2==1&&W%2==1\n\t\tc1=1\n\t\tc2=div(H-1,2)+div(W-1,2)\n\telseif H%2==1&&W%2==0\n\t\tc2=div(W,2)\n\telseif H%2==0&&W%2==1\n\t\tc2=div(H,2)\n\tend\n\tc4=div(H*W-c1-2c2,4)\n\tfor i=1:26\n\t\tt=min(c4,div(cnt[i],4))\n\t\tc4-=t\n\t\tcnt[i]-=4t\n\tend\n\tfor i=1:26\n\t\tt=min(c2,div(cnt[i],2))\n\t\tc2-=t\n\t\tcnt[i]-=2t\n\tend\n\tprintln(c4==c2==0&&sum(cnt)==c1 ? \"Yes\" : \"No\")\nend\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nWe have an H-by-W matrix.\nLet a_{ij} be the element at the i-th row from the top and j-th column from the left.\nIn this matrix, each a_{ij} is a lowercase English letter.\n\nSnuke is creating another H-by-W matrix, A', by freely rearranging the elements in A.\nHere, he wants to satisfy the following condition:\n\nEvery row and column in A' can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\nNote\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are all palindromes, while ab, abab and abcda are not.\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_{12}...a_{1W}\n:\na_{H1}a_{H2}...a_{HW}\n\nOutput\n\nIf Snuke can create a matrix satisfying the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 4\naabb\naabb\naacc\n\nSample Output 1\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba\n\nSample Input 2\n\n2 2\naa\nbb\n\nSample Output 2\n\nNo\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in A.\n\nSample Input 3\n\n5 1\nt\nw\ne\ne\nt\n\nSample Output 3\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt\n\nSample Input 4\n\n2 5\nabxba\nabyba\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n1 1\nz\n\nSample Output 5\n\nYes", "sample_input": "3 4\naabb\naabb\naacc\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03593", "source_text": "Score : 400 points\n\nProblem Statement\n\nWe have an H-by-W matrix.\nLet a_{ij} be the element at the i-th row from the top and j-th column from the left.\nIn this matrix, each a_{ij} is a lowercase English letter.\n\nSnuke is creating another H-by-W matrix, A', by freely rearranging the elements in A.\nHere, he wants to satisfy the following condition:\n\nEvery row and column in A' can be read as a palindrome.\n\nDetermine whether he can create a matrix satisfying the condition.\n\nNote\n\nA palindrome is a string that reads the same forward and backward.\nFor example, a, aa, abba and abcba are all palindromes, while ab, abab and abcda are not.\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_{12}...a_{1W}\n:\na_{H1}a_{H2}...a_{HW}\n\nOutput\n\nIf Snuke can create a matrix satisfying the condition, print Yes; otherwise, print No.\n\nSample Input 1\n\n3 4\naabb\naabb\naacc\n\nSample Output 1\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nabba\nacca\nabba\n\nSample Input 2\n\n2 2\naa\nbb\n\nSample Output 2\n\nNo\n\nIt is not possible to create a matrix satisfying the condition, no matter how we rearrange the elements in A.\n\nSample Input 3\n\n5 1\nt\nw\ne\ne\nt\n\nSample Output 3\n\nYes\n\nFor example, the following matrix satisfies the condition.\n\nt\ne\nw\ne\nt\n\nSample Input 4\n\n2 5\nabxba\nabyba\n\nSample Output 4\n\nNo\n\nSample Input 5\n\n1 1\nz\n\nSample Output 5\n\nYes", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 900, "memory_kb": 172980}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s743253788", "group_id": "codeNet:p03597", "input_text": "print(parse(readline())^2-parse(readline()))", "language": "Julia", "metadata": {"date": 1561170998, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03597.html", "problem_id": "p03597", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03597/input.txt", "sample_output_relpath": "derived/input_output/data/p03597/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03597/Julia/s743253788.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s743253788", "user_id": "u729133443"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "print(parse(readline())^2-parse(readline()))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have an N \\times N square grid.\n\nWe will paint each square in the grid either black or white.\n\nIf we paint exactly A squares white, how many squares will be painted black?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq A \\leq N^2\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutputs\n\nPrint the number of squares that will be painted black.\n\nSample Input 1\n\n3\n4\n\nSample Output 1\n\n5\n\nThere are nine squares in a 3 \\times 3 square grid.\nFour of them will be painted white, so the remaining five squares will be painted black.\n\nSample Input 2\n\n19\n100\n\nSample Output 2\n\n261\n\nSample Input 3\n\n10\n0\n\nSample Output 3\n\n100\n\nAs zero squares will be painted white, all the squares will be painted black.", "sample_input": "3\n4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03597", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have an N \\times N square grid.\n\nWe will paint each square in the grid either black or white.\n\nIf we paint exactly A squares white, how many squares will be painted black?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq A \\leq N^2\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutputs\n\nPrint the number of squares that will be painted black.\n\nSample Input 1\n\n3\n4\n\nSample Output 1\n\n5\n\nThere are nine squares in a 3 \\times 3 square grid.\nFour of them will be painted white, so the remaining five squares will be painted black.\n\nSample Input 2\n\n19\n100\n\nSample Output 2\n\n261\n\nSample Input 3\n\n10\n0\n\nSample Output 3\n\n100\n\nAs zero squares will be painted white, all the squares will be painted black.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 870, "memory_kb": 165484}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s199848565", "group_id": "codeNet:p03597", "input_text": "x=parse(Int,readline())\ny=parse(Int,readline())\nprint(x*x-y)", "language": "Julia", "metadata": {"date": 1544734035, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03597.html", "problem_id": "p03597", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03597/input.txt", "sample_output_relpath": "derived/input_output/data/p03597/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03597/Julia/s199848565.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s199848565", "user_id": "u095714878"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "x=parse(Int,readline())\ny=parse(Int,readline())\nprint(x*x-y)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have an N \\times N square grid.\n\nWe will paint each square in the grid either black or white.\n\nIf we paint exactly A squares white, how many squares will be painted black?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq A \\leq N^2\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutputs\n\nPrint the number of squares that will be painted black.\n\nSample Input 1\n\n3\n4\n\nSample Output 1\n\n5\n\nThere are nine squares in a 3 \\times 3 square grid.\nFour of them will be painted white, so the remaining five squares will be painted black.\n\nSample Input 2\n\n19\n100\n\nSample Output 2\n\n261\n\nSample Input 3\n\n10\n0\n\nSample Output 3\n\n100\n\nAs zero squares will be painted white, all the squares will be painted black.", "sample_input": "3\n4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03597", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have an N \\times N square grid.\n\nWe will paint each square in the grid either black or white.\n\nIf we paint exactly A squares white, how many squares will be painted black?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq A \\leq N^2\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutputs\n\nPrint the number of squares that will be painted black.\n\nSample Input 1\n\n3\n4\n\nSample Output 1\n\n5\n\nThere are nine squares in a 3 \\times 3 square grid.\nFour of them will be painted white, so the remaining five squares will be painted black.\n\nSample Input 2\n\n19\n100\n\nSample Output 2\n\n261\n\nSample Input 3\n\n10\n0\n\nSample Output 3\n\n100\n\nAs zero squares will be painted white, all the squares will be painted black.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 60, "cpu_time_ms": 299, "memory_kb": 107648}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s028233309", "group_id": "codeNet:p03597", "input_text": "n = parse(Int, readline())\na = parse(Int, readline())\nprintln(n^2 - a)", "language": "Julia", "metadata": {"date": 1505616941, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03597.html", "problem_id": "p03597", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03597/input.txt", "sample_output_relpath": "derived/input_output/data/p03597/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03597/Julia/s028233309.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s028233309", "user_id": "u872191059"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "n = parse(Int, readline())\na = parse(Int, readline())\nprintln(n^2 - a)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have an N \\times N square grid.\n\nWe will paint each square in the grid either black or white.\n\nIf we paint exactly A squares white, how many squares will be painted black?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq A \\leq N^2\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutputs\n\nPrint the number of squares that will be painted black.\n\nSample Input 1\n\n3\n4\n\nSample Output 1\n\n5\n\nThere are nine squares in a 3 \\times 3 square grid.\nFour of them will be painted white, so the remaining five squares will be painted black.\n\nSample Input 2\n\n19\n100\n\nSample Output 2\n\n261\n\nSample Input 3\n\n10\n0\n\nSample Output 3\n\n100\n\nAs zero squares will be painted white, all the squares will be painted black.", "sample_input": "3\n4\n"}, "reference_outputs": ["5\n"], "source_document_id": "p03597", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have an N \\times N square grid.\n\nWe will paint each square in the grid either black or white.\n\nIf we paint exactly A squares white, how many squares will be painted black?\n\nConstraints\n\n1 \\leq N \\leq 100\n\n0 \\leq A \\leq N^2\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nA\n\nOutputs\n\nPrint the number of squares that will be painted black.\n\nSample Input 1\n\n3\n4\n\nSample Output 1\n\n5\n\nThere are nine squares in a 3 \\times 3 square grid.\nFour of them will be painted white, so the remaining five squares will be painted black.\n\nSample Input 2\n\n19\n100\n\nSample Output 2\n\n261\n\nSample Input 3\n\n10\n0\n\nSample Output 3\n\n100\n\nAs zero squares will be painted white, all the squares will be painted black.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2109, "memory_kb": 113920}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s676093643", "group_id": "codeNet:p03598", "input_text": "function main()\n \n N = parse(Int,readline())\n K = parse(Int,readline())\n x = map(x -> parse(Int,x), split(readline()))\n \n ans = 0\n \n for i in 1:N\n \n ans += min(2x[i],2abs(K-x[i]))\n\n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1581191914, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03598.html", "problem_id": "p03598", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03598/input.txt", "sample_output_relpath": "derived/input_output/data/p03598/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03598/Julia/s676093643.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s676093643", "user_id": "u790457721"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "function main()\n \n N = parse(Int,readline())\n K = parse(Int,readline())\n x = map(x -> parse(Int,x), split(readline()))\n \n ans = 0\n \n for i in 1:N\n \n ans += min(2x[i],2abs(K-x[i]))\n\n end\n \n println(ans)\n \nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i).\nThus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N.\n\nIn order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B.\nThen, he placed the i-th type-A robot at coordinates (0, i), and the i-th type-B robot at coordinates (K, i).\nThus, now we have one type-A robot and one type-B robot on each of the N lines y = 1, y = 2, ..., y = N.\n\nWhen activated, each type of robot will operate as follows.\n\nWhen a type-A robot is activated at coordinates (0, a), it will move to the position of the ball on the line y = a, collect the ball, move back to its original position (0, a) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.\n\nWhen a type-B robot is activated at coordinates (K, b), it will move to the position of the ball on the line y = b, collect the ball, move back to its original position (K, b) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.\n\nSnuke will activate some of the 2N robots to collect all of the balls. Find the minimum possible total distance covered by robots.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n0 < x_i < K\n\nAll input values are integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nK\nx_1 x_2 ... x_N\n\nOutputs\n\nPrint the minimum possible total distance covered by robots.\n\nSample Input 1\n\n1\n10\n2\n\nSample Output 1\n\n4\n\nThere are just one ball, one type-A robot and one type-B robot.\n\nIf the type-A robot is used to collect the ball, the distance from the robot to the ball is 2, and the distance from the ball to the original position of the robot is also 2, for a total distance of 4.\n\nSimilarly, if the type-B robot is used, the total distance covered will be 16.\n\nThus, the total distance covered will be minimized when the type-A robot is used. The output should be 4.\n\nSample Input 2\n\n2\n9\n3 6\n\nSample Output 2\n\n12\n\nThe total distance covered will be minimized when the first ball is collected by the type-A robot, and the second ball by the type-B robot.\n\nSample Input 3\n\n5\n20\n11 12 9 17 12\n\nSample Output 3\n\n74", "sample_input": "1\n10\n2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03598", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N balls in the xy-plane. The coordinates of the i-th of them is (x_i, i).\nThus, we have one ball on each of the N lines y = 1, y = 2, ..., y = N.\n\nIn order to collect these balls, Snuke prepared 2N robots, N of type A and N of type B.\nThen, he placed the i-th type-A robot at coordinates (0, i), and the i-th type-B robot at coordinates (K, i).\nThus, now we have one type-A robot and one type-B robot on each of the N lines y = 1, y = 2, ..., y = N.\n\nWhen activated, each type of robot will operate as follows.\n\nWhen a type-A robot is activated at coordinates (0, a), it will move to the position of the ball on the line y = a, collect the ball, move back to its original position (0, a) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.\n\nWhen a type-B robot is activated at coordinates (K, b), it will move to the position of the ball on the line y = b, collect the ball, move back to its original position (K, b) and deactivate itself. If there is no such ball, it will just deactivate itself without doing anything.\n\nSnuke will activate some of the 2N robots to collect all of the balls. Find the minimum possible total distance covered by robots.\n\nConstraints\n\n1 \\leq N \\leq 100\n\n1 \\leq K \\leq 100\n\n0 < x_i < K\n\nAll input values are integers.\n\nInputs\n\nInput is given from Standard Input in the following format:\n\nN\nK\nx_1 x_2 ... x_N\n\nOutputs\n\nPrint the minimum possible total distance covered by robots.\n\nSample Input 1\n\n1\n10\n2\n\nSample Output 1\n\n4\n\nThere are just one ball, one type-A robot and one type-B robot.\n\nIf the type-A robot is used to collect the ball, the distance from the robot to the ball is 2, and the distance from the ball to the original position of the robot is also 2, for a total distance of 4.\n\nSimilarly, if the type-B robot is used, the total distance covered will be 16.\n\nThus, the total distance covered will be minimized when the type-A robot is used. The output should be 4.\n\nSample Input 2\n\n2\n9\n3 6\n\nSample Output 2\n\n12\n\nThe total distance covered will be minimized when the first ball is collected by the type-A robot, and the second ball by the type-B robot.\n\nSample Input 3\n\n5\n20\n11 12 9 17 12\n\nSample Output 3\n\n74", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 351, "memory_kb": 111104}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s477004783", "group_id": "codeNet:p03599", "input_text": "const a,b,c,d,e,f = map(x -> parse(Int,x), split(readline()))\nai = bi = ci = di = 0\nconst amax = fld(30,a)\nconst bmax = fld(30,b)\nconst cmax = fld(3000,c)\nconst dmax = fld(3000,d)\nwat = 100\nsug = 0\niwat = 0\nisug = 0\n\nfor ai = 0:amax,bi = 0:bmax,ci = 0:cmax,di = 0:dmax\n iwat = 100*(ai*a+bi*b)\n isug = ci*c+di*d\n if iwat+isug <= f && isug/iwat <= e/100\n if isug*wat > sug*iwat\n wat = iwat\n sug = isug\n end\n end\nend\nprint(\"$(wat+sug) $sug\")", "language": "Julia", "metadata": {"date": 1506543593, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s477004783.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s477004783", "user_id": "u743272507"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "const a,b,c,d,e,f = map(x -> parse(Int,x), split(readline()))\nai = bi = ci = di = 0\nconst amax = fld(30,a)\nconst bmax = fld(30,b)\nconst cmax = fld(3000,c)\nconst dmax = fld(3000,d)\nwat = 100\nsug = 0\niwat = 0\nisug = 0\n\nfor ai = 0:amax,bi = 0:bmax,ci = 0:cmax,di = 0:dmax\n iwat = 100*(ai*a+bi*b)\n isug = ci*c+di*d\n if iwat+isug <= f && isug/iwat <= e/100\n if isug*wat > sug*iwat\n wat = iwat\n sug = isug\n end\n end\nend\nprint(\"$(wat+sug) $sug\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 486, "cpu_time_ms": 3164, "memory_kb": 154520}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s899100064", "group_id": "codeNet:p03601", "input_text": "function solve(A, B, C, D, E, F)\n i = j = k = l = 0\n max = -Inf\n solution = (i, j, k, l)\n ok() = k * C + l * D ≤ E * (i * A + j * B) && 100 * i * A + 100 * j * B + k * C + l * D ≤ F\n while ok()\n while ok()\n while ok()\n while ok()\n x = 100 * (k * C + l * D) / (i * 100A + j * 100B + k * C + l * D)\n if x > max\n solution = (i, j, k, l)\n max = x\n end\n l += 1\n end\n l = 0\n k += 1\n end\n k = l = 0\n j += 1\n end\n j = k = l = 0\n i += 1\n end\n i, j, k, l = solution\n println(i * 100A + j * 100B + k * C + l * D, \" \", k * C + l * D)\nend\n\nA, B, C, D, E, F = [parse(Int, x) for x in split(readline())]\nsolve(A, B, C, D, E, F)\n", "language": "Julia", "metadata": {"date": 1506573477, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03601.html", "problem_id": "p03601", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03601/input.txt", "sample_output_relpath": "derived/input_output/data/p03601/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03601/Julia/s899100064.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s899100064", "user_id": "u256288129"}, "prompt_components": {"gold_output": "110 10\n", "input_to_evaluate": "function solve(A, B, C, D, E, F)\n i = j = k = l = 0\n max = -Inf\n solution = (i, j, k, l)\n ok() = k * C + l * D ≤ E * (i * A + j * B) && 100 * i * A + 100 * j * B + k * C + l * D ≤ F\n while ok()\n while ok()\n while ok()\n while ok()\n x = 100 * (k * C + l * D) / (i * 100A + j * 100B + k * C + l * D)\n if x > max\n solution = (i, j, k, l)\n max = x\n end\n l += 1\n end\n l = 0\n k += 1\n end\n k = l = 0\n j += 1\n end\n j = k = l = 0\n i += 1\n end\n i, j, k, l = solution\n println(i * 100A + j * 100B + k * C + l * D, \" \", k * C + l * D)\nend\n\nA, B, C, D, E, F = [parse(Int, x) for x in split(readline())]\nsolve(A, B, C, D, E, F)\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": "p03601", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 895, "cpu_time_ms": 1159, "memory_kb": 151916}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s267356165", "group_id": "codeNet:p03605", "input_text": "function main()\n \n N = split(chomp(readline()),\"\")\n \n if in(\"9\",N)\n println(\"Yes\")\n else\n println(\"No\")\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1578956031, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s267356165.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s267356165", "user_id": "u790457721"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n \n N = split(chomp(readline()),\"\")\n \n if in(\"9\",N)\n println(\"Yes\")\n else\n println(\"No\")\n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 311, "memory_kb": 107908}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s028263150", "group_id": "codeNet:p03607", "input_text": "function main()\n \n N = parse(Int,readline())\n \n dict = Dict()\n \n for i in 1:N\n A = chomp(readline())\n dict[A] = get(dict,A,0) + 1\n end\n \n ans = 0\n \n for i in keys(dict)\n if dict[i] % 2 == 1\n ans += 1\n end\n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1583514796, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s028263150.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s028263150", "user_id": "u790457721"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n \n N = parse(Int,readline())\n \n dict = Dict()\n \n for i in 1:N\n A = chomp(readline())\n dict[A] = get(dict,A,0) + 1\n end\n \n ans = 0\n \n for i in keys(dict)\n if dict[i] % 2 == 1\n ans += 1\n end\n end\n \n println(ans)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 426, "memory_kb": 141276}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s769353647", "group_id": "codeNet:p03608", "input_text": "function f(D,X,u)\n\tif isempty(X)\n\t\treturn 0\n\tend\n\tret=1145141919810\n\tfor i=1:length(X)\n\t\tW=Int[]\n\t\tfor j=1:length(X)\n\t\t\tif i!=j\n\t\t\t\tpush!(W,X[j])\n\t\t\tend\n\t\tend\n\t\tret=min(ret,f(D,W,X[i])+D[u][X[i]])\n\tend\n\tret\nend\np(x)=map(y->parse(Int,y),split(x))\nfunction main()\n\tN,M,R=p(readline())\n\tr=p(readline())\n\tD=[[1145141919810 for _=1:N] for _=1:N]\n\tfor i=1:N\n\t\tD[i][i]=0\n\tend\n\tfor s=readlines()\n\t\ta,b,c=p(s)\n\t\tD[a][b]=D[b][a]=c\n\tend\n\tfor k=1:N,i=1:N,j=1:N\n\t\tD[i][j]=min(D[i][j],D[i][k]+D[k][j])\n\tend\n\tans=1145141919810\n\tfor i=1:R\n\t\tnow=Int[]\n\t\tfor j=1:R\n\t\t\tif i!=j\n\t\t\t\tpush!(now,r[j])\n\t\t\tend\n\t\tend\n\t\tans=min(ans,f(D,now,r[i]))\n\tend\n\tprintln(ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561541605, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03608.html", "problem_id": "p03608", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03608/input.txt", "sample_output_relpath": "derived/input_output/data/p03608/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03608/Julia/s769353647.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s769353647", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function f(D,X,u)\n\tif isempty(X)\n\t\treturn 0\n\tend\n\tret=1145141919810\n\tfor i=1:length(X)\n\t\tW=Int[]\n\t\tfor j=1:length(X)\n\t\t\tif i!=j\n\t\t\t\tpush!(W,X[j])\n\t\t\tend\n\t\tend\n\t\tret=min(ret,f(D,W,X[i])+D[u][X[i]])\n\tend\n\tret\nend\np(x)=map(y->parse(Int,y),split(x))\nfunction main()\n\tN,M,R=p(readline())\n\tr=p(readline())\n\tD=[[1145141919810 for _=1:N] for _=1:N]\n\tfor i=1:N\n\t\tD[i][i]=0\n\tend\n\tfor s=readlines()\n\t\ta,b,c=p(s)\n\t\tD[a][b]=D[b][a]=c\n\tend\n\tfor k=1:N,i=1:N,j=1:N\n\t\tD[i][j]=min(D[i][j],D[i][k]+D[k][j])\n\tend\n\tans=1145141919810\n\tfor i=1:R\n\t\tnow=Int[]\n\t\tfor j=1:R\n\t\t\tif i!=j\n\t\t\t\tpush!(now,r[j])\n\t\t\tend\n\t\tend\n\t\tans=min(ans,f(D,now,r[i]))\n\tend\n\tprintln(ans)\nend\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N towns in the State of Atcoder, connected by M bidirectional roads.\n\nThe i-th road connects Town A_i and B_i and has a length of C_i.\n\nJoisino is visiting R towns in the state, r_1,r_2,..,r_R (not necessarily in this order).\n\nShe will fly to the first town she visits, and fly back from the last town she visits, but for the rest of the trip she will have to travel by road.\n\nIf she visits the towns in the order that minimizes the distance traveled by road, what will that distance be?\n\nConstraints\n\n2≤N≤200\n\n1≤M≤N×(N-1)/2\n\n2≤R≤min(8,N) (min(8,N) is the smaller of 8 and N.)\n\nr_i≠r_j (i≠j)\n\n1≤A_i,B_i≤N, A_i≠B_i\n\n(A_i,B_i)≠(A_j,B_j),(A_i,B_i)≠(B_j,A_j) (i≠j)\n\n1≤C_i≤100000\n\nEvery town can be reached from every town by road.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M R\nr_1 ... r_R\nA_1 B_1 C_1\n:\nA_M B_M C_M\n\nOutput\n\nPrint the distance traveled by road if Joisino visits the towns in the order that minimizes it.\n\nSample Input 1\n\n3 3 3\n1 2 3\n1 2 1\n2 3 1\n3 1 4\n\nSample Output 1\n\n2\n\nFor example, if she visits the towns in the order of 1, 2, 3, the distance traveled will be 2, which is the minimum possible.\n\nSample Input 2\n\n3 3 2\n1 3\n2 3 2\n1 3 6\n1 2 2\n\nSample Output 2\n\n4\n\nThe shortest distance between Towns 1 and 3 is 4. Thus, whether she visits Town 1 or 3 first, the distance traveled will be 4.\n\nSample Input 3\n\n4 6 3\n2 3 4\n1 2 4\n2 3 3\n4 3 1\n1 4 1\n4 2 2\n3 1 6\n\nSample Output 3\n\n3", "sample_input": "3 3 3\n1 2 3\n1 2 1\n2 3 1\n3 1 4\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03608", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N towns in the State of Atcoder, connected by M bidirectional roads.\n\nThe i-th road connects Town A_i and B_i and has a length of C_i.\n\nJoisino is visiting R towns in the state, r_1,r_2,..,r_R (not necessarily in this order).\n\nShe will fly to the first town she visits, and fly back from the last town she visits, but for the rest of the trip she will have to travel by road.\n\nIf she visits the towns in the order that minimizes the distance traveled by road, what will that distance be?\n\nConstraints\n\n2≤N≤200\n\n1≤M≤N×(N-1)/2\n\n2≤R≤min(8,N) (min(8,N) is the smaller of 8 and N.)\n\nr_i≠r_j (i≠j)\n\n1≤A_i,B_i≤N, A_i≠B_i\n\n(A_i,B_i)≠(A_j,B_j),(A_i,B_i)≠(B_j,A_j) (i≠j)\n\n1≤C_i≤100000\n\nEvery town can be reached from every town by road.\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M R\nr_1 ... r_R\nA_1 B_1 C_1\n:\nA_M B_M C_M\n\nOutput\n\nPrint the distance traveled by road if Joisino visits the towns in the order that minimizes it.\n\nSample Input 1\n\n3 3 3\n1 2 3\n1 2 1\n2 3 1\n3 1 4\n\nSample Output 1\n\n2\n\nFor example, if she visits the towns in the order of 1, 2, 3, the distance traveled will be 2, which is the minimum possible.\n\nSample Input 2\n\n3 3 2\n1 3\n2 3 2\n1 3 6\n1 2 2\n\nSample Output 2\n\n4\n\nThe shortest distance between Towns 1 and 3 is 4. Thus, whether she visits Town 1 or 3 first, the distance traveled will be 4.\n\nSample Input 3\n\n4 6 3\n2 3 4\n1 2 4\n2 3 3\n4 3 1\n1 4 1\n4 2 2\n3 1 6\n\nSample Output 3\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 156384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s000620271", "group_id": "codeNet:p03609", "input_text": "print(max(-(parse.(split(readline())...),0))", "language": "Julia", "metadata": {"date": 1561171253, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03609.html", "problem_id": "p03609", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03609/input.txt", "sample_output_relpath": "derived/input_output/data/p03609/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03609/Julia/s000620271.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s000620271", "user_id": "u729133443"}, "prompt_components": {"gold_output": "83\n", "input_to_evaluate": "print(max(-(parse.(split(readline())...),0))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nWe have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand.\n\nHow many grams of sand will the upper bulb contains after t seconds?\n\nConstraints\n\n1≤X≤10^9\n\n1≤t≤10^9\n\nX and t are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX t\n\nOutput\n\nPrint the number of sand in the upper bulb after t second.\n\nSample Input 1\n\n100 17\n\nSample Output 1\n\n83\n\n17 out of the initial 100 grams of sand will be consumed, resulting in 83 grams.\n\nSample Input 2\n\n48 58\n\nSample Output 2\n\n0\n\nAll 48 grams of sand will be gone, resulting in 0 grams.\n\nSample Input 3\n\n1000000000 1000000000\n\nSample Output 3\n\n0", "sample_input": "100 17\n"}, "reference_outputs": ["83\n"], "source_document_id": "p03609", "source_text": "Score : 100 points\n\nProblem Statement\n\nWe have a sandglass that runs for X seconds. The sand drops from the upper bulb at a rate of 1 gram per second. That is, the upper bulb initially contains X grams of sand.\n\nHow many grams of sand will the upper bulb contains after t seconds?\n\nConstraints\n\n1≤X≤10^9\n\n1≤t≤10^9\n\nX and t are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX t\n\nOutput\n\nPrint the number of sand in the upper bulb after t second.\n\nSample Input 1\n\n100 17\n\nSample Output 1\n\n83\n\n17 out of the initial 100 grams of sand will be consumed, resulting in 83 grams.\n\nSample Input 2\n\n48 58\n\nSample Output 2\n\n0\n\nAll 48 grams of sand will be gone, resulting in 0 grams.\n\nSample Input 3\n\n1000000000 1000000000\n\nSample Output 3\n\n0", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 550, "memory_kb": 125412}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s471971233", "group_id": "codeNet:p03610", "input_text": "s=readline()\nfor i=1:endof(s)\n\tif i%2==1\n\t\tprint(s[i])\n\tend\nend\n", "language": "Julia", "metadata": {"date": 1534843624, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s471971233.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s471971233", "user_id": "u657913472"}, "prompt_components": {"gold_output": "acdr\n", "input_to_evaluate": "s=readline()\nfor i=1:endof(s)\n\tif i%2==1\n\t\tprint(s[i])\n\tend\nend\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 64, "cpu_time_ms": 325, "memory_kb": 113380}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s234443073", "group_id": "codeNet:p03623", "input_text": "parseInt(x) = parse(Int, x)\n\nx, a, b = map(parseInt,split(readline()))\n\nprintln(abs(x - a) < abs(x - b) ? 'A' : 'B')", "language": "Julia", "metadata": {"date": 1584715377, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s234443073.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s234443073", "user_id": "u131000248"}, "prompt_components": {"gold_output": "B\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nx, a, b = map(parseInt,split(readline()))\n\nprintln(abs(x - a) < abs(x - b) ? 'A' : 'B')", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 343, "memory_kb": 110216}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s024113791", "group_id": "codeNet:p03623", "input_text": "parseInt(x) = parse(Int, x)\n\nx, a, b = map(parseInt(split(readline())))\n\nprintln(abs(x - a) < abs(x - b) ? 'A' : 'B')", "language": "Julia", "metadata": {"date": 1584715233, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s024113791.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s024113791", "user_id": "u131000248"}, "prompt_components": {"gold_output": "B\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nx, a, b = map(parseInt(split(readline())))\n\nprintln(abs(x - a) < abs(x - b) ? 'A' : 'B')", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1231, "memory_kb": 145544}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s773071876", "group_id": "codeNet:p03623", "input_text": "x,a,b=map(x->parse(Int,x),split(readline()))\nprint(abs(a-x)parse(Int,x),split(readline()))\nprint(abs(a-x)parse(Int,x), split(readline()))\n#A = parse.(Int, split(readline()))\n\ncount = Dict()\n\nfor a in A\n count[a] = get(count,a,0) + 1\nend\n\ncount2 = sort([x for x in count if x.second >= 2],by = x->x.first,rev = true)\ncount4 = sort([x for x in count if x.second >= 4],by = x->x.first,rev = true)\n\nans = 0\n\nif length(count2) > 2\n ans = count2[1].first * count2[2].first\nend\n\nif length(count4) > 0\n ans = max(ans, count4[1].first * count4[1].first)\nend\n\nif length(count2) > 1 && length(count4) > 1\n ans = max(ans, count2[1].first * count4[1].first)\nend\n\nprintln(ans)", "language": "Julia", "metadata": {"date": 1584724295, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03625.html", "problem_id": "p03625", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03625/input.txt", "sample_output_relpath": "derived/input_output/data/p03625/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03625/Julia/s012881718.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s012881718", "user_id": "u131000248"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N = parse(Int,readline())\nA = map(x->parse(Int,x), split(readline()))\n#A = parse.(Int, split(readline()))\n\ncount = Dict()\n\nfor a in A\n count[a] = get(count,a,0) + 1\nend\n\ncount2 = sort([x for x in count if x.second >= 2],by = x->x.first,rev = true)\ncount4 = sort([x for x in count if x.second >= 4],by = x->x.first,rev = true)\n\nans = 0\n\nif length(count2) > 2\n ans = count2[1].first * count2[2].first\nend\n\nif length(count4) > 0\n ans = max(ans, count4[1].first * count4[1].first)\nend\n\nif length(count2) > 1 && length(count4) > 1\n ans = max(ans, count2[1].first * count4[1].first)\nend\n\nprintln(ans)", "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": "p03625", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 864, "memory_kb": 152720}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s944299834", "group_id": "codeNet:p03631", "input_text": "N = readline()\n\nif N = reverse(N)\n println(\"Yes\")\nelse\n println(\"No\")\nend", "language": "Julia", "metadata": {"date": 1585880676, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03631.html", "problem_id": "p03631", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03631/input.txt", "sample_output_relpath": "derived/input_output/data/p03631/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03631/Julia/s944299834.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s944299834", "user_id": "u879294842"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N = readline()\n\nif N = reverse(N)\n println(\"Yes\")\nelse\n println(\"No\")\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a three-digit positive integer N.\n\nDetermine whether N is a palindromic number.\n\nHere, a palindromic number is an integer that reads the same backward as forward in decimal notation.\n\nConstraints\n\n100≤N≤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 N is a palindromic number, print Yes; otherwise, print No.\n\nSample Input 1\n\n575\n\nSample Output 1\n\nYes\n\nN=575 is also 575 when read backward, so it is a palindromic number. You should print Yes.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\nN=123 becomes 321 when read backward, so it is not a palindromic number. You should print No.\n\nSample Input 3\n\n812\n\nSample Output 3\n\nNo", "sample_input": "575\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03631", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a three-digit positive integer N.\n\nDetermine whether N is a palindromic number.\n\nHere, a palindromic number is an integer that reads the same backward as forward in decimal notation.\n\nConstraints\n\n100≤N≤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 N is a palindromic number, print Yes; otherwise, print No.\n\nSample Input 1\n\n575\n\nSample Output 1\n\nYes\n\nN=575 is also 575 when read backward, so it is a palindromic number. You should print Yes.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\nN=123 becomes 321 when read backward, so it is not a palindromic number. You should print No.\n\nSample Input 3\n\n812\n\nSample Output 3\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 75, "cpu_time_ms": 1060, "memory_kb": 199500}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s096503243", "group_id": "codeNet:p03631", "input_text": "x=parse(readline())\nprintln(div(x,100)==x%10?\"Yes\":\"No\")", "language": "Julia", "metadata": {"date": 1546359363, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03631.html", "problem_id": "p03631", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03631/input.txt", "sample_output_relpath": "derived/input_output/data/p03631/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03631/Julia/s096503243.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s096503243", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "x=parse(readline())\nprintln(div(x,100)==x%10?\"Yes\":\"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a three-digit positive integer N.\n\nDetermine whether N is a palindromic number.\n\nHere, a palindromic number is an integer that reads the same backward as forward in decimal notation.\n\nConstraints\n\n100≤N≤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 N is a palindromic number, print Yes; otherwise, print No.\n\nSample Input 1\n\n575\n\nSample Output 1\n\nYes\n\nN=575 is also 575 when read backward, so it is a palindromic number. You should print Yes.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\nN=123 becomes 321 when read backward, so it is not a palindromic number. You should print No.\n\nSample Input 3\n\n812\n\nSample Output 3\n\nNo", "sample_input": "575\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03631", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a three-digit positive integer N.\n\nDetermine whether N is a palindromic number.\n\nHere, a palindromic number is an integer that reads the same backward as forward in decimal notation.\n\nConstraints\n\n100≤N≤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 N is a palindromic number, print Yes; otherwise, print No.\n\nSample Input 1\n\n575\n\nSample Output 1\n\nYes\n\nN=575 is also 575 when read backward, so it is a palindromic number. You should print Yes.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\nN=123 becomes 321 when read backward, so it is not a palindromic number. You should print No.\n\nSample Input 3\n\n812\n\nSample Output 3\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 780, "memory_kb": 167648}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s476349157", "group_id": "codeNet:p03631", "input_text": "n = parse(Int, readline())\n\nif n % 10 == div(n, 100)\n println(\"Yes\")\nelse\n println(\"No\")\nend", "language": "Julia", "metadata": {"date": 1502586103, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03631.html", "problem_id": "p03631", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03631/input.txt", "sample_output_relpath": "derived/input_output/data/p03631/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03631/Julia/s476349157.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s476349157", "user_id": "u872191059"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "n = parse(Int, readline())\n\nif n % 10 == div(n, 100)\n println(\"Yes\")\nelse\n println(\"No\")\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given a three-digit positive integer N.\n\nDetermine whether N is a palindromic number.\n\nHere, a palindromic number is an integer that reads the same backward as forward in decimal notation.\n\nConstraints\n\n100≤N≤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 N is a palindromic number, print Yes; otherwise, print No.\n\nSample Input 1\n\n575\n\nSample Output 1\n\nYes\n\nN=575 is also 575 when read backward, so it is a palindromic number. You should print Yes.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\nN=123 becomes 321 when read backward, so it is not a palindromic number. You should print No.\n\nSample Input 3\n\n812\n\nSample Output 3\n\nNo", "sample_input": "575\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03631", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given a three-digit positive integer N.\n\nDetermine whether N is a palindromic number.\n\nHere, a palindromic number is an integer that reads the same backward as forward in decimal notation.\n\nConstraints\n\n100≤N≤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 N is a palindromic number, print Yes; otherwise, print No.\n\nSample Input 1\n\n575\n\nSample Output 1\n\nYes\n\nN=575 is also 575 when read backward, so it is a palindromic number. You should print Yes.\n\nSample Input 2\n\n123\n\nSample Output 2\n\nNo\n\nN=123 becomes 321 when read backward, so it is not a palindromic number. You should print No.\n\nSample Input 3\n\n812\n\nSample Output 3\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1558, "memory_kb": 167048}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s457286782", "group_id": "codeNet:p03632", "input_text": "function parseInt(x) parse(Int, x) end\n\nfunction main()\n\ta = parseInt.(split(readline()))\n\tif a[1] < a[3]\n\t\tif a[2] < a[4]\n\t\t\tprint(max(a[2]-a[3], 0))\n\t\telse\n\t\t\tprint(a[4]-a[3])\n\t\tend\n\telse\n\t\tif a[4] < a[2]\n\t\t\tprint(max(a[4]-a[1], 0))\n\t\telse\n\t\t\tprint(a[2]-a[1])\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1540775983, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03632.html", "problem_id": "p03632", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03632/input.txt", "sample_output_relpath": "derived/input_output/data/p03632/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03632/Julia/s457286782.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s457286782", "user_id": "u095714878"}, "prompt_components": {"gold_output": "50\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\n\nfunction main()\n\ta = parseInt.(split(readline()))\n\tif a[1] < a[3]\n\t\tif a[2] < a[4]\n\t\t\tprint(max(a[2]-a[3], 0))\n\t\telse\n\t\t\tprint(a[4]-a[3])\n\t\tend\n\telse\n\t\tif a[4] < a[2]\n\t\t\tprint(max(a[4]-a[1], 0))\n\t\telse\n\t\t\tprint(a[2]-a[1])\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAlice and Bob are controlling a robot. They each have one switch that controls the robot.\n\nAlice started holding down her button A second after the start-up of the robot, and released her button B second after the start-up.\n\nBob started holding down his button C second after the start-up, and released his button D second after the start-up.\n\nFor how many seconds both Alice and Bob were holding down their buttons?\n\nConstraints\n\n0≤Aperse(Int,x),split(readline()))\nprint(max(0,min(b,d)-max(a,c)))", "language": "Julia", "metadata": {"date": 1534892792, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03632.html", "problem_id": "p03632", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03632/input.txt", "sample_output_relpath": "derived/input_output/data/p03632/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03632/Julia/s471952099.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s471952099", "user_id": "u657913472"}, "prompt_components": {"gold_output": "50\n", "input_to_evaluate": "a,b,c,d=map(x->perse(Int,x),split(readline()))\nprint(max(0,min(b,d)-max(a,c)))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAlice and Bob are controlling a robot. They each have one switch that controls the robot.\n\nAlice started holding down her button A second after the start-up of the robot, and released her button B second after the start-up.\n\nBob started holding down his button C second after the start-up, and released his button D second after the start-up.\n\nFor how many seconds both Alice and Bob were holding down their buttons?\n\nConstraints\n\n0≤A parseInt\n\tend\n\tprint(lcm(t))\nend\nmain()", "language": "Julia", "metadata": {"date": 1541343768, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03633.html", "problem_id": "p03633", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03633/input.txt", "sample_output_relpath": "derived/input_output/data/p03633/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03633/Julia/s393880588.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s393880588", "user_id": "u095714878"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nfunction main()\n\tn = parseInt(readline())\n\tt = Array{Int}(n)\n\tfor i in 1:n\n\t\tt[i] = readline() |> parseInt\n\tend\n\tprint(lcm(t))\nend\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have N clocks. The hand of the i-th clock (1≤i≤N) rotates through 360° in exactly T_i seconds.\n\nInitially, the hand of every clock stands still, pointing directly upward.\n\nNow, Dolphin starts all the clocks simultaneously.\n\nIn how many seconds will the hand of every clock point directly upward again?\n\nConstraints\n\n1≤N≤100\n\n1≤T_i≤10^{18}\n\nAll input values are integers.\n\nThe correct answer is at most 10^{18} seconds.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nT_1\n:\nT_N\n\nOutput\n\nPrint the number of seconds after which the hand of every clock point directly upward again.\n\nSample Input 1\n\n2\n2\n3\n\nSample Output 1\n\n6\n\nWe have two clocks. The time when the hand of each clock points upward is as follows:\n\nClock 1: 2, 4, 6, ... seconds after the beginning\n\nClock 2: 3, 6, 9, ... seconds after the beginning\n\nTherefore, it takes 6 seconds until the hands of both clocks point directly upward.\n\nSample Input 2\n\n5\n2\n5\n10\n1000000000000000000\n1000000000000000000\n\nSample Output 2\n\n1000000000000000000", "sample_input": "2\n2\n3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03633", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have N clocks. The hand of the i-th clock (1≤i≤N) rotates through 360° in exactly T_i seconds.\n\nInitially, the hand of every clock stands still, pointing directly upward.\n\nNow, Dolphin starts all the clocks simultaneously.\n\nIn how many seconds will the hand of every clock point directly upward again?\n\nConstraints\n\n1≤N≤100\n\n1≤T_i≤10^{18}\n\nAll input values are integers.\n\nThe correct answer is at most 10^{18} seconds.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\nT_1\n:\nT_N\n\nOutput\n\nPrint the number of seconds after which the hand of every clock point directly upward again.\n\nSample Input 1\n\n2\n2\n3\n\nSample Output 1\n\n6\n\nWe have two clocks. The time when the hand of each clock points upward is as follows:\n\nClock 1: 2, 4, 6, ... seconds after the beginning\n\nClock 2: 3, 6, 9, ... seconds after the beginning\n\nTherefore, it takes 6 seconds until the hands of both clocks point directly upward.\n\nSample Input 2\n\n5\n2\n5\n10\n1000000000000000000\n1000000000000000000\n\nSample Output 2\n\n1000000000000000000", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 347, "memory_kb": 110588}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s386614516", "group_id": "codeNet:p03635", "input_text": "inputs = split(deadline(), ' ')\ninputs = map(x -> parse(Int, x), inputs)\n\nm = inputs[0]\nn = inputs[1]\n\nprint((m - 1) * (n - 1))", "language": "Julia", "metadata": {"date": 1502119137, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s386614516.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s386614516", "user_id": "u845674689"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "inputs = split(deadline(), ' ')\ninputs = map(x -> parse(Int, x), inputs)\n\nm = inputs[0]\nn = inputs[1]\n\nprint((m - 1) * (n - 1))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1275, "memory_kb": 197384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s659491163", "group_id": "codeNet:p03636", "input_text": "x = chomp(readline())\nl=length(x)\nprint(x[1], l-2, x[l])", "language": "Julia", "metadata": {"date": 1541301324, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03636.html", "problem_id": "p03636", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03636/input.txt", "sample_output_relpath": "derived/input_output/data/p03636/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03636/Julia/s659491163.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s659491163", "user_id": "u095714878"}, "prompt_components": {"gold_output": "i18n\n", "input_to_evaluate": "x = chomp(readline())\nl=length(x)\nprint(x[1], l-2, x[l])", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThe word internationalization is sometimes abbreviated to i18n.\nThis comes from the fact that there are 18 letters between the first i and the last n.\n\nYou are given a string s of length at least 3 consisting of lowercase English letters.\nAbbreviate s in the same way.\n\nConstraints\n\n3 ≤ |s| ≤ 100 (|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\nPrint the abbreviation of s.\n\nSample Input 1\n\ninternationalization\n\nSample Output 1\n\ni18n\n\nSample Input 2\n\nsmiles\n\nSample Output 2\n\ns4s\n\nSample Input 3\n\nxyz\n\nSample Output 3\n\nx1z", "sample_input": "internationalization\n"}, "reference_outputs": ["i18n\n"], "source_document_id": "p03636", "source_text": "Score : 200 points\n\nProblem Statement\n\nThe word internationalization is sometimes abbreviated to i18n.\nThis comes from the fact that there are 18 letters between the first i and the last n.\n\nYou are given a string s of length at least 3 consisting of lowercase English letters.\nAbbreviate s in the same way.\n\nConstraints\n\n3 ≤ |s| ≤ 100 (|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\nPrint the abbreviation of s.\n\nSample Input 1\n\ninternationalization\n\nSample Output 1\n\ni18n\n\nSample Input 2\n\nsmiles\n\nSample Output 2\n\ns4s\n\nSample Input 3\n\nxyz\n\nSample Output 3\n\nx1z", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 289, "memory_kb": 109480}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s265574266", "group_id": "codeNet:p03636", "input_text": "s=readline();print(s[1],endof(s)-2,s[end-1])", "language": "Julia", "metadata": {"date": 1534900234, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03636.html", "problem_id": "p03636", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03636/input.txt", "sample_output_relpath": "derived/input_output/data/p03636/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03636/Julia/s265574266.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s265574266", "user_id": "u657913472"}, "prompt_components": {"gold_output": "i18n\n", "input_to_evaluate": "s=readline();print(s[1],endof(s)-2,s[end-1])", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThe word internationalization is sometimes abbreviated to i18n.\nThis comes from the fact that there are 18 letters between the first i and the last n.\n\nYou are given a string s of length at least 3 consisting of lowercase English letters.\nAbbreviate s in the same way.\n\nConstraints\n\n3 ≤ |s| ≤ 100 (|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\nPrint the abbreviation of s.\n\nSample Input 1\n\ninternationalization\n\nSample Output 1\n\ni18n\n\nSample Input 2\n\nsmiles\n\nSample Output 2\n\ns4s\n\nSample Input 3\n\nxyz\n\nSample Output 3\n\nx1z", "sample_input": "internationalization\n"}, "reference_outputs": ["i18n\n"], "source_document_id": "p03636", "source_text": "Score : 200 points\n\nProblem Statement\n\nThe word internationalization is sometimes abbreviated to i18n.\nThis comes from the fact that there are 18 letters between the first i and the last n.\n\nYou are given a string s of length at least 3 consisting of lowercase English letters.\nAbbreviate s in the same way.\n\nConstraints\n\n3 ≤ |s| ≤ 100 (|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\nPrint the abbreviation of s.\n\nSample Input 1\n\ninternationalization\n\nSample Output 1\n\ni18n\n\nSample Input 2\n\nsmiles\n\nSample Output 2\n\ns4s\n\nSample Input 3\n\nxyz\n\nSample Output 3\n\nx1z", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 777, "memory_kb": 163652}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s146148944", "group_id": "codeNet:p03637", "input_text": "b1=b2=b4=0\nreadline()\nfor a=map(x->parse(Int,x),split(readline()))\n if a%4==0\n b4+=1\n elseif a%2==0\n b2+=1\n else\n b1+=1\n end\nend\nprintln(b4+(b2==0)>=b1 ? \"Yes\" : \"No\")", "language": "Julia", "metadata": {"date": 1561587660, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s146148944.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s146148944", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "b1=b2=b4=0\nreadline()\nfor a=map(x->parse(Int,x),split(readline()))\n if a%4==0\n b4+=1\n elseif a%2==0\n b2+=1\n else\n b1+=1\n end\nend\nprintln(b4+(b2==0)>=b1 ? \"Yes\" : \"No\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 420, "memory_kb": 124168}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s173273374", "group_id": "codeNet:p03643", "input_text": "println(\"ABC\",chomp(readline()))", "language": "Julia", "metadata": {"date": 1546359499, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s173273374.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s173273374", "user_id": "u095714878"}, "prompt_components": {"gold_output": "ABC100\n", "input_to_evaluate": "println(\"ABC\",chomp(readline()))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 32, "cpu_time_ms": 924, "memory_kb": 167552}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s685584880", "group_id": "codeNet:p03644", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n println(2^floor(Int,log2(pI(readline()))))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end\n", "language": "Julia", "metadata": {"date": 1591543209, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s685584880.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s685584880", "user_id": "u443151804"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n println(2^floor(Int,log2(pI(readline()))))\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 300, "memory_kb": 109520}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s463146294", "group_id": "codeNet:p03645", "input_text": "function main()\n \n (N, M) = map(x -> parse(Int, x), split(readline()))\n \n T = Tuple[]\n \n check_1 = []\n check_N = []\n \n for i in 1:M\n (a, b) = map(x -> parse(Int, x), split(readline()))\n if a == 1\n push!(check_1, b)\n elseif b == N\n push!(check_N, a)\n end\n end\n \n ans = false\n \n for i in check_1, j in check_N\n if i == j\n ans = true\n end\n end \n \n if ans\n println(\"POSSIBLE\")\n else\n println(\"IMPOSSIBLE\")\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1586974992, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Julia/s463146294.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s463146294", "user_id": "u790457721"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "function main()\n \n (N, M) = map(x -> parse(Int, x), split(readline()))\n \n T = Tuple[]\n \n check_1 = []\n check_N = []\n \n for i in 1:M\n (a, b) = map(x -> parse(Int, x), split(readline()))\n if a == 1\n push!(check_1, b)\n elseif b == N\n push!(check_N, a)\n end\n end\n \n ans = false\n \n for i in check_1, j in check_N\n if i == j\n ans = true\n end\n end \n \n if ans\n println(\"POSSIBLE\")\n else\n println(\"IMPOSSIBLE\")\n end\n \nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\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\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\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\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2112, "memory_kb": 156504}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s647579266", "group_id": "codeNet:p03645", "input_text": "function main()\n \n (N, M) = map(x -> parse(Int, x), split(readline()))\n \n T = Tuple[]\n \n for i in 1:M\n (a, b) = map(x -> parse(Int, x), split(readline()))\n push!(T, (a, b))\n end\n \n ans = false\n \n for i in 1:M\n \n if T[i][1] == 1\n for j in 1:M\n if T[j][1] == T[i][2] && T[j][2] == N\n ans = true\n end\n end\n end\n \n end\n \n if ans\n println(\"POSSIBLE\")\n else\n println(\"IMPOSSIBLE\")\n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1586969963, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Julia/s647579266.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s647579266", "user_id": "u790457721"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "function main()\n \n (N, M) = map(x -> parse(Int, x), split(readline()))\n \n T = Tuple[]\n \n for i in 1:M\n (a, b) = map(x -> parse(Int, x), split(readline()))\n push!(T, (a, b))\n end\n \n ans = false\n \n for i in 1:M\n \n if T[i][1] == 1\n for j in 1:M\n if T[j][1] == T[i][2] && T[j][2] == N\n ans = true\n end\n end\n end\n \n end\n \n if ans\n println(\"POSSIBLE\")\n else\n println(\"IMPOSSIBLE\")\n end\n \nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\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\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\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\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 467, "cpu_time_ms": 2113, "memory_kb": 154044}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s826330393", "group_id": "codeNet:p03645", "input_text": "function parseInt(x) parse(Int, x) end\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n\tn, m = parseMap(split(readline()))\n\tx = [Int64[] for i in 1:n]\n\tfor i in 1:m\n\t\ta, b = parseMap(split(readline()))\n\t\tpush!(x[a], b)\n\t\tpush!(x[b], a)\n\tend\n\tflg = 0\n\tfor i in 2:n-1\n\t\tif 1 in x[i] && n in x[i]\n\t\t\tprint(\"POSSIBLE\")\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tif flg == 0\n\t\tprint(\"IMPOSSIBLE\")\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541615136, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Julia/s826330393.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s826330393", "user_id": "u095714878"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n\tn, m = parseMap(split(readline()))\n\tx = [Int64[] for i in 1:n]\n\tfor i in 1:m\n\t\ta, b = parseMap(split(readline()))\n\t\tpush!(x[a], b)\n\t\tpush!(x[b], a)\n\tend\n\tflg = 0\n\tfor i in 2:n-1\n\t\tif 1 in x[i] && n in x[i]\n\t\t\tprint(\"POSSIBLE\")\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tif flg == 0\n\t\tprint(\"IMPOSSIBLE\")\n\tend\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\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\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\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\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 426, "cpu_time_ms": 1021, "memory_kb": 159792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s844695819", "group_id": "codeNet:p03645", "input_text": "function parseInt(x) parse(Int, x) end\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n\tn, m = parseMap(split(readline()))\n\tx = [Int64[] for i in 1:n]\n\tfor i in 1:m\n\t\ta, b = parseMap(split(readline()))\n\t\tpush!(x[a], b)\n\t\tpush!(x[b], a)\n\tend\n\tflg = 0\n\tfor i in 2:n-1\n\t\tif 1 in x[i] && n in x[i]\n\t\t\tprint(\"POSSIBLE\")\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tif flg == 0\n\t\tprint(\"IMPOSSIBLE\")\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1541615105, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03645.html", "problem_id": "p03645", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03645/input.txt", "sample_output_relpath": "derived/input_output/data/p03645/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03645/Julia/s844695819.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s844695819", "user_id": "u095714878"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "function parseInt(x) parse(Int, x) end\nparseMap(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n\tn, m = parseMap(split(readline()))\n\tx = [Int64[] for i in 1:n]\n\tfor i in 1:m\n\t\ta, b = parseMap(split(readline()))\n\t\tpush!(x[a], b)\n\t\tpush!(x[b], a)\n\tend\n\tflg = 0\n\tfor i in 2:n-1\n\t\tif 1 in x[i] && n in x[i]\n\t\t\tprint(\"POSSIBLE\")\n\t\t\tflg = 1\n\t\t\tbreak\n\t\tend\n\tend\n\tif flg == 0\n\t\tprint(\"IMPOSSIBLE\")\n\tend\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\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\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03645", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.\nFor convenience, we will call them Island 1, Island 2, ..., Island N.\n\nThere are M kinds of regular boat services between these islands.\nEach service connects two islands. The i-th service connects Island a_i and Island b_i.\n\nCat Snuke is on Island 1 now, and wants to go to Island N.\nHowever, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.\n\nHelp him.\n\nConstraints\n\n3 ≤ N ≤ 200 000\n\n1 ≤ M ≤ 200 000\n\n1 ≤ a_i < b_i ≤ N\n\n(a_i, b_i) \\neq (1, N)\n\nIf i \\neq j, (a_i, b_i) \\neq (a_j, b_j).\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\nIf it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\nPOSSIBLE\n\nSample Input 2\n\n4 3\n1 2\n2 3\n3 4\n\nSample Output 2\n\nIMPOSSIBLE\n\nYou have to use three boat services to get to Island 4.\n\nSample Input 3\n\n100000 1\n1 99999\n\nSample Output 3\n\nIMPOSSIBLE\n\nSample Input 4\n\n5 5\n1 3\n4 5\n2 3\n2 4\n1 4\n\nSample Output 4\n\nPOSSIBLE\n\nYou can get to Island 5 by using two boat services: Island 1 -> Island 4 -> Island 5.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 426, "cpu_time_ms": 1993, "memory_kb": 167668}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s180746761", "group_id": "codeNet:p03646", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tk = readline() |> parseInt\n\tx = div(k,50)\n\ty = k%50\n\ta = Int[i-1 for i in 1:50]\n\ta.+= x\n\tfor i in 1:y\n\t\ta[i] += 51\n\tend\n\ta.-=y\n\tprintln(a)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1558732647, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03646.html", "problem_id": "p03646", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03646/input.txt", "sample_output_relpath": "derived/input_output/data/p03646/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03646/Julia/s180746761.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s180746761", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n3 3 3 3\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tk = readline() |> parseInt\n\tx = div(k,50)\n\ty = k%50\n\ta = Int[i-1 for i in 1:50]\n\ta.+= x\n\tfor i in 1:y\n\t\ta[i] += 51\n\tend\n\ta.-=y\n\tprintln(a)\nend\nmain()\n", "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.\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 an integer K. Find an integer sequence a_i such that the number of times we will perform the above operation is exactly K. It can be shown that there is always such a sequence under the constraints on input and output in this problem.\n\nConstraints\n\n0 ≤ K ≤ 50 \\times 10^{16}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint a solution in the following format:\n\nN\na_1 a_2 ... a_N\n\nHere, 2 ≤ N ≤ 50 and 0 ≤ a_i ≤ 10^{16} + 1000 must hold.\n\nSample Input 1\n\n0\n\nSample Output 1\n\n4\n3 3 3 3\n\nSample Input 2\n\n1\n\nSample Output 2\n\n3\n1 0 3\n\nSample Input 3\n\n2\n\nSample Output 3\n\n2\n2 2\n\nThe operation will be performed twice: [2, 2] -> [0, 3] -> [1, 1].\n\nSample Input 4\n\n3\n\nSample Output 4\n\n7\n27 0 0 0 0 0 0\n\nSample Input 5\n\n1234567894848\n\nSample Output 5\n\n10\n1000 193 256 777 0 1 1192 1234567891011 48 425", "sample_input": "0\n"}, "reference_outputs": ["4\n3 3 3 3\n"], "source_document_id": "p03646", "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.\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 an integer K. Find an integer sequence a_i such that the number of times we will perform the above operation is exactly K. It can be shown that there is always such a sequence under the constraints on input and output in this problem.\n\nConstraints\n\n0 ≤ K ≤ 50 \\times 10^{16}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nK\n\nOutput\n\nPrint a solution in the following format:\n\nN\na_1 a_2 ... a_N\n\nHere, 2 ≤ N ≤ 50 and 0 ≤ a_i ≤ 10^{16} + 1000 must hold.\n\nSample Input 1\n\n0\n\nSample Output 1\n\n4\n3 3 3 3\n\nSample Input 2\n\n1\n\nSample Output 2\n\n3\n1 0 3\n\nSample Input 3\n\n2\n\nSample Output 3\n\n2\n2 2\n\nThe operation will be performed twice: [2, 2] -> [0, 3] -> [1, 1].\n\nSample Input 4\n\n3\n\nSample Output 4\n\n7\n27 0 0 0 0 0 0\n\nSample Input 5\n\n1234567894848\n\nSample Output 5\n\n10\n1000 193 256 777 0 1 1192 1234567891011 48 425", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1160, "memory_kb": 187408}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s440883688", "group_id": "codeNet:p03651", "input_text": "read N K;julia -E\"A=parse.(split(readline()));(maximum(A)<$K||$K%gcd(A)?\"'\"IM\":\"\")~\"POSSIBLE\"'", "language": "Julia", "metadata": {"date": 1573086104, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03651.html", "problem_id": "p03651", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03651/input.txt", "sample_output_relpath": "derived/input_output/data/p03651/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03651/Julia/s440883688.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s440883688", "user_id": "u657913472"}, "prompt_components": {"gold_output": "POSSIBLE\n", "input_to_evaluate": "read N K;julia -E\"A=parse.(split(readline()));(maximum(A)<$K||$K%gcd(A)?\"'\"IM\":\"\")~\"POSSIBLE\"'", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere is a box containing N balls. The i-th ball has the integer A_i written on it.\nSnuke can perform the following operation any number of times:\n\nTake out two balls from the box. Then, return them to the box along with a new ball, on which the absolute difference of the integers written on the two balls is written.\n\nDetermine whether it is possible for Snuke to reach the state where the box contains a ball on which the integer K is written.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq K \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nIf it is possible for Snuke to reach the state where the box contains a ball on which the integer K is written, print POSSIBLE; if it is not possible, print IMPOSSIBLE.\n\nSample Input 1\n\n3 7\n9 3 4\n\nSample Output 1\n\nPOSSIBLE\n\nFirst, take out the two balls 9 and 4, and return them back along with a new ball, abs(9-4)=5.\nNext, take out 3 and 5, and return them back along with abs(3-5)=2.\nFinally, take out 9 and 2, and return them back along with abs(9-2)=7.\nNow we have 7 in the box, and the answer is therefore POSSIBLE.\n\nSample Input 2\n\n3 5\n6 9 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo matter what we do, it is not possible to have 5 in the box. The answer is therefore IMPOSSIBLE.\n\nSample Input 3\n\n4 11\n11 3 7 15\n\nSample Output 3\n\nPOSSIBLE\n\nThe box already contains 11 before we do anything. The answer is therefore POSSIBLE.\n\nSample Input 4\n\n5 12\n10 2 8 6 4\n\nSample Output 4\n\nIMPOSSIBLE", "sample_input": "3 7\n9 3 4\n"}, "reference_outputs": ["POSSIBLE\n"], "source_document_id": "p03651", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere is a box containing N balls. The i-th ball has the integer A_i written on it.\nSnuke can perform the following operation any number of times:\n\nTake out two balls from the box. Then, return them to the box along with a new ball, on which the absolute difference of the integers written on the two balls is written.\n\nDetermine whether it is possible for Snuke to reach the state where the box contains a ball on which the integer K is written.\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\n1 \\leq K \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN K\nA_1 A_2 ... A_N\n\nOutput\n\nIf it is possible for Snuke to reach the state where the box contains a ball on which the integer K is written, print POSSIBLE; if it is not possible, print IMPOSSIBLE.\n\nSample Input 1\n\n3 7\n9 3 4\n\nSample Output 1\n\nPOSSIBLE\n\nFirst, take out the two balls 9 and 4, and return them back along with a new ball, abs(9-4)=5.\nNext, take out 3 and 5, and return them back along with abs(3-5)=2.\nFinally, take out 9 and 2, and return them back along with abs(9-2)=7.\nNow we have 7 in the box, and the answer is therefore POSSIBLE.\n\nSample Input 2\n\n3 5\n6 9 3\n\nSample Output 2\n\nIMPOSSIBLE\n\nNo matter what we do, it is not possible to have 5 in the box. The answer is therefore IMPOSSIBLE.\n\nSample Input 3\n\n4 11\n11 3 7 15\n\nSample Output 3\n\nPOSSIBLE\n\nThe box already contains 11 before we do anything. The answer is therefore POSSIBLE.\n\nSample Input 4\n\n5 12\n10 2 8 6 4\n\nSample Output 4\n\nIMPOSSIBLE", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 94, "cpu_time_ms": 1117, "memory_kb": 197188}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s792065022", "group_id": "codeNet:p03657", "input_text": "a,b = parse.(split(readline()))\nif a%3==0 || b%3 == 0 || (a+b)%3==0\n print(\"Possible\")\nelse\n print(\"Impossible\")\nend", "language": "Julia", "metadata": {"date": 1541604857, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s792065022.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s792065022", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Possible\n", "input_to_evaluate": "a,b = parse.(split(readline()))\nif a%3==0 || b%3 == 0 || (a+b)%3==0\n print(\"Possible\")\nelse\n print(\"Impossible\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2107, "memory_kb": 122416}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s285591192", "group_id": "codeNet:p03657", "input_text": "a, b = parse.(split(readline()))\nif (a+b)%3 == 0\n println(\"Possible\")\nelse\n println(\"Impossible\")\nend\n", "language": "Julia", "metadata": {"date": 1500876153, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s285591192.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s285591192", "user_id": "u467412132"}, "prompt_components": {"gold_output": "Possible\n", "input_to_evaluate": "a, b = parse.(split(readline()))\nif (a+b)%3 == 0\n println(\"Possible\")\nelse\n println(\"Impossible\")\nend\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 104, "cpu_time_ms": 1042, "memory_kb": 175096}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s254177947", "group_id": "codeNet:p03657", "input_text": "(a, b) = parse.([Int], split(readline()))\n\nif a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0\n println(\"Possible\")\nelse\n println(\"Impossible\")\nend", "language": "Julia", "metadata": {"date": 1500173698, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s254177947.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s254177947", "user_id": "u872191059"}, "prompt_components": {"gold_output": "Possible\n", "input_to_evaluate": "(a, b) = parse.([Int], split(readline()))\n\nif a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0\n println(\"Possible\")\nelse\n println(\"Impossible\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 149, "cpu_time_ms": 1162, "memory_kb": 173580}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s585304802", "group_id": "codeNet:p03658", "input_text": "(n, k) = parse.([Int], split(readline()))\nls = parse.([Int], split(readline()))\n\nprintln(sum(reverse!(sort!(ls))[1:k]))", "language": "Julia", "metadata": {"date": 1500173860, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s585304802.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s585304802", "user_id": "u872191059"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "(n, k) = parse.([Int], split(readline()))\nls = parse.([Int], split(readline()))\n\nprintln(sum(reverse!(sort!(ls))[1:k]))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 119, "cpu_time_ms": 1178, "memory_kb": 178340}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s660358579", "group_id": "codeNet:p03659", "input_text": "function main()\n \n N = parse(Int,readline())\n a = map(x -> parse(Int,x), split(readline()))\n \n Su = 0\n Ar = sum(a)\n ans = 10^10\n \n for i in 1:N-1\n Su += a[i]\n Ar -= a[i]\n ans = min(ans,abs(Su-Ar))\n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1585411726, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03659.html", "problem_id": "p03659", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03659/input.txt", "sample_output_relpath": "derived/input_output/data/p03659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03659/Julia/s660358579.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s660358579", "user_id": "u790457721"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "function main()\n \n N = parse(Int,readline())\n a = map(x -> parse(Int,x), split(readline()))\n \n Su = 0\n Ar = sum(a)\n ans = 10^10\n \n for i in 1:N-1\n Su += a[i]\n Ar -= a[i]\n ans = min(ans,abs(Su-Ar))\n end\n \n println(ans)\n \nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.\n\nThey will share these cards.\nFirst, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards.\nHere, both Snuke and Raccoon have to take at least one card.\n\nLet the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively.\nThey would like to minimize |x-y|.\nFind the minimum possible value of |x-y|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n-10^{9} \\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 answer.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n1\n\nIf Snuke takes four cards from the top, and Raccoon takes the remaining two cards, x=10, y=11, and thus |x-y|=1. This is the minimum possible value.\n\nSample Input 2\n\n2\n10 -10\n\nSample Output 2\n\n20\n\nSnuke can only take one card from the top, and Raccoon can only take the remaining one card. In this case, x=10, y=-10, and thus |x-y|=20.", "sample_input": "6\n1 2 3 4 5 6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03659", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.\n\nThey will share these cards.\nFirst, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards.\nHere, both Snuke and Raccoon have to take at least one card.\n\nLet the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively.\nThey would like to minimize |x-y|.\nFind the minimum possible value of |x-y|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n-10^{9} \\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 answer.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n1\n\nIf Snuke takes four cards from the top, and Raccoon takes the remaining two cards, x=10, y=11, and thus |x-y|=1. This is the minimum possible value.\n\nSample Input 2\n\n2\n10 -10\n\nSample Output 2\n\n20\n\nSnuke can only take one card from the top, and Raccoon can only take the remaining one card. In this case, x=10, y=-10, and thus |x-y|=20.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 469, "memory_kb": 148588}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s017916665", "group_id": "codeNet:p03659", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n l=[0 for i in 1:n]\n l[1]=a[1]\n for i in 2:n\n l[i]=l[i-1]+a[i]\n end\n ans=10^10\n for i in 1:n-1\n ans=min(ans,abs(l[i]-(l[end]-l[i])))\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1584501613, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03659.html", "problem_id": "p03659", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03659/input.txt", "sample_output_relpath": "derived/input_output/data/p03659/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03659/Julia/s017916665.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s017916665", "user_id": "u619197965"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n l=[0 for i in 1:n]\n l[1]=a[1]\n for i in 2:n\n l[i]=l[i-1]+a[i]\n end\n ans=10^10\n for i in 1:n-1\n ans=min(ans,abs(l[i]-(l[end]-l[i])))\n end\n println(ans)\nend\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.\n\nThey will share these cards.\nFirst, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards.\nHere, both Snuke and Raccoon have to take at least one card.\n\nLet the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively.\nThey would like to minimize |x-y|.\nFind the minimum possible value of |x-y|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n-10^{9} \\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 answer.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n1\n\nIf Snuke takes four cards from the top, and Raccoon takes the remaining two cards, x=10, y=11, and thus |x-y|=1. This is the minimum possible value.\n\nSample Input 2\n\n2\n10 -10\n\nSample Output 2\n\n20\n\nSnuke can only take one card from the top, and Raccoon can only take the remaining one card. In this case, x=10, y=-10, and thus |x-y|=20.", "sample_input": "6\n1 2 3 4 5 6\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03659", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke and Raccoon have a heap of N cards. The i-th card from the top has the integer a_i written on it.\n\nThey will share these cards.\nFirst, Snuke will take some number of cards from the top of the heap, then Raccoon will take all the remaining cards.\nHere, both Snuke and Raccoon have to take at least one card.\n\nLet the sum of the integers on Snuke's cards and Raccoon's cards be x and y, respectively.\nThey would like to minimize |x-y|.\nFind the minimum possible value of |x-y|.\n\nConstraints\n\n2 \\leq N \\leq 2 \\times 10^5\n\n-10^{9} \\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 answer.\n\nSample Input 1\n\n6\n1 2 3 4 5 6\n\nSample Output 1\n\n1\n\nIf Snuke takes four cards from the top, and Raccoon takes the remaining two cards, x=10, y=11, and thus |x-y|=1. This is the minimum possible value.\n\nSample Input 2\n\n2\n10 -10\n\nSample Output 2\n\n20\n\nSnuke can only take one card from the top, and Raccoon can only take the remaining one card. In this case, x=10, y=-10, and thus |x-y|=20.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 885, "memory_kb": 170836}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s338960505", "group_id": "codeNet:p03662", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction root(uf::Array{Int,1},x);s=x;while uf[s]>0;s=uf[s];end;s;end\nfunction same(uf::Array{Int,1},x,y);root(uf,x)==root(uf,y)?true:false;end\nfunction unite(uf::Array{Int,1},x,y);l=root(uf,x);r=root(uf,y);if lr;uf[r]+=uf[l];uf[l]=r;end;end\n\nfunction main()\n\tn = readline() |> parseInt\n\te = [Int[] for i in 1:n]\n\tda = Array{Int}(2,n-1)\n\tfor i in 1:n-1\n\t\tda[:,i] = readline() |> split |> parseMap\n\t\tpush!(e[da[1,i]],da[2,i])\n\t\tpush!(e[da[2,i]],da[1,i])\n\tend\n\tc = -ones(Int,n)\n\tc[1] = 0\n\td = -ones(Int,n)\n\td[n] = 0\n\ts = Int[1]\n\twhile !isempty(s)\n\t\tnow = shift!(s)\n\t\tfor i in 1:length(e[now])\n\t\t\tif c[e[now][i]] < 0\n\t\t\t\tpush!(s,e[now][i])\n\t\t\t\tc[e[now][i]] = c[now]+1\n\t\t\tend\n\t\tend\n\tend\n\ts = Int[n]\n\twhile !isempty(s)\n\t\tnow = shift!(s)\n\t\tfor i in 1:length(e[now])\n\t\t\tif d[e[now][i]] < 0\n\t\t\t\tpush!(s,e[now][i])\n\t\t\t\td[e[now][i]] = d[now]+1\n\t\t\tend\n\t\tend\n\tend\n\tth = div(c[n]+1,2)\n\tti = c[n]-th\n\to = 1\n\tp = n\n\tfor i in 2:n-1\n\t\tif c[i]==th && d[i]==ti\n\t\t\to = i\n\t\tend\n\t\tif c[i] == th+1 && d[i] == ti-1\n\t\t\tp = i\n\t\tend\n\tend\n\tuf = -ones(Int,n)\n\tfor i in 1:n-1\n\t\tif da[:,i] != [o,p] && da[:,i] != [p,o]\n\t\t\tunite(uf,da[1,i],da[2,i])\n\t\tend\n\tend\n\tprintln(uf[root(uf,1)]<=uf[root(uf,n)]?\"Fennec\":\"Snuke\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1567636833, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03662.html", "problem_id": "p03662", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03662/input.txt", "sample_output_relpath": "derived/input_output/data/p03662/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03662/Julia/s338960505.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s338960505", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Fennec\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction root(uf::Array{Int,1},x);s=x;while uf[s]>0;s=uf[s];end;s;end\nfunction same(uf::Array{Int,1},x,y);root(uf,x)==root(uf,y)?true:false;end\nfunction unite(uf::Array{Int,1},x,y);l=root(uf,x);r=root(uf,y);if lr;uf[r]+=uf[l];uf[l]=r;end;end\n\nfunction main()\n\tn = readline() |> parseInt\n\te = [Int[] for i in 1:n]\n\tda = Array{Int}(2,n-1)\n\tfor i in 1:n-1\n\t\tda[:,i] = readline() |> split |> parseMap\n\t\tpush!(e[da[1,i]],da[2,i])\n\t\tpush!(e[da[2,i]],da[1,i])\n\tend\n\tc = -ones(Int,n)\n\tc[1] = 0\n\td = -ones(Int,n)\n\td[n] = 0\n\ts = Int[1]\n\twhile !isempty(s)\n\t\tnow = shift!(s)\n\t\tfor i in 1:length(e[now])\n\t\t\tif c[e[now][i]] < 0\n\t\t\t\tpush!(s,e[now][i])\n\t\t\t\tc[e[now][i]] = c[now]+1\n\t\t\tend\n\t\tend\n\tend\n\ts = Int[n]\n\twhile !isempty(s)\n\t\tnow = shift!(s)\n\t\tfor i in 1:length(e[now])\n\t\t\tif d[e[now][i]] < 0\n\t\t\t\tpush!(s,e[now][i])\n\t\t\t\td[e[now][i]] = d[now]+1\n\t\t\tend\n\t\tend\n\tend\n\tth = div(c[n]+1,2)\n\tti = c[n]-th\n\to = 1\n\tp = n\n\tfor i in 2:n-1\n\t\tif c[i]==th && d[i]==ti\n\t\t\to = i\n\t\tend\n\t\tif c[i] == th+1 && d[i] == ti-1\n\t\t\tp = i\n\t\tend\n\tend\n\tuf = -ones(Int,n)\n\tfor i in 1:n-1\n\t\tif da[:,i] != [o,p] && da[:,i] != [p,o]\n\t\t\tunite(uf,da[1,i],da[2,i])\n\t\tend\n\tend\n\tprintln(uf[root(uf,1)]<=uf[root(uf,n)]?\"Fennec\":\"Snuke\")\nend\n\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nFennec and Snuke are playing a board game.\n\nOn the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeatedly traveling to an adjacent cell. In terms of graph theory, the graph formed by the cells and the roads is a tree.\n\nInitially, Cell 1 is painted black, and Cell N is painted white. The other cells are not yet colored.\nFennec (who goes first) and Snuke (who goes second) alternately paint an uncolored cell.\nMore specifically, each player performs the following action in her/his turn:\n\nFennec: selects an uncolored cell that is adjacent to a black cell, and paints it black.\n\nSnuke: selects an uncolored cell that is adjacent to a white cell, and paints it white.\n\nA player loses when she/he cannot paint a cell. Determine the winner of the game when Fennec and Snuke play optimally.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i \\leq N\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}\n\nOutput\n\nIf Fennec wins, print Fennec; if Snuke wins, print Snuke.\n\nSample Input 1\n\n7\n3 6\n1 2\n3 1\n7 4\n5 7\n1 4\n\nSample Output 1\n\nFennec\n\nFor example, if Fennec first paints Cell 2 black, she will win regardless of Snuke's moves.\n\nSample Input 2\n\n4\n1 4\n4 2\n2 3\n\nSample Output 2\n\nSnuke", "sample_input": "7\n3 6\n1 2\n3 1\n7 4\n5 7\n1 4\n"}, "reference_outputs": ["Fennec\n"], "source_document_id": "p03662", "source_text": "Score : 400 points\n\nProblem Statement\n\nFennec and Snuke are playing a board game.\n\nOn the board, there are N cells numbered 1 through N, and N-1 roads, each connecting two cells. Cell a_i is adjacent to Cell b_i through the i-th road. Every cell can be reached from every other cell by repeatedly traveling to an adjacent cell. In terms of graph theory, the graph formed by the cells and the roads is a tree.\n\nInitially, Cell 1 is painted black, and Cell N is painted white. The other cells are not yet colored.\nFennec (who goes first) and Snuke (who goes second) alternately paint an uncolored cell.\nMore specifically, each player performs the following action in her/his turn:\n\nFennec: selects an uncolored cell that is adjacent to a black cell, and paints it black.\n\nSnuke: selects an uncolored cell that is adjacent to a white cell, and paints it white.\n\nA player loses when she/he cannot paint a cell. Determine the winner of the game when Fennec and Snuke play optimally.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq a_i, b_i \\leq N\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}\n\nOutput\n\nIf Fennec wins, print Fennec; if Snuke wins, print Snuke.\n\nSample Input 1\n\n7\n3 6\n1 2\n3 1\n7 4\n5 7\n1 4\n\nSample Output 1\n\nFennec\n\nFor example, if Fennec first paints Cell 2 black, she will win regardless of Snuke's moves.\n\nSample Input 2\n\n4\n1 4\n4 2\n2 3\n\nSample Output 2\n\nSnuke", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1317, "cpu_time_ms": 1282, "memory_kb": 179240}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s291450640", "group_id": "codeNet:p03666", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,a,b,c,d = readline() |> split |> parseMap\n\tf = 0\n\tfor i in 0:n-1\n\t\tif i*(-d)+(n-i-1)*c<=b-a<=i*(-c)+(n-i-1)*d\n\t\t\tf = 1\n\t\tend\n\tend\n\tprintln(f==1?\"YES\":\"NO\")\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1576610928, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03666.html", "problem_id": "p03666", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03666/input.txt", "sample_output_relpath": "derived/input_output/data/p03666/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03666/Julia/s291450640.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s291450640", "user_id": "u095714878"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,a,b,c,d = readline() |> split |> parseMap\n\tf = 0\n\tfor i in 0:n-1\n\t\tif i*(-d)+(n-i-1)*c<=b-a<=i*(-c)+(n-i-1)*d\n\t\t\tf = 1\n\t\tend\n\tend\n\tprintln(f==1?\"YES\":\"NO\")\nend\n\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares in a row.\nThe leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty.\n\nAohashi would like to fill the empty squares with integers so that the following condition is satisfied:\n\nFor any two adjacent squares, the (absolute) difference of the two integers in those squares is between C and D (inclusive).\n\nAs long as the condition is satisfied, it is allowed to use arbitrarily large or small integers to fill the squares.\nDetermine whether it is possible to fill the squares under the condition.\n\nConstraints\n\n3 \\leq N \\leq 500000\n\n0 \\leq A \\leq 10^9\n\n0 \\leq B \\leq 10^9\n\n0 \\leq C \\leq D \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\n\nOutput\n\nPrint YES if it is possible to fill the squares under the condition; print NO otherwise.\n\nSample Input 1\n\n5 1 5 2 4\n\nSample Output 1\n\nYES\n\nFor example, fill the squares with the following integers: 1, -1, 3, 7, 5, from left to right.\n\nSample Input 2\n\n4 7 6 4 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n48792 105960835 681218449 90629745 90632170\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n491995 412925347 825318103 59999126 59999339\n\nSample Output 4\n\nYES", "sample_input": "5 1 5 2 4\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03666", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares in a row.\nThe leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty.\n\nAohashi would like to fill the empty squares with integers so that the following condition is satisfied:\n\nFor any two adjacent squares, the (absolute) difference of the two integers in those squares is between C and D (inclusive).\n\nAs long as the condition is satisfied, it is allowed to use arbitrarily large or small integers to fill the squares.\nDetermine whether it is possible to fill the squares under the condition.\n\nConstraints\n\n3 \\leq N \\leq 500000\n\n0 \\leq A \\leq 10^9\n\n0 \\leq B \\leq 10^9\n\n0 \\leq C \\leq D \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\n\nOutput\n\nPrint YES if it is possible to fill the squares under the condition; print NO otherwise.\n\nSample Input 1\n\n5 1 5 2 4\n\nSample Output 1\n\nYES\n\nFor example, fill the squares with the following integers: 1, -1, 3, 7, 5, from left to right.\n\nSample Input 2\n\n4 7 6 4 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n48792 105960835 681218449 90629745 90632170\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n491995 412925347 825318103 59999126 59999339\n\nSample Output 4\n\nYES", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 351, "memory_kb": 110348}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s938238243", "group_id": "codeNet:p03666", "input_text": "(n, a, b, c, d) = parse.([Int], split(readline()))\n\nf(m) = a + m * c - (n - 1 - m) * d <= b && b <= a + m * d - (n - 1 - m) * c\nprintln(any(map(f, [m for m in 0:n-1]))? \"YES\" : \"NO\")", "language": "Julia", "metadata": {"date": 1499660363, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03666.html", "problem_id": "p03666", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03666/input.txt", "sample_output_relpath": "derived/input_output/data/p03666/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03666/Julia/s938238243.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s938238243", "user_id": "u872191059"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "(n, a, b, c, d) = parse.([Int], split(readline()))\n\nf(m) = a + m * c - (n - 1 - m) * d <= b && b <= a + m * d - (n - 1 - m) * c\nprintln(any(map(f, [m for m in 0:n-1]))? \"YES\" : \"NO\")", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N squares in a row.\nThe leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty.\n\nAohashi would like to fill the empty squares with integers so that the following condition is satisfied:\n\nFor any two adjacent squares, the (absolute) difference of the two integers in those squares is between C and D (inclusive).\n\nAs long as the condition is satisfied, it is allowed to use arbitrarily large or small integers to fill the squares.\nDetermine whether it is possible to fill the squares under the condition.\n\nConstraints\n\n3 \\leq N \\leq 500000\n\n0 \\leq A \\leq 10^9\n\n0 \\leq B \\leq 10^9\n\n0 \\leq C \\leq D \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\n\nOutput\n\nPrint YES if it is possible to fill the squares under the condition; print NO otherwise.\n\nSample Input 1\n\n5 1 5 2 4\n\nSample Output 1\n\nYES\n\nFor example, fill the squares with the following integers: 1, -1, 3, 7, 5, from left to right.\n\nSample Input 2\n\n4 7 6 4 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n48792 105960835 681218449 90629745 90632170\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n491995 412925347 825318103 59999126 59999339\n\nSample Output 4\n\nYES", "sample_input": "5 1 5 2 4\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03666", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N squares in a row.\nThe leftmost square contains the integer A, and the rightmost contains the integer B. The other squares are empty.\n\nAohashi would like to fill the empty squares with integers so that the following condition is satisfied:\n\nFor any two adjacent squares, the (absolute) difference of the two integers in those squares is between C and D (inclusive).\n\nAs long as the condition is satisfied, it is allowed to use arbitrarily large or small integers to fill the squares.\nDetermine whether it is possible to fill the squares under the condition.\n\nConstraints\n\n3 \\leq N \\leq 500000\n\n0 \\leq A \\leq 10^9\n\n0 \\leq B \\leq 10^9\n\n0 \\leq C \\leq D \\leq 10^9\n\nAll input values are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN A B C D\n\nOutput\n\nPrint YES if it is possible to fill the squares under the condition; print NO otherwise.\n\nSample Input 1\n\n5 1 5 2 4\n\nSample Output 1\n\nYES\n\nFor example, fill the squares with the following integers: 1, -1, 3, 7, 5, from left to right.\n\nSample Input 2\n\n4 7 6 4 5\n\nSample Output 2\n\nNO\n\nSample Input 3\n\n48792 105960835 681218449 90629745 90632170\n\nSample Output 3\n\nNO\n\nSample Input 4\n\n491995 412925347 825318103 59999126 59999339\n\nSample Output 4\n\nYES", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 182, "cpu_time_ms": 1068, "memory_kb": 155596}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s817357871", "group_id": "codeNet:p03667", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tf = zeros(Int,n)\n\td = Dict{Int,Int}()\n\tfor i in 1:n\n\t\tif haskey(d,a[i])\n\t\t\td[a[i]] += 1\n\t\telse\n\t\t\td[a[i]] = 1\n\t\tend\n\tend\n\tfor i in keys(d)\n\t\tfor j in 0:d[i]-1\n\t\t\tif i-j>0\n\t\t\t\tf[i-j] += 1\n\t\t\tend\n\t\tend\n\tend\n\ts = 0\n\tfor i in 1:n\n\t\tif f[i] == 0\n\t\t\ts += 1\n\t\tend\n\tend\n\tfor i in 1:m\n\t\tx,y = readline() |> split |> parseMap\n\t\tif a[x]-d[a[x]]+1>0\n\t\t\tf[a[x]-d[a[x]]+1] -= 1\n\t\t\tif f[a[x]-d[a[x]]+1] == 0\n\t\t\t\ts += 1\n\t\t\tend\n\t\tend\n\t\td[a[x]] -= 1\n\t\tif haskey(d,y)\n\t\t\td[y] += 1\n\t\telse\n\t\t\td[y] = 1\n\t\tend\n\t\ta[x] = y\n\t\tif y-d[y]+1>0\n\t\t\tif f[y-d[y]+1] == 0\n\t\t\t\ts -= 1\n\t\t\tend\n\t\t\tf[y-d[y]+1] += 1\n\t\tend\n\t\tprintln(s)\n\tend\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1576627739, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03667.html", "problem_id": "p03667", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03667/input.txt", "sample_output_relpath": "derived/input_output/data/p03667/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03667/Julia/s817357871.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s817357871", "user_id": "u095714878"}, "prompt_components": {"gold_output": "0\n1\n1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\ta = readline() |> split |> parseMap\n\tf = zeros(Int,n)\n\td = Dict{Int,Int}()\n\tfor i in 1:n\n\t\tif haskey(d,a[i])\n\t\t\td[a[i]] += 1\n\t\telse\n\t\t\td[a[i]] = 1\n\t\tend\n\tend\n\tfor i in keys(d)\n\t\tfor j in 0:d[i]-1\n\t\t\tif i-j>0\n\t\t\t\tf[i-j] += 1\n\t\t\tend\n\t\tend\n\tend\n\ts = 0\n\tfor i in 1:n\n\t\tif f[i] == 0\n\t\t\ts += 1\n\t\tend\n\tend\n\tfor i in 1:m\n\t\tx,y = readline() |> split |> parseMap\n\t\tif a[x]-d[a[x]]+1>0\n\t\t\tf[a[x]-d[a[x]]+1] -= 1\n\t\t\tif f[a[x]-d[a[x]]+1] == 0\n\t\t\t\ts += 1\n\t\t\tend\n\t\tend\n\t\td[a[x]] -= 1\n\t\tif haskey(d,y)\n\t\t\td[y] += 1\n\t\telse\n\t\t\td[y] = 1\n\t\tend\n\t\ta[x] = y\n\t\tif y-d[y]+1>0\n\t\t\tif f[y-d[y]+1] == 0\n\t\t\t\ts -= 1\n\t\t\tend\n\t\t\tf[y-d[y]+1] += 1\n\t\tend\n\t\tprintln(s)\n\tend\nend\n\nmain()\n", "problem_context": "Score : 1000 points\n\nProblem Statement\n\nThere are N balls in a row.\nInitially, the i-th ball from the left has the integer A_i written on it.\n\nWhen Snuke cast a spell, the following happens:\n\nLet the current number of balls be k. All the balls with k written on them disappear at the same time.\n\nSnuke's objective is to vanish all the balls by casting the spell some number of times.\nThis may not be possible as it is. If that is the case, he would like to modify the integers on the minimum number of balls to make his objective achievable.\n\nBy the way, the integers on these balls sometimes change by themselves.\nThere will be M such changes. In the j-th change, the integer on the X_j-th ball from the left will change into Y_j.\n\nAfter each change, find the minimum number of modifications of integers on the balls Snuke needs to make if he wishes to achieve his objective before the next change occurs. We will assume that he is quick enough in modifying integers. Here, note that he does not actually perform those necessary modifications and leaves them as they are.\n\nConstraints\n\n1 \\leq N \\leq 200000\n\n1 \\leq M \\leq 200000\n\n1 \\leq A_i \\leq N\n\n1 \\leq X_j \\leq N\n\n1 \\leq Y_j \\leq N\n\nSubscore\n\nIn the test set worth 500 points, N \\leq 200 and M \\leq 200.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nX_1 Y_1\nX_2 Y_2\n:\nX_M Y_M\n\nOutput\n\nPrint M lines.\nThe j-th line should contain the minimum necessary number of modifications of integers on the balls to make Snuke's objective achievable.\n\nSample Input 1\n\n5 3\n1 1 3 4 5\n1 2\n2 5\n5 4\n\nSample Output 1\n\n0\n1\n1\n\nAfter the first change, the integers on the balls become 2, 1, 3, 4, 5, from left to right. Here, all the balls can be vanished by casting the spell five times. Thus, no modification is necessary.\n\nAfter the second change, the integers on the balls become 2, 5, 3, 4, 5, from left to right. In this case, at least one modification must be made. One optimal solution is to modify the integer on the fifth ball from the left to 2, and cast the spell four times.\n\nAfter the third change, the integers on the balls become 2, 5, 3, 4, 4, from left to right. Also in this case, at least one modification must be made. One optimal solution is to modify the integer on the third ball from the left to 2, and cast the spell three times.\n\nSample Input 2\n\n4 4\n4 4 4 4\n4 1\n3 1\n1 1\n2 1\n\nSample Output 2\n\n0\n1\n2\n3\n\nSample Input 3\n\n10 10\n8 7 2 9 10 6 6 5 5 4\n8 1\n6 3\n6 2\n7 10\n9 7\n9 9\n2 4\n8 1\n1 8\n7 7\n\nSample Output 3\n\n1\n0\n1\n2\n2\n3\n3\n3\n3\n2", "sample_input": "5 3\n1 1 3 4 5\n1 2\n2 5\n5 4\n"}, "reference_outputs": ["0\n1\n1\n"], "source_document_id": "p03667", "source_text": "Score : 1000 points\n\nProblem Statement\n\nThere are N balls in a row.\nInitially, the i-th ball from the left has the integer A_i written on it.\n\nWhen Snuke cast a spell, the following happens:\n\nLet the current number of balls be k. All the balls with k written on them disappear at the same time.\n\nSnuke's objective is to vanish all the balls by casting the spell some number of times.\nThis may not be possible as it is. If that is the case, he would like to modify the integers on the minimum number of balls to make his objective achievable.\n\nBy the way, the integers on these balls sometimes change by themselves.\nThere will be M such changes. In the j-th change, the integer on the X_j-th ball from the left will change into Y_j.\n\nAfter each change, find the minimum number of modifications of integers on the balls Snuke needs to make if he wishes to achieve his objective before the next change occurs. We will assume that he is quick enough in modifying integers. Here, note that he does not actually perform those necessary modifications and leaves them as they are.\n\nConstraints\n\n1 \\leq N \\leq 200000\n\n1 \\leq M \\leq 200000\n\n1 \\leq A_i \\leq N\n\n1 \\leq X_j \\leq N\n\n1 \\leq Y_j \\leq N\n\nSubscore\n\nIn the test set worth 500 points, N \\leq 200 and M \\leq 200.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\nA_1 A_2 ... A_N\nX_1 Y_1\nX_2 Y_2\n:\nX_M Y_M\n\nOutput\n\nPrint M lines.\nThe j-th line should contain the minimum necessary number of modifications of integers on the balls to make Snuke's objective achievable.\n\nSample Input 1\n\n5 3\n1 1 3 4 5\n1 2\n2 5\n5 4\n\nSample Output 1\n\n0\n1\n1\n\nAfter the first change, the integers on the balls become 2, 1, 3, 4, 5, from left to right. Here, all the balls can be vanished by casting the spell five times. Thus, no modification is necessary.\n\nAfter the second change, the integers on the balls become 2, 5, 3, 4, 5, from left to right. In this case, at least one modification must be made. One optimal solution is to modify the integer on the fifth ball from the left to 2, and cast the spell four times.\n\nAfter the third change, the integers on the balls become 2, 5, 3, 4, 4, from left to right. Also in this case, at least one modification must be made. One optimal solution is to modify the integer on the third ball from the left to 2, and cast the spell three times.\n\nSample Input 2\n\n4 4\n4 4 4 4\n4 1\n3 1\n1 1\n2 1\n\nSample Output 2\n\n0\n1\n2\n3\n\nSample Input 3\n\n10 10\n8 7 2 9 10 6 6 5 5 4\n8 1\n6 3\n6 2\n7 10\n9 7\n9 9\n2 4\n8 1\n1 8\n7 7\n\nSample Output 3\n\n1\n0\n1\n2\n2\n3\n3\n3\n3\n2", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1590, "memory_kb": 176756}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s089892562", "group_id": "codeNet:p03672", "input_text": "function main()\n \n s = split(chomp(readline()),\"\")\n\n pop!(s)\n\n count = 0\n \n while true\n \n if length(s) % 2 == 0\n\n for i in 1:div(length(s),2)\n\n if s[i] == s[i+div(length(s),2)]\n count += 1\n else\n check = false\n end\n \n end\n \n end\n\n if count == div(length(s),2)\n break\n elseif length(s) == 0\n break\n end\n \n pop!(s)\n count = 0\n end\n \n println(length(s))\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1578600499, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03672.html", "problem_id": "p03672", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03672/input.txt", "sample_output_relpath": "derived/input_output/data/p03672/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03672/Julia/s089892562.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s089892562", "user_id": "u790457721"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "function main()\n \n s = split(chomp(readline()),\"\")\n\n pop!(s)\n\n count = 0\n \n while true\n \n if length(s) % 2 == 0\n\n for i in 1:div(length(s),2)\n\n if s[i] == s[i+div(length(s),2)]\n count += 1\n else\n check = false\n end\n \n end\n \n end\n\n if count == div(length(s),2)\n break\n elseif length(s) == 0\n break\n end\n \n pop!(s)\n count = 0\n end\n \n println(length(s))\n \nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nWe will call a string that can be obtained by concatenating two equal strings an even string.\nFor example, xyzxyz and aaaaaa are even, while ababab and xyzxy are not.\n\nYou are given an even string S consisting of lowercase English letters.\nFind the length of the longest even string that can be obtained by deleting one or more characters from the end of S.\nIt is guaranteed that such a non-empty string exists for a given input.\n\nConstraints\n\n2 \\leq |S| \\leq 200\n\nS is an even string consisting of lowercase English letters.\n\nThere exists a non-empty even string that can be obtained by deleting one or more characters from the end of S.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest even string that can be obtained.\n\nSample Input 1\n\nabaababaab\n\nSample Output 1\n\n6\n\nabaababaab itself is even, but we need to delete at least one character.\n\nabaababaa is not even.\n\nabaababa is not even.\n\nabaabab is not even.\n\nabaaba is even. Thus, we should print its length, 6.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\n2\n\nxxx is not even.\n\nxx is even.\n\nSample Input 3\n\nabcabcabcabc\n\nSample Output 3\n\n6\n\nThe longest even string that can be obtained is abcabc, whose length is 6.\n\nSample Input 4\n\nakasakaakasakasakaakas\n\nSample Output 4\n\n14\n\nThe longest even string that can be obtained is akasakaakasaka, whose length is 14.", "sample_input": "abaababaab\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03672", "source_text": "Score : 200 points\n\nProblem Statement\n\nWe will call a string that can be obtained by concatenating two equal strings an even string.\nFor example, xyzxyz and aaaaaa are even, while ababab and xyzxy are not.\n\nYou are given an even string S consisting of lowercase English letters.\nFind the length of the longest even string that can be obtained by deleting one or more characters from the end of S.\nIt is guaranteed that such a non-empty string exists for a given input.\n\nConstraints\n\n2 \\leq |S| \\leq 200\n\nS is an even string consisting of lowercase English letters.\n\nThere exists a non-empty even string that can be obtained by deleting one or more characters from the end of S.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint the length of the longest even string that can be obtained.\n\nSample Input 1\n\nabaababaab\n\nSample Output 1\n\n6\n\nabaababaab itself is even, but we need to delete at least one character.\n\nabaababaa is not even.\n\nabaababa is not even.\n\nabaabab is not even.\n\nabaaba is even. Thus, we should print its length, 6.\n\nSample Input 2\n\nxxxx\n\nSample Output 2\n\n2\n\nxxx is not even.\n\nxx is even.\n\nSample Input 3\n\nabcabcabcabc\n\nSample Output 3\n\n6\n\nThe longest even string that can be obtained is abcabc, whose length is 6.\n\nSample Input 4\n\nakasakaakasakasakaakas\n\nSample Output 4\n\n14\n\nThe longest even string that can be obtained is akasakaakasaka, whose length is 14.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 344, "memory_kb": 110480}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s785660601", "group_id": "codeNet:p03673", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n b=Vector{Int}()\n muki=true\n for i in a\n push!(b,i)\n reverse!(b)\n end\n println(join(b,\" \"))\nend\nmain()", "language": "Julia", "metadata": {"date": 1584502348, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s785660601.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s785660601", "user_id": "u619197965"}, "prompt_components": {"gold_output": "4 2 1 3\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n b=Vector{Int}()\n muki=true\n for i in a\n push!(b,i)\n reverse!(b)\n end\n println(join(b,\" \"))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 596, "cpu_time_ms": 2111, "memory_kb": 127364}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s226889017", "group_id": "codeNet:p03674", "input_text": "N=parse(Int,readline())\nap=[0 for _=1:N]\nid=1\nL=R=-1\nfor a=map(x->parse(Int,x),split(readline()))\n\tif ap[a]>0\n\t\tL,R=ap[a],id\n\t\tbreak\n\tend\n\tap[a]=id\n\tid+=1\nend\nmod=10^9+7\nF=Int[1]\nfor i=1:N+1\n\tpush!(F,F[end]*i%mod)\nend\nI=[1 for _=1:N+2]\nI[N+2]=invmod(F[N+2],mod)\nfor i=N+1:-1:1\n\tI[i]=I[i+1]*i%mod\nend\nb(n,r)=n>=r ? F[n+1]*I[n-r+1]%mod*I[r+1]%mod : 0\nfor k=1:N+1\n\tprintln((b(N+1,k)-b(L+N-R,k-1)+mod)%mod)\nend\n", "language": "Julia", "metadata": {"date": 1561603292, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03674.html", "problem_id": "p03674", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03674/input.txt", "sample_output_relpath": "derived/input_output/data/p03674/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03674/Julia/s226889017.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s226889017", "user_id": "u657913472"}, "prompt_components": {"gold_output": "3\n5\n4\n1\n", "input_to_evaluate": "N=parse(Int,readline())\nap=[0 for _=1:N]\nid=1\nL=R=-1\nfor a=map(x->parse(Int,x),split(readline()))\n\tif ap[a]>0\n\t\tL,R=ap[a],id\n\t\tbreak\n\tend\n\tap[a]=id\n\tid+=1\nend\nmod=10^9+7\nF=Int[1]\nfor i=1:N+1\n\tpush!(F,F[end]*i%mod)\nend\nI=[1 for _=1:N+2]\nI[N+2]=invmod(F[N+2],mod)\nfor i=N+1:-1:1\n\tI[i]=I[i+1]*i%mod\nend\nb(n,r)=n>=r ? F[n+1]*I[n-r+1]%mod*I[r+1]%mod : 0\nfor k=1:N+1\n\tprintln((b(N+1,k)-b(L+N-R,k-1)+mod)%mod)\nend\n", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\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+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "sample_input": "3\n1 2 1 3\n"}, "reference_outputs": ["3\n5\n4\n1\n"], "source_document_id": "p03674", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\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+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 407, "cpu_time_ms": 896, "memory_kb": 157616}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s606085759", "group_id": "codeNet:p03676", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction abmp(a,b,p);if b==0;1;elseif b%2==0;k=abmp(a,div(b,2),p);(k*k)%p;else;(a*abmp(a,b-1,p))%p;end;end;;\nfunction binarr(n,p);z=1;for i in 1:n;z=z*i%p;end;fac=Array{Int}(n+1);inv=Array{Int}(n+1);inv[n+1]=abmp(z,p-2,p)\nfor i in 0:n-1;inv[n-i]=(inv[n+1-i]*(n-i))%p;end;for i in 0:n;fac[i+1]=(((z*inv[i+1])%p)*inv[n+1-i])%p;end;fac;end;\nmod(a,p)=a<0?a+p:a\n\nfunction main()\n\tp = 10^9+7\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tc = zeros(Int,n)\n\td = [0,0]\n\tfor i in 1:n+1\n\t\tif c[a[i]] == 0\n\t\t\tc[a[i]] = i\n\t\telse\n\t\t\td[1] = c[a[i]]\n\t\t\td[2] = i\n\t\t\tbreak\n\t\tend\n\tend\n\tb = binarr(n+1,p)\n\tl = binarr(d[1]+n-d[2],p)\n\tfor i in 1:n+1\n\t\tif i<=d[1]+n-d[2]+1\n\t\t\tprintln(mod(b[i+1]-l[i],p))\n\t\telse\n\t\t\tprintln(b[i+1])\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1565916765, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03676.html", "problem_id": "p03676", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03676/input.txt", "sample_output_relpath": "derived/input_output/data/p03676/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03676/Julia/s606085759.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s606085759", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n5\n4\n1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\nfunction abmp(a,b,p);if b==0;1;elseif b%2==0;k=abmp(a,div(b,2),p);(k*k)%p;else;(a*abmp(a,b-1,p))%p;end;end;;\nfunction binarr(n,p);z=1;for i in 1:n;z=z*i%p;end;fac=Array{Int}(n+1);inv=Array{Int}(n+1);inv[n+1]=abmp(z,p-2,p)\nfor i in 0:n-1;inv[n-i]=(inv[n+1-i]*(n-i))%p;end;for i in 0:n;fac[i+1]=(((z*inv[i+1])%p)*inv[n+1-i])%p;end;fac;end;\nmod(a,p)=a<0?a+p:a\n\nfunction main()\n\tp = 10^9+7\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tc = zeros(Int,n)\n\td = [0,0]\n\tfor i in 1:n+1\n\t\tif c[a[i]] == 0\n\t\t\tc[a[i]] = i\n\t\telse\n\t\t\td[1] = c[a[i]]\n\t\t\td[2] = i\n\t\t\tbreak\n\t\tend\n\tend\n\tb = binarr(n+1,p)\n\tl = binarr(d[1]+n-d[2],p)\n\tfor i in 1:n+1\n\t\tif i<=d[1]+n-d[2]+1\n\t\t\tprintln(mod(b[i+1]-l[i],p))\n\t\telse\n\t\t\tprintln(b[i+1])\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\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+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "sample_input": "3\n1 2 1 3\n"}, "reference_outputs": ["3\n5\n4\n1\n"], "source_document_id": "p03676", "source_text": "Score : 600 points\n\nProblem Statement\n\nYou are given an integer sequence of length n+1, a_1,a_2,...,a_{n+1}, which consists of the n integers 1,...,n.\nIt is known that each of the n integers 1,...,n appears at least once in this sequence.\n\nFor each integer k=1,...,n+1, find the number of the different subsequences (not necessarily contiguous) of the given sequence with length k, modulo 10^9+7.\n\nNotes\n\nIf the contents of two subsequences are the same, they are not separately counted even if they originate from different positions in the original sequence.\n\nA subsequence of a sequence a with length k is a sequence obtained by selecting k of the elements of a and arranging them without changing their relative order. For example, the sequences 1,3,5 and 1,2,3 are subsequences of 1,2,3,4,5, while 3,1,2 and 1,10,100 are not.\n\nConstraints\n\n1 \\leq n \\leq 10^5\n\n1 \\leq a_i \\leq n\n\nEach of the integers 1,...,n appears in the sequence.\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+1}\n\nOutput\n\nPrint n+1 lines.\nThe k-th line should contain the number of the different subsequences of the given sequence with length k, modulo 10^9+7.\n\nSample Input 1\n\n3\n1 2 1 3\n\nSample Output 1\n\n3\n5\n4\n1\n\nThere are three subsequences with length 1: 1 and 2 and 3.\n\nThere are five subsequences with length 2: 1,1 and 1,2 and 1,3 and 2,1 and 2,3.\n\nThere are four subsequences with length 3: 1,1,3 and 1,2,1 and 1,2,3 and 2,1,3.\n\nThere is one subsequence with length 4: 1,2,1,3.\n\nSample Input 2\n\n1\n1 1\n\nSample Output 2\n\n1\n1\n\nThere is one subsequence with length 1: 1.\n\nThere is one subsequence with length 2: 1,1.\n\nSample Input 3\n\n32\n29 19 7 10 26 32 27 4 11 20 2 8 16 23 5 14 6 12 17 22 18 30 28 24 15 1 25 3 13 21 19 31 9\n\nSample Output 3\n\n32\n525\n5453\n40919\n237336\n1107568\n4272048\n13884156\n38567100\n92561040\n193536720\n354817320\n573166440\n818809200\n37158313\n166803103\n166803103\n37158313\n818809200\n573166440\n354817320\n193536720\n92561040\n38567100\n13884156\n4272048\n1107568\n237336\n40920\n5456\n528\n33\n1\n\nBe sure to print the numbers modulo 10^9+7.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 836, "cpu_time_ms": 485, "memory_kb": 135916}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s359308877", "group_id": "codeNet:p03679", "input_text": "X,A,B=map(x->parse(Int,x),split(readline()))\nprintln(-A+B<=0 ? \"delicious\" : -A+B<=X ? \"safe\" : \"dangerous\")", "language": "Julia", "metadata": {"date": 1561603473, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03679.html", "problem_id": "p03679", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03679/input.txt", "sample_output_relpath": "derived/input_output/data/p03679/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03679/Julia/s359308877.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s359308877", "user_id": "u657913472"}, "prompt_components": {"gold_output": "safe\n", "input_to_evaluate": "X,A,B=map(x->parse(Int,x),split(readline()))\nprintln(-A+B<=0 ? \"delicious\" : -A+B<=X ? \"safe\" : \"dangerous\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "sample_input": "4 3 6\n"}, "reference_outputs": ["safe\n"], "source_document_id": "p03679", "source_text": "Score : 100 points\n\nProblem Statement\n\nTakahashi has a strong stomach. He never gets a stomachache from eating something whose \"best-by\" date is at most X days earlier.\nHe gets a stomachache if the \"best-by\" date of the food is X+1 or more days earlier, though.\n\nOther than that, he finds the food delicious if he eats it not later than the \"best-by\" date. Otherwise, he does not find it delicious.\n\nTakahashi bought some food A days before the \"best-by\" date, and ate it B days after he bought it.\n\nWrite a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.\n\nConstraints\n\n1 ≤ X,A,B ≤ 10^9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX A B\n\nOutput\n\nPrint delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.\n\nSample Input 1\n\n4 3 6\n\nSample Output 1\n\nsafe\n\nHe ate the food three days after the \"best-by\" date. It was not delicious or harmful for him.\n\nSample Input 2\n\n6 5 1\n\nSample Output 2\n\ndelicious\n\nHe ate the food by the \"best-by\" date. It was delicious for him.\n\nSample Input 3\n\n3 7 12\n\nSample Output 3\n\ndangerous\n\nHe ate the food five days after the \"best-by\" date. It was harmful for him.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 317, "memory_kb": 110216}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s998281331", "group_id": "codeNet:p03681", "input_text": "parseInt(x) = parse(BigInt, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tp = 10^9+7\n\tn,m = readline() |> split |> parseMap\n\tif abs(n-m)>1\n\t\tprintln(0)\n\telseif n==m\n\t\tx = 2\n\t\tfor i in 1:n\n\t\t\tx=x*i%p\n\t\tend\n\t\tfor i in 1:m\n\t\t\tx=x*i%p\n\t\tend\n\t\tprintln(x)\n\telse\n\t\tx = 1\n\t\tfor i in 1:n\n\t\t\tx=x*i%p\n\t\tend\n\t\tfor i in 1:m\n\t\t\tx=x*i%p\n\t\tend\n\t\tprintln(x)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584616391, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03681.html", "problem_id": "p03681", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03681/input.txt", "sample_output_relpath": "derived/input_output/data/p03681/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03681/Julia/s998281331.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s998281331", "user_id": "u095714878"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "parseInt(x) = parse(BigInt, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tp = 10^9+7\n\tn,m = readline() |> split |> parseMap\n\tif abs(n-m)>1\n\t\tprintln(0)\n\telseif n==m\n\t\tx = 2\n\t\tfor i in 1:n\n\t\t\tx=x*i%p\n\t\tend\n\t\tfor i in 1:m\n\t\t\tx=x*i%p\n\t\tend\n\t\tprintln(x)\n\telse\n\t\tx = 1\n\t\tfor i in 1:n\n\t\t\tx=x*i%p\n\t\tend\n\t\tfor i in 1:m\n\t\t\tx=x*i%p\n\t\tend\n\t\tprintln(x)\n\tend\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "sample_input": "2 2\n"}, "reference_outputs": ["8\n"], "source_document_id": "p03681", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke has N dogs and M monkeys. He wants them to line up in a row.\n\nAs a Japanese saying goes, these dogs and monkeys are on bad terms. (\"ken'en no naka\", literally \"the relationship of dogs and monkeys\", means a relationship of mutual hatred.) Snuke is trying to reconsile them, by arranging the animals so that there are neither two adjacent dogs nor two adjacent monkeys.\n\nHow many such arrangements there are? Find the count modulo 10^9+7 (since animals cannot understand numbers larger than that).\nHere, dogs and monkeys are both distinguishable. Also, two arrangements that result from reversing each other are distinguished.\n\nConstraints\n\n1 ≤ N,M ≤ 10^5\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN M\n\nOutput\n\nPrint the number of possible arrangements, modulo 10^9+7.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n8\n\nWe will denote the dogs by A and B, and the monkeys by C and D. There are eight possible arrangements: ACBD, ADBC, BCAD, BDAC, CADB, CBDA, DACB and DBCA.\n\nSample Input 2\n\n3 2\n\nSample Output 2\n\n12\n\nSample Input 3\n\n1 8\n\nSample Output 3\n\n0\n\nSample Input 4\n\n100000 100000\n\nSample Output 4\n\n530123477", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 391, "cpu_time_ms": 997, "memory_kb": 173576}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s004043632", "group_id": "codeNet:p03688", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tf = 0\n\tma = maximum(a)\n\tmi = minimum(a)\n\tif ma-mi>1\n\t\tf = 1\n\telse\n\t\tax = 0\n\t\tix = 0\n\t\tfor i in 1:n\n\t\t\tif a[i]==ma\n\t\t\t\tax+=1\n\t\t\telse\n\t\t\t\tix+=1\n\t\t\tend\n\t\tend\n\t\tif ix+ax>>1ma\n\t\t\tf = 1\n\t\tend\n\t\tif ax==n&&ma==n-1\n\t\t\tf = 0\n\t\tend\n\tend\n\tprintln(f==0?\"Yes\":\"No\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1574445136, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03688.html", "problem_id": "p03688", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03688/input.txt", "sample_output_relpath": "derived/input_output/data/p03688/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03688/Julia/s004043632.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s004043632", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\tf = 0\n\tma = maximum(a)\n\tmi = minimum(a)\n\tif ma-mi>1\n\t\tf = 1\n\telse\n\t\tax = 0\n\t\tix = 0\n\t\tfor i in 1:n\n\t\t\tif a[i]==ma\n\t\t\t\tax+=1\n\t\t\telse\n\t\t\t\tix+=1\n\t\t\tend\n\t\tend\n\t\tif ix+ax>>1ma\n\t\t\tf = 1\n\t\tend\n\t\tif ax==n&&ma==n-1\n\t\t\tf = 0\n\t\tend\n\tend\n\tprintln(f==0?\"Yes\":\"No\")\nend\nmain()", "problem_context": "Score : 700 points\n\nProblem Statement\n\nThere are N cats.\nWe number them from 1 through N.\n\nEach of the cats wears a hat.\nCat i says: \"there are exactly a_i different colors among the N - 1 hats worn by the cats except me.\"\n\nDetermine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N-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\nPrint Yes if there exists a sequence of colors of the hats that is consistent with the remarks of the cats; print No otherwise.\n\nSample Input 1\n\n3\n1 2 2\n\nSample Output 1\n\nYes\n\nFor example, if cat 1, 2 and 3 wears red, blue and blue hats, respectively, it is consistent with the remarks of the cats.\n\nSample Input 2\n\n3\n1 1 2\n\nSample Output 2\n\nNo\n\nFrom the remark of cat 1, we can see that cat 2 and 3 wear hats of the same color.\nAlso, from the remark of cat 2, we can see that cat 1 and 3 wear hats of the same color.\nTherefore, cat 1 and 2 wear hats of the same color, which contradicts the remark of cat 3.\n\nSample Input 3\n\n5\n4 3 4 3 4\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\n2 2 2\n\nSample Output 4\n\nYes\n\nSample Input 5\n\n4\n2 2 2 2\n\nSample Output 5\n\nYes\n\nSample Input 6\n\n5\n3 3 3 3 3\n\nSample Output 6\n\nNo", "sample_input": "3\n1 2 2\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03688", "source_text": "Score : 700 points\n\nProblem Statement\n\nThere are N cats.\nWe number them from 1 through N.\n\nEach of the cats wears a hat.\nCat i says: \"there are exactly a_i different colors among the N - 1 hats worn by the cats except me.\"\n\nDetermine whether there exists a sequence of colors of the hats that is consistent with the remarks of the cats.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ N-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\nPrint Yes if there exists a sequence of colors of the hats that is consistent with the remarks of the cats; print No otherwise.\n\nSample Input 1\n\n3\n1 2 2\n\nSample Output 1\n\nYes\n\nFor example, if cat 1, 2 and 3 wears red, blue and blue hats, respectively, it is consistent with the remarks of the cats.\n\nSample Input 2\n\n3\n1 1 2\n\nSample Output 2\n\nNo\n\nFrom the remark of cat 1, we can see that cat 2 and 3 wear hats of the same color.\nAlso, from the remark of cat 2, we can see that cat 1 and 3 wear hats of the same color.\nTherefore, cat 1 and 2 wear hats of the same color, which contradicts the remark of cat 3.\n\nSample Input 3\n\n5\n4 3 4 3 4\n\nSample Output 3\n\nNo\n\nSample Input 4\n\n3\n2 2 2\n\nSample Output 4\n\nYes\n\nSample Input 5\n\n4\n2 2 2 2\n\nSample Output 5\n\nYes\n\nSample Input 6\n\n5\n3 3 3 3 3\n\nSample Output 6\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 388, "memory_kb": 118284}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s250976086", "group_id": "codeNet:p03689", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\thh,ww,h,w = readline() |> split |> parseMap\n\tif hh==h&&ww==w\n\t\tprintln(\"No\")\n\telseif (h==2&&hh%2==0)||(w==2&&ww%2==0)\n\t\tprintln(\"No\")\n\telse\n\t\tprintln(\"Yes\")\n\t\tfor i in 1:hh\n\t\t\tfor j in 1:ww-1\n\t\t\t\tif i%h==0&&j%w==0\n\t\t\t\t\tprint(-2*h*w+1,\" \")\n\t\t\t\telse\n\t\t\t\t\tprint(2, \" \")\n\t\t\t\tend\n\t\t\tend\n\t\t\tif i%h==0&&ww%w==0\n\t\t\t\tprintln(-2*h*w+1)\n\t\t\telse\n\t\t\t\tprintln(2)\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577578384, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s250976086.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s250976086", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Yes\n1 1 1\n1 -4 1\n1 1 1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\thh,ww,h,w = readline() |> split |> parseMap\n\tif hh==h&&ww==w\n\t\tprintln(\"No\")\n\telseif (h==2&&hh%2==0)||(w==2&&ww%2==0)\n\t\tprintln(\"No\")\n\telse\n\t\tprintln(\"Yes\")\n\t\tfor i in 1:hh\n\t\t\tfor j in 1:ww-1\n\t\t\t\tif i%h==0&&j%w==0\n\t\t\t\t\tprint(-2*h*w+1,\" \")\n\t\t\t\telse\n\t\t\t\t\tprint(2, \" \")\n\t\t\t\tend\n\t\t\tend\n\t\t\tif i%h==0&&ww%w==0\n\t\t\t\tprintln(-2*h*w+1)\n\t\t\telse\n\t\t\t\tprintln(2)\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 483, "cpu_time_ms": 870, "memory_kb": 167704}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s674212862", "group_id": "codeNet:p03693", "input_text": "function main()\n r,g,b = map(x->parse(Int,x),split(readline()))\n if (10g + b)%4 == 0\n print(\"YES\")\n else\n print(\"NO\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1535141239, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03693.html", "problem_id": "p03693", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03693/input.txt", "sample_output_relpath": "derived/input_output/data/p03693/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03693/Julia/s674212862.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s674212862", "user_id": "u373796790"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "function main()\n r,g,b = map(x->parse(Int,x),split(readline()))\n if (10g + b)%4 == 0\n print(\"YES\")\n else\n print(\"NO\")\n end\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer has three cards, one red, one green and one blue.\n\nAn integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card.\n\nWe will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer.\n\nIs this integer a multiple of 4?\n\nConstraints\n\n1 ≤ r, g, b ≤ 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr g b\n\nOutput\n\nIf the three-digit integer is a multiple of 4, print YES (case-sensitive); otherwise, print NO.\n\nSample Input 1\n\n4 3 2\n\nSample Output 1\n\nYES\n\n432 is a multiple of 4, and thus YES should be printed.\n\nSample Input 2\n\n2 3 4\n\nSample Output 2\n\nNO\n\n234 is not a multiple of 4, and thus NO should be printed.", "sample_input": "4 3 2\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03693", "source_text": "Score : 100 points\n\nProblem Statement\n\nAtCoDeer has three cards, one red, one green and one blue.\n\nAn integer between 1 and 9 (inclusive) is written on each card: r on the red card, g on the green card and b on the blue card.\n\nWe will arrange the cards in the order red, green and blue from left to right, and read them as a three-digit integer.\n\nIs this integer a multiple of 4?\n\nConstraints\n\n1 ≤ r, g, b ≤ 9\n\nInput\n\nInput is given from Standard Input in the following format:\n\nr g b\n\nOutput\n\nIf the three-digit integer is a multiple of 4, print YES (case-sensitive); otherwise, print NO.\n\nSample Input 1\n\n4 3 2\n\nSample Output 1\n\nYES\n\n432 is a multiple of 4, and thus YES should be printed.\n\nSample Input 2\n\n2 3 4\n\nSample Output 2\n\nNO\n\n234 is not a multiple of 4, and thus NO should be printed.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 847, "memory_kb": 167656}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s065616048", "group_id": "codeNet:p03695", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n color=[0 for i in 1:9]\n for i in a\n for j in 1:8\n if 400*(j-1)<=i<400*j\n color[j]+=1\n end\n end\n if 3200<=i\n color[9]+=1\n end\n end\n MIN=max(count(i->i>0,color[1:8]),1)\n MAX=count(i->i>0,color[1:8])+color[9]\n println(\"$MIN $MAX\")\nend\nmain()", "language": "Julia", "metadata": {"date": 1584586167, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s065616048.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s065616048", "user_id": "u619197965"}, "prompt_components": {"gold_output": "2 2\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=parseMap(split(readline()))\n color=[0 for i in 1:9]\n for i in a\n for j in 1:8\n if 400*(j-1)<=i<400*j\n color[j]+=1\n end\n end\n if 3200<=i\n color[9]+=1\n end\n end\n MIN=max(count(i->i>0,color[1:8]),1)\n MAX=count(i->i>0,color[1:8])+color[9]\n println(\"$MIN $MAX\")\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 798, "cpu_time_ms": 866, "memory_kb": 170320}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s904646328", "group_id": "codeNet:p03696", "input_text": "N = parse(Int, readline())\nS = chomp(readline())\n\nbr = 0\npre = \"\"\nsuf = \"\"\nfor i in 1:N\n if S[i] == '('\n br += 1\n elseif br == 0\n pre *= \"(\"\n else\n br -= 1\n end\nend\nfor i in 1:br\n suf *= \")\"\nend\nprintln(pre * S * suf)", "language": "Julia", "metadata": {"date": 1497144504, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s904646328.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s904646328", "user_id": "u872191059"}, "prompt_components": {"gold_output": "(())\n", "input_to_evaluate": "N = parse(Int, readline())\nS = chomp(readline())\n\nbr = 0\npre = \"\"\nsuf = \"\"\nfor i in 1:N\n if S[i] == '('\n br += 1\n elseif br == 0\n pre *= \"(\"\n else\n br -= 1\n end\nend\nfor i in 1:br\n suf *= \")\"\nend\nprintln(pre * S * suf)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 848, "memory_kb": 166808}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s492483738", "group_id": "codeNet:p03697", "input_text": "a=sum(parse.(split(readline())))\nprint(a>9?\"error\":a)", "language": "Julia", "metadata": {"date": 1561173894, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s492483738.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s492483738", "user_id": "u729133443"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "a=sum(parse.(split(readline())))\nprint(a>9?\"error\":a)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 53, "cpu_time_ms": 527, "memory_kb": 117736}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s861596177", "group_id": "codeNet:p03698", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=join(sort(collect(chomp(readline()))))\n l=length(s)\n ans=\"yes\"\n for i in 2:l\n if s[i]==s[i-1]\n ans=\"no\"\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1584586397, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s861596177.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s861596177", "user_id": "u619197965"}, "prompt_components": {"gold_output": "yes\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n s=join(sort(collect(chomp(readline()))))\n l=length(s)\n ans=\"yes\"\n for i in 2:l\n if s[i]==s[i-1]\n ans=\"no\"\n end\n end\n println(ans)\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 909, "memory_kb": 172020}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s373732193", "group_id": "codeNet:p03711", "input_text": "A=[0,2,0,1,0,1,0,0,1,0,1,0]\nx,y=map(x->parse(Int,x),split(readline()))\nprintln(A[x]==A[y]?\"Yes\":\"No\")", "language": "Julia", "metadata": {"date": 1561605281, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s373732193.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s373732193", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "A=[0,2,0,1,0,1,0,0,1,0,1,0]\nx,y=map(x->parse(Int,x),split(readline()))\nprintln(A[x]==A[y]?\"Yes\":\"No\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 318, "memory_kb": 108288}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s223159207", "group_id": "codeNet:p03712", "input_text": "h,w=map(x->parse(Int,x),split(readline()))\nprintln(repeat(\"#\",w+2))\nfor i=1:h\n\tprintln(\"#\",chop(readline()),\"#\")\nend\nprintln(repeat(\"#\",w+2))", "language": "Julia", "metadata": {"date": 1534974120, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s223159207.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s223159207", "user_id": "u657913472"}, "prompt_components": {"gold_output": "#####\n#abc#\n#arc#\n#####\n", "input_to_evaluate": "h,w=map(x->parse(Int,x),split(readline()))\nprintln(repeat(\"#\",w+2))\nfor i=1:h\n\tprintln(\"#\",chop(readline()),\"#\")\nend\nprintln(repeat(\"#\",w+2))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 141, "cpu_time_ms": 338, "memory_kb": 110348}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s545277288", "group_id": "codeNet:p03716", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\ta[1:n] = sort(a[1:n])\n\ta[2*n+1:3*n] = sort(a[2*n+1:3*n])\n\tb = zeros(Int,n+1)\n\tc = zeros(Int,n+1)\n\tc[n+1] = sum(a[2*n+1:3*n])\n\tb[1] = sum(a[1:n])\n\tnb = 1\n\tnc = 3*n\n\tfor i in 1:n\n\t\tif a[n+i] > a[nb]\n\t\t\tb[i+1] = b[i] - a[nb] + a[n+i]\n\t\t\tnb += 1\n\t\telse\n\t\t\tb[i+1] = b[i]\n\t\tend\n\t\tif a[2*n+1-i] < a[nc]\n\t\t\tc[n+1-i] = c[n+2-i] - a[nc] + a[2*n+1-i]\n\t\t\tnc -= 1\n\t\telse\n\t\t\tc[n+1-i] = c[n+2-i]\n\t\tend\n\tend\n\tm = 0\n\tfor i in 1:n+1\n\t\tm = max(m, b[i]-c[i])\n\tend\n\tprintln(m)\nend\nmain()", "language": "Julia", "metadata": {"date": 1554837096, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03716.html", "problem_id": "p03716", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03716/input.txt", "sample_output_relpath": "derived/input_output/data/p03716/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03716/Julia/s545277288.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s545277288", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = readline() |> split |> parseMap\n\ta[1:n] = sort(a[1:n])\n\ta[2*n+1:3*n] = sort(a[2*n+1:3*n])\n\tb = zeros(Int,n+1)\n\tc = zeros(Int,n+1)\n\tc[n+1] = sum(a[2*n+1:3*n])\n\tb[1] = sum(a[1:n])\n\tnb = 1\n\tnc = 3*n\n\tfor i in 1:n\n\t\tif a[n+i] > a[nb]\n\t\t\tb[i+1] = b[i] - a[nb] + a[n+i]\n\t\t\tnb += 1\n\t\telse\n\t\t\tb[i+1] = b[i]\n\t\tend\n\t\tif a[2*n+1-i] < a[nc]\n\t\t\tc[n+1-i] = c[n+2-i] - a[nc] + a[2*n+1-i]\n\t\t\tnc -= 1\n\t\telse\n\t\t\tc[n+1-i] = c[n+2-i]\n\t\tend\n\tend\n\tm = 0\n\tfor i in 1:n+1\n\t\tm = max(m, b[i]-c[i])\n\tend\n\tprintln(m)\nend\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nLet N be a positive integer.\n\nThere is a numerical sequence of length 3N, a = (a_1, a_2, ..., a_{3N}).\nSnuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements.\nHere, the score of a' is defined as follows: (the sum of the elements in the first half of a') - (the sum of the elements in the second half of a').\n\nFind the maximum possible score of a'.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nPartial Score\n\nIn the test set worth 300 points, N ≤ 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the maximum possible score of a'.\n\nSample Input 1\n\n2\n3 1 4 1 5 9\n\nSample Output 1\n\n1\n\nWhen a_2 and a_6 are removed, a' will be (3, 4, 1, 5), which has a score of (3 + 4) - (1 + 5) = 1.\n\nSample Input 2\n\n1\n1 2 3\n\nSample Output 2\n\n-1\n\nFor example, when a_1 are removed, a' will be (2, 3), which has a score of 2 - 3 = -1.\n\nSample Input 3\n\n3\n8 2 2 7 4 6 5 3 8\n\nSample Output 3\n\n5\n\nFor example, when a_2, a_3 and a_9 are removed, a' will be (8, 7, 4, 6, 5, 3), which has a score of (8 + 7 + 4) - (6 + 5 + 3) = 5.", "sample_input": "2\n3 1 4 1 5 9\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03716", "source_text": "Score : 500 points\n\nProblem Statement\n\nLet N be a positive integer.\n\nThere is a numerical sequence of length 3N, a = (a_1, a_2, ..., a_{3N}).\nSnuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements.\nHere, the score of a' is defined as follows: (the sum of the elements in the first half of a') - (the sum of the elements in the second half of a').\n\nFind the maximum possible score of a'.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\na_i is an integer.\n\n1 ≤ a_i ≤ 10^9\n\nPartial Score\n\nIn the test set worth 300 points, N ≤ 1000.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the maximum possible score of a'.\n\nSample Input 1\n\n2\n3 1 4 1 5 9\n\nSample Output 1\n\n1\n\nWhen a_2 and a_6 are removed, a' will be (3, 4, 1, 5), which has a score of (3 + 4) - (1 + 5) = 1.\n\nSample Input 2\n\n1\n1 2 3\n\nSample Output 2\n\n-1\n\nFor example, when a_1 are removed, a' will be (2, 3), which has a score of 2 - 3 = -1.\n\nSample Input 3\n\n3\n8 2 2 7 4 6 5 3 8\n\nSample Output 3\n\n5\n\nFor example, when a_2, a_3 and a_9 are removed, a' will be (8, 7, 4, 6, 5, 3), which has a score of (8 + 7 + 4) - (6 + 5 + 3) = 5.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 620, "memory_kb": 141236}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s892338517", "group_id": "codeNet:p03719", "input_text": "function main()\n \n (A,B,C) = map(x -> parse(Int,x), readline())\n \n if A <= C <= B\n \n println(\"Yes\")\n \n else\n \n println(\"No\")\n \n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577720655, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s892338517.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s892338517", "user_id": "u790457721"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "function main()\n \n (A,B,C) = map(x -> parse(Int,x), readline())\n \n if A <= C <= B\n \n println(\"Yes\")\n \n else\n \n println(\"No\")\n \n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 709, "memory_kb": 140084}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s734526442", "group_id": "codeNet:p03720", "input_text": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n,m=pM(split(readline()))\n l=[0 for i=1:n]\n for i=1:m\n a,b=pM(split(readline()))\n l[a]+=1\n l[b]+=1\n end\n for i=1:n\n println(l[i])\n end\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "language": "Julia", "metadata": {"date": 1592053493, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03720.html", "problem_id": "p03720", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03720/input.txt", "sample_output_relpath": "derived/input_output/data/p03720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03720/Julia/s734526442.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s734526442", "user_id": "u443151804"}, "prompt_components": {"gold_output": "2\n2\n1\n1\n", "input_to_evaluate": "if isfile(\"mystdin.txt\");mystdin=open(\"mystdin.txt\",\"r\");redirect_stdin(mystdin);end\npI(x)=parse(Int,x)\npM(x::Array{SubString{String},1})=map(pI,x)\nfunction main()\n n,m=pM(split(readline()))\n l=[0 for i=1:n]\n for i=1:m\n a,b=pM(split(readline()))\n l[a]+=1\n l[b]+=1\n end\n for i=1:n\n println(l[i])\n end\nend\nmain()\nif isdefined(Base, :mystdin);close(mystdin);end", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N cities and M roads.\nThe i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally.\nThere may be more than one road that connects the same pair of two cities.\nFor each city, how many roads are connected to the city?\n\nConstraints\n\n2≤N,M≤50\n\n1≤a_i,b_i≤N\n\na_i ≠ b_i\n\nAll input values are integers.\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\nPrint the answer in N lines.\nIn the i-th line (1≤i≤N), print the number of roads connected to city i.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n1 4\n\nSample Output 1\n\n2\n2\n1\n1\n\nCity 1 is connected to the 1-st and 3-rd roads.\n\nCity 2 is connected to the 1-st and 2-nd roads.\n\nCity 3 is connected to the 2-nd road.\n\nCity 4 is connected to the 3-rd road.\n\nSample Input 2\n\n2 5\n1 2\n2 1\n1 2\n2 1\n1 2\n\nSample Output 2\n\n5\n5\n\nSample Input 3\n\n8 8\n1 2\n3 4\n1 5\n2 8\n3 7\n5 2\n4 1\n6 8\n\nSample Output 3\n\n3\n3\n2\n2\n2\n1\n1\n2", "sample_input": "4 3\n1 2\n2 3\n1 4\n"}, "reference_outputs": ["2\n2\n1\n1\n"], "source_document_id": "p03720", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N cities and M roads.\nThe i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally.\nThere may be more than one road that connects the same pair of two cities.\nFor each city, how many roads are connected to the city?\n\nConstraints\n\n2≤N,M≤50\n\n1≤a_i,b_i≤N\n\na_i ≠ b_i\n\nAll input values are integers.\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\nPrint the answer in N lines.\nIn the i-th line (1≤i≤N), print the number of roads connected to city i.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n1 4\n\nSample Output 1\n\n2\n2\n1\n1\n\nCity 1 is connected to the 1-st and 3-rd roads.\n\nCity 2 is connected to the 1-st and 2-nd roads.\n\nCity 3 is connected to the 2-nd road.\n\nCity 4 is connected to the 3-rd road.\n\nSample Input 2\n\n2 5\n1 2\n2 1\n1 2\n2 1\n1 2\n\nSample Output 2\n\n5\n5\n\nSample Input 3\n\n8 8\n1 2\n3 4\n1 5\n2 8\n3 7\n5 2\n4 1\n6 8\n\nSample Output 3\n\n3\n3\n2\n2\n2\n1\n1\n2", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 839, "memory_kb": 172376}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s111677661", "group_id": "codeNet:p03720", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,m=parseMap(split(readline()))\n city=[0 for i in 1:n]\n for i in 1:m\n a,b=parseMap(split(readline()))\n city[a]+=1\n city[b]+=1\n end\n for i in city\n println(i)\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1584658925, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03720.html", "problem_id": "p03720", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03720/input.txt", "sample_output_relpath": "derived/input_output/data/p03720/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03720/Julia/s111677661.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s111677661", "user_id": "u619197965"}, "prompt_components": {"gold_output": "2\n2\n1\n1\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n,m=parseMap(split(readline()))\n city=[0 for i in 1:n]\n for i in 1:m\n a,b=parseMap(split(readline()))\n city[a]+=1\n city[b]+=1\n end\n for i in city\n println(i)\n end\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N cities and M roads.\nThe i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally.\nThere may be more than one road that connects the same pair of two cities.\nFor each city, how many roads are connected to the city?\n\nConstraints\n\n2≤N,M≤50\n\n1≤a_i,b_i≤N\n\na_i ≠ b_i\n\nAll input values are integers.\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\nPrint the answer in N lines.\nIn the i-th line (1≤i≤N), print the number of roads connected to city i.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n1 4\n\nSample Output 1\n\n2\n2\n1\n1\n\nCity 1 is connected to the 1-st and 3-rd roads.\n\nCity 2 is connected to the 1-st and 2-nd roads.\n\nCity 3 is connected to the 2-nd road.\n\nCity 4 is connected to the 3-rd road.\n\nSample Input 2\n\n2 5\n1 2\n2 1\n1 2\n2 1\n1 2\n\nSample Output 2\n\n5\n5\n\nSample Input 3\n\n8 8\n1 2\n3 4\n1 5\n2 8\n3 7\n5 2\n4 1\n6 8\n\nSample Output 3\n\n3\n3\n2\n2\n2\n1\n1\n2", "sample_input": "4 3\n1 2\n2 3\n1 4\n"}, "reference_outputs": ["2\n2\n1\n1\n"], "source_document_id": "p03720", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N cities and M roads.\nThe i-th road (1≤i≤M) connects two cities a_i and b_i (1≤a_i,b_i≤N) bidirectionally.\nThere may be more than one road that connects the same pair of two cities.\nFor each city, how many roads are connected to the city?\n\nConstraints\n\n2≤N,M≤50\n\n1≤a_i,b_i≤N\n\na_i ≠ b_i\n\nAll input values are integers.\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\nPrint the answer in N lines.\nIn the i-th line (1≤i≤N), print the number of roads connected to city i.\n\nSample Input 1\n\n4 3\n1 2\n2 3\n1 4\n\nSample Output 1\n\n2\n2\n1\n1\n\nCity 1 is connected to the 1-st and 3-rd roads.\n\nCity 2 is connected to the 1-st and 2-nd roads.\n\nCity 3 is connected to the 2-nd road.\n\nCity 4 is connected to the 3-rd road.\n\nSample Input 2\n\n2 5\n1 2\n2 1\n1 2\n2 1\n1 2\n\nSample Output 2\n\n5\n5\n\nSample Input 3\n\n8 8\n1 2\n3 4\n1 5\n2 8\n3 7\n5 2\n4 1\n6 8\n\nSample Output 3\n\n3\n3\n2\n2\n2\n1\n1\n2", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 624, "cpu_time_ms": 930, "memory_kb": 172508}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s064733362", "group_id": "codeNet:p03721", "input_text": "function main()\n \n (N,K) = map(x -> parse(Int,x), split(readline()))\n \n (n,b) = map(x -> parse(Int,x), split(readline()))\n \n a = [n for i in 1:b]\n \n for i in 1:N-1\n \n (n,m) = map(x -> parse(Int,x), split(readline()))\n \n for j in 1:m\n push!(a,n)\n end\n \n end\n \n sort!(a)\n \n println(a[4])\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1578627136, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s064733362.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s064733362", "user_id": "u790457721"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main()\n \n (N,K) = map(x -> parse(Int,x), split(readline()))\n \n (n,b) = map(x -> parse(Int,x), split(readline()))\n \n a = [n for i in 1:b]\n \n for i in 1:N-1\n \n (n,m) = map(x -> parse(Int,x), split(readline()))\n \n for j in 1:m\n push!(a,n)\n end\n \n end\n \n sort!(a)\n \n println(a[4])\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 336, "cpu_time_ms": 2121, "memory_kb": 290312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s558798522", "group_id": "codeNet:p03721", "input_text": "(n, k) = parse.([Int64], split(readline()))\narr = zeros(Int, 100000)\nfor i in 1:n\n (a, b) = parse.([Int64], split(readline()))\n arr[a] += b\nend\ncnt = 0\nfor ans in 1:100000\n cnt += arr[ans]\n if k <= cnt\n println(ans)\n break\n end\nend", "language": "Julia", "metadata": {"date": 1494793778, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s558798522.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s558798522", "user_id": "u872191059"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "(n, k) = parse.([Int64], split(readline()))\narr = zeros(Int, 100000)\nfor i in 1:n\n (a, b) = parse.([Int64], split(readline()))\n arr[a] += b\nend\ncnt = 0\nfor ans in 1:100000\n cnt += arr[ans]\n if k <= cnt\n println(ans)\n break\n end\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 260, "cpu_time_ms": 2117, "memory_kb": 177264}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s323040873", "group_id": "codeNet:p03721", "input_text": "(n, k) = parse.([Int], split(readline()))\narr = []\nfor i in 1:n\n (a, b) = parse.([Int], split(readline()))\n push!(arr, (a, b))\nend\nsort(arr)\ncnt = 0\ni = 1\nans = arr[end][1]\nwhile cnt < k\n ans = arr[i][1]\n cnt += arr[i][2]\n i += 1\nend\nprintln(ans)", "language": "Julia", "metadata": {"date": 1494731319, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s323040873.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s323040873", "user_id": "u872191059"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "(n, k) = parse.([Int], split(readline()))\narr = []\nfor i in 1:n\n (a, b) = parse.([Int], split(readline()))\n push!(arr, (a, b))\nend\nsort(arr)\ncnt = 0\ni = 1\nans = arr[end][1]\nwhile cnt < k\n ans = arr[i][1]\n cnt += arr[i][2]\n i += 1\nend\nprintln(ans)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 261, "cpu_time_ms": 2113, "memory_kb": 154580}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s526367244", "group_id": "codeNet:p03722", "input_text": "function f(E,D)\n\tfor d=D\n\t\tfor (a,b,c)=E\n\t\t\tif D[b]>D[a]+c\n\t\t\t\tD[b]=D[a]+c\n\t\t\tend\n\t\tend\n\tend\nend\nfunction main()\n\tN,M=map(x->parse(Int,x),split(readline()))\n\tE=Tuple{Int,Int,Int}[]\n\tfor s=readlines()\n\t\ta,b,c=map(x->parse(Int,x),split(s))\n\t\tpush!(E,(a,b,-c))\n\tend\n\tD=[1145141919810931893 for _=1:N]\n\tD[1]=0\n\tf(E,D)\n\tans=D[N]\n\tf(E,D)\n\tprintln(ans>D[N]?\"inf\":-ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561606731, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s526367244.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s526367244", "user_id": "u657913472"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "function f(E,D)\n\tfor d=D\n\t\tfor (a,b,c)=E\n\t\t\tif D[b]>D[a]+c\n\t\t\t\tD[b]=D[a]+c\n\t\t\tend\n\t\tend\n\tend\nend\nfunction main()\n\tN,M=map(x->parse(Int,x),split(readline()))\n\tE=Tuple{Int,Int,Int}[]\n\tfor s=readlines()\n\t\ta,b,c=map(x->parse(Int,x),split(s))\n\t\tpush!(E,(a,b,-c))\n\tend\n\tD=[1145141919810931893 for _=1:N]\n\tD[1]=0\n\tf(E,D)\n\tans=D[N]\n\tf(E,D)\n\tprintln(ans>D[N]?\"inf\":-ans)\nend\nmain()\n", "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=time\n res+=time\n else \n res+=T\n end\nend\nres+=T\n\nprintln(res)", "language": "Julia", "metadata": {"date": 1566790643, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03731.html", "problem_id": "p03731", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03731/input.txt", "sample_output_relpath": "derived/input_output/data/p03731/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03731/Julia/s152172355.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s152172355", "user_id": "u879294842"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "N,T=parse.(split(readline()))\ntimes=parse.(split(readline()))\nres=0\nfor i in 1:length(times)-1\n bf_time=times[i]\n af_time=times[i+1]\n time=af_time-bf_time\n if T>=time\n res+=time\n else \n res+=T\n end\nend\nres+=T\n\nprintln(res)", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIn a public bath, there is a shower which emits water for T seconds when the switch is pushed.\n\nIf the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds.\nNote that it does not mean that the shower emits water for T additional seconds.\n\nN people will push the switch while passing by the shower.\nThe i-th person will push the switch t_i seconds after the first person pushes it.\n\nHow long will the shower emit water in total?\n\nConstraints\n\n1 ≤ N ≤ 200,000\n\n1 ≤ T ≤ 10^9\n\n0 = t_1 < t_2 < t_3 < , ..., < t_{N-1} < t_N ≤ 10^9\n\nT and each t_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\nt_1 t_2 ... t_N\n\nOutput\n\nAssume that the shower will emit water for a total of X seconds. Print X.\n\nSample Input 1\n\n2 4\n0 3\n\nSample Output 1\n\n7\n\nThree seconds after the first person pushes the water, the switch is pushed again and the shower emits water for four more seconds, for a total of seven seconds.\n\nSample Input 2\n\n2 4\n0 5\n\nSample Output 2\n\n8\n\nOne second after the shower stops emission of water triggered by the first person, the switch is pushed again.\n\nSample Input 3\n\n4 1000000000\n0 1000 1000000 1000000000\n\nSample Output 3\n\n2000000000\n\nSample Input 4\n\n1 1\n0\n\nSample Output 4\n\n1\n\nSample Input 5\n\n9 10\n0 3 5 7 100 110 200 300 311\n\nSample Output 5\n\n67", "sample_input": "2 4\n0 3\n"}, "reference_outputs": ["7\n"], "source_document_id": "p03731", "source_text": "Score : 300 points\n\nProblem Statement\n\nIn a public bath, there is a shower which emits water for T seconds when the switch is pushed.\n\nIf the switch is pushed when the shower is already emitting water, from that moment it will be emitting water for T seconds.\nNote that it does not mean that the shower emits water for T additional seconds.\n\nN people will push the switch while passing by the shower.\nThe i-th person will push the switch t_i seconds after the first person pushes it.\n\nHow long will the shower emit water in total?\n\nConstraints\n\n1 ≤ N ≤ 200,000\n\n1 ≤ T ≤ 10^9\n\n0 = t_1 < t_2 < t_3 < , ..., < t_{N-1} < t_N ≤ 10^9\n\nT and each t_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN T\nt_1 t_2 ... t_N\n\nOutput\n\nAssume that the shower will emit water for a total of X seconds. Print X.\n\nSample Input 1\n\n2 4\n0 3\n\nSample Output 1\n\n7\n\nThree seconds after the first person pushes the water, the switch is pushed again and the shower emits water for four more seconds, for a total of seven seconds.\n\nSample Input 2\n\n2 4\n0 5\n\nSample Output 2\n\n8\n\nOne second after the shower stops emission of water triggered by the first person, the switch is pushed again.\n\nSample Input 3\n\n4 1000000000\n0 1000 1000000 1000000000\n\nSample Output 3\n\n2000000000\n\nSample Input 4\n\n1 1\n0\n\nSample Output 4\n\n1\n\nSample Input 5\n\n9 10\n0 3 5 7 100 110 200 300 311\n\nSample Output 5\n\n67", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2111, "memory_kb": 166300}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s022882006", "group_id": "codeNet:p03734", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,w = readline() |> split |> parseMap\n\ta = Array{Int}(2,n)\n\tfor i in 1:n\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\tx = a[1,1]\n\tfor i in 1:n\n\t\ta[1,i] -= x\n\tend\n\ts = sum(a[1,:])\n\tdp = zeros(Int,n,n,s+1)\n\tif x <= w\n\t\tdp[1,1,1] = a[2,1]\n\tend\n\tfor i in 2:n\n\t\tfor k in 1:min(s+1,w)\n\t\t\tif k == a[1,i]+x+1\n\t\t\t\tdp[i,1,k] = max(dp[i-1,1,k], a[2,i])\n\t\t\telse\n\t\t\t\tdp[i,1,k] = dp[i-1,1,k]\n\t\t\tend\n\t\tend\n\t\tfor j in 2:i\n\t\t\tfor k in 1:s+1\n\t\t\t\tif j*x+k<=w+1\n\t\t\t\t\tif k<=a[1,i]\n\t\t\t\t\t\tdp[i,j,k] = dp[i-1,j,k]\n\t\t\t\t\telse\n\t\t\t\t\t\tdp[i,j,k] = max(dp[i-1,j,k],dp[i-1,j-1,k-a[1,i]] + a[2,i])\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tprintln(maximum(dp[n,:,:]))\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1557213603, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03734.html", "problem_id": "p03734", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03734/input.txt", "sample_output_relpath": "derived/input_output/data/p03734/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03734/Julia/s022882006.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s022882006", "user_id": "u095714878"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,w = readline() |> split |> parseMap\n\ta = Array{Int}(2,n)\n\tfor i in 1:n\n\t\ta[:,i] = readline() |> split |> parseMap\n\tend\n\tx = a[1,1]\n\tfor i in 1:n\n\t\ta[1,i] -= x\n\tend\n\ts = sum(a[1,:])\n\tdp = zeros(Int,n,n,s+1)\n\tif x <= w\n\t\tdp[1,1,1] = a[2,1]\n\tend\n\tfor i in 2:n\n\t\tfor k in 1:min(s+1,w)\n\t\t\tif k == a[1,i]+x+1\n\t\t\t\tdp[i,1,k] = max(dp[i-1,1,k], a[2,i])\n\t\t\telse\n\t\t\t\tdp[i,1,k] = dp[i-1,1,k]\n\t\t\tend\n\t\tend\n\t\tfor j in 2:i\n\t\t\tfor k in 1:s+1\n\t\t\t\tif j*x+k<=w+1\n\t\t\t\t\tif k<=a[1,i]\n\t\t\t\t\t\tdp[i,j,k] = dp[i-1,j,k]\n\t\t\t\t\telse\n\t\t\t\t\t\tdp[i,j,k] = max(dp[i-1,j,k],dp[i-1,j-1,k-a[1,i]] + a[2,i])\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tprintln(maximum(dp[n,:,:]))\nend\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou have N items and a bag of strength W.\nThe i-th item has a weight of w_i and a value of v_i.\n\nYou will select some of the items and put them in the bag.\nHere, the total weight of the selected items needs to be at most W.\n\nYour objective is to maximize the total value of the selected items.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ W ≤ 10^9\n\n1 ≤ w_i ≤ 10^9\n\nFor each i = 2,3,...,N, w_1 ≤ w_i ≤ w_1 + 3.\n\n1 ≤ v_i ≤ 10^7\n\nW, each w_i and v_i are integers.\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 total value of the selected items.\n\nSample Input 1\n\n4 6\n2 1\n3 4\n4 10\n3 4\n\nSample Output 1\n\n11\n\nThe first and third items should be selected.\n\nSample Input 2\n\n4 6\n2 1\n3 7\n4 10\n3 6\n\nSample Output 2\n\n13\n\nThe second and fourth items should be selected.\n\nSample Input 3\n\n4 10\n1 100\n1 100\n1 100\n1 100\n\nSample Output 3\n\n400\n\nYou can take everything.\n\nSample Input 4\n\n4 1\n10 100\n10 100\n10 100\n10 100\n\nSample Output 4\n\n0\n\nYou can take nothing.", "sample_input": "4 6\n2 1\n3 4\n4 10\n3 4\n"}, "reference_outputs": ["11\n"], "source_document_id": "p03734", "source_text": "Score : 400 points\n\nProblem Statement\n\nYou have N items and a bag of strength W.\nThe i-th item has a weight of w_i and a value of v_i.\n\nYou will select some of the items and put them in the bag.\nHere, the total weight of the selected items needs to be at most W.\n\nYour objective is to maximize the total value of the selected items.\n\nConstraints\n\n1 ≤ N ≤ 100\n\n1 ≤ W ≤ 10^9\n\n1 ≤ w_i ≤ 10^9\n\nFor each i = 2,3,...,N, w_1 ≤ w_i ≤ w_1 + 3.\n\n1 ≤ v_i ≤ 10^7\n\nW, each w_i and v_i are integers.\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 total value of the selected items.\n\nSample Input 1\n\n4 6\n2 1\n3 4\n4 10\n3 4\n\nSample Output 1\n\n11\n\nThe first and third items should be selected.\n\nSample Input 2\n\n4 6\n2 1\n3 7\n4 10\n3 6\n\nSample Output 2\n\n13\n\nThe second and fourth items should be selected.\n\nSample Input 3\n\n4 10\n1 100\n1 100\n1 100\n1 100\n\nSample Output 3\n\n400\n\nYou can take everything.\n\nSample Input 4\n\n4 1\n10 100\n10 100\n10 100\n10 100\n\nSample Output 4\n\n0\n\nYou can take nothing.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 612, "memory_kb": 135312}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s471348973", "group_id": "codeNet:p03737", "input_text": "a,b,c=split(readline())\nprintln(a[1]-32,b[1]-32,c[1]-32)", "language": "Julia", "metadata": {"date": 1561614584, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03737.html", "problem_id": "p03737", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03737/input.txt", "sample_output_relpath": "derived/input_output/data/p03737/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03737/Julia/s471348973.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s471348973", "user_id": "u657913472"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "a,b,c=split(readline())\nprintln(a[1]-32,b[1]-32,c[1]-32)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nYou are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between.\nPrint the acronym formed from the uppercased initial letters of the words.\n\nConstraints\n\ns_1, s_2 and s_3 are composed of lowercase English letters.\n\n1 ≤ |s_i| ≤ 10 (1≤i≤3)\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_1 s_2 s_3\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\natcoder beginner contest\n\nSample Output 1\n\nABC\n\nThe initial letters of atcoder, beginner and contest are a, b and c. Uppercase and concatenate them to obtain ABC.\n\nSample Input 2\n\nresident register number\n\nSample Output 2\n\nRRN\n\nSample Input 3\n\nk nearest neighbor\n\nSample Output 3\n\nKNN\n\nSample Input 4\n\nasync layered coding\n\nSample Output 4\n\nALC", "sample_input": "atcoder beginner contest\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03737", "source_text": "Score : 100 points\n\nProblem Statement\n\nYou are given three words s_1, s_2 and s_3, each composed of lowercase English letters, with spaces in between.\nPrint the acronym formed from the uppercased initial letters of the words.\n\nConstraints\n\ns_1, s_2 and s_3 are composed of lowercase English letters.\n\n1 ≤ |s_i| ≤ 10 (1≤i≤3)\n\nInput\n\nInput is given from Standard Input in the following format:\n\ns_1 s_2 s_3\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\natcoder beginner contest\n\nSample Output 1\n\nABC\n\nThe initial letters of atcoder, beginner and contest are a, b and c. Uppercase and concatenate them to obtain ABC.\n\nSample Input 2\n\nresident register number\n\nSample Output 2\n\nRRN\n\nSample Input 3\n\nk nearest neighbor\n\nSample Output 3\n\nKNN\n\nSample Input 4\n\nasync layered coding\n\nSample Output 4\n\nALC", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 279, "memory_kb": 108452}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s949159032", "group_id": "codeNet:p03738", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a=chomp(readline())\n b=chomp(readline())\n la,lb=length(a),length(b)\n if lalb\n println(\"GREATER\")\n else\n ans=\"EQUAL\"\n for i in 1:la\n if a[i]b[i]\n ans=\"GREATER\"\n break\n end\n end\n println(ans)\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1584666320, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03738.html", "problem_id": "p03738", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03738/input.txt", "sample_output_relpath": "derived/input_output/data/p03738/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03738/Julia/s949159032.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s949159032", "user_id": "u619197965"}, "prompt_components": {"gold_output": "GREATER\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a=chomp(readline())\n b=chomp(readline())\n la,lb=length(a),length(b)\n if lalb\n println(\"GREATER\")\n else\n ans=\"EQUAL\"\n for i in 1:la\n if a[i]b[i]\n ans=\"GREATER\"\n break\n end\n end\n println(ans)\n end\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two positive integers A and B. Compare the magnitudes of these numbers.\n\nConstraints\n\n1 ≤ A, B ≤ 10^{100}\n\nNeither A nor B begins with a 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint GREATER if A>B, LESS if A24, print GREATER.\n\nSample Input 2\n\n850\n3777\n\nSample Output 2\n\nLESS\n\nSample Input 3\n\n9720246\n22516266\n\nSample Output 3\n\nLESS\n\nSample Input 4\n\n123456789012345678901234567890\n234567890123456789012345678901\n\nSample Output 4\n\nLESS", "sample_input": "36\n24\n"}, "reference_outputs": ["GREATER\n"], "source_document_id": "p03738", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two positive integers A and B. Compare the magnitudes of these numbers.\n\nConstraints\n\n1 ≤ A, B ≤ 10^{100}\n\nNeither A nor B begins with a 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint GREATER if A>B, LESS if A24, print GREATER.\n\nSample Input 2\n\n850\n3777\n\nSample Output 2\n\nLESS\n\nSample Input 3\n\n9720246\n22516266\n\nSample Output 3\n\nLESS\n\nSample Input 4\n\n123456789012345678901234567890\n234567890123456789012345678901\n\nSample Output 4\n\nLESS", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 836, "cpu_time_ms": 1009, "memory_kb": 163904}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s849550220", "group_id": "codeNet:p03738", "input_text": "s=readline()\nt=readline()\nif length(s)!=length(t)\n\tprintln(length(s)t?\"GREATER\":\"EQUAL\");\nend\n", "language": "Julia", "metadata": {"date": 1534995319, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03738.html", "problem_id": "p03738", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03738/input.txt", "sample_output_relpath": "derived/input_output/data/p03738/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03738/Julia/s849550220.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s849550220", "user_id": "u657913472"}, "prompt_components": {"gold_output": "GREATER\n", "input_to_evaluate": "s=readline()\nt=readline()\nif length(s)!=length(t)\n\tprintln(length(s)t?\"GREATER\":\"EQUAL\");\nend\n", "problem_context": "Score : 200 points\n\nProblem Statement\n\nYou are given two positive integers A and B. Compare the magnitudes of these numbers.\n\nConstraints\n\n1 ≤ A, B ≤ 10^{100}\n\nNeither A nor B begins with a 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint GREATER if A>B, LESS if A24, print GREATER.\n\nSample Input 2\n\n850\n3777\n\nSample Output 2\n\nLESS\n\nSample Input 3\n\n9720246\n22516266\n\nSample Output 3\n\nLESS\n\nSample Input 4\n\n123456789012345678901234567890\n234567890123456789012345678901\n\nSample Output 4\n\nLESS", "sample_input": "36\n24\n"}, "reference_outputs": ["GREATER\n"], "source_document_id": "p03738", "source_text": "Score : 200 points\n\nProblem Statement\n\nYou are given two positive integers A and B. Compare the magnitudes of these numbers.\n\nConstraints\n\n1 ≤ A, B ≤ 10^{100}\n\nNeither A nor B begins with a 0.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nA\nB\n\nOutput\n\nPrint GREATER if A>B, LESS if A24, print GREATER.\n\nSample Input 2\n\n850\n3777\n\nSample Output 2\n\nLESS\n\nSample Input 3\n\n9720246\n22516266\n\nSample Output 3\n\nLESS\n\nSample Input 4\n\n123456789012345678901234567890\n234567890123456789012345678901\n\nSample Output 4\n\nLESS", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 152, "cpu_time_ms": 295, "memory_kb": 108328}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s412612319", "group_id": "codeNet:p03739", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = map(parseInt, split(readline()))\n\tb = Array{Int}(n)\n\tk = 0\n\tif a[1] > 0\n\t\tb[1] = 1\n\t\tk += abs(a[1]-1)\n\telse\n\t\tb[1] = -1\n\t\tk += abs(a[1]+1)\n\tend\n\tfor i in 2:n\n\t\tb[i] = a[i]+b[i-1]\n\t\tif b[i]*b[i-1] >= 0\n\t\t\tif b[i-1] < 0\n\t\t\t\tk += abs(b[i]-1)\n \t\t\tb[i] = 1\n\t\t\telse\n\t\t\t\tk += abs(b[i]+1)\n\t\t\t\tb[i] = -1\n\t\t\tend\n\t\tend\n\tend\n\tc = Array{Int}(n)\n\tl = 0\n\tif a[1] > 0\n\t\tc[1] = -1\n\t\tl += abs(a[1]+1)\n\telse\n\t\tc[1] = 1\n\t\tl += abs(a[1]-1)\n\tend\n\tfor i in 2:n\n\t\tc[i] = a[i]+c[i-1]\n\t\tif c[i]*c[i-1] >= 0\n\t\t\tif c[i-1] < 0\n\t\t\t\tl += abs(c[i]-1)\n \t\t\tc[i] = 1\n\t\t\telse\n\t\t\t\tl += abs(c[i]+1)\n\t\t\t\tc[i] = -1\n\t\t\tend\n\t\tend\n\tend\n\tprint(min(k,l))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1545100147, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03739.html", "problem_id": "p03739", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03739/input.txt", "sample_output_relpath": "derived/input_output/data/p03739/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03739/Julia/s412612319.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s412612319", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\ta = map(parseInt, split(readline()))\n\tb = Array{Int}(n)\n\tk = 0\n\tif a[1] > 0\n\t\tb[1] = 1\n\t\tk += abs(a[1]-1)\n\telse\n\t\tb[1] = -1\n\t\tk += abs(a[1]+1)\n\tend\n\tfor i in 2:n\n\t\tb[i] = a[i]+b[i-1]\n\t\tif b[i]*b[i-1] >= 0\n\t\t\tif b[i-1] < 0\n\t\t\t\tk += abs(b[i]-1)\n \t\t\tb[i] = 1\n\t\t\telse\n\t\t\t\tk += abs(b[i]+1)\n\t\t\t\tb[i] = -1\n\t\t\tend\n\t\tend\n\tend\n\tc = Array{Int}(n)\n\tl = 0\n\tif a[1] > 0\n\t\tc[1] = -1\n\t\tl += abs(a[1]+1)\n\telse\n\t\tc[1] = 1\n\t\tl += abs(a[1]-1)\n\tend\n\tfor i in 2:n\n\t\tc[i] = a[i]+c[i-1]\n\t\tif c[i]*c[i-1] >= 0\n\t\t\tif c[i-1] < 0\n\t\t\t\tl += abs(c[i]-1)\n \t\t\tc[i] = 1\n\t\t\telse\n\t\t\t\tl += abs(c[i]+1)\n\t\t\t\tc[i] = -1\n\t\t\tend\n\t\tend\n\tend\n\tprint(min(k,l))\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_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 necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "sample_input": "4\n1 -3 1 0\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03739", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an integer sequence of length N. The i-th term in the sequence is a_i.\nIn one operation, you can select a term and either increment or decrement it by one.\n\nAt least how many operations are necessary to satisfy the following conditions?\n\nFor every i (1≤i≤n), the sum of the terms from the 1-st through i-th term is not zero.\n\nFor every i (1≤i≤n-1), the sign of the sum of the terms from the 1-st through i-th term, is different from the sign of the sum of the terms from the 1-st through (i+1)-th term.\n\nConstraints\n\n2 ≤ n ≤ 10^5\n\n|a_i| ≤ 10^9\n\nEach a_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 necessary count of operations.\n\nSample Input 1\n\n4\n1 -3 1 0\n\nSample Output 1\n\n4\n\nFor example, the given sequence can be transformed into 1, -2, 2, -2 by four operations. The sums of the first one, two, three and four terms are 1, -1, 1 and -1, respectively, which satisfy the conditions.\n\nSample Input 2\n\n5\n3 -6 4 -5 7\n\nSample Output 2\n\n0\n\nThe given sequence already satisfies the conditions.\n\nSample Input 3\n\n6\n-1 4 3 2 -5 4\n\nSample Output 3\n\n8", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 711, "cpu_time_ms": 487, "memory_kb": 136308}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s958532008", "group_id": "codeNet:p03740", "input_text": "x,y = parse.(split(readline()))\nprintln(abs(x-y)<=1?\"Brown\":\"Alice\")", "language": "Julia", "metadata": {"date": 1557617964, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03740.html", "problem_id": "p03740", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03740/input.txt", "sample_output_relpath": "derived/input_output/data/p03740/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03740/Julia/s958532008.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s958532008", "user_id": "u095714878"}, "prompt_components": {"gold_output": "Brown\n", "input_to_evaluate": "x,y = parse.(split(readline()))\nprintln(abs(x-y)<=1?\"Brown\":\"Alice\")", "problem_context": "Score : 500 points\n\nProblem Statement\n\nAlice and Brown loves games. Today, they will play the following game.\n\nIn this game, there are two piles initially consisting of X and Y stones, respectively.\nAlice and Bob alternately perform the following operation, starting from Alice:\n\nTake 2i stones from one of the piles. Then, throw away i of them, and put the remaining i in the other pile. Here, the integer i (1≤i) can be freely chosen as long as there is a sufficient number of stones in the pile.\n\nThe player who becomes unable to perform the operation, loses the game.\n\nGiven X and Y, determine the winner of the game, assuming that both players play optimally.\n\nConstraints\n\n0 ≤ X, Y ≤ 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the winner: either Alice or Brown.\n\nSample Input 1\n\n2 1\n\nSample Output 1\n\nBrown\n\nAlice can do nothing but taking two stones from the pile containing two stones. As a result, the piles consist of zero and two stones, respectively. Then, Brown will take the two stones, and the piles will consist of one and zero stones, respectively. Alice will be unable to perform the operation anymore, which means Brown's victory.\n\nSample Input 2\n\n5 0\n\nSample Output 2\n\nAlice\n\nSample Input 3\n\n0 0\n\nSample Output 3\n\nBrown\n\nSample Input 4\n\n4 8\n\nSample Output 4\n\nAlice", "sample_input": "2 1\n"}, "reference_outputs": ["Brown\n"], "source_document_id": "p03740", "source_text": "Score : 500 points\n\nProblem Statement\n\nAlice and Brown loves games. Today, they will play the following game.\n\nIn this game, there are two piles initially consisting of X and Y stones, respectively.\nAlice and Bob alternately perform the following operation, starting from Alice:\n\nTake 2i stones from one of the piles. Then, throw away i of them, and put the remaining i in the other pile. Here, the integer i (1≤i) can be freely chosen as long as there is a sufficient number of stones in the pile.\n\nThe player who becomes unable to perform the operation, loses the game.\n\nGiven X and Y, determine the winner of the game, assuming that both players play optimally.\n\nConstraints\n\n0 ≤ X, Y ≤ 10^{18}\n\nInput\n\nInput is given from Standard Input in the following format:\n\nX Y\n\nOutput\n\nPrint the winner: either Alice or Brown.\n\nSample Input 1\n\n2 1\n\nSample Output 1\n\nBrown\n\nAlice can do nothing but taking two stones from the pile containing two stones. As a result, the piles consist of zero and two stones, respectively. Then, Brown will take the two stones, and the piles will consist of one and zero stones, respectively. Alice will be unable to perform the operation anymore, which means Brown's victory.\n\nSample Input 2\n\n5 0\n\nSample Output 2\n\nAlice\n\nSample Input 3\n\n0 0\n\nSample Output 3\n\nBrown\n\nSample Input 4\n\n4 8\n\nSample Output 4\n\nAlice", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 68, "cpu_time_ms": 542, "memory_kb": 119300}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s481573110", "group_id": "codeNet:p03745", "input_text": "function f()\n N = parse(Int, readline())\n A = parse.(Int, split(readline()))\n ans = 1\n flag = 0\n for i in 2:N\n if flag == 1\n if A[i]A[i-1]\n flag = 1\n elseif A[i]A[i-1]\n ans += 1\n flag = 0\n end\n end\n end\n \n println(Int(ans))\nend\nf()", "language": "Julia", "metadata": {"date": 1598923308, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p03745.html", "problem_id": "p03745", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03745/input.txt", "sample_output_relpath": "derived/input_output/data/p03745/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03745/Julia/s481573110.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s481573110", "user_id": "u499062271"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function f()\n N = parse(Int, readline())\n A = parse.(Int, split(readline()))\n ans = 1\n flag = 0\n for i in 2:N\n if flag == 1\n if A[i]A[i-1]\n flag = 1\n elseif A[i]A[i-1]\n ans += 1\n flag = 0\n end\n end\n end\n \n println(Int(ans))\nend\nf()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nYou are given an array A of length N.\nYour task is to divide it into several contiguous subarrays.\nHere, all subarrays obtained must be sorted in either non-decreasing or non-increasing order.\nAt least how many subarrays do you need to divide A into?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nEach A_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 subarrays after division of A.\n\nSample Input 1\n\n6\n1 2 3 2 2 1\n\nSample Output 1\n\n2\n\nOne optimal solution is to divide the array into [1,2,3] and [2,2,1].\n\nSample Input 2\n\n9\n1 2 1 2 1 2 1 2 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1 2 3 2 1 999999999 1000000000\n\nSample Output 3\n\n3", "sample_input": "6\n1 2 3 2 2 1\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03745", "source_text": "Score : 300 points\n\nProblem Statement\n\nYou are given an array A of length N.\nYour task is to divide it into several contiguous subarrays.\nHere, all subarrays obtained must be sorted in either non-decreasing or non-increasing order.\nAt least how many subarrays do you need to divide A into?\n\nConstraints\n\n1 \\leq N \\leq 10^5\n\n1 \\leq A_i \\leq 10^9\n\nEach A_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 subarrays after division of A.\n\nSample Input 1\n\n6\n1 2 3 2 2 1\n\nSample Output 1\n\n2\n\nOne optimal solution is to divide the array into [1,2,3] and [2,2,1].\n\nSample Input 2\n\n9\n1 2 1 2 1 2 1 2 1\n\nSample Output 2\n\n5\n\nSample Input 3\n\n7\n1 2 3 2 1 999999999 1000000000\n\nSample Output 3\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 550, "cpu_time_ms": 282, "memory_kb": 186528}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s609057828", "group_id": "codeNet:p03745", "input_text": "function main()\n\tN=parse(Int,readline())\n\tA=map(x->parse(Int,x),split(readline()))\n\tans=1\n\ti=3\n\tnow=A[1]A[2] ? -1 : 0\n\twhile i<=N\n\t\tif now==1&&A[i-1]>A[i]\n\t\t\tans+=1\n\t\t\ti+=1\n\t\t\tnow=-1\n\t\telseif now==-1&&A[i-1]parse(Int,x),split(readline()))\n\tans=1\n\ti=3\n\tnow=A[1]A[2] ? -1 : 0\n\twhile i<=N\n\t\tif now==1&&A[i-1]>A[i]\n\t\t\tans+=1\n\t\t\ti+=1\n\t\t\tnow=-1\n\t\telseif now==-1&&A[i-1] split |> parseMap\n\te = [Int[] for i in 1:n]\n\tvst = zeros(Int,n)\n\tans = Tuple{Int,Int}[]\n\tstack = Int[]\n\tfor i in 1:m\n\t\ta,b = readline() |> split |> parseMap\n\t\tif i == 1\n\t\t\tvst[a] = 1\n\t\t\tvst[b] = 1\n\t\t\tpush!(ans,(a,b))\n\t\t\tpush!(stack,a)\n\t\t\tpush!(stack,b)\n\t\t\tend\n\t\tpush!(e[a],b)\n\t\tpush!(e[b],a)\n\tend\n\twhile !isempty(stack)\n\t\tnow = pop!(stack)\n\t\tfor i in e[now]\n\t\t\tif vst[i] == 0\n\t\t\t\tvst[i] = 1\n\t\t\t\tpush!(ans,(now,i))\n\t\t\t\tpush!(stack,i)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tprintln(sum(vst))\n\tl = 0\n\tfor i in 1:n\n\t\tif vst[i] == 1\n\t\t\tprint(i)\n\t\t\tl = i+1\n\t\t\tbreak\n\t\tend\n\tend\n\tfor i in l:n\n\t\tif vst[i] == 1\n\t\t\tprint(\" \",i)\n\t\tend\n\tend\n\tprintln(\"\")\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1576699397, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03746.html", "problem_id": "p03746", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03746/input.txt", "sample_output_relpath": "derived/input_output/data/p03746/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03746/Julia/s266352598.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s266352598", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n2 3 1 4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\te = [Int[] for i in 1:n]\n\tvst = zeros(Int,n)\n\tans = Tuple{Int,Int}[]\n\tstack = Int[]\n\tfor i in 1:m\n\t\ta,b = readline() |> split |> parseMap\n\t\tif i == 1\n\t\t\tvst[a] = 1\n\t\t\tvst[b] = 1\n\t\t\tpush!(ans,(a,b))\n\t\t\tpush!(stack,a)\n\t\t\tpush!(stack,b)\n\t\t\tend\n\t\tpush!(e[a],b)\n\t\tpush!(e[b],a)\n\tend\n\twhile !isempty(stack)\n\t\tnow = pop!(stack)\n\t\tfor i in e[now]\n\t\t\tif vst[i] == 0\n\t\t\t\tvst[i] = 1\n\t\t\t\tpush!(ans,(now,i))\n\t\t\t\tpush!(stack,i)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\n\tprintln(sum(vst))\n\tl = 0\n\tfor i in 1:n\n\t\tif vst[i] == 1\n\t\t\tprint(i)\n\t\t\tl = i+1\n\t\t\tbreak\n\t\tend\n\tend\n\tfor i in l:n\n\t\tif vst[i] == 1\n\t\t\tprint(\" \",i)\n\t\tend\n\tend\n\tprintln(\"\")\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nYou are given a connected undirected simple graph, which has N vertices and M edges.\nThe vertices are numbered 1 through N, and the edges are numbered 1 through M.\nEdge i connects vertices A_i and B_i.\nYour task is to find a path that satisfies the following conditions:\n\nThe path traverses two or more vertices.\n\nThe path does not traverse the same vertex more than once.\n\nA vertex directly connected to at least one of the endpoints of the path, is always contained in the path.\n\nIt can be proved that such a path always exists.\nAlso, if there are more than one solution, any of them will be accepted.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nThe given graph is connected and simple (that is, for every pair of vertices, there is at most one edge that directly connects them).\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\nFind one path that satisfies the conditions, and print it in the following format.\nIn the first line, print the count of the vertices contained in the path.\nIn the second line, print a space-separated list of the indices of the vertices, in order of appearance in the path.\n\nSample Input 1\n\n5 6\n1 3\n1 4\n2 3\n1 5\n3 5\n2 4\n\nSample Output 1\n\n4\n2 3 1 4\n\nThere are two vertices directly connected to vertex 2: vertices 3 and 4.\nThere are also two vertices directly connected to vertex 4: vertices 1 and 2.\nHence, the path 2 → 3 → 1 → 4 satisfies the conditions.\n\nSample Input 2\n\n7 8\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n3 5\n2 6\n\nSample Output 2\n\n7\n1 2 3 4 5 6 7", "sample_input": "5 6\n1 3\n1 4\n2 3\n1 5\n3 5\n2 4\n"}, "reference_outputs": ["4\n2 3 1 4\n"], "source_document_id": "p03746", "source_text": "Score : 500 points\n\nProblem Statement\n\nYou are given a connected undirected simple graph, which has N vertices and M edges.\nThe vertices are numbered 1 through N, and the edges are numbered 1 through M.\nEdge i connects vertices A_i and B_i.\nYour task is to find a path that satisfies the following conditions:\n\nThe path traverses two or more vertices.\n\nThe path does not traverse the same vertex more than once.\n\nA vertex directly connected to at least one of the endpoints of the path, is always contained in the path.\n\nIt can be proved that such a path always exists.\nAlso, if there are more than one solution, any of them will be accepted.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq M \\leq 10^5\n\n1 \\leq A_i < B_i \\leq N\n\nThe given graph is connected and simple (that is, for every pair of vertices, there is at most one edge that directly connects them).\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\nFind one path that satisfies the conditions, and print it in the following format.\nIn the first line, print the count of the vertices contained in the path.\nIn the second line, print a space-separated list of the indices of the vertices, in order of appearance in the path.\n\nSample Input 1\n\n5 6\n1 3\n1 4\n2 3\n1 5\n3 5\n2 4\n\nSample Output 1\n\n4\n2 3 1 4\n\nThere are two vertices directly connected to vertex 2: vertices 3 and 4.\nThere are also two vertices directly connected to vertex 4: vertices 1 and 2.\nHence, the path 2 → 3 → 1 → 4 satisfies the conditions.\n\nSample Input 2\n\n7 8\n1 2\n2 3\n3 4\n4 5\n5 6\n6 7\n3 5\n2 6\n\nSample Output 2\n\n7\n1 2 3 4 5 6 7", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 768, "cpu_time_ms": 729, "memory_kb": 159612}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s917878747", "group_id": "codeNet:p03759", "input_text": "ParseInt(x) = parse(Int,x)\nParseMap(x::Array{SubString{String},1}) = map(ParseInt,x)\nfunction main()\n a,b,c = ParseMap(split(readline()))\n println(b - a == c - b ? \"YES\" : \"NO\")\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1590024093, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03759.html", "problem_id": "p03759", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03759/input.txt", "sample_output_relpath": "derived/input_output/data/p03759/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03759/Julia/s917878747.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s917878747", "user_id": "u962609087"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "ParseInt(x) = parse(Int,x)\nParseMap(x::Array{SubString{String},1}) = map(ParseInt,x)\nfunction main()\n a,b,c = ParseMap(split(readline()))\n println(b - a == c - b ? \"YES\" : \"NO\")\nend\nmain()\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThree poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.\nWe will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b.\n\nDetermine whether the arrangement of the poles is beautiful.\n\nConstraints\n\n1 \\leq a,b,c \\leq 100\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 YES if the arrangement of the poles is beautiful; print NO otherwise.\n\nSample Input 1\n\n2 4 6\n\nSample Output 1\n\nYES\n\nSince 4-2 = 6-4, this arrangement of poles is beautiful.\n\nSample Input 2\n\n2 5 6\n\nSample Output 2\n\nNO\n\nSince 5-2 \\neq 6-5, this arrangement of poles is not beautiful.\n\nSample Input 3\n\n3 2 1\n\nSample Output 3\n\nYES\n\nSince 1-2 = 2-3, this arrangement of poles is beautiful.", "sample_input": "2 4 6\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03759", "source_text": "Score : 100 points\n\nProblem Statement\n\nThree poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.\nWe will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b.\n\nDetermine whether the arrangement of the poles is beautiful.\n\nConstraints\n\n1 \\leq a,b,c \\leq 100\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 YES if the arrangement of the poles is beautiful; print NO otherwise.\n\nSample Input 1\n\n2 4 6\n\nSample Output 1\n\nYES\n\nSince 4-2 = 6-4, this arrangement of poles is beautiful.\n\nSample Input 2\n\n2 5 6\n\nSample Output 2\n\nNO\n\nSince 5-2 \\neq 6-5, this arrangement of poles is not beautiful.\n\nSample Input 3\n\n3 2 1\n\nSample Output 3\n\nYES\n\nSince 1-2 = 2-3, this arrangement of poles is beautiful.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 736, "memory_kb": 166736}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s262451565", "group_id": "codeNet:p03759", "input_text": "a,b,c=parse.(split(readline()))\nprintln(c-b==b-a?\"YES\":\"NO\")", "language": "Julia", "metadata": {"date": 1546360422, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03759.html", "problem_id": "p03759", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03759/input.txt", "sample_output_relpath": "derived/input_output/data/p03759/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03759/Julia/s262451565.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s262451565", "user_id": "u095714878"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "a,b,c=parse.(split(readline()))\nprintln(c-b==b-a?\"YES\":\"NO\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThree poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.\nWe will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b.\n\nDetermine whether the arrangement of the poles is beautiful.\n\nConstraints\n\n1 \\leq a,b,c \\leq 100\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 YES if the arrangement of the poles is beautiful; print NO otherwise.\n\nSample Input 1\n\n2 4 6\n\nSample Output 1\n\nYES\n\nSince 4-2 = 6-4, this arrangement of poles is beautiful.\n\nSample Input 2\n\n2 5 6\n\nSample Output 2\n\nNO\n\nSince 5-2 \\neq 6-5, this arrangement of poles is not beautiful.\n\nSample Input 3\n\n3 2 1\n\nSample Output 3\n\nYES\n\nSince 1-2 = 2-3, this arrangement of poles is beautiful.", "sample_input": "2 4 6\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03759", "source_text": "Score : 100 points\n\nProblem Statement\n\nThree poles stand evenly spaced along a line. Their heights are a, b and c meters, from left to right.\nWe will call the arrangement of the poles beautiful if the tops of the poles lie on the same line, that is, b-a = c-b.\n\nDetermine whether the arrangement of the poles is beautiful.\n\nConstraints\n\n1 \\leq a,b,c \\leq 100\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 YES if the arrangement of the poles is beautiful; print NO otherwise.\n\nSample Input 1\n\n2 4 6\n\nSample Output 1\n\nYES\n\nSince 4-2 = 6-4, this arrangement of poles is beautiful.\n\nSample Input 2\n\n2 5 6\n\nSample Output 2\n\nNO\n\nSince 5-2 \\neq 6-5, this arrangement of poles is not beautiful.\n\nSample Input 3\n\n3 2 1\n\nSample Output 3\n\nYES\n\nSince 1-2 = 2-3, this arrangement of poles is beautiful.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 60, "cpu_time_ms": 558, "memory_kb": 117692}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s126814915", "group_id": "codeNet:p03761", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn = parseInt(readline())\n\tx = zeros(Int,n,26)\n\tfor i in 1:n\n\t\tk = chomp(readline())\n\t\tfor j in 1:length(k)\n\t\t\tx[i,Int[k[j]]-96] += 1\n\t\tend\n\tend\n\tfor i in 1:26\n\t\tk = minimum(x[:,i])\n\t\tfor j in 1:k\n\t\t\tprint(Char(96+i))\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1543513566, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03761.html", "problem_id": "p03761", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03761/input.txt", "sample_output_relpath": "derived/input_output/data/p03761/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03761/Julia/s126814915.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s126814915", "user_id": "u095714878"}, "prompt_components": {"gold_output": "aac\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn = parseInt(readline())\n\tx = zeros(Int,n,26)\n\tfor i in 1:n\n\t\tk = chomp(readline())\n\t\tfor j in 1:length(k)\n\t\t\tx[i,Int[k[j]]-96] += 1\n\t\tend\n\tend\n\tfor i in 1:26\n\t\tk = minimum(x[:,i])\n\t\tfor j in 1:k\n\t\t\tprint(Char(96+i))\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nSnuke loves \"paper cutting\": he cuts out characters from a newspaper headline and rearranges them to form another string.\n\nHe will receive a headline which contains one of the strings S_1,...,S_n tomorrow.\nHe is excited and already thinking of what string he will create.\nSince he does not know the string on the headline yet, he is interested in strings that can be created regardless of which string the headline contains.\n\nFind the longest string that can be created regardless of which string among S_1,...,S_n the headline contains.\nIf there are multiple such strings, find the lexicographically smallest one among them.\n\nConstraints\n\n1 \\leq n \\leq 50\n\n1 \\leq |S_i| \\leq 50 for every i = 1, ..., n.\n\nS_i consists of lowercase English letters (a - z) for every i = 1, ..., n.\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 lexicographically smallest string among the longest strings that satisfy the condition.\nIf the answer is an empty string, print an empty line.\n\nSample Input 1\n\n3\ncbaa\ndaacc\nacacac\n\nSample Output 1\n\naac\n\nThe strings that can be created from each of cbaa, daacc and acacac, are aa, aac, aca, caa and so forth.\nAmong them, aac, aca and caa are the longest, and the lexicographically smallest of these three is aac.\n\nSample Input 2\n\n3\na\naa\nb\n\nSample Output 2\n\nThe answer is an empty string.", "sample_input": "3\ncbaa\ndaacc\nacacac\n"}, "reference_outputs": ["aac\n"], "source_document_id": "p03761", "source_text": "Score : 300 points\n\nProblem Statement\n\nSnuke loves \"paper cutting\": he cuts out characters from a newspaper headline and rearranges them to form another string.\n\nHe will receive a headline which contains one of the strings S_1,...,S_n tomorrow.\nHe is excited and already thinking of what string he will create.\nSince he does not know the string on the headline yet, he is interested in strings that can be created regardless of which string the headline contains.\n\nFind the longest string that can be created regardless of which string among S_1,...,S_n the headline contains.\nIf there are multiple such strings, find the lexicographically smallest one among them.\n\nConstraints\n\n1 \\leq n \\leq 50\n\n1 \\leq |S_i| \\leq 50 for every i = 1, ..., n.\n\nS_i consists of lowercase English letters (a - z) for every i = 1, ..., n.\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 lexicographically smallest string among the longest strings that satisfy the condition.\nIf the answer is an empty string, print an empty line.\n\nSample Input 1\n\n3\ncbaa\ndaacc\nacacac\n\nSample Output 1\n\naac\n\nThe strings that can be created from each of cbaa, daacc and acacac, are aa, aac, aca, caa and so forth.\nAmong them, aac, aca and caa are the longest, and the lexicographically smallest of these three is aac.\n\nSample Input 2\n\n3\na\naa\nb\n\nSample Output 2\n\nThe answer is an empty string.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 285, "cpu_time_ms": 459, "memory_kb": 116528}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s224235221", "group_id": "codeNet:p03762", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,m = map(parseInt, split(readline()))\n\tx = map(parseInt, split(readline()))\n\ty = map(parseInt, split(readline()))\n\tsx = 0\n\tsy = 0\n\tfor k in 1:n\n\t\tsx += ((k-1)*x[k] - (n-k)*x[k])%1000000007\n\tend\n for k in 1:m\n\t\tsy += ((k-1)*y[k] - (m-k)*y[k])%1000000007\n end\n\tprintln((sx%1000000007)*(sy%1000000007)%1000000007)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1543442445, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03762.html", "problem_id": "p03762", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03762/input.txt", "sample_output_relpath": "derived/input_output/data/p03762/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03762/Julia/s224235221.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s224235221", "user_id": "u095714878"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,m = map(parseInt, split(readline()))\n\tx = map(parseInt, split(readline()))\n\ty = map(parseInt, split(readline()))\n\tsx = 0\n\tsy = 0\n\tfor k in 1:n\n\t\tsx += ((k-1)*x[k] - (n-k)*x[k])%1000000007\n\tend\n for k in 1:m\n\t\tsy += ((k-1)*y[k] - (m-k)*y[k])%1000000007\n end\n\tprintln((sx%1000000007)*(sy%1000000007)%1000000007)\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nOn a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis.\nAmong the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i.\nSimilarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i.\n\nFor every rectangle that is formed by these lines, find its area, and print the total area modulo 10^9+7.\n\nThat is, for every quadruple (i,j,k,l) satisfying 1\\leq i < j\\leq n and 1\\leq k < l\\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j, y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7.\n\nConstraints\n\n2 \\leq n,m \\leq 10^5\n\n-10^9 \\leq x_1 < ... < x_n \\leq 10^9\n\n-10^9 \\leq y_1 < ... < y_m \\leq 10^9\n\nx_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\nx_1 x_2 ... x_n\ny_1 y_2 ... y_m\n\nOutput\n\nPrint the total area of the rectangles, modulo 10^9+7.\n\nSample Input 1\n\n3 3\n1 3 4\n1 3 6\n\nSample Output 1\n\n60\n\nThe following figure illustrates this input:\n\nThe total area of the nine rectangles A, B, ..., I shown in the following figure, is 60.\n\nSample Input 2\n\n6 5\n-790013317 -192321079 95834122 418379342 586260100 802780784\n-253230108 193944314 363756450 712662868 735867677\n\nSample Output 2\n\n835067060", "sample_input": "3 3\n1 3 4\n1 3 6\n"}, "reference_outputs": ["60\n"], "source_document_id": "p03762", "source_text": "Score : 500 points\n\nProblem Statement\n\nOn a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis.\nAmong the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i.\nSimilarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i.\n\nFor every rectangle that is formed by these lines, find its area, and print the total area modulo 10^9+7.\n\nThat is, for every quadruple (i,j,k,l) satisfying 1\\leq i < j\\leq n and 1\\leq k < l\\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j, y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7.\n\nConstraints\n\n2 \\leq n,m \\leq 10^5\n\n-10^9 \\leq x_1 < ... < x_n \\leq 10^9\n\n-10^9 \\leq y_1 < ... < y_m \\leq 10^9\n\nx_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\nx_1 x_2 ... x_n\ny_1 y_2 ... y_m\n\nOutput\n\nPrint the total area of the rectangles, modulo 10^9+7.\n\nSample Input 1\n\n3 3\n1 3 4\n1 3 6\n\nSample Output 1\n\n60\n\nThe following figure illustrates this input:\n\nThe total area of the nine rectangles A, B, ..., I shown in the following figure, is 60.\n\nSample Input 2\n\n6 5\n-790013317 -192321079 95834122 418379342 586260100 802780784\n-253230108 193944314 363756450 712662868 735867677\n\nSample Output 2\n\n835067060", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 375, "cpu_time_ms": 604, "memory_kb": 151740}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s396943349", "group_id": "codeNet:p03762", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,m = map(parseInt, split(readline()))\n\tx = map(parseInt, split(readline()))\n\ty = map(parseInt, split(readline()))\n\tsx = 0\n\tsy = 0\n\tfor k in 1:n\n\t\tsx += (k-1)*x[k] - (n-k)*x[k]\n\tend\n for k in 1:m\n\t\tsy += (k-1)*y[k] - (m-k)*y[k]\n end\n\tprintln(sx%1000000007*sy%1000000007)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1543442243, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03762.html", "problem_id": "p03762", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03762/input.txt", "sample_output_relpath": "derived/input_output/data/p03762/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03762/Julia/s396943349.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s396943349", "user_id": "u095714878"}, "prompt_components": {"gold_output": "60\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,m = map(parseInt, split(readline()))\n\tx = map(parseInt, split(readline()))\n\ty = map(parseInt, split(readline()))\n\tsx = 0\n\tsy = 0\n\tfor k in 1:n\n\t\tsx += (k-1)*x[k] - (n-k)*x[k]\n\tend\n for k in 1:m\n\t\tsy += (k-1)*y[k] - (m-k)*y[k]\n end\n\tprintln(sx%1000000007*sy%1000000007)\nend\n\nmain()", "problem_context": "Score : 500 points\n\nProblem Statement\n\nOn a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis.\nAmong the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i.\nSimilarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i.\n\nFor every rectangle that is formed by these lines, find its area, and print the total area modulo 10^9+7.\n\nThat is, for every quadruple (i,j,k,l) satisfying 1\\leq i < j\\leq n and 1\\leq k < l\\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j, y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7.\n\nConstraints\n\n2 \\leq n,m \\leq 10^5\n\n-10^9 \\leq x_1 < ... < x_n \\leq 10^9\n\n-10^9 \\leq y_1 < ... < y_m \\leq 10^9\n\nx_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\nx_1 x_2 ... x_n\ny_1 y_2 ... y_m\n\nOutput\n\nPrint the total area of the rectangles, modulo 10^9+7.\n\nSample Input 1\n\n3 3\n1 3 4\n1 3 6\n\nSample Output 1\n\n60\n\nThe following figure illustrates this input:\n\nThe total area of the nine rectangles A, B, ..., I shown in the following figure, is 60.\n\nSample Input 2\n\n6 5\n-790013317 -192321079 95834122 418379342 586260100 802780784\n-253230108 193944314 363756450 712662868 735867677\n\nSample Output 2\n\n835067060", "sample_input": "3 3\n1 3 4\n1 3 6\n"}, "reference_outputs": ["60\n"], "source_document_id": "p03762", "source_text": "Score : 500 points\n\nProblem Statement\n\nOn a two-dimensional plane, there are m lines drawn parallel to the x axis, and n lines drawn parallel to the y axis.\nAmong the lines parallel to the x axis, the i-th from the bottom is represented by y = y_i.\nSimilarly, among the lines parallel to the y axis, the i-th from the left is represented by x = x_i.\n\nFor every rectangle that is formed by these lines, find its area, and print the total area modulo 10^9+7.\n\nThat is, for every quadruple (i,j,k,l) satisfying 1\\leq i < j\\leq n and 1\\leq k < l\\leq m, find the area of the rectangle formed by the lines x=x_i, x=x_j, y=y_k and y=y_l, and print the sum of these areas modulo 10^9+7.\n\nConstraints\n\n2 \\leq n,m \\leq 10^5\n\n-10^9 \\leq x_1 < ... < x_n \\leq 10^9\n\n-10^9 \\leq y_1 < ... < y_m \\leq 10^9\n\nx_i and y_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nn m\nx_1 x_2 ... x_n\ny_1 y_2 ... y_m\n\nOutput\n\nPrint the total area of the rectangles, modulo 10^9+7.\n\nSample Input 1\n\n3 3\n1 3 4\n1 3 6\n\nSample Output 1\n\n60\n\nThe following figure illustrates this input:\n\nThe total area of the nine rectangles A, B, ..., I shown in the following figure, is 60.\n\nSample Input 2\n\n6 5\n-790013317 -192321079 95834122 418379342 586260100 802780784\n-253230108 193944314 363756450 712662868 735867677\n\nSample Output 2\n\n835067060", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 334, "cpu_time_ms": 655, "memory_kb": 153940}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s564056942", "group_id": "codeNet:p03766", "input_text": "n=parse(Int,readline())\nprintln((BigInt[2 -1 1 -1;1 0 0 0;0 1 0 0;0 0 0 1]^n*[n^2;n;1;1])[3]%(10^9+7))", "language": "Julia", "metadata": {"date": 1599359553, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p03766.html", "problem_id": "p03766", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03766/input.txt", "sample_output_relpath": "derived/input_output/data/p03766/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03766/Julia/s564056942.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s564056942", "user_id": "u541055501"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "n=parse(Int,readline())\nprintln((BigInt[2 -1 1 -1;1 0 0 0;0 1 0 0;0 0 0 1]^n*[n^2;n;1;1])[3]%(10^9+7))", "problem_context": "Score : 1000 points\n\nProblem Statement\n\nHow many infinite sequences a_1, a_2, ... consisting of {{1, ... ,n}} satisfy the following conditions?\n\nThe n-th and subsequent elements are all equal. That is, if n \\leq i,j, a_i = a_j.\n\nFor every integer i, the a_i elements immediately following the i-th element are all equal. That is, if i < j < k\\leq i+a_i, a_j = a_k.\n\nFind the count modulo 10^9+7.\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 how many sequences satisfy the conditions, modulo 10^9+7.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n4\n\nThe four sequences that satisfy the conditions are:\n\n1, 1, 1, ...\n\n1, 2, 2, ...\n\n2, 1, 1, ...\n\n2, 2, 2, ...\n\nSample Input 2\n\n654321\n\nSample Output 2\n\n968545283", "sample_input": "2\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03766", "source_text": "Score : 1000 points\n\nProblem Statement\n\nHow many infinite sequences a_1, a_2, ... consisting of {{1, ... ,n}} satisfy the following conditions?\n\nThe n-th and subsequent elements are all equal. That is, if n \\leq i,j, a_i = a_j.\n\nFor every integer i, the a_i elements immediately following the i-th element are all equal. That is, if i < j < k\\leq i+a_i, a_j = a_k.\n\nFind the count modulo 10^9+7.\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 how many sequences satisfy the conditions, modulo 10^9+7.\n\nSample Input 1\n\n2\n\nSample Output 1\n\n4\n\nThe four sequences that satisfy the conditions are:\n\n1, 1, 1, ...\n\n1, 2, 2, ...\n\n2, 1, 1, ...\n\n2, 2, 2, ...\n\nSample Input 2\n\n654321\n\nSample Output 2\n\n968545283", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1071, "memory_kb": 232584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s589962355", "group_id": "codeNet:p03767", "input_text": "mp(x)=parse(Int,x)\na=mp(readline())\nb=sort(mp.(split(readline())))\nprint(b[end-2a+1:end-a])", "language": "Julia", "metadata": {"date": 1585910649, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03767.html", "problem_id": "p03767", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03767/input.txt", "sample_output_relpath": "derived/input_output/data/p03767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03767/Julia/s589962355.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s589962355", "user_id": "u443151804"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "mp(x)=parse(Int,x)\na=mp(readline())\nb=sort(mp.(split(readline())))\nprint(b[end-2a+1:end-a])", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are 3N participants in AtCoder Group Contest.\nThe strength of the i-th participant is represented by an integer a_i.\nThey will form N teams, each consisting of three participants.\nNo participant may belong to multiple teams.\n\nThe strength of a team is defined as the second largest strength among its members.\nFor example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3.\n\nFind the maximum possible sum of the strengths of N teams.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ 10^{9}\n\na_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n5 2 8 5 1 5\n\nSample Output 1\n\n10\n\nThe following is one formation of teams that maximizes the sum of the strengths of teams:\n\nTeam 1: consists of the first, fourth and fifth participants.\n\nTeam 2: consists of the second, third and sixth participants.\n\nSample Input 2\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 2\n\n10000000000\n\nThe sum of the strengths can be quite large.", "sample_input": "2\n5 2 8 5 1 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are 3N participants in AtCoder Group Contest.\nThe strength of the i-th participant is represented by an integer a_i.\nThey will form N teams, each consisting of three participants.\nNo participant may belong to multiple teams.\n\nThe strength of a team is defined as the second largest strength among its members.\nFor example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3.\n\nFind the maximum possible sum of the strengths of N teams.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ 10^{9}\n\na_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n5 2 8 5 1 5\n\nSample Output 1\n\n10\n\nThe following is one formation of teams that maximizes the sum of the strengths of teams:\n\nTeam 1: consists of the first, fourth and fifth participants.\n\nTeam 2: consists of the second, third and sixth participants.\n\nSample Input 2\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 2\n\n10000000000\n\nThe sum of the strengths can be quite large.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 983, "memory_kb": 160520}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s698390639", "group_id": "codeNet:p03767", "input_text": "function main()\n\tN=parse(Int,readline())\n\tA=sort(map(x->parse(Int,x),split(readline())))\n\tans=0\n\tfor i=N+1:2:3N\n\t\tans+=A[i]\n\tend\n\tprintln(ans)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1573077782, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03767.html", "problem_id": "p03767", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03767/input.txt", "sample_output_relpath": "derived/input_output/data/p03767/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03767/Julia/s698390639.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s698390639", "user_id": "u657913472"}, "prompt_components": {"gold_output": "10\n", "input_to_evaluate": "function main()\n\tN=parse(Int,readline())\n\tA=sort(map(x->parse(Int,x),split(readline())))\n\tans=0\n\tfor i=N+1:2:3N\n\t\tans+=A[i]\n\tend\n\tprintln(ans)\nend\nmain()\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are 3N participants in AtCoder Group Contest.\nThe strength of the i-th participant is represented by an integer a_i.\nThey will form N teams, each consisting of three participants.\nNo participant may belong to multiple teams.\n\nThe strength of a team is defined as the second largest strength among its members.\nFor example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3.\n\nFind the maximum possible sum of the strengths of N teams.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ 10^{9}\n\na_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n5 2 8 5 1 5\n\nSample Output 1\n\n10\n\nThe following is one formation of teams that maximizes the sum of the strengths of teams:\n\nTeam 1: consists of the first, fourth and fifth participants.\n\nTeam 2: consists of the second, third and sixth participants.\n\nSample Input 2\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 2\n\n10000000000\n\nThe sum of the strengths can be quite large.", "sample_input": "2\n5 2 8 5 1 5\n"}, "reference_outputs": ["10\n"], "source_document_id": "p03767", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are 3N participants in AtCoder Group Contest.\nThe strength of the i-th participant is represented by an integer a_i.\nThey will form N teams, each consisting of three participants.\nNo participant may belong to multiple teams.\n\nThe strength of a team is defined as the second largest strength among its members.\nFor example, a team of participants of strength 1, 5, 2 has a strength 2, and a team of three participants of strength 3, 2, 3 has a strength 3.\n\nFind the maximum possible sum of the strengths of N teams.\n\nConstraints\n\n1 ≤ N ≤ 10^5\n\n1 ≤ a_i ≤ 10^{9}\n\na_i are integers.\n\nInput\n\nInput is given from Standard Input in the following format:\n\nN\na_1 a_2 ... a_{3N}\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n2\n5 2 8 5 1 5\n\nSample Output 1\n\n10\n\nThe following is one formation of teams that maximizes the sum of the strengths of teams:\n\nTeam 1: consists of the first, fourth and fifth participants.\n\nTeam 2: consists of the second, third and sixth participants.\n\nSample Input 2\n\n10\n1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000\n\nSample Output 2\n\n10000000000\n\nThe sum of the strengths can be quite large.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 563, "memory_kb": 141604}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s589593786", "group_id": "codeNet:p03773", "input_text": "print(sum(parse.(split(readline())))%24)", "language": "Julia", "metadata": {"date": 1561174886, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s589593786.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s589593786", "user_id": "u729133443"}, "prompt_components": {"gold_output": "21\n", "input_to_evaluate": "print(sum(parse.(split(readline())))%24)", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 40, "cpu_time_ms": 1010, "memory_kb": 177932}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s728136328", "group_id": "codeNet:p03775", "input_text": "function main()\n \n N = parse(Int, readline())\n \n ans = 0\n \n for i in 1:round(Int,sqrt(N))\n \n if N % i == 0\n ans = i\n end\n\n end\n \n S = split(string(div(N,ans)),\"\")\n\n println(length(S))\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1578449586, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s728136328.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s728136328", "user_id": "u790457721"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main()\n \n N = parse(Int, readline())\n \n ans = 0\n \n for i in 1:round(Int,sqrt(N))\n \n if N % i == 0\n ans = i\n end\n\n end\n \n S = split(string(div(N,ans)),\"\")\n\n println(length(S))\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 301, "memory_kb": 109496}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s500572428", "group_id": "codeNet:p03775", "input_text": "function dig(n)\n\tk = 0\n\twhile 10^k <= n\n\t\tk += 1\n\tend\n\tk\nend\n\nfunction main()\n\tn = parse(Int, readline())\n\tif n == 1\n\t\tprintln(1)\n\telse\n\t\tm = n\n\t\tk = 2\n\t\ts = Int[]\n\t\twhile k <= sqrt(n)\n\t\t\tif m % k == 0\n\t\t\t\tpush!(s,k)\n\t\t\t\tm = div(m,k)\n\t\t\telse\n\t\t\t\tk += 1\n\t\t\tend\n\t\tend\n\t\tif m > sqrt(n)\n\t\t\tpush!(s,m)\n\t\tend\n\t\tif length(s) == 1\n\t\t\tprint(dig(s[1]))\n\t\telse\n\t\t\tl = s[length(s)-1]\n\t\t\tr = s[length(s)]\n\t\t\tfor i in 2:length(s)-1\n\t\t\t\tif l > r\n\t\t\t\t\tr = r*s[length(s)-i]\n\t\t\t\telse\n\t\t\t\t\tl = l*s[length(s)-i]\n\t\t\t\tend\n\t\t\tend\n\t\t\tprint(max(dig(l),dig(r)))\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1543596781, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s500572428.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s500572428", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function dig(n)\n\tk = 0\n\twhile 10^k <= n\n\t\tk += 1\n\tend\n\tk\nend\n\nfunction main()\n\tn = parse(Int, readline())\n\tif n == 1\n\t\tprintln(1)\n\telse\n\t\tm = n\n\t\tk = 2\n\t\ts = Int[]\n\t\twhile k <= sqrt(n)\n\t\t\tif m % k == 0\n\t\t\t\tpush!(s,k)\n\t\t\t\tm = div(m,k)\n\t\t\telse\n\t\t\t\tk += 1\n\t\t\tend\n\t\tend\n\t\tif m > sqrt(n)\n\t\t\tpush!(s,m)\n\t\tend\n\t\tif length(s) == 1\n\t\t\tprint(dig(s[1]))\n\t\telse\n\t\t\tl = s[length(s)-1]\n\t\t\tr = s[length(s)]\n\t\t\tfor i in 2:length(s)-1\n\t\t\t\tif l > r\n\t\t\t\t\tr = r*s[length(s)-i]\n\t\t\t\telse\n\t\t\t\t\tl = l*s[length(s)-i]\n\t\t\t\tend\n\t\t\tend\n\t\t\tprint(max(dig(l),dig(r)))\n\t\tend\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 558, "cpu_time_ms": 343, "memory_kb": 110092}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s300634196", "group_id": "codeNet:p03777", "input_text": "println(length(unique!(split(readline())))==1 ? \"H\" : \"D\")", "language": "Julia", "metadata": {"date": 1601411619, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s300634196.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s300634196", "user_id": "u443151804"}, "prompt_components": {"gold_output": "H\n", "input_to_evaluate": "println(length(unique!(split(readline())))==1 ? \"H\" : \"D\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 58, "cpu_time_ms": 271, "memory_kb": 168152}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s977007225", "group_id": "codeNet:p03777", "input_text": "a,_,b=readline()\nprint(a==b?\"H\":\"D\")", "language": "Julia", "metadata": {"date": 1561174956, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s977007225.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s977007225", "user_id": "u729133443"}, "prompt_components": {"gold_output": "H\n", "input_to_evaluate": "a,_,b=readline()\nprint(a==b?\"H\":\"D\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 270, "memory_kb": 108028}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s134251078", "group_id": "codeNet:p03777", "input_text": "a,b=split(chomp(readline()))\nif a == \"D\" && b == \"H\"\n println(\"D\")\nelseif a == \"D\" && b == \"D\"\n println(\"H\")\nelseif a == \"H\" && b == \"H\"\n println(\"H\")\nelse\n println(\"D\")\nend", "language": "Julia", "metadata": {"date": 1546360661, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s134251078.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s134251078", "user_id": "u095714878"}, "prompt_components": {"gold_output": "H\n", "input_to_evaluate": "a,b=split(chomp(readline()))\nif a == \"D\" && b == \"H\"\n println(\"D\")\nelseif a == \"D\" && b == \"D\"\n println(\"H\")\nelseif a == \"H\" && b == \"H\"\n println(\"H\")\nelse\n println(\"D\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 177, "cpu_time_ms": 286, "memory_kb": 109956}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s642426156", "group_id": "codeNet:p03779", "input_text": "function main()\n \n N = parse(Int, readline())\n \n ans = 0\n check = 0\n \n while check <= N\n ans += 1\n check = div(ans*(ans+1), 2)\n end\n \n println(ans)\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1588444544, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s642426156.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s642426156", "user_id": "u790457721"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main()\n \n N = parse(Int, readline())\n \n ans = 0\n check = 0\n \n while check <= N\n ans += 1\n check = div(ans*(ans+1), 2)\n end\n \n println(ans)\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 749, "memory_kb": 163288}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s685264510", "group_id": "codeNet:p03780", "input_text": "parseInt(x)=parse(Int32,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction eval(a::Array{Int32,1},m,n,k)\n\tdp = Set(Int32[0])\n\tf = 0\n\tfor i in 1:n\n\t\tif i!=m\n\t\t\ttmp = Int32[]\n\t\t\tfor j in dp\n\t\t\t\tv = a[i]+j\n\t\t\t\tif v split |> parseMap\n\ta = readline() |> split |> parseMap\n\ta = sort(a)\n\tl,r = 0,n+1\n\twhile r-l>1\n\t\tm = (l+r)>>1\n\t\tf = eval(a,m,n,k)\n\t\tif a[m]>=k\n\t\t\tf = 1\n\t\tend\n\t\tif f == 1\n\t\t\tr = m\n\t\telse\n\t\t\tl = m\n\t\tend\n\tend\n\tprintln(l)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1572005469, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03780.html", "problem_id": "p03780", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03780/input.txt", "sample_output_relpath": "derived/input_output/data/p03780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03780/Julia/s685264510.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s685264510", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x)=parse(Int32,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction eval(a::Array{Int32,1},m,n,k)\n\tdp = Set(Int32[0])\n\tf = 0\n\tfor i in 1:n\n\t\tif i!=m\n\t\t\ttmp = Int32[]\n\t\t\tfor j in dp\n\t\t\t\tv = a[i]+j\n\t\t\t\tif v split |> parseMap\n\ta = readline() |> split |> parseMap\n\ta = sort(a)\n\tl,r = 0,n+1\n\twhile r-l>1\n\t\tm = (l+r)>>1\n\t\tf = eval(a,m,n,k)\n\t\tif a[m]>=k\n\t\t\tf = 1\n\t\tend\n\t\tif f == 1\n\t\t\tr = m\n\t\telse\n\t\t\tl = m\n\t\tend\n\tend\n\tprintln(l)\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nAtCoDeer the deer has N cards with positive integers written on them. The number on the i-th card (1≤i≤N) is a_i.\nBecause he loves big numbers, he calls a subset of the cards good when the sum of the numbers written on the cards in the subset, is K or greater.\n\nThen, for each card i, he judges whether it is unnecessary or not, as follows:\n\nIf, for any good subset of the cards containing card i, the set that can be obtained by eliminating card i from the subset is also good, card i is unnecessary.\n\nOtherwise, card i is NOT unnecessary.\n\nFind the number of the unnecessary cards. Here, he judges each card independently, and he does not throw away cards that turn out to be unnecessary.\n\nConstraints\n\nAll input values are integers.\n\n1≤N≤5000\n\n1≤K≤5000\n\n1≤a_i≤10^9 (1≤i≤N)\n\nPartial Score\n\n300 points will be awarded for passing the test set satisfying N,K≤400.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the unnecessary cards.\n\nSample Input 1\n\n3 6\n1 4 3\n\nSample Output 1\n\n1\n\nThere are two good sets: {2,3} and {1,2,3}.\n\nCard 1 is only contained in {1,2,3}, and this set without card 1, {2,3}, is also good. Thus, card 1 is unnecessary.\n\nFor card 2, a good set {2,3} without card 2, {3}, is not good. Thus, card 2 is NOT unnecessary.\n\nNeither is card 3 for a similar reason, hence the answer is 1.\n\nSample Input 2\n\n5 400\n3 1 4 1 5\n\nSample Output 2\n\n5\n\nIn this case, there is no good set. Therefore, all the cards are unnecessary.\n\nSample Input 3\n\n6 20\n10 4 3 10 25 2\n\nSample Output 3\n\n3", "sample_input": "3 6\n1 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03780", "source_text": "Score : 600 points\n\nProblem Statement\n\nAtCoDeer the deer has N cards with positive integers written on them. The number on the i-th card (1≤i≤N) is a_i.\nBecause he loves big numbers, he calls a subset of the cards good when the sum of the numbers written on the cards in the subset, is K or greater.\n\nThen, for each card i, he judges whether it is unnecessary or not, as follows:\n\nIf, for any good subset of the cards containing card i, the set that can be obtained by eliminating card i from the subset is also good, card i is unnecessary.\n\nOtherwise, card i is NOT unnecessary.\n\nFind the number of the unnecessary cards. Here, he judges each card independently, and he does not throw away cards that turn out to be unnecessary.\n\nConstraints\n\nAll input values are integers.\n\n1≤N≤5000\n\n1≤K≤5000\n\n1≤a_i≤10^9 (1≤i≤N)\n\nPartial Score\n\n300 points will be awarded for passing the test set satisfying N,K≤400.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the unnecessary cards.\n\nSample Input 1\n\n3 6\n1 4 3\n\nSample Output 1\n\n1\n\nThere are two good sets: {2,3} and {1,2,3}.\n\nCard 1 is only contained in {1,2,3}, and this set without card 1, {2,3}, is also good. Thus, card 1 is unnecessary.\n\nFor card 2, a good set {2,3} without card 2, {3}, is not good. Thus, card 2 is NOT unnecessary.\n\nNeither is card 3 for a similar reason, hence the answer is 1.\n\nSample Input 2\n\n5 400\n3 1 4 1 5\n\nSample Output 2\n\n5\n\nIn this case, there is no good set. Therefore, all the cards are unnecessary.\n\nSample Input 3\n\n6 20\n10 4 3 10 25 2\n\nSample Output 3\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 652, "cpu_time_ms": 2114, "memory_kb": 155696}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s860803753", "group_id": "codeNet:p03780", "input_text": "parseInt(x)=parse(Int32,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction eval(a::Array{Int32,1},m,n,k)\n\tdp = zeros(Int32,n,k)\n\tf = 0\n\tdp[:,1] = 1\n\tfor i in 1:n\n\t\tif i!=m\n\t\t\ttmp = i split |> parseMap\n\ta = readline() |> split |> parseMap\n\ta = sort(a)\n\tl,r = 0,n+1\n\twhile r-l>1\n\t\tm = (l+r)>>1\n\t\tf = eval(a,m,n,k)\n\t\tif a[m]>=k\n\t\t\tf = 1\n\t\tend\n\t\tif f == 1\n\t\t\tr = m\n\t\telse\n\t\t\tl = m\n\t\tend\n\tend\n\tprintln(l)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1572003857, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03780.html", "problem_id": "p03780", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03780/input.txt", "sample_output_relpath": "derived/input_output/data/p03780/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03780/Julia/s860803753.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s860803753", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x)=parse(Int32,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction eval(a::Array{Int32,1},m,n,k)\n\tdp = zeros(Int32,n,k)\n\tf = 0\n\tdp[:,1] = 1\n\tfor i in 1:n\n\t\tif i!=m\n\t\t\ttmp = i split |> parseMap\n\ta = readline() |> split |> parseMap\n\ta = sort(a)\n\tl,r = 0,n+1\n\twhile r-l>1\n\t\tm = (l+r)>>1\n\t\tf = eval(a,m,n,k)\n\t\tif a[m]>=k\n\t\t\tf = 1\n\t\tend\n\t\tif f == 1\n\t\t\tr = m\n\t\telse\n\t\t\tl = m\n\t\tend\n\tend\n\tprintln(l)\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nAtCoDeer the deer has N cards with positive integers written on them. The number on the i-th card (1≤i≤N) is a_i.\nBecause he loves big numbers, he calls a subset of the cards good when the sum of the numbers written on the cards in the subset, is K or greater.\n\nThen, for each card i, he judges whether it is unnecessary or not, as follows:\n\nIf, for any good subset of the cards containing card i, the set that can be obtained by eliminating card i from the subset is also good, card i is unnecessary.\n\nOtherwise, card i is NOT unnecessary.\n\nFind the number of the unnecessary cards. Here, he judges each card independently, and he does not throw away cards that turn out to be unnecessary.\n\nConstraints\n\nAll input values are integers.\n\n1≤N≤5000\n\n1≤K≤5000\n\n1≤a_i≤10^9 (1≤i≤N)\n\nPartial Score\n\n300 points will be awarded for passing the test set satisfying N,K≤400.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the unnecessary cards.\n\nSample Input 1\n\n3 6\n1 4 3\n\nSample Output 1\n\n1\n\nThere are two good sets: {2,3} and {1,2,3}.\n\nCard 1 is only contained in {1,2,3}, and this set without card 1, {2,3}, is also good. Thus, card 1 is unnecessary.\n\nFor card 2, a good set {2,3} without card 2, {3}, is not good. Thus, card 2 is NOT unnecessary.\n\nNeither is card 3 for a similar reason, hence the answer is 1.\n\nSample Input 2\n\n5 400\n3 1 4 1 5\n\nSample Output 2\n\n5\n\nIn this case, there is no good set. Therefore, all the cards are unnecessary.\n\nSample Input 3\n\n6 20\n10 4 3 10 25 2\n\nSample Output 3\n\n3", "sample_input": "3 6\n1 4 3\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03780", "source_text": "Score : 600 points\n\nProblem Statement\n\nAtCoDeer the deer has N cards with positive integers written on them. The number on the i-th card (1≤i≤N) is a_i.\nBecause he loves big numbers, he calls a subset of the cards good when the sum of the numbers written on the cards in the subset, is K or greater.\n\nThen, for each card i, he judges whether it is unnecessary or not, as follows:\n\nIf, for any good subset of the cards containing card i, the set that can be obtained by eliminating card i from the subset is also good, card i is unnecessary.\n\nOtherwise, card i is NOT unnecessary.\n\nFind the number of the unnecessary cards. Here, he judges each card independently, and he does not throw away cards that turn out to be unnecessary.\n\nConstraints\n\nAll input values are integers.\n\n1≤N≤5000\n\n1≤K≤5000\n\n1≤a_i≤10^9 (1≤i≤N)\n\nPartial Score\n\n300 points will be awarded for passing the test set satisfying N,K≤400.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\na_1 a_2 ... a_N\n\nOutput\n\nPrint the number of the unnecessary cards.\n\nSample Input 1\n\n3 6\n1 4 3\n\nSample Output 1\n\n1\n\nThere are two good sets: {2,3} and {1,2,3}.\n\nCard 1 is only contained in {1,2,3}, and this set without card 1, {2,3}, is also good. Thus, card 1 is unnecessary.\n\nFor card 2, a good set {2,3} without card 2, {3}, is not good. Thus, card 2 is NOT unnecessary.\n\nNeither is card 3 for a similar reason, hence the answer is 1.\n\nSample Input 2\n\n5 400\n3 1 4 1 5\n\nSample Output 2\n\n5\n\nIn this case, there is no good set. Therefore, all the cards are unnecessary.\n\nSample Input 3\n\n6 20\n10 4 3 10 25 2\n\nSample Output 3\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 637, "cpu_time_ms": 2113, "memory_kb": 218628}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s304193854", "group_id": "codeNet:p03781", "input_text": "x=parse(readline())\nprint(Int(round(((2x)^.5))))", "language": "Julia", "metadata": {"date": 1530154751, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03781.html", "problem_id": "p03781", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03781/input.txt", "sample_output_relpath": "derived/input_output/data/p03781/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03781/Julia/s304193854.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s304193854", "user_id": "u130196064"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "x=parse(readline())\nprint(Int(round(((2x)^.5))))", "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": "p03781", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 48, "cpu_time_ms": 294, "memory_kb": 108284}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s370391945", "group_id": "codeNet:p03786", "input_text": "function main()\n N = pread(Int)\n a = sort(readvec(Int, N))\n c = 1\n s = 0\n for i in 2:N\n if 2 * (a[i-1] + s) >= a[i]\n c += 1\n else\n c = 1\n end\n s += a[i-1]\n end\n println(c)\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1594922453, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s370391945.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s370391945", "user_id": "u729767359"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n N = pread(Int)\n a = sort(readvec(Int, N))\n c = 1\n s = 0\n for i in 2:N\n if 2 * (a[i-1] + s) >= a[i]\n c += 1\n else\n c = 1\n end\n s += a[i-1]\n end\n println(c)\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1761, "cpu_time_ms": 499, "memory_kb": 209120}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s744227931", "group_id": "codeNet:p03786", "input_text": "function main()\n N = pread(Int)\n a = sort(readvec(Int, N))\n au = unique(a)\n ad = Dict((u, count(isequal(u), a)) for u in au)\n sumu = zeros(Int, length(au))\n sumu[1] = au[1]*ad[au[1]]\n for i in 2:length(au)\n sumu[i] = au[i]*ad[au[i]] + sumu[i-1]\n end\n aN = length(au)\n sumc = 0\n #for i in 1:aN-1\n i = 1\n while i <= aN-1\n v = sumu[i]\n nt = i\n while true\n nt = findlast(x -> x <= 2*v, view(au, nt:aN)) + nt - 1\n if aN == nt\n sumc += ad[au[i]]\n break\n elseif v == sumu[nt]\n i = nt+1\n break\n end\n v = sumu[nt]\n end\n if sumc != 0\n sumc += sum(map(x -> ad[au[x]], i+1:aN))\n break\n end\n end\n if sumc == 0\n sumc = ad[au[end]]\n end\n println(sumc)\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1594921708, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s744227931.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s744227931", "user_id": "u729767359"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n N = pread(Int)\n a = sort(readvec(Int, N))\n au = unique(a)\n ad = Dict((u, count(isequal(u), a)) for u in au)\n sumu = zeros(Int, length(au))\n sumu[1] = au[1]*ad[au[1]]\n for i in 2:length(au)\n sumu[i] = au[i]*ad[au[i]] + sumu[i-1]\n end\n aN = length(au)\n sumc = 0\n #for i in 1:aN-1\n i = 1\n while i <= aN-1\n v = sumu[i]\n nt = i\n while true\n nt = findlast(x -> x <= 2*v, view(au, nt:aN)) + nt - 1\n if aN == nt\n sumc += ad[au[i]]\n break\n elseif v == sumu[nt]\n i = nt+1\n break\n end\n v = sumu[nt]\n end\n if sumc != 0\n sumc += sum(map(x -> ad[au[x]], i+1:aN))\n break\n end\n end\n if sumc == 0\n sumc = ad[au[end]]\n end\n println(sumc)\nend\n\nimport Base.parse\nimport Base.StringVector\n\nparse(::Type{String}, str::AbstractString) = str\nisdelim(x::UInt8, xs::Set{UInt8}) = x in xs\nconst delimset = Set([0x0a, 0x20])\n\nfunction myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}\n out = StringVector(0)\n c::UInt8 = 0x00\n while !eof(s)\n c = read(s, UInt8)\n !isdelim(c, delims) && break\n end\n push!(out, c)\n eof(s) && return out\n while !eof(s)\n c = read(s, UInt8)\n isdelim(c, delims) && break\n push!(out, c)\n end\n return out\nend\n\nfunction readword(io::IO = stdin, delims = delimset)::String\n word = myreaduntil(io, delims)\n i = length(word)\n if i == 0 || word[i] != 0x0a\n return String(word)\n elseif i < 2 || word[i-1] != 0x0d\n return String(resize!(word,i-1))\n else\n return String(resize!(word,i-2))\n end\nend\n\npread(ty) = parse(ty, readword())\n\nreads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)\n\nfunction readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}\n rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)\n for i in 1:len\n for j in 1:length(tys)\n @inbounds rv[j][i] = pread(tys[j])\n end\n end\n rv\nend\n\nreadvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]\n\nfunction readmat(ty::Type, s...)::Matrix{ty}\n v = Matrix{ty}(undef, s...)\n @inbounds for i in 1:s[1]\n v[i,:] = readvec(ty, s[2])\n end\n v\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2399, "cpu_time_ms": 1643, "memory_kb": 244840}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s462438456", "group_id": "codeNet:p03795", "input_text": "N=parse(readline())\nprintln(800N-200div(N,15))", "language": "Julia", "metadata": {"date": 1561618908, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03795.html", "problem_id": "p03795", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03795/input.txt", "sample_output_relpath": "derived/input_output/data/p03795/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03795/Julia/s462438456.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s462438456", "user_id": "u657913472"}, "prompt_components": {"gold_output": "15800\n", "input_to_evaluate": "N=parse(readline())\nprintln(800N-200div(N,15))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a favorite restaurant.\n\nThe price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.\n\nSo far, Snuke has ordered N meals at the restaurant.\nLet the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen.\nFind x-y.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n15800\n\nSo far, Snuke has paid 16000 yen, and the restaurant has paid back 200 yen. Thus, the answer is 15800.\n\nSample Input 2\n\n60\n\nSample Output 2\n\n47200\n\nSnuke has paid 48000 yen for 60 meals, and the restaurant has paid back 800 yen.", "sample_input": "20\n"}, "reference_outputs": ["15800\n"], "source_document_id": "p03795", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a favorite restaurant.\n\nThe price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.\n\nSo far, Snuke has ordered N meals at the restaurant.\nLet the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen.\nFind x-y.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n15800\n\nSo far, Snuke has paid 16000 yen, and the restaurant has paid back 200 yen. Thus, the answer is 15800.\n\nSample Input 2\n\n60\n\nSample Output 2\n\n47200\n\nSnuke has paid 48000 yen for 60 meals, and the restaurant has paid back 800 yen.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 46, "cpu_time_ms": 304, "memory_kb": 108156}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s898618067", "group_id": "codeNet:p03795", "input_text": "N = parse(Int,readline());println(N*800-200*(div(N,15)))", "language": "Julia", "metadata": {"date": 1487926623, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03795.html", "problem_id": "p03795", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03795/input.txt", "sample_output_relpath": "derived/input_output/data/p03795/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03795/Julia/s898618067.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s898618067", "user_id": "u317194934"}, "prompt_components": {"gold_output": "15800\n", "input_to_evaluate": "N = parse(Int,readline());println(N*800-200*(div(N,15)))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a favorite restaurant.\n\nThe price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.\n\nSo far, Snuke has ordered N meals at the restaurant.\nLet the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen.\nFind x-y.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n15800\n\nSo far, Snuke has paid 16000 yen, and the restaurant has paid back 200 yen. Thus, the answer is 15800.\n\nSample Input 2\n\n60\n\nSample Output 2\n\n47200\n\nSnuke has paid 48000 yen for 60 meals, and the restaurant has paid back 800 yen.", "sample_input": "20\n"}, "reference_outputs": ["15800\n"], "source_document_id": "p03795", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a favorite restaurant.\n\nThe price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.\n\nSo far, Snuke has ordered N meals at the restaurant.\nLet the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen.\nFind x-y.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n15800\n\nSo far, Snuke has paid 16000 yen, and the restaurant has paid back 200 yen. Thus, the answer is 15800.\n\nSample Input 2\n\n60\n\nSample Output 2\n\n47200\n\nSnuke has paid 48000 yen for 60 meals, and the restaurant has paid back 800 yen.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 328, "memory_kb": 108160}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s679134607", "group_id": "codeNet:p03795", "input_text": "N = parse(Int,readline())\nx = 800N\ny = 200(div(N,15))\nprintln(x-y)", "language": "Julia", "metadata": {"date": 1487807317, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03795.html", "problem_id": "p03795", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03795/input.txt", "sample_output_relpath": "derived/input_output/data/p03795/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03795/Julia/s679134607.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s679134607", "user_id": "u317194934"}, "prompt_components": {"gold_output": "15800\n", "input_to_evaluate": "N = parse(Int,readline())\nx = 800N\ny = 200(div(N,15))\nprintln(x-y)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke has a favorite restaurant.\n\nThe price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.\n\nSo far, Snuke has ordered N meals at the restaurant.\nLet the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen.\nFind x-y.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n15800\n\nSo far, Snuke has paid 16000 yen, and the restaurant has paid back 200 yen. Thus, the answer is 15800.\n\nSample Input 2\n\n60\n\nSample Output 2\n\n47200\n\nSnuke has paid 48000 yen for 60 meals, and the restaurant has paid back 800 yen.", "sample_input": "20\n"}, "reference_outputs": ["15800\n"], "source_document_id": "p03795", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke has a favorite restaurant.\n\nThe price of any meal served at the restaurant is 800 yen (the currency of Japan), and each time a customer orders 15 meals, the restaurant pays 200 yen back to the customer.\n\nSo far, Snuke has ordered N meals at the restaurant.\nLet the amount of money Snuke has paid to the restaurant be x yen, and let the amount of money the restaurant has paid back to Snuke be y yen.\nFind x-y.\n\nConstraints\n\n1 ≤ N ≤ 100\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer.\n\nSample Input 1\n\n20\n\nSample Output 1\n\n15800\n\nSo far, Snuke has paid 16000 yen, and the restaurant has paid back 200 yen. Thus, the answer is 15800.\n\nSample Input 2\n\n60\n\nSample Output 2\n\n47200\n\nSnuke has paid 48000 yen for 60 meals, and the restaurant has paid back 800 yen.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 66, "cpu_time_ms": 320, "memory_kb": 109656}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s700181830", "group_id": "codeNet:p03796", "input_text": "parseInt(x) = parse(Int,x)\n\nfunction main()\n\tn = parseInt(readline())\n\tk = 1\n\tfor i in 1:n\n\t\tk = k*i%1000000007\n\tend\n\tprintln(k)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1542849705, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03796.html", "problem_id": "p03796", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03796/input.txt", "sample_output_relpath": "derived/input_output/data/p03796/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03796/Julia/s700181830.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s700181830", "user_id": "u095714878"}, "prompt_components": {"gold_output": "6\n", "input_to_evaluate": "parseInt(x) = parse(Int,x)\n\nfunction main()\n\tn = parseInt(readline())\n\tk = 1\n\tfor i in 1:n\n\t\tk = k*i%1000000007\n\tend\n\tprintln(k)\nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke loves working out. He is now exercising N times.\n\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\n\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\nConstraints\n\n1 ≤ N ≤ 10^{5}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer modulo 10^{9}+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nAfter Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.\n\nAfter Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.\n\nAfter Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n3628800\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n457992974\n\nPrint the answer modulo 10^{9}+7.", "sample_input": "3\n"}, "reference_outputs": ["6\n"], "source_document_id": "p03796", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke loves working out. He is now exercising N times.\n\nBefore he starts exercising, his power is 1. After he exercises for the i-th time, his power gets multiplied by i.\n\nFind Snuke's power after he exercises N times. Since the answer can be extremely large, print the answer modulo 10^{9}+7.\n\nConstraints\n\n1 ≤ N ≤ 10^{5}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nPrint the answer modulo 10^{9}+7.\n\nSample Input 1\n\n3\n\nSample Output 1\n\n6\n\nAfter Snuke exercises for the first time, his power gets multiplied by 1 and becomes 1.\n\nAfter Snuke exercises for the second time, his power gets multiplied by 2 and becomes 2.\n\nAfter Snuke exercises for the third time, his power gets multiplied by 3 and becomes 6.\n\nSample Input 2\n\n10\n\nSample Output 2\n\n3628800\n\nSample Input 3\n\n100000\n\nSample Output 3\n\n457992974\n\nPrint the answer modulo 10^{9}+7.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 316, "memory_kb": 106952}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s821987572", "group_id": "codeNet:p03798", "input_text": "N = parse(Int64, chomp(readline()))\ns = chomp(readline())\nres = \"\"\n\nfunction check(a::Char, b::Char, c::Char, s::Char)\n if s == 'o'\n if b == 'W'\n return a != c\n else\n return a == c\n end\n else\n if b == 'W'\n return a == c\n else\n return a != c\n end\n end\nend\n\ntypes = [\"S\", \"W\"]\nfor t = types\n circle = \"\"\n for tt in types\n circle = t*tt\n for i in 2:N-1\n pre_a = circle[i-1]\n now_a = circle[i]\n if s[i] == 'o'\n if pre_a == now_a\n circle *= \"S\"\n else\n circle *= \"W\"\n end\n else\n if pre_a == now_a\n circle *= \"W\"\n else\n circle *= \"S\"\n end\n end\n end\n is_ok = true\n is_ok *= check(circle[end], circle[1], circle[2], s[1])\n is_ok *= check(circle[N-1], circle[end], circle[1], s[end])\n if is_ok\n println(circle)\n quit()\n end\n end\nend\n\nprintln(-1)\n", "language": "Julia", "metadata": {"date": 1488156757, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s821987572.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s821987572", "user_id": "u952894166"}, "prompt_components": {"gold_output": "SSSWWS\n", "input_to_evaluate": "N = parse(Int64, chomp(readline()))\ns = chomp(readline())\nres = \"\"\n\nfunction check(a::Char, b::Char, c::Char, s::Char)\n if s == 'o'\n if b == 'W'\n return a != c\n else\n return a == c\n end\n else\n if b == 'W'\n return a == c\n else\n return a != c\n end\n end\nend\n\ntypes = [\"S\", \"W\"]\nfor t = types\n circle = \"\"\n for tt in types\n circle = t*tt\n for i in 2:N-1\n pre_a = circle[i-1]\n now_a = circle[i]\n if s[i] == 'o'\n if pre_a == now_a\n circle *= \"S\"\n else\n circle *= \"W\"\n end\n else\n if pre_a == now_a\n circle *= \"W\"\n else\n circle *= \"S\"\n end\n end\n end\n is_ok = true\n is_ok *= check(circle[end], circle[1], circle[2], s[1])\n is_ok *= check(circle[N-1], circle[end], circle[1], s[end])\n if is_ok\n println(circle)\n quit()\n end\n end\nend\n\nprintln(-1)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1135, "cpu_time_ms": 2108, "memory_kb": 155264}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s082384365", "group_id": "codeNet:p03799", "input_text": "input = map(x->parse(Int, x), split(readline()))\nN = input[1]\nM = input[2]\n\nif 2N > M\n ans = floor(M/2)\nelse\n ans = N + floor((M-2N)/4)\nend\nprintln(Int(ans))", "language": "Julia", "metadata": {"date": 1490506158, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s082384365.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s082384365", "user_id": "u317194934"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "input = map(x->parse(Int, x), split(readline()))\nN = input[1]\nM = input[2]\n\nif 2N > M\n ans = floor(M/2)\nelse\n ans = N + floor((M-2N)/4)\nend\nprintln(Int(ans))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 967, "memory_kb": 169024}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s808009998", "group_id": "codeNet:p03803", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a,b=parseMap(split(readline()))\n if a==1\n a=14\n end\n if b==1\n b=14\n end\n if a==b\n println(\"Draw\")\n elseif a>b\n println(\"Alice\")\n else\n println(\"Bob\")\n end\n\n\nend\nmain()", "language": "Julia", "metadata": {"date": 1584675841, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s808009998.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s808009998", "user_id": "u619197965"}, "prompt_components": {"gold_output": "Alice\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a,b=parseMap(split(readline()))\n if a==1\n a=14\n end\n if b==1\n b=14\n end\n if a==b\n println(\"Draw\")\n elseif a>b\n println(\"Alice\")\n else\n println(\"Bob\")\n end\n\n\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 634, "cpu_time_ms": 786, "memory_kb": 163604}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s533377050", "group_id": "codeNet:p03804", "input_text": "input()=chomp(readline())\nn,m=parse.(split(input()))\na=fill('0',n,n)\nfor i=1:n,(j,c)=enumerate(input())\n a[i,j]=c\nend\nb=fill('0',m,m)\nfor i=1:m,(j,c)=enumerate(input())\n b[i,j]=c\nend\nprintln(any(b==a[i+1:i+m,j+1:j+m]for i=0:n-m,j=0:n-m)?\"Yes\":\"No\")", "language": "Julia", "metadata": {"date": 1562685469, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s533377050.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s533377050", "user_id": "u729133443"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "input()=chomp(readline())\nn,m=parse.(split(input()))\na=fill('0',n,n)\nfor i=1:n,(j,c)=enumerate(input())\n a[i,j]=c\nend\nb=fill('0',m,m)\nfor i=1:m,(j,c)=enumerate(input())\n b[i,j]=c\nend\nprintln(any(b==a[i+1:i+m,j+1:j+m]for i=0:n-m,j=0:n-m)?\"Yes\":\"No\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 254, "cpu_time_ms": 792, "memory_kb": 130764}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s822488033", "group_id": "codeNet:p03807", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=map(x->parseInt(x)%2,split(readline()))\n if sum(a)%2==0\n println(\"YES\")\n else\n println(\"NO\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1585767797, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s822488033.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s822488033", "user_id": "u619197965"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n a=map(x->parseInt(x)%2,split(readline()))\n if sum(a)%2==0\n println(\"YES\")\n else\n println(\"NO\")\n end\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 875, "memory_kb": 174792}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s561700504", "group_id": "codeNet:p03813", "input_text": "println(parse(readline())<1200?\"ABC\":\"ARC\")", "language": "Julia", "metadata": {"date": 1561621741, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s561700504.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s561700504", "user_id": "u657913472"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "println(parse(readline())<1200?\"ABC\":\"ARC\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 285, "memory_kb": 110084}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s756593423", "group_id": "codeNet:p03813", "input_text": "n = parse(Int, String(read(STDIN)))\nif n < 1200\n\tprintln(\"ABC\")\nelse\n \tprintln(\"ARC\")\nend", "language": "Julia", "metadata": {"date": 1529319692, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s756593423.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s756593423", "user_id": "u714587753"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "n = parse(Int, String(read(STDIN)))\nif n < 1200\n\tprintln(\"ABC\")\nelse\n \tprintln(\"ARC\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 271, "memory_kb": 108168}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s260112919", "group_id": "codeNet:p03826", "input_text": "N = split(readline())\nA,B,C,D=parse(Int,N[1]),parse(Int,N[2]),parse(Int,N[3]),parse(Int,N[4])\nprintln(max(A*B,C*D))", "language": "Julia", "metadata": {"date": 1487926096, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03826.html", "problem_id": "p03826", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03826/input.txt", "sample_output_relpath": "derived/input_output/data/p03826/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03826/Julia/s260112919.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s260112919", "user_id": "u317194934"}, "prompt_components": {"gold_output": "15\n", "input_to_evaluate": "N = split(readline())\nA,B,C,D=parse(Int,N[1]),parse(Int,N[2]),parse(Int,N[3]),parse(Int,N[4])\nprintln(max(A*B,C*D))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere are two rectangles.\nThe lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B.\nThe lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D.\n\nPrint the area of the rectangle with the larger area.\nIf the two rectangles have equal areas, print that area.\n\nConstraints\n\nAll input values are integers.\n\n1≤A≤10^4\n\n1≤B≤10^4\n\n1≤C≤10^4\n\n1≤D≤10^4\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the area of the rectangle with the larger area.\nIf the two rectangles have equal areas, print that area.\n\nSample Input 1\n\n3 5 2 7\n\nSample Output 1\n\n15\n\nThe first rectangle has an area of 3×5=15, and the second rectangle has an area of 2×7=14.\nThus, the output should be 15, the larger area.\n\nSample Input 2\n\n100 600 200 300\n\nSample Output 2\n\n60000", "sample_input": "3 5 2 7\n"}, "reference_outputs": ["15\n"], "source_document_id": "p03826", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere are two rectangles.\nThe lengths of the vertical sides of the first rectangle are A, and the lengths of the horizontal sides of the first rectangle are B.\nThe lengths of the vertical sides of the second rectangle are C, and the lengths of the horizontal sides of the second rectangle are D.\n\nPrint the area of the rectangle with the larger area.\nIf the two rectangles have equal areas, print that area.\n\nConstraints\n\nAll input values are integers.\n\n1≤A≤10^4\n\n1≤B≤10^4\n\n1≤C≤10^4\n\n1≤D≤10^4\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nA B C D\n\nOutput\n\nPrint the area of the rectangle with the larger area.\nIf the two rectangles have equal areas, print that area.\n\nSample Input 1\n\n3 5 2 7\n\nSample Output 1\n\n15\n\nThe first rectangle has an area of 3×5=15, and the second rectangle has an area of 2×7=14.\nThus, the output should be 15, the larger area.\n\nSample Input 2\n\n100 600 200 300\n\nSample Output 2\n\n60000", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 308, "memory_kb": 109652}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s932112791", "group_id": "codeNet:p03827", "input_text": "N = parse(Int,readline())\nS = chomp(readline())\nlist = [0]\nfor i in 1:N\n if string(S[i]) == \"I\"\n list = push!(list,list[i]+1)\n else\n list = push!(list,list[i]-1)\n end\nend\nsortlist = sort(list,rev=true)\nprintln(sortlist[1])", "language": "Julia", "metadata": {"date": 1488012815, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s932112791.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s932112791", "user_id": "u317194934"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "N = parse(Int,readline())\nS = chomp(readline())\nlist = [0]\nfor i in 1:N\n if string(S[i]) == \"I\"\n list = push!(list,list[i]+1)\n else\n list = push!(list,list[i]-1)\n end\nend\nsortlist = sort(list,rev=true)\nprintln(sortlist[1])", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 425, "memory_kb": 110720}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s156602491", "group_id": "codeNet:p03831", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,a,b = readline() |> split |> parseMap\n\tx = readline() |> split |> parseMap\n\ts = 0\n\tfor i in 2:n\n\t\tif (x[i]-x[i-1])*a < b\n\t\t\ts += (x[i]-x[i-1])*a\n\t\telse\n\t\t\ts += b\n\t\tend\n\tend\n\tprintln(s)\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561463410, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03831.html", "problem_id": "p03831", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03831/input.txt", "sample_output_relpath": "derived/input_output/data/p03831/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03831/Julia/s156602491.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s156602491", "user_id": "u095714878"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\tn,a,b = readline() |> split |> parseMap\n\tx = readline() |> split |> parseMap\n\ts = 0\n\tfor i in 2:n\n\t\tif (x[i]-x[i-1])*a < b\n\t\t\ts += (x[i]-x[i-1])*a\n\t\telse\n\t\t\ts += b\n\t\tend\n\tend\n\tprintln(s)\nend\nmain()\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N towns on a line running east-west.\nThe towns are numbered 1 through N, in order from west to east.\nEach point on the line has a one-dimensional coordinate, and a point that is farther east has a greater coordinate value.\nThe coordinate of town i is X_i.\n\nYou are now at town 1, and you want to visit all the other towns.\nYou have two ways to travel:\n\nWalk on the line.\nYour fatigue level increases by A each time you travel a distance of 1, regardless of direction.\n\nTeleport to any location of your choice.\nYour fatigue level increases by B, regardless of the distance covered.\n\nFind the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.\n\nConstraints\n\nAll input values are integers.\n\n2≤N≤10^5\n\n1≤X_i≤10^9\n\nFor all i(1≤i≤N-1), X_iparse(x),split(readline()))\nA=map(x->parse(x),split(readline()))\nans=0\nfor i=2:n\n\tans+=min(a*(A[i]-A[i-1]),b)\nend\nprintln(ans)", "language": "Julia", "metadata": {"date": 1539164376, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03831.html", "problem_id": "p03831", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03831/input.txt", "sample_output_relpath": "derived/input_output/data/p03831/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03831/Julia/s259119471.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s259119471", "user_id": "u657913472"}, "prompt_components": {"gold_output": "11\n", "input_to_evaluate": "n,a,b=map(x->parse(x),split(readline()))\nA=map(x->parse(x),split(readline()))\nans=0\nfor i=2:n\n\tans+=min(a*(A[i]-A[i-1]),b)\nend\nprintln(ans)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere are N towns on a line running east-west.\nThe towns are numbered 1 through N, in order from west to east.\nEach point on the line has a one-dimensional coordinate, and a point that is farther east has a greater coordinate value.\nThe coordinate of town i is X_i.\n\nYou are now at town 1, and you want to visit all the other towns.\nYou have two ways to travel:\n\nWalk on the line.\nYour fatigue level increases by A each time you travel a distance of 1, regardless of direction.\n\nTeleport to any location of your choice.\nYour fatigue level increases by B, regardless of the distance covered.\n\nFind the minimum possible total increase of your fatigue level when you visit all the towns in these two ways.\n\nConstraints\n\nAll input values are integers.\n\n2≤N≤10^5\n\n1≤X_i≤10^9\n\nFor all i(1≤i≤N-1), X_i split |> parseMap\n\tg = zeros(Int,n,n)\n\td = 10000000*ones(Int,n,n)\n\tfor i in 1:n\n\t\td[i,i] = 0\n\tend\n\tx = 0\n\tfor i in 1:m\n\t\ta,b,c = readline() |> split |> parseMap\n\t\tg[a,b] = c\n\t\tg[b,a] = c\n\t\td[a,b] = c\n\t\td[b,a] = c\n\tend\n\tfor k in 1:n\n\t\tfor i in 1:n\n\t\t\tfor j in 1:n\n\t\t\t\td[i,j] = min(d[i,j],d[i,k]+d[k,j])\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tfor j in 1:n\n\t\t\tf = 0\n\t\t\tfor s in 1:n\n\t\t\t\tif d[s,i] + g[i,j] == d[s,j]\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tif f == 0\n\t\t\t\tx += 1\n\t\t\tend\n\t\tend\n\tend\n\tprintln(x>>1)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1571649420, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03837.html", "problem_id": "p03837", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03837/input.txt", "sample_output_relpath": "derived/input_output/data/p03837/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03837/Julia/s015713466.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s015713466", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\tg = zeros(Int,n,n)\n\td = 10000000*ones(Int,n,n)\n\tfor i in 1:n\n\t\td[i,i] = 0\n\tend\n\tx = 0\n\tfor i in 1:m\n\t\ta,b,c = readline() |> split |> parseMap\n\t\tg[a,b] = c\n\t\tg[b,a] = c\n\t\td[a,b] = c\n\t\td[b,a] = c\n\tend\n\tfor k in 1:n\n\t\tfor i in 1:n\n\t\t\tfor j in 1:n\n\t\t\t\td[i,j] = min(d[i,j],d[i,k]+d[k,j])\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:n\n\t\tfor j in 1:n\n\t\t\tf = 0\n\t\t\tfor s in 1:n\n\t\t\t\tif d[s,i] + g[i,j] == d[s,j]\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tif f == 0\n\t\t\t\tx += 1\n\t\t\tend\n\t\tend\n\tend\n\tprintln(x>>1)\nend\n\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.\n\nThe i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.\n\nHere, a self-loop is an edge where a_i = b_i (1≤i≤M), and double edges are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i split |> parseMap\n\tg = zeros(Int,n,n)\n\td = 10000000*ones(Int,n,n)\n\tx = 0\n\tfor i in 1:m\n\t\ta,b,c = readline() |> split |> parseMap\n\t\tg[a,b] = c\n\t\tg[b,a] = c\n\t\td[a,b] = c\n\t\td[b,a] = c\n\tend\n\tfor k in 1:n\n\t\tfor i in 1:n\n\t\t\tfor j in 1:n\n\t\t\t\td[i,j] = min(d[i,j],d[i,k]+d[k,j])\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:n-1\n\t\tfor j in i+1:n\n\t\t\tf = 0\n\t\t\tfor s in 1:n\n\t\t\t\tif d[s,i] + g[i,j] == d[s,j]\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tif f == 0\n\t\t\t\tx += 1\n\t\t\tend\n\t\tend\n\tend\n\tprintln(x)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1571648814, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03837.html", "problem_id": "p03837", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03837/input.txt", "sample_output_relpath": "derived/input_output/data/p03837/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03837/Julia/s270593087.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s270593087", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,m = readline() |> split |> parseMap\n\tg = zeros(Int,n,n)\n\td = 10000000*ones(Int,n,n)\n\tx = 0\n\tfor i in 1:m\n\t\ta,b,c = readline() |> split |> parseMap\n\t\tg[a,b] = c\n\t\tg[b,a] = c\n\t\td[a,b] = c\n\t\td[b,a] = c\n\tend\n\tfor k in 1:n\n\t\tfor i in 1:n\n\t\t\tfor j in 1:n\n\t\t\t\td[i,j] = min(d[i,j],d[i,k]+d[k,j])\n\t\t\tend\n\t\tend\n\tend\n\tfor i in 1:n-1\n\t\tfor j in i+1:n\n\t\t\tf = 0\n\t\t\tfor s in 1:n\n\t\t\t\tif d[s,i] + g[i,j] == d[s,j]\n\t\t\t\t\tf = 1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tif f == 0\n\t\t\t\tx += 1\n\t\t\tend\n\t\tend\n\tend\n\tprintln(x)\nend\n\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nYou are given an undirected connected weighted graph with N vertices and M edges that contains neither self-loops nor double edges.\n\nThe i-th (1≤i≤M) edge connects vertex a_i and vertex b_i with a distance of c_i.\n\nHere, a self-loop is an edge where a_i = b_i (1≤i≤M), and double edges are two edges where (a_i,b_i)=(a_j,b_j) or (a_i,b_i)=(b_j,a_j) (1≤i split |> parseMap\n\tif x==y\n\t\tprintln(0)\n\telseif x<0 split |> parseMap\n\tif x==y\n\t\tprintln(0)\n\telseif x<0parse(Int,x),split(readline()))\n\tfor i in 1:h\n\t\tk = chomp(readline())\n\t\tprintln(k)\n\t\tprintln(k)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1542907792, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s433387774.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s433387774", "user_id": "u095714878"}, "prompt_components": {"gold_output": "*.\n*.\n.*\n.*\n", "input_to_evaluate": "function main()\n\th,w = map(x->parse(Int,x),split(readline()))\n\tfor i in 1:h\n\t\tk = chomp(readline())\n\t\tprintln(k)\n\t\tprintln(k)\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 142, "cpu_time_ms": 356, "memory_kb": 109068}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s562010515", "group_id": "codeNet:p03853", "input_text": "\nH = parse(Int,readline()[1])\nlist = []\nfor i in 1:H\n S = chomp(readline())\n println(S)\n println(S)\nend", "language": "Julia", "metadata": {"date": 1518998014, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s562010515.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s562010515", "user_id": "u667084803"}, "prompt_components": {"gold_output": "*.\n*.\n.*\n.*\n", "input_to_evaluate": "\nH = parse(Int,readline()[1])\nlist = []\nfor i in 1:H\n S = chomp(readline())\n println(S)\n println(S)\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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 288, "memory_kb": 107712}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s960803845", "group_id": "codeNet:p03855", "input_text": "lines=readlines()\nfunction find(u,p)\n\tif u==p[u]\n\t\tu\n\telse\n\t\tp[u]=find(p[u],p)\n\tend\nend\nfunction f(N,M)\n\tparent=collect(1:N)\n\tsize=ones(Int,N)\n\tfor _=1:M\n\t\ta,b=map(x->find(parse(Int,x),parent),split(shift!(lines)))\n\t\tif a!=b\n\t\t\tif size[a]>size[b]\n\t\t\t\tparent[b]=a\n\t\t\t\tsize[a]+=size[b]\n\t\t\telse\n\t\t\t\tparent[a]=b\n\t\t\t\tsize[b]+=size[a]\n\t\t\tend\n\t\tend\n\tend\n\tparent\nend\nfunction main()\n\tN,K,L=map(x->parse(Int,x),split(shift!(lines)))\n\tE=zip(f(N,K),f(N,L))\n\tD=Dict{Tuple{Int,Int},Int}()\n\tfor v=E\n\t\tD[v]=get(D,v,0)+1\n\tend\n\tfor v=E\n\t\tprintln(D[v])\n\tend\nend\nmain()", "language": "Julia", "metadata": {"date": 1561656581, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03855.html", "problem_id": "p03855", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03855/input.txt", "sample_output_relpath": "derived/input_output/data/p03855/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03855/Julia/s960803845.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s960803845", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 2 2 1\n", "input_to_evaluate": "lines=readlines()\nfunction find(u,p)\n\tif u==p[u]\n\t\tu\n\telse\n\t\tp[u]=find(p[u],p)\n\tend\nend\nfunction f(N,M)\n\tparent=collect(1:N)\n\tsize=ones(Int,N)\n\tfor _=1:M\n\t\ta,b=map(x->find(parse(Int,x),parent),split(shift!(lines)))\n\t\tif a!=b\n\t\t\tif size[a]>size[b]\n\t\t\t\tparent[b]=a\n\t\t\t\tsize[a]+=size[b]\n\t\t\telse\n\t\t\t\tparent[a]=b\n\t\t\t\tsize[b]+=size[a]\n\t\t\tend\n\t\tend\n\tend\n\tparent\nend\nfunction main()\n\tN,K,L=map(x->parse(Int,x),split(shift!(lines)))\n\tE=zip(f(N,K),f(N,L))\n\tD=Dict{Tuple{Int,Int},Int}()\n\tfor v=E\n\t\tD[v]=get(D,v,0)+1\n\tend\n\tfor v=E\n\t\tprintln(D[v])\n\tend\nend\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nThere are N cities. There are also K roads and L railways, extending between the cities.\nThe i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities.\nNo two roads connect the same pair of cities. Similarly, no two railways connect the same pair of cities.\n\nWe will say city A and B are connected by roads if city B is reachable from city A by traversing some number of roads. Here, any city is considered to be connected to itself by roads.\nWe will also define connectivity by railways similarly.\n\nFor each city, find the number of the cities connected to that city by both roads and railways.\n\nConstraints\n\n2 ≦ N ≦ 2*10^5\n\n1 ≦ K, L≦ 10^5\n\n1 ≦ p_i, q_i, r_i, s_i ≦ N\n\np_i < q_i\n\nr_i < s_i\n\nWhen i ≠ j, (p_i, q_i) ≠ (p_j, q_j)\n\nWhen i ≠ j, (r_i, s_i) ≠ (r_j, s_j)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K L\np_1 q_1\n:\np_K q_K\nr_1 s_1\n:\nr_L s_L\n\nOutput\n\nPrint N integers. The i-th of them should represent the number of the cities connected to the i-th city by both roads and railways.\n\nSample Input 1\n\n4 3 1\n1 2\n2 3\n3 4\n2 3\n\nSample Output 1\n\n1 2 2 1\n\nAll the four cities are connected to each other by roads.\n\nBy railways, only the second and third cities are connected. Thus, the answers for the cities are 1, 2, 2 and 1, respectively.\n\nSample Input 2\n\n4 2 2\n1 2\n2 3\n1 4\n2 3\n\nSample Output 2\n\n1 2 2 1\n\nSample Input 3\n\n7 4 4\n1 2\n2 3\n2 5\n6 7\n3 5\n4 5\n3 4\n6 7\n\nSample Output 3\n\n1 1 2 1 2 2 2", "sample_input": "4 3 1\n1 2\n2 3\n3 4\n2 3\n"}, "reference_outputs": ["1 2 2 1\n"], "source_document_id": "p03855", "source_text": "Score : 400 points\n\nProblem Statement\n\nThere are N cities. There are also K roads and L railways, extending between the cities.\nThe i-th road bidirectionally connects the p_i-th and q_i-th cities, and the i-th railway bidirectionally connects the r_i-th and s_i-th cities.\nNo two roads connect the same pair of cities. Similarly, no two railways connect the same pair of cities.\n\nWe will say city A and B are connected by roads if city B is reachable from city A by traversing some number of roads. Here, any city is considered to be connected to itself by roads.\nWe will also define connectivity by railways similarly.\n\nFor each city, find the number of the cities connected to that city by both roads and railways.\n\nConstraints\n\n2 ≦ N ≦ 2*10^5\n\n1 ≦ K, L≦ 10^5\n\n1 ≦ p_i, q_i, r_i, s_i ≦ N\n\np_i < q_i\n\nr_i < s_i\n\nWhen i ≠ j, (p_i, q_i) ≠ (p_j, q_j)\n\nWhen i ≠ j, (r_i, s_i) ≠ (r_j, s_j)\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K L\np_1 q_1\n:\np_K q_K\nr_1 s_1\n:\nr_L s_L\n\nOutput\n\nPrint N integers. The i-th of them should represent the number of the cities connected to the i-th city by both roads and railways.\n\nSample Input 1\n\n4 3 1\n1 2\n2 3\n3 4\n2 3\n\nSample Output 1\n\n1 2 2 1\n\nAll the four cities are connected to each other by roads.\n\nBy railways, only the second and third cities are connected. Thus, the answers for the cities are 1, 2, 2 and 1, respectively.\n\nSample Input 2\n\n4 2 2\n1 2\n2 3\n1 4\n2 3\n\nSample Output 2\n\n1 2 2 1\n\nSample Input 3\n\n7 4 4\n1 2\n2 3\n2 5\n6 7\n3 5\n4 5\n3 4\n6 7\n\nSample Output 3\n\n1 1 2 1 2 2 2", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 550, "cpu_time_ms": 2113, "memory_kb": 160352}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s051028912", "group_id": "codeNet:p03860", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a,b,c=split(readline())\n println(uppercase(join([a[1],b[1],c[1]])))\nend\nmain()", "language": "Julia", "metadata": {"date": 1584824802, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03860.html", "problem_id": "p03860", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03860/input.txt", "sample_output_relpath": "derived/input_output/data/p03860/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03860/Julia/s051028912.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s051028912", "user_id": "u619197965"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a,b,c=split(readline())\n println(uppercase(join([a[1],b[1],c[1]])))\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke is going to open a contest named \"AtCoder s Contest\".\nHere, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters.\n\nSnuke has decided to abbreviate the name of the contest as \"AxC\".\nHere, x is the uppercase English letter at the beginning of s.\n\nGiven the name of the contest, print the abbreviation of the name.\n\nConstraints\n\nThe length of s is between 1 and 100, inclusive.\n\nThe first character in s is an uppercase English letter.\n\nThe second and subsequent characters in s are lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nAtCoder s Contest\n\nOutput\n\nPrint the abbreviation of the name of the contest.\n\nSample Input 1\n\nAtCoder Beginner Contest\n\nSample Output 1\n\nABC\n\nThe contest in which you are participating now.\n\nSample Input 2\n\nAtCoder Snuke Contest\n\nSample Output 2\n\nASC\n\nThis contest does not actually exist.\n\nSample Input 3\n\nAtCoder X Contest\n\nSample Output 3\n\nAXC", "sample_input": "AtCoder Beginner Contest\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03860", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke is going to open a contest named \"AtCoder s Contest\".\nHere, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters.\n\nSnuke has decided to abbreviate the name of the contest as \"AxC\".\nHere, x is the uppercase English letter at the beginning of s.\n\nGiven the name of the contest, print the abbreviation of the name.\n\nConstraints\n\nThe length of s is between 1 and 100, inclusive.\n\nThe first character in s is an uppercase English letter.\n\nThe second and subsequent characters in s are lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nAtCoder s Contest\n\nOutput\n\nPrint the abbreviation of the name of the contest.\n\nSample Input 1\n\nAtCoder Beginner Contest\n\nSample Output 1\n\nABC\n\nThe contest in which you are participating now.\n\nSample Input 2\n\nAtCoder Snuke Contest\n\nSample Output 2\n\nASC\n\nThis contest does not actually exist.\n\nSample Input 3\n\nAtCoder X Contest\n\nSample Output 3\n\nAXC", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 348, "memory_kb": 115608}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s228364520", "group_id": "codeNet:p03860", "input_text": "function main()\n \n S = chomp(readline())\n \n S = replace(S, \"AtCoder \", \"\")\n S = replace(S, \" Contest\", \"\")\n ans = split(S, \"\")\n \n println(\"A\"*ans[1]*\"C\")\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577987312, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03860.html", "problem_id": "p03860", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03860/input.txt", "sample_output_relpath": "derived/input_output/data/p03860/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03860/Julia/s228364520.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s228364520", "user_id": "u790457721"}, "prompt_components": {"gold_output": "ABC\n", "input_to_evaluate": "function main()\n \n S = chomp(readline())\n \n S = replace(S, \"AtCoder \", \"\")\n S = replace(S, \" Contest\", \"\")\n ans = split(S, \"\")\n \n println(\"A\"*ans[1]*\"C\")\n \nend\n\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nSnuke is going to open a contest named \"AtCoder s Contest\".\nHere, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters.\n\nSnuke has decided to abbreviate the name of the contest as \"AxC\".\nHere, x is the uppercase English letter at the beginning of s.\n\nGiven the name of the contest, print the abbreviation of the name.\n\nConstraints\n\nThe length of s is between 1 and 100, inclusive.\n\nThe first character in s is an uppercase English letter.\n\nThe second and subsequent characters in s are lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nAtCoder s Contest\n\nOutput\n\nPrint the abbreviation of the name of the contest.\n\nSample Input 1\n\nAtCoder Beginner Contest\n\nSample Output 1\n\nABC\n\nThe contest in which you are participating now.\n\nSample Input 2\n\nAtCoder Snuke Contest\n\nSample Output 2\n\nASC\n\nThis contest does not actually exist.\n\nSample Input 3\n\nAtCoder X Contest\n\nSample Output 3\n\nAXC", "sample_input": "AtCoder Beginner Contest\n"}, "reference_outputs": ["ABC\n"], "source_document_id": "p03860", "source_text": "Score : 100 points\n\nProblem Statement\n\nSnuke is going to open a contest named \"AtCoder s Contest\".\nHere, s is a string of length 1 or greater, where the first character is an uppercase English letter, and the second and subsequent characters are lowercase English letters.\n\nSnuke has decided to abbreviate the name of the contest as \"AxC\".\nHere, x is the uppercase English letter at the beginning of s.\n\nGiven the name of the contest, print the abbreviation of the name.\n\nConstraints\n\nThe length of s is between 1 and 100, inclusive.\n\nThe first character in s is an uppercase English letter.\n\nThe second and subsequent characters in s are lowercase English letters.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nAtCoder s Contest\n\nOutput\n\nPrint the abbreviation of the name of the contest.\n\nSample Input 1\n\nAtCoder Beginner Contest\n\nSample Output 1\n\nABC\n\nThe contest in which you are participating now.\n\nSample Input 2\n\nAtCoder Snuke Contest\n\nSample Output 2\n\nASC\n\nThis contest does not actually exist.\n\nSample Input 3\n\nAtCoder X Contest\n\nSample Output 3\n\nAXC", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 291, "memory_kb": 108512}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s568704772", "group_id": "codeNet:p03861", "input_text": "function main()\n\ta,b,x = map(x->parse(Int,x),split(readline()))\n\ts = div(a,x)\n\tt = div(b,x)\n\tif a%x == 0\n\t\tprint(t-s+1)\n\telse\n\t\tprint(t-s)\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1542907975, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s568704772.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s568704772", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "function main()\n\ta,b,x = map(x->parse(Int,x),split(readline()))\n\ts = div(a,x)\n\tt = div(b,x)\n\tif a%x == 0\n\t\tprint(t-s+1)\n\telse\n\t\tprint(t-s)\n\tend\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 374, "memory_kb": 110916}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s395229456", "group_id": "codeNet:p03862", "input_text": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,x = map(parseInt, split(readline()))\n\ta = map(parseInt, split(readline()))\n\tk = 0\n\tif a[1] > x\n\t\tk += a[1]-x\n\t\ta[1] = x\n\tend\n\tfor i in 2:n-1\n\t\tif a[i-1] + a[i] > x\n\t\t\tif a[i-1] > x\n\t\t\t\tk += a[i-1] + a[i] - x\n\t\t\t\ta[i] = 0\n\t\t\t\ta[i-1] = a[i-1] + a[i] - x\n\t\t\telse\n\t\t\t\tk += a[i-1] + a[i] - x\n\t\t\t\ta[i] = x - a[i-1]\n\t\t\tend\n\t\tend\n\tend\n\tif a[n-1] + a[n] > x\n\t\tk += a[n-1] + a[n] - x\n\tend\n\tprint(k)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1544315863, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03862.html", "problem_id": "p03862", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03862/input.txt", "sample_output_relpath": "derived/input_output/data/p03862/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03862/Julia/s395229456.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s395229456", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\n\nfunction main()\n\tn,x = map(parseInt, split(readline()))\n\ta = map(parseInt, split(readline()))\n\tk = 0\n\tif a[1] > x\n\t\tk += a[1]-x\n\t\ta[1] = x\n\tend\n\tfor i in 2:n-1\n\t\tif a[i-1] + a[i] > x\n\t\t\tif a[i-1] > x\n\t\t\t\tk += a[i-1] + a[i] - x\n\t\t\t\ta[i] = 0\n\t\t\t\ta[i-1] = a[i-1] + a[i] - x\n\t\t\telse\n\t\t\t\tk += a[i-1] + a[i] - x\n\t\t\t\ta[i] = x - a[i-1]\n\t\t\tend\n\t\tend\n\tend\n\tif a[n-1] + a[n] > x\n\t\tk += a[n-1] + a[n] - x\n\tend\n\tprint(k)\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "sample_input": "3 3\n2 2 2\n"}, "reference_outputs": ["1\n"], "source_document_id": "p03862", "source_text": "Score : 300 points\n\nProblem Statement\n\nThere are N boxes arranged in a row.\nInitially, the i-th box from the left contains a_i candies.\n\nSnuke can perform the following operation any number of times:\n\nChoose a box containing at least one candy, and eat one of the candies in the chosen box.\n\nHis objective is as follows:\n\nAny two neighboring boxes contain at most x candies in total.\n\nFind the minimum number of operations required to achieve the objective.\n\nConstraints\n\n2 ≤ N ≤ 10^5\n\n0 ≤ a_i ≤ 10^9\n\n0 ≤ x ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN x\na_1 a_2 ... a_N\n\nOutput\n\nPrint the minimum number of operations required to achieve the objective.\n\nSample Input 1\n\n3 3\n2 2 2\n\nSample Output 1\n\n1\n\nEat one candy in the second box.\nThen, the number of candies in each box becomes (2, 1, 2).\n\nSample Input 2\n\n6 1\n1 6 1 2 0 4\n\nSample Output 2\n\n11\n\nFor example, eat six candies in the second box, two in the fourth box, and three in the sixth box.\nThen, the number of candies in each box becomes (1, 0, 1, 0, 0, 1).\n\nSample Input 3\n\n5 9\n3 1 4 1 5\n\nSample Output 3\n\n0\n\nThe objective is already achieved without performing operations.\n\nSample Input 4\n\n2 0\n5 5\n\nSample Output 4\n\n10\n\nAll the candies need to be eaten.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 844, "memory_kb": 167080}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s450395680", "group_id": "codeNet:p03865", "input_text": "s=chomp(readline())\nprintln(length(s)%2+Int(s[1]!=s[length(s)])==1?\"Second\":\"First\")\n", "language": "Julia", "metadata": {"date": 1539344863, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03865.html", "problem_id": "p03865", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03865/input.txt", "sample_output_relpath": "derived/input_output/data/p03865/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03865/Julia/s450395680.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s450395680", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Second\n", "input_to_evaluate": "s=chomp(readline())\nprintln(length(s)%2+Int(s[1]!=s[length(s)])==1?\"Second\":\"First\")\n", "problem_context": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "sample_input": "aba\n"}, "reference_outputs": ["Second\n"], "source_document_id": "p03865", "source_text": "Score : 500 points\n\nProblem Statement\n\nThere is a string s of length 3 or greater.\nNo two neighboring characters in s are equal.\n\nTakahashi and Aoki will play a game against each other.\nThe two players alternately performs the following operation, Takahashi going first:\n\nRemove one of the characters in s, excluding both ends. However, a character cannot be removed if removal of the character would result in two neighboring equal characters in s.\n\nThe player who becomes unable to perform the operation, loses the game. Determine which player will win when the two play optimally.\n\nConstraints\n\n3 ≤ |s| ≤ 10^5\n\ns consists of lowercase English letters.\n\nNo two neighboring characters in s are equal.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nIf Takahashi will win, print First. If Aoki will win, print Second.\n\nSample Input 1\n\naba\n\nSample Output 1\n\nSecond\n\nTakahashi, who goes first, cannot perform the operation, since removal of the b, which is the only character not at either ends of s, would result in s becoming aa, with two as neighboring.\n\nSample Input 2\n\nabc\n\nSample Output 2\n\nFirst\n\nWhen Takahashi removes b from s, it becomes ac.\nThen, Aoki cannot perform the operation, since there is no character in s, excluding both ends.\n\nSample Input 3\n\nabcab\n\nSample Output 3\n\nFirst", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 85, "cpu_time_ms": 296, "memory_kb": 110228}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s911824551", "group_id": "codeNet:p03866", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction eval(a::Tuple{Int,Float64},b::Tuple{Int,Float64})\n\tif a[2] 1\n\t\tl = n+1\n\t\tk = l>>1\n\t\twhile x[2]=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\n\th\nend\n \nfunction hpop(h::Array{Tuple{Int,Float64},1},n::Int)\n\tx = h[1]\n\tz = h[n]\n\tif n>1\n\t\th[1] = z\n\t\tk = 1\n\t\tl = n-1\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k][2]<=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif z[2]<=h[2*k][2]&&z[2]<=h[2*k+1][2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k][2]<=h[2*k+1][2]?2*k:2*k+1\n\t\t\t\t\ttmp = h[t]\n\t\t\t\t\th[t] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tx\nend\n\ndist(xa::Int,ya::Int,xb::Int,yb::Int,ra::Int,rb::Int)=sqrt((xa-xb)^2+(ya-yb)^2)-ra-rb\n\nfunction main()\n\txs,ys,xt,yt = readline() |> split |> parseMap\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int,Int}[(0,0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tx,y,r = readline() |> split |> parseMap\n\t\ta[i] = (x,y,r)\n\tend\n\te = [Tuple{Int,Float64}[] for i in 1:n+2]\n\tfor i in 1:n\n\t\tfor j in i+1:n\n\t\t\tv = dist(a[i][1],a[i][2],a[j][1],a[j][2],a[i][3],a[j][3])\n\t\t\tpush!(e[i], (j,max(0,v)))\n\t\t\tpush!(e[j], (i,max(0,v)))\n\t\tend\n\t\tv = dist(a[i][1],a[i][2],xs,ys,a[i][3],0)\n\t\tpush!(e[i],(n+1,max(0,v)))\n\t\tpush!(e[n+1],(i,max(0,v)))\n\t\tv = dist(a[i][1],a[i][2],xt,yt,a[i][3],0)\n\t\tpush!(e[i],(n+2,max(0,v)))\n\t\tpush!(e[n+2],(i,max(0,v)))\n\tend\n\tv = dist(xs,ys,xt,yt,0,0)\n\tpush!(e[n+1],(n+2,max(0,v)))\n\tpush!(e[n+2],(n+1,max(0,v)))\n\n\ths = Tuple{Int,Float64}[(n+1,0.0) for i in 1:(n+2)^2]\n\tls = 1\n\thg = Tuple{Int,Float64}[(n+2,0.0) for i in 1:(n+2)^2]\n\tlg = 1\n\tds = -ones(Float64,n+2)\n\tdg = -ones(Float64,n+2)\n\tvss = zeros(Int,n+2)\n\tvsg = zeros(Int,n+2)\n\tds[n+1] = 0.0\n\tdg[n+2] = 0.0\n\twhile !isempty(hs)||!isempty(hg)\n\t\tv,w = hpop(hs,ls)\n\t\tls-=1\n\t\tds[v] = ds[v]==-1.0?w:min(ds[v],w)\n\t\tvss[v] = 1\n\t\tif vss[v]+vsg[v] > 1\n\t\t\tbreak\n\t\tend\n\t\tfor i in 1:length(e[v])\n\t\t\tif ds[e[v][i][1]]<0.0 || ds[e[v][i][1]]>w+e[v][i][2]\n\t\t\t\tds[e[v][i][1]] = w+e[v][i][2]\n\t\t\t\thpush(hs,(e[v][i][1],w+e[v][i][2]),ls)\n\t\t\t\tls += 1\n\t\t\tend\n\t\tend\n\t\tvv,ww = hpop(hg,lg)\n\t\tlg-=1\n\t\tdg[vv] = dg[vv]==-1.0?ww:min(dg[vv],ww)\n\t\tvsg[vv] = 1\n\t\tif vss[vv]+vsg[vv] > 1\n\t\t\tbreak\n\t\tend\n\t\tfor i in 1:length(e[vv])\n\t\t\tif dg[e[vv][i][1]]<0.0 || dg[e[vv][i][1]]>ww+e[vv][i][2]\n\t\t\t\tdg[e[vv][i][1]] = ww+e[vv][i][2]\n\t\t\t\thpush(hg,(e[vv][i][1],ww+e[vv][i][2]),lg)\n\t\t\t\tlg+=1\n\t\t\tend\n\t\tend\n\tend\n\tminim = ds[1]+dg[1]\n\tfor i in 2:n+2\n\t\tif ds[i]>-1.0 && dg[i]>-1.0\n\t\t\tminim = min(minim,ds[i]+dg[i])\n\t\tend\n\tend\n\tprintln(minim)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1574840892, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03866.html", "problem_id": "p03866", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03866/input.txt", "sample_output_relpath": "derived/input_output/data/p03866/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03866/Julia/s911824551.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s911824551", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3.6568542495\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction eval(a::Tuple{Int,Float64},b::Tuple{Int,Float64})\n\tif a[2] 1\n\t\tl = n+1\n\t\tk = l>>1\n\t\twhile x[2]=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk = max(k>>1,1)\n\t\t\tl = l>>1\n\t\tend\n\tend\n\th\nend\n \nfunction hpop(h::Array{Tuple{Int,Float64},1},n::Int)\n\tx = h[1]\n\tz = h[n]\n\tif n>1\n\t\th[1] = z\n\t\tk = 1\n\t\tl = n-1\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k][2]<=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif z[2]<=h[2*k][2]&&z[2]<=h[2*k+1][2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k][2]<=h[2*k+1][2]?2*k:2*k+1\n\t\t\t\t\ttmp = h[t]\n\t\t\t\t\th[t] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tx\nend\n\ndist(xa::Int,ya::Int,xb::Int,yb::Int,ra::Int,rb::Int)=sqrt((xa-xb)^2+(ya-yb)^2)-ra-rb\n\nfunction main()\n\txs,ys,xt,yt = readline() |> split |> parseMap\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int,Int}[(0,0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tx,y,r = readline() |> split |> parseMap\n\t\ta[i] = (x,y,r)\n\tend\n\te = [Tuple{Int,Float64}[] for i in 1:n+2]\n\tfor i in 1:n\n\t\tfor j in i+1:n\n\t\t\tv = dist(a[i][1],a[i][2],a[j][1],a[j][2],a[i][3],a[j][3])\n\t\t\tpush!(e[i], (j,max(0,v)))\n\t\t\tpush!(e[j], (i,max(0,v)))\n\t\tend\n\t\tv = dist(a[i][1],a[i][2],xs,ys,a[i][3],0)\n\t\tpush!(e[i],(n+1,max(0,v)))\n\t\tpush!(e[n+1],(i,max(0,v)))\n\t\tv = dist(a[i][1],a[i][2],xt,yt,a[i][3],0)\n\t\tpush!(e[i],(n+2,max(0,v)))\n\t\tpush!(e[n+2],(i,max(0,v)))\n\tend\n\tv = dist(xs,ys,xt,yt,0,0)\n\tpush!(e[n+1],(n+2,max(0,v)))\n\tpush!(e[n+2],(n+1,max(0,v)))\n\n\ths = Tuple{Int,Float64}[(n+1,0.0) for i in 1:(n+2)^2]\n\tls = 1\n\thg = Tuple{Int,Float64}[(n+2,0.0) for i in 1:(n+2)^2]\n\tlg = 1\n\tds = -ones(Float64,n+2)\n\tdg = -ones(Float64,n+2)\n\tvss = zeros(Int,n+2)\n\tvsg = zeros(Int,n+2)\n\tds[n+1] = 0.0\n\tdg[n+2] = 0.0\n\twhile !isempty(hs)||!isempty(hg)\n\t\tv,w = hpop(hs,ls)\n\t\tls-=1\n\t\tds[v] = ds[v]==-1.0?w:min(ds[v],w)\n\t\tvss[v] = 1\n\t\tif vss[v]+vsg[v] > 1\n\t\t\tbreak\n\t\tend\n\t\tfor i in 1:length(e[v])\n\t\t\tif ds[e[v][i][1]]<0.0 || ds[e[v][i][1]]>w+e[v][i][2]\n\t\t\t\tds[e[v][i][1]] = w+e[v][i][2]\n\t\t\t\thpush(hs,(e[v][i][1],w+e[v][i][2]),ls)\n\t\t\t\tls += 1\n\t\t\tend\n\t\tend\n\t\tvv,ww = hpop(hg,lg)\n\t\tlg-=1\n\t\tdg[vv] = dg[vv]==-1.0?ww:min(dg[vv],ww)\n\t\tvsg[vv] = 1\n\t\tif vss[vv]+vsg[vv] > 1\n\t\t\tbreak\n\t\tend\n\t\tfor i in 1:length(e[vv])\n\t\t\tif dg[e[vv][i][1]]<0.0 || dg[e[vv][i][1]]>ww+e[vv][i][2]\n\t\t\t\tdg[e[vv][i][1]] = ww+e[vv][i][2]\n\t\t\t\thpush(hg,(e[vv][i][1],ww+e[vv][i][2]),lg)\n\t\t\t\tlg+=1\n\t\t\tend\n\t\tend\n\tend\n\tminim = ds[1]+dg[1]\n\tfor i in 2:n+2\n\t\tif ds[i]>-1.0 && dg[i]>-1.0\n\t\t\tminim = min(minim,ds[i]+dg[i])\n\t\tend\n\tend\n\tprintln(minim)\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nOn the xy-plane, Snuke is going to travel from the point (x_s, y_s) to the point (x_t, y_t).\nHe can move in arbitrary directions with speed 1.\nHere, we will consider him as a point without size.\n\nThere are N circular barriers deployed on the plane.\nThe center and the radius of the i-th barrier are (x_i, y_i) and r_i, respectively.\nThe barriers may overlap or contain each other.\n\nA point on the plane is exposed to cosmic rays if the point is not within any of the barriers.\n\nSnuke wants to avoid exposure to cosmic rays as much as possible during the travel.\nFind the minimum possible duration of time he is exposed to cosmic rays during the travel.\n\nConstraints\n\nAll input values are integers.\n\n-10^9 ≤ x_s, y_s, x_t, y_t ≤ 10^9\n\n(x_s, y_s) ≠ (x_t, y_t)\n\n1≤N≤1,000\n\n-10^9 ≤ x_i, y_i ≤ 10^9\n\n1 ≤ r_i ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx_s y_s x_t y_t\nN\nx_1 y_1 r_1\nx_2 y_2 r_2\n:\nx_N y_N r_N\n\nOutput\n\nPrint the minimum possible duration of time Snuke is exposed to cosmic rays during the travel.\nThe output is considered correct if the absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n-2 -2 2 2\n1\n0 0 1\n\nSample Output 1\n\n3.6568542495\n\nAn optimal route is as follows:\n\nSample Input 2\n\n-2 0 2 0\n2\n-1 0 2\n1 0 2\n\nSample Output 2\n\n0.0000000000\n\nAn optimal route is as follows:\n\nSample Input 3\n\n4 -2 -2 4\n3\n0 0 2\n4 0 1\n0 4 1\n\nSample Output 3\n\n4.0000000000\n\nAn optimal route is as follows:", "sample_input": "-2 -2 2 2\n1\n0 0 1\n"}, "reference_outputs": ["3.6568542495\n"], "source_document_id": "p03866", "source_text": "Score : 600 points\n\nProblem Statement\n\nOn the xy-plane, Snuke is going to travel from the point (x_s, y_s) to the point (x_t, y_t).\nHe can move in arbitrary directions with speed 1.\nHere, we will consider him as a point without size.\n\nThere are N circular barriers deployed on the plane.\nThe center and the radius of the i-th barrier are (x_i, y_i) and r_i, respectively.\nThe barriers may overlap or contain each other.\n\nA point on the plane is exposed to cosmic rays if the point is not within any of the barriers.\n\nSnuke wants to avoid exposure to cosmic rays as much as possible during the travel.\nFind the minimum possible duration of time he is exposed to cosmic rays during the travel.\n\nConstraints\n\nAll input values are integers.\n\n-10^9 ≤ x_s, y_s, x_t, y_t ≤ 10^9\n\n(x_s, y_s) ≠ (x_t, y_t)\n\n1≤N≤1,000\n\n-10^9 ≤ x_i, y_i ≤ 10^9\n\n1 ≤ r_i ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx_s y_s x_t y_t\nN\nx_1 y_1 r_1\nx_2 y_2 r_2\n:\nx_N y_N r_N\n\nOutput\n\nPrint the minimum possible duration of time Snuke is exposed to cosmic rays during the travel.\nThe output is considered correct if the absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n-2 -2 2 2\n1\n0 0 1\n\nSample Output 1\n\n3.6568542495\n\nAn optimal route is as follows:\n\nSample Input 2\n\n-2 0 2 0\n2\n-1 0 2\n1 0 2\n\nSample Output 2\n\n0.0000000000\n\nAn optimal route is as follows:\n\nSample Input 3\n\n4 -2 -2 4\n3\n0 0 2\n4 0 1\n0 4 1\n\nSample Output 3\n\n4.0000000000\n\nAn optimal route is as follows:", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2774, "cpu_time_ms": 2113, "memory_kb": 194488}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s809934755", "group_id": "codeNet:p03866", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction hpush(h::Array{Tuple{Int,Float64},1},x::Tuple{Int,Float64})\n\tpush!(h,x)\n\tif length(h)>1\n\t\tl = length(h)\n\t\tk = l>>1\n\t\twhile x[2]=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk>>1\n\t\t\tl>>1\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Tuple{Int,Float64},1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k][2]<=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif z[2]<=h[2*k][2]&&z[2]<=h[2*k+1][2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k][2]<=h[2*k+1][2]?2*k:2*k+1\n\t\t\t\t\ttmp = h[t]\n\t\t\t\t\th[t] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tx\nend\n\ndist(xa::Int,ya::Int,xb::Int,yb::Int,ra::Int,rb::Int)=sqrt((xa-xb)^2+(ya-yb)^2)-ra-rb\n\nfunction main()\n\txs,ys,xt,yt = readline() |> split |> parseMap\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int,Int}[(0,0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tx,y,r = readline() |> split |> parseMap\n\t\ta[i] = (x,y,r)\n\tend\n\te = [Tuple{Int,Float64}[] for i in 1:n+2]\n\tfor i in 1:n\n\t\tfor j in i+1:n\n\t\t\tv = dist(a[i][1],a[i][2],a[j][1],a[j][2],a[i][3],a[j][3])\n\t\t\tpush!(e[i], (j,max(0,v)))\n\t\t\tpush!(e[j], (i,max(0,v)))\n\t\tend\n\t\tv = dist(a[i][1],a[i][2],xs,ys,a[i][3],0)\n\t\tpush!(e[i],(n+1,max(0,v)))\n\t\tpush!(e[n+1],(i,max(0,v)))\n\t\tv = dist(a[i][1],a[i][2],xt,yt,a[i][3],0)\n\t\tpush!(e[i],(n+2,max(0,v)))\n\t\tpush!(e[n+2],(i,max(0,v)))\n\tend\n\tv = dist(xs,ys,xt,yt,0,0)\n\tpush!(e[n+1],(n+2,max(0,v)))\n\tpush!(e[n+2],(n+1,max(0,v)))\n\n\ths = Tuple{Int,Float64}[(n+1,0.0)]\n\thg = Tuple{Int,Float64}[(n+2,0.0)]\n\tds = -ones(Float64,n+2)\n\tdg = -ones(Float64,n+2)\n\tvst = zeros(Int,n+2)\n\tds[n+1] = 0.0\n\tdg[n+2] = 0.0\n\tmeet = 0\n\twhile !isempty(hs)||!isempty(hg)\n\t\tv,w = hpop(hs)\n\t\tds[v] = ds[v]<0.0?w:min(ds[v],w)\n\t\tvst[v] += 1\n\t\tif vst[v] > 1\n\t\t\tmeet = v\n\t\t\tbreak\n\t\tend\n\t\tfor i in 1:length(e[v])\n\t\t\tif ds[e[v][i][1]]<0.0 || ds[e[v][i][1]]>w+e[v][i][2]\n\t\t\t\tds[e[v][i][1]] = w+e[v][i][2]\n\t\t\t\thpush(hs,(e[v][i][1],w+e[v][i][2]))\n\t\t\tend\n\t\tend\n\t\tv,w = hpop(hg)\n\t\tdg[v] = dg[v]<0.0?w:min(dg[v],w)\n\t\tvst[v] += 1\n\t\tif vst[v] > 1\n\t\t\tmeet = v\n\t\t\tbreak\n\t\tend\n\t\tfor i in 1:length(e[v])\n\t\t\tif dg[e[v][i][1]]<0.0 || dg[e[v][i][1]]>w+e[v][i][2]\n\t\t\t\tdg[e[v][i][1]] = w+e[v][i][2]\n\t\t\t\thpush(hg,(e[v][i][1],w+e[v][i][2]))\n\t\t\tend\n\t\tend\n\tend\n\tif ds[n+2]<0.0&&dg[n+1]<0.0\n\t\tprintln(ds[meet]+dg[meet])\n\telseif ds[n+2]>=0.0\n\t\tif meet>0\n\t\t\tprintln(min(ds[n+2],ds[meet]+dg[meet]))\n\t\telse\n\t\t\tprintln(ds[n+2])\n\t\tend\n\telse\n\t\tif meet>0\n\t\t\tprintln(min(dg[n+1],ds[meet]+dg[meet]))\n\t\telse\n\t\t\tprintln(dg[n+1])\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1574837944, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03866.html", "problem_id": "p03866", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03866/input.txt", "sample_output_relpath": "derived/input_output/data/p03866/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03866/Julia/s809934755.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s809934755", "user_id": "u095714878"}, "prompt_components": {"gold_output": "3.6568542495\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction hpush(h::Array{Tuple{Int,Float64},1},x::Tuple{Int,Float64})\n\tpush!(h,x)\n\tif length(h)>1\n\t\tl = length(h)\n\t\tk = l>>1\n\t\twhile x[2]=1\n\t\t\ttmp = h[k]\n\t\t\th[k] = x\n\t\t\th[l] = tmp\n\t\t\tk>>1\n\t\t\tl>>1\n\t\tend\n\tend\nend\n\nfunction hpop(h::Array{Tuple{Int,Float64},1})\n\tx = h[1]\n\tz = pop!(h)\n\tif !isempty(h)\n\t\th[1] = z\n\t\tk = 1\n\t\tl = length(h)\n\t\twhile k <= l\n\t\t\tif 2*k>l\n\t\t\t\tbreak\n\t\t\telseif 2*k+1>l\n\t\t\t\tif h[2*k][2]<=z[2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\ttmp = h[2*k]\n\t\t\t\t\th[2*k] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = 2*k\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif z[2]<=h[2*k][2]&&z[2]<=h[2*k+1][2]\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tt = h[2*k][2]<=h[2*k+1][2]?2*k:2*k+1\n\t\t\t\t\ttmp = h[t]\n\t\t\t\t\th[t] = z\n\t\t\t\t\th[k] = tmp\n\t\t\t\t\tk = t\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\tx\nend\n\ndist(xa::Int,ya::Int,xb::Int,yb::Int,ra::Int,rb::Int)=sqrt((xa-xb)^2+(ya-yb)^2)-ra-rb\n\nfunction main()\n\txs,ys,xt,yt = readline() |> split |> parseMap\n\tn = readline() |> parseInt\n\ta = Tuple{Int,Int,Int}[(0,0,0) for i in 1:n]\n\tfor i in 1:n\n\t\tx,y,r = readline() |> split |> parseMap\n\t\ta[i] = (x,y,r)\n\tend\n\te = [Tuple{Int,Float64}[] for i in 1:n+2]\n\tfor i in 1:n\n\t\tfor j in i+1:n\n\t\t\tv = dist(a[i][1],a[i][2],a[j][1],a[j][2],a[i][3],a[j][3])\n\t\t\tpush!(e[i], (j,max(0,v)))\n\t\t\tpush!(e[j], (i,max(0,v)))\n\t\tend\n\t\tv = dist(a[i][1],a[i][2],xs,ys,a[i][3],0)\n\t\tpush!(e[i],(n+1,max(0,v)))\n\t\tpush!(e[n+1],(i,max(0,v)))\n\t\tv = dist(a[i][1],a[i][2],xt,yt,a[i][3],0)\n\t\tpush!(e[i],(n+2,max(0,v)))\n\t\tpush!(e[n+2],(i,max(0,v)))\n\tend\n\tv = dist(xs,ys,xt,yt,0,0)\n\tpush!(e[n+1],(n+2,max(0,v)))\n\tpush!(e[n+2],(n+1,max(0,v)))\n\n\ths = Tuple{Int,Float64}[(n+1,0.0)]\n\thg = Tuple{Int,Float64}[(n+2,0.0)]\n\tds = -ones(Float64,n+2)\n\tdg = -ones(Float64,n+2)\n\tvst = zeros(Int,n+2)\n\tds[n+1] = 0.0\n\tdg[n+2] = 0.0\n\tmeet = 0\n\twhile !isempty(hs)||!isempty(hg)\n\t\tv,w = hpop(hs)\n\t\tds[v] = ds[v]<0.0?w:min(ds[v],w)\n\t\tvst[v] += 1\n\t\tif vst[v] > 1\n\t\t\tmeet = v\n\t\t\tbreak\n\t\tend\n\t\tfor i in 1:length(e[v])\n\t\t\tif ds[e[v][i][1]]<0.0 || ds[e[v][i][1]]>w+e[v][i][2]\n\t\t\t\tds[e[v][i][1]] = w+e[v][i][2]\n\t\t\t\thpush(hs,(e[v][i][1],w+e[v][i][2]))\n\t\t\tend\n\t\tend\n\t\tv,w = hpop(hg)\n\t\tdg[v] = dg[v]<0.0?w:min(dg[v],w)\n\t\tvst[v] += 1\n\t\tif vst[v] > 1\n\t\t\tmeet = v\n\t\t\tbreak\n\t\tend\n\t\tfor i in 1:length(e[v])\n\t\t\tif dg[e[v][i][1]]<0.0 || dg[e[v][i][1]]>w+e[v][i][2]\n\t\t\t\tdg[e[v][i][1]] = w+e[v][i][2]\n\t\t\t\thpush(hg,(e[v][i][1],w+e[v][i][2]))\n\t\t\tend\n\t\tend\n\tend\n\tif ds[n+2]<0.0&&dg[n+1]<0.0\n\t\tprintln(ds[meet]+dg[meet])\n\telseif ds[n+2]>=0.0\n\t\tif meet>0\n\t\t\tprintln(min(ds[n+2],ds[meet]+dg[meet]))\n\t\telse\n\t\t\tprintln(ds[n+2])\n\t\tend\n\telse\n\t\tif meet>0\n\t\t\tprintln(min(dg[n+1],ds[meet]+dg[meet]))\n\t\telse\n\t\t\tprintln(dg[n+1])\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 600 points\n\nProblem Statement\n\nOn the xy-plane, Snuke is going to travel from the point (x_s, y_s) to the point (x_t, y_t).\nHe can move in arbitrary directions with speed 1.\nHere, we will consider him as a point without size.\n\nThere are N circular barriers deployed on the plane.\nThe center and the radius of the i-th barrier are (x_i, y_i) and r_i, respectively.\nThe barriers may overlap or contain each other.\n\nA point on the plane is exposed to cosmic rays if the point is not within any of the barriers.\n\nSnuke wants to avoid exposure to cosmic rays as much as possible during the travel.\nFind the minimum possible duration of time he is exposed to cosmic rays during the travel.\n\nConstraints\n\nAll input values are integers.\n\n-10^9 ≤ x_s, y_s, x_t, y_t ≤ 10^9\n\n(x_s, y_s) ≠ (x_t, y_t)\n\n1≤N≤1,000\n\n-10^9 ≤ x_i, y_i ≤ 10^9\n\n1 ≤ r_i ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx_s y_s x_t y_t\nN\nx_1 y_1 r_1\nx_2 y_2 r_2\n:\nx_N y_N r_N\n\nOutput\n\nPrint the minimum possible duration of time Snuke is exposed to cosmic rays during the travel.\nThe output is considered correct if the absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n-2 -2 2 2\n1\n0 0 1\n\nSample Output 1\n\n3.6568542495\n\nAn optimal route is as follows:\n\nSample Input 2\n\n-2 0 2 0\n2\n-1 0 2\n1 0 2\n\nSample Output 2\n\n0.0000000000\n\nAn optimal route is as follows:\n\nSample Input 3\n\n4 -2 -2 4\n3\n0 0 2\n4 0 1\n0 4 1\n\nSample Output 3\n\n4.0000000000\n\nAn optimal route is as follows:", "sample_input": "-2 -2 2 2\n1\n0 0 1\n"}, "reference_outputs": ["3.6568542495\n"], "source_document_id": "p03866", "source_text": "Score : 600 points\n\nProblem Statement\n\nOn the xy-plane, Snuke is going to travel from the point (x_s, y_s) to the point (x_t, y_t).\nHe can move in arbitrary directions with speed 1.\nHere, we will consider him as a point without size.\n\nThere are N circular barriers deployed on the plane.\nThe center and the radius of the i-th barrier are (x_i, y_i) and r_i, respectively.\nThe barriers may overlap or contain each other.\n\nA point on the plane is exposed to cosmic rays if the point is not within any of the barriers.\n\nSnuke wants to avoid exposure to cosmic rays as much as possible during the travel.\nFind the minimum possible duration of time he is exposed to cosmic rays during the travel.\n\nConstraints\n\nAll input values are integers.\n\n-10^9 ≤ x_s, y_s, x_t, y_t ≤ 10^9\n\n(x_s, y_s) ≠ (x_t, y_t)\n\n1≤N≤1,000\n\n-10^9 ≤ x_i, y_i ≤ 10^9\n\n1 ≤ r_i ≤ 10^9\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nx_s y_s x_t y_t\nN\nx_1 y_1 r_1\nx_2 y_2 r_2\n:\nx_N y_N r_N\n\nOutput\n\nPrint the minimum possible duration of time Snuke is exposed to cosmic rays during the travel.\nThe output is considered correct if the absolute or relative error is at most 10^{-9}.\n\nSample Input 1\n\n-2 -2 2 2\n1\n0 0 1\n\nSample Output 1\n\n3.6568542495\n\nAn optimal route is as follows:\n\nSample Input 2\n\n-2 0 2 0\n2\n-1 0 2\n1 0 2\n\nSample Output 2\n\n0.0000000000\n\nAn optimal route is as follows:\n\nSample Input 3\n\n4 -2 -2 4\n3\n0 0 2\n4 0 1\n0 4 1\n\nSample Output 3\n\n4.0000000000\n\nAn optimal route is as follows:", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 2657, "cpu_time_ms": 768, "memory_kb": 160740}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s716770507", "group_id": "codeNet:p03909", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\tfor i in 1:h\n\t\ts = readline() |> split\n\t\tfor j in 1:w\n\t\t\tif s[j][1:5] == \"snuke\"\n\t\t\t\tprintln(Char(64+j),i)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1561430997, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03909.html", "problem_id": "p03909", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03909/input.txt", "sample_output_relpath": "derived/input_output/data/p03909/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03909/Julia/s716770507.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s716770507", "user_id": "u095714878"}, "prompt_components": {"gold_output": "H6\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\th,w = readline() |> split |> parseMap\n\tfor i in 1:h\n\t\ts = readline() |> split\n\t\tfor j in 1:w\n\t\t\tif s[j][1:5] == \"snuke\"\n\t\t\t\tprintln(Char(64+j),i)\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend\nend\nmain()\n", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from A through the W-th letter of the alphabet.\n\nExactly one of the squares in the grid contains the string snuke. Find this square and report its location.\n\nFor example, the square at the 6-th row and 8-th column should be reported as H6.\n\nConstraints\n\n1≦H, W≦26\n\nThe length of S_{i,j} is 5.\n\nS_{i,j} consists of lowercase English letters (a-z).\n\nExactly one of the given strings is equal to snuke.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nS_{1,1} S_{1,2} ... S_{1,W}\nS_{2,1} S_{2,2} ... S_{2,W}\n:\nS_{H,1} S_{H,2} ... S_{H,W}\n\nOutput\n\nPrint the labels of the row and the column of the square containing the string snuke, with no space inbetween.\n\nSample Input 1\n\n15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n\nSample Output 1\n\nH6\n\nSample Input 2\n\n1 1\nsnuke\n\nSample Output 2\n\nA1", "sample_input": "15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n"}, "reference_outputs": ["H6\n"], "source_document_id": "p03909", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from A through the W-th letter of the alphabet.\n\nExactly one of the squares in the grid contains the string snuke. Find this square and report its location.\n\nFor example, the square at the 6-th row and 8-th column should be reported as H6.\n\nConstraints\n\n1≦H, W≦26\n\nThe length of S_{i,j} is 5.\n\nS_{i,j} consists of lowercase English letters (a-z).\n\nExactly one of the given strings is equal to snuke.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nS_{1,1} S_{1,2} ... S_{1,W}\nS_{2,1} S_{2,2} ... S_{2,W}\n:\nS_{H,1} S_{H,2} ... S_{H,W}\n\nOutput\n\nPrint the labels of the row and the column of the square containing the string snuke, with no space inbetween.\n\nSample Input 1\n\n15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n\nSample Output 1\n\nH6\n\nSample Input 2\n\n1 1\nsnuke\n\nSample Output 2\n\nA1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 348, "memory_kb": 110520}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s375344616", "group_id": "codeNet:p03910", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tm = 0\n\twhile m*(m+1)>1)\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1577252079, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03910.html", "problem_id": "p03910", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03910/input.txt", "sample_output_relpath": "derived/input_output/data/p03910/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03910/Julia/s375344616.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s375344616", "user_id": "u095714878"}, "prompt_components": {"gold_output": "1\n3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn = readline() |> parseInt\n\tm = 0\n\twhile m*(m+1)>1)\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "sample_input": "4\n"}, "reference_outputs": ["1\n3\n"], "source_document_id": "p03910", "source_text": "Score : 300 points\n\nProblem Statement\n\nThe problem set at CODE FESTIVAL 20XX Finals consists of N problems.\n\nThe score allocated to the i-th (1≦i≦N) problem is i points.\n\nTakahashi, a contestant, is trying to score exactly N points. For that, he is deciding which problems to solve.\n\nAs problems with higher scores are harder, he wants to minimize the highest score of a problem among the ones solved by him.\n\nDetermine the set of problems that should be solved.\n\nConstraints\n\n1≦N≦10^7\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1≦N≦1000.\n\nAdditional 100 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\n\nOutput\n\nAmong the sets of problems with the total score of N, find a set in which the highest score of a problem is minimum, then print the indices of the problems in the set in any order, one per line.\n\nIf there exists more than one such set, any of them will be accepted.\n\nSample Input 1\n\n4\n\nSample Output 1\n\n1\n3\n\nSolving only the 4-th problem will also result in the total score of 4 points, but solving the 1-st and 3-rd problems will lower the highest score of a solved problem.\n\nSample Input 2\n\n7\n\nSample Output 2\n\n1\n2\n4\n\nThe set \\{3,4\\} will also be accepted.\n\nSample Input 3\n\n1\n\nSample Output 3\n\n1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 346, "memory_kb": 111528}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s363842849", "group_id": "codeNet:p03919", "input_text": "H,W=map(x->parse(Int,x),split(readline()))\nfor i=1:H\n T=split(readline())\n for j=1:W\n if T[j]==\"snuke\"\n println(\"$(Char(j+64))$i\")\n end\n end\nend", "language": "Julia", "metadata": {"date": 1568038390, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03919.html", "problem_id": "p03919", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03919/input.txt", "sample_output_relpath": "derived/input_output/data/p03919/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03919/Julia/s363842849.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s363842849", "user_id": "u657913472"}, "prompt_components": {"gold_output": "H6\n", "input_to_evaluate": "H,W=map(x->parse(Int,x),split(readline()))\nfor i=1:H\n T=split(readline())\n for j=1:W\n if T[j]==\"snuke\"\n println(\"$(Char(j+64))$i\")\n end\n end\nend", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from A through the W-th letter of the alphabet.\n\nExactly one of the squares in the grid contains the string snuke. Find this square and report its location.\n\nFor example, the square at the 6-th row and 8-th column should be reported as H6.\n\nConstraints\n\n1≦H, W≦26\n\nThe length of S_{i,j} is 5.\n\nS_{i,j} consists of lowercase English letters (a-z).\n\nExactly one of the given strings is equal to snuke.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nS_{1,1} S_{1,2} ... S_{1,W}\nS_{2,1} S_{2,2} ... S_{2,W}\n:\nS_{H,1} S_{H,2} ... S_{H,W}\n\nOutput\n\nPrint the labels of the row and the column of the square containing the string snuke, with no space inbetween.\n\nSample Input 1\n\n15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n\nSample Output 1\n\nH6\n\nSample Input 2\n\n1 1\nsnuke\n\nSample Output 2\n\nA1", "sample_input": "15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n"}, "reference_outputs": ["H6\n"], "source_document_id": "p03919", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a grid with H rows and W columns.\n\nThe square at the i-th row and j-th column contains a string S_{i,j} of length 5.\n\nThe rows are labeled with the numbers from 1 through H, and the columns are labeled with the uppercase English letters from A through the W-th letter of the alphabet.\n\nExactly one of the squares in the grid contains the string snuke. Find this square and report its location.\n\nFor example, the square at the 6-th row and 8-th column should be reported as H6.\n\nConstraints\n\n1≦H, W≦26\n\nThe length of S_{i,j} is 5.\n\nS_{i,j} consists of lowercase English letters (a-z).\n\nExactly one of the given strings is equal to snuke.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nH W\nS_{1,1} S_{1,2} ... S_{1,W}\nS_{2,1} S_{2,2} ... S_{2,W}\n:\nS_{H,1} S_{H,2} ... S_{H,W}\n\nOutput\n\nPrint the labels of the row and the column of the square containing the string snuke, with no space inbetween.\n\nSample Input 1\n\n15 10\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snuke snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\nsnake snake snake snake snake snake snake snake snake snake\n\nSample Output 1\n\nH6\n\nSample Input 2\n\n1 1\nsnuke\n\nSample Output 2\n\nA1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 158, "cpu_time_ms": 365, "memory_kb": 114444}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s404586509", "group_id": "codeNet:p03921", "input_text": "type UF\n\tn::Int\n\tpr::Array{Int}\n\tsz::Array{Int}\n\tUF(n)=new(n,1:n,ones(Int,n))\nend\nfunction find(UF,a)\n\tif UF.pr[a]==a\n\t\ta\n\telse\n\t\tUF.pr[a]=find(UF,UF.pr[a])\n\tend\nend\nsame(UF,a,b)=find(UF,a)==find(UF,b)\nfunction unite(UF,a,b)\n\tap=find(UF,a)\n\tbp=find(UF,b)\n\tif ap==bp\n\t\tfalse\n\telse\n\t\tif UF.sz[ap]parse(Int,x),split(readline()))\n\tpr=-ones(Int,M)\n\tuf=UF(N)\n\tfor i=1:N\n\t\tL=map(x->parse(Int,x),split(readline()))\n\t\tshift!(L)\n\t\tfor l=L\n\t\t\tif pr[l]<0\n\t\t\t\tpr[l]=i\n\t\t\telse\n\t\t\t\tunite(uf,pr[l],i)\n\t\t\tend\n\t\tend\n\tend\n\tfor i=1:N\n\t\tif !same(uf,1,i)\n\t\t\tprintln(\"NO\")\n\t\t\texit()\n\t\tend\n\tend\n\tprintln(\"YES\")\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1582882880, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03921.html", "problem_id": "p03921", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03921/input.txt", "sample_output_relpath": "derived/input_output/data/p03921/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03921/Julia/s404586509.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s404586509", "user_id": "u657913472"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "type UF\n\tn::Int\n\tpr::Array{Int}\n\tsz::Array{Int}\n\tUF(n)=new(n,1:n,ones(Int,n))\nend\nfunction find(UF,a)\n\tif UF.pr[a]==a\n\t\ta\n\telse\n\t\tUF.pr[a]=find(UF,UF.pr[a])\n\tend\nend\nsame(UF,a,b)=find(UF,a)==find(UF,b)\nfunction unite(UF,a,b)\n\tap=find(UF,a)\n\tbp=find(UF,b)\n\tif ap==bp\n\t\tfalse\n\telse\n\t\tif UF.sz[ap]parse(Int,x),split(readline()))\n\tpr=-ones(Int,M)\n\tuf=UF(N)\n\tfor i=1:N\n\t\tL=map(x->parse(Int,x),split(readline()))\n\t\tshift!(L)\n\t\tfor l=L\n\t\t\tif pr[l]<0\n\t\t\t\tpr[l]=i\n\t\t\telse\n\t\t\t\tunite(uf,pr[l],i)\n\t\t\tend\n\t\tend\n\tend\n\tfor i=1:N\n\t\tif !same(uf,1,i)\n\t\t\tprintln(\"NO\")\n\t\t\texit()\n\t\tend\n\tend\n\tprintln(\"YES\")\nend\nmain()\n", "problem_context": "Score : 400 points\n\nProblem Statement\n\nOn a planet far, far away, M languages are spoken. They are conveniently numbered 1 through M.\n\nFor CODE FESTIVAL 20XX held on this planet, N participants gathered from all over the planet.\n\nThe i-th (1≦i≦N) participant can speak K_i languages numbered L_{i,1}, L_{i,2}, ..., L_{i,{}K_i}.\n\nTwo participants A and B can communicate with each other if and only if one of the following conditions is satisfied:\n\nThere exists a language that both A and B can speak.\n\nThere exists a participant X that both A and B can communicate with.\n\nDetermine whether all N participants can communicate with all other participants.\n\nConstraints\n\n2≦N≦10^5\n\n1≦M≦10^5\n\n1≦K_i≦M\n\n(The sum of all K_i)≦10^5\n\n1≦L_{i,j}≦M\n\nL_{i,1}, L_{i,2}, ..., L_{i,{}K_i} are pairwise distinct.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying the following: N≦1000, M≦1000 and (The sum of all K_i)≦1000.\n\nAdditional 200 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nK_1 L_{1,1} L_{1,2} ... L_{1,{}K_1}\nK_2 L_{2,1} L_{2,2} ... L_{2,{}K_2}\n:\nK_N L_{N,1} L_{N,2} ... L_{N,{}K_N}\n\nOutput\n\nIf all N participants can communicate with all other participants, print YES. Otherwise, print NO.\n\nSample Input 1\n\n4 6\n3 1 2 3\n2 4 2\n2 4 6\n1 6\n\nSample Output 1\n\nYES\n\nAny two participants can communicate with each other, as follows:\n\nParticipants 1 and 2: both can speak language 2.\n\nParticipants 2 and 3: both can speak language 4.\n\nParticipants 1 and 3: both can communicate with participant 2.\n\nParticipants 3 and 4: both can speak language 6.\n\nParticipants 2 and 4: both can communicate with participant 3.\n\nParticipants 1 and 4: both can communicate with participant 2.\n\nNote that there can be languages spoken by no participant.\n\nSample Input 2\n\n4 4\n2 1 2\n2 1 2\n1 3\n2 4 3\n\nSample Output 2\n\nNO\n\nFor example, participants 1 and 3 cannot communicate with each other.", "sample_input": "4 6\n3 1 2 3\n2 4 2\n2 4 6\n1 6\n"}, "reference_outputs": ["YES\n"], "source_document_id": "p03921", "source_text": "Score : 400 points\n\nProblem Statement\n\nOn a planet far, far away, M languages are spoken. They are conveniently numbered 1 through M.\n\nFor CODE FESTIVAL 20XX held on this planet, N participants gathered from all over the planet.\n\nThe i-th (1≦i≦N) participant can speak K_i languages numbered L_{i,1}, L_{i,2}, ..., L_{i,{}K_i}.\n\nTwo participants A and B can communicate with each other if and only if one of the following conditions is satisfied:\n\nThere exists a language that both A and B can speak.\n\nThere exists a participant X that both A and B can communicate with.\n\nDetermine whether all N participants can communicate with all other participants.\n\nConstraints\n\n2≦N≦10^5\n\n1≦M≦10^5\n\n1≦K_i≦M\n\n(The sum of all K_i)≦10^5\n\n1≦L_{i,j}≦M\n\nL_{i,1}, L_{i,2}, ..., L_{i,{}K_i} are pairwise distinct.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying the following: N≦1000, M≦1000 and (The sum of all K_i)≦1000.\n\nAdditional 200 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nK_1 L_{1,1} L_{1,2} ... L_{1,{}K_1}\nK_2 L_{2,1} L_{2,2} ... L_{2,{}K_2}\n:\nK_N L_{N,1} L_{N,2} ... L_{N,{}K_N}\n\nOutput\n\nIf all N participants can communicate with all other participants, print YES. Otherwise, print NO.\n\nSample Input 1\n\n4 6\n3 1 2 3\n2 4 2\n2 4 6\n1 6\n\nSample Output 1\n\nYES\n\nAny two participants can communicate with each other, as follows:\n\nParticipants 1 and 2: both can speak language 2.\n\nParticipants 2 and 3: both can speak language 4.\n\nParticipants 1 and 3: both can communicate with participant 2.\n\nParticipants 3 and 4: both can speak language 6.\n\nParticipants 2 and 4: both can communicate with participant 3.\n\nParticipants 1 and 4: both can communicate with participant 2.\n\nNote that there can be languages spoken by no participant.\n\nSample Input 2\n\n4 4\n2 1 2\n2 1 2\n1 3\n2 4 3\n\nSample Output 2\n\nNO\n\nFor example, participants 1 and 3 cannot communicate with each other.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 775, "cpu_time_ms": 1443, "memory_kb": 153404}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s943886206", "group_id": "codeNet:p03938", "input_text": "N=parse(Int,readline())\np=map(x->parse(Int,x),split(readline()))\nfor i=1:N\n\tprintln((N+1)*i);\nend\nfor i=1:N\n\tprintln((N+1)*(N-i)+p[i])\nend", "language": "Julia", "metadata": {"date": 1579578819, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03938.html", "problem_id": "p03938", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03938/input.txt", "sample_output_relpath": "derived/input_output/data/p03938/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03938/Julia/s943886206.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s943886206", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 4\n5 4\n", "input_to_evaluate": "N=parse(Int,readline())\np=map(x->parse(Int,x),split(readline()))\nfor i=1:N\n\tprintln((N+1)*i);\nend\nfor i=1:N\n\tprintln((N+1)*(N-i)+p[i])\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nYou are given a permutation p of the set {1, 2, ..., N}. Please construct two sequences of positive integers a_1, a_2, ..., a_N and b_1, b_2, ..., b_N satisfying the following conditions:\n\n1 \\leq a_i, b_i \\leq 10^9 for all i\n\na_1 < a_2 < ... < a_N\n\nb_1 > b_2 > ... > b_N\n\na_{p_1}+b_{p_1} < a_{p_2}+b_{p_2} < ... < a_{p_N}+b_{p_N}\n\nConstraints\n\n2 \\leq N \\leq 20,000\n\np is a permutation of the set {1, 2, ..., N}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nThe output consists of two lines. The first line contains a_1, a_2, ..., a_N seperated by a space. The second line contains b_1, b_2, ..., b_N seperated by a space.\n\nIt can be shown that there always exists a solution for any input satisfying the constraints.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n1 4\n5 4\n\na_1 + b_1 = 6 and a_2 + b_2 = 8. So this output satisfies all conditions.\n\nSample Input 2\n\n3\n3 2 1\n\nSample Output 2\n\n1 2 3\n5 3 1\n\nSample Input 3\n\n3\n2 3 1\n\nSample Output 3\n\n5 10 100\n100 10 1", "sample_input": "2\n1 2\n"}, "reference_outputs": ["1 4\n5 4\n"], "source_document_id": "p03938", "source_text": "Score : 400 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nYou are given a permutation p of the set {1, 2, ..., N}. Please construct two sequences of positive integers a_1, a_2, ..., a_N and b_1, b_2, ..., b_N satisfying the following conditions:\n\n1 \\leq a_i, b_i \\leq 10^9 for all i\n\na_1 < a_2 < ... < a_N\n\nb_1 > b_2 > ... > b_N\n\na_{p_1}+b_{p_1} < a_{p_2}+b_{p_2} < ... < a_{p_N}+b_{p_N}\n\nConstraints\n\n2 \\leq N \\leq 20,000\n\np is a permutation of the set {1, 2, ..., N}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nThe output consists of two lines. The first line contains a_1, a_2, ..., a_N seperated by a space. The second line contains b_1, b_2, ..., b_N seperated by a space.\n\nIt can be shown that there always exists a solution for any input satisfying the constraints.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n1 4\n5 4\n\na_1 + b_1 = 6 and a_2 + b_2 = 8. So this output satisfies all conditions.\n\nSample Input 2\n\n3\n3 2 1\n\nSample Output 2\n\n1 2 3\n5 3 1\n\nSample Input 3\n\n3\n2 3 1\n\nSample Output 3\n\n5 10 100\n100 10 1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 761, "memory_kb": 167280}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s810734172", "group_id": "codeNet:p03938", "input_text": "N=parse(Int,readline())\np=map(x->parse(Int,x),split(readline()))\nfor i=1:N\n\tprint(\"$((N+1)*i)$(i==N?Char(10):\" \")\");\nend\nfor i=1:N\n\tprint(\"$((N+1)*(N-i)+p[i])$(i==N?Char(10):\" \")\")\nend", "language": "Julia", "metadata": {"date": 1579578611, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03938.html", "problem_id": "p03938", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03938/input.txt", "sample_output_relpath": "derived/input_output/data/p03938/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03938/Julia/s810734172.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s810734172", "user_id": "u657913472"}, "prompt_components": {"gold_output": "1 4\n5 4\n", "input_to_evaluate": "N=parse(Int,readline())\np=map(x->parse(Int,x),split(readline()))\nfor i=1:N\n\tprint(\"$((N+1)*i)$(i==N?Char(10):\" \")\");\nend\nfor i=1:N\n\tprint(\"$((N+1)*(N-i)+p[i])$(i==N?Char(10):\" \")\")\nend", "problem_context": "Score : 400 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nYou are given a permutation p of the set {1, 2, ..., N}. Please construct two sequences of positive integers a_1, a_2, ..., a_N and b_1, b_2, ..., b_N satisfying the following conditions:\n\n1 \\leq a_i, b_i \\leq 10^9 for all i\n\na_1 < a_2 < ... < a_N\n\nb_1 > b_2 > ... > b_N\n\na_{p_1}+b_{p_1} < a_{p_2}+b_{p_2} < ... < a_{p_N}+b_{p_N}\n\nConstraints\n\n2 \\leq N \\leq 20,000\n\np is a permutation of the set {1, 2, ..., N}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nThe output consists of two lines. The first line contains a_1, a_2, ..., a_N seperated by a space. The second line contains b_1, b_2, ..., b_N seperated by a space.\n\nIt can be shown that there always exists a solution for any input satisfying the constraints.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n1 4\n5 4\n\na_1 + b_1 = 6 and a_2 + b_2 = 8. So this output satisfies all conditions.\n\nSample Input 2\n\n3\n3 2 1\n\nSample Output 2\n\n1 2 3\n5 3 1\n\nSample Input 3\n\n3\n2 3 1\n\nSample Output 3\n\n5 10 100\n100 10 1", "sample_input": "2\n1 2\n"}, "reference_outputs": ["1 4\n5 4\n"], "source_document_id": "p03938", "source_text": "Score : 400 points\n\nProblem Statement\n\n#nck {\nwidth: 30px;\nheight: auto;\n}\n\nYou are given a permutation p of the set {1, 2, ..., N}. Please construct two sequences of positive integers a_1, a_2, ..., a_N and b_1, b_2, ..., b_N satisfying the following conditions:\n\n1 \\leq a_i, b_i \\leq 10^9 for all i\n\na_1 < a_2 < ... < a_N\n\nb_1 > b_2 > ... > b_N\n\na_{p_1}+b_{p_1} < a_{p_2}+b_{p_2} < ... < a_{p_N}+b_{p_N}\n\nConstraints\n\n2 \\leq N \\leq 20,000\n\np is a permutation of the set {1, 2, ..., N}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\np_1 p_2 ... p_N\n\nOutput\n\nThe output consists of two lines. The first line contains a_1, a_2, ..., a_N seperated by a space. The second line contains b_1, b_2, ..., b_N seperated by a space.\n\nIt can be shown that there always exists a solution for any input satisfying the constraints.\n\nSample Input 1\n\n2\n1 2\n\nSample Output 1\n\n1 4\n5 4\n\na_1 + b_1 = 6 and a_2 + b_2 = 8. So this output satisfies all conditions.\n\nSample Input 2\n\n3\n3 2 1\n\nSample Output 2\n\n1 2 3\n5 3 1\n\nSample Input 3\n\n3\n2 3 1\n\nSample Output 3\n\n5 10 100\n100 10 1", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 184, "cpu_time_ms": 1082, "memory_kb": 167528}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s620533599", "group_id": "codeNet:p03944", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tw,h,n = readline() |> split |> parseMap\n\tlx = 0\n\trx = w\n\tly = 0\n\try = h\n\tfor i in 1:n\n\t\tx,y,a = readline() |> split |> parseMap\n\t\tif a==1\n\t\t\tlx = max(lx,x)\n\t\telseif a==2\n\t\t\trx = min(rx,x)\n\t\telseif a==3\n\t\t\tly = max(ly,y)\n\t\telse\n\t\t\try = min(ry,y)\n\t\tend\n\tend\n\tprintln(max(rx-lx,0)*max(ry-ly,0))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1585740740, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s620533599.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s620533599", "user_id": "u095714878"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tw,h,n = readline() |> split |> parseMap\n\tlx = 0\n\trx = w\n\tly = 0\n\try = h\n\tfor i in 1:n\n\t\tx,y,a = readline() |> split |> parseMap\n\t\tif a==1\n\t\t\tlx = max(lx,x)\n\t\telseif a==2\n\t\t\trx = min(rx,x)\n\t\telseif a==3\n\t\t\tly = max(ly,y)\n\t\telse\n\t\t\try = min(ry,y)\n\t\tend\n\tend\n\tprintln(max(rx-lx,0)*max(ry-ly,0))\nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 354, "memory_kb": 111780}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s490766664", "group_id": "codeNet:p03944", "input_text": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n w,h,n=parseMap(split(readline()))\n hma,hmi,wma,wmi=h,0,w,0\n for i in 1:n\n x,y,a=parseMap(split(readline()))\n if a==1\n wmi=max(wmi,x)\n elseif a==2\n wma=min(wma,x)\n elseif a==3\n hmi=max(hmi,y)\n else\n hma=min(hma,y)\n end\n end\n println(max((hma-hmi)*(wma-wmi),0))\nend\nmain()", "language": "Julia", "metadata": {"date": 1584833112, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s490766664.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s490766664", "user_id": "u619197965"}, "prompt_components": {"gold_output": "9\n", "input_to_evaluate": "parseInt(x::String) = parse(Int, x)\nparseInt(x::SubString{String}) = parse(Int, x)\nparseInt(x::Char) = parse(Int, x)\nparseInt(x::Float64) = trunc(Int, x)\nparseFloat(x::String) = parse(Float64, x)\nparseFloat(x::Int) = trunc(Float64, x)\nparseFloat(x::SubString{String}) = parse(Float64, x)\nparseFloat(x::Char) = parse(Float64, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n w,h,n=parseMap(split(readline()))\n hma,hmi,wma,wmi=h,0,w,0\n for i in 1:n\n x,y,a=parseMap(split(readline()))\n if a==1\n wmi=max(wmi,x)\n elseif a==2\n wma=min(wma,x)\n elseif a==3\n hmi=max(hmi,y)\n else\n hma=min(hma,y)\n end\n end\n println(max((hma-hmi)*(wma-wmi),0))\nend\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 791, "memory_kb": 169236}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s368667077", "group_id": "codeNet:p03957", "input_text": "f=0\nfor c=readline()\n if f==0&&c=='C'\n f=1\n elseif f==1&&c=='F'\n f=2\n end\nend\nprintln(f==2 ? \"Yes\" : \"No\")", "language": "Julia", "metadata": {"date": 1568038223, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03957.html", "problem_id": "p03957", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03957/input.txt", "sample_output_relpath": "derived/input_output/data/p03957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03957/Julia/s368667077.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s368667077", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "f=0\nfor c=readline()\n if f==0&&c=='C'\n f=1\n elseif f==1&&c=='F'\n f=2\n end\nend\nprintln(f==2 ? \"Yes\" : \"No\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "sample_input": "CODEFESTIVAL\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03957", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 293, "memory_kb": 107672}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s701775780", "group_id": "codeNet:p03957", "input_text": "s=readline()\ni=find(x->x=='C',s)\nj=find(x->x=='F',s)\nprint(isempty(i)||isempty(j)||i[1]>j[end]?\"No\":\"Yes\")", "language": "Julia", "metadata": {"date": 1561223853, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03957.html", "problem_id": "p03957", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03957/input.txt", "sample_output_relpath": "derived/input_output/data/p03957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03957/Julia/s701775780.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s701775780", "user_id": "u729133443"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "s=readline()\ni=find(x->x=='C',s)\nj=find(x->x=='F',s)\nprint(isempty(i)||isempty(j)||i[1]>j[end]?\"No\":\"Yes\")", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "sample_input": "CODEFESTIVAL\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03957", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 106, "cpu_time_ms": 296, "memory_kb": 108788}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s522494593", "group_id": "codeNet:p03957", "input_text": "k, t = map(parse, split(readline()))\nas = map(parse, split(readline()))\nprintln(max(0, k-(k-max(as...)*2-1))", "language": "Julia", "metadata": {"date": 1477676820, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03957.html", "problem_id": "p03957", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03957/input.txt", "sample_output_relpath": "derived/input_output/data/p03957/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03957/Julia/s522494593.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s522494593", "user_id": "u765237551"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "k, t = map(parse, split(readline()))\nas = map(parse, split(readline()))\nprintln(max(0, k-(k-max(as...)*2-1))", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "sample_input": "CODEFESTIVAL\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p03957", "source_text": "Score : 100 points\n\nProblem Statement\n\nThis contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.\n\nMr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.\n\nYou are given a string s consisting of uppercase English letters.\nDetermine whether the string CF can be obtained from the string s by deleting some characters.\n\nConstraints\n\n2 ≤ |s| ≤ 100\n\nAll characters in s are uppercase English letters (A-Z).\n\nInput\n\nThe input is given from Standard Input in the following format:\n\ns\n\nOutput\n\nPrint Yes if the string CF can be obtained from the string s by deleting some characters.\nOtherwise print No.\n\nSample Input 1\n\nCODEFESTIVAL\n\nSample Output 1\n\nYes\n\nCF is obtained by deleting characters other than the first character C and the fifth character F.\n\nSample Input 2\n\nFESTIVALCODE\n\nSample Output 2\n\nNo\n\nFC can be obtained but CF cannot be obtained because you cannot change the order of the characters.\n\nSample Input 3\n\nCF\n\nSample Output 3\n\nYes\n\nIt is also possible not to delete any characters.\n\nSample Input 4\n\nFCF\n\nSample Output 4\n\nYes\n\nCF is obtained by deleting the first character.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 821, "memory_kb": 82348}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s294466894", "group_id": "codeNet:p03958", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n k,t=parseMap(split(readline()))\n a=sort(parseMap(split(readline())),rev=true)[1]\n println(max(a-1-(k-a),0))\nend\nmain()", "language": "Julia", "metadata": {"date": 1587340484, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03958.html", "problem_id": "p03958", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03958/input.txt", "sample_output_relpath": "derived/input_output/data/p03958/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03958/Julia/s294466894.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s294466894", "user_id": "u619197965"}, "prompt_components": {"gold_output": "0\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n k,t=parseMap(split(readline()))\n a=sort(parseMap(split(readline())),rev=true)[1]\n println(max(a-1-(k-a),0))\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are K pieces of cakes.\nMr. Takahashi would like to eat one cake per day, taking K days to eat them all.\n\nThere are T types of cake, and the number of the cakes of type i (1 ≤ i ≤ T) is a_i.\n\nEating the same type of cake two days in a row would be no fun,\nso Mr. Takahashi would like to decide the order for eating cakes that minimizes the number of days on which he has to eat the same type of cake as the day before.\n\nCompute the minimum number of days on which the same type of cake as the previous day will be eaten.\n\nConstraints\n\n1 ≤ K ≤ 10000\n\n1 ≤ T ≤ 100\n\n1 ≤ a_i ≤ 100\n\na_1 + a_2 + ... + a_T = K\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK T\na_1 a_2 ... a_T\n\nOutput\n\nPrint the minimum number of days on which the same type of cake as the previous day will be eaten.\n\nSample Input 1\n\n7 3\n3 2 2\n\nSample Output 1\n\n0\n\nFor example, if Mr. Takahashi eats cakes in the order of 2, 1, 2, 3, 1, 3, 1, he can avoid eating the same type of cake as the previous day.\n\nSample Input 2\n\n6 3\n1 4 1\n\nSample Output 2\n\n1\n\nThere are 6 cakes.\nFor example, if Mr. Takahashi eats cakes in the order of 2, 3, 2, 2, 1, 2, he has to eat the same type of cake (i.e., type 2) as the previous day only on the fourth day.\nSince this is the minimum number, the answer is 1.\n\nSample Input 3\n\n100 1\n100\n\nSample Output 3\n\n99\n\nSince Mr. Takahashi has only one type of cake, he has no choice but to eat the same type of cake as the previous day from the second day and after.", "sample_input": "7 3\n3 2 2\n"}, "reference_outputs": ["0\n"], "source_document_id": "p03958", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are K pieces of cakes.\nMr. Takahashi would like to eat one cake per day, taking K days to eat them all.\n\nThere are T types of cake, and the number of the cakes of type i (1 ≤ i ≤ T) is a_i.\n\nEating the same type of cake two days in a row would be no fun,\nso Mr. Takahashi would like to decide the order for eating cakes that minimizes the number of days on which he has to eat the same type of cake as the day before.\n\nCompute the minimum number of days on which the same type of cake as the previous day will be eaten.\n\nConstraints\n\n1 ≤ K ≤ 10000\n\n1 ≤ T ≤ 100\n\n1 ≤ a_i ≤ 100\n\na_1 + a_2 + ... + a_T = K\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nK T\na_1 a_2 ... a_T\n\nOutput\n\nPrint the minimum number of days on which the same type of cake as the previous day will be eaten.\n\nSample Input 1\n\n7 3\n3 2 2\n\nSample Output 1\n\n0\n\nFor example, if Mr. Takahashi eats cakes in the order of 2, 1, 2, 3, 1, 3, 1, he can avoid eating the same type of cake as the previous day.\n\nSample Input 2\n\n6 3\n1 4 1\n\nSample Output 2\n\n1\n\nThere are 6 cakes.\nFor example, if Mr. Takahashi eats cakes in the order of 2, 3, 2, 2, 1, 2, he has to eat the same type of cake (i.e., type 2) as the previous day only on the fourth day.\nSince this is the minimum number, the answer is 1.\n\nSample Input 3\n\n100 1\n100\n\nSample Output 3\n\n99\n\nSince Mr. Takahashi has only one type of cake, he has no choice but to eat the same type of cake as the previous day from the second day and after.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 856, "memory_kb": 169748}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s119219285", "group_id": "codeNet:p03963", "input_text": "n,k=parse.(split(readline()))\ndp=zeros(Int,n,k)\nfor j=1:k;dp[1,j]=1;end\nfor i=2:n,j=1:k,l=1:k\n if j==l;continue;end\n dp[i,j]+=dp[i-1,l]\nend\nprint(sum(dp[n,:]))", "language": "Julia", "metadata": {"date": 1561733893, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03963.html", "problem_id": "p03963", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03963/input.txt", "sample_output_relpath": "derived/input_output/data/p03963/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03963/Julia/s119219285.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s119219285", "user_id": "u729133443"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n,k=parse.(split(readline()))\ndp=zeros(Int,n,k)\nfor j=1:k;dp[1,j]=1;end\nfor i=2:n,j=1:k,l=1:k\n if j==l;continue;end\n dp[i,j]+=dp[i-1,l]\nend\nprint(sum(dp[n,:]))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N balls placed in a row.\nAtCoDeer the deer is painting each of these in one of the K colors of his paint cans.\nFor aesthetic reasons, any two adjacent balls must be painted in different colors.\n\nFind the number of the possible ways to paint the balls.\n\nConstraints\n\n1≦N≦1000\n\n2≦K≦1000\n\nThe correct answer is at most 2^{31}-1.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of the possible ways to paint the balls.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n2\n\nWe will denote the colors by 0 and 1. There are two possible ways: we can either paint the left ball in color 0 and the right ball in color 1, or paint the left in color 1 and the right in color 0.\n\nSample Input 2\n\n1 10\n\nSample Output 2\n\n10\n\nSince there is only one ball, we can use any of the ten colors to paint it. Thus, the answer is ten.", "sample_input": "2 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03963", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N balls placed in a row.\nAtCoDeer the deer is painting each of these in one of the K colors of his paint cans.\nFor aesthetic reasons, any two adjacent balls must be painted in different colors.\n\nFind the number of the possible ways to paint the balls.\n\nConstraints\n\n1≦N≦1000\n\n2≦K≦1000\n\nThe correct answer is at most 2^{31}-1.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of the possible ways to paint the balls.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n2\n\nWe will denote the colors by 0 and 1. There are two possible ways: we can either paint the left ball in color 0 and the right ball in color 1, or paint the left in color 1 and the right in color 0.\n\nSample Input 2\n\n1 10\n\nSample Output 2\n\n10\n\nSince there is only one ball, we can use any of the ten colors to paint it. Thus, the answer is ten.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1393, "memory_kb": 153628}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s251930598", "group_id": "codeNet:p03963", "input_text": "n,k=map(x->parse(Int,x),split(readline()));print(k*(k-1)^(n-1))", "language": "Julia", "metadata": {"date": 1537922209, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03963.html", "problem_id": "p03963", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03963/input.txt", "sample_output_relpath": "derived/input_output/data/p03963/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03963/Julia/s251930598.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s251930598", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "n,k=map(x->parse(Int,x),split(readline()));print(k*(k-1)^(n-1))", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N balls placed in a row.\nAtCoDeer the deer is painting each of these in one of the K colors of his paint cans.\nFor aesthetic reasons, any two adjacent balls must be painted in different colors.\n\nFind the number of the possible ways to paint the balls.\n\nConstraints\n\n1≦N≦1000\n\n2≦K≦1000\n\nThe correct answer is at most 2^{31}-1.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of the possible ways to paint the balls.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n2\n\nWe will denote the colors by 0 and 1. There are two possible ways: we can either paint the left ball in color 0 and the right ball in color 1, or paint the left in color 1 and the right in color 0.\n\nSample Input 2\n\n1 10\n\nSample Output 2\n\n10\n\nSince there is only one ball, we can use any of the ten colors to paint it. Thus, the answer is ten.", "sample_input": "2 2\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03963", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N balls placed in a row.\nAtCoDeer the deer is painting each of these in one of the K colors of his paint cans.\nFor aesthetic reasons, any two adjacent balls must be painted in different colors.\n\nFind the number of the possible ways to paint the balls.\n\nConstraints\n\n1≦N≦1000\n\n2≦K≦1000\n\nThe correct answer is at most 2^{31}-1.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\n\nOutput\n\nPrint the number of the possible ways to paint the balls.\n\nSample Input 1\n\n2 2\n\nSample Output 1\n\n2\n\nWe will denote the colors by 0 and 1. There are two possible ways: we can either paint the left ball in color 0 and the right ball in color 1, or paint the left in color 1 and the right in color 0.\n\nSample Input 2\n\n1 10\n\nSample Output 2\n\n10\n\nSince there is only one ball, we can use any of the ten colors to paint it. Thus, the answer is ten.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 63, "cpu_time_ms": 310, "memory_kb": 110212}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s162230081", "group_id": "codeNet:p03970", "input_text": "s=\"CODEFESTIVAL2016\"\nt=chomp(readline())\na=0\nfor i=1:16\n a+=s[i]!=t[i]\nend\nprintln(a)", "language": "Julia", "metadata": {"date": 1568038192, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03970.html", "problem_id": "p03970", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03970/input.txt", "sample_output_relpath": "derived/input_output/data/p03970/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03970/Julia/s162230081.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s162230081", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "s=\"CODEFESTIVAL2016\"\nt=chomp(readline())\na=0\nfor i=1:16\n a+=s[i]!=t[i]\nend\nprintln(a)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write CODEFESTIVAL2016 on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length.\n\nSo Mr. Takahashi decided to perform an operation that replaces a certain character with another in the minimum number of iterations, changing the string to CODEFESTIVAL2016.\n\nFind the minimum number of iterations for the rewrite operation.\n\nConstraints\n\nS is 16 characters long.\n\nS consists of uppercase and lowercase alphabet letters and numerals.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nS\n\nOutput\n\nOutput an integer representing the minimum number of iterations needed for the rewrite operation.\n\nSample Input 1\n\nC0DEFESTIVAL2O16\n\nSample Output 1\n\n2\n\nThe second character 0 must be changed to O and the 14th character O changed to 0.\n\nSample Input 2\n\nFESTIVAL2016CODE\n\nSample Output 2\n\n16", "sample_input": "C0DEFESTIVAL2O16\n"}, "reference_outputs": ["2\n"], "source_document_id": "p03970", "source_text": "Score : 100 points\n\nProblem Statement\n\nCODE FESTIVAL 2016 is going to be held. For the occasion, Mr. Takahashi decided to make a signboard.\n\nHe intended to write CODEFESTIVAL2016 on it, but he mistakenly wrote a different string S. Fortunately, the string he wrote was the correct length.\n\nSo Mr. Takahashi decided to perform an operation that replaces a certain character with another in the minimum number of iterations, changing the string to CODEFESTIVAL2016.\n\nFind the minimum number of iterations for the rewrite operation.\n\nConstraints\n\nS is 16 characters long.\n\nS consists of uppercase and lowercase alphabet letters and numerals.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nS\n\nOutput\n\nOutput an integer representing the minimum number of iterations needed for the rewrite operation.\n\nSample Input 1\n\nC0DEFESTIVAL2O16\n\nSample Output 1\n\n2\n\nThe second character 0 must be changed to O and the 14th character O changed to 0.\n\nSample Input 2\n\nFESTIVAL2016CODE\n\nSample Output 2\n\n16", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 86, "cpu_time_ms": 308, "memory_kb": 109960}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s264828321", "group_id": "codeNet:p03971", "input_text": "for i in 1:5\n println(\"No\")\nend", "language": "Julia", "metadata": {"date": 1478971355, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03971.html", "problem_id": "p03971", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03971/input.txt", "sample_output_relpath": "derived/input_output/data/p03971/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03971/Julia/s264828321.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s264828321", "user_id": "u104282757"}, "prompt_components": {"gold_output": "Yes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n", "input_to_evaluate": "for i in 1:5\n println(\"No\")\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.\n\nA Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.\n\nAn overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.\n\nA string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.\n\nWrite a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.\n\nConstraints\n\n1≦N,A,B≦100000\n\nA+B≦N\n\nS is N characters long.\n\nS consists only of the letters a, b and c.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nN A B\nS\n\nOutput\n\nOutput N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.\n\nSample Input 1\n\n10 2 3\nabccabaabb\n\nSample Output 1\n\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n\nThe first, second, fifth, sixth, and seventh participants pass the Qualification contests.\n\nSample Input 2\n\n12 5 2\ncabbabaacaba\n\nSample Output 2\n\nNo\nYes\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\n\nThe sixth participant is third among overseas students and thus does not pass the Qualification contests.\n\nSample Input 3\n\n5 2 2\nccccc\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nNo", "sample_input": "10 2 3\nabccabaabb\n"}, "reference_outputs": ["Yes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n"], "source_document_id": "p03971", "source_text": "Score : 200 points\n\nProblem Statement\n\nThere are N participants in the CODE FESTIVAL 2016 Qualification contests. The participants are either students in Japan, students from overseas, or neither of these.\n\nOnly Japanese students or overseas students can pass the Qualification contests. The students pass when they satisfy the conditions listed below, from the top rank down. Participants who are not students cannot pass the Qualification contests.\n\nA Japanese student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B.\n\nAn overseas student passes the Qualification contests if the number of the participants who have already definitively passed is currently fewer than A+B and the student ranks B-th or above among all overseas students.\n\nA string S is assigned indicating attributes of all participants. If the i-th character of string S is a, this means the participant ranked i-th in the Qualification contests is a Japanese student; b means the participant ranked i-th is an overseas student; and c means the participant ranked i-th is neither of these.\n\nWrite a program that outputs for all the participants in descending rank either Yes if they passed the Qualification contests or No if they did not pass.\n\nConstraints\n\n1≦N,A,B≦100000\n\nA+B≦N\n\nS is N characters long.\n\nS consists only of the letters a, b and c.\n\nInput\n\nInputs are provided from Standard Input in the following form.\n\nN A B\nS\n\nOutput\n\nOutput N lines. On the i-th line, output Yes if the i-th participant passed the Qualification contests or No if that participant did not pass.\n\nSample Input 1\n\n10 2 3\nabccabaabb\n\nSample Output 1\n\nYes\nYes\nNo\nNo\nYes\nYes\nYes\nNo\nNo\nNo\n\nThe first, second, fifth, sixth, and seventh participants pass the Qualification contests.\n\nSample Input 2\n\n12 5 2\ncabbabaacaba\n\nSample Output 2\n\nNo\nYes\nYes\nYes\nYes\nNo\nYes\nYes\nNo\nYes\nNo\nNo\n\nThe sixth participant is third among overseas students and thus does not pass the Qualification contests.\n\nSample Input 3\n\n5 2 2\nccccc\n\nSample Output 3\n\nNo\nNo\nNo\nNo\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 34, "cpu_time_ms": 578, "memory_kb": 95732}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s743129869", "group_id": "codeNet:p03986", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tx = chomp(readline())\n\tn = length(x)\n\tl = 1\n\tr = n\n\tfor i in 1:n\n\t\tif x[i] == 'S'\n\t\t\tl = i-1\n\t\t\tbreak\n\t\tend\n\tend\n\tfor i in 0:n-1\n\t\tif x[n-i] == 'T'\n\t\t\tr = i\n\t\t\tbreak\n\t\tend\n\tend\n\tprintln(2*max(l,r))\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1559170599, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03986.html", "problem_id": "p03986", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03986/input.txt", "sample_output_relpath": "derived/input_output/data/p03986/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03986/Julia/s743129869.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s743129869", "user_id": "u095714878"}, "prompt_components": {"gold_output": "4\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tx = chomp(readline())\n\tn = length(x)\n\tl = 1\n\tr = n\n\tfor i in 1:n\n\t\tif x[i] == 'S'\n\t\t\tl = i-1\n\t\t\tbreak\n\t\tend\n\tend\n\tfor i in 0:n-1\n\t\tif x[n-i] == 'T'\n\t\t\tr = i\n\t\t\tbreak\n\t\tend\n\tend\n\tprintln(2*max(l,r))\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "sample_input": "TSTTSS\n"}, "reference_outputs": ["4\n"], "source_document_id": "p03986", "source_text": "Score : 300 points\n\nProblem Statement\n\nWe have a string X, which has an even number of characters. Half the characters are S, and the other half are T.\n\nTakahashi, who hates the string ST, will perform the following operation 10^{10000} times:\n\nAmong the occurrences of ST in X as (contiguous) substrings, remove the leftmost one. If there is no occurrence, do nothing.\n\nFind the eventual length of X.\n\nConstraints\n\n2 ≦ |X| ≦ 200,000\n\nThe length of X is even.\n\nHalf the characters in X are S, and the other half are T.\n\nPartial Scores\n\nIn test cases worth 200 points, |X| ≦ 200.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nX\n\nOutput\n\nPrint the eventual length of X.\n\nSample Input 1\n\nTSTTSS\n\nSample Output 1\n\n4\n\nIn the 1-st operation, the 2-nd and 3-rd characters of TSTTSS are removed.\nX becomes TTSS, and since it does not contain ST anymore, nothing is done in the remaining 10^{10000}-1 operations.\nThus, the answer is 4.\n\nSample Input 2\n\nSSTTST\n\nSample Output 2\n\n0\n\nX will eventually become an empty string: SSTTST ⇒ STST ⇒ ST ⇒ ``.\n\nSample Input 3\n\nTSSTTTSS\n\nSample Output 3\n\n4\n\nX will become: TSSTTTSS ⇒ TSTTSS ⇒ TTSS.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 314, "cpu_time_ms": 850, "memory_kb": 167588}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s967950416", "group_id": "codeNet:p03992", "input_text": "function main()\n \n s = split(chomp(readline()),\"\")\n \n for i in 1:12\n \n if i == 4\n print(s[i],\" \")\n elseif i == 12\n println(s[i])\n else\n print(s[i])\n end\n \n end\n \nend\n\nmain()", "language": "Julia", "metadata": {"date": 1580956673, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s967950416.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s967950416", "user_id": "u790457721"}, "prompt_components": {"gold_output": "CODE FESTIVAL\n", "input_to_evaluate": "function main()\n \n s = split(chomp(readline()),\"\")\n \n for i in 1:12\n \n if i == 4\n print(s[i],\" \")\n elseif i == 12\n println(s[i])\n else\n print(s[i])\n end\n \n end\n \nend\n\nmain()", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 212, "cpu_time_ms": 344, "memory_kb": 109828}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s252862122", "group_id": "codeNet:p03994", "input_text": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ts = readline() |> chomp\n k = readline() |> parseInt\n l = length(s)\n z = Int[123-Int(s[i]) for i in 1:l]\n for i in 1:l\n if z[i] < 26 && k>=z[i]\n k -= z[i]\n z[i] = 26\n end\n end\n if k > 0\n z[l] = rem(z[l]-(k%26),26)\n if z[l] == 0\n z[l] = 26\n end\n end\n for i in 1:l\n print(Char(123-z[i]))\n end\n println(\"\")\nend\nmain()\n", "language": "Julia", "metadata": {"date": 1572631018, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s252862122.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s252862122", "user_id": "u095714878"}, "prompt_components": {"gold_output": "aya\n", "input_to_evaluate": "parseInt(x)=parse(Int,x)\nparseMap(x::Array{SubString{String},1})=map(parseInt,x)\n\nfunction main()\n\ts = readline() |> chomp\n k = readline() |> parseInt\n l = length(s)\n z = Int[123-Int(s[i]) for i in 1:l]\n for i in 1:l\n if z[i] < 26 && k>=z[i]\n k -= z[i]\n z[i] = 26\n end\n end\n if k > 0\n z[l] = rem(z[l]-(k%26),26)\n if z[l] == 0\n z[l] = 26\n end\n end\n for i in 1:l\n print(Char(123-z[i]))\n end\n println(\"\")\nend\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 518, "cpu_time_ms": 844, "memory_kb": 165708}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s194283236", "group_id": "codeNet:p03997", "input_text": "a = parse(readline())\nb = parse(readline())\nh = parse(readline())\nprint(div((a+b)*h,2))", "language": "Julia", "metadata": {"date": 1541517609, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s194283236.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s194283236", "user_id": "u095714878"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "a = parse(readline())\nb = parse(readline())\nh = parse(readline())\nprint(div((a+b)*h,2))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 87, "cpu_time_ms": 272, "memory_kb": 109856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s894092372", "group_id": "codeNet:p03997", "input_text": "a = parse(Int,readline())\nb = parse(Int,readline())\nh = parse(Int,readline())\nprintln(Int((a+b)*h/2))", "language": "Julia", "metadata": {"date": 1487924847, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s894092372.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s894092372", "user_id": "u317194934"}, "prompt_components": {"gold_output": "7\n", "input_to_evaluate": "a = parse(Int,readline())\nb = parse(Int,readline())\nh = parse(Int,readline())\nprintln(Int((a+b)*h/2))", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 303, "memory_kb": 111584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s753661964", "group_id": "codeNet:p03998", "input_text": "a=(x->[c for c=x]).(chomp.(readlines()))\nt=1\nwhile true\n if isempty(a[t])\n print('A'+t-1)\n break\n end\n t=Int(pop!(a[t]))-96\nend", "language": "Julia", "metadata": {"date": 1561733370, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03998.html", "problem_id": "p03998", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03998/input.txt", "sample_output_relpath": "derived/input_output/data/p03998/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03998/Julia/s753661964.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s753661964", "user_id": "u729133443"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "a=(x->[c for c=x]).(chomp.(readlines()))\nt=1\nwhile true\n if isempty(a[t])\n print('A'+t-1)\n break\n end\n t=Int(pop!(a[t]))-96\nend", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAlice, Bob and Charlie are playing Card Game for Three, as below:\n\nAt first, each of the three players has a deck consisting of some number of cards. Each card has a letter a, b or c written on it. The orders of the cards in the decks cannot be rearranged.\n\nThe players take turns. Alice goes first.\n\nIf the current player's deck contains at least one card, discard the top card in the deck. Then, the player whose name begins with the letter on the discarded card, takes the next turn. (For example, if the card says a, Alice takes the next turn.)\n\nIf the current player's deck is empty, the game ends and the current player wins the game.\n\nYou are given the initial decks of the players.\nMore specifically, you are given three strings S_A, S_B and S_C. The i-th (1≦i≦|S_A|) letter in S_A is the letter on the i-th card in Alice's initial deck. S_B and S_C describes Bob's and Charlie's initial decks in the same way.\n\nDetermine the winner of the game.\n\nConstraints\n\n1≦|S_A|≦100\n\n1≦|S_B|≦100\n\n1≦|S_C|≦100\n\nEach letter in S_A, S_B, S_C is a, b or c.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS_A\nS_B\nS_C\n\nOutput\n\nIf Alice will win, print A. If Bob will win, print B. If Charlie will win, print C.\n\nSample Input 1\n\naca\naccc\nca\n\nSample Output 1\n\nA\n\nThe game will progress as below:\n\nAlice discards the top card in her deck, a. Alice takes the next turn.\n\nAlice discards the top card in her deck, c. Charlie takes the next turn.\n\nCharlie discards the top card in his deck, c. Charlie takes the next turn.\n\nCharlie discards the top card in his deck, a. Alice takes the next turn.\n\nAlice discards the top card in her deck, a. Alice takes the next turn.\n\nAlice's deck is empty. The game ends and Alice wins the game.\n\nSample Input 2\n\nabcb\naacb\nbccc\n\nSample Output 2\n\nC", "sample_input": "aca\naccc\nca\n"}, "reference_outputs": ["A\n"], "source_document_id": "p03998", "source_text": "Score : 200 points\n\nProblem Statement\n\nAlice, Bob and Charlie are playing Card Game for Three, as below:\n\nAt first, each of the three players has a deck consisting of some number of cards. Each card has a letter a, b or c written on it. The orders of the cards in the decks cannot be rearranged.\n\nThe players take turns. Alice goes first.\n\nIf the current player's deck contains at least one card, discard the top card in the deck. Then, the player whose name begins with the letter on the discarded card, takes the next turn. (For example, if the card says a, Alice takes the next turn.)\n\nIf the current player's deck is empty, the game ends and the current player wins the game.\n\nYou are given the initial decks of the players.\nMore specifically, you are given three strings S_A, S_B and S_C. The i-th (1≦i≦|S_A|) letter in S_A is the letter on the i-th card in Alice's initial deck. S_B and S_C describes Bob's and Charlie's initial decks in the same way.\n\nDetermine the winner of the game.\n\nConstraints\n\n1≦|S_A|≦100\n\n1≦|S_B|≦100\n\n1≦|S_C|≦100\n\nEach letter in S_A, S_B, S_C is a, b or c.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS_A\nS_B\nS_C\n\nOutput\n\nIf Alice will win, print A. If Bob will win, print B. If Charlie will win, print C.\n\nSample Input 1\n\naca\naccc\nca\n\nSample Output 1\n\nA\n\nThe game will progress as below:\n\nAlice discards the top card in her deck, a. Alice takes the next turn.\n\nAlice discards the top card in her deck, c. Charlie takes the next turn.\n\nCharlie discards the top card in his deck, c. Charlie takes the next turn.\n\nCharlie discards the top card in his deck, a. Alice takes the next turn.\n\nAlice discards the top card in her deck, a. Alice takes the next turn.\n\nAlice's deck is empty. The game ends and Alice wins the game.\n\nSample Input 2\n\nabcb\naacb\nbccc\n\nSample Output 2\n\nC", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 458, "memory_kb": 117744}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s163427934", "group_id": "codeNet:p03998", "input_text": "function battle(x)\n\tif x == 'a'\n\t\t1\n\telseif x == 'b'\n\t\t2\n\telseif x == 'c'\n\t\t3\n\tend\nend\n\nfunction main()\n\tsa = chomp(readline())\n\tsb = chomp(readline())\n\tsc = chomp(readline())\n\tna = 1\n\tnb = 1\n\tnc = 1\n\tturn = 1\n\twhile na <= length(sa)+1 && nb <= length(sb)+1 && nc <= length(sc)+1\n\t\tif turn == 1\n \t\tif na > length(sa)\n \t\t\tprintln(\"A\")\n \t\tbreak\n \t\telse\n\t\t\t\tturn = battle(sa[na])\n\t\t\t\tna += 1\n\t\t\tend\n\t\telseif turn == 2\n \t\tif nb > length(sb)\n \t\t\tprintln(\"B\")\n \t\tbreak\n \t\telse\n \t\t\t turn = battle(sb[nb])\n\t\t\t\tnb += 1\n\t\t\tend\n\t\telseif turn == 3\n \t\tif nc > length(sc)\n \t\t\tprintln(\"C\")\n \t\tbreak\n \t\telse\n\t\t turn = battle(sc[nc])\n\t\t\t\tnc += 1\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1543334165, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03998.html", "problem_id": "p03998", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03998/input.txt", "sample_output_relpath": "derived/input_output/data/p03998/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03998/Julia/s163427934.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s163427934", "user_id": "u095714878"}, "prompt_components": {"gold_output": "A\n", "input_to_evaluate": "function battle(x)\n\tif x == 'a'\n\t\t1\n\telseif x == 'b'\n\t\t2\n\telseif x == 'c'\n\t\t3\n\tend\nend\n\nfunction main()\n\tsa = chomp(readline())\n\tsb = chomp(readline())\n\tsc = chomp(readline())\n\tna = 1\n\tnb = 1\n\tnc = 1\n\tturn = 1\n\twhile na <= length(sa)+1 && nb <= length(sb)+1 && nc <= length(sc)+1\n\t\tif turn == 1\n \t\tif na > length(sa)\n \t\t\tprintln(\"A\")\n \t\tbreak\n \t\telse\n\t\t\t\tturn = battle(sa[na])\n\t\t\t\tna += 1\n\t\t\tend\n\t\telseif turn == 2\n \t\tif nb > length(sb)\n \t\t\tprintln(\"B\")\n \t\tbreak\n \t\telse\n \t\t\t turn = battle(sb[nb])\n\t\t\t\tnb += 1\n\t\t\tend\n\t\telseif turn == 3\n \t\tif nc > length(sc)\n \t\t\tprintln(\"C\")\n \t\tbreak\n \t\telse\n\t\t turn = battle(sc[nc])\n\t\t\t\tnc += 1\n\t\t\tend\n\t\tend\n\tend\nend\n\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nAlice, Bob and Charlie are playing Card Game for Three, as below:\n\nAt first, each of the three players has a deck consisting of some number of cards. Each card has a letter a, b or c written on it. The orders of the cards in the decks cannot be rearranged.\n\nThe players take turns. Alice goes first.\n\nIf the current player's deck contains at least one card, discard the top card in the deck. Then, the player whose name begins with the letter on the discarded card, takes the next turn. (For example, if the card says a, Alice takes the next turn.)\n\nIf the current player's deck is empty, the game ends and the current player wins the game.\n\nYou are given the initial decks of the players.\nMore specifically, you are given three strings S_A, S_B and S_C. The i-th (1≦i≦|S_A|) letter in S_A is the letter on the i-th card in Alice's initial deck. S_B and S_C describes Bob's and Charlie's initial decks in the same way.\n\nDetermine the winner of the game.\n\nConstraints\n\n1≦|S_A|≦100\n\n1≦|S_B|≦100\n\n1≦|S_C|≦100\n\nEach letter in S_A, S_B, S_C is a, b or c.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS_A\nS_B\nS_C\n\nOutput\n\nIf Alice will win, print A. If Bob will win, print B. If Charlie will win, print C.\n\nSample Input 1\n\naca\naccc\nca\n\nSample Output 1\n\nA\n\nThe game will progress as below:\n\nAlice discards the top card in her deck, a. Alice takes the next turn.\n\nAlice discards the top card in her deck, c. Charlie takes the next turn.\n\nCharlie discards the top card in his deck, c. Charlie takes the next turn.\n\nCharlie discards the top card in his deck, a. Alice takes the next turn.\n\nAlice discards the top card in her deck, a. Alice takes the next turn.\n\nAlice's deck is empty. The game ends and Alice wins the game.\n\nSample Input 2\n\nabcb\naacb\nbccc\n\nSample Output 2\n\nC", "sample_input": "aca\naccc\nca\n"}, "reference_outputs": ["A\n"], "source_document_id": "p03998", "source_text": "Score : 200 points\n\nProblem Statement\n\nAlice, Bob and Charlie are playing Card Game for Three, as below:\n\nAt first, each of the three players has a deck consisting of some number of cards. Each card has a letter a, b or c written on it. The orders of the cards in the decks cannot be rearranged.\n\nThe players take turns. Alice goes first.\n\nIf the current player's deck contains at least one card, discard the top card in the deck. Then, the player whose name begins with the letter on the discarded card, takes the next turn. (For example, if the card says a, Alice takes the next turn.)\n\nIf the current player's deck is empty, the game ends and the current player wins the game.\n\nYou are given the initial decks of the players.\nMore specifically, you are given three strings S_A, S_B and S_C. The i-th (1≦i≦|S_A|) letter in S_A is the letter on the i-th card in Alice's initial deck. S_B and S_C describes Bob's and Charlie's initial decks in the same way.\n\nDetermine the winner of the game.\n\nConstraints\n\n1≦|S_A|≦100\n\n1≦|S_B|≦100\n\n1≦|S_C|≦100\n\nEach letter in S_A, S_B, S_C is a, b or c.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS_A\nS_B\nS_C\n\nOutput\n\nIf Alice will win, print A. If Bob will win, print B. If Charlie will win, print C.\n\nSample Input 1\n\naca\naccc\nca\n\nSample Output 1\n\nA\n\nThe game will progress as below:\n\nAlice discards the top card in her deck, a. Alice takes the next turn.\n\nAlice discards the top card in her deck, c. Charlie takes the next turn.\n\nCharlie discards the top card in his deck, c. Charlie takes the next turn.\n\nCharlie discards the top card in his deck, a. Alice takes the next turn.\n\nAlice discards the top card in her deck, a. Alice takes the next turn.\n\nAlice's deck is empty. The game ends and Alice wins the game.\n\nSample Input 2\n\nabcb\naacb\nbccc\n\nSample Output 2\n\nC", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 735, "cpu_time_ms": 351, "memory_kb": 110728}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s425793512", "group_id": "codeNet:p03999", "input_text": "MyString=Union{String,SubString{String},Char}\nMyStringArray=Union{Array{String,1},Array{SubString{String},1},Array{Char,1}}\nparseInt(x::MyString) = parse(Int, x)\nparseInt(x::Real) = trunc(Int, x)\nparseBigInt(x::MyString) = parse(BigInt, x)\nparseBigInt(x::Real) = trunc(BigInt, x)\nparseFloat(x::MyString) = parse(Float64, x)\nparseFloat(x::Real) = trunc(Float64, x)\nparseBigFloat(x::MyString) = parse(BigFloat, x)\nparseBigFloat(x::Real) = trunc(BigFloat, x)\nparseMap(x::MyStringArray) = map(parseInt, x)\nparseMapBig(x::MyStringArray) = map(parseBigInt, x)\n\nans=0\nfunction dfs(s,n,arr::Vector{String},cnt)\n if cnt==n+1\n global ans+=sum(parseMap(arr))\n return\n end\n num=string(s[cnt])\n if cnt==1\n push!(arr,num)\n dfs(s,n,arr,cnt+1)\n else\n arr1,arr2=copy(arr),copy(arr)\n push!(arr1,num)\n dfs(s,n,arr1,cnt+1)\n arr2[end]=join([arr2[end],num])\n dfs(s,n,arr2,cnt+1)\n end\nend\nfunction main()\n s=chomp(readline())\n n=length(s)\n dfs(s,n,Vector{String}(),1)\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1584908946, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p03999.html", "problem_id": "p03999", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p03999/input.txt", "sample_output_relpath": "derived/input_output/data/p03999/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p03999/Julia/s425793512.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s425793512", "user_id": "u619197965"}, "prompt_components": {"gold_output": "176\n", "input_to_evaluate": "MyString=Union{String,SubString{String},Char}\nMyStringArray=Union{Array{String,1},Array{SubString{String},1},Array{Char,1}}\nparseInt(x::MyString) = parse(Int, x)\nparseInt(x::Real) = trunc(Int, x)\nparseBigInt(x::MyString) = parse(BigInt, x)\nparseBigInt(x::Real) = trunc(BigInt, x)\nparseFloat(x::MyString) = parse(Float64, x)\nparseFloat(x::Real) = trunc(Float64, x)\nparseBigFloat(x::MyString) = parse(BigFloat, x)\nparseBigFloat(x::Real) = trunc(BigFloat, x)\nparseMap(x::MyStringArray) = map(parseInt, x)\nparseMapBig(x::MyStringArray) = map(parseBigInt, x)\n\nans=0\nfunction dfs(s,n,arr::Vector{String},cnt)\n if cnt==n+1\n global ans+=sum(parseMap(arr))\n return\n end\n num=string(s[cnt])\n if cnt==1\n push!(arr,num)\n dfs(s,n,arr,cnt+1)\n else\n arr1,arr2=copy(arr),copy(arr)\n push!(arr1,num)\n dfs(s,n,arr1,cnt+1)\n arr2[end]=join([arr2[end],num])\n dfs(s,n,arr2,cnt+1)\n end\nend\nfunction main()\n s=chomp(readline())\n n=length(s)\n dfs(s,n,Vector{String}(),1)\n println(ans)\nend\nmain()", "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": "p03999", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1062, "cpu_time_ms": 470, "memory_kb": 118668}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s481893140", "group_id": "codeNet:p04001", "input_text": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n s = readline()\n\n n = length(s)\n ans = 0\n for b in 0:1<<(n - 1) - 1\n sx = String[]\n i = 1\n for j in 1:n - 1\n if b & 1<<(j - 1) != 0\n push!(sx, s[i:j])\n i = j + 1\n end\n end\n push!(sx, s[i:end])\n # println(sx)\n ans += map(parseInt, sx) |> sum\n end\n println(ans)\nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1594872660, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "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/Julia/s481893140.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s481893140", "user_id": "u630185395"}, "prompt_components": {"gold_output": "176\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseArray(x::Array{SubString{String}, 1}) = map(parseInt, x)\n\nfunction main()\n s = readline()\n\n n = length(s)\n ans = 0\n for b in 0:1<<(n - 1) - 1\n sx = String[]\n i = 1\n for j in 1:n - 1\n if b & 1<<(j - 1) != 0\n push!(sx, s[i:j])\n i = j + 1\n end\n end\n push!(sx, s[i:end])\n # println(sx)\n ans += map(parseInt, sx) |> sum\n end\n println(ans)\nend\n\nmain()\n", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 430, "cpu_time_ms": 259, "memory_kb": 168448}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s544404628", "group_id": "codeNet:p04006", "input_text": "function main()\nN,x=map(x->parse(Int,x),split(readline()))\nans=10^18\nA=map(x->parse(Int,x),split(readline()))\nfor j=0:N\n now=j*x\n p=A[1]\n for i=1:N\n now+=A[i]\n if iA[i+1]\n A[i]=A[i+1]\n end\n end\n ans=min(ans,now)\n A[N]=min(A[N],p)\nend\nprintln(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1579576970, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04006.html", "problem_id": "p04006", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04006/input.txt", "sample_output_relpath": "derived/input_output/data/p04006/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04006/Julia/s544404628.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s544404628", "user_id": "u657913472"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "function main()\nN,x=map(x->parse(Int,x),split(readline()))\nans=10^18\nA=map(x->parse(Int,x),split(readline()))\nfor j=0:N\n now=j*x\n p=A[1]\n for i=1:N\n now+=A[i]\n if iA[i+1]\n A[i]=A[i+1]\n end\n end\n ans=min(ans,now)\n A[N]=min(A[N],p)\nend\nprintln(ans)\nend\nmain()", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke lives in another world, where slimes are real creatures and kept by some people.\nSlimes come in N colors. Those colors are conveniently numbered 1 through N.\nSnuke currently has no slime. His objective is to have slimes of all the colors together.\n\nSnuke can perform the following two actions:\n\nSelect a color i (1≤i≤N), such that he does not currently have a slime in color i, and catch a slime in color i. This action takes him a_i seconds.\n\nCast a spell, which changes the color of all the slimes that he currently has. The color of a slime in color i (1≤i≤N-1) will become color i+1, and the color of a slime in color N will become color 1. This action takes him x seconds.\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nConstraints\n\n2≤N≤2,000\n\na_i are integers.\n\n1≤a_i≤10^9\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\nN x\na_1 a_2 ... a_N\n\nOutput\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nSample Input 1\n\n2 10\n1 100\n\nSample Output 1\n\n12\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCast the spell. The color of the slime changes: 1 → 2. This takes 10 seconds.\n\nCatch a slime in color 1. This takes 1 second.\n\nSample Input 2\n\n3 10\n100 1 100\n\nSample Output 2\n\n23\n\nSnuke can act as follows:\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the spell. The color of the slime changes: 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the soell. The color of each slime changes: 3 → 1, 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nSample Input 3\n\n4 10\n1 2 3 4\n\nSample Output 3\n\n10\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCatch a slime in color 2. This takes 2 seconds.\n\nCatch a slime in color 3. This takes 3 seconds.\n\nCatch a slime in color 4. This takes 4 seconds.", "sample_input": "2 10\n1 100\n"}, "reference_outputs": ["12\n"], "source_document_id": "p04006", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke lives in another world, where slimes are real creatures and kept by some people.\nSlimes come in N colors. Those colors are conveniently numbered 1 through N.\nSnuke currently has no slime. His objective is to have slimes of all the colors together.\n\nSnuke can perform the following two actions:\n\nSelect a color i (1≤i≤N), such that he does not currently have a slime in color i, and catch a slime in color i. This action takes him a_i seconds.\n\nCast a spell, which changes the color of all the slimes that he currently has. The color of a slime in color i (1≤i≤N-1) will become color i+1, and the color of a slime in color N will become color 1. This action takes him x seconds.\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nConstraints\n\n2≤N≤2,000\n\na_i are integers.\n\n1≤a_i≤10^9\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\nN x\na_1 a_2 ... a_N\n\nOutput\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nSample Input 1\n\n2 10\n1 100\n\nSample Output 1\n\n12\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCast the spell. The color of the slime changes: 1 → 2. This takes 10 seconds.\n\nCatch a slime in color 1. This takes 1 second.\n\nSample Input 2\n\n3 10\n100 1 100\n\nSample Output 2\n\n23\n\nSnuke can act as follows:\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the spell. The color of the slime changes: 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the soell. The color of each slime changes: 3 → 1, 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nSample Input 3\n\n4 10\n1 2 3 4\n\nSample Output 3\n\n10\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCatch a slime in color 2. This takes 2 seconds.\n\nCatch a slime in color 3. This takes 3 seconds.\n\nCatch a slime in color 4. This takes 4 seconds.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1968, "memory_kb": 155292}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s751311680", "group_id": "codeNet:p04006", "input_text": "N,x=map(x->parse(Int,x),split(readline()))\nans=10^18\nA=map(x->parse(Int,x),split(readline()))\nfor j=0:N\n now=j*x\n p=A[1]\n for i=1:N\n now+=A[i]\n if iA[i+1]\n A[i]=A[i+1]\n end\n end\n ans=min(ans,now)\n A[N]=min(A[N],p)\nend\nprintln(ans)", "language": "Julia", "metadata": {"date": 1579576858, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04006.html", "problem_id": "p04006", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04006/input.txt", "sample_output_relpath": "derived/input_output/data/p04006/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04006/Julia/s751311680.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Time Limit Exceeded", "submission_id": "s751311680", "user_id": "u657913472"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "N,x=map(x->parse(Int,x),split(readline()))\nans=10^18\nA=map(x->parse(Int,x),split(readline()))\nfor j=0:N\n now=j*x\n p=A[1]\n for i=1:N\n now+=A[i]\n if iA[i+1]\n A[i]=A[i+1]\n end\n end\n ans=min(ans,now)\n A[N]=min(A[N],p)\nend\nprintln(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke lives in another world, where slimes are real creatures and kept by some people.\nSlimes come in N colors. Those colors are conveniently numbered 1 through N.\nSnuke currently has no slime. His objective is to have slimes of all the colors together.\n\nSnuke can perform the following two actions:\n\nSelect a color i (1≤i≤N), such that he does not currently have a slime in color i, and catch a slime in color i. This action takes him a_i seconds.\n\nCast a spell, which changes the color of all the slimes that he currently has. The color of a slime in color i (1≤i≤N-1) will become color i+1, and the color of a slime in color N will become color 1. This action takes him x seconds.\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nConstraints\n\n2≤N≤2,000\n\na_i are integers.\n\n1≤a_i≤10^9\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\nN x\na_1 a_2 ... a_N\n\nOutput\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nSample Input 1\n\n2 10\n1 100\n\nSample Output 1\n\n12\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCast the spell. The color of the slime changes: 1 → 2. This takes 10 seconds.\n\nCatch a slime in color 1. This takes 1 second.\n\nSample Input 2\n\n3 10\n100 1 100\n\nSample Output 2\n\n23\n\nSnuke can act as follows:\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the spell. The color of the slime changes: 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the soell. The color of each slime changes: 3 → 1, 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nSample Input 3\n\n4 10\n1 2 3 4\n\nSample Output 3\n\n10\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCatch a slime in color 2. This takes 2 seconds.\n\nCatch a slime in color 3. This takes 3 seconds.\n\nCatch a slime in color 4. This takes 4 seconds.", "sample_input": "2 10\n1 100\n"}, "reference_outputs": ["12\n"], "source_document_id": "p04006", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke lives in another world, where slimes are real creatures and kept by some people.\nSlimes come in N colors. Those colors are conveniently numbered 1 through N.\nSnuke currently has no slime. His objective is to have slimes of all the colors together.\n\nSnuke can perform the following two actions:\n\nSelect a color i (1≤i≤N), such that he does not currently have a slime in color i, and catch a slime in color i. This action takes him a_i seconds.\n\nCast a spell, which changes the color of all the slimes that he currently has. The color of a slime in color i (1≤i≤N-1) will become color i+1, and the color of a slime in color N will become color 1. This action takes him x seconds.\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nConstraints\n\n2≤N≤2,000\n\na_i are integers.\n\n1≤a_i≤10^9\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\nN x\na_1 a_2 ... a_N\n\nOutput\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nSample Input 1\n\n2 10\n1 100\n\nSample Output 1\n\n12\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCast the spell. The color of the slime changes: 1 → 2. This takes 10 seconds.\n\nCatch a slime in color 1. This takes 1 second.\n\nSample Input 2\n\n3 10\n100 1 100\n\nSample Output 2\n\n23\n\nSnuke can act as follows:\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the spell. The color of the slime changes: 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the soell. The color of each slime changes: 3 → 1, 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nSample Input 3\n\n4 10\n1 2 3 4\n\nSample Output 3\n\n10\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCatch a slime in color 2. This takes 2 seconds.\n\nCatch a slime in color 3. This takes 3 seconds.\n\nCatch a slime in color 4. This takes 4 seconds.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 2022, "memory_kb": 155128}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s435363584", "group_id": "codeNet:p04006", "input_text": "n::Int, x::Int = map(x -> parse(Int, x), split(readline()))\n\ta::Vector{Int} = map(x -> parse(Int, x), split(readline()))\n\tb::Vector{Int} = copy(a)\n\n\tans = 10^15\n\tfor i in 1:n\n\t\tsm = 0\n\t\tfor j in 1:n\n\t\t\tsm += b[j]\n\t\tend\n\t\tans = min(ans, sm + x*(i-1))\n\t\tfor j in 1:n\n\t\t\tb[j] = min(b[j], a[mod1(j-i, n)])\n\t\tend\n\tend\n\n\tprintln(ans)", "language": "Julia", "metadata": {"date": 1473241799, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04006.html", "problem_id": "p04006", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04006/input.txt", "sample_output_relpath": "derived/input_output/data/p04006/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04006/Julia/s435363584.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s435363584", "user_id": "u965174248"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "n::Int, x::Int = map(x -> parse(Int, x), split(readline()))\n\ta::Vector{Int} = map(x -> parse(Int, x), split(readline()))\n\tb::Vector{Int} = copy(a)\n\n\tans = 10^15\n\tfor i in 1:n\n\t\tsm = 0\n\t\tfor j in 1:n\n\t\t\tsm += b[j]\n\t\tend\n\t\tans = min(ans, sm + x*(i-1))\n\t\tfor j in 1:n\n\t\t\tb[j] = min(b[j], a[mod1(j-i, n)])\n\t\tend\n\tend\n\n\tprintln(ans)", "problem_context": "Score : 400 points\n\nProblem Statement\n\nSnuke lives in another world, where slimes are real creatures and kept by some people.\nSlimes come in N colors. Those colors are conveniently numbered 1 through N.\nSnuke currently has no slime. His objective is to have slimes of all the colors together.\n\nSnuke can perform the following two actions:\n\nSelect a color i (1≤i≤N), such that he does not currently have a slime in color i, and catch a slime in color i. This action takes him a_i seconds.\n\nCast a spell, which changes the color of all the slimes that he currently has. The color of a slime in color i (1≤i≤N-1) will become color i+1, and the color of a slime in color N will become color 1. This action takes him x seconds.\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nConstraints\n\n2≤N≤2,000\n\na_i are integers.\n\n1≤a_i≤10^9\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\nN x\na_1 a_2 ... a_N\n\nOutput\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nSample Input 1\n\n2 10\n1 100\n\nSample Output 1\n\n12\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCast the spell. The color of the slime changes: 1 → 2. This takes 10 seconds.\n\nCatch a slime in color 1. This takes 1 second.\n\nSample Input 2\n\n3 10\n100 1 100\n\nSample Output 2\n\n23\n\nSnuke can act as follows:\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the spell. The color of the slime changes: 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the soell. The color of each slime changes: 3 → 1, 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nSample Input 3\n\n4 10\n1 2 3 4\n\nSample Output 3\n\n10\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCatch a slime in color 2. This takes 2 seconds.\n\nCatch a slime in color 3. This takes 3 seconds.\n\nCatch a slime in color 4. This takes 4 seconds.", "sample_input": "2 10\n1 100\n"}, "reference_outputs": ["12\n"], "source_document_id": "p04006", "source_text": "Score : 400 points\n\nProblem Statement\n\nSnuke lives in another world, where slimes are real creatures and kept by some people.\nSlimes come in N colors. Those colors are conveniently numbered 1 through N.\nSnuke currently has no slime. His objective is to have slimes of all the colors together.\n\nSnuke can perform the following two actions:\n\nSelect a color i (1≤i≤N), such that he does not currently have a slime in color i, and catch a slime in color i. This action takes him a_i seconds.\n\nCast a spell, which changes the color of all the slimes that he currently has. The color of a slime in color i (1≤i≤N-1) will become color i+1, and the color of a slime in color N will become color 1. This action takes him x seconds.\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nConstraints\n\n2≤N≤2,000\n\na_i are integers.\n\n1≤a_i≤10^9\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\nN x\na_1 a_2 ... a_N\n\nOutput\n\nFind the minimum time that Snuke needs to have slimes in all N colors.\n\nSample Input 1\n\n2 10\n1 100\n\nSample Output 1\n\n12\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCast the spell. The color of the slime changes: 1 → 2. This takes 10 seconds.\n\nCatch a slime in color 1. This takes 1 second.\n\nSample Input 2\n\n3 10\n100 1 100\n\nSample Output 2\n\n23\n\nSnuke can act as follows:\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the spell. The color of the slime changes: 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nCast the soell. The color of each slime changes: 3 → 1, 2 → 3. This takes 10 seconds.\n\nCatch a slime in color 2. This takes 1 second.\n\nSample Input 3\n\n4 10\n1 2 3 4\n\nSample Output 3\n\n10\n\nSnuke can act as follows:\n\nCatch a slime in color 1. This takes 1 second.\n\nCatch a slime in color 2. This takes 2 seconds.\n\nCatch a slime in color 3. This takes 3 seconds.\n\nCatch a slime in color 4. This takes 4 seconds.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 1070, "memory_kb": 106084}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s018591632", "group_id": "codeNet:p04011", "input_text": "p(x)=parse(Int,x)\nfunction main()\n n = p(readline())\n k = p(readline())\n x = p(readline())\n y = p(readline())\n if n<=k\n print(n*x)\n else\n print(n*x + (n-k)*y)\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1564775549, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04011.html", "problem_id": "p04011", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04011/input.txt", "sample_output_relpath": "derived/input_output/data/p04011/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04011/Julia/s018591632.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s018591632", "user_id": "u539005641"}, "prompt_components": {"gold_output": "48000\n", "input_to_evaluate": "p(x)=parse(Int,x)\nfunction main()\n n = p(readline())\n k = p(readline())\n x = p(readline())\n y = p(readline())\n if n<=k\n print(n*x)\n else\n print(n*x + (n-k)*y)\n end\nend\nmain()", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a hotel with the following accommodation fee:\n\nX yen (the currency of Japan) per night, for the first K nights\n\nY yen per night, for the (K+1)-th and subsequent nights\n\nTak is staying at this hotel for N consecutive nights.\nFind his total accommodation fee.\n\nConstraints\n\n1 \\leq N, K \\leq 10000\n\n1 \\leq Y < X \\leq 10000\n\nN,\\,K,\\,X,\\,Y are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nK\nX\nY\n\nOutput\n\nPrint Tak's total accommodation fee.\n\nSample Input 1\n\n5\n3\n10000\n9000\n\nSample Output 1\n\n48000\n\nThe accommodation fee is as follows:\n\n10000 yen for the 1-st night\n\n10000 yen for the 2-nd night\n\n10000 yen for the 3-rd night\n\n9000 yen for the 4-th night\n\n9000 yen for the 5-th night\n\nThus, the total is 48000 yen.\n\nSample Input 2\n\n2\n3\n10000\n9000\n\nSample Output 2\n\n20000", "sample_input": "5\n3\n10000\n9000\n"}, "reference_outputs": ["48000\n"], "source_document_id": "p04011", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a hotel with the following accommodation fee:\n\nX yen (the currency of Japan) per night, for the first K nights\n\nY yen per night, for the (K+1)-th and subsequent nights\n\nTak is staying at this hotel for N consecutive nights.\nFind his total accommodation fee.\n\nConstraints\n\n1 \\leq N, K \\leq 10000\n\n1 \\leq Y < X \\leq 10000\n\nN,\\,K,\\,X,\\,Y are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nK\nX\nY\n\nOutput\n\nPrint Tak's total accommodation fee.\n\nSample Input 1\n\n5\n3\n10000\n9000\n\nSample Output 1\n\n48000\n\nThe accommodation fee is as follows:\n\n10000 yen for the 1-st night\n\n10000 yen for the 2-nd night\n\n10000 yen for the 3-rd night\n\n9000 yen for the 4-th night\n\n9000 yen for the 5-th night\n\nThus, the total is 48000 yen.\n\nSample Input 2\n\n2\n3\n10000\n9000\n\nSample Output 2\n\n20000", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 281, "memory_kb": 107856}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s106442629", "group_id": "codeNet:p04011", "input_text": "n=parse(readline())\nk=parse(readline())\nx=parse(readline())\ny=parse(readline())\nprint(min(n,k)*x+max(n-k,0)*y)", "language": "Julia", "metadata": {"date": 1545342420, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04011.html", "problem_id": "p04011", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04011/input.txt", "sample_output_relpath": "derived/input_output/data/p04011/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04011/Julia/s106442629.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s106442629", "user_id": "u095714878"}, "prompt_components": {"gold_output": "48000\n", "input_to_evaluate": "n=parse(readline())\nk=parse(readline())\nx=parse(readline())\ny=parse(readline())\nprint(min(n,k)*x+max(n-k,0)*y)", "problem_context": "Score : 100 points\n\nProblem Statement\n\nThere is a hotel with the following accommodation fee:\n\nX yen (the currency of Japan) per night, for the first K nights\n\nY yen per night, for the (K+1)-th and subsequent nights\n\nTak is staying at this hotel for N consecutive nights.\nFind his total accommodation fee.\n\nConstraints\n\n1 \\leq N, K \\leq 10000\n\n1 \\leq Y < X \\leq 10000\n\nN,\\,K,\\,X,\\,Y are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nK\nX\nY\n\nOutput\n\nPrint Tak's total accommodation fee.\n\nSample Input 1\n\n5\n3\n10000\n9000\n\nSample Output 1\n\n48000\n\nThe accommodation fee is as follows:\n\n10000 yen for the 1-st night\n\n10000 yen for the 2-nd night\n\n10000 yen for the 3-rd night\n\n9000 yen for the 4-th night\n\n9000 yen for the 5-th night\n\nThus, the total is 48000 yen.\n\nSample Input 2\n\n2\n3\n10000\n9000\n\nSample Output 2\n\n20000", "sample_input": "5\n3\n10000\n9000\n"}, "reference_outputs": ["48000\n"], "source_document_id": "p04011", "source_text": "Score : 100 points\n\nProblem Statement\n\nThere is a hotel with the following accommodation fee:\n\nX yen (the currency of Japan) per night, for the first K nights\n\nY yen per night, for the (K+1)-th and subsequent nights\n\nTak is staying at this hotel for N consecutive nights.\nFind his total accommodation fee.\n\nConstraints\n\n1 \\leq N, K \\leq 10000\n\n1 \\leq Y < X \\leq 10000\n\nN,\\,K,\\,X,\\,Y are integers.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nK\nX\nY\n\nOutput\n\nPrint Tak's total accommodation fee.\n\nSample Input 1\n\n5\n3\n10000\n9000\n\nSample Output 1\n\n48000\n\nThe accommodation fee is as follows:\n\n10000 yen for the 1-st night\n\n10000 yen for the 2-nd night\n\n10000 yen for the 3-rd night\n\n9000 yen for the 4-th night\n\n9000 yen for the 5-th night\n\nThus, the total is 48000 yen.\n\nSample Input 2\n\n2\n3\n10000\n9000\n\nSample Output 2\n\n20000", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 110, "cpu_time_ms": 783, "memory_kb": 162816}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s313009199", "group_id": "codeNet:p04012", "input_text": "w = chomp(readline())\ndict = Dict()\nfor i in 1:length(w)\n key = string(w[i])\n dict[key] = get(dict,key,0) + 1\nend\n\nmod_list = []\nfor key in keys(dict)\n mod_list = push!(mod_list,mod(dict[key],2))\nend\nsorted = sort(mod_list,rev=true)\n\nif sorted[1] == 0\n println(\"Yes\")\nelse\n println(\"No\")\nend", "language": "Julia", "metadata": {"date": 1488009655, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s313009199.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s313009199", "user_id": "u317194934"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "w = chomp(readline())\ndict = Dict()\nfor i in 1:length(w)\n key = string(w[i])\n dict[key] = get(dict,key,0) + 1\nend\n\nmod_list = []\nfor key in keys(dict)\n mod_list = push!(mod_list,mod(dict[key],2))\nend\nsorted = sort(mod_list,rev=true)\n\nif sorted[1] == 0\n println(\"Yes\")\nelse\n println(\"No\")\nend", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 306, "cpu_time_ms": 352, "memory_kb": 110540}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s968577116", "group_id": "codeNet:p04013", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,a = readline() |> split |> parseMap\n\tx = readline() |> split |> parseMap\n\ts = sum(x)\n\tdp = zeros(Int,n+1,s+1)\n\tdp[1,1] = 1\n\tfor i in 1:n\n\t\tfor j in 0:n-1\n\t\t\tfor k in 0:s\n\t\t\t\tif k+x[i] split |> parseMap\n\tx = readline() |> split |> parseMap\n\ts = sum(x)\n\tdp = zeros(Int,n+1,s+1)\n\tdp[1,1] = 1\n\tfor i in 1:n\n\t\tfor j in 0:n-1\n\t\t\tfor k in 0:s\n\t\t\t\tif k+x[i]parse(Int,x),split(readline()))\ndp=zeros(Int,6666)\ndp[3000]=1\nfor x=map(x->parse(Int,x),split(readline()))\n\tdp=f(x-A,dp)\nend\nprintln(dp[3000]-1)\n", "language": "Julia", "metadata": {"date": 1561693508, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04013.html", "problem_id": "p04013", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04013/input.txt", "sample_output_relpath": "derived/input_output/data/p04013/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04013/Julia/s322834943.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s322834943", "user_id": "u657913472"}, "prompt_components": {"gold_output": "5\n", "input_to_evaluate": "function f(x,dp)\n\tnext=dp[:]\n\tfor i=-2500:2500\n\t\tnext[3000+i+x]+=dp[3000+i]\n\tend\n\tnext\nend\nN,A=map(x->parse(Int,x),split(readline()))\ndp=zeros(Int,6666)\ndp[3000]=1\nfor x=map(x->parse(Int,x),split(readline()))\n\tdp=f(x-A,dp)\nend\nprintln(dp[3000]-1)\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nTak has N cards. On the i-th (1 \\leq i \\leq N) card is written an integer x_i.\nHe is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A.\nIn how many ways can he make his selection?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq A \\leq 50\n\n1 \\leq x_i \\leq 50\n\nN,\\,A,\\,x_i are integers.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1 \\leq N \\leq 16.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN A\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the number of ways to select cards such that the average of the written integers is exactly A.\n\nSample Input 1\n\n4 8\n7 9 8 9\n\nSample Output 1\n\n5\n\nThe following are the 5 ways to select cards such that the average is 8:\n\nSelect the 3-rd card.\n\nSelect the 1-st and 2-nd cards.\n\nSelect the 1-st and 4-th cards.\n\nSelect the 1-st, 2-nd and 3-rd cards.\n\nSelect the 1-st, 3-rd and 4-th cards.\n\nSample Input 2\n\n3 8\n6 6 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n8 5\n3 6 2 8 7 6 5 9\n\nSample Output 3\n\n19\n\nSample Input 4\n\n33 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n\nSample Output 4\n\n8589934591\n\nThe answer may not fit into a 32-bit integer.", "sample_input": "4 8\n7 9 8 9\n"}, "reference_outputs": ["5\n"], "source_document_id": "p04013", "source_text": "Score : 300 points\n\nProblem Statement\n\nTak has N cards. On the i-th (1 \\leq i \\leq N) card is written an integer x_i.\nHe is selecting one or more cards from these N cards, so that the average of the integers written on the selected cards is exactly A.\nIn how many ways can he make his selection?\n\nConstraints\n\n1 \\leq N \\leq 50\n\n1 \\leq A \\leq 50\n\n1 \\leq x_i \\leq 50\n\nN,\\,A,\\,x_i are integers.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying 1 \\leq N \\leq 16.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN A\nx_1 x_2 ... x_N\n\nOutput\n\nPrint the number of ways to select cards such that the average of the written integers is exactly A.\n\nSample Input 1\n\n4 8\n7 9 8 9\n\nSample Output 1\n\n5\n\nThe following are the 5 ways to select cards such that the average is 8:\n\nSelect the 3-rd card.\n\nSelect the 1-st and 2-nd cards.\n\nSelect the 1-st and 4-th cards.\n\nSelect the 1-st, 2-nd and 3-rd cards.\n\nSelect the 1-st, 3-rd and 4-th cards.\n\nSample Input 2\n\n3 8\n6 6 9\n\nSample Output 2\n\n0\n\nSample Input 3\n\n8 5\n3 6 2 8 7 6 5 9\n\nSample Output 3\n\n19\n\nSample Input 4\n\n33 3\n3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n\nSample Output 4\n\n8589934591\n\nThe answer may not fit into a 32-bit integer.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 395, "memory_kb": 115204}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s380112093", "group_id": "codeNet:p04017", "input_text": "function inI()\n a = Ref{Int64}(0)\n ccall(:scanf, Int32, (Ptr{UInt8}, Ref{Int64},), \"%lld\", a)\n Int(a[])\nend\n\nfunction outI(x::Int64)\n ccall(:printf, Void, (Ptr{UInt8}, Int64), \"%lld\\n\", x)\nend\n\nlet\n n = inI()\n x = Int[inI() for _ in 1:n]\n l = inI()\n q = inI()\n const lg = 20\n F = Array(Int, lg, n)\n B = Array(Int, lg, n)\n for i = 1:n\n F[1,i] = searchsortedlast(x, x[i]+l)\n B[1,i] = searchsortedfirst(x, x[i]-l)\n end\n\n for fe = 2:lg\n for i = 1:n\n F[fe,i] = F[fe-1,F[fe-1,i]]\n B[fe,i] = B[fe-1,B[fe-1,i]]\n end\n end\n\n for i = 1:q\n a = inI()\n b = inI()\n\n ans = 1\n if a < b\n for fe = lg:-1:1\n if F[fe,a] < b\n a = F[fe,a]\n ans += 2^(fe-1)\n end\n end\n else\n for fe = lg:-1:1\n if B[fe,a] > b\n a = B[fe,a]\n ans += 2^(fe-1)\n end\n end\n end\n outI(ans)\n #println(ans)\n end\nend\n", "language": "Julia", "metadata": {"date": 1473276807, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04017.html", "problem_id": "p04017", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04017/input.txt", "sample_output_relpath": "derived/input_output/data/p04017/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04017/Julia/s380112093.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s380112093", "user_id": "u965174248"}, "prompt_components": {"gold_output": "4\n2\n1\n2\n", "input_to_evaluate": "function inI()\n a = Ref{Int64}(0)\n ccall(:scanf, Int32, (Ptr{UInt8}, Ref{Int64},), \"%lld\", a)\n Int(a[])\nend\n\nfunction outI(x::Int64)\n ccall(:printf, Void, (Ptr{UInt8}, Int64), \"%lld\\n\", x)\nend\n\nlet\n n = inI()\n x = Int[inI() for _ in 1:n]\n l = inI()\n q = inI()\n const lg = 20\n F = Array(Int, lg, n)\n B = Array(Int, lg, n)\n for i = 1:n\n F[1,i] = searchsortedlast(x, x[i]+l)\n B[1,i] = searchsortedfirst(x, x[i]-l)\n end\n\n for fe = 2:lg\n for i = 1:n\n F[fe,i] = F[fe-1,F[fe-1,i]]\n B[fe,i] = B[fe-1,B[fe-1,i]]\n end\n end\n\n for i = 1:q\n a = inI()\n b = inI()\n\n ans = 1\n if a < b\n for fe = lg:-1:1\n if F[fe,a] < b\n a = F[fe,a]\n ans += 2^(fe-1)\n end\n end\n else\n for fe = lg:-1:1\n if B[fe,a] > b\n a = B[fe,a]\n ans += 2^(fe-1)\n end\n end\n end\n outI(ans)\n #println(ans)\n end\nend\n", "problem_context": "Score : 700 points\n\nProblem Statement\n\nN hotels are located on a straight line. The coordinate of the i-th hotel (1 \\leq i \\leq N) is x_i.\n\nTak the traveler has the following two personal principles:\n\nHe never travels a distance of more than L in a single day.\n\nHe never sleeps in the open. That is, he must stay at a hotel at the end of a day.\n\nYou are given Q queries. The j-th (1 \\leq j \\leq Q) query is described by two distinct integers a_j and b_j.\nFor each query, find the minimum number of days that Tak needs to travel from the a_j-th hotel to the b_j-th hotel following his principles.\nIt is guaranteed that he can always travel from the a_j-th hotel to the b_j-th hotel, in any given input.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq L \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq x_i < x_2 < ... < x_N \\leq 10^9\n\nx_{i+1} - x_i \\leq L\n\n1 \\leq a_j,b_j \\leq N\n\na_j \\neq b_j\n\nN,\\,L,\\,Q,\\,x_i,\\,a_j,\\,b_j are integers.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying N \\leq 10^3 and Q \\leq 10^3.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nx_1 x_2 ... x_N\nL\nQ\na_1 b_1\na_2 b_2\n:\na_Q b_Q\n\nOutput\n\nPrint Q lines.\nThe j-th line (1 \\leq j \\leq Q) should contain the minimum number of days that Tak needs to travel from the a_j-th hotel to the b_j-th hotel.\n\nSample Input 1\n\n9\n1 3 6 13 15 18 19 29 31\n10\n4\n1 8\n7 3\n6 7\n8 5\n\nSample Output 1\n\n4\n2\n1\n2\n\nFor the 1-st query, he can travel from the 1-st hotel to the 8-th hotel in 4 days, as follows:\n\nDay 1: Travel from the 1-st hotel to the 2-nd hotel. The distance traveled is 2.\n\nDay 2: Travel from the 2-nd hotel to the 4-th hotel. The distance traveled is 10.\n\nDay 3: Travel from the 4-th hotel to the 7-th hotel. The distance traveled is 6.\n\nDay 4: Travel from the 7-th hotel to the 8-th hotel. The distance traveled is 10.", "sample_input": "9\n1 3 6 13 15 18 19 29 31\n10\n4\n1 8\n7 3\n6 7\n8 5\n"}, "reference_outputs": ["4\n2\n1\n2\n"], "source_document_id": "p04017", "source_text": "Score : 700 points\n\nProblem Statement\n\nN hotels are located on a straight line. The coordinate of the i-th hotel (1 \\leq i \\leq N) is x_i.\n\nTak the traveler has the following two personal principles:\n\nHe never travels a distance of more than L in a single day.\n\nHe never sleeps in the open. That is, he must stay at a hotel at the end of a day.\n\nYou are given Q queries. The j-th (1 \\leq j \\leq Q) query is described by two distinct integers a_j and b_j.\nFor each query, find the minimum number of days that Tak needs to travel from the a_j-th hotel to the b_j-th hotel following his principles.\nIt is guaranteed that he can always travel from the a_j-th hotel to the b_j-th hotel, in any given input.\n\nConstraints\n\n2 \\leq N \\leq 10^5\n\n1 \\leq L \\leq 10^9\n\n1 \\leq Q \\leq 10^5\n\n1 \\leq x_i < x_2 < ... < x_N \\leq 10^9\n\nx_{i+1} - x_i \\leq L\n\n1 \\leq a_j,b_j \\leq N\n\na_j \\neq b_j\n\nN,\\,L,\\,Q,\\,x_i,\\,a_j,\\,b_j are integers.\n\nPartial Score\n\n200 points will be awarded for passing the test set satisfying N \\leq 10^3 and Q \\leq 10^3.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nx_1 x_2 ... x_N\nL\nQ\na_1 b_1\na_2 b_2\n:\na_Q b_Q\n\nOutput\n\nPrint Q lines.\nThe j-th line (1 \\leq j \\leq Q) should contain the minimum number of days that Tak needs to travel from the a_j-th hotel to the b_j-th hotel.\n\nSample Input 1\n\n9\n1 3 6 13 15 18 19 29 31\n10\n4\n1 8\n7 3\n6 7\n8 5\n\nSample Output 1\n\n4\n2\n1\n2\n\nFor the 1-st query, he can travel from the 1-st hotel to the 8-th hotel in 4 days, as follows:\n\nDay 1: Travel from the 1-st hotel to the 2-nd hotel. The distance traveled is 2.\n\nDay 2: Travel from the 2-nd hotel to the 4-th hotel. The distance traveled is 10.\n\nDay 3: Travel from the 4-th hotel to the 7-th hotel. The distance traveled is 6.\n\nDay 4: Travel from the 7-th hotel to the 8-th hotel. The distance traveled is 10.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 1100, "cpu_time_ms": 1102, "memory_kb": 101812}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s295242590", "group_id": "codeNet:p04019", "input_text": "N=W=S=E=0\nfor c=chomp(readline())\n if c=='N'\n N+=1\n elseif c=='W'\n W+=1\n elseif c=='S'\n S+=1\n elseif c=='E'\n E+=1\n end\nend\nprintln(N*S==0&&N+S>0||W*E==0&&W+E>0 ? \"No\" : \"Yes\")", "language": "Julia", "metadata": {"date": 1568040061, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04019.html", "problem_id": "p04019", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04019/input.txt", "sample_output_relpath": "derived/input_output/data/p04019/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04019/Julia/s295242590.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s295242590", "user_id": "u657913472"}, "prompt_components": {"gold_output": "Yes\n", "input_to_evaluate": "N=W=S=E=0\nfor c=chomp(readline())\n if c=='N'\n N+=1\n elseif c=='W'\n W+=1\n elseif c=='S'\n S+=1\n elseif c=='E'\n E+=1\n end\nend\nprintln(N*S==0&&N+S>0||W*E==0&&W+E>0 ? \"No\" : \"Yes\")", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke lives on an infinite two-dimensional plane. He is going on an N-day trip.\nAt the beginning of Day 1, he is at home. His plan is described in a string S of length N.\nOn Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction:\n\nNorth if the i-th letter of S is N\n\nWest if the i-th letter of S is W\n\nSouth if the i-th letter of S is S\n\nEast if the i-th letter of S is E\n\nHe has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N.\n\nConstraints\n\n1 ≦ | S | ≦ 1000\n\nS consists of the letters N, W, S, E.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Yes if it is possible to set each day's travel distance so that he will be back at home at the end of Day N. Otherwise, print No.\n\nSample Input 1\n\nSENW\n\nSample Output 1\n\nYes\n\nIf Snuke travels a distance of 1 on each day, he will be back at home at the end of day 4.\n\nSample Input 2\n\nNSNNSNSN\n\nSample Output 2\n\nYes\n\nSample Input 3\n\nNNEW\n\nSample Output 3\n\nNo\n\nSample Input 4\n\nW\n\nSample Output 4\n\nNo", "sample_input": "SENW\n"}, "reference_outputs": ["Yes\n"], "source_document_id": "p04019", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke lives on an infinite two-dimensional plane. He is going on an N-day trip.\nAt the beginning of Day 1, he is at home. His plan is described in a string S of length N.\nOn Day i(1 ≦ i ≦ N), he will travel a positive distance in the following direction:\n\nNorth if the i-th letter of S is N\n\nWest if the i-th letter of S is W\n\nSouth if the i-th letter of S is S\n\nEast if the i-th letter of S is E\n\nHe has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N.\n\nConstraints\n\n1 ≦ | S | ≦ 1000\n\nS consists of the letters N, W, S, E.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nS\n\nOutput\n\nPrint Yes if it is possible to set each day's travel distance so that he will be back at home at the end of Day N. Otherwise, print No.\n\nSample Input 1\n\nSENW\n\nSample Output 1\n\nYes\n\nIf Snuke travels a distance of 1 on each day, he will be back at home at the end of day 4.\n\nSample Input 2\n\nNSNNSNSN\n\nSample Output 2\n\nYes\n\nSample Input 3\n\nNNEW\n\nSample Output 3\n\nNo\n\nSample Input 4\n\nW\n\nSample Output 4\n\nNo", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 304, "memory_kb": 111484}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s819437065", "group_id": "codeNet:p04028", "input_text": "N=parse(Int,readline())\nM=length(readline())\nD=zeros(Int,N+1)\nO=10^9+7\nD[1]=1\nfor _=1:N\n\tD=[(D[i>0?i:1]*(i>0?2:1)+(i0?i:1]*(i>0?2:1)+(i parse(Int, x), split(readline()))\n \n ans = 10^5\n max_num = maximum(a)\n min_num = minimum(a)\n \n for i in -100:100\n check = 0\n for j in a\n check += (i - j)^2\n end\n ans = min(ans, check)\n end\n \n println(ans)\n \nend\n\nmain()\n", "language": "Julia", "metadata": {"date": 1586708539, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04031.html", "problem_id": "p04031", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04031/input.txt", "sample_output_relpath": "derived/input_output/data/p04031/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04031/Julia/s435950007.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s435950007", "user_id": "u790457721"}, "prompt_components": {"gold_output": "8\n", "input_to_evaluate": "function main()\n \n N = parse(Int, readline())\n a = map(x -> parse(Int, x), split(readline()))\n \n ans = 10^5\n max_num = maximum(a)\n min_num = minimum(a)\n \n for i in -100:100\n check = 0\n for j in a\n check += (i - j)^2\n end\n ans = min(ans, check)\n end\n \n println(ans)\n \nend\n\nmain()\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": "p04031", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 371, "memory_kb": 112584}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s608091047", "group_id": "codeNet:p04033", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a,b=parseMap(split(readline()))\n if a<=0<=b\n println(\"Zero\")\n elseif b<0 && (b-a)%2==0\n println(\"Negative\")\n else\n println(\"Positive\")\n end\nend\nmain()", "language": "Julia", "metadata": {"date": 1585768183, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04033.html", "problem_id": "p04033", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04033/input.txt", "sample_output_relpath": "derived/input_output/data/p04033/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04033/Julia/s608091047.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s608091047", "user_id": "u619197965"}, "prompt_components": {"gold_output": "Positive\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n a,b=parseMap(split(readline()))\n if a<=0<=b\n println(\"Zero\")\n elseif b<0 && (b-a)%2==0\n println(\"Negative\")\n else\n println(\"Positive\")\n end\nend\nmain()", "problem_context": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "sample_input": "1 3\n"}, "reference_outputs": ["Positive\n"], "source_document_id": "p04033", "source_text": "Problem Statement\n\nYou are given two integers a and b (a≤b). Determine if the product of the integers a, a+1, …, b is positive, negative or zero.\n\nConstraints\n\na and b are integers.\n\n-10^9≤a≤b≤10^9\n\nPartial Score\n\nIn test cases worth 100 points, -10≤a≤b≤10.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\na b\n\nOutput\n\nIf the product is positive, print Positive. If it is negative, print Negative. If it is zero, print Zero.\n\nSample Input 1\n\n1 3\n\nSample Output 1\n\nPositive\n\n1×2×3=6 is positive.\n\nSample Input 2\n\n-3 -1\n\nSample Output 2\n\nNegative\n\n(-3)×(-2)×(-1)=-6 is negative.\n\nSample Input 3\n\n-1 1\n\nSample Output 3\n\nZero\n\n(-1)×0×1=0.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 829, "memory_kb": 167384}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s471214967", "group_id": "codeNet:p04034", "input_text": "function main()\n N,M=map(x->parse(Int,x),split(readline()))\n A=ones(Int,N)\n B=zeros(Int,N)\n B[1]=1\n for s=readlines()\n x,y=map(x->parse(Int,x),split(s))\n A[x]-=1\n A[y]+=1\n if B[x]==1\n B[y]=1\n end\n if A[x]==0\n B[x]=0\n end\n end\n println(+(B...))\nend\nmain()", "language": "Julia", "metadata": {"date": 1579565849, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04034.html", "problem_id": "p04034", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04034/input.txt", "sample_output_relpath": "derived/input_output/data/p04034/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04034/Julia/s471214967.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s471214967", "user_id": "u657913472"}, "prompt_components": {"gold_output": "2\n", "input_to_evaluate": "function main()\n N,M=map(x->parse(Int,x),split(readline()))\n A=ones(Int,N)\n B=zeros(Int,N)\n B[1]=1\n for s=readlines()\n x,y=map(x->parse(Int,x),split(s))\n A[x]-=1\n A[y]+=1\n if B[x]==1\n B[y]=1\n end\n if A[x]==0\n B[x]=0\n end\n end\n println(+(B...))\nend\nmain()", "problem_context": "Problem Statement\n\nWe have N boxes, numbered 1 through N. At first, box 1 contains one red ball, and each of the other boxes contains one white ball.\n\nSnuke will perform the following M operations, one by one. In the i-th operation, he randomly picks one ball from box x_i, then he puts it into box y_i.\n\nFind the number of boxes that may contain the red ball after all operations are performed.\n\nConstraints\n\n2≤N≤10^5\n\n1≤M≤10^5\n\n1≤x_i,y_i≤N\n\nx_i≠y_i\n\nJust before the i-th operation is performed, box x_i contains at least 1 ball.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nx_1 y_1\n:\nx_M y_M\n\nOutput\n\nPrint the number of boxes that may contain the red ball after all operations are performed.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\n2\n\nJust after the first operation, box 1 is empty, box 2 contains one red ball and one white ball, and box 3 contains one white ball.\n\nNow, consider the second operation. If Snuke picks the red ball from box 2, the red ball will go into box 3. If he picks the white ball instead, the red ball will stay in box 2.\nThus, the number of boxes that may contain the red ball after all operations, is 2.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n2 3\n\nSample Output 2\n\n1\n\nAll balls will go into box 3.\n\nSample Input 3\n\n4 4\n1 2\n2 3\n4 1\n3 4\n\nSample Output 3\n\n3", "sample_input": "3 2\n1 2\n2 3\n"}, "reference_outputs": ["2\n"], "source_document_id": "p04034", "source_text": "Problem Statement\n\nWe have N boxes, numbered 1 through N. At first, box 1 contains one red ball, and each of the other boxes contains one white ball.\n\nSnuke will perform the following M operations, one by one. In the i-th operation, he randomly picks one ball from box x_i, then he puts it into box y_i.\n\nFind the number of boxes that may contain the red ball after all operations are performed.\n\nConstraints\n\n2≤N≤10^5\n\n1≤M≤10^5\n\n1≤x_i,y_i≤N\n\nx_i≠y_i\n\nJust before the i-th operation is performed, box x_i contains at least 1 ball.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN M\nx_1 y_1\n:\nx_M y_M\n\nOutput\n\nPrint the number of boxes that may contain the red ball after all operations are performed.\n\nSample Input 1\n\n3 2\n1 2\n2 3\n\nSample Output 1\n\n2\n\nJust after the first operation, box 1 is empty, box 2 contains one red ball and one white ball, and box 3 contains one white ball.\n\nNow, consider the second operation. If Snuke picks the red ball from box 2, the red ball will go into box 3. If he picks the white ball instead, the red ball will stay in box 2.\nThus, the number of boxes that may contain the red ball after all operations, is 2.\n\nSample Input 2\n\n3 3\n1 2\n2 3\n2 3\n\nSample Output 2\n\n1\n\nAll balls will go into box 3.\n\nSample Input 3\n\n4 4\n1 2\n2 3\n4 1\n3 4\n\nSample Output 3\n\n3", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 703, "memory_kb": 159752}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s241379222", "group_id": "codeNet:p04043", "input_text": "(A, B, C) = sort!(parse.([Int], split(readline(STDIN))))\nprintln((A, B, C) == (5, 5, 7) ? \"YES\" : \"NO\")", "language": "Julia", "metadata": {"date": 1493776129, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "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/Julia/s241379222.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s241379222", "user_id": "u872191059"}, "prompt_components": {"gold_output": "YES\n", "input_to_evaluate": "(A, B, C) = sort!(parse.([Int], split(readline(STDIN))))\nprintln((A, B, C) == (5, 5, 7) ? \"YES\" : \"NO\")", "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": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 104, "cpu_time_ms": 1156, "memory_kb": 173056}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s017037844", "group_id": "codeNet:p04045", "input_text": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\td = readline() |> split |> parseMap\n\tv = zeros(Int,10)\n\tfor i in 1:k\n\t\tv[d[i]+1] = 1\n\tend\n\twhile 1==1\n\t\tm = n\n\t\tf = 0\n\t\twhile m>0\n\t\t\tif v[m%10+1]==1\n\t\t\t\tf = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tm=div(m,10)\n\t\tend\n\t\tif f==0\n\t\t\tprintln(n)\n\t\t\tbreak\n\t\tend\n\t\tn+=1\n\tend\nend\n\nmain()", "language": "Julia", "metadata": {"date": 1584962510, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04045.html", "problem_id": "p04045", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04045/input.txt", "sample_output_relpath": "derived/input_output/data/p04045/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04045/Julia/s017037844.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s017037844", "user_id": "u095714878"}, "prompt_components": {"gold_output": "2000\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n\tn,k = readline() |> split |> parseMap\n\td = readline() |> split |> parseMap\n\tv = zeros(Int,10)\n\tfor i in 1:k\n\t\tv[d[i]+1] = 1\n\tend\n\twhile 1==1\n\t\tm = n\n\t\tf = 0\n\t\twhile m>0\n\t\t\tif v[m%10+1]==1\n\t\t\t\tf = 1\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tm=div(m,10)\n\t\tend\n\t\tif f==0\n\t\t\tprintln(n)\n\t\t\tbreak\n\t\tend\n\t\tn+=1\n\tend\nend\n\nmain()", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K.\n\nShe is shopping, and now paying at the cashier.\nHer total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change).\n\nHowever, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.\n\nFind the amount of money that she will hand to the cashier.\n\nConstraints\n\n1 ≦ N < 10000\n\n1 ≦ K < 10\n\n0 ≦ D_1 < D_2 < … < D_K≦9\n\n\\{D_1,D_2,...,D_K\\} ≠ \\{1,2,3,4,5,6,7,8,9\\}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\nD_1 D_2 … D_K\n\nOutput\n\nPrint the amount of money that Iroha will hand to the cashier.\n\nSample Input 1\n\n1000 8\n1 3 4 5 6 7 8 9\n\nSample Output 1\n\n2000\n\nShe dislikes all digits except 0 and 2.\n\nThe smallest integer equal to or greater than N=1000 whose decimal notation contains only 0 and 2, is 2000.\n\nSample Input 2\n\n9999 1\n0\n\nSample Output 2\n\n9999", "sample_input": "1000 8\n1 3 4 5 6 7 8 9\n"}, "reference_outputs": ["2000\n"], "source_document_id": "p04045", "source_text": "Score : 300 points\n\nProblem Statement\n\nIroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K.\n\nShe is shopping, and now paying at the cashier.\nHer total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change).\n\nHowever, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.\n\nFind the amount of money that she will hand to the cashier.\n\nConstraints\n\n1 ≦ N < 10000\n\n1 ≦ K < 10\n\n0 ≦ D_1 < D_2 < … < D_K≦9\n\n\\{D_1,D_2,...,D_K\\} ≠ \\{1,2,3,4,5,6,7,8,9\\}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\nD_1 D_2 … D_K\n\nOutput\n\nPrint the amount of money that Iroha will hand to the cashier.\n\nSample Input 1\n\n1000 8\n1 3 4 5 6 7 8 9\n\nSample Output 1\n\n2000\n\nShe dislikes all digits except 0 and 2.\n\nThe smallest integer equal to or greater than N=1000 whose decimal notation contains only 0 and 2, is 2000.\n\nSample Input 2\n\n9999 1\n0\n\nSample Output 2\n\n9999", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 362, "memory_kb": 110888}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s563788504", "group_id": "codeNet:p04045", "input_text": "n,k = map(x -> parse(Int8, x), split(readline()))\n\nd = map(x -> parse(Int8, x), split(readline()))\n\nwhile n>0\n m = map(x -> parse(Int8, x), split(string(n),\"\"))\n p = 0\n for i in 1:k\n \tif in(d[i] , m)\n p += 1\n break\n end\n end\n if p == 0\n print(n)\n global n=0\n else\n global n += 1\n end\nend\n", "language": "Julia", "metadata": {"date": 1573899540, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04045.html", "problem_id": "p04045", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04045/input.txt", "sample_output_relpath": "derived/input_output/data/p04045/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04045/Julia/s563788504.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Runtime Error", "submission_id": "s563788504", "user_id": "u217655905"}, "prompt_components": {"gold_output": "2000\n", "input_to_evaluate": "n,k = map(x -> parse(Int8, x), split(readline()))\n\nd = map(x -> parse(Int8, x), split(readline()))\n\nwhile n>0\n m = map(x -> parse(Int8, x), split(string(n),\"\"))\n p = 0\n for i in 1:k\n \tif in(d[i] , m)\n p += 1\n break\n end\n end\n if p == 0\n print(n)\n global n=0\n else\n global n += 1\n end\nend\n", "problem_context": "Score : 300 points\n\nProblem Statement\n\nIroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K.\n\nShe is shopping, and now paying at the cashier.\nHer total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change).\n\nHowever, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.\n\nFind the amount of money that she will hand to the cashier.\n\nConstraints\n\n1 ≦ N < 10000\n\n1 ≦ K < 10\n\n0 ≦ D_1 < D_2 < … < D_K≦9\n\n\\{D_1,D_2,...,D_K\\} ≠ \\{1,2,3,4,5,6,7,8,9\\}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\nD_1 D_2 … D_K\n\nOutput\n\nPrint the amount of money that Iroha will hand to the cashier.\n\nSample Input 1\n\n1000 8\n1 3 4 5 6 7 8 9\n\nSample Output 1\n\n2000\n\nShe dislikes all digits except 0 and 2.\n\nThe smallest integer equal to or greater than N=1000 whose decimal notation contains only 0 and 2, is 2000.\n\nSample Input 2\n\n9999 1\n0\n\nSample Output 2\n\n9999", "sample_input": "1000 8\n1 3 4 5 6 7 8 9\n"}, "reference_outputs": ["2000\n"], "source_document_id": "p04045", "source_text": "Score : 300 points\n\nProblem Statement\n\nIroha is very particular about numbers. There are K digits that she dislikes: D_1, D_2, ..., D_K.\n\nShe is shopping, and now paying at the cashier.\nHer total is N yen (the currency of Japan), thus she has to hand at least N yen to the cashier (and possibly receive the change).\n\nHowever, as mentioned before, she is very particular about numbers. When she hands money to the cashier, the decimal notation of the amount must not contain any digits that she dislikes. Under this condition, she will hand the minimum amount of money.\n\nFind the amount of money that she will hand to the cashier.\n\nConstraints\n\n1 ≦ N < 10000\n\n1 ≦ K < 10\n\n0 ≦ D_1 < D_2 < … < D_K≦9\n\n\\{D_1,D_2,...,D_K\\} ≠ \\{1,2,3,4,5,6,7,8,9\\}\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN K\nD_1 D_2 … D_K\n\nOutput\n\nPrint the amount of money that Iroha will hand to the cashier.\n\nSample Input 1\n\n1000 8\n1 3 4 5 6 7 8 9\n\nSample Output 1\n\n2000\n\nShe dislikes all digits except 0 and 2.\n\nThe smallest integer equal to or greater than N=1000 whose decimal notation contains only 0 and 2, is 2000.\n\nSample Input 2\n\n9999 1\n0\n\nSample Output 2\n\n9999", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 742, "memory_kb": 135248}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s775745665", "group_id": "codeNet:p04047", "input_text": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n l=parseMap(split(readline())) |> sort\n ans=0\n for i in 1:2n\n if i%2==1\n ans+=l[i]\n end\n end\n println(ans)\nend\nmain()", "language": "Julia", "metadata": {"date": 1585768357, "filename_ext": "jl", "original_language": "Julia (0.5.0)", "problem_description_relpath": "problem_descriptions/p04047.html", "problem_id": "p04047", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04047/input.txt", "sample_output_relpath": "derived/input_output/data/p04047/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04047/Julia/s775745665.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s775745665", "user_id": "u619197965"}, "prompt_components": {"gold_output": "3\n", "input_to_evaluate": "parseInt(x) = parse(Int, x)\nparseBigInt(x) = parse(BigInt, x)\nparseFloat(x) = parse(Float64, x)\nparseBigFloat(x) = parse(BigFloat, x)\nparseMap(x::Array{SubString{String},1}) = map(parseInt, x)\n\nfunction main()\n n=parseInt(readline())\n l=parseMap(split(readline())) |> sort\n ans=0\n for i in 1:2n\n if i%2==1\n ans+=l[i]\n end\n end\n println(ans)\nend\nmain()", "problem_context": "Score : 200 points\n\nProblem Statement\n\nSnuke is having a barbeque party.\n\nAt the party, he will make N servings of Skewer Meal.\n\nExample of a serving of Skewer Meal\n\nHe has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i.\nAlso, he has an infinite supply of ingredients.\n\nTo make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers.\nLet the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients.\n\nWhat is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?\n\nConstraints\n\n1≦N≦100\n\n1≦L_i≦100\n\nFor each i, L_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_{2N}\n\nOutput\n\nPrint the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold.\n\nSample Input 1\n\n2\n1 3 1 2\n\nSample Output 1\n\n3\n\nIf he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold 1 and 2 ingredients, for the total of 3.\n\nSample Input 2\n\n5\n100 1 2 3 14 15 58 58 58 29\n\nSample Output 2\n\n135", "sample_input": "2\n1 3 1 2\n"}, "reference_outputs": ["3\n"], "source_document_id": "p04047", "source_text": "Score : 200 points\n\nProblem Statement\n\nSnuke is having a barbeque party.\n\nAt the party, he will make N servings of Skewer Meal.\n\nExample of a serving of Skewer Meal\n\nHe has a stock of 2N skewers, all of which will be used in Skewer Meal. The length of the i-th skewer is L_i.\nAlso, he has an infinite supply of ingredients.\n\nTo make a serving of Skewer Meal, he picks 2 skewers and threads ingredients onto those skewers.\nLet the length of the shorter skewer be x, then the serving can hold the maximum of x ingredients.\n\nWhat is the maximum total number of ingredients that his N servings of Skewer Meal can hold, if he uses the skewers optimally?\n\nConstraints\n\n1≦N≦100\n\n1≦L_i≦100\n\nFor each i, L_i is an integer.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN\nL_1 L_2 ... L_{2N}\n\nOutput\n\nPrint the maximum total number of ingredients that Snuke's N servings of Skewer Meal can hold.\n\nSample Input 1\n\n2\n1 3 1 2\n\nSample Output 1\n\n3\n\nIf he makes a serving using the first and third skewers, and another using the second and fourth skewers, each serving will hold 1 and 2 ingredients, for the total of 3.\n\nSample Input 2\n\n5\n100 1 2 3 14 15 58 58 58 29\n\nSample Output 2\n\n135", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 821, "memory_kb": 168972}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s623524697", "group_id": "codeNet:p04048", "input_text": "n, x = map((x) -> parse(Int, x), split(readline(stdin), ' '))\n\nlongline = max(n-x, x)\nshortline = min(n-x, x)\nsum = n\nwhile shortline != 0\n global sum += 2 * div(longline, shortline) * shortline\n tmp = longline\n global longline = shortline\n global shortline = tmp % shortline\n if shortline == 0\n sum -= longline\n end\nend\n\nprintln(sum)\n ", "language": "Julia", "metadata": {"date": 1597695439, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p04048.html", "problem_id": "p04048", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04048/input.txt", "sample_output_relpath": "derived/input_output/data/p04048/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04048/Julia/s623524697.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Accepted", "submission_id": "s623524697", "user_id": "u767620109"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "n, x = map((x) -> parse(Int, x), split(readline(stdin), ' '))\n\nlongline = max(n-x, x)\nshortline = min(n-x, x)\nsum = n\nwhile shortline != 0\n global sum += 2 * div(longline, shortline) * shortline\n tmp = longline\n global longline = shortline\n global shortline = tmp % shortline\n if shortline == 0\n sum -= longline\n end\nend\n\nprintln(sum)\n ", "problem_context": "Score : 500 points\n\nProblem Statement\n\nSnuke is conducting an optical experiment using mirrors and his new invention, the rifle of Mysterious Light.\n\nThree mirrors of length N are set so that they form an equilateral triangle.\nLet the vertices of the triangle be a, b and c.\n\nInside the triangle, the rifle is placed at the point p on segment ab such that ap = X.\n(The size of the rifle is negligible.)\nNow, the rifle is about to fire a ray of Mysterious Light in the direction of bc.\n\nThe ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as \"ordinary\" light.\nThere is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!\nWhen the ray comes back to the rifle, the ray will be absorbed.\n\nThe following image shows the ray's trajectory where N = 5 and X = 2.\n\nIt can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X.\nFind the total length of the ray's trajectory.\n\nConstraints\n\n2≦N≦10^{12}\n\n1≦X≦N-1\n\nN and X are integers.\n\nPartial Points\n\n300 points will be awarded for passing the test set satisfying N≦1000.\n\nAnother 200 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the total length of the ray's trajectory.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n12\n\nRefer to the image in the Problem Statement section.\nThe total length of the trajectory is 2+3+2+2+1+1+1 = 12.", "sample_input": "5 2\n"}, "reference_outputs": ["12\n"], "source_document_id": "p04048", "source_text": "Score : 500 points\n\nProblem Statement\n\nSnuke is conducting an optical experiment using mirrors and his new invention, the rifle of Mysterious Light.\n\nThree mirrors of length N are set so that they form an equilateral triangle.\nLet the vertices of the triangle be a, b and c.\n\nInside the triangle, the rifle is placed at the point p on segment ab such that ap = X.\n(The size of the rifle is negligible.)\nNow, the rifle is about to fire a ray of Mysterious Light in the direction of bc.\n\nThe ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as \"ordinary\" light.\nThere is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!\nWhen the ray comes back to the rifle, the ray will be absorbed.\n\nThe following image shows the ray's trajectory where N = 5 and X = 2.\n\nIt can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X.\nFind the total length of the ray's trajectory.\n\nConstraints\n\n2≦N≦10^{12}\n\n1≦X≦N-1\n\nN and X are integers.\n\nPartial Points\n\n300 points will be awarded for passing the test set satisfying N≦1000.\n\nAnother 200 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the total length of the ray's trajectory.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n12\n\nRefer to the image in the Problem Statement section.\nThe total length of the trajectory is 2+3+2+2+1+1+1 = 12.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported 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": 265, "memory_kb": 164824}, "variant": "low_resource"} {"dataset": "codeNet", "domain": "code_generation", "example_id": "codeNet:Julia:s815167926", "group_id": "codeNet:p04048", "input_text": "n, x = 5, 2\n\nt = gcd(n,x)\nprint(3*(n//t-1)*t)", "language": "Julia", "metadata": {"date": 1597692311, "filename_ext": "jl", "original_language": "Julia (1.4.0)", "problem_description_relpath": "problem_descriptions/p04048.html", "problem_id": "p04048", "resource_group": "low_resource", "sample_input_relpath": "derived/input_output/data/p04048/input.txt", "sample_output_relpath": "derived/input_output/data/p04048/output.txt", "source_dataset": "Project CodeNet", "source_relpath": "data/p04048/Julia/s815167926.jl", "split_policy": "Global OOD problem IDs are disjoint from train, validation, and in-distribution test problem IDs.", "status": "Wrong Answer", "submission_id": "s815167926", "user_id": "u767620109"}, "prompt_components": {"gold_output": "12\n", "input_to_evaluate": "n, x = 5, 2\n\nt = gcd(n,x)\nprint(3*(n//t-1)*t)", "problem_context": "Score : 500 points\n\nProblem Statement\n\nSnuke is conducting an optical experiment using mirrors and his new invention, the rifle of Mysterious Light.\n\nThree mirrors of length N are set so that they form an equilateral triangle.\nLet the vertices of the triangle be a, b and c.\n\nInside the triangle, the rifle is placed at the point p on segment ab such that ap = X.\n(The size of the rifle is negligible.)\nNow, the rifle is about to fire a ray of Mysterious Light in the direction of bc.\n\nThe ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as \"ordinary\" light.\nThere is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!\nWhen the ray comes back to the rifle, the ray will be absorbed.\n\nThe following image shows the ray's trajectory where N = 5 and X = 2.\n\nIt can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X.\nFind the total length of the ray's trajectory.\n\nConstraints\n\n2≦N≦10^{12}\n\n1≦X≦N-1\n\nN and X are integers.\n\nPartial Points\n\n300 points will be awarded for passing the test set satisfying N≦1000.\n\nAnother 200 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the total length of the ray's trajectory.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n12\n\nRefer to the image in the Problem Statement section.\nThe total length of the trajectory is 2+3+2+2+1+1+1 = 12.", "sample_input": "5 2\n"}, "reference_outputs": ["12\n"], "source_document_id": "p04048", "source_text": "Score : 500 points\n\nProblem Statement\n\nSnuke is conducting an optical experiment using mirrors and his new invention, the rifle of Mysterious Light.\n\nThree mirrors of length N are set so that they form an equilateral triangle.\nLet the vertices of the triangle be a, b and c.\n\nInside the triangle, the rifle is placed at the point p on segment ab such that ap = X.\n(The size of the rifle is negligible.)\nNow, the rifle is about to fire a ray of Mysterious Light in the direction of bc.\n\nThe ray of Mysterious Light will travel in a straight line, and will be reflected by mirrors, in the same ways as \"ordinary\" light.\nThere is one major difference, though: it will be also reflected by its own trajectory as if it is a mirror!\nWhen the ray comes back to the rifle, the ray will be absorbed.\n\nThe following image shows the ray's trajectory where N = 5 and X = 2.\n\nIt can be shown that the ray eventually comes back to the rifle and is absorbed, regardless of the values of N and X.\nFind the total length of the ray's trajectory.\n\nConstraints\n\n2≦N≦10^{12}\n\n1≦X≦N-1\n\nN and X are integers.\n\nPartial Points\n\n300 points will be awarded for passing the test set satisfying N≦1000.\n\nAnother 200 points will be awarded for passing the test set without additional constraints.\n\nInput\n\nThe input is given from Standard Input in the following format:\n\nN X\n\nOutput\n\nPrint the total length of the ray's trajectory.\n\nSample Input 1\n\n5 2\n\nSample Output 1\n\n12\n\nRefer to the image in the Problem Statement section.\nThe total length of the trajectory is 2+3+2+2+1+1+1 = 12.", "split": "train", "target_descriptions": {"code_size_bytes": "Submitted source-code file size, in bytes.", "cpu_time_ms": "Execution CPU time reported by official Project CodeNet metadata, in milliseconds.", "memory_kb": "Peak memory usage reported by official Project CodeNet metadata, in kilobytes."}, "targets": {"code_size_bytes": 45, "cpu_time_ms": 297, "memory_kb": 165476}, "variant": "low_resource"}