suffix
null | compare_func
sequencelengths 0
0
| demos
sequencelengths 0
0
| tgt_lang
stringclasses 1
value | task_name
stringclasses 1
value | solution
stringlengths 40
1.94k
| src_lang
stringclasses 1
value | doc_string
stringclasses 1
value | test_cases
sequencelengths 10
11
| entry_func
stringclasses 1
value | data_id
stringlengths 9
106
| dataset_name
stringclasses 1
value | prefix
stringlengths 188
2.04k
| import_str
sequencelengths 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
null | [] | [] | python | code_translation | def f_gold ( arr , n ) :
sum = 0
arr.sort ( )
for i in range ( 0 , int ( n / 2 ) ) :
sum -= ( 2 * arr [ i ] )
sum += ( 2 * arr [ n - i - 1 ] )
return sum
| java | [
[
"[8, 9, 12, 13, 17, 21, 24, 29, 37, 37, 39, 40, 41, 45, 49, 50, 53, 54, 56, 59, 60, 60, 70, 71, 72, 74, 77, 77, 78, 85, 89, 89, 90, 90, 95, 98, 98], 34",
"1454"
],
[
"[-92, -84, -84, -84, -84, -80, -80, -80, -64, -52, -40, -32, -20, -18, -16, 0, 6, 14, 20, 26, 28, 30, 32, 32, 44, 48, 48, 52, 54, 66, 76, 78, 88, 92, 94, 96], 24",
"1980"
],
[
"[0, 0, 0, 1, 1, 1], 3",
"0"
],
[
"[7, 47, 53, 59, 80, 84, 96], 5",
"170"
],
[
"[-88, -80, -68, -62, -60, -60, -48, -46, -44, -38, -16, -16, 0, 0, 2, 8, 20, 36, 40, 40, 44, 54, 60, 68, 70, 82, 82, 84, 92, 94, 96], 29",
"2812"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 32",
"20"
],
[
"[2, 5, 10, 11, 13, 14, 15, 17, 17, 23, 23, 24, 27, 27, 28, 29, 30, 40, 42, 43, 46, 47, 51, 52, 57, 64, 65, 73, 74, 75, 76, 77, 81, 81, 82, 87, 89, 93, 95, 95, 99], 35",
"1542"
],
[
"[-94, -92, -84, -84, -76, -72, -72, -72, -54, -48, -38, -22, -16, -12, 2, 2, 12, 20, 20, 24, 26, 26, 26, 26, 30, 38, 48, 50, 84, 86], 21",
"1608"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 37",
"20"
],
[
"[7, 8, 27, 31, 37, 46, 46, 52, 53, 53, 56, 57, 57, 73, 73, 74, 80, 84, 97], 13",
"344"
]
] | f_gold | MAXIMIZE_SUM_CONSECUTIVE_DIFFERENCES_CIRCULAR_ARRAY | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMIZE_SUM_CONSECUTIVE_DIFFERENCES_CIRCULAR_ARRAY{
static int f_gold ( int arr [ ] , int n ) {
int sum = 0 ;
Arrays . sort ( arr ) ;
for ( int i = 0 ;
i < n / 2 ;
i ++ ) {
sum -= ( 2 * arr [ i ] ) ;
sum += ( 2 * arr [ n - i - 1 ] ) ;
}
return sum ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n , p ) :
ans = 0 ;
temp = p ;
while ( temp <= n ) :
ans += n / temp ;
temp = temp * p ;
return ans ;
| java | [
[
"49, 30",
"1.6333333333333333"
],
[
"80, 25",
"3.2"
],
[
"10, 9",
"1.1111111111111112"
],
[
"81, 57",
"1.4210526315789473"
],
[
"11, 4",
"2.75"
],
[
"45, 34",
"1.3235294117647058"
],
[
"86, 90",
"0"
],
[
"27, 78",
"0"
],
[
"80, 60",
"1.3333333333333333"
],
[
"97, 31",
"3.129032258064516"
]
] | f_gold | FINDING_POWER_PRIME_NUMBER_P_N | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FINDING_POWER_PRIME_NUMBER_P_N{
static int f_gold ( int n , int p ) {
int ans = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
int count = 0 , temp = i ;
while ( temp % p == 0 ) {
count ++ ;
temp = temp / p ;
}
ans += count ;
}
return ans ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n ) :
for i in range ( n ) :
j = 0
while ( j < n ) :
if ( i != j and arr [ i ] == arr [ j ] ) :
break
j += 1
if ( j == n ) :
return arr [ i ]
return - 1
| java | [
[
"[1, 2, 3, 4, 6, 6, 7, 9, 10, 13, 16, 23, 30, 32, 36, 42, 42, 43, 44, 47, 48, 48, 49, 52, 52, 53, 55, 56, 58, 59, 60, 60, 63, 67, 68, 68, 74, 75, 76, 80, 81, 81, 83, 83, 86, 87, 91, 92, 97], 47",
"1"
],
[
"[-96, -46, -86, 56, -72, 50, 18, 8, 50], 8",
"-96"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 14",
"-1"
],
[
"[19, 10, 49, 40, 34, 21, 63, 51], 5",
"19"
],
[
"[-96, -96, -90, -88, -88, -84, -80, -76, -68, -64, -64, -52, -52, -52, -52, -50, -50, -48, -48, -40, -32, -26, -24, -22, -20, -14, -12, 0, 6, 8, 10, 20, 24, 28, 34, 36, 54, 60, 60, 60, 68, 74, 74, 74, 84, 88, 94], 27",
"-90"
],
[
"[1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0], 19",
"-1"
],
[
"[1, 2, 3, 10, 15, 21, 28, 36, 41, 44, 45, 47, 72, 77, 77, 79, 85], 15",
"1"
],
[
"[42, -84, 42, 36, -10, 24, -62, 60], 7",
"-84"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 35",
"-1"
],
[
"[2, 21, 42, 92, 65, 62, 75, 43, 81, 17, 92, 86, 37, 63, 27, 97, 24, 61, 85, 49, 84, 7, 14, 19, 60, 55, 68, 79, 8, 12, 75, 12, 92, 79, 42], 27",
"2"
]
] | f_gold | NON_REPEATING_ELEMENT | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NON_REPEATING_ELEMENT{
static int f_gold ( int arr [ ] , int n ) {
for ( int i = 0 ;
i < n ;
i ++ ) {
int j ;
for ( j = 0 ;
j < n ;
j ++ ) if ( i != j && arr [ i ] == arr [ j ] ) break ;
if ( j == n ) return arr [ i ] ;
}
return - 1 ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold(n):
if (n <= 1):
return False
if (n <= 3):
return True
if (n % 2 == 0 or n % 3 == 0):
return False
i = 5
while (i * i <= n):
if (n % i == 0 or n % (i + 2) == 0):
return False
i = i + 6
return True
| java | [
[
"15",
"False"
],
[
"90",
"False"
],
[
"38",
"False"
],
[
"65",
"False"
],
[
"91",
"False"
],
[
"16",
"False"
],
[
"48",
"False"
],
[
"74",
"False"
],
[
"14",
"False"
],
[
"47",
"True"
]
] | f_gold | PRIMALITY_TEST_SET_1_INTRODUCTION_AND_SCHOOL_METHOD_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PRIMALITY_TEST_SET_1_INTRODUCTION_AND_SCHOOL_METHOD_1{
static boolean f_gold ( int n ) {
if ( n <= 1 ) return false ;
if ( n <= 3 ) return true ;
if ( n % 2 == 0 || n % 3 == 0 ) return false ;
for ( int i = 5 ;
i * i <= n ;
i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return false ;
return true ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n ) :
max = 0
for i in range ( n ) :
for j in range ( n ) :
if ( ( j - 3 ) >= 0 ) :
result = ( arr [ i ] [ j ] * arr [ i ] [ j - 1 ] * arr [ i ] [ j - 2 ] * arr [ i ] [ j - 3 ] )
if ( max < result ) :
max = result
if ( ( i - 3 ) >= 0 ) :
result = ( arr [ i ] [ j ] * arr [ i - 1 ] [ j ] * arr [ i - 2 ] [ j ] * arr [ i - 3 ] [ j ] )
if ( max < result ) :
max = result
if ( ( i - 3 ) >= 0 and ( j - 3 ) >= 0 ) :
result = ( arr [ i ] [ j ] * arr [ i - 1 ] [ j - 1 ] * arr [ i - 2 ] [ j - 2 ] * arr [ i - 3 ] [ j - 3 ] )
if ( max < result ) :
max = result
return max
| java | [
[
"[[1, 2, 5, 6, 7, 11, 12, 14, 15, 16, 19, 19, 24, 25, 32, 34, 36, 36, 38, 38, 39, 43, 43, 45, 47, 49, 51, 51, 51, 52, 53, 56, 59, 59, 67, 69, 70, 74, 75, 75, 77, 79, 81, 90, 94, 96, 96, 96], [1, 2, 4, 6, 9, 9, 9, 16, 18, 21, 23, 26, 26, 30, 36, 37, 37, 38, 39, 42, 45, 49, 51, 52, 52, 53, 56, 59, 61, 61, 64, 64, 69, 72, 77, 79, 82, 82, 87, 88, 89, 91, 91, 91, 94, 95, 95, 98], [2, 5, 5, 6, 10, 10, 14, 16, 16, 20, 22, 24, 25, 28, 28, 29, 30, 31, 36, 38, 42, 44, 44, 45, 45, 49, 51, 53, 56, 57, 61, 63, 66, 67, 67, 70, 76, 80, 87, 87, 91, 93, 95, 96, 96, 96, 97, 99], [4, 9, 10, 11, 12, 13, 13, 18, 20, 23, 24, 26, 27, 28, 33, 35, 35, 37, 42, 42, 44, 45, 49, 52, 55, 56, 59, 60, 60, 63, 64, 64, 72, 72, 74, 77, 78, 81, 85, 85, 87, 89, 93, 93, 95, 98, 98, 99], [7, 7, 7, 9, 11, 11, 14, 18, 19, 21, 26, 32, 32, 34, 35, 37, 37, 39, 40, 41, 42, 53, 56, 59, 62, 62, 65, 68, 69, 70, 72, 73, 73, 75, 75, 77, 77, 78, 85, 86, 87, 88, 88, 88, 93, 94, 95, 98], [4, 4, 5, 12, 16, 19, 20, 23, 25, 27, 28, 37, 38, 39, 40, 41, 45, 46, 47, 48, 49, 49, 55, 58, 61, 61, 62, 67, 67, 69, 69, 71, 72, 73, 75, 76, 76, 77, 77, 79, 81, 85, 86, 90, 90, 97, 97, 99], [1, 9, 9, 11, 19, 19, 21, 23, 25, 26, 26, 27, 28, 31, 37, 38, 41, 41, 43, 43, 49, 54, 55, 56, 58, 58, 61, 62, 63, 64, 64, 68, 70, 75, 79, 81, 83, 84, 85, 85, 86, 87, 92, 92, 92, 94, 94, 97], [2, 6, 8, 10, 11, 11, 12, 13, 14, 15, 15, 19, 23, 25, 27, 29, 33, 33, 41, 43, 45, 47, 49, 49, 51, 52, 55, 59, 60, 62, 64, 64, 65, 65, 72, 74, 76, 79, 83, 83, 84, 90, 91, 92, 93, 93, 94, 96], [5, 9, 11, 12, 13, 15, 16, 21, 24, 28, 32, 33, 36, 37, 40, 45, 46, 48, 57, 60, 63, 63, 63, 63, 64, 66, 68, 68, 73, 75, 75, 77, 77, 79, 80, 81, 83, 84, 84, 85, 85, 85, 89, 91, 91, 92, 94, 99], [2, 2, 4, 6, 6, 11, 14, 15, 15, 18, 25, 25, 27, 28, 30, 31, 32, 36, 37, 40, 40, 41, 42, 46, 52, 59, 60, 60, 61, 62, 63, 65, 68, 68, 69, 71, 73, 74, 75, 78, 79, 82, 93, 93, 93, 94, 97, 99], [1, 1, 4, 5, 5, 6, 8, 8, 9, 10, 11, 12, 15, 21, 22, 28, 32, 33, 35, 35, 36, 38, 41, 44, 49, 53, 54, 57, 58, 59, 62, 62, 63, 67, 68, 69, 70, 75, 77, 77, 82, 83, 83, 86, 90, 91, 92, 97], [1, 1, 3, 4, 5, 9, 9, 13, 15, 24, 27, 28, 33, 37, 37, 39, 40, 41, 41, 48, 50, 50, 51, 52, 54, 63, 63, 64, 65, 68, 70, 71, 73, 74, 74, 74, 79, 79, 80, 83, 89, 90, 90, 93, 94, 98, 99, 99], [2, 3, 5, 9, 11, 11, 20, 22, 23, 25, 26, 26, 26, 29, 39, 39, 40, 40, 48, 48, 49, 49, 50, 51, 51, 53, 54, 58, 65, 66, 67, 71, 71, 72, 75, 76, 79, 85, 87, 87, 90, 91, 95, 97, 98, 98, 98, 99], [4, 4, 9, 9, 10, 13, 15, 22, 23, 23, 24, 26, 26, 27, 28, 29, 31, 33, 34, 38, 40, 45, 45, 47, 48, 50, 50, 58, 59, 60, 64, 65, 66, 70, 80, 80, 81, 83, 84, 84, 88, 89, 90, 90, 95, 98, 99, 99], [2, 4, 5, 7, 9, 11, 11, 12, 13, 15, 17, 19, 23, 26, 26, 28, 28, 29, 34, 35, 43, 47, 48, 49, 51, 51, 51, 56, 57, 58, 60, 61, 63, 64, 66, 68, 68, 71, 72, 74, 78, 80, 81, 84, 86, 90, 91, 97], [1, 2, 3, 4, 6, 7, 7, 12, 13, 17, 19, 22, 23, 33, 33, 38, 40, 44, 44, 47, 47, 51, 52, 54, 56, 56, 57, 58, 64, 65, 67, 68, 74, 74, 76, 79, 80, 83, 85, 88, 90, 92, 92, 93, 93, 94, 97, 99], [1, 4, 5, 10, 13, 13, 20, 22, 23, 28, 30, 31, 32, 33, 36, 36, 44, 46, 49, 49, 51, 51, 51, 55, 56, 60, 69, 72, 73, 74, 74, 75, 75, 77, 78, 78, 81, 82, 82, 84, 87, 87, 88, 91, 91, 95, 97, 99], [2, 3, 4, 10, 13, 13, 14, 16, 18, 23, 31, 35, 39, 41, 42, 42, 43, 43, 48, 49, 49, 53, 56, 57, 57, 58, 64, 65, 68, 68, 68, 74, 75, 77, 78, 78, 82, 83, 84, 87, 88, 89, 89, 91, 92, 93, 99, 99], [2, 4, 5, 8, 10, 12, 13, 16, 17, 18, 23, 24, 28, 29, 29, 31, 32, 34, 38, 39, 39, 43, 45, 50, 51, 51, 54, 55, 58, 59, 59, 61, 62, 63, 63, 65, 65, 72, 74, 82, 82, 84, 92, 92, 93, 94, 95, 97], [6, 7, 9, 10, 10, 10, 11, 14, 16, 19, 22, 24, 33, 38, 41, 47, 50, 50, 51, 52, 52, 54, 55, 57, 57, 57, 59, 62, 66, 66, 66, 67, 68, 72, 72, 73, 80, 81, 81, 83, 87, 88, 89, 94, 96, 97, 97, 98], [2, 4, 5, 6, 9, 13, 14, 14, 14, 16, 20, 21, 23, 23, 24, 24, 27, 29, 31, 33, 36, 37, 43, 48, 49, 50, 51, 56, 57, 59, 62, 62, 65, 70, 71, 72, 74, 74, 75, 77, 80, 81, 84, 87, 89, 93, 96, 99], [1, 2, 3, 6, 8, 17, 27, 28, 30, 31, 32, 32, 33, 33, 37, 40, 41, 42, 42, 45, 49, 51, 52, 54, 57, 60, 62, 62, 64, 64, 65, 67, 67, 70, 73, 77, 77, 80, 83, 83, 83, 83, 85, 85, 92, 95, 97, 97], [1, 3, 11, 11, 12, 15, 20, 22, 22, 22, 23, 23, 23, 24, 26, 28, 33, 33, 34, 34, 36, 39, 41, 42, 42, 43, 50, 50, 54, 56, 59, 60, 64, 70, 74, 75, 76, 82, 82, 89, 89, 94, 96, 96, 96, 98, 98, 98], [2, 2, 3, 4, 7, 11, 14, 18, 18, 18, 21, 23, 28, 29, 32, 33, 33, 33, 34, 39, 39, 40, 41, 42, 48, 49, 50, 52, 56, 57, 57, 58, 59, 66, 66, 70, 72, 74, 76, 77, 77, 79, 86, 86, 89, 92, 94, 99], [1, 9, 10, 12, 13, 14, 17, 18, 20, 21, 23, 23, 25, 26, 28, 28, 31, 33, 33, 36, 37, 41, 41, 41, 41, 42, 43, 44, 47, 51, 54, 57, 59, 59, 59, 63, 64, 67, 69, 69, 75, 78, 84, 85, 93, 98, 98, 99], [1, 3, 5, 8, 9, 9, 10, 18, 18, 18, 19, 21, 23, 24, 24, 25, 26, 27, 29, 34, 34, 35, 37, 37, 39, 39, 41, 48, 56, 57, 59, 61, 64, 65, 68, 69, 75, 75, 75, 76, 78, 83, 85, 86, 90, 94, 97, 98], [7, 8, 11, 13, 14, 15, 16, 16, 17, 20, 28, 31, 39, 41, 42, 46, 51, 52, 53, 53, 54, 57, 57, 66, 66, 67, 72, 72, 73, 74, 74, 78, 82, 82, 83, 84, 85, 87, 89, 91, 93, 95, 95, 97, 98, 98, 98, 99], [1, 2, 4, 5, 6, 8, 8, 12, 12, 12, 20, 20, 25, 29, 30, 31, 38, 38, 39, 39, 42, 43, 43, 44, 45, 47, 47, 51, 56, 56, 57, 58, 62, 65, 65, 65, 66, 69, 69, 73, 78, 82, 83, 85, 87, 90, 95, 96], [2, 2, 3, 3, 6, 7, 8, 14, 15, 16, 16, 17, 20, 23, 25, 29, 29, 31, 32, 33, 37, 37, 39, 40, 40, 47, 48, 48, 50, 51, 52, 55, 55, 56, 59, 62, 69, 70, 71, 72, 72, 81, 82, 84, 89, 92, 96, 99], [2, 8, 9, 10, 16, 17, 23, 30, 32, 37, 38, 41, 41, 46, 49, 49, 55, 57, 59, 59, 63, 63, 64, 66, 68, 68, 69, 70, 72, 74, 76, 77, 80, 81, 83, 84, 84, 85, 86, 90, 90, 91, 91, 92, 96, 96, 97, 97], [1, 7, 13, 13, 17, 17, 18, 23, 24, 31, 33, 34, 34, 35, 36, 40, 40, 40, 40, 44, 45, 51, 53, 55, 55, 58, 58, 64, 64, 69, 72, 75, 75, 80, 80, 81, 82, 82, 83, 84, 86, 87, 87, 88, 89, 95, 96, 99], [1, 4, 7, 9, 10, 11, 13, 15, 15, 19, 21, 23, 23, 24, 25, 27, 32, 32, 33, 37, 38, 41, 43, 43, 45, 45, 47, 51, 52, 53, 54, 58, 59, 61, 63, 63, 65, 73, 76, 77, 80, 80, 85, 87, 90, 92, 94, 96], [3, 4, 7, 7, 12, 13, 20, 20, 20, 21, 22, 22, 27, 27, 28, 31, 32, 35, 37, 39, 39, 40, 41, 45, 45, 45, 48, 48, 49, 49, 51, 54, 57, 64, 67, 70, 80, 83, 89, 89, 90, 90, 90, 92, 92, 98, 98, 99], [1, 1, 7, 10, 12, 16, 16, 21, 27, 31, 33, 34, 36, 44, 45, 46, 46, 46, 47, 49, 49, 53, 54, 57, 57, 58, 58, 62, 62, 63, 67, 69, 77, 79, 82, 82, 84, 85, 85, 85, 85, 86, 92, 93, 94, 94, 96, 99], [1, 1, 4, 14, 14, 17, 19, 20, 21, 29, 30, 30, 32, 33, 34, 36, 36, 44, 46, 47, 48, 53, 57, 59, 59, 62, 63, 64, 65, 65, 66, 69, 69, 70, 72, 73, 74, 74, 80, 81, 83, 84, 84, 84, 85, 85, 87, 94], [9, 13, 16, 18, 19, 19, 21, 23, 24, 24, 25, 30, 32, 33, 35, 36, 37, 42, 46, 47, 48, 48, 52, 54, 55, 62, 62, 66, 67, 69, 70, 70, 71, 71, 73, 74, 75, 77, 78, 79, 80, 82, 83, 86, 88, 89, 94, 99], [1, 2, 2, 4, 13, 14, 15, 15, 18, 18, 18, 19, 21, 22, 22, 22, 24, 28, 31, 36, 45, 46, 47, 49, 51, 52, 56, 56, 58, 66, 67, 68, 69, 71, 73, 75, 77, 78, 79, 79, 82, 87, 87, 93, 93, 97, 97, 98], [2, 3, 4, 4, 8, 11, 14, 14, 16, 19, 25, 29, 32, 36, 39, 45, 46, 46, 46, 47, 50, 51, 52, 55, 56, 57, 61, 63, 63, 64, 66, 67, 70, 72, 75, 76, 80, 82, 83, 84, 84, 87, 89, 90, 92, 94, 96, 97], [3, 6, 10, 11, 14, 15, 19, 20, 21, 23, 28, 29, 30, 30, 32, 34, 34, 38, 39, 41, 41, 44, 45, 47, 50, 50, 50, 54, 57, 57, 58, 58, 63, 65, 66, 68, 68, 69, 73, 75, 76, 79, 83, 86, 89, 94, 95, 96], [4, 10, 13, 18, 18, 21, 21, 22, 22, 22, 24, 24, 25, 25, 26, 29, 29, 39, 50, 51, 51, 53, 55, 56, 56, 56, 57, 60, 61, 62, 67, 67, 69, 69, 73, 76, 76, 76, 77, 79, 79, 80, 82, 84, 89, 90, 95, 97], [1, 6, 8, 10, 10, 25, 35, 38, 39, 40, 40, 40, 41, 41, 43, 47, 51, 56, 56, 56, 57, 60, 60, 62, 63, 64, 65, 68, 69, 72, 73, 75, 76, 76, 76, 78, 79, 79, 79, 80, 82, 82, 84, 90, 91, 95, 96, 99], [2, 3, 7, 10, 11, 11, 17, 17, 19, 21, 21, 23, 24, 26, 28, 29, 31, 33, 44, 44, 44, 45, 48, 48, 50, 50, 52, 54, 56, 58, 61, 65, 66, 67, 69, 70, 72, 72, 74, 81, 84, 85, 86, 87, 92, 93, 98, 99], [1, 3, 3, 3, 6, 9, 13, 14, 14, 22, 25, 26, 28, 28, 33, 36, 38, 38, 41, 44, 45, 46, 46, 51, 55, 56, 57, 57, 59, 62, 64, 65, 65, 68, 77, 78, 79, 79, 84, 85, 87, 90, 94, 95, 95, 95, 97, 99], [7, 7, 8, 9, 14, 18, 24, 24, 25, 27, 28, 28, 30, 31, 31, 31, 33, 36, 36, 37, 37, 38, 40, 43, 45, 46, 46, 47, 50, 51, 51, 52, 52, 53, 53, 60, 62, 65, 65, 67, 73, 76, 79, 88, 91, 94, 95, 95], [4, 5, 7, 16, 17, 18, 18, 18, 21, 24, 25, 27, 28, 31, 33, 35, 36, 36, 38, 40, 42, 42, 42, 45, 46, 46, 47, 49, 50, 52, 53, 65, 68, 68, 69, 69, 71, 71, 71, 72, 75, 76, 76, 80, 80, 87, 90, 95], [9, 11, 12, 14, 15, 20, 22, 23, 29, 29, 29, 33, 35, 35, 37, 37, 41, 42, 44, 45, 45, 47, 50, 51, 51, 51, 55, 57, 62, 64, 66, 66, 67, 76, 80, 82, 82, 83, 83, 83, 83, 83, 85, 86, 90, 90, 92, 93], [1, 3, 3, 7, 8, 8, 11, 16, 19, 20, 25, 29, 32, 33, 39, 39, 42, 43, 43, 44, 47, 48, 49, 50, 51, 53, 54, 54, 58, 60, 60, 60, 62, 64, 65, 67, 71, 74, 75, 77, 83, 84, 85, 87, 87, 90, 91, 97], [2, 5, 5, 12, 13, 16, 17, 19, 20, 22, 26, 28, 28, 30, 30, 31, 36, 37, 41, 44, 44, 44, 46, 50, 51, 51, 51, 54, 54, 57, 58, 58, 59, 60, 62, 66, 66, 68, 68, 71, 75, 76, 84, 85, 89, 90, 91, 95]], 45",
"85791650"
],
[
"[[36, 16, 60, 44, 14, -68, -28, -98, 14, -6, 24, 56, 54, 70, 70], [-14, 28, -16, -26, -54, 60, 2, 52, 28, -42, 36, 6, 14, 2, -30], [-26, 56, -60, -6, 24, -36, 76, -52, 20, -54, -22, 38, 90, -2, -70], [62, -70, -50, 18, 62, -34, -74, 66, 30, 64, 6, 94, -72, 58, -82], [30, 28, 6, -38, -40, -98, -14, -80, -84, -20, -8, 12, -90, -26, -48], [-2, 64, -38, -82, -82, -18, -14, -20, 28, 16, -94, -78, -80, -4, 32], [-82, -74, 68, 78, -56, 24, -58, 36, -10, 28, 98, 42, 26, -98, 92], [40, -82, 56, 98, 68, -8, 48, -78, -72, -40, 78, 22, -76, 68, 10], [88, 88, 80, 52, -66, -16, -24, -84, 56, -10, 70, -2, 42, 64, 62], [-76, -52, 70, -10, 24, -46, 62, -98, 28, -78, 58, -10, -76, 40, -98], [-82, -58, -12, -98, -54, -62, -32, 52, 48, 64, 28, 72, -84, 48, -14], [-72, 66, -84, 34, -96, 66, -90, 48, 86, -34, -4, -70, -88, -76, 46], [40, 70, 22, -40, 64, -32, -68, -6, -78, -56, -96, -98, -26, -38, -90], [98, 32, 20, 2, -56, 12, 72, -40, 24, 78, 98, 76, 98, -8, 70], [-30, -34, -34, 46, 18, -48, -96, -12, -60, -90, -50, -64, 12, 60, -94]], 8",
"32184672"
],
[
"[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], 18",
"1"
],
[
"[[43, 44, 74, 24, 47, 58, 43, 11, 78, 61], [93, 7, 12, 81, 39, 13, 50, 62, 27, 87], [27, 9, 63, 68, 8, 83, 44, 22, 83, 2], [70, 73, 44, 15, 37, 38, 42, 21, 20, 75], [72, 43, 56, 93, 92, 73, 34, 9, 28, 38], [4, 83, 97, 56, 44, 89, 92, 51, 82, 68], [55, 51, 72, 78, 65, 66, 10, 13, 71, 85], [97, 15, 49, 86, 56, 56, 92, 84, 98, 73], [89, 44, 19, 45, 74, 7, 76, 60, 42, 34], [65, 47, 3, 34, 46, 97, 98, 78, 19, 57]], 8",
"37003392"
],
[
"[[-88, -82, -70, -46, -44, -18, 12, 38, 66, 90, 96], [-98, -90, -84, -62, -42, -30, -16, 4, 14, 18, 26], [-94, -48, -32, -24, -22, -18, 42, 44, 64, 70, 74], [-94, -60, -58, -56, -40, -34, 2, 18, 32, 76, 96], [-94, -74, -62, -56, -50, -46, -2, 34, 34, 44, 68], [-74, -56, -50, -16, -14, 0, 14, 30, 30, 66, 82], [-80, -78, -60, -56, -46, -32, 4, 8, 14, 42, 54], [-68, -66, -58, -50, -50, -40, -16, -2, 4, 10, 80], [-70, -68, -24, -8, -4, 34, 36, 60, 82, 84, 92], [-90, -62, -60, -54, -6, -6, 10, 10, 14, 52, 66], [-88, -72, -70, -18, -6, 28, 38, 50, 56, 72, 90]], 9",
"81397232"
],
[
"[[0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1], [1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0], [1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0], [0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0], [0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0], [0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1], [1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0], [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1], [0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1], [0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0], [1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1], [0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0], [0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1], [0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1], [0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], [1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1], [0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1], [0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0], [1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1], [1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1], [1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0], [0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0]], 18",
"1"
],
[
"[[8, 14, 19, 21, 33, 35, 37, 40, 44, 49, 52, 68, 68, 72, 77, 80, 86, 88, 88, 99], [10, 12, 18, 18, 25, 27, 30, 32, 32, 42, 46, 47, 48, 53, 67, 69, 70, 84, 85, 89], [12, 15, 18, 24, 26, 33, 41, 45, 55, 71, 73, 79, 82, 87, 88, 88, 89, 91, 92, 98], [1, 1, 11, 16, 24, 24, 27, 42, 49, 50, 69, 69, 72, 73, 75, 80, 80, 82, 95, 96], [1, 6, 12, 13, 14, 22, 28, 30, 39, 51, 53, 66, 68, 68, 69, 77, 86, 90, 96, 99], [2, 6, 24, 26, 28, 32, 32, 37, 38, 54, 56, 61, 64, 64, 68, 71, 71, 76, 79, 86], [22, 31, 32, 34, 39, 47, 54, 57, 59, 61, 62, 72, 72, 74, 79, 79, 80, 85, 91, 93], [3, 7, 12, 13, 15, 16, 21, 26, 26, 36, 56, 60, 62, 63, 64, 66, 67, 71, 76, 83], [3, 22, 29, 30, 34, 35, 36, 39, 41, 42, 43, 51, 57, 58, 72, 72, 80, 84, 88, 92], [9, 14, 17, 29, 34, 37, 38, 39, 40, 46, 46, 52, 62, 68, 77, 78, 79, 92, 93, 95], [1, 17, 17, 18, 19, 23, 26, 27, 36, 37, 48, 53, 56, 62, 62, 68, 69, 78, 78, 84], [20, 20, 22, 33, 33, 33, 43, 48, 60, 63, 64, 70, 77, 80, 80, 85, 87, 88, 91, 94], [7, 10, 10, 13, 14, 14, 23, 42, 64, 65, 65, 72, 73, 74, 75, 76, 77, 78, 79, 91], [1, 4, 9, 12, 13, 13, 23, 23, 27, 33, 34, 34, 37, 40, 43, 63, 67, 70, 87, 96], [1, 2, 8, 11, 12, 14, 14, 23, 24, 33, 44, 45, 47, 55, 78, 79, 83, 98, 98, 99], [3, 9, 18, 21, 24, 28, 34, 35, 45, 46, 59, 60, 60, 63, 64, 84, 95, 96, 97, 97], [4, 11, 17, 19, 20, 20, 20, 30, 31, 41, 45, 47, 64, 68, 76, 81, 83, 89, 93, 93], [2, 8, 10, 21, 38, 40, 43, 44, 47, 52, 55, 71, 75, 80, 85, 85, 89, 92, 94, 99], [3, 7, 13, 14, 27, 28, 29, 30, 44, 47, 50, 53, 55, 64, 64, 75, 79, 86, 98, 99], [10, 10, 10, 16, 17, 33, 44, 52, 53, 57, 59, 64, 65, 74, 75, 76, 80, 87, 90, 90]], 15",
"49595568"
],
[
"[[-78, 34, -74, 16, -10, -10, -14, 28], [-22, -84, 48, -20, 2, 86, 88, -60], [32, 16, 98, 30, -10, 48, 82, 56], [48, -32, -76, -54, 36, 56, 6, 82], [6, -20, 64, 56, 6, -28, 30, -72], [-32, -48, 10, 26, 40, -8, -26, -54], [-68, -36, -86, -12, -6, 62, -90, 26], [-76, 80, 44, -82, 92, -12, -56, -8]], 7",
"26455296"
],
[
"[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]], 17",
"1"
],
[
"[[76, 57, 99, 99, 95, 61, 64, 17, 58, 47], [52, 18, 37, 70, 17, 3, 33, 84, 80, 7], [2, 34, 4, 49, 17, 71, 12, 76, 74, 44], [89, 49, 69, 17, 38, 56, 61, 75, 86, 84], [32, 56, 87, 23, 66, 67, 97, 5, 23, 51], [25, 24, 30, 51, 30, 72, 46, 57, 29, 85], [80, 62, 87, 29, 37, 90, 88, 40, 55, 26], [27, 75, 51, 91, 22, 65, 38, 91, 1, 15], [11, 56, 38, 93, 54, 94, 23, 90, 37, 51], [61, 82, 79, 22, 66, 55, 67, 26, 93, 93]], 6",
"56796795"
]
] | f_gold | MAXIMUM_PRODUCT_OF_4_ADJACENT_ELEMENTS_IN_MATRIX | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_PRODUCT_OF_4_ADJACENT_ELEMENTS_IN_MATRIX{
static int f_gold ( int arr [ ] [ ] , int n ) {
int max = 0 , result ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = 0 ;
j < n ;
j ++ ) {
if ( ( j - 3 ) >= 0 ) {
result = arr [ i ] [ j ] * arr [ i ] [ j - 1 ] * arr [ i ] [ j - 2 ] * arr [ i ] [ j - 3 ] ;
if ( max < result ) max = result ;
}
if ( ( i - 3 ) >= 0 ) {
result = arr [ i ] [ j ] * arr [ i - 1 ] [ j ] * arr [ i - 2 ] [ j ] * arr [ i - 3 ] [ j ] ;
if ( max < result ) max = result ;
}
if ( ( i - 3 ) >= 0 && ( j - 3 ) >= 0 ) {
result = arr [ i ] [ j ] * arr [ i - 1 ] [ j - 1 ] * arr [ i - 2 ] [ j - 2 ] * arr [ i - 3 ] [ j - 3 ] ;
if ( max < result ) max = result ;
}
}
}
return max ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a , b , mod ) :
res = 0 ;
a = a % mod ;
while ( b > 0 ) :
if ( b % 2 == 1 ) :
res = ( res + a ) % mod ;
a = ( a * 2 ) % mod ;
b //= 2 ;
return res % mod ;
| java | [
[
"99, 75, 40",
"25"
],
[
"11, 4, 41",
"3"
],
[
"51, 37, 23",
"1"
],
[
"49, 51, 88",
"35"
],
[
"9, 34, 30",
"6"
],
[
"90, 85, 55",
"5"
],
[
"19, 96, 41",
"20"
],
[
"17, 96, 37",
"4"
],
[
"54, 3, 51",
"9"
],
[
"5, 69, 60",
"45"
]
] | f_gold | HOW_TO_AVOID_OVERFLOW_IN_MODULAR_MULTIPLICATION | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class HOW_TO_AVOID_OVERFLOW_IN_MODULAR_MULTIPLICATION{
static long f_gold ( long a , long b , long mod ) {
long res = 0 ;
a = a % mod ;
while ( b > 0 ) {
if ( b % 2 == 1 ) {
res = ( res + a ) % mod ;
}
a = ( a * 2 ) % mod ;
b /= 2 ;
}
return res % mod ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( text , word ) :
word_list = text.split ( )
result = ''
stars = '*' * len ( word )
count = 0
index = 0 ;
for i in word_list :
if i == word :
word_list [ index ] = stars
index += 1
result = ' '.join ( word_list )
return result
| java | [
[
"'IggvAXtmJ', 'kzHdEJuCaO'",
"'IggvAXtmJ'"
],
[
"'76711241128', '5'",
"'76711241128'"
],
[
"'010', '0101001'",
"'010'"
],
[
"'HIKOn', 'XlnBwpx'",
"'HIKOn'"
],
[
"'3680369217', '017523'",
"'3680369217'"
],
[
"'1111', '1011'",
"'1111'"
],
[
"'zIi', 'ONNXygON'",
"'zIi'"
],
[
"'06', '54171617'",
"'06'"
],
[
"'111', '0010001011001'",
"'111'"
],
[
"'NJNnrVU', 'AGwmS'",
"'NJNnrVU'"
]
] | f_gold | PROGRAM_CENSOR_WORD_ASTERISKS_SENTENCE | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_CENSOR_WORD_ASTERISKS_SENTENCE{
static String f_gold ( String text , String word ) {
String [ ] word_list = text . split ( "\\s+" ) ;
String result = "" ;
String stars = "" ;
for ( int i = 0 ;
i < word . length ( ) ;
i ++ ) stars += '*' ;
int index = 0 ;
for ( String i : word_list ) {
if ( i . compareTo ( word ) == 0 ) word_list [ index ] = stars ;
index ++ ;
}
for ( String i : word_list ) result += i + ' ' ;
return result ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( string ) :
Stack = [ ]
for ch in string :
if ch == ')' :
top = Stack.pop ( )
elementsInside = 0
while top != '(' :
elementsInside += 1
top = Stack.pop ( )
if elementsInside < 1 :
return True
else :
Stack.append ( ch )
return False
| java | [
[
"'((a+b)+((c+d)))'",
"True"
],
[
"'(((a+(b)))+(c+d))'",
"True"
],
[
"'(((a+(b))+c+d))'",
"True"
],
[
"'((a+b)+(c+d))'",
"False"
],
[
"'(8582007)'",
"False"
],
[
"'((a+(b))+(c+d))'",
"False"
],
[
"'(PylsShEdKAE)'",
"False"
],
[
"'886980680541'",
"False"
],
[
"'001'",
"False"
],
[
"'jsVmFeOq'",
"False"
]
] | f_gold | FIND_EXPRESSION_DUPLICATE_PARENTHESIS_NOT | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_EXPRESSION_DUPLICATE_PARENTHESIS_NOT{
static boolean f_gold ( String s ) {
Stack < Character > Stack = new Stack < > ( ) ;
char [ ] str = s . toCharArray ( ) ;
for ( char ch : str ) {
if ( ch == ')' ) {
char top = Stack . peek ( ) ;
Stack . pop ( ) ;
int elementsInside = 0 ;
while ( top != '(' ) {
elementsInside ++ ;
top = Stack . peek ( ) ;
Stack . pop ( ) ;
}
if ( elementsInside < 1 ) {
return true ;
}
}
else {
Stack . push ( ch ) ;
}
}
return false ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( x1 , y1 , x2 , y2 ) :
return ( float ) ( y2 - y1 ) / ( x2 - x1 )
| java | [
[
"236.27324548309292, 5792.493225762838, 7177.837879115863, 1289.5700425822731",
"-0.6486899453998202"
],
[
"-9201.144918204123, -2716.3347716140406, -5161.142121227645, -3205.784279961129",
"-0.12115078452752318"
],
[
"3480.4716834445326, 3577.9608612055613, 8611.515262945342, 6744.864707668983",
"0.617204628531244"
],
[
"-6915.538971485092, -4113.601103381095, -748.3462104020822, -9245.271700539257",
"-0.8320918116165706"
],
[
"8887.97173657486, 1678.4080012662428, 8709.574949883017, 8548.492675510739",
"-38.51013687881985"
],
[
"-3785.5177159369946, -3084.67461899163, -7415.76208254121, -887.5389305564152",
"-0.6052307962095809"
],
[
"3037.6696554256832, 4432.445827549, 8387.304165588026, 611.3373507518394",
"-0.7142746798007333"
],
[
"-7925.458496016523, -3350.27411882042, -5619.767086756504, -1185.7423219907591",
"0.9387777514963889"
],
[
"1404.2919985268031, 8971.636233373416, 3039.112051378511, 1947.6756252708972",
"-4.2964732392719505"
],
[
"-4748.744241168378, -675.557388148954, -5998.241086029875, -4236.658178504375",
"2.85002783720527"
]
] | f_gold | PROGRAM_FIND_SLOPE_LINE | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_FIND_SLOPE_LINE{
static float f_gold ( float x1 , float y1 , float x2 , float y2 ) {
return ( y2 - y1 ) / ( x2 - x1 ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
if ( n == 0 or n == 1 ) :
return n
f1 , f2 , f3 = 0 , 1 , 1
while ( f3 <= n ) :
f1 = f2 ;
f2 = f3 ;
f3 = f1 + f2 ;
return f2 ;
| java | [
[
"54",
"34"
],
[
"71",
"55"
],
[
"64",
"55"
],
[
"71",
"55"
],
[
"96",
"89"
],
[
"43",
"34"
],
[
"70",
"55"
],
[
"94",
"89"
],
[
"95",
"89"
],
[
"69",
"55"
]
] | f_gold | ZECKENDORFS_THEOREM_NON_NEIGHBOURING_FIBONACCI_REPRESENTATION | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class ZECKENDORFS_THEOREM_NON_NEIGHBOURING_FIBONACCI_REPRESENTATION{
public static int f_gold ( int n ) {
if ( n == 0 || n == 1 ) return n ;
int f1 = 0 , f2 = 1 , f3 = 1 ;
while ( f3 <= n ) {
f1 = f2 ;
f2 = f3 ;
f3 = f1 + f2 ;
}
return f2 ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
sum = 0
for row in range ( n ) :
sum = sum + ( 1 << row )
return sum
| java | [
[
"21",
"2097151"
],
[
"4",
"15"
],
[
"31",
"2147483647"
],
[
"79",
"604462909807314587353087"
],
[
"38",
"274877906943"
],
[
"75",
"37778931862957161709567"
],
[
"36",
"68719476735"
],
[
"32",
"4294967295"
],
[
"23",
"8388607"
],
[
"65",
"36893488147419103231"
]
] | f_gold | SUM_OF_ALL_ELEMENTS_UP_TO_NTH_ROW_IN_A_PASCALS_TRIANGLE | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_OF_ALL_ELEMENTS_UP_TO_NTH_ROW_IN_A_PASCALS_TRIANGLE{
static long f_gold ( int n ) {
long sum = 0 ;
for ( int row = 0 ;
row < n ;
row ++ ) {
sum = sum + ( 1 << row ) ;
}
return sum ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( x ) :
m = 1
while ( x & m ) :
x = x ^ m
m <<= 1
x = x ^ m
return x
| java | [
[
"96",
"97"
],
[
"66",
"67"
],
[
"67",
"68"
],
[
"13",
"14"
],
[
"75",
"76"
],
[
"78",
"79"
],
[
"1",
"2"
],
[
"83",
"84"
],
[
"27",
"28"
],
[
"65",
"66"
]
] | f_gold | ADD_1_TO_A_GIVEN_NUMBER | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class ADD_1_TO_A_GIVEN_NUMBER{
static int f_gold ( int x ) {
int m = 1 ;
while ( ( int ) ( x & m ) >= 1 ) {
x = x ^ m ;
m <<= 1 ;
}
x = x ^ m ;
return x ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n , key ) :
for i in range ( n ) :
if ( arr [ i ] == key ) :
return i
return - 1
| java | [
[
"[4, 8, 11, 23, 55, 57, 73, 74, 77, 79, 93], 8, 11",
"2"
],
[
"[-88, 12, -62, -66, -24, 18, 12, 22, 94, 30, -50, -42, -94, 18, 76, -6, -48, -68, 48, 36, -78, 52, -82, 76, 2, -44, -10, 88], 27, 12",
"1"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1], 11, 0",
"0"
],
[
"[33, 9, 93, 70, 81, 70, 56, 66, 72, 81, 74, 32, 71, 72, 3, 81, 70, 22, 82, 2, 75, 18, 90, 29, 48], 24, 72",
"8"
],
[
"[-98, -70, -62, -60, -60, -54, -48, -48, -46, -44, -34, -26, -18, -6, 4, 18, 28, 32, 34, 40, 50, 54, 56, 62, 64, 64, 98], 18, 23",
"-1"
],
[
"[1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1], 17, 16",
"-1"
],
[
"[4, 6, 7, 10, 10, 12, 13, 18, 23, 29, 29, 34, 46, 54, 60, 61, 63, 67, 69, 70, 72, 76, 79, 79, 81, 82, 88, 90, 99], 15, 28",
"-1"
],
[
"[94, 34, -60, -74, 86, 80, 68, -48, 78, -62, -98, -44, -44, 92, -94, -86, -36, 12, 84, -90, 52, 42, -42, -66, 88, 76, 66], 21, 16",
"-1"
],
[
"[0, 0, 0, 1], 2, 3",
"-1"
],
[
"[76, 59, 38, 83, 38, 93, 27, 11, 17, 80, 26, 28, 35, 53, 88, 10, 9, 75], 12, 13",
"-1"
]
] | f_gold | SEARCH_INSERT_AND_DELETE_IN_AN_UNSORTED_ARRAY | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SEARCH_INSERT_AND_DELETE_IN_AN_UNSORTED_ARRAY{
static int f_gold ( int arr [ ] , int n , int key ) {
for ( int i = 0 ;
i < n ;
i ++ ) if ( arr [ i ] == key ) return i ;
return - 1 ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a , n ) :
x1 = a [ 0 ]
x2 = 1
for i in range ( 1 , n ) :
x1 = x1 ^ a [ i ]
for i in range ( 2 , n + 2 ) :
x2 = x2 ^ i
return x1 ^ x2
| java | [
[
"[2, 5, 7, 8, 10, 14, 27, 32, 51, 52, 57, 58, 65, 68, 68, 72, 73, 73, 83, 92, 98], 12",
"50"
],
[
"[-60, -48, 38, -78, 88, 86, -4, -94, 16, -64, 32, 88, 58, -78, -16, 48, 38, 30, 66, -60, 20, 40, -28, -64, -48, -86, -80, -8, -58, 52, 80, -32, 46, -4, -70, 76, -4, 78, -64, 38, -40], 28",
"-91"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 38",
"1"
],
[
"[69, 59, 22, 33, 69, 28, 11, 34, 72, 88, 16, 30, 69, 89, 43, 4, 65, 85, 27], 13",
"109"
],
[
"[-98, -98, -92, -88, -88, -82, -74, -70, -68, -60, -60, -48, -38, -34, -34, -24, 14, 38, 50, 58, 62, 64, 64, 68, 76, 78, 78, 86, 88, 90, 92, 98, 98], 23",
"94"
],
[
"[0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0], 41",
"42"
],
[
"[1, 9, 12, 12, 24, 25, 33, 33, 36, 39, 46, 48, 48, 52, 52, 53, 57, 69, 71, 72, 75, 76, 78, 80, 82, 86, 89, 91, 94, 95, 96, 97, 98, 99], 30",
"124"
],
[
"[62, -66, 60, -92, 46, 6, -52, 48, 72, -64, 34, 20, 50, 70, -34, 20, -70, 14, -44, 66, -70], 17",
"101"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 30",
"0"
],
[
"[33, 10, 6, 71, 18, 22, 15, 57, 56, 63, 35, 93, 31, 43, 98, 99, 62, 39, 44, 86, 78, 95, 6, 76, 71], 12",
"32"
]
] | f_gold | FIND_THE_MISSING_NUMBER_2 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THE_MISSING_NUMBER_2{
static int f_gold ( int a [ ] , int n ) {
int x1 = a [ 0 ] ;
int x2 = 1 ;
for ( int i = 1 ;
i < n ;
i ++ ) x1 = x1 ^ a [ i ] ;
for ( int i = 2 ;
i <= n + 1 ;
i ++ ) x2 = x2 ^ i ;
return ( x1 ^ x2 ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( Str ) :
Len = len ( Str )
res = [ None ] * Len
index = 0
i = 0
s = [ ]
s.append ( 0 )
while ( i < Len ) :
if ( Str [ i ] == '+' ) :
if ( s [ - 1 ] == 1 ) :
res [ index ] = '-'
index += 1
if ( s [ - 1 ] == 0 ) :
res [ index ] = '+'
index += 1
elif ( Str [ i ] == '-' ) :
if ( s [ - 1 ] == 1 ) :
res [ index ] = '+'
index += 1
elif ( s [ - 1 ] == 0 ) :
res [ index ] = '-'
index += 1
elif ( Str [ i ] == '(' and i > 0 ) :
if ( Str [ i - 1 ] == '-' ) :
x = 0 if ( s [ - 1 ] == 1 ) else 1
s.append ( x )
elif ( Str [ i - 1 ] == '+' ) :
s.append ( s [ - 1 ] )
elif ( Str [ i ] == ')' ) :
s.pop ( )
else :
res [ index ] = Str [ i ]
index += 1
i += 1
return res
| java | [
[
"'ggbsMvMZcMOVd'",
"['g', 'g', 'b', 's', 'M', 'v', 'M', 'Z', 'c', 'M', 'O', 'V', 'd']"
],
[
"'384292670'",
"['3', '8', '4', '2', '9', '2', '6', '7', '0']"
],
[
"'10000100'",
"['1', '0', '0', '0', '0', '1', '0', '0']"
],
[
"'fdHME'",
"['f', 'd', 'H', 'M', 'E']"
],
[
"'09198832'",
"['0', '9', '1', '9', '8', '8', '3', '2']"
],
[
"'0011111011'",
"['0', '0', '1', '1', '1', '1', '1', '0', '1', '1']"
],
[
"'SnXwRS'",
"['S', 'n', 'X', 'w', 'R', 'S']"
],
[
"'071'",
"['0', '7', '1']"
],
[
"'01101'",
"['0', '1', '1', '0', '1']"
],
[
"'xwmqxgBa'",
"['x', 'w', 'm', 'q', 'x', 'g', 'B', 'a']"
]
] | f_gold | REMOVE_BRACKETS_ALGEBRAIC_STRING_CONTAINING_OPERATORS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class REMOVE_BRACKETS_ALGEBRAIC_STRING_CONTAINING_OPERATORS{
static String f_gold ( String str ) {
int len = str . length ( ) ;
char res [ ] = new char [ len ] ;
int index = 0 , i = 0 ;
Stack < Integer > s = new Stack < Integer > ( ) ;
s . push ( 0 ) ;
while ( i < len ) {
if ( str . charAt ( i ) == '+' ) {
if ( s . peek ( ) == 1 ) res [ index ++ ] = '-' ;
if ( s . peek ( ) == 0 ) res [ index ++ ] = '+' ;
}
else if ( str . charAt ( i ) == '-' ) {
if ( s . peek ( ) == 1 ) res [ index ++ ] = '+' ;
else if ( s . peek ( ) == 0 ) res [ index ++ ] = '-' ;
}
else if ( str . charAt ( i ) == '(' && i > 0 ) {
if ( str . charAt ( i - 1 ) == '-' ) {
int x = ( s . peek ( ) == 1 ) ? 0 : 1 ;
s . push ( x ) ;
}
else if ( str . charAt ( i - 1 ) == '+' ) s . push ( s . peek ( ) ) ;
}
else if ( str . charAt ( i ) == ')' ) s . pop ( ) ;
else res [ index ++ ] = str . charAt ( i ) ;
i ++ ;
}
return new String ( res ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n , p ) :
ans = 0
temp = p
while ( temp <= n ) :
ans += n / temp
temp = temp * p
return int ( ans )
| java | [
[
"76, 43",
"1"
],
[
"77, 91",
"0"
],
[
"9, 42",
"0"
],
[
"59, 67",
"0"
],
[
"8, 52",
"0"
],
[
"97, 8",
"13"
],
[
"78, 24",
"3"
],
[
"41, 88",
"0"
],
[
"72, 61",
"1"
],
[
"71, 28",
"2"
]
] | f_gold | FINDING_POWER_PRIME_NUMBER_P_N_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FINDING_POWER_PRIME_NUMBER_P_N_1{
static int f_gold ( int n , int p ) {
int ans = 0 ;
int temp = p ;
while ( temp <= n ) {
ans += n / temp ;
temp = temp * p ;
}
return ans ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( f , d , s ) :
mem = [ [ 0 for i in range ( s + 1 ) ] for j in range ( d + 1 ) ]
mem [ 0 ] [ 0 ] = 1
for i in range ( 1 , d + 1 ) :
for j in range ( 1 , s + 1 ) :
mem [ i ] [ j ] = mem [ i ] [ j - 1 ] + mem [ i - 1 ] [ j - 1 ]
if j - f - 1 >= 0 :
mem [ i ] [ j ] -= mem [ i - 1 ] [ j - f - 1 ]
return mem [ d ] [ s ]
| java | [
[
"57, 5, 33",
"35960"
],
[
"58, 45, 4",
"0"
],
[
"38, 89, 9",
"0"
],
[
"5, 39, 30",
"0"
],
[
"91, 90, 47",
"0"
],
[
"76, 56, 46",
"0"
],
[
"38, 43, 84",
"839455243105945544513490"
],
[
"97, 26, 52",
"247959266474052"
],
[
"97, 90, 90",
"1"
],
[
"99, 2, 26",
"25"
]
] | f_gold | DICE_THROW_PROBLEM_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DICE_THROW_PROBLEM_1{
public static long f_gold ( int f , int d , int s ) {
long mem [ ] [ ] = new long [ d + 1 ] [ s + 1 ] ;
mem [ 0 ] [ 0 ] = 1 ;
for ( int i = 1 ;
i <= d ;
i ++ ) {
for ( int j = i ;
j <= s ;
j ++ ) {
mem [ i ] [ j ] = mem [ i ] [ j - 1 ] + mem [ i - 1 ] [ j - 1 ] ;
if ( j - f - 1 >= 0 ) mem [ i ] [ j ] -= mem [ i - 1 ] [ j - f - 1 ] ;
}
}
return mem [ d ] [ s ] ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a , n ) :
count = dict ( )
for i in range ( n ) :
if count.get ( a [ i ] ) :
count [ a [ i ] ] += 1
else :
count [ a [ i ] ] = 1 ;
next_missing = 1
for i in range ( n ) :
if count [ a [ i ] ] != 1 or a [ i ] > n or a [ i ] < 1 :
count [ a [ i ] ] -= 1
while count.get ( next_missing ) :
next_missing += 1
a [ i ] = next_missing
count [ next_missing ] = 1
| java | [
[
"[19], 0",
"None"
],
[
"[1, 72], 1",
"None"
],
[
"[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1, 1, 1, 1, 1, 1, 1, 1, 1], 18",
"None"
],
[
"[1, 3, 2, 4, 5, 6, 7, 8, 9, 20, 96, 71, 52, 33, 40, 39], 9",
"None"
],
[
"[1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 14, 15, 17, 18, 19, 4, 21, 12, 22, 13, 16, 20, 29, 29, 31, 40, 44, 47, 48, 51, 52, 52, 59, 60, 61, 64, 66, 78, 85, 97], 22",
"None"
],
[
"[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0], 12",
"None"
],
[
"[4, 6, 8, 17, 19, 21, 22, 24, 1, 2, 3, 5, 7, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 23, 25, 26, 54, 59, 60, 61, 63, 64, 64, 69, 76, 85, 86, 87, 92, 93, 93, 95, 97, 97, 97, 98, 99, 99], 26",
"None"
],
[
"[1, 2, 3, 5, 4, 6, 7, 8, 9, 75, -14, 51, 94, 27, 55, 30, -83, 4], 9",
"None"
],
[
"[1, 2, 3, 4, 5, 1, 1, 1, 1], 5",
"None"
],
[
"[24, 13, 1, 7, 2, 3, 4, 20, 5, 8, 16, 14, 6, 9, 15, 10, 11, 12, 17, 18, 19, 21, 22, 23, 58], 24",
"None"
]
] | f_gold | CHANGE_ARRAY_PERMUTATION_NUMBERS_1_N | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
class CHANGE_ARRAY_PERMUTATION_NUMBERS_1_N{
static void f_gold ( int [ ] a , int n ) {
HashMap < Integer , Integer > count = new HashMap < Integer , Integer > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( count . containsKey ( a [ i ] ) ) {
count . put ( a [ i ] , count . get ( a [ i ] ) + 1 ) ;
}
else {
count . put ( a [ i ] , 1 ) ;
}
}
int next_missing = 1 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( count . containsKey ( a [ i ] ) && count . get ( a [ i ] ) != 1 || a [ i ] > n || a [ i ] < 1 ) {
count . put ( a [ i ] , count . get ( a [ i ] ) - 1 ) ;
while ( count . containsKey ( next_missing ) ) next_missing ++ ;
a [ i ] = next_missing ;
count . put ( next_missing , 1 ) ;
}
}
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( m , n ) :
for i in range ( 0 , n ) :
sum = 0
for j in range ( 0 , n ) :
sum = sum + abs ( m [ i ] [ j ] )
sum = sum - abs ( m [ i ] [ i ] )
if ( abs ( m [ i ] [ i ] ) < sum ) :
return False
return True
| java | [
[
"[[3, -2, 1], [1, -3, 2], [-1, 2, 4]], 2",
"True"
],
[
"[[2, -2, 1], [1, -3, 2], [-1, 2, 4]], 3",
"False"
],
[
"[[78, 46, 33, 58, 79, 94, 94, 31, 69], [83, 48, 11, 74, 33, 61, 88, 15, 29], [27, 20, 36, 14, 37, 88, 49, 36, 58], [93, 15, 39, 5, 97, 45, 1, 47, 34], [8, 88, 54, 87, 60, 77, 37, 46, 18], [10, 68, 71, 86, 76, 24, 47, 37, 72], [84, 43, 82, 25, 87, 18, 51, 46, 75], [59, 39, 78, 86, 38, 55, 79, 5, 5], [50, 42, 19, 34, 53, 80, 21, 45, 96]], 1",
"True"
],
[
"[[88, 35, 82, 14, 86, 94, 12, 49, 76, 94, 3, 96, 27, 92, 82, 25, 15, 27, 15], [30, 75, 59, 45, 53, 78, 45, 92, 72, 61, 11, 78, 51, 86, 89, 74, 39, 24, 6], [33, 22, 60, 20, 11, 35, 35, 65, 90, 78, 49, 66, 46, 5, 39, 79, 85, 93, 51], [21, 38, 36, 14, 33, 23, 72, 84, 38, 47, 64, 47, 1, 42, 68, 78, 86, 76, 25], [57, 52, 7, 7, 56, 39, 70, 83, 58, 23, 10, 72, 36, 71, 3, 72, 77, 95, 13], [90, 48, 66, 3, 63, 15, 2, 61, 59, 17, 11, 5, 70, 67, 23, 96, 63, 4, 29], [17, 95, 35, 48, 85, 87, 48, 95, 53, 65, 75, 1, 7, 77, 84, 70, 30, 70, 98], [99, 84, 38, 30, 97, 54, 88, 95, 16, 16, 27, 22, 15, 46, 1, 28, 33, 15, 95], [57, 70, 68, 58, 20, 4, 10, 7, 91, 57, 6, 55, 31, 64, 36, 91, 13, 75, 73], [72, 61, 10, 66, 24, 99, 34, 50, 75, 1, 5, 27, 7, 1, 32, 17, 18, 68, 49], [13, 69, 22, 26, 68, 87, 5, 9, 77, 62, 73, 68, 90, 78, 2, 95, 50, 51, 90], [2, 41, 64, 44, 52, 37, 66, 92, 56, 23, 71, 39, 86, 60, 56, 36, 1, 98, 4], [41, 99, 53, 31, 33, 5, 43, 11, 32, 1, 43, 6, 92, 81, 11, 41, 27, 61, 76], [13, 95, 35, 25, 94, 36, 21, 55, 36, 28, 27, 12, 74, 26, 93, 45, 6, 89, 8], [75, 17, 38, 77, 41, 15, 83, 83, 74, 28, 25, 79, 35, 80, 37, 27, 5, 59, 88], [66, 99, 57, 61, 97, 96, 60, 64, 32, 16, 44, 87, 90, 69, 61, 71, 34, 74, 86], [21, 19, 52, 42, 39, 45, 89, 13, 43, 83, 71, 95, 66, 45, 4, 1, 60, 50, 87], [47, 17, 86, 35, 8, 56, 60, 55, 7, 65, 25, 24, 97, 75, 96, 93, 65, 47, 8], [45, 29, 31, 57, 99, 7, 31, 60, 56, 32, 94, 61, 61, 76, 99, 64, 10, 26, 69]], 2",
"True"
],
[
"[[97, 37, 30, 97, 2, 42, 68, 90, 94], [35, 10, 31, 79, 85, 6, 65, 74, 2], [9, 81, 80, 66, 80, 99, 59, 92, 13], [6, 25, 63, 59, 90, 46, 15, 66, 86], [42, 92, 17, 23, 15, 38, 56, 34, 94], [65, 80, 89, 87, 97, 34, 73, 16, 50], [69, 42, 62, 12, 69, 87, 72, 99, 80], [84, 28, 30, 75, 50, 17, 10, 88, 95], [11, 47, 8, 31, 37, 33, 9, 46, 3]], 4",
"False"
],
[
"[[28, 52, 61, 24, 10, 42, 37, 15, 28, 37, 65, 13, 59], [68, 56, 30, 64, 67, 20, 99, 27, 12, 41, 80, 96, 51], [97, 80, 29, 91, 95, 51, 59, 88, 31, 9, 70, 30, 90], [40, 7, 72, 59, 11, 3, 4, 97, 20, 5, 34, 14, 13], [61, 49, 45, 53, 24, 94, 63, 75, 9, 63, 56, 77, 77], [96, 71, 75, 42, 1, 64, 92, 72, 15, 69, 22, 20, 68], [45, 89, 80, 40, 46, 91, 63, 93, 12, 52, 7, 88, 55], [5, 47, 97, 38, 43, 70, 8, 86, 50, 78, 9, 13, 50], [96, 78, 35, 25, 61, 31, 49, 43, 45, 84, 7, 74, 6], [89, 50, 70, 45, 54, 17, 86, 87, 29, 64, 71, 99, 20], [26, 93, 29, 7, 34, 5, 77, 6, 96, 33, 43, 59, 33], [83, 61, 18, 14, 21, 39, 34, 31, 81, 7, 85, 71, 1], [86, 22, 87, 92, 63, 62, 46, 57, 94, 45, 74, 76, 80]], 10",
"False"
],
[
"[[68, 37, 94, 90, 14, 37, 89, 91, 14, 66, 66, 33, 2], [98, 53, 89, 55, 45, 37, 27, 90, 52, 86, 47, 58, 7], [13, 48, 28, 45, 56, 92, 88, 35, 55, 97, 37, 9, 3], [2, 58, 22, 85, 24, 78, 54, 97, 17, 58, 58, 21, 77], [63, 63, 44, 40, 75, 66, 92, 67, 79, 46, 24, 72, 70], [96, 51, 99, 77, 92, 4, 31, 65, 30, 72, 40, 14, 44], [92, 34, 39, 4, 88, 27, 42, 11, 87, 32, 50, 53, 4], [19, 71, 33, 78, 77, 70, 83, 55, 9, 62, 99, 62, 48], [90, 68, 48, 92, 27, 55, 44, 71, 52, 57, 9, 98, 8], [56, 10, 65, 72, 45, 39, 46, 17, 82, 98, 99, 67, 76], [62, 68, 36, 9, 35, 67, 89, 52, 90, 91, 28, 58, 83], [24, 59, 37, 38, 25, 98, 15, 16, 55, 4, 26, 39, 57], [47, 90, 48, 92, 49, 37, 38, 62, 61, 74, 97, 8, 38]], 7",
"False"
],
[
"[[85, 56, 45, 50, 20, 63, 55, 34, 92, 32, 76, 73, 43, 79, 13, 2, 61, 84, 14, 42, 15, 93, 85, 10, 56, 53, 58, 85, 99, 81, 62, 57, 63, 4, 78, 96], [82, 34, 32, 78, 34, 70, 40, 35, 15, 51, 20, 92, 37, 38, 21, 88, 10, 54, 9, 86, 42, 16, 24, 4, 44, 23, 42, 86, 66, 92, 19, 20, 28, 24, 91, 2], [7, 1, 11, 51, 60, 31, 30, 77, 24, 18, 58, 77, 17, 46, 94, 19, 12, 90, 82, 12, 50, 66, 20, 6, 1, 90, 7, 96, 55, 97, 74, 15, 95, 24, 29, 82], [71, 34, 78, 84, 93, 37, 42, 64, 95, 19, 23, 71, 6, 99, 93, 55, 77, 39, 25, 98, 83, 4, 88, 33, 66, 2, 14, 50, 11, 34, 38, 92, 39, 22, 42, 97], [95, 57, 78, 38, 9, 88, 29, 69, 42, 60, 39, 91, 72, 93, 60, 53, 76, 8, 21, 56, 48, 47, 9, 78, 1, 55, 31, 80, 91, 11, 66, 60, 31, 50, 60, 88], [62, 39, 3, 58, 68, 30, 67, 68, 58, 77, 53, 14, 10, 78, 81, 22, 63, 61, 46, 37, 21, 89, 3, 19, 32, 79, 24, 73, 74, 48, 96, 58, 40, 7, 46, 91], [15, 85, 74, 87, 5, 59, 70, 22, 28, 54, 19, 14, 48, 7, 79, 32, 22, 46, 85, 83, 13, 22, 10, 44, 24, 59, 62, 72, 72, 55, 49, 50, 19, 82, 58, 97], [48, 93, 96, 72, 96, 12, 86, 20, 45, 26, 81, 98, 31, 82, 59, 3, 18, 84, 21, 57, 99, 42, 62, 30, 61, 36, 55, 4, 15, 71, 96, 97, 57, 63, 77, 64], [17, 53, 40, 70, 50, 68, 15, 72, 34, 30, 87, 73, 24, 8, 57, 70, 25, 77, 34, 25, 18, 73, 97, 70, 14, 6, 82, 90, 36, 36, 75, 18, 15, 94, 89, 16], [76, 14, 47, 54, 58, 77, 30, 46, 16, 1, 41, 93, 27, 77, 62, 81, 28, 20, 55, 51, 69, 88, 73, 97, 34, 27, 97, 38, 29, 35, 20, 19, 5, 25, 93, 26], [51, 66, 61, 15, 45, 6, 58, 1, 73, 43, 16, 14, 74, 19, 51, 8, 48, 12, 70, 35, 70, 6, 99, 11, 38, 91, 26, 28, 72, 89, 83, 80, 50, 58, 26, 44], [15, 76, 24, 77, 59, 57, 17, 77, 81, 1, 11, 20, 31, 99, 39, 63, 6, 99, 28, 51, 53, 44, 65, 80, 12, 28, 79, 72, 68, 95, 30, 35, 6, 85, 30, 80], [63, 8, 91, 33, 43, 76, 43, 45, 87, 54, 65, 7, 36, 25, 85, 37, 12, 32, 49, 38, 56, 80, 65, 26, 57, 14, 56, 70, 41, 51, 84, 67, 12, 97, 49, 1], [19, 66, 58, 87, 72, 98, 4, 8, 27, 26, 97, 43, 40, 50, 67, 73, 74, 29, 85, 42, 18, 81, 21, 67, 62, 27, 96, 93, 47, 93, 26, 9, 91, 12, 16, 47], [56, 66, 51, 27, 73, 66, 62, 71, 8, 38, 6, 59, 19, 79, 56, 28, 94, 91, 10, 45, 95, 65, 50, 32, 61, 16, 6, 66, 62, 66, 67, 19, 4, 43, 18, 82], [46, 46, 85, 21, 30, 64, 41, 17, 5, 5, 73, 75, 48, 78, 38, 6, 58, 14, 72, 94, 59, 65, 89, 13, 27, 25, 56, 68, 59, 95, 49, 18, 81, 75, 76, 3], [79, 57, 6, 69, 31, 8, 10, 3, 12, 92, 76, 94, 19, 21, 81, 14, 75, 29, 7, 49, 65, 7, 14, 16, 99, 16, 85, 13, 82, 29, 85, 73, 95, 61, 37, 17], [31, 59, 88, 47, 6, 32, 31, 18, 9, 3, 71, 26, 13, 34, 43, 93, 33, 69, 36, 79, 74, 68, 47, 61, 45, 96, 88, 84, 48, 41, 38, 68, 75, 11, 16, 65], [97, 71, 67, 71, 1, 97, 71, 4, 82, 37, 14, 79, 25, 82, 4, 66, 43, 26, 84, 15, 6, 37, 43, 42, 13, 16, 42, 38, 66, 65, 5, 30, 95, 43, 32, 67], [67, 42, 5, 99, 86, 96, 59, 23, 8, 68, 70, 91, 19, 44, 93, 38, 44, 6, 3, 96, 80, 33, 66, 58, 26, 99, 28, 43, 75, 88, 16, 89, 23, 59, 35, 89], [41, 97, 22, 74, 1, 46, 22, 32, 87, 30, 87, 43, 12, 83, 71, 27, 26, 18, 92, 75, 66, 81, 61, 46, 29, 32, 15, 60, 82, 28, 27, 41, 47, 33, 44, 50], [10, 24, 34, 91, 20, 25, 55, 90, 43, 53, 85, 50, 55, 13, 49, 97, 10, 92, 97, 11, 78, 84, 20, 72, 79, 97, 83, 48, 76, 17, 33, 20, 46, 31, 51, 83], [19, 62, 44, 77, 38, 49, 65, 11, 27, 58, 64, 65, 15, 82, 89, 1, 19, 56, 64, 34, 64, 10, 76, 60, 39, 66, 32, 51, 26, 57, 84, 60, 55, 6, 7, 66], [81, 26, 95, 98, 82, 78, 5, 87, 1, 84, 2, 65, 10, 50, 51, 69, 41, 58, 77, 68, 24, 91, 56, 36, 2, 96, 56, 81, 12, 12, 85, 72, 22, 74, 84, 62], [64, 28, 89, 28, 4, 45, 90, 13, 83, 98, 80, 4, 61, 84, 26, 94, 6, 77, 56, 81, 27, 35, 97, 82, 58, 84, 63, 33, 95, 83, 97, 81, 33, 69, 40, 47], [45, 27, 7, 58, 14, 4, 82, 34, 80, 91, 38, 20, 46, 19, 1, 23, 62, 73, 28, 84, 80, 77, 33, 3, 79, 16, 30, 25, 78, 1, 33, 37, 29, 37, 61, 8], [1, 63, 88, 65, 46, 43, 10, 82, 85, 10, 62, 86, 51, 45, 73, 73, 45, 85, 58, 95, 66, 24, 97, 75, 65, 55, 51, 72, 73, 21, 47, 22, 29, 40, 3, 49], [25, 82, 11, 94, 89, 75, 98, 88, 48, 32, 3, 45, 89, 20, 20, 51, 81, 20, 82, 14, 98, 80, 32, 72, 42, 80, 39, 38, 64, 4, 99, 92, 63, 61, 78, 5], [66, 45, 50, 88, 3, 23, 11, 38, 56, 35, 65, 6, 70, 40, 90, 35, 13, 25, 86, 81, 78, 67, 68, 99, 47, 55, 92, 43, 2, 45, 48, 62, 38, 47, 4, 60], [49, 76, 34, 44, 94, 85, 56, 92, 42, 50, 69, 33, 98, 96, 91, 67, 42, 44, 68, 57, 36, 41, 56, 3, 56, 56, 65, 39, 40, 39, 27, 67, 94, 65, 74, 3], [3, 37, 98, 20, 11, 83, 91, 24, 70, 65, 83, 74, 32, 62, 55, 36, 66, 37, 14, 46, 77, 56, 50, 61, 17, 27, 54, 29, 13, 49, 25, 88, 23, 26, 48, 36], [6, 80, 74, 39, 57, 91, 66, 10, 72, 9, 77, 72, 27, 46, 63, 42, 85, 41, 34, 93, 30, 44, 80, 1, 45, 47, 93, 30, 22, 15, 84, 38, 23, 31, 57, 81], [35, 66, 53, 31, 26, 31, 72, 80, 12, 53, 56, 83, 62, 44, 58, 77, 65, 13, 61, 68, 51, 62, 48, 95, 63, 72, 91, 72, 51, 24, 86, 40, 29, 73, 17, 1], [96, 84, 1, 25, 41, 91, 23, 18, 95, 28, 85, 12, 88, 49, 97, 81, 97, 16, 27, 53, 92, 36, 7, 34, 65, 4, 26, 20, 51, 77, 99, 10, 8, 18, 17, 69], [30, 95, 39, 61, 24, 81, 98, 35, 79, 61, 75, 98, 72, 15, 36, 55, 37, 87, 62, 64, 39, 90, 98, 75, 12, 72, 8, 41, 69, 74, 3, 43, 37, 86, 57, 25], [4, 58, 37, 8, 94, 9, 79, 1, 13, 68, 16, 44, 65, 14, 91, 26, 32, 2, 16, 92, 49, 90, 75, 23, 94, 60, 95, 66, 20, 93, 74, 18, 59, 31, 4, 27]], 35",
"False"
],
[
"[[95, 71, 19, 39, 66, 78, 46, 92, 38, 67, 29, 91, 57, 48, 52, 48, 61, 67, 48, 94, 82, 8, 74, 86, 88, 67, 14, 47, 24, 91, 62, 58, 34, 31, 48, 91, 45, 29, 29, 63, 48, 12, 78, 27], [47, 66, 37, 45, 57, 18, 13, 73, 29, 56, 74, 20, 29, 6, 26, 61, 86, 43, 47, 26, 81, 1, 95, 73, 26, 64, 62, 6, 62, 66, 42, 27, 65, 30, 82, 98, 85, 65, 47, 32, 34, 47, 14, 5], [36, 96, 9, 35, 25, 75, 46, 13, 61, 30, 98, 32, 30, 82, 56, 67, 71, 55, 98, 8, 43, 48, 58, 32, 78, 69, 7, 74, 20, 62, 21, 92, 29, 70, 38, 42, 3, 37, 17, 33, 10, 37, 33, 28], [87, 42, 58, 48, 51, 10, 8, 16, 96, 62, 49, 89, 15, 16, 81, 27, 47, 26, 72, 41, 11, 91, 9, 54, 11, 7, 28, 94, 62, 55, 36, 73, 99, 63, 51, 77, 48, 68, 10, 26, 67, 53, 43, 17], [27, 22, 36, 72, 33, 90, 95, 53, 11, 93, 29, 38, 58, 15, 54, 62, 57, 79, 71, 58, 49, 53, 29, 33, 46, 54, 80, 98, 85, 7, 29, 9, 49, 71, 78, 94, 88, 51, 98, 8, 55, 65, 98, 84], [95, 79, 15, 51, 34, 69, 86, 12, 45, 31, 54, 93, 22, 72, 64, 60, 28, 21, 75, 75, 87, 77, 43, 27, 23, 97, 90, 36, 97, 38, 16, 74, 43, 41, 44, 52, 17, 52, 43, 23, 1, 93, 25, 6], [74, 54, 78, 23, 19, 56, 53, 31, 38, 19, 1, 77, 50, 98, 58, 81, 32, 49, 98, 97, 92, 44, 29, 88, 48, 80, 77, 26, 7, 44, 14, 52, 32, 75, 32, 75, 84, 57, 52, 34, 61, 62, 86, 87], [93, 76, 31, 29, 31, 12, 35, 57, 41, 27, 15, 94, 71, 36, 24, 82, 24, 96, 76, 28, 75, 3, 3, 29, 32, 54, 38, 95, 56, 65, 21, 41, 20, 60, 75, 59, 74, 55, 3, 14, 45, 95, 99, 60], [49, 9, 54, 70, 93, 52, 63, 52, 22, 55, 3, 2, 59, 28, 37, 69, 9, 62, 32, 81, 75, 35, 47, 18, 36, 19, 25, 46, 60, 95, 23, 78, 27, 35, 77, 55, 36, 88, 97, 71, 9, 21, 32, 66], [44, 89, 65, 75, 80, 87, 15, 27, 16, 46, 97, 72, 48, 65, 19, 90, 37, 58, 55, 53, 47, 3, 88, 86, 62, 1, 39, 73, 33, 23, 34, 49, 49, 99, 49, 10, 96, 66, 71, 88, 67, 76, 39, 42], [91, 1, 46, 36, 96, 91, 44, 31, 97, 58, 96, 4, 53, 89, 93, 57, 73, 78, 50, 5, 52, 17, 32, 6, 69, 93, 92, 61, 10, 23, 53, 61, 19, 4, 46, 32, 84, 46, 62, 92, 54, 87, 67, 24], [66, 18, 96, 48, 46, 48, 62, 94, 27, 62, 78, 65, 52, 1, 50, 40, 72, 17, 1, 78, 77, 30, 77, 67, 22, 35, 56, 14, 45, 86, 33, 12, 24, 69, 57, 9, 2, 59, 95, 29, 93, 55, 94, 22], [85, 49, 12, 71, 89, 8, 97, 16, 40, 45, 64, 63, 51, 10, 76, 86, 71, 45, 85, 56, 86, 73, 84, 13, 64, 88, 30, 52, 54, 57, 18, 25, 53, 20, 11, 40, 98, 23, 90, 87, 42, 47, 56, 33], [89, 98, 26, 69, 29, 94, 60, 91, 37, 25, 74, 44, 34, 12, 93, 39, 19, 19, 29, 66, 90, 98, 94, 76, 20, 57, 97, 9, 2, 28, 34, 21, 83, 78, 81, 56, 5, 85, 22, 59, 40, 84, 92, 63], [32, 45, 83, 92, 87, 33, 82, 35, 46, 36, 62, 83, 90, 26, 7, 87, 5, 87, 32, 79, 91, 81, 84, 57, 80, 62, 28, 95, 80, 78, 74, 66, 97, 41, 86, 66, 64, 7, 41, 45, 44, 30, 38, 39], [19, 47, 38, 17, 74, 79, 69, 99, 4, 35, 1, 81, 85, 58, 22, 5, 60, 36, 9, 84, 57, 78, 84, 90, 4, 51, 39, 84, 52, 75, 71, 55, 31, 50, 8, 87, 15, 65, 10, 41, 88, 79, 48, 21], [86, 24, 74, 23, 80, 69, 33, 36, 25, 58, 90, 66, 98, 31, 44, 63, 45, 83, 82, 50, 67, 71, 87, 1, 71, 86, 67, 83, 94, 9, 99, 35, 13, 26, 45, 51, 92, 25, 56, 39, 3, 75, 94, 53], [33, 62, 98, 67, 69, 95, 4, 72, 59, 17, 22, 38, 88, 31, 49, 52, 89, 38, 96, 49, 90, 27, 23, 84, 27, 81, 14, 3, 27, 62, 14, 92, 44, 25, 61, 75, 52, 12, 97, 84, 34, 23, 19, 1], [74, 65, 5, 57, 22, 43, 2, 73, 7, 21, 71, 59, 9, 40, 73, 49, 12, 73, 10, 74, 17, 4, 64, 16, 49, 27, 6, 9, 58, 32, 38, 30, 78, 45, 29, 92, 22, 31, 81, 17, 54, 79, 47, 32], [28, 11, 39, 17, 76, 39, 73, 25, 26, 68, 62, 19, 13, 29, 54, 73, 42, 62, 71, 71, 21, 9, 45, 27, 48, 85, 69, 5, 72, 15, 77, 97, 44, 47, 32, 36, 49, 53, 23, 34, 18, 12, 87, 2], [27, 50, 31, 48, 86, 69, 17, 43, 71, 18, 66, 31, 63, 28, 67, 9, 97, 28, 92, 18, 15, 75, 89, 5, 41, 91, 76, 74, 73, 66, 73, 51, 16, 65, 85, 57, 37, 39, 65, 49, 47, 40, 14, 40], [48, 32, 88, 39, 33, 30, 26, 43, 55, 44, 78, 76, 3, 7, 85, 58, 91, 10, 10, 81, 42, 34, 82, 26, 60, 2, 73, 45, 5, 26, 79, 25, 26, 92, 87, 85, 22, 19, 10, 42, 31, 31, 99, 75], [81, 97, 86, 90, 36, 66, 32, 67, 63, 23, 50, 65, 69, 44, 58, 57, 37, 65, 18, 5, 82, 99, 96, 26, 33, 42, 88, 27, 54, 83, 82, 79, 91, 75, 24, 3, 39, 71, 12, 33, 22, 35, 14, 26], [83, 85, 54, 41, 45, 31, 69, 99, 17, 60, 96, 4, 10, 94, 9, 61, 90, 22, 21, 23, 61, 12, 95, 17, 55, 21, 54, 47, 41, 97, 15, 96, 59, 99, 15, 29, 11, 29, 86, 90, 82, 89, 85, 88], [56, 92, 53, 3, 13, 38, 70, 11, 23, 73, 56, 17, 9, 83, 99, 96, 92, 28, 79, 19, 97, 87, 92, 4, 47, 47, 31, 99, 5, 33, 48, 32, 79, 59, 98, 64, 47, 9, 35, 47, 88, 82, 17, 1], [55, 11, 33, 70, 56, 64, 93, 58, 20, 18, 78, 45, 43, 20, 57, 82, 27, 18, 17, 60, 89, 5, 6, 97, 15, 39, 80, 39, 88, 21, 13, 29, 98, 5, 67, 21, 9, 67, 44, 62, 94, 67, 62, 62], [60, 49, 39, 41, 50, 98, 17, 53, 55, 78, 75, 56, 1, 65, 64, 52, 15, 2, 12, 45, 57, 42, 2, 87, 62, 34, 17, 41, 78, 75, 84, 71, 65, 15, 38, 98, 73, 65, 9, 42, 66, 86, 89, 51], [78, 99, 80, 19, 31, 66, 32, 75, 8, 69, 98, 32, 47, 70, 8, 34, 4, 36, 44, 25, 26, 33, 9, 47, 72, 17, 15, 42, 54, 13, 50, 44, 3, 53, 56, 54, 57, 12, 93, 59, 65, 96, 37, 20], [72, 37, 31, 95, 25, 50, 49, 8, 94, 94, 91, 35, 13, 21, 73, 24, 48, 33, 1, 72, 3, 14, 14, 49, 33, 4, 38, 25, 47, 13, 39, 25, 73, 43, 38, 35, 93, 55, 50, 78, 34, 25, 42, 92], [51, 94, 37, 66, 85, 34, 83, 38, 31, 26, 76, 94, 26, 63, 48, 95, 79, 10, 36, 40, 26, 9, 53, 81, 70, 86, 80, 86, 53, 39, 61, 52, 68, 68, 73, 78, 42, 90, 67, 96, 75, 51, 3, 13], [13, 61, 24, 20, 74, 87, 97, 55, 35, 78, 80, 30, 83, 33, 41, 66, 49, 8, 84, 3, 85, 65, 85, 72, 2, 87, 41, 53, 75, 16, 9, 96, 39, 64, 36, 23, 47, 49, 55, 94, 10, 63, 95, 26], [48, 30, 2, 29, 54, 32, 38, 21, 27, 88, 34, 23, 78, 39, 69, 73, 45, 63, 8, 7, 30, 12, 20, 64, 29, 55, 12, 84, 22, 23, 48, 45, 26, 28, 55, 73, 69, 2, 28, 77, 79, 53, 14, 46], [78, 67, 74, 70, 20, 35, 48, 43, 20, 56, 3, 68, 11, 62, 61, 95, 58, 29, 38, 84, 88, 87, 22, 86, 41, 84, 63, 38, 50, 7, 24, 46, 25, 78, 29, 67, 93, 80, 85, 22, 85, 86, 9, 87], [49, 73, 96, 36, 5, 90, 4, 24, 41, 14, 91, 12, 82, 44, 9, 66, 38, 96, 77, 57, 47, 55, 88, 2, 83, 18, 66, 90, 57, 64, 88, 27, 53, 59, 29, 72, 95, 98, 14, 68, 43, 29, 57, 33], [21, 41, 1, 27, 2, 64, 51, 54, 74, 74, 30, 1, 95, 99, 29, 13, 73, 43, 41, 75, 88, 89, 58, 77, 14, 41, 67, 54, 6, 46, 77, 1, 29, 78, 76, 26, 58, 87, 3, 60, 14, 98, 23, 62], [10, 4, 39, 74, 88, 34, 88, 25, 52, 15, 12, 1, 9, 59, 14, 31, 88, 53, 63, 10, 43, 18, 67, 59, 76, 99, 23, 86, 75, 46, 49, 23, 12, 29, 89, 88, 59, 53, 68, 63, 29, 3, 95, 89], [37, 63, 23, 49, 86, 93, 77, 3, 22, 36, 10, 9, 56, 55, 19, 72, 33, 20, 94, 35, 31, 83, 50, 46, 78, 10, 67, 34, 51, 92, 83, 39, 90, 68, 12, 26, 71, 67, 90, 2, 12, 59, 32, 51], [11, 32, 64, 45, 79, 54, 6, 26, 8, 8, 38, 8, 17, 83, 3, 41, 73, 53, 97, 96, 96, 70, 62, 53, 59, 93, 81, 83, 95, 83, 23, 47, 35, 14, 65, 97, 49, 36, 1, 84, 22, 35, 3, 12], [37, 58, 77, 12, 2, 84, 65, 58, 60, 41, 35, 88, 90, 11, 52, 52, 62, 63, 15, 70, 40, 9, 70, 17, 23, 58, 95, 80, 51, 57, 86, 16, 45, 61, 12, 73, 6, 4, 81, 74, 35, 47, 85, 19], [27, 11, 70, 59, 41, 43, 28, 63, 67, 45, 24, 77, 64, 79, 73, 39, 99, 45, 61, 82, 43, 67, 92, 80, 42, 41, 47, 43, 23, 32, 74, 57, 38, 77, 15, 28, 13, 35, 2, 61, 65, 41, 96, 94], [86, 4, 53, 88, 14, 17, 14, 41, 62, 52, 27, 85, 40, 35, 90, 95, 59, 97, 49, 63, 11, 80, 6, 98, 41, 32, 21, 93, 75, 57, 5, 91, 28, 95, 75, 77, 70, 27, 94, 53, 48, 83, 78, 58], [9, 55, 45, 28, 28, 46, 25, 26, 62, 68, 67, 34, 21, 81, 34, 44, 76, 89, 21, 18, 36, 70, 84, 53, 20, 96, 95, 84, 94, 3, 84, 8, 85, 48, 23, 1, 2, 74, 37, 94, 51, 44, 24, 32], [56, 50, 64, 30, 38, 78, 55, 3, 25, 45, 62, 7, 81, 27, 23, 32, 2, 75, 34, 52, 61, 34, 7, 10, 89, 2, 30, 81, 29, 82, 60, 99, 17, 56, 86, 51, 25, 84, 16, 25, 15, 79, 57, 15], [56, 82, 37, 65, 33, 3, 49, 22, 54, 21, 27, 4, 99, 1, 4, 55, 24, 29, 22, 23, 85, 78, 8, 58, 80, 99, 88, 59, 90, 7, 25, 45, 90, 26, 30, 66, 53, 73, 39, 11, 79, 12, 99, 50]], 29",
"False"
],
[
"[[16, 49, 32, 82, 45, 85, 80, 71, 5, 44, 41, 97, 95, 85, 67, 74, 75, 22, 17, 89, 92, 50, 84, 94, 31, 13, 74, 51, 33, 20, 48, 78, 72, 72, 92, 74, 14, 62, 51, 78, 70, 98, 81, 21, 92, 38, 15], [36, 9, 99, 59, 82, 54, 17, 82, 4, 84, 13, 75, 43, 97, 92, 8, 20, 82, 71, 61, 44, 97, 51, 58, 75, 30, 99, 84, 10, 94, 18, 25, 96, 34, 44, 39, 95, 92, 90, 68, 43, 20, 72, 2, 27, 34, 55], [36, 85, 72, 87, 72, 69, 65, 85, 44, 43, 74, 66, 21, 61, 13, 28, 30, 82, 2, 58, 83, 21, 90, 46, 89, 83, 25, 57, 20, 6, 18, 49, 82, 20, 34, 10, 33, 55, 19, 66, 47, 49, 67, 30, 83, 85, 59], [78, 31, 21, 17, 53, 51, 24, 40, 98, 47, 20, 16, 58, 49, 42, 12, 41, 58, 60, 24, 13, 34, 61, 27, 85, 67, 14, 41, 57, 30, 45, 74, 1, 92, 83, 94, 84, 52, 20, 23, 95, 96, 90, 78, 6, 33, 8], [63, 4, 13, 35, 93, 89, 34, 56, 11, 38, 93, 45, 86, 58, 34, 75, 92, 72, 24, 74, 79, 63, 39, 21, 36, 48, 84, 13, 2, 27, 7, 90, 94, 19, 40, 21, 58, 26, 74, 36, 44, 64, 27, 8, 90, 1, 23], [73, 31, 7, 9, 71, 92, 98, 53, 16, 74, 24, 74, 46, 29, 89, 30, 51, 83, 31, 30, 34, 92, 19, 75, 28, 6, 17, 91, 36, 1, 16, 68, 47, 23, 96, 67, 62, 85, 88, 15, 75, 67, 83, 43, 8, 98, 98], [44, 26, 67, 32, 64, 43, 74, 74, 62, 11, 78, 95, 9, 48, 6, 54, 62, 54, 99, 98, 56, 82, 87, 30, 3, 61, 15, 3, 15, 67, 29, 31, 71, 71, 55, 75, 92, 43, 25, 81, 55, 50, 38, 60, 85, 52, 84], [74, 70, 76, 81, 45, 97, 19, 5, 42, 93, 30, 65, 76, 79, 5, 38, 11, 84, 29, 14, 90, 98, 74, 91, 89, 10, 39, 60, 96, 98, 23, 97, 96, 22, 86, 87, 83, 23, 22, 62, 94, 19, 22, 1, 34, 26, 4], [48, 45, 12, 92, 37, 3, 28, 93, 84, 2, 56, 65, 46, 44, 18, 73, 37, 54, 25, 83, 62, 25, 52, 63, 15, 46, 56, 26, 64, 20, 67, 25, 21, 34, 88, 25, 65, 29, 32, 1, 35, 56, 16, 32, 79, 5, 10], [86, 72, 79, 20, 89, 12, 90, 68, 63, 26, 60, 74, 61, 15, 5, 32, 96, 22, 22, 12, 64, 75, 88, 80, 16, 65, 51, 87, 92, 32, 53, 3, 13, 92, 92, 58, 45, 24, 51, 13, 24, 5, 81, 50, 76, 49, 18], [33, 58, 31, 34, 94, 96, 74, 31, 99, 79, 27, 59, 27, 1, 76, 68, 23, 98, 52, 57, 87, 51, 83, 84, 63, 84, 93, 77, 28, 24, 22, 86, 40, 75, 8, 96, 88, 12, 49, 21, 67, 39, 62, 82, 58, 62, 70], [36, 45, 79, 15, 62, 38, 64, 88, 71, 9, 75, 80, 71, 25, 78, 65, 20, 28, 49, 34, 73, 20, 95, 85, 22, 77, 44, 47, 25, 22, 61, 52, 20, 96, 80, 20, 86, 45, 37, 15, 76, 9, 44, 15, 44, 86, 12], [27, 19, 25, 74, 99, 64, 12, 50, 72, 11, 83, 23, 88, 15, 63, 20, 89, 78, 10, 61, 93, 47, 49, 49, 76, 33, 87, 78, 23, 53, 37, 22, 93, 2, 20, 5, 91, 3, 82, 77, 86, 77, 12, 32, 58, 71, 70], [40, 6, 63, 25, 91, 69, 83, 73, 50, 40, 1, 46, 73, 39, 10, 49, 14, 46, 40, 89, 19, 17, 82, 46, 73, 65, 70, 38, 17, 73, 11, 53, 18, 7, 35, 44, 71, 39, 11, 10, 98, 88, 76, 9, 86, 96, 8], [48, 21, 80, 97, 89, 6, 59, 68, 23, 73, 75, 35, 12, 99, 71, 57, 29, 85, 67, 61, 61, 88, 30, 27, 93, 30, 55, 23, 37, 26, 36, 92, 63, 37, 51, 68, 93, 78, 63, 37, 97, 31, 78, 25, 73, 25, 46], [89, 30, 20, 23, 1, 15, 21, 30, 11, 90, 52, 30, 9, 69, 47, 34, 33, 98, 65, 51, 79, 31, 56, 76, 71, 45, 33, 96, 51, 5, 38, 5, 56, 81, 71, 89, 25, 67, 52, 36, 92, 23, 8, 31, 63, 21, 99], [50, 29, 60, 67, 44, 89, 2, 98, 15, 39, 40, 47, 76, 52, 88, 6, 70, 48, 58, 90, 3, 96, 46, 18, 56, 92, 33, 17, 32, 76, 85, 2, 26, 39, 63, 17, 34, 19, 62, 32, 50, 86, 45, 54, 82, 88, 1], [66, 40, 24, 52, 2, 61, 27, 66, 87, 33, 34, 62, 32, 3, 55, 27, 76, 8, 20, 52, 17, 33, 55, 75, 73, 98, 71, 16, 91, 79, 64, 88, 40, 58, 83, 23, 95, 94, 7, 59, 59, 3, 30, 10, 98, 13, 39], [77, 64, 25, 41, 98, 40, 62, 40, 34, 79, 3, 52, 46, 86, 98, 69, 41, 86, 60, 29, 8, 98, 4, 25, 50, 23, 25, 98, 70, 98, 21, 94, 56, 3, 79, 21, 83, 83, 49, 46, 98, 78, 68, 31, 46, 75, 44], [45, 75, 49, 4, 80, 57, 56, 38, 6, 82, 89, 24, 52, 39, 73, 37, 98, 34, 40, 40, 37, 92, 50, 11, 78, 59, 26, 60, 8, 28, 84, 60, 89, 10, 63, 61, 75, 26, 23, 63, 19, 18, 50, 19, 15, 16, 20], [19, 75, 71, 19, 88, 31, 52, 48, 8, 50, 61, 88, 8, 13, 74, 19, 50, 23, 57, 97, 30, 94, 29, 61, 35, 9, 72, 25, 64, 37, 38, 8, 90, 75, 40, 23, 96, 45, 1, 49, 9, 40, 28, 97, 96, 8, 37], [82, 71, 18, 76, 68, 77, 75, 80, 44, 78, 16, 52, 53, 86, 18, 40, 61, 25, 35, 71, 84, 27, 93, 10, 75, 20, 33, 77, 80, 11, 69, 67, 59, 66, 53, 38, 10, 6, 85, 95, 34, 49, 32, 29, 65, 33, 17], [98, 49, 16, 7, 13, 84, 4, 63, 69, 80, 73, 76, 78, 15, 5, 42, 18, 72, 8, 89, 68, 26, 75, 70, 33, 22, 93, 69, 1, 86, 35, 56, 95, 67, 3, 71, 1, 42, 58, 88, 94, 96, 96, 85, 64, 80, 4], [17, 77, 99, 40, 34, 56, 11, 89, 40, 94, 13, 24, 34, 8, 82, 7, 62, 46, 86, 71, 13, 2, 2, 29, 91, 82, 58, 2, 59, 53, 68, 61, 49, 46, 72, 59, 48, 9, 18, 50, 86, 75, 27, 32, 66, 66, 94], [22, 86, 24, 91, 75, 13, 91, 15, 49, 17, 39, 73, 87, 4, 57, 15, 43, 31, 6, 90, 59, 65, 86, 30, 58, 86, 97, 56, 69, 36, 46, 74, 1, 12, 67, 10, 1, 19, 82, 95, 55, 49, 55, 86, 68, 41, 55], [74, 74, 79, 69, 43, 81, 82, 57, 48, 50, 69, 8, 56, 91, 89, 26, 23, 41, 87, 93, 97, 59, 18, 71, 96, 71, 8, 58, 85, 17, 51, 33, 30, 66, 60, 46, 22, 32, 25, 8, 97, 63, 29, 81, 40, 45, 2], [49, 31, 68, 90, 9, 95, 10, 51, 70, 44, 26, 75, 79, 84, 78, 21, 91, 30, 71, 15, 80, 59, 84, 84, 86, 70, 20, 69, 53, 75, 2, 30, 8, 40, 8, 17, 99, 30, 1, 69, 64, 80, 36, 79, 49, 81, 77], [24, 4, 77, 62, 9, 26, 47, 16, 37, 70, 11, 2, 94, 83, 23, 47, 62, 76, 39, 6, 36, 62, 60, 79, 36, 77, 72, 89, 88, 31, 40, 60, 13, 93, 96, 37, 61, 18, 90, 18, 34, 54, 31, 79, 37, 84, 92], [68, 72, 58, 82, 96, 53, 87, 62, 79, 7, 31, 96, 40, 78, 83, 50, 80, 9, 65, 25, 8, 39, 32, 8, 13, 67, 66, 28, 4, 23, 34, 55, 71, 94, 58, 73, 19, 9, 23, 75, 13, 93, 31, 72, 19, 5, 91], [39, 14, 22, 22, 5, 62, 52, 80, 39, 26, 80, 56, 12, 80, 49, 12, 96, 5, 92, 51, 4, 93, 83, 25, 99, 24, 56, 19, 23, 95, 83, 96, 77, 46, 18, 61, 71, 45, 88, 46, 17, 15, 73, 34, 99, 8, 50], [11, 88, 42, 94, 85, 43, 35, 59, 12, 73, 12, 28, 93, 46, 40, 99, 29, 70, 16, 46, 92, 65, 29, 52, 40, 6, 27, 37, 22, 7, 1, 77, 48, 51, 14, 79, 12, 49, 41, 68, 85, 2, 85, 62, 57, 14, 44], [66, 75, 37, 78, 47, 61, 84, 99, 27, 49, 60, 70, 71, 45, 1, 13, 38, 17, 38, 1, 1, 83, 30, 77, 7, 20, 44, 73, 13, 39, 20, 89, 5, 52, 25, 12, 90, 56, 86, 1, 72, 49, 67, 22, 85, 85, 31], [1, 27, 2, 93, 1, 42, 8, 35, 35, 7, 23, 23, 46, 19, 79, 72, 97, 99, 13, 50, 31, 71, 84, 38, 57, 8, 14, 94, 51, 9, 13, 76, 66, 38, 21, 29, 84, 50, 64, 9, 15, 53, 97, 53, 71, 3, 87], [22, 39, 77, 9, 34, 12, 34, 45, 97, 50, 99, 28, 39, 3, 47, 12, 43, 77, 67, 18, 90, 10, 4, 12, 53, 51, 16, 17, 95, 26, 2, 29, 94, 47, 11, 34, 71, 29, 97, 49, 91, 16, 81, 75, 14, 13, 35], [90, 52, 25, 59, 76, 68, 42, 48, 91, 45, 72, 72, 29, 3, 21, 31, 13, 95, 81, 48, 96, 24, 2, 3, 26, 2, 33, 34, 90, 98, 38, 78, 95, 20, 10, 84, 33, 45, 60, 66, 61, 51, 12, 80, 9, 11, 21], [76, 68, 26, 63, 19, 17, 44, 61, 1, 72, 58, 94, 41, 24, 43, 81, 94, 9, 66, 90, 32, 91, 41, 11, 65, 18, 8, 27, 82, 9, 2, 81, 75, 46, 70, 5, 12, 44, 42, 99, 88, 30, 52, 81, 47, 36, 70], [32, 98, 44, 16, 71, 96, 17, 32, 14, 26, 73, 13, 89, 12, 45, 16, 94, 52, 21, 24, 43, 5, 33, 31, 9, 35, 8, 75, 17, 80, 20, 91, 78, 22, 54, 71, 75, 81, 77, 81, 75, 68, 80, 31, 85, 97, 13], [29, 79, 10, 33, 15, 77, 35, 54, 21, 30, 46, 42, 71, 49, 24, 80, 69, 6, 2, 3, 53, 10, 24, 33, 84, 22, 61, 96, 94, 67, 4, 51, 4, 39, 31, 57, 73, 30, 93, 89, 39, 99, 25, 58, 36, 11, 90], [46, 89, 21, 2, 74, 39, 99, 33, 31, 4, 67, 69, 81, 13, 65, 45, 39, 87, 89, 53, 31, 13, 1, 98, 29, 61, 95, 72, 2, 12, 56, 97, 94, 41, 27, 89, 38, 97, 52, 80, 32, 88, 2, 66, 20, 57, 62], [91, 86, 48, 83, 7, 67, 50, 34, 87, 69, 67, 88, 91, 34, 43, 21, 12, 32, 47, 86, 98, 87, 55, 65, 68, 17, 26, 95, 33, 64, 92, 10, 46, 73, 90, 51, 34, 14, 41, 90, 95, 38, 48, 43, 28, 41, 56], [81, 76, 91, 65, 60, 97, 13, 69, 52, 43, 92, 88, 84, 40, 42, 37, 84, 23, 67, 69, 79, 69, 98, 58, 46, 87, 47, 17, 9, 68, 94, 78, 30, 95, 61, 65, 58, 27, 66, 45, 40, 61, 41, 74, 88, 84, 42], [62, 80, 38, 60, 49, 18, 99, 94, 5, 11, 4, 61, 75, 12, 49, 28, 90, 34, 56, 65, 6, 33, 47, 24, 34, 72, 16, 80, 16, 98, 84, 14, 59, 62, 90, 66, 19, 61, 66, 26, 89, 49, 19, 49, 81, 30, 76], [57, 85, 36, 40, 28, 97, 46, 73, 82, 88, 32, 87, 58, 76, 98, 26, 70, 69, 87, 50, 79, 32, 58, 64, 77, 28, 97, 72, 80, 39, 96, 80, 45, 13, 20, 58, 19, 75, 91, 80, 9, 77, 19, 94, 55, 39, 17], [62, 94, 93, 60, 42, 2, 50, 67, 20, 1, 5, 97, 39, 87, 18, 68, 97, 90, 22, 30, 90, 1, 70, 81, 95, 51, 68, 74, 61, 48, 53, 34, 86, 86, 7, 39, 37, 63, 55, 15, 83, 74, 62, 68, 50, 41, 61], [25, 28, 82, 35, 83, 53, 84, 39, 97, 59, 65, 1, 45, 19, 48, 49, 73, 14, 67, 30, 65, 69, 87, 6, 84, 46, 42, 72, 61, 31, 79, 26, 58, 33, 52, 32, 54, 1, 5, 22, 95, 5, 8, 70, 63, 10, 62], [40, 47, 80, 56, 28, 56, 1, 52, 82, 62, 42, 47, 37, 11, 67, 29, 4, 95, 11, 30, 79, 79, 58, 32, 29, 43, 92, 85, 39, 11, 96, 27, 24, 37, 65, 32, 53, 1, 56, 34, 82, 29, 6, 57, 95, 14, 75], [69, 62, 86, 51, 13, 76, 4, 38, 4, 30, 54, 65, 61, 49, 31, 42, 50, 23, 78, 99, 81, 60, 32, 56, 56, 87, 34, 41, 39, 86, 42, 66, 20, 14, 38, 37, 37, 12, 92, 56, 8, 93, 21, 39, 48, 18, 63]], 41",
"False"
]
] | f_gold | DIAGONALLY_DOMINANT_MATRIX | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DIAGONALLY_DOMINANT_MATRIX{
static boolean f_gold ( int m [ ] [ ] , int n ) {
for ( int i = 0 ;
i < n ;
i ++ ) {
int sum = 0 ;
for ( int j = 0 ;
j < n ;
j ++ ) sum += Math . abs ( m [ i ] [ j ] ) ;
sum -= Math . abs ( m [ i ] [ i ] ) ;
if ( Math . abs ( m [ i ] [ i ] ) < sum ) return false ;
}
return true ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( x , y , z ) :
c = 0
while ( x and y and z ) :
x = x - 1
y = y - 1
z = z - 1
c = c + 1
return c
| java | [
[
"23, 98, 25",
"23"
],
[
"87, 55, 94",
"55"
],
[
"35, 90, 29",
"29"
],
[
"25, 9, 41",
"9"
],
[
"93, 22, 39",
"22"
],
[
"52, 42, 96",
"42"
],
[
"95, 88, 26",
"26"
],
[
"91, 64, 51",
"51"
],
[
"75, 1, 6",
"1"
],
[
"96, 44, 76",
"44"
]
] | f_gold | SMALLEST_OF_THREE_INTEGERS_WITHOUT_COMPARISON_OPERATORS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SMALLEST_OF_THREE_INTEGERS_WITHOUT_COMPARISON_OPERATORS{
static int f_gold ( int x , int y , int z ) {
int c = 0 ;
while ( x != 0 && y != 0 && z != 0 ) {
x -- ;
y -- ;
z -- ;
c ++ ;
}
return c ;
}
| [] |
|
null | [] | [] | python | code_translation | import sys
def f_gold ( arr , n ) :
min_ending_here = sys.maxsize
min_so_far = sys.maxsize
for i in range ( n ) :
if ( min_ending_here > 0 ) :
min_ending_here = arr [ i ]
else :
min_ending_here += arr [ i ]
min_so_far = min ( min_so_far , min_ending_here )
return min_so_far
| java | [
[
"[2, 9, 13, 14, 15, 18, 19, 19, 25, 26, 29, 29, 29, 30, 31, 36, 37, 37, 38, 39, 39, 40, 40, 42, 42, 46, 50, 53, 58, 60, 62, 64, 65, 67, 68, 69, 72, 77, 78, 83, 85, 89, 90, 93, 95, 95, 97], 24",
"2"
],
[
"[14, -58, 8, 78, -26, -20, -60, 42, -64, -12], 6",
"-58"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], 8",
"0"
],
[
"[44, 88, 20, 47, 69, 42, 26, 49, 71, 91, 18, 95, 9, 66, 60, 37, 47, 29, 98, 63, 15, 9, 80, 66, 1, 9, 57, 56, 20, 2, 1], 26",
"1"
],
[
"[-78, -64, -62, -60, -52, 4, 8, 46, 72, 74], 8",
"-316"
],
[
"[0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1], 11",
"0"
],
[
"[3, 7, 16, 17, 23, 23, 23, 28, 29, 30, 34, 38, 40, 41, 43, 43, 44, 46, 51, 51, 51, 55, 57, 58, 61, 62, 66, 66, 67, 69, 70, 73, 75, 77, 79, 80, 85, 85, 87, 87, 93, 96], 38",
"3"
],
[
"[80, 22, 38, 26, 62, -48, -48, 46, -54, 4, 76, 46, 48, 40, -92, -98, -88, 12, -42, -94, 76, -16, -82, 62, 18, -24], 22",
"-402"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 13",
"0"
],
[
"[85, 44, 1, 97, 50, 74, 62, 90, 3, 78, 8, 48, 96, 41, 36, 91, 57, 97, 85, 90, 78, 43, 28, 92, 85, 59, 29, 38, 34, 65, 20, 26, 27, 23, 71, 22, 47, 99, 68, 93, 67, 66, 69, 82, 98, 15, 44, 51, 65], 45",
"1"
]
] | f_gold | SMALLEST_SUM_CONTIGUOUS_SUBARRAY | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SMALLEST_SUM_CONTIGUOUS_SUBARRAY{
static int f_gold ( int arr [ ] , int n ) {
int min_ending_here = 2147483647 ;
int min_so_far = 2147483647 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( min_ending_here > 0 ) min_ending_here = arr [ i ] ;
else min_ending_here += arr [ i ] ;
min_so_far = Math . min ( min_so_far , min_ending_here ) ;
}
return min_so_far ;
}
| [
"import sys"
] |
|
null | [] | [] | python | code_translation | import math
def f_gold ( num ) :
if ( num < 0 ) :
return False
c = ( - 2 * num )
b , a = 1 , 1
d = ( b * b ) - ( 4 * a * c )
if ( d < 0 ) :
return False
root1 = ( - b + math.sqrt ( d ) ) / ( 2 * a )
root2 = ( - b - math.sqrt ( d ) ) / ( 2 * a )
if ( root1 > 0 and math.floor ( root1 ) == root1 ) :
return True
if ( root2 > 0 and math.floor ( root2 ) == root2 ) :
return True
return False
| java | [
[
"1",
"True"
],
[
"3",
"True"
],
[
"6",
"True"
],
[
"10",
"True"
],
[
"55",
"True"
],
[
"48",
"False"
],
[
"63",
"False"
],
[
"72",
"False"
],
[
"16",
"False"
],
[
"85",
"False"
]
] | f_gold | TRIANGULAR_NUMBERS_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class TRIANGULAR_NUMBERS_1{
static boolean f_gold ( int num ) {
if ( num < 0 ) return false ;
int c = ( - 2 * num ) ;
int b = 1 , a = 1 ;
int d = ( b * b ) - ( 4 * a * c ) ;
if ( d < 0 ) return false ;
float root1 = ( - b + ( float ) Math . sqrt ( d ) ) / ( 2 * a ) ;
float root2 = ( - b - ( float ) Math . sqrt ( d ) ) / ( 2 * a ) ;
if ( root1 > 0 && Math . floor ( root1 ) == root1 ) return true ;
if ( root2 > 0 && Math . floor ( root2 ) == root2 ) return true ;
return false ;
}
| [
"import math"
] |
|
null | [] | [] | python | code_translation | def f_gold(str1, str2, k):
if ((len(str1) + len(str2)) < k):
return True
commonLength = 0
for i in range(0, min(len(str1), len(str2)), 1):
if (str1[i] == str2[i]):
commonLength += 1
else:
break
if ((k - len(str1) - len(str2) + 2 * commonLength) % 2 == 0):
return True
return False
| java | [
[
"'ZNHGro', 'jAdbtDUYQu', 3",
"False"
],
[
"'382880806774', '65565', 10",
"False"
],
[
"'0', '00100010100', 2",
"True"
],
[
"'lxHTRFCTSQ', 'sViXYE', 89",
"True"
],
[
"'6399914758', '780990121', 9",
"True"
],
[
"'01100011100000', '0100', 0",
"True"
],
[
"'WkGqlob', 'NpQVdXzEtUZy', 6",
"False"
],
[
"'46974006151', '74438', 11",
"False"
],
[
"'1001001', '1000010', 15",
"True"
],
[
"'IJQ', 'nFOHAeYEAp', 42",
"True"
]
] | f_gold | CONVERTING_ONE_STRING_USING_APPEND_DELETE_LAST_OPERATIONS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CONVERTING_ONE_STRING_USING_APPEND_DELETE_LAST_OPERATIONS{
static boolean f_gold ( String str1 , String str2 , int k ) {
if ( ( str1 . length ( ) + str2 . length ( ) ) < k ) return true ;
int commonLength = 0 ;
for ( int i = 0 ;
i < Math . min ( str1 . length ( ) , str2 . length ( ) ) ;
i ++ ) {
if ( str1 == str2 ) commonLength ++ ;
else break ;
}
if ( ( k - str1 . length ( ) - str2 . length ( ) + 2 * commonLength ) % 2 == 0 ) return true ;
return false ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a1 , a2 , a3 , n1 , n2 , n3 , sum ) :
s = set ( )
for i in range ( n1 ) :
s.add ( a1 [ i ] )
for i in range ( n2 ) :
for j in range ( n3 ) :
if sum - a2 [ i ] - a3 [ j ] in s :
return True
return False
| java | [
[
"[6, 7, 10, 15, 28, 30, 30, 35, 38, 43, 44, 44, 54, 55, 64, 68, 69, 73, 75, 75, 86, 87, 92, 93, 94], [11, 17, 18, 24, 26, 26, 33, 35, 38, 41, 55, 60, 63, 63, 69, 73, 78, 81, 82, 87, 90, 91, 93, 94, 99], [3, 3, 8, 22, 24, 24, 28, 30, 32, 32, 34, 39, 40, 45, 46, 50, 54, 59, 75, 78, 79, 90, 95, 95, 97], 21, 16, 17, 18",
"False"
],
[
"[-72, -90, -92, 4, 22, 14, -50, 16, -56, -66, 62, -32, 82, 8, 12, -24, 92, -98, -94, 56, -74, -66, 26, -98, 10, -74, -14, 2, 60, -88, -84, 34, 82, 28, -86, -90, -92, 52, 72, 90, 92, -20, -86, 74, -96, -46, 28], [50, -20, 26, 32, -46, 38, 36, 0, -96, 60, -70, -36, -12, 50, 64, -70, 22, -22, 32, 60, -94, 98, -58, -86, -16, 40, -68, 2, -50, 6, -36, -28, -68, 44, -98, -38, -46, 68, 4, 60, -36, 28, -38, 4, 50, -84, -12], [-28, 20, -62, -84, 14, 10, 28, -10, 94, -2, 52, 66, 38, -50, 48, -88, -28, 92, -48, 86, 4, -16, 26, 26, -82, 44, 70, 72, -6, -98, 80, 56, 38, 42, -20, 64, 36, 80, 12, 4, -50, 54, 22, 98, -30, -52, 4], 41, 42, 34, 32",
"True"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 26, 20, 30, 16",
"False"
],
[
"[85, 34, 78, 64, 22, 94, 52, 71, 44, 48, 46, 88, 59, 95, 4, 55, 21, 83, 56, 19, 85, 6, 87, 13], [58, 45, 14, 13, 73, 82, 34, 78, 83, 84, 39, 34, 65, 84, 84, 61, 26, 67, 48, 51, 41, 46, 89, 10], [46, 1, 2, 90, 31, 49, 62, 10, 28, 4, 48, 84, 87, 51, 88, 74, 99, 15, 35, 24, 32, 66, 10, 66], 15, 16, 23, 15",
"False"
],
[
"[-98, -98, -96, -94, -90, -90, -84, -36, -34, -34, -32, 16, 26, 26, 56, 74, 80], [-92, -70, -70, -56, -54, -48, -38, -14, -10, 0, 4, 30, 34, 70, 72, 76, 78], [-92, -88, -70, -56, -50, -50, -48, -36, -20, -10, -8, 2, 16, 22, 48, 70, 78], 15, 10, 15, 15",
"False"
],
[
"[1, 1, 1, 0, 0, 0, 1, 1, 1, 1], [0, 0, 1, 0, 0, 1, 0, 1, 0, 1], [1, 1, 1, 1, 0, 1, 1, 1, 0, 1], 5, 7, 9, 6",
"False"
],
[
"[4, 4, 25, 27, 35, 39, 50, 60, 60, 63, 67, 73, 75, 81, 84, 85, 91, 98], [20, 21, 23, 25, 37, 41, 51, 57, 62, 66, 74, 77, 77, 79, 80, 87, 88, 95], [2, 3, 9, 10, 10, 18, 24, 40, 41, 47, 68, 69, 70, 86, 90, 95, 96, 98], 12, 17, 13, 9",
"False"
],
[
"[54, -64, 76, 78, 24, 40, 44, -56, 80, -10, -12, -8, -18, 42, 70, 14, -70, 48, -68, -98, -74, -40, -16, -90, 48, 92, -64, 58, -98, 60, -10, -10], [88, -66, -50, 74, -44, -32, -58, -24, -40, 62, 52, 88, -48, -2, -46, 38, 30, -56, 76, 56, 60, 52, -32, 36, 90, 92, -74, 88, -36, -14, -16, -14], [38, -96, 16, 38, -48, -22, -52, -78, 42, 94, -26, -20, 12, -10, 72, 16, -8, -2, -36, -76, -6, -92, 10, 34, -76, -54, -20, 20, -76, -46, 24, 44], 23, 18, 29, 19",
"False"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 38, 22, 40, 32",
"False"
],
[
"[28, 88, 75, 86, 51, 82, 2, 20, 22, 18, 96, 11], [62, 54, 79, 88, 27, 13, 48, 94, 86, 28, 86, 60], [49, 14, 18, 61, 94, 54, 12, 56, 97, 59, 85, 44], 6, 6, 8, 9",
"False"
]
] | f_gold | FIND_THREE_ELEMENT_FROM_DIFFERENT_THREE_ARRAYS_SUCH_THAT_THAT_A_B_C_K_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THREE_ELEMENT_FROM_DIFFERENT_THREE_ARRAYS_SUCH_THAT_THAT_A_B_C_K_1{
static boolean f_gold ( int a1 [ ] , int a2 [ ] , int a3 [ ] , int n1 , int n2 , int n3 , int sum ) {
HashSet < Integer > s = new HashSet < Integer > ( ) ;
for ( int i = 0 ;
i < n1 ;
i ++ ) {
s . add ( a1 [ i ] ) ;
}
ArrayList < Integer > al = new ArrayList < > ( s ) ;
for ( int i = 0 ;
i < n2 ;
i ++ ) {
for ( int j = 0 ;
j < n3 ;
j ++ ) {
if ( al . contains ( sum - a2 [ i ] - a3 [ j ] ) & al . indexOf ( sum - a2 [ i ] - a3 [ j ] ) != al . get ( al . size ( ) - 1 ) ) {
return true ;
}
}
}
return false ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( N ) :
if ( N <= 6 ) :
return N
screen = [ 0 ] * N
for n in range ( 1 , 7 ) :
screen [ n - 1 ] = n
for n in range ( 7 , N + 1 ) :
screen [ n - 1 ] = max ( 2 * screen [ n - 4 ] , max ( 3 * screen [ n - 5 ] , 4 * screen [ n - 6 ] ) ) ;
return screen [ N - 1 ]
| java | [
[
"41",
"110592"
],
[
"94",
"274877906944"
],
[
"80",
"5435817984"
],
[
"40",
"82944"
],
[
"76",
"1811939328"
],
[
"5",
"5"
],
[
"43",
"196608"
],
[
"67",
"150994944"
],
[
"24",
"1024"
],
[
"90",
"86973087744"
]
] | f_gold | HOW_TO_PRINT_MAXIMUM_NUMBER_OF_A_USING_GIVEN_FOUR_KEYS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class HOW_TO_PRINT_MAXIMUM_NUMBER_OF_A_USING_GIVEN_FOUR_KEYS{
static int f_gold ( int N ) {
if ( N <= 6 ) return N ;
int [ ] screen = new int [ N ] ;
int b ;
int n ;
for ( n = 1 ;
n <= 6 ;
n ++ ) screen [ n - 1 ] = n ;
for ( n = 7 ;
n <= N ;
n ++ ) {
screen [ n - 1 ] = Math . max ( 2 * screen [ n - 4 ] , Math . max ( 3 * screen [ n - 5 ] , 4 * screen [ n - 6 ] ) ) ;
}
return screen [ N - 1 ] ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
res = 0
x = 0
while ( x * x < n ) :
y = 0
while ( x * x + y * y < n ) :
res = res + 1
y = y + 1
x = x + 1
return res
| java | [
[
"61",
"54"
],
[
"45",
"41"
],
[
"53",
"50"
],
[
"4",
"4"
],
[
"82",
"73"
],
[
"86",
"79"
],
[
"37",
"35"
],
[
"48",
"43"
],
[
"81",
"71"
],
[
"50",
"45"
]
] | f_gold | COUNT_DISTINCT_NON_NEGATIVE_PAIRS_X_Y_SATISFY_INEQUALITY_XX_YY_N_2 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_DISTINCT_NON_NEGATIVE_PAIRS_X_Y_SATISFY_INEQUALITY_XX_YY_N_2{
static int f_gold ( int n ) {
int res = 0 ;
for ( int x = 0 ;
x * x < n ;
x ++ ) for ( int y = 0 ;
x * x + y * y < n ;
y ++ ) res ++ ;
return res ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( m , x , revenue , n , t ) :
maxRev = [ 0 ] * ( m + 1 )
nxtbb = 0 ;
for i in range ( 1 , m + 1 ) :
if ( nxtbb < n ) :
if ( x [ nxtbb ] != i ) :
maxRev [ i ] = maxRev [ i - 1 ]
else :
if ( i <= t ) :
maxRev [ i ] = max ( maxRev [ i - 1 ] , revenue [ nxtbb ] )
else :
maxRev [ i ] = max ( maxRev [ i - t - 1 ] + revenue [ nxtbb ] , maxRev [ i - 1 ] ) ;
nxtbb += 1
else :
maxRev [ i ] = maxRev [ i - 1 ]
return maxRev [ m ]
| java | [
[
"16, [6, 15, 15, 18, 23, 29, 32, 36, 37, 39, 40, 41, 44, 49, 51, 52, 53, 57, 66, 68, 82, 89, 96], [1, 2, 5, 5, 24, 26, 31, 32, 33, 41, 57, 59, 71, 75, 79, 87, 87, 88, 92, 94, 96, 96, 99], 12, 12",
"2"
],
[
"39, [76, 60, 88, 46, -20, -78, -22, 54, -18, 92, -42, -66, -90, -72, -48, 22, -72, -42, -46, 94, 82, -78, 14, 86, 10, -64, -78, 66, 78, -36, 50, -20, -40, -12, 10, -46, 56, -18, 4, -76, -64, 74, 22, 34, 4, -2], [28, 8, -60, 84, 68, -54, -56, 0, -68, -84, -6, 92, -80, -24, 86, -6, -44, 82, 74, 90, -46, 40, 62, 50, -42, 38, 78, 94, 46, -14, -48, 66, 70, 52, 10, -88, 54, -10, 98, 34, 16, -2, -62, -56, -40, 86], 25, 27",
"0"
],
[
"5, [0, 0, 0, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1], 9, 6",
"0"
],
[
"10, [21, 69, 30, 10, 71, 72, 71, 78, 30, 9, 72, 10, 7, 87, 30, 46, 56, 74, 73, 60, 86], [72, 45, 7, 30, 76, 35, 75, 72, 4, 7, 55, 56, 7, 52, 48, 27, 11, 76, 66, 48, 33], 18, 20",
"0"
],
[
"14, [-76, -76, -66, -64, -62, -60, -52, -48, -42, -28, -14, -6, -6, 16, 20, 20, 38, 46, 58, 60, 70, 72, 86, 98], [-90, -82, -78, -76, -74, -52, -48, -44, -44, -40, -38, -14, -6, 10, 20, 38, 38, 40, 44, 48, 52, 54, 76, 78], 15, 17",
"0"
],
[
"32, [1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1], [0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1], 28, 36",
"0"
],
[
"2, [16, 38, 72, 82], [15, 34, 56, 74], 2, 3",
"0"
],
[
"22, [28, -76, 42, -2, 30, -10, 52, 66, 26, 96, 96, -72, 26, -86, -30, -78, 32, -32, 58, 12, -72, 8, 34, -68, -28, -66], [68, -38, 34, 20, 40, 78, 52, 80, 58, -12, -18, 10, 40, 34, 20, -32, -8, -46, 8, 62, 94, -30, -94, 26, -40, 64], 13, 16",
"0"
],
[
"15, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 25, 15",
"0"
],
[
"8, [95, 12, 65, 97, 92, 49, 94, 32, 37, 97, 9, 35], [25, 32, 14, 49, 90, 37, 92, 1, 8, 75, 50, 9], 9, 8",
"0"
]
] | f_gold | HIGHWAY_BILLBOARD_PROBLEM | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class HIGHWAY_BILLBOARD_PROBLEM{
static int f_gold ( int m , int [ ] x , int [ ] revenue , int n , int t ) {
int [ ] maxRev = new int [ m + 1 ] ;
for ( int i = 0 ;
i < m + 1 ;
i ++ ) maxRev [ i ] = 0 ;
int nxtbb = 0 ;
for ( int i = 1 ;
i <= m ;
i ++ ) {
if ( nxtbb < n ) {
if ( x [ nxtbb ] != i ) maxRev [ i ] = maxRev [ i - 1 ] ;
else {
if ( i <= t ) maxRev [ i ] = Math . max ( maxRev [ i - 1 ] , revenue [ nxtbb ] ) ;
else maxRev [ i ] = Math . max ( maxRev [ i - t - 1 ] + revenue [ nxtbb ] , maxRev [ i - 1 ] ) ;
nxtbb ++ ;
}
}
else maxRev [ i ] = maxRev [ i - 1 ] ;
}
return maxRev [ m ] ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( s ) :
length = len ( s )
oneSeen = False
count = 0
for i in range ( length ) :
if ( s [ i ] == '1' and oneSeen ) :
if ( s [ i - 1 ] == '0' ) :
count += 1
if ( s [ i ] == '1' and oneSeen == 0 ) :
oneSeen = True
if ( s [ i ] != '0' and s [ i ] != '1' ) :
oneSeen = False
return count
| java | [
[
"'1001ab010abc01001'",
"2"
],
[
"'1001010001'",
"3"
],
[
"'010100010100'",
"3"
],
[
"'DLCu'",
"0"
],
[
"'7072430592'",
"0"
],
[
"'011'",
"0"
],
[
"'pnJpypYOza'",
"0"
],
[
"'1037'",
"0"
],
[
"'111'",
"0"
],
[
"'HxK'",
"0"
]
] | f_gold | COUNT_OF_OCCURRENCES_OF_A_101_PATTERN_IN_A_STRING | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_OF_OCCURRENCES_OF_A_101_PATTERN_IN_A_STRING{
static int f_gold ( String str ) {
int len = str . length ( ) ;
boolean oneSeen = false ;
int count = 0 ;
for ( int i = 0 ;
i < len ;
i ++ ) {
char getChar = str . charAt ( i ) ;
if ( getChar == '1' && oneSeen == true ) {
if ( str . charAt ( i - 1 ) == '0' ) count ++ ;
}
if ( getChar == '1' && oneSeen == false ) oneSeen = true ;
if ( getChar != '0' && str . charAt ( i ) != '1' ) oneSeen = false ;
}
return count ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a , b ) :
if ( a == 0 or b == 0 ) :
return False
result = a * b
if ( result >= 9223372036854775807 or result <= - 9223372036854775808 ) :
result = 0
if ( a == ( result // b ) ) :
print ( result // b )
return False
else :
return True
| java | [
[
"37, 80",
"False"
],
[
"10000000000, -10000000000",
"True"
],
[
"10000000000, 10000000000",
"True"
],
[
"999999999, 999999999",
"False"
],
[
"39, 36",
"False"
],
[
"92, 56",
"False"
],
[
"14, 21",
"False"
],
[
"19, 38",
"False"
],
[
"14, 82",
"False"
],
[
"88, 41",
"False"
]
] | f_gold | CHECK_INTEGER_OVERFLOW_MULTIPLICATION | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_INTEGER_OVERFLOW_MULTIPLICATION{
static Boolean f_gold ( long a , long b ) {
if ( a == 0 || b == 0 ) return false ;
long result = a * b ;
if ( a == result / b ) return false ;
else return true ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( mat , n ) :
diag1_left = 0
diag1_right = 0
diag2_left = 0
diag2_right = 0
i = 0
j = n - 1
while i < n :
if ( i < n // 2 ) :
diag1_left += mat [ i ] [ i ]
diag2_left += mat [ j ] [ i ]
elif ( i > n // 2 ) :
diag1_right += mat [ i ] [ i ]
diag2_right += mat [ j ] [ i ]
i += 1
j -= 1
return ( diag1_left == diag2_right and diag2_right == diag2_left and diag1_right == diag2_left and diag2_right == mat [ n // 2 ] [ n // 2 ] )
| java | [
[
"[[2, 9, 1, 4, -2], [6, 7, 2, 11, 4], [4, 2, 9, 2, 4], [1, 9, 2, 4, 4], [0, 2, 4, 2, 5]], 5",
"True"
],
[
"[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]], 8",
"True"
],
[
"[[52, 88, 22, 69, 1, 83, 30, 39, 79, 35, 69, 70, 89, 11, 51, 63, 86, 34, 55, 78, 73, 20, 80, 58, 81, 17, 34, 75, 99, 62, 34, 72, 19, 97, 87, 66, 72, 93, 42, 51, 71, 49, 29, 95], [30, 99, 25, 68, 62, 38, 17, 74, 1, 18, 63, 46, 19, 50, 96, 54, 31, 97, 86, 65, 46, 35, 49, 81, 34, 29, 6, 1, 55, 27, 12, 4, 80, 52, 11, 52, 84, 26, 28, 72, 66, 90, 27, 97], [55, 71, 54, 46, 36, 21, 49, 34, 87, 34, 40, 7, 90, 52, 49, 81, 95, 89, 37, 62, 15, 2, 11, 96, 94, 17, 88, 45, 68, 61, 46, 32, 19, 67, 4, 25, 73, 21, 87, 93, 94, 89, 93, 98], [14, 22, 48, 51, 80, 11, 59, 14, 7, 69, 58, 40, 93, 81, 94, 25, 78, 42, 86, 44, 5, 28, 76, 60, 77, 21, 96, 49, 56, 57, 85, 61, 38, 73, 2, 3, 43, 74, 35, 73, 40, 96, 85, 58], [34, 25, 56, 32, 22, 89, 65, 21, 80, 96, 21, 28, 19, 14, 87, 24, 20, 32, 74, 52, 65, 95, 52, 58, 79, 95, 92, 10, 70, 15, 47, 91, 10, 21, 19, 68, 22, 63, 38, 15, 70, 75, 44, 30], [24, 86, 94, 46, 4, 6, 38, 26, 19, 2, 68, 69, 47, 99, 29, 64, 80, 12, 85, 73, 11, 8, 60, 26, 32, 39, 4, 98, 92, 89, 44, 99, 83, 35, 51, 51, 29, 78, 85, 36, 78, 60, 15, 51], [50, 94, 55, 12, 50, 62, 5, 27, 79, 90, 9, 35, 13, 44, 46, 97, 98, 68, 77, 74, 53, 1, 11, 50, 9, 38, 87, 13, 5, 25, 10, 5, 22, 42, 89, 20, 28, 21, 11, 93, 69, 37, 49, 69], [33, 45, 8, 6, 15, 15, 9, 61, 56, 5, 26, 87, 80, 57, 35, 10, 91, 80, 21, 12, 9, 16, 73, 93, 54, 23, 39, 88, 22, 55, 31, 74, 47, 27, 98, 48, 39, 88, 21, 15, 81, 45, 19, 53], [89, 55, 86, 49, 78, 61, 60, 92, 76, 91, 24, 86, 39, 61, 23, 72, 92, 93, 79, 39, 72, 92, 97, 11, 42, 25, 34, 22, 2, 51, 16, 11, 78, 96, 86, 69, 87, 62, 19, 29, 42, 23, 60, 73], [18, 95, 81, 55, 18, 27, 85, 1, 96, 14, 59, 78, 33, 36, 39, 76, 45, 25, 15, 20, 34, 58, 60, 78, 30, 13, 78, 93, 90, 67, 89, 91, 45, 40, 80, 38, 75, 93, 47, 88, 29, 34, 11, 20], [20, 73, 56, 23, 91, 88, 25, 89, 33, 31, 74, 79, 1, 54, 16, 85, 59, 66, 3, 15, 32, 50, 91, 99, 60, 88, 8, 7, 4, 94, 10, 60, 25, 42, 47, 96, 96, 32, 74, 73, 25, 89, 16, 49], [16, 94, 38, 5, 7, 77, 8, 33, 62, 74, 84, 32, 93, 1, 91, 20, 55, 63, 78, 79, 6, 52, 2, 93, 39, 32, 51, 69, 86, 92, 32, 93, 3, 62, 95, 13, 70, 21, 61, 14, 89, 71, 22, 32], [41, 32, 42, 52, 94, 81, 54, 62, 85, 90, 43, 3, 38, 81, 39, 70, 85, 45, 46, 13, 52, 9, 57, 69, 43, 7, 44, 44, 95, 68, 77, 44, 79, 40, 77, 43, 62, 43, 90, 19, 49, 65, 77, 25], [84, 41, 23, 58, 88, 43, 40, 30, 34, 10, 60, 1, 12, 46, 93, 75, 17, 84, 58, 38, 6, 62, 84, 74, 10, 95, 26, 58, 17, 53, 78, 5, 67, 20, 51, 46, 79, 67, 3, 23, 9, 11, 47, 49], [44, 13, 8, 63, 22, 38, 27, 26, 23, 95, 93, 65, 74, 47, 61, 46, 4, 31, 4, 29, 73, 79, 44, 3, 59, 79, 53, 11, 6, 47, 7, 68, 85, 1, 56, 87, 77, 43, 28, 29, 18, 87, 92, 73], [62, 6, 16, 1, 22, 46, 62, 23, 21, 51, 95, 38, 28, 44, 91, 39, 42, 42, 60, 57, 77, 96, 7, 51, 97, 77, 32, 7, 76, 40, 15, 59, 85, 12, 77, 42, 39, 63, 2, 29, 61, 29, 38, 7], [30, 87, 92, 56, 87, 36, 42, 93, 4, 84, 5, 46, 75, 2, 54, 88, 59, 33, 22, 47, 6, 24, 93, 49, 96, 94, 51, 41, 67, 89, 92, 79, 81, 2, 91, 78, 43, 32, 12, 23, 16, 44, 2, 7], [21, 58, 95, 23, 60, 25, 35, 99, 45, 7, 69, 32, 53, 69, 25, 95, 84, 86, 77, 2, 86, 61, 9, 51, 2, 45, 32, 72, 80, 97, 75, 32, 8, 96, 85, 89, 20, 65, 21, 7, 89, 9, 86, 2], [19, 60, 70, 59, 69, 45, 62, 10, 65, 26, 90, 60, 18, 59, 21, 46, 12, 78, 32, 39, 99, 81, 55, 55, 10, 35, 80, 6, 68, 62, 9, 29, 71, 80, 6, 44, 64, 67, 44, 78, 14, 9, 23, 57], [57, 15, 64, 7, 20, 64, 19, 6, 51, 39, 65, 71, 99, 25, 23, 89, 58, 11, 34, 31, 38, 46, 12, 9, 13, 64, 20, 59, 85, 22, 65, 60, 41, 81, 45, 4, 70, 45, 58, 83, 94, 23, 32, 63], [93, 8, 85, 81, 81, 85, 79, 91, 25, 33, 66, 16, 55, 36, 72, 80, 7, 69, 87, 8, 3, 35, 36, 79, 30, 15, 93, 68, 98, 87, 58, 99, 28, 95, 42, 97, 18, 5, 9, 84, 9, 18, 56, 15], [79, 78, 62, 35, 40, 51, 60, 56, 84, 75, 41, 54, 17, 25, 93, 87, 9, 56, 89, 23, 2, 45, 65, 38, 6, 48, 44, 79, 7, 66, 62, 30, 93, 76, 52, 98, 94, 36, 35, 66, 50, 3, 76, 4], [55, 52, 59, 71, 20, 19, 8, 67, 27, 79, 8, 18, 29, 46, 36, 3, 9, 10, 84, 66, 1, 91, 4, 48, 96, 18, 78, 45, 15, 51, 61, 4, 19, 88, 94, 77, 11, 28, 57, 75, 54, 65, 47, 4], [34, 76, 54, 88, 61, 96, 83, 93, 93, 83, 20, 3, 40, 69, 23, 69, 94, 32, 24, 51, 58, 42, 35, 32, 54, 45, 48, 86, 85, 92, 49, 34, 16, 11, 97, 19, 92, 29, 54, 53, 67, 82, 82, 76], [82, 32, 83, 56, 63, 4, 11, 3, 27, 80, 44, 18, 30, 88, 70, 47, 34, 76, 42, 23, 40, 15, 80, 57, 14, 79, 12, 35, 25, 78, 2, 18, 35, 9, 11, 90, 67, 69, 96, 74, 38, 70, 75, 81], [59, 66, 41, 24, 50, 5, 21, 6, 4, 9, 69, 68, 9, 18, 59, 43, 80, 66, 29, 48, 51, 42, 36, 76, 45, 98, 35, 6, 37, 36, 84, 16, 72, 22, 69, 69, 63, 75, 19, 81, 18, 73, 17, 41], [33, 84, 55, 82, 24, 77, 40, 28, 67, 75, 39, 21, 37, 2, 6, 52, 5, 47, 43, 96, 40, 11, 81, 14, 2, 39, 63, 63, 18, 97, 94, 79, 93, 90, 1, 17, 54, 39, 48, 66, 15, 22, 20, 93], [89, 43, 56, 24, 98, 43, 21, 48, 66, 16, 40, 21, 52, 8, 78, 55, 86, 82, 58, 5, 42, 30, 95, 9, 95, 95, 41, 51, 57, 73, 61, 6, 26, 74, 6, 53, 61, 33, 45, 94, 40, 24, 92, 45], [38, 29, 79, 8, 64, 87, 73, 51, 75, 6, 47, 49, 76, 98, 85, 32, 54, 36, 89, 99, 98, 19, 37, 17, 80, 16, 58, 44, 68, 49, 94, 51, 98, 5, 97, 58, 46, 55, 73, 17, 12, 24, 56, 55], [76, 79, 16, 87, 82, 22, 44, 95, 43, 79, 21, 8, 49, 6, 81, 47, 36, 92, 23, 31, 75, 62, 84, 96, 81, 57, 70, 65, 37, 68, 95, 75, 17, 7, 52, 35, 2, 40, 37, 57, 10, 76, 81, 46], [90, 5, 5, 27, 5, 61, 8, 31, 97, 21, 99, 21, 51, 79, 59, 2, 30, 58, 92, 81, 20, 40, 29, 5, 89, 10, 83, 61, 1, 47, 98, 57, 14, 25, 90, 21, 16, 74, 32, 45, 64, 84, 73, 60], [98, 95, 19, 47, 95, 64, 30, 47, 88, 33, 82, 21, 95, 63, 42, 61, 43, 68, 26, 33, 33, 49, 84, 41, 72, 36, 72, 95, 22, 47, 83, 20, 87, 24, 43, 88, 73, 16, 27, 45, 37, 13, 51, 2], [76, 97, 87, 59, 14, 49, 30, 98, 9, 79, 24, 41, 60, 89, 32, 47, 21, 42, 70, 89, 2, 31, 56, 30, 63, 15, 18, 32, 14, 62, 82, 99, 52, 22, 14, 78, 34, 86, 80, 56, 53, 49, 63, 16], [80, 40, 38, 18, 23, 48, 82, 46, 22, 54, 40, 30, 55, 56, 42, 42, 62, 82, 53, 82, 53, 64, 1, 79, 69, 27, 17, 63, 41, 58, 57, 96, 38, 90, 66, 92, 45, 23, 20, 36, 42, 22, 60, 11], [28, 45, 22, 81, 63, 31, 11, 36, 78, 35, 23, 29, 23, 16, 84, 89, 19, 90, 96, 63, 50, 85, 73, 43, 19, 85, 18, 6, 35, 14, 64, 9, 35, 2, 6, 99, 25, 73, 50, 95, 7, 63, 28, 2], [65, 59, 24, 62, 99, 71, 38, 93, 62, 65, 51, 94, 52, 96, 74, 98, 63, 11, 48, 54, 91, 50, 74, 38, 86, 88, 8, 6, 68, 69, 6, 32, 38, 57, 84, 64, 54, 14, 64, 50, 47, 54, 19, 75], [39, 65, 99, 83, 60, 33, 32, 36, 24, 43, 71, 71, 46, 47, 69, 14, 45, 52, 90, 50, 65, 77, 64, 23, 84, 71, 70, 59, 73, 92, 74, 54, 99, 71, 89, 94, 26, 44, 76, 13, 54, 40, 4, 53], [1, 6, 55, 66, 91, 18, 29, 53, 33, 3, 20, 4, 82, 8, 86, 86, 83, 28, 66, 73, 99, 86, 26, 34, 71, 94, 49, 89, 49, 73, 27, 65, 33, 72, 49, 63, 32, 19, 50, 22, 90, 67, 9, 35], [71, 79, 4, 37, 28, 9, 35, 25, 9, 61, 52, 97, 17, 76, 9, 54, 5, 63, 47, 90, 19, 99, 66, 45, 71, 73, 86, 33, 80, 43, 88, 72, 94, 26, 45, 35, 81, 53, 10, 41, 17, 71, 66, 11], [63, 67, 46, 20, 13, 87, 17, 93, 32, 99, 99, 98, 85, 16, 23, 11, 14, 67, 71, 45, 75, 33, 83, 45, 54, 51, 87, 23, 29, 6, 39, 5, 96, 40, 90, 78, 82, 21, 59, 89, 20, 24, 3, 86], [72, 57, 93, 71, 70, 70, 76, 63, 86, 47, 90, 89, 19, 99, 13, 89, 45, 32, 30, 85, 42, 72, 42, 7, 3, 37, 3, 18, 42, 9, 57, 24, 7, 97, 89, 42, 98, 58, 85, 56, 58, 18, 39, 50], [33, 28, 56, 25, 14, 55, 84, 84, 7, 4, 95, 30, 62, 57, 37, 55, 85, 65, 52, 3, 77, 7, 70, 70, 34, 96, 16, 8, 21, 11, 50, 87, 6, 15, 11, 27, 79, 45, 38, 4, 78, 45, 10, 54], [29, 12, 56, 40, 84, 37, 66, 20, 12, 38, 30, 47, 82, 74, 71, 42, 5, 48, 93, 99, 51, 12, 10, 37, 66, 67, 14, 47, 20, 52, 68, 26, 47, 79, 73, 3, 2, 41, 30, 37, 81, 3, 9, 8], [9, 17, 24, 72, 14, 54, 80, 18, 88, 39, 47, 27, 92, 71, 98, 91, 34, 19, 6, 30, 92, 12, 15, 39, 64, 64, 15, 58, 67, 1, 7, 9, 1, 5, 47, 10, 2, 23, 93, 56, 19, 38, 47, 84]], 33",
"False"
],
[
"[[99, 52, 49, 71, 23, 50, 17, 48, 2, 69, 62], [85, 13, 61, 11, 88, 97, 27, 35, 18, 85, 68], [61, 41, 96, 43, 49, 11, 67, 51, 52, 85, 43], [58, 78, 70, 29, 31, 28, 50, 36, 92, 19, 67], [12, 88, 76, 24, 65, 92, 80, 21, 94, 98, 26], [35, 95, 80, 58, 42, 29, 29, 9, 78, 72, 2], [75, 2, 18, 69, 57, 71, 23, 19, 19, 58, 83], [49, 45, 28, 75, 50, 11, 55, 9, 14, 98, 93], [21, 48, 58, 69, 97, 9, 67, 78, 18, 12, 87], [78, 16, 37, 20, 20, 15, 25, 17, 12, 42, 39], [56, 53, 71, 72, 88, 47, 25, 85, 50, 33, 74]], 10",
"False"
],
[
"[[29, 3, 39, 4, 37, 95, 6, 92, 10, 12, 66, 3, 65, 64, 35, 24, 47, 52, 34], [84, 80, 94, 25, 69, 29, 92, 64, 53, 58, 41, 87, 96, 51, 18, 41, 99, 61, 24], [47, 28, 36, 21, 56, 69, 26, 54, 87, 44, 33, 26, 22, 20, 2, 41, 54, 57, 18], [5, 96, 46, 75, 21, 22, 3, 9, 2, 28, 34, 53, 59, 10, 83, 93, 2, 48, 6], [44, 54, 71, 36, 8, 83, 10, 33, 91, 93, 19, 18, 51, 23, 1, 59, 3, 10, 71], [49, 56, 90, 16, 39, 96, 76, 44, 8, 8, 45, 11, 97, 25, 17, 95, 83, 55, 79], [56, 44, 53, 35, 39, 2, 98, 25, 38, 68, 80, 32, 79, 78, 41, 79, 71, 7, 72], [83, 18, 17, 82, 83, 77, 59, 11, 51, 7, 27, 59, 37, 5, 62, 72, 74, 90, 79], [55, 16, 93, 92, 74, 56, 51, 68, 46, 61, 78, 33, 55, 18, 12, 74, 21, 97, 78], [73, 26, 79, 21, 22, 55, 46, 41, 5, 44, 16, 35, 5, 62, 90, 26, 61, 51, 69], [56, 50, 36, 24, 79, 30, 69, 48, 22, 33, 69, 96, 50, 23, 10, 36, 17, 53, 91], [8, 44, 61, 6, 71, 90, 81, 37, 54, 23, 91, 57, 51, 58, 19, 27, 89, 25, 21], [25, 51, 71, 35, 70, 50, 15, 24, 49, 68, 7, 94, 81, 54, 38, 94, 45, 9, 55], [83, 52, 77, 49, 55, 83, 70, 76, 79, 3, 68, 38, 70, 49, 92, 8, 95, 85, 45], [29, 79, 49, 24, 21, 23, 95, 98, 28, 32, 22, 62, 67, 73, 6, 65, 22, 51, 68], [57, 72, 55, 42, 52, 61, 19, 1, 41, 63, 88, 48, 81, 32, 50, 14, 17, 96, 97], [30, 51, 98, 92, 62, 24, 63, 14, 34, 59, 65, 86, 33, 58, 18, 12, 74, 66, 2], [70, 84, 28, 42, 3, 48, 89, 87, 13, 57, 88, 3, 63, 38, 59, 28, 26, 84, 91], [65, 74, 74, 61, 57, 1, 32, 32, 27, 13, 17, 28, 89, 52, 36, 47, 66, 32, 32]], 0",
"False"
],
[
"[[55, 73, 80, 89, 40, 28, 81, 31, 87, 31, 26, 4, 58, 79, 23, 69, 60, 43, 89, 94, 26, 67, 68, 55, 47, 82, 59, 75, 75, 16, 58], [89, 1, 90, 45, 94, 6, 91, 52, 19, 43, 19, 39, 32, 65, 89, 47, 13, 74, 82, 36, 86, 70, 27, 72, 24, 20, 86, 9, 39, 83, 1], [11, 74, 1, 91, 81, 44, 51, 17, 66, 23, 41, 59, 74, 94, 99, 25, 17, 19, 82, 82, 46, 35, 74, 23, 86, 44, 9, 32, 90, 93, 59], [42, 62, 19, 93, 35, 76, 8, 89, 91, 43, 45, 6, 13, 11, 70, 69, 7, 55, 55, 19, 6, 89, 9, 20, 25, 50, 72, 50, 38, 66, 57], [22, 56, 36, 51, 68, 1, 48, 33, 24, 49, 69, 58, 48, 57, 64, 99, 53, 60, 90, 43, 41, 26, 59, 49, 64, 5, 44, 18, 57, 89, 40], [46, 58, 85, 24, 28, 46, 68, 72, 54, 33, 67, 84, 35, 39, 47, 71, 91, 5, 37, 1, 86, 56, 7, 64, 8, 94, 64, 57, 28, 26, 34], [96, 22, 20, 14, 23, 67, 19, 78, 39, 37, 99, 1, 19, 15, 89, 1, 31, 52, 43, 46, 86, 50, 20, 62, 43, 5, 79, 66, 12, 57, 60], [55, 71, 66, 72, 73, 27, 28, 37, 79, 19, 94, 51, 13, 45, 6, 94, 1, 25, 99, 26, 13, 19, 10, 45, 71, 15, 87, 31, 8, 30, 98], [97, 1, 16, 11, 27, 86, 40, 83, 44, 70, 57, 48, 40, 39, 84, 3, 55, 1, 23, 67, 62, 34, 17, 48, 91, 53, 61, 87, 11, 15, 90], [11, 7, 47, 8, 5, 81, 87, 66, 91, 63, 21, 71, 90, 94, 12, 11, 54, 81, 10, 16, 15, 58, 79, 84, 4, 96, 22, 35, 14, 94, 31], [74, 70, 91, 11, 36, 74, 80, 24, 85, 40, 42, 87, 21, 96, 81, 51, 81, 55, 85, 4, 62, 87, 25, 96, 70, 14, 41, 57, 38, 62, 41], [45, 80, 96, 16, 19, 37, 85, 79, 61, 26, 94, 79, 64, 13, 91, 87, 34, 98, 23, 20, 54, 73, 58, 59, 20, 39, 78, 90, 91, 98, 93], [32, 41, 69, 68, 87, 21, 97, 24, 16, 32, 83, 26, 3, 99, 82, 7, 96, 88, 16, 53, 88, 4, 45, 32, 98, 83, 78, 58, 13, 22, 95], [44, 44, 30, 23, 12, 14, 36, 45, 72, 24, 3, 78, 51, 75, 55, 38, 92, 87, 82, 20, 97, 2, 26, 2, 67, 84, 74, 42, 85, 40, 9], [2, 28, 3, 16, 4, 23, 94, 77, 6, 74, 55, 81, 8, 73, 98, 81, 86, 64, 67, 41, 40, 93, 27, 39, 53, 40, 52, 37, 67, 19, 34], [78, 85, 66, 10, 52, 42, 60, 81, 2, 91, 1, 50, 36, 97, 22, 99, 98, 82, 36, 3, 44, 16, 11, 10, 51, 42, 85, 25, 99, 6, 44], [8, 34, 41, 1, 3, 52, 91, 77, 43, 47, 83, 19, 70, 47, 78, 5, 64, 45, 64, 45, 36, 9, 23, 32, 93, 45, 28, 52, 11, 19, 64], [65, 73, 57, 66, 4, 29, 4, 1, 92, 18, 13, 70, 49, 47, 86, 30, 27, 72, 28, 2, 20, 75, 78, 24, 77, 72, 44, 21, 22, 73, 58], [11, 80, 53, 9, 67, 52, 13, 1, 44, 75, 24, 5, 66, 81, 81, 20, 64, 15, 68, 54, 11, 23, 1, 42, 47, 68, 38, 2, 45, 27, 98], [77, 61, 82, 11, 69, 29, 25, 78, 54, 48, 46, 41, 41, 61, 11, 44, 32, 49, 6, 57, 6, 47, 63, 49, 22, 67, 19, 55, 34, 41, 7], [57, 16, 59, 38, 9, 77, 34, 46, 37, 43, 47, 6, 38, 61, 4, 5, 70, 60, 77, 88, 92, 77, 56, 82, 59, 7, 68, 31, 88, 86, 85], [48, 42, 90, 30, 51, 35, 62, 51, 87, 50, 30, 19, 96, 50, 54, 83, 86, 4, 12, 15, 15, 10, 61, 19, 53, 72, 57, 95, 9, 29, 7], [72, 17, 79, 16, 71, 83, 38, 89, 76, 96, 47, 10, 24, 50, 68, 43, 37, 45, 54, 43, 68, 37, 89, 41, 94, 1, 93, 16, 37, 37, 7], [40, 51, 64, 97, 22, 43, 62, 54, 27, 29, 16, 85, 11, 21, 9, 27, 86, 79, 23, 51, 93, 80, 3, 16, 8, 90, 42, 73, 35, 71, 72], [99, 48, 54, 36, 6, 71, 12, 59, 65, 50, 43, 43, 49, 89, 76, 55, 91, 87, 83, 85, 50, 21, 88, 13, 42, 15, 50, 1, 51, 34, 42], [62, 95, 32, 61, 93, 54, 74, 58, 85, 24, 27, 21, 18, 55, 68, 47, 54, 18, 73, 64, 49, 94, 35, 94, 39, 58, 57, 6, 78, 93, 96], [78, 20, 50, 9, 76, 14, 23, 48, 98, 80, 82, 56, 40, 97, 69, 39, 74, 86, 43, 97, 31, 70, 3, 4, 27, 89, 27, 47, 60, 36, 46], [61, 42, 7, 30, 50, 47, 93, 40, 5, 70, 58, 44, 71, 32, 79, 77, 82, 74, 40, 57, 11, 40, 47, 2, 91, 52, 72, 49, 59, 38, 16], [88, 87, 78, 27, 74, 28, 89, 66, 45, 33, 60, 50, 46, 35, 41, 58, 77, 55, 5, 5, 22, 34, 65, 59, 17, 51, 49, 9, 74, 15, 29], [53, 25, 85, 81, 91, 28, 23, 3, 33, 71, 69, 90, 17, 81, 67, 67, 34, 8, 45, 60, 56, 70, 22, 33, 50, 71, 83, 46, 52, 74, 87], [66, 21, 24, 48, 13, 64, 5, 18, 75, 37, 54, 32, 28, 86, 45, 28, 65, 70, 75, 42, 33, 16, 13, 21, 59, 47, 39, 88, 43, 27, 37]], 16",
"False"
],
[
"[[76, 7, 58], [20, 79, 65], [74, 14, 79]], 2",
"False"
],
[
"[[89, 95, 74, 37, 6, 6, 28, 78, 13, 13, 10, 80, 39, 99, 79, 23, 37, 8, 90, 60, 86, 5, 98, 27, 19, 43, 43, 35, 84, 55, 61, 47, 77, 56, 82, 18, 65, 96, 53, 89, 85, 91, 11, 1, 83, 96, 8, 19, 55], [16, 99, 66, 12, 93, 74, 62, 86, 98, 58, 21, 37, 5, 70, 32, 67, 10, 69, 88, 84, 62, 37, 95, 47, 81, 49, 24, 82, 26, 55, 7, 78, 41, 2, 30, 81, 20, 56, 74, 24, 12, 91, 15, 73, 82, 48, 61, 71, 28], [3, 16, 36, 4, 99, 9, 12, 74, 44, 66, 19, 13, 55, 97, 65, 92, 70, 3, 25, 52, 16, 43, 56, 68, 8, 80, 44, 38, 23, 6, 43, 44, 80, 80, 23, 16, 76, 9, 82, 9, 85, 58, 65, 59, 23, 69, 19, 35, 97], [55, 82, 40, 14, 84, 13, 53, 80, 95, 39, 99, 84, 65, 56, 40, 46, 77, 7, 45, 22, 7, 84, 52, 68, 70, 67, 3, 58, 67, 54, 9, 54, 80, 51, 16, 12, 20, 53, 31, 94, 21, 3, 21, 92, 28, 5, 71, 69, 73], [47, 85, 20, 38, 37, 58, 17, 42, 92, 95, 97, 32, 62, 96, 87, 21, 89, 33, 67, 6, 92, 66, 32, 64, 26, 62, 5, 11, 74, 79, 82, 49, 78, 92, 94, 62, 60, 77, 84, 2, 89, 59, 76, 25, 68, 42, 76, 71, 55], [38, 96, 43, 70, 53, 91, 99, 21, 20, 19, 33, 63, 68, 60, 19, 28, 22, 51, 88, 63, 62, 94, 29, 74, 32, 73, 25, 16, 15, 59, 48, 18, 23, 55, 42, 3, 71, 52, 11, 55, 88, 99, 25, 92, 76, 87, 81, 41, 37], [82, 55, 9, 99, 36, 57, 63, 82, 20, 85, 47, 20, 6, 73, 93, 29, 77, 91, 49, 6, 39, 32, 49, 43, 28, 45, 65, 50, 54, 51, 43, 64, 95, 30, 82, 93, 42, 38, 87, 86, 66, 69, 15, 61, 96, 6, 78, 24, 85], [14, 12, 55, 68, 44, 85, 81, 93, 51, 80, 82, 38, 41, 44, 75, 96, 92, 16, 98, 50, 94, 38, 86, 5, 9, 77, 39, 87, 27, 32, 64, 95, 33, 90, 18, 76, 67, 5, 78, 59, 76, 4, 16, 75, 48, 66, 77, 8, 44], [21, 26, 35, 15, 40, 30, 66, 80, 13, 1, 43, 28, 1, 40, 34, 13, 61, 66, 4, 89, 98, 13, 36, 96, 61, 58, 85, 90, 15, 93, 90, 85, 12, 76, 69, 61, 42, 90, 32, 2, 8, 91, 54, 8, 88, 13, 29, 13, 58], [63, 87, 47, 79, 88, 87, 74, 38, 69, 69, 95, 40, 1, 2, 29, 7, 93, 57, 55, 73, 36, 7, 92, 10, 80, 74, 39, 58, 90, 98, 98, 40, 14, 82, 1, 17, 49, 86, 16, 7, 15, 21, 66, 59, 48, 89, 73, 84, 50], [10, 52, 85, 68, 30, 34, 94, 78, 86, 65, 60, 8, 75, 65, 69, 57, 45, 49, 74, 62, 39, 77, 21, 53, 45, 97, 28, 53, 9, 75, 93, 71, 61, 27, 22, 95, 30, 92, 84, 15, 15, 53, 76, 81, 23, 70, 16, 91, 87], [65, 45, 7, 45, 39, 50, 49, 48, 49, 40, 39, 57, 82, 63, 56, 86, 2, 26, 96, 23, 18, 83, 88, 68, 60, 2, 94, 49, 38, 31, 40, 80, 53, 64, 33, 58, 50, 64, 3, 61, 82, 10, 66, 51, 94, 30, 25, 43, 88], [64, 59, 62, 99, 10, 64, 94, 60, 90, 99, 88, 20, 49, 99, 74, 27, 51, 57, 79, 79, 37, 99, 3, 29, 68, 47, 80, 69, 21, 42, 21, 2, 78, 69, 7, 75, 35, 30, 44, 46, 55, 1, 54, 80, 1, 63, 55, 86, 77], [27, 15, 81, 9, 69, 59, 23, 11, 24, 72, 98, 54, 31, 22, 14, 5, 17, 82, 83, 71, 90, 89, 82, 44, 79, 93, 49, 65, 4, 9, 36, 51, 32, 88, 18, 15, 20, 58, 40, 66, 89, 13, 91, 13, 62, 28, 46, 15, 93], [85, 44, 95, 23, 67, 99, 78, 66, 50, 13, 2, 76, 91, 34, 40, 69, 61, 25, 75, 77, 63, 28, 85, 56, 26, 27, 26, 15, 50, 6, 68, 4, 30, 77, 9, 42, 14, 92, 40, 3, 41, 93, 33, 79, 60, 64, 62, 79, 7], [76, 50, 39, 71, 47, 70, 26, 58, 73, 51, 88, 52, 94, 16, 48, 27, 33, 23, 45, 83, 83, 22, 42, 33, 10, 47, 96, 79, 39, 46, 72, 51, 25, 82, 15, 58, 59, 26, 41, 44, 85, 22, 98, 37, 14, 4, 24, 66, 63], [65, 66, 13, 27, 81, 17, 69, 88, 57, 72, 73, 18, 16, 51, 96, 40, 39, 56, 54, 44, 46, 32, 48, 61, 66, 38, 43, 4, 5, 58, 37, 26, 9, 15, 88, 88, 99, 89, 26, 63, 87, 70, 27, 54, 83, 31, 32, 2, 18], [28, 71, 87, 88, 92, 25, 39, 49, 4, 52, 83, 68, 57, 13, 65, 63, 98, 71, 25, 23, 30, 61, 7, 54, 17, 97, 60, 66, 38, 13, 52, 52, 32, 86, 9, 17, 82, 40, 91, 75, 54, 54, 28, 72, 50, 18, 13, 33, 15], [86, 38, 94, 6, 45, 59, 98, 83, 97, 78, 48, 41, 83, 79, 74, 55, 61, 2, 2, 85, 76, 10, 76, 39, 2, 65, 66, 87, 92, 81, 52, 85, 44, 34, 73, 81, 45, 32, 5, 78, 89, 86, 63, 69, 54, 38, 9, 61, 95], [21, 36, 1, 22, 87, 87, 15, 46, 65, 6, 40, 35, 81, 61, 23, 20, 28, 37, 82, 7, 49, 84, 24, 80, 13, 92, 7, 15, 87, 23, 95, 69, 91, 60, 10, 51, 64, 71, 56, 32, 23, 54, 73, 93, 91, 85, 70, 90, 84], [61, 79, 20, 53, 15, 29, 70, 80, 65, 62, 70, 16, 54, 97, 7, 60, 10, 53, 8, 85, 90, 37, 82, 4, 84, 83, 97, 23, 9, 38, 45, 45, 18, 46, 2, 48, 17, 16, 45, 48, 24, 95, 65, 92, 33, 4, 1, 33, 74], [62, 3, 45, 21, 64, 73, 57, 40, 62, 43, 88, 46, 72, 24, 24, 10, 99, 68, 57, 44, 73, 75, 48, 77, 27, 30, 46, 12, 60, 19, 68, 54, 34, 87, 90, 7, 82, 42, 68, 53, 8, 22, 26, 77, 63, 46, 81, 44, 62], [36, 41, 79, 82, 27, 70, 98, 41, 5, 57, 76, 29, 12, 25, 34, 75, 87, 24, 82, 63, 63, 10, 5, 95, 89, 53, 81, 28, 65, 45, 66, 49, 40, 66, 91, 8, 27, 17, 68, 44, 31, 5, 60, 89, 92, 19, 42, 23, 77], [17, 94, 58, 87, 49, 3, 77, 96, 45, 35, 2, 47, 3, 29, 74, 20, 34, 79, 40, 65, 90, 63, 56, 32, 66, 96, 41, 29, 84, 87, 51, 12, 44, 10, 83, 74, 83, 90, 88, 9, 29, 29, 92, 61, 64, 3, 87, 4, 55], [14, 77, 28, 63, 39, 64, 60, 20, 28, 96, 14, 77, 75, 58, 39, 58, 15, 73, 3, 5, 92, 42, 15, 3, 35, 7, 94, 24, 31, 78, 80, 4, 3, 99, 9, 68, 83, 88, 60, 11, 79, 36, 95, 72, 2, 50, 3, 67, 85], [62, 76, 14, 23, 77, 16, 81, 18, 13, 56, 90, 45, 40, 31, 81, 32, 1, 35, 36, 83, 92, 66, 29, 43, 29, 43, 19, 64, 92, 98, 31, 19, 96, 29, 73, 7, 58, 76, 60, 51, 95, 82, 92, 50, 21, 9, 34, 34, 47], [24, 80, 28, 46, 51, 99, 6, 63, 53, 64, 52, 60, 41, 11, 4, 14, 13, 15, 8, 88, 11, 99, 89, 23, 7, 69, 32, 92, 44, 3, 94, 44, 69, 51, 61, 51, 33, 20, 30, 44, 86, 86, 29, 21, 82, 53, 11, 10, 35], [26, 44, 4, 74, 57, 39, 80, 41, 94, 67, 98, 89, 36, 4, 74, 13, 70, 7, 28, 59, 37, 15, 30, 74, 12, 81, 30, 1, 36, 88, 21, 32, 63, 82, 13, 37, 44, 21, 18, 46, 47, 26, 5, 5, 31, 28, 77, 75, 65], [88, 13, 18, 24, 29, 28, 45, 86, 84, 11, 51, 59, 84, 13, 47, 88, 43, 24, 48, 63, 17, 69, 54, 94, 14, 15, 73, 78, 10, 22, 95, 13, 81, 65, 14, 44, 39, 35, 65, 27, 45, 57, 22, 34, 9, 50, 54, 58, 96], [62, 38, 84, 27, 64, 3, 11, 24, 29, 69, 97, 8, 19, 68, 99, 94, 69, 48, 40, 67, 16, 64, 8, 5, 99, 72, 25, 53, 49, 72, 21, 51, 46, 9, 64, 96, 77, 23, 60, 59, 8, 64, 99, 54, 92, 15, 52, 93, 51], [4, 34, 24, 21, 2, 7, 56, 75, 76, 68, 35, 26, 18, 64, 56, 80, 55, 12, 37, 52, 19, 15, 86, 84, 52, 77, 87, 95, 26, 45, 96, 21, 81, 93, 53, 29, 48, 86, 19, 54, 78, 87, 2, 32, 62, 97, 7, 98, 68], [87, 84, 22, 29, 3, 22, 84, 89, 98, 53, 93, 57, 10, 40, 20, 87, 11, 8, 93, 36, 25, 39, 98, 96, 62, 87, 21, 19, 25, 87, 83, 5, 83, 99, 12, 25, 5, 76, 27, 4, 83, 45, 47, 88, 28, 97, 35, 16, 12], [80, 75, 43, 28, 87, 81, 19, 75, 68, 74, 55, 83, 36, 62, 39, 41, 60, 86, 66, 59, 97, 40, 91, 19, 55, 46, 4, 83, 62, 25, 63, 70, 13, 86, 4, 2, 67, 30, 4, 48, 43, 93, 45, 97, 13, 47, 96, 28, 37], [28, 27, 89, 30, 6, 94, 9, 6, 29, 87, 70, 86, 66, 95, 53, 70, 5, 20, 12, 8, 58, 49, 64, 50, 97, 39, 40, 31, 3, 83, 72, 30, 95, 29, 70, 56, 66, 87, 63, 30, 53, 46, 9, 7, 63, 47, 44, 49, 79], [79, 85, 62, 59, 78, 75, 75, 84, 13, 30, 84, 43, 51, 8, 37, 97, 90, 64, 39, 8, 62, 82, 39, 14, 52, 82, 57, 21, 23, 4, 74, 43, 11, 84, 19, 65, 95, 2, 49, 69, 34, 4, 91, 39, 49, 3, 26, 41, 65], [16, 58, 35, 83, 16, 33, 31, 22, 61, 84, 64, 70, 35, 39, 3, 96, 13, 14, 41, 8, 19, 14, 75, 50, 99, 61, 36, 67, 89, 77, 80, 92, 45, 91, 74, 82, 72, 7, 22, 9, 60, 42, 59, 40, 29, 55, 64, 42, 29], [92, 21, 97, 63, 63, 90, 38, 79, 66, 12, 33, 79, 1, 97, 68, 28, 62, 78, 59, 49, 45, 76, 6, 20, 85, 16, 12, 52, 20, 58, 45, 97, 2, 34, 26, 33, 42, 94, 65, 8, 65, 10, 32, 51, 57, 40, 66, 31, 63], [68, 56, 12, 31, 23, 33, 8, 62, 80, 15, 41, 52, 26, 78, 12, 27, 95, 68, 30, 4, 54, 95, 34, 68, 84, 56, 18, 47, 72, 60, 59, 2, 73, 16, 86, 58, 12, 5, 39, 15, 72, 88, 19, 82, 85, 49, 39, 78, 15], [55, 67, 56, 45, 75, 57, 67, 94, 6, 70, 31, 22, 85, 38, 58, 70, 29, 56, 11, 48, 86, 60, 51, 39, 6, 30, 89, 1, 86, 9, 45, 8, 34, 80, 83, 8, 12, 43, 56, 31, 42, 33, 19, 91, 88, 92, 55, 4, 12], [87, 84, 28, 58, 48, 1, 75, 44, 63, 95, 38, 9, 6, 70, 52, 67, 96, 99, 16, 2, 36, 71, 35, 30, 45, 46, 93, 65, 1, 57, 71, 67, 31, 25, 47, 56, 88, 1, 95, 37, 75, 67, 12, 20, 30, 74, 64, 79, 85], [64, 18, 32, 19, 94, 33, 62, 22, 29, 88, 4, 50, 76, 4, 5, 83, 39, 57, 31, 7, 12, 10, 29, 85, 13, 87, 70, 31, 9, 51, 88, 16, 59, 58, 11, 36, 1, 21, 44, 37, 6, 14, 93, 1, 8, 44, 83, 87, 75], [27, 36, 42, 20, 8, 46, 52, 26, 35, 60, 3, 4, 93, 62, 64, 50, 92, 19, 43, 92, 82, 14, 14, 54, 29, 3, 98, 73, 5, 93, 5, 45, 64, 64, 43, 43, 51, 13, 90, 73, 68, 95, 69, 7, 92, 78, 88, 42, 5], [47, 48, 98, 92, 47, 8, 21, 88, 24, 13, 15, 89, 53, 92, 72, 31, 71, 51, 47, 39, 81, 57, 50, 57, 35, 86, 7, 53, 10, 92, 39, 58, 93, 35, 59, 22, 9, 8, 94, 94, 58, 95, 22, 95, 40, 28, 46, 69, 81], [52, 11, 22, 47, 89, 13, 45, 75, 69, 78, 22, 67, 35, 32, 38, 58, 40, 88, 92, 21, 49, 97, 92, 39, 61, 10, 40, 58, 89, 45, 17, 68, 10, 62, 89, 32, 72, 42, 45, 76, 21, 27, 30, 74, 85, 1, 9, 3, 53], [42, 19, 6, 7, 43, 80, 36, 68, 82, 96, 96, 82, 39, 43, 37, 28, 50, 39, 2, 37, 66, 19, 69, 44, 13, 22, 7, 2, 62, 78, 89, 90, 5, 20, 54, 76, 63, 36, 95, 81, 16, 57, 64, 10, 99, 97, 99, 51, 27], [7, 91, 41, 76, 97, 13, 66, 3, 11, 5, 60, 2, 92, 77, 99, 64, 13, 54, 12, 18, 18, 17, 39, 86, 13, 45, 19, 88, 19, 21, 24, 30, 92, 48, 35, 59, 17, 48, 98, 55, 9, 77, 14, 26, 52, 85, 44, 84, 11], [51, 42, 62, 35, 64, 95, 18, 14, 49, 69, 17, 21, 14, 3, 31, 89, 47, 44, 17, 90, 81, 56, 83, 27, 71, 90, 69, 2, 80, 62, 75, 87, 99, 6, 65, 97, 18, 55, 67, 57, 19, 74, 84, 11, 96, 84, 55, 96, 37], [86, 4, 13, 70, 93, 58, 2, 60, 89, 32, 63, 60, 26, 90, 22, 74, 87, 4, 16, 63, 42, 33, 13, 46, 13, 33, 14, 8, 90, 86, 46, 1, 59, 60, 49, 80, 93, 61, 23, 5, 85, 50, 36, 20, 43, 8, 90, 41, 25], [7, 86, 61, 33, 69, 38, 12, 44, 53, 14, 71, 92, 52, 52, 46, 80, 41, 2, 49, 95, 78, 28, 32, 92, 76, 77, 22, 42, 29, 94, 79, 68, 33, 46, 9, 38, 80, 26, 43, 53, 27, 11, 26, 78, 57, 1, 11, 30, 88]], 41",
"False"
],
[
"[[4, 86, 72, 80, 33, 33, 74, 66, 4, 87, 51, 27, 33, 97, 84, 77, 75, 83, 32, 67, 77, 28, 86, 57, 19, 31, 84, 53, 88, 32, 9, 51, 83, 23, 25, 97, 46, 44, 66, 67, 28, 99, 78, 24, 56, 50, 3, 23, 34], [9, 82, 59, 66, 22, 35, 31, 90, 78, 48, 53, 92, 75, 32, 85, 87, 88, 12, 62, 3, 6, 12, 53, 20, 6, 84, 14, 56, 41, 49, 65, 84, 86, 95, 31, 28, 12, 16, 97, 35, 44, 68, 10, 98, 3, 31, 52, 95, 65], [5, 5, 66, 15, 65, 21, 71, 11, 90, 42, 66, 94, 61, 60, 14, 5, 31, 48, 32, 57, 34, 74, 95, 27, 82, 5, 17, 75, 69, 56, 38, 54, 48, 85, 88, 94, 80, 49, 41, 22, 57, 66, 19, 2, 75, 33, 73, 59, 89], [6, 11, 27, 72, 45, 31, 91, 63, 44, 41, 47, 69, 79, 2, 15, 95, 20, 3, 39, 74, 90, 10, 40, 13, 85, 98, 44, 32, 73, 30, 1, 53, 76, 44, 35, 88, 40, 45, 60, 63, 10, 47, 24, 57, 18, 57, 72, 46, 43], [77, 16, 14, 9, 73, 69, 61, 11, 19, 64, 38, 10, 16, 93, 69, 82, 42, 44, 53, 35, 36, 22, 24, 76, 12, 35, 50, 83, 78, 87, 40, 22, 47, 75, 66, 10, 43, 69, 94, 85, 97, 25, 47, 7, 28, 80, 45, 67, 83], [12, 83, 11, 3, 61, 66, 56, 26, 86, 81, 34, 55, 79, 76, 16, 80, 39, 6, 72, 52, 25, 56, 83, 19, 76, 73, 93, 27, 5, 26, 30, 78, 97, 35, 75, 53, 68, 33, 70, 28, 74, 36, 49, 90, 94, 86, 53, 69, 2], [97, 80, 71, 64, 21, 35, 46, 86, 48, 22, 6, 33, 39, 43, 25, 18, 41, 35, 24, 55, 40, 87, 97, 29, 10, 79, 10, 90, 64, 29, 98, 18, 2, 25, 85, 51, 95, 22, 9, 91, 89, 89, 91, 74, 94, 4, 21, 30, 33], [43, 90, 2, 87, 31, 4, 47, 84, 89, 45, 65, 66, 6, 7, 51, 68, 18, 41, 69, 25, 56, 1, 98, 55, 3, 54, 81, 32, 88, 2, 65, 98, 8, 58, 53, 44, 73, 28, 19, 56, 20, 71, 56, 35, 19, 81, 63, 82, 7], [27, 39, 30, 23, 84, 23, 90, 47, 78, 48, 95, 91, 63, 9, 23, 63, 74, 47, 87, 74, 66, 37, 38, 1, 48, 82, 35, 71, 86, 53, 25, 42, 23, 9, 27, 75, 51, 91, 92, 57, 82, 36, 34, 13, 55, 46, 52, 94, 28], [86, 88, 30, 45, 38, 20, 70, 97, 47, 59, 79, 79, 96, 14, 42, 61, 59, 8, 57, 22, 84, 88, 21, 28, 49, 23, 88, 54, 23, 68, 46, 68, 94, 28, 95, 97, 50, 83, 63, 10, 89, 37, 13, 70, 30, 87, 80, 72, 80], [11, 1, 86, 18, 11, 84, 10, 48, 61, 10, 60, 22, 75, 99, 9, 15, 83, 37, 70, 44, 69, 3, 10, 77, 4, 56, 40, 33, 98, 33, 60, 21, 69, 45, 57, 77, 40, 81, 64, 10, 74, 66, 85, 65, 30, 82, 35, 53, 39], [22, 67, 70, 80, 67, 75, 17, 19, 60, 72, 78, 90, 89, 51, 48, 57, 10, 32, 79, 68, 28, 4, 61, 77, 12, 15, 29, 87, 13, 38, 58, 35, 40, 76, 94, 5, 2, 30, 99, 10, 73, 81, 38, 59, 94, 35, 71, 12, 42], [98, 49, 67, 33, 13, 75, 20, 95, 33, 34, 50, 50, 9, 7, 9, 26, 2, 5, 66, 10, 31, 33, 6, 14, 78, 15, 97, 95, 81, 43, 79, 20, 21, 64, 29, 59, 73, 64, 93, 44, 34, 47, 9, 60, 30, 17, 52, 59, 4], [40, 96, 96, 7, 38, 32, 69, 67, 56, 20, 64, 17, 16, 11, 13, 18, 14, 34, 76, 86, 85, 26, 42, 61, 39, 2, 57, 50, 16, 62, 98, 11, 83, 63, 30, 54, 71, 27, 86, 64, 81, 79, 9, 76, 72, 2, 49, 48, 55], [80, 67, 31, 26, 66, 30, 77, 78, 1, 96, 70, 22, 75, 87, 54, 14, 14, 84, 71, 19, 26, 59, 22, 6, 63, 77, 74, 54, 19, 95, 10, 37, 77, 17, 55, 5, 21, 39, 20, 71, 15, 79, 53, 87, 33, 44, 66, 50, 32], [79, 71, 73, 55, 28, 86, 3, 53, 42, 2, 22, 25, 89, 32, 7, 62, 31, 63, 37, 68, 97, 79, 9, 70, 46, 95, 34, 60, 13, 36, 96, 86, 48, 93, 75, 6, 5, 65, 50, 74, 74, 24, 7, 86, 58, 21, 86, 33, 44], [25, 95, 80, 15, 29, 83, 52, 17, 90, 36, 35, 40, 23, 73, 34, 58, 82, 80, 61, 96, 28, 60, 32, 58, 82, 44, 34, 93, 21, 1, 55, 80, 49, 97, 21, 99, 55, 27, 20, 95, 16, 78, 48, 32, 32, 53, 53, 2, 57], [22, 52, 81, 96, 81, 58, 34, 71, 93, 17, 88, 72, 23, 33, 29, 19, 69, 37, 87, 26, 24, 54, 21, 97, 90, 10, 42, 29, 57, 35, 28, 12, 58, 44, 7, 16, 84, 93, 35, 92, 7, 86, 14, 59, 62, 74, 66, 22, 16], [99, 75, 43, 97, 98, 97, 83, 20, 10, 19, 12, 10, 71, 56, 11, 80, 97, 61, 38, 17, 54, 45, 25, 31, 65, 39, 20, 73, 43, 66, 1, 55, 51, 5, 12, 14, 60, 96, 40, 9, 42, 42, 33, 25, 78, 9, 91, 44, 83], [58, 25, 32, 22, 93, 55, 92, 61, 57, 77, 61, 92, 67, 94, 75, 2, 57, 73, 33, 90, 63, 16, 89, 1, 85, 64, 84, 69, 17, 40, 1, 13, 18, 68, 14, 5, 62, 33, 26, 61, 68, 30, 62, 62, 81, 92, 70, 57, 91], [36, 7, 65, 74, 77, 41, 32, 14, 33, 30, 73, 6, 10, 75, 20, 89, 12, 22, 76, 14, 48, 54, 36, 61, 55, 14, 2, 2, 61, 6, 25, 67, 23, 73, 95, 28, 25, 99, 65, 66, 79, 43, 40, 80, 23, 49, 99, 8, 7], [21, 35, 97, 99, 82, 61, 83, 74, 68, 30, 97, 68, 9, 17, 43, 88, 57, 13, 57, 26, 61, 62, 19, 81, 30, 90, 13, 49, 82, 85, 98, 51, 9, 94, 29, 93, 83, 8, 81, 76, 15, 69, 34, 52, 50, 67, 5, 98, 9], [88, 5, 27, 84, 47, 62, 45, 66, 23, 98, 61, 93, 43, 35, 30, 67, 10, 56, 34, 65, 6, 70, 43, 16, 63, 65, 5, 25, 27, 42, 55, 26, 16, 90, 28, 92, 30, 77, 89, 45, 19, 13, 75, 23, 14, 74, 98, 23, 40], [64, 85, 59, 20, 32, 78, 24, 46, 18, 94, 92, 48, 14, 54, 21, 98, 5, 31, 67, 87, 59, 44, 64, 94, 42, 94, 38, 7, 59, 69, 70, 49, 78, 11, 2, 95, 27, 16, 64, 66, 49, 90, 16, 73, 52, 73, 5, 36, 7], [61, 96, 29, 67, 30, 40, 31, 48, 91, 6, 62, 29, 9, 54, 84, 11, 19, 74, 5, 87, 70, 95, 18, 21, 15, 59, 95, 74, 6, 24, 97, 60, 28, 92, 74, 23, 79, 46, 37, 14, 48, 78, 71, 36, 82, 60, 54, 79, 63], [97, 48, 22, 43, 41, 17, 63, 90, 79, 18, 72, 3, 54, 14, 34, 97, 1, 48, 99, 10, 83, 11, 99, 66, 3, 15, 59, 64, 47, 92, 2, 30, 38, 5, 6, 5, 12, 4, 24, 25, 26, 55, 46, 46, 43, 60, 33, 21, 87], [37, 12, 21, 13, 33, 70, 76, 61, 30, 37, 82, 16, 45, 71, 1, 53, 28, 53, 44, 67, 39, 10, 51, 14, 79, 6, 39, 80, 82, 99, 48, 25, 97, 33, 83, 75, 67, 65, 40, 25, 57, 32, 46, 4, 23, 80, 75, 22, 33], [41, 62, 38, 56, 63, 77, 85, 76, 55, 51, 90, 65, 57, 86, 27, 57, 55, 96, 72, 98, 82, 4, 65, 56, 53, 44, 16, 94, 23, 31, 28, 50, 16, 41, 9, 2, 43, 66, 96, 80, 77, 49, 91, 95, 97, 21, 19, 57, 77], [60, 19, 99, 64, 35, 33, 67, 85, 87, 48, 60, 45, 75, 68, 68, 15, 92, 72, 88, 98, 15, 23, 60, 91, 14, 2, 99, 43, 71, 16, 86, 28, 32, 71, 86, 2, 72, 7, 38, 48, 85, 86, 99, 82, 73, 2, 42, 42, 81], [20, 6, 11, 69, 74, 87, 97, 40, 36, 51, 47, 98, 17, 26, 53, 48, 27, 46, 67, 19, 72, 81, 65, 71, 36, 67, 83, 42, 91, 67, 98, 69, 49, 37, 46, 80, 56, 63, 78, 30, 96, 63, 76, 91, 26, 93, 23, 86, 20], [46, 80, 31, 67, 21, 51, 39, 63, 69, 20, 23, 96, 42, 73, 3, 27, 91, 74, 80, 24, 87, 9, 2, 6, 99, 71, 79, 21, 87, 29, 13, 69, 42, 1, 20, 43, 1, 99, 40, 7, 35, 52, 34, 50, 69, 29, 91, 71, 1], [73, 58, 65, 91, 17, 62, 96, 94, 79, 42, 28, 3, 92, 5, 66, 54, 38, 80, 44, 81, 76, 90, 57, 71, 24, 80, 82, 59, 8, 91, 90, 95, 82, 2, 41, 87, 56, 48, 22, 97, 18, 79, 41, 67, 48, 23, 2, 4, 26], [19, 49, 74, 86, 53, 6, 62, 1, 16, 52, 7, 88, 35, 78, 68, 15, 57, 23, 83, 78, 91, 86, 11, 4, 58, 96, 40, 58, 88, 98, 67, 38, 2, 87, 40, 84, 56, 72, 35, 49, 67, 96, 95, 44, 31, 65, 76, 18, 88], [36, 62, 29, 89, 23, 3, 30, 81, 45, 49, 94, 19, 64, 5, 56, 34, 73, 48, 26, 5, 88, 31, 24, 85, 22, 22, 85, 57, 30, 47, 74, 67, 39, 93, 89, 66, 77, 91, 29, 14, 4, 72, 5, 44, 91, 24, 98, 28, 24], [5, 13, 82, 55, 81, 30, 83, 86, 49, 82, 90, 15, 92, 30, 28, 84, 4, 68, 15, 34, 75, 87, 99, 43, 99, 75, 61, 63, 2, 52, 52, 15, 40, 28, 95, 96, 98, 55, 50, 22, 29, 72, 86, 12, 87, 38, 2, 12, 55], [85, 12, 95, 9, 79, 32, 73, 88, 8, 28, 56, 82, 36, 37, 32, 85, 39, 49, 93, 18, 23, 33, 73, 51, 43, 4, 80, 67, 72, 80, 2, 45, 83, 88, 80, 40, 2, 32, 1, 18, 64, 32, 9, 55, 67, 24, 11, 28, 16], [93, 12, 68, 90, 4, 75, 66, 31, 56, 50, 67, 89, 98, 1, 69, 39, 52, 95, 36, 67, 12, 61, 80, 72, 11, 14, 91, 82, 54, 8, 33, 4, 30, 84, 94, 91, 89, 54, 6, 5, 78, 51, 14, 34, 41, 89, 39, 18, 20], [8, 26, 85, 27, 32, 42, 50, 81, 49, 65, 63, 27, 75, 35, 38, 38, 42, 42, 49, 57, 54, 10, 60, 40, 1, 86, 64, 81, 12, 57, 77, 89, 26, 40, 43, 97, 72, 13, 90, 56, 17, 88, 24, 76, 95, 58, 80, 61, 80], [94, 28, 67, 97, 51, 88, 94, 92, 39, 66, 77, 74, 40, 13, 19, 6, 18, 9, 81, 68, 54, 50, 70, 11, 55, 42, 90, 11, 72, 67, 2, 82, 66, 26, 76, 37, 90, 36, 16, 78, 66, 21, 7, 11, 56, 44, 54, 93, 57], [58, 37, 48, 62, 39, 92, 64, 68, 68, 27, 70, 98, 82, 60, 44, 30, 97, 58, 84, 36, 5, 99, 19, 12, 90, 60, 83, 11, 53, 20, 73, 84, 27, 58, 5, 74, 9, 89, 77, 32, 72, 54, 45, 27, 86, 28, 18, 87, 31], [41, 34, 7, 5, 21, 6, 45, 35, 87, 3, 33, 38, 87, 80, 89, 16, 89, 71, 8, 3, 69, 19, 7, 86, 90, 50, 89, 6, 5, 61, 86, 95, 58, 22, 57, 75, 32, 17, 58, 41, 22, 80, 42, 79, 8, 46, 48, 3, 77], [30, 28, 73, 76, 25, 37, 85, 51, 39, 83, 72, 67, 86, 1, 38, 52, 63, 52, 83, 85, 60, 13, 91, 17, 84, 30, 38, 11, 27, 38, 28, 26, 33, 32, 54, 25, 24, 40, 27, 46, 86, 84, 97, 69, 93, 69, 39, 81, 29], [75, 86, 31, 65, 15, 83, 74, 9, 13, 45, 90, 6, 44, 2, 29, 48, 12, 87, 67, 50, 11, 5, 45, 74, 47, 6, 80, 95, 87, 94, 84, 89, 99, 69, 63, 67, 47, 34, 12, 27, 69, 86, 68, 28, 71, 45, 98, 2, 9], [79, 31, 36, 15, 97, 62, 31, 27, 2, 73, 43, 1, 83, 9, 60, 2, 58, 65, 12, 55, 90, 10, 65, 65, 61, 95, 75, 69, 35, 11, 68, 38, 39, 21, 36, 92, 72, 20, 43, 21, 35, 64, 32, 36, 69, 52, 4, 7, 98], [84, 71, 24, 21, 57, 73, 19, 84, 28, 32, 34, 16, 38, 81, 75, 4, 56, 40, 50, 40, 82, 49, 48, 6, 96, 5, 79, 45, 16, 17, 59, 56, 79, 35, 8, 99, 61, 27, 78, 87, 20, 57, 70, 88, 23, 76, 2, 27, 32], [93, 50, 64, 40, 33, 29, 33, 17, 74, 65, 43, 63, 81, 92, 58, 91, 43, 37, 46, 25, 98, 67, 93, 99, 51, 74, 38, 38, 1, 54, 65, 96, 22, 61, 58, 54, 19, 99, 70, 34, 79, 44, 67, 52, 22, 29, 14, 94, 62], [15, 93, 14, 67, 22, 97, 87, 7, 84, 7, 17, 32, 79, 77, 56, 62, 58, 58, 3, 89, 96, 80, 1, 67, 20, 92, 86, 62, 56, 53, 65, 56, 78, 45, 79, 96, 18, 48, 38, 22, 80, 75, 71, 73, 1, 42, 72, 75, 69], [29, 6, 56, 12, 39, 71, 12, 33, 83, 53, 19, 58, 85, 83, 43, 73, 45, 86, 19, 37, 11, 56, 25, 99, 69, 45, 62, 95, 14, 77, 34, 98, 82, 60, 64, 70, 51, 42, 21, 5, 66, 70, 61, 8, 66, 87, 62, 20, 4], [15, 94, 56, 20, 24, 9, 21, 41, 13, 5, 64, 46, 78, 71, 70, 59, 76, 51, 16, 51, 96, 42, 11, 68, 93, 52, 98, 73, 10, 72, 63, 36, 96, 45, 6, 6, 91, 66, 73, 64, 38, 69, 98, 61, 78, 74, 63, 71, 20]], 34",
"False"
],
[
"[[64, 81, 37, 36, 97, 10, 34, 45, 63, 13, 25, 44, 97], [74, 24, 69, 74, 47, 91, 50, 36, 33, 92, 3, 31, 60], [29, 44, 45, 42, 21, 32, 28, 85, 47, 99, 94, 47, 17], [29, 48, 2, 33, 63, 68, 39, 89, 5, 68, 52, 52, 29], [37, 8, 20, 41, 70, 36, 32, 5, 20, 68, 22, 97, 31], [41, 93, 5, 10, 75, 37, 56, 86, 24, 85, 16, 2, 15], [41, 63, 49, 26, 94, 66, 29, 70, 60, 65, 40, 11, 52], [87, 90, 95, 79, 73, 64, 98, 81, 99, 3, 11, 28, 62], [48, 28, 46, 64, 55, 83, 2, 96, 75, 16, 11, 3, 55], [42, 29, 69, 92, 31, 77, 25, 6, 60, 67, 22, 41, 53], [60, 39, 55, 96, 30, 71, 89, 2, 8, 63, 59, 97, 28], [74, 38, 18, 62, 77, 85, 97, 23, 65, 40, 60, 85, 5], [99, 18, 38, 29, 26, 60, 36, 82, 29, 31, 63, 13, 94]], 12",
"False"
]
] | f_gold | CENTER_ELEMENT_OF_MATRIX_EQUALS_SUMS_OF_HALF_DIAGONALS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CENTER_ELEMENT_OF_MATRIX_EQUALS_SUMS_OF_HALF_DIAGONALS{
static boolean f_gold ( int mat [ ] [ ] , int n ) {
int diag1_left = 0 , diag1_right = 0 ;
int diag2_left = 0 , diag2_right = 0 ;
for ( int i = 0 , j = n - 1 ;
i < n ;
i ++ , j -- ) {
if ( i < n / 2 ) {
diag1_left += mat [ i ] [ i ] ;
diag2_left += mat [ j ] [ i ] ;
}
else if ( i > n / 2 ) {
diag1_right += mat [ i ] [ i ] ;
diag2_right += mat [ j ] [ i ] ;
}
}
return ( diag1_left == diag2_right && diag2_right == diag2_left && diag1_right == diag2_left && diag2_right == mat [ n / 2 ] [ n / 2 ] ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( A , B , n ) :
sorted ( A )
sorted ( B )
result = 0
for i in range ( n ) :
result += ( A [ i ] * B [ n - i - 1 ] )
return result
| java | [
[
"[31, 85], [18, 33], 1",
"558"
],
[
"[22, -6, 84, 70, 84, 6, 28, -74, -14, 68, 22, 90, -10], [2, -48, -36, -4, -22, -98, -74, -92, -72, -4, 48, -32, 94], 6",
"-8900"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 14",
"1"
],
[
"[12, 33, 93, 2, 83, 9, 61, 84, 9, 69, 2], [85, 92, 92, 1, 54, 31, 69, 4, 39, 81, 52], 7",
"20524"
],
[
"[-92, -88, -84, -78, -78, -76, -66, -54, -52, -48, -46, -44, -40, -34, -32, -24, -20, -14, -6, -4, 2, 6, 10, 10, 22, 26, 32, 36, 36, 40, 46, 48, 56, 58, 64, 76, 80, 80, 80, 84, 84, 84, 92], [-98, -90, -82, -80, -76, -66, -62, -62, -62, -50, -50, -50, -32, -30, -14, -12, 4, 6, 12, 14, 16, 30, 30, 30, 32, 34, 40, 42, 50, 52, 56, 58, 60, 62, 62, 64, 66, 68, 78, 82, 86, 90, 94], 26",
"-14428"
],
[
"[1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0], [0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1], 32",
"8"
],
[
"[4, 6, 6, 20, 22, 23, 26, 39, 40, 47, 50, 68, 68, 70, 73, 77, 80, 82, 85], [2, 3, 15, 21, 22, 26, 35, 37, 37, 38, 57, 59, 62, 63, 64, 76, 81, 85, 91], 17",
"19298"
],
[
"[78, 60, -8, 46, -12], [-72, -80, -30, 16, -38], 2",
"-10560"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], 17",
"0"
],
[
"[60, 66, 84, 99, 85, 89, 28, 97, 85, 71, 53, 93, 23, 9, 45, 26, 49, 95, 64, 33, 70, 34, 10, 1, 68, 39, 53, 12], [37, 33, 33, 77, 78, 34, 28, 1, 63, 15, 51, 50, 90, 22, 71, 23, 68, 55, 2, 22, 31, 54, 76, 36, 2, 27, 96, 89], 15",
"44563"
]
] | f_gold | MINIMIZE_SUM_PRODUCT_TWO_ARRAYS_PERMUTATIONS_ALLOWED | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMIZE_SUM_PRODUCT_TWO_ARRAYS_PERMUTATIONS_ALLOWED{
static int f_gold ( int A [ ] , int B [ ] , int n ) {
Arrays . sort ( A ) ;
Arrays . sort ( B ) ;
int result = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) result += ( A [ i ] * B [ n - i - 1 ] ) ;
return result ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n , k ) :
max1 = max ( arr )
res = 0
for i in range ( 0 , n ) :
if ( ( max1 - arr [ i ] ) % k != 0 ) :
return - 1
else :
res += ( max1 - arr [ i ] ) / k
return int ( res )
| java | [
[
"[4, 7, 19, 16], 4, 3",
"10"
],
[
"[4, 4, 4, 4, 4], 5, 3",
"0"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 39, 1",
"24"
],
[
"[85, 36, 52, 8, 52, 15, 16], 5, 6",
"-1"
],
[
"[-10, -5, -5, -20, 10, 30], 6, 5",
"36"
],
[
"[0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0], 10, 15",
"-1"
],
[
"[1, 5, 5, 9, 11, 12, 12, 13, 13, 14, 16, 18, 26, 26, 28, 28, 30, 31, 32, 37, 37, 38, 40, 43, 44, 45, 47, 47, 55, 58, 60, 62, 63, 64, 69, 78, 83, 84, 92, 96, 96, 99], 26, 33",
"-1"
],
[
"[76, -78, 92, -98, 16, 44, 86, 96, -8, 2, -96, 74, -28, 12, 54, -40, -64, -12, 4, 48, 68, -82, 8, 0, -4, 88, 48, -54, 90, 62, -84, 76, -48, 62, -80, -94, 38, -4, 36], 34, 3",
"-1"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 39, 10",
"-1"
],
[
"[62, 99, 29, 23, 55, 30, 79, 63, 1, 88, 59, 8, 11, 80, 23, 51, 97, 32, 80, 48, 84, 36, 73, 59, 1, 34, 92, 10], 18, 1",
"892"
]
] | f_gold | MINIMUM_INCREMENT_K_OPERATIONS_MAKE_ELEMENTS_EQUAL | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_INCREMENT_K_OPERATIONS_MAKE_ELEMENTS_EQUAL{
static int f_gold ( int arr [ ] , int n , int k ) {
Arrays . sort ( arr ) ;
int max = arr [ arr . length - 1 ] ;
int res = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( ( max - arr [ i ] ) % k != 0 ) return - 1 ;
else res += ( max - arr [ i ] ) / k ;
}
return res ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
if ( n == 0 or n == 1 ) :
return n
return max ( ( f_gold ( n // 2 ) + f_gold ( n // 3 ) + f_gold ( n // 4 ) ) , n )
| java | [
[
"39",
"41"
],
[
"79",
"87"
],
[
"7",
"7"
],
[
"76",
"87"
],
[
"48",
"57"
],
[
"18",
"19"
],
[
"58",
"63"
],
[
"17",
"17"
],
[
"36",
"41"
],
[
"5",
"5"
]
] | f_gold | RECURSIVELY_BREAK_NUMBER_3_PARTS_GET_MAXIMUM_SUM | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class RECURSIVELY_BREAK_NUMBER_3_PARTS_GET_MAXIMUM_SUM{
static int f_gold ( int n ) {
if ( n == 0 || n == 1 ) return n ;
return Math . max ( ( f_gold ( n / 2 ) + f_gold ( n / 3 ) + f_gold ( n / 4 ) ) , n ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n ) :
fw = [ 0 for k in range ( n ) ]
bw = [ 0 for k in range ( n ) ]
cur_max , max_so_far = arr [ 0 ] , arr [ 0 ]
for i in range ( n ) :
cur_max = max ( arr [ i ] , cur_max + arr [ i ] )
max_so_far = max ( max_so_far , cur_max )
fw [ i ] = cur_max
cur_max = max_so_far = bw [ n - 1 ] = arr [ n - 1 ]
i = n - 2
while i >= 0 :
cur_max = max ( arr [ i ] , cur_max + arr [ i ] )
max_so_far = max ( max_so_far , cur_max )
bw [ i ] = cur_max
i -= 1
fans = max_so_far
for i in range ( 1 , n - 1 ) :
fans = max ( fans , fw [ i - 1 ] + bw [ i + 1 ] )
return fans
| java | [
[
"[2, 8, 14, 17, 19, 35, 38, 45, 50, 53, 55, 70, 82, 88, 92, 96], 13",
"488"
],
[
"[-64, -56, -80, -82, 72, 62, -8, 48, -96, 34, 64, -38, -60, 80, 4, -64, -62, 34, 94, -16, 38, 62, -84, 48, 42, -40], 22",
"344"
],
[
"[0, 0, 0, 0, 1, 1, 1], 6",
"2"
],
[
"[3, 7, 50, 53, 72, 14, 18, 74, 27, 65, 41, 20, 54, 17, 87, 40, 63, 15, 47], 11",
"424"
],
[
"[-96, -96, -94, -80, -74, -74, -74, -74, -70, -64, -60, -58, -52, -52, -44, -42, -40, -38, -36, -34, -30, -14, -12, -8, -2, 6, 12, 16, 24, 24, 48, 48, 66, 76, 76, 84, 90], 32",
"178"
],
[
"[1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0], 8",
"7"
],
[
"[4, 4, 5, 9, 11, 13, 13, 15, 16, 21, 23, 25, 27, 30, 31, 35, 35, 43, 43, 47, 49, 50, 52, 54, 55, 55, 57, 57, 57, 59, 62, 64, 66, 68, 69, 71, 73, 76, 80, 84, 88, 88, 90, 90, 97, 97, 99], 34",
"1255"
],
[
"[-86, -60, 4, 14, 6, -6, -50, 46, -50, -62, -56, 16, -76, 90, 40, 2, 36, 48, -26, 34, 78, 84, 2, -54, 94, 60, -26, 60, 84, 2, -98, 2, -74], 25",
"482"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1], 9",
"1"
],
[
"[36, 99, 27, 8, 90, 74, 67, 77, 49, 23, 43, 25, 68, 56, 85, 6], 12",
"646"
]
] | f_gold | MAXIMUM_SUM_SUBARRAY_REMOVING_ONE_ELEMENT | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_SUM_SUBARRAY_REMOVING_ONE_ELEMENT{
static int f_gold ( int arr [ ] , int n ) {
int fw [ ] = new int [ n ] ;
int bw [ ] = new int [ n ] ;
int cur_max = arr [ 0 ] , max_so_far = arr [ 0 ] ;
fw [ 0 ] = arr [ 0 ] ;
for ( int i = 1 ;
i < n ;
i ++ ) {
cur_max = Math . max ( arr [ i ] , cur_max + arr [ i ] ) ;
max_so_far = Math . max ( max_so_far , cur_max ) ;
fw [ i ] = cur_max ;
}
cur_max = max_so_far = bw [ n - 1 ] = arr [ n - 1 ] ;
for ( int i = n - 2 ;
i >= 0 ;
i -- ) {
cur_max = Math . max ( arr [ i ] , cur_max + arr [ i ] ) ;
max_so_far = Math . max ( max_so_far , cur_max ) ;
bw [ i ] = cur_max ;
}
int fans = max_so_far ;
for ( int i = 1 ;
i < n - 1 ;
i ++ ) fans = Math . max ( fans , fw [ i - 1 ] + bw [ i + 1 ] ) ;
return fans ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
while ( int ( n / 100 ) ) :
last_digit = int ( n % 10 )
n = int ( n / 10 )
n += last_digit * 3
return ( n % 29 == 0 )
| java | [
[
"29",
"True"
],
[
"0",
"True"
],
[
"65",
"False"
],
[
"1419",
"False"
],
[
"54",
"False"
],
[
"7",
"False"
],
[
"44",
"False"
],
[
"34",
"False"
],
[
"1160",
"True"
],
[
"292929002929",
"True"
]
] | f_gold | NUMBER_IS_DIVISIBLE_BY_29_OR_NOT | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_IS_DIVISIBLE_BY_29_OR_NOT{
static boolean f_gold ( long n ) {
while ( n / 100 > 0 ) {
int last_digit = ( int ) n % 10 ;
n /= 10 ;
n += last_digit * 3 ;
}
return ( n % 29 == 0 ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a , n ) :
if ( n == 1 ) :
return a [ 0 ]
max_neg = float ( '-inf' )
min_pos = float ( 'inf' )
count_neg = 0
count_zero = 0
prod = 1
for i in range ( 0 , n ) :
if ( a [ i ] == 0 ) :
count_zero = count_zero + 1
continue
if ( a [ i ] < 0 ) :
count_neg = count_neg + 1
max_neg = max ( max_neg , a [ i ] )
if ( a [ i ] > 0 ) :
min_pos = min ( min_pos , a [ i ] )
prod = prod * a [ i ]
if ( count_zero == n or ( count_neg == 0 and count_zero > 0 ) ) :
return 0 ;
if ( count_neg == 0 ) :
return min_pos
if ( ( count_neg & 1 ) == 0 and count_neg != 0 ) :
prod = int ( prod / max_neg )
return prod ;
| java | [
[
"[3, 6, 7, 8, 8, 9, 12, 12, 12, 13, 15, 15, 15, 16, 18, 18, 18, 19, 20, 21, 22, 22, 23, 28, 29, 30, 30, 33, 33, 35, 35, 36, 40, 43, 58, 63, 73, 78, 82, 83, 84, 87, 89, 89, 92, 94], 23",
"3"
],
[
"[18, -6, -8, 98, 66, -86, 24, 6, 58, 74, 82], 10",
"-297032800813056"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 25",
"0"
],
[
"[97, 79, 93, 41, 76, 34, 94, 57, 63, 98, 52, 62, 96, 7, 63, 44, 55, 43, 36, 66, 35, 14, 24, 40, 26, 16, 67, 19, 31, 86, 64, 93, 85, 86, 66, 24, 73, 86, 45, 99, 25, 98, 38, 57], 30",
"7"
],
[
"[-58, -48, -46, -36, 0, 18], 3",
"-128064"
],
[
"[1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0], 36",
"0"
],
[
"[1, 3, 5, 15, 18, 19, 21, 23, 29, 29, 33, 33, 34, 37, 39, 43, 43, 68, 73, 74, 75, 84, 87, 88, 89, 90, 93], 18",
"1"
],
[
"[74, 70, -36, 16, 10, 60, -82, 96, -30, 58, 56, -54, -14, 94, 10, -82, -80, -40, -72, -68, 8, 38, -50, -76, 34, 2, -66, -30, 26], 15",
"-975833006044977561600000"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 20",
"0"
],
[
"[74, 74, 8, 74, 85, 41, 31, 3, 84, 46, 73, 39, 64, 72, 28, 83, 98, 27, 64, 7, 95, 37, 10, 38, 77, 32, 69, 72, 62, 96, 5, 81, 34, 96, 80, 25, 38], 33",
"3"
]
] | f_gold | MINIMUM_PRODUCT_SUBSET_ARRAY | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_PRODUCT_SUBSET_ARRAY{
static int f_gold ( int a [ ] , int n ) {
if ( n == 1 ) return a [ 0 ] ;
int negmax = Integer . MIN_VALUE ;
int posmin = Integer . MAX_VALUE ;
int count_neg = 0 , count_zero = 0 ;
int product = 1 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( a [ i ] == 0 ) {
count_zero ++ ;
continue ;
}
if ( a [ i ] < 0 ) {
count_neg ++ ;
negmax = Math . max ( negmax , a [ i ] ) ;
}
if ( a [ i ] > 0 && a [ i ] < posmin ) posmin = a [ i ] ;
product *= a [ i ] ;
}
if ( count_zero == n || ( count_neg == 0 && count_zero > 0 ) ) return 0 ;
if ( count_neg == 0 ) return posmin ;
if ( count_neg % 2 == 0 && count_neg != 0 ) {
product = product / negmax ;
}
return product ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
if n <= 1 :
return False
for i in range ( 2 , n ) :
if n % i == 0 :
return False ;
return True
| java | [
[
"37",
"True"
],
[
"39",
"False"
],
[
"73",
"True"
],
[
"8",
"False"
],
[
"28",
"False"
],
[
"66",
"False"
],
[
"20",
"False"
],
[
"36",
"False"
],
[
"6",
"False"
],
[
"51",
"False"
]
] | f_gold | PRIMALITY_TEST_SET_1_INTRODUCTION_AND_SCHOOL_METHOD | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PRIMALITY_TEST_SET_1_INTRODUCTION_AND_SCHOOL_METHOD{
static boolean f_gold ( int n ) {
if ( n <= 1 ) return false ;
for ( int i = 2 ;
i < n ;
i ++ ) if ( n % i == 0 ) return false ;
return true ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( str ) :
for i in range ( 0 , len ( str ) ) :
if ( str [ i ].istitle ( ) ) :
return str [ i ]
return 0
| java | [
[
"'pH'",
"'H'"
],
[
"'96544000'",
"0"
],
[
"'000010000'",
"0"
],
[
"'ujqpx'",
"0"
],
[
"'20684847994'",
"0"
],
[
"'111'",
"0"
],
[
"'rclkv'",
"0"
],
[
"'45173693434'",
"0"
],
[
"'11111011001101'",
"0"
],
[
"'f'",
"0"
]
] | f_gold | FIRST_UPPERCASE_LETTER_IN_A_STRING_ITERATIVE_AND_RECURSIVE | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIRST_UPPERCASE_LETTER_IN_A_STRING_ITERATIVE_AND_RECURSIVE{
static char f_gold ( String str ) {
for ( int i = 0 ;
i < str . length ( ) ;
i ++ ) if ( Character . isUpperCase ( str . charAt ( i ) ) ) return str . charAt ( i ) ;
return 0 ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( s , c ) :
res = 0
for i in range ( len ( s ) ) :
if ( s [ i ] == c ) :
res = res + 1
return res
| java | [
[
"'mhjnKfd', 'l'",
"0"
],
[
"'716662107', '6'",
"3"
],
[
"'01', '1'",
"1"
],
[
"'wPHSxIbnHakGRO', 'n'",
"1"
],
[
"'721106', '8'",
"0"
],
[
"'111', '0'",
"0"
],
[
"'TIBFU', 'Q'",
"0"
],
[
"'0', '3'",
"0"
],
[
"'10', '0'",
"1"
],
[
"'lqq', 'd'",
"0"
]
] | f_gold | PROGRAM_COUNT_OCCURRENCE_GIVEN_CHARACTER_STRING | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_COUNT_OCCURRENCE_GIVEN_CHARACTER_STRING{
public static int f_gold ( String s , char c ) {
int res = 0 ;
for ( int i = 0 ;
i < s . length ( ) ;
i ++ ) {
if ( s . charAt ( i ) == c ) res ++ ;
}
return res ;
}
| [] |
|
null | [] | [] | python | code_translation | import math
def f_gold ( n ) :
res = 1
while n % 2 == 0 :
n = n // 2
for i in range ( 3 , int ( math.sqrt ( n ) + 1 ) ) :
count = 0
curr_sum = 1
curr_term = 1
while n % i == 0 :
count += 1
n = n // i
curr_term *= i
curr_sum += curr_term
res *= curr_sum
if n >= 2 :
res *= ( 1 + n )
return res
| java | [
[
"20",
"6"
],
[
"6",
"4"
],
[
"39",
"56"
],
[
"80",
"6"
],
[
"88",
"12"
],
[
"7",
"8"
],
[
"16",
"1"
],
[
"27",
"40"
],
[
"83",
"84"
],
[
"6",
"4"
]
] | f_gold | FIND_SUM_ODD_FACTORS_NUMBER | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_SUM_ODD_FACTORS_NUMBER{
static int f_gold ( int n ) {
int res = 1 ;
while ( n % 2 == 0 ) n = n / 2 ;
for ( int i = 3 ;
i <= Math . sqrt ( n ) ;
i ++ ) {
int count = 0 , curr_sum = 1 ;
int curr_term = 1 ;
while ( n % i == 0 ) {
count ++ ;
n = n / i ;
curr_term *= i ;
curr_sum += curr_term ;
}
res *= curr_sum ;
}
if ( n >= 2 ) res *= ( 1 + n ) ;
return res ;
}
| [
"import math"
] |
|
null | [] | [] | python | code_translation | def f_gold ( num ) :
length = len ( num )
if ( length == 1 and num [ 0 ] == '0' ) :
return True
if ( length % 3 == 1 ) :
num = str ( num ) + "00"
length += 2
elif ( length % 3 == 2 ) :
num = str ( num ) + "0"
length += 1
sum = 0
p = 1
for i in range ( length - 1 , - 1 , - 1 ) :
group = 0
group += ord ( num [ i ] ) - ord ( '0' )
i -= 1
group += ( ord ( num [ i ] ) - ord ( '0' ) ) * 10
i -= 1
group += ( ord ( num [ i ] ) - ord ( '0' ) ) * 100
sum = sum + group * p
p *= ( - 1 )
sum = abs ( sum )
return ( sum % 13 == 0 )
| java | [
[
"'vzTUaItpCpLnjY'",
"False"
],
[
"'33855'",
"True"
],
[
"'0011110101011'",
"True"
],
[
"'MMQ'",
"False"
],
[
"'439340517954'",
"True"
],
[
"'000000000'",
"True"
],
[
"'UugAuRRJbjEgl'",
"True"
],
[
"'6406553695441'",
"True"
],
[
"'011001'",
"True"
],
[
"'yjFqEEvgiNjEX'",
"True"
]
] | f_gold | CHECK_LARGE_NUMBER_DIVISIBLE_13_NOT | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_LARGE_NUMBER_DIVISIBLE_13_NOT{
static boolean f_gold ( String num ) {
int length = num . length ( ) ;
if ( length == 1 && num . charAt ( 0 ) == '0' ) return true ;
if ( length % 3 == 1 ) {
num += "00" ;
length += 2 ;
}
else if ( length % 3 == 2 ) {
num += "0" ;
length += 1 ;
}
int sum = 0 , p = 1 ;
for ( int i = length - 1 ;
i >= 0 ;
i -- ) {
int group = 0 ;
group += num . charAt ( i -- ) - '0' ;
group += ( num . charAt ( i -- ) - '0' ) * 10 ;
group += ( num . charAt ( i ) - '0' ) * 100 ;
sum = sum + group * p ;
p *= ( - 1 ) ;
}
sum = Math . abs ( sum ) ;
return ( sum % 13 == 0 ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n ) :
ans = 0
maxele = max ( arr )
for i in range ( 2 , maxele + 1 ) :
count = 0
for j in range ( n ) :
if ( arr [ j ] % i == 0 ) :
count += 1
ans = max ( ans , count )
return ans
| java | [
[
"[10, 18, 22, 22, 22, 29, 30, 32, 33, 34, 37, 39, 40, 41, 44, 47, 49, 50, 50, 51, 53, 67, 69, 70, 71, 71, 73, 75, 78, 80, 81, 82, 91, 91, 93, 97, 97, 99], 35",
"16"
],
[
"[-42, 62, 6, 98, 38, -4, -38, 72, 42, 4, -22, -94, 78, -90, 14], 10",
"10"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 23",
"0"
],
[
"[89, 92, 96, 71, 24, 27, 18, 19, 41, 1, 45, 8], 7",
"4"
],
[
"[-98, -94, -92, -90, -82, -80, -76, -76, -72, -62, -60, -58, -56, -52, -42, -36, -32, -32, -24, -22, -20, -10, -10, -10, -8, -2, -2, 0, 2, 4, 6, 6, 8, 10, 14, 18, 22, 26, 30, 46, 46, 62, 68, 74, 78, 82, 86, 86], 40",
"40"
],
[
"[1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1], 41",
"0"
],
[
"[4, 8, 10, 10, 11, 17, 18, 25, 32, 33, 34, 37, 40, 41, 44, 47, 47, 52, 63, 77, 85, 87, 89, 89, 91, 95, 96, 98], 23",
"10"
],
[
"[-86, 52, -48, 70, 10, -94, 16, 14, 38, 62], 9",
"9"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 30",
"0"
],
[
"[95, 32, 87, 37, 86, 71, 30, 88, 96, 52, 88, 92, 79, 86, 19, 5, 74, 67], 13",
"8"
]
] | f_gold | LARGEST_SUBSEQUENCE_GCD_GREATER_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LARGEST_SUBSEQUENCE_GCD_GREATER_1{
static int f_gold ( int arr [ ] , int n ) {
int ans = 0 ;
int maxele = Arrays . stream ( arr ) . max ( ) . getAsInt ( ) ;
;
for ( int i = 2 ;
i <= maxele ;
++ i ) {
int count = 0 ;
for ( int j = 0 ;
j < n ;
++ j ) {
if ( arr [ j ] % i == 0 ) ++ count ;
}
ans = Math . max ( ans , count ) ;
}
return ans ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( str ) :
i = len ( str ) - 1
start = end = i + 1
result = ''
while i >= 0 :
if str [ i ] == ' ' :
start = i + 1
while start != end :
result += str [ start ]
start += 1
result += ' '
end = i
i -= 1
start = 0
while start != end :
result += str [ start ]
start += 1
return result
| java | [
[
"'m Dm YZ'",
"'YZ Dm m'"
],
[
"'65 48 57 71'",
"'71 57 48 65'"
],
[
"'01 010'",
"'010 01'"
],
[
"'mT vhByi'",
"'vhByi mT'"
],
[
"'19 44 9 1'",
"'1 9 44 19'"
],
[
"'0'",
"'0'"
],
[
"'z vUi '",
"' vUi z'"
],
[
"'7 591 36643 9 055'",
"'055 9 36643 591 7'"
],
[
"'01'",
"'01'"
],
[
"'ti YGaijPY'",
"'YGaijPY ti'"
]
] | f_gold | PRINT_WORDS_STRING_REVERSE_ORDER | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PRINT_WORDS_STRING_REVERSE_ORDER{
static String f_gold ( String str ) {
int i = str . length ( ) - 1 ;
int start , end = i + 1 ;
String result = "" ;
while ( i >= 0 ) {
if ( str . charAt ( i ) == ' ' ) {
start = i + 1 ;
while ( start != end ) result += str . charAt ( start ++ ) ;
result += ' ' ;
end = i ;
}
i -- ;
}
start = 0 ;
while ( start != end ) result += str . charAt ( start ++ ) ;
return result ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( N ) :
B_Number = 0
cnt = 0
while ( N != 0 ) :
rem = N % 2
c = pow ( 10 , cnt )
B_Number += rem * c
N //= 2
cnt += 1
return B_Number
| java | [
[
"18",
"10010"
],
[
"92",
"1011100"
],
[
"87",
"1010111"
],
[
"50",
"110010"
],
[
"56",
"111000"
],
[
"88",
"1011000"
],
[
"3",
"11"
],
[
"16",
"10000"
],
[
"45",
"101101"
],
[
"58",
"111010"
]
] | f_gold | PROGRAM_DECIMAL_BINARY_CONVERSION_2 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_DECIMAL_BINARY_CONVERSION_2{
static int f_gold ( int N ) {
int B_Number = 0 ;
int cnt = 0 ;
while ( N != 0 ) {
int rem = N % 2 ;
double c = Math . pow ( 10 , cnt ) ;
B_Number += rem * c ;
N /= 2 ;
cnt ++ ;
}
return B_Number ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( b , m ) :
return ( b / m - 1 ) * ( b / m ) / 2
| java | [
[
"40, 74",
"-0.1241782322863404"
],
[
"38, 35",
"0.04653061224489791"
],
[
"47, 71",
"-0.11188256298353501"
],
[
"52, 29",
"0.7110582639714625"
],
[
"21, 9",
"1.5555555555555558"
],
[
"50, 33",
"0.3902662993572084"
],
[
"8, 82",
"-0.04402141582391434"
],
[
"56, 80",
"-0.10500000000000001"
],
[
"93, 5",
"163.68000000000004"
],
[
"21, 90",
"-0.08944444444444444"
]
] | f_gold | MAXIMUM_NUMBER_OF_SQUARES_THAT_CAN_BE_FIT_IN_A_RIGHT_ANGLE_ISOSCELES_TRIANGLE | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_NUMBER_OF_SQUARES_THAT_CAN_BE_FIT_IN_A_RIGHT_ANGLE_ISOSCELES_TRIANGLE{
static int f_gold ( int b , int m ) {
return ( b / m - 1 ) * ( b / m ) / 2 ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a , b , k ) :
p = a ** b
count = 0
while ( p > 0 and count < k ) :
rem = p % 10
count = count + 1
if ( count == k ) :
return rem
p = p / 10 ;
| java | [
[
"11, 2, 1",
"1"
],
[
"41, 3, 3",
"9.210000000000036"
],
[
"5, 4, 3",
"6.25"
],
[
"1, 2, 4",
"0.001"
],
[
"24, 1, 5",
"0.0024000000000000002"
],
[
"5, 2, 3",
"0.25"
],
[
"66, 5, 8",
"5.233257599999973"
],
[
"7, 10, 3",
"2.489999999757856"
],
[
"77, 30, 10",
"4.0"
],
[
"60, 50, 1",
"0"
]
] | f_gold | K_TH_DIGIT_RAISED_POWER_B | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class K_TH_DIGIT_RAISED_POWER_B{
public static int f_gold ( int a , int b , int k ) {
int p = ( int ) Math . pow ( a , b ) ;
int count = 0 ;
while ( p > 0 && count < k ) {
int rem = p % 10 ;
count ++ ;
if ( count == k ) return rem ;
p = p / 10 ;
}
return 0 ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( start , end , arr ) :
frequency = dict ( )
for i in range ( start , end + 1 ) :
if arr [ i ] in frequency.keys ( ) :
frequency [ arr [ i ] ] += 1
else :
frequency [ arr [ i ] ] = 1
count = 0
for x in frequency :
if x == frequency [ x ] :
count += 1
return count
| java | [
[
"0, 31, [1, 2, 2, 3, 3, 3, 12, 13, 18, 18, 26, 28, 29, 36, 37, 39, 40, 49, 55, 57, 63, 69, 69, 73, 85, 86, 87, 87, 89, 89, 90, 91, 92, 93, 93, 93, 95, 99]",
"3"
],
[
"1, 25, [24, -62, 2, 1, 94, 56, -22, -70, -22, -34, -92, -18, 56, 2, 60, 38, -88, 16, -28, 30, -30, 58, -80, 94, 6, 56]",
"2"
],
[
"3, 4, [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]",
"1"
],
[
"10, 15, [84, 13, 81, 40, 87, 82, 50, 30, 90, 80, 81, 70, 14, 54, 72, 93, 78, 27, 61]",
"0"
],
[
"2, 3, [-20, 20, 34, 60, 90]",
"0"
],
[
"0, 6, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0]",
"1"
],
[
"14, 18, [11, 18, 18, 19, 25, 30, 42, 42, 56, 58, 63, 66, 67, 68, 69, 75, 78, 83, 83]",
"0"
],
[
"29, 33, [-24, -82, 24, -84, 94, 2, -30, 86, 58, -56, -96, 60, -38, 76, 94, 74, -98, -84, -38, 46, 4, -84, -90, -28, -50, 46, 16, 28, -14, -82, -64, 42, 64, -2, -40, 96, 60, 2, -86, 32, 38, -66]",
"0"
],
[
"31, 19, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]",
"0"
],
[
"21, 32, [2, 91, 42, 85, 97, 92, 24, 39, 63, 89, 31, 59, 51, 89, 72, 62, 26, 92, 75, 4, 6, 13, 20, 95, 22, 30, 52, 60, 37, 27, 49, 15, 67, 26]",
"0"
]
] | f_gold | ARRAY_RANGE_QUERIES_ELEMENTS_FREQUENCY_VALUE | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class ARRAY_RANGE_QUERIES_ELEMENTS_FREQUENCY_VALUE{
static int f_gold ( int start , int end , int arr [ ] ) {
Map < Integer , Integer > mp = new HashMap < > ( ) ;
for ( int i = start ;
i <= end ;
i ++ ) mp . put ( arr [ i ] , mp . get ( arr [ i ] ) == null ? 1 : mp . get ( arr [ i ] ) + 1 ) ;
int count = 0 ;
for ( Map . Entry < Integer , Integer > entry : mp . entrySet ( ) ) if ( entry . getKey ( ) == entry . getValue ( ) ) count ++ ;
return count ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n , sum ) :
for i in range ( n ) :
curr_sum = arr [ i ]
j = i + 1
while j <= n :
if curr_sum == sum :
print ( "Sum found between" )
print ( "indexes %d and %d" % ( i , j - 1 ) )
return 1
if curr_sum > sum or j == n :
break
curr_sum = curr_sum + arr [ j ]
j += 1
print ( "No subarray found" )
return 0
| java | [
[
"[4, 8, 8, 10, 15, 18, 19, 22, 25, 26, 30, 32, 35, 36, 40, 41, 43, 48, 53, 57, 59, 63, 64, 68, 71, 76, 76, 77, 78, 89, 96, 97], 26, 23",
"0"
],
[
"[-78, 16, -16, -10, -2, -38, 58, -72, -78, 50, -68, -16, -96, 82, 70, 2, -20], 9, 12",
"0"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 9, 11",
"0"
],
[
"[16, 10, 55, 43, 46, 74, 57, 65, 86, 60, 28, 6, 92], 10, 6",
"0"
],
[
"[-98, -98, -90, -84, -84, -80, -76, -76, -70, -54, -48, -46, -44, -42, -38, -14, -12, -4, 6, 8, 24, 28, 32, 40, 40, 42, 64, 84, 98], 23, 19",
"0"
],
[
"[0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1], 12, 8",
"0"
],
[
"[2, 10, 40, 45, 56, 66, 66, 70, 75, 83, 93, 98], 10, 10",
"1"
],
[
"[-20, 30, 56, -68, 54, -6, 78, -86, 88, -66, 76, -66, 62, 78, 22, 46, -94, -10, 18, 16, -36, 34, -98, -84, -40, 98, 82, 10, 12, 54, -88], 30, 17",
"0"
],
[
"[0, 0, 1, 1], 2, 2",
"0"
],
[
"[38, 24, 12], 1, 1",
"0"
]
] | f_gold | FIND_SUBARRAY_WITH_GIVEN_SUM | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_SUBARRAY_WITH_GIVEN_SUM{
static int f_gold ( int arr [ ] , int n , int sum ) {
int curr_sum , i , j ;
for ( i = 0 ;
i < n ;
i ++ ) {
curr_sum = arr [ i ] ;
for ( j = i + 1 ;
j <= n ;
j ++ ) {
if ( curr_sum == sum ) {
int p = j - 1 ;
System . out . println ( "Sum found between indexes " + i + " and " + p ) ;
return 1 ;
}
if ( curr_sum > sum || j == n ) break ;
curr_sum = curr_sum + arr [ j ] ;
}
}
System . out . println ( "No subarray found" ) ;
return 0 ;
}
| [] |
|
null | [] | [] | python | code_translation | import sys
def f_gold ( arr , n ) :
res = - sys.maxsize
for i in range ( 0 , n ) :
curr_sum = 0
for j in range ( 0 , n ) :
index = int ( ( i + j ) % n )
curr_sum += j * arr [ index ]
res = max ( res , curr_sum )
return res
| java | [
[
"[11, 12, 16, 26, 29, 40, 54, 59, 65, 70, 71, 73, 78, 81, 87, 87, 88, 90, 95, 97], 11",
"3035"
],
[
"[-46, -32, 54, 96, -72, -58, -36, -44, 26, -2, -68, 42, 90, 26, -92, -96, 88, -42, -18, 46, -70, 24, 0, 24, 34, 34, -52, 50, 94, -60, 64, 58], 22",
"592"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 33",
"392"
],
[
"[48, 2, 79, 98, 28, 17, 41, 47, 61, 76, 82, 5, 74, 4, 80, 51, 22, 45, 91, 75, 91, 93, 42, 45, 69, 98, 76, 74, 83, 17, 30, 88, 53, 25, 35, 19, 26], 20",
"10714"
],
[
"[-88, -84, -82, -74, -44, -34, -32, -20, -20, -14, 6, 6, 10, 12, 16, 24, 32, 34, 38, 46, 54, 54, 56, 60, 82, 88, 90, 94, 98], 24",
"7026"
],
[
"[0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1], 7",
"19"
],
[
"[10, 14, 14, 14, 19, 20, 22, 26, 35, 36, 40, 53, 54, 55, 55, 57, 57, 67, 72, 72, 77, 78, 83, 84, 95, 96], 16",
"5149"
],
[
"[-80, 18, -76, 48, -52, -38, 52, -82, 40, -44, -90, 86, -86, -36, -32, -2, 56, -12, -88, 14, -16, 8, 52, 24, 46, 56, 84, -36, 84, -60, 72, -46, 32, -16, -20, 68, -86, -62, 58, 8, 78, -52, 22, -28, -22, -42, 12, -48], 30",
"4226"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], 14",
"46"
],
[
"[20, 94, 36, 2, 50, 62, 84, 50, 66, 75, 1, 18, 41, 48, 72, 61, 86, 22, 54, 6, 71, 46, 92, 68, 59, 51, 89, 31, 58, 78, 82, 84], 25",
"16847"
]
] | f_gold | MAXIMUM_SUM_IARRI_AMONG_ROTATIONS_GIVEN_ARRAY | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_SUM_IARRI_AMONG_ROTATIONS_GIVEN_ARRAY{
static int f_gold ( int arr [ ] , int n ) {
int res = Integer . MIN_VALUE ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int curr_sum = 0 ;
for ( int j = 0 ;
j < n ;
j ++ ) {
int index = ( i + j ) % n ;
curr_sum += j * arr [ index ] ;
}
res = Math . max ( res , curr_sum ) ;
}
return res ;
}
| [
"import sys"
] |
|
null | [] | [] | python | code_translation | def f_gold ( a , n , k ) :
b = dict ( )
for i in range ( n ) :
x = a [ i ]
d = min ( 1 + i , n - i )
if x not in b.keys ( ) :
b [ x ] = d
else :
b [ x ] = min ( d , b [ x ] )
ans = 10 ** 9
for i in range ( n ) :
x = a [ i ]
if ( x != ( k - x ) and ( k - x ) in b.keys ( ) ) :
ans = min ( max ( b [ x ] , b [ k - x ] ) , ans )
return ans
| java | [
[
"[2, 27, 66, 89, 96, 96], 4, 4",
"1000000000"
],
[
"[84, -38, -56, -20, -98, -40, -16, 22, 20, 98, -56, -32, -44, 30, -58, 26, -44, -32, 50, 46, 92], 13, 11",
"1000000000"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 23, 13",
"1000000000"
],
[
"[20, 71, 66, 58, 74, 2, 63, 13, 1, 36, 28, 83, 24, 20, 85, 30, 59, 56, 8, 97, 58, 28, 28, 42], 23, 17",
"1000000000"
],
[
"[-94, -88, -86, -68, -66, -64, -28, -12, 4, 18, 22, 28, 32, 34, 34, 40, 44, 46, 60, 68, 72, 78, 80, 84, 88, 96], 16, 15",
"1000000000"
],
[
"[0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1], 8, 13",
"1000000000"
],
[
"[8, 13, 54, 59, 61, 69, 89, 90, 92], 4, 8",
"1000000000"
],
[
"[-58, 50, -74, -8, -50, 90, 90, -2, -22, 8, -76, 16, 4, 56, 94, 36, 28, -42, 80, -88, 88, 52, 74, 40, 12, -72, -50, 50, 88, -54, 32, -24, -48, -66, -86, 40, -6, 14, 10, -88, 56, 80, -34], 27, 42",
"4"
],
[
"[0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], 9, 12",
"1000000000"
],
[
"[2, 60, 66, 39, 18, 60, 37, 75, 3, 64, 24, 16, 72, 95, 96, 44, 23, 58, 58, 33, 24, 96], 21, 17",
"1000000000"
]
] | f_gold | PRINT_MAXIMUM_SHORTEST_DISTANCE | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PRINT_MAXIMUM_SHORTEST_DISTANCE{
static int f_gold ( int a [ ] , int n , int k ) {
HashMap < Integer , Integer > b = new HashMap < Integer , Integer > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int x = a [ i ] ;
int d = Math . min ( 1 + i , n - i ) ;
if ( ! b . containsKey ( x ) ) b . put ( x , d ) ;
else {
b . put ( x , Math . min ( d , b . get ( x ) ) ) ;
}
}
int ans = Integer . MAX_VALUE ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int x = a [ i ] ;
if ( x != k - x && b . containsKey ( k - x ) ) ans = Math . min ( Math . max ( b . get ( x ) , b . get ( k - x ) ) , ans ) ;
}
return ans ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
return int ( ( ( n + 1 ) * ( n + 2 ) ) / 2 )
| java | [
[
"41",
"903"
],
[
"72",
"2701"
],
[
"54",
"1540"
],
[
"75",
"2926"
],
[
"87",
"3916"
],
[
"41",
"903"
],
[
"78",
"3160"
],
[
"80",
"3321"
],
[
"46",
"1128"
],
[
"9",
"55"
]
] | f_gold | NUMBER_NON_NEGATIVE_INTEGRAL_SOLUTIONS_B_C_N_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_NON_NEGATIVE_INTEGRAL_SOLUTIONS_B_C_N_1{
static int f_gold ( int n ) {
return ( ( n + 1 ) * ( n + 2 ) ) / 2 ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a , b , x , y ) :
if a == 0 :
x = 0
y = 1
return b
x1 = 1
y1 = 1
gcd = f_gold ( b % a , a , x1 , y1 )
x = y1 - ( b / a ) * x1
y = x1
return gcd
| java | [
[
"44, 17, 10, 65",
"1"
],
[
"33, 81, 67, 20",
"3"
],
[
"39, 77, 21, 34",
"1"
],
[
"52, 96, 23, 97",
"4"
],
[
"64, 48, 17, 33",
"16"
],
[
"45, 32, 89, 3",
"1"
],
[
"53, 88, 24, 74",
"1"
],
[
"86, 19, 29, 21",
"1"
],
[
"57, 67, 30, 32",
"1"
],
[
"11, 86, 96, 81",
"1"
]
] | f_gold | BASIC_AND_EXTENDED_EUCLIDEAN_ALGORITHMS_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class BASIC_AND_EXTENDED_EUCLIDEAN_ALGORITHMS_1{
public static int f_gold ( int a , int b , int x , int y ) {
if ( a == 0 ) {
x = 0 ;
y = 1 ;
return b ;
}
int x1 = 1 , y1 = 1 ;
int gcd = f_gold ( b % a , a , x1 , y1 ) ;
x = y1 - ( b / a ) * x1 ;
y = x1 ;
return gcd ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( str ) :
n = len ( str )
C = [ [ 0 for i in range ( n ) ] for i in range ( n ) ]
P = [ [ False for i in range ( n ) ] for i in range ( n ) ]
j = 0
k = 0
L = 0
for i in range ( n ) :
P [ i ] [ i ] = True ;
C [ i ] [ i ] = 0 ;
for L in range ( 2 , n + 1 ) :
for i in range ( n - L + 1 ) :
j = i + L - 1
if L == 2 :
P [ i ] [ j ] = ( str [ i ] == str [ j ] )
else :
P [ i ] [ j ] = ( ( str [ i ] == str [ j ] ) and P [ i + 1 ] [ j - 1 ] )
if P [ i ] [ j ] == True :
C [ i ] [ j ] = 0
else :
C [ i ] [ j ] = 100000000
for k in range ( i , j ) :
C [ i ] [ j ] = min ( C [ i ] [ j ] , C [ i ] [ k ] + C [ k + 1 ] [ j ] + 1 )
return C [ 0 ] [ n - 1 ]
| java | [
[
"'ydYdV'",
"2"
],
[
"'4446057'",
"4"
],
[
"'0111'",
"1"
],
[
"'keEj'",
"3"
],
[
"'642861576557'",
"10"
],
[
"'11111000101'",
"2"
],
[
"'ram'",
"2"
],
[
"'09773261'",
"6"
],
[
"'1'",
"0"
],
[
"'AVBEKClFdj'",
"9"
]
] | f_gold | DYNAMIC_PROGRAMMING_SET_17_PALINDROME_PARTITIONING | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_SET_17_PALINDROME_PARTITIONING{
static int f_gold ( String str ) {
int n = str . length ( ) ;
int [ ] [ ] C = new int [ n ] [ n ] ;
boolean [ ] [ ] P = new boolean [ n ] [ n ] ;
int i , j , k , L ;
for ( i = 0 ;
i < n ;
i ++ ) {
P [ i ] [ i ] = true ;
C [ i ] [ i ] = 0 ;
}
for ( L = 2 ;
L <= n ;
L ++ ) {
for ( i = 0 ;
i < n - L + 1 ;
i ++ ) {
j = i + L - 1 ;
if ( L == 2 ) P [ i ] [ j ] = ( str . charAt ( i ) == str . charAt ( j ) ) ;
else P [ i ] [ j ] = ( str . charAt ( i ) == str . charAt ( j ) ) && P [ i + 1 ] [ j - 1 ] ;
if ( P [ i ] [ j ] == true ) C [ i ] [ j ] = 0 ;
else {
C [ i ] [ j ] = Integer . MAX_VALUE ;
for ( k = i ;
k <= j - 1 ;
k ++ ) C [ i ] [ j ] = Integer . min ( C [ i ] [ j ] , C [ i ] [ k ] + C [ k + 1 ] [ j ] + 1 ) ;
}
}
}
return C [ 0 ] [ n - 1 ] ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( stri , n ) :
m = dict ( )
for i in range ( n ) :
m [ stri [ i ] ] = m.get ( stri [ i ] , 0 ) + 1
res = 0
for i in m.values ( ) :
if i == 2 :
res += 1
return res
| java | [
[
"['hate', 'love', 'peace', 'love', 'peace', 'hate', 'love', 'peace', 'love', 'peace'], 10",
"1"
],
[
"['16', '946613197072', '532052', '42780833', '511552', '1241934', '4', '3444540', '47487223670074', '23753', '14158', '4', '95420017116714', '16', '0845', '689000748', '976403809728', '8922', '487784120896', '329', '611', '59101', '611', '2131059721', '53952148295020', '445948587', '3905249775372', '4683180907', '7169093', '01413852276627', '63', '5864', '40862536595', '2280304422294', '930028582', '05', '33447'], 32",
"3"
],
[
"['001000100000', '1010', '01011', '11', '011', '1010'], 6",
"1"
],
[
"['Om', 'Om', 'Shankar', 'Tripathi', 'Tom', 'Jerry', 'Jerry'], 7",
"2"
],
[
"['2', '644', '2', '42484637089', '81578664', '0778'], 6",
"1"
],
[
"['001000101', '011010', '1', '101010011', '011010', '01', '10111000101', '0', '1', '00101101', '0', '0'], 12",
"2"
],
[
"['kl', 'p sH', 'PwCPMPu', 'tQoIgPpk', 'wtsNP WjS', 'kl ', 'TXsFWgU', 'kl', 'AD', 'NjjTyFGwNWZcB', 'jpFQslbGbDI', 'cEpGAgvpk', 'EMaDkMOm', 'YZuNZgfwDIjG', 'k', 'hJx jHmGpQYwQP', 'CIETe', 'RH', 'Pj', 'h', 'DInR', 'AEsqOvliQtz', 'NwzHTALTt LS', 'LwLR', 'WvDCzlQF', 'soJb', 'WktoldCbWyTO', 'pIdRJxY', 'BmpWxjOwTXkjjL', 'zmtCiQ', 'g', 'yBmDW', 'QhaBZrQnOJaAJ', 'u', 'MGTwCKve', 'UxYQrONag', 'xsGSz', 'dqNPTT', 'U W', 'ygJKvCEKDClby', 'M', 'yXJQHxjyDQDLkT', 'oJmaREOEk YA', 'zUwiwhSMdiC', 'jYgZEktcdgLD', 'fwyTAAW', 'GENttdzeGY '], 43",
"1"
],
[
"['938', '074209', '0949093096', '218622476', '71692175', '0714', '81217924991', '74016430795374', '52213147', '338', '939', '798161500954', '90528060774015', '68715', '75810', '43450', '8017', '0193164', '5945740', '212', '4589289', '2912211026', '0', '49', '8230114', '0733435391403', '5429', '10070'], 20",
"0"
],
[
"['00', '0', '00', '0101111010100', '110'], 4",
"1"
],
[
"['g', 'h', 'ok', 'h', 'ok', 'sqozuC', 'ut', 'ZwRcG', 'ok', 'MR', 'jHrWyy', 'qaJlrokgRHuZH', 'LjPNzDUKszYmCq', 'g', 'ZGjLfMnyAGL', 'kEZoSxOMEWSFpw', 'IFtqNaDVnG', 'iJoJXl', 'vjrQMyWor', 'FTEHZqbHGlmHph', 'QeSdzm', 'nPostKHkigyJt', 'mOSekk'], 15",
"2"
]
] | f_gold | COUNT_WORDS_APPEAR_EXACTLY_TWO_TIMES_ARRAY_WORDS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_WORDS_APPEAR_EXACTLY_TWO_TIMES_ARRAY_WORDS{
static int f_gold ( String str [ ] , int n ) {
HashMap < String , Integer > m = new HashMap < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( m . containsKey ( str [ i ] ) ) {
int get = m . get ( str [ i ] ) ;
m . put ( str [ i ] , get + 1 ) ;
}
else {
m . put ( str [ i ] , 1 ) ;
}
}
int res = 0 ;
for ( Map . Entry < String , Integer > it : m . entrySet ( ) ) {
if ( it . getValue ( ) == 2 ) res ++ ;
}
return res ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
n -= 1
n |= n >> 1
n |= n >> 2
n |= n >> 4
n |= n >> 8
n |= n >> 16
n += 1
return n
| java | [
[
"63",
"64"
],
[
"78",
"128"
],
[
"13",
"16"
],
[
"5",
"8"
],
[
"34",
"64"
],
[
"69",
"128"
],
[
"63",
"64"
],
[
"78",
"128"
],
[
"80",
"128"
],
[
"19",
"32"
]
] | f_gold | NEXT_POWER_OF_2_2 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NEXT_POWER_OF_2_2{
static int f_gold ( int n ) {
n -- ;
n |= n >> 1 ;
n |= n >> 2 ;
n |= n >> 4 ;
n |= n >> 8 ;
n |= n >> 16 ;
n ++ ;
return n ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( A , B , m , n ) :
dp = [ [ 0 for i in range ( m + 1 ) ] for j in range ( n + 1 ) ]
for i in range ( 1 , n + 1 , 1 ) :
for j in range ( i , m + 1 , 1 ) :
dp [ i ] [ j ] = max ( ( dp [ i - 1 ] [ j - 1 ] + ( A [ j - 1 ] * B [ i - 1 ] ) ) , dp [ i ] [ j - 1 ] )
return dp [ n ] [ m ]
| java | [
[
"[7, 9, 22, 68], [14, 22, 54, 58], 3, 2",
"610"
],
[
"[24, 40, 98, 58, -24, 24, 76, 48, -92, -16, -46, -48, -70, 88, 66, 2, 44, 36, 34, 34, 46, 90, -80, -24, -58, 68, 72, -20, -62, -40], [30, -88, 6, -26, -76, 14, -80, -30, -58, 76, 40, -28, -54, 38, -60, -60, 88, -80, -22, 90, 50, -48, 68, -26, 26, -2, 68, -16, 88, -72], 22, 22",
"7952"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 22, 19",
"0"
],
[
"[32, 15, 41, 41, 4, 42, 22, 33, 33, 11, 68, 5, 41, 80, 39, 15, 36, 75, 41, 11, 25, 40, 50, 19, 39, 12, 75, 28, 52, 20, 63, 5, 27, 53, 19, 62, 98, 72, 10, 90, 74, 93, 52, 81, 91, 65, 90, 93], [80, 18, 9, 29, 62, 89, 4, 40, 47, 15, 35, 82, 22, 97, 63, 54, 7, 58, 64, 73, 54, 79, 21, 21, 20, 19, 56, 42, 6, 97, 7, 34, 55, 35, 57, 86, 73, 88, 20, 29, 48, 52, 8, 77, 2, 12, 6, 47], 30, 25",
"50904"
],
[
"[-94, -76, -68, -50, -28, -20, 18, 24, 30, 54, 74, 84, 98], [-88, -80, -78, -68, -44, -38, 42, 50, 62, 68, 70, 80, 92], 11, 8",
"31016"
],
[
"[1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0], [1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1], 21, 33",
"0"
],
[
"[14, 27, 43, 49], [51, 59, 76, 83], 2, 2",
"2307"
],
[
"[78, -26, -12, 38, -90], [14, 50, -6, -38, 80], 3, 2",
"492"
],
[
"[0, 1, 1, 1], [0, 0, 0, 1], 3, 2",
"0"
],
[
"[12, 69, 57, 7, 52, 14, 15, 83, 67, 57, 15, 86, 81, 43, 1, 64, 45, 68, 30, 23, 14, 70, 13, 51, 23, 33, 98, 68, 24, 43, 12, 82, 46], [12, 48, 57, 40, 47, 36, 22, 50, 68, 98, 77, 78, 39, 55, 87, 75, 65, 27, 33, 27, 70, 34, 67, 71, 84, 33, 7, 61, 3, 9, 67, 92, 60], 17, 32",
"0"
]
] | f_gold | FIND_MAXIMUM_DOT_PRODUCT_TWO_ARRAYS_INSERTION_0S | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_MAXIMUM_DOT_PRODUCT_TWO_ARRAYS_INSERTION_0S{
static int f_gold ( int A [ ] , int B [ ] , int m , int n ) {
int dp [ ] [ ] = new int [ n + 1 ] [ m + 1 ] ;
for ( int [ ] row : dp ) Arrays . fill ( row , 0 ) ;
for ( int i = 1 ;
i <= n ;
i ++ ) for ( int j = i ;
j <= m ;
j ++ ) dp [ i ] [ j ] = Math . max ( ( dp [ i - 1 ] [ j - 1 ] + ( A [ j - 1 ] * B [ i - 1 ] ) ) , dp [ i ] [ j - 1 ] ) ;
return dp [ n ] [ m ] ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n ) :
s = [ ]
j = 0
ans = 0
for i in range ( n ) :
while ( j < n and ( arr [ j ] not in s ) ) :
s.append ( arr [ j ] )
j += 1
ans += ( ( j - i ) * ( j - i + 1 ) ) // 2
s.remove ( arr [ i ] )
return ans
| java | [
[
"[3, 4, 5, 6, 12, 15, 16, 17, 20, 20, 22, 24, 24, 27, 28, 34, 37, 39, 39, 41, 43, 49, 49, 51, 55, 62, 63, 67, 71, 74, 74, 74, 77, 84, 84, 89, 89, 97, 99], 24",
"255"
],
[
"[-8, 54, -22, 18, 20, 44, 0, 54, 90, -4, 4, 40, -74, -16], 13",
"335"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 28",
"30"
],
[
"[36, 71, 36, 58, 38, 90, 17], 4",
"13"
],
[
"[-90, -32, -16, 18, 38, 82], 5",
"35"
],
[
"[1, 0, 1], 2",
"4"
],
[
"[3, 11, 21, 25, 28, 28, 38, 42, 48, 53, 55, 55, 55, 58, 71, 75, 79, 80, 80, 94, 96, 99], 20",
"152"
],
[
"[-16, -52, -4, -46, 54, 0, 8, -64, -82, -10, -62, -10, 58, 44, -28, 86, -24, 16, 44, 22, -28, -42, -52, 8, 76, -44, -34, 2, 88, -88, -14, -84, -36, -68, 76, 20, 20, -50], 35",
"1791"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 27",
"29"
],
[
"[19, 13, 61, 32, 92, 90, 12, 81, 52], 5",
"35"
]
] | f_gold | SUBARRAYS_DISTINCT_ELEMENTS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUBARRAYS_DISTINCT_ELEMENTS{
public static int f_gold ( int [ ] arr , int n ) {
Set < Integer > s = new HashSet < > ( ) ;
int j = 0 , ans = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
while ( j < n && ! s . contains ( arr [ j ] ) ) {
s . add ( arr [ i ] ) ;
j ++ ;
}
ans += ( ( j - i ) * ( j - i + 1 ) ) / 2 ;
s . remove ( arr [ i ] ) ;
}
return ans ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
return 1 if ( n == 1 or n == 0 ) else n * f_gold ( n - 1 )
| java | [
[
"24",
"620448401733239439360000"
],
[
"46",
"5502622159812088949850305428800254892961651752960000000000"
],
[
"47",
"258623241511168180642964355153611979969197632389120000000000"
],
[
"41",
"33452526613163807108170062053440751665152000000000"
],
[
"98",
"9426890448883247745626185743057242473809693764078951663494238777294707070023223798882976159207729119823605850588608460429412647567360000000000000000000000"
],
[
"69",
"171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000"
],
[
"83",
"39455239697206586511897471180120610571436503407643446275224357528369751562996629334879591940103770870906880000000000000000000"
],
[
"2",
"2"
],
[
"12",
"479001600"
],
[
"11",
"39916800"
]
] | f_gold | PROGRAM_FOR_FACTORIAL_OF_A_NUMBER_2 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_FOR_FACTORIAL_OF_A_NUMBER_2{
static int f_gold ( int n ) {
return ( n == 1 || n == 0 ) ? 1 : n * f_gold ( n - 1 ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( x ) :
if ( x == 0 or x == 1 ) :
return x
start = 1
end = x
while ( start <= end ) :
mid = ( start + end ) // 2
if ( mid * mid == x ) :
return mid
if ( mid * mid < x ) :
start = mid + 1
ans = mid
else :
end = mid - 1
return ans
| java | [
[
"40",
"6"
],
[
"10",
"3"
],
[
"46",
"6"
],
[
"54",
"7"
],
[
"1",
"1"
],
[
"67",
"8"
],
[
"64",
"8"
],
[
"10",
"3"
],
[
"75",
"8"
],
[
"11",
"3"
]
] | f_gold | SQUARE_ROOT_OF_AN_INTEGER_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SQUARE_ROOT_OF_AN_INTEGER_1{
public static int f_gold ( int x ) {
if ( x == 0 || x == 1 ) return x ;
int start = 1 , end = x , ans = 0 ;
while ( start <= end ) {
int mid = ( start + end ) / 2 ;
if ( mid * mid == x ) return mid ;
if ( mid * mid < x ) {
start = mid + 1 ;
ans = mid ;
}
else end = mid - 1 ;
}
return ans ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a , n ) :
cnt = dict ( )
ans = 0
pre_sum = 0
for i in range ( n ) :
ans += ( i * a [ i ] ) - pre_sum
pre_sum += a [ i ]
if ( a [ i ] - 1 ) in cnt :
ans -= cnt [ a [ i ] - 1 ]
if ( a [ i ] + 1 ) in cnt :
ans += cnt [ a [ i ] + 1 ]
if a [ i ] not in cnt :
cnt [ a [ i ] ] = 0
cnt [ a [ i ] ] += 1
return ans
| java | [
[
"[2, 8, 12, 19, 23, 23, 26, 39, 54, 56, 57, 57, 73, 78, 83, 83, 89, 91], 15",
"3278"
],
[
"[62, -34, 10, -28, -42, -12, 4, 20, -20, -84, -76, -16, -44, 26, -78, -40, 50, -10, -56, 76, -88, 24, 64, 10, 64, -8, -68, -42, 26, 24, 62, 36, -68, 8, -68, -2, 8, 38, -18], 20",
"-112"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 18",
"0"
],
[
"[23, 14, 44, 29, 93, 56, 22, 29, 97, 71, 43, 72, 74, 8, 92, 40, 18, 34, 78, 79, 93, 63, 79, 44, 35, 72, 88, 83, 40, 89, 66, 66, 54, 56, 44, 62, 72, 94, 79, 79, 24, 55, 72, 37, 27, 55, 16, 58, 83], 25",
"2551"
],
[
"[-96, -94, -90, -90, -86, -82, -80, -80, -58, -48, -40, -32, -32, -20, -20, -20, -12, -12, -6, -6, -2, 0, 4, 16, 16, 16, 42, 48, 58, 64, 68, 76, 76, 76, 78, 80, 82, 88, 88, 88, 92, 94, 96, 98], 27",
"16640"
],
[
"[1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1], 34",
"0"
],
[
"[3, 4, 4, 8, 10, 10, 11, 15, 19, 19, 20, 24, 25, 25, 27, 30, 41, 43, 44, 45, 47, 55, 59, 59, 61, 63, 63, 67, 67, 69, 72, 73, 75, 77, 77, 78, 81, 81, 83, 84, 92, 94, 99], 31",
"12408"
],
[
"[94, -86, 94, 54, -52, 86, 68, 64, 98, 54, -14, -60, -60, -92, 80, -16, 28, 16, -74, 68, 32, -54, 58, -16, -2, -52, -92, -36, 96, -18, 14, 76, 16], 26",
"-6856"
],
[
"[0, 0, 0, 0, 1, 1, 1, 1], 7",
"0"
],
[
"[10, 28, 63, 2, 78, 12, 51, 82, 89, 65, 99], 8",
"542"
]
] | f_gold | SUM_FAI_AJ_PAIRS_ARRAY_N_INTEGERS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_FAI_AJ_PAIRS_ARRAY_N_INTEGERS{
public static int f_gold ( int a [ ] , int n ) {
Map < Integer , Integer > cnt = new HashMap < Integer , Integer > ( ) ;
int ans = 0 , pre_sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
ans += ( i * a [ i ] ) - pre_sum ;
pre_sum += a [ i ] ;
if ( cnt . containsKey ( a [ i ] - 1 ) ) ans -= cnt . get ( a [ i ] - 1 ) ;
if ( cnt . containsKey ( a [ i ] + 1 ) ) ans += cnt . get ( a [ i ] + 1 ) ;
if ( cnt . containsKey ( a [ i ] ) ) {
cnt . put ( a [ i ] , cnt . get ( a [ i ] ) + 1 ) ;
}
else {
cnt . put ( a [ i ] , 1 ) ;
}
}
return ans ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
if ( n == 0 or n == 9 ) :
return True
if ( n < 9 ) :
return False
return f_gold ( ( int ) ( n >> 3 ) - ( int ) ( n & 7 ) )
| java | [
[
"96",
"False"
],
[
"85",
"False"
],
[
"54",
"True"
],
[
"14",
"False"
],
[
"47",
"False"
],
[
"11",
"False"
],
[
"49",
"False"
],
[
"99",
"True"
],
[
"28",
"False"
],
[
"82",
"False"
]
] | f_gold | DIVISIBILITY_9_USING_BITWISE_OPERATORS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DIVISIBILITY_9_USING_BITWISE_OPERATORS{
static boolean f_gold ( int n ) {
if ( n == 0 || n == 9 ) return true ;
if ( n < 9 ) return false ;
return f_gold ( ( int ) ( n >> 3 ) - ( int ) ( n & 7 ) ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( s ) :
n = len ( s ) ;
sub_count = ( n * ( n + 1 ) ) // 2 ;
arr = [ 0 ] * sub_count ;
index = 0 ;
for i in range ( n ) :
for j in range ( 1 , n - i + 1 ) :
arr [ index ] = s [ i : i + j ] ;
index += 1 ;
arr.sort ( ) ;
res = "" ;
for i in range ( sub_count ) :
res += arr [ i ] ;
return res ;
| java | [
[
"'sqGOi'",
"'GGOGOiOOiiqqGqGOqGOissqsqGsqGOsqGOi'"
],
[
"'848580'",
"'04484854858485805585808888084848848584858848580858588580'"
],
[
"'01001110011001'",
"'00000000000000010010010011001100110001100001100100111001110001110000111001001110011001110011000111001100001110011001010101010100100010010100110100111010011100100111000100111001010011100110100111001100100111001100010011100110010110110110011000110010111011100111000111001011100110111001100111001100011100110011111111101010100100100100110011001100111001110011010011001001100110011110011101001110010011100110011100111001110011010011100110010011100110011111111101101100110011001110011100111100110110011001100110011111110111001110011110011111001101110011001110011001'"
],
[
"'ZhWXUKmeiI'",
"'IKKmKmeKmeiKmeiIUUKUKmUKmeUKmeiUKmeiIWWXWXUWXUKWXUKmWXUKmeWXUKmeiWXUKmeiIXXUXUKXUKmXUKmeXUKmeiXUKmeiIZZhZhWZhWXZhWXUZhWXUKZhWXUKmZhWXUKmeZhWXUKmeiZhWXUKmeiIeeieiIhhWhWXhWXUhWXUKhWXUKmhWXUKmehWXUKmeihWXUKmeiIiiImmemeimeiI'"
],
[
"'0917296541285'",
"'00909109170917209172909172960917296509172965409172965410917296541209172965412809172965412851112128128517172172917296172965172965417296541172965412172965412817296541285222828529296296529654296541296541229654128296541285441412412841285555454154125412854128566565465416541265412865412857727297296729657296547296541729654127296541287296541285885999191791729172991729691729659172965491729654191729654129172965412891729654128596965965496541965412965412896541285'"
],
[
"'01101001111100'",
"'00000000000010011001110011110011111001111100011111000101010100100010010100110100111010011110100111110100111110010011111000110110110011010110100110100011010010110100110110100111011010011110110100111110110100111110011010011111000111011110111110111110011111001111111110101010010010011001110011110011111001111110011111010011111001011010101001010011010011101001111010011111010011111101001111101010011111001111111111110110110011011101011010011010011101001111010011111010011111101001111111010011111011010011111001111111111110111001111111111110111100111111111101111100'"
],
[
"'tjP kR'",
"' k kRPP P kP kRRjjPjP jP kjP kRkkRttjtjPtjP tjP ktjP kR'"
],
[
"'999907'",
"'00779999909079999999909907999999999099907999999990999907'"
],
[
"'011100'",
"'00000010110111011100111001111010011111101100111111011100'"
],
[
"'qJPHNSJOUj'",
"'HHNHNSHNSJHNSJOHNSJOUHNSJOUjJJJOJOUJOUjJPJPHJPHNJPHNSJPHNSJJPHNSJOJPHNSJOUJPHNSJOUjNNSNSJNSJONSJOUNSJOUjOOUOUjPPHPHNPHNSPHNSJPHNSJOPHNSJOUPHNSJOUjSSJSJOSJOUSJOUjUUjjqqJqJPqJPHqJPHNqJPHNSqJPHNSJqJPHNSJOqJPHNSJOUqJPHNSJOUj'"
]
] | f_gold | LEXICOGRAPHICAL_CONCATENATION_SUBSTRINGS_STRING | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LEXICOGRAPHICAL_CONCATENATION_SUBSTRINGS_STRING{
static String f_gold ( String s ) {
int n = s . length ( ) ;
int sub_count = n * ( n + 1 ) / 2 ;
String [ ] arr = new String [ sub_count ] ;
int index = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int len = 1 ;
len <= n - i ;
len ++ ) {
arr [ index ++ ] = s . substring ( i , i + len ) ;
}
Arrays . sort ( arr ) ;
String res = "" ;
for ( int i = 0 ;
i < sub_count ;
i ++ ) res += arr [ i ] ;
return res ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( x , y ) :
if ( y == 0 ) : return 1
elif ( int ( y % 2 ) == 0 ) :
return ( f_gold ( x , int ( y / 2 ) ) * f_gold ( x , int ( y / 2 ) ) )
else :
return ( x * f_gold ( x , int ( y / 2 ) ) * f_gold ( x , int ( y / 2 ) ) )
| java | [
[
"46, 92",
"941283649136660906908287235589050394624915053389458552934497600337861569560091909525670688971469335226973410396408482954990038586235954171670711989436416"
],
[
"99, 87",
"417120879933220675381816712512036545138912699084280583663207213807936364408333206792708310813441891301021083287536733543359096141318739253639335503708346305283597086457598699"
],
[
"30, 32",
"185302018885184100000000000000000000000000000000"
],
[
"1, 86",
"1"
],
[
"26, 81",
"4100541255028480090859025036114684248138311212746959682913884801288203877480821967992945808043646919726928049995776"
],
[
"1, 49",
"1"
],
[
"27, 46",
"696198609130885597695136021593547814689632716312296141651066450089"
],
[
"10, 52",
"10000000000000000000000000000000000000000000000000000"
],
[
"26, 38",
"587472068623721885444772535796326093242836249347096576"
],
[
"29, 80",
"981385940506319036815227144278277936294241688059589172727394328671888635445148060139292978307880366753409399275521601"
]
] | f_gold | WRITE_A_C_PROGRAM_TO_CALCULATE_POWXN | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class WRITE_A_C_PROGRAM_TO_CALCULATE_POWXN{
static int f_gold ( int x , int y ) {
if ( y == 0 ) return 1 ;
else if ( y % 2 == 0 ) return f_gold ( x , y / 2 ) * f_gold ( x , y / 2 ) ;
else return x * f_gold ( x , y / 2 ) * f_gold ( x , y / 2 ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( s ) :
aCount = 0
bCount = 0
cCount = 0
for i in range ( len ( s ) ) :
if ( s [ i ] == 'a' ) :
aCount = ( 1 + 2 * aCount )
elif ( s [ i ] == 'b' ) :
bCount = ( aCount + 2 * bCount )
elif ( s [ i ] == 'c' ) :
cCount = ( bCount + 2 * cCount )
return cCount
| java | [
[
"''",
"0"
],
[
"'abbc'",
"3"
],
[
"'abcabc'",
"7"
],
[
"'agsdbkfdc '",
"1"
],
[
"'ababab'",
"0"
],
[
"'aaaaaaa'",
"0"
],
[
"'aabaaabcc'",
"111"
],
[
"'19'",
"0"
],
[
"'1001100'",
"0"
],
[
"'DtAnuQbU'",
"0"
]
] | f_gold | NUMBER_SUBSEQUENCES_FORM_AI_BJ_CK | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_SUBSEQUENCES_FORM_AI_BJ_CK{
static int f_gold ( String s ) {
int aCount = 0 ;
int bCount = 0 ;
int cCount = 0 ;
for ( int i = 0 ;
i < s . length ( ) ;
i ++ ) {
if ( s . charAt ( i ) == 'a' ) aCount = ( 1 + 2 * aCount ) ;
else if ( s . charAt ( i ) == 'b' ) bCount = ( aCount + 2 * bCount ) ;
else if ( s . charAt ( i ) == 'c' ) cCount = ( bCount + 2 * cCount ) ;
}
return cCount ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( X , Y , m , n ) :
LCSuff = [ [ 0 for k in range ( n + 1 ) ] for l in range ( m + 1 ) ]
result = 0
for i in range ( m + 1 ) :
for j in range ( n + 1 ) :
if ( i == 0 or j == 0 ) :
LCSuff [ i ] [ j ] = 0
elif ( X [ i - 1 ] == Y [ j - 1 ] ) :
LCSuff [ i ] [ j ] = LCSuff [ i - 1 ] [ j - 1 ] + 1
result = max ( result , LCSuff [ i ] [ j ] )
else :
LCSuff [ i ] [ j ] = 0
return result
| java | [
[
"['A', 'D', 'E', 'E', 'L', 'L', 'T', 'r', 'x'], ['D', 'F', 'H', 'O', 'g', 'o', 'u', 'v', 'w'], 4, 4",
"1"
],
[
"['9', '3', '4', '8', '7', '6', '3', '8', '3', '3', '5', '3', '5', '4', '2', '5', '5', '3', '6', '2', '1', '7', '4', '2', '7', '3', '2', '1', '3', '7', '6', '5', '0', '6', '3', '8', '5', '1', '7', '9', '2', '7'], ['5', '5', '3', '7', '8', '0', '9', '8', '5', '8', '5', '1', '4', '4', '0', '2', '9', '2', '3', '1', '1', '3', '6', '1', '2', '0', '5', '4', '3', '7', '5', '5', '8', '1', '1', '4', '8', '1', '7', '5', '5', '4'], 41, 37",
"3"
],
[
"['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'], ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'], 35, 29",
"29"
],
[
"['W', 'X', 'P', 'u', 's', 'k', 'O', 'y', 'Q', 'i', 't', 'z', 'F', 'f', 's', 'N', 'K', 'm', 'I', 'M', 'g', 'e', 'E', 'P', 'b', 'Y', 'c', 'O', ' ', 'G', 'F', 'x'], ['e', 'R', 'P', 'W', 'd', 'a', 'A', 'j', 'H', 'v', 'T', 'w', 'x', 'I', 'd', 'o', 'z', 'K', 'B', 'M', 'J', 'L', 'a', ' ', 'T', 'L', 'V', 't', 'M', 'U', 'z', 'R'], 31, 18",
"1"
],
[
"['0', '1', '2', '4', '5', '7', '7', '7', '8', '8', '9', '9', '9'], ['0', '0', '2', '2', '2', '3', '4', '6', '6', '7', '8', '9', '9'], 12, 8",
"1"
],
[
"['0', '0', '1'], ['0', '0', '1'], 1, 1",
"1"
],
[
"['A', 'C', 'F', 'G', 'G', 'H', 'I', 'K', 'K', 'N', 'O', 'Q', 'R', 'V', 'V', 'W', 'Y', 'a', 'a', 'c', 'd', 'k', 'k', 'm', 'o', 'p', 't', 'u', 'y', 'y', 'y', 'z'], [' ', ' ', 'B', 'C', 'C', 'C', 'D', 'E', 'I', 'J', 'M', 'N', 'P', 'T', 'U', 'U', 'V', 'V', 'W', 'W', 'Y', 'b', 'c', 'e', 'i', 'o', 'p', 'r', 't', 'y', 'y', 'z'], 21, 23",
"3"
],
[
"['0', '0', '0', '2', '8', '3', '5', '1', '0', '7', '7', '9', '9', '4', '8', '9', '5'], ['8', '5', '8', '7', '1', '4', '0', '2', '2', '7', '2', '4', '0', '8', '3', '8', '7'], 13, 12",
"2"
],
[
"['0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1'], ['0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1'], 9, 9",
"7"
],
[
"['B', 'o', 'R', 'k', 'Y', 'M', 'g', 'b', 'h', 'A', 'i', 'X', 'p', 'i', 'j', 'f', 'V', 'n', 'd', 'P', 'T', 'U', 'f', 'G', 'M', 'W', 'g', 'a', 'C', 'E', 'v', 'C', ' '], ['F', 'h', 'G', 'H', 'Q', 'Q', 'K', 'g', 'k', 'u', 'l', 'c', 'c', 'o', 'n', 'G', 'i', 'Z', 'd', 'b', 'c', 'b', 'v', 't', 'S', 't', 'P', 'A', 'K', 'g', 'G', 'i', 'm'], 19, 32",
"1"
]
] | f_gold | LONGEST_COMMON_SUBSTRING | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LONGEST_COMMON_SUBSTRING{
static int f_gold ( char X [ ] , char Y [ ] , int m , int n ) {
int LCStuff [ ] [ ] = new int [ m + 1 ] [ n + 1 ] ;
int result = 0 ;
for ( int i = 0 ;
i <= m ;
i ++ ) {
for ( int j = 0 ;
j <= n ;
j ++ ) {
if ( i == 0 || j == 0 ) LCStuff [ i ] [ j ] = 0 ;
else if ( X [ i - 1 ] == Y [ j - 1 ] ) {
LCStuff [ i ] [ j ] = LCStuff [ i - 1 ] [ j - 1 ] + 1 ;
result = Integer . max ( result , LCStuff [ i ] [ j ] ) ;
}
else LCStuff [ i ] [ j ] = 0 ;
}
}
return result ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , low , high , x ) :
if x <= arr [ low ] :
return low
if x > arr [ high ] :
return - 1
mid = ( low + high ) / 2 ;
if arr [ mid ] == x :
return mid
elif arr [ mid ] < x :
if mid + 1 <= high and x <= arr [ mid + 1 ] :
return mid + 1
else :
return f_gold ( arr , mid + 1 , high , x )
else :
if mid - 1 >= low and x > arr [ mid - 1 ] :
return mid
else :
return f_gold ( arr , low , mid - 1 , x )
| java | [
[
"[2, 6, 13, 16, 23, 24, 24, 27, 30, 32, 34, 34, 55, 56, 56, 63, 66, 81, 83, 96], 13, 11, 18",
"13"
],
[
"[-28, -96, 48, 22, -12, 72, 48, -70, -96, -84, -62, 22, 18, -92, -74, 14, 28, 52, 64, 72, 16, -76, 46], 11, 18, 21",
"11"
],
[
"[0, 1], 1, 1, 1",
"1"
],
[
"[51, 98, 25, 10, 43, 91, 33, 25, 85, 51, 94, 6, 35, 48, 11, 97, 67, 21, 50, 9, 11, 51, 86, 61, 22, 88, 89, 11], 20, 20, 15",
"-1"
],
[
"[-94, -92, -88, -74, -52, -50, -48, -44, -40, -36, -32, -26, 20, 22, 30, 32, 46, 56, 56, 60, 62, 64, 80, 84, 86, 94, 96, 96], 20, 15, 15",
"20"
],
[
"[1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], 15, 17, 22",
"-1"
],
[
"[4, 5, 5, 13, 26, 40, 46, 51, 58, 60, 64, 66, 68, 69, 71, 74, 78, 81, 83, 88, 88, 90, 98, 99], 12, 17, 14",
"12"
],
[
"[92, 6, -54, 84, -10, 32, 50, 40, -38, 64, -64, -10, 70, -68, -6, -16, 68, 34, -66, -82, 84, 98, 50, 82, 78, 4, 34, -34, 78, 64, 32, 58, -94, 40, 50, 0, -92, -36, 10, -54, 58, -78, -88, 32, 6], 23, 28, 28",
"23"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 24, 17, 22",
"-1"
],
[
"[80, 67, 30, 35, 9], 2, 3, 2",
"2"
]
] | f_gold | CEILING_IN_A_SORTED_ARRAY_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CEILING_IN_A_SORTED_ARRAY_1{
static int f_gold ( int arr [ ] , int low , int high , int x ) {
int mid ;
if ( x <= arr [ low ] ) return low ;
if ( x > arr [ high ] ) return - 1 ;
mid = ( low + high ) / 2 ;
if ( arr [ mid ] == x ) return mid ;
else if ( arr [ mid ] < x ) {
if ( mid + 1 <= high && x <= arr [ mid + 1 ] ) return mid + 1 ;
else return f_gold ( arr , mid + 1 , high , x ) ;
}
else {
if ( mid - 1 >= low && x > arr [ mid - 1 ] ) return mid ;
else return f_gold ( arr , low , mid - 1 , x ) ;
}
}
| [] |
|
null | [] | [] | python | code_translation | import sys
def f_gold ( arr , n ) :
res = - sys.maxsize - 1
for i in range ( n ) :
prefix_sum = arr [ i ]
for j in range ( i ) :
prefix_sum += arr [ j ]
suffix_sum = arr [ i ]
j = n - 1
while ( j > i ) :
suffix_sum += arr [ j ]
j -= 1
if ( prefix_sum == suffix_sum ) :
res = max ( res , prefix_sum )
return res
| java | [
[
"[3, 3, 9, 19, 22, 27, 32, 41, 45, 63, 66, 67, 81, 91], 13",
"-9223372036854775808"
],
[
"[-64, -2, 68, -48, 22, -14, -98], 4",
"-9223372036854775808"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 19",
"5"
],
[
"[86, 79, 23, 55, 4, 22, 37, 1, 72, 22, 82, 62, 96, 47], 8",
"-9223372036854775808"
],
[
"[-96, -96, -96, -96, -92, -82, -72, -72, -62, -58, -52, -48, -44, -44, -40, -34, -28, -26, -26, 0, 0, 2, 4, 4, 12, 12, 18, 34, 36, 40, 48, 48, 54, 60, 66, 66, 72, 76, 78, 82, 82, 96, 98], 33",
"-9223372036854775808"
],
[
"[0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0], 38",
"9"
],
[
"[2, 3, 7, 13, 20, 24, 39, 49, 53, 58, 72, 80, 90, 99], 11",
"-9223372036854775808"
],
[
"[-48, 44, 60, -30, 8, 20, 70, -50, 80, -2, -28, -14], 11",
"-9223372036854775808"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], 16",
"-9223372036854775808"
],
[
"[64, 13, 18, 3, 22, 29, 51, 45, 21, 13, 47, 15, 17, 34, 60, 99, 30, 54, 16, 47, 13, 49, 60, 66, 28, 57, 85, 66, 65, 7, 62, 29, 9], 21",
"-9223372036854775808"
]
] | f_gold | MAXIMUM_EQULIBRIUM_SUM_ARRAY | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_EQULIBRIUM_SUM_ARRAY{
static int f_gold ( int [ ] arr , int n ) {
int res = Integer . MIN_VALUE ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int prefix_sum = arr [ i ] ;
for ( int j = 0 ;
j < i ;
j ++ ) prefix_sum += arr [ j ] ;
int suffix_sum = arr [ i ] ;
for ( int j = n - 1 ;
j > i ;
j -- ) suffix_sum += arr [ j ] ;
if ( prefix_sum == suffix_sum ) res = Math . max ( res , prefix_sum ) ;
}
return res ;
}
| [
"import sys"
] |
|
null | [] | [] | python | code_translation | def f_gold ( low , high ) :
f1 , f2 , f3 = 0 , 1 , 1
result = 0
while ( f1 <= high ) :
if ( f1 >= low ) :
result += 1
f1 = f2
f2 = f3
f3 = f1 + f2
return result
| java | [
[
"76, 43",
"0"
],
[
"96, 52",
"0"
],
[
"19, 79",
"3"
],
[
"36, 2",
"0"
],
[
"60, 11",
"0"
],
[
"20, 15",
"0"
],
[
"76, 4",
"0"
],
[
"63, 93",
"1"
],
[
"2, 25",
"6"
],
[
"41, 39",
"0"
]
] | f_gold | COUNT_FIBONACCI_NUMBERS_GIVEN_RANGE_LOG_TIME | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_FIBONACCI_NUMBERS_GIVEN_RANGE_LOG_TIME{
static int f_gold ( int low , int high ) {
int f1 = 0 , f2 = 1 , f3 = 1 ;
int result = 0 ;
while ( f1 <= high ) {
if ( f1 >= low ) result ++ ;
f1 = f2 ;
f2 = f3 ;
f3 = f1 + f2 ;
}
return result ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n , x ) :
curr_sum = 0 ;
min_len = n + 1 ;
start = 0 ;
end = 0 ;
while ( end < n ) :
while ( curr_sum <= x and end < n ) :
if ( curr_sum <= 0 and x > 0 ) :
start = end ;
curr_sum = 0 ;
curr_sum += arr [ end ] ;
end += 1 ;
while ( curr_sum > x and start < n ) :
if ( end - start < min_len ) :
min_len = end - start ;
curr_sum -= arr [ start ] ;
start += 1 ;
return min_len ;
| java | [
[
"[2, 4, 5, 10, 14, 15, 16, 20, 23, 28, 31, 35, 36, 36, 43, 48, 49, 55, 57, 57, 58, 61, 64, 64, 68, 70, 70, 73, 74, 76, 76, 77, 81, 81, 82, 87, 89, 92, 99], 33, 28",
"1"
],
[
"[66, -20, 12, -48, 22, 28, 40, -30, -6, -96, 10, -88, 40], 11, 12",
"1"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 42, 23",
"43"
],
[
"[28, 19, 38, 31, 17, 27, 60, 35, 19, 47, 34, 51, 3, 95, 33, 29, 84, 46, 74, 87], 15, 15",
"1"
],
[
"[-48, -2], 1, 1",
"2"
],
[
"[1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1], 12, 15",
"13"
],
[
"[1, 4, 4, 6, 8, 10, 12, 12, 13, 15, 18, 20, 21, 23, 25, 28, 28, 33, 33, 35, 35, 36, 37, 38, 42, 44, 63, 63, 65, 65, 65, 66, 70, 74, 77, 78, 80, 80, 84, 87, 87, 89, 92, 93, 94, 97, 98, 99], 42, 27",
"1"
],
[
"[-82, -12, -40, 58, 22, -76, -94, -28, 42, 36, 64], 10, 6",
"1"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], 10, 14",
"11"
],
[
"[76, 65, 96, 76, 1, 91, 22, 29, 95, 21, 73, 68, 30, 52, 73, 86, 52, 66, 67, 37, 76, 53, 68, 6, 95, 81, 98, 42, 63, 38, 92, 78, 59, 86, 10, 38, 18, 15, 52, 62, 16, 66], 23, 35",
"1"
]
] | f_gold | MINIMUM_LENGTH_SUBARRAY_SUM_GREATER_GIVEN_VALUE_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_LENGTH_SUBARRAY_SUM_GREATER_GIVEN_VALUE_1{
static int f_gold ( int arr [ ] , int n , int x ) {
int curr_sum = 0 , min_len = n + 1 ;
int start = 0 , end = 0 ;
while ( end < n ) {
while ( curr_sum <= x && end < n ) {
if ( curr_sum <= 0 && x > 0 ) {
start = end ;
curr_sum = 0 ;
}
curr_sum += arr [ end ++ ] ;
}
while ( curr_sum > x && start < n ) {
if ( end - start < min_len ) min_len = end - start ;
curr_sum -= arr [ start ++ ] ;
}
}
return min_len ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n , k ) :
for i in range ( n ) :
count = 0
for j in range ( n ) :
if arr [ j ] == arr [ i ] :
count += 1
if count > 2 * k :
return False
return True
| java | [
[
"[1, 1, 2, 3, 1], 5, 2",
"True"
],
[
"[2, 3, 3, 5, 3, 3], 6, 2",
"True"
],
[
"[0, 0, 1, 1, 1], 2, 1",
"True"
],
[
"[7, 60, 78, 91, 80, 75, 85, 21, 41, 63, 1, 84, 69, 13, 94, 25, 54, 54, 52, 68, 53, 35, 17, 37, 98, 27, 2, 31], 24, 2",
"True"
],
[
"[-96, -94, -82, -80, -78, -66, -36, -24, -18, -12, -2, -2, 6, 8, 10, 12, 36, 38, 42, 58, 64, 68, 82, 84, 86, 88, 94], 24, 3",
"True"
],
[
"[0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0], 34, 2",
"False"
],
[
"[16, 19, 25, 25, 32, 37, 48, 59, 60, 60, 71, 74, 77, 81, 91, 94], 10, 8",
"True"
],
[
"[-62, -94, 72, -22, 86, -80, 64, 98, -82, -50, 12, -4, 56, 46, -80, 2, -86, -44, -26, 68, -94, -82, 74, 26, 94, 40, 50, -40, -42, -10], 20, 4",
"True"
],
[
"[0, 0, 0, 0, 0, 1, 1, 1], 5, 2",
"False"
],
[
"[83, 57, 2, 47, 70, 22, 49, 51, 25, 57, 32, 7, 8, 99, 6, 86, 24, 79, 42, 43, 1, 24, 68, 11, 24, 12, 43, 40, 14, 45, 11, 46, 12, 80, 66], 21, 33",
"True"
]
] | f_gold | DISTRIBUTING_ITEMS_PERSON_CANNOT_TAKE_TWO_ITEMS_TYPE | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DISTRIBUTING_ITEMS_PERSON_CANNOT_TAKE_TWO_ITEMS_TYPE{
static boolean f_gold ( int [ ] arr , int n , int k ) {
int count ;
for ( int i = 0 ;
i < n ;
i ++ ) {
count = 0 ;
for ( int j = 0 ;
j < n ;
j ++ ) {
if ( arr [ j ] == arr [ i ] ) count ++ ;
if ( count > 2 * k ) return false ;
}
}
return true ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( array , start , end ) :
if ( start > end ) :
return end + 1
if ( start != array [ start ] ) :
return start ;
mid = int ( ( start + end ) / 2 )
if ( array [ mid ] == mid ) :
return f_gold ( array , mid + 1 , end )
return f_gold ( array , start , mid )
| java | [
[
"[3, 6, 7, 9, 11, 14, 18, 30, 30, 32, 32, 34, 37, 44, 45, 45, 48, 48, 48, 52, 58, 60, 63, 67, 69, 69, 81, 83, 87, 89, 97, 99], 24, 18",
"19"
],
[
"[88, -62, 16, 80, 66, 78, 88, 38, 52, -96, 48, 98, 96, -62, 18, 34, -58, 30, -10, 26, -98, 48, -96, 4, 92, 36, 36, -36, -32, -70, 62, -58, -58, -84, 86, -98], 19, 26",
"19"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 26, 28",
"26"
],
[
"[79, 99, 79, 85, 61, 58, 62, 61, 39, 87, 39, 74, 36, 70, 30, 43, 20, 52, 54, 50, 81, 98, 42], 20, 20",
"20"
],
[
"[-98, -72, -46, -44, -42, -40, -16, -4, 62, 70, 74], 8, 10",
"8"
],
[
"[1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], 26, 23",
"24"
],
[
"[58], 0, 0",
"0"
],
[
"[4, -84, -42, 12, -50, 42, -36, -38, -36, 98, -2, 20, 6, -96, -78, 24, 34, 88, 0, 74, 0, -8, -86, -68, -42, 98, -26, 86, -70, -32, -82, 78, 46, 58, 84, 4, -60, -90, -52, -78], 37, 31",
"32"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 28, 28",
"28"
],
[
"[8], 0, 0",
"0"
]
] | f_gold | FIND_THE_FIRST_MISSING_NUMBER | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THE_FIRST_MISSING_NUMBER{
static int f_gold ( int array [ ] , int start , int end ) {
if ( start > end ) return end + 1 ;
if ( start != array [ start ] ) return start ;
int mid = ( start + end ) / 2 ;
if ( array [ mid ] == mid ) return f_gold ( array , mid + 1 , end ) ;
return f_gold ( array , start , mid ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( x , p1 , p2 , n ) :
set1 = ( x >> p1 ) & ( ( 1 << n ) - 1 )
set2 = ( x >> p2 ) & ( ( 1 << n ) - 1 )
xor = ( set1 ^ set2 )
xor = ( xor << p1 ) | ( xor << p2 )
result = x ^ xor
return result
| java | [
[
"95, 88, 97, 92",
"95"
],
[
"16, 26, 59, 42",
"16"
],
[
"55, 56, 40, 41",
"55"
],
[
"75, 35, 79, 30",
"75"
],
[
"90, 12, 59, 34",
"90"
],
[
"58, 65, 25, 19",
"58"
],
[
"69, 64, 17, 94",
"69"
],
[
"5, 1, 59, 38",
"1152921504606846977"
],
[
"36, 33, 97, 44",
"36"
],
[
"62, 69, 66, 9",
"62"
]
] | f_gold | SWAP_BITS_IN_A_GIVEN_NUMBER | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SWAP_BITS_IN_A_GIVEN_NUMBER{
static int f_gold ( int x , int p1 , int p2 , int n ) {
int set1 = ( x >> p1 ) & ( ( 1 << n ) - 1 ) ;
int set2 = ( x >> p2 ) & ( ( 1 << n ) - 1 ) ;
int xor = ( set1 ^ set2 ) ;
xor = ( xor << p1 ) | ( xor << p2 ) ;
int result = x ^ xor ;
return result ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( X , Y , m , n ) :
res = 0
X.sort ( reverse = True )
Y.sort ( reverse = True )
hzntl = 1 ; vert = 1
i = 0 ; j = 0
while ( i < m and j < n ) :
if ( X [ i ] > Y [ j ] ) :
res += X [ i ] * vert
hzntl += 1
i += 1
else :
res += Y [ j ] * hzntl
vert += 1
j += 1
total = 0
while ( i < m ) :
total += X [ i ]
i += 1
res += total * vert
total = 0
while ( j < n ) :
total += Y [ j ]
j += 1
res += total * hzntl
return res
| java | [
[
"[98, 97, 93, 90, 90, 87, 87, 87, 83, 77, 75, 73, 70, 70, 69, 67, 67, 61, 60, 59, 58, 58, 56, 53, 52, 46, 46, 44, 40, 37, 34, 33, 33, 33, 32, 28, 26, 25, 25, 23, 22, 22, 20, 18, 16, 9, 9, 1], [99, 97, 96, 95, 92, 91, 88, 87, 86, 77, 74, 73, 73, 72, 71, 70, 70, 67, 63, 62, 60, 59, 56, 55, 55, 55, 50, 47, 45, 39, 39, 37, 35, 30, 30, 29, 27, 25, 23, 20, 19, 17, 16, 13, 10, 9, 3, 2], 25, 27",
"47899"
],
[
"[78, 66, 66, 52, -4, -52, -72, -74], [88, 84, 72, 30, -34, -40, -76, -78], 6, 7",
"76"
],
[
"[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 15, 19",
"119"
],
[
"[97, 96, 89, 87, 83, 78, 77, 76, 67, 66, 63, 58, 54, 52, 48, 44, 38, 37, 28, 28, 19, 2], [94, 92, 91, 83, 79, 75, 75, 72, 63, 63, 47, 40, 37, 36, 36, 33, 33, 29, 26, 19, 9, 5], 13, 14",
"13164"
],
[
"[96, 90, 86, 78, 70, 32, 26, 26, 20, 16, 14, -2, -2, -4, -8, -10, -34, -44, -58, -60, -62, -62, -68, -72, -76, -78, -84], [98, 92, 78, 66, 64, 50, 48, 42, 36, 26, 16, 16, 0, -4, -10, -18, -24, -32, -32, -48, -60, -62, -76, -82, -86, -98, -98], 15, 24",
"-1650"
],
[
"[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 25, 26",
"341"
],
[
"[75, 30], [39, 10], 1, 1",
"153"
],
[
"[96, 78, 74, 70, 70, 62, 60, 58, 50, 46, 44, 40, 38, 38, 36, 32, 24, 22, 16, 14, 10, 0, -8, -10, -10, -18, -20, -36, -52, -54, -56, -56, -60, -60, -68, -82, -96], [94, 92, 92, 90, 86, 80, 78, 70, 64, 62, 46, 46, 40, 40, 32, 6, 4, -6, -14, -18, -20, -22, -24, -28, -34, -42, -50, -56, -62, -66, -76, -86, -86, -90, -92, -94, -96], 19, 19",
"14508"
],
[
"[1, 0, 0, 0], [1, 1, 1, 0], 2, 2",
"5"
],
[
"[90, 81, 81, 74, 67, 40, 29, 25, 24, 13, 10], [75, 74, 58, 53, 51, 49, 45, 25, 23, 14, 7], 8, 10",
"4117"
]
] | f_gold | MINIMUM_COST_CUT_BOARD_SQUARES | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_COST_CUT_BOARD_SQUARES{
static int f_gold ( Integer X [ ] , Integer Y [ ] , int m , int n ) {
int res = 0 ;
Arrays . sort ( X , Collections . reverseOrder ( ) ) ;
Arrays . sort ( Y , Collections . reverseOrder ( ) ) ;
int hzntl = 1 , vert = 1 ;
int i = 0 , j = 0 ;
while ( i < m && j < n ) {
if ( X [ i ] > Y [ j ] ) {
res += X [ i ] * vert ;
hzntl ++ ;
i ++ ;
}
else {
res += Y [ j ] * hzntl ;
vert ++ ;
j ++ ;
}
}
int total = 0 ;
while ( i < m ) total += X [ i ++ ] ;
res += total * vert ;
total = 0 ;
while ( j < n ) total += Y [ j ++ ] ;
res += total * hzntl ;
return res ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold(x, y, n):
sum = 0
for i in range(n):
for j in range(i + 1, n):
sum += (abs(x[i] - x[j]) + abs(y[i] - y[j]))
return sum
| java | [
[
"[2, 4, 6, 6, 8, 11, 12, 13, 14, 19, 20, 22, 24, 28, 29, 30, 32, 35, 37, 44, 48, 49, 51, 51, 56, 59, 59, 62, 65, 68, 68, 68, 72, 75, 77, 78, 89, 89, 91, 93, 95, 99], [6, 19, 19, 22, 25, 27, 31, 33, 34, 35, 37, 38, 38, 44, 46, 50, 51, 55, 58, 58, 64, 64, 64, 64, 65, 66, 66, 66, 67, 70, 75, 78, 79, 81, 81, 81, 82, 84, 84, 86, 94, 96], 37",
"35930"
],
[
"[16, 76, 2, 42, -24, -82, 68, -2, 98, -42, -72, 28, -22, -52, 28, -38, 36, 66, 84, 64, -28, 86, 52, 84, -98, -30], [-34, 92, -24, -62, 28, 72, -10, 10, 8, 90, -72, -24, 50, -46, 52, 58, 68, -62, -64, -78, -12, 24, 62, -30, 62, -60], 24",
"35216"
],
[
"[0, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 5",
"4"
],
[
"[61, 37, 57, 99, 22, 72, 38, 85, 23, 85, 15, 4, 49, 9, 15, 25, 7, 63, 79, 6, 85, 30, 12, 34, 38, 6, 59, 62, 59, 34, 72, 97, 70, 44, 95, 58, 99], [72, 41, 77, 62, 78, 36, 75, 28, 91, 39, 32, 56, 60, 64, 21, 15, 80, 85, 28, 22, 53, 58, 69, 62, 60, 48, 66, 91, 38, 66, 54, 5, 24, 1, 49, 71, 49], 26",
"19322"
],
[
"[-96, -86, -82, -72, -72, -64, -62, -60, -56, -56, -56, -54, -52, -40, -36, -30, -10, 10, 18, 26, 28, 56, 56, 56, 64, 90, 92, 94], [-98, -98, -96, -96, -82, -80, -80, -68, -62, -60, -46, -38, -26, -26, -20, -18, 16, 22, 24, 26, 34, 46, 52, 52, 74, 76, 90, 92], 26",
"42084"
],
[
"[1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 1], 3",
"4"
],
[
"[6, 10, 24, 25, 31, 41, 43, 45, 47, 65, 67, 90], [4, 7, 11, 19, 21, 39, 57, 80, 84, 93, 94, 97], 10",
"2776"
],
[
"[-74, 92, 34, 56, -54, -98, -76, -34, 16, 32, -4, -16, 22, 90, -52, -90, -60, 70, -40, 78, 96, -68, 78, -56, -94], [14, 20, 24, -92, 58, 12, 78, 78, -90, 96, -44, 36, 30, -46, -30, -80, 26, -2, 26, 28, -16, -50, -2, -36, -8], 21",
"28932"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 23",
"188"
],
[
"[20, 32], [23, 50], 1",
"0"
]
] | f_gold | SUM_MANHATTAN_DISTANCES_PAIRS_POINTS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_MANHATTAN_DISTANCES_PAIRS_POINTS{
static int f_gold ( int x [ ] , int y [ ] , int n ) {
int sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = i + 1 ;
j < n ;
j ++ ) sum += ( Math . abs ( x [ i ] - x [ j ] ) + Math . abs ( y [ i ] - y [ j ] ) ) ;
return sum ;
}
| [] |
|
null | [] | [] | python | code_translation | import math
def f_gold ( n ) :
fibo = 2.078087 * math.log ( n ) + 1.672276
return round ( fibo )
| java | [
[
"20",
"8"
],
[
"95",
"11"
],
[
"39",
"9"
],
[
"21",
"8"
],
[
"94",
"11"
],
[
"79",
"11"
],
[
"56",
"10"
],
[
"62",
"10"
],
[
"23",
"8"
],
[
"3",
"4"
]
] | f_gold | FIND_INDEX_GIVEN_FIBONACCI_NUMBER_CONSTANT_TIME_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_INDEX_GIVEN_FIBONACCI_NUMBER_CONSTANT_TIME_1{
static int f_gold ( int n ) {
float fibo = 2.078087F * ( float ) Math . log ( n ) + 1.672276F ;
return Math . round ( fibo ) ;
}
| [
"import math"
] |
|
null | [] | [] | python | code_translation | def f_gold ( n , x ) :
cnt = 0
for i in range ( 1 , n + 1 ) :
if i <= x :
if x // i <= n and x % i == 0 :
cnt += 1
return cnt
| java | [
[
"47, 30",
"8"
],
[
"57, 16",
"5"
],
[
"55, 63",
"4"
],
[
"11, 23",
"0"
],
[
"55, 49",
"3"
],
[
"63, 64",
"5"
],
[
"64, 98",
"4"
],
[
"28, 30",
"6"
],
[
"49, 61",
"0"
],
[
"48, 64",
"5"
]
] | f_gold | COUNT_ENTRIES_EQUAL_TO_X_IN_A_SPECIAL_MATRIX | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_ENTRIES_EQUAL_TO_X_IN_A_SPECIAL_MATRIX{
static int f_gold ( int n , int x ) {
int f_gold = 0 ;
for ( int i = 1 ;
i <= n && i <= x ;
i ++ ) {
if ( x / i <= n && x % i == 0 ) f_gold ++ ;
}
return f_gold ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold(n):
if (n < 4):
return - 1
rem = n % 4
if (rem == 0):
return n // 4
if (rem == 1):
if (n < 9):
return - 1
return (n - 9) // 4 + 1
if (rem == 2):
return (n - 6) // 4 + 1
if (rem == 3):
if (n < 15):
return - 1
return (n - 15) // 4 + 2
| java | [
[
"55",
"12"
],
[
"35",
"7"
],
[
"24",
"6"
],
[
"75",
"17"
],
[
"5",
"-1"
],
[
"7",
"-1"
],
[
"50",
"12"
],
[
"28",
"7"
],
[
"67",
"15"
],
[
"59",
"13"
]
] | f_gold | SPLIT_N_MAXIMUM_COMPOSITE_NUMBERS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SPLIT_N_MAXIMUM_COMPOSITE_NUMBERS{
static int f_gold ( int n ) {
if ( n < 4 ) return - 1 ;
int rem = n % 4 ;
if ( rem == 0 ) return n / 4 ;
if ( rem == 1 ) {
if ( n < 9 ) return - 1 ;
return ( n - 9 ) / 4 + 1 ;
}
if ( rem == 2 ) return ( n - 6 ) / 4 + 1 ;
if ( rem == 3 ) {
if ( n < 15 ) return - 1 ;
return ( n - 15 ) / 4 + 2 ;
}
return 0 ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( s , t ) :
count = 0
for i in range ( 0 , len ( t ) ) :
if ( count == len ( s ) ) :
break
if ( t [ i ] == s [ count ] ) :
count = count + 1
return count
| java | [
[
"'nObYIOjEQZ', 'uARTDTQbmGI'",
"0"
],
[
"'84574', '8538229'",
"1"
],
[
"'1010001010010', '11'",
"1"
],
[
"'DjZtAfUudk', 'OewGm'",
"0"
],
[
"'550', '132744553919'",
"2"
],
[
"'1110', '0101'",
"2"
],
[
"'GywyxwH', 'LPQqEqrDZiwY'",
"0"
],
[
"'67318370914755', '9928'",
"0"
],
[
"'11011000000101', '00000'",
"0"
],
[
"'G', 'V'",
"0"
]
] | f_gold | MAXIMUM_LENGTH_PREFIX_ONE_STRING_OCCURS_SUBSEQUENCE_ANOTHER | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_LENGTH_PREFIX_ONE_STRING_OCCURS_SUBSEQUENCE_ANOTHER{
static int f_gold ( String s , String t ) {
int count = 0 ;
for ( int i = 0 ;
i < t . length ( ) ;
i ++ ) {
if ( count == t . length ( ) ) break ;
if ( t . charAt ( i ) == s . charAt ( count ) ) count ++ ;
}
return count ;
}
| [] |
|
null | [] | [] | python | code_translation | import sys
def f_gold(A, B, m, n):
A.sort()
B.sort()
a = 0
b = 0
result = sys.maxsize
while (a < m and b < n):
if (abs(A[a] - B[b]) < result):
result = abs(A[a] - B[b])
if (A[a] < B[b]):
a += 1
else:
b += 1
return result
| java | [
[
"[2, 2, 11, 13, 18, 18, 23, 25, 28, 28, 37, 39, 53, 56, 67, 70, 74, 74, 75, 79, 80, 82, 84, 89, 94, 95, 95, 98, 98], [5, 6, 11, 13, 13, 16, 17, 19, 23, 25, 28, 31, 31, 39, 41, 44, 45, 52, 62, 64, 70, 71, 73, 78, 78, 79, 85, 86, 92], 28, 14",
"0"
],
[
"[-94, -78, -78, -72, -72, -72, -70, -70, -64, -62, -50, -48, -48, -44, -44, -40, -36, -36, -30, -24, -24, -22, -12, -10, -8, -4, -4, 0, 6, 10, 22, 30, 38, 56, 62, 72, 86], [-98, -98, -90, -84, -80, -78, -68, -62, -52, -50, -42, -30, -26, -24, -24, -24, -12, 2, 10, 14, 18, 22, 26, 26, 36, 42, 50, 60, 62, 64, 64, 72, 76, 78, 84, 86, 92], 23, 33",
"0"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 14, 16",
"0"
],
[
"[2, 9, 15, 24, 28, 28, 39, 47, 57, 61, 71, 82, 90], [11, 26, 27, 41, 47, 49, 51, 54, 70, 77, 84, 85, 92], 7, 8",
"1"
],
[
"[-92, -90, -90, -28, -16, -14, -14, -8, 42, 52, 62, 84], [-98, -98, -58, -6, 14, 16, 18, 46, 52, 52, 52, 56], 11, 6",
"2"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 35, 33",
"0"
],
[
"[6, 7, 7, 12, 15, 15, 21, 24, 26, 26, 28, 36, 38, 42, 46, 52, 55, 56, 59, 62, 63, 65, 65, 66, 68, 71, 73, 77, 77, 77, 77, 85, 87, 87, 88, 90, 93, 94, 98], [1, 3, 4, 4, 6, 7, 8, 8, 15, 17, 18, 18, 20, 23, 23, 24, 25, 25, 26, 33, 39, 43, 46, 54, 59, 67, 69, 69, 69, 69, 76, 76, 81, 81, 85, 86, 86, 91, 95], 30, 20",
"0"
],
[
"[-82, -68, -68, -60, -60, -38, -20, -16, 4, 18, 18, 22, 24, 30, 34, 44, 70, 78, 88, 90, 94], [-74, -68, -64, -62, -60, -52, -50, -44, -36, -34, -32, -30, -20, -18, -14, -2, 18, 62, 62, 84, 98], 16, 12",
"0"
],
[
"[0, 0, 1], [0, 0, 1], 2, 1",
"0"
],
[
"[2, 7, 7, 9, 14, 15, 16, 20, 21, 26, 35, 37, 40, 45, 46, 47, 53, 56, 58, 61, 62, 67, 70, 70, 71, 73, 81, 85, 85, 90, 94, 98, 99], [1, 7, 14, 16, 18, 19, 24, 27, 28, 29, 29, 37, 41, 44, 45, 48, 49, 55, 64, 67, 67, 71, 72, 79, 80, 84, 86, 88, 88, 92, 94, 98, 99], 20, 25",
"0"
]
] | f_gold | SMALLEST_DIFFERENCE_PAIR_VALUES_TWO_UNSORTED_ARRAYS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SMALLEST_DIFFERENCE_PAIR_VALUES_TWO_UNSORTED_ARRAYS{
static int f_gold ( int A [ ] , int B [ ] , int m , int n ) {
Arrays . sort ( A ) ;
Arrays . sort ( B ) ;
int a = 0 , b = 0 ;
int result = Integer . MAX_VALUE ;
while ( a < m && b < n ) {
if ( Math . abs ( A [ a ] - B [ b ] ) < result ) result = Math . abs ( A [ a ] - B [ b ] ) ;
if ( A [ a ] < B [ b ] ) a ++ ;
else b ++ ;
}
return result ;
}
| [
"import sys"
] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
return ( not ( n & 1 ) )
| java | [
[
"57",
"False"
],
[
"73",
"False"
],
[
"79",
"False"
],
[
"36",
"True"
],
[
"71",
"False"
],
[
"23",
"False"
],
[
"41",
"False"
],
[
"66",
"True"
],
[
"46",
"True"
],
[
"50",
"True"
]
] | f_gold | CHECK_WHETHER_GIVEN_NUMBER_EVEN_ODD_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_WHETHER_GIVEN_NUMBER_EVEN_ODD_1{
public static boolean f_gold ( int n ) {
if ( ( n & 1 ) == 0 ) return true ;
else return false ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a , b , n ) :
a.sort ( reverse = False )
b.sort ( reverse = False )
result = 0
for i in range ( 0 , n , 1 ) :
if ( a [ i ] > b [ i ] ) :
result = result + abs ( a [ i ] - b [ i ] )
elif ( a [ i ] < b [ i ] ) :
result = result + abs ( a [ i ] - b [ i ] )
return result
| java | [
[
"[1, 6, 6, 7, 10, 11, 13, 18, 19, 19, 19, 31, 34, 37, 37, 40, 41, 41, 47, 47, 53, 54, 55, 55, 56, 56, 60, 60, 62, 62, 66, 73, 75, 76, 78, 81, 81, 85, 88, 90, 91, 92, 93, 95, 97, 98], [2, 2, 4, 7, 8, 8, 8, 8, 8, 9, 9, 12, 15, 16, 21, 25, 26, 27, 29, 34, 34, 35, 38, 40, 40, 44, 44, 47, 48, 54, 58, 61, 63, 64, 66, 69, 69, 70, 73, 74, 75, 76, 79, 80, 80, 93], 23",
"263"
],
[
"[-32, -12, -6, 62, 78, 86], [-86, -60, 20, 32, 50, 52], 4",
"158"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 14",
"4"
],
[
"[74, 76], [16, 98], 1",
"58"
],
[
"[-92, -90, -88, -84, -76, -54, -44, -42, -38, -30, 34, 42], [-80, -54, -34, 12, 14, 16, 16, 46, 50, 64, 84, 92], 8",
"506"
],
[
"[0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 14",
"0"
],
[
"[4, 5, 6, 13, 16, 24, 36, 40, 40, 44, 47, 52, 58, 58, 59, 63, 66, 67, 69, 70, 74, 77, 81, 88, 89, 90, 94, 96], [1, 7, 10, 17, 21, 22, 22, 27, 36, 37, 39, 46, 52, 53, 56, 59, 65, 67, 70, 75, 78, 78, 79, 89, 89, 94, 96, 97], 24",
"105"
],
[
"[-54, -36, -36, -16, -12, -10, -8, -2, 10, 22, 36, 40, 44, 50, 54, 66, 84, 92, 98], [-92, -76, -74, -62, -58, -26, -18, -10, -10, -10, -6, 22, 26, 50, 62, 78, 84, 86, 86], 16",
"392"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 36",
"5"
],
[
"[3, 7, 8, 15, 19, 24, 26, 30, 32, 34, 37, 42, 43, 43, 55, 55, 55, 63, 64, 64, 76, 81, 88, 94], [3, 4, 11, 17, 17, 22, 28, 44, 63, 63, 65, 66, 69, 74, 80, 80, 81, 81, 81, 86, 90, 91, 96, 98], 22",
"354"
]
] | f_gold | MAKING_ELEMENTS_OF_TWO_ARRAYS_SAME_WITH_MINIMUM_INCREMENTDECREMENT | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAKING_ELEMENTS_OF_TWO_ARRAYS_SAME_WITH_MINIMUM_INCREMENTDECREMENT{
static int f_gold ( int a [ ] , int b [ ] , int n ) {
Arrays . sort ( a ) ;
Arrays . sort ( b ) ;
int result = 0 ;
for ( int i = 0 ;
i < n ;
++ i ) {
if ( a [ i ] > b [ i ] ) result = result + Math . abs ( a [ i ] - b [ i ] ) ;
else if ( a [ i ] < b [ i ] ) result = result + Math . abs ( a [ i ] - b [ i ] ) ;
}
return result ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( num , divisor ) :
while ( num >= divisor ) :
num -= divisor ;
return num ;
| java | [
[
"70, 13",
"5"
],
[
"77, 3",
"2"
],
[
"77, 73",
"4"
],
[
"88, 54",
"34"
],
[
"96, 39",
"18"
],
[
"6, 10",
"6"
],
[
"79, 95",
"79"
],
[
"44, 32",
"12"
],
[
"26, 86",
"26"
],
[
"82, 91",
"82"
]
] | f_gold | PROGRAM_TO_FIND_REMAINDER_WITHOUT_USING_MODULO_OR_OPERATOR_2 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_TO_FIND_REMAINDER_WITHOUT_USING_MODULO_OR_OPERATOR_2{
static int f_gold ( int num , int divisor ) {
while ( num >= divisor ) num -= divisor ;
return num ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n ) :
arr.sort ( )
return ( arr [ n - 1 ] + arr [ n - 2 ] + arr [ n - 3 ] )
| java | [
[
"[6, 8, 18, 18, 27, 33, 33, 38, 42, 43, 44, 47, 52, 58, 64, 65, 67, 68, 71, 75, 85, 89, 91, 94, 94, 95, 95], 26",
"283"
],
[
"[-88, -84, -82, -58, -12, 18, 24, 24, 28, 30, 34, 44, 92, 94], 8",
"66"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1], 15",
"2"
],
[
"[1, 2, 4, 5, 9, 11, 12, 15, 16, 18, 18, 21, 23, 25, 25, 26, 27, 28, 31, 34, 35, 47, 51, 55, 63, 63, 66, 67, 70, 70, 72, 73, 73, 75, 76, 79, 81, 84, 87, 87, 92, 94, 95], 37",
"236"
],
[
"[-86, -86, -78, -56, -24, -14, -10, -6, 12, 12, 18, 22, 22, 26, 50, 50, 72, 78, 94], 9",
"-4"
],
[
"[0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1], 9",
"2"
],
[
"[2, 13, 17, 19, 20, 23, 28, 28, 29, 40, 45, 51, 52, 58, 58, 68, 70, 75, 79, 81, 92, 96, 97], 15",
"168"
],
[
"[-78, -62, -46, -36, -20, -4, 4, 6, 6, 40, 50, 52, 64, 76, 94], 13",
"166"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 27",
"3"
],
[
"[3, 3, 4, 5, 6, 7, 11, 11, 14, 15, 17, 22, 25, 32, 33, 34, 35, 42, 44, 44, 52, 57, 58, 66, 70, 89], 13",
"64"
]
] | f_gold | MAXIMUM_TRIPLET_SUM_ARRAY_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_TRIPLET_SUM_ARRAY_1{
static int f_gold ( int arr [ ] , int n ) {
Arrays . sort ( arr ) ;
return arr [ n - 1 ] + arr [ n - 2 ] + arr [ n - 3 ] ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n ) :
ans = 0
for i in range ( 0 , n ) :
for j in range ( i + 1 , n ) :
if ( arr [ i ] == arr [ j ] ) :
ans += 1
return ans
| java | [
[
"[4, 6, 9, 16, 16, 21, 36, 41, 58, 60, 62, 73, 77, 81, 95], 12",
"1"
],
[
"[-86, -72, -26, -34, 18, -62, -66], 3",
"0"
],
[
"[1], 0",
"0"
],
[
"[16], 0",
"0"
],
[
"[-88, -80, -72, -68, -64, -26, 4, 14, 16, 22, 30, 32, 60, 74, 82], 11",
"0"
],
[
"[0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1], 9",
"16"
],
[
"[3, 9, 10, 12, 17, 23, 27, 29, 42, 44, 59, 61, 71, 76, 78, 82, 84, 84, 89, 90, 93, 93, 97, 97], 15",
"0"
],
[
"[68, -40, -46, -20, -64, 90], 5",
"0"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 15",
"61"
],
[
"[99, 17, 94, 43, 97, 17, 11, 58, 75, 94, 37, 22, 54, 31, 41, 4, 55, 69, 92, 80, 45, 97, 16, 33, 36, 17, 43, 82, 81, 64, 22, 65, 85, 44, 47, 14], 23",
"3"
]
] | f_gold | COUNT_INDEX_PAIRS_EQUAL_ELEMENTS_ARRAY | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_INDEX_PAIRS_EQUAL_ELEMENTS_ARRAY{
static int f_gold ( int arr [ ] , int n ) {
int ans = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = i + 1 ;
j < n ;
j ++ ) if ( arr [ i ] == arr [ j ] ) ans ++ ;
return ans ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n , m , k ) :
if ( m <= n - k + 1 ) :
return m + k - 1
m = m - ( n - k + 1 )
if ( m % n == 0 ) :
return n
else :
return m % n
| java | [
[
"19, 14, 34",
"9"
],
[
"23, 51, 5",
"9"
],
[
"92, 10, 24",
"33"
],
[
"9, 50, 34",
"2"
],
[
"20, 67, 20",
"6"
],
[
"68, 25, 40",
"64"
],
[
"66, 30, 24",
"53"
],
[
"77, 22, 32",
"53"
],
[
"90, 1, 71",
"71"
],
[
"26, 34, 54",
"9"
]
] | f_gold | DISTRIBUTING_M_ITEMS_CIRCLE_SIZE_N_STARTING_K_TH_POSITION | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DISTRIBUTING_M_ITEMS_CIRCLE_SIZE_N_STARTING_K_TH_POSITION{
static int f_gold ( int n , int m , int k ) {
if ( m <= n - k + 1 ) return m + k - 1 ;
m = m - ( n - k + 1 ) ;
return ( m % n == 0 ) ? n : ( m % n ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
if ( n == 0 ) :
return 1
return n * f_gold ( n - 1 )
| java | [
[
"77",
"145183092028285869634070784086308284983740379224208358846781574688061991349156420080065207861248000000000000000000"
],
[
"62",
"31469973260387937525653122354950764088012280797258232192163168247821107200000000000000"
],
[
"42",
"1405006117752879898543142606244511569936384000000000"
],
[
"16",
"20922789888000"
],
[
"82",
"475364333701284174842138206989404946643813294067993328617160934076743994734899148613007131808479167119360000000000000000000"
],
[
"37",
"13763753091226345046315979581580902400000000"
],
[
"29",
"8841761993739701954543616000000"
],
[
"32",
"263130836933693530167218012160000000"
],
[
"82",
"475364333701284174842138206989404946643813294067993328617160934076743994734899148613007131808479167119360000000000000000000"
],
[
"91",
"135200152767840296255166568759495142147586866476906677791741734597153670771559994765685283954750449427751168336768008192000000000000000000000"
]
] | f_gold | TAIL_RECURSION | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class TAIL_RECURSION{
static int f_gold ( int n ) {
if ( n == 0 ) return 1 ;
return n * f_gold ( n - 1 ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n , d ) :
return ( n & ( d - 1 ) )
| java | [
[
"54, 59",
"50"
],
[
"39, 84",
"3"
],
[
"35, 81",
"0"
],
[
"9, 60",
"9"
],
[
"62, 68",
"2"
],
[
"16, 16",
"0"
],
[
"93, 96",
"93"
],
[
"32, 38",
"32"
],
[
"39, 62",
"37"
],
[
"63, 16",
"15"
]
] | f_gold | COMPUTE_MODULUS_DIVISION_BY_A_POWER_OF_2_NUMBER | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COMPUTE_MODULUS_DIVISION_BY_A_POWER_OF_2_NUMBER{
static int f_gold ( int n , int d ) {
return ( n & ( d - 1 ) ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( a , b , c ) :
x = a - b
y = b - c
z = a - c
if x * y > 0 :
return b
elif ( x * z > 0 ) :
return
else :
return a
| java | [
[
"48, 46, 38",
"46"
],
[
"21, 7, 16",
"None"
],
[
"71, 4, 31",
"None"
],
[
"93, 34, 11",
"34"
],
[
"3, 61, 32",
"None"
],
[
"58, 78, 6",
"58"
],
[
"88, 41, 66",
"None"
],
[
"8, 84, 38",
"None"
],
[
"17, 66, 27",
"None"
],
[
"13, 3, 23",
"13"
]
] | f_gold | MIDDLE_OF_THREE_USING_MINIMUM_COMPARISONS_2 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MIDDLE_OF_THREE_USING_MINIMUM_COMPARISONS_2{
public static int f_gold ( int a , int b , int c ) {
int x = a - b ;
int y = b - c ;
int z = a - c ;
if ( x * y > 0 ) return b ;
else if ( x * z > 0 ) return c ;
else return a ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , N ) :
lis = [ 0 ] * N
for i in range ( N ) :
lis [ i ] = 1
for i in range ( 1 , N ) :
for j in range ( i ) :
if ( arr [ i ] >= arr [ j ] and lis [ i ] < lis [ j ] + 1 ) :
lis [ i ] = lis [ j ] + 1
max = 0
for i in range ( N ) :
if ( max < lis [ i ] ) :
max = lis [ i ]
return ( N - max )
| java | [
[
"[4, 7, 20, 22, 23, 31, 33, 36, 47, 61, 63, 63, 71, 74, 82, 91, 95, 99], 15",
"0"
],
[
"[-84, 12, -42, -78, 22, 72, 56, 70, 28, -72], 7",
"3"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 16",
"0"
],
[
"[29, 41, 4, 62, 77, 74, 30, 2, 14, 90, 93, 10, 78, 36, 66, 22, 48, 89, 36, 73, 70, 23, 90], 13",
"7"
],
[
"[-80, -72, -68, -66, -58, -50, -48, -32, -28, -24, -22, -18, 0, 2, 6, 10, 12, 14, 14, 18, 24, 24, 24, 28, 28, 28, 34, 38, 42, 42, 46, 46, 46, 58, 80, 82, 82, 84, 84, 86, 88, 90, 92, 96], 36",
"0"
],
[
"[1, 1, 0, 1, 0, 1, 0, 0, 1, 0], 8",
"4"
],
[
"[26, 36, 58, 64, 69, 72, 79, 82, 82, 87, 89, 90, 95], 8",
"0"
],
[
"[-52, -40, 98, 40, 42, -50, 60, -64, -92, 36, -88, 72, -72, 38, -80, -52, 68, 70, 16, 22, -30, -74, 56, -80, 62, -54, -32, -22, -86, -70, 88, -76, -46, 28, 40, -2, -84, 68, -98, -16, 90, 36, -38, -86, 20, -40, 82, 98, 54], 41",
"30"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1], 10",
"0"
],
[
"[36, 62, 58, 24, 99, 12, 46, 3, 4, 40, 54, 97, 48, 94, 98, 7, 17, 5, 3, 36, 3], 16",
"10"
]
] | f_gold | MINIMUM_INSERTIONS_SORT_ARRAY | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_INSERTIONS_SORT_ARRAY{
static int f_gold ( int arr [ ] , int N ) {
int [ ] lis = new int [ N ] ;
for ( int i = 0 ;
i < N ;
i ++ ) lis [ i ] = 1 ;
for ( int i = 1 ;
i < N ;
i ++ ) for ( int j = 0 ;
j < i ;
j ++ ) if ( arr [ i ] >= arr [ j ] && lis [ i ] < lis [ j ] + 1 ) lis [ i ] = lis [ j ] + 1 ;
int max = 0 ;
for ( int i = 0 ;
i < N ;
i ++ ) if ( max < lis [ i ] ) max = lis [ i ] ;
return ( N - max ) ;
}
| [] |
|
null | [] | [] | python | code_translation | import sys
def f_gold ( str1 ) :
n = len ( str1 ) ;
C = [ 0 ] * ( n + 1 ) ;
P = [ [ False for x in range ( n + 1 ) ] for y in range ( n + 1 ) ] ;
for i in range ( n ) :
P [ i ] [ i ] = True ;
for L in range ( 2 , n + 1 ) :
for i in range ( n - L + 1 ) :
j = i + L - 1 ;
if ( L == 2 ) :
P [ i ] [ j ] = ( str1 [ i ] == str1 [ j ] ) ;
else :
P [ i ] [ j ] = ( ( str1 [ i ] == str1 [ j ] ) and P [ i + 1 ] [ j - 1 ] ) ;
for i in range ( n ) :
if ( P [ 0 ] [ i ] == True ) :
C [ i ] = 0 ;
else :
C [ i ] = sys.maxsize ;
for j in range ( i ) :
if ( P [ j + 1 ] [ i ] == True and 1 + C [ j ] < C [ i ] ) :
C [ i ] = 1 + C [ j ] ;
return C [ n - 1 ] ;
| java | [
[
"'YYGWgYrovdsh'",
"10"
],
[
"'56109778'",
"6"
],
[
"'101'",
"0"
],
[
"'RxM'",
"2"
],
[
"'187546405'",
"6"
],
[
"'0110010'",
"1"
],
[
"'wVODAmgvI'",
"8"
],
[
"'56719'",
"4"
],
[
"'10100011001100'",
"2"
],
[
"'Wtpai'",
"4"
]
] | f_gold | DYNAMIC_PROGRAMMING_SET_17_PALINDROME_PARTITIONING_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_SET_17_PALINDROME_PARTITIONING_1{
static int f_gold ( String str ) {
int n = str . length ( ) ;
int [ ] C = new int [ n ] ;
boolean [ ] [ ] P = new boolean [ n ] [ n ] ;
int i , j , k , L ;
for ( i = 0 ;
i < n ;
i ++ ) {
P [ i ] [ i ] = true ;
}
for ( L = 2 ;
L <= n ;
L ++ ) {
for ( i = 0 ;
i < n - L + 1 ;
i ++ ) {
j = i + L - 1 ;
if ( L == 2 ) P [ i ] [ j ] = ( str . charAt ( i ) == str . charAt ( j ) ) ;
else P [ i ] [ j ] = ( str . charAt ( i ) == str . charAt ( j ) ) && P [ i + 1 ] [ j - 1 ] ;
}
}
for ( i = 0 ;
i < n ;
i ++ ) {
if ( P [ 0 ] [ i ] == true ) C [ i ] = 0 ;
else {
C [ i ] = Integer . MAX_VALUE ;
for ( j = 0 ;
j < i ;
j ++ ) {
if ( P [ j + 1 ] [ i ] == true && 1 + C [ j ] < C [ i ] ) C [ i ] = 1 + C [ j ] ;
}
}
}
return C [ n - 1 ] ;
}
| [
"import sys"
] |
|
null | [] | [] | python | code_translation | def f_gold ( arr1 , arr2 , n ) :
for i in range ( 0 , n ) :
if ( arr1 [ i ] != arr2 [ i ] ) :
return i
return n
| java | [
[
"[1, 6, 7, 10, 11, 12, 12, 16, 17, 29, 32, 33, 35, 35, 45, 49, 52, 56, 57, 58, 61, 62, 63, 64, 68, 71, 71, 77, 79, 79, 81, 82, 82, 83, 83, 89, 89, 93, 94, 94], [3, 12, 13, 14, 15, 17, 18, 19, 22, 24, 28, 29, 33, 37, 41, 42, 44, 49, 51, 51, 52, 53, 56, 56, 59, 60, 64, 64, 67, 70, 71, 78, 83, 88, 88, 90, 92, 93, 93, 95], 36",
"0"
],
[
"[-48, -92, 96, -18, 10, -24, -4, 96, -16, -78, 4, -80, -96, -28, -78, 68, 2, -60, 0], [-38, -40, -50, 50, -26, -80, 64, 54, 74, -44, -40, -92, -16, 4, -60, -42, -60, -74, 38], 16",
"0"
],
[
"[1], [0], 0",
"0"
],
[
"[68, 98, 21, 29, 71, 49], [97, 90, 25, 89, 57, 41], 3",
"0"
],
[
"[-80, -76, -76, -76, -68, -66, -56, -44, -38, -28, -24, -10, 8, 14, 16, 18, 24, 26, 30, 32, 50, 64, 76, 80, 90, 94, 94, 94], [-90, -88, -66, -60, -48, -48, -46, -42, -40, -36, -26, -4, 2, 4, 4, 8, 16, 18, 34, 50, 52, 56, 64, 80, 86, 90, 92, 96], 14",
"0"
],
[
"[0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1], [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1], 22",
"2"
],
[
"[3, 7, 16, 17, 20, 22, 29, 32, 34, 34, 35, 40, 40, 40, 41, 46, 49, 58, 60, 62, 63, 64, 64, 68, 70, 73, 76, 79, 83, 86, 90, 92, 99], [4, 4, 7, 13, 23, 23, 25, 25, 26, 34, 38, 39, 39, 45, 48, 50, 52, 54, 58, 59, 60, 65, 72, 76, 80, 80, 80, 84, 87, 90, 92, 94, 96], 26",
"0"
],
[
"[18, -68, -6, -32, -76, -86, -8, 76, -46, 20, -80, 54, -88, -58, -48, -66, -66, 18, -28, -74, -72, -26, -92, -78, 24, -22, -80, -80, 82, -2, -72, -88, -54, -84, -8], [-30, 96, 92, -12, -14, -68, -16, 20, 74, -42, 36, 84, -82, 66, 44, 70, -92, -56, -28, -68, -4, 10, -4, 90, 72, 84, 68, 14, 32, 60, 40, 60, -34, 58, -56], 17",
"0"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 24",
"24"
],
[
"[74, 75, 52, 58, 34, 53, 51, 45, 34, 28, 53, 94, 10, 20, 23, 12, 95, 78, 48, 11], [62, 56, 17, 1, 11, 30, 59, 18, 99, 21, 86, 49, 24, 85, 25, 56, 21, 66, 23, 96], 17",
"0"
]
] | f_gold | FIND_INDEX_OF_AN_EXTRA_ELEMENT_PRESENT_IN_ONE_SORTED_ARRAY | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_INDEX_OF_AN_EXTRA_ELEMENT_PRESENT_IN_ONE_SORTED_ARRAY{
static int f_gold ( int arr1 [ ] , int arr2 [ ] , int n ) {
for ( int i = 0 ;
i < n ;
i ++ ) if ( arr1 [ i ] != arr2 [ i ] ) return i ;
return n ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n ) :
res = 0
for i in range ( 0 , n - 1 ) :
res = res ^ ( i + 1 ) ^ arr [ i ]
res = res ^ arr [ n - 1 ]
return res
| java | [
[
"[2, 2, 4, 5, 5, 7, 7, 7, 8, 11, 14, 15, 18, 19, 20, 25, 25, 29, 29, 31, 32, 32, 33, 38, 42, 48, 52, 55, 60, 61, 63, 71, 74, 78, 82, 82, 84, 84, 87, 87, 88, 90, 93, 94, 94], 31",
"52"
],
[
"[46, 2, 62, 60, 92, 4, 26, 66, 66, 90, 26, -14, 76, -20, -68], 8",
"46"
],
[
"[0, 0, 0, 1, 1, 1, 1, 1], 4",
"1"
],
[
"[87, 67, 11, 47, 64, 81, 94, 75, 58, 77, 18, 2, 85, 26, 6, 44, 55, 19, 46, 49, 5, 69, 44, 12, 42, 66, 46, 9, 26, 49, 68, 95, 6, 9, 11, 72, 5, 67], 34",
"28"
],
[
"[-98, -94, -92, -82, -78, -64, -62, -58, -52, -44, -40, -38, -8, 6, 10, 20, 22, 28, 30, 30, 36, 54, 54, 58, 64, 68, 76, 78, 84, 88, 90, 94, 96], 29",
"-32"
],
[
"[1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1], 17",
"16"
],
[
"[1, 14, 15, 15, 21, 34, 38, 39, 41, 50, 60, 74, 96, 97], 7",
"25"
],
[
"[96, -12, -16, -52], 3",
"103"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 21",
"21"
],
[
"[66, 21, 21, 59, 78, 8, 46, 41, 16, 32, 97, 93, 32, 86, 91, 61, 67, 61, 97, 49, 66, 35, 24, 35, 65, 45, 83], 25",
"9"
]
] | f_gold | FIND_REPETITIVE_ELEMENT_1_N_1_2 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_REPETITIVE_ELEMENT_1_N_1_2{
static int f_gold ( int arr [ ] , int n ) {
int res = 0 ;
for ( int i = 0 ;
i < n - 1 ;
i ++ ) res = res ^ ( i + 1 ) ^ arr [ i ] ;
res = res ^ arr [ n - 1 ] ;
return res ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
if ( n == 0 ) :
return "0" ;
bin = "" ;
while ( n > 0 ) :
if ( n & 1 == 0 ) :
bin = '0' + bin ;
else :
bin = '1' + bin ;
n = n >> 1 ;
return bin ;
| java | [
[
"35",
"'100011'"
],
[
"17",
"'10001'"
],
[
"8",
"'1000'"
],
[
"99",
"'1100011'"
],
[
"57",
"'111001'"
],
[
"39",
"'100111'"
],
[
"99",
"'1100011'"
],
[
"14",
"'1110'"
],
[
"22",
"'10110'"
],
[
"7",
"'111'"
]
] | f_gold | DECIMAL_BINARY_CONVERSION_WITHOUT_USING_ARITHMETIC_OPERATORS | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DECIMAL_BINARY_CONVERSION_WITHOUT_USING_ARITHMETIC_OPERATORS{
static String f_gold ( int n ) {
if ( n == 0 ) return "0" ;
String bin = "" ;
while ( n > 0 ) {
bin = ( ( n & 1 ) == 0 ? '0' : '1' ) + bin ;
n >>= 1 ;
}
return bin ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( str ) :
zeros = 0
ones = 0
for i in range ( 0 , len ( str ) ) :
ch = str [ i ] ;
if ( ch == '0' ) :
zeros = zeros + 1
else :
ones = ones + 1
return ( zeros == 1 or ones == 1 ) ;
| java | [
[
"'00001'",
"True"
],
[
"'0000'",
"False"
],
[
"'11'",
"False"
],
[
"'111110'",
"True"
],
[
"'1'",
"True"
],
[
"'111010111010'",
"False"
],
[
"'hUInqJXNdbfP'",
"False"
],
[
"'5191'",
"False"
],
[
"'1110101101'",
"False"
],
[
"'NupSrU xz'",
"False"
]
] | f_gold | CHANGE_BITS_CAN_MADE_ONE_FLIP | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHANGE_BITS_CAN_MADE_ONE_FLIP{
static boolean f_gold ( String str ) {
int zeros = 0 , ones = 0 ;
for ( int i = 0 ;
i < str . length ( ) ;
i ++ ) {
char ch = str . charAt ( i ) ;
if ( ch == '0' ) ++ zeros ;
else ++ ones ;
}
return ( zeros == 1 || ones == 1 ) ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
position = 1
m = 1
while ( not ( n & m ) ) :
m = m << 1
position += 1
return position
| java | [
[
"17",
"1"
],
[
"97",
"1"
],
[
"73",
"1"
],
[
"68",
"3"
],
[
"6",
"2"
],
[
"84",
"3"
],
[
"72",
"4"
],
[
"66",
"2"
],
[
"57",
"1"
],
[
"11",
"1"
]
] | f_gold | POSITION_OF_RIGHTMOST_SET_BIT_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class POSITION_OF_RIGHTMOST_SET_BIT_1{
static int f_gold ( int n ) {
int position = 1 ;
int m = 1 ;
while ( ( n & m ) == 0 ) {
m = m << 1 ;
position ++ ;
}
return position ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( str ) :
n = len ( str ) ;
return int ( n * ( n + 1 ) / 2 ) ;
| java | [
[
"'gZFGZsHCimLf'",
"78"
],
[
"'505357'",
"21"
],
[
"'011011101'",
"45"
],
[
"'ovfwP Osauz'",
"66"
],
[
"'92132238746026'",
"105"
],
[
"'01100'",
"15"
],
[
"'RaOWYQRfiWKSyC'",
"105"
],
[
"'861330202'",
"45"
],
[
"'001100010'",
"45"
],
[
"'uvpKlGUBLOMba'",
"91"
]
] | f_gold | NUMBER_SUBSTRINGS_STRING | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_SUBSTRINGS_STRING{
static int f_gold ( String str ) {
int n = str . length ( ) ;
return n * ( n + 1 ) / 2 ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n ) :
leftMax = [ None ] * n
leftMax [ 0 ] = float ( '-inf' )
for i in range ( 1 , n ) :
leftMax [ i ] = max ( leftMax [ i - 1 ] , arr [ i - 1 ] )
rightMin = float ( 'inf' )
for i in range ( n - 1 , - 1 , - 1 ) :
if leftMax [ i ] < arr [ i ] and rightMin > arr [ i ] :
return i
rightMin = min ( rightMin , arr [ i ] )
return - 1
| java | [
[
"[4, 24, 30, 33, 56, 67, 87, 90], 4",
"3"
],
[
"[72, -48, 12, 4, 46, 36, 2, 58, 82, -88, -14, 56, 90, 76, 18, -6, -28, 18, 88, 90, 40, -68, -10, -82, -28, 16, 32, -90, 12, -86, -16, 78, -98, -52, -26, 80, 6, 50, 40, -12, 52, 38, -92, 94, -32, 14, -80, -88, 48], 28",
"-1"
],
[
"[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 30",
"-1"
],
[
"[51, 87, 46, 76, 2, 89, 56, 34, 49, 61, 44, 73, 14, 60, 89], 11",
"-1"
],
[
"[-90, -90, -80, -72, -68, -64, -62, -62, -60, -46, -44, -44, -44, -42, -42, -32, -22, -22, -18, -2, 4, 6, 10, 12, 14, 30, 34, 34, 40, 56, 56, 56, 58, 68, 74, 78, 78, 82, 84, 86, 88, 90, 92], 29",
"28"
],
[
"[0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0], 26",
"-1"
],
[
"[7, 8, 11, 12, 15, 17, 28, 34, 57, 61, 66, 76, 92], 9",
"8"
],
[
"[-22, -96, -78, -60, 34, -18, 86, -42, -78, 76, 8, 28, -80, 80, 6, -72, 34, 66, 84, 50, -4, 18, 72, -66, -68, -24, 56, -12, -70, 24, -82], 19",
"-1"
],
[
"[0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1], 9",
"-1"
],
[
"[79, 81, 55, 6, 78, 93, 81, 33, 29, 1, 27, 49, 21, 58, 22, 65, 44, 95, 6, 51, 75, 42, 14, 55, 79, 82, 90, 8, 15, 15, 53, 98, 76, 43, 33], 30",
"-1"
]
] | f_gold | FIND_THE_ELEMENT_BEFORE_WHICH_ALL_THE_ELEMENTS_ARE_SMALLER_THAN_IT_AND_AFTER_WHICH_ALL_ARE_GREATER_THAN_IT | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THE_ELEMENT_BEFORE_WHICH_ALL_THE_ELEMENTS_ARE_SMALLER_THAN_IT_AND_AFTER_WHICH_ALL_ARE_GREATER_THAN_IT{
static int f_gold ( int [ ] arr , int n ) {
int [ ] leftMax = new int [ n ] ;
leftMax [ 0 ] = Integer . MIN_VALUE ;
for ( int i = 1 ;
i < n ;
i ++ ) leftMax [ i ] = Math . max ( leftMax [ i - 1 ] , arr [ i - 1 ] ) ;
int rightMin = Integer . MAX_VALUE ;
for ( int i = n - 1 ;
i >= 0 ;
i -- ) {
if ( leftMax [ i ] < arr [ i ] && rightMin > arr [ i ] ) return i ;
rightMin = Math . min ( rightMin , arr [ i ] ) ;
}
return - 1 ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n ) :
sum = 0 ;
while ( n > 0 ) :
sum += ( n % 10 ) ;
n //= 10 ;
if ( sum == 1 ) :
return 10 ;
return sum ;
| java | [
[
"2",
"2"
],
[
"39",
"12"
],
[
"31",
"4"
],
[
"45",
"9"
],
[
"35",
"8"
],
[
"94",
"13"
],
[
"67",
"13"
],
[
"50",
"5"
],
[
"4",
"4"
],
[
"63",
"9"
]
] | f_gold | MINIMIZE_THE_SUM_OF_DIGITS_OF_A_AND_B_SUCH_THAT_A_B_N | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMIZE_THE_SUM_OF_DIGITS_OF_A_AND_B_SUCH_THAT_A_B_N{
static int f_gold ( int n ) {
int sum = 0 ;
while ( n > 0 ) {
sum += ( n % 10 ) ;
n /= 10 ;
}
if ( sum == 1 ) return 10 ;
return sum ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( n , m ) :
dp = [ [ 0 for x in range ( m + 1 ) ] for y in range ( n + 1 ) ]
for i in range ( 1 , n + 1 ) :
for j in range ( 0 , m + 1 ) :
if ( i > j ) :
if ( j == 0 ) :
dp [ i ] [ j ] = 1
else :
dp [ i ] [ j ] = ( ( ( i - j ) * dp [ i - 1 ] [ j - 1 ] ) + ( ( j + 1 ) * dp [ i - 1 ] [ j ] ) )
return dp [ n ] [ m ]
| java | [
[
"27, 7",
"940744845942385425654976"
],
[
"77, 34",
"6659628962352540071013461802622903732181448311622532437589102727552487005433977695399091580931215833915283931140"
],
[
"35, 22",
"35713299412878610033189961245712022360"
],
[
"26, 20",
"131921922645609200622"
],
[
"6, 10",
"0"
],
[
"66, 47",
"221859117810481349493305127684600387619569922020324586026515826232579975082496996060"
],
[
"44, 29",
"256901182650534135593685383141946368285073503385000"
],
[
"26, 33",
"0"
],
[
"74, 86",
"0"
],
[
"65, 97",
"0"
]
] | f_gold | EULERIAN_NUMBER_1 | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class EULERIAN_NUMBER_1{
public static int f_gold ( int n , int m ) {
int [ ] [ ] dp = new int [ n + 1 ] [ m + 1 ] ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
for ( int j = 0 ;
j <= m ;
j ++ ) {
if ( i > j ) {
if ( j == 0 ) dp [ i ] [ j ] = 1 ;
else dp [ i ] [ j ] = ( ( i - j ) * dp [ i - 1 ] [ j - 1 ] ) + ( ( j + 1 ) * dp [ i - 1 ] [ j ] ) ;
}
}
}
return dp [ n ] [ m ] ;
}
| [] |
|
null | [] | [] | python | code_translation | def f_gold ( arr , n , k ) :
count = 0
for i in range ( 0 , n ) :
if ( arr [ i ] <= k ) :
count = count + 1
bad = 0
for i in range ( 0 , count ) :
if ( arr [ i ] > k ) :
bad = bad + 1
ans = bad
j = count
for i in range ( 0 , n ) :
if ( j == n ) :
break
if ( arr [ i ] > k ) :
bad = bad - 1
if ( arr [ j ] > k ) :
bad = bad + 1
ans = min ( ans , bad )
j = j + 1
return ans
| java | [
[
"[7, 12, 15, 30, 33, 34, 53, 66, 73, 74, 76, 77, 85, 90], 9, 8",
"0"
],
[
"[-62, -20, -26, -24, 92, 66, -74, -4, 18, -82, -36, 92, -4, 92, -80, 56, -24, 4, -48, -10, -14, -46, -16, -58, -58, -6, -68, -22, -82, -16, 76, -30, -86, -38, -66, 28, 58, 30, -44, -56], 24, 28",
"4"
],
[
"[0, 0, 0, 0, 0, 1, 1], 5, 6",
"0"
],
[
"[8, 48, 64, 77, 61, 60, 96, 95, 41, 68, 9, 67, 10, 66, 16, 59, 83, 21, 47, 16, 13, 85, 52, 11, 48, 31, 99, 57, 57, 44, 66, 93, 80, 69, 23, 2, 55, 90], 36, 24",
"5"
],
[
"[-80, -58, -40, -34, 14, 36, 48, 56, 58, 60, 84, 90, 92, 92], 7, 8",
"0"
],
[
"[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1], 26, 23",
"0"
],
[
"[4, 4, 8, 9, 13, 17, 18, 19, 21, 22, 22, 23, 27, 28, 30, 44, 46, 48, 53, 53, 55, 60, 61, 62, 68, 70, 70, 71, 73, 80, 82, 82, 85, 88, 90, 93, 99], 28, 36",
"0"
],
[
"[-28, 50, 82, -32, 32, -78, 12, 50, 38, 34, -10, 6, 86, -56, -2], 13, 9",
"3"
],
[
"[0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 9, 8",
"0"
],
[
"[37, 88, 83, 91, 11, 39, 98, 70, 93, 74, 24, 90, 66, 3, 6, 28], 12, 12",
"0"
]
] | f_gold | MINIMUM_SWAPS_REQUIRED_BRING_ELEMENTS_LESS_EQUAL_K_TOGETHER | transcoder-geeksforgeeks |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_SWAPS_REQUIRED_BRING_ELEMENTS_LESS_EQUAL_K_TOGETHER{
static int f_gold ( int arr [ ] , int n , int k ) {
int count = 0 ;
for ( int i = 0 ;
i < n ;
++ i ) if ( arr [ i ] <= k ) ++ count ;
int bad = 0 ;
for ( int i = 0 ;
i < count ;
++ i ) if ( arr [ i ] > k ) ++ bad ;
int ans = bad ;
for ( int i = 0 , j = count ;
j < n ;
++ i , ++ j ) {
if ( arr [ i ] > k ) -- bad ;
if ( arr [ j ] > k ) ++ bad ;
ans = Math . min ( ans , bad ) ;
}
return ans ;
}
| [] |
Subsets and Splits