This video, kindly made by Chris Roffey from Bebras UK, nicely demonstrates how to use the code editor/grader on this site:
NOTES:
- Don't include any printed messages or input prompts for your submissins - your only output must be the requested result.
- Constraints specified in the question do not need validating - they are just information about the range of test data.
- In a live competition, web searching & AI sites or copilots are not allowed.
- However you are allowed up to 20 sides of selected notes for your language - use your own OR our suggested Python set here (adapted with permission from Coding-Club Core Cards) OR the new EdExcel GCSE PLS might also be a useful choice.
- You are also allowed the official documentation for your language - for Python click here.
- Rough paper or calculators may be used if helpful.
- For a live competition you may discuss in your pairs but not between pairs and your teacher also wouldn't be able to help you (except for some silent pointing in R1 if you are finding it hard to get any points).
- Although you can code directly into the submission editor (and use the Run button before the Submit button to test with custom data), it is easier to use a coding environment such as an installed IDE or the Code Now area of our corresponding tutorial site pythonsponge or pynative. Sites which share code publically or have integrated AI (such as replit) are not allowed as code editors for a live competition.
CODE SNIPPETS:
All inputs should be read from standard in and outputs printed to standard out.
These examples all read a single integer and print double that number out.
Python:
num = int(input())
print(num * 2)
Java:
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
// Enter your code here
Scanner scanner = new Scanner(System.in);
int num = scanner.nextInt();
System.out.println(num * 2);
}
}
C#:
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static void Main(String[] args) {
// Enter your code here
int num = Int32.Parse(Console.ReadLine());
Console.WriteLine(num * 2);
}
}
VB.NET:
Module Solution
Sub Main()
' Enter your code here
Dim num As Integer = Integer.Parse(Console.ReadLine())
Console.WriteLine(num * 2)
End Sub
End Module
JavaScript (Node.js)
process.stdin.setEncoding('ascii');
var stdin = "";
var stdin_arr;
var prompt = () => stdin_arr.pop();
process.stdin.on('data', (data) => {stdin += data});
process.stdin.on('end', () => {stdin_arr = stdin.split("\n");stdin_arr.reverse();main()});
process.stdin.resume();
function main() {
// Enter your code here
var num = parseInt(prompt());
console.log(num * 2);
}
C++ 11:
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
// Enter your code here
string sNum;
getline(cin, sNum);
int num = stoi(sNum);
cout << num * 2 << "\n";
return 0;
}
Note: one advantage of using getline for c++ input is that when multiple values are provided on one line of input (e.g. 2 3 5 7) then you can easily read through to the next delimeter e.g.
getline(cin, sNum, ' ');
However, of course, you could also in this case just do the shorter:
#include <iostream>
using namespace std;
int main() {
// Enter your code here
int num;
cin >> num;
cout << num * 2 << "\n";
return 0;
}