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 | 3daffe5809221b1ceddbe65a9a11ce7c | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 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.Collections;
import java.util.StringTokenizer;
import java.io.PrintWriter;
public class a {
public static void main(String[] args) {
FastScanner fs = ne... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 8b6f8ca69f4e1bc8deda247c4f6ff017 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Tanzim Ibn Patowary
*/
public class Main {
public static void main(String[] args) {
I... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 40d91818fb73ecbfca6ac94573fe0585 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
for(int i=0;i<t;i++){
System.out.println(Math.max(sc.nextInt(),Math.max(sc.nextInt(),sc.nextInt())));
}
}
} | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | acea32f3961674ab14474bcaa762f489 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class A {
public static void main (String[] args) throws java.lang.Exception {
FastReader in = new FastReader();
int t = in.nextInt();
while(t-->0) {
int a = in.nextInt(... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | bbd11971518845814777583f462ae0b2 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class A {
public static void main (String[] args) throws java.lang.Exception {
FastReader in = new FastReader();
int t = in.nextInt();
while(t-->0) {
int a = in.nextInt(... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 792c853cdf827d881056f2ab61a067b8 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.util.*;
public class Solution{
public static void main(String[] agrs){
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int z=0;z<t;z++){
double a = sc.nextDouble();
double b = sc.nextDouble();
double c = sc.nextDouble();
... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | ce4ed1c1ac5e63b383b1b499f68d94c7 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.*;
public class code1{
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader()
... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 2fecf849f93d31a74f96abe3ee4d626a | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | //package codeforce;
import javafx.scene.transform.Scale;
import java.util.Scanner;
public class ograzhdenie {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for (int i = 0; i < t; i++) {
long a = sc.nextLong(), b = sc.next... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 9cdc88c545ac88797d33f0fc0481f953 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | /* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class Main {
public static class FastReader {
BufferedReader br;
StringTokenizer st;
public FastReade... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 54d431e088bb5351e9aeb19b6adb6c11 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | ... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 35d633a69b481a7718867ca2976ccf01 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes |
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | ... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | d0fe1dc21f97b15c469e2802ccb3b474 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.util.Scanner;
public class Program {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
for (int i = 0; i < n; i++) {
int a = scanner.nextInt();
int b = scanner.nextInt();
int c = scan... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | ae2a5d0cf429bd42fb650aeeca104f5f | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | //JAI BAJRANGBALI
import java.util.*;
import java.io.*;
import java.math.BigInteger;
//class Main //AtCoder
//class Solution // Codechef
public class Solution //Codeforces
{
... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 92f269b74c48f2919d013031441c15e1 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | //package codeforces.div2;
import java.util.Scanner;
public class Fence {
static public void print(long a, long b, long c) {
long x = (a + b + c) - 1;
System.out.println(x);
}
public static void main(String []args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 2531c5ba70e60a7b7558a444fae6f649 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.io.*;
import java.util.*;
public class A {
public static void main(String args[]) {
FastReader sc = new FastReader();
PrintWriter out = new PrintWriter(System.out);
int t, n, i, j;
String s;
t = sc.nextInt();
while(t-->0) {
int arr[] = sc... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | c1c05164e2b60ef712fea706ff71d1a9 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.util.Arrays;
import java.util.Scanner;
public class Codeforces {
public static boolean isPowerOfTwo (int x) {
return x!=0 && ((x&(x-1)) == 0);
}
public static int binsearch(long[] a,long x){
int l = 0;
int r = a.length;
while (l <= r){
int mid = l + (... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | ae4aff7b0b3469a3f6386dc653ee6245 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes |
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
public clas... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 9610b21591a8ae6da6c10234d1d74bba | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.util.*;
public class mysol {
public static void main(String[] args){
Scanner scn=new Scanner(System.in);
int t=scn.nextInt();
long ans=0;
while(t-->0){
long a=scn.nextLong();
long b=scn.nextLong();
long c=scn.nextLong();
... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | fa83402f91bdde4c2be6e6d0c5750dc1 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Task{
// ..............code begins here..............
static long mod=(long)1e9+7;
static void solve() throws IOException {
long[] x=long_arr();
long s=(x[0]+x[1]+x[2]);
out.write((s-1)+"\n");
}
pu... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 6086f2d6a7d88232d56cdf9046cd2cf6 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
long a = sc.nextInt();
long b = sc.nextInt();
long c = sc.nextInt();
long ans = a+b+c-1;
System.out.println(ans);
... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 35a0c15ffdc00df5d2d9e4784eee8182 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.util.*;
public class ClassA {
static Scanner scanner =new Scanner(System.in);
static long a,b,c,testCases;
public static void main(String[] args) {
testCases=scanner.nextInt();
for(int i=0;i<testCases;i++){
a=scanner.next... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 3b246ebe3e6c3a1b5fd094461ebcf155 | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes |
import java.util.*;
import java.io.*;
public class D {
static class FastReader
{
BufferedReader br;
StringTokenizer st;
public FastReader() throws Exception
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
while (st == null || !st.hasMoreElements())... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | b836e81c917dbd8de841d607d0e40b8a | train_000.jsonl | 1601827500 | Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th... | 256 megabytes | import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class atc3 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t-->0){
long a=sc.nextLong();
long b=sc.nextLong();
l... | Java | ["2\n1 2 3\n12 34 56"] | 1 second | ["4\n42"] | NoteWe can build a quadrilateral with sides $$$1$$$, $$$2$$$, $$$3$$$, $$$4$$$.We can build a quadrilateral with sides $$$12$$$, $$$34$$$, $$$56$$$, $$$42$$$. | Java 8 | standard input | [
"geometry",
"math"
] | 40d679f53417ba058144c745e7a2c76d | The first line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The next $$$t$$$ lines describe the test cases. Each line contains three integers $$$a$$$, $$$b$$$, and $$$c$$$ — the lengths of the three fence segments ($$$1 \le a, b, c \le 10^9$$$). | 800 | For each test case print a single integer $$$d$$$ — the length of the fourth fence segment that is suitable for building the fence. If there are multiple answers, print any. We can show that an answer always exists. | standard output | |
PASSED | 7a411b9ba1f25d0cf8e97277f6930a84 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | //package a2oj_ladder_C;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | c51079bdceac154ef271fc0f93820588 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new Pri... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | ad87ed164787a51f38c4458a4b204142 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public ... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | e89dc583cc2a91033569ce0f39df89e4 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashMap;
public class R109_D1_A {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
Prin... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 131540dbeebe3a40b31ab271f7c63223 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
public class practice {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
String s=scn.next(),p;
int k=scn.nextInt(),x=0,y=0,ans=0;
char a,b;
for(int i=0;i<k;i++){
p=scn.next();
for(int j=0;j<s.length();j++){
if(s.charAt(j)==p.charAt(0)){
x++;... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 99d66afe8a7d77d20e991f81907e593e | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.*;
import java.util.*;
public class Template implements Runnable {
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws FileNotFoundException {
try {
in = new BufferedReader(new FileReader("input.txt"));
o... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | bb111f29b8055c0b491934ff85176639 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
import java.io.*;
import java.lang.*;
public class A154 {
private static long mod = 1000000007;
public static void main(String[] args) {
InputReader in=new InputReader(System.in);
PrintWriter pw=new PrintWriter(System.out);
String s=" ";
s+=in.nextLine();
int m=in.nextInt();
int ... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 30d6062acc2380e5955fb3041d37bc5b | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.Writer;
i... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 808e3f03c5833c6fb91cd04bd4d3faa2 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 7cb40baece52de1c5c817069886f3a88 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | d04f3d222f31db6a09e1d373c2421337 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 604193df86876f379d09b29864b47c9b | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 651c9aa97efeb490024c6203faa5c1f6 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | /*
*
* @Author Ajudiya_13(Bhargav Girdharbhai Ajudiya)
* Dhirubhai Ambani Institute of Information And Communication Technology
*
*/
import java.util.*;
import java.io.*;
import java.lang.*;
public class Code162
{
static class InputReader {
private final InputStream stream;
private final byte[]... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 78230c0ccc296804167fe78b3122a57b | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String str = sc.next();
int n = sc.nextInt();
int ans=0;
int len=0;
int aa=0;
int bb=0;
for(int j=1;j<=n;j++){
Stri... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | b55be5202cf35ddaff326159d621bc5a | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes |
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import static java.lang.Integer.min;
public class Hometask implements Closeable {
private InputReader in ... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 9d0dba7e112f69389d9b049014075904 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
import java.io.*;
public class Hometask {
/************************ SOLUTION STARTS HERE ************************/
private static void solve() {
char str[] = nextLine().toCharArray();
int k = nextInt();
char map[] = new char[... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 0cc74b6c0043350228aad97b952b29dd | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.awt.*;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Abc {
static char[] s;
static int k;
static Set<String> set;
static int dp[][];
public static void main(String[] args) throws IOException {
FastReader sc = new FastReader();
s=sc.next(... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 6412f0d52bbd321dc5e86e496fbfb4ab | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | //package codeforces;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
i... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | ee89a55b67d6e9e5fbde0d41157905c1 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | /*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking inter... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 1f3d84a0c9d9ff37767603382299061b | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.*;
import java.util.*;
public final class hometask
{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static FastScanner sc=new FastScanner(br);
static PrintWriter out=new PrintWriter(System.out);
static char[] a;
static int[][] dp;
static int[] b;
static int n;... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 71d04a20a2acba7a81e60da90d4380bb | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
private static char [] pair = new char[128];
private static char [] C,S;
private static int [] cnt;
private static void compress(){
int m = 0;
char lst = 0;
for (int i = 0;i < S.length;i++){
... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 9efa6b868a95ef1fc6082e2f2cd40ca8 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
/**
*
* @author fz
*/
publi... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 0f171dc1465a6fce0d6a95c436c89e9e | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.Arrays;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
Inpu... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 64d48d01cabebdf4a3358a87c2323722 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.StringTokenizer;
/**
* 154A
*
* @author artyom
*/
public class Hometask implements Runnable {
private static final int MAX = 'z' + 1;
private BufferedReader in;
pri... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 34ed64f61a93639f9fe06b0641b036d0 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
static class Reader
{
private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
public int read() {if (nu... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 6d76a96ad727609497e4125ebab9827d | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
//package CP;
import java.io.*;
import java.util.*;
public class A154
{
public static void main(String args[])throws IOException
... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | b58a6d41bc7d71cbe3bb45f6776e18e9 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
public class practice {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
String s=scn.next(),p;
int k=scn.nextInt(),x=0,y=0,ans=0;
char a,b;
for(int i=0;i<k;i++){
p=scn.next();
for(int j=0;j<s.length();j++){
if(s.charAt(j)==p.charAt(0)){
x++;... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 1f67c493a21898897f9f482eacaf90f3 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual soluti... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 95e5a643d5658c13e394061af9181c65 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes |
import java.util.Scanner;
public class Hometask
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
String s = sc.next();
int k = sc.nextInt();
int[] pair = new int[26];
for(int i = 0; i < 26; i++)
{
pair[i] = -1;
}
for(int i = 0; i < k; i++)
{
Strin... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 2dc67aea106b2ea739d9f19f44080f59 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
import java.io.*;
import static java.lang.Math.*;
public class PracticeProblem
{
/*
* This FastReader code is taken from GeeksForGeeks.com
* https://www.geeksforgeeks.org/fast-io-in-java-in-competitive-programming/
*
* The article was written by Rishabh Mahrsee
*/
p... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 8 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | b1783ddc058bcfac90c0a8460d694001 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.InputStreamReader;
import java.io.IOException;
import java.util.HashMap;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solutio... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 79f75e8f34acdac84002c7e27ec893f9 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
public class C {
static String s;
static boolean[][] adj = new boolean[31][31];
static int[][] dp;
static int n;
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
s = in.next();
int k = in.nextInt();
String t;
... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | d962b7067f91b6d17ddfa631ed7b2195 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;
public class ProblemA {
private void solve() {
Scanner in = new Scanner(new BufferedInputStream(System.in));
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 10447fff86ac53dd619636c2667f9f5f | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
public class Hometask {
private static final char SIMIL_NULL = (char)0;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String theString = sc.next();
char[] theStringChar = theStr... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | fef86cff7df2c86222db90c580d7de04 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
public class A {
private static final Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
final char[] cs = sc.next().toCharArray();
final int n = sc.nextInt();
char[][] pat = new char[n][];
for(int i = 0; i < n; i++) {
... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | c8f3b5c892da37f67403baece73a959f | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import static java.lang.Math.min;
import static java.util.Arrays.deepToString;
import java.io.*;
import java.math.*;
import java.util.*;
public class A {
static int solve(String ws, char[][] ch) {
int ans = 0;
char[] w = ws.toCharArray();
for (char[] c : ch) {
int pos = 0;
while (pos < w.length) {
i... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | fcb12603a60fea58b221585c9a4de6b9 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.*;
public class A {
char [] F = new char[256];
public A () throws IOException {
String input = r.readLine();
int K = Integer.parseInt(r.readLine());
for (int i = 0; i < K; ++i) {
char [] f = r.readLine().toCharArray();
F[f[0]] = f[1];
F[f[1]] = f[0];
}
solve(input);
}
public vo... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 6b39019d56e4e9692ef8f2b008ce2fbd | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 2e963c617f7390ca4c7a2b75d1c7d478 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;
publ... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | fe50d06006fc074df623b8b411178d28 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
public class c154A
{
private final Scanner sc;
private static final boolean debug = true;
static void debug(Object ... objects)
{
if(debug)
System.err.println(Arrays.toString(objects));
}
c154A()
{
sc = new Scanner(System.in);
}... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | fdc6954b26ada96a0fc2d0bf71889b71 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
import static java.lang.Math.*;
import java.io.*;
public class A {
public static void p(Object ...args) {System.out.println(Arrays.toString(args));}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String S = in.next();
int N = S.length();
int[] C = new int[... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 5f1a453d5938bcb89c0fd8ccd3aeab70 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.*;
import java.util.*;
public class A implements Runnable {
private MyScanner in;
private PrintWriter out;
private void solve() {
char[] s = in.next().toCharArray();
int k = in.nextInt();
HashSet<Integer> hashes = new HashSet<Integer>();
final int MUL = 239;
for (int i = 0; i < k; ++i) {
... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | b84128157931aae69eae795e0653e582 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.util.*;
public class cf154a {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
char[] v = in.next().trim().toCharArray();
int n = in.nextInt();
boolean[][] g = new boolean[26][26];
for(int i=0; i<n; i++) {
String s = in.next().trim();
int a = s.charAt(0)-'a';
... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 6e361ac56ab57341f72d8032b82ddc37 | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* Created by IntelliJ IDEA.
* User: aircube
*/
public class taskA {
BufferedReader reader;
StringTokenizer tokenizer;
Pr... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 3ac5c46ff1f2de89dde90e0334a7460d | train_000.jsonl | 1330095600 | Sergey attends lessons of the N-ish language. Each lesson he receives a hometask. This time the task is to translate some sentence to the N-ish language. Sentences of the N-ish language can be represented as strings consisting of lowercase Latin letters without spaces or punctuation marks.Sergey totally forgot about th... | 256 megabytes | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
public class Main {
static char[] input;
static int[] states;
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {... | Java | ["ababa\n1\nab", "codeforces\n2\ndo\ncs"] | 2 seconds | ["2", "1"] | NoteIn the first sample you should remove two letters b.In the second sample you should remove the second or the third letter. The second restriction doesn't influence the solution. | Java 6 | standard input | [
"greedy"
] | da2b3450a3ca05a60ea4de6bab9291e9 | The first line contains a non-empty string s, consisting of lowercase Latin letters — that's the initial sentence in N-ish, written by Sergey. The length of string s doesn't exceed 105. The next line contains integer k (0 ≤ k ≤ 13) — the number of forbidden pairs of letters. Next k lines contain descriptions of forbidd... | 1,600 | Print the single number — the smallest number of letters that need to be removed to get a string without any forbidden pairs of neighboring letters. Please note that the answer always exists as it is always possible to remove all letters. | standard output | |
PASSED | 6f09f5e5cdea2200fee84dd042ebcdf3 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Vector;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Stack;
import java.io.InputStream;
/**
* Built using CHelper plug-in
... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 72dd9342e6c7e62eed73d3f13847575e | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 379c3a4606468449a02d495340257acf | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | f59bd43cfa86119392ef7eb974d8b008 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 13f55ba3751984b5022d6693b0536667 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | da1969428240a5906713a93bdef95e17 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | ecef03d06fd7e880ccad9e42e986934e | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 5e9a78704ceff50e0914bc679a40ed59 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 7ee93811c22dedaffa10e2f937ab7d64 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 7670688a6b5d70d240cfb6d475d7ad99 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Input... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 644df49d1e5bfa4eb72d20ddcc87fde5 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes |
/**
* Date: 29 Sep, 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 ja... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | cb8d33131b3c021dec86d547c3127cf2 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.*;
import java.util.*;
/**
*
* @author Jishnu_T
*/
public class ImbalancedArray {
private static long maxSum(int n,int[] ar)
{
long maxSum = 0;
Stack<Integer> s= new Stack<>();
for(int i=0;i<=n;i++)
{
if(i==0 || (i!=n &&... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | cb8fd9919a9e1df38e95e1b775d018f1 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | /* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
public class CF817D_fast_scanner
{
public static void main (String[] args) throws java.lang.Exception
{
FastScanner in = new Fast... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 7188c651cdd3943bf36410ae882b27fa | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.util.*;
import java.io.*;
public class CF817D_2{
public static int index;
public static void main(String[] args)throws Exception {
InputReader in = new InputReader(System.in);
PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
int n = in.nextInt();
Node [] arr = new ... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 9365aab3f79fd3a8a80d92e98715eec4 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Stack;
import java.util.StringTokenizer;
public class P817D
{
public static void main(String[] args)
{
FastScanner scan = new FastScanner();
int n = scan.nextInt();
int[] arr = new int[n];
for (int i = 0; i < n; i++)
arr[i] ... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | ab2e7faed4a006c3c27f80827354a1d9 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Task{
static long sumSubarrayMax(int[] A) {
int[] ple=new int[A.length];
int[] nle=new int[A.length];
Stack<Integer>ples=new Stack<>();
Stack<Integer>nles=new Stack<>();
//for ple
for(int i=0;i<A.length;i++){
... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 22dc7faa60a8fb188db9819543513ce7 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | //import java.util.*;
//import java.io.*;
//import java.lang.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Stack;
public class Task{
pub... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 06c28832cfcbbb76b2d5287061b53a7d | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Task{
static long Mins(int[] A) {
Stack<Integer> stack = new Stack<>();
long[] dp = new long[A.length + 1];
stack.push(-1);
long result = 0;
for (int i = 0; i < A.length; i++) {
while (stack.peek() != -1 && A[i] <= A... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | b316001d35fe2a110de5a953db7a0da4 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | /* Author: Ronak Agarwal */
import java.io.* ; import java.util.* ; import java.math.* ;
import static java.lang.Math.min ;
import static java.lang.Math.max ;
import static java.lang.Math.abs ;
/* Thread is created here to increase the stack size of the java code so that recursive dfs can be performed */
public class C... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 027b9304081743f1811521f350357bcd | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | //created by Whiplash99
import java.io.*;
import java.util.*;
public class A
{
public static void main(String[] args) throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,N;
N=Integer.parseInt(br.readLine().trim());
String[] s=br.read... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 1b2d96d1911f63731b77a29906a54272 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes |
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Bit... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | c388236bad675db4c86b68bdbcf6f82b | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.util.*;
import java.io.*;
public class ImbalancedArray {
/************************ SOLUTION STARTS HERE ************************/
static class SegmentTree {
int tree[];
int len;
int size;
SegmentTree(int len) {
this.len = len;
... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 07b0e29e6af66eb9c6869cc1e38cfe6c | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.util.*;
import java.io.*;
public class ImbalancedArray {
/************************ SOLUTION STARTS HERE ************************/
static class SegmentTree {
int tree[];
int len;
int size;
SegmentTree(int len) {
this.len = len;
// ... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | fe0ff16b4c67c5cd08ee13a4917792ca | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.util.*;
import java.io.*;
public class Main {
public static class Node implements Comparable<Node> {
public final Integer index, val;
Node(int index, int val) {
this.index = index;
this.val = val;
}
@Override
public int compareTo(Node node)... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 3b2e9dc279f10a27c4adfb0679d42bbb | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
import java.util.Stack;
import java.util.StringTokenizer;... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 539e71c0d139642bb5e212cd2faf2965 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.*;
import java.util.*;
public class Main
{
static class FastReader
{
final BufferedReader br;
StringTokenizer st;
FastReader()
{
br = new BufferedReader(new
InputStreamReader(System.in));
}
String next()
{
... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | b00448c0123882652568a2724e316073 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.StringTokenizer;
/*
public class _817D {
}
*/
public cla... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | ad3f65f8b8e6d3f50fe382f3679f020a | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.StringTokenizer;
/*
public class _817D {
}
*/
public cla... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | c4a0f86f72b48558147109942beaa0d0 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | //package educational.round23;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class D {
InputStream is;
PrintWriter out;
String INPUT = "";
void solve()
{
int n = ... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 16003671ecee36e6a2f0d13a4aebde26 | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.*;
import java.util.*;
public class TestClass {
static PrintWriter out = new PrintWriter(System.out);
public static void main(String args[] ) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
Str... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | ca09e63fa9f348c26c2aa01e271412ff | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;
public final class imb
{
static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
static FastScanner sc=new FastScanner(br);
static PrintWriter out=new PrintWriter(System.out);
static Random rnd=new... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output | |
PASSED | 8a603ac6a34c7462363afb11d359c5bf | train_000.jsonl | 1497539100 | You are given an array a consisting of n elements. The imbalance value of some subsegment of this array is the difference between the maximum and minimum element from this segment. The imbalance value of the array is the sum of imbalance values of all subsegments of this array.For example, the imbalance value of array ... | 256 megabytes | import java.io.*;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class edu23d implements Runnable{
public static void main(String[] args) {
try{
new Thread(null, new edu23d(), "process", 1<<26).start();
}
catch(Exception e){
System.out.println(e);
... | Java | ["3\n1 4 1"] | 2 seconds | ["9"] | null | Java 8 | standard input | [
"data structures",
"dsu",
"divide and conquer",
"sortings"
] | 38210a3dcb16ce2bbc81aa1d39d23112 | The first line contains one integer n (1 ≤ n ≤ 106) — size of the array a. The second line contains n integers a1, a2... an (1 ≤ ai ≤ 106) — elements of the array. | 1,900 | Print one integer — the imbalance value of a. | standard output |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.