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
1ddbba229965e499920e6e909953f72a
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.io.IOException; import java.io.UncheckedIOException; import java.io.Closeable; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.InputStream; /**...
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output
PASSED
6e2ff9b28c902cf937021d76304e695e
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.FileNotFoundException; import java.io....
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output
PASSED
ac538393dd8a7d671bbaa66e859ea1d9
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.io.BufferedReader; impo...
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output
PASSED
54554cc6e74408b3d0ebf9b220c00849
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
import java.io.*; import java.util.*; public class F implements Runnable { public static void main (String[] args) {new Thread(null, new F(), "_cf", 1 << 28).start();} int MAX = 4000; int[] fact, invFact; public void run() { FastScanner fs = new FastScanner(); PrintWriter out = new PrintWriter(System.out); ...
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output
PASSED
696b3ad987cf9739f72dbd4bafde7f82
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.Input...
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output
PASSED
c88bb8940f0e768a686412ef8809a888
train_001.jsonl
1571236500
Consider a square grid with $$$h$$$ rows and $$$w$$$ columns with some dominoes on it. Each domino covers exactly two cells of the grid that share a common side. Every cell is covered by at most one domino.Let's call a placement of dominoes on the grid perfectly balanced if no row and no column contains a pair of cells...
512 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper...
Java
["5 7 2\n3 1 3 2\n4 4 4 5", "5 4 2\n1 2 2 2\n4 3 4 4", "23 42 0"]
2 seconds
["8", "1", "102848351"]
NoteIn the first example, the initial grid looks like this:Here are $$$8$$$ ways to place zero or more extra dominoes to keep the placement perfectly balanced:In the second example, the initial grid looks like this:No extra dominoes can be placed here.
Java 8
standard input
[ "dp", "combinatorics" ]
76fc2b718342821ac9d5a132a03c925e
The first line contains three integers $$$h$$$, $$$w$$$, and $$$n$$$ ($$$1 \le h, w \le 3600$$$; $$$0 \le n \le 2400$$$), denoting the dimensions of the grid and the number of already placed dominoes. The rows are numbered from $$$1$$$ to $$$h$$$, and the columns are numbered from $$$1$$$ to $$$w$$$. Each of the next $...
2,600
Output the number of ways to place zero or more extra dominoes on the grid to keep the placement perfectly balanced, modulo $$$998\,244\,353$$$.
standard output
PASSED
b1842869479e2cbcb29d87cbf8fd1fd1
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.io.*; import java.util.*; public class A { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); int n=Integer.parseInt(bu.readLine()),a[][]=new int[n][2],i,j; for(i=0;i<n;i++) { St...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
1a2d4ae80da823ebcd6ec296ee5cf08e
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Comparator; import java.util.Scanner; import java.util.stream.IntStream; public class TheRank { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int nrRows = scanner.nextInt(); final int[][] grid = IntStream.range(0, nrRows) ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
16f7f25ddc510bc2fe97f685c861e975
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.PrintStream; import java.util.Arrays; import java.util.Scanner; public class Main implements Runnable, AutoCloseable { Scanner in = new Scanner(new BufferedInputStream(System.in)); PrintStream out = new PrintStream(new Buff...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
3cb4bbd6e42a9a551d181430e9458d1f
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.net.StandardSocketOptions; public class Main { static long sx = 0, sy = 0, mod = (long) (998244353); static ArrayList<Integer>[] a; // static ArrayList<Long> p; static HashMap<ArrayList<Integer>, Long> hm = new HashMap<>(); static Double[][]...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
7eb615192c4dd332f0f304b6dab8ec50
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; import java.math.BigDecimal; import java.math.BigInteger; public class JavaApplication9 { //******************************************************************...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
20c132be7f5c0df2cd8169e4f3c03450
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class Rank{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int x[] = new int[n]; for(int i = 0; i< n; i++){ for(int j = 0; j< 4; j++) x[i] += sc.nextInt(); } in...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
b817dbde16a1dae53c1282b495e585ff
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
//package com.baba; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int sum = s.nextInt() + s.nextInt() + s.nextInt() + s.nextInt(); int ans = 1; for (int i = 1; i < n; i++) { ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
9e00976051ace67d42d270344f5c14bb
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
//package com.baba; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int[] arr = new int[n]; int i = 0; while (n-- > 0) { arr[i] += s.nextInt...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
75f76c67b83a3ceadebfcd6b1e593c82
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class The_Rank { public static void main(String args[]) { Scanner reader = new Scanner(System.in); int n = reader.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) for (int j = 0; j < 4; j++) a[i] += reader.ne...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
79118706e6933c203648c9ad9cacde5a
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.*; public class rank { public static void main(String args[]) { Scanner s=new Scanner(System.in); int a,b,c,d,n,i; n=s.nextInt(); int sum[]=new int[n]; a=s.nextInt(); b=s.nextInt(); c...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
a7fb082fefd8447ef1524d71b233f302
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; import java.lang.*; public class codejam { public static void main(String[] args) { // the code goes here// Scanner in=new Scanner(System.in); int n,s=0,c=1,max=0; n=in.nextInt(); int num=0; for(int i=1;i<=n;i++) { int a1,b1,a2,b2; a1=in.nextInt(); b1=in.nextInt(); a2=i...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
5404046635e69dbf7b3bba19973e3198
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; import java.lang.*; public class codejam { public static void main(String[] args) { // the code goes here// Scanner in=new Scanner(System.in); int n,s=0,c=1,max=0; n=in.nextInt(); int num=0; for(int i=1;i<=n;i++) { int a1,b1,a2,b2; a1=in.nextInt(); b1=in.nextInt(); a2=i...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
bbe5cca15a0b903dd099758e62ab59c0
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import org.w3c.dom.ls.LSOutput; import java.security.MessageDigest; import java.util.*; import java.math.*; import java.lang.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); ArrayList<Integer> a = new ArrayList<> ()...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
87d27e7a3a698584c4ec9cdc8da6cdfc
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class Rank_1017A { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int a = s.nextInt(); int b = s.nextInt(); int c = s.nextInt(); int d = s.nextInt(); int ts = a+b+c+d; ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
f322fa8a400aedc4f70d8a6849a1716a
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[] x=new int[n]; for(int i=0;i<n;i++) { for(int j=0;j<4;j++) { x[i]+=sc.nextInt(); } } int sum=1; for(int i=0;i<n;i++) { if(i!=0) { if(x[i]>x[0]) ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
9f47bb5fd164dd5882d812d36527eb35
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Scanner; public class TheRank { public static void main(String[]args) { Scanner s = new Scanner(new BufferedReader(new InputStreamReader(System.in))); int n=s.nextInt(); int cnt=1; int thomas=s.nextInt...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
662ae70da4c7e3a6dc6e9a24235cd58d
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class The_Rank_1017A { public static void main(String[] args) { int num, id= 0; int[][] estudiantes; int suma[]; Scanner scanner = new Scanner(System.in); num = scanner.nextInt(); estudiantes= new int[num][4]; suma = new int[num]; if(num>=1&&num<=1000) { //Pon...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
870532b20189ccf6859bdb033a649caf
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class THERank { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int rank=1; long sum=0; int x=1; int n=sc.nextInt(); for(int i=0;i<n;i++){ long a=sc.nextLong(); long b=sc.nextLong();...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
a6fa5c73042c77ca0d12007836691c08
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class test { static Scanner sc = new Scanner(System.in); static int read() { final int r1 = sc.nextInt(), r2 = sc.nextInt(), r3 = sc.nextInt(), r4 = sc.nextInt(); return r1 + r2 + r3 + r4; } public static void main(final String[] args) { final i...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
4fcfcf442f13b8b9caf4bdf923747f58
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
// practice with kaiboy import java.io.*; import java.util.*; public class CF1017A extends PrintWriter { CF1017A() { super(System.out, true); } Scanner sc = new Scanner(System.in); public static void main(String[] $) { CF1017A o = new CF1017A(); o.main(); o.flush(); } void main() { int n = sc.nextInt(); in...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
13b6e3754c7683ab0e107213e4111ce4
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class TheRank { public static void main(String[] args) { Scanner input=new Scanner(System.in); int n,max=0,m=1,i; n=input.nextInt(); for ( i = 0; i < n; i++) { int a,b,c,d,sum=0; a=input.nextInt(); b=input.nex...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
631db5ad5af9e94ecd587eb33469134b
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main{ static void solve(){//Here is the main function int N = nextInt(); Node[] list = new Node[N]; for(int i = 0; i < N; i++){ ArrayList<Integer> tmp = nextIntArray(); int sum = tmp.get(0) + tmp.get(1) + tmp.get(2) + tmp.get(3); lis...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
b1111548d5550bcac3448b31a9c2af69
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int[] total = new int[n - 1]; int a = input.nextInt(); int b = input.nextInt(); int c = input.nextInt(); i...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
63b693d16af70f0c0b222721caa5dc8c
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int a = input.nextInt(); int b = input.nextInt(); int c = input.nextInt(); int d = input.nextInt(); int to...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
02816fbf7864aaf174c913da4a8a290f
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class Scanner { BufferedReader br; StringTokenizer st; Scanner() { br = new BufferedReader(new InputStrea...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
92a22214f1b5d01db8b1b3de0c6d4fb3
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Arrays; import java.util.Collections; import java.util.Scanner; public class The_Rank { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int no = sc.nextInt(); Integer a[] = new Integer[no]; for(int i=0;i<no;i++) { i...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
78d08211ac70a245f4fc2b13d7332daa
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; import java.io.*; //***************** Agar firdaus bar roo-e zameen ast,Hameen ast-o hameen ast-o hameen ast. *****************\\ public class Main{ public static long fast_exp(long base, long exp) { long MOD = 1000000007; long res=1; while(exp>0) { if...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
83c6245ed0f61b868567b443fd89d453
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class Test { static class Student { int id, marks; Student(int id, int marks) { this.id = id; this.marks = marks; } } static int searchThomas(Student[] arr) { for(int i = 0; i < arr.length; i++) if(arr[i].id == 1) return i + 1; return 0; } public static void m...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
035cef4b1f584a0bc1ee6780f3f73c14
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import java.lang.*; public class Main{ static long mod = 1000000007; static InputReader in = new InputReader(System.in); static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args)...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
48447a9578c6958958f55793211449ea
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); Integer[] marks = new Integer[n]; for(int k = 0; k < n;k++){ int sum = 0,stud[] = new int[4]; for(int i = 0; i < 4; i++){ stud[i] = sc...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
d3b6b4fce00b7a75fa565632eb47a3aa
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class August { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int rank = 1,a,b,c,d,sum; a = input.nextInt(); b = input.nextInt(); c = input.nextInt(); d = input.nextInt(); sum = a + b + c + d;...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
34e744cf8cce4e7f6ddaa51e36c74c2e
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class TheRank { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList<Integer> arr = new ArrayList<>(); ArrayList<Integer> ids = new ArrayList<>(); for (int i = 0; i < n; i++) { ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
7fc1b3ecd508c9b9ed2249159319fc4d
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[4*n]; int[] arr2 = new int[n]; int a=0; for (int i=0;i<4*n;i++) arr[i]=sc.nextInt(); for (int i=0;i<4*n;i=i+4) { arr2[a]=arr[i]+arr[i+...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
ecfdbf1154f853c9d9b828c99cc51f29
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int[] arr = new int[n]; for(int i = 0; i < n; i++){ for(int j = 0; j < 4; j++){ arr[i] += in.nextInt(); } } in...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
0acbca82251901c8148c1e7940caefe1
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class rank { public static void main(String[] args) { int temp,k,rank=0; Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int marks_sum[] = new int[n]; int id[] = new int[n]; for(int i=0;i<n;i++){ int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.ne...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
9bbf4634084708667684d1a662dd43f4
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class TheRank { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int thomasScore = s.nextInt() + s.nextInt() + s.nextInt() + s.nextInt(); int rank = 1; for (int i = 1; i < n; ++i) { int score = s.nextInt() + s.nextI...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
d0dddce7c4ab176c084bd7c7ba48ac8b
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; public class B implements Runnable { public void run() { final InputReader sc = new InputReader(System.in); final PrintWriter out = new PrintWriter(System.out); int n=sc.nextInt(); ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
ae0e8fc8b9092b7ced3294911ada91be
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class Tomas { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int[] massiv=new int[n]; for(int i=0;i<n;i++){ int j=sc.nextInt(); int k=sc.nextInt(); int l=sc.nextInt(...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
bfa28ad1e79b128c9a99760a6a92f97b
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int max = 0; int[] sum = new int[n]; int rank = 1; for(int i=0; i<n; i++) { ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
d71ecbada5edc22bd16a034c75423c0b
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.StringTokenizer; public class A { public static void main(String args[])throws Exception{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st=new StringTokenizer(br.readLine()); ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
25c654a2e04f371f49b428a3221c76fd
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class codeForces { public static void main(String[] args){ Scanner s=new Scanner(System.in); int n=s.nextInt(); int count=1; int sum1=0; int sum2=0; // int x=Integer.parseInt(str[1]); int a[][]=new int[n][4]; for (int i...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
f0aab51012adeb2f79d47be3b9339573
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
/* package codechef; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; import java.util.Arrays; import java.math.BigInteger; /* Name of the class has to be "Main" only if the class is public. */ public class Main { public static void main (String[] args) throws java.lang....
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
d2e29676049ea5d53ab1156a3fcf5cd8
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; public class A1017_TheRank { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); List<Integer> scores = new ArrayList<>(); ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
e4b404dc09dc2add3747ded808df3d11
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class codeforces { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); int s = 0; int c = 1; int max = 0; for(int i =1; i<=n; i++) { int a...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
7a73a542df6c639f721aa73d09a900c1
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int t = Integer.parseInt(scan.nextLine()); int[] scores = new int[t]; for (int i = 0; i < t; i++) { for (int j = 0; j < 4; j++) { ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
416e0ec3954731a472997d0b96020e96
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.Scanner; import java.util.Arrays; public class Main{ public static void main(String[]args){ Scanner go = new Scanner (System.in); int t = go.nextInt(); int []arr = new int[t]; int pos = 0; for (int tc = 0; tc < t; tc++){ int d = go.nextInt(), f= go.nextInt(), g= go.nextInt(), h= go.nextI...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
1d216f79c3a3f7f7cb846a3d3ac6786f
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class div { private static Scanner sc = new Scanner(System.in); private static Map<Character, Integer> m = new HashMap<>(); private static List<Integer> l = new ArrayList<>(); private static int sum = 0; public static void main(String[] args) { int n = sc.nextIn...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
cf49284b62b1889c77faad96a695755d
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class problem1372A25 { private static Scanner sc=new Scanner(System.in); public static void main(String[] args) { // int t=sc.nextInt(); // while(t>0) { int n=sc.nextInt(); int[][] arr=new int[n][4]; Integer[] sumarr=new Integer[n]; int c=1; int thomsum=0; for ...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
dfea76a9d96e0c79cbb841df9f95af44
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.io.*; import java.util.*; public class TheRank { public static void main(String[] args) throws Exception { BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); int n = Integer.parseInt(buffer.readLine()); S...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
1c61ed1268aab9a0b0306599ff5673cc
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class Rank { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int a = scn.nextInt(); int b = scn.nextInt(); int c = scn.nextInt(); int d = scn.nextInt(); int sum = a + b + c + d;...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
07fa59dba04e3d72bc3b92641d2ab288
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class Rank { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int[][] arr = new int[10001][5]; for (int i = 1; i <= n; i++) { for (int j = 1; j < 5; j++) { arr[i][j] = scn.ne...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
f1eda7f381d39900695826c34edf015a
train_001.jsonl
1533737100
John Smith knows that his son, Thomas Smith, is among the best students in his class and even in his school. After the students of the school took the exams in English, German, Math, and History, a table of results was formed.There are $$$n$$$ students, each of them has a unique id (from $$$1$$$ to $$$n$$$). Thomas's i...
256 megabytes
import java.util.*; public class Yash { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a[] = new int[n]; for(int i=0; i<n; i++) { int a1 = sc.nextInt(); int a2 = sc.nextInt(); int a3 = sc.nextInt(); int a4 = sc.nextInt(); a[i] = a1+a...
Java
["5\n100 98 100 100\n100 100 100 100\n100 100 99 99\n90 99 90 100\n100 98 60 99", "6\n100 80 90 99\n60 60 60 60\n90 60 100 60\n60 100 60 80\n100 100 0 100\n0 0 0 0"]
1 second
["2", "1"]
NoteIn the first sample, the students got total scores: $$$398$$$, $$$400$$$, $$$398$$$, $$$379$$$, and $$$357$$$. Among the $$$5$$$ students, Thomas and the third student have the second highest score, but Thomas has a smaller id, so his rank is $$$2$$$.In the second sample, the students got total scores: $$$369$$$, $...
Java 11
standard input
[ "implementation" ]
3c984366bba580993d1694d27982a773
The first line contains a single integer $$$n$$$ ($$$1 \le n \le 1000$$$)Β β€” the number of students. Each of the next $$$n$$$ lines contains four integers $$$a_i$$$, $$$b_i$$$, $$$c_i$$$, and $$$d_i$$$ ($$$0\leq a_i, b_i, c_i, d_i\leq 100$$$)Β β€” the grades of the $$$i$$$-th student on English, German, Math, and History. ...
800
Print the rank of Thomas Smith. Thomas's id is $$$1$$$.
standard output
PASSED
623406422adc4b44681300ae00217f28
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.util.*; public class GFG { static class Pair{ int x; int y; Pair(int x,int y){ this.x=x; this.y=y; } @Override public boolean equals(Object o) { if (o == this) { return true; } if (!(o instanceof Pair)) { return false; } Pair c = (...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
4a82bd6fd676ba410699e54e747db61a
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
//package codeforces.round617div3; import java.io.*; import java.util.*; public class WalkingRobot { private static int UNVISITED = 0; private static int VISITING = -1; private static int VISITED = 1; public static void main(String[] args) { // try { // FastScanner in = new FastScan...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
6beb834a88a7ace60456fe912b253877
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.*; import java.io.*; public class Sol { static class Loc { int x; int y; Loc() { x =0; y = 0; } Loc (Loc a) { this.x = a.x; this.y = a.y; } } public static void main(String Args[])throws IOException { ...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
b831fb8348e0276540efcf6515a06061
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.util.*; public class C { static FastReader in = new FastReader(); static PrintWriter out = new PrintWriter(System.out); static void solve() { try { int size = in.nextInt(); String s = in.next(); Map<pair, Integer> map = new HashMap...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
425afecd800ece2110042747efed6724
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.*; public class test { static int N=1000007; public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int t = sc.nextInt(); while (t-- > 0) { int n = sc.nextInt(); String s = sc.next(); HashMap<Long, Integer> hm = new HashMap...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
8115b404a1d4e5aa0a69f49b12e1e4a1
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.awt.*; import java.io.*; import java.util.*; public class Abc { public static void main(String[] args) throws Exception { FastReader sc = new FastReader(); int t=sc.nextInt(); while (t-->0){ int n=sc.nextInt(); char s[]=sc.next().toCharArray(); ...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
d910510912ac6a76f22d3ec8e155c112
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class que3 { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); A: for (int i = 0; i < n; i++) { int strt = scn.nextInt(); StringBuilder s = new StringBuilder(scn.next()); int[][] arr = new in...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
80210b6dd35e3f3602092434eee769f5
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.util.*; public class Main { static String str; static int t, n; static Map<Node, Integer> map = new HashMap<>(); static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); static BufferedWriter bw = new BufferedWriter(new Out...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
a6245dffc5aa2b4ba66a309b5cea81cb
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.util.*; public class Main { static String str; static int t, n; static Map<Node, Integer> map = new HashMap<>(); static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); static BufferedWriter bw = new BufferedWriter(new Out...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
e3d133927dfb69594c16cb5fef7f45b3
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Objects; import java.util.Map; import java.util.Scanner; import java.util.HashMap; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public sta...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
228c2128d5ea094809b954599aa9883a
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.*; public class Robot { public static void main(String args[]) { Scanner scan = new Scanner(System.in); int NC = scan.nextInt(); //loop test cases while (NC>0){ int length = scan.nextInt(); String instructions = scan.next(); //Sys...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
a93b8f8537b9feabc6ec7be8a3113eb5
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.*; public class Solution { static class Pair { int x,y; Pair(int x,int y) { this.x=x; this.y=y; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + x * 7 + (y * 3+5*(y-x) ); ret...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
47f68336130c8dcc149ec3d7e78e54e8
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class C { private static FastReader fr; private static OutputStream out; private static int mod = (int)(1e9+7); private void solve() { int t = fr.nextInt(); while(t-- > 0) { int n = fr.nextInt(); char arr[] = fr.next().toCharArray(); ...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
bf387a5cd903353ddc4546bfe6334267
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
//package com.pb.codeforces.practice; import java.util.HashMap; import java.util.Scanner; public class CF1296C { public static void main(String[] args) { Scanner in = new Scanner(System.in); int t = in.nextInt(); while(t-- > 0) { int n = in.nextInt(); char[] path = in.next().toCharArray(); int x,y,min...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
dcc396acd0132e23afdc1c5b1398f4c3
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.HashMap; import java.util.Map; import java.util.Scanner; import static java.lang.System.in; public class CodeForces617C { public static void main(String[] args) { Scanner sc = new Scanner(in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.next...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
8f1093deb97bc10523b02caa51b81c9a
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.lang.reflect.Array; import java.util.*; public class C { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(in.readLine()); for(int t = 0; t < T; t++){ ...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
6c678c7e4baefee3ab42bd6ea0cae72d
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; import java.util.HashMap; import java.util.Map; public class Main { static class FastReader { BufferedReader br; StringTokenizer ...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
b0ff12b93d1e512d15711a31b661bd73
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.util.*; public class YetAnotherWalkingRobotHashMap { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int t = in.nextInt(); while(t-->0) { int n = in.nextInt();in.nextLine(); char...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
a8841daf82a98c44a511b47bdad32f3b
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.util.HashMap; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int t=s.nextInt();; for(int i=0;i<t;i++) { int n=s.nextInt(); String str=s.next(); if(n==1) System.out.println(-1); else { ...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
a1a283fe3e39d086296628ab24374fbf
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
/* If you want to aim high, aim high Don't let that studying and grades consume you Just live life young ****************************** If I'm the sun, you're the moon Because when I go up, you go down ******************************* I'm working for the day I will surpass you Sometime i think i am goona die and I want...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
711d95467a431b8e21bbc0c39f1cff0a
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class Main { public sta...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
ad4bf644f9a3f15c8e2bdfaa6ca7fa4f
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class Main { public sta...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
6e5e643572dcf0d07af59e1cfa823ac3
train_001.jsonl
1580826900
There is a robot on a coordinate plane. Initially, the robot is located at the point $$$(0, 0)$$$. Its path is described as a string $$$s$$$ of length $$$n$$$ consisting of characters 'L', 'R', 'U', 'D'.Each of these characters corresponds to some move: 'L' (left): means that the robot moves from the point $$$(x, y)$...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class RobotPath implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private...
Java
["4\n4\nLRUD\n4\nLURD\n5\nRRUDU\n5\nLLDDR"]
1 second
["1 2\n1 4\n3 4\n-1"]
null
Java 8
standard input
[ "data structures", "implementation" ]
1fc1d5ee79aaf823b246db5471ba7836
The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) β€” the number of test cases. The next $$$2t$$$ lines describe test cases. Each test case is given on two lines. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) β€” the length of the robot's path....
1,500
For each test case, print the answer on it. If you cannot remove such non-empty substring that the endpoint of the robot's path doesn't change, print -1. Otherwise, print two integers $$$l$$$ and $$$r$$$ such that $$$1 \le l \le r \le n$$$ β€” endpoints of the substring you remove. The value $$$r-l+1$$$ should be minimum...
standard output
PASSED
ba5bbf68e6abac4be5020cd490c82494
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.util.*; import java.math.*; public class shortest { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n = in.nextInt(); int caminho[] = new int[150]; caminho[0]=0; for(int i=1; i<=n; i++){ caminho[i...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
1d26e846cd314dceb53eb5b3a79f20e2
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Test { public static void main(String[] argv) { FastScanner scan = new FastScanner(System.in); PrintWriter out = new PrintWriter(...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
6f99b80633cb3e429dc2aac945c1ef41
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for(int i=0; i<n;i++) a[i] = sc.nextInt(); int s = sc.nextInt()-1; int e = sc.nex...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
b67f25064624051997f77f91d8503e09
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.util.*; public class CircleLine { public static void main(String[] args) { Scanner in=new Scanner(System.in); while(in.hasNext()){ int t=in.nextInt(); int []m=new int[t]; int x[]=new int[t]; int y[]=new int[t]; for (int i =...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
14f04791c96fecb08a5e66f9e7af4380
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.util.Scanner; public class Stations { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] d = new int[n + 1]; for (int i = 1; i < d.length; i++) d[i] = sc.nextInt(); int ymen = 0, temp=0, shmal = 0, s = sc.nextInt(), t = sc.nextInt()...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
909261713b962d7c0be0871e936780a7
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.util.Scanner; public class CircleLine{ public static int a[]; public static void main(String []args){ Scanner s1 = new Scanner(System.in); int n = s1.nextInt(); a = new int[n]; int i = 0; while(i < n) a[i++] = s1.nextInt(); i = s1.nextInt(); int j =s1.nextInt(); int s = Math.min(i, j) - 1; int t = Math.max...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
08f89b831fa9f0c22bd11346e36d2b34
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.util.*; public class a278 { public static void main(String ar[]) { Scanner ob=new Scanner(System.in); int n=ob.nextInt(); int sum=0,sum1=0; int arr[]=new int[n]; for(int i=0;i<n;i++) arr[i]=ob.nextInt(); int x=ob.nextInt(); int y=ob.nextInt(); int s=Math.min(x,y); ...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
876f4c50de91e53488ac5db831e4c45b
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.util.*; public class Circle { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int[] line = new int[n]; for (int i = 0; i < n; i++) { line[i] = input.nextInt(); } int s = input.nextInt()-1; int t = input.nextInt()-...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
827ce69ea577142bb618149fbc114128
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.util.*; import java.math.*; public class mayn { public static void main(String[] args) { Scanner scan = new Scanner (System.in); int n = scan.nextInt(); int [] dis = new int [n]; int total = 0; for (int i=0 ; i<n ; i++) { dis[i] = scan.nextInt(); total += dis[i]; } int begin =...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
9f49fdf805b891d6a56c5f41ed68b0e3
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
/* * @Author: steve * @Date: 2015-10-08 18:27:08 * @Last Modified by: steve * @Last Modified time: 2015-10-08 19:34:38 */ import java.io.*; public class dcircle { public static void main(String[] args) throws Exception { BufferedReader en= new BufferedReader(new InputStreamReader(System.in)); int n=...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
e4dc4ac7a02657f28d0faa4155b49fbf
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author user */ public class CF278A { public static void main(String[] args...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
ec8dc88c3c3c64198721a22236a4a46d
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author user */ public class CFround170div2 { public static void main(Strin...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
268fa87380708966600e82cc30d1d5bb
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; public class ACM { public static void main(String[] args) { Scanner input = new Scanner(System.in); int numberOfStations = 0; numberOfStations = input.nextInt(); ArrayList<Integer> list = new ArrayList<>(); Integer int...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
c283d4321dcf101301b57637fdf59532
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.util.Scanner; public class CircleLine { public static void main(String[] args) { Scanner input = new Scanner(System.in); int x = input.nextInt(); int c[] = new int[x]; for (int i = 0; i < c.length; i++) { c[i] = input.nextInt(); } int s = i...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
3f2dca0451786ba0a87305399d8f3c35
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.io.*; import java.util.*; public class z6 { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); int n=in.nextInt(); int[] a=new int[n+1]; int sum=0; for (int i=1;i<=n;...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
c7091db93326afc43c872dafc418bf65
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.io.*; import java.util.*; public class z6 { public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); int n = in.nextInt(); int[] a = new int[n + 1]; int sum = 0; for (int i = 1; i <= ...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
37b9a16b712115673aac7d46b95095fd
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.io.*; import java.util.*; import java.*; import java.math.BigInteger; import java.util.ArrayList; import java.util.Random; import java.lang.*; public class zad { private static BufferedReader in; private static StringTokenizer tok; private static PrintWriter out; final static boolean ONLINE_JUDGE ...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
b72c8a29dfb3aab976f3413635f372f4
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { /** * @param args */ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); int ...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output
PASSED
025378f2b8c8f52dec8a40eaab36d71c
train_001.jsonl
1362065400
The circle line of the Berland subway has n stations. We know the distances between all pairs of neighboring stations: d1 is the distance between the 1-st and the 2-nd station; d2 is the distance between the 2-nd and the 3-rd station;... dn - 1 is the distance between the n - 1-th and the n-th station; dn is the distan...
256 megabytes
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class SystemsOfEquations { static class Reader { BufferedReader r; StringTokenizer str; ...
Java
["4\n2 3 4 9\n1 3", "4\n5 8 2 100\n4 1", "3\n1 1 1\n3 1", "3\n31 41 59\n1 1"]
2 seconds
["5", "15", "1", "0"]
NoteIn the first sample the length of path 1 → 2 → 3 equals 5, the length of path 1 → 4 → 3 equals 13.In the second sample the length of path 4 → 1 is 100, the length of path 4 → 3 → 2 → 1 is 15.In the third sample the length of path 3 → 1 is 1, the length of path 3 → 2 → 1 is 2.In the fourth sample the numbers of stat...
Java 7
standard input
[ "implementation" ]
22ef37041ebbd8266f62ab932f188b31
The first line contains integer n (3 ≀ n ≀ 100) β€” the number of stations on the circle line. The second line contains n integers d1, d2, ..., dn (1 ≀ di ≀ 100) β€” the distances between pairs of neighboring stations. The third line contains two integers s and t (1 ≀ s, t ≀ n) β€” the numbers of stations, between which you ...
800
Print a single number β€” the length of the shortest path between stations number s and t.
standard output