Skip to content

Instantly share code, notes, and snippets.

@u-m-i
Last active March 12, 2026 17:36
Show Gist options
  • Select an option

  • Save u-m-i/6d0824d973c6acd92b16d6cf7d8f79e3 to your computer and use it in GitHub Desktop.

Select an option

Save u-m-i/6d0824d973c6acd92b16d6cf7d8f79e3 to your computer and use it in GitHub Desktop.
Codeforce's way to access input

Basically, for me as a newbie on Competitive Programming was difficult to find the way you are supposed to enter the input of the test cases.
That lead me to find little about how to do so, seeming that everyones supouse that you know, but yes, we don't, so here are how you can expect
input from the judge (the program that executes your script passing it one or more test cases) for all languages allowed.

#include <stdio.h>
int main(void){
/* Simplest */
int n;
scanf("%d", &n);
/* Whole line */
char input[100]; // It can be a larger number
fgets(input, sizeof(input), stdin);
/* Large inputs */
}
/* Common JS */
const fs = require("fs");
const input = fs.readFileSync(0, "utf8");
/* Parse the input */
/* Simple method */
const args = input.replace("\r\n", "").split(" ");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment