exec_outcome
stringclasses
1 value
code_uid
stringlengths
32
32
file_name
stringclasses
111 values
prob_desc_created_at
stringlengths
10
10
prob_desc_description
stringlengths
63
3.8k
prob_desc_memory_limit
stringclasses
18 values
source_code
stringlengths
117
65.5k
lang_cluster
stringclasses
1 value
prob_desc_sample_inputs
stringlengths
2
802
prob_desc_time_limit
stringclasses
27 values
prob_desc_sample_outputs
stringlengths
2
796
prob_desc_notes
stringlengths
4
3k
lang
stringclasses
5 values
prob_desc_input_from
stringclasses
3 values
tags
listlengths
0
11
src_uid
stringlengths
32
32
prob_desc_input_spec
stringlengths
28
2.37k
difficulty
int64
-1
3.5k
prob_desc_output_spec
stringlengths
17
1.47k
prob_desc_output_to
stringclasses
3 values
hidden_unit_tests
stringclasses
1 value
PASSED
c8b7e28feb0621e163d6f444c51d0649
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.Random; import java.util.StringTokenizer; public class A { public static void main(String[] args) { FastReader scan = new FastReader(); PrintWriter out = new PrintWriter(System.out); Task sol...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
ea1fcf0ab092d227ab9add8a7eaa621a
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A { public static void main(String[]args){ MyScanner sc = new MyScanner(); int n = sc.nextInt(); for(int i=0;i<n;i++){ int c = sc....
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
813745a098597a63cb9d7c8275382acf
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { new Main().FunctionCall(); } void FunctionCall(){ Scanner scanner=new Scanner(System.in); int t=scanner.nextInt(); whil...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
70f610274f4851ff06dc49c3499f25fd
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader (new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); for (int i=0; i<t; i++) { String[] a...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
5328b89c9a5f0f6512f477287a7b8779
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.time.LocalTime; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class A { public static void main(String[] args) { FastScanner scan = new FastScanner(); PrintW...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
4c89c8159c87951e5609f441fcbabfaf
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
//package lovejava; import java.io.*; import java.math.BigInteger; import java.util.*; public class LoveJava { static int sum1 = 0; static int sum2 = 0; public static void main(String[] args) { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); Print...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
fa45e631fa0a85b37cd4c72b929b4b9a
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.util.*; import java.io.*; import java.util.Arrays; public class codeforces { static long[]fac=new long[200100]; static long[] two= new long[200100] ; static long mod=((int)1e9)+9; static String[]pow=new String[63]; static int[][]perm; static int[]a,pe; static int x=0; static int n,r; ...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
e5601810dcbbb1eb22eed96d3ceac8ce
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class Practice { public static long mod = (long) Math.pow(10, 9) + 7; // public static long mod2 = 998244353; // public static int ...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
9a4b83aa7a4f4e01145109c89310510c
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
//package codeforces; import java.util.*; import java.lang.*; import java.io.*; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreE...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
d1925c81972aad109f790d2745650cd7
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.util.*; public class Leetcode { public static void main(String[] args) { int a; int b; int c; Scanner scanner=new Scanner(System.in); c=scanner.nextInt(); while(c-->0){ a= scanner.nextInt(); b=scanner.nextInt(); ...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
619e18a86784766ab080bb1d3f966556
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.util.*; public class Main { public static void main(String args[] ) throws Exception { Scanner sc = new Scanner(System.in); try { int t = sc.nextInt(); while((t--)!=0){ int a=sc.nextInt(); int b=sc....
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
6b92a8b931df57b241eba8e406223c3b
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.io.*; import java.util.*; public class Sol { final static int LINE_SIZE = 128; FastReader in = new FastReader(); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out), false); void solve() throws Exception { long c = in.nextInt(); long d = in.next...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
50083139414a674d5ae4f5723b567657
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.util.*; import java.io.*; import java.math.BigInteger; public class _practise { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while ...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
c30b5f694b7bb2cefda64eab5808fc83
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.util.*; public class HelloWorld{ public static void main(String []args){ Scanner sc = new Scanner(System.in); int test =sc.nextInt(); int a=0; int b=0; for(int i=0;i<test;i++) { int c = sc.nextInt(); int d = sc.nextInt(); ...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
41053fdb914896fcfff27076f12d44fd
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { final static FastScanner scan = new FastScanner(); static void test() { int a = scan.nextInt(); int b = scan.nextInt(); if(Math....
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
b4f328af15110ed2a25a42999659db4b
train_107.jsonl
1630247700
William has two numbers $$$a$$$ and $$$b$$$ initially both equal to zero. William mastered performing three different operations with them quickly. Before performing each operation some positive integer $$$k$$$ is picked, which is then used to perform one of the following operations: (note, that for each operation yo...
256 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { FastScanner f= new FastScanner(); int ttt=1; ttt=f.nextInt(); PrintWriter out=new PrintWriter(System.out); outer: for(int tt=0;tt<ttt;tt++) { int a=f.nextInt(); int b...
Java
["6\n1 2\n3 5\n5 3\n6 6\n8 0\n0 0"]
1 second
["-1\n2\n2\n1\n2\n0"]
NoteLet us demonstrate one of the suboptimal ways of getting a pair $$$(3, 5)$$$: Using an operation of the first type with $$$k=1$$$, the current pair would be equal to $$$(1, 1)$$$. Using an operation of the third type with $$$k=8$$$, the current pair would be equal to $$$(-7, 9)$$$. Using an operation of the seco...
Java 8
standard input
[ "math" ]
8e7c0b703155dd9b90cda706d22525c9
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). Description of the test cases follows. The only line of each test case contains two integers $$$c$$$ and $$$d$$$ $$$(0 \le c, d \le 10^9)$$$, which are William's favorite numbers and which he wants...
800
For each test case output a single number, which is the minimal number of operations which William would have to perform to make $$$a$$$ equal to $$$c$$$ and $$$b$$$ equal to $$$d$$$, or $$$-1$$$ if it is impossible to achieve this using the described operations.
standard output
PASSED
862b2dc4f8fe28ca3ea84b07cadd7942
train_107.jsonl
1630247700
William really likes puzzle kits. For one of his birthdays, his friends gifted him a complete undirected edge-weighted graph consisting of $$$n$$$ vertices.He wants to build a spanning tree of this graph, such that for the first $$$k$$$ vertices the following condition is satisfied: the degree of a vertex with index ...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.ArrayList; import java.io.OutputStream; import java.io.PrintStream; import java.io.IOException; import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.io.Unchecke...
Java
["10 5\n5 3 4 2 1\n29 49 33 12 55 15 32 62 37\n61 26 15 58 15 22 8 58\n37 16 9 39 20 14 58\n10 15 40 3 19 55\n53 13 37 44 52\n23 59 58 4\n69 80 29\n89 28\n48"]
6 seconds
["95"]
null
Java 11
standard input
[ "graphs", "greedy", "math", "probabilities" ]
d870600853fa87cce3e0b4a985bcc5c8
The first line of input contains two integers $$$n$$$, $$$k$$$ ($$$2 \leq n \leq 50$$$, $$$1 \leq k \leq min(n - 1, 5)$$$). The second line contains $$$k$$$ integers $$$d_1, d_2, \ldots, d_k$$$ ($$$1 \leq d_i \leq n$$$). The $$$i$$$-th of the next $$$n - 1$$$ lines contains $$$n - i$$$ integers $$$w_{i,i+1}, w_{i,i+2}...
3,300
Print one integer: the minimum weight of a spanning tree under given degree constraints for the first $$$k$$$ vertices.
standard output
PASSED
7740066b3ed4d6dc5e2d0f9474b0bae1
train_107.jsonl
1630247700
As mentioned previously William really likes playing video games. In one of his favorite games, the player character is in a universe where every planet is designated by a binary number from $$$0$$$ to $$$2^n - 1$$$. On each planet, there are gates that allow the player to move from planet $$$i$$$ to planet $$$j$$$ i...
1024 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.ArrayList; import java.io.OutputStream; import java.io.PrintStream; import java.io.IOException; import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.io.Unchecke...
Java
["3 3\nask 0 7\nblock 3 6\nask 0 7", "6 10\nblock 12 26\nask 44 63\nblock 32 46\nask 1 54\nblock 27 30\nask 10 31\nask 11 31\nask 49 31\nblock 31 31\nask 2 51"]
4 seconds
["1\n0", "1\n1\n0\n0\n1\n0"]
NoteThe first example test can be visualized in the following way: Response to a query ask 0 7 is positive.Next after query block 3 6 the graph will look the following way (destroyed vertices are highlighted): Response to a query ask 0 7 is negative, since any path from vertex $$$0$$$ to vertex $$$7$$$ must go throug...
Java 11
standard input
[ "bitmasks", "data structures", "dsu", "two pointers" ]
327718077f69c0ed1c48acaf09b8e576
The first line contains two integers $$$n$$$, $$$m$$$ ($$$1 \leq n \leq 50$$$, $$$1 \leq m \leq 5 \cdot 10^4$$$), which are the number of bits in binary representation of each planets' designation and the number of queries, respectively. Each of the next $$$m$$$ lines contains a query of two types: block l r — query fo...
3,300
For each query of type ask you must output "1" in a new line, if it is possible to reach planet $$$b$$$ from planet $$$a$$$ and "0" otherwise (without quotation marks).
standard output
PASSED
f47ce88eb6d38583ef4ae2a9f905daf3
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class InterestingSum { public static void main(String[] args) { Scanner sc=new Scanner(System.in); String[] s=new String[650]; //System.out.println("Enter the number of test cases:"); int n1=sc.nextInt(); String[] s1=new String[n1]; //System.out.prin...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
6ca231797fba82a36e5c9ea2668b7d65
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { String s = sc.next(); int res = (26 * (s.charAt(0) - 'a')) + (s.charAt(1) - 'a'); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
bf474b8116264a774c2ced9cb532b860
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class B_Dictionary { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- != 0) { String s = sc.next(); int a = s.charAt(0) - 'a' + 1, b = s.charAt(1) - 'a' + 1; ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
be80197e0d82937a005a421913e2d205
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class B_Dictionary { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- != 0) { String s = sc.next(); int a = s.charAt(0) - 'a' + 1, b = s.charAt(1) - 'a' + 1; ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
bc83599005aa75ca2a5713215fc0da84
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; public class Main { private static class Task { public void solve(int testNumber, InputReader in, PrintWriter out) { char[] word = in.next().toCharArray(); int p = word[0] - 'a', q = word[1] - 'a'; if (p == 0) { ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
89153a6846d5ce4d2b180f824ef1f16e
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Scanner; import java.util.HashMap; public class Solution { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int index = 1; HashMap<String, Integer> dictionary = new HashMap<>(); for (char i = 65; i <= 90; i++) { for (...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
839a6d9a8ef4497266a365196804b9ae
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
//package com.company; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class Demo { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-- > 0){ ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
3c767f2e986e93aab1439bed3d2fab11
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class _1674B_Dictionary { public static void main(String[] args) { ArrayList<String> dic = new ArrayList<>(); for (char i = 'a'; i <= 'z'; i++) { for (char j = 'a'; j <= 'z'; j++) { if (i == j) { continue; ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
b16de7d10d49ec508b395f471d66fdf3
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args){ MyScanner scanner = new MyScanner(); int testCount = scanner.nextInt(); for(int testIdx = 1; testIdx <= testCount; testIdx++){ String s = scanner.nextLine(); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
66a387562591e16065472363198f8859
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Scanner; public class Dictionary { public static void main(String[]args) { Scanner sn = new Scanner(System.in); int t = sn.nextInt(); sn.nextLine(); for(int i =0; i<t; i++) { String word = sn.nextLine(); char ch1 = word.charAt(0); char ch2 = word.charAt(1); int sum = 0;...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
e31d2d627bf5d7975fb244ad16511cae
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; public class Main { public static void main(String[] args) throws IOException { ArrayList<String> list = new ArrayList<>(); for(int j = 97; j <= 122; j++){ for(int k = 97; k <=122;...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
0ed8913eb527a6a6b800c20f3e54aeba
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int tc= sc.nextInt(); while(tc > 0){ tc--; String s = sc.next(); int c1 = s.charAt(0)-'a'; int c2 = s.charAt(1)-'a';...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
9c4eb7bc1ba09fa393f2d0d7d6d3ed0a
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class Solution{ public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); s.nextLine(); while(n!=0) { --n; String r=s.nextLine(); int y=(r.charAt(0)-97)*25+(r.cha...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
132707b40944b15631ce73aaa03e4ba7
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class CF1674B { public static void main(String[] args) { Scanner scanner = new Scanner(System.in, StandardCharsets.UTF_8); int t = scanner.nextInt(); for (int ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
c7358020f1b967cddb0487ea780a16cc
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class Testing { public static void main(String[] args) { Scanner s = new Scanner (System.in); int t=s.nextInt(); for(int i=0;i<t;i++){ String input=s.next(); int x=(int)(input.charAt(1)-97)-(input.charAt(0)-97); if(input.charAt...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
fd5db711bbdc6f5245adf6aea2a1d067
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Solution { private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static PrintWriter pw = new PrintWriter(System.out); static v...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 17
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
8b4d050348424507b0bdae3aee68f337
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Scanner; public class Diccionary { public static void main(String args[]){ Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); while(n-->0){ int c, d; String a = scanner.next(); if(a.charAt(0)=='a') ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
0c3d069f0b8c30ac94b8f55bcef2772b
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.HashMap; import java.util.Scanner; public class codeforcesdiv3 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); scan.nextLine(); for(int i = 0; i < n; i++){ String s = scan.nextLine(); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
800a4607719983d1e3cd56f40732e800
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void solution(String str) { HashMap<Character,Integer> hm=new Hash...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
b69ef37dfc23689ed6fc562815fa9f60
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class Practice { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); while(t--!=0){ String val = sc.nextLine(); int ans = (val.charAt(0)-'a')*25; ans+=va...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
5eb1b15ad028f42e5abe6fc6aa0ac3e6
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.BufferedReader; import java.io.PrintWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class Test { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); Pri...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
d0c24065d88ca167513499d806a8a73c
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class DictionarySolution2 { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int tc = Integer.parseInt(reader.readLine()); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
edba3367d037dd1d80a10bf681ecff07
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; public class DictionarySolution1 { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int tc = Integer.parseInt(reader.readLine()); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
43e9cabf3779ca2f9f969f74c689fc65
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class dict { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); sc.nextLine(); while(t-->0) { String s=sc.nextLine(); if(s.charAt(0)>s.charAt(1)) ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
20678b2ba32e21af90cbf207501e3d30
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; import javax.lang.model.util.ElementScanner6; import javax.sound.midi.SysexMessage; import...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
bb22e79e37948944c8c772f467d0aa74
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.lang.*; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Scanner; public class Last { static Scanner sc = new Scanner(System.in); static int I() { return sc.nextInt(); } static long L() { return sc.nextLong()...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
bdeb3c82dbba7f0c4e1a6f5acd98f354
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
/*Author: Jatin Yadav*/ import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class Main{ static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private by...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
2b791fd48e855847d5d8115cc6c81f64
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; public class Solution{ public static void main(String[] args) throws IOException { FastScanner f= new FastScanner(); int ttt=1; ttt=f.nextInt(); PrintWriter out=new PrintWriter(System.out); outer: for(int tt=0;tt<ttt;tt++) { char[] l=f.next().toCharArray...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
1d812ecba6098b778b37b5694a41e66e
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; public class Dictionary { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out)); String Eng [] = {"a" , "b" ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
6c4a73e10ca20036c9ae29dffedf662b
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.math.*; import java.util.*; /* * Author: Atuer */ public class Main { // ==== Solve Code ====// static int INF = 2000000010; public static void csh() { } public static void main(String[] args) throws IOException { // csh(); int t = in.nextInt(); while (t-- > 0) { ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
60dc012e51f8aeef72f8285071ea668e
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.math.*; import java.util.*; /* * Author: Atuer */ public class Main { // ==== Solve Code ====// static int INF = 2000000010; public static void csh() { } public static void main(String[] args) throws IOException { // csh(); int t = in.nextInt(); while (t-- > 0) { ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
8af4eaee534b4174665dd6c5d1a3e614
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; import javax.sound.midi.Soundbank; public class dictionar { public static void main(String[] args) { String[] str= new String[650]; for(int i=0;i<650;i++) { str[i]=""; } int c=0; for(char ch='a';ch<='z';ch++) { ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
7547ac5a71b2ee8d189c931d4b9cc6d2
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Dispatcher { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); scan.nextLine(); for(int i=0;i<t;i++) { String a = scan.nextLine(); int c = a.valu...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
414e45f7158ad03789302a9781b2d35a
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; import java.io.*; public class lab_1 { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int start = 0; int diff = 0; int dec = 0; int second = 0; for(int i = 0;i<t;i++) {dec = 0; String s = sc....
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
f8ea5e915290bb035f74b5499e555f50
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Scanner; public class Dictionary { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while (t-->0){ String s=sc.next(); char first = s.charAt(0); char second = s.charAt(1); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
f3de5f8434b41b3dc7355e52913c23e5
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int t= sc.nextInt(); while(t-- >0){ String str= sc.next(); int ans = 25*(str.charAt(0)-97)+(str.charAt(1)-97); if(str.charAt(0)...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
409195beb7125f7cc801f4ea62787e90
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.lang.reflect.Array; import java.util.*; import java.lang.*; import java.io.*; import java.util.StringTokenizer; import java.util.Collections; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
17fa54781dcce8a0d5f6ee60e42148b2
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Scanner; public class CODE_FORCES { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int size = scanner.nextInt(); String[] words = new String[size]; for (int i = 0; i < size; i++) { words[i] = scanner.next(); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
9218901c1f3b8a2f448d536e37252b6d
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class B_1674 { public static void main(String args[]) { Scanner sc=new Scanner(System.in); String[] arr=new String[650]; int n=0; for(int i=97;i<123;i++) { for(int j=97;j<123;j++) { if(i==j) continue; arr[n]=String.valueOf((char)i)+String.valueOf((char)j); n+...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
f5daf03686e77629d42016b270228254
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class B_1674 { public static void main(String args[]) { Scanner sc=new Scanner(System.in); String[] arr=new String[650]; int n=0; for(int i=97;i<123;i++) { for(int j=97;j<123;j++) { if(i==j) continue; arr[n]=String.valueOf((char)i)+String.valueOf((char)j); n+...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
a0ad7f3f98af5e4fad6bb2410247fee9
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class CF_1674B { static void shinchan() { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); while(T>0) { String s = sc.next(); int res = (s.charAt(0)-'a')*26+(s.charAt(1)-'a'); if(s.charAt(0)<=s.charAt(1)) { res-=Math.max(0, (s.charAt(0)-'a')); }e...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
72488877d016cfe091e95cb52056fea0
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class class428 { public static void main(String arg[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { String s=sc.next(); int val=s.charAt(0)-'a'; int f=25*val; for(int i=0;i<26;i++) { char c=(char)('a'+i); if(c==s.charAt(...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
3ac29ed2d98b2aa3286f19e60c002a82
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.HashMap; import java.util.StringTokenizer; public class B { static Scanner sc = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); static HashMap<String, Integer> map = new HashMap<>(); static void genWords() { int i = 1;...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
43539dbb3e4404851d0df62df53d1e23
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
/** * User: Jameel Sawafta * Date: 5/2/2022 * Time: 8:02 PM * ProblemLink:https://codeforces.com/contest/1674/problem/B */ import java.math.BigInteger; import java.util.ArrayList; import java.util.Random; import java.util.Arrays; import java.util.Collections; import static java.lang.Integer.parseI...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
d0850ef43be9929309ee5ccd00d1e2bc
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Dictionary_1674B { private static Map<String,Integer> map = new HashMap<>(); private static void dict(){ int cnt = 1; String s = "abcdefghijklmnopqrstuvwxyz"; for (int i = 0; i < 26; i++) { ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
a9f28a60ee61cf1bde519890d167f096
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Dictionary_1674B { private static Map<String,Integer> map = new HashMap<>(); private static void dict(){ int cnt = 1; String s = "abcdefghijklmnopqrstuvwxyz"; for (int i = 0; i < 26; i++)...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
dd0e6e0b4fafc4263605221b2b4bdf7e
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); String z = sc.nextLine(); while(t >0){ t--; String s = sc.nextLine(); char first = s.ch...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
e5a07523fb15c103ca20a8f9de714ebf
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Scanner; public class Dictionary { public static void main(String[] args) { Scanner input = new Scanner(System.in); int test = input.nextInt(); for (int i = 0; i < test; i++) { String number = input.next(); String[] nums = number.split(""); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
705cc2eb23a80b2fb791edeed5337380
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.*; import java.lang.Math; import java.util.StringTokenizer; public class B { public static void main(String[] args) { int b, t; char a[]; String str; ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
fda342e7ecf207be28df5216d8c73d2b
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.ArrayList; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); ArrayList<String> arrayList = new ArrayList<>(); scanner.nextLine(); for (int ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
980ea8880da1758051108297935a1b11
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class Dictionary { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int tests = scn.nextInt(); scn.nextLine(); for(int t=0;t<tests;t++){ String str = scn.nextLine(); int a = str.charAt(0)-96; ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
ba42ab3545436aa8e6426a61696de855
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; import javax.swing.plaf.synth.SynthScrollPaneUI; public class B_Dictionary{ static Scanner sc = new Scanner(System.in); // @Harshit Maurya public static void reverse(int[] arr, int l, int r) { int d = (r - l + 1) / 2; for (int i = 0; i < d; i++) { int t = arr[l + i]; ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
a2f442d5db47d144c0c1505b0f275bde
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
//package Codeforces; import java.io.*; import java.util.*; public class B { public static void main (String[] Z) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringBuilder op = new StringBuilder(); StringTokenizer stz; ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
caecb22bcd06ce8e1440db214df0e8cc
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; import java.lang.Math.*; public class Main { public static void main(String[] args) throws IOException { int t = nextInt(); for (int i = 0; i < t; i++) { String s = next(); if(s.charAt(0) < s.cha...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
0097c4870a655b446dc0c2fdaca8ef2c
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.security.KeyPair; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Stack; ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
6296261f3f858a09f4d4dfca41bb9477
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
//package com.company; import java.io.*; import java.util.*; public class Cf_0 { private static class FastReader { InputStream is; private byte[] inbuf = new byte[1024]; private int lenbuf = 0, ptrbuf = 0; public FastReader(InputStream is) { this.is = is; ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
9d2b9d31a505bc56e031d3d280b86c1f
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { public static void main(String[] args) throws IOException { OutputStreamWriter osr = new OutputStreamWriter(System.out); PrintWriter o = new PrintWriter(osr); FastReader fr = new FastReader(); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
7ce38f6a193f97a4f40a06fa810beb44
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; import java.io.*; public class Dictionary { public static void main(String[] args) { try { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); int testcases = in.nextInt(); while (testcases-- > 0) { String s = in.next(); char[] a = s.to...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
6191087a77793c2ef67f4ce93960821b
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; import java.io.*; public class B { public static void main(String[] args) throws IOException { FastReader in = new FastReader(System.in); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out)); int t = in.nextInt(); for (int tt = 0; tt < t...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
39b27fc8268353135590952df49de4be
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Integer t = scanner.nextInt(); while (t-- > 0) { Integer sum =0; String text = scanner.next(); int f...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
8cf39da56f61fab8e1a3f2fe3fe00332
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args){ MyScanner scanner = new MyScanner(); int testCount = scanner.nextInt(); for(int testIdx = 1; testIdx <= testCount; testIdx++){ String s = scanner.nextLine(); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
c87cb28463aac04f85c38c8a109dc544
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
//package combinatorics; import java.util.Scanner; public class CF1674B { public static Scanner scanner; public static void main(String[] args) { scanner = new Scanner(System.in); int n = scanner.nextInt(); for(int i = 0; i < n; i++) { String str = scanner.next(); int res = (str...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
5a2ebfdf434327ca3a754c568fe357e7
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Scanner; public class Solution { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int t = scan.nextInt(); while(t-->0) { char[] s = scan.next().toCharArray(); int result = (s[0] - 'a') * 25; result += (s[0] <= s[1]) ? (s[1]-'a'):(s[1]-'a' + 1); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
f0b69801617ef10d08b46fcc363863a9
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { public static void main(String [] args) { FastScanner fs=new FastScanner(); PrintWriter out=new PrintWriter(System....
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
5c9384602132e21c6c50d1299513e970
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class Solution { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0) { String s=sc.next(); char first=s.charAt(0); int initial=25*(first-97); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
45c59d9fed44b7d5c9fec02b80b488cc
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; public class B_Dictionary { public static void main(String[] args) { FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); // try { // out = new PrintWriter("output.txt"); // } catch (Exception e) ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
b4ddd3cb5ad7ad50c6c5b7e274bcbb10
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws IOException { InputStreamReader is = new InputStreamReader(System.in); BufferedReader br = new BufferedReader(is); Scanner sc = new Scanner(System.in); //int test_case =...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
d8d8366bbf231d1ca636cf2159b28264
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(new BufferedInputStream(System.in)); int t = in.nextInt(); Map<String, Integer> mp = new HashMap<>(); int count = 0; for (int i = 0; i < 26; ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
24db4570809ffd5391bed52eda4c099f
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Scanner; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.nio.charset.MalformedInputException; import java.util.StringTokenizer; import java.util.Arrays; public class Cv { public static void main(String[] ar...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
8a8fd286c628fac5d60a4453ddda2004
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java.util.Arrays; /* Name of the class has to be "Main" only if the class is public. */ public class Codechef { public static void main (String[] args) throws java.lang.Exception { // ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
97dbc83008c57b747b558514df3d48c0
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { static class Reader { BufferedReader reader= new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tokenizer = new StringTokenizer(""); ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
d23d37a9bede12c23fb6cb2d064a96a6
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); while (t-- > 0) { String s = sc.nextLine(); char[] ch = s.toCharArray(); int position1 = (int) ch[0] - 96; int...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
a0063657787e839f18cea068b5753189
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import static java.lang.System.out; import java.util.*; import java.io.*; import java.math.*; public class Main { static FastScanner scan = new FastScanner(); public static void main(String[] args)...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
0ea661e94c9c44009fa1608585baa1ec
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; public final class Main { //int 2e9 - long 9e18 static PrintWriter out = new PrintWriter(System.out); static FastReader in = new FastReader(); static Pair[] moves = new Pair[]{new Pair(-1, 0), new Pair(0, 1), new Pair(1, 0), new Pair(0, -1)}; static...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
ba730f363194a6449fefd12d775f4507
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Random; import java.util.Stack; import java....
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
8ec4704540b388f65b14ba2632ce5399
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; import java.util.StringTokenizer; public class Dict implements Runnable { public static void main(String [] args) { new Thread(null, new Dict(), "whatever", 1<<26).start(); } public void run() { FastScanner scanner = new FastScanner(System.in...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
24942fd718ad7d59850faff5f1984277
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class Main { public Main() { FastScanner input = new FastScanner(...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
c4669f66b8cc262a7100d24eef87563a
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.io.*; import java.util.*; /* */ public class B{ static FastReader sc=null; public static void main(String[] args) { sc=new FastReader(); int t=sc.nextInt(); for(int tt=0;tt<t;tt++) { char a[]=sc.next().toCharArray(); int pos=(a[0]-'a')*26+(a[1]-'a'); int ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
c50099c8c4b409c63a10122d974bd52f
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; import java.io.*; public class B { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
a36ce975e4e4bc0cb19435a6f5ee051f
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.Arrays; import java.util.Scanner; public class Demo { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tc = sc.nextInt(); for (int itc=0; itc<tc; itc++) { String s = sc.next(); char a = s.charAt(0); char b = s.charAt(1); int t = ((a-97)*...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
e452d8d3ebe986348e90a6a087a9888c
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.*; public class dictionary{ public static void main(String [] args){ Scanner sc = new Scanner(System.in); int t = sc.nextInt(); sc.nextLine(); while(t-->0){ String s = sc.nextLine(); int sum = (s.codePointAt(0)-97)*25; if(s.codePointAt(1)<s.codePointAt(0)){ ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output
PASSED
7114b28fdf9f1a30b54b2a8ee1cf60ad
train_107.jsonl
1651502100
The Berland language consists of words having exactly two letters. Moreover, the first letter of a word is different from the second letter. Any combination of two different Berland letters (which, by the way, are the same as the lowercase letters of Latin alphabet) is a correct word in Berland language.The Berland dic...
512 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class Dictionary { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); Map<Character, Integer> letters = new HashMap<>(); letters.put('a', ...
Java
["7\n\nab\n\nac\n\naz\n\nba\n\nbc\n\nzx\n\nzy"]
2 seconds
["1\n2\n25\n26\n27\n649\n650"]
null
Java 8
standard input
[ "combinatorics", "math" ]
2e3006d663a3c7ad3781aba1e37be3ca
The first line contains one integer $$$t$$$ ($$$1 \le t \le 650$$$) — the number of test cases. Each test case consists of one line containing $$$s$$$ — a string consisting of exactly two different lowercase Latin letters (i. e. a correct word of the Berland language).
800
For each test case, print one integer — the index of the word $$$s$$$ in the dictionary.
standard output