codeparrot/codecomplex huggingface dataset:
// 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.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 StringTokenizer st;
    private PrintWriter out;

    private void solve() throws IOException {
        String s = next();
        for (int length = s.length() - 1; length > 0; --length) {
            Set<String> h = new HashSet<String>();
            int count = 0;
            for (int i = 0; i + length <= s.length(); ++i) {
                h.add(s.substring(i, i + length));
                ++count;
            }
            if (count != h.size()) {
                out.println(length);
                return;
            }
        }
        out.println(0);
    }

    public void run() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        eat("");
        solve();
        out.close();
        in.close();
    }

    private void eat(String s) {
        st = new StringTokenizer(s);
    }

    private String next() throws IOException {
        while (!st.hasMoreTokens()) {
            String line = in.readLine();
            if (line == null) {
                return null;
            }
            eat(line);
        }
        return st.nextToken();
    }

    private int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    private long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    private double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    private BigInteger nextBigInteger() throws IOException {
        return new BigInteger(next());
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new A().run();
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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);
            out = new PrintWriter(System.out);
        } catch (Exception ignored) {
        }

        String s = sc.next();
        int i = s.length() - 1;
        Test: for (; i > 0; i--) {
            HashSet<String> set = new HashSet<String>();
            for (int j = 0; j + i <= s.length(); j++) {
                String ss = s.substring(j, j + i);
                if (set.contains(ss)) {
                    break Test;
                }
                set.add(ss);
            }
        }
        out.println(i);

        out.close();
        System.exit(0);
    }


    //The PandaScanner class, for Panda fast scanning!
    public class PandaScanner {
        BufferedReader br;
        StringTokenizer st;
        InputStream in;

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

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

        public boolean hasNext() throws Exception {
            return (st != null && st.hasMoreTokens()) || in.available() > 0;
        }

        public long nextLong() throws Exception {
            return Long.parseLong(next());
        }

        public int nextInt() throws Exception {
            return Integer.parseInt(next());
        }
    }
}
// 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.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 void main(String[] args) throws IOException {
		BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);

		String line = s.readLine();
		int len = line.length();
		int max = 0;
		for (int i = 0 ; i < len ; i++) {
			for (int j = i+1 ; j <= len ; j++) {
				String sch = line.substring(i, j);
				for (int k = i+1 ; k + (j - i) <= len ; k++) {
					String tch = line.substring(k, k+(j-i));
					if (sch.equals(tch)) {
						max = Math.max(max, (j-i));
					}
				}
			}
		}
		out.println(max);
		out.flush();
	}


	public static void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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; start + length <= s.length(); start++)       {
                String test = s.substring(start, start+length);
                if(s.indexOf(test) != s.lastIndexOf(test))  {
                    System.out.println(length);
                    return;
                }
            }
        }
        System.out.println(0);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
//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++) {
                if (i != j) {
                    int ti = i, tj = j;
                    current = 0;
                    while (ti < s.length() && tj < s.length() && s.charAt(ti) == s.charAt(tj)) {
                        current++;
                        ti++;
                        tj++;
                    }
                    if (current > longest) {
                        longest = current;
                    }
                }
            }
        }
        System.out.println(longest);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
// 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 BufferedWriter(new OutputStreamWriter(System.out));
    
    String text = reader.readLine().trim();
    int out = 0;
    for(int i=0;i<text.length();i++){
      for(int j=i+1;j<text.length();j++){
        for(int len = out+1;len+j<=text.length();len++){
          if(text.substring(i,i+len).compareTo(text.substring(j,j+len))==0){
            out = len;
          }
        }
      }
    }
    String buf = ""+out;
    writer.write(buf,0,buf.length());
    writer.newLine();
    writer.flush();
    writer.close();
    reader.close();
  }
  String process(){
    return "1";
  }
  int[] toIntArray(String line){
    String[] p = line.split("[ ]+");
    int[] out = new int[p.length];
    for(int i=0;i<p.length;i++) out[i] = Integer.valueOf(p[i]);
    return out;
  }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic

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();

        String sub = "";
        int count = 0;
        int max = 0;
        for (int i = 0; i < line.length() - 1; i++) {
            sub = line.substring(i, i + 1);

            int q = i + 1;
            int p;
            int r = i;
            while (q < line.length() && q > 0) {
                p = q;
                r = i;
                int ind = line.indexOf(sub, p);
                count = 0;
                if (ind != -1) {
                    for (int j = ind; j < line.length(); j++) {
                        if (line.substring(j, j + 1).equalsIgnoreCase(line.substring(r, r + 1))) {
                            r++;
                            count++;
                        } else {
                            break;
                        }
                    }
                    if (count > max) {
                        max = count;
                    }
                }
                q = ind + 1;
                
            }

        }

        System.out.println(max);

    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic

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{
        
        String line = cin.nextLine();
        
        HashMap<String, Integer> map = new HashMap<String, Integer>();
        int ans = 0;
        for (int i = 0; i < line.length(); ++i) {
            StringBuffer str = new StringBuffer("");
            for (int j = i; j < line.length(); ++j) {
                str.append(line.charAt(j));
                
                if (!map.containsKey(str.toString())) {
                    //cout.println(str.toString());
                    map.put(str.toString(), 1);
                } else {
                    ans = str.length() > ans ? str.length() : ans;
                }
            }
        }
        
        cout.println(ans);
        
        cin.close();
        cout.close();
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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++)
            for(int j = i + 1; j < s.length(); j++)
            {
                for(k = 0; j + k < s.length(); k++)
                {
                    if(s.charAt(i + k) != s.charAt(j + k)) break;
                }
                if(ans < k) ans = k;
            }
        System.out.println(ans);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic

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+sz <= n ; i++) {
                c = s.substring(i, i+sz);
                a = s.indexOf(c,0);
                if(a < 0) continue;
                b = s.indexOf(c,a+1);
                if(b < 0) continue;
                System.out.println(sz);
                return;
                
            } // for j
        } // for i
        System.out.println(0);

    }

}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 (int k = 0; k < str.length(); k++) {
                    for (int n = k + 1; n < str.length() + 1; n++) {

                        if ((str.substring(i, j).equals(str.substring(k, n)))
                                && (k != i)) {
                            if (j - i > max)
                                max = j - i;
                        }
                    }
                }
            }
        }
        System.out.println(max);
    }

    public static void main(String args[]) throws Exception {
        St.metod();
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 static void main(String[] args) 
    {
        Scanner in=new Scanner(System.in);
        String str=in.next();
        
        int i;
        for(i=str.length()-1;i>=1;i--)
            if(isOK(str,i))
            {
        	break;
            }
        
        System.out.println(i);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 consider = in.substring(i, j);
				for(int k = i+1; k < in.length(); k++){
					if(k + consider.length() > in.length())
						break;
					else if(in.substring(k, k+consider.length()).equals(consider))
						max = Math.max(max, consider.length());	
				}
			}
		}
		
		System.out.println(max);
	}	
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic

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++) {
                
                
                subS = s.substring(i, j);
                
                for (int k=i+1;k<s.length();k++) {
                    
                
                    if ( s.startsWith(subS,k) ){
                        if ( max < subS.length() )
                            max = subS.length();
                    }
                }
                
            }
        }
        
        System.out.println(max);
        return;
        
    }
    
    public static void main(String[] args){
        
        new A().run();
        
    }

}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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+1;j<s.length()+1;j++){
                String s1 = s.substring(i, j);
                if(s.substring(i+1).contains(s1)){
                    max = Math.max(max,s1.length());
                }
            }
        }
        writer.write(""+max);
    }


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

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(getReader());
            tokenizer = null;
            writer = new PrintWriter(System.out);
            //do job
            doJob();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }


    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    public Reader getReader() throws FileNotFoundException {
        if (isLocalMode) {
            return new FileReader("input.txt");
        } else {
            return new InputStreamReader(System.in);
        }
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 <= n; i++) {
            h = new HashSet();
            for (int j = 0; j < n - i + 1; j++) {
                String t = s.substring(j, j + i);
                if (h.contains(t)) {
                    r = i;
                    continue loop;
                } else {
                    h.add(t);
                }
            }
        }
        System.out.println(r);
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        //final String FILENAME = "dvd";
        //in = new BufferedReader(new FileReader(new File(FILENAME + ".in")));
        //out = new PrintWriter(new File(FILENAME + ".out"));
        in = new BufferedReader(new InputStreamReader(System.in));
        //in = new Scanner(System.in);
        out = new PrintWriter(System.out);
        st = new StringTokenizer(" ");
        new Main().run();
        out.close();
    }

    static BufferedReader in;
    //static Scanner in;
    static PrintWriter out;
    static StringTokenizer st;

    String token() throws IOException {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    int nint() throws IOException {
        return Integer.parseInt(token());
    }

    long nlong() throws IOException {
        return Long.parseLong(token());
    }

    double ndouble() throws IOException {
        return Double.parseDouble(token());
    }
}
// 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.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)
            for (int j=0; j+i<=str.length(); ++j)
                if (str.substring(j+1).contains(str.substring(j, j+i))) {
                    writer.println(i);
                    return;
                }
        writer.println(0);
    }

    public static void main(String[] args) {
        new Thread(new A()).start();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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();
		int n = l - 1;
		String st, sub;
		while (n > 0) {
			for (int i = 0; i < l - n; ++i) {
				st = s.substring(i, n + i);
				sub = s.substring(i + 1);
				if (sub.indexOf(st) != -1) {
					System.out.println(n);
					System.exit(0);
				}
			}
			n--;
		}
		System.out.println(0);
	}

}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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 = stdin.readLine()) != null) {
			System.out.println(os.handleOverlap(line));
		}
	}
	private int handleOverlap(String str) {
		int len = str.length();
		int count = 0;
		for(int i=0;i<len;i++)
			for(int j=i+1;j<len;j++) {
				String _tmp = str.substring(i,j);
				if(_tmp!=null&&_tmp.length()>0) {
					if(getOverlapCount(str,_tmp)>1)
					{
						if(_tmp.length()>count)
							count = _tmp.length();
					}
				}
			}
		return count;
	}
	private int getOverlapCount(String str,String sub) {
		int start = 0;
		int count = 0;
		while(start<str.length()) {
			start = str.indexOf(sub,start);
			if(start==-1)
				break;
			else {
				start++;
				count++;
			}
		}
		return count;
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
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{
		
				
			fstream = new FileInputStream(file);
			in = new DataInputStream(fstream);
			is = new BufferedReader(new InputStreamReader(in));
			}catch(Exception e)
			{
				System.err.println(e);
			}
		}

	}
	
	void readNextLine()
	{
		try {
			line = is.readLine();
			inputParser = new StringTokenizer(line, " ");
			//System.err.println("Input: " + line);
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}	
		
	}
	
	int NextInt()
	{
		String n = inputParser.nextToken();
		int val = Integer.parseInt(n);
		
		//System.out.println("I read this number: " + val);
		return val;
	}
	
	String NextString()
	{
		String n = inputParser.nextToken();
		return n;
	}
	
	void closeInput()
	{
		try {
			is.close();
		} catch (IOException e) {
			System.err.println("Unexpected IO ERROR: " + e);
		}
			
	}
	
	
	public static void main(String [] argv)
	{
		String filePath=null;
		if(argv.length>0)filePath=argv[0];
		A a = new A(filePath);
	}
	
	public A(String inputFile)
	{
		openInput(inputFile);
		
		readNextLine();
		String s=line;
		int ret=0;
		for(int i=0; i<s.length(); i++)
		{
			for(int j=i+1; j<s.length()+1; j++)
			{
				String a=s.substring(i,	j);
				if(s.indexOf(a, i+1)>-1)ret=Math.max(ret, a.length());
				
			}
		}
		System.out.println(ret);
	}
	
}