id stringlengths 9 111 | java stringlengths 188 2.04k | python stringlengths 40 1.94k ⌀ | cpp stringlengths 65 1.25k ⌀ | java_test stringlengths 532 56.4k | python_test stringlengths 348 57.4k ⌀ | cpp_test stringlengths 328 4.71k ⌀ |
|---|---|---|---|---|---|---|
MAXIMUM_CONSECUTIVE_NUMBERS_PRESENT_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_CONSECUTIVE_NUMBERS_PRESENT_ARRAY{
static int f_gold ( int arr [ ] , int n ) {
HashSet < Integer > S = new HashSet < Integer > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) S . add ( arr [ i ] ) ;
int a... | def f_gold ( arr , n ) :
S = set ( ) ;
for i in range ( n ) :
S.add ( arr [ i ] ) ;
ans = 0 ;
for i in range ( n ) :
if S.__contains__ ( arr [ i ] ) :
j = arr [ i ] ;
while ( S.__contains__ ( j ) ) :
j += 1 ;
ans = max ( ans , j - arr [... |
using namespace std;
int f_gold ( int arr [ ], int n ) {
unordered_set < int > S;
for ( int i = 0;
i < n;
i ++ ) S . insert ( arr [ i ] );
int ans = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( S . find ( arr [ i ] - 1 ) == S . end ( ) ) {
int j = arr [ i ];
while ( S . find ( j ) != S . en... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,5,9,24,28,31,49,54,67,85,86,94,97,97});
param0.add(new int[]{-34,16,-80,-10,80,2,50,-74,-76,36,-84,-24,74,-54,-22,46,80,58,-8,70,24,-88,52,62,30,42,48,16,78,-82,64,-36,84,-72});
... |
if __name__ == '__main__':
param = [
([3, 5, 9, 24, 28, 31, 49, 54, 67, 85, 86, 94, 97, 97],11,),
([-34, 16, -80, -10, 80, 2, 50, -74, -76, 36, -84, -24, 74, -54, -22, 46, 80, 58, -8, 70, 24, -88, 52, 62, 30, 42, 48, 16, 78, -82, 64, -36, 84, -72],29,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{3,5,9,24,28,31,49,54,67,85,86,94,97,97},{-34,16,-80,-10,80,2,50,-74,-76,36,-84,-24,74,-54,-22,46,80,58,-8,70,24,-88,52,62,30,42,48,16,78,-82,64,-36,84,-72},{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1},{49,61,68,4,90,89,71,74,45,61,35,41,59},{-42,-8,... |
LARGEST_SUM_CONTIGUOUS_SUBARRAY_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LARGEST_SUM_CONTIGUOUS_SUBARRAY_2{
static int f_gold ( int a [ ] , int size ) {
int max_so_far = a [ 0 ] ;
int curr_max = a [ 0 ] ;
for ( int i = 1 ;
i < size ;
i ++ ) {
curr_max = Math . max ( a [ i... | def f_gold ( a , size ) :
max_so_far = a [ 0 ]
curr_max = a [ 0 ]
for i in range ( 1 , size ) :
curr_max = max ( a [ i ] , curr_max + a [ i ] )
max_so_far = max ( max_so_far , curr_max )
return max_so_far
|
using namespace std;
int f_gold ( int a [ ], int size ) {
int max_so_far = a [ 0 ];
int curr_max = a [ 0 ];
for ( int i = 1;
i < size;
i ++ ) {
curr_max = max ( a [ i ], curr_max + a [ i ] );
max_so_far = max ( max_so_far, curr_max );
}
return max_so_far;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,3,4,7,8,8,10,12,16,19,19,20,20,21,21,22,26,27,29,34,36,38,38,39,41,43,44,47,47,49,57,57,60,62,63,65,75,77,77,78,81,82,82,83,83,84,85,98,99});
param0.add(new int[]{-40,14,2,-70,86... |
if __name__ == '__main__':
param = [
([1, 3, 4, 7, 8, 8, 10, 12, 16, 19, 19, 20, 20, 21, 21, 22, 26, 27, 29, 34, 36, 38, 38, 39, 41, 43, 44, 47, 47, 49, 57, 57, 60, 62, 63, 65, 75, 77, 77, 78, 81, 82, 82, 83, 83, 84, 85, 98, 99],38,),
([-40, 14, 2, -70, 86, -90, -50, -54, -2, 90, 30],10,),
([0, 0, 0, 0... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,3,4,7,8,8,10,12,16,19,19,20,20,21,21,22,26,27,29,34,36,38,38,39,41,43,44,47,47,49,57,57,60,62,63,65,75,77,77,78,81,82,82,83,83,84,85,98,99},{-40,14,2,-70,86,-90,-50,-54,-2,90,30},{0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1},{60,69,41,7,77,36,36,26,35,30... |
MINIMUM_SUM_TWO_NUMBERS_FORMED_DIGITS_ARRAY_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_SUM_TWO_NUMBERS_FORMED_DIGITS_ARRAY_2{
static int f_gold ( int a [ ] , int n ) {
Arrays . sort ( a ) ;
int num1 = 0 ;
int num2 = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( i % 2 == 0 ) num... | def f_gold ( a , n ) :
a = sorted ( a )
num1 , num2 = 0 , 0
for i in range ( n ) :
if i % 2 == 0 :
num1 = num1 * 10 + a [ i ]
else :
num2 = num2 * 10 + a [ i ]
return num2 + num1
|
using namespace std;
int f_gold ( int a [ ], int n ) {
sort ( a, a + n );
int num1 = 0;
int num2 = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( i % 2 == 0 ) num1 = num1 * 10 + a [ i ];
else num2 = num2 * 10 + a [ i ];
}
return num2 + num1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,16,29,30,38,83});
param0.add(new int[]{58,74,-28,-60,-6,66,-76,46,0,-24,28,-16,-14,24,-94,-56,-80,40,-18,-68,-8,-94,-88,-12,-20,-8});
param0.add(new int[]{0,1});
param0.a... |
if __name__ == '__main__':
param = [
([4, 16, 29, 30, 38, 83],5,),
([58, 74, -28, -60, -6, 66, -76, 46, 0, -24, 28, -16, -14, 24, -94, -56, -80, 40, -18, -68, -8, -94, -88, -12, -20, -8],16,),
([0, 1],1,),
([7, 12, 78, 8],3,),
([-78, -48, -48, -26, 8, 34],4,),
([1, 1, 1, 1, 0, 1, 1, 1, 0, 1... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{4,16,29,30,38,83},{58,74,-28,-60,-6,66,-76,46,0,-24,28,-16,-14,24,-94,-56,-80,40,-18,-68,-8,-94,-88,-12,-20,-8},{0,1},{7,12,78,8},{-78,-48,-48,-26,8,34},{1,1,1,1,0,1,1,1,0,1,0,1,0,0,0,0,1,1,1,1,1,0,0,0,1,0,0,1,1,0},{2,3,5,7,25,30,31,38,42,45,52,53,56... |
MODULAR_EXPONENTIATION_POWER_IN_MODULAR_ARITHMETIC |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MODULAR_EXPONENTIATION_POWER_IN_MODULAR_ARITHMETIC{
static int f_gold ( int x , int y , int p ) {
int res = 1 ;
x = x % p ;
while ( y > 0 ) {
if ( ( y & 1 ) == 1 ) res = ( res * x ) % p ;
y = y >> 1 ... | def f_gold ( x , y , p ) :
res = 1
x = x % p
while ( y > 0 ) :
if ( ( y & 1 ) == 1 ) :
res = ( res * x ) % p
y = y >> 1
x = ( x * x ) % p
return res
|
using namespace std;
int f_gold ( int x, unsigned int y, int p ) {
int res = 1;
x = x % p;
while ( y > 0 ) {
if ( y & 1 ) res = ( res * x ) % p;
y = y >> 1;
x = ( x * x ) % p;
}
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(45);
param0.add(67);
param0.add(26);
param0.add(33);
param0.add(35);
param0.add(68);
param0.add(14);
param0.add(5);
param0.add(23);
param0.add(37);
List<I... |
if __name__ == '__main__':
param = [
(45,5,68,),
(67,25,49,),
(26,91,44,),
(33,61,9,),
(35,8,13,),
(68,41,5,),
(14,76,20,),
(5,89,13,),
(23,42,45,),
(37,63,56,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) ==... |
int main() {
int n_success = 0;
vector<int> param0 {45,67,26,33,35,68,14,5,23,37};
vector<int> param1 {5,25,91,61,8,41,76,89,42,63};
vector<int> param2 {68,49,44,9,13,5,20,13,45,56};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i]) == f_gold(param0[i],... |
WRITE_A_C_PROGRAM_TO_FIND_THE_PARITY_OF_AN_UNSIGNED_INTEGER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class WRITE_A_C_PROGRAM_TO_FIND_THE_PARITY_OF_AN_UNSIGNED_INTEGER{
static boolean f_gold ( int n ) {
boolean parity = false ;
while ( n != 0 ) {
parity = ! parity ;
n = n & ( n - 1 ) ;
}
return parity ;
... | def f_gold ( n ) :
parity = 0
while n :
parity = ~ parity
n = n & ( n - 1 )
return parity
|
using namespace std;
bool f_gold ( unsigned int n ) {
bool parity = 0;
while ( n ) {
parity = ! parity;
n = n & ( n - 1 );
}
return parity;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(63);
param0.add(64);
param0.add(85);
param0.add(36);
param0.add(20);
param0.add(63);
param0.add(42);
param0.add(19);
param0.add(62);
param0.add(97);
for(i... |
if __name__ == '__main__':
param = [
(63,),
(64,),
(85,),
(36,),
(20,),
(63,),
(42,),
(19,),
(62,),
(97,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {63,64,85,36,20,63,42,19,62,97};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
CHECK_LARGE_NUMBER_DIVISIBLE_11_NOT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_LARGE_NUMBER_DIVISIBLE_11_NOT{
static boolean f_gold ( String str ) {
int n = str . length ( ) ;
int oddDigSum = 0 , evenDigSum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( i % 2 == 0 ) oddDig... | null |
using namespace std;
int f_gold ( string str ) {
int n = str . length ( );
int oddDigSum = 0, evenDigSum = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( i % 2 == 0 ) oddDigSum += ( str [ i ] - '0' );
else evenDigSum += ( str [ i ] - '0' );
}
return ( ( oddDigSum - evenDigSum ) % 11 == 0 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("r");
param0.add("7386620");
param0.add("1010");
param0.add("rWFOLX VB");
param0.add("3845847974820");
param0.add("01001");
param0.add("yq");
param0.add("770356");
... | null |
int main() {
int n_success = 0;
vector<string> param0 {"r","7386620","1010","rWFOLX VB","3845847974820","01001","yq","770356","0000110111001","tDMrBdHJJITDx"};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
... |
SMALLEST_POWER_OF_2_GREATER_THAN_OR_EQUAL_TO_N_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SMALLEST_POWER_OF_2_GREATER_THAN_OR_EQUAL_TO_N_1{
static int f_gold ( int n ) {
int p = 1 ;
if ( n > 0 && ( n & ( n - 1 ) ) == 0 ) return n ;
while ( p < n ) p <<= 1 ;
return p ;
}
| def f_gold ( n ) :
p = 1
if ( n and not ( n & ( n - 1 ) ) ) :
return n
while ( p < n ) :
p <<= 1
return p ;
|
using namespace std;
unsigned int f_gold ( unsigned int n ) {
unsigned int p = 1;
if ( n && ! ( n & ( n - 1 ) ) ) return n;
while ( p < n ) p <<= 1;
return p;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(31);
param0.add(89);
param0.add(92);
param0.add(66);
param0.add(38);
param0.add(34);
param0.add(17);
param0.add(24);
param0.add(54);
param0.add(20);
for(i... |
if __name__ == '__main__':
param = [
(31,),
(89,),
(92,),
(66,),
(38,),
(34,),
(17,),
(24,),
(54,),
(20,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {31,89,92,66,38,34,17,24,54,20};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
K_TH_MISSING_ELEMENT_INCREASING_SEQUENCE_NOT_PRESENT_GIVEN_SEQUENCE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class K_TH_MISSING_ELEMENT_INCREASING_SEQUENCE_NOT_PRESENT_GIVEN_SEQUENCE{
static int f_gold ( int a [ ] , int b [ ] , int k , int n1 , int n2 ) {
LinkedHashSet < Integer > s = new LinkedHashSet < > ( ) ;
for ( int ... | def f_gold ( a , b , k , n1 , n2 ) :
s = set ( )
for i in range ( n2 ) :
s.add ( b [ i ] )
missing = 0
for i in range ( n1 ) :
if a [ i ] not in s :
missing += 1
if missing == k :
return a [ i ]
return - 1
| null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,9,9,13,38,41,50,59,64,64,72,78,79,80,84,92,94,98,99});
param0.add(new int[]{-54,-80,-62,98,-68,42,98,80,-8,-6,26,0,-60,-24,-74,-48,4,-54,20,32,42,68,-50,58,-50,96,-34,22,56,-60,-... |
if __name__ == '__main__':
param = [
([2, 9, 9, 13, 38, 41, 50, 59, 64, 64, 72, 78, 79, 80, 84, 92, 94, 98, 99],[5, 9, 11, 21, 24, 27, 30, 35, 38, 39, 40, 45, 48, 48, 51, 58, 61, 91, 92],11,9,18,),
([-54, -80, -62, 98, -68, 42, 98, 80, -8, -6, 26, 0, -60, -24, -74, -48, 4, -54, 20, 32, 42, 68, -50, 58, -50... | null |
FIND_THE_NUMBER_OCCURRING_ODD_NUMBER_OF_TIMES_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THE_NUMBER_OCCURRING_ODD_NUMBER_OF_TIMES_2{
static int f_gold ( int ar [ ] , int ar_size ) {
int i ;
int res = 0 ;
for ( i = 0 ;
i < ar_size ;
i ++ ) {
res = res ^ ar [ i ] ;
}
return res ;
... | null |
using namespace std;
int f_gold ( int ar [ ], int ar_size ) {
int res = 0;
for ( int i = 0;
i < ar_size;
i ++ ) res = res ^ ar [ i ];
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,1,7,10,12,19,20,22,23,25,27,32,33,39,43,44,45,46,47,47,48,49,50,51,55,58,68,69,73,76,77,79,81,84,92,95,99});
param0.add(new int[]{-12,-40,-68});
param0.add(new int[]{0,0,0,0,... | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,1,7,10,12,19,20,22,23,25,27,32,33,39,43,44,45,46,47,47,48,49,50,51,55,58,68,69,73,76,77,79,81,84,92,95,99},{-12,-40,-68},{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},{86,56,98,58,7,40,84,45,69,77,36,50,72,99,95},{-90,-68,-6... |
SUM_MATRIX_ELEMENT_ABSOLUTE_DIFFERENCE_ROW_COLUMN_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_MATRIX_ELEMENT_ABSOLUTE_DIFFERENCE_ROW_COLUMN_NUMBERS{
static int f_gold ( int n ) {
int [ ] [ ] arr = new int [ n ] [ n ] ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = 0 ;
j < n ;
j ++ ) arr [ ... | def f_gold ( n ) :
arr = [ [ 0 for x in range ( n ) ] for y in range ( n ) ]
for i in range ( n ) :
for j in range ( n ) :
arr [ i ] [ j ] = abs ( i - j )
sum = 0
for i in range ( n ) :
for j in range ( n ) :
sum += arr [ i ] [ j ]
return sum
|
using namespace std;
int f_gold ( int n ) {
int arr [ n ] [ n ];
for ( int i = 0;
i < n;
i ++ ) for ( int j = 0;
j < n;
j ++ ) arr [ i ] [ j ] = abs ( i - j );
int sum = 0;
for ( int i = 0;
i < n;
i ++ ) for ( int j = 0;
j < n;
j ++ ) sum += arr [ i ] [ j ];
return sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(60);
param0.add(44);
param0.add(72);
param0.add(90);
param0.add(99);
param0.add(45);
param0.add(27);
param0.add(11);
param0.add(65);
param0.add(52);
for(i... |
if __name__ == '__main__':
param = [
(60,),
(44,),
(72,),
(90,),
(99,),
(45,),
(27,),
(11,),
(65,),
(52,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {60,44,72,90,99,45,27,11,65,52};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
WRITE_YOU_OWN_POWER_WITHOUT_USING_MULTIPLICATION_AND_DIVISION |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class WRITE_YOU_OWN_POWER_WITHOUT_USING_MULTIPLICATION_AND_DIVISION{
static int f_gold ( int a , int b ) {
if ( b == 0 ) return 1 ;
int answer = a ;
int increment = a ;
int i , j ;
for ( i = 1 ;
i < b ;
i ... | def f_gold ( a , b ) :
if ( b == 0 ) :
return 1
answer = a
increment = a
for i in range ( 1 , b ) :
for j in range ( 1 , a ) :
answer += increment
increment = answer
return answer
|
using namespace std;
int f_gold ( int a, int b ) {
if ( b == 0 ) return 1;
int answer = a;
int increment = a;
int i, j;
for ( i = 1;
i < b;
i ++ ) {
for ( j = 1;
j < a;
j ++ ) {
answer += increment;
}
increment = answer;
}
return answer;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(66);
param0.add(82);
param0.add(12);
param0.add(55);
param0.add(34);
param0.add(22);
param0.add(13);
param0.add(57);
param0.add(76);
param0.add(76);
List<... |
if __name__ == '__main__':
param = [
(66,4,),
(82,66,),
(12,38,),
(55,33,),
(34,26,),
(22,23,),
(13,98,),
(57,84,),
(76,94,),
(76,95,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
... |
int main() {
int n_success = 0;
vector<int> param0 {66,82,12,55,34,22,13,57,76,76};
vector<int> param1 {4,66,38,33,26,23,98,84,94,95};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
... |
FIND_WHETHER_AN_ARRAY_IS_SUBSET_OF_ANOTHER_ARRAY_SET_1_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_WHETHER_AN_ARRAY_IS_SUBSET_OF_ANOTHER_ARRAY_SET_1_1{
static boolean f_gold ( int arr1 [ ] , int arr2 [ ] , int m , int n ) {
int i = 0 , j = 0 ;
if ( m < n ) return false ;
Arrays . sort ( arr1 ) ;
Ar... | def f_gold ( arr1 , arr2 , m , n ) :
i = 0
j = 0
if m < n :
return 0
arr1.sort ( )
arr2.sort ( )
while i < n and j < m :
if arr1 [ j ] < arr2 [ i ] :
j += 1
elif arr1 [ j ] == arr2 [ i ] :
j += 1
i += 1
elif arr1 [ j ] > arr2 [ ... |
using namespace std;
bool f_gold ( int arr1 [ ], int arr2 [ ], int m, int n ) {
int i = 0, j = 0;
if ( m < n ) return 0;
sort ( arr1, arr1 + m );
sort ( arr2, arr2 + n );
while ( i < n && j < m ) {
if ( arr1 [ j ] < arr2 [ i ] ) j ++;
else if ( arr1 [ j ] == arr2 [ i ] ) {
j ++;
i ++;
... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{7,10,10,10,13,17,23,24,25,28,30,33,37,49,49,50,57,60,60,63,63,64,65,65,72,81,84,85,85,94,96});
param0.add(new int[]{12,30,-94,-92,-62,-18,-56,44,-50,-92,6,2,56,-90,0,0,18,86,-58,58... |
if __name__ == '__main__':
param = [
([7, 10, 10, 10, 13, 17, 23, 24, 25, 28, 30, 33, 37, 49, 49, 50, 57, 60, 60, 63, 63, 64, 65, 65, 72, 81, 84, 85, 85, 94, 96],
[10,13,17,63],29,4,),
([12, 30, -94, -92, -62, -18, -56, 44, -50, -92, 6, 2, 56, -90, 0, 0, 18, 86, -58, 58, -54, 62, -94, 94, 0, 8, 82, -6... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{7,10,10,10,13,17,23,24,25,28,30,33,37,49,49,50,57,60,60,63,63,64,65,65,72,81,84,85,85,94,96},{12,30,-94,-92,-62,-18,-56,44,-50,-92,6,2,56,-90,0,0,18,86,-58,58,-54,62,-94,94,0,8,82,-68,-88,-18,8,-80,-42,18,62,-8,56,-76,-42,56,44,-2,-20,62,-14,74,-86,-... |
SORT_EVEN_PLACED_ELEMENTS_INCREASING_ODD_PLACED_DECREASING_ORDER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SPLIT_ARRAY_ADD_FIRST_PART_END{
public static void f_gold ( int arr [ ] , int n , int k ) {
for ( int i = 0 ;
i < k ;
i ++ ) {
int x = arr [ 0 ] ;
for ( int j = 0 ;
j < n - 1 ;
++ j ) arr [ j... | def f_gold ( arr , n ) :
evenArr = [ ]
oddArr = [ ]
for i in range ( n ) :
if ( ( i % 2 ) == 0 ) :
evenArr.append ( arr [ i ] )
else :
oddArr.append ( arr [ i ] )
evenArr = sorted ( evenArr )
oddArr = sorted ( oddArr )
oddArr = oddArr [ : : - 1 ]
i = 0... |
using namespace std;
void f_gold ( int arr [ ], int n ) {
vector < int > evenArr;
vector < int > oddArr;
for ( int i = 0;
i < n;
i ++ ) {
if ( ! ( i % 2 ) ) evenArr . push_back ( arr [ i ] );
else oddArr . push_back ( arr [ i ] );
}
sort ( evenArr . begin ( ), evenArr . end ( ) );
sort ( oddArr... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{75});
param0.add(new int[]{-58,-60,-38,48,-2,32,-48,-46,90,-54,-18,28,72,86,0,-2,-74,12,-58,90,-30,10,-88,2,-14,82,-82,-46,2,-74});
param0.add(new int[]{0,0,0,0,0,1,1,1,1,1,1})... |
if __name__ == '__main__':
param = [
([6, 6, 6, 10, 15, 21, 38, 50, 51, 72, 79, 81, 82, 84, 85, 86, 87],15,),
([82, -36, 18, -88, -24, 20, 26, -52, 28, 2],7,),
([0, 0, 0, 1, 1, 1],3,),
([81, 47, 38, 70, 35, 43, 94, 30, 57, 55, 78, 97, 72, 1],8,),
([-80, -78, -72, -46, -26, -24, -20, 8, 16, 26, ... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{6,6,6,10,15,21,38,50,51,72,79,81,82,84,85,86,87},{82,-36,18,-88,-24,20,26,-52,28,2},{0,0,0,1,1,1},{81,47,38,70,35,43,94,30,57,55,78,97,72,1},{-80,-78,-72,-46,-26,-24,-20,8,16,26,38,44,54,68,68,78,86,92},{0,0,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,0,0,1,0,1... |
CHECK_IF_A_NUMBER_IS_POWER_OF_ANOTHER_NUMBER_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_IF_A_NUMBER_IS_POWER_OF_ANOTHER_NUMBER_1{
static boolean f_gold ( int x , int y ) {
int res1 = ( int ) Math . log ( y ) / ( int ) Math . log ( x ) ;
double res2 = Math . log ( y ) / Math . log ( x ) ;
... | import math
def f_gold ( x , y ) :
res1 = math.log ( y ) / math.log ( x ) ;
res2 = math.log ( y ) / math.log ( x ) ;
return 1 if ( res1 == res2 ) else 0 ;
|
using namespace std;
bool f_gold ( int x, int y ) {
int res1 = log ( y ) / log ( x );
double res2 = log ( y ) / log ( x );
return ( res1 == res2 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(57);
param0.add(3);
param0.add(10);
param0.add(10);
param0.add(6);
param0.add(2);
param0.add(2);
param0.add(20);
param0.add(96);
param0.add(25);
List<Inte... |
if __name__ == '__main__':
param = [
(57,1,),
(3,9,),
(10,101,),
(10,10000,),
(6,46656,),
(2,2048,),
(2,40,),
(20,79,),
(96,98,),
(25,5,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set... |
int main() {
int n_success = 0;
vector<int> param0 {57,3,10,10,6,2,2,20,96,25};
vector<int> param1 {1,9,101,10000,46656,2048,40,79,98,5};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
... |
POLICEMEN_CATCH_THIEVES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class POLICEMEN_CATCH_THIEVES{
static int f_gold ( char arr [ ] , int n , int k ) {
int res = 0 ;
ArrayList < Integer > thi = new ArrayList < Integer > ( ) ;
ArrayList < Integer > pol = new ArrayList < Integer > (... | def f_gold ( arr , n , k ) :
i = 0
l = 0
r = 0
res = 0
thi = [ ]
pol = [ ]
while i < n :
if arr [ i ] == 'P' :
pol.append ( i )
elif arr [ i ] == 'T' :
thi.append ( i )
i += 1
while l < len ( thi ) and r < len ( pol ) :
if ( abs ( t... |
using namespace std;
int f_gold ( char arr [ ], int n, int k ) {
int res = 0;
vector < int > thi;
vector < int > pol;
for ( int i = 0;
i < n;
i ++ ) {
if ( arr [ i ] == 'P' ) pol . push_back ( i );
else if ( arr [ i ] == 'T' ) thi . push_back ( i );
}
int l = 0, r = 0;
while ( l < thi . size ... |
public static void main(String args[]) {
int n_success = 0;
List<char [ ]> param0 = new ArrayList<>();
param0.add(new char[]{'A','B','B','D','E','E','F','G','G','G','I','J','O','P','Q','Q','Q','Q','R','R','S','U','X','Y','Y','c','d','h','i','i','i','i','k','k','l','l','l','l','m','p','r','r','s','t','t','u... |
if __name__ == '__main__':
param = [
(['A', 'B', 'B', 'D', 'E', 'E', 'F', 'G', 'G', 'G', 'I', 'J', 'O', 'P', 'Q', 'Q', 'Q', 'Q', 'R', 'R', 'S', 'U', 'X', 'Y', 'Y', 'c', 'd', 'h', 'i', 'i', 'i', 'i', 'k', 'k', 'l', 'l', 'l', 'l', 'm', 'p', 'r', 'r', 's', 't', 't', 'u', 'x', 'z'],33,45,),
(['7', '6', '0', '1... |
int main() {
int n_success = 0;
vector<vector<char>> param0 {{'A','B','B','D','E','E','F','G','G','G','I','J','O','P','Q','Q','Q','Q','R','R','S','U','X','Y','Y','c','d','h','i','i','i','i','k','k','l','l','l','l','m','p','r','r','s','t','t','u','x','z'},{'7','6','0','1','0','1'},{'0','0','0','0','0','0','0','... |
DYNAMIC_PROGRAMMING_SET_36_CUT_A_ROPE_TO_MAXIMIZE_PRODUCT_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_SET_36_CUT_A_ROPE_TO_MAXIMIZE_PRODUCT_1{
static int f_gold ( int n ) {
if ( n == 2 || n == 3 ) return ( n - 1 ) ;
int res = 1 ;
while ( n > 4 ) {
n -= 3 ;
res *= 3 ;
}
return ... | def f_gold(n):
if (n == 2 or n == 3):
return (n - 1)
res = 1
while (n > 4):
n -= 3
res *= 3
return (n * res)
|
using namespace std;
int f_gold ( int n ) {
if ( n == 2 || n == 3 ) return ( n - 1 );
int res = 1;
while ( n > 4 ) {
n -= 3;
res *= 3;
}
return ( n * res );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(62);
param0.add(53);
param0.add(8);
param0.add(6);
param0.add(35);
param0.add(35);
param0.add(46);
param0.add(74);
param0.add(69);
param0.add(3);
for(int ... |
if __name__ == '__main__':
param = [
(62,),
(53,),
(8,),
(6,),
(35,),
(35,),
(46,),
(74,),
(69,),
(3,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_se... |
int main() {
int n_success = 0;
vector<int> param0 {62,53,8,6,35,35,46,74,69,3};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
re... |
MAXIMUM_CONSECUTIVE_REPEATING_CHARACTER_STRING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_CONSECUTIVE_REPEATING_CHARACTER_STRING{
static char f_gold ( String str ) {
int len = str . length ( ) ;
int count = 0 ;
char res = str . charAt ( 0 ) ;
for ( int i = 0 ;
i < len ;
i ++ ) {
... | def f_gold ( str ) :
l = len ( str )
count = 0
res = str [ 0 ]
for i in range ( l ) :
cur_count = 1
for j in range ( i + 1 , l ) :
if ( str [ i ] != str [ j ] ) :
break
cur_count += 1
if cur_count > count :
count = cur_count
... |
using namespace std;
char f_gold ( string str ) {
int len = str . length ( );
int count = 0;
char res = str [ 0 ];
for ( int i = 0;
i < len;
i ++ ) {
int cur_count = 1;
for ( int j = i + 1;
j < len;
j ++ ) {
if ( str [ i ] != str [ j ] ) break;
cur_count ++;
}
if ( cur_c... |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("geeekk");
param0.add("3786868");
param0.add("110");
param0.add("aaaabbcbbb");
param0.add("11");
param0.add("011101");
param0.add("WoHNyJYLC");
param0.add("3141711779"... |
if __name__ == '__main__':
param = [
('geeekk',),
('3786868',),
('110',),
('aaaabbcbbb',),
('11',),
('011101',),
('WoHNyJYLC',),
('3141711779',),
('10111101101',),
('aabbabababcc',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_fille... |
int main() {
int n_success = 0;
vector<string> param0 {"geeekk","3786868","110","aaaabbcbbb","11","011101","WoHNyJYLC","3141711779","10111101101","aabbabababcc"};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
... |
COUNT_NEGATIVE_NUMBERS_IN_A_COLUMN_WISE_ROW_WISE_SORTED_MATRIX |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_NEGATIVE_NUMBERS_IN_A_COLUMN_WISE_ROW_WISE_SORTED_MATRIX{
static int f_gold ( int M [ ] [ ] , int n , int m ) {
int count = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = 0 ;
j < m ;
... | def f_gold ( M , n , m ) :
count = 0
for i in range ( n ) :
for j in range ( m ) :
if M [ i ] [ j ] < 0 :
count += 1
else :
break
return count
| null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ] [ ]> param0 = new ArrayList<>();
param0.add(new int[][]{new int[]{31,92,57,28,79,84,92,19,31,71,91,46,60,79,82,4,70,82,41,79,80,29,26,76,92,18,94,55,46,69,67,60,85,25,11},new int[]{58,69,14,55,6,69,81,60,38,52,81,80,1,47,42,82,2,70,68... |
if __name__ == '__main__':
param = [
([[31, 92, 57, 28, 79, 84, 92, 19, 31, 71, 91, 46, 60, 79, 82, 4, 70, 82, 41, 79, 80, 29, 26, 76, 92, 18, 94, 55, 46, 69, 67, 60, 85, 25, 11], [58, 69, 14, 55, 6, 69, 81, 60, 38, 52, 81, 80, 1, 47, 42, 82, 2, 70, 68, 71, 50, 98, 84, 1, 45, 24, 49, 33, 56, 4, 60, 42, 14, 45,... | null |
MAXIMIZE_VOLUME_CUBOID_GIVEN_SUM_SIDES_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMIZE_VOLUME_CUBOID_GIVEN_SUM_SIDES_1{
static int f_gold ( int s ) {
int length = s / 3 ;
s -= length ;
int breadth = s / 2 ;
int height = s - breadth ;
return length * breadth * height ;
}
| def f_gold ( s ) :
length = int ( s / 3 )
s -= length
breadth = s / 2
height = s - breadth
return int ( length * breadth * height )
|
using namespace std;
int f_gold ( int s ) {
int length = s / 3;
s -= length;
int breadth = s / 2;
int height = s - breadth;
return length * breadth * height;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(8);
param0.add(96);
param0.add(96);
param0.add(96);
param0.add(12);
param0.add(95);
param0.add(72);
param0.add(81);
param0.add(42);
param0.add(13);
for(in... |
if __name__ == '__main__':
param = [
(8,),
(96,),
(96,),
(96,),
(12,),
(95,),
(72,),
(81,),
(42,),
(13,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
p... |
int main() {
int n_success = 0;
vector<int> param0 {8,96,96,96,12,95,72,81,42,13};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
NUMBER_OF_BINARY_TREES_FOR_GIVEN_PREORDER_SEQUENCE_LENGTH |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_OF_BINARY_TREES_FOR_GIVEN_PREORDER_SEQUENCE_LENGTH{
static int f_gold ( int n ) {
int BT [ ] = new int [ n + 1 ] ;
for ( int i = 0 ;
i <= n ;
i ++ ) BT [ i ] = 0 ;
BT [ 0 ] = BT [ 1 ] = 1 ;
for ... | def f_gold(n):
BT = [0] * (n + 1)
BT[0] = BT[1] = 1
for i in range(2, n + 1):
for j in range(i):
BT[i] += BT[j] * BT[i - j - 1]
return BT[n]
|
using namespace std;
int f_gold ( int n ) {
int BT [ n + 1 ];
memset ( BT, 0, sizeof ( BT ) );
BT [ 0 ] = BT [ 1 ] = 1;
for ( int i = 2;
i <= n;
++ i ) for ( int j = 0;
j < i;
j ++ ) BT [ i ] += BT [ j ] * BT [ i - j - 1 ];
return BT [ n ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(87);
param0.add(69);
param0.add(15);
param0.add(11);
param0.add(11);
param0.add(15);
param0.add(47);
param0.add(65);
param0.add(50);
param0.add(58);
for(i... |
if __name__ == '__main__':
param = [
(87,),
(69,),
(15,),
(11,),
(11,),
(15,),
(47,),
(65,),
(50,),
(58,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters... |
int main() {
int n_success = 0;
vector<int> param0 {87,69,15,11,11,15,47,65,50,58};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
GIVEN_P_AND_N_FIND_THE_LARGEST_X_SUCH_THAT_PX_DIVIDES_N_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class GIVEN_P_AND_N_FIND_THE_LARGEST_X_SUCH_THAT_PX_DIVIDES_N_2{
static int f_gold ( int n , int p ) {
int ans = 0 ;
while ( n > 0 ) {
n /= p ;
ans += n ;
}
return ans ;
}
| null | null |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(33);
param0.add(81);
param0.add(18);
param0.add(77);
param0.add(9);
param0.add(31);
param0.add(63);
param0.add(66);
param0.add(57);
param0.add(14);
List<I... | null | null |
CHECK_WHETHER_ARITHMETIC_PROGRESSION_CAN_FORMED_GIVEN_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_WHETHER_ARITHMETIC_PROGRESSION_CAN_FORMED_GIVEN_ARRAY{
static boolean f_gold ( int arr [ ] , int n ) {
if ( n == 1 ) return true ;
Arrays . sort ( arr ) ;
int d = arr [ 1 ] - arr [ 0 ] ;
for ( int i ... | def f_gold ( arr , n ) :
if ( n == 1 ) : return True
arr.sort ( )
d = arr [ 1 ] - arr [ 0 ]
for i in range ( 2 , n ) :
if ( arr [ i ] - arr [ i - 1 ] != d ) :
return False
return True
|
using namespace std;
bool f_gold ( int arr [ ], int n ) {
if ( n == 1 ) return true;
sort ( arr, arr + n );
int d = arr [ 1 ] - arr [ 0 ];
for ( int i = 2;
i < n;
i ++ ) if ( arr [ i ] - arr [ i - 1 ] != d ) return false;
return true;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,4,64,16});
param0.add(new int[]{0, 12, 4, 8});
param0.add(new int[]{-2, 2, 0, 4, 6});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,0});
param0.add(new int[]{66,56,86,76... |
if __name__ == '__main__':
param = [
([1,4,64,16],4,),
([0, 12, 4, 8],4,),
([-2, 2, 0, 4, 6],5,),
([0,0,0,0,0,0,0,0,0,0,0,0],7,),
([66,56,86,76,46],5,),
([66,56,56,86,76,46],6,),
([7, 9, 11, 21, 44, 45, 61, 67, 78, 97, 98, 99],11,),
([66, -28, -26, 50, -18, 54, 84, -2, -70, -74, 6, ... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {
{1,4,64,16},
{0, 12, 4, 8},
{-2, 2, 0, 4, 6},
{0,0,0,0,0,0,0,0,0,0,0,0},
{66,56,86,76,46},
{66,56,56,86,76,46},
{7,9,11,21,44,45,61,67,78,97,98,99},
{66,-28,-26,50,-18,54,84,-2,-70,-74,6,-34,44,-36,-4,36,14,24,64,74,86... |
COUNT_PAIRS_WHOSE_PRODUCTS_EXIST_IN_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_PAIRS_WHOSE_PRODUCTS_EXIST_IN_ARRAY{
static int f_gold ( int arr [ ] , int n ) {
int result = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = i + 1 ;
j < n ;
j ++ ) {
int produ... | def f_gold ( arr , n ) :
result = 0 ;
for i in range ( 0 , n ) :
for j in range ( i + 1 , n ) :
product = arr [ i ] * arr [ j ] ;
for k in range ( 0 , n ) :
if ( arr [ k ] == product ) :
result = result + 1 ;
break ;
ret... |
using namespace std;
int f_gold ( int arr [ ], int n ) {
int result = 0;
for ( int i = 0;
i < n;
i ++ ) {
for ( int j = i + 1;
j < n;
j ++ ) {
int product = arr [ i ] * arr [ j ];
for ( int k = 0;
k < n;
k ++ ) {
if ( arr [ k ] == product ) {
result ++;
... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,7,26,40,46,89,99});
param0.add(new int[]{98,42,-24,-60,74,86,6,8,72,-58,38,-20,6,-6,8,48,-34,30,60,66,38,-54,8,-94,-8,0,-64,-94,-94,-72,-84,-36,88,-62,-88,46,-4,88});
param0.... |
if __name__ == '__main__':
param = [
([3, 7, 26, 40, 46, 89, 99],5,),
([98, 42, -24, -60, 74, 86, 6, 8, 72, -58, 38, -20, 6, -6, 8, 48, -34, 30, 60, 66, 38, -54, 8, -94, -8, 0, -64, -94, -94, -72, -84, -36, 88, -62, -88, 46, -4, 88],24,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{3,7,26,40,46,89,99},{98,42,-24,-60,74,86,6,8,72,-58,38,-20,6,-6,8,48,-34,30,60,66,38,-54,8,-94,-8,0,-64,-94,-94,-72,-84,-36,88,-62,-88,46,-4,88},{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,1,1},{37,97,... |
MAXIMUM_CONSECUTIVE_REPEATING_CHARACTER_STRING_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_CONSECUTIVE_REPEATING_CHARACTER_STRING_1{
static char f_gold ( String str ) {
int n = str . length ( ) ;
int count = 0 ;
char res = str . charAt ( 0 ) ;
int cur_count = 1 ;
for ( int i = 0 ;
i ... | def f_gold ( str ) :
n = len ( str )
count = 0
res = str [ 0 ]
cur_count = 1
for i in range ( n ) :
if ( i < n - 1 and str [ i ] == str [ i + 1 ] ) :
cur_count += 1
else :
if cur_count > count :
count = cur_count
res = str [ i ]... |
using namespace std;
char f_gold ( string str ) {
int n = str . length ( );
int count = 0;
char res = str [ 0 ];
int cur_count = 1;
for ( int i = 0;
i < n;
i ++ ) {
if ( i < n - 1 && str [ i ] == str [ i + 1 ] ) cur_count ++;
else {
if ( cur_count > count ) {
count = cur_count;
... |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("geeekk");
param0.add("3786868");
param0.add("110");
param0.add("aaaabbcbbb");
param0.add("11");
param0.add("011101");
param0.add("WoHNyJYLC");
param0.add("3141711779"... |
if __name__ == '__main__':
param = [
('geeekk',),
('3786868',),
('110',),
('aaaabbcbbb',),
('11',),
('011101',),
('WoHNyJYLC',),
('3141711779',),
('10111101101',),
('aabbabababcc',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_fille... |
int main() {
int n_success = 0;
vector<string> param0 {"geeekk","3786868","110","aaaabbcbbb","11","011101","WoHNyJYLC","3141711779","10111101101","aabbabababcc"};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
... |
C_PROGRAM_CONCATENATE_STRING_GIVEN_NUMBER_TIMES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class C_PROGRAM_CONCATENATE_STRING_GIVEN_NUMBER_TIMES{
static String f_gold ( String s , int n ) {
String s1 = s ;
for ( int i = 1 ;
i < n ;
i ++ ) s += s1 ;
return s ;
}
| def f_gold ( s , n ) :
s1 = s
for i in range ( 1 , n ) :
s += s1
return s
|
using namespace std;
string f_gold ( string s, int n ) {
string s1 = s;
for ( int i = 1;
i < n;
i ++ ) s += s1;
return s;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("LPWsaI");
param0.add("9037515104");
param0.add("00100010010111");
param0.add("SbwipuE");
param0.add("574314109");
param0.add("1101");
param0.add("f");
param0.add("068... |
if __name__ == '__main__':
param = [
('LPWsaI',41,),
('9037515104',72,),
('00100010010111',95,),
('SbwipuE',27,),
('574314109',5,),
('1101',70,),
('f',91,),
('068',50,),
('000011001',38,),
('BWbUtIkC',79,)
]
n_success = 0
for i, parameters_set in enumerate(pa... |
int main() {
int n_success = 0;
vector<string> param0 {"LPWsaI","9037515104","00100010010111","SbwipuE","574314109","1101","f","068","000011001","BWbUtIkC"};
vector<int> param1 {41,72,95,27,5,70,91,50,38,79};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gol... |
PRODUCT_MAXIMUM_FIRST_ARRAY_MINIMUM_SECOND_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PRODUCT_MAXIMUM_FIRST_ARRAY_MINIMUM_SECOND_1{
public static int f_gold ( int arr1 [ ] , int arr2 [ ] , int n1 , int n2 ) {
int max = arr1 [ 0 ] ;
int min = arr2 [ 0 ] ;
int i ;
for ( i = 1 ;
i < n1 && i ... | null |
using namespace std;
int f_gold ( int arr1 [ ], int arr2 [ ], int n1, int n2 ) {
int max = arr1 [ 0 ];
int min = arr2 [ 0 ];
int i;
for ( i = 1;
i < n1 && i < n2;
++ i ) {
if ( arr1 [ i ] > max ) max = arr1 [ i ];
if ( arr2 [ i ] < min ) min = arr2 [ i ];
}
while ( i < n1 ) {
if ( arr1 [ i ... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,6,32,33,34,36,41,43,52,70,70,70,75,78,88,88,95,95});
param0.add(new int[]{78,-88,44,10,96,-46,-66,84,32,44,56,76,-72,-72,82,-12,-20,-76,8,-34,12,-22,-92,-74,76,46,86,-2,-76,-86,3... | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{4,6,32,33,34,36,41,43,52,70,70,70,75,78,88,88,95,95},{78,-88,44,10,96,-46,-66,84,32,44,56,76,-72,-72,82,-12,-20,-76,8,-34,12,-22,-92,-74,76,46,86,-2,-76,-86,36,80},{0,0,1},{87,4,90,50,2,35,87},{-98,-86,-86,-82,-72,-72,-70,-68,-64,-58,-50,-48,-44,-38,... |
COUNT_NUMBER_OF_OCCURRENCES_OR_FREQUENCY_IN_A_SORTED_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_NUMBER_OF_OCCURRENCES_OR_FREQUENCY_IN_A_SORTED_ARRAY{
static int f_gold ( int arr [ ] , int n , int x ) {
int res = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) if ( x == arr [ i ] ) res ++ ;
return res ;
... | def f_gold ( arr , n , x ) :
res = 0
for i in range ( n ) :
if x == arr [ i ] :
res += 1
return res
|
using namespace std;
int f_gold ( int arr [ ], int n, int x ) {
int res = 0;
for ( int i = 0;
i < n;
i ++ ) if ( x == arr [ i ] ) res ++;
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{16,18,24,27,34,36,41,43,43,52,59,76,86,87,90,91,94,96,98,98});
param0.add(new int[]{64,66,-36});
param0.add(new int[]{0,0,0});
param0.add(new int[]{9,85,34,43,70,96,44,7,27... |
if __name__ == '__main__':
param = [
([16, 18, 24, 27, 34, 36, 41, 43, 43, 52, 59, 76, 86, 87, 90, 91, 94, 96, 98, 98],14,43,),
([64, 66, -36],1,64,),
([0, 0, 0],2,0,),
([9, 85, 34, 43, 70, 96, 44, 7, 27, 33, 34, 5, 91, 84, 76, 45, 20, 37, 15, 37, 20, 24, 13, 49, 74, 13, 50, 81, 81, 66, 23, 36, 91,... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{16,18,24,27,34,36,41,43,43,52,59,76,86,87,90,91,94,96,98,98},{64,66,-36},{0,0,0},{9,85,34,43,70,96,44,7,27,33,34,5,91,84,76,45,20,37,15,37,20,24,13,49,74,13,50,81,81,66,23,36,91,80,61,15,96,70,90,25,16,62,75,63,6,65,38,12},{-98,-98,-98,-34,-32,-26,-1... |
FIRST_ELEMENT_OCCURRING_K_TIMES_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIRST_ELEMENT_OCCURRING_K_TIMES_ARRAY{
static int f_gold ( int arr [ ] , int n , int k ) {
HashMap < Integer , Integer > count_map = new HashMap < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int a = 0 ;... | def f_gold ( arr , n , k ) :
count_map = { } ;
for i in range ( 0 , n ) :
if ( arr [ i ] in count_map.keys ( ) ) :
count_map [ arr [ i ] ] += 1
else :
count_map [ arr [ i ] ] = 1
i += 1
for i in range ( 0 , n ) :
if ( count_map [ arr [ i ] ] == k ) :
... |
using namespace std;
int f_gold ( int arr [ ], int n, int k ) {
unordered_map < int, int > count_map;
for ( int i = 0;
i < n;
i ++ ) count_map [ arr [ i ] ] ++;
for ( int i = 0;
i < n;
i ++ ) if ( count_map [ arr [ i ] ] == k ) return arr [ i ];
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,3,4,4,7,18,20,23,27,30,31,31,32,35,36,43,45,46,49,50,53,55,59,60,64,64,65,68,78,80,80,85,95});
param0.add(new int[]{-26,32,36,6,64,24,-28,96});
param0.add(new int[]{0,0,0,0,0... |
if __name__ == '__main__':
param = [
([2, 3, 4, 4, 7, 18, 20, 23, 27, 30, 31, 31, 32, 35, 36, 43, 45, 46, 49, 50, 53, 55, 59, 60, 64, 64, 65, 68, 78, 80, 80, 85, 95],30,2,),
([-26, 32, 36, 6, 64, 24, -28, 96],6,3,),
([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... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,3,4,4,7,18,20,23,27,30,31,31,32,35,36,43,45,46,49,50,53,55,59,60,64,64,65,68,78,80,80,85,95},{-26,32,36,6,64,24,-28,96},{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},{38,40,43,70,20,40,95,96,81,82},{-68,-8,-8,16,24,54},{1,0,1,0,0,0,... |
SPLIT_ARRAY_ADD_FIRST_PART_END |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SPLIT_ARRAY_ADD_FIRST_PART_END{
public static void f_gold ( int arr [ ] , int n , int k ) {
for ( int i = 0 ;
i < k ;
i ++ ) {
int x = arr [ 0 ] ;
for ( int j = 0 ;
j < n - 1 ;
++ j ) arr [ j... | def f_gold ( arr , n , k ) :
for i in range ( 0 , k ) :
x = arr [ 0 ]
for j in range ( 0 , n - 1 ) :
arr [ j ] = arr [ j + 1 ]
arr [ n - 1 ] = x
|
using namespace std;
void f_gold ( int arr [ ], int n, int k ) {
for ( int i = 0;
i < k;
i ++ ) {
int x = arr [ 0 ];
for ( int j = 0;
j < n - 1;
++ j ) arr [ j ] = arr [ j + 1 ];
arr [ n - 1 ] = x;
}
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{75});
param0.add(new int[]{-58,-60,-38,48,-2,32,-48,-46,90,-54,-18,28,72,86,0,-2,-74,12,-58,90,-30,10,-88,2,-14,82,-82,-46,2,-74});
param0.add(new int[]{0,0,0,0,0,1,1,1,1,1,1}... |
if __name__ == '__main__':
param = [
([75],0,0,),
([-58, -60, -38, 48, -2, 32, -48, -46, 90, -54, -18, 28, 72, 86, 0, -2, -74, 12, -58, 90, -30, 10, -88, 2, -14, 82, -82, -46, 2, -74],27,17,),
([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],7,7,),
([45, 51, 26, 36, 10, 62, 62, 56, 61, 67, 86, 97, 31, 93, 32, 1,... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{75},{-58,-60,-38,48,-2,32,-48,-46,90,-54,-18,28,72,86,0,-2,-74,12,-58,90,-30,10,-88,2,-14,82,-82,-46,2,-74},{0,0,0,0,0,1,1,1,1,1,1},{45,51,26,36,10,62,62,56,61,67,86,97,31,93,32,1,14,25,24,30,1,44,7,98,56,68,53,59,30,90,79,22},{-88,-72,-64,-46,-40,-... |
K_TH_LARGEST_SUM_CONTIGUOUS_SUBARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class K_TH_LARGEST_SUM_CONTIGUOUS_SUBARRAY{
static int f_gold ( int arr [ ] , int n , int k ) {
int sum [ ] = new int [ n + 1 ] ;
sum [ 0 ] = 0 ;
sum [ 1 ] = arr [ 0 ] ;
for ( int i = 2 ;
i <= n ;
i ++ ) sum... | import heapq
def f_gold ( arr , n , k ) :
sum = [ ]
sum.append ( 0 )
sum.append ( arr [ 0 ] )
for i in range ( 2 , n + 1 ) :
sum.append ( sum [ i - 1 ] + arr [ i - 1 ] )
Q = [ ]
heapq.heapify ( Q )
for i in range ( 1 , n + 1 ) :
for j in range ( i , n + 1 ) :
x =... |
using namespace std;
int f_gold ( int arr [ ], int n, int k ) {
int sum [ n + 1 ];
sum [ 0 ] = 0;
sum [ 1 ] = arr [ 0 ];
for ( int i = 2;
i <= n;
i ++ ) sum [ i ] = sum [ i - 1 ] + arr [ i - 1 ];
priority_queue < int, vector < int >, greater < int > > Q;
for ( int i = 1;
i <= n;
i ++ ) {
for ( ... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,3,5,7,8,29,29,44,47,52,60,65,73,83,87,92,92,95});
param0.add(new int[]{44,-98,-10,14,-6,-46,6,-74,-4,36,10,-2,30,28,96,-84,-36,-76,64,-74,-20,94,-4,14,78,52,-56,98,-68,-76,-10,20... |
if __name__ == '__main__':
param = [
([2, 3, 5, 7, 8, 29, 29, 44, 47, 52, 60, 65, 73, 83, 87, 92, 92, 95],10,12,),
([44, -98, -10, 14, -6, -46, 6, -74, -4, 36, 10, -2, 30, 28, 96, -84, -36, -76, 64, -74, -20, 94, -4, 14, 78, 52, -56, 98, -68, -76, -10, 20, 88, -98, 96, 80, 96, -32, -40, -30, 82],34,37,),
... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,3,5,7,8,29,29,44,47,52,60,65,73,83,87,92,92,95},{44,-98,-10,14,-6,-46,6,-74,-4,36,10,-2,30,28,96,-84,-36,-76,64,-74,-20,94,-4,14,78,52,-56,98,-68,-76,-10,20,88,-98,96,80,96,-32,-40,-30,82},{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},{58,21,97,78,78,5... |
TEMPLE_OFFERINGS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class TEMPLE_OFFERINGS{
static int f_gold ( int n , int templeHeight [ ] ) {
int sum = 0 ;
for ( int i = 0 ;
i < n ;
++ i ) {
int left = 0 , right = 0 ;
for ( int j = i - 1 ;
j >= 0 ;
-- j ) {
... | def f_gold ( n , templeHeight ) :
sum = 0
for i in range ( n ) :
left = 0
right = 0
for j in range ( i - 1 , - 1 , - 1 ) :
if ( templeHeight [ j ] < templeHeight [ j + 1 ] ) :
left += 1
else :
break
for j in range ( i + 1 , ... |
using namespace std;
int f_gold ( int n, int templeHeight [ ] ) {
int sum = 0;
for ( int i = 0;
i < n;
++ i ) {
int left = 0, right = 0;
for ( int j = i - 1;
j >= 0;
-- j ) {
if ( templeHeight [ j ] < templeHeight [ j + 1 ] ) ++ left;
else break;
}
for ( int j = i + 1;
j... |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(12);
param0.add(46);
param0.add(16);
param0.add(9);
param0.add(0);
param0.add(38);
param0.add(28);
param0.add(9);
param0.add(18);
param0.add(29);
List<int... |
if __name__ == '__main__':
param = [
(12,[3, 11, 12, 15, 16, 21, 24, 29, 32, 39, 42, 44, 51, 68, 79, 81, 81, 85, 92, 94],),
(46,[76, 48, 88, 70, -64, 66, -6, -58, 26, -28, -42, -94, 80, -4, -56, -46, 4, 90, -12, -78, 64, 18, -38, 26, 56, -24, 66, -18, -12, 0, -94, 12, -10, 4, -68, -20, 88, 2, -58, 16, 46, ... |
int main() {
int n_success = 0;
vector<int> param0 {12,46,16,9,0,38,28,9,18,29};
vector<vector<int>> param1 {{3,11,12,15,16,21,24,29,32,39,42,44,51,68,79,81,81,85,92,94},{76,48,88,70,-64,66,-6,-58,26,-28,-42,-94,80,-4,-56,-46,4,90,-12,-78,64,18,-38,26,56,-24,66,-18,-12,0,-94,12,-10,4,-68,-20,88,2,-58,16,46... |
COUNT_1S_SORTED_BINARY_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_1S_SORTED_BINARY_ARRAY{
static int f_gold ( int arr [ ] , int low , int high ) {
if ( high >= low ) {
int mid = low + ( high - low ) / 2 ;
if ( ( mid == high || arr [ mid + 1 ] == 0 ) && ( arr [ mi... | null | null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{5,21,38,46,89,91});
param0.add(new int[]{-48,46,12,-68,-82,-16,86,32,98,86,44,-86,60,-28,-60,-6,12,88,-82,-84,28,4,64,30,82,94,64,-34,-46,90,60,52,46,-24,10});
param0.add(new i... | null | null |
MINIMUM_NUMBER_OF_JUMPS_TO_REACH_END_OF_A_GIVEN_ARRAY_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_NUMBER_OF_JUMPS_TO_REACH_END_OF_A_GIVEN_ARRAY_2{
static int f_gold ( int arr [ ] , int n ) {
int [ ] jumps = new int [ n ] ;
int min ;
jumps [ n - 1 ] = 0 ;
for ( int i = n - 2 ;
i >= 0 ;
i -- ... | def f_gold ( arr , n ) :
jumps = [ 0 for i in range ( n ) ]
for i in range ( n - 2 , - 1 , - 1 ) :
if ( arr [ i ] == 0 ) :
jumps [ i ] = float ( 'inf' )
elif ( arr [ i ] >= n - i - 1 ) :
jumps [ i ] = 1
else :
min = float ( 'inf' )
for j in... |
using namespace std;
int f_gold ( int arr [ ], int n ) {
int * jumps = new int [ n ];
int min;
jumps [ n - 1 ] = 0;
for ( int i = n - 2;
i >= 0;
i -- ) {
if ( arr [ i ] == 0 ) jumps [ i ] = INT_MAX;
else if ( arr [ i ] >= n - i - 1 ) jumps [ i ] = 1;
else {
min = INT_MAX;
for ( int ... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,6,7,14,22,32,42,42,43,48,54,57,59,69,84,92,98});
param0.add(new int[]{98,-66,-70,-64,-88,-76,-90,16,58,68,-10,-42,-28,10,72,68,-30,60,92,-56,80,-4,-82,30,58,98,-56,98,-14,-38,-20... |
if __name__ == '__main__':
param = [
([1, 6, 7, 14, 22, 32, 42, 42, 43, 48, 54, 57, 59, 69, 84, 92, 98],11,),
([98, -66, -70, -64, -88, -76, -90, 16, 58, 68, -10, -42, -28, 10, 72, 68, -30, 60, 92, -56, 80, -4, -82, 30, 58, 98, -56, 98, -14, -38, -20, -74, -46, -22, 78, 36, -54, -64, 80, -10, -26, 82, 96, ... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,6,7,14,22,32,42,42,43,48,54,57,59,69,84,92,98},{98,-66,-70,-64,-88,-76,-90,16,58,68,-10,-42,-28,10,72,68,-30,60,92,-56,80,-4,-82,30,58,98,-56,98,-14,-38,-20,-74,-46,-22,78,36,-54,-64,80,-10,-26,82,96,-72,-36,-36,-32,-88,0},{0,0,0,0,0,0,0,0,0,0,0,0,... |
MINIMUM_SUM_SUBSEQUENCE_LEAST_ONE_EVERY_FOUR_CONSECUTIVE_ELEMENTS_PICKED |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_SUM_SUBSEQUENCE_LEAST_ONE_EVERY_FOUR_CONSECUTIVE_ELEMENTS_PICKED{
static int f_gold ( int [ ] arr , int n ) {
int [ ] dp = new int [ n ] ;
if ( n == 1 ) return arr [ 0 ] ;
if ( n == 2 ) return Math .... | def f_gold ( arr , n ) :
dp = [ 0 ] * n
if ( n == 1 ) :
return arr [ 0 ]
if ( n == 2 ) :
return min ( arr [ 0 ] , arr [ 1 ] )
if ( n == 3 ) :
return min ( arr [ 0 ] , min ( arr [ 1 ] , arr [ 2 ] ) )
if ( n == 4 ) :
return min ( min ( arr [ 0 ] , arr [ 1 ] ) , min ( ar... |
using namespace std;
int f_gold ( int arr [ ], int n ) {
int dp [ n ];
if ( n == 1 ) return arr [ 0 ];
if ( n == 2 ) return min ( arr [ 0 ], arr [ 1 ] );
if ( n == 3 ) return min ( arr [ 0 ], min ( arr [ 1 ], arr [ 2 ] ) );
if ( n == 4 ) return min ( min ( arr [ 0 ], arr [ 1 ] ), min ( arr [ 2 ], arr [ 3 ] )... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,7,11,12,13,14,18,20,22,26,28,29,31,32,33,35,38,38,40,40,41,42,43,44,45,53,54,54,59,62,69,72,74,75,75,76,79,83,84,89,91,96,97,98,99,99});
param0.add(new int[]{50,-22,90,-40,46,86,... |
if __name__ == '__main__':
param = [
([2, 7, 11, 12, 13, 14, 18, 20, 22, 26, 28, 29, 31, 32, 33, 35, 38, 38, 40, 40, 41, 42, 43, 44, 45, 53, 54, 54, 59, 62, 69, 72, 74, 75, 75, 76, 79, 83, 84, 89, 91, 96, 97, 98, 99, 99],30,),
([50, -22, 90, -40, 46, 86, 50, 44, 12, -42, -58, 6, 52, -16, 4, 46, 44, 0, -64,... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,7,11,12,13,14,18,20,22,26,28,29,31,32,33,35,38,38,40,40,41,42,43,44,45,53,54,54,59,62,69,72,74,75,75,76,79,83,84,89,91,96,97,98,99,99},{50,-22,90,-40,46,86,50,44,12,-42,-58,6,52,-16,4,46,44,0,-64,78,-14,-80,30,-66,78,24,28,10,-72,-44,-28,-32,-30,94... |
PROGRAM_CHECK_ARRAY_SORTED_NOT_ITERATIVE_RECURSIVE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_CHECK_ARRAY_SORTED_NOT_ITERATIVE_RECURSIVE{
static int f_gold ( int arr [ ] , int n ) {
if ( n == 1 || n == 0 ) return 1 ;
if ( arr [ n - 1 ] < arr [ n - 2 ] ) return 0 ;
return f_gold ( arr , n - 1 ... | null |
using namespace std;
int f_gold ( int arr [ ], int n ) {
if ( n == 1 || n == 0 ) return 1;
if ( arr [ n - 1 ] < arr [ n - 2 ] ) return 0;
return f_gold ( arr, n - 1 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,4,19,21,28,32,35,44,51,55,62,80,80,83,90,93,93});
param0.add(new int[]{84,-28,-42,38,-94,-70,34,54,38,-58,-54,-6,72,-32,-18,80,-6,-38,-30,-86,-10,14,92,-56,40,-58,-2,-6,-46,-80,7... | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,4,19,21,28,32,35,44,51,55,62,80,80,83,90,93,93},{84,-28,-42,38,-94,-70,34,54,38,-58,-54,-6,72,-32,-18,80,-6,-38,-30,-86,-10,14,92,-56,40,-58,-2,-6,-46,-80,72,-12,2,-64,36,98,-24},{0,1,1,1},{74,75,9,13,57,82,57,37,47,11,28,6,33,14,47,29,15,56,69,86,... |
PRODUCT_NODES_K_TH_LEVEL_TREE_REPRESENTED_STRING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PRODUCT_NODES_K_TH_LEVEL_TREE_REPRESENTED_STRING{
static int f_gold ( String tree , int k ) {
int level = - 1 ;
int product = 1 ;
int n = tree . length ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if (... | def f_gold ( tree , k ) :
level = - 1
product = 1
n = len ( tree )
for i in range ( 0 , n ) :
if ( tree [ i ] == '(' ) :
level += 1
elif ( tree [ i ] == ')' ) :
level -= 1
else :
if ( level == k ) :
product *= ( int ( tree [ i ]... |
using namespace std;
int f_gold ( string tree, int k ) {
int level = - 1;
int product = 1;
int n = tree . length ( );
for ( int i = 0;
i < n;
i ++ ) {
if ( tree [ i ] == '(' ) level ++;
else if ( tree [ i ] == ')' ) level --;
else {
if ( level == k ) product *= ( tree [ i ] - '0' );
}... |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("(0(5(6()())(4()(9()())))(7(1()())(3()())))");
param0.add("(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))");
param0.add("(0(5(6()())(4()(9()())))(7(1()())(3()())))");
param0.add("(... |
if __name__ == '__main__':
param = [
('(0(5(6()())(4()(9()())))(7(1()())(3()())))',2,),
('(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))',3,),
('(0(5(6()())(4()(9()())))(7(1()())(3()())))',1,),
('(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))',2,),
('(8(3(2()())(6(5()())()))(5(10()())(7(1... |
int main() {
int n_success = 0;
vector<string> param0 {
"(0(5(6()())(4()(9()())))(7(1()())(3()())))",
"(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))",
"(0(5(6()())(4()(9()())))(7(1()())(3()())))",
"(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))",
"(8(3(2()())(6(5()())()))(5(10()())(7... |
SIZE_SUBARRAY_MAXIMUM_SUM |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SIZE_SUBARRAY_MAXIMUM_SUM{
static int f_gold ( int a [ ] , int size ) {
int max_so_far = Integer . MIN_VALUE , max_ending_here = 0 , start = 0 , end = 0 , s = 0 ;
for ( int i = 0 ;
i < size ;
i ++ ) {
... | null |
using namespace std;
int f_gold ( int a [ ], int size ) {
int max_so_far = INT_MIN, max_ending_here = 0, start = 0, end = 0, s = 0;
for ( int i = 0;
i < size;
i ++ ) {
max_ending_here += a [ i ];
if ( max_so_far < max_ending_here ) {
max_so_far = max_ending_here;
start = s;
end = i;
... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{7,7,16,20,21,22,34,34,37,37,49,53,54,55,58,59,60,66,67,68,73,80,80,88,90,98,99,99});
param0.add(new int[]{-90,-98,-10,-84,24});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,1,1,1... | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{7,7,16,20,21,22,34,34,37,37,49,53,54,55,58,59,60,66,67,68,73,80,80,88,90,98,99,99},{-90,-98,-10,-84,24},{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{94,2,83,94,10,94,58,99,60,19,3,71,36,84,71,14,50,15},{-98,-96,-70,-64,-56,-38,-34,-24,-22,-2,26,32,36,5... |
RECURSIVE_C_PROGRAM_LINEARLY_SEARCH_ELEMENT_GIVEN_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class RECURSIVE_C_PROGRAM_LINEARLY_SEARCH_ELEMENT_GIVEN_ARRAY{
static int f_gold ( int arr [ ] , int l , int r , int x ) {
if ( r < l ) return - 1 ;
if ( arr [ l ] == x ) return l ;
if ( arr [ r ] == x ) return r ... | def f_gold ( arr , l , r , x ) :
if r < l :
return - 1
if arr [ l ] == x :
return l
if arr [ r ] == x :
return r
return f_gold ( arr , l + 1 , r - 1 , x )
|
using namespace std;
int f_gold ( int arr [ ], int l, int r, int x ) {
if ( r < l ) return - 1;
if ( arr [ l ] == x ) return l;
if ( arr [ r ] == x ) return r;
return f_gold ( arr, l + 1, r - 1, x );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{10,74,5});
param0.add(new int[]{-90,72,36,96,42,0,-66,5});
param0.add(new int[]{0,5});
param0.add(new int[]{99,70,67,5});
param0.add(new int[]{-98,-98,-26,-26,-24,-18,-... |
if __name__ == '__main__':
param = [
([10,74,5],0,2,1,),
([-90,72,36,96,42,0,-66,5],0,7,96,),
([0,5],0,1,-1,),
([99,70,67,5],0,3,3,),
([-98,-98,-26,-26,-24,-18,-16,80,5],0,8,80,),
([1,1,1,1,0,1,5],0,6,1,),
([1,5,12,12,17,17,12,95,96,98,5],0,0,12,),
([50,-70,-30,-54,6,-10,70,84,5],0,... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{10,74,3},{-90,72,36,96,42,0,-66,4},{0},{99,70,67,5},{-98,-98,-26,-26,-24,-18,-16,80,5},{1,1,1,1,0,1,0},{1,5,12,12,17,17,12,95,96,98,4},{50,-70,-30,-54,6,-10,70,84,5},{0,1,5},{59,21,28,3,14,5}};
vector<int> param1 {0,0,0,0,0,0,0,0,0,0};
vector... |
CHECK_POSSIBLE_SORT_ARRAY_CONDITIONAL_SWAPPING_ADJACENT_ALLOWED |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_POSSIBLE_SORT_ARRAY_CONDITIONAL_SWAPPING_ADJACENT_ALLOWED{
static boolean f_gold ( int arr [ ] , int n ) {
for ( int i = 0 ;
i < n - 1 ;
i ++ ) {
if ( arr [ i ] > arr [ i + 1 ] ) {
if ( arr [... | def f_gold ( arr , n ) :
for i in range ( 0 , n - 1 ) :
if ( arr [ i ] > arr [ i + 1 ] ) :
if ( arr [ i ] - arr [ i + 1 ] == 1 ) :
arr [ i ] , arr [ i + 1 ] = arr [ i + 1 ] , arr [ i ]
else :
return False
return True
|
using namespace std;
bool f_gold ( int arr [ ], int n ) {
for ( int i = 0;
i < n - 1;
i ++ ) {
if ( arr [ i ] > arr [ i + 1 ] ) {
if ( arr [ i ] - arr [ i + 1 ] == 1 ) swap ( arr [ i ], arr [ i + 1 ] );
else return false;
}
}
return true;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,4,12,16,37,44,47,51,55,57,57,62,62,62,64,69,69,70,72,81,81,88,89,97});
param0.add(new int[]{-86,0,14,-16,-12,-72,62,-34,-72,30,84,-60,84,-64,50,74,18,-82,-64,-64,-74,-56,86,84,-3... |
if __name__ == '__main__':
param = [
([1, 4, 12, 16, 37, 44, 47, 51, 55, 57, 57, 62, 62, 62, 64, 69, 69, 70, 72, 81, 81, 88, 89, 97],15,),
([-86, 0, 14, -16, -12, -72, 62, -34, -72, 30, 84, -60, 84, -64, 50, 74, 18, -82, -64, -64, -74, -56, 86, 84, -32, -10, 20, 4, 8, 96, 82, 26, 42],18,),
([0, 0, 0, 0... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,4,12,16,37,44,47,51,55,57,57,62,62,62,64,69,69,70,72,81,81,88,89,97},{-86,0,14,-16,-12,-72,62,-34,-72,30,84,-60,84,-64,50,74,18,-82,-64,-64,-74,-56,86,84,-32,-10,20,4,8,96,82,26,42},{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... |
C_PROGRAM_FACTORIAL_NUMBER_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class C_PROGRAM_FACTORIAL_NUMBER_2{
static int f_gold ( int n ) {
return ( n == 1 || n == 0 ) ? 1 : n * f_gold ( n - 1 ) ;
}
| def f_gold ( n ) :
return 1 if ( n == 1 or n == 0 ) else n * f_gold ( n - 1 )
|
using namespace std;
int f_gold ( int n ) {
return ( n == 1 || n == 0 ) ? 1 : n * f_gold ( n - 1 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(66);
param0.add(93);
param0.add(39);
param0.add(93);
param0.add(68);
param0.add(20);
param0.add(37);
param0.add(52);
param0.add(52);
param0.add(19);
for(i... |
if __name__ == '__main__':
param = [
(66,),
(93,),
(39,),
(93,),
(68,),
(20,),
(37,),
(52,),
(52,),
(19,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {66,93,39,93,68,20,37,52,52,19};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
SUM_SERIES_23_45_67_89_UPTO_N_TERMS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_SERIES_23_45_67_89_UPTO_N_TERMS{
static double f_gold ( int n ) {
int i = 1 ;
double res = 0.0 ;
boolean sign = true ;
while ( n > 0 ) {
n -- ;
if ( sign ) {
sign = ! sign ;
res = r... | def f_gold ( n ) :
i = 1 ;
res = 0.0 ;
sign = True ;
while ( n > 0 ) :
n = n - 1 ;
if ( sign ) :
sign = False ;
res = res + ( i + 1 ) / ( i + 2 ) ;
i = i + 2 ;
else :
sign = True ;
res = res - ( i + 1 ) / ( i + 2 ) ;
... |
using namespace std;
double f_gold ( int n ) {
int i = 1;
double res = 0.0;
bool sign = true;
while ( n > 0 ) {
n --;
if ( sign ) {
sign = ! sign;
res = res + ( double ) ++ i / ++ i;
}
else {
sign = ! sign;
res = res - ( double ) ++ i / ++ i;
}
}
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(49);
param0.add(4);
param0.add(60);
param0.add(90);
param0.add(96);
param0.add(29);
param0.add(86);
param0.add(47);
param0.add(77);
param0.add(87);
for(in... |
if __name__ == '__main__':
param = [
(49,),
(4,),
(60,),
(90,),
(96,),
(29,),
(86,),
(47,),
(77,),
(87,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if abs(1 - (0.0000001 + abs(f_gold(*parameters_set))) / (abs(f_filled(*parameters_set))... |
int main() {
int n_success = 0;
vector<int> param0 {49,4,60,90,96,29,86,47,77,87};
for(int i = 0; i < param0.size(); ++i)
{
if(abs(1 - (0.0000001 + abs(f_gold(param0[i])) )/ (abs(f_filled(param0[i])) + 0.0000001)) < 0.001)
{
n_success+=1;
}
}
cout << "#Result... |
COUNT_NUMBER_PAIRS_N_B_N_GCD_B_B |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_NUMBER_PAIRS_N_B_N_GCD_B_B{
static int f_gold ( int n ) {
int k = n ;
int imin = 1 ;
int ans = 0 ;
while ( imin <= n ) {
int imax = n / k ;
ans += k * ( imax - imin + 1 ) ;
imin = imax + ... | def f_gold(n):
k = n
imin = 1
ans = 0
while (imin <= n):
imax = n / k
ans += k * (imax - imin + 1)
imin = imax + 1
k = n / imin
return ans
|
using namespace std;
int f_gold ( int n ) {
int k = n;
int imin = 1;
int ans = 0;
while ( imin <= n ) {
int imax = n / k;
ans += k * ( imax - imin + 1 );
imin = imax + 1;
k = n / imin;
}
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(17);
param0.add(72);
param0.add(43);
param0.add(55);
param0.add(62);
param0.add(22);
param0.add(17);
param0.add(68);
param0.add(20);
param0.add(29);
for(i... |
if __name__ == '__main__':
param = [
(17,),
(72,),
(43,),
(55,),
(62,),
(22,),
(17,),
(68,),
(20,),
(29,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters... |
int main() {
int n_success = 0;
vector<int> param0 {17,72,43,55,62,22,17,68,20,29};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
CALCULATE_VOLUME_DODECAHEDRON |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CALCULATE_VOLUME_DODECAHEDRON{
static double f_gold ( int side ) {
return ( ( ( 15 + ( 7 * ( Math . sqrt ( 5 ) ) ) ) / 4 ) * ( Math . pow ( side , 3 ) ) ) ;
}
| import math
def f_gold ( side ) :
return ( ( ( 15 + ( 7 * ( math.sqrt ( 5 ) ) ) ) / 4 ) * ( math.pow ( side , 3 ) ) )
|
using namespace std;
double f_gold ( int side ) {
return ( ( ( 15 + ( 7 * ( sqrt ( 5 ) ) ) ) / 4 ) * ( pow ( side, 3 ) ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(56);
param0.add(73);
param0.add(22);
param0.add(10);
param0.add(84);
param0.add(20);
param0.add(51);
param0.add(91);
param0.add(10);
param0.add(83);
for(i... |
if __name__ == '__main__':
param = [
(56,),
(73,),
(22,),
(10,),
(84,),
(20,),
(51,),
(91,),
(10,),
(83,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if abs(1 - (0.0000001 + abs(f_gold(*parameters_set))) / (abs(f_filled(*parameters_set)... |
int main() {
int n_success = 0;
vector<int> param0 {56,73,22,10,84,20,51,91,10,83};
for(int i = 0; i < param0.size(); ++i)
{
if(abs(1 - (0.0000001 + abs(f_gold(param0[i])) )/ (abs(f_filled(param0[i])) + 0.0000001)) < 0.001)
{
n_success+=1;
}
}
cout << "#Resul... |
SORT_ARRAY_CONTAIN_1_N_VALUES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
class SORT_ARRAY_CONTAIN_1_N_VALUES{
static void f_gold ( int [ ] arr , int n ) {
for ( int i = 0 ;
i < n ;
i ++ ) {
arr [ i ] = i + 1 ;
}
}
| def f_gold ( arr , n ) :
for i in range ( n ) :
arr [ i ] = i + 1
|
using namespace std;
void f_gold ( int arr [ ], int n ) {
for ( int i = 0;
i < n;
i ++ ) {
arr [ i ] = i + 1;
}
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,3,6,7,9,11,15,15,17,19,21,23,26,27,37,48,48,51,53,53,59,64,69,69,70,71,72,84,93,96});
param0.add(new int[]{66,-28,6,25,-65,19,-86,-86,-90,40,-62});
param0.add(new int[]{0,0,0... |
if __name__ == '__main__':
param = [
([3, 3, 6, 7, 9, 11, 15, 15, 17, 19, 21, 23, 26, 27, 37, 48, 48, 51, 53, 53, 59, 64, 69, 69, 70, 71, 72, 84, 93, 96],19,),
([66, -28, 6, 25, -65, 19, -86, -86, -90, 40, -62],8,),
([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... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{3,3,6,7,9,11,15,15,17,19,21,23,26,27,37,48,48,51,53,53,59,64,69,69,70,71,72,84,93,96},{66,-28,6,25,-65,19,-86,-86,-90,40,-62},{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},{85,84,8,36,93,76,14,54,85,86}... |
PROGRAM_CHECK_INPUT_INTEGER_STRING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_CHECK_INPUT_INTEGER_STRING{
static boolean f_gold ( String s ) {
for ( int i = 0 ;
i < s . length ( ) ;
i ++ ) if ( Character . isDigit ( s . charAt ( i ) ) == false ) return false ;
return true ;
... | def f_gold ( s ) :
for i in range ( len ( s ) ) :
if s [ i ].isdigit ( ) != True :
return False
return True
|
using namespace std;
bool f_gold ( string s ) {
for ( int i = 0;
i < s . length ( );
i ++ ) if ( isdigit ( s [ i ] ) == false ) return false;
return true;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("MgTOyHo NT");
param0.add("033675175");
param0.add("011001");
param0.add("XLlccG");
param0.add("8223900094410");
param0.add("000");
param0.add("aupp");
param0.add("902... |
if __name__ == '__main__':
param = [
('MgTOyHo NT',),
('033675175',),
('011001',),
('XLlccG',),
('8223900094410',),
('000',),
('aupp',),
('90202721499',),
('110000100011',),
('MhYHsMQeLhG',)
]
n_success = 0
for i, parameters_set in enumerate(param):
i... |
int main() {
int n_success = 0;
vector<string> param0 {"MgTOyHo NT","033675175","011001","XLlccG","8223900094410","000","aupp","90202721499","110000100011","MhYHsMQeLhG"};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
... |
MINIMUM_XOR_VALUE_PAIR_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_XOR_VALUE_PAIR_1{
static int f_gold ( int arr [ ] , int n ) {
Arrays . parallelSort ( arr ) ;
int minXor = Integer . MAX_VALUE ;
int val = 0 ;
for ( int i = 0 ;
i < n - 1 ;
i ++ ) {
val = a... | import sys
def f_gold ( arr , n ) :
arr.sort ( )
minXor = int ( sys.float_info.max )
val = 0
for i in range ( 0 , n - 1 ) :
val = arr [ i ] ^ arr [ i + 1 ] ;
minXor = min ( minXor , val ) ;
return minXor
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
sort ( arr, arr + n );
int minXor = INT_MAX;
int val = 0;
for ( int i = 0;
i < n - 1;
i ++ ) {
val = arr [ i ] ^ arr [ i + 1 ];
minXor = min ( minXor, val );
}
return minXor;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{8,11,12,27,32,32,36,56,57,66,68,70,74,78,82,83,96});
param0.add(new int[]{40,48,66,4,-60,42,-8,38});
param0.add(new int[]{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,... |
if __name__ == '__main__':
param = [
([8, 11, 12, 27, 32, 32, 36, 56, 57, 66, 68, 70, 74, 78, 82, 83, 96],10,),
([40, 48, 66, 4, -60, 42, -8, 38],7,),
([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],19,),
([98, 6, 82, 95, 87, 20, 11, 63,... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{8,11,12,27,32,32,36,56,57,66,68,70,74,78,82,83,96},{40,48,66,4,-60,42,-8,38},{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},{98,6,82,95,87,20,11,63,78,70,37,12,57,67,10,49,38,28,86,7,61,50,32,68,91,66,57,29,2,64,65,15,16,4,... |
SUM_K_TH_GROUP_ODD_POSITIVE_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_K_TH_GROUP_ODD_POSITIVE_NUMBERS{
public static int f_gold ( int k ) {
int cur = ( k * ( k - 1 ) ) + 1 ;
int sum = 0 ;
while ( k -- > 0 ) {
sum += cur ;
cur += 2 ;
}
return sum ;
}
| def f_gold(k):
cur = int((k * (k - 1)) + 1)
sum = 0
while k:
sum += cur
cur += 2
k = k - 1
return sum
|
using namespace std;
int f_gold ( int k ) {
int cur = ( k * ( k - 1 ) ) + 1;
int sum = 0;
while ( k -- ) {
sum += cur;
cur += 2;
}
return sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(91);
param0.add(52);
param0.add(78);
param0.add(51);
param0.add(65);
param0.add(39);
param0.add(42);
param0.add(12);
param0.add(56);
param0.add(98);
for(i... |
if __name__ == '__main__':
param = [
(91,),
(52,),
(78,),
(51,),
(65,),
(39,),
(42,),
(12,),
(56,),
(98,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters... |
int main() {
int n_success = 0;
vector<int> param0 {91,52,78,51,65,39,42,12,56,98};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
FIND_SMALLEST_VALUE_REPRESENTED_SUM_SUBSET_GIVEN_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_SMALLEST_VALUE_REPRESENTED_SUM_SUBSET_GIVEN_ARRAY{
static int f_gold ( int arr [ ] , int n ) {
int res = 1 ;
for ( int i = 0 ;
i < n && arr [ i ] <= res ;
i ++ ) res = res + arr [ i ] ;
return res ;... | def f_gold ( arr , n ) :
res = 1
for i in range ( 0 , n ) :
if arr [ i ] <= res :
res = res + arr [ i ]
else :
break
return res
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int res = 1;
for ( int i = 0;
i < n && arr [ i ] <= res;
i ++ ) res = res + arr [ i ];
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{16,23,24,41,48,58,72,75});
param0.add(new int[]{-14,-82,12,-14,-38,12,40,12,-74,42,-36,64});
param0.add(new int[]{0,0,1,1,1,1});
param0.add(new int[]{17,89,44});
param0... |
if __name__ == '__main__':
param = [
([16, 23, 24, 41, 48, 58, 72, 75],4,),
([-14, -82, 12, -14, -38, 12, 40, 12, -74, 42, -36, 64],8,),
([0, 0, 1, 1, 1, 1],5,),
([17, 89, 44],2,),
([-94, -92, -84, -82, -72, -58, -56, -40, -34, -34, -24, -22, -8, -8, 12, 14, 16, 16, 22, 22, 34, 46, 54, 58, 68, ... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{16,23,24,41,48,58,72,75},{-14,-82,12,-14,-38,12,40,12,-74,42,-36,64},{0,0,1,1,1,1},{17,89,44},{-94,-92,-84,-82,-72,-58,-56,-40,-34,-34,-24,-22,-8,-8,12,14,16,16,22,22,34,46,54,58,68,72,74,78,88,96},{0,0,0,0,0,1,0,0,1,0,1,0},{2,12,13,13,13,16,28,32,34... |
EFFICIENT_WAY_CHECK_WHETHER_N_TH_FIBONACCI_NUMBER_MULTIPLE_10 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class EFFICIENT_WAY_CHECK_WHETHER_N_TH_FIBONACCI_NUMBER_MULTIPLE_10{
static boolean f_gold ( int n ) {
if ( n % 15 == 0 ) return true ;
return false ;
}
| def f_gold ( n ) :
return ( n % 15 == 0 )
|
using namespace std;
bool f_gold ( int n ) {
return ( n % 15 == 0 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(30);
param0.add(-30);
param0.add(60);
param0.add(90);
param0.add(99);
param0.add(32);
param0.add(21);
param0.add(65);
param0.add(21);
param0.add(99);
for(... |
if __name__ == '__main__':
param = [
(30,),
(-30,),
(60,),
(90,),
(99,),
(32,),
(21,),
(65,),
(21,),
(99,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {30,-30,60,90,99,32,21,65,21,99};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
DYNAMIC_PROGRAMMING_SET_14_MAXIMUM_SUM_INCREASING_SUBSEQUENCE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_SET_14_MAXIMUM_SUM_INCREASING_SUBSEQUENCE{
static int f_gold ( int arr [ ] , int n ) {
int i , j , max = 0 ;
int msis [ ] = new int [ n ] ;
for ( i = 0 ;
i < n ;
i ++ ) msis [ i ] = a... | def f_gold ( arr , n ) :
max = 0
msis = [ 0 for x in range ( n ) ]
for i in range ( n ) :
msis [ i ] = arr [ i ]
for i in range ( 1 , n ) :
for j in range ( i ) :
if ( arr [ i ] > arr [ j ] and msis [ i ] < msis [ j ] + arr [ i ] ) :
msis [ i ] = msis [ j ] + ... |
using namespace std;
int f_gold ( int arr [ ], int n ) {
int i, j, max = 0;
int msis [ n ];
for ( i = 0;
i < n;
i ++ ) msis [ i ] = arr [ i ];
for ( i = 1;
i < n;
i ++ ) for ( j = 0;
j < i;
j ++ ) if ( arr [ i ] > arr [ j ] && msis [ i ] < msis [ j ] + arr [ i ] ) msis [ i ] = msis [ j ] + arr [ i ... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,5,7,12,23,31,31,45,47,60,67,70,84,85,91,96});
param0.add(new int[]{-88,-38,-50,-14,36,-32,0,-8,-12,-62,-46,66,-46,-26,6,-44,14,-74,-84,52,-28});
param0.add(new int[]{0,0,0,0,... |
if __name__ == '__main__':
param = [
([4, 5, 7, 12, 23, 31, 31, 45, 47, 60, 67, 70, 84, 85, 91, 96],11,),
([-88, -38, -50, -14, 36, -32, 0, -8, -12, -62, -46, 66, -46, -26, 6, -44, 14, -74, -84, 52, -28],18,),
([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... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{4,5,7,12,23,31,31,45,47,60,67,70,84,85,91,96},{-88,-38,-50,-14,36,-32,0,-8,-12,-62,-46,66,-46,-26,6,-44,14,-74,-84,52,-28},{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},{85,42,7,35,35,21,97,59,88,... |
SUM_NODES_K_TH_LEVEL_TREE_REPRESENTED_STRING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_NODES_K_TH_LEVEL_TREE_REPRESENTED_STRING{
static int f_gold ( String tree , int k ) {
int level = - 1 ;
int sum = 0 ;
int n = tree . length ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( tree . ... | def f_gold ( tree , k ) :
level = - 1
sum = 0
n = len ( tree )
for i in range ( n ) :
if ( tree [ i ] == '(' ) :
level += 1
elif ( tree [ i ] == ')' ) :
level -= 1
else :
if ( level == k ) :
sum += ( ord ( tree [ i ] ) - ord ( '... |
using namespace std;
int f_gold ( string tree, int k ) {
int level = - 1;
int sum = 0;
int n = tree . length ( );
for ( int i = 0;
i < n;
i ++ ) {
if ( tree [ i ] == '(' ) level ++;
else if ( tree [ i ] == ')' ) level --;
else {
if ( level == k ) sum += ( tree [ i ] - '0' );
}
}
r... |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("(0(5(6()())(4()(9()())))(7(1()())(3()())))");
param0.add("(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))");
param0.add("(0(5(6()())(4()(9()())))(7(1()())(3()())))");
param0.add("(... |
if __name__ == '__main__':
param = [
('(0(5(6()())(4()(9()())))(7(1()())(3()())))',2,),
('(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))',3,),
('(0(5(6()())(4()(9()())))(7(1()())(3()())))',1,),
('(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))',2,),
('(8(3(2()())(6(5()())()))(5(10()())(7(1... |
int main() {
int n_success = 0;
vector<string> param0 {
"(0(5(6()())(4()(9()())))(7(1()())(3()())))",
"(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))",
"(0(5(6()())(4()(9()())))(7(1()())(3()())))",
"(8(3(2()())(6(5()())()))(5(10()())(7(13()())())))",
"(8(3(2()())(6(5()())()))(5(10()(... |
PROGRAM_OCTAL_DECIMAL_CONVERSION |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_OCTAL_DECIMAL_CONVERSION{
static int f_gold ( int n ) {
int num = n ;
int dec_value = 0 ;
int base = 1 ;
int temp = num ;
while ( temp > 0 ) {
int last_digit = temp % 10 ;
temp = temp / 1... | def f_gold ( n ) :
num = n ;
dec_value = 0 ;
base = 1 ;
temp = num ;
while ( temp ) :
last_digit = temp % 10 ;
temp = int ( temp / 10 ) ;
dec_value += last_digit * base ;
base = base * 8 ;
return dec_value ;
|
using namespace std;
int f_gold ( int n ) {
int num = n;
int dec_value = 0;
int base = 1;
int temp = num;
while ( temp ) {
int last_digit = temp % 10;
temp = temp / 10;
dec_value += last_digit * base;
base = base * 8;
}
return dec_value;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(37);
param0.add(25);
param0.add(63);
param0.add(66);
param0.add(32);
param0.add(5);
param0.add(41);
param0.add(82);
param0.add(54);
param0.add(5);
for(int... |
if __name__ == '__main__':
param = [
(37,),
(25,),
(63,),
(66,),
(32,),
(5,),
(41,),
(82,),
(54,),
(5,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
pr... |
int main() {
int n_success = 0;
vector<int> param0 {37,25,63,66,32,5,41,82,54,5};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
r... |
REARRANGE_ARRAY_MAXIMUM_MINIMUM_FORM_SET_2_O1_EXTRA_SPACE_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
class REARRANGE_ARRAY_MAXIMUM_MINIMUM_FORM_SET_2_O1_EXTRA_SPACE_1{
public static void f_gold ( int arr [ ] , int n ) {
int max_ele = arr [ n - 1 ] ;
int min_ele = arr [ 0 ] ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if... | def f_gold ( arr , n ) :
max_ele = arr [ n - 1 ]
min_ele = arr [ 0 ]
for i in range ( n ) :
if i % 2 == 0 :
arr [ i ] = max_ele
max_ele -= 1
else :
arr [ i ] = min_ele
min_ele += 1
|
using namespace std;
void f_gold ( int arr [ ], int n ) {
int max_ele = arr [ n - 1 ];
int min_ele = arr [ 0 ];
for ( int i = 0;
i < n;
i ++ ) {
if ( i % 2 == 0 ) {
arr [ i ] = max_ele;
max_ele -= 1;
}
else {
arr [ i ] = min_ele;
min_ele += 1;
}
}
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,4,8,10,12,14,14,17,18,19,20,25,28,29,30,31,34,35,37,38,40,41,42,45,47,49,54,54,55,58,58,63,65,66,66,67,67,72,74,75,75,80,82,86,92,95,96,99});
param0.add(new int[]{45,42,-91,90,-6... |
if __name__ == '__main__':
param = [
([3, 4, 8, 10, 12, 14, 14, 17, 18, 19, 20, 25, 28, 29, 30, 31, 34, 35, 37, 38, 40, 41, 42, 45, 47, 49, 54, 54, 55, 58, 58, 63, 65, 66, 66, 67, 67, 72, 74, 75, 75, 80, 82, 86, 92, 95, 96, 99],40,),
([45, 42, -91, 90, -6, 49, 65, 39, -80, -65, -47, 75, 10, 80, 36, -96, 55... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{3,4,8,10,12,14,14,17,18,19,20,25,28,29,30,31,34,35,37,38,40,41,42,45,47,49,54,54,55,58,58,63,65,66,66,67,67,72,74,75,75,80,82,86,92,95,96,99},{45,42,-91,90,-6,49,65,39,-80,-65,-47,75,10,80,36,-96,55,72,68,2,-53,-6,72,-52,-9,80,-16,-32,39,25,-27,-96,-... |
CHECK_IF_STRING_REMAINS_PALINDROME_AFTER_REMOVING_GIVEN_NUMBER_OF_CHARACTERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_IF_STRING_REMAINS_PALINDROME_AFTER_REMOVING_GIVEN_NUMBER_OF_CHARACTERS{
static boolean f_gold ( String str , int n ) {
int len = str . length ( ) ;
if ( len >= n ) return true ;
return false ;
}
| def f_gold ( str , n ) :
l = len ( str )
if ( l >= n ) :
return True
return False
|
using namespace std;
bool f_gold ( string str, int n ) {
int len = str . length ( );
if ( len >= n ) return true;
return false;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("ZCoQhuM");
param0.add("7437725");
param0.add("11");
param0.add("buGlvR");
param0.add("9");
param0.add("101101010110");
param0.add("YguiM");
param0.add("8198");
pa... |
if __name__ == '__main__':
param = [
('ZCoQhuM',2,),
('7437725',53,),
('11',30,),
('buGlvR',1,),
('9',92,),
('101101010110',3,),
('YguiM',18,),
('8198',90,),
('11101',71,),
('hUInqJXNdbfP',4,)
]
n_success = 0
for i, parameters_set in enumerate(param):
... |
int main() {
int n_success = 0;
vector<string> param0 {"ZCoQhuM","7437725","11","buGlvR","9","101101010110","YguiM","8198","11101","hUInqJXNdbfP"};
vector<int> param1 {2,53,30,1,92,3,18,90,71,4};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],p... |
COUNT_POSSIBLE_PATHS_TOP_LEFT_BOTTOM_RIGHT_NXM_MATRIX_3 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_POSSIBLE_PATHS_TOP_LEFT_BOTTOM_RIGHT_NXM_MATRIX_3{
static int f_gold ( int m , int n ) {
int path = 1 ;
for ( int i = n ;
i < ( m + n - 1 ) ;
i ++ ) {
path *= i ;
path /= ( i - n + 1 ) ;
}
... | null |
using namespace std;
int f_gold ( int m, int n ) {
int path = 1;
for ( int i = n;
i < ( m + n - 1 );
i ++ ) {
path *= i;
path /= ( i - n + 1 );
}
return path;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(10);
param0.add(52);
param0.add(5);
param0.add(84);
param0.add(27);
param0.add(77);
param0.add(52);
param0.add(3);
param0.add(5);
param0.add(14);
List<Int... | null |
int main() {
int n_success = 0;
vector<int> param0 {10,52,5,84,27,77,52,3,5,14};
vector<int> param1 {3,8,23,56,30,90,50,25,75,18};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
... |
NUMBER_INDEXES_EQUAL_ELEMENTS_GIVEN_RANGE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_INDEXES_EQUAL_ELEMENTS_GIVEN_RANGE{
static int f_gold ( int a [ ] , int n , int l , int r ) {
int count = 0 ;
for ( int i = l ;
i < r ;
i ++ ) if ( a [ i ] == a [ i + 1 ] ) count += 1 ;
return cou... | def f_gold ( a , n , l , r ) :
count = 0
for i in range ( l , r ) :
if ( a [ i ] == a [ i + 1 ] ) :
count += 1
return count
|
using namespace std;
int f_gold ( int a [ ], int n, int l, int r ) {
int count = 0;
for ( int i = l;
i < r;
i ++ ) if ( a [ i ] == a [ i + 1 ] ) count += 1;
return count;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,13,13,16,16,19,39,41,48,52,57,62,65,67,76,84,88,91,95,96,97,98});
param0.add(new int[]{62,76,86,-8,84,-6,72,84,6,-50,-18,-94,54,90,-74,-64,-26,-14,-32,62,10,4,70,-28,8,18,4,-62,-... |
if __name__ == '__main__':
param = [
([4, 13, 13, 16, 16, 19, 39, 41, 48, 52, 57, 62, 65, 67, 76, 84, 88, 91, 95, 96, 97, 98],18,12,17,),
([62, 76, 86, -8, 84, -6, 72, 84, 6, -50, -18, -94, 54, 90, -74, -64, -26, -14, -32, 62, 10, 4, 70, -28, 8, 18, 4, -62, -76, 84, -78, -4, 84, 98, 58, -68, 42, -6, 34, -3... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{4,13,13,16,16,19,39,41,48,52,57,62,65,67,76,84,88,91,95,96,97,98},{62,76,86,-8,84,-6,72,84,6,-50,-18,-94,54,90,-74,-64,-26,-14,-32,62,10,4,70,-28,8,18,4,-62,-76,84,-78,-4,84,98,58,-68,42,-6,34,-38,52,-84,78},{0,0,0,0,0,0,1,1,1,1,1,1},{11,75,98,29,62,... |
PROGRAM_FIND_REMAINDER_LARGE_NUMBER_DIVIDED_11 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_FIND_REMAINDER_LARGE_NUMBER_DIVIDED_11{
static int f_gold ( String str ) {
int len = str . length ( ) ;
int num , rem = 0 ;
for ( int i = 0 ;
i < len ;
i ++ ) {
num = rem * 10 + ( str . charA... | null |
using namespace std;
int f_gold ( string str ) {
int len = str . length ( );
int num, rem = 0;
for ( int i = 0;
i < len;
i ++ ) {
num = rem * 10 + ( str [ i ] - '0' );
rem = num % 11;
}
return rem;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("DvsNZVNZ");
param0.add("1170");
param0.add("10");
param0.add("evsPwREbSY");
param0.add("09219178704");
param0.add("1001010");
param0.add("SkZbWSajDKmiG");
param0.add(... | null |
int main() {
int n_success = 0;
vector<string> param0 {"DvsNZVNZ","1170","10","evsPwREbSY","09219178704","1001010","SkZbWSajDKmiG","0287976763","011011000111","lUn"};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
... |
COUNT_SET_BITS_IN_AN_INTEGER_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_SET_BITS_IN_AN_INTEGER_2{
static int f_gold ( int n ) {
int count = 0 ;
while ( n > 0 ) {
n &= ( n - 1 ) ;
count ++ ;
}
return count ;
}
| def f_gold ( n ) :
count = 0
while ( n ) :
n &= ( n - 1 )
count += 1
return count
| null |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(32);
param0.add(94);
param0.add(33);
param0.add(99);
param0.add(17);
param0.add(64);
param0.add(80);
param0.add(42);
param0.add(12);
param0.add(86);
for(i... |
if __name__ == '__main__':
param = [
(32,),
(94,),
(33,),
(99,),
(17,),
(64,),
(80,),
(42,),
(12,),
(86,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... | null |
TRIANGULAR_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class TRIANGULAR_NUMBERS{
static boolean f_gold ( int num ) {
if ( num < 0 ) return false ;
int sum = 0 ;
for ( int n = 1 ;
sum <= num ;
n ++ ) {
sum = sum + n ;
if ( sum == num ) return true ;
}
r... | def f_gold ( num ) :
if ( num < 0 ) :
return False
sum , n = 0 , 1
while ( sum <= num ) :
sum = sum + n
if ( sum == num ) :
return True
n += 1
return False
|
using namespace std;
bool f_gold ( int num ) {
if ( num < 0 ) return false;
int sum = 0;
for ( int n = 1;
sum <= num;
n ++ ) {
sum = sum + n;
if ( sum == num ) return true;
}
return false;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(97);
param0.add(97);
param0.add(32);
param0.add(40);
param0.add(18);
param0.add(14);
param0.add(90);
param0.add(39);
param0.add(1);
param0.add(57);
for(in... |
if __name__ == '__main__':
param = [
(97,),
(97,),
(32,),
(40,),
(18,),
(14,),
(90,),
(39,),
(1,),
(57,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
p... |
int main() {
int n_success = 0;
vector<int> param0 {97,97,32,40,18,14,90,39,1,57};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
ROUND_THE_GIVEN_NUMBER_TO_NEAREST_MULTIPLE_OF_10 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class ROUND_THE_GIVEN_NUMBER_TO_NEAREST_MULTIPLE_OF_10{
static int f_gold ( int n ) {
int a = ( n / 10 ) * 10 ;
int b = a + 10 ;
return ( n - a > b - n ) ? b : a ;
}
| def f_gold ( n ) :
a = ( n // 10 ) * 10
b = a + 10
return ( b if n - a > b - n else a )
|
using namespace std;
int f_gold ( int n ) {
int a = ( n / 10 ) * 10;
int b = a + 10;
return ( n - a > b - n ) ? b : a;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(31);
param0.add(78);
param0.add(19);
param0.add(36);
param0.add(77);
param0.add(94);
param0.add(86);
param0.add(16);
param0.add(95);
param0.add(2);
for(in... |
if __name__ == '__main__':
param = [
(31,),
(78,),
(19,),
(36,),
(77,),
(94,),
(86,),
(16,),
(95,),
(2,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
p... |
int main() {
int n_success = 0;
vector<int> param0 {31,78,19,36,77,94,86,16,95,2};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
SUM_FACTORS_NUMBER_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_FACTORS_NUMBER_1{
static int f_gold ( int n ) {
int res = 1 ;
for ( int i = 2 ;
i <= Math . sqrt ( n ) ;
i ++ ) {
int curr_sum = 1 ;
int curr_term = 1 ;
while ( n % i == 0 ) {
n = n /... | null |
using namespace std;
int f_gold ( int n ) {
int res = 1;
for ( int i = 2;
i <= sqrt ( n );
i ++ ) {
int curr_sum = 1;
int curr_term = 1;
while ( n % i == 0 ) {
n = n / i;
curr_term *= i;
curr_sum += curr_term;
}
res *= curr_sum;
}
if ( n >= 2 ) res *= ( 1 + n );
retu... |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(96);
param0.add(32);
param0.add(93);
param0.add(78);
param0.add(30);
param0.add(5);
param0.add(62);
param0.add(27);
param0.add(95);
param0.add(45);
for(in... | null |
int main() {
int n_success = 0;
vector<int> param0 {96,32,93,78,30,5,62,27,95,45};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
COUNT_ROTATIONS_DIVISIBLE_8 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_ROTATIONS_DIVISIBLE_8{
static int f_gold ( String n ) {
int len = n . length ( ) ;
int count = 0 ;
if ( len == 1 ) {
int oneDigit = n . charAt ( 0 ) - '0' ;
if ( oneDigit % 8 == 0 ) return 1 ;
... | null |
using namespace std;
int f_gold ( string n ) {
int len = n . length ( );
int count = 0;
if ( len == 1 ) {
int oneDigit = n [ 0 ] - '0';
if ( oneDigit % 8 == 0 ) return 1;
return 0;
}
if ( len == 2 ) {
int first = ( n [ 0 ] - '0' ) * 10 + ( n [ 1 ] - '0' );
int second = ( n [ 1 ] - '0' ) *... |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add(" MwBVIb");
param0.add("37291205493");
param0.add("0111111");
param0.add("BrrQon");
param0.add("226051");
param0.add("1001101");
param0.add("eREctoEen");
param0.add("2... | null |
int main() {
int n_success = 0;
vector<string> param0 {" MwBVIb","37291205493","0111111","BrrQon","226051","1001101","eREctoEen","299967","000111","GJUYuqbampKo"};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}... |
SUM_MATRIX_ELEMENT_ABSOLUTE_DIFFERENCE_ROW_COLUMN_NUMBERS_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_MATRIX_ELEMENT_ABSOLUTE_DIFFERENCE_ROW_COLUMN_NUMBERS_1{
static int f_gold ( int n ) {
int sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) sum += i * ( n - i ) ;
return 2 * sum ;
}
| def f_gold ( n ) :
sum = 0
for i in range ( n ) :
sum += i * ( n - i )
return 2 * sum
|
using namespace std;
int f_gold ( int n ) {
int sum = 0;
for ( int i = 0;
i < n;
i ++ ) sum += i * ( n - i );
return 2 * sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(63);
param0.add(72);
param0.add(28);
param0.add(35);
param0.add(6);
param0.add(70);
param0.add(20);
param0.add(8);
param0.add(8);
param0.add(35);
for(int ... |
if __name__ == '__main__':
param = [
(63,),
(72,),
(28,),
(35,),
(6,),
(70,),
(20,),
(8,),
(8,),
(35,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
pri... |
int main() {
int n_success = 0;
vector<int> param0 {63,72,28,35,6,70,20,8,8,35};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
re... |
NUMBER_JUMP_REQUIRED_GIVEN_LENGTH_REACH_POINT_FORM_D_0_ORIGIN_2D_PLANE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_JUMP_REQUIRED_GIVEN_LENGTH_REACH_POINT_FORM_D_0_ORIGIN_2D_PLANE{
static int f_gold ( int a , int b , int d ) {
int temp = a ;
a = Math . min ( a , b ) ;
b = Math . max ( temp , b ) ;
if ( d >= b ) r... | def f_gold ( a , b , d ) :
temp = a
a = min ( a , b )
b = max ( temp , b )
if ( d >= b ) :
return ( d + b - 1 ) / b
if ( d == 0 ) :
return 0
if ( d == a ) :
return 1
return 2
|
using namespace std;
int f_gold ( int a, int b, int d ) {
int temp = a;
a = min ( a, b );
b = max ( temp, b );
if ( d >= b ) return ( d + b - 1 ) / b;
if ( d == 0 ) return 0;
if ( d == a ) return 1;
return 2;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(35);
param0.add(85);
param0.add(22);
param0.add(8);
param0.add(12);
param0.add(58);
param0.add(65);
param0.add(10);
param0.add(23);
param0.add(5);
List<In... |
if __name__ == '__main__':
param = [
(35,8,77,),
(85,55,33,),
(22,23,64,),
(8,43,29,),
(12,64,11,),
(58,25,26,),
(65,4,28,),
(10,95,55,),
(23,13,54,),
(5,50,71,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) =... |
int main() {
int n_success = 0;
vector<int> param0 {35,85,22,8,12,58,65,10,23,5};
vector<int> param1 {8,55,23,43,64,25,4,95,13,50};
vector<int> param2 {77,33,64,29,11,26,28,55,54,71};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i]) == f_gold(param0[i]... |
CHECK_IF_A_NUMBER_IS_POWER_OF_ANOTHER_NUMBER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_IF_A_NUMBER_IS_POWER_OF_ANOTHER_NUMBER{
public static boolean f_gold ( int x , int y ) {
if ( x == 1 ) return ( y == 1 ) ;
int pow = 1 ;
while ( pow < y ) pow = pow * x ;
return ( pow == y ) ;
}
| def f_gold ( x , y ) :
if ( x == 1 ) :
return ( y == 1 )
pow = 1
while ( pow < y ) :
pow = pow * x
return ( pow == y )
|
using namespace std;
bool f_gold ( int x, long int y ) {
if ( x == 1 ) return ( y == 1 );
long int pow = 1;
while ( pow < y ) pow *= x;
return ( pow == y );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(57);
param0.add(3);
param0.add(10);
param0.add(10);
param0.add(6);
param0.add(2);
param0.add(1);
param0.add(20);
param0.add(96);
param0.add(25);
List<Inte... |
if __name__ == '__main__':
param = [
(57,1,),
(3,9,),
(10,101,),
(10,10000,),
(6,46656,),
(2,2048,),
(1,40,),
(20,79,),
(96,98,),
(25,5,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set... |
int main() {
int n_success = 0;
vector<int> param0 {57,3,10,10,6,2,1,20,96,25};
vector<int> param1 {1,9,101,10000,46656,2048,40,79,98,5};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
... |
MINIMUM_FLIP_REQUIRED_MAKE_BINARY_MATRIX_SYMMETRIC_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_FLIP_REQUIRED_MAKE_BINARY_MATRIX_SYMMETRIC_1{
static int f_gold ( int mat [ ] [ ] , int n ) {
int flip = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = 0 ;
j < i ;
j ++ ) if ( mat [ i ] [ j... | def f_gold ( mat , n ) :
flip = 0
for i in range ( n ) :
for j in range ( i ) :
if mat [ i ] [ j ] != mat [ j ] [ i ] :
flip += 1
return flip
| null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ] [ ]> param0 = new ArrayList<>();
param0.add(new int[][]{new int[]{16,16,47,49,50,64,70,83,88},new int[]{11,12,24,32,36,39,48,58,62},new int[]{29,31,35,49,71,78,82,92,96},new int[]{6,21,46,53,83,88,94,94,97},new int[]{29,36,41,52,83,89... |
if __name__ == '__main__':
param = [
([[16, 16, 47, 49, 50, 64, 70, 83, 88], [11, 12, 24, 32, 36, 39, 48, 58, 62], [29, 31, 35, 49, 71, 78, 82, 92, 96], [6, 21, 46, 53, 83, 88, 94, 94, 97], [29, 36, 41, 52, 83, 89, 89, 90, 90], [3, 11, 35, 45, 47, 79, 81, 85, 96], [31, 43, 62, 62, 62, 65, 66, 68, 81], [8, 9, 1... | null |
SUM_SERIES_12_32_52_2N_12 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_SERIES_12_32_52_2N_12{
static int f_gold ( int n ) {
int sum = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) sum = sum + ( 2 * i - 1 ) * ( 2 * i - 1 ) ;
return sum ;
}
| def f_gold ( n ) :
sum = 0
for i in range ( 1 , n + 1 ) :
sum = sum + ( 2 * i - 1 ) * ( 2 * i - 1 )
return sum
|
using namespace std;
int f_gold ( int n ) {
int sum = 0;
for ( int i = 1;
i <= n;
i ++ ) sum = sum + ( 2 * i - 1 ) * ( 2 * i - 1 );
return sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(14);
param0.add(61);
param0.add(37);
param0.add(86);
param0.add(47);
param0.add(98);
param0.add(70);
param0.add(24);
param0.add(76);
param0.add(24);
for(i... |
if __name__ == '__main__':
param = [
(14,),
(61,),
(37,),
(86,),
(47,),
(98,),
(70,),
(24,),
(76,),
(24,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {14,61,37,86,47,98,70,24,76,24};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
SWAP_TWO_NUMBERS_WITHOUT_USING_TEMPORARY_VARIABLE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
class SWAP_TWO_NUMBERS_WITHOUT_USING_TEMPORARY_VARIABLE{
static void f_gold ( int [ ] xp , int [ ] yp ) {
xp [ 0 ] = xp [ 0 ] ^ yp [ 0 ] ;
yp [ 0 ] = xp [ 0 ] ^ yp [ 0 ] ;
xp [ 0 ] = xp [ 0 ] ^ yp [ 0 ] ;
}
| def f_gold ( xp , yp ) :
xp [ 0 ] = xp [ 0 ] ^ yp [ 0 ]
yp [ 0 ] = xp [ 0 ] ^ yp [ 0 ]
xp [ 0 ] = xp [ 0 ] ^ yp [ 0 ]
| null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,7,12,13,15,17,24,27,28,31,36,44,55,55,56,58,60,62,64,73,75,77,89,90,93,93,95,97,98});
param0.add(new int[]{36,51,6,25,13,-36,23,14,-80,-84,45,-81,20,36,66,-62,81,-7,5,0,-10,59,-5... |
if __name__ == '__main__':
param = [
([2, 7, 12, 13, 15, 17, 24, 27, 28, 31, 36, 44, 55, 55, 56, 58, 60, 62, 64, 73, 75, 77, 89, 90, 93, 93, 95, 97, 98],[5, 8, 12, 13, 14, 20, 23, 25, 27, 28, 31, 33, 33, 37, 38, 39, 42, 42, 43, 47, 52, 54, 62, 67, 71, 72, 73, 76, 77, 79, 81, 81, 85, 86, 89, 91, 91, 96, 96, 99]... | null |
CHECK_IF_ALL_THE_ELEMENTS_CAN_BE_MADE_OF_SAME_PARITY_BY_INVERTING_ADJACENT_ELEMENTS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_IF_ALL_THE_ELEMENTS_CAN_BE_MADE_OF_SAME_PARITY_BY_INVERTING_ADJACENT_ELEMENTS{
static boolean f_gold ( int [ ] a , int n ) {
int count_odd = 0 , count_even = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
... | def f_gold ( a , n ) :
count_odd = 0 ; count_even = 0 ;
for i in range ( n ) :
if ( a [ i ] & 1 ) :
count_odd += 1 ;
else :
count_even += 1 ;
if ( count_odd % 2 and count_even % 2 ) :
return False ;
else :
return True ;
|
using namespace std;
bool f_gold ( int a [ ], int n ) {
int count_odd = 0, count_even = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( a [ i ] & 1 ) count_odd ++;
else count_even ++;
}
if ( count_odd % 2 && count_even % 2 ) return false;
else return true;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,1,1,7,7,8,10,10,10,14,15,18,20,23,24,24,26,30,32,32,33,36,42,43,46,48,51,51,52,53,58,58,59,59,59,60,67,71,72,74,76,77,83,84,86,90,91});
param0.add(new int[]{-90,-20,-60,-64,-24,8... |
if __name__ == '__main__':
param = [
([1, 1, 1, 7, 7, 8, 10, 10, 10, 14, 15, 18, 20, 23, 24, 24, 26, 30, 32, 32, 33, 36, 42, 43, 46, 48, 51, 51, 52, 53, 58, 58, 59, 59, 59, 60, 67, 71, 72, 74, 76, 77, 83, 84, 86, 90, 91],30,),
([-90, -20, -60, -64, -24, 84, -2, -32, 28, -54, 44, -96, 52, 88, 20, -56, -2],1... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,1,1,7,7,8,10,10,10,14,15,18,20,23,24,24,26,30,32,32,33,36,42,43,46,48,51,51,52,53,58,58,59,59,59,60,67,71,72,74,76,77,83,84,86,90,91},{-90,-20,-60,-64,-24,84,-2,-32,28,-54,44,-96,52,88,20,-56,-2},{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... |
CHECK_WHETHER_TRIANGLE_VALID_NOT_SIDES_GIVEN |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_WHETHER_TRIANGLE_VALID_NOT_SIDES_GIVEN{
public static int f_gold ( int a , int b , int c ) {
if ( a + b <= c || a + c <= b || b + c <= a ) return 0 ;
else return 1 ;
}
| def f_gold ( a , b , c ) :
if ( a + b <= c ) or ( a + c <= b ) or ( b + c <= a ) :
return False
else :
return True
|
using namespace std;
bool f_gold ( int a, int b, int c ) {
if ( a + b <= c || a + c <= b || b + c <= a ) return false;
else return true;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(29);
param0.add(83);
param0.add(48);
param0.add(59);
param0.add(56);
param0.add(68);
param0.add(63);
param0.add(95);
param0.add(2);
param0.add(11);
List<I... |
if __name__ == '__main__':
param = [
(29,19,52,),
(83,34,49,),
(48,14,65,),
(59,12,94,),
(56,39,22,),
(68,85,9,),
(63,36,41,),
(95,34,37,),
(2,90,27,),
(11,16,1,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) ... |
int main() {
int n_success = 0;
vector<int> param0 {29,83,48,59,56,68,63,95,2,11};
vector<int> param1 {19,34,14,12,39,85,36,34,90,16};
vector<int> param2 {52,49,65,94,22,9,41,37,27,1};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i]) == f_gold(param0[i... |
TOTAL_NUMBER_OF_NON_DECREASING_NUMBERS_WITH_N_DIGITS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class TOTAL_NUMBER_OF_NON_DECREASING_NUMBERS_WITH_N_DIGITS{
static int f_gold ( int n ) {
int dp [ ] [ ] = new int [ 10 ] [ n + 1 ] ;
for ( int i = 0 ;
i < 10 ;
i ++ ) dp [ i ] [ 1 ] = 1 ;
for ( int digit = 0 ... | def f_gold ( n ) :
dp = [ [ 0 for i in range ( n + 1 ) ] for i in range ( 10 ) ]
for i in range ( 10 ) :
dp [ i ] [ 1 ] = 1
for digit in range ( 10 ) :
for len in range ( 2 , n + 1 ) :
for x in range ( digit + 1 ) :
dp [ digit ] [ len ] += dp [ x ] [ len - 1 ]
... |
using namespace std;
long long int f_gold ( int n ) {
long long int dp [ 10 ] [ n + 1 ];
memset ( dp, 0, sizeof dp );
for ( int i = 0;
i < 10;
i ++ ) dp [ i ] [ 1 ] = 1;
for ( int digit = 0;
digit <= 9;
digit ++ ) {
for ( int len = 2;
len <= n;
len ++ ) {
for ( int x = 0;
x <= d... |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(21);
param0.add(40);
param0.add(83);
param0.add(93);
param0.add(43);
param0.add(98);
param0.add(35);
param0.add(86);
param0.add(76);
param0.add(88);
for(i... |
if __name__ == '__main__':
param = [
(21,),
(40,),
(83,),
(93,),
(43,),
(98,),
(35,),
(86,),
(76,),
(88,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {21,40,83,93,43,98,35,86,76,88};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
MAXIMUM_PROFIT_BY_BUYING_AND_SELLING_A_SHARE_AT_MOST_TWICE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_PROFIT_BY_BUYING_AND_SELLING_A_SHARE_AT_MOST_TWICE{
static int f_gold ( int price [ ] , int n ) {
int profit [ ] = new int [ n ] ;
for ( int i = 0 ;
i < n ;
i ++ ) profit [ i ] = 0 ;
int max_pric... | def f_gold(price, n):
profit = [0] * n
max_price = price[n - 1]
for i in range(n - 2, 0, - 1):
if price[i] > max_price:
max_price = price[i]
profit[i] = max(profit[i + 1], max_price - price[i])
min_price = price[0]
for i in range(1, n):
if price[i] < min_price:
... |
using namespace std;
int f_gold ( int price [ ], int n ) {
int * profit = new int [ n ];
for ( int i = 0;
i < n;
i ++ ) profit [ i ] = 0;
int max_price = price [ n - 1 ];
for ( int i = n - 2;
i >= 0;
i -- ) {
if ( price [ i ] > max_price ) max_price = price [ i ];
profit [ i ] = max ( profit [ ... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{9,10,10,12,17,18,23,32,41,44,47,50,59,69,69,75,82,84,87,89,97,99});
param0.add(new int[]{6,6,60,40,32,-70,-92,88,10,-8,-54,4,16,8,-44,80,-70,36,36,-74,-94,18,-64,-66,-46,0,-54,-84,... |
if __name__ == '__main__':
param = [
([9, 10, 10, 12, 17, 18, 23, 32, 41, 44, 47, 50,
59, 69, 69, 75, 82, 84, 87, 89, 97, 99], 20,),
([6, 6, 60, 40, 32, -70, -92, 88, 10, -8, -54, 4, 16, 8, -44, 80, -70, 36, 36, -
74, -94, 18, -64, -66, -46, 0, -54, -84, 16, -88, -34, -24, 92, 8... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{9,10,10,12,17,18,23,32,41,44,47,50,59,69,69,75,82,84,87,89,97,99},{6,6,60,40,32,-70,-92,88,10,-8,-54,4,16,8,-44,80,-70,36,36,-74,-94,18,-64,-66,-46,0,-54,-84,16,-88,-34,-24,92,84,62},{0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1},{2,67,50,8,20,42,37,69,86,74,... |
MAXIMUM_POSSIBLE_SUM_WINDOW_ARRAY_ELEMENTS_WINDOW_ARRAY_UNIQUE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_POSSIBLE_SUM_WINDOW_ARRAY_ELEMENTS_WINDOW_ARRAY_UNIQUE{
static int f_gold ( int A [ ] , int B [ ] , int n ) {
Set < Integer > mp = new HashSet < Integer > ( ) ;
int result = 0 ;
int curr_sum = 0 , cu... | def f_gold ( A , B , n ) :
mp = set ( )
result = 0
curr_sum = curr_begin = 0
for i in range ( 0 , n ) :
while A [ i ] in mp :
mp.remove ( A [ curr_begin ] )
curr_sum -= B [ curr_begin ]
curr_begin += 1
mp.add ( A [ i ] )
curr_sum += B [ i ]
... |
using namespace std;
int f_gold ( int A [ ], int B [ ], int n ) {
unordered_set < int > mp;
int result = 0;
int curr_sum = 0, curr_begin = 0;
for ( int i = 0;
i < n;
++ i ) {
while ( mp . find ( A [ i ] ) != mp . end ( ) ) {
mp . erase ( A [ curr_begin ] );
curr_sum -= B [ curr_begin ];
... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,8,10,10,16,23,33,36,43,47,50,55,56,72,84,85,86,86,88,90,92,99});
param0.add(new int[]{48,-22,84,76,50,-14,-82,28,86,-50,-40,10,48,20,-48,-84,-64,-48,-32,-84,-32,10,42,-10,-68,-16... |
if __name__ == '__main__':
param = [
([4, 8, 10, 10, 16, 23, 33, 36, 43, 47, 50, 55, 56, 72, 84, 85, 86, 86, 88, 90, 92, 99],[8, 26, 30, 35, 45, 47, 55, 56, 59, 61, 64, 66, 67, 69, 73, 77, 78, 81, 82, 85, 86, 99],20,),
([48, -22, 84, 76, 50, -14, -82, 28, 86, -50, -40, 10, 48, 20, -48, -84, -64, -48, -32, ... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{4,8,10,10,16,23,33,36,43,47,50,55,56,72,84,85,86,86,88,90,92,99},{48,-22,84,76,50,-14,-82,28,86,-50,-40,10,48,20,-48,-84,-64,-48,-32,-84,-32,10,42,-10,-68,-16,-94,-76,42,-96,16,-64,60,8,-88,-62,82,-24,-28,40,18,8},{0,0,0,1},{74,64,93,72,75,90,46,72,9... |
MAXIMUM_WEIGHT_PATH_ENDING_ELEMENT_LAST_ROW_MATRIX |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_WEIGHT_PATH_ENDING_ELEMENT_LAST_ROW_MATRIX{
public static int f_gold ( int mat [ ] [ ] , int N ) {
int dp [ ] [ ] = new int [ N ] [ N ] ;
dp [ 0 ] [ 0 ] = mat [ 0 ] [ 0 ] ;
for ( int i = 1 ;
i < N ... | def f_gold ( mat , N ) :
dp = [ [ 0 for i in range ( N ) ] for j in range ( N ) ]
dp [ 0 ] [ 0 ] = mat [ 0 ] [ 0 ]
for i in range ( 1 , N ) :
dp [ i ] [ 0 ] = mat [ i ] [ 0 ] + dp [ i - 1 ] [ 0 ]
for i in range ( 1 , N ) :
for j in range ( 1 , min ( i + 1 , N ) ) :
dp [ i ] [... | null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ] [ ]> param0 = new ArrayList<>();
param0.add(new int[][]{new int[]{1,3,17,22,24,29,36,38,41,42,44,44,47,48,49,51,52,54,64,69,70,77,79,82,86,86,87,88,97,99},new int[]{5,6,17,21,27,27,37,39,47,48,48,52,53,54,57,59,61,63,68,72,75,77,78,81... |
if __name__ == '__main__':
param = [
([[1, 3, 17, 22, 24, 29, 36, 38, 41, 42, 44, 44, 47, 48, 49, 51, 52, 54, 64, 69, 70, 77, 79, 82, 86, 86, 87, 88, 97, 99], [5, 6, 17, 21, 27, 27, 37, 39, 47, 48, 48, 52, 53, 54, 57, 59, 61, 63, 68, 72, 75, 77, 78, 81, 88, 89, 91, 95, 95, 97], [2, 8, 10, 16, 17, 18, 18, 18, 2... | null |
HOW_TO_CHECK_IF_A_GIVEN_ARRAY_REPRESENTS_A_BINARY_HEAP |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class HOW_TO_CHECK_IF_A_GIVEN_ARRAY_REPRESENTS_A_BINARY_HEAP{
static boolean f_gold ( int arr [ ] , int i , int n ) {
if ( i > ( n - 2 ) / 2 ) {
return true ;
}
if ( arr [ i ] >= arr [ 2 * i + 1 ] && arr [ i ]... | def f_gold ( arr , i , n ) :
if i > int ( ( n - 2 ) / 2 ) :
return True
if ( arr [ i ] >= arr [ 2 * i + 1 ] and arr [ i ] >= arr [ 2 * i + 2 ] and f_gold ( arr , 2 * i + 1 , n ) and f_gold ( arr , 2 * i + 2 , n ) ) :
return True
return False
|
using namespace std;
bool f_gold ( int arr [ ], int i, int n ) {
if ( i > ( n - 2 ) / 2 ) return true;
if ( arr [ i ] >= arr [ 2 * i + 1 ] && arr [ i ] >= arr [ 2 * i + 2 ] && f_gold ( arr, 2 * i + 1, n ) && f_gold ( arr, 2 * i + 2, n ) ) return true;
return false;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,2,3,5,24,24,25,25,36,37,37,39,42,44,46,50,51,54,56,60,62,70,71,73,75,80,80,85,86,89,91,95,99});
param0.add(new int[]{-44,-58,88,-42,42,-14,-44,42,64,94,-46,-70,34,-10,-46,-52,-6,... |
if __name__ == '__main__':
param = [
([1, 2, 3, 5, 24, 24, 25, 25, 36, 37, 37, 39, 42, 44, 46, 50, 51, 54, 56, 60, 62, 70, 71, 73, 75, 80, 80, 85, 86, 89, 91, 95, 99],0,18,),
([-44, -58, 88, -42, 42, -14, -44, 42, 64, 94, -46, -70, 34, -10, -46, -52, -6, -78, 64, 56, 74, 98, -34, -4, -92, 6, -52, -20, 78, ... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,2,3,5,24,24,25,25,36,37,37,39,42,44,46,50,51,54,56,60,62,70,71,73,75,80,80,85,86,89,91,95,99},{-44,-58,88,-42,42,-14,-44,42,64,94,-46,-70,34,-10,-46,-52,-6,-78,64,56,74,98,-34,-4,-92,6,-52,-20,78,-72,-40},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,... |
COMPUTE_NCR_P_SET_1_INTRODUCTION_AND_DYNAMIC_PROGRAMMING_SOLUTION |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COMPUTE_NCR_P_SET_1_INTRODUCTION_AND_DYNAMIC_PROGRAMMING_SOLUTION{
static int f_gold ( int n , int r , int p ) {
int C [ ] = new int [ r + 1 ] ;
Arrays . fill ( C , 0 ) ;
C [ 0 ] = 1 ;
for ( int i = 1 ;
... | def f_gold ( n , r , p ) :
C = [ 0 for i in range ( r + 1 ) ]
C [ 0 ] = 1
for i in range ( 1 , n + 1 ) :
for j in range ( min ( i , r ) , 0 , - 1 ) :
C [ j ] = ( C [ j ] + C [ j - 1 ] ) % p
return C [ r ]
|
using namespace std;
int f_gold ( int n, int r, int p ) {
int C [ r + 1 ];
memset ( C, 0, sizeof ( C ) );
C [ 0 ] = 1;
for ( int i = 1;
i <= n;
i ++ ) {
for ( int j = min ( i, r );
j > 0;
j -- ) C [ j ] = ( C [ j ] + C [ j - 1 ] ) % p;
}
return C [ r ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(82);
param0.add(45);
param0.add(44);
param0.add(88);
param0.add(90);
param0.add(98);
param0.add(80);
param0.add(60);
param0.add(52);
param0.add(71);
List<... |
if __name__ == '__main__':
param = [
(82,5,94,),
(45,24,95,),
(44,68,61,),
(88,24,43,),
(90,75,57,),
(98,55,43,),
(80,54,88,),
(60,75,65,),
(52,73,86,),
(71,26,45,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set... |
int main() {
int n_success = 0;
vector<int> param0 {82,45,44,88,90,98,80,60,52,71};
vector<int> param1 {5,24,68,24,75,55,54,75,73,26};
vector<int> param2 {94,95,61,43,57,43,88,65,86,45};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i]) == f_gold(param0... |
SQUARE_ROOT_OF_AN_INTEGER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SQUARE_ROOT_OF_AN_INTEGER{
static int f_gold ( int x ) {
if ( x == 0 || x == 1 ) return x ;
int i = 1 , result = 1 ;
while ( result <= x ) {
i ++ ;
result = i * i ;
}
return i - 1 ;
}
| def f_gold ( x ) :
if ( x == 0 or x == 1 ) :
return x
i = 1 ; result = 1
while ( result <= x ) :
i += 1
result = i * i
return i - 1
|
using namespace std;
int f_gold ( int x ) {
if ( x == 0 || x == 1 ) return x;
int i = 1, result = 1;
while ( result <= x ) {
i ++;
result = i * i;
}
return i - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(89);
param0.add(11);
param0.add(14);
param0.add(92);
param0.add(76);
param0.add(63);
param0.add(51);
param0.add(16);
param0.add(83);
param0.add(66);
for(i... |
if __name__ == '__main__':
param = [
(89,),
(11,),
(14,),
(92,),
(76,),
(63,),
(51,),
(16,),
(83,),
(66,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {89,11,14,92,76,63,51,16,83,66};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
LONGEST_SUBSEQUENCE_DIFFERENCE_ADJACENTS_ONE_SET_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LONGEST_SUBSEQUENCE_DIFFERENCE_ADJACENTS_ONE_SET_2{
static int f_gold ( int [ ] arr , int n ) {
HashMap < Integer , Integer > um = new HashMap < Integer , Integer > ( ) ;
int longLen = 0 ;
for ( int i = 0 ;
... | null |
using namespace std;
int f_gold ( int arr [ ], int n ) {
unordered_map < int, int > um;
int longLen = 0;
for ( int i = 0;
i < n;
i ++ ) {
int len = 0;
if ( um . find ( arr [ i ] - 1 ) != um . end ( ) && len < um [ arr [ i ] - 1 ] ) len = um [ arr [ i ] - 1 ];
if ( um . find ( arr [ i ] + 1 ) != u... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{20,48,58});
param0.add(new int[]{-36,94,-20,-90,-80,88,46,-8,-36,22,70,-16,-48,-54,-82,38,10,-84,12,10,-14,50,12,-28,-64,-38,-84,-62,-56,32,-78,34,-34,48});
param0.add(new int[... | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{20,48,58},{-36,94,-20,-90,-80,88,46,-8,-36,22,70,-16,-48,-54,-82,38,10,-84,12,10,-14,50,12,-28,-64,-38,-84,-62,-56,32,-78,34,-34,48},{0,0,0},{50,28,14,52,92,30,30,27,66,77,39,42,28,84,63,55,18,34,57,45,81,38,23,31,9,35,25,39,30,5,28,7,42,42},{-96,-70... |
MAXIMIZE_VOLUME_CUBOID_GIVEN_SUM_SIDES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMIZE_VOLUME_CUBOID_GIVEN_SUM_SIDES{
static int f_gold ( int s ) {
int maxvalue = 0 ;
for ( int i = 1 ;
i <= s - 2 ;
i ++ ) {
for ( int j = 1 ;
j <= s - 1 ;
j ++ ) {
int k = s - i - j ... | def f_gold(s):
maxvalue = 0
i = 1
for i in range(s - 1):
j = 1
for j in range(s):
k = s - i - j
maxvalue = max(maxvalue, i * j * k)
return maxvalue
|
using namespace std;
int f_gold ( int s ) {
int maxvalue = 0;
for ( int i = 1;
i <= s - 2;
i ++ ) {
for ( int j = 1;
j <= s - 1;
j ++ ) {
int k = s - i - j;
maxvalue = max ( maxvalue, i * j * k );
}
}
return maxvalue;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(67);
param0.add(48);
param0.add(59);
param0.add(22);
param0.add(14);
param0.add(66);
param0.add(1);
param0.add(75);
param0.add(58);
param0.add(78);
for(in... |
if __name__ == '__main__':
param = [
(67,),
(48,),
(59,),
(22,),
(14,),
(66,),
(1,),
(75,),
(58,),
(78,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_... |
int main() {
int n_success = 0;
vector<int> param0 {67,48,59,22,14,66,1,75,58,78};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
PROGRAM_PRINT_SUM_GIVEN_NTH_TERM_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_PRINT_SUM_GIVEN_NTH_TERM_1{
static int f_gold ( long n ) {
return ( int ) Math . pow ( n , 2 ) ;
}
| import math
def f_gold ( n ) :
return math.pow ( n , 2 )
|
using namespace std;
int f_gold ( long n ) {
return pow ( n, 2 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Long> param0 = new ArrayList<>();
param0.add(42L);
param0.add(40L);
param0.add(67L);
param0.add(73L);
param0.add(18L);
param0.add(16L);
param0.add(74L);
param0.add(33L);
param0.add(92L);
param0.add(22L);
... |
if __name__ == '__main__':
param = [
(42,),
(40,),
(67,),
(73,),
(18,),
(16,),
(74,),
(33,),
(92,),
(22,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<long> param0 {42,40,67,73,18,16,74,33,92,22};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
REARRANGE_POSITIVE_AND_NEGATIVE_NUMBERS_PUBLISH |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
class REARRANGE_POSITIVE_AND_NEGATIVE_NUMBERS_PUBLISH{
static void f_gold ( int arr [ ] , int n ) {
int i = - 1 , temp = 0 ;
for ( int j = 0 ;
j < n ;
j ++ ) {
if ( arr [ j ] < 0 ) {
i ++ ;
temp = arr [... | def f_gold ( arr , n ) :
i = - 1
for j in range ( n ) :
if ( arr [ j ] < 0 ) :
i += 1
arr [ i ] , arr [ j ] = arr [ j ] , arr [ i ]
pos , neg = i + 1 , 0
while ( pos < n and neg < pos and arr [ neg ] < 0 ) :
arr [ neg ] , arr [ pos ] = arr [ pos ] , arr [ neg ]
... | null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{5,5,6,7,8,10,13,15,15,27,27,29,29,29,29,31,33,33,36,38,38,39,42,47,47,51,51,51,52,53,55,56,57,64,66,66,67,68,70,72,74,78,86,88,94,97,97});
param0.add(new int[]{73,30,55,-5,15,64,-6... |
if __name__ == '__main__':
param = [
([5, 5, 6, 7, 8, 10, 13, 15, 15, 27, 27, 29, 29, 29, 29, 31, 33, 33, 36, 38, 38, 39, 42, 47, 47, 51, 51, 51, 52, 53, 55, 56, 57, 64, 66, 66, 67, 68, 70, 72, 74, 78, 86, 88, 94, 97, 97],26,),
([73, 30, 55, -5, 15, 64, -64, -74, -57, -73, -31, 48],8,),
([0, 0, 0, 1, 1... | null |
PARTITION_INTO_TWO_SUBARRAYS_OF_LENGTHS_K_AND_N_K_SUCH_THAT_THE_DIFFERENCE_OF_SUMS_IS_MAXIMUM |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PARTITION_INTO_TWO_SUBARRAYS_OF_LENGTHS_K_AND_N_K_SUCH_THAT_THE_DIFFERENCE_OF_SUMS_IS_MAXIMUM{
static int f_gold ( int arr [ ] , int N , int k ) {
int M , S = 0 , S1 = 0 , max_difference = 0 ;
for ( int i = 0 ... | null |
using namespace std;
int f_gold ( int arr [ ], int N, int k ) {
int M, S = 0, S1 = 0, max_difference = 0;
for ( int i = 0;
i < N;
i ++ ) S += arr [ i ];
sort ( arr, arr + N, greater < int > ( ) );
M = max ( k, N - k );
for ( int i = 0;
i < M;
i ++ ) S1 += arr [ i ];
max_difference = S1 - ( S - S1 )... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,5,5,9,9,19,22,24,27,33,39,39,40,41,42,43,44,45,48,52,52,53,53,55,55,56,57,57,60,60,61,62,65,66,67,70,71,72,73,77,78,79,84,87,89,91,95,98});
param0.add(new int[]{-22,-28});
pa... | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,5,5,9,9,19,22,24,27,33,39,39,40,41,42,43,44,45,48,52,52,53,53,55,55,56,57,57,60,60,61,62,65,66,67,70,71,72,73,77,78,79,84,87,89,91,95,98},{-22,-28},{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},{63,72,2,94,89,11,95,79,90,9,70,28,25,... |
GIVEN_A_SORTED_AND_ROTATED_ARRAY_FIND_IF_THERE_IS_A_PAIR_WITH_A_GIVEN_SUM_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class GIVEN_A_SORTED_AND_ROTATED_ARRAY_FIND_IF_THERE_IS_A_PAIR_WITH_A_GIVEN_SUM_1{
static int f_gold ( int arr [ ] , int n , int x ) {
int i ;
for ( i = 0 ;
i < n - 1 ;
i ++ ) if ( arr [ i ] > arr [ i + 1 ] ) br... | def f_gold ( arr , n , x ) :
for i in range ( n ) :
if arr [ i ] > arr [ i + 1 ] :
break
l = ( i + 1 ) % n
r = i
cnt = 0
while ( l != r ) :
if arr [ l ] + arr [ r ] == x :
cnt += 1
if l == ( r - 1 + n ) % n :
return cnt
... |
using namespace std;
int f_gold ( int arr [ ], int n, int x ) {
int i;
for ( i = 0;
i < n - 1;
i ++ ) if ( arr [ i ] > arr [ i + 1 ] ) break;
int l = ( i + 1 ) % n;
int r = i;
int cnt = 0;
while ( l != r ) {
if ( arr [ l ] + arr [ r ] == x ) {
cnt ++;
if ( l == ( r - 1 + n ) % n ) {
... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{24,54});
param0.add(new int[]{68,-30,-18,-6,70,-40,86,98,-24,-48});
param0.add(new int[]{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})... |
if __name__ == '__main__':
param = [
([24, 54],1,1,),
([68, -30, -18, -6, 70, -40, 86, 98, -24, -48],8,8,),
([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],33,28,),
([84, 44, 40, 45, 2, 41, 52, 17, 50, 41, 5, 52, 48,... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{24,54},{68,-30,-18,-6,70,-40,86,98,-24,-48},{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},{84,44,40,45,2,41,52,17,50,41,5,52,48,90,13,55,34,55,94,44,41,2},{-92,-76,-74,-72,-68,-64,-58,-44,-44,-38,-26,-24,-20,... |
PROGRAM_DISTANCE_TWO_POINTS_EARTH |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_DISTANCE_TWO_POINTS_EARTH{
public static double f_gold ( double lat1 , double lat2 , double lon1 , double lon2 ) {
lon1 = Math . toRadians ( lon1 ) ;
lon2 = Math . toRadians ( lon2 ) ;
lat1 = Math . ... | null | null |
public static void main(String args[]) {
int n_success = 0;
List<Double> param0 = new ArrayList<>();
param0.add(6578.099266893886);
param0.add(-9410.77783405426);
param0.add(6641.858718352012);
param0.add(-4142.202863100186);
param0.add(4181.4508741498075);
param0.add(-7745.655002884576... | null | null |
COUNT_TOTAL_SET_BITS_IN_ALL_NUMBERS_FROM_1_TO_N |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_TOTAL_SET_BITS_IN_ALL_NUMBERS_FROM_1_TO_N{
static int f_gold ( int n ) {
int i = 0 ;
int ans = 0 ;
while ( ( 1 << i ) <= n ) {
boolean k = false ;
int change = 1 << i ;
for ( int j = 0 ;
... | def f_gold ( n ) :
i = 0
ans = 0
while ( ( 1 << i ) <= n ) :
k = 0
change = 1 << i
for j in range ( 0 , n + 1 ) :
ans += k
if change == 1 :
k = not k
change = 1 << i
else :
change -= 1
i += 1
... |
using namespace std;
int f_gold ( int n ) {
int i = 0;
int ans = 0;
while ( ( 1 << i ) <= n ) {
bool k = 0;
int change = 1 << i;
for ( int j = 0;
j <= n;
j ++ ) {
ans += k;
if ( change == 1 ) {
k = ! k;
change = 1 << i;
}
else {
change --;
... |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(90);
param0.add(56);
param0.add(43);
param0.add(31);
param0.add(77);
param0.add(35);
param0.add(43);
param0.add(66);
param0.add(15);
param0.add(95);
for(i... |
if __name__ == '__main__':
param = [
(90,),
(56,),
(43,),
(31,),
(77,),
(35,),
(43,),
(66,),
(15,),
(95,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {90,56,43,31,77,35,43,66,15,95};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
CHECK_GIVEN_SENTENCE_GIVEN_SET_SIMPLE_GRAMMER_RULES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_GIVEN_SENTENCE_GIVEN_SET_SIMPLE_GRAMMER_RULES{
static boolean f_gold ( char [ ] str ) {
int len = str . length ;
if ( str [ 0 ] < 'A' || str [ 0 ] > 'Z' ) return false ;
if ( str [ len - 1 ] != '.' ) r... | def f_gold ( string ) :
length = len ( string )
if string [ 0 ] < 'A' or string [ 0 ] > 'Z' :
return False
if string [ length - 1 ] != '.' :
return False
prev_state = 0
curr_state = 0
index = 1
while ( string [ index ] ) :
if string [ index ] >= 'A' and string [ index... |
using namespace std;
bool f_gold ( char str [ ] ) {
int len = strlen ( str );
if ( str [ 0 ] < 'A' || str [ 0 ] > 'Z' ) return false;
if ( str [ len - 1 ] != '.' ) return false;
int prev_state = 0, curr_state = 0;
int index = 1;
while ( str [ index ] ) {
if ( str [ index ] >= 'A' && str [ index ] <= 'Z... |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = Arrays.asList("I love cinema.", "The vertex is S.",
"I am single.", "My name is KG.",
"I lovE cinema.", "GeeksQuiz. is a quiz site.",
"I love Geeksquiz an... |
if __name__ == '__main__':
param = ["I love cinema.", "The vertex is S.",
"I am single.", "My name is KG.",
"I lovE cinema.", "GeeksQuiz. is a quiz site.",
"I love Geeksquiz and Geeksforgeeks.",
" You are my friend.", "I love cinema", "Hello world !"]
n_success ... |
int main() {
int n_success = 0;
vector<string> param0 { "I love cinema.", "The vertex is S.",
"I am single.", "My name is KG.",
"I lovE cinema.", "GeeksQuiz. is a quiz site.",
"I love Geeksquiz and Geeksforgeeks.",
" You are my fr... |
CHECK_EXIST_TWO_ELEMENTS_ARRAY_WHOSE_SUM_EQUAL_SUM_REST_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_EXIST_TWO_ELEMENTS_ARRAY_WHOSE_SUM_EQUAL_SUM_REST_ARRAY{
static boolean f_gold ( int arr [ ] , int n ) {
int sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
sum += arr [ i ] ;
}
if ( sum % 2 != ... | def f_gold ( arr , n ) :
s = set ( )
sum = 0
for i in range ( n ) :
sum += arr [ i ]
if sum % 2 != 0 :
return False
sum = sum / 2
for i in range ( n ) :
val = sum - arr [ i ]
if arr [ i ] not in s :
s.add ( arr [ i ] )
if val in s :
... |
using namespace std;
bool f_gold ( int arr [ ], int n ) {
int sum = 0;
for ( int i = 0;
i < n;
i ++ ) sum += arr [ i ];
if ( sum % 2 != 0 ) return false;
sum = sum / 2;
unordered_set < int > s;
for ( int i = 0;
i < n;
i ++ ) {
int val = sum - arr [ i ];
if ( s . find ( val ) != s . end ( ) ... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2, 11, 5, 1, 4, 7});
param0.add(new int[]{2, 4, 2, 1, 11, 15});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{69,6,24,30,75,37,... |
if __name__ == '__main__':
param = [
([2, 11, 5, 1, 4, 7],6,),
([2, 4, 2, 1, 11, 15],6,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],13,),
([69, 6, 24, 30, 75, 37, 61, 76, 19, 18, 90, 9, 49, 24, 58, 97, 18, 85, 24, 93, 71, 98, 92, 59, 75, 75, 75, 70, 35, 58, 50, 1, 64, 6... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {
{2, 11, 5, 1, 4, 7},
{2, 4, 2, 1, 11, 15},
{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1},{69,6,24,30,75,37,61,76,19,18,90,9,49,24,58,97,18,85,24,93,71,98,92,59,75,75,75,70,35,58,50,1,64,66,33},{-94,-94,-92,-74,-60,-58,-56,-44,-42,-40,-2... |
CHECK_POSSIBLE_TRANSFORM_ONE_STRING_ANOTHER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_POSSIBLE_TRANSFORM_ONE_STRING_ANOTHER{
static boolean f_gold ( String s1 , String s2 ) {
int n = s1 . length ( ) ;
int m = s2 . length ( ) ;
boolean dp [ ] [ ] = new boolean [ n + 1 ] [ m + 1 ] ;
for... | def f_gold ( s1 , s2 ) :
n = len ( s1 )
m = len ( s2 )
dp = ( [ [ False for i in range ( m + 1 ) ] for i in range ( n + 1 ) ] )
dp [ 0 ] [ 0 ] = True
for i in range ( len ( s1 ) ) :
for j in range ( len ( s2 ) + 1 ) :
if ( dp [ i ] [ j ] ) :
if ( ( j < len ( s2 ) ... |
using namespace std;
bool f_gold ( string s1, string s2 ) {
int n = s1 . length ( );
int m = s2 . length ( );
bool dp [ n + 1 ] [ m + 1 ];
for ( int i = 0;
i <= n;
i ++ ) {
for ( int j = 0;
j <= m;
j ++ ) {
dp [ i ] [ j ] = false;
}
}
dp [ 0 ] [ 0 ] = true;
for ( int i = 0;
i ... |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("daBcd");
param0.add("417514");
param0.add("010000");
param0.add("ZcKYguiMrdyn");
param0.add("argaju");
param0.add("1110101101");
param0.add("ySOCoSaygi");
param0.add(... |
if __name__ == '__main__':
param = [
('daBcd','ABC',),
('417514','9',),
('010000','1111011010',),
('ZcKYguiMrdyn','iz',),
('argaju','RAJ',),
('1110101101','110101001',),
('ySOCoSaygi','aRhxkYqh',),
('204','6986871066',),
('10011100000010','0',),
('nMAioozPmY','WZFdDKw',)
... |
int main() {
int n_success = 0;
vector<string> param0 {"daBcd","417514","010000","ZcKYguiMrdyn","argaju","1110101101","ySOCoSaygi","204","10011100000010","nMAioozPmY"};
vector<string> param1 {"ABC","9","1111011010","iz","RAJ","110101001","aRhxkYqh","6986871066","0","WZFdDKw"};
for(int i = 0; i < param0... |
FIND_SUM_EVEN_FACTORS_NUMBER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_SUM_EVEN_FACTORS_NUMBER{
public static int f_gold ( int n ) {
if ( n % 2 != 0 ) return 0 ;
int res = 1 ;
for ( int i = 2 ;
i <= Math . sqrt ( n ) ;
i ++ ) {
int count = 0 , curr_sum = 1 ;
in... | import math
def f_gold ( n ) :
if ( n % 2 != 0 ) :
return 0
res = 1
for i in range ( 2 , ( int ) ( math.sqrt ( n ) ) + 1 ) :
count = 0
curr_sum = 1
curr_term = 1
while ( n % i == 0 ) :
count = count + 1
n = n // i
if ( i == 2 and c... |
using namespace std;
int f_gold ( int n ) {
if ( n % 2 != 0 ) return 0;
int res = 1;
for ( int i = 2;
i <= sqrt ( n );
i ++ ) {
int count = 0, curr_sum = 1, curr_term = 1;
while ( n % i == 0 ) {
count ++;
n = n / i;
if ( i == 2 && count == 1 ) curr_sum = 0;
curr_term *= i;
... |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(71);
param0.add(78);
param0.add(39);
param0.add(36);
param0.add(49);
param0.add(17);
param0.add(53);
param0.add(66);
param0.add(92);
param0.add(71);
for(i... |
if __name__ == '__main__':
param = [
(71,),
(78,),
(39,),
(36,),
(49,),
(17,),
(53,),
(66,),
(92,),
(71,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {71,78,39,36,49,17,53,66,92,71};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
CALCULATE_AREA_TETRAHEDRON |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CALCULATE_AREA_TETRAHEDRON{
static double f_gold ( int side ) {
double volume = ( Math . pow ( side , 3 ) / ( 6 * Math . sqrt ( 2 ) ) ) ;
return volume ;
}
| import math
def f_gold ( side ) :
volume = ( side ** 3 / ( 6 * math.sqrt ( 2 ) ) )
return round ( volume , 2 )
|
using namespace std;
double f_gold ( int side ) {
double volume = ( pow ( side, 3 ) / ( 6 * sqrt ( 2 ) ) );
return volume;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(58);
param0.add(56);
param0.add(35);
param0.add(99);
param0.add(13);
param0.add(45);
param0.add(40);
param0.add(92);
param0.add(7);
param0.add(13);
for(in... |
if __name__ == '__main__':
param = [
(58,),
(56,),
(35,),
(99,),
(13,),
(45,),
(40,),
(92,),
(7,),
(13,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if abs(1 - (0.0000001 + abs(f_gold(*parameters_set))) / (abs(f_filled(*parameters_set))... |
int main() {
int n_success = 0;
vector<int> param0 {58,56,35,99,13,45,40,92,7,13};
for(int i = 0; i < param0.size(); ++i)
{
if(abs(1 - (0.0000001 + abs(f_gold(param0[i])) )/ (abs(f_filled(param0[i])) + 0.0000001)) < 0.001)
{
n_success+=1;
}
}
cout << "#Result... |
DYNAMIC_PROGRAMMING_SET_13_CUTTING_A_ROD |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_SET_13_CUTTING_A_ROD{
static int f_gold ( int price [ ] , int n ) {
int val [ ] = new int [ n + 1 ] ;
val [ 0 ] = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
int max_val = Integer . M... | null |
using namespace std;
int f_gold ( int price [ ], int n ) {
int val [ n + 1 ];
val [ 0 ] = 0;
int i, j;
for ( i = 1;
i <= n;
i ++ ) {
int max_val = INT_MIN;
for ( j = 0;
j < i;
j ++ ) max_val = max ( max_val, price [ j ] + val [ i - j - 1 ] );
val [ i ] = max_val;
}
return val [ n ];... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{5,7,15,16,18,22,22,30,34,35,37,41,42,42,43,47,49,52,53,55,58,60,62,62,62,65,65,67,69,73,73,73,75,78,83,84,86,90,91,91,93,94,96});
param0.add(new int[]{50,-30,-84,-2,-96,-54,-14,56,... | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{5,7,15,16,18,22,22,30,34,35,37,41,42,42,43,47,49,52,53,55,58,60,62,62,62,65,65,67,69,73,73,73,75,78,83,84,86,90,91,91,93,94,96},{50,-30,-84,-2,-96,-54,-14,56,-48,70,38,-86,16,-48,66,34,36,40,40,36,-16,-92,30},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,... |
SQUARED_TRIANGULAR_NUMBER_SUM_CUBES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SQUARED_TRIANGULAR_NUMBER_SUM_CUBES{
static int f_gold ( int s ) {
int sum = 0 ;
for ( int n = 1 ;
sum < s ;
n ++ ) {
sum += n * n * n ;
if ( sum == s ) return n ;
}
return - 1 ;
}
| def f_gold ( s ) :
_sum = 0
n = 1
while ( _sum < s ) :
_sum += n * n * n
n += 1
n -= 1
if _sum == s :
return n
return - 1
|
using namespace std;
int f_gold ( int s ) {
int sum = 0;
for ( int n = 1;
sum < s;
n ++ ) {
sum += n * n * n;
if ( sum == s ) return n;
}
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(15);
param0.add(36);
param0.add(39);
param0.add(43);
param0.add(75);
param0.add(49);
param0.add(56);
param0.add(14);
param0.add(62);
param0.add(97);
for(i... |
if __name__ == '__main__':
param = [
(15,),
(36,),
(39,),
(43,),
(75,),
(49,),
(56,),
(14,),
(62,),
(97,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {15,36,39,43,75,49,56,14,62,97};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
FREQUENT_ELEMENT_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FREQUENT_ELEMENT_ARRAY{
static int f_gold ( int arr [ ] , int n ) {
Arrays . sort ( arr ) ;
int max_count = 1 , res = arr [ 0 ] ;
int curr_count = 1 ;
for ( int i = 1 ;
i < n ;
i ++ ) {
if ( arr [ ... | def f_gold ( arr , n ) :
arr.sort ( )
max_count = 1 ; res = arr [ 0 ] ; curr_count = 1
for i in range ( 1 , n ) :
if ( arr [ i ] == arr [ i - 1 ] ) :
curr_count += 1
else :
if ( curr_count > max_count ) :
max_count = curr_count
res = ar... |
using namespace std;
int f_gold ( int arr [ ], int n ) {
sort ( arr, arr + n );
int max_count = 1, res = arr [ 0 ], curr_count = 1;
for ( int i = 1;
i < n;
i ++ ) {
if ( arr [ i ] == arr [ i - 1 ] ) curr_count ++;
else {
if ( curr_count > max_count ) {
max_count = curr_count;
re... |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,1,3,11,11,11,18,20,26,26,27,30,33,39,39,42,42,48,51,51,51,51,60,66,66,68,68,69,71,72,73,76,76,77,77,77,78,90,96});
param0.add(new int[]{46,-8,64,-46,-38,92,-14,-22,-32,48,72,96,3... |
if __name__ == '__main__':
param = [
([1, 1, 3, 11, 11, 11, 18, 20, 26, 26, 27, 30, 33, 39, 39, 42, 42, 48, 51, 51, 51, 51, 60, 66, 66, 68, 68, 69, 71, 72, 73, 76, 76, 77, 77, 77, 78, 90, 96],25,),
([46, -8, 64, -46, -38, 92, -14, -22, -32, 48, 72, 96, 30, 66, 94, 36, 42, -18, 14, -74, 80, 96, -4],18,),
... |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,1,3,11,11,11,18,20,26,26,27,30,33,39,39,42,42,48,51,51,51,51,60,66,66,68,68,69,71,72,73,76,76,77,77,77,78,90,96},{46,-8,64,-46,-38,92,-14,-22,-32,48,72,96,30,66,94,36,42,-18,14,-74,80,96,-4},{0,0,0,0,0,0,1},{93,32,3,31,67,96,52,80,70,49,45,23,58,87... |
FIND_SUM_EVEN_INDEX_BINOMIAL_COEFFICIENTS_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_SUM_EVEN_INDEX_BINOMIAL_COEFFICIENTS_1{
static int f_gold ( int n ) {
return ( 1 << ( n - 1 ) ) ;
}
| def f_gold ( n ) :
return ( 1 << ( n - 1 ) )
|
using namespace std;
int f_gold ( int n ) {
return ( 1 << ( n - 1 ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(56);
param0.add(28);
param0.add(4);
param0.add(24);
param0.add(72);
param0.add(30);
param0.add(48);
param0.add(32);
param0.add(13);
param0.add(19);
for(in... |
if __name__ == '__main__':
param = [
(56,),
(28,),
(4,),
(24,),
(72,),
(30,),
(48,),
(32,),
(13,),
(19,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
p... |
int main() {
int n_success = 0;
vector<int> param0 {56,28,4,24,72,30,48,32,13,19};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
PYTHON_PROGRAM_FIND_PERIMETER_CIRCUMFERENCE_SQUARE_RECTANGLE_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PYTHON_PROGRAM_FIND_PERIMETER_CIRCUMFERENCE_SQUARE_RECTANGLE_1{
static int f_gold ( int l , int w ) {
return ( 2 * ( l + w ) ) ;
}
| def f_gold ( l , w ) :
return ( 2 * ( l + w ) )
|
using namespace std;
int f_gold ( int l, int w ) {
return ( 2 * ( l + w ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(58);
param0.add(37);
param0.add(56);
param0.add(22);
param0.add(77);
param0.add(34);
param0.add(74);
param0.add(37);
param0.add(21);
param0.add(75);
List<... |
if __name__ == '__main__':
param = [
(58,39,),
(37,49,),
(56,52,),
(22,43,),
(77,12,),
(34,31,),
(74,54,),
(37,52,),
(21,37,),
(75,30,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):... |
int main() {
int n_success = 0;
vector<int> param0 {58,37,56,22,77,34,74,37,21,75};
vector<int> param1 {39,49,52,43,12,31,54,52,37,30};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
... |
LONGEST_REPEATING_AND_NON_OVERLAPPING_SUBSTRING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LONGEST_REPEATING_AND_NON_OVERLAPPING_SUBSTRING{
static String f_gold ( String str ) {
int n = str . length ( ) ;
int LCSRe [ ] [ ] = new int [ n + 1 ] [ n + 1 ] ;
String res = "" ;
int res_length = 0 ;
... | def f_gold ( str ) :
n = len ( str )
LCSRe = [ [ 0 for x in range ( n + 1 ) ] for y in range ( n + 1 ) ]
res = ""
res_length = 0
index = 0
for i in range ( 1 , n + 1 ) :
for j in range ( i + 1 , n + 1 ) :
if ( str [ i - 1 ] == str [ j - 1 ] and LCSRe [ i - 1 ] [ j - 1 ] < ( j... |
using namespace std;
string f_gold ( string str ) {
int n = str . length ( );
int LCSRe [ n + 1 ] [ n + 1 ];
memset ( LCSRe, 0, sizeof ( LCSRe ) );
string res;
int res_length = 0;
int i, index = 0;
for ( i = 1;
i <= n;
i ++ ) {
for ( int j = i + 1;
j <= n;
j ++ ) {
if ( str [ i - 1 ... |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("fbfHTjE");
param0.add("09285256323");
param0.add("0011000101110");
param0.add("ue JkVZTt");
param0.add("48387612426300");
param0.add("010");
param0.add("ddRrUz");
par... |
if __name__ == '__main__':
param = [
('fbfHTjE',),
('09285256323',),
('0011000101110',),
('ue JkVZTt',),
('48387612426300',),
('010',),
('ddRrUz',),
('1049162633793',),
('100011',),
('iJfadiVaQqv',)
]
n_success = 0
for i, parameters_set in enumerate(param):
... |
int main() {
int n_success = 0;
vector<string> param0 {"fbfHTjE","09285256323","0011000101110","ue JkVZTt","48387612426300","010","ddRrUz","1049162633793","100011","iJfadiVaQqv"};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_succe... |
NUMBER_N_DIGIT_STEPPING_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_N_DIGIT_STEPPING_NUMBERS{
static long f_gold ( int n ) {
int dp [ ] [ ] = new int [ n + 1 ] [ 10 ] ;
if ( n == 1 ) return 10 ;
for ( int j = 0 ;
j <= 9 ;
j ++ ) dp [ 1 ] [ j ] = 1 ;
for ( int i ... | def f_gold ( n ) :
dp = [ [ 0 for x in range ( 10 ) ] for y in range ( n + 1 ) ] ;
if ( n == 1 ) :
return 10 ;
for j in range ( 10 ) :
dp [ 1 ] [ j ] = 1 ;
for i in range ( 2 , n + 1 ) :
for j in range ( 10 ) :
if ( j == 0 ) :
dp [ i ] [ j ] = dp [ i -... |
using namespace std;
long long f_gold ( int n ) {
int dp [ n + 1 ] [ 10 ];
if ( n == 1 ) return 10;
for ( int j = 0;
j <= 9;
j ++ ) dp [ 1 ] [ j ] = 1;
for ( int i = 2;
i <= n;
i ++ ) {
for ( int j = 0;
j <= 9;
j ++ ) {
if ( j == 0 ) dp [ i ] [ j ] = dp [ i - 1 ] [ j + 1 ];
else... |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(18);
param0.add(66);
param0.add(73);
param0.add(70);
param0.add(26);
param0.add(41);
param0.add(20);
param0.add(25);
param0.add(52);
param0.add(13);
for(i... |
if __name__ == '__main__':
param = [
(18,),
(66,),
(73,),
(70,),
(26,),
(41,),
(20,),
(25,),
(52,),
(13,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
... |
int main() {
int n_success = 0;
vector<int> param0 {18,66,73,70,26,41,20,25,52,13};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
... |
PROGRAM_FIND_STRING_START_END_GEEKS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_FIND_STRING_START_END_GEEKS{
static boolean f_gold ( String str , String corner ) {
int n = str . length ( ) ;
int cl = corner . length ( ) ;
if ( n < cl ) return false ;
return ( str . substring (... | def f_gold ( str , corner ) :
n = len ( str )
cl = len ( corner )
if ( n < cl ) :
return False
return ( ( str [ : cl ] == corner ) and ( str [ n - cl : ] == corner ) )
|
using namespace std;
bool f_gold ( string str, string corner ) {
int n = str . length ( );
int cl = corner . length ( );
if ( n < cl ) return false;
return ( str . substr ( 0, cl ) . compare ( corner ) == 0 && str . substr ( n - cl, cl ) . compare ( corner ) == 0 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("geeksmanishgeeks");
param0.add("shreyadhatwalia");
param0.add("10000100");
param0.add("abaa");
param0.add("30645530");
param0.add("0000011011001");
param0.add("dkqEd");
... |
if __name__ == '__main__':
param = [
('geeksmanishgeeks','geeks',),
('shreyadhatwalia','abc',),
('10000100','100',),
('abaa','a',),
('30645530','30',),
('0000011011001','001',),
('dkqEd','d',),
('48694119324654','654',),
('1101010010','11',),
('Ks','KsFLmngGGOmHKs',)
... |
int main() {
int n_success = 0;
vector<string> param0 {"geeksmanishgeeks","shreyadhatwalia","10000100","abaa","30645530","0000011011001","dkqEd","48694119324654","1101010010","Ks"};
vector<string> param1 {"geeks","abc","100","a","30","001","d","654","11","KsFLmngGGOmHKs"};
for(int i = 0; i < param0.siz... |
FIND_NUMBER_ENDLESS_POINTS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_NUMBER_ENDLESS_POINTS{
static int f_gold ( boolean input [ ] [ ] , int n ) {
boolean row [ ] [ ] = new boolean [ n ] [ n ] ;
boolean col [ ] [ ] = new boolean [ n ] [ n ] ;
for ( int j = 0 ;
j < n ;
... | null | null |
public static void main(String args[]) {
int n_success = 0;
List<boolean [ ] [ ]> param0 = new ArrayList<>();
param0.add(new boolean[][]{new boolean[]{false,false,false,true},new boolean[]{false,true,true,true},new boolean[]{false,false,true,true},new boolean[]{true,true,true,true}});
param0.add(new bo... | null | null |
CHECK_STRING_FOLLOWS_ANBN_PATTERN_NOT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_STRING_FOLLOWS_ANBN_PATTERN_NOT{
public static boolean f_gold ( String s ) {
int l = s . length ( ) ;
if ( l % 2 == 1 ) {
return false ;
}
int i = 0 ;
int j = l - 1 ;
while ( i < j ) {
if... | def f_gold ( str ) :
n = len ( str )
for i in range ( n ) :
if ( str [ i ] != 'a' ) :
break
if ( i * 2 != n ) :
return False
for j in range ( i , n ) :
if ( str [ j ] != 'b' ) :
return False
return True
|
using namespace std;
bool f_gold ( string str ) {
int n = str . length ( );
int i;
for ( i = 0;
i < n;
i ++ ) if ( str [ i ] != 'a' ) break;
if ( i * 2 != n ) return false;
int j;
for ( j = i;
j < n;
j ++ ) if ( str [ j ] != 'b' ) return false;
return true;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("ba");
param0.add("aabb");
param0.add("abab");
param0.add("aaabb");
param0.add("aabbb");
param0.add("abaabbaa");
param0.add("abaababb");
param0.add("bbaa");
param0... |
if __name__ == '__main__':
param = [
('ba',),
('aabb',),
('abab',),
('aaabb',),
('aabbb',),
('abaabbaa',),
('abaababb',),
('bbaa',),
('11001000',),
('ZWXv te',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) ==... |
int main() {
int n_success = 0;
vector<string> param0 {"ba","aabb","abab","aaabb","aabbb","abaabbaa","abaababb","bbaa","11001000","ZWXv te"};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#R... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.