codeparrot/codecomplex huggingface dataset:
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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; i--) {
            Set<String> set = new HashSet<String>();
            for (int j = 0; j < n-i+1; j++) {
                String t = s.substring(j, j+i);
                if (set.contains(t)) {
                    System.out.println(i);
                    return;
                }
                set.add(t);
            }
        }
        System.out.println(0);
    }
    
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic

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.length(); i++)
      {
         for (int j=i+1; j<=s.length(); j++)
         {
            String ss = s.substring(i, j);
            if (ts.contains(ss))
            {
               sr.add(ss);
            }
            ts.add(ss);
         }
      }

      int res = 0;
      for (String ss : sr)
      {
         if (ss.length() > res)
            res = ss.length();
      }

      System.out.printf("%d%n", res);
   }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic

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();
            for(i=0; i<s.length(); ++i){
                for(j=i+1; j<s.length()+1; ++j){
                    String s2 = s.substring(i, j);
                    if(s2.length()<=mxLen) continue;
                    int cnt=0;
                    for(k=0; k<s.length(); ++k){
                        if(s.length()>=k+s2.length())
                        if(s2.equals(s.substring(k,k+s2.length()))){
                            cnt++;
                            if(cnt>1)mxLen = Math.max(mxLen, s2.length());
                        }
                    }
                }
            }
            System.out.println(mxLen);
        } catch (Exception e) {

        }
    }
    public static void main(String[] args) {
        new YouAreGivenAString().run();
    }

}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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++;
        }
        if (i > 1){
            System.out.println(subword.length());
            System.exit(0);
        }
    }

    public static void main(String[] arg) {
        Scanner in = new Scanner(System.in);
        word = in.next();
        if (word.length() == 1) {
            System.out.println(0);
            return;
        }
        for (int i = word.length() - 1; i > 0; i--) {
            int j = 0;
            while (j + i <= word.length()) {
                check(word.substring(j, i+j));
                j++;
            }
        }
        System.out.println(0);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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++)
            for (int j = i+1; j <= str.length(); j++) {
                String s = str.substring(i,j);
                if (str.indexOf(s) >= 0 && str.substring(str.indexOf(s)+1).indexOf(s) >= 0)
                    max = Math.max(max, j-i);
            }
        System.out.println(max);
    }   
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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.in));
        str = r.readLine();

        int max = 0;

        for (int x = 0; x  < str.length(); x++) {
            for (int y = x + 1; y  < str.length(); y++) {
                int c = 0;
                for (;c + x < str.length() && y + c < str.length(); c++) {
                    if (str.charAt(x + c) != str.charAt(y + c)) {
                        break;
                    }
                }

                if (c > max) {
                    max = c;
                }
            }
        }

        System.out.println(max);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public class Task {

	private static final boolean readFromFile = false;
	
	public static void main(String args[]){
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FileOutputStream fileOutputStream;
		FileInputStream fileInputStream;
		if (readFromFile){
			try{
				fileInputStream = new FileInputStream(new File("input.txt"));
				fileOutputStream = new FileOutputStream(new File("output.txt"));
			}catch (FileNotFoundException e){
				throw new RuntimeException(e);
			}
		}
		PrintWriter out = new PrintWriter((readFromFile)?fileOutputStream:outputStream);
		InputReader in = new InputReader((readFromFile)?fileInputStream:inputStream);
		
		Solver s = new Solver(in,out);
		s.solve();
		
		out.close();
	}
}

class Solver{
	InputReader in;
	PrintWriter out;
	
	public void solve(){
		String s = in.nextLine();
		for (int len=s.length()-1;len>=1;len--)
			for (int i=0;i<s.length()-len+1;i++)
				for (int j=i+1;j<s.length()-len+1;j++)
					if (s.substring(i,i+len).equals(s.substring(j,j+len))){
						out.println(len);
						return;
					}
		out.println(0);
	}

		
	Solver(InputReader in, PrintWriter out){
		this.in=in;
		this.out=out;
	}
}

class InputReader{
	private BufferedReader buf;
	private StringTokenizer tok;
	
	InputReader(InputStream in){
		tok = null;
		buf = new BufferedReader(new InputStreamReader(in));
	}
	
	InputReader(FileInputStream in){
		tok = null;
		buf = new BufferedReader(new InputStreamReader(in));
	}
	
	public String next(){
		while (tok==null || !tok.hasMoreTokens()){
			try{
				tok = new StringTokenizer(buf.readLine());
			}catch (IOException e){
				throw new RuntimeException(e);
			}
		}
		return tok.nextToken();
	}
	
	public int nextInt(){
		return Integer.parseInt(next());
	}
	
	public long nextLong(){
		return Long.parseLong(next());
	}
	
	public double nextDouble(){
		return Double.parseDouble(next());
	}
	
	public float nextFloat(){
		return Float.parseFloat(next());
	}
	
	public String nextLine(){
		try{
			return buf.readLine();
		}catch (IOException e){
			return null;
		}
	}
	
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 followings are methods to take care of inputs.
    static int nextInt(){
        return Integer.parseInt(nextLine());
    }
    static long nextLong(){
        return Long.parseLong(nextLine());
    }
    static int[] nextIntArray(){
        String[] inp = nextLine().split("\\s+");
        int[] ary = new int[inp.length];
        for (int i = 0; i < ary.length; i++){
            ary[i] = Integer.parseInt(inp[i]);
        }
        return ary;
    }
    static int[] nextIntArrayFrom1(){
        String[] inp = nextLine().split("\\s+");
        int[] ary = new int[inp.length + 1];
        for (int i = 0; i < inp.length; i++){
            ary[i+1] = Integer.parseInt(inp[i]);
        }
        return ary;
    }
    static long[] nextLongArray(){
        String[] inp = nextLine().split("\\s+");
        long[] ary = new long[inp.length];
        for (int i = 0; i < inp.length; i++){
            ary[i] = Long.parseLong(inp[i]);
        }
        return ary;
    }
    static long[] nextLongArrayFrom1(){
        String[] inp = nextLine().split("\\s+");
        long[] ary = new long[inp.length + 1];
        for (int i = 0; i < inp.length; i++){
            ary[i+1] = Long.parseLong(inp[i]);
        }
        return ary;
    }
    static String nextLine(){
        try { 
            return reader.readLine().trim();
        } catch (Exception e){}
        return null;
    }
    static void solve(){
        String str = nextLine();
        int max=0;
        int index=0;
        for(int i=0;i<str.length();i++){
            for(int j=i+1;j<str.length();j++){
                if(str.charAt(i)==str.charAt(j)){
                    int count=1;
                    while(true){
                        if(str.length()<=i+count || str.length()<=j+count || str.charAt(i+count)!=str.charAt(j+count) ) 
                            break;
                        count++;
                    }
                    if(max<count){
                        max=count;
                        index=i;
                    }
                }
            }
        }
        System.out.println(max);

        return;
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 using CHelper plug-in
 * Actual solution is at the top
 * @author Zyflair Griffane
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		PandaScanner in = new PandaScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		A solver = new A();
		solver.solve(1, in, out);
		out.close();
	}
}

class A {
    public void solve(int testNumber, PandaScanner in, PrintWriter out) {
        String s = in.next();
        String[] ss = Substring.allSubstrings(s);
        int res = 0;
        for (String sss: ss) {
            if (sss.length() <= res) continue;
            if (Substring.occurences(s, sss).length > 1) {
                res = sss.length();
            }
        }
        out.println(res);
    }
}

class PandaScanner {
    public BufferedReader br;
    public StringTokenizer st;
    public InputStream in;

    public PandaScanner(InputStream in) {
        br = new BufferedReader(new InputStreamReader(this.in = in));
    }

    public String nextLine() {
        try {
            return br.readLine();
        }
        catch (Exception e) {
            return null;
        }
    }

    public String next() {
        if (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(nextLine().trim());
            return next();
        }
        return st.nextToken();
    }

    }

class Substring {

    public static String[] allSubstrings(String s) {
        TreeSet<String> substrings = new TreeSet<String>();
        int n = s.length();
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                substrings.add(s.substring(i, j));
            }
        }
        return substrings.toArray(new String[0]);
    }

    public static int[] occurences(String s, String target) {
        int n = s.length();
        ArrayList<Integer> res = new ArrayList<Integer>();
        int idx = s.indexOf(target);
        while (idx != -1) {
            res.add(idx);
            if (idx == n - 1) break;
            idx = s.indexOf(target, idx + 1);
        }
        n = res.size();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = res.get(i);
        }
        return arr;
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 static String nextString() throws Exception {
		in.nextToken();
		return in.sval;
	}

	public static void main(String[] args) throws Exception {
		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(
				System.in)));
		out = new PrintWriter(System.out);

		String s = nextString();
		int max = 0;
		for (int i=0; i<s.length(); i++) {
			for (int j=i+1; j<=s.length(); j++) {
//				System.out.println(i+ " "+ j);
				String u = s.substring(i,j);
				if (s.substring(i+1).indexOf(u) >= 0) {
					max = Math.max(max, u.length());
				}
			}
		}
		out.println(max);
		
		out.flush();
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 = s.length();
		
		HashSet<String> h = new HashSet<String>();
		String t=null;
		boolean b;
		int lmax = 0;
		for (int i=0; i<n; i++) {
			for (int j=i+1; j<=n; j++) {
				t = s.substring(i, j);
				b = h.add(t);
//				System.out.println(t + "	"  + b);
				if (b==false) {
					if (j-i>lmax) {
						lmax = j-i;
//						System.out.println(t);
					}
				}
			}
		}
		System.out.println(lmax);
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 >= 1; --len)  {
            h.clear();
            for (int pos = 0; pos + len <= init.length(); ++pos) {
                String now = init.substring(pos, pos + len);
                if (h.contains(now)) {
                    System.out.println(len);
                    return;
                }
                h.add(now);
            }

        }

        System.out.println(0);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 computes the longest
 *  repeated substring in that corpus. Suffix sorts the corpus using
 *  the system sort, then finds the longest repeated substring among 
 *  consecutive suffixes in the sorted order.
 * 
 *  % java LRS < mobydick.txt
 *  ',- Such a funny, sporty, gamy, jesty, joky, hoky-poky lad, is the Ocean, oh! Th'
 * 
 *  % java LRS 
 *  aaaaaaaaa
 *  'aaaaaaaa'
 *
 *  % java LRS
 *  abcdefg
 *  ''
 *
 *************************************************************************/


import java.util.Arrays;

public class LRS {

    // return the longest common prefix of s and t
    public static String lcp(String s, String t) {
        int n = Math.min(s.length(), t.length());
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) != t.charAt(i))
                return s.substring(0, i);
        }
        return s.substring(0, n);
    }


    // return the longest repeated string in s
    public static String lrs(String s) {

        // form the N suffixes
        int N  = s.length();
        String[] suffixes = new String[N];
        for (int i = 0; i < N; i++) {
            suffixes[i] = s.substring(i, N);
        }

        // sort them
        Arrays.sort(suffixes);

        // find longest repeated substring by comparing adjacent sorted suffixes
        String lrs = "";
        for (int i = 0; i < N - 1; i++) {
            String x = lcp(suffixes[i], suffixes[i+1]);
            if (x.length() > lrs.length())
                lrs = x;
        }
        return lrs;
    }



    // read in text, replacing all consecutive whitespace with a single space
    // then compute longest repeated substring
    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        s = s.replaceAll("\\s+", " ");
        System.out.println(lrs(s).length());
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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();
        int max=0;
        for(int i=0;i<s.length();i++){
            int len=0;
            int k=i;
            boolean flag=false;
            for(int j=i+1;j<s.length();j++){
                if(s.charAt(k)==s.charAt(j)){
                len++;
                k++;
                flag=true;
                }
                else if(flag==true){
                    j=j-len;
                    k=i;
                    if(max<len)
                    max=len;
                    len=0;
                    flag=false;
                    
                }
                   
            }
            if(max<len)
            max=len;
        }
        System.out.print(max);
    }}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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(sub.contains(s.substring(j, j+i)))
found = true;
else
sub.add(s.substring(j, j+i));
}

}
System.out.println(i);
}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 boolean[1001];
    public static void gen(){
        Arrays.fill(prime, true);
        prime[0] = prime[1]  = false; 
        for (int i = 2; i < 1001; i++) {
            if (prime[i]){
                primes.add(i);
                for (int j = i*2; j < 1001; j+=i)
                    prime[j] = false;
            }
        }
    }
    public static boolean isVowel(char c){
        Character r = Character.toLowerCase(c);
        return (r == 'e' || r == 'a' || r == 'i' || r == 'o' ||  r == 'u'||  r == 'y');
    }
    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(new InputStreamReader(System.in));
        String str = s.next();
        int x;
        int max= 0;
        
        for (int i = 0; i < str.length()-1; i++) {
            for (int j = i+1; j < str.length(); j++) {
                x = str.indexOf(str.substring(i,j),i+1) ;
                if (x != -1){
                    if (j-i > max) max = j-i;
                }
            }
        }
        System.out.println(max);
    }

}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
/*
 * 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 = new Scanner(System.in);
       // System.out.println("entet strig");
        String str = scr.nextLine();
        int len =0;
      //  System.out.println(str.substring(0, str.length()));
        for(int i=0;i<(str.length()-1);i++)
        {
            for(int j=i+1;j<str.length();j++)
            {
                String sub = str.substring(i, j);
                //int a=i+sub.indexOf(sub.charAt(0));
                int ind = str.indexOf(sub, i+1);
                if(ind!=-1 && sub.length()>len )
                {
                    len = sub.length();
                }
            }
        }
        System.out.println(len);
        // TODO code application logic here
    }

}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 = k - i; 
		System.out.println(max);
	}

}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.*;

public class a{
	public static void main(String[] args) {
		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(); j++) {
				String first = str.substring(i,j);
				for(int k=i+1; k<=str.length()-first.length(); k++) {
					if(str.substring(k,k+first.length()).equals(first))
						max = Math.max(max,first.length());
				}
			}
		}
		System.out.println(max);
	}
}