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
8b6f0b8325726cec8feef16c0fc8a703
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.*; import static java.lang.Math.*; public class ProblemA { void run() { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); String w = sc.next(); int[] counts = new int[256]; for (char c : w.toCharArray()) { ++counts[c]; } boolean good = true; for (char c = 'a'; c <=...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
cad48326d800c710e9b29373b62a59ba
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.Scanner; public class CodeForces { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int k = scan.nextInt(); String s = scan.next(); char[] v = new char[26]; boolean can = true; for (char c : s.toCharArray()) { ...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
584a954d427cabd009deca5cfd510dd2
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.StringTokenizer; public class A { public static void main(String[] Args) throws IOException { ...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
eac4663f6d7ffbdf7877f3545481fb8a
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.Scanner; public class CodeForces { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int k = scan.nextInt(); String s = scan.next(); char[] v = new char[26]; boolean can = true; for (char c : s.toCharArray()) { ...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
91f3f59fcb9d808a29a6c05807a0b34d
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); sc.nextLine(); char[] a = sc.nextLine().toCharArray(); int n = a.length; if (n % k != 0) { System.out.println(-...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
9aa5ad52fff7bb6ebf6c56c5513ca092
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); char[] s = sc.next().toCharArray(); int[] a = new int[255]; for(int i = 0; i < s.length; i++){ a[s[i]]++; }...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
44ab2afe4d92edf962aaf8e50101bdf4
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.math.BigDecimal; import java.util.Locale; public class A219 { public static void main(String[] a...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
cce22ddeca938d5e92fb03de28154e21
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.*; import java.io.*; import java.math.*; public class Main { //========================================================================= public static final String INPUT = ""; public static final String OUTPUT = ""; //===================================================================...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
fd959d2c207bec066f88db5208a6095d
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Problem implements Runnable { public static void main(String[] args) { new Problem().run(); } BufferedReader br; Str...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
b48be73886c05b71e03abf604c7fb98b
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; public class main { public static void main(String[]args)throws IOException { BufferedReader in = new BufferedReader (new InputStreamReader(System.in)...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
67696665244a3c1391531d0b2361498f
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.*; public class KString { public static void main(String[] args) { // Set up scanner Scanner sc = new Scanner(System.in); // System.out.println("Enter k"); int k = sc.nextInt(); // System.out.println("Enter string"); String st = sc.next(); ...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
ddb617c0b09fa1bf571b1a99043f312e
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.*; /* 3 abcabcabcabc */ /* 4 aabaabaabaab */ public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); char array []; int k = sc.nextInt(),n; sc.nextLine(); array = sc.nextLine().toCharArray(); if(array.leng...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
4ccc5499c138232fc13ff808327e0c9d
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.*; import java.util.*; /** * * @author N-AssassiN */ public class Main { private static BufferedReader reader; private static BufferedWriter out; private static StringTokenizer tokenizer;...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
19d134c00d3723c9dd3d0674c0bc2c63
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.Scanner; public class test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner scan = new Scanner(System.in); int k=scan.nextInt(); int[] alphabet= new int [40]; char[] s=scan.next().toCharArray(); for(char c:s){ alphabet[(in...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
489c74da0cddfc13705759c9f846ac81
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Hashtable; import java.util.Stack; /** * * @author DELL */ public class CodeForce219AKString { /** * @param args the command line arguments */ public static ...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
4cc50d62ee0ee7903fbe9a9c38cc2586
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.Scanner; public class Kstring { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int k = sc.nextInt(); String cad = sc.next(); int[] ar = new int[26]; boolean correcto = true; String cadFin = ""; for(int i=0; i<cad.length(); i++) { ar[(int)cad.charAt(i) - ...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
807630380414d35c938f096208c6331a
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.Scanner; public class A { public static void main(String[] args) { Scanner in = new Scanner(System.in); int k = in.nextInt(); String s = in.next(); String ans = solve(s, k); if(ans != null) System.out.println(ans); else ...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
e877cda8ae4c545cb91598ff9217e29b
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.*; public class k_string { static int n; static String str; static int[] az = new int[26]; public static void main( String[] args ) { Scanner in = new Scanner( System.in ); n = in.nextInt(); str = in.next(); for ( int i = 0; i < str.length(); i++ ...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
f77bca8c13998d15940f21096637a626
train_001.jsonl
1346081400
A string is called a k-string if it can be represented as k concatenated copies of some string. For example, the string "aabaabaabaab" is at the same time a 1-string, a 2-string and a 4-string, but it is not a 3-string, a 5-string, or a 6-string and so on. Obviously any string is a 1-string.You are given a string s, co...
256 megabytes
import java.util.Scanner; public class KString { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int k = sc.nextInt(); String s = sc.next(); System.out.println(valid(s,k)); ...
Java
["2\naazz", "3\nabcabcabz"]
2 seconds
["azaz", "-1"]
null
Java 6
standard input
[ "implementation", "strings" ]
f5451b19cf835b1cb154253fbe4ea6df
The first input line contains integer k (1 ≤ k ≤ 1000). The second line contains s, all characters in s are lowercase English letters. The string length s satisfies the inequality 1 ≤ |s| ≤ 1000, where |s| is the length of string s.
1,000
Rearrange the letters in string s in such a way that the result is a k-string. Print the result on a single output line. If there are multiple solutions, print any of them. If the solution doesn't exist, print "-1" (without quotes).
standard output
PASSED
8ffd5391e52df83a210e3af8dad23fed
train_001.jsonl
1553006100
There are $$$n$$$ left boots and $$$n$$$ right boots. Each boot has a color which is denoted as a lowercase Latin letter or a question mark ('?'). Thus, you are given two strings $$$l$$$ and $$$r$$$, both of length $$$n$$$. The character $$$l_i$$$ stands for the color of the $$$i$$$-th left boot and the character $$$r_...
256 megabytes
import java.util.*;import java.io.*;import java.math.*; public class Main { public static void process()throws IOException { int n=ni(); char left[]=(" "+nln()).toCharArray(),right[]=(" "+nln()).toCharArray(); Queue<Integer> l[]=new Queue[30],r[]=new Queue[30],uk_l=new LinkedList<>(),...
Java
["10\ncodeforces\ndodivthree", "7\nabaca?b\nzabbbcc", "9\nbambarbia\nhellocode", "10\ncode??????\n??????test"]
2 seconds
["5\n7 8\n4 9\n2 2\n9 10\n3 1", "5\n6 5\n2 3\n4 6\n7 4\n1 2", "0", "10\n6 2\n1 6\n7 3\n3 5\n4 8\n9 7\n5 1\n2 4\n10 9\n8 10"]
null
Java 11
standard input
[ "implementation", "greedy" ]
6bf3e5a542ebce81c1e6ce7260644a3c
The first line contains $$$n$$$ ($$$1 \le n \le 150000$$$), denoting the number of boots for each leg (i.e. the number of left boots and the number of right boots). The second line contains the string $$$l$$$ of length $$$n$$$. It contains only lowercase Latin letters or question marks. The $$$i$$$-th character stands ...
1,500
Print $$$k$$$ — the maximum number of compatible left-right pairs of boots, i.e. pairs consisting of one left and one right boot which have compatible colors. The following $$$k$$$ lines should contain pairs $$$a_j, b_j$$$ ($$$1 \le a_j, b_j \le n$$$). The $$$j$$$-th of these lines should contain the index $$$a_j$$$ of...
standard output
PASSED
59e21356044088f5a9834e1199077086
train_001.jsonl
1553006100
There are $$$n$$$ left boots and $$$n$$$ right boots. Each boot has a color which is denoted as a lowercase Latin letter or a question mark ('?'). Thus, you are given two strings $$$l$$$ and $$$r$$$, both of length $$$n$$$. The character $$$l_i$$$ stands for the color of the $$$i$$$-th left boot and the character $$$r_...
256 megabytes
import java.io.*; import java.util.*; public class swapSort { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader((System.in))); int n =Integer.parseInt(br.readLine()); String s1 = br.readLine(); String s2 = br.readLine(); HashMap<Characte...
Java
["10\ncodeforces\ndodivthree", "7\nabaca?b\nzabbbcc", "9\nbambarbia\nhellocode", "10\ncode??????\n??????test"]
2 seconds
["5\n7 8\n4 9\n2 2\n9 10\n3 1", "5\n6 5\n2 3\n4 6\n7 4\n1 2", "0", "10\n6 2\n1 6\n7 3\n3 5\n4 8\n9 7\n5 1\n2 4\n10 9\n8 10"]
null
Java 11
standard input
[ "implementation", "greedy" ]
6bf3e5a542ebce81c1e6ce7260644a3c
The first line contains $$$n$$$ ($$$1 \le n \le 150000$$$), denoting the number of boots for each leg (i.e. the number of left boots and the number of right boots). The second line contains the string $$$l$$$ of length $$$n$$$. It contains only lowercase Latin letters or question marks. The $$$i$$$-th character stands ...
1,500
Print $$$k$$$ — the maximum number of compatible left-right pairs of boots, i.e. pairs consisting of one left and one right boot which have compatible colors. The following $$$k$$$ lines should contain pairs $$$a_j, b_j$$$ ($$$1 \le a_j, b_j \le n$$$). The $$$j$$$-th of these lines should contain the index $$$a_j$$$ of...
standard output
PASSED
86e725b482040cc92d6434eb24afcbdb
train_001.jsonl
1553006100
There are $$$n$$$ left boots and $$$n$$$ right boots. Each boot has a color which is denoted as a lowercase Latin letter or a question mark ('?'). Thus, you are given two strings $$$l$$$ and $$$r$$$, both of length $$$n$$$. The character $$$l_i$$$ stands for the color of the $$$i$$$-th left boot and the character $$$r_...
256 megabytes
import java.util.*; public class MyClass { public static void main(String args[]) { Scanner in=new Scanner(System.in); int n=in.nextInt(); String s=in.next(),t=in.next(); int l[]=new int[26]; int r[]=new int[26]; int le=0,re=0; Stack<Integer> left[]=new Stack[2...
Java
["10\ncodeforces\ndodivthree", "7\nabaca?b\nzabbbcc", "9\nbambarbia\nhellocode", "10\ncode??????\n??????test"]
2 seconds
["5\n7 8\n4 9\n2 2\n9 10\n3 1", "5\n6 5\n2 3\n4 6\n7 4\n1 2", "0", "10\n6 2\n1 6\n7 3\n3 5\n4 8\n9 7\n5 1\n2 4\n10 9\n8 10"]
null
Java 11
standard input
[ "implementation", "greedy" ]
6bf3e5a542ebce81c1e6ce7260644a3c
The first line contains $$$n$$$ ($$$1 \le n \le 150000$$$), denoting the number of boots for each leg (i.e. the number of left boots and the number of right boots). The second line contains the string $$$l$$$ of length $$$n$$$. It contains only lowercase Latin letters or question marks. The $$$i$$$-th character stands ...
1,500
Print $$$k$$$ — the maximum number of compatible left-right pairs of boots, i.e. pairs consisting of one left and one right boot which have compatible colors. The following $$$k$$$ lines should contain pairs $$$a_j, b_j$$$ ($$$1 \le a_j, b_j \le n$$$). The $$$j$$$-th of these lines should contain the index $$$a_j$$$ of...
standard output
PASSED
a541f2b41422b23793add594347fe804
train_001.jsonl
1553006100
There are $$$n$$$ left boots and $$$n$$$ right boots. Each boot has a color which is denoted as a lowercase Latin letter or a question mark ('?'). Thus, you are given two strings $$$l$$$ and $$$r$$$, both of length $$$n$$$. The character $$$l_i$$$ stands for the color of the $$$i$$$-th left boot and the character $$$r_...
256 megabytes
//package codeforces_464_div2; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.Stack; public class D { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.nextLine(); String l = sc.nex...
Java
["10\ncodeforces\ndodivthree", "7\nabaca?b\nzabbbcc", "9\nbambarbia\nhellocode", "10\ncode??????\n??????test"]
2 seconds
["5\n7 8\n4 9\n2 2\n9 10\n3 1", "5\n6 5\n2 3\n4 6\n7 4\n1 2", "0", "10\n6 2\n1 6\n7 3\n3 5\n4 8\n9 7\n5 1\n2 4\n10 9\n8 10"]
null
Java 11
standard input
[ "implementation", "greedy" ]
6bf3e5a542ebce81c1e6ce7260644a3c
The first line contains $$$n$$$ ($$$1 \le n \le 150000$$$), denoting the number of boots for each leg (i.e. the number of left boots and the number of right boots). The second line contains the string $$$l$$$ of length $$$n$$$. It contains only lowercase Latin letters or question marks. The $$$i$$$-th character stands ...
1,500
Print $$$k$$$ — the maximum number of compatible left-right pairs of boots, i.e. pairs consisting of one left and one right boot which have compatible colors. The following $$$k$$$ lines should contain pairs $$$a_j, b_j$$$ ($$$1 \le a_j, b_j \le n$$$). The $$$j$$$-th of these lines should contain the index $$$a_j$$$ of...
standard output
PASSED
772158bf1c1bdcceb5e72950bfd11fac
train_001.jsonl
1553006100
There are $$$n$$$ left boots and $$$n$$$ right boots. Each boot has a color which is denoted as a lowercase Latin letter or a question mark ('?'). Thus, you are given two strings $$$l$$$ and $$$r$$$, both of length $$$n$$$. The character $$$l_i$$$ stands for the color of the $$$i$$$-th left boot and the character $$$r_...
256 megabytes
/* Author: Anthony Ngene Created: 29/09/2020 - 05:36 */ import java.io.*; import java.util.*; public class D { // checks: 1. edge cases 2. overflow 3. possible errors (e.g 1/0, arr[out]) 4. time/space complexity void solver() throws IOException { int n = in.intNext(); HashMap<Charact...
Java
["10\ncodeforces\ndodivthree", "7\nabaca?b\nzabbbcc", "9\nbambarbia\nhellocode", "10\ncode??????\n??????test"]
2 seconds
["5\n7 8\n4 9\n2 2\n9 10\n3 1", "5\n6 5\n2 3\n4 6\n7 4\n1 2", "0", "10\n6 2\n1 6\n7 3\n3 5\n4 8\n9 7\n5 1\n2 4\n10 9\n8 10"]
null
Java 11
standard input
[ "implementation", "greedy" ]
6bf3e5a542ebce81c1e6ce7260644a3c
The first line contains $$$n$$$ ($$$1 \le n \le 150000$$$), denoting the number of boots for each leg (i.e. the number of left boots and the number of right boots). The second line contains the string $$$l$$$ of length $$$n$$$. It contains only lowercase Latin letters or question marks. The $$$i$$$-th character stands ...
1,500
Print $$$k$$$ — the maximum number of compatible left-right pairs of boots, i.e. pairs consisting of one left and one right boot which have compatible colors. The following $$$k$$$ lines should contain pairs $$$a_j, b_j$$$ ($$$1 \le a_j, b_j \le n$$$). The $$$j$$$-th of these lines should contain the index $$$a_j$$$ of...
standard output
PASSED
75db6606ff91fb679533dc4a0bf12d51
train_001.jsonl
1553006100
There are $$$n$$$ left boots and $$$n$$$ right boots. Each boot has a color which is denoted as a lowercase Latin letter or a question mark ('?'). Thus, you are given two strings $$$l$$$ and $$$r$$$, both of length $$$n$$$. The character $$$l_i$$$ stands for the color of the $$$i$$$-th left boot and the character $$$r_...
256 megabytes
import java.util.Scanner; import java.util.Arrays; import java.util.ArrayList; import java.util.List; public class Application1 { public static String Reduce(String s) { int k; int[]temp=new int[256]; List<Character>arr=new ArrayList<Character>(); for(k=97;k<=122;k++) { ...
Java
["10\ncodeforces\ndodivthree", "7\nabaca?b\nzabbbcc", "9\nbambarbia\nhellocode", "10\ncode??????\n??????test"]
2 seconds
["5\n7 8\n4 9\n2 2\n9 10\n3 1", "5\n6 5\n2 3\n4 6\n7 4\n1 2", "0", "10\n6 2\n1 6\n7 3\n3 5\n4 8\n9 7\n5 1\n2 4\n10 9\n8 10"]
null
Java 11
standard input
[ "implementation", "greedy" ]
6bf3e5a542ebce81c1e6ce7260644a3c
The first line contains $$$n$$$ ($$$1 \le n \le 150000$$$), denoting the number of boots for each leg (i.e. the number of left boots and the number of right boots). The second line contains the string $$$l$$$ of length $$$n$$$. It contains only lowercase Latin letters or question marks. The $$$i$$$-th character stands ...
1,500
Print $$$k$$$ — the maximum number of compatible left-right pairs of boots, i.e. pairs consisting of one left and one right boot which have compatible colors. The following $$$k$$$ lines should contain pairs $$$a_j, b_j$$$ ($$$1 \le a_j, b_j \le n$$$). The $$$j$$$-th of these lines should contain the index $$$a_j$$$ of...
standard output
PASSED
b966adc8632723bbfcf2c62885d78cf0
train_001.jsonl
1553006100
There are $$$n$$$ left boots and $$$n$$$ right boots. Each boot has a color which is denoted as a lowercase Latin letter or a question mark ('?'). Thus, you are given two strings $$$l$$$ and $$$r$$$, both of length $$$n$$$. The character $$$l_i$$$ stands for the color of the $$$i$$$-th left boot and the character $$$r_...
256 megabytes
/* Author: Anthony Ngene Created: 29/09/2020 - 05:36 */ import java.io.*; import java.util.*; public class D { // checks: 1. edge cases 2. overflow 3. possible errors (e.g 1/0, arr[out]) 4. time/space complexity void solver() throws IOException { int n = in.intNext(); HashMap<Charact...
Java
["10\ncodeforces\ndodivthree", "7\nabaca?b\nzabbbcc", "9\nbambarbia\nhellocode", "10\ncode??????\n??????test"]
2 seconds
["5\n7 8\n4 9\n2 2\n9 10\n3 1", "5\n6 5\n2 3\n4 6\n7 4\n1 2", "0", "10\n6 2\n1 6\n7 3\n3 5\n4 8\n9 7\n5 1\n2 4\n10 9\n8 10"]
null
Java 11
standard input
[ "implementation", "greedy" ]
6bf3e5a542ebce81c1e6ce7260644a3c
The first line contains $$$n$$$ ($$$1 \le n \le 150000$$$), denoting the number of boots for each leg (i.e. the number of left boots and the number of right boots). The second line contains the string $$$l$$$ of length $$$n$$$. It contains only lowercase Latin letters or question marks. The $$$i$$$-th character stands ...
1,500
Print $$$k$$$ — the maximum number of compatible left-right pairs of boots, i.e. pairs consisting of one left and one right boot which have compatible colors. The following $$$k$$$ lines should contain pairs $$$a_j, b_j$$$ ($$$1 \le a_j, b_j \le n$$$). The $$$j$$$-th of these lines should contain the index $$$a_j$$$ of...
standard output
PASSED
653853d6f9badfb143d676dc0420ecce
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.Scanner; public class TanyaAndCandies { public static void main(String []args) { Scanner scn=new Scanner(System.in); int n=scn.nextInt(); int []arr=new int[n]; int []left_odd=new int[n]; int []left_even=new int[n]; int []right_odd=new int[n]; int []right_even=new int[n]; for(int i=0;...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
24bfc293d6be594759b23f1188cbcaf6
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; import java.io.*; public class Solution { public static void main(String []args)throws Exception { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(System.out)); int n=Integer.parseInt(br.readLine()); ...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
c59cbe90cd01056607fce21a09dd3864
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
/** * Date: 19 Feb, 2019 * Link: * * @author Prasad-Chaudhari * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/ * @git: https://github.com/Prasad-Chaudhari */ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
202b788770dc60d01a4d4c4b8ff175ea
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.ArrayList; import java.util.Scanner; /** * @Created by sbhowmik on 19/02/19 */ public class TanyaAndCandies { static public class TanyaAndCandiesObject { int x; int y; public TanyaAndCandiesObject(int x, int y) { this.x = x; this.y = y; ...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
abc57360ad6a3f697bbcead9efdbcd72
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * Created by NubbY */ public class A { public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
a4c882ec3fe54c7773623b98bea81b97
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; public class Code { public static void main (String[] args) throws java.lang.Exception { Scanner s= new Scanner(System.in); int n= s.nextInt(); int[] a = new int[n]; long sume=0; long sumo=0; for(int i=0;i<n;i++){ a[i]=s.nextI...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
917d961ec76a434fd4743437ffb2c8b7
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; public class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int i,t=0,s=0,s1=0,s2=0; int n=sc.nextInt(); int a[]=new int [n]; int b[]=new int [n]; for(i=0;i<n;i++){ a[i]=sc.nextInt(); s+...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
6358c303d0c9e1534153854a6247e076
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.io.*; import java.util.*; public class tr2 { public static void main(String[] args) throws IOException { Scanner sc=new Scanner(System.in); PrintWriter out=new PrintWriter(System.out); int n=sc.nextInt(); int []a=new int[n]; long odd=0; long even=0; long []e=new long[n]; long []o=new long[...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
6299ad55873eb3da1f56794ff2a21eb3
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class b { public static void main(String[] args) { Scanner stdin = new Scanner(System.in); int n = stdin.nextInt(); int[] in = new int[n]; int[] evenf = new int[n]; int[] oddf = new int[n]; int[] evenb = new int[n]; int[] oddb = new int[n];...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
d8e879ae0e650f86eeddf78997065423
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import static java.lang.System.exit; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Scanner; import java.util.*; /** * * @author abdelmagied */ import java.util.ArrayList; import java.util.Collections; import java....
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
ba1195e9ee796bc9c33cdc2cbe87463e
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors; public class Candies { public static void main(String args[]) { Scanner in = new Scanner(System.in); int q; q=Integer.parseInt(in.nextLine().trim()); ...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
f275a6271713907388b23ebfbf610848
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; import java.io.*; public class can { public static void main(String args[]) throws Exception { FastReader sc=new FastReader(); int n=sc.nextInt(); int c=0; int sum=0,sum0=0,sum1=0; int a[]=new int[n]; for(int i=0;i<n;i++) { a[i]=sc.nextInt(...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
056837940fa301e720323306a5462abb
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.BigInteger; public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc = new Scanner(System.in); int n=sc.nextInt(); int a[]=new int[n]; int ePref = 0, oPref =...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
359206ff10e663a0928033f7125cfebd
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; import java.lang.*; import java.io.*; import java.math.BigInteger; public class Codechef { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int ePref=0,oPref=0,oSuf=0,eSuf=...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
070ba9047055f86f18a75c1f8cd10e61
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; public class Tanya_and_Candies { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n =sc.nextInt(),evenf=0,oddf=0,evenb=0,oddb=0,count=0; int arr[] = new int[n]; for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); ...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
90e2314c8f93741703f9b9b44381ca39
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class TanyaCandy { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(Syst...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
cab4647a33eec40ded29d85144969083
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; import java.lang.Math; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class mainClass { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int r = sc.nextInt(); ArrayList<Integer> inputList = new ArrayList<...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
a3ab066ccd13f051730655ac68f0f568
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
//package com.company; 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 A[]=new int[n]; int e=0; int o=0; for(int i=0;i<n;i++) { A[i]=in...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
7937db4ef258a3bedb04cfcd26067758
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.Scanner; public class A_20_1 { public static void main(String []args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n+1]; long[] oddSum = new long[n+1]; long[] evenSum = new long[n+1]; long[] sum = new long[n+1]; ...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
108807f5715f0a56e097938e3b392ff5
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
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[] arr=new int[n]; int sum1=0; int sum2=0; for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); if(i%2==0)sum2+=arr[i]; else sum1+=arr[i]; } int ans=...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
34c029383a590b39b11a6bc34c1b0603
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; import java.lang.*; import java.math.BigDecimal; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ public class IUPC { public static void main (String[] args) throws java.lang.Exception { Scanner sc=new Scanner(System.in); // your code goes here int ...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
109f1f040aa2b0a7a48dc321e6cb9dd3
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.io.*; import java.util.*; public class Main { private static final boolean FROM_FILE = false; private static final boolean TO_FILE = false; public static void main(String[] args) throws IOException { BufferedReader br; if (FROM_FILE) { br = new BufferedReader(new F...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
012df407e36088740f7be573d5216ec8
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.Scanner; public class B{ static Scanner fr = new Scanner(System.in); public static void main(String args[]){ int n = fr.nextInt(); int arr[] = nextArray(n); int odd = 0, even = 0; int curr_odd = 0, curr_even = 0; for(int i=0;i<n;i++){ if(i % 2 == 0){ odd += arr[i]; }else{ ...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
6b828efca96eb2666651bfd39a2948b9
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class B { public static void main(String[] args) throws Exception { //BufferedReader bufferedReader = new BufferedReader(new FileReader("input.txt")); //Scanner scanner = new Scanner(bufferedReader); //Scanner sc...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
8268597e4ec09358e53aaa2b4243f24a
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.Scanner; public class ProblemB { public static void main(String[] args) { // TODO Auto-generated method stub Scanner in = new Scanner(System.in); int n = in.nextInt(); if (n == 1) { System.out.println(1); in.close(); return; } int[] sum = new int[...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
ebf1d11f5fe77cbbfeff41de4bfa1673
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
//package com.freemaker.first; import java.util.Scanner; public class TanyasCandies { public static void main(String[] s){ Scanner sc = new Scanner(System.in); int size = sc.nextInt(); int[] candies = new int[size]; for(int i=0; i < size; i++ ){ candies[i] = sc.nextInt(); } System.out.println(...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
9a915a633f6ecdb9a25cf2d022f0f9f6
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; // The number is simply too large to even consider running a loop through all the candies and then // compare the odd and the even. // So why not count the odd and the even first time, and then find the difference. // Loop from the beginning an public class TanyaAndCandles { public int countGoo...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
b1b168b43b97beef4d9e6ccca29c86e8
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.Arrays; import java.util.StringTokenizer; import java.util.stream.Collector; import java.util.stream.Collectors; import java.util.stream.IntStream; /** * Tanya has 𝑛 candies numb...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
35d7157c4ed872e731440bd1bc2a7fa9
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n=in.nextInt(); long[] arr=new long[n]; long odd=0; long even=0; ...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
57067d4724bb0dcc96a29648da580793
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Andrei Chugunov */ public class Main { private static class Solution { private...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
ad9bc2958ebb24fa5c2dae41faa9035a
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class CodeForces540B { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int[] a = new int[n]; int[] sum = new int[2]; for (int i = 0; i < n; i++) { ...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
d76f66d405a5091494070d3761a380ab
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.io.*; import java.util.*; public class test { static BufferedReader br; static StringTokenizer st; static int[] vals; static int n; public static void main(String[] args) throws NumberFormatException, IOException { br = new BufferedReader(new InputStreamReader(System.in)); n = Integer.parseInt...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
0e41d701e2f82dc566a7b4de10710a15
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s=new Scanner(System.in); int length=s.nextInt(); int[] input=new int[length]; int[] oddSum=new int[length]; int[] evenSum=new int[length]; int sum,result; sum=result=0; for(int a=0;a<length;a++) { i...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
13e1412d65167df8fdc1cb18a47aab01
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.*; public class Sol { public static void main(String[] args) { Scanner ip=new Scanner(System.in); int n=ip.nextInt(); int arr[]=new int[n]; int evenP=0; int oddP=0; int evenS=0; int oddS=0; for(int i=0;i<n;i++) { arr[i]=ip.nextInt(); if(i%2==0) { evenS+=...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
8db3054349532dbeaa8d2a49aa34bf69
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.StringTokenizer; public class B { public static void main(String[] args) throws IOException { BufferedReader br=new Buffered...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
cc077ac93b78d688a4a232796cbedbb3
train_001.jsonl
1550586900
Tanya has $$$n$$$ candies numbered from $$$1$$$ to $$$n$$$. The $$$i$$$-th candy has the weight $$$a_i$$$.She plans to eat exactly $$$n-1$$$ candies and give the remaining candy to her dad. Tanya eats candies in order of increasing their numbers, exactly one candy per day.Your task is to find the number of such candies...
256 megabytes
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int answer = 0, arraySum = 0, oddSum = 0, evenSum = 0, n = input.nextInt(); int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = input.nex...
Java
["7\n5 5 4 5 5 5 6", "8\n4 8 8 7 8 4 4 5", "9\n2 3 4 2 2 3 2 2 4"]
1 second
["2", "2", "3"]
NoteIn the first example indices of good candies are $$$[1, 2]$$$.In the second example indices of good candies are $$$[2, 3]$$$.In the third example indices of good candies are $$$[4, 5, 9]$$$.
Java 8
standard input
[ "implementation" ]
dcc380c544225c8cadf0df8d8b6ffb4d
The first line of the input contains one integer $$$n$$$ ($$$1 \le n \le 2 \cdot 10^5$$$) — the number of candies. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^4$$$), where $$$a_i$$$ is the weight of the $$$i$$$-th candy.
1,200
Print one integer — the number of such candies $$$i$$$ (good candies) that if dad gets the $$$i$$$-th candy then the sum of weights of candies Tanya eats in even days will be equal to the sum of weights of candies Tanya eats in odd days.
standard output
PASSED
693302bccc920641e19e5c2a95f6c5c3
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.io.*; import java.util.*; public class LimitTokenizer { public static void main(String args[])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int i,n,m,a,b,hcf,t; hcf=0; StringTokenizer d1=new StringTokenizer(br.readLine()); n=Integer.parseInt(d1.next...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
7bf8df3b3d4d988cbb00e9f322f6d129
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.util.*; /** * Created by IntelliJ IDEA. * User: piyushd * Date: 3/26/11 * Time: 10:53 PM * To change this template use File | Settings | File Templates. */ public class TaskB { int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } void run() { int...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
2ad17cfb7d2c3492785f845a898c6fc5
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.math.BigInteger; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] Args) { int n = si(), m = si(); int[] p = sai(n + 1); int[] q = sai(m + 1); if (n > m) System.out.println(p[0]*q[...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
363f3dfd500d1a48e982c5ddb3e4ec0c
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.util.Scanner; public class B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt() + 1; int m = sc.nextInt() + 1; int[] p = new int[n]; int[] q = new int[m]; for (int i = 0; i < n; i++) p[i] = sc....
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
59730ca3f339e58ef81e775202e0e6ae
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.io.*; import java.util.*; public class B { public static void main(String[] args) throws Exception { new B().solve(); } void solve() throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] sp = in.readLine().split(" "); ...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
fba40d087940806fe6c09ec649160b6e
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.util.Scanner; public class Main { private static Scanner s = new Scanner(System.in); public static void main(String[] args) { int n=s.nextInt(); int m=s.nextInt(); int nl=0; int ml=0; boolean b=false; for(int i=0;i<=n;i++) { ...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
91e287070055d2b4fc660570196fd78a
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class wadup { public static void debug(Object... obs) { System.out.println(Arrays.deepToString(obs)); } static int gcd(int a, int b) { return (b==0)? a : gcd(b, a%b); } public static void main(String[] args...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
9dd01b935880cbc85566ac99dab8fa76
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class B { static BufferedReader reader; static StringTokenizer tokenizer; static PrintWriter writer; static void init() { reader = n...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
319473ff2013b02fabbb1ec1ee9fd921
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.io.*; public class B { public static void main(String[] args) throws IOException { BufferedReader r; r = new BufferedReader(new InputStreamReader(System.in)); //r = new BufferedReader(new FileReader(new File("in.txt"))); String[] line = r.readLine().split(" "); int n = Integer.parseInt(line[0]);...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
8dd0fbcba9f7c55b5b1c3442f152ad97
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.io.InputStreamReader; import java.io.IOException; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author Sergey Parkhomenko */ publi...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
4cf760a9d51d6454804818e6b0c95ccf
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; public class Main { public static void main(String[] args) throws Exception { // char[] c = inB.readLine().toCharA...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
5e1995ad8d2d3ff5db072fa5afc91dba
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.io.*; import java.util.*; public class Main { int gcd( int a, int b ) { return b == 0 ? a : gcd( b, a % b ); } public void solve( ) throws Throwable { int n = in.nextInt( ), m = in.nextInt( ); int a[ ] = new int[ n + 1 ], b[ ] = new int[ m + 1 ]; for ( int i = 0;...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
0ed2283dbf870b162cd29396e203afbe
train_001.jsonl
1339506000
You are given two polynomials: P(x) = a0·xn + a1·xn - 1 + ... + an - 1·x + an and Q(x) = b0·xm + b1·xm - 1 + ... + bm - 1·x + bm. Calculate limit .
256 megabytes
import java.util.Scanner; public class C_124B { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int a[] = new int [n+1]; for (int i = 0; i < n+1; i++) { a[i] = sc.nextInt(); } int b[] = new int [m+1]; for (int i = 0; i < m+...
Java
["2 1\n1 1 1\n2 5", "1 0\n-1 3\n2", "0 1\n1\n1 0", "2 2\n2 1 6\n4 5 -7", "1 1\n9 0\n-5 2"]
2 seconds
["Infinity", "-Infinity", "0/1", "1/2", "-9/5"]
NoteLet's consider all samples: You can learn more about the definition and properties of limits if you follow the link: http://en.wikipedia.org/wiki/Limit_of_a_function
Java 6
standard input
[ "math" ]
37cf6edce77238db53d9658bc92b2cab
The first line contains two space-separated integers n and m (0 ≤ n, m ≤ 100) — degrees of polynomials P(x) and Q(x) correspondingly. The second line contains n + 1 space-separated integers — the factors of polynomial P(x): a0, a1, ..., an - 1, an ( - 100 ≤ ai ≤ 100, a0 ≠ 0). The third line contains m + 1 space-separat...
1,400
If the limit equals  + ∞, print "Infinity" (without quotes). If the limit equals  - ∞, print "-Infinity" (without the quotes). If the value of the limit equals zero, print "0/1" (without the quotes). Otherwise, print an irreducible fraction — the value of limit , in the format "p/q" (without the quotes), where p is the...
standard output
PASSED
0e4d8391697684101adfe2ddbd95b755
train_001.jsonl
1603623900
Tenten runs a weapon shop for ninjas. Today she is willing to sell $$$n$$$ shurikens which cost $$$1$$$, $$$2$$$, ..., $$$n$$$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shur...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.io.PrintStream; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; import java.util.TreeSet; import java.util.Vector; import java.util....
Java
["4\n+\n+\n- 2\n+\n- 3\n+\n- 1\n- 4", "1\n- 1\n+", "3\n+\n+\n+\n- 2\n- 1\n- 3"]
1 second
["YES\n4 2 3 1", "NO", "NO"]
NoteIn the first example Tenten first placed shurikens with prices $$$4$$$ and $$$2$$$. After this a customer came in and bought the cheapest shuriken which costed $$$2$$$. Next, Tenten added a shuriken with price $$$3$$$ on the showcase to the already placed $$$4$$$-ryo. Then a new customer bought this $$$3$$$-ryo shu...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
5fa2af185c4e3c8a1ce3df0983824bad
The first line contains the only integer $$$n$$$ ($$$1\leq n\leq 10^5$$$) standing for the number of shurikens. The following $$$2n$$$ lines describe the events in the format described above. It's guaranteed that there are exactly $$$n$$$ events of the first type, and each price from $$$1$$$ to $$$n$$$ occurs exactly ...
1,700
If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO". In the first case the second line must contain $$$n$$$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answ...
standard output
PASSED
f26375fd16a11489bc66f101c959b47b
train_001.jsonl
1603623900
Tenten runs a weapon shop for ninjas. Today she is willing to sell $$$n$$$ shurikens which cost $$$1$$$, $$$2$$$, ..., $$$n$$$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shur...
256 megabytes
import java.io.*; import java.util.*; import java.lang.*; import java.math.*; import java.text.DecimalFormat; import java.lang.reflect.Array; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.Bi...
Java
["4\n+\n+\n- 2\n+\n- 3\n+\n- 1\n- 4", "1\n- 1\n+", "3\n+\n+\n+\n- 2\n- 1\n- 3"]
1 second
["YES\n4 2 3 1", "NO", "NO"]
NoteIn the first example Tenten first placed shurikens with prices $$$4$$$ and $$$2$$$. After this a customer came in and bought the cheapest shuriken which costed $$$2$$$. Next, Tenten added a shuriken with price $$$3$$$ on the showcase to the already placed $$$4$$$-ryo. Then a new customer bought this $$$3$$$-ryo shu...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
5fa2af185c4e3c8a1ce3df0983824bad
The first line contains the only integer $$$n$$$ ($$$1\leq n\leq 10^5$$$) standing for the number of shurikens. The following $$$2n$$$ lines describe the events in the format described above. It's guaranteed that there are exactly $$$n$$$ events of the first type, and each price from $$$1$$$ to $$$n$$$ occurs exactly ...
1,700
If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO". In the first case the second line must contain $$$n$$$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answ...
standard output
PASSED
dcb5e9539770f6bf2e4ef12d7b7dde88
train_001.jsonl
1603623900
Tenten runs a weapon shop for ninjas. Today she is willing to sell $$$n$$$ shurikens which cost $$$1$$$, $$$2$$$, ..., $$$n$$$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shur...
256 megabytes
// Main Code at the Bottom import java.util.*; import java.io.*; public class Main{ //Fast IO class static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { boolean env=System.getProperty("ONLINE_JUDGE") != null; if(!env) { try { ...
Java
["4\n+\n+\n- 2\n+\n- 3\n+\n- 1\n- 4", "1\n- 1\n+", "3\n+\n+\n+\n- 2\n- 1\n- 3"]
1 second
["YES\n4 2 3 1", "NO", "NO"]
NoteIn the first example Tenten first placed shurikens with prices $$$4$$$ and $$$2$$$. After this a customer came in and bought the cheapest shuriken which costed $$$2$$$. Next, Tenten added a shuriken with price $$$3$$$ on the showcase to the already placed $$$4$$$-ryo. Then a new customer bought this $$$3$$$-ryo shu...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
5fa2af185c4e3c8a1ce3df0983824bad
The first line contains the only integer $$$n$$$ ($$$1\leq n\leq 10^5$$$) standing for the number of shurikens. The following $$$2n$$$ lines describe the events in the format described above. It's guaranteed that there are exactly $$$n$$$ events of the first type, and each price from $$$1$$$ to $$$n$$$ occurs exactly ...
1,700
If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO". In the first case the second line must contain $$$n$$$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answ...
standard output
PASSED
0ce84aa3a6b4f1b294a8695bc4ee7bac
train_001.jsonl
1603623900
Tenten runs a weapon shop for ninjas. Today she is willing to sell $$$n$$$ shurikens which cost $$$1$$$, $$$2$$$, ..., $$$n$$$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shur...
256 megabytes
import java.io.*; import java.util.*; import static java.lang.Math.max; import static java.lang.Math.min; import static java.util.Arrays.fill; import static java.util.Arrays.sort; import static java.util.Comparator.comparingInt; public class Miston { FastScanner in; PrintWriter out; private void DP_solve...
Java
["4\n+\n+\n- 2\n+\n- 3\n+\n- 1\n- 4", "1\n- 1\n+", "3\n+\n+\n+\n- 2\n- 1\n- 3"]
1 second
["YES\n4 2 3 1", "NO", "NO"]
NoteIn the first example Tenten first placed shurikens with prices $$$4$$$ and $$$2$$$. After this a customer came in and bought the cheapest shuriken which costed $$$2$$$. Next, Tenten added a shuriken with price $$$3$$$ on the showcase to the already placed $$$4$$$-ryo. Then a new customer bought this $$$3$$$-ryo shu...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
5fa2af185c4e3c8a1ce3df0983824bad
The first line contains the only integer $$$n$$$ ($$$1\leq n\leq 10^5$$$) standing for the number of shurikens. The following $$$2n$$$ lines describe the events in the format described above. It's guaranteed that there are exactly $$$n$$$ events of the first type, and each price from $$$1$$$ to $$$n$$$ occurs exactly ...
1,700
If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO". In the first case the second line must contain $$$n$$$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answ...
standard output
PASSED
ac649a8f0a87e8c7224106963cfcf473
train_001.jsonl
1603623900
Tenten runs a weapon shop for ninjas. Today she is willing to sell $$$n$$$ shurikens which cost $$$1$$$, $$$2$$$, ..., $$$n$$$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shur...
256 megabytes
//cyan piece of shit import static java.lang.Math.max; import static java.lang.Math.min; import static java.lang.Math.abs; import java.util.*; import java.io.*; import java.math.*; public class x1413D { public static void main(String hi[]) throws Exception { BufferedReader infile = new Buffe...
Java
["4\n+\n+\n- 2\n+\n- 3\n+\n- 1\n- 4", "1\n- 1\n+", "3\n+\n+\n+\n- 2\n- 1\n- 3"]
1 second
["YES\n4 2 3 1", "NO", "NO"]
NoteIn the first example Tenten first placed shurikens with prices $$$4$$$ and $$$2$$$. After this a customer came in and bought the cheapest shuriken which costed $$$2$$$. Next, Tenten added a shuriken with price $$$3$$$ on the showcase to the already placed $$$4$$$-ryo. Then a new customer bought this $$$3$$$-ryo shu...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
5fa2af185c4e3c8a1ce3df0983824bad
The first line contains the only integer $$$n$$$ ($$$1\leq n\leq 10^5$$$) standing for the number of shurikens. The following $$$2n$$$ lines describe the events in the format described above. It's guaranteed that there are exactly $$$n$$$ events of the first type, and each price from $$$1$$$ to $$$n$$$ occurs exactly ...
1,700
If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO". In the first case the second line must contain $$$n$$$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answ...
standard output
PASSED
d5684f0a0b76eb710d3b9394b78ad9d2
train_001.jsonl
1603623900
Tenten runs a weapon shop for ninjas. Today she is willing to sell $$$n$$$ shurikens which cost $$$1$$$, $$$2$$$, ..., $$$n$$$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shur...
256 megabytes
import java.awt.Point; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.math.BigDecimal; import java.math.BigInteger; imp...
Java
["4\n+\n+\n- 2\n+\n- 3\n+\n- 1\n- 4", "1\n- 1\n+", "3\n+\n+\n+\n- 2\n- 1\n- 3"]
1 second
["YES\n4 2 3 1", "NO", "NO"]
NoteIn the first example Tenten first placed shurikens with prices $$$4$$$ and $$$2$$$. After this a customer came in and bought the cheapest shuriken which costed $$$2$$$. Next, Tenten added a shuriken with price $$$3$$$ on the showcase to the already placed $$$4$$$-ryo. Then a new customer bought this $$$3$$$-ryo shu...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
5fa2af185c4e3c8a1ce3df0983824bad
The first line contains the only integer $$$n$$$ ($$$1\leq n\leq 10^5$$$) standing for the number of shurikens. The following $$$2n$$$ lines describe the events in the format described above. It's guaranteed that there are exactly $$$n$$$ events of the first type, and each price from $$$1$$$ to $$$n$$$ occurs exactly ...
1,700
If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO". In the first case the second line must contain $$$n$$$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answ...
standard output
PASSED
2b21e89217a75e684ba47e847046997b
train_001.jsonl
1603623900
Tenten runs a weapon shop for ninjas. Today she is willing to sell $$$n$$$ shurikens which cost $$$1$$$, $$$2$$$, ..., $$$n$$$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shur...
256 megabytes
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.*; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; public class Main { public static void main(String[] args) {...
Java
["4\n+\n+\n- 2\n+\n- 3\n+\n- 1\n- 4", "1\n- 1\n+", "3\n+\n+\n+\n- 2\n- 1\n- 3"]
1 second
["YES\n4 2 3 1", "NO", "NO"]
NoteIn the first example Tenten first placed shurikens with prices $$$4$$$ and $$$2$$$. After this a customer came in and bought the cheapest shuriken which costed $$$2$$$. Next, Tenten added a shuriken with price $$$3$$$ on the showcase to the already placed $$$4$$$-ryo. Then a new customer bought this $$$3$$$-ryo shu...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
5fa2af185c4e3c8a1ce3df0983824bad
The first line contains the only integer $$$n$$$ ($$$1\leq n\leq 10^5$$$) standing for the number of shurikens. The following $$$2n$$$ lines describe the events in the format described above. It's guaranteed that there are exactly $$$n$$$ events of the first type, and each price from $$$1$$$ to $$$n$$$ occurs exactly ...
1,700
If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO". In the first case the second line must contain $$$n$$$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answ...
standard output
PASSED
9ee0cf50877b1523a2a41c8560e6dbce
train_001.jsonl
1603623900
Tenten runs a weapon shop for ninjas. Today she is willing to sell $$$n$$$ shurikens which cost $$$1$$$, $$$2$$$, ..., $$$n$$$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shur...
256 megabytes
import java.io.*; import java.util.*; public class Main { public static void main(String args[]) { FastReader input=new FastReader(); PrintWriter out=new PrintWriter(System.out); int T=1; while(T-->0) { int n=input.nextInt(); int count=0; ...
Java
["4\n+\n+\n- 2\n+\n- 3\n+\n- 1\n- 4", "1\n- 1\n+", "3\n+\n+\n+\n- 2\n- 1\n- 3"]
1 second
["YES\n4 2 3 1", "NO", "NO"]
NoteIn the first example Tenten first placed shurikens with prices $$$4$$$ and $$$2$$$. After this a customer came in and bought the cheapest shuriken which costed $$$2$$$. Next, Tenten added a shuriken with price $$$3$$$ on the showcase to the already placed $$$4$$$-ryo. Then a new customer bought this $$$3$$$-ryo shu...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
5fa2af185c4e3c8a1ce3df0983824bad
The first line contains the only integer $$$n$$$ ($$$1\leq n\leq 10^5$$$) standing for the number of shurikens. The following $$$2n$$$ lines describe the events in the format described above. It's guaranteed that there are exactly $$$n$$$ events of the first type, and each price from $$$1$$$ to $$$n$$$ occurs exactly ...
1,700
If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO". In the first case the second line must contain $$$n$$$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answ...
standard output
PASSED
4db110399d36bf4c30781aca68521f04
train_001.jsonl
1603623900
Tenten runs a weapon shop for ninjas. Today she is willing to sell $$$n$$$ shurikens which cost $$$1$$$, $$$2$$$, ..., $$$n$$$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shur...
256 megabytes
import java.util.*; import java.io.*; import static java.lang.Math.*; public class Main { static long INF = (long) (2e10); static FastScanner sc; static PrintWriter pw; public static void main(String[] args) throws IOException { sc = new FastScanner(System.in); pw = new PrintWriter...
Java
["4\n+\n+\n- 2\n+\n- 3\n+\n- 1\n- 4", "1\n- 1\n+", "3\n+\n+\n+\n- 2\n- 1\n- 3"]
1 second
["YES\n4 2 3 1", "NO", "NO"]
NoteIn the first example Tenten first placed shurikens with prices $$$4$$$ and $$$2$$$. After this a customer came in and bought the cheapest shuriken which costed $$$2$$$. Next, Tenten added a shuriken with price $$$3$$$ on the showcase to the already placed $$$4$$$-ryo. Then a new customer bought this $$$3$$$-ryo shu...
Java 8
standard input
[ "data structures", "implementation", "greedy" ]
5fa2af185c4e3c8a1ce3df0983824bad
The first line contains the only integer $$$n$$$ ($$$1\leq n\leq 10^5$$$) standing for the number of shurikens. The following $$$2n$$$ lines describe the events in the format described above. It's guaranteed that there are exactly $$$n$$$ events of the first type, and each price from $$$1$$$ to $$$n$$$ occurs exactly ...
1,700
If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO". In the first case the second line must contain $$$n$$$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answ...
standard output
PASSED
c9726b1f692bebe216d91f3516a17206
train_001.jsonl
1371992400
In this problem at each moment you have a set of intervals. You can move from interval (a, b) from our set to interval (c, d) from our set if and only if c &lt; a &lt; d or c &lt; b &lt; d. Also there is a path from interval I1 from our set to interval I2 from our set if there is a sequence of successive moves starting...
256 megabytes
import java.util.List; import java.util.NavigableSet; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.SortedSet; import java.util.Set; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.TreeSet; import java....
Java
["5\n1 1 5\n1 5 11\n2 1 2\n1 2 9\n2 1 2"]
2 seconds
["NO\nYES"]
null
Java 7
standard input
[ "data structures" ]
c686c3592542b70a3b617eb639c0e3f4
The first line of the input contains integer n denoting the number of queries, (1 ≤ n ≤ 105). Each of the following lines contains a query as described above. All numbers in the input are integers and don't exceed 109 by their absolute value. It's guaranteed that all queries are correct.
3,000
For each query of the second type print "YES" or "NO" on a separate line depending on the answer.
standard output
PASSED
69f88ef329f22b2fa2cd49278c61c332
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
//package sept; import java.io.*; import java.util.*; public class TimePass implements Runnable { InputStream is; PrintWriter out; String INPUT = "10 6\r\n" + "2 3 3 3 4 4 4 5 5 6"; //boolean debug=false; boolean debug=true; static long mod=998244353; static long mod2=1000000007; ...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
5a287e497b2994868788a92ee15909e0
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class AveragePower { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s = new Scanner(System.in); int n = s.nextInt(); int k = s.nextInt(); int m = s.nextInt(); int[] a = new int[n]; long sum = 0; for (int...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
9a6dd0dfe40e3881f5d0b6b4bca3c35a
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
// Feb 28, 2019 import java.util.*; public class Superhero { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int n = scnr.nextInt(); int k = scnr.nextInt(); int m = scnr.nextInt(); scnr.nextLine(); int[] superHeroes = new int[n]; for (int i = 0; i < n; i++) { superHer...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
6feee93fc4c56c6aeb53e52092a34e12
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public class CodeCraft { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(n...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
b3a78d02717e7bdc3a682438f8f0905d
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class Main { static PrintWriter out; public static void main(String[] args) throws Exception { Scan...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
3ceaf32bac4484b2a95a94174a9ca08b
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.BufferedReader; import java.io.FileReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Stack; import java.util.StringTokenizer; public class Main { public static void main(String args[]) throws Exception { init(); int n =...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
d95a4d926a7faa7d558e76ab3c65e366
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.*; import java.util.*; import java.math.*; import java.lang.*; import static java.lang.Math.*; public class fast implements Runnable { static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numCh...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
a2a1cee00a98435f86d7b5951c3c2ceb
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.*; import java.io.*; import java.util.Queue; import java.util.LinkedList; import java.math.*; public class Solution implements Runnable { public static void solve() { int n=i(); long k=i(); int m=i(); long[] arr = new long[n]; for(int...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
ead0bae3bc90eb98772a11ccf2b0706d
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.InputStream; import java.io.PrintStream; import java.util.function.Supplier; import java.util.*; public class GangPower { static Supplier<InputStream> inputSupplier = () -> System.in; static Supplier<PrintStream> outSupplier = () -> System.out; public static void main(String[] args) { ...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
a8f82c106292938b24e407fbd4278447
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class SolutionCF1111B6 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int numOfHero = sc.nextInt(); int kLimit = sc.nextInt(); int mOp = sc.nextInt(); int[] powerArray =...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
b4ad4eaceeb03410ac4475bba8b050c1
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class SolutionCF1111B6 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int numOfHero = sc.nextInt(); int kLimit = sc.nextInt(); int mOp = sc.nextInt(); int[] powerArray =...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
9e55f8e1be0f6f46ebc8ab3d93fb223d
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class SolutionCF1111B3 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int numOfHero = sc.nextInt(); int kLimit = sc.nextInt(); int mOp = sc.nextInt(); int[] powerArray =...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
4708321d5801e4a5d2ee88134c698aec
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class SolutionCF1111B8 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int numOfHero = sc.nextInt(); int kLimit = sc.nextInt(); int mOp = sc.nextInt(); int[] powerArray =...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
6eb3d43f97b6754e0dbef55468040885
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.util.Arrays; import java.util.Scanner; public class SolutionCF1111B6 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int numOfHero = sc.nextInt(); int kLimit = sc.nextInt(); int mOp = sc.nextInt(); int[] powerArray =...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output
PASSED
cfad5b1b0dc4bbc8462c4f59a59a992e
train_001.jsonl
1549208100
Every superhero has been given a power value by the Felicity Committee. The avengers crew wants to maximize the average power of the superheroes in their team by performing certain operations.Initially, there are $$$n$$$ superheroes in avengers team having powers $$$a_1, a_2, \ldots, a_n$$$, respectively. In one operat...
256 megabytes
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.StringTokenizer; public class Average_Superhero { public static void main(String[] args) {...
Java
["2 4 6\n4 7", "4 2 6\n1 3 2 3"]
1 second
["11.00000000000000000000", "5.00000000000000000000"]
NoteIn the first example, the maximum average is obtained by deleting the first element and increasing the second element four times.In the second sample, one of the ways to achieve maximum average is to delete the first and the third element and increase the second and the fourth elements by $$$2$$$ each.
Java 8
standard input
[ "implementation", "brute force", "math" ]
d6e44bd8ac03876cb03be0731f7dda3d
The first line contains three integers $$$n$$$, $$$k$$$ and $$$m$$$ ($$$1 \le n \le 10^{5}$$$, $$$1 \le k \le 10^{5}$$$, $$$1 \le m \le 10^{7}$$$) — the number of superheroes, the maximum number of times you can increase power of a particular superhero, and the total maximum number of operations. The second line contai...
1,700
Output a single number — the maximum final average power. Your answer is considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is accepted if and only if $$$\frac{|a - b|}{\max{(1, |b|)}} \le 10^{-6}$$$.
standard output