src
stringlengths
95
64.6k
complexity
stringclasses
7 values
problem
stringlengths
6
50
from
stringclasses
1 value
import java.io.InputStreamReader; import java.util.Scanner; public class Hexadecimal { public static void main(String [] args){ Scanner s = new Scanner(new InputStreamReader(System.in)); int x = s.nextInt(); System.out.println(x + " " + 0 + " " + 0); } }
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.io.*; import java.util.*; public class A { public static void main(String[] args) throws Exception { new A().solve(); } void solve() throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.readLine()); ...
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class HexTheorem { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader read = new BufferedReader(new InputStreamReader(System.in)); int x = Integer.pars...
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.io.*; import java.text.*; import java.math.*; import java.util.*; public class Hexadec implements Runnable { final static String taskname = "filename"; public void solve() throws Exception { // int n = iread(); int n = Integer.parseInt(in.readLine()); out.write(n ...
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.util.Scanner; public class Fibonacci { public static void main(String[] args) { Scanner input = new Scanner(System.in); long num =0; num = input.nextLong(); while (num<0 || num>Math.pow(10,9)) { System.out.println("Invalid"); num = input.nextLong(); } System.out.println("0 0 "+num); } ...
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.StringTokenizer; public class Main { pu...
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.util.Scanner; public class N1_CF_199A { public static void main(String[] args) { int n = new Scanner(System.in).nextInt(); if( n == 0) { System.out.println(0); System.out.println(0); System.out.println(0); return; } int i = 0 , j = 1; while(true) ...
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.util.*; import java.io.*; import java.math.*; public class a extends Thread { BufferedReader bf; PrintWriter out; FastScanner in; void solve() throws Exception { long n = in.nextLong(); long f[] = new long[2001]; int i = 2; f[0] = 0; f[1] = 1; while (true){ f[i] = f[i-1] + f[i-2]; ...
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.util.*; public class A { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = sc.nextLong(); List<Long> fi = new ArrayList<Long>(); fi.add((long) 0); fi.add((long) 1); while (fi.get(fi.size()...
constant
199_A. Hexadecimal's theorem
CODEFORCES
import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Collections.*; import java.io.*; import java.math.*; import java.util.*; @SuppressWarnings("unused") public class A { public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); long n = in...
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.io.IOException; import java.util.Scanner; public class A199 { static int n[][] = new int[][] { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } }; public static void main(String[] args) throws IOException { new A199().solve(); } public void solve() throws IOException { Scanner scan = new Scanner(System....
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.io.PrintWriter; import java.util.Scanner; /** * Created with IntelliJ IDEA. * User: vaibhav mittal * Date: 23/6/12 * Time: 1:15 AM * To change this template use File | Settings | File Templates. */ public class Main { public static void main(String[] args) { Scanner in = new Scanner(Syste...
constant
199_A. Hexadecimal's theorem
CODEFORCES
import java.util.*; import java.io.*; import java.text.*; import java.math.*; import static java.lang.Integer.*; import static java.lang.Double.*; import java.lang.Math.*; public class two_squares { public static void main(String[] args) throws Exception { new two_squares().run(); } public void run() throws Exc...
constant
994_C. Two Squares
CODEFORCES
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; public class C { static StringBuilder st = new StringBuilder(); public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); Point [] sq...
constant
994_C. Two Squares
CODEFORCES
import java.util.*; import java.io.*; public class C994{ static double area(double x1,double y1,double x2,double y2,double x3,double y3){ return Math.abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0); } public static void main(String args[])throws IOException{ Scanner sc=new Scanner(new ...
constant
994_C. Two Squares
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; /** * @author Don Li */ public class TwoSquares { int INF = 1000; void solve() { int[][] s1 = new int[4][2]; for (int i = 0; i <...
constant
994_C. Two Squares
CODEFORCES
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class cf2 { static final double EPS = 1e-9; public static void main(String[] args) thro...
constant
994_C. Two Squares
CODEFORCES
/* Shubhang Verma */ import java.io.*; import java.math.*; import java.util.*; public class Main { public static void main(String[] args) { InputStream inputstream = System.in; OutputStream outputstream = System.out; InputReader in = new InputReader(inputstream); OutputWriter ...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.*; import java.lang.reflect.Array; import java.math.BigDecimal; import java.sql.Time; import java.util.*; import java.math.BigInteger; import static java.lang.Math.*; import static java.math.BigInteger.*; import static java.util.Arrays.*; public class Main{ void run(){ Locale.setDefault(...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.InputMismatchException; import java.util.LinkedList; public class D { static LinkedList<Integer>[] E; static int[] M; static boolean[] visited; static int n; static int center; public static bool...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.Reader; import java.util.Arrays; import java.util.InputMismatchException; import java.util.ArrayList; import java.io.InputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.util.List; import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; import ...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.*; import java.util.*; public class CF387D { static class A { ArrayList<Integer> list = new ArrayList<>(); int u, v, d; } static final int INF = Integer.MAX_VALUE; static boolean bfs(A[] aa, int n) { ArrayDeque<Integer> q = new ArrayDeque<>(); for (int u = 1; u <= n; u++) if (aa[u].v > 0)...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.awt.Point; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.InputMismatchException; public class R227_2_D { static ArrayList<Integer>[] graph; static int[] right, left; static boolean vis[];...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.*; import java.util.*; public class CF387D { static class A { ArrayList<Integer> list = new ArrayList<>(); int u, v, d; } static int INF = Integer.MAX_VALUE; static boolean bfs(A[] aa, int n) { LinkedList<Integer> q = new LinkedList<>(); for (int u = 1; u <= n; u++) if (aa[u].v > 0) a...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.LinkedList; import java.util.StringTokenizer; public class GeorgeAndInterestingGraph { public static void main(String[] args) { MyScanner sc = new MyScanner(); int N = sc.nextInt()...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.util.ArrayList; import java.util.Scanner; public class Main { static ArrayList<Edge> graph; static ArrayList<ArrayList<Integer>> graphForKuhn; static int n, m, u = 0; static int mt[]; static int used[]; public static void main(String[] args) { formGraph(); Sy...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; /** * @author Don Li */ public class GeorgeInterestingGraph { int N = 505; int INF = (int) 1e9; ...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class D { BufferedReader reader; StringTokenizer tokenizer; PrintWriter out; public void solve() throws IOException { int N = nextInt(); int M = n...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; /** * @author Don Li */ public class GeorgeInterestingGraph { int N = 505; int INF = (int) 1e9; ...
cubic
387_D. George and Interesting Graph
CODEFORCES
//Author: net12k44 import java.io.*; import java.util.*; public class Main{//} static PrintWriter out; static int c[][]; static int x[] , y[] , n; static int degIn[]; static ArrayList< ArrayList<Integer> >a = new ArrayList< ArrayList<Integer> >(); static int cnt = 0; static boolean b[]; private static boolean dfs(i...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.StringTokenizer; public class GeorgeAndInterestingGraph { public static void main(String[] args) { MyScanner sc = new MyScanner(); int N = sc.nextInt(); int M = sc.nextInt(...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.StringTokenizer; public class GeorgeAndInterestingGraph { public static void main(String[] args) { MyScanner sc = new MyScanner(); int N = sc.nextInt(); int M = sc.nextInt(...
cubic
387_D. George and Interesting Graph
CODEFORCES
//package codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class D { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); ...
cubic
387_D. George and Interesting Graph
CODEFORCES
import static java.lang.Math.*; import static java.util.Arrays.*; import static java.lang.System.out; import static java.util.Collections.*; import java.io.*; import java.math.*; import java.util.*; public class Main { static boolean LOCAL = System.getSecurityManager() == null; Scanner in = new Scanner(System.in); ...
cubic
387_D. George and Interesting Graph
CODEFORCES
//package codeforces; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class D { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); ...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.*; import java.lang.reflect.Array; import java.math.BigDecimal; import java.sql.Time; import java.util.*; import java.math.BigInteger; import static java.lang.Math.*; import static java.math.BigInteger.*; import static java.util.Arrays.*; public class Main{ void run(){ Locale.setDefault(...
cubic
387_D. George and Interesting Graph
CODEFORCES
//package round227; 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 = ni(), m = n...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.*; import java.util.*; public class CF387D { static class A { ArrayList<Integer> list = new ArrayList<>(); int u, v, d; } static int INF = Integer.MAX_VALUE; static boolean bfs(A[] aa, int n) { LinkedList<Integer> queue = new LinkedList<>(); for (int u = 1; u <= n; u++) if (aa[u].v > 0) ...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.*; import java.util.*; public class CF { class W implements Comparable<W> { int id, sz; W(int id, int sz) { this.id = id; this.sz = sz; } @Override public int compareTo(W o) { return -Integer.compare(sz, o.sz); } } int[] left; int center; boolean[] used; boolean go(int v)...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.util.LinkedList; import java.util.StringTokenizer; public class GeorgeAndInterestingGraph { public static void main(String[] args) { MyScanner sc = new MyScanner(); int N = sc.nextInt()...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Scanner; public class Main { public static void main(final String[] args) throws IOException { try(Scanner scan = new Scanner(System.in); PrintWr...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.*; import java.lang.reflect.Array; import java.math.BigDecimal; import java.sql.Time; import java.util.*; import java.math.BigInteger; import static java.lang.Math.*; import static java.math.BigInteger.*; import static java.util.Arrays.*; public class Main{ void run(){ Locale.setDefault(...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * @author she...
cubic
387_D. George and Interesting Graph
CODEFORCES
import com.sun.java_cup.internal.runtime.virtual_parse_stack; import java.util.Arrays; import java.util.Scanner; /** * Created by ali on 2/3/14. */ public class D { public static void main(String [] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); boolean [][] gra...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.io.InputStreamReader; import java.io.IOException; import java.util.Arrays; import java.util.ArrayList; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution ...
cubic
387_D. George and Interesting Graph
CODEFORCES
import java.util.Scanner; public class P23A { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String input = scan.nextLine(); System.out.println(F(input)); } static int F(String string){ int ans =0; for (int i = 0; i < string.length(); i++) { for (int j = 1; j < str...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; public class A { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String s = sc.next(); for (int l = s.length(); l > 0; --l) { HashSet<String> set = new HashSet<String>(); for (int i = 0; i < s.length() - l + 1; +...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.Scanner; public class Prob023A { public static void main( String[] Args ) { Scanner scan = new Scanner( System.in ); String s = scan.next(); all: for ( int x = s.length() - 1; x >= 0; x-- ) for ( int y = 0; x + y <= s.length(); y++ ) { ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class A23 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); Map<String, Boolean> map = new HashMap<String, Boolean>(); for (int i = s.length(); i >= 1; i--) { map.clear(); ...
cubic
23_A. You're Given a String...
CODEFORCES
/** * MxNINJA 04:06:52 ص 14/01/2014 */ import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); StringBuilder line = new StringBuild...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; public class YouAreGivenAString { public static void main(String[] args) throws Exception { // TODO Auto-generated method stub BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); String s=r.readLine(); int max=0; for(int ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner r = new Scanner(System.in); String a = r.next(); char[] c = a.toCharArray(); for(int l = a.length()-1; l >= 1; l--){ for(int i = 0; i <= a.length()-l; i++){ ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; import java.util.*; public class Main{ public static void main( String[] args ){ Scanner cin = new Scanner( System.in ); String s = cin.next(); int n = s.length(); char[] ss = new char[ n ]; ss = s.toCharArray(); int ans = 0; for (int i=0; i<n; i++) for (int j=i+1; j<n; j++){ ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.Scanner; public class prob1 { public static void main(String[] args) { Scanner input = new Scanner(System.in); String s = input.next(); int n = s.length(); int i = n-1; CharSequence temp; for(i = n-1; i > 0; i--) for(int j = 0 ; j <= n-i; j++) { temp = s.subSequence(j, i+j); ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; import java.util.*; import static java.lang.Math.*; import static java.util.Arrays.fill; import static java.util.Arrays.binarySearch; import static java.util.Arrays.sort; public class Main { public static void main(String[] args) throws IOException { try { if (new File("input.txt").exists()) ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; import java.io.*; public class a { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int len = s.length(); for(int i=len-1; i>=1; --i) { for(int j=0; j<=len - i; ++j) { String ss = s.substring(j, j+i); if(s.substring(j+1).ind...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; import java.util.*; public class Main implements Runnable { public void _main() throws IOException { String s = next(); for (int len = s.length(); len >= 1; len--) { for (int i = 0; i + len <= s.length(); i++) for (int j = i + 1; j + len <= s.length(); j++) if (s.substring(i, i + le...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; import java.util.*; public class Main implements Runnable { Scanner in; PrintWriter out; //= new PrintWriter(System.out); public static void main(String[] args) throws FileNotFoundException, IOException { new Thread(new Main()).start(); } public class Pair { public long last;...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.HashSet; import java.util.Locale; import java.util.Set; import java.util.StringTokenizer; public class A { private BufferedReader in; private St...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; import java.io.*; public class A0023 { public static void main(String args[]) throws Exception { new A0023(); } A0023() throws Exception { PandaScanner sc = null; PrintWriter out = null; try { sc = new PandaScanner(System.in); ou...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; public class ProblemA { public static ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; public class A23 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s = br.readLine(); for(int length = s.length(); length > 0; length--) { for(int start = 0; star...
cubic
23_A. You're Given a String...
CODEFORCES
//package arbuz; import java.util.Scanner; public class Arbuz { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); int i, j, current, longest = 0; for (i = 0; i < s.length(); i++) { for (j = 0; j < s.length(); j++) { ...
cubic
23_A. You're Given a String...
CODEFORCES
// by agus.mw import java.util.*; import java.io.*; public class Main{ public static void main(String[] args) throws Exception { new Main().doWork(); } void doWork() throws Exception{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter writer = new BufferedWri...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.Scanner; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author madi */ public class GivenString { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String line = sc.nextLine(); S...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; import java.io.*; public class Main { static Scanner cin = new Scanner(new BufferedReader(new InputStreamReader(System.in))); static PrintWriter cout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); public static void main(String[] agrs) throws IOException{ ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.Scanner; /** * @author Alexander Grigoryev * Created on 01.08.11 */ public class Main { static Scanner in = new Scanner(System.in); public static void main(String[] args) { String s = in.nextLine(); int k, ans = 0; for(int i = 0; i < s.length(); i++...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.Scanner; public class Main { /** * @param args */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(),c; int n = s.length(),a,b; for(int sz = n ; sz >= 1 ; sz--) { for(int i = 0 ; i+...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.Scanner; public class St { static void metod() throws Exception { Scanner in = new Scanner(System.in); String str = in.next(); int max = 0; for (int i = 0; i < str.length(); i++) { for (int j = i + 1; j < str.length() + 1; j++) { for (...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; public class test { static boolean isOK(String str, int len) { HashSet<String> hs=new HashSet<String>(); for(int i=0;i<=str.length()-len;i++) { String s=str.substring(i,len+i); if(hs.contains(s)) return true; else hs.add(s); } return false; } public ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; import java.io.*; public class givenstring { public static void main(String[] args){ Scanner reader = new Scanner(System.in); String in = reader.next(); int max = 0; for(int i = 0; i < in.length(); i++){ for(int j = i+1; j < in.length(); j++){ //take this substring String ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; import java.lang.*; import java.math.*; public class A { Scanner sc = new Scanner(System.in); void run(){ String s = sc.next(); String subS; int max = 0; for (int i=0;i<s.length();i++) { for (int j=i+1;j<s.length()+1;j...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; import java.util.StringTokenizer; public class DoubleWord implements Runnable { boolean isLocalMode =false; private void doJob() throws Exception { //do here String s = nextToken(); int max=0; for(int i = 0;i<s.length();i++){ for(int j=i+...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.lang.Math.*; import java.math.*; public class Main { void run() throws IOException { String s = token(); HashSet <String> h; int n = s.length(); int r = 0; loop: for (int i = 1; i...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class A implements Runnable { private void solve() throws IOException { String str = nextToken(); for (int i=str.length()-1; i>=0; --i) ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; import java.util.*; public class Main { /** * @author hunglee */ public static void main(String[] args) throws IOException { StreamTokenizer in = new StreamTokenizer(new BufferedReader( new InputStreamReader(System.in))); in.nextToken(); String s = in.sval; int l = s.length(); ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; public class OverlapedString { public static void main(String args[]) throws Exception { OverlapedString os = new OverlapedString(); BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); String line; while ((line = std...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; import java.util.*; public class A { String line; StringTokenizer inputParser; BufferedReader is; FileInputStream fstream; DataInputStream in; void openInput(String file) { if(file==null)is = new BufferedReader(new InputStreamReader(System.in));//stdin else { try{ fstrea...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.IOException; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class A { public static void main(String[] args) throws IOException{ Scanner sc = new Scanner(System.in); String s = sc.next(); int n = s.length(); for (int i = n; i >= 1; ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; public class A { public static void main(String[] args) { new A(new Scanner(System.in)); } public A(Scanner in) { TreeSet<String> ts = new TreeSet<String>(); ArrayList<String> sr = new ArrayList<String>(); String s = in.next(); for (int i=0; i<s.leng...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; public class A { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String s = sc.next(); for (int l = s.length(); l > 0; --l) { HashSet<String> set = new HashSet<String>(); for (int i = 0; i < s.length() - l + 1; +...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; public class YouAreGivenAString { void run() { try { BufferedReader bfd = new BufferedReader(new InputStreamReader( System.in)); int i, j, k, mxLen = 0; String s= bfd.readLine(); ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.Scanner; public class Word { static String word; private static void check(String subword) { int i = 0; int j = 0; while (j + subword.length() <= word.length()) { if (word.substring(j).startsWith(subword)){ i++; } j++...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; import java.util.*; public class YoureGivenAString { public static void main(String[] args) throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); String str = f.readLine(); int max = 0; for (int i = 0; i < str.length(); i++) ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; /** * User: alms * Date: 09.07.2010 * Time: 18:57:44 */ public class Solution { public static void main(String[] args) throws Exception { final String str; final BufferedReader r = new BufferedReader(new InputStreamReader(System.i...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.StringTokenizer; import java.util.TreeSet; /* * To change this template, choose Too...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.InputStream; import java.io.OutputStream; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.util.A...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; import java.io.*; public class Main { static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); static StringBuilder out = new StringBuilder(); public static void main(String[] args){ solve(); return; } // the following...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; public class A { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { String s = sc.next(); for (int l = s.length(); l > 0; --l) { HashSet<String> set = new HashSet<String>(); for (int i = 0; i < s.length() - l + 1; +...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintWriter; import java.util.TreeSet; import java.util.StringTokenizer; import java.util.AbstractCollection; import java.io.InputStream; /** * Built usi...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; public class A { private static StreamTokenizer in; private static PrintWriter out; private static int nextInt() throws Exception { in.nextToken(); return (int) in.nval; } private sta...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; import java.io.*; public class P1 { public static void main(String[] args) { String s = null; // citire try { // Scanner sc = new Scanner(new File("in.txt")); Scanner sc = new Scanner(System.in); s = sc.next(); } catch (Exception e) { e.printStackTrace(); } int n = ...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; import java.util.*; import java.math.*; public class Main { public static void main(String ...args) throws Throwable { Scanner in = new Scanner(System.in); String init = in.nextLine(); HashSet<String> h = new HashSet<String>(); for (int len = init.length() - 1; len...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.*; /************************************************************************* * Compilation: javac LRS.java * Execution: java LRS < file.txt * Dependencies: StdIn.java * * Reads a text corpus from stdin, replaces all consecutive blocks of * whitespace with a single space, and then compu...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.util.StringTokenizer; import java.io.InputStreamReader; public class Main{ public static void main(String[] args)throws IOException{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); String s=br.readLine();...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.*; public class substring { public static void main(String[] args) { Scanner input = new Scanner(System.in); String s = input.nextLine(); Boolean found = false; int i = s.length(); while(found==false) { i--; ArrayList<String> sub = new ArrayList<String>(); for(int j = 0; j <= s.length() - i; j++) { if(...
cubic
23_A. You're Given a String...
CODEFORCES
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; public class Main20 { static ArrayList<Integer> primes = new ArrayList<Integer>(); static boolean[] prime = new...
cubic
23_A. You're Given a String...
CODEFORCES
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ //package substring; import java.util.*; /** * * @author lav */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner scr = n...
cubic
23_A. You're Given a String...
CODEFORCES
import java.util.Scanner; public class P23A { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s = in.nextLine(); int max = 0; for(int i = 0; i < s.length(); i++) for(int k = s.length(); k > max + i; k--) if(s.substring(i + 1).contains(s.substring(i,k))) max ...
cubic
23_A. You're Given a String...
CODEFORCES
//package timus; import java.io.BufferedReader; 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.io.Reader; import java.io.StreamTokenizer; import java.io.Writer; import java.ma...
cubic
23_A. You're Given a String...
CODEFORCES