RULES
The ground rules for fierce strategic competition Fair competition starts with clear standards.
You may use the development tools on your local computer while writing code. In this case, please be sure to read this guide so that you do not suffer the disadvantage of your code failing to run or be judged due to differences between your local development environment and the judging environment (especially when using Visual Studio / Visual C++).
Judging Environment
The execution and judging of all code submitted for code submission problems takes place in the following environment.
- Amazon Web Services c7a.2xlarge instance
- Custom processor based on 4th-generation AMD EPYC
- Clock: 3.7 GHz
- Processor architecture: 64-bit
- OS: Ubuntu 24.04
Please note that code that does not work in this environment will not be graded. Please keep this in mind when using development tools.
Compilers by Language
- C++26 and Rust 2024 Nightly are experimental languages whose judging and compilation environments may change at any time, and their correct operation is not guaranteed.
Cautions
Please be careful not to write code that runs only on a specific platform (especially Windows or Visual C++), as in the examples below.
| Prohibited Example | Remarks |
|---|---|
void main() | it must be int main |
getch() | Use getchar() instead |
fflush(stdin) | Use of a non-standard function |
GetTickCount() | The Windows API cannot be used |
CString | CString is non-standard and cannot be used. Use std::string instead |
#include <stdafx.h> | stdafx.h is a Visual C++-only precompiled header |
Java Cautions
The class name must be Main.
Using Standard Input/Output
For all code submission problems, you must read input from standard input according to the given input format and print output to standard output according to the given output format. If there is a problem in which you must read two integers and print their product, as in the example below, the way to handle standard input and standard output for each language is as follows.
Input Example
8 4
Output Example
32
Code Examples by Language
#include <stdio.h>
int main()
{
int a, b;
scanf("%d %d", &a, &b);
printf("%d\n", a * b);
return 0;
}#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a * b << endl;
return 0;
}a, b = map(int, input().split())
print(a * b)a, b = map(int, input().split())
print(a * b)import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a * b);
}
}use std::io;
fn main() {
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
let nums: Vec<i32> = input.trim().split_whitespace()
.map(|x| x.parse().unwrap())
.collect();
println!("{}", nums[0] * nums[1]);
}const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const [a, b] = input.split(' ').map(Number);
console.log(a * b);const input = require('fs').readFileSync('/dev/stdin', 'utf8');
const [a, b] = input.split(' ').map(Number);
console.log(a * b);using System;
class Program {
static void Main() {
string[] input = Console.ReadLine().Split(' ');
int a = int.Parse(input[0]);
int b = int.Parse(input[1]);
Console.WriteLine(a * b);
}
}package main
import (
"fmt"
)
func main() {
var a, b int
fmt.Scanf("%d %d", &a, &b)
fmt.Println(a * b)
}a, b = io.read("*n", "*n")
print(a * b)a, b = io.read("*n", "*n")
print(a * b)fun main() {
val (a, b) = readLine()!!.split(" ").map { it.toInt() }
println(a * b)
}import scala.io.StdIn.readLine
@main def run(): Unit =
val nums = readLine().split(" ").map(_.toInt)
println(nums(0) * nums(1))Binary Files
In the judging environment, you may submit a binary file in addition to your source code. The binary file is provided as a file named data.bin in the directory where the source code is executed.
This file is provided only during code execution, not during compilation.
The code to print every byte of data.bin to standard output is as follows.
#include <stdio.h>
int main()
{
FILE *f = fopen("data.bin", "rb");
int byte;
while ((byte = fgetc(f)) != EOF)
{
printf("%d ", byte);
}
fclose(f);
printf("\n");
}#include <fstream>
#include <iostream>
using namespace std;
int main()
{
ifstream file("data.bin", ios::binary);
unsigned char byte;
while (file.read((char *)&byte, 1))
{
cout << (int)byte << " ";
}
cout << endl;
file.close();
return 0;
}with open("data.bin", "rb") as f:
bytes_read = f.read()
for byte in bytes_read:
print(byte, end=" ")
print()with open("data.bin", "rb") as f:
bytes_read = f.read()
for byte in bytes_read:
print(byte, end=" ")
print()import java.io.FileInputStream;
import java.io.IOException;
public class Main {
public static void main(String[] args) {
try (FileInputStream fis = new FileInputStream("data.bin")) {
int byteRead;
while ((byteRead = fis.read()) != -1) {
System.out.print(byteRead + " ");
}
System.out.println();
} catch (IOException e) {
e.printStackTrace();
}
}
}use std::{fs::File, io::Read};
fn main() {
let mut file = File::open("data.bin").unwrap();
let mut buffer = [0u8; 1];
while let Ok(n) = file.read(&mut buffer) {
if n == 0 { break; }
print!("{} ", buffer[0]);
}
println!();
}const fs = require("fs");
fs.readFile("data.bin", (_, data) => {
data.forEach(byte => process.stdout.write(byte + " "));
console.log();
});const fs = require("fs");
fs.readFile("data.bin", (_, data) => {
data.forEach(byte => process.stdout.write(byte + " "));
console.log();
});using System;
using System.IO;
class Program {
static void Main() {
using (FileStream fs = new FileStream("data.bin", FileMode.Open, FileAccess.Read)) {
int byteRead;
while ((byteRead = fs.ReadByte()) != -1) {
Console.Write(byteRead + " ");
}
Console.WriteLine();
}
}
}package main
import (
"fmt"
"os"
)
func main() {
file, _ := os.Open("data.bin")
defer file.Close()
buf := make([]byte, 1)
for {
n, _ := file.Read(buf)
if n == 0 { break }
fmt.Printf("%d ", buf[0])
}
fmt.Println()
}local file = assert(io.open("data.bin", "rb"))
while true do
local byte = file:read(1)
if not byte then break end
io.write(string.byte(byte), " ")
end
file:close()
print()local file = assert(io.open("data.bin", "rb"))
while true do
local byte = file:read(1)
if not byte then break end
io.write(string.byte(byte), " ")
end
file:close()
print()import java.io.File
fun main() {
val bytes = File("data.bin").readBytes()
for (b in bytes) {
print("${b.toInt() and 0xFF} ")
}
println()
}import java.nio.file.{Files, Paths}
@main def run(): Unit =
val bytes = Files.readAllBytes(Paths.get("data.bin"))
println(bytes.map(_ & 0xFF).mkString(" "))Program Exit Code
The program you write must always have an exit code of 0 (normal termination). If it does not terminate with 0, your submission may not be judged even if it prints the correct answer. In particular, even if you submit code that sets the exit code to 0, it may terminate with a non-zero code depending on whether a runtime error occurs in your program.
