codeparrot/codecomplex huggingface dataset:
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Scanner;

public class Main implements Runnable {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		new Thread(new Main()).start();
	}

	public void run() {
		Locale.setDefault(Locale.US);
		try {
			run1();
		} catch (IOException e) {
			throw new RuntimeException();
		}
	}

	int nextInt(StreamTokenizer st) throws IOException {
		st.nextToken();
		return (int) st.nval;
	}

	private List<Integer> kmp(String x, String a) {
		String s = a + "$" + x;
		int[] oppa = new int[s.length()];
		oppa[0] = 0;
		int tmp = 0;
		List<Integer> res = new ArrayList<Integer>();
		for (int i = 1; i < s.length(); i++) {
			while (tmp != 0 && s.charAt(tmp) != s.charAt(i)) {
				// System.out.println(i + " " + tmp);
				tmp = oppa[tmp - 1];
			}
			if (s.charAt(tmp) == s.charAt(i))
				tmp++;
			oppa[i] = tmp;
			if (tmp == a.length()) {
				res.add(i - a.length() - a.length());
			}
		}
		return res;
	}

	double nextDouble(StreamTokenizer st) throws IOException {
		st.nextToken();
		return st.nval;
	}

	String nextLine(StreamTokenizer st) throws IOException {
		st.nextToken();
		return st.sval;
	}

	int cnt = 0;
	int[] col;

	void unite(int a, int b) {
		if (cnt % 2 == 0)
			col[getCol(a)] = getCol(b);
		else
			col[getCol(b)] = getCol(a);
		cnt++;
	}

	int getCol(int a) {
		return a == col[a] ? a : (col[a] = getCol(col[a]));
	}

	public void run1() throws IOException {
//		 Scanner sc = new Scanner(new FileReader("input.txt"));
		Scanner sc = new Scanner(new InputStreamReader(System.in));
		// BufferedReader br = new BufferedReader(new
		// InputStreamReader(System.in));
		// PrintWriter pw = new PrintWriter(new FileWriter("output.txt"));
		String s= sc.next();
		int res = 0;
		int n = s.length();
		for(int i = 0; i < n; i++)
			for(int j = i + 1; j < n; j++) {
				int k = 0;
				while(j + k < n && s.charAt(i + k) == s.charAt(j + k))
					k++;
					res = Math.max(res, k);
			}
		System.out.println(res);
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
	public static void main(String[] args) /*throws FileNotFoundException*/ { 
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		FastPrinter out = new FastPrinter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA{
     static boolean twofind(String s, String t){
    	 int index = s.indexOf(t);
    	 int index2 = s.indexOf(t, index + 1);
    	 if(index2 != -1)return true;
    	 return false;
     }
	public void solve(int testNumber, FastScanner scan, FastPrinter out) /*throws FileNotFoundException*/ {
		//Scanner sscan = new Scanner(new File("input.txt"));
		//PrintStream oout = new PrintStream(new File("output.txt"));
	     String s = scan.next();
	     String ans = "";
	     boolean ok = false;
	     for(int i = s.length(); i >= 0; i--){
	        for(int j = 0; j <= s.length() - 1; j++){
	        	try{
	        		if(twofind(s, s.substring(j, j + i))){
	        			ans = s.substring(j, j + i); break;
	        		}
	        	}catch(Exception e){
	        		break;
	        	}
	        }
	        if(!ans.equals(""))break;
	     }
	     
	     out.println(ans.length());
		//sscan.close();
		//oout.close();
	}
}

class FastScanner extends BufferedReader {
	public FastScanner(InputStream is) {
		super(new InputStreamReader(is));
	}
	
	public int read() {
		try{
			int ret = super.read();
			return ret;
		}catch(Exception e){
			throw new InputMismatchException();
		}
	}
	
	public String next() {
        StringBuilder sb = new StringBuilder();
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        if (c < 0) {
            return null;
        }
        while (c >= 0 && !isWhiteSpace(c)) {
            sb.appendCodePoint(c);
            c = read();
        }
        return sb.toString();
    }
	
	static boolean isWhiteSpace(int c) {
        return c >= 0 && c <= 32;
    }
	
	public int nextInt() {
        int c = read();
        while (isWhiteSpace(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int ret = 0;
        while (c >= 0 && !isWhiteSpace(c)) {
            if (c < '0' || c > '9') {
                throw new NumberFormatException("digit expected " + (char) c
                        + " found");
            }
            ret = ret * 10 + c - '0';
            c = read();
        }
        return ret * sgn;
    }
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public BigInteger nextBigInteger() {
		return new BigInteger(next());
	}
	
	public BigDecimal nextBigDecimal(){
		return new BigDecimal(next());
	}
	
	public String readLine(){
		try{
			return super.readLine();
		}catch(IOException e){
			return null;
		}
	}
}

class FastPrinter extends PrintWriter {
	
	public FastPrinter(OutputStream out) {
		super(out);
	}
	public FastPrinter(Writer out) {
		super(out);
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.*;
import java.lang.*;

public class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        String str=sc.next();
        sc.close();
        
        int maxm=0;
        int ind1,ind2;
        
        for(int i=0;i<str.length();i++){
            for(int j=i+1;j<str.length();j++){
                int len=0;
                ind1=i;ind2=j;
                while(ind2<str.length() && str.charAt(ind1)==str.charAt(ind2)){
                    ind1++;
                    ind2++;
                    len++;
                }
                maxm=Math.max(maxm,len);
            }
        }
        System.out.println(maxm);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.*;
import java.math.*;
import java.util.*;

public class StringRepeat
{
	static Scanner in = new Scanner( new BufferedReader( new InputStreamReader( System.in ) ) );

	public static void main( String[] args )
	{
		String s = in.next();
		int n = s.length(), ans = 0;
		for( int i = 0; i < n; i++ ) for( int j = i+1; j < n; j++ )
		{
			int l = 0;
			while( j+l<n && s.charAt(i+l)==s.charAt(j+l) ) l++;
			ans = Math.max( ans, l );
		}
		System.out.println( ans );
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic

import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class BetaRound23_A implements Runnable {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	void init() throws IOException {
		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}

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

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	@Override
	public void run() {
		try {
			long t1 = System.currentTimeMillis();
			init();
			solve();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Exception e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}

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

	void solve() throws IOException {
		char[] s = in.readLine().toCharArray();
		int n = s.length;
		for (int ans = n - 1; ans >= 1; ans--) {
			for (int i = 0; i < n - ans + 1; i++) {
				for (int j = i + 1; j < n - ans + 1; j++) {
					int count = 0;
					for (int k = 0; k < ans; k++) {
						if (s[i + k] == s[j + k]) count++;
						else break;
					}
					if (count == ans) {
						out.print(ans);
						return;
					}
				}
			}
		}
		out.print(0);
	}
	
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class P19 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        Map<Integer, Integer> mapa = new HashMap<Integer, Integer>();
        String str = in.next();
        int len = str.length();
        int maxCurrent = 0;
        for (int i = 0; i < len; ++i) {
            for (int j = 1; j <= len; ++j) {
                if (i + j > len) continue;
                //System.out.format("Adding from %d to %d -> %s\n",i, i+j,str.substring(i, i + j));
                int hashCode = str.substring(i, i + j).hashCode();
                Integer current = mapa.get(hashCode);
                if (current == null)
                    current = 0;
                current++;
                mapa.put(hashCode, current);
                if (current > 1)
                    maxCurrent = Math.max(maxCurrent, j);
            }
        }

        out.println(maxCurrent);

        out.flush();
        out.close();
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.*;
public class j
{
public static void main(String a[])throws IOException
{
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
int n=0,i=0,k=2;
String s="\0",r="\0";
s=b.readLine();
n=s.length()-1;
while(k<=s.length())
{
for(i=0;i<k;i++)
{
r=s.substring(i,i+n);
if(s.indexOf(r)!=s.lastIndexOf(r))
{
System.out.print(n);
System.exit(0);
}
}
k++;
n--;
}
System.out.print("0");
}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.*;
import java.util.*;

public class Main {
	static Scanner in;
	static PrintWriter out;
//	static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;}

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

		String s = in.next();
		int n = s.length();

		int max = 0;
		for (int i = 1; i < n; i++) {
			String[] subs = new String[n - i + 1];
			for (int j = 0; j + i <= n; j++) subs[j] = s.substring(j, j + i);
			Arrays.sort(subs);
			boolean flag = false;
			for (int j = 0; j < n - i; j++)
				if (subs[j].equals(subs[j + 1])) flag = true;
			if (flag) max = Math.max(max, i);
		}

		out.println(max);

		out.close();
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.*;
public class A23 {
	public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		String W = sc.next();
		ArrayList<String>Q = new ArrayList<String>();
		for (int i = 0; i < W.length(); i++){			
			String O = "";
			for (int k = i; k < W.length(); k++){
				O = O + W.charAt(k);
				Q.add(O);
			}			
		}
		Collections.sort(Q);
		String tmp = Q.get(0);
		int y = 0;
		for (int i = 1; i < Q.size(); i++){
			if (Q.get(i).equals(tmp)){
				if (Q.get(i).length() > y){
					y = Q.get(i).length();
				}	
			}
			else {
				tmp = Q.get(i);				
			}
		}
		System.out.println(y);
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.*;
import java.util.*;

public class Solution {
	
	private BufferedReader in;
	private PrintWriter out;
	private StringTokenizer st;

	void solve() throws IOException {
		String s = next();
		HashSet<String> set = new HashSet<String>();
		int ans = 0;
		for (int i = 0; i < s.length(); ++i) {
			for (int j = i + 1; j <= s.length(); ++j) {
				String t = s.substring(i, j);
				if (set.contains(t)) {
					ans = Math.max(ans, t.length());
				}
				set.add(t);
			}
		}
		out.println(ans);
	}

	Solution() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		
		eat("");
		
		solve();
		
		in.close();
		out.close();
	}
	
	private void eat(String str) {
		st = new StringTokenizer(str);
	}
	
	String next() throws IOException {
		while (!st.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) {
				return null;
			}
			eat(line);
		}
		return st.nextToken();
	}
	
	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
	
	long nextLong() throws IOException {
		return Long.parseLong(next());
	}
	
	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) throws IOException {
		new Solution();
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.Scanner;

public class GivenString {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        
        String s = input.nextLine();
        
        int max = 0;
        
        for(int i = 0; i < s.length(); i++) {
            for(int j = i + 1; j <= s.length(); j++) {
                String tmp = s.substring(i, j);
                int match = 0;
                for(int k = 0; k + tmp.length() <= s.length(); k++) {
                    if(tmp.equals(s.substring(k, k + tmp.length()))) {
                        match++;                        
                    }
                }
                if(match >= 2) {
                    max = Math.max(max, tmp.length());
                }
            }
        }
        System.out.println(max);
        System.exit(0);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.*;
public class Main 
{
     public static void main(String []args)throws Exception
    {
        String inp="";
        String res="";
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        inp=br.readLine();
        for(int i=0;i<inp.length();i++)//counts the length
        {
            for(int j=0;j<(inp.length()-i);j++)//start index of string
            {
                for(int k=j+1;k<=inp.length()-i;k++)
                {
                    if(inp.substring(j,j+i).equals(inp.substring(k,k+i)))
                       res =inp.substring(j,j+i);
                }
            }
        }
        System.out.println(res.length());

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A23 {

    static int solve(String s) {
        for(int i = s.length(); i > 0; --i) {
            for(int start = 0; start < s.length() - i; ++start) {
                String str = s.substring(start, start + i);
                int firstIndex = s.indexOf(str);
                int lastIndex = s.lastIndexOf(str);
                if(firstIndex != lastIndex)
                    return i;
            }
        }
        return 0;
    }

    public static String[] EX = new String[] { "abcd", "ababa", "zzz", "qwertyuiopasdfghjklzxcvbnmqwepriuwpoep"};
    public static int[] EX_A = new int[] { 0, 3, 2, 3};
    
    public static void main(String[] args) throws IOException {
        if(true) {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            String s = br.readLine();
            System.out.println(solve(s));
        }
        else {
            for(int i = 0; i < EX.length; ++i) {
                int result = solve(EX[i]);
                System.out.println(i + ": " + result + " " + (result == EX_A[i]? "ja" : "NEJ"));
            }
        }
    }

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

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String str=sc.nextLine();
		int max=0;
		for(int i=0;i<str.length();i++)
		{
			for(int x=0;x+i<=str.length();x++)
			{
				if(contains(str,str.substring(x,x+i),x))
				{
					//System.out.println(str.substring(x,x+i));
					max=Math.max(max, i);
				}
			}
		}
		System.out.println(max);
	}
	public static boolean contains(String whole,String part,int start)
	{
		
		if(whole.indexOf(part, start+1)>=0)return true;
		return false;
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String s = in.readLine();
        for (int i = s.length() - 1; i > 0; i--)
            for (int j = 0; j <= s.length() - i; j++)
                if (s.substring(0, j + i - 1).contains(s.substring(j, j + i))
                        || s.substring(j + 1).contains(s.substring(j, j + i))) {
                    System.out.println(i);
                    return;
                }
        System.out.println(0);
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.*;
public class C23A {
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        String str=sc.next();

        for(int k=str.length()-1;k>=1;k--){
            for(int i=0;i<=str.length()-k;i++){
                for(int j=i+1;j<=str.length()-k;j++){
                    if(str.substring(i,i+k).equals(str.substring(j,j+k))){
                            System.out.println(k);
                            return;
                    }
                }
            }
        }
        System.out.println(0);

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


public class Test {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        StringBuilder text = new StringBuilder(in.nextLine()); String substr; String max="";
        for(int i=2; i<=text.length(); i++){
            for(int j=0; j<i; j++){
                substr = text.substring(j, i);
                if(text.lastIndexOf(substr) != text.indexOf(substr)){
                    if(substr.length() > max.length()){  max = substr;}
                }
            }
        }
        System.out.println(max.length());
    }
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.Map.Entry;

public class StringsProb {
    private void solve() throws IOException {
        String s = nextToken();
        int res = 0;
        Map<String , Integer> m = new HashMap<String, Integer>();
        for (int i = 0; i < s.length(); i++)
            for (int j = 0; j <= s.length(); j++) {
                if (i > j) continue;
                String a = s.substring(i , j);
                if (a.equals("")) continue;
                if (m.containsKey(a)) {
                    m.put(a, m.get(a) + 1);
                }
                else
                    m.put(a, 1);
            }
        for (Entry<String , Integer> e : m.entrySet()) {
            if (e.getValue() >= 2)
                res = Math.max(res, e.getKey().length());
        }
        System.out.println(res);
    }

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

    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[] readIntArray(int size) throws IOException {
        int[] res = new int[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    long[] readLongArray(int size) throws IOException {
        long[] res = new long[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextLong();
        }
        return res;
    }

    double[] readDoubleArray(int size) throws IOException {
        double[] res = new double[size];
        for (int i = 0; i < size; i++) {
            res[i] = nextDouble();
        }
        return res;
    }

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

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

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

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(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 substring {
	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;
	public static void main(String[] args) throws IOException {
		InputStream input = System.in;
		//InputStream input = new FileInputStream("fileIn.in");
		OutputStream output = System.out;
		//OutputStream output = new FileOutputStream("fileOut.out");
		br = new BufferedReader(new InputStreamReader(input));
		out = new PrintWriter(output);
		String in = br.readLine();
      int len = in.length();
      int doub = len;
      boolean found = false;
      while (!found)
         {
         int count = 0;
         String[] parts = new String[len - doub + 1];
         for (int i = 0; i < len - doub + 1; i++)
            parts[i] = in.substring(i,i+doub);
         for (int i = 1; i < len - doub + 1; i++)
            for (int j = 0; j < i; j++)
               if (parts[i].equals(parts[j]))
                  count++;
         if (count >= 1)
            found = true;
         doub--;
         }
      out.println(doub+1);
		out.close();
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.Scanner;

public class Main{
	public static void main(String args[]){
		Scanner cin = new Scanner(System.in);
		String str;
		int i,j,k;
		int cnt = 0;
		char [] strArray;
		
		str = cin.next();
		strArray = str.toCharArray();
		
		for(i = 0; i < strArray.length; i ++)
			for(j = i + 1; j < strArray.length; j ++)
			{
				for(k = 0; (((i + k) < strArray.length && (j + k) < strArray.length) && (strArray[i + k] == strArray[j + k])); k ++)
					if(k + 1> cnt) cnt = k + 1;
			}
		
		System.out.println(cnt);
	}
}
// Problem: 23_A. You're Given a String...
// Time complexity: cubic
import java.util.*;

public class A23 {
    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	char[] input = sc.nextLine().toCharArray();
	int[][] dyn = new int[input.length][input.length];
	int max = 0;
	for(int a = 0; a < input.length; a++) {
	    for(int b = a + 1; b < input.length; b++) {
		if(input[a] == input[b]) {
		    int prev = (a == 0) ? 0 : dyn[a-1][b-1];
		    dyn[a][b] = prev + 1;
		    max = (dyn[a][b] > max) ? dyn[a][b] : max;
		}
	    }
	}
	System.out.println(max);
    }
}