group_id stringlengths 12 18 | problem_description stringlengths 85 3.02k | candidates listlengths 3 20 |
|---|---|---|
aoj_ALDS1_1_B_cpp | Greatest Common Divisor
Write a program which finds the greatest common divisor of two natural numbers
a
and
b
Input
a
and
b
are given in a line sparated by a single space.
Output
Output the greatest common divisor of
a
and
b
.
Constrants
1 ≤
a
,
b
≤ 10
9
Hint
You can use the following observation:
For integers
x
and
y
, if
x
≥
y
, then gcd(
x
,
y
) = gcd(
y
,
x
%
y
)
Sample Input 1
54 20
Sample Output 1
2
Sample Input 2
147 105
Sample Output 2
21 | [
{
"submission_id": "aoj_ALDS1_1_B_10915851",
"code_snippet": "#include <iostream>\nusing namespace std;\n\nint main(){\n int x, y; cin >> x >> y;\n int d = 2;\n int gcd = 1;\n\n while(d <= x && d <= y){\n if (x % d == 0 && y % d == 0){\n x = x / d;\n y = y / d;\n ... |
aoj_ALDS1_2_D_cpp | Shell Sort
Shell Sort is a generalization of Insertion Sort (ALDS1_1_A) to arrange a list of $n$ elements $A$.
1 insertionSort(A, n, g)
2 for i = g to n-1
3 v = A[i]
4 j = i - g
5 while j >= 0 && A[j] > v
6 A[j+g] = A[j]
7 j = j - g
8 cnt++
9 A[j+g] = v
10
11 shellSort(A, n)
12 cnt = 0
13 m = ?
14 G[] = {?, ?,..., ?}
15 for i = 0 to m-1
16 insertionSort(A, n, G[i])
A function shellSort(A, n) performs a function insertionSort(A, n, g), which considers every $g$-th elements. Beginning with large values of $g$, it repeats the insertion sort with smaller $g$.
Your task is to complete the above program by filling
?
. Write a program which reads an integer $n$ and a sequence $A$, and prints $m$, $G_i (i = 0, 1, ..., m − 1)$ in the pseudo code and the sequence $A$ in ascending order. The output of your program must meet the following requirements:
$1 \leq m \leq 100$
$0 \leq G_i \leq n$
cnt
does not exceed $\lceil n^{1.5}\rceil$
Input
In the first line, an integer $n$ is given. In the following $n$ lines, $A_i (i=0,1,...,n-1)$ are given for each line.
Output
In the first line, print an integer $m$. In the second line, print $m$ integers $G_i (i=0,1,...,m-1)$ separated by single space character in a line.
In the third line, print
cnt
in a line. In the following $n$ lines, print $A_i (i=0,1,...,n-1)$ respectively.
This problem has multiple solutions and the judge will be performed by a special validator.
Constraints
$1 \leq n \leq 1,000,000$
$0 \leq A_i \leq 10^9$
Sample Input 1
5
5
1
4
3
2
Sample Output 1
2
4 1
3
1
2
3
4
5
Sample Input 2
3
3
2
1
Sample Output 2
1
1
3
1
2
3 | [
{
"submission_id": "aoj_ALDS1_2_D_11015424",
"code_snippet": "#include <iostream>\n#include <bits/stdc++.h>\n\nusing namespace std;\n\nclass my_vector\n{\nprivate: // 隠すもの。外から見えない\n int *a; // 可変長配列\n int n; // 要素数\n int capacity; // 確保する容量\n\npublic: // 公開するもの\n my... |
aoj_ALDS1_1_D_cpp | Maximum Profit
You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar, and sell them at a rate of 108 yen per dollar, you can obtain (108 - 100) × 1000 = 8000 yen.
Write a program which reads values of a currency $R_t$ at a certain time $t$ ($t = 0, 1, 2, ... n-1$), and reports the maximum value of $R_j - R_i$ where $j > i$ .
Input
The first line contains an integer $n$. In the following $n$ lines, $R_t$ ($t = 0, 1, 2, ... n-1$) are given in order.
Output
Print the maximum value in a line.
Constraints
$2 \leq n \leq 200,000$
$1 \leq R_t \leq 10^9$
Sample Input 1
6
5
3
1
3
4
3
Sample Output 1
3
Sample Input 2
3
4
3
2
Sample Output 2
-1 | [
{
"submission_id": "aoj_ALDS1_1_D_11066075",
"code_snippet": "#include<iostream>\nusing namespace std;\nint main ( ) {\n\tint n = 0, min = 0, result = -1000000000, temp = 0;\n\tcin >> n;\n\tcin >> min;\n\tfor (int i = 0; i < n-1; i++) {\n\t\tcin >> temp;\n\t\tif (temp - min > result) {\n\t\t\tresult = temp ... |
aoj_ALDS1_1_C_cpp | Prime Numbers
A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7.
Write a program which reads a list of
N
integers and prints the number of prime numbers in the list.
Input
The first line contains an integer
N
, the number of elements in the list.
N
numbers are given in the following lines.
Output
Print the number of prime numbers in the given list.
Constraints
1 ≤
N
≤ 10000
2 ≤
an element of the list
≤ 10
8
Sample Input 1
5
2
3
4
5
6
Sample Output 1
3
Sample Input 2
11
7
8
9
10
11
12
13
14
15
16
17
Sample Output 2
4 | [
{
"submission_id": "aoj_ALDS1_1_C_11063301",
"code_snippet": "#include<bits/stdc++.h> \nusing namespace std;\nint gcd(int a, int b) {\n while (b != 0) {\n int temp = b;\n b = a % b;\n a = temp;\n }\n return a;\n}\nint lcm(int a, int b) {\n return a / gcd(a, b) * b;\n}\nint m... |
aoj_ALDS1_4_C_cpp | Search III
Your task is to write a program of a simple
dictionary
which implements the following instructions:
insert
str
: insert a string
str
in to the dictionary
find
str
: if the distionary contains
str
, then print '
yes
', otherwise print '
no
'
Input
In the first line
n
, the number of instructions is given. In the following
n
lines,
n
instructions are given in the above mentioned format.
Output
Print
yes
or
no
for each find instruction in a line.
Constraints
A string consists of '
A
', '
C
', '
G
', or '
T
'
1 ≤ length of a string ≤ 12
n
≤ 1000000
Sample Input 1
5
insert A
insert T
insert C
find G
find A
Sample Output 1
no
yes
Sample Input 2
13
insert AAA
insert AAC
insert AGA
insert AGG
insert TTT
find AAA
find CCC
find CCC
insert CCC
find CCC
insert T
find TTT
find T
Sample Output 2
yes
no
no
yes
yes
yes
Notes
Template in C | [
{
"submission_id": "aoj_ALDS1_4_C_11057022",
"code_snippet": "// ██████████████████╗█████╗███╗ ██╗ ██████╗ █████╗████╗ ██╗█████╗███╗ ██╗\n// ╚══██╔══██╚══██╔══██╔══██████╗ ██║ ██╔══████╔══████╚██╗ ██╔██╔══██████╗ ██║\n// ██║ ██║ ██║ █████████╔██╗ ██║ ██████╔█████████║╚████╔╝█████████╔... |
aoj_ALDS1_4_B_cpp | Search II
You are given a sequence of
n
integers S and a sequence of different
q
integers T. Write a program which outputs C, the number of integers in T which are also in the set S.
Input
In the first line
n
is given. In the second line,
n
integers are given. In the third line
q
is given. Then, in the fourth line,
q
integers are given.
Output
Print C in a line.
Constraints
Elements in S is sorted in ascending order
n ≤ 100000
q ≤ 50000
0 ≤ an element in S ≤ 10
9
0 ≤ an element in T ≤ 10
9
Sample Input 1
5
1 2 3 4 5
3
3 4 1
Sample Output 1
3
Sample Input 2
3
1 2 3
1
5
Sample Output 2
0
Sample Input 3
5
1 1 2 2 3
2
1 2
Sample Output 3
2
Notes | [
{
"submission_id": "aoj_ALDS1_4_B_11066403",
"code_snippet": "#include <bits/stdc++.h>\nusing namespace std;\n#define ll long long\n\nint main() {\n int n,q; cin>>n;\n int s[n+5], t;\n int count=0;\n\n for(int i =1; i<=n;i++){\n cin>>s[i];\n }\n cin>>q;\n for(int i=1;i<=q;i++){\n... |
aoj_ALDS1_3_C_cpp | Doubly Linked List
Your task is to implement a double linked list.
Write a program which performs the following operations:
insert x: insert an element with key x into the front of the list.
delete x: delete the first element which has the key of x from the list. If there is not such element, you need not do anything.
deleteFirst: delete the first element from the list.
deleteLast: delete the last element from the list.
Input
The input is given in the following format:
n
command
1
command
2
...
command
n
In the first line, the number of operations
n
is given. In the following
n
lines, the above mentioned operations are given in the following format:
insert x
delete x
deleteFirst
deleteLast
Output
Print all the element (key) in the list after the given operations. Two consequtive keys should be separated by a single space.
Constraints
The number of operations ≤ 2,000,000
The number of delete operations ≤ 20
0 ≤ value of a key ≤ 10
9
The number of elements in the list does not exceed 10
6
For a delete, deleteFirst or deleteLast operation, there is at least one element in the list.
Sample Input 1
7
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5
Sample Output 1
6 1 2
Sample Input 2
9
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5
deleteFirst
deleteLast
Sample Output 2
1 | [
{
"submission_id": "aoj_ALDS1_3_C_11042443",
"code_snippet": "#include <bits/stdc++.h>\n\nusing namespace std;\n\nint n, x;\nstring s;\nlist<int> l;\n\nint main() {\n ios::sync_with_stdio(false);\n cin.tie(0); cout.tie(0);\n\n cin >> n;\n while(n--) {\n cin >> s;\n if(s == \"insert... |
aoj_ALDS1_4_D_cpp | "Allocation\nYou are given $n$ packages of $w_i$ kg from a belt conveyor in order ($i = 0, 1, ... n-(...TRUNCATED) | [{"submission_id":"aoj_ALDS1_4_D_10995248","code_snippet":"#include<iostream>\n#include<vector>\n#in(...TRUNCATED) |
aoj_ALDS1_3_B_cpp | "There are\nn\nprocesses in a queue. Each process has name\ni\nand time\ni\n. The round-robin sched(...TRUNCATED) | [{"submission_id":"aoj_ALDS1_3_B_11064149","code_snippet":"#include <bits/stdc++.h>\nusing namespace(...TRUNCATED) |
aoj_ALDS1_5_A_cpp | "Exhaustive Search\nWrite a program which reads a sequence\nA\nof\nn\nelements and an integer\nM\n, (...TRUNCATED) | [{"submission_id":"aoj_ALDS1_5_A_11061393","code_snippet":"# include <stdio.h>\n\nstatic int N, A[50(...TRUNCATED) |
AOJ-CodeRank-Benchmark: Hybrid Efficiency Ranking Benchmark Dataset
1. Overview
This dataset (AOJ-CodeRank-Benchmark) was created to evaluate the capability of Large Language Models (LLMs) in code efficiency ranking tasks using a high-quality, structured benchmark.
The dataset is built entirely on code submission records from Aizu Online Judge (AOJ), strictly adhering to the principle of correctness first, efficiency second.
- Problem Scope: ALDS1 (Fundamental Algorithms), DSL/GRL/CGL (Advanced Data Structures/Graphs), and Volume 0000-3299 (Classic Contest Problems).
- Core Feature: Eliminates 0ms submissions and low-quality/non-unique submissions, ensuring true time differentiation across all data groups.
2. Data Structure
The dataset uses the JSON Lines (.jsonl) format. Each line represents a single Task Group object.
Structure Preview (Candidates):
| Field Name | Type | Description |
|---|---|---|
submission_id |
string | Unique Submission ID. |
code_snippet |
string | The complete C++ source code. |
accuracy |
float | Accuracy Score (0.0 to 1.0). |
time_ms |
integer | Actual Execution Time (in milliseconds). |
score_of_the_acc |
float | Normalized Efficiency Score (Range -2.0 to 0.0). |
final_rank |
integer | Final Competition Rank (1, 2, 3...). |
3. Ground Truth (GT) Scoring and Ranking Logic 🏆
The LLM's objective is to predict the final_rank. This ranking is derived from a unique two-tiered system:
Phase I: Efficiency Score (score_of_the_acc)
This score is a purely performance-based metric, calculating the normalized inverse sum of Time and Memory costs within the task group.
(Note: Score is between -2.0 and 0.0. A score closer to 0.0 is better.)
Phase II: Final Ranking (final_rank) Mechanism
The final rank is determined by a lexicographical sort (Standard Competition Ranking) using the following priority:
- Primary Sort Key (Accuracy):
accuracy(Descending). - Secondary Sort Key (Efficiency):
score_of_the_acc(Descending).
Tie-Breaking: Submissions with identical Accuracy and Efficiency Score receive the same rank (1-2-2-4 rule).
4. Usage Example
from datasets import load_dataset
# Load the dataset and access the candidates list
dataset = load_dataset("Slime/AOJ-CodeRank-Benchmark", data_files="train.jsonl", split="train")
# The LLM sorting algorithm will receive task['candidates'] for ranking
for task in dataset:
candidates = task['candidates']
# Algorithm generates predicted_rank for candidates
# Evaluation compares predicted_rank against ground_truth['final_rank']
5. Acknowledgments
Original submission records and problem context are sourced from Aizu Online Judge (AOJ).
- Downloads last month
- 12