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
⌀ |
---|---|---|---|---|---|---|
FIND_MAXIMUM_DOT_PRODUCT_TWO_ARRAYS_INSERTION_0S |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_MAXIMUM_DOT_PRODUCT_TWO_ARRAYS_INSERTION_0S{
static int f_gold ( int A [ ] , int B [ ] , int m , int n ) {
int dp [ ] [ ] = new int [ n + 1 ] [ m + 1 ] ;
for ( int [ ] row : dp ) Arrays . fill ( row , 0 ) ;
for ( int i = 1 ;
i <= n ;
i ++ ) for ( int j = i ;
j <= m ;
j ++ ) dp [ i ] [ j ] = Math . max ( ( dp [ i - 1 ] [ j - 1 ] + ( A [ j - 1 ] * B [ i - 1 ] ) ) , dp [ i ] [ j - 1 ] ) ;
return dp [ n ] [ m ] ;
}
| def f_gold ( A , B , m , n ) :
dp = [ [ 0 for i in range ( m + 1 ) ] for j in range ( n + 1 ) ]
for i in range ( 1 , n + 1 , 1 ) :
for j in range ( i , m + 1 , 1 ) :
dp [ i ] [ j ] = max ( ( dp [ i - 1 ] [ j - 1 ] + ( A [ j - 1 ] * B [ i - 1 ] ) ) , dp [ i ] [ j - 1 ] )
return dp [ n ] [ m ]
|
using namespace std;
long long int f_gold ( int A [ ], int B [ ], int m, int n ) {
long long int dp [ n + 1 ] [ m + 1 ];
memset ( dp, 0, sizeof ( dp ) );
for ( int i = 1;
i <= n;
i ++ ) for ( int j = i;
j <= m;
j ++ ) dp [ i ] [ j ] = max ( ( dp [ i - 1 ] [ j - 1 ] + ( A [ j - 1 ] * B [ i - 1 ] ) ), dp [ i ] [ j - 1 ] );
return dp [ n ] [ m ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{7,9,22,68});
param0.add(new int[]{24,40,98,58,-24,24,76,48,-92,-16,-46,-48,-70,88,66,2,44,36,34,34,46,90,-80,-24,-58,68,72,-20,-62,-40});
param0.add(new int[]{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});
param0.add(new int[]{32,15,41,41,4,42,22,33,33,11,68,5,41,80,39,15,36,75,41,11,25,40,50,19,39,12,75,28,52,20,63,5,27,53,19,62,98,72,10,90,74,93,52,81,91,65,90,93});
param0.add(new int[]{-94,-76,-68,-50,-28,-20,18,24,30,54,74,84,98});
param0.add(new int[]{1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,1,1,1,0,1,0});
param0.add(new int[]{14,27,43,49});
param0.add(new int[]{78,-26,-12,38,-90});
param0.add(new int[]{0,1,1,1});
param0.add(new int[]{12,69,57,7,52,14,15,83,67,57,15,86,81,43,1,64,45,68,30,23,14,70,13,51,23,33,98,68,24,43,12,82,46});
List<int [ ]> param1 = new ArrayList<>();
param1.add(new int[]{14,22,54,58});
param1.add(new int[]{30,-88,6,-26,-76,14,-80,-30,-58,76,40,-28,-54,38,-60,-60,88,-80,-22,90,50,-48,68,-26,26,-2,68,-16,88,-72});
param1.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,1,1,1,1,1,1,1,1,1,1});
param1.add(new int[]{80,18,9,29,62,89,4,40,47,15,35,82,22,97,63,54,7,58,64,73,54,79,21,21,20,19,56,42,6,97,7,34,55,35,57,86,73,88,20,29,48,52,8,77,2,12,6,47});
param1.add(new int[]{-88,-80,-78,-68,-44,-38,42,50,62,68,70,80,92});
param1.add(new int[]{1,0,0,1,1,1,1,1,1,0,0,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,1,0,0,1,0,0,1,0,1,0,1,0,1});
param1.add(new int[]{51,59,76,83});
param1.add(new int[]{14,50,-6,-38,80});
param1.add(new int[]{0,0,0,1});
param1.add(new int[]{12,48,57,40,47,36,22,50,68,98,77,78,39,55,87,75,65,27,33,27,70,34,67,71,84,33,7,61,3,9,67,92,60});
List<Integer> param2 = new ArrayList<>();
param2.add(3);
param2.add(22);
param2.add(22);
param2.add(30);
param2.add(11);
param2.add(21);
param2.add(2);
param2.add(3);
param2.add(3);
param2.add(17);
List<Integer> param3 = new ArrayList<>();
param3.add(2);
param3.add(22);
param3.add(19);
param3.add(25);
param3.add(8);
param3.add(33);
param3.add(2);
param3.add(2);
param3.add(2);
param3.add(32);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i),param3.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([7, 9, 22, 68],[14, 22, 54, 58],3,2,),
([24, 40, 98, 58, -24, 24, 76, 48, -92, -16, -46, -48, -70, 88, 66, 2, 44, 36, 34, 34, 46, 90, -80, -24, -58, 68, 72, -20, -62, -40],[30, -88, 6, -26, -76, 14, -80, -30, -58, 76, 40, -28, -54, 38, -60, -60, 88, -80, -22, 90, 50, -48, 68, -26, 26, -2, 68, -16, 88, -72],22,22,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],22,19,),
([32, 15, 41, 41, 4, 42, 22, 33, 33, 11, 68, 5, 41, 80, 39, 15, 36, 75, 41, 11, 25, 40, 50, 19, 39, 12, 75, 28, 52, 20, 63, 5, 27, 53, 19, 62, 98, 72, 10, 90, 74, 93, 52, 81, 91, 65, 90, 93],[80, 18, 9, 29, 62, 89, 4, 40, 47, 15, 35, 82, 22, 97, 63, 54, 7, 58, 64, 73, 54, 79, 21, 21, 20, 19, 56, 42, 6, 97, 7, 34, 55, 35, 57, 86, 73, 88, 20, 29, 48, 52, 8, 77, 2, 12, 6, 47],30,25,),
([-94, -76, -68, -50, -28, -20, 18, 24, 30, 54, 74, 84, 98],[-88, -80, -78, -68, -44, -38, 42, 50, 62, 68, 70, 80, 92],11,8,),
([1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0],[1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1],21,33,),
([14, 27, 43, 49],[51, 59, 76, 83],2,2,),
([78, -26, -12, 38, -90],[14, 50, -6, -38, 80],3,2,),
([0, 1, 1, 1],[0, 0, 0, 1],3,2,),
([12, 69, 57, 7, 52, 14, 15, 83, 67, 57, 15, 86, 81, 43, 1, 64, 45, 68, 30, 23, 14, 70, 13, 51, 23, 33, 98, 68, 24, 43, 12, 82, 46],[12, 48, 57, 40, 47, 36, 22, 50, 68, 98, 77, 78, 39, 55, 87, 75, 65, 27, 33, 27, 70, 34, 67, 71, 84, 33, 7, 61, 3, 9, 67, 92, 60],17,32,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{7,9,22,68},{24,40,98,58,-24,24,76,48,-92,-16,-46,-48,-70,88,66,2,44,36,34,34,46,90,-80,-24,-58,68,72,-20,-62,-40},{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},{32,15,41,41,4,42,22,33,33,11,68,5,41,80,39,15,36,75,41,11,25,40,50,19,39,12,75,28,52,20,63,5,27,53,19,62,98,72,10,90,74,93,52,81,91,65,90,93},{-94,-76,-68,-50,-28,-20,18,24,30,54,74,84,98},{1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,1,1,1,0,1,0},{14,27,43,49},{78,-26,-12,38,-90},{0,1,1,1},{12,69,57,7,52,14,15,83,67,57,15,86,81,43,1,64,45,68,30,23,14,70,13,51,23,33,98,68,24,43,12,82,46}};
vector<vector<int>> param1 {{14,22,54,58},{30,-88,6,-26,-76,14,-80,-30,-58,76,40,-28,-54,38,-60,-60,88,-80,-22,90,50,-48,68,-26,26,-2,68,-16,88,-72},{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},{80,18,9,29,62,89,4,40,47,15,35,82,22,97,63,54,7,58,64,73,54,79,21,21,20,19,56,42,6,97,7,34,55,35,57,86,73,88,20,29,48,52,8,77,2,12,6,47},{-88,-80,-78,-68,-44,-38,42,50,62,68,70,80,92},{1,0,0,1,1,1,1,1,1,0,0,1,1,0,1,1,0,0,1,0,1,1,0,1,0,1,1,0,1,0,0,1,0,0,1,0,1,0,1,0,1},{51,59,76,83},{14,50,-6,-38,80},{0,0,0,1},{12,48,57,40,47,36,22,50,68,98,77,78,39,55,87,75,65,27,33,27,70,34,67,71,84,33,7,61,3,9,67,92,60}};
vector<int> param2 {3,22,22,30,11,21,2,3,3,17};
vector<int> param3 {2,22,19,25,8,33,2,2,2,32};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),¶m1[i].front(),param2[i],param3[i]) == f_gold(¶m0[i].front(),¶m1[i].front(),param2[i],param3[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
SUBARRAYS_DISTINCT_ELEMENTS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUBARRAYS_DISTINCT_ELEMENTS{
public static int f_gold ( int [ ] arr , int n ) {
Set < Integer > s = new HashSet < > ( ) ;
int j = 0 , ans = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
while ( j < n && ! s . contains ( arr [ j ] ) ) {
s . add ( arr [ i ] ) ;
j ++ ;
}
ans += ( ( j - i ) * ( j - i + 1 ) ) / 2 ;
s . remove ( arr [ i ] ) ;
}
return ans ;
}
| def f_gold ( arr , n ) :
s = [ ]
j = 0
ans = 0
for i in range ( n ) :
while ( j < n and ( arr [ j ] not in s ) ) :
s.append ( arr [ j ] )
j += 1
ans += ( ( j - i ) * ( j - i + 1 ) ) // 2
s.remove ( arr [ i ] )
return ans
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
unordered_set < int > s;
int j = 0, ans = 0;
for ( int i = 0;
i < n;
i ++ ) {
while ( j < n && s . find ( arr [ j ] ) == s . end ( ) ) {
s . insert ( arr [ j ] );
j ++;
}
ans += ( ( j - i ) * ( j - i + 1 ) ) / 2;
s . erase ( arr [ i ] );
}
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,4,5,6,12,15,16,17,20,20,22,24,24,27,28,34,37,39,39,41,43,49,49,51,55,62,63,67,71,74,74,74,77,84,84,89,89,97,99});
param0.add(new int[]{-8,54,-22,18,20,44,0,54,90,-4,4,40,-74,-16});
param0.add(new int[]{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});
param0.add(new int[]{36,71,36,58,38,90,17});
param0.add(new int[]{-90,-32,-16,18,38,82});
param0.add(new int[]{1,0,1});
param0.add(new int[]{3,11,21,25,28,28,38,42,48,53,55,55,55,58,71,75,79,80,80,94,96,99});
param0.add(new int[]{-16,-52,-4,-46,54,0,8,-64,-82,-10,-62,-10,58,44,-28,86,-24,16,44,22,-28,-42,-52,8,76,-44,-34,2,88,-88,-14,-84,-36,-68,76,20,20,-50});
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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{19,13,61,32,92,90,12,81,52});
List<Integer> param1 = new ArrayList<>();
param1.add(24);
param1.add(13);
param1.add(28);
param1.add(4);
param1.add(5);
param1.add(2);
param1.add(20);
param1.add(35);
param1.add(27);
param1.add(5);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([3, 4, 5, 6, 12, 15, 16, 17, 20, 20, 22, 24, 24, 27, 28, 34, 37, 39, 39, 41, 43, 49, 49, 51, 55, 62, 63, 67, 71, 74, 74, 74, 77, 84, 84, 89, 89, 97, 99],24,),
([-8, 54, -22, 18, 20, 44, 0, 54, 90, -4, 4, 40, -74, -16],13,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],28,),
([36, 71, 36, 58, 38, 90, 17],4,),
([-90, -32, -16, 18, 38, 82],5,),
([1, 0, 1],2,),
([3, 11, 21, 25, 28, 28, 38, 42, 48, 53, 55, 55, 55, 58, 71, 75, 79, 80, 80, 94, 96, 99],20,),
([-16, -52, -4, -46, 54, 0, 8, -64, -82, -10, -62, -10, 58, 44, -28, 86, -24, 16, 44, 22, -28, -42, -52, 8, 76, -44, -34, 2, 88, -88, -14, -84, -36, -68, 76, 20, 20, -50],35,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],27,),
([19, 13, 61, 32, 92, 90, 12, 81, 52],5,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{3,4,5,6,12,15,16,17,20,20,22,24,24,27,28,34,37,39,39,41,43,49,49,51,55,62,63,67,71,74,74,74,77,84,84,89,89,97,99},{-8,54,-22,18,20,44,0,54,90,-4,4,40,-74,-16},{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},{36,71,36,58,38,90,17},{-90,-32,-16,18,38,82},{1,0,1},{3,11,21,25,28,28,38,42,48,53,55,55,55,58,71,75,79,80,80,94,96,99},{-16,-52,-4,-46,54,0,8,-64,-82,-10,-62,-10,58,44,-28,86,-24,16,44,22,-28,-42,-52,8,76,-44,-34,2,88,-88,-14,-84,-36,-68,76,20,20,-50},{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},{19,13,61,32,92,90,12,81,52}};
vector<int> param1 {24,13,28,4,5,2,20,35,27,5};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
PROGRAM_FOR_FACTORIAL_OF_A_NUMBER_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_FOR_FACTORIAL_OF_A_NUMBER_2{
static int f_gold ( int n ) {
return ( n == 1 || n == 0 ) ? 1 : n * f_gold ( n - 1 ) ;
}
| 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(24);
param0.add(46);
param0.add(47);
param0.add(41);
param0.add(98);
param0.add(69);
param0.add(83);
param0.add(2);
param0.add(12);
param0.add(11);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(24,),
(46,),
(47,),
(41,),
(98,),
(69,),
(83,),
(2,),
(12,),
(11,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {24,46,47,41,98,69,83,2,12,11};
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();
return 0;
} |
SQUARE_ROOT_OF_AN_INTEGER_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SQUARE_ROOT_OF_AN_INTEGER_1{
public static int f_gold ( int x ) {
if ( x == 0 || x == 1 ) return x ;
int start = 1 , end = x , ans = 0 ;
while ( start <= end ) {
int mid = ( start + end ) / 2 ;
if ( mid * mid == x ) return mid ;
if ( mid * mid < x ) {
start = mid + 1 ;
ans = mid ;
}
else end = mid - 1 ;
}
return ans ;
}
| def f_gold ( x ) :
if ( x == 0 or x == 1 ) :
return x
start = 1
end = x
while ( start <= end ) :
mid = ( start + end ) // 2
if ( mid * mid == x ) :
return mid
if ( mid * mid < x ) :
start = mid + 1
ans = mid
else :
end = mid - 1
return ans
|
using namespace std;
int f_gold ( int x ) {
if ( x == 0 || x == 1 ) return x;
int start = 1, end = x, ans;
while ( start <= end ) {
int mid = ( start + end ) / 2;
if ( mid * mid == x ) return mid;
if ( mid * mid < x ) {
start = mid + 1;
ans = mid;
}
else end = mid - 1;
}
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(40);
param0.add(10);
param0.add(46);
param0.add(54);
param0.add(1);
param0.add(67);
param0.add(64);
param0.add(10);
param0.add(75);
param0.add(11);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(40,),
(10,),
(46,),
(54,),
(1,),
(67,),
(64,),
(10,),
(75,),
(11,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {40,10,46,54,1,67,64,10,75,11};
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();
return 0;
} |
SUM_FAI_AJ_PAIRS_ARRAY_N_INTEGERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_FAI_AJ_PAIRS_ARRAY_N_INTEGERS{
public static int f_gold ( int a [ ] , int n ) {
Map < Integer , Integer > cnt = new HashMap < Integer , Integer > ( ) ;
int ans = 0 , pre_sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
ans += ( i * a [ i ] ) - pre_sum ;
pre_sum += a [ i ] ;
if ( cnt . containsKey ( a [ i ] - 1 ) ) ans -= cnt . get ( a [ i ] - 1 ) ;
if ( cnt . containsKey ( a [ i ] + 1 ) ) ans += cnt . get ( a [ i ] + 1 ) ;
if ( cnt . containsKey ( a [ i ] ) ) {
cnt . put ( a [ i ] , cnt . get ( a [ i ] ) + 1 ) ;
}
else {
cnt . put ( a [ i ] , 1 ) ;
}
}
return ans ;
}
| def f_gold ( a , n ) :
cnt = dict ( )
ans = 0
pre_sum = 0
for i in range ( n ) :
ans += ( i * a [ i ] ) - pre_sum
pre_sum += a [ i ]
if ( a [ i ] - 1 ) in cnt :
ans -= cnt [ a [ i ] - 1 ]
if ( a [ i ] + 1 ) in cnt :
ans += cnt [ a [ i ] + 1 ]
if a [ i ] not in cnt :
cnt [ a [ i ] ] = 0
cnt [ a [ i ] ] += 1
return ans
|
using namespace std;
int f_gold ( int a [ ], int n ) {
unordered_map < int, int > cnt;
int ans = 0, pre_sum = 0;
for ( int i = 0;
i < n;
i ++ ) {
ans += ( i * a [ i ] ) - pre_sum;
pre_sum += a [ i ];
if ( cnt [ a [ i ] - 1 ] ) ans -= cnt [ a [ i ] - 1 ];
if ( cnt [ a [ i ] + 1 ] ) ans += cnt [ a [ i ] + 1 ];
cnt [ a [ i ] ] ++;
}
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,8,12,19,23,23,26,39,54,56,57,57,73,78,83,83,89,91});
param0.add(new int[]{62,-34,10,-28,-42,-12,4,20,-20,-84,-76,-16,-44,26,-78,-40,50,-10,-56,76,-88,24,64,10,64,-8,-68,-42,26,24,62,36,-68,8,-68,-2,8,38,-18});
param0.add(new int[]{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});
param0.add(new int[]{23,14,44,29,93,56,22,29,97,71,43,72,74,8,92,40,18,34,78,79,93,63,79,44,35,72,88,83,40,89,66,66,54,56,44,62,72,94,79,79,24,55,72,37,27,55,16,58,83});
param0.add(new int[]{-96,-94,-90,-90,-86,-82,-80,-80,-58,-48,-40,-32,-32,-20,-20,-20,-12,-12,-6,-6,-2,0,4,16,16,16,42,48,58,64,68,76,76,76,78,80,82,88,88,88,92,94,96,98});
param0.add(new int[]{1,1,1,1,0,0,0,1,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,1});
param0.add(new int[]{3,4,4,8,10,10,11,15,19,19,20,24,25,25,27,30,41,43,44,45,47,55,59,59,61,63,63,67,67,69,72,73,75,77,77,78,81,81,83,84,92,94,99});
param0.add(new int[]{94,-86,94,54,-52,86,68,64,98,54,-14,-60,-60,-92,80,-16,28,16,-74,68,32,-54,58,-16,-2,-52,-92,-36,96,-18,14,76,16});
param0.add(new int[]{0,0,0,0,1,1,1,1});
param0.add(new int[]{10,28,63,2,78,12,51,82,89,65,99});
List<Integer> param1 = new ArrayList<>();
param1.add(15);
param1.add(20);
param1.add(18);
param1.add(25);
param1.add(27);
param1.add(34);
param1.add(31);
param1.add(26);
param1.add(7);
param1.add(8);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([2, 8, 12, 19, 23, 23, 26, 39, 54, 56, 57, 57, 73, 78, 83, 83, 89, 91],15,),
([62, -34, 10, -28, -42, -12, 4, 20, -20, -84, -76, -16, -44, 26, -78, -40, 50, -10, -56, 76, -88, 24, 64, 10, 64, -8, -68, -42, 26, 24, 62, 36, -68, 8, -68, -2, 8, 38, -18],20,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],18,),
([23, 14, 44, 29, 93, 56, 22, 29, 97, 71, 43, 72, 74, 8, 92, 40, 18, 34, 78, 79, 93, 63, 79, 44, 35, 72, 88, 83, 40, 89, 66, 66, 54, 56, 44, 62, 72, 94, 79, 79, 24, 55, 72, 37, 27, 55, 16, 58, 83],25,),
([-96, -94, -90, -90, -86, -82, -80, -80, -58, -48, -40, -32, -32, -20, -20, -20, -12, -12, -6, -6, -2, 0, 4, 16, 16, 16, 42, 48, 58, 64, 68, 76, 76, 76, 78, 80, 82, 88, 88, 88, 92, 94, 96, 98],27,),
([1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1],34,),
([3, 4, 4, 8, 10, 10, 11, 15, 19, 19, 20, 24, 25, 25, 27, 30, 41, 43, 44, 45, 47, 55, 59, 59, 61, 63, 63, 67, 67, 69, 72, 73, 75, 77, 77, 78, 81, 81, 83, 84, 92, 94, 99],31,),
([94, -86, 94, 54, -52, 86, 68, 64, 98, 54, -14, -60, -60, -92, 80, -16, 28, 16, -74, 68, 32, -54, 58, -16, -2, -52, -92, -36, 96, -18, 14, 76, 16],26,),
([0, 0, 0, 0, 1, 1, 1, 1],7,),
([10, 28, 63, 2, 78, 12, 51, 82, 89, 65, 99],8,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,8,12,19,23,23,26,39,54,56,57,57,73,78,83,83,89,91},{62,-34,10,-28,-42,-12,4,20,-20,-84,-76,-16,-44,26,-78,-40,50,-10,-56,76,-88,24,64,10,64,-8,-68,-42,26,24,62,36,-68,8,-68,-2,8,38,-18},{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},{23,14,44,29,93,56,22,29,97,71,43,72,74,8,92,40,18,34,78,79,93,63,79,44,35,72,88,83,40,89,66,66,54,56,44,62,72,94,79,79,24,55,72,37,27,55,16,58,83},{-96,-94,-90,-90,-86,-82,-80,-80,-58,-48,-40,-32,-32,-20,-20,-20,-12,-12,-6,-6,-2,0,4,16,16,16,42,48,58,64,68,76,76,76,78,80,82,88,88,88,92,94,96,98},{1,1,1,1,0,0,0,1,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,1},{3,4,4,8,10,10,11,15,19,19,20,24,25,25,27,30,41,43,44,45,47,55,59,59,61,63,63,67,67,69,72,73,75,77,77,78,81,81,83,84,92,94,99},{94,-86,94,54,-52,86,68,64,98,54,-14,-60,-60,-92,80,-16,28,16,-74,68,32,-54,58,-16,-2,-52,-92,-36,96,-18,14,76,16},{0,0,0,0,1,1,1,1},{10,28,63,2,78,12,51,82,89,65,99}};
vector<int> param1 {15,20,18,25,27,34,31,26,7,8};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
DIVISIBILITY_9_USING_BITWISE_OPERATORS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DIVISIBILITY_9_USING_BITWISE_OPERATORS{
static boolean f_gold ( int n ) {
if ( n == 0 || n == 9 ) return true ;
if ( n < 9 ) return false ;
return f_gold ( ( int ) ( n >> 3 ) - ( int ) ( n & 7 ) ) ;
}
| def f_gold ( n ) :
if ( n == 0 or n == 9 ) :
return True
if ( n < 9 ) :
return False
return f_gold ( ( int ) ( n >> 3 ) - ( int ) ( n & 7 ) )
|
using namespace std;
bool f_gold ( int n ) {
if ( n == 0 || n == 9 ) return true;
if ( n < 9 ) return false;
return f_gold ( ( int ) ( n >> 3 ) - ( int ) ( n & 7 ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(96);
param0.add(85);
param0.add(54);
param0.add(14);
param0.add(47);
param0.add(11);
param0.add(49);
param0.add(99);
param0.add(28);
param0.add(82);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(96,),
(85,),
(54,),
(14,),
(47,),
(11,),
(49,),
(99,),
(28,),
(82,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {96,85,54,14,47,11,49,99,28,82};
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();
return 0;
} |
LEXICOGRAPHICAL_CONCATENATION_SUBSTRINGS_STRING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LEXICOGRAPHICAL_CONCATENATION_SUBSTRINGS_STRING{
static String f_gold ( String s ) {
int n = s . length ( ) ;
int sub_count = n * ( n + 1 ) / 2 ;
String [ ] arr = new String [ sub_count ] ;
int index = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int len = 1 ;
len <= n - i ;
len ++ ) {
arr [ index ++ ] = s . substring ( i , i + len ) ;
}
Arrays . sort ( arr ) ;
String res = "" ;
for ( int i = 0 ;
i < sub_count ;
i ++ ) res += arr [ i ] ;
return res ;
}
| def f_gold ( s ) :
n = len ( s ) ;
sub_count = ( n * ( n + 1 ) ) // 2 ;
arr = [ 0 ] * sub_count ;
index = 0 ;
for i in range ( n ) :
for j in range ( 1 , n - i + 1 ) :
arr [ index ] = s [ i : i + j ] ;
index += 1 ;
arr.sort ( ) ;
res = "" ;
for i in range ( sub_count ) :
res += arr [ i ] ;
return res ;
|
using namespace std;
string f_gold ( string s ) {
int n = s . length ( );
int sub_count = n * ( n + 1 ) / 2;
string arr [ sub_count ];
int index = 0;
for ( int i = 0;
i < n;
i ++ ) for ( int len = 1;
len <= n - i;
len ++ ) arr [ index ++ ] = s . substr ( i, len );
sort ( arr, arr + sub_count );
string res = "";
for ( int i = 0;
i < sub_count;
i ++ ) res += arr [ i ];
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("sqGOi");
param0.add("848580");
param0.add("01001110011001");
param0.add("ZhWXUKmeiI");
param0.add("0917296541285");
param0.add("01101001111100");
param0.add("tjP kR");
param0.add("999907");
param0.add("011100");
param0.add("qJPHNSJOUj");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)).equals(f_gold(param0.get(i))))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('sqGOi',),
('848580',),
('01001110011001',),
('ZhWXUKmeiI',),
('0917296541285',),
('01101001111100',),
('tjP kR',),
('999907',),
('011100',),
('qJPHNSJOUj',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<string> param0 {"sqGOi","848580","01001110011001","ZhWXUKmeiI","0917296541285","01101001111100","tjP kR","999907","011100","qJPHNSJOUj"};
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();
return 0;
} |
WRITE_A_C_PROGRAM_TO_CALCULATE_POWXN |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class WRITE_A_C_PROGRAM_TO_CALCULATE_POWXN{
static int f_gold ( int x , int y ) {
if ( y == 0 ) return 1 ;
else if ( y % 2 == 0 ) return f_gold ( x , y / 2 ) * f_gold ( x , y / 2 ) ;
else return x * f_gold ( x , y / 2 ) * f_gold ( x , y / 2 ) ;
}
| def f_gold ( x , y ) :
if ( y == 0 ) : return 1
elif ( int ( y % 2 ) == 0 ) :
return ( f_gold ( x , int ( y / 2 ) ) * f_gold ( x , int ( y / 2 ) ) )
else :
return ( x * f_gold ( x , int ( y / 2 ) ) * f_gold ( x , int ( y / 2 ) ) )
| null |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(46);
param0.add(99);
param0.add(30);
param0.add(1);
param0.add(26);
param0.add(1);
param0.add(27);
param0.add(10);
param0.add(26);
param0.add(29);
List<Integer> param1 = new ArrayList<>();
param1.add(92);
param1.add(87);
param1.add(32);
param1.add(86);
param1.add(81);
param1.add(49);
param1.add(46);
param1.add(52);
param1.add(38);
param1.add(80);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(46,92,),
(99,87,),
(30,32,),
(1,86,),
(26,81,),
(1,49,),
(27,46,),
(10,52,),
(26,38,),
(29,80,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) | null |
NUMBER_SUBSEQUENCES_FORM_AI_BJ_CK |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_SUBSEQUENCES_FORM_AI_BJ_CK{
static int f_gold ( String s ) {
int aCount = 0 ;
int bCount = 0 ;
int cCount = 0 ;
for ( int i = 0 ;
i < s . length ( ) ;
i ++ ) {
if ( s . charAt ( i ) == 'a' ) aCount = ( 1 + 2 * aCount ) ;
else if ( s . charAt ( i ) == 'b' ) bCount = ( aCount + 2 * bCount ) ;
else if ( s . charAt ( i ) == 'c' ) cCount = ( bCount + 2 * cCount ) ;
}
return cCount ;
}
| def f_gold ( s ) :
aCount = 0
bCount = 0
cCount = 0
for i in range ( len ( s ) ) :
if ( s [ i ] == 'a' ) :
aCount = ( 1 + 2 * aCount )
elif ( s [ i ] == 'b' ) :
bCount = ( aCount + 2 * bCount )
elif ( s [ i ] == 'c' ) :
cCount = ( bCount + 2 * cCount )
return cCount
|
using namespace std;
int f_gold ( string s ) {
int aCount = 0;
int bCount = 0;
int cCount = 0;
for ( unsigned int i = 0;
i < s . size ( );
i ++ ) {
if ( s [ i ] == 'a' ) aCount = ( 1 + 2 * aCount );
else if ( s [ i ] == 'b' ) bCount = ( aCount + 2 * bCount );
else if ( s [ i ] == 'c' ) cCount = ( bCount + 2 * cCount );
}
return cCount;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("");
param0.add("abbc");
param0.add("abcabc");
param0.add("agsdbkfdc ");
param0.add("ababab");
param0.add("aaaaaaa");
param0.add("aabaaabcc");
param0.add("19");
param0.add("1001100");
param0.add("DtAnuQbU");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('',),
('abbc',),
('abcabc',),
('agsdbkfdc ',),
('ababab',),
('aaaaaaa',),
('aabaaabcc',),
('19',),
('1001100',),
('DtAnuQbU',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<string> param0 {"","abbc","abcabc","agsdbkfdc","ababab","aaaaaaa","aabaaabcc","19","1001100","DtAnuQbU"};
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();
return 0;
} |
LONGEST_COMMON_SUBSTRING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LONGEST_COMMON_SUBSTRING{
static int f_gold ( char X [ ] , char Y [ ] , int m , int n ) {
int LCStuff [ ] [ ] = new int [ m + 1 ] [ n + 1 ] ;
int result = 0 ;
for ( int i = 0 ;
i <= m ;
i ++ ) {
for ( int j = 0 ;
j <= n ;
j ++ ) {
if ( i == 0 || j == 0 ) LCStuff [ i ] [ j ] = 0 ;
else if ( X [ i - 1 ] == Y [ j - 1 ] ) {
LCStuff [ i ] [ j ] = LCStuff [ i - 1 ] [ j - 1 ] + 1 ;
result = Integer . max ( result , LCStuff [ i ] [ j ] ) ;
}
else LCStuff [ i ] [ j ] = 0 ;
}
}
return result ;
}
| def f_gold ( X , Y , m , n ) :
LCSuff = [ [ 0 for k in range ( n + 1 ) ] for l in range ( m + 1 ) ]
result = 0
for i in range ( m + 1 ) :
for j in range ( n + 1 ) :
if ( i == 0 or j == 0 ) :
LCSuff [ i ] [ j ] = 0
elif ( X [ i - 1 ] == Y [ j - 1 ] ) :
LCSuff [ i ] [ j ] = LCSuff [ i - 1 ] [ j - 1 ] + 1
result = max ( result , LCSuff [ i ] [ j ] )
else :
LCSuff [ i ] [ j ] = 0
return result
| null |
public static void main(String args[]) {
int n_success = 0;
List<char [ ]> param0 = new ArrayList<>();
param0.add(new char[]{'A','D','E','E','L','L','T','r','x'});
param0.add(new char[]{'9','3','4','8','7','6','3','8','3','3','5','3','5','4','2','5','5','3','6','2','1','7','4','2','7','3','2','1','3','7','6','5','0','6','3','8','5','1','7','9','2','7'});
param0.add(new char[]{'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'});
param0.add(new char[]{'W','X','P','u','s','k','O','y','Q','i','t','z','F','f','s','N','K','m','I','M','g','e','E','P','b','Y','c','O',' ','G','F','x'});
param0.add(new char[]{'0','1','2','4','5','7','7','7','8','8','9','9','9'});
param0.add(new char[]{'0','0','1'});
param0.add(new char[]{'A','C','F','G','G','H','I','K','K','N','O','Q','R','V','V','W','Y','a','a','c','d','k','k','m','o','p','t','u','y','y','y','z'});
param0.add(new char[]{'0','0','0','2','8','3','5','1','0','7','7','9','9','4','8','9','5'});
param0.add(new char[]{'0','0','0','0','0','0','0','0','1','1','1'});
param0.add(new char[]{'B','o','R','k','Y','M','g','b','h','A','i','X','p','i','j','f','V','n','d','P','T','U','f','G','M','W','g','a','C','E','v','C',' '});
List<char [ ]> param1 = new ArrayList<>();
param1.add(new char[]{'D','F','H','O','g','o','u','v','w'});
param1.add(new char[]{'5','5','3','7','8','0','9','8','5','8','5','1','4','4','0','2','9','2','3','1','1','3','6','1','2','0','5','4','3','7','5','5','8','1','1','4','8','1','7','5','5','4'});
param1.add(new char[]{'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'});
param1.add(new char[]{'e','R','P','W','d','a','A','j','H','v','T','w','x','I','d','o','z','K','B','M','J','L','a',' ','T','L','V','t','M','U','z','R'});
param1.add(new char[]{'0','0','2','2','2','3','4','6','6','7','8','9','9'});
param1.add(new char[]{'0','0','1'});
param1.add(new char[]{' ',' ','B','C','C','C','D','E','I','J','M','N','P','T','U','U','V','V','W','W','Y','b','c','e','i','o','p','r','t','y','y','z'});
param1.add(new char[]{'8','5','8','7','1','4','0','2','2','7','2','4','0','8','3','8','7'});
param1.add(new char[]{'0','0','0','0','0','0','1','1','1','1','1'});
param1.add(new char[]{'F','h','G','H','Q','Q','K','g','k','u','l','c','c','o','n','G','i','Z','d','b','c','b','v','t','S','t','P','A','K','g','G','i','m'});
List<Integer> param2 = new ArrayList<>();
param2.add(4);
param2.add(41);
param2.add(35);
param2.add(31);
param2.add(12);
param2.add(1);
param2.add(21);
param2.add(13);
param2.add(9);
param2.add(19);
List<Integer> param3 = new ArrayList<>();
param3.add(4);
param3.add(37);
param3.add(29);
param3.add(18);
param3.add(8);
param3.add(1);
param3.add(23);
param3.add(12);
param3.add(9);
param3.add(32);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i),param3.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(['A', 'D', 'E', 'E', 'L', 'L', 'T', 'r', 'x'],['D', 'F', 'H', 'O', 'g', 'o', 'u', 'v', 'w'],4,4,),
(['9', '3', '4', '8', '7', '6', '3', '8', '3', '3', '5', '3', '5', '4', '2', '5', '5', '3', '6', '2', '1', '7', '4', '2', '7', '3', '2', '1', '3', '7', '6', '5', '0', '6', '3', '8', '5', '1', '7', '9', '2', '7'],['5', '5', '3', '7', '8', '0', '9', '8', '5', '8', '5', '1', '4', '4', '0', '2', '9', '2', '3', '1', '1', '3', '6', '1', '2', '0', '5', '4', '3', '7', '5', '5', '8', '1', '1', '4', '8', '1', '7', '5', '5', '4'],41,37,),
(['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'],['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'],35,29,),
(['W', 'X', 'P', 'u', 's', 'k', 'O', 'y', 'Q', 'i', 't', 'z', 'F', 'f', 's', 'N', 'K', 'm', 'I', 'M', 'g', 'e', 'E', 'P', 'b', 'Y', 'c', 'O', ' ', 'G', 'F', 'x'],['e', 'R', 'P', 'W', 'd', 'a', 'A', 'j', 'H', 'v', 'T', 'w', 'x', 'I', 'd', 'o', 'z', 'K', 'B', 'M', 'J', 'L', 'a', ' ', 'T', 'L', 'V', 't', 'M', 'U', 'z', 'R'],31,18,),
(['0', '1', '2', '4', '5', '7', '7', '7', '8', '8', '9', '9', '9'],['0', '0', '2', '2', '2', '3', '4', '6', '6', '7', '8', '9', '9'],12,8,),
(['0', '0', '1'],['0', '0', '1'],1,1,),
(['A', 'C', 'F', 'G', 'G', 'H', 'I', 'K', 'K', 'N', 'O', 'Q', 'R', 'V', 'V', 'W', 'Y', 'a', 'a', 'c', 'd', 'k', 'k', 'm', 'o', 'p', 't', 'u', 'y', 'y', 'y', 'z'],[' ', ' ', 'B', 'C', 'C', 'C', 'D', 'E', 'I', 'J', 'M', 'N', 'P', 'T', 'U', 'U', 'V', 'V', 'W', 'W', 'Y', 'b', 'c', 'e', 'i', 'o', 'p', 'r', 't', 'y', 'y', 'z'],21,23,),
(['0', '0', '0', '2', '8', '3', '5', '1', '0', '7', '7', '9', '9', '4', '8', '9', '5'],['8', '5', '8', '7', '1', '4', '0', '2', '2', '7', '2', '4', '0', '8', '3', '8', '7'],13,12,),
(['0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1'],['0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1'],9,9,),
(['B', 'o', 'R', 'k', 'Y', 'M', 'g', 'b', 'h', 'A', 'i', 'X', 'p', 'i', 'j', 'f', 'V', 'n', 'd', 'P', 'T', 'U', 'f', 'G', 'M', 'W', 'g', 'a', 'C', 'E', 'v', 'C', ' '],['F', 'h', 'G', 'H', 'Q', 'Q', 'K', 'g', 'k', 'u', 'l', 'c', 'c', 'o', 'n', 'G', 'i', 'Z', 'd', 'b', 'c', 'b', 'v', 't', 'S', 't', 'P', 'A', 'K', 'g', 'G', 'i', 'm'],19,32,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) | null |
CEILING_IN_A_SORTED_ARRAY_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CEILING_IN_A_SORTED_ARRAY_1{
static int f_gold ( int arr [ ] , int low , int high , int x ) {
int mid ;
if ( x <= arr [ low ] ) return low ;
if ( x > arr [ high ] ) return - 1 ;
mid = ( low + high ) / 2 ;
if ( arr [ mid ] == x ) return mid ;
else if ( arr [ mid ] < x ) {
if ( mid + 1 <= high && x <= arr [ mid + 1 ] ) return mid + 1 ;
else return f_gold ( arr , mid + 1 , high , x ) ;
}
else {
if ( mid - 1 >= low && x > arr [ mid - 1 ] ) return mid ;
else return f_gold ( arr , low , mid - 1 , x ) ;
}
}
| def f_gold ( arr , low , high , x ) :
if x <= arr [ low ] :
return low
if x > arr [ high ] :
return - 1
mid = ( low + high ) / 2 ;
if arr [ mid ] == x :
return mid
elif arr [ mid ] < x :
if mid + 1 <= high and x <= arr [ mid + 1 ] :
return mid + 1
else :
return f_gold ( arr , mid + 1 , high , x )
else :
if mid - 1 >= low and x > arr [ mid - 1 ] :
return mid
else :
return f_gold ( arr , low , mid - 1 , x )
|
using namespace std;
int f_gold ( int arr [ ], int low, int high, int x ) {
int mid;
if ( x <= arr [ low ] ) return low;
if ( x > arr [ high ] ) return - 1;
mid = ( low + high ) / 2;
if ( arr [ mid ] == x ) return mid;
else if ( arr [ mid ] < x ) {
if ( mid + 1 <= high && x <= arr [ mid + 1 ] ) return mid + 1;
else return f_gold ( arr, mid + 1, high, x );
}
else {
if ( mid - 1 >= low && x > arr [ mid - 1 ] ) return mid;
else return f_gold ( arr, low, mid - 1, x );
}
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,6,13,16,23,24,24,27,30,32,34,34,55,56,56,63,66,81,83,96});
param0.add(new int[]{-28,-96,48,22,-12,72,48,-70,-96,-84,-62,22,18,-92,-74,14,28,52,64,72,16,-76,46});
param0.add(new int[]{0,1});
param0.add(new int[]{51,98,25,10,43,91,33,25,85,51,94,6,35,48,11,97,67,21,50,9,11,51,86,61,22,88,89,11});
param0.add(new int[]{-94,-92,-88,-74,-52,-50,-48,-44,-40,-36,-32,-26,20,22,30,32,46,56,56,60,62,64,80,84,86,94,96,96});
param0.add(new int[]{1,0,0,1,1,0,0,1,0,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0});
param0.add(new int[]{4,5,5,13,26,40,46,51,58,60,64,66,68,69,71,74,78,81,83,88,88,90,98,99});
param0.add(new int[]{92,6,-54,84,-10,32,50,40,-38,64,-64,-10,70,-68,-6,-16,68,34,-66,-82,84,98,50,82,78,4,34,-34,78,64,32,58,-94,40,50,0,-92,-36,10,-54,58,-78,-88,32,6});
param0.add(new int[]{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});
param0.add(new int[]{80,67,30,35,9});
List<Integer> param1 = new ArrayList<>();
param1.add(13);
param1.add(11);
param1.add(1);
param1.add(20);
param1.add(20);
param1.add(15);
param1.add(12);
param1.add(23);
param1.add(24);
param1.add(2);
List<Integer> param2 = new ArrayList<>();
param2.add(11);
param2.add(18);
param2.add(1);
param2.add(20);
param2.add(15);
param2.add(17);
param2.add(17);
param2.add(28);
param2.add(17);
param2.add(3);
List<Integer> param3 = new ArrayList<>();
param3.add(18);
param3.add(21);
param3.add(1);
param3.add(15);
param3.add(15);
param3.add(22);
param3.add(14);
param3.add(28);
param3.add(22);
param3.add(2);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i),param3.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([2, 6, 13, 16, 23, 24, 24, 27, 30, 32, 34, 34, 55, 56, 56, 63, 66, 81, 83, 96],13,11,18,),
([-28, -96, 48, 22, -12, 72, 48, -70, -96, -84, -62, 22, 18, -92, -74, 14, 28, 52, 64, 72, 16, -76, 46],11,18,21,),
([0, 1],1,1,1,),
([51, 98, 25, 10, 43, 91, 33, 25, 85, 51, 94, 6, 35, 48, 11, 97, 67, 21, 50, 9, 11, 51, 86, 61, 22, 88, 89, 11],20,20,15,),
([-94, -92, -88, -74, -52, -50, -48, -44, -40, -36, -32, -26, 20, 22, 30, 32, 46, 56, 56, 60, 62, 64, 80, 84, 86, 94, 96, 96],20,15,15,),
([1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],15,17,22,),
([4, 5, 5, 13, 26, 40, 46, 51, 58, 60, 64, 66, 68, 69, 71, 74, 78, 81, 83, 88, 88, 90, 98, 99],12,17,14,),
([92, 6, -54, 84, -10, 32, 50, 40, -38, 64, -64, -10, 70, -68, -6, -16, 68, 34, -66, -82, 84, 98, 50, 82, 78, 4, 34, -34, 78, 64, 32, 58, -94, 40, 50, 0, -92, -36, 10, -54, 58, -78, -88, 32, 6],23,28,28,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],24,17,22,),
([80, 67, 30, 35, 9],2,3,2,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,6,13,16,23,24,24,27,30,32,34,34,55,56,56,63,66,81,83,96},{-28,-96,48,22,-12,72,48,-70,-96,-84,-62,22,18,-92,-74,14,28,52,64,72,16,-76,46},{0,1},{51,98,25,10,43,91,33,25,85,51,94,6,35,48,11,97,67,21,50,9,11,51,86,61,22,88,89,11},{-94,-92,-88,-74,-52,-50,-48,-44,-40,-36,-32,-26,20,22,30,32,46,56,56,60,62,64,80,84,86,94,96,96},{1,0,0,1,1,0,0,1,0,1,0,1,1,0,0,0,0,0,0,1,0,0,0,0,0},{4,5,5,13,26,40,46,51,58,60,64,66,68,69,71,74,78,81,83,88,88,90,98,99},{92,6,-54,84,-10,32,50,40,-38,64,-64,-10,70,-68,-6,-16,68,34,-66,-82,84,98,50,82,78,4,34,-34,78,64,32,58,-94,40,50,0,-92,-36,10,-54,58,-78,-88,32,6},{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},{80,67,30,35,9}};
vector<int> param1 {13,11,1,20,20,15,12,23,24,2};
vector<int> param2 {11,18,1,20,15,17,17,28,17,3};
vector<int> param3 {18,21,1,15,15,22,14,28,22,2};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],param2[i],param3[i]) == f_gold(¶m0[i].front(),param1[i],param2[i],param3[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MAXIMUM_EQULIBRIUM_SUM_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_EQULIBRIUM_SUM_ARRAY{
static int f_gold ( int [ ] arr , int n ) {
int res = Integer . MIN_VALUE ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int prefix_sum = arr [ i ] ;
for ( int j = 0 ;
j < i ;
j ++ ) prefix_sum += arr [ j ] ;
int suffix_sum = arr [ i ] ;
for ( int j = n - 1 ;
j > i ;
j -- ) suffix_sum += arr [ j ] ;
if ( prefix_sum == suffix_sum ) res = Math . max ( res , prefix_sum ) ;
}
return res ;
}
| import sys
def f_gold ( arr , n ) :
res = - sys.maxsize - 1
for i in range ( n ) :
prefix_sum = arr [ i ]
for j in range ( i ) :
prefix_sum += arr [ j ]
suffix_sum = arr [ i ]
j = n - 1
while ( j > i ) :
suffix_sum += arr [ j ]
j -= 1
if ( prefix_sum == suffix_sum ) :
res = max ( res , prefix_sum )
return res
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int res = INT_MIN;
for ( int i = 0;
i < n;
i ++ ) {
int prefix_sum = arr [ i ];
for ( int j = 0;
j < i;
j ++ ) prefix_sum += arr [ j ];
int suffix_sum = arr [ i ];
for ( int j = n - 1;
j > i;
j -- ) suffix_sum += arr [ j ];
if ( prefix_sum == suffix_sum ) res = max ( res, prefix_sum );
}
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,3,9,19,22,27,32,41,45,63,66,67,81,91});
param0.add(new int[]{-64,-2,68,-48,22,-14,-98});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{86,79,23,55,4,22,37,1,72,22,82,62,96,47});
param0.add(new int[]{-96,-96,-96,-96,-92,-82,-72,-72,-62,-58,-52,-48,-44,-44,-40,-34,-28,-26,-26,0,0,2,4,4,12,12,18,34,36,40,48,48,54,60,66,66,72,76,78,82,82,96,98});
param0.add(new int[]{0,1,0,1,1,0,0,0,1,1,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,1,0,0,0,0,0,1,1,1,1,1,0,0,1,1,0,0,0,1,0});
param0.add(new int[]{2,3,7,13,20,24,39,49,53,58,72,80,90,99});
param0.add(new int[]{-48,44,60,-30,8,20,70,-50,80,-2,-28,-14});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{64,13,18,3,22,29,51,45,21,13,47,15,17,34,60,99,30,54,16,47,13,49,60,66,28,57,85,66,65,7,62,29,9});
List<Integer> param1 = new ArrayList<>();
param1.add(13);
param1.add(4);
param1.add(19);
param1.add(8);
param1.add(33);
param1.add(38);
param1.add(11);
param1.add(11);
param1.add(16);
param1.add(21);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([3, 3, 9, 19, 22, 27, 32, 41, 45, 63, 66, 67, 81, 91],13,),
([-64, -2, 68, -48, 22, -14, -98],4,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],19,),
([86, 79, 23, 55, 4, 22, 37, 1, 72, 22, 82, 62, 96, 47],8,),
([-96, -96, -96, -96, -92, -82, -72, -72, -62, -58, -52, -48, -44, -44, -40, -34, -28, -26, -26, 0, 0, 2, 4, 4, 12, 12, 18, 34, 36, 40, 48, 48, 54, 60, 66, 66, 72, 76, 78, 82, 82, 96, 98],33,),
([0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0],38,),
([2, 3, 7, 13, 20, 24, 39, 49, 53, 58, 72, 80, 90, 99],11,),
([-48, 44, 60, -30, 8, 20, 70, -50, 80, -2, -28, -14],11,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],16,),
([64, 13, 18, 3, 22, 29, 51, 45, 21, 13, 47, 15, 17, 34, 60, 99, 30, 54, 16, 47, 13, 49, 60, 66, 28, 57, 85, 66, 65, 7, 62, 29, 9],21,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{3,3,9,19,22,27,32,41,45,63,66,67,81,91},{-64,-2,68,-48,22,-14,-98},{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1},{86,79,23,55,4,22,37,1,72,22,82,62,96,47},{-96,-96,-96,-96,-92,-82,-72,-72,-62,-58,-52,-48,-44,-44,-40,-34,-28,-26,-26,0,0,2,4,4,12,12,18,34,36,40,48,48,54,60,66,66,72,76,78,82,82,96,98},{0,1,0,1,1,0,0,0,1,1,1,0,0,1,0,0,1,1,0,0,0,0,1,1,0,1,0,0,0,0,0,1,1,1,1,1,0,0,1,1,0,0,0,1,0},{2,3,7,13,20,24,39,49,53,58,72,80,90,99},{-48,44,60,-30,8,20,70,-50,80,-2,-28,-14},{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{64,13,18,3,22,29,51,45,21,13,47,15,17,34,60,99,30,54,16,47,13,49,60,66,28,57,85,66,65,7,62,29,9}};
vector<int> param1 {13,4,19,8,33,38,11,11,16,21};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
COUNT_FIBONACCI_NUMBERS_GIVEN_RANGE_LOG_TIME |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_FIBONACCI_NUMBERS_GIVEN_RANGE_LOG_TIME{
static int f_gold ( int low , int high ) {
int f1 = 0 , f2 = 1 , f3 = 1 ;
int result = 0 ;
while ( f1 <= high ) {
if ( f1 >= low ) result ++ ;
f1 = f2 ;
f2 = f3 ;
f3 = f1 + f2 ;
}
return result ;
}
| def f_gold ( low , high ) :
f1 , f2 , f3 = 0 , 1 , 1
result = 0
while ( f1 <= high ) :
if ( f1 >= low ) :
result += 1
f1 = f2
f2 = f3
f3 = f1 + f2
return result
|
using namespace std;
int f_gold ( int low, int high ) {
int f1 = 0, f2 = 1, f3 = 1;
int result = 0;
while ( f1 <= high ) {
if ( f1 >= low ) result ++;
f1 = f2;
f2 = f3;
f3 = f1 + f2;
}
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(76);
param0.add(96);
param0.add(19);
param0.add(36);
param0.add(60);
param0.add(20);
param0.add(76);
param0.add(63);
param0.add(2);
param0.add(41);
List<Integer> param1 = new ArrayList<>();
param1.add(43);
param1.add(52);
param1.add(79);
param1.add(2);
param1.add(11);
param1.add(15);
param1.add(4);
param1.add(93);
param1.add(25);
param1.add(39);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(76,43,),
(96,52,),
(19,79,),
(36,2,),
(60,11,),
(20,15,),
(76,4,),
(63,93,),
(2,25,),
(41,39,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {76,96,19,36,60,20,76,63,2,41};
vector<int> param1 {43,52,79,2,11,15,4,93,25,39};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MINIMUM_LENGTH_SUBARRAY_SUM_GREATER_GIVEN_VALUE_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_LENGTH_SUBARRAY_SUM_GREATER_GIVEN_VALUE_1{
static int f_gold ( int arr [ ] , int n , int x ) {
int curr_sum = 0 , min_len = n + 1 ;
int start = 0 , end = 0 ;
while ( end < n ) {
while ( curr_sum <= x && end < n ) {
if ( curr_sum <= 0 && x > 0 ) {
start = end ;
curr_sum = 0 ;
}
curr_sum += arr [ end ++ ] ;
}
while ( curr_sum > x && start < n ) {
if ( end - start < min_len ) min_len = end - start ;
curr_sum -= arr [ start ++ ] ;
}
}
return min_len ;
}
| def f_gold ( arr , n , x ) :
curr_sum = 0 ;
min_len = n + 1 ;
start = 0 ;
end = 0 ;
while ( end < n ) :
while ( curr_sum <= x and end < n ) :
if ( curr_sum <= 0 and x > 0 ) :
start = end ;
curr_sum = 0 ;
curr_sum += arr [ end ] ;
end += 1 ;
while ( curr_sum > x and start < n ) :
if ( end - start < min_len ) :
min_len = end - start ;
curr_sum -= arr [ start ] ;
start += 1 ;
return min_len ;
|
using namespace std;
int f_gold ( int arr [ ], int n, int x ) {
int curr_sum = 0, min_len = n + 1;
int start = 0, end = 0;
while ( end < n ) {
while ( curr_sum <= x && end < n ) {
if ( curr_sum <= 0 && x > 0 ) {
start = end;
curr_sum = 0;
}
curr_sum += arr [ end ++ ];
}
while ( curr_sum > x && start < n ) {
if ( end - start < min_len ) min_len = end - start;
curr_sum -= arr [ start ++ ];
}
}
return min_len;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,4,5,10,14,15,16,20,23,28,31,35,36,36,43,48,49,55,57,57,58,61,64,64,68,70,70,73,74,76,76,77,81,81,82,87,89,92,99});
param0.add(new int[]{66,-20,12,-48,22,28,40,-30,-6,-96,10,-88,40});
param0.add(new int[]{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});
param0.add(new int[]{28,19,38,31,17,27,60,35,19,47,34,51,3,95,33,29,84,46,74,87});
param0.add(new int[]{-48,-2});
param0.add(new int[]{1,1,0,1,1,1,1,0,1,0,1,1,0,1,1,0,1,1,0,1,1,1});
param0.add(new int[]{1,4,4,6,8,10,12,12,13,15,18,20,21,23,25,28,28,33,33,35,35,36,37,38,42,44,63,63,65,65,65,66,70,74,77,78,80,80,84,87,87,89,92,93,94,97,98,99});
param0.add(new int[]{-82,-12,-40,58,22,-76,-94,-28,42,36,64});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{76,65,96,76,1,91,22,29,95,21,73,68,30,52,73,86,52,66,67,37,76,53,68,6,95,81,98,42,63,38,92,78,59,86,10,38,18,15,52,62,16,66});
List<Integer> param1 = new ArrayList<>();
param1.add(33);
param1.add(11);
param1.add(42);
param1.add(15);
param1.add(1);
param1.add(12);
param1.add(42);
param1.add(10);
param1.add(10);
param1.add(23);
List<Integer> param2 = new ArrayList<>();
param2.add(28);
param2.add(12);
param2.add(23);
param2.add(15);
param2.add(1);
param2.add(15);
param2.add(27);
param2.add(6);
param2.add(14);
param2.add(35);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([2, 4, 5, 10, 14, 15, 16, 20, 23, 28, 31, 35, 36, 36, 43, 48, 49, 55, 57, 57, 58, 61, 64, 64, 68, 70, 70, 73, 74, 76, 76, 77, 81, 81, 82, 87, 89, 92, 99],33,28,),
([66, -20, 12, -48, 22, 28, 40, -30, -6, -96, 10, -88, 40],11,12,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],42,23,),
([28, 19, 38, 31, 17, 27, 60, 35, 19, 47, 34, 51, 3, 95, 33, 29, 84, 46, 74, 87],15,15,),
([-48, -2],1,1,),
([1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1],12,15,),
([1, 4, 4, 6, 8, 10, 12, 12, 13, 15, 18, 20, 21, 23, 25, 28, 28, 33, 33, 35, 35, 36, 37, 38, 42, 44, 63, 63, 65, 65, 65, 66, 70, 74, 77, 78, 80, 80, 84, 87, 87, 89, 92, 93, 94, 97, 98, 99],42,27,),
([-82, -12, -40, 58, 22, -76, -94, -28, 42, 36, 64],10,6,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],10,14,),
([76, 65, 96, 76, 1, 91, 22, 29, 95, 21, 73, 68, 30, 52, 73, 86, 52, 66, 67, 37, 76, 53, 68, 6, 95, 81, 98, 42, 63, 38, 92, 78, 59, 86, 10, 38, 18, 15, 52, 62, 16, 66],23,35,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,4,5,10,14,15,16,20,23,28,31,35,36,36,43,48,49,55,57,57,58,61,64,64,68,70,70,73,74,76,76,77,81,81,82,87,89,92,99},{66,-20,12,-48,22,28,40,-30,-6,-96,10,-88,40},{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},{28,19,38,31,17,27,60,35,19,47,34,51,3,95,33,29,84,46,74,87},{-48,-2},{1,1,0,1,1,1,1,0,1,0,1,1,0,1,1,0,1,1,0,1,1,1},{1,4,4,6,8,10,12,12,13,15,18,20,21,23,25,28,28,33,33,35,35,36,37,38,42,44,63,63,65,65,65,66,70,74,77,78,80,80,84,87,87,89,92,93,94,97,98,99},{-82,-12,-40,58,22,-76,-94,-28,42,36,64},{0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{76,65,96,76,1,91,22,29,95,21,73,68,30,52,73,86,52,66,67,37,76,53,68,6,95,81,98,42,63,38,92,78,59,86,10,38,18,15,52,62,16,66}};
vector<int> param1 {33,11,42,15,1,12,42,10,10,23};
vector<int> param2 {28,12,23,15,1,15,27,6,14,35};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],param2[i]) == f_gold(¶m0[i].front(),param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
DISTRIBUTING_ITEMS_PERSON_CANNOT_TAKE_TWO_ITEMS_TYPE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DISTRIBUTING_ITEMS_PERSON_CANNOT_TAKE_TWO_ITEMS_TYPE{
static boolean f_gold ( int [ ] arr , int n , int k ) {
int count ;
for ( int i = 0 ;
i < n ;
i ++ ) {
count = 0 ;
for ( int j = 0 ;
j < n ;
j ++ ) {
if ( arr [ j ] == arr [ i ] ) count ++ ;
if ( count > 2 * k ) return false ;
}
}
return true ;
}
| def f_gold ( arr , n , k ) :
for i in range ( n ) :
count = 0
for j in range ( n ) :
if arr [ j ] == arr [ i ] :
count += 1
if count > 2 * k :
return False
return True
|
using namespace std;
bool f_gold ( int arr [ ], int n, int k ) {
int count;
for ( int i = 0;
i < n;
i ++ ) {
count = 0;
for ( int j = 0;
j < n;
j ++ ) {
if ( arr [ j ] == arr [ i ] ) count ++;
if ( count > 2 * k ) return false;
}
}
return true;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,1,2,3,1});
param0.add(new int[]{2,3,3,5,3,3});
param0.add(new int[]{0,0,1,1,1});
param0.add(new int[]{7,60,78,91,80,75,85,21,41,63,1,84,69,13,94,25,54,54,52,68,53,35,17,37,98,27,2,31});
param0.add(new int[]{-96,-94,-82,-80,-78,-66,-36,-24,-18,-12,-2,-2,6,8,10,12,36,38,42,58,64,68,82,84,86,88,94});
param0.add(new int[]{0,1,1,1,0,0,0,0,1,0,0,0,1,0,0,1,1,1,1,1,1,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,0,0,1,1,1,0});
param0.add(new int[]{16,19,25,25,32,37,48,59,60,60,71,74,77,81,91,94});
param0.add(new int[]{-62,-94,72,-22,86,-80,64,98,-82,-50,12,-4,56,46,-80,2,-86,-44,-26,68,-94,-82,74,26,94,40,50,-40,-42,-10});
param0.add(new int[]{0,0,0,0,0,1,1,1});
param0.add(new int[]{83,57,2,47,70,22,49,51,25,57,32,7,8,99,6,86,24,79,42,43,1,24,68,11,24,12,43,40,14,45,11,46,12,80,66});
List<Integer> param1 = new ArrayList<>();
param1.add(5);
param1.add(6);
param1.add(2);
param1.add(24);
param1.add(24);
param1.add(34);
param1.add(10);
param1.add(20);
param1.add(5);
param1.add(21);
List<Integer> param2 = new ArrayList<>();
param2.add(2);
param2.add(2);
param2.add(1);
param2.add(2);
param2.add(3);
param2.add(2);
param2.add(8);
param2.add(4);
param2.add(2);
param2.add(33);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([1,1,2,3,1],5,2,),
([2,3,3,5,3,3],6,2,),
([0, 0, 1, 1, 1],2,1,),
([7, 60, 78, 91, 80, 75, 85, 21, 41, 63, 1, 84, 69, 13, 94, 25, 54, 54, 52, 68, 53, 35, 17, 37, 98, 27, 2, 31],24,2,),
([-96, -94, -82, -80, -78, -66, -36, -24, -18, -12, -2, -2, 6, 8, 10, 12, 36, 38, 42, 58, 64, 68, 82, 84, 86, 88, 94],24,3,),
([0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0],34,2,),
([16, 19, 25, 25, 32, 37, 48, 59, 60, 60, 71, 74, 77, 81, 91, 94],10,8,),
([-62, -94, 72, -22, 86, -80, 64, 98, -82, -50, 12, -4, 56, 46, -80, 2, -86, -44, -26, 68, -94, -82, 74, 26, 94, 40, 50, -40, -42, -10],20,4,),
([0, 0, 0, 0, 0, 1, 1, 1],5,2,),
([83, 57, 2, 47, 70, 22, 49, 51, 25, 57, 32, 7, 8, 99, 6, 86, 24, 79, 42, 43, 1, 24, 68, 11, 24, 12, 43, 40, 14, 45, 11, 46, 12, 80, 66],21,33,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,1,2,3,1},{2,3,3,5,3,3},{0,0,1,1,1},{7,60,78,91,80,75,85,21,41,63,1,84,69,13,94,25,54,54,52,68,53,35,17,37,98,27,2,31},{-96,-94,-82,-80,-78,-66,-36,-24,-18,-12,-2,-2,6,8,10,12,36,38,42,58,64,68,82,84,86,88,94},{0,1,1,1,0,0,0,0,1,0,0,0,1,0,0,1,1,1,1,1,1,0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,0,0,1,1,1,0},{16,19,25,25,32,37,48,59,60,60,71,74,77,81,91,94},{-62,-94,72,-22,86,-80,64,98,-82,-50,12,-4,56,46,-80,2,-86,-44,-26,68,-94,-82,74,26,94,40,50,-40,-42,-10},{0,0,0,0,0,1,1,1},{83,57,2,47,70,22,49,51,25,57,32,7,8,99,6,86,24,79,42,43,1,24,68,11,24,12,43,40,14,45,11,46,12,80,66}};
vector<int> param1 {5,6,2,24,24,34,10,20,5,21};
vector<int> param2 {2,2,1,2,3,2,8,4,2,33};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],param2[i]) == f_gold(¶m0[i].front(),param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
FIND_THE_FIRST_MISSING_NUMBER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THE_FIRST_MISSING_NUMBER{
static int f_gold ( int array [ ] , int start , int end ) {
if ( start > end ) return end + 1 ;
if ( start != array [ start ] ) return start ;
int mid = ( start + end ) / 2 ;
if ( array [ mid ] == mid ) return f_gold ( array , mid + 1 , end ) ;
return f_gold ( array , start , mid ) ;
}
| def f_gold ( array , start , end ) :
if ( start > end ) :
return end + 1
if ( start != array [ start ] ) :
return start ;
mid = int ( ( start + end ) / 2 )
if ( array [ mid ] == mid ) :
return f_gold ( array , mid + 1 , end )
return f_gold ( array , start , mid )
|
using namespace std;
int f_gold ( int array [ ], int start, int end ) {
if ( start > end ) return end + 1;
if ( start != array [ start ] ) return start;
int mid = ( start + end ) / 2;
if ( array [ mid ] == mid ) return f_gold ( array, mid + 1, end );
return f_gold ( array, start, mid );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,6,7,9,11,14,18,30,30,32,32,34,37,44,45,45,48,48,48,52,58,60,63,67,69,69,81,83,87,89,97,99});
param0.add(new int[]{88,-62,16,80,66,78,88,38,52,-96,48,98,96,-62,18,34,-58,30,-10,26,-98,48,-96,4,92,36,36,-36,-32,-70,62,-58,-58,-84,86,-98});
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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{79,99,79,85,61,58,62,61,39,87,39,74,36,70,30,43,20,52,54,50,81,98,42});
param0.add(new int[]{-98,-72,-46,-44,-42,-40,-16,-4,62,70,74});
param0.add(new int[]{1,1,0,1,0,0,0,0,1,1,0,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0});
param0.add(new int[]{58});
param0.add(new int[]{4,-84,-42,12,-50,42,-36,-38,-36,98,-2,20,6,-96,-78,24,34,88,0,74,0,-8,-86,-68,-42,98,-26,86,-70,-32,-82,78,46,58,84,4,-60,-90,-52,-78});
param0.add(new int[]{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});
param0.add(new int[]{8});
List<Integer> param1 = new ArrayList<>();
param1.add(24);
param1.add(19);
param1.add(26);
param1.add(20);
param1.add(8);
param1.add(26);
param1.add(0);
param1.add(37);
param1.add(28);
param1.add(0);
List<Integer> param2 = new ArrayList<>();
param2.add(18);
param2.add(26);
param2.add(28);
param2.add(20);
param2.add(10);
param2.add(23);
param2.add(0);
param2.add(31);
param2.add(28);
param2.add(0);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([3, 6, 7, 9, 11, 14, 18, 30, 30, 32, 32, 34, 37, 44, 45, 45, 48, 48, 48, 52, 58, 60, 63, 67, 69, 69, 81, 83, 87, 89, 97, 99],24,18,),
([88, -62, 16, 80, 66, 78, 88, 38, 52, -96, 48, 98, 96, -62, 18, 34, -58, 30, -10, 26, -98, 48, -96, 4, 92, 36, 36, -36, -32, -70, 62, -58, -58, -84, 86, -98],19,26,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],26,28,),
([79, 99, 79, 85, 61, 58, 62, 61, 39, 87, 39, 74, 36, 70, 30, 43, 20, 52, 54, 50, 81, 98, 42],20,20,),
([-98, -72, -46, -44, -42, -40, -16, -4, 62, 70, 74],8,10,),
([1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],26,23,),
([58],0,0,),
([4, -84, -42, 12, -50, 42, -36, -38, -36, 98, -2, 20, 6, -96, -78, 24, 34, 88, 0, 74, 0, -8, -86, -68, -42, 98, -26, 86, -70, -32, -82, 78, 46, 58, 84, 4, -60, -90, -52, -78],37,31,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],28,28,),
([8],0,0,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{3,6,7,9,11,14,18,30,30,32,32,34,37,44,45,45,48,48,48,52,58,60,63,67,69,69,81,83,87,89,97,99},{88,-62,16,80,66,78,88,38,52,-96,48,98,96,-62,18,34,-58,30,-10,26,-98,48,-96,4,92,36,36,-36,-32,-70,62,-58,-58,-84,86,-98},{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},{79,99,79,85,61,58,62,61,39,87,39,74,36,70,30,43,20,52,54,50,81,98,42},{-98,-72,-46,-44,-42,-40,-16,-4,62,70,74},{1,1,0,1,0,0,0,0,1,1,0,1,0,1,1,1,1,0,0,0,1,1,0,0,0,0,1,0,0,0,0,0,0},{58},{4,-84,-42,12,-50,42,-36,-38,-36,98,-2,20,6,-96,-78,24,34,88,0,74,0,-8,-86,-68,-42,98,-26,86,-70,-32,-82,78,46,58,84,4,-60,-90,-52,-78},{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},{8}};
vector<int> param1 {24,19,26,20,8,26,0,37,28,0};
vector<int> param2 {18,26,28,20,10,23,0,31,28,0};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],param2[i]) == f_gold(¶m0[i].front(),param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
SWAP_BITS_IN_A_GIVEN_NUMBER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SWAP_BITS_IN_A_GIVEN_NUMBER{
static int f_gold ( int x , int p1 , int p2 , int n ) {
int set1 = ( x >> p1 ) & ( ( 1 << n ) - 1 ) ;
int set2 = ( x >> p2 ) & ( ( 1 << n ) - 1 ) ;
int xor = ( set1 ^ set2 ) ;
xor = ( xor << p1 ) | ( xor << p2 ) ;
int result = x ^ xor ;
return result ;
}
| def f_gold ( x , p1 , p2 , n ) :
set1 = ( x >> p1 ) & ( ( 1 << n ) - 1 )
set2 = ( x >> p2 ) & ( ( 1 << n ) - 1 )
xor = ( set1 ^ set2 )
xor = ( xor << p1 ) | ( xor << p2 )
result = x ^ xor
return result
|
using namespace std;
int f_gold ( unsigned int x, unsigned int p1, unsigned int p2, unsigned int n ) {
unsigned int set1 = ( x >> p1 ) & ( ( 1U << n ) - 1 );
unsigned int set2 = ( x >> p2 ) & ( ( 1U << n ) - 1 );
unsigned int Xor = ( set1 ^ set2 );
Xor = ( Xor << p1 ) | ( Xor << p2 );
unsigned int result = x ^ Xor;
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(95);
param0.add(16);
param0.add(55);
param0.add(75);
param0.add(90);
param0.add(58);
param0.add(69);
param0.add(5);
param0.add(36);
param0.add(62);
List<Integer> param1 = new ArrayList<>();
param1.add(88);
param1.add(26);
param1.add(56);
param1.add(35);
param1.add(12);
param1.add(65);
param1.add(64);
param1.add(1);
param1.add(33);
param1.add(69);
List<Integer> param2 = new ArrayList<>();
param2.add(97);
param2.add(59);
param2.add(40);
param2.add(79);
param2.add(59);
param2.add(25);
param2.add(17);
param2.add(59);
param2.add(97);
param2.add(66);
List<Integer> param3 = new ArrayList<>();
param3.add(92);
param3.add(42);
param3.add(41);
param3.add(30);
param3.add(34);
param3.add(19);
param3.add(94);
param3.add(38);
param3.add(44);
param3.add(9);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i),param3.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(95,88,97,92,),
(16,26,59,42,),
(55,56,40,41,),
(75,35,79,30,),
(90,12,59,34,),
(58,65,25,19,),
(69,64,17,94,),
(5,1,59,38,),
(36,33,97,44,),
(62,69,66,9,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {95,16,55,75,90,58,69,5,36,62};
vector<int> param1 {88,26,56,35,12,65,64,1,33,69};
vector<int> param2 {97,59,40,79,59,25,17,59,97,66};
vector<int> param3 {92,42,41,30,34,19,94,38,44,9};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i],param3[i]) == f_gold(param0[i],param1[i],param2[i],param3[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MINIMUM_COST_CUT_BOARD_SQUARES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_COST_CUT_BOARD_SQUARES{
static int f_gold ( Integer X [ ] , Integer Y [ ] , int m , int n ) {
int res = 0 ;
Arrays . sort ( X , Collections . reverseOrder ( ) ) ;
Arrays . sort ( Y , Collections . reverseOrder ( ) ) ;
int hzntl = 1 , vert = 1 ;
int i = 0 , j = 0 ;
while ( i < m && j < n ) {
if ( X [ i ] > Y [ j ] ) {
res += X [ i ] * vert ;
hzntl ++ ;
i ++ ;
}
else {
res += Y [ j ] * hzntl ;
vert ++ ;
j ++ ;
}
}
int total = 0 ;
while ( i < m ) total += X [ i ++ ] ;
res += total * vert ;
total = 0 ;
while ( j < n ) total += Y [ j ++ ] ;
res += total * hzntl ;
return res ;
}
| def f_gold ( X , Y , m , n ) :
res = 0
X.sort ( reverse = True )
Y.sort ( reverse = True )
hzntl = 1 ; vert = 1
i = 0 ; j = 0
while ( i < m and j < n ) :
if ( X [ i ] > Y [ j ] ) :
res += X [ i ] * vert
hzntl += 1
i += 1
else :
res += Y [ j ] * hzntl
vert += 1
j += 1
total = 0
while ( i < m ) :
total += X [ i ]
i += 1
res += total * vert
total = 0
while ( j < n ) :
total += Y [ j ]
j += 1
res += total * hzntl
return res
|
using namespace std;
int f_gold ( int X [ ], int Y [ ], int m, int n ) {
int res = 0;
sort ( X, X + m, greater < int > ( ) );
sort ( Y, Y + n, greater < int > ( ) );
int hzntl = 1, vert = 1;
int i = 0, j = 0;
while ( i < m && j < n ) {
if ( X [ i ] > Y [ j ] ) {
res += X [ i ] * vert;
hzntl ++;
i ++;
}
else {
res += Y [ j ] * hzntl;
vert ++;
j ++;
}
}
int total = 0;
while ( i < m ) total += X [ i ++ ];
res += total * vert;
total = 0;
while ( j < n ) total += Y [ j ++ ];
res += total * hzntl;
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer [ ]> param0 = new ArrayList<>();
param0.add(new Integer[]{1,9,9,16,18,20,22,22,23,25,25,26,28,32,33,33,33,34,37,40,44,46,46,52,53,56,58,58,59,60,61,67,67,69,70,70,73,75,77,83,87,87,87,90,90,93,97,98});
param0.add(new Integer[]{-52,66,66,-4,-74,78,52,-72});
param0.add(new Integer[]{0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new Integer[]{58,78,48,44,63,37,89,76,66,83,52,97,19,28,67,38,54,77,2,96,28,87});
param0.add(new Integer[]{-84,-78,-76,-72,-68,-62,-62,-60,-58,-44,-34,-10,-8,-4,-2,-2,14,16,20,26,26,32,70,78,86,90,96});
param0.add(new Integer[]{0,1,1,0,0,1,1,0,1,0,1,0,1,1,1,1,1,0,0,1,1,1,1,0,0,0,1,1,0});
param0.add(new Integer[]{30,75});
param0.add(new Integer[]{70,78,-60,-10,-8,46,38,60,-54,-68,16,10,36,-10,38,-96,-52,-82,-56,22,-56,0,96,-60,24,70,40,62,-20,-36,74,32,44,14,-18,50,58});
param0.add(new Integer[]{0,0,0,1});
param0.add(new Integer[]{81,40,29,74,13,67,10,25,24,81,90});
List<Integer [ ]> param1 = new ArrayList<>();
param1.add(new Integer[]{2,3,9,10,13,16,17,19,20,23,25,27,29,30,30,35,37,39,39,45,47,50,55,55,55,56,59,60,62,63,67,70,70,71,72,73,73,74,77,86,87,88,91,92,95,96,97,99});
param1.add(new Integer[]{-40,30,-34,-76,84,88,-78,72});
param1.add(new Integer[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1});
param1.add(new Integer[]{37,36,26,5,83,75,33,33,72,63,91,94,75,92,9,19,79,29,40,47,63,36});
param1.add(new Integer[]{-98,-98,-86,-82,-76,-62,-60,-48,-32,-32,-24,-18,-10,-4,0,16,16,26,36,42,48,50,64,66,78,92,98});
param1.add(new Integer[]{1,0,1,1,1,0,1,1,1,0,1,0,1,1,0,0,0,1,1,1,1,0,1,1,1,0,0,1,0});
param1.add(new Integer[]{10,39});
param1.add(new Integer[]{64,-42,-50,-76,46,32,-66,86,-6,46,94,70,-62,90,78,4,6,-20,92,-18,-34,-96,92,-24,-90,-94,62,40,-14,-28,80,-86,-86,-56,40,-92,-22});
param1.add(new Integer[]{0,1,1,1});
param1.add(new Integer[]{51,45,23,7,53,14,49,58,25,75,74});
List<Integer> param2 = new ArrayList<>();
param2.add(25);
param2.add(6);
param2.add(15);
param2.add(13);
param2.add(15);
param2.add(25);
param2.add(1);
param2.add(19);
param2.add(2);
param2.add(8);
List<Integer> param3 = new ArrayList<>();
param3.add(27);
param3.add(7);
param3.add(19);
param3.add(14);
param3.add(24);
param3.add(26);
param3.add(1);
param3.add(19);
param3.add(2);
param3.add(10);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i),param3.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([1, 9, 9, 16, 18, 20, 22, 22, 23, 25, 25, 26, 28, 32, 33, 33, 33, 34, 37, 40, 44, 46, 46, 52, 53, 56, 58, 58, 59, 60, 61, 67, 67, 69, 70, 70, 73, 75, 77, 83, 87, 87, 87, 90, 90, 93, 97, 98],[2, 3, 9, 10, 13, 16, 17, 19, 20, 23, 25, 27, 29, 30, 30, 35, 37, 39, 39, 45, 47, 50, 55, 55, 55, 56, 59, 60, 62, 63, 67, 70, 70, 71, 72, 73, 73, 74, 77, 86, 87, 88, 91, 92, 95, 96, 97, 99],25,27,),
([-52, 66, 66, -4, -74, 78, 52, -72],[-40, 30, -34, -76, 84, 88, -78, 72],6,7,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],15,19,),
([58, 78, 48, 44, 63, 37, 89, 76, 66, 83, 52, 97, 19, 28, 67, 38, 54, 77, 2, 96, 28, 87],[37, 36, 26, 5, 83, 75, 33, 33, 72, 63, 91, 94, 75, 92, 9, 19, 79, 29, 40, 47, 63, 36],13,14,),
([-84, -78, -76, -72, -68, -62, -62, -60, -58, -44, -34, -10, -8, -4, -2, -2, 14, 16, 20, 26, 26, 32, 70, 78, 86, 90, 96],[-98, -98, -86, -82, -76, -62, -60, -48, -32, -32, -24, -18, -10, -4, 0, 16, 16, 26, 36, 42, 48, 50, 64, 66, 78, 92, 98],15,24,),
([0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0],[1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0],25,26,),
([30, 75],[10, 39],1,1,),
([70, 78, -60, -10, -8, 46, 38, 60, -54, -68, 16, 10, 36, -10, 38, -96, -52, -82, -56, 22, -56, 0, 96, -60, 24, 70, 40, 62, -20, -36, 74, 32, 44, 14, -18, 50, 58],[64, -42, -50, -76, 46, 32, -66, 86, -6, 46, 94, 70, -62, 90, 78, 4, 6, -20, 92, -18, -34, -96, 92, -24, -90, -94, 62, 40, -14, -28, 80, -86, -86, -56, 40, -92, -22],19,19,),
([0, 0, 0, 1],[0, 1, 1, 1],2,2,),
([81, 40, 29, 74, 13, 67, 10, 25, 24, 81, 90],[51, 45, 23, 7, 53, 14, 49, 58, 25, 75, 74],8,10,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,9,9,16,18,20,22,22,23,25,25,26,28,32,33,33,33,34,37,40,44,46,46,52,53,56,58,58,59,60,61,67,67,69,70,70,73,75,77,83,87,87,87,90,90,93,97,98},{-52,66,66,-4,-74,78,52,-72},{0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1},{58,78,48,44,63,37,89,76,66,83,52,97,19,28,67,38,54,77,2,96,28,87},{-84,-78,-76,-72,-68,-62,-62,-60,-58,-44,-34,-10,-8,-4,-2,-2,14,16,20,26,26,32,70,78,86,90,96},{0,1,1,0,0,1,1,0,1,0,1,0,1,1,1,1,1,0,0,1,1,1,1,0,0,0,1,1,0},{30,75},{70,78,-60,-10,-8,46,38,60,-54,-68,16,10,36,-10,38,-96,-52,-82,-56,22,-56,0,96,-60,24,70,40,62,-20,-36,74,32,44,14,-18,50,58},{0,0,0,1},{81,40,29,74,13,67,10,25,24,81,90}};
vector<vector<int>> param1 {{2,3,9,10,13,16,17,19,20,23,25,27,29,30,30,35,37,39,39,45,47,50,55,55,55,56,59,60,62,63,67,70,70,71,72,73,73,74,77,86,87,88,91,92,95,96,97,99},{-40,30,-34,-76,84,88,-78,72},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{37,36,26,5,83,75,33,33,72,63,91,94,75,92,9,19,79,29,40,47,63,36},{-98,-98,-86,-82,-76,-62,-60,-48,-32,-32,-24,-18,-10,-4,0,16,16,26,36,42,48,50,64,66,78,92,98},{1,0,1,1,1,0,1,1,1,0,1,0,1,1,0,0,0,1,1,1,1,0,1,1,1,0,0,1,0},{10,39},{64,-42,-50,-76,46,32,-66,86,-6,46,94,70,-62,90,78,4,6,-20,92,-18,-34,-96,92,-24,-90,-94,62,40,-14,-28,80,-86,-86,-56,40,-92,-22},{0,1,1,1},{51,45,23,7,53,14,49,58,25,75,74}};
vector<int> param2 {25,6,15,13,15,25,1,19,2,8};
vector<int> param3 {27,7,19,14,24,26,1,19,2,10};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),¶m1[i].front(),param2[i],param3[i]) == f_gold(¶m0[i].front(),¶m1[i].front(),param2[i],param3[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
SUM_MANHATTAN_DISTANCES_PAIRS_POINTS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_MANHATTAN_DISTANCES_PAIRS_POINTS{
static int f_gold ( int x [ ] , int y [ ] , int n ) {
int sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = i + 1 ;
j < n ;
j ++ ) sum += ( Math . abs ( x [ i ] - x [ j ] ) + Math . abs ( y [ i ] - y [ j ] ) ) ;
return sum ;
}
| def f_gold(x, y, n):
sum = 0
for i in range(n):
for j in range(i + 1, n):
sum += (abs(x[i] - x[j]) + abs(y[i] - y[j]))
return sum
|
using namespace std;
int f_gold ( int x [ ], int y [ ], int n ) {
int sum = 0;
for ( int i = 0;
i < n;
i ++ ) for ( int j = i + 1;
j < n;
j ++ ) sum += ( abs ( x [ i ] - x [ j ] ) + abs ( y [ i ] - y [ j ] ) );
return sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,4,6,6,8,11,12,13,14,19,20,22,24,28,29,30,32,35,37,44,48,49,51,51,56,59,59,62,65,68,68,68,72,75,77,78,89,89,91,93,95,99});
param0.add(new int[]{16,76,2,42,-24,-82,68,-2,98,-42,-72,28,-22,-52,28,-38,36,66,84,64,-28,86,52,84,-98,-30});
param0.add(new int[]{0,0,0,0,0,1,1,1,1,1});
param0.add(new int[]{61,37,57,99,22,72,38,85,23,85,15,4,49,9,15,25,7,63,79,6,85,30,12,34,38,6,59,62,59,34,72,97,70,44,95,58,99});
param0.add(new int[]{-96,-86,-82,-72,-72,-64,-62,-60,-56,-56,-56,-54,-52,-40,-36,-30,-10,10,18,26,28,56,56,56,64,90,92,94});
param0.add(new int[]{1,0,1,1,1,0,1});
param0.add(new int[]{6,10,24,25,31,41,43,45,47,65,67,90});
param0.add(new int[]{-74,92,34,56,-54,-98,-76,-34,16,32,-4,-16,22,90,-52,-90,-60,70,-40,78,96,-68,78,-56,-94});
param0.add(new int[]{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});
param0.add(new int[]{20,32});
List<int [ ]> param1 = new ArrayList<>();
param1.add(new int[]{6,19,19,22,25,27,31,33,34,35,37,38,38,44,46,50,51,55,58,58,64,64,64,64,65,66,66,66,67,70,75,78,79,81,81,81,82,84,84,86,94,96});
param1.add(new int[]{-34,92,-24,-62,28,72,-10,10,8,90,-72,-24,50,-46,52,58,68,-62,-64,-78,-12,24,62,-30,62,-60});
param1.add(new int[]{0,0,0,0,1,1,1,1,1,1});
param1.add(new int[]{72,41,77,62,78,36,75,28,91,39,32,56,60,64,21,15,80,85,28,22,53,58,69,62,60,48,66,91,38,66,54,5,24,1,49,71,49});
param1.add(new int[]{-98,-98,-96,-96,-82,-80,-80,-68,-62,-60,-46,-38,-26,-26,-20,-18,16,22,24,26,34,46,52,52,74,76,90,92});
param1.add(new int[]{1,0,1,0,0,1,1});
param1.add(new int[]{4,7,11,19,21,39,57,80,84,93,94,97});
param1.add(new int[]{14,20,24,-92,58,12,78,78,-90,96,-44,36,30,-46,-30,-80,26,-2,26,28,-16,-50,-2,-36,-8});
param1.add(new int[]{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});
param1.add(new int[]{23,50});
List<Integer> param2 = new ArrayList<>();
param2.add(37);
param2.add(24);
param2.add(5);
param2.add(26);
param2.add(26);
param2.add(3);
param2.add(10);
param2.add(21);
param2.add(23);
param2.add(1);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([2, 4, 6, 6, 8, 11, 12, 13, 14, 19, 20, 22, 24, 28, 29, 30, 32, 35, 37, 44, 48, 49, 51, 51, 56, 59, 59, 62, 65, 68, 68, 68, 72, 75, 77, 78, 89, 89, 91, 93, 95, 99], [
6, 19, 19, 22, 25, 27, 31, 33, 34, 35, 37, 38, 38, 44, 46, 50, 51, 55, 58, 58, 64, 64, 64, 64, 65, 66, 66, 66, 67, 70, 75, 78, 79, 81, 81, 81, 82, 84, 84, 86, 94, 96], 37,),
([16, 76, 2, 42, -24, -82, 68, -2, 98, -42, -72, 28, -22, -52, 28, -38, 36, 66, 84, 64, -28, 86, 52, 84, -98, -30],
[-34, 92, -24, -62, 28, 72, -10, 10, 8, 90, -72, -24, 50, -46, 52, 58, 68, -62, -64, -78, -12, 24, 62, -30, 62, -60], 24,),
([0, 0, 0, 0, 0, 1, 1, 1, 1, 1], [0, 0, 0, 0, 1, 1, 1, 1, 1, 1], 5,),
([61, 37, 57, 99, 22, 72, 38, 85, 23, 85, 15, 4, 49, 9, 15, 25, 7, 63, 79, 6, 85, 30, 12, 34, 38, 6, 59, 62, 59, 34, 72, 97, 70, 44, 95, 58, 99], [
72, 41, 77, 62, 78, 36, 75, 28, 91, 39, 32, 56, 60, 64, 21, 15, 80, 85, 28, 22, 53, 58, 69, 62, 60, 48, 66, 91, 38, 66, 54, 5, 24, 1, 49, 71, 49], 26,),
([-96, -86, -82, -72, -72, -64, -62, -60, -56, -56, -56, -54, -52, -40, -36, -30, -10, 10, 18, 26, 28, 56, 56, 56, 64, 90, 92, 94],
[-98, -98, -96, -96, -82, -80, -80, -68, -62, -60, -46, -38, -26, -26, -20, -18, 16, 22, 24, 26, 34, 46, 52, 52, 74, 76, 90, 92], 26,),
([1, 0, 1, 1, 1, 0, 1], [1, 0, 1, 0, 0, 1, 1], 3,),
([6, 10, 24, 25, 31, 41, 43, 45, 47, 65, 67, 90], [
4, 7, 11, 19, 21, 39, 57, 80, 84, 93, 94, 97], 10,),
([-74, 92, 34, 56, -54, -98, -76, -34, 16, 32, -4, -16, 22, 90, -52, -90, -60, 70, -40, 78, 96, -68, 78, -56, -94],
[14, 20, 24, -92, 58, 12, 78, 78, -90, 96, -44, 36, 30, -46, -30, -80, 26, -2, 26, 28, -16, -50, -2, -36, -8], 21,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 23,),
([20, 32], [23, 50], 1,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success += 1
print("#Results: %i, %i" % (n_success, len(param)))
|
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,4,6,6,8,11,12,13,14,19,20,22,24,28,29,30,32,35,37,44,48,49,51,51,56,59,59,62,65,68,68,68,72,75,77,78,89,89,91,93,95,99},{16,76,2,42,-24,-82,68,-2,98,-42,-72,28,-22,-52,28,-38,36,66,84,64,-28,86,52,84,-98,-30},{0,0,0,0,0,1,1,1,1,1},{61,37,57,99,22,72,38,85,23,85,15,4,49,9,15,25,7,63,79,6,85,30,12,34,38,6,59,62,59,34,72,97,70,44,95,58,99},{-96,-86,-82,-72,-72,-64,-62,-60,-56,-56,-56,-54,-52,-40,-36,-30,-10,10,18,26,28,56,56,56,64,90,92,94},{1,0,1,1,1,0,1},{6,10,24,25,31,41,43,45,47,65,67,90},{-74,92,34,56,-54,-98,-76,-34,16,32,-4,-16,22,90,-52,-90,-60,70,-40,78,96,-68,78,-56,-94},{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},{20,32}};
vector<vector<int>> param1 {{6,19,19,22,25,27,31,33,34,35,37,38,38,44,46,50,51,55,58,58,64,64,64,64,65,66,66,66,67,70,75,78,79,81,81,81,82,84,84,86,94,96},{-34,92,-24,-62,28,72,-10,10,8,90,-72,-24,50,-46,52,58,68,-62,-64,-78,-12,24,62,-30,62,-60},{0,0,0,0,1,1,1,1,1,1},{72,41,77,62,78,36,75,28,91,39,32,56,60,64,21,15,80,85,28,22,53,58,69,62,60,48,66,91,38,66,54,5,24,1,49,71,49},{-98,-98,-96,-96,-82,-80,-80,-68,-62,-60,-46,-38,-26,-26,-20,-18,16,22,24,26,34,46,52,52,74,76,90,92},{1,0,1,0,0,1,1},{4,7,11,19,21,39,57,80,84,93,94,97},{14,20,24,-92,58,12,78,78,-90,96,-44,36,30,-46,-30,-80,26,-2,26,28,-16,-50,-2,-36,-8},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{23,50}};
vector<int> param2 {37,24,5,26,26,3,10,21,23,1};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),¶m1[i].front(),param2[i]) == f_gold(¶m0[i].front(),¶m1[i].front(),param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
FIND_INDEX_GIVEN_FIBONACCI_NUMBER_CONSTANT_TIME_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_INDEX_GIVEN_FIBONACCI_NUMBER_CONSTANT_TIME_1{
static int f_gold ( int n ) {
float fibo = 2.078087F * ( float ) Math . log ( n ) + 1.672276F ;
return Math . round ( fibo ) ;
}
| import math
def f_gold ( n ) :
fibo = 2.078087 * math.log ( n ) + 1.672276
return round ( fibo )
|
using namespace std;
int f_gold ( int n ) {
float fibo = 2.078087 * log ( n ) + 1.672276;
return round ( fibo );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(20);
param0.add(95);
param0.add(39);
param0.add(21);
param0.add(94);
param0.add(79);
param0.add(56);
param0.add(62);
param0.add(23);
param0.add(3);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(20,),
(95,),
(39,),
(21,),
(94,),
(79,),
(56,),
(62,),
(23,),
(3,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {20,95,39,21,94,79,56,62,23,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();
return 0;
} |
COUNT_ENTRIES_EQUAL_TO_X_IN_A_SPECIAL_MATRIX |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_ENTRIES_EQUAL_TO_X_IN_A_SPECIAL_MATRIX{
static int f_gold ( int n , int x ) {
int f_gold = 0 ;
for ( int i = 1 ;
i <= n && i <= x ;
i ++ ) {
if ( x / i <= n && x % i == 0 ) f_gold ++ ;
}
return f_gold ;
}
| def f_gold ( n , x ) :
cnt = 0
for i in range ( 1 , n + 1 ) :
if i <= x :
if x // i <= n and x % i == 0 :
cnt += 1
return cnt
| null |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(47);
param0.add(57);
param0.add(55);
param0.add(11);
param0.add(55);
param0.add(63);
param0.add(64);
param0.add(28);
param0.add(49);
param0.add(48);
List<Integer> param1 = new ArrayList<>();
param1.add(30);
param1.add(16);
param1.add(63);
param1.add(23);
param1.add(49);
param1.add(64);
param1.add(98);
param1.add(30);
param1.add(61);
param1.add(64);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(47,30,),
(57,16,),
(55,63,),
(11,23,),
(55,49,),
(63,64,),
(64,98,),
(28,30,),
(49,61,),
(48,64,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) | null |
LONGEST_CONSECUTIVE_SUBSEQUENCE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LONGEST_CONSECUTIVE_SUBSEQUENCE{
static int f_gold ( int arr [ ] , int n ) {
HashSet < Integer > S = new HashSet < Integer > ( ) ;
int ans = 0 ;
for ( int i = 0 ;
i < n ;
++ i ) S . add ( arr [ i ] ) ;
for ( int i = 0 ;
i < n ;
++ i ) {
if ( ! S . contains ( arr [ i ] - 1 ) ) {
int j = arr [ i ] ;
while ( S . contains ( j ) ) j ++ ;
if ( ans < j - arr [ i ] ) ans = j - arr [ i ] ;
}
}
return ans ;
}
| null |
using namespace std;
int f_gold ( int arr [ ], int n ) {
unordered_set < int > S;
int ans = 0;
for ( int i = 0;
i < n;
i ++ ) S . insert ( arr [ i ] );
for ( int i = 0;
i < n;
i ++ ) {
if ( S . find ( arr [ i ] - 1 ) == S . end ( ) ) {
int j = arr [ i ];
while ( S . find ( j ) != S . end ( ) ) j ++;
ans = max ( ans, j - arr [ i ] );
}
}
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,28,31,64,73});
param0.add(new int[]{46,26,-84,-24,50,94,-14,74,-52,-62,2,46,62,54,-30,-70,-76,74,60,10,60,98,-92,98,-96,34,30,58,-60,-52,-66,-40,-78,-26,80,-58,-26,80,92,66,90,4,46,-78,80,62,30,0,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,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{24,72,87,81,90,59,18,29,12,24,78,59,93,80,79,26,17,28,43,85,85,76,83,71,28,99,80,14,9,92,46,59,66,34});
param0.add(new int[]{-94,-94,-94,-76,-68,-64,-64,-56,-48,-46,-36,-26,-12,-6,-6,-2,-2,6,6,24,46,48,50,52,58,76,88});
param0.add(new int[]{1});
param0.add(new int[]{1,8,22,27,28,58,80,89,95});
param0.add(new int[]{46,38,-50,98,-22,92,84,-48});
param0.add(new int[]{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});
param0.add(new int[]{74,2,85,72,1,49,53,48,46,44,98,75,5,13,98,69,65,68,37,38,77,69,14,17,46,54,55,20,23,59,98,44,22,12,71,18,94,49,57,82,7,64,33,7,29,58,45,98});
List<Integer> param1 = new ArrayList<>();
param1.add(3);
param1.add(29);
param1.add(38);
param1.add(32);
param1.add(19);
param1.add(0);
param1.add(5);
param1.add(6);
param1.add(19);
param1.add(36);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,28,31,64,73},{46,26,-84,-24,50,94,-14,74,-52,-62,2,46,62,54,-30,-70,-76,74,60,10,60,98,-92,98,-96,34,30,58,-60,-52,-66,-40,-78,-26,80,-58,-26,80,92,66,90,4,46,-78,80,62,30,0,38},{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},{24,72,87,81,90,59,18,29,12,24,78,59,93,80,79,26,17,28,43,85,85,76,83,71,28,99,80,14,9,92,46,59,66,34},{-94,-94,-94,-76,-68,-64,-64,-56,-48,-46,-36,-26,-12,-6,-6,-2,-2,6,6,24,46,48,50,52,58,76,88},{1},{1,8,22,27,28,58,80,89,95},{46,38,-50,98,-22,92,84,-48},{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},{74,2,85,72,1,49,53,48,46,44,98,75,5,13,98,69,65,68,37,38,77,69,14,17,46,54,55,20,23,59,98,44,22,12,71,18,94,49,57,82,7,64,33,7,29,58,45,98}};
vector<int> param1 {3,29,38,32,19,0,5,6,19,36};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
CALCULATING_FACTORIALS_USING_STIRLING_APPROXIMATION |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CALCULATING_FACTORIALS_USING_STIRLING_APPROXIMATION{
public static int f_gold ( double n ) {
if ( n == 1 ) return 1 ;
double z ;
double e = 2.71 ;
z = Math . sqrt ( 2 * 3.14 * n ) * Math . pow ( ( n / e ) , n ) ;
return ( int ) ( z ) ;
}
| null |
using namespace std;
long int f_gold ( int n ) {
if ( n == 1 ) return 1;
long int z;
float e = 2.71;
z = sqrt ( 2 * 3.14 * n ) * pow ( ( n / e ), n );
return z;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Double> param0 = new ArrayList<>();
param0.add(1.0);
param0.add(5.0);
param0.add(10.0);
param0.add(20.0);
param0.add(40.0);
param0.add(2.0);
param0.add(3.0);
param0.add(-1.0);
param0.add(4663.43115050185);
param0.add(-3722.039522409859);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} | null |
int main() {
int n_success = 0;
vector<double> param0 {1.0,5.0,10.0,20.0,40.0,2.0,3.0,-1.0,4663.43115050185,-3722.039522409859};
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();
return 0;
} |
SPLIT_N_MAXIMUM_COMPOSITE_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SPLIT_N_MAXIMUM_COMPOSITE_NUMBERS{
static int f_gold ( int n ) {
if ( n < 4 ) return - 1 ;
int rem = n % 4 ;
if ( rem == 0 ) return n / 4 ;
if ( rem == 1 ) {
if ( n < 9 ) return - 1 ;
return ( n - 9 ) / 4 + 1 ;
}
if ( rem == 2 ) return ( n - 6 ) / 4 + 1 ;
if ( rem == 3 ) {
if ( n < 15 ) return - 1 ;
return ( n - 15 ) / 4 + 2 ;
}
return 0 ;
}
| def f_gold(n):
if (n < 4):
return - 1
rem = n % 4
if (rem == 0):
return n // 4
if (rem == 1):
if (n < 9):
return - 1
return (n - 9) // 4 + 1
if (rem == 2):
return (n - 6) // 4 + 1
if (rem == 3):
if (n < 15):
return - 1
return (n - 15) // 4 + 2
|
using namespace std;
int f_gold ( int n ) {
if ( n < 4 ) return - 1;
int rem = n % 4;
if ( rem == 0 ) return n / 4;
if ( rem == 1 ) {
if ( n < 9 ) return - 1;
return ( n - 9 ) / 4 + 1;
}
if ( rem == 2 ) return ( n - 6 ) / 4 + 1;
if ( rem == 3 ) {
if ( n < 15 ) return - 1;
return ( n - 15 ) / 4 + 2;
}
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(55);
param0.add(35);
param0.add(24);
param0.add(75);
param0.add(5);
param0.add(7);
param0.add(50);
param0.add(28);
param0.add(67);
param0.add(59);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(55,),
(35,),
(24,),
(75,),
(5,),
(7,),
(50,),
(28,),
(67,),
(59,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success += 1
print("#Results: %i, %i" % (n_success, len(param)))
|
int main() {
int n_success = 0;
vector<int> param0 {55,35,24,75,5,7,50,28,67,59};
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();
return 0;
} |
MAXIMUM_LENGTH_PREFIX_ONE_STRING_OCCURS_SUBSEQUENCE_ANOTHER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_LENGTH_PREFIX_ONE_STRING_OCCURS_SUBSEQUENCE_ANOTHER{
static int f_gold ( String s , String t ) {
int count = 0 ;
for ( int i = 0 ;
i < t . length ( ) ;
i ++ ) {
if ( count == t . length ( ) ) break ;
if ( t . charAt ( i ) == s . charAt ( count ) ) count ++ ;
}
return count ;
}
| def f_gold ( s , t ) :
count = 0
for i in range ( 0 , len ( t ) ) :
if ( count == len ( s ) ) :
break
if ( t [ i ] == s [ count ] ) :
count = count + 1
return count
|
using namespace std;
int f_gold ( char s [ ], char t [ ] ) {
int count = 0;
for ( int i = 0;
i < strlen ( t );
i ++ ) {
if ( count == strlen ( s ) ) break;
if ( t [ i ] == s [ count ] ) count ++;
}
return count;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("nObYIOjEQZ");
param0.add("84574");
param0.add("1010001010010");
param0.add("DjZtAfUudk");
param0.add("550");
param0.add("1110");
param0.add("GywyxwH");
param0.add("67318370914755");
param0.add("11011000000101");
param0.add("G");
List<String> param1 = new ArrayList<>();
param1.add("uARTDTQbmGI");
param1.add("8538229");
param1.add("11");
param1.add("OewGm");
param1.add("132744553919");
param1.add("0101");
param1.add("LPQqEqrDZiwY");
param1.add("9928");
param1.add("00000");
param1.add("V");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('nObYIOjEQZ','uARTDTQbmGI',),
('84574','8538229',),
('1010001010010','11',),
('DjZtAfUudk','OewGm',),
('550','132744553919',),
('1110','0101',),
('GywyxwH','LPQqEqrDZiwY',),
('67318370914755','9928',),
('11011000000101','00000',),
('G','V',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<string> param0 {"nObYIOjEQZ","84574","1010001010010","DjZtAfUudk","550","1110","GywyxwH","67318370914755","11011000000101","G"};
vector<string> param1 {"uARTDTQbmGI","8538229","11","OewGm","132744553919","0101","LPQqEqrDZiwY","9928","00000","V"};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),¶m1[i].front()) == f_gold(¶m0[i].front(),¶m1[i].front()))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
SMALLEST_DIFFERENCE_PAIR_VALUES_TWO_UNSORTED_ARRAYS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SMALLEST_DIFFERENCE_PAIR_VALUES_TWO_UNSORTED_ARRAYS{
static int f_gold ( int A [ ] , int B [ ] , int m , int n ) {
Arrays . sort ( A ) ;
Arrays . sort ( B ) ;
int a = 0 , b = 0 ;
int result = Integer . MAX_VALUE ;
while ( a < m && b < n ) {
if ( Math . abs ( A [ a ] - B [ b ] ) < result ) result = Math . abs ( A [ a ] - B [ b ] ) ;
if ( A [ a ] < B [ b ] ) a ++ ;
else b ++ ;
}
return result ;
}
| import sys
def f_gold(A, B, m, n):
A.sort()
B.sort()
a = 0
b = 0
result = sys.maxsize
while (a < m and b < n):
if (abs(A[a] - B[b]) < result):
result = abs(A[a] - B[b])
if (A[a] < B[b]):
a += 1
else:
b += 1
return result
|
using namespace std;
int f_gold ( int A [ ], int B [ ], int m, int n ) {
sort ( A, A + m );
sort ( B, B + n );
int a = 0, b = 0;
int result = INT_MAX;
while ( a < m && b < n ) {
if ( abs ( A [ a ] - B [ b ] ) < result ) result = abs ( A [ a ] - B [ b ] );
if ( A [ a ] < B [ b ] ) a ++;
else b ++;
}
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,2,11,13,18,18,23,25,28,28,37,39,53,56,67,70,74,74,75,79,80,82,84,89,94,95,95,98,98});
param0.add(new int[]{-78,10,-8,30,-70,-94,-48,-4,-22,-40,-36,-48,-4,86,-50,62,-72,-44,-62,22,-30,-72,6,-24,-78,72,-44,56,38,-36,0,-72,-10,-12,-70,-64,-24});
param0.add(new int[]{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});
param0.add(new int[]{57,82,90,9,61,71,15,2,39,24,28,28,47});
param0.add(new int[]{-92,-90,-90,-28,-16,-14,-14,-8,42,52,62,84});
param0.add(new int[]{1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,1,1,1,0,0,1,1,0,0,1,0,1,0,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,0});
param0.add(new int[]{6,7,7,12,15,15,21,24,26,26,28,36,38,42,46,52,55,56,59,62,63,65,65,66,68,71,73,77,77,77,77,85,87,87,88,90,93,94,98});
param0.add(new int[]{-68,44,88,-68,22,34,-82,18,-60,30,24,18,78,90,-20,-60,94,70,4,-16,-38});
param0.add(new int[]{0,0,1});
param0.add(new int[]{14,7,9,71,37,20,85,62,70,67,26,47,61,99,2,90,70,46,53,16,56,7,15,81,85,94,73,40,35,58,21,98,45});
List<int [ ]> param1 = new ArrayList<>();
param1.add(new int[]{5,6,11,13,13,16,17,19,23,25,28,31,31,39,41,44,45,52,62,64,70,71,73,78,78,79,85,86,92});
param1.add(new int[]{78,-80,-24,-50,-26,-62,26,-12,22,-90,84,10,18,62,26,-68,92,64,-52,76,-84,64,50,36,-24,-98,42,72,-78,-98,-24,86,2,60,-30,14,-42});
param1.add(new int[]{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});
param1.add(new int[]{85,92,84,27,54,77,26,49,47,51,70,11,41});
param1.add(new int[]{-98,-98,-58,-6,14,16,18,46,52,52,52,56});
param1.add(new int[]{0,1,1,1,0,0,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1});
param1.add(new int[]{1,3,4,4,6,7,8,8,15,17,18,18,20,23,23,24,25,25,26,33,39,43,46,54,59,67,69,69,69,69,76,76,81,81,85,86,86,91,95});
param1.add(new int[]{-18,-30,-74,-50,98,-44,-62,-20,18,84,62,-64,-2,62,-32,-34,-14,-52,-36,-60,-68});
param1.add(new int[]{0,0,1});
param1.add(new int[]{99,72,29,55,88,1,88,19,7,80,79,18,28,41,48,49,67,27,24,94,86,14,45,84,37,71,92,98,16,64,67,44,29});
List<Integer> param2 = new ArrayList<>();
param2.add(28);
param2.add(23);
param2.add(14);
param2.add(7);
param2.add(11);
param2.add(35);
param2.add(30);
param2.add(16);
param2.add(2);
param2.add(20);
List<Integer> param3 = new ArrayList<>();
param3.add(14);
param3.add(33);
param3.add(16);
param3.add(8);
param3.add(6);
param3.add(33);
param3.add(20);
param3.add(12);
param3.add(1);
param3.add(25);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i),param3.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([2, 2, 11, 13, 18, 18, 23, 25, 28, 28, 37, 39, 53, 56, 67, 70, 74, 74, 75, 79, 80, 82, 84, 89, 94, 95, 95, 98, 98], [
5, 6, 11, 13, 13, 16, 17, 19, 23, 25, 28, 31, 31, 39, 41, 44, 45, 52, 62, 64, 70, 71, 73, 78, 78, 79, 85, 86, 92], 28, 14,),
([-78, 10, -8, 30, -70, -94, -48, -4, -22, -40, -36, -48, -4, 86, -50, 62, -72, -44, -62, 22, -30, -72, 6, -24, -78, 72, -44, 56, 38, -36, 0, -72, -10, -12, -70, -64, -24],
[78, -80, -24, -50, -26, -62, 26, -12, 22, -90, 84, 10, 18, 62, 26, -68, 92, 64, -52, 76, -84, 64, 50, 36, -24, -98, 42, 72, -78, -98, -24, 86, 2, 60, -30, 14, -42], 23, 33,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 14, 16,),
([57, 82, 90, 9, 61, 71, 15, 2, 39, 24, 28, 28, 47], [
85, 92, 84, 27, 54, 77, 26, 49, 47, 51, 70, 11, 41], 7, 8,),
([-92, -90, -90, -28, -16, -14, -14, -8, 42, 52, 62, 84],
[-98, -98, -58, -6, 14, 16, 18, 46, 52, 52, 52, 56], 11, 6,),
([1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0], [
0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1], 35, 33,),
([6, 7, 7, 12, 15, 15, 21, 24, 26, 26, 28, 36, 38, 42, 46, 52, 55, 56, 59, 62, 63, 65, 65, 66, 68, 71, 73, 77, 77, 77, 77, 85, 87, 87, 88, 90, 93, 94, 98], [
1, 3, 4, 4, 6, 7, 8, 8, 15, 17, 18, 18, 20, 23, 23, 24, 25, 25, 26, 33, 39, 43, 46, 54, 59, 67, 69, 69, 69, 69, 76, 76, 81, 81, 85, 86, 86, 91, 95], 30, 20,),
([-68, 44, 88, -68, 22, 34, -82, 18, -60, 30, 24, 18, 78, 90, -20, -60, 94, 70, 4, -16, -38], [-18, -
30, -74, -50, 98, -44, -62, -20, 18, 84, 62, -64, -2, 62, -32, -34, -14, -52, -36, -60, -68], 16, 12,),
([0, 0, 1], [0, 0, 1], 2, 1,),
([14, 7, 9, 71, 37, 20, 85, 62, 70, 67, 26, 47, 61, 99, 2, 90, 70, 46, 53, 16, 56, 7, 15, 81, 85, 94, 73, 40, 35, 58, 21, 98, 45], [
99, 72, 29, 55, 88, 1, 88, 19, 7, 80, 79, 18, 28, 41, 48, 49, 67, 27, 24, 94, 86, 14, 45, 84, 37, 71, 92, 98, 16, 64, 67, 44, 29], 20, 25,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success += 1
print("#Results: %i, %i" % (n_success, len(param)))
|
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,2,11,13,18,18,23,25,28,28,37,39,53,56,67,70,74,74,75,79,80,82,84,89,94,95,95,98,98},{-78,10,-8,30,-70,-94,-48,-4,-22,-40,-36,-48,-4,86,-50,62,-72,-44,-62,22,-30,-72,6,-24,-78,72,-44,56,38,-36,0,-72,-10,-12,-70,-64,-24},{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},{57,82,90,9,61,71,15,2,39,24,28,28,47},{-92,-90,-90,-28,-16,-14,-14,-8,42,52,62,84},{1,0,0,0,1,0,0,0,1,0,1,0,1,0,0,1,1,1,0,0,1,1,0,0,1,0,1,0,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,0},{6,7,7,12,15,15,21,24,26,26,28,36,38,42,46,52,55,56,59,62,63,65,65,66,68,71,73,77,77,77,77,85,87,87,88,90,93,94,98},{-68,44,88,-68,22,34,-82,18,-60,30,24,18,78,90,-20,-60,94,70,4,-16,-38},{0,0,1},{14,7,9,71,37,20,85,62,70,67,26,47,61,99,2,90,70,46,53,16,56,7,15,81,85,94,73,40,35,58,21,98,45}};
vector<vector<int>> param1 {{5,6,11,13,13,16,17,19,23,25,28,31,31,39,41,44,45,52,62,64,70,71,73,78,78,79,85,86,92},{78,-80,-24,-50,-26,-62,26,-12,22,-90,84,10,18,62,26,-68,92,64,-52,76,-84,64,50,36,-24,-98,42,72,-78,-98,-24,86,2,60,-30,14,-42},{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},{85,92,84,27,54,77,26,49,47,51,70,11,41},{-98,-98,-58,-6,14,16,18,46,52,52,52,56},{0,1,1,1,0,0,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1},{1,3,4,4,6,7,8,8,15,17,18,18,20,23,23,24,25,25,26,33,39,43,46,54,59,67,69,69,69,69,76,76,81,81,85,86,86,91,95},{-18,-30,-74,-50,98,-44,-62,-20,18,84,62,-64,-2,62,-32,-34,-14,-52,-36,-60,-68},{0,0,1},{99,72,29,55,88,1,88,19,7,80,79,18,28,41,48,49,67,27,24,94,86,14,45,84,37,71,92,98,16,64,67,44,29}};
vector<int> param2 {28,23,14,7,11,35,30,16,2,20};
vector<int> param3 {14,33,16,8,6,33,20,12,1,25};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),¶m1[i].front(),param2[i],param3[i]) == f_gold(¶m0[i].front(),¶m1[i].front(),param2[i],param3[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
CHECK_WHETHER_GIVEN_NUMBER_EVEN_ODD_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_WHETHER_GIVEN_NUMBER_EVEN_ODD_1{
public static boolean f_gold ( int n ) {
if ( ( n & 1 ) == 0 ) return true ;
else return false ;
}
| def f_gold ( n ) :
return ( not ( n & 1 ) )
|
using namespace std;
bool f_gold ( int n ) {
return ( ! ( n & 1 ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(57);
param0.add(73);
param0.add(79);
param0.add(36);
param0.add(71);
param0.add(23);
param0.add(41);
param0.add(66);
param0.add(46);
param0.add(50);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(57,),
(73,),
(79,),
(36,),
(71,),
(23,),
(41,),
(66,),
(46,),
(50,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {57,73,79,36,71,23,41,66,46,50};
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();
return 0;
} |
MAKING_ELEMENTS_OF_TWO_ARRAYS_SAME_WITH_MINIMUM_INCREMENTDECREMENT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAKING_ELEMENTS_OF_TWO_ARRAYS_SAME_WITH_MINIMUM_INCREMENTDECREMENT{
static int f_gold ( int a [ ] , int b [ ] , int n ) {
Arrays . sort ( a ) ;
Arrays . sort ( b ) ;
int result = 0 ;
for ( int i = 0 ;
i < n ;
++ i ) {
if ( a [ i ] > b [ i ] ) result = result + Math . abs ( a [ i ] - b [ i ] ) ;
else if ( a [ i ] < b [ i ] ) result = result + Math . abs ( a [ i ] - b [ i ] ) ;
}
return result ;
}
| def f_gold ( a , b , n ) :
a.sort ( reverse = False )
b.sort ( reverse = False )
result = 0
for i in range ( 0 , n , 1 ) :
if ( a [ i ] > b [ i ] ) :
result = result + abs ( a [ i ] - b [ i ] )
elif ( a [ i ] < b [ i ] ) :
result = result + abs ( a [ i ] - b [ i ] )
return result
|
using namespace std;
int f_gold ( int a [ ], int b [ ], int n ) {
sort ( a, a + n );
sort ( b, b + n );
int result = 0;
for ( int i = 0;
i < n;
++ i ) {
result = result + abs ( a [ i ] - b [ i ] );
}
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,6,6,7,10,11,13,18,19,19,19,31,34,37,37,40,41,41,47,47,53,54,55,55,56,56,60,60,62,62,66,73,75,76,78,81,81,85,88,90,91,92,93,95,97,98});
param0.add(new int[]{-12,-6,78,62,86,-32});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1});
param0.add(new int[]{76,74});
param0.add(new int[]{-92,-90,-88,-84,-76,-54,-44,-42,-38,-30,34,42});
param0.add(new int[]{1,1,0,0,1,1,1,0,1,1,0,0,1,0,0,1,1,1});
param0.add(new int[]{4,5,6,13,16,24,36,40,40,44,47,52,58,58,59,63,66,67,69,70,74,77,81,88,89,90,94,96});
param0.add(new int[]{-16,66,-2,54,-8,10,44,-36,-54,50,92,84,-36,40,-12,98,36,22,-10});
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,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});
param0.add(new int[]{42,24,43,64,55,94,26,30,76,3,37,43,81,7,15,64,63,88,34,8,55,32,19,55});
List<int [ ]> param1 = new ArrayList<>();
param1.add(new int[]{2,2,4,7,8,8,8,8,8,9,9,12,15,16,21,25,26,27,29,34,34,35,38,40,40,44,44,47,48,54,58,61,63,64,66,69,69,70,73,74,75,76,79,80,80,93});
param1.add(new int[]{-86,20,32,52,50,-60});
param1.add(new int[]{0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1});
param1.add(new int[]{16,98});
param1.add(new int[]{-80,-54,-34,12,14,16,16,46,50,64,84,92});
param1.add(new int[]{0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1});
param1.add(new int[]{1,7,10,17,21,22,22,27,36,37,39,46,52,53,56,59,65,67,70,75,78,78,79,89,89,94,96,97});
param1.add(new int[]{-76,-74,62,22,50,84,78,26,-62,-10,86,-10,-92,-10,86,-6,-58,-26,-18});
param1.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,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});
param1.add(new int[]{96,11,63,90,28,80,44,63,17,81,80,69,66,22,81,4,86,74,91,17,3,81,65,98});
List<Integer> param2 = new ArrayList<>();
param2.add(23);
param2.add(4);
param2.add(14);
param2.add(1);
param2.add(8);
param2.add(14);
param2.add(24);
param2.add(16);
param2.add(36);
param2.add(22);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([1, 6, 6, 7, 10, 11, 13, 18, 19, 19, 19, 31, 34, 37, 37, 40, 41, 41, 47, 47, 53, 54, 55, 55, 56, 56, 60, 60, 62, 62, 66, 73, 75, 76, 78, 81, 81, 85, 88, 90, 91, 92, 93, 95, 97, 98],[2, 2, 4, 7, 8, 8, 8, 8, 8, 9, 9, 12, 15, 16, 21, 25, 26, 27, 29, 34, 34, 35, 38, 40, 40, 44, 44, 47, 48, 54, 58, 61, 63, 64, 66, 69, 69, 70, 73, 74, 75, 76, 79, 80, 80, 93],23,),
([-12, -6, 78, 62, 86, -32],[-86, 20, 32, 52, 50, -60],4,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],14,),
([76, 74],[16, 98],1,),
([-92, -90, -88, -84, -76, -54, -44, -42, -38, -30, 34, 42],[-80, -54, -34, 12, 14, 16, 16, 46, 50, 64, 84, 92],8,),
([1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1],[0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],14,),
([4, 5, 6, 13, 16, 24, 36, 40, 40, 44, 47, 52, 58, 58, 59, 63, 66, 67, 69, 70, 74, 77, 81, 88, 89, 90, 94, 96],[1, 7, 10, 17, 21, 22, 22, 27, 36, 37, 39, 46, 52, 53, 56, 59, 65, 67, 70, 75, 78, 78, 79, 89, 89, 94, 96, 97],24,),
([-16, 66, -2, 54, -8, 10, 44, -36, -54, 50, 92, 84, -36, 40, -12, 98, 36, 22, -10],[-76, -74, 62, 22, 50, 84, 78, 26, -62, -10, 86, -10, -92, -10, 86, -6, -58, -26, -18],16,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],36,),
([42, 24, 43, 64, 55, 94, 26, 30, 76, 3, 37, 43, 81, 7, 15, 64, 63, 88, 34, 8, 55, 32, 19, 55],[96, 11, 63, 90, 28, 80, 44, 63, 17, 81, 80, 69, 66, 22, 81, 4, 86, 74, 91, 17, 3, 81, 65, 98],22,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,6,6,7,10,11,13,18,19,19,19,31,34,37,37,40,41,41,47,47,53,54,55,55,56,56,60,60,62,62,66,73,75,76,78,81,81,85,88,90,91,92,93,95,97,98},{-12,-6,78,62,86,-32},{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1},{76,74},{-92,-90,-88,-84,-76,-54,-44,-42,-38,-30,34,42},{1,1,0,0,1,1,1,0,1,1,0,0,1,0,0,1,1,1},{4,5,6,13,16,24,36,40,40,44,47,52,58,58,59,63,66,67,69,70,74,77,81,88,89,90,94,96},{-16,66,-2,54,-8,10,44,-36,-54,50,92,84,-36,40,-12,98,36,22,-10},{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},{42,24,43,64,55,94,26,30,76,3,37,43,81,7,15,64,63,88,34,8,55,32,19,55}};
vector<vector<int>> param1 {{2,2,4,7,8,8,8,8,8,9,9,12,15,16,21,25,26,27,29,34,34,35,38,40,40,44,44,47,48,54,58,61,63,64,66,69,69,70,73,74,75,76,79,80,80,93},{-86,20,32,52,50,-60},{0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},{16,98},{-80,-54,-34,12,14,16,16,46,50,64,84,92},{0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,1,1,1},{1,7,10,17,21,22,22,27,36,37,39,46,52,53,56,59,65,67,70,75,78,78,79,89,89,94,96,97},{-76,-74,62,22,50,84,78,26,-62,-10,86,-10,-92,-10,86,-6,-58,-26,-18},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{96,11,63,90,28,80,44,63,17,81,80,69,66,22,81,4,86,74,91,17,3,81,65,98}};
vector<int> param2 {23,4,14,1,8,14,24,16,36,22};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),¶m1[i].front(),param2[i]) == f_gold(¶m0[i].front(),¶m1[i].front(),param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
PROGRAM_TO_FIND_REMAINDER_WITHOUT_USING_MODULO_OR_OPERATOR_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_TO_FIND_REMAINDER_WITHOUT_USING_MODULO_OR_OPERATOR_2{
static int f_gold ( int num , int divisor ) {
while ( num >= divisor ) num -= divisor ;
return num ;
}
| def f_gold ( num , divisor ) :
while ( num >= divisor ) :
num -= divisor ;
return num ;
|
using namespace std;
int f_gold ( int num, int divisor ) {
while ( num >= divisor ) num -= divisor;
return num;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(70);
param0.add(77);
param0.add(77);
param0.add(88);
param0.add(96);
param0.add(6);
param0.add(79);
param0.add(44);
param0.add(26);
param0.add(82);
List<Integer> param1 = new ArrayList<>();
param1.add(13);
param1.add(3);
param1.add(73);
param1.add(54);
param1.add(39);
param1.add(10);
param1.add(95);
param1.add(32);
param1.add(86);
param1.add(91);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(70,13,),
(77,3,),
(77,73,),
(88,54,),
(96,39,),
(6,10,),
(79,95,),
(44,32,),
(26,86,),
(82,91,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {70,77,77,88,96,6,79,44,26,82};
vector<int> param1 {13,3,73,54,39,10,95,32,86,91};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MAXIMUM_TRIPLET_SUM_ARRAY_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_TRIPLET_SUM_ARRAY_1{
static int f_gold ( int arr [ ] , int n ) {
Arrays . sort ( arr ) ;
return arr [ n - 1 ] + arr [ n - 2 ] + arr [ n - 3 ] ;
}
| def f_gold ( arr , n ) :
arr.sort ( )
return ( arr [ n - 1 ] + arr [ n - 2 ] + arr [ n - 3 ] )
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
sort ( arr, arr + n );
return arr [ n - 1 ] + arr [ n - 2 ] + arr [ n - 3 ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{6,8,18,18,27,33,33,38,42,43,44,47,52,58,64,65,67,68,71,75,85,89,91,94,94,95,95});
param0.add(new int[]{24,24,44,28,-88,18,34,92,-84,94,-12,30,-82,-58});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1});
param0.add(new int[]{95,75,5,51,67,63,26,47,70,11,21,9,18,31,76,66,81,73,63,55,16,72,15,28,25,25,35,79,4,73,23,87,2,1,92,94,18,70,87,27,34,84,12});
param0.add(new int[]{-86,-86,-78,-56,-24,-14,-10,-6,12,12,18,22,22,26,50,50,72,78,94});
param0.add(new int[]{0,1,1,1,1,1,0,0,0,1,1,1,0,0,0});
param0.add(new int[]{2,13,17,19,20,23,28,28,29,40,45,51,52,58,58,68,70,75,79,81,92,96,97});
param0.add(new int[]{94,6,52,6,-78,40,-46,-20,64,76,-36,-62,50,-4,4});
param0.add(new int[]{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});
param0.add(new int[]{34,11,15,42,32,4,6,25,52,44,14,57,3,44,7,89,35,3,70,66,58,22,5,17,33,11});
List<Integer> param1 = new ArrayList<>();
param1.add(26);
param1.add(8);
param1.add(15);
param1.add(37);
param1.add(9);
param1.add(9);
param1.add(15);
param1.add(13);
param1.add(27);
param1.add(13);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([6, 8, 18, 18, 27, 33, 33, 38, 42, 43, 44, 47, 52, 58, 64, 65, 67, 68, 71, 75, 85, 89, 91, 94, 94, 95, 95],26,),
([24, 24, 44, 28, -88, 18, 34, 92, -84, 94, -12, 30, -82, -58],8,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1],15,),
([95, 75, 5, 51, 67, 63, 26, 47, 70, 11, 21, 9, 18, 31, 76, 66, 81, 73, 63, 55, 16, 72, 15, 28, 25, 25, 35, 79, 4, 73, 23, 87, 2, 1, 92, 94, 18, 70, 87, 27, 34, 84, 12],37,),
([-86, -86, -78, -56, -24, -14, -10, -6, 12, 12, 18, 22, 22, 26, 50, 50, 72, 78, 94],9,),
([0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0],9,),
([2, 13, 17, 19, 20, 23, 28, 28, 29, 40, 45, 51, 52, 58, 58, 68, 70, 75, 79, 81, 92, 96, 97],15,),
([94, 6, 52, 6, -78, 40, -46, -20, 64, 76, -36, -62, 50, -4, 4],13,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],27,),
([34, 11, 15, 42, 32, 4, 6, 25, 52, 44, 14, 57, 3, 44, 7, 89, 35, 3, 70, 66, 58, 22, 5, 17, 33, 11],13,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{6,8,18,18,27,33,33,38,42,43,44,47,52,58,64,65,67,68,71,75,85,89,91,94,94,95,95},{24,24,44,28,-88,18,34,92,-84,94,-12,30,-82,-58},{0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1},{95,75,5,51,67,63,26,47,70,11,21,9,18,31,76,66,81,73,63,55,16,72,15,28,25,25,35,79,4,73,23,87,2,1,92,94,18,70,87,27,34,84,12},{-86,-86,-78,-56,-24,-14,-10,-6,12,12,18,22,22,26,50,50,72,78,94},{0,1,1,1,1,1,0,0,0,1,1,1,0,0,0},{2,13,17,19,20,23,28,28,29,40,45,51,52,58,58,68,70,75,79,81,92,96,97},{94,6,52,6,-78,40,-46,-20,64,76,-36,-62,50,-4,4},{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},{34,11,15,42,32,4,6,25,52,44,14,57,3,44,7,89,35,3,70,66,58,22,5,17,33,11}};
vector<int> param1 {26,8,15,37,9,9,15,13,27,13};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
COUNT_INDEX_PAIRS_EQUAL_ELEMENTS_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_INDEX_PAIRS_EQUAL_ELEMENTS_ARRAY{
static int f_gold ( int arr [ ] , int n ) {
int ans = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = i + 1 ;
j < n ;
j ++ ) if ( arr [ i ] == arr [ j ] ) ans ++ ;
return ans ;
}
| def f_gold ( arr , n ) :
ans = 0
for i in range ( 0 , n ) :
for j in range ( i + 1 , n ) :
if ( arr [ i ] == arr [ j ] ) :
ans += 1
return ans
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int ans = 0;
for ( int i = 0;
i < n;
i ++ ) for ( int j = i + 1;
j < n;
j ++ ) if ( arr [ i ] == arr [ j ] ) ans ++;
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,6,9,16,16,21,36,41,58,60,62,73,77,81,95});
param0.add(new int[]{-86,-72,-26,-34,18,-62,-66});
param0.add(new int[]{1});
param0.add(new int[]{16});
param0.add(new int[]{-88,-80,-72,-68,-64,-26,4,14,16,22,30,32,60,74,82});
param0.add(new int[]{0,0,1,1,1,0,1,0,0,0,1});
param0.add(new int[]{3,9,10,12,17,23,27,29,42,44,59,61,71,76,78,82,84,84,89,90,93,93,97,97});
param0.add(new int[]{68,-40,-46,-20,-64,90});
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,1});
param0.add(new int[]{99,17,94,43,97,17,11,58,75,94,37,22,54,31,41,4,55,69,92,80,45,97,16,33,36,17,43,82,81,64,22,65,85,44,47,14});
List<Integer> param1 = new ArrayList<>();
param1.add(12);
param1.add(3);
param1.add(0);
param1.add(0);
param1.add(11);
param1.add(9);
param1.add(15);
param1.add(5);
param1.add(15);
param1.add(23);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([4, 6, 9, 16, 16, 21, 36, 41, 58, 60, 62, 73, 77, 81, 95],12,),
([-86, -72, -26, -34, 18, -62, -66],3,),
([1],0,),
([16],0,),
([-88, -80, -72, -68, -64, -26, 4, 14, 16, 22, 30, 32, 60, 74, 82],11,),
([0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1],9,),
([3, 9, 10, 12, 17, 23, 27, 29, 42, 44, 59, 61, 71, 76, 78, 82, 84, 84, 89, 90, 93, 93, 97, 97],15,),
([68, -40, -46, -20, -64, 90],5,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],15,),
([99, 17, 94, 43, 97, 17, 11, 58, 75, 94, 37, 22, 54, 31, 41, 4, 55, 69, 92, 80, 45, 97, 16, 33, 36, 17, 43, 82, 81, 64, 22, 65, 85, 44, 47, 14],23,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{4,6,9,16,16,21,36,41,58,60,62,73,77,81,95},{-86,-72,-26,-34,18,-62,-66},{1},{16},{-88,-80,-72,-68,-64,-26,4,14,16,22,30,32,60,74,82},{0,0,1,1,1,0,1,0,0,0,1},{3,9,10,12,17,23,27,29,42,44,59,61,71,76,78,82,84,84,89,90,93,93,97,97},{68,-40,-46,-20,-64,90},{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1},{99,17,94,43,97,17,11,58,75,94,37,22,54,31,41,4,55,69,92,80,45,97,16,33,36,17,43,82,81,64,22,65,85,44,47,14}};
vector<int> param1 {12,3,0,0,11,9,15,5,15,23};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
DISTRIBUTING_M_ITEMS_CIRCLE_SIZE_N_STARTING_K_TH_POSITION |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DISTRIBUTING_M_ITEMS_CIRCLE_SIZE_N_STARTING_K_TH_POSITION{
static int f_gold ( int n , int m , int k ) {
if ( m <= n - k + 1 ) return m + k - 1 ;
m = m - ( n - k + 1 ) ;
return ( m % n == 0 ) ? n : ( m % n ) ;
}
| def f_gold ( n , m , k ) :
if ( m <= n - k + 1 ) :
return m + k - 1
m = m - ( n - k + 1 )
if ( m % n == 0 ) :
return n
else :
return m % n
|
using namespace std;
int f_gold ( int n, int m, int k ) {
if ( m <= n - k + 1 ) return m + k - 1;
m = m - ( n - k + 1 );
return ( m % n == 0 ) ? n : ( m % n );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(19);
param0.add(23);
param0.add(92);
param0.add(9);
param0.add(20);
param0.add(68);
param0.add(66);
param0.add(77);
param0.add(90);
param0.add(26);
List<Integer> param1 = new ArrayList<>();
param1.add(14);
param1.add(51);
param1.add(10);
param1.add(50);
param1.add(67);
param1.add(25);
param1.add(30);
param1.add(22);
param1.add(1);
param1.add(34);
List<Integer> param2 = new ArrayList<>();
param2.add(34);
param2.add(5);
param2.add(24);
param2.add(34);
param2.add(20);
param2.add(40);
param2.add(24);
param2.add(32);
param2.add(71);
param2.add(54);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(19,14,34,),
(23,51,5,),
(92,10,24,),
(9,50,34,),
(20,67,20,),
(68,25,40,),
(66,30,24,),
(77,22,32,),
(90,1,71,),
(26,34,54,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {19,23,92,9,20,68,66,77,90,26};
vector<int> param1 {14,51,10,50,67,25,30,22,1,34};
vector<int> param2 {34,5,24,34,20,40,24,32,71,54};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i]) == f_gold(param0[i],param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
TAIL_RECURSION |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class TAIL_RECURSION{
static int f_gold ( int n ) {
if ( n == 0 ) return 1 ;
return n * f_gold ( n - 1 ) ;
}
| def f_gold ( n ) :
if ( n == 0 ) :
return 1
return n * f_gold ( n - 1 )
|
using namespace std;
unsigned int f_gold ( unsigned int n ) {
if ( n == 0 ) return 1;
return n * f_gold ( n - 1 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(77);
param0.add(62);
param0.add(42);
param0.add(16);
param0.add(82);
param0.add(37);
param0.add(29);
param0.add(32);
param0.add(82);
param0.add(91);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(77,),
(62,),
(42,),
(16,),
(82,),
(37,),
(29,),
(32,),
(82,),
(91,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {77,62,42,16,82,37,29,32,82,91};
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();
return 0;
} |
COMPUTE_MODULUS_DIVISION_BY_A_POWER_OF_2_NUMBER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COMPUTE_MODULUS_DIVISION_BY_A_POWER_OF_2_NUMBER{
static int f_gold ( int n , int d ) {
return ( n & ( d - 1 ) ) ;
}
| def f_gold ( n , d ) :
return ( n & ( d - 1 ) )
|
using namespace std;
unsigned int f_gold ( unsigned int n, unsigned int d ) {
return ( n & ( d - 1 ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(54);
param0.add(39);
param0.add(35);
param0.add(9);
param0.add(62);
param0.add(16);
param0.add(93);
param0.add(32);
param0.add(39);
param0.add(63);
List<Integer> param1 = new ArrayList<>();
param1.add(59);
param1.add(84);
param1.add(81);
param1.add(60);
param1.add(68);
param1.add(16);
param1.add(96);
param1.add(38);
param1.add(62);
param1.add(16);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(54,59,),
(39,84,),
(35,81,),
(9,60,),
(62,68,),
(16,16,),
(93,96,),
(32,38,),
(39,62,),
(63,16,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {54,39,35,9,62,16,93,32,39,63};
vector<int> param1 {59,84,81,60,68,16,96,38,62,16};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MIDDLE_OF_THREE_USING_MINIMUM_COMPARISONS_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MIDDLE_OF_THREE_USING_MINIMUM_COMPARISONS_2{
public static int f_gold ( int a , int b , int c ) {
int x = a - b ;
int y = b - c ;
int z = a - c ;
if ( x * y > 0 ) return b ;
else if ( x * z > 0 ) return c ;
else return a ;
}
| def f_gold ( a , b , c ) :
x = a - b
y = b - c
z = a - c
if x * y > 0 :
return b
elif ( x * z > 0 ) :
return
else :
return a
|
using namespace std;
int f_gold ( int a, int b, int c ) {
int x = a - b;
int y = b - c;
int z = a - c;
if ( x * y > 0 ) return b;
else if ( x * z > 0 ) return c;
else return a;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(48);
param0.add(21);
param0.add(71);
param0.add(93);
param0.add(3);
param0.add(58);
param0.add(88);
param0.add(8);
param0.add(17);
param0.add(13);
List<Integer> param1 = new ArrayList<>();
param1.add(46);
param1.add(7);
param1.add(4);
param1.add(34);
param1.add(61);
param1.add(78);
param1.add(41);
param1.add(84);
param1.add(66);
param1.add(3);
List<Integer> param2 = new ArrayList<>();
param2.add(38);
param2.add(16);
param2.add(31);
param2.add(11);
param2.add(32);
param2.add(6);
param2.add(66);
param2.add(38);
param2.add(27);
param2.add(23);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(48,46,38,),
(21,7,16,),
(71,4,31,),
(93,34,11,),
(3,61,32,),
(58,78,6,),
(88,41,66,),
(8,84,38,),
(17,66,27,),
(13,3,23,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {48,21,71,93,3,58,88,8,17,13};
vector<int> param1 {46,7,4,34,61,78,41,84,66,3};
vector<int> param2 {38,16,31,11,32,6,66,38,27,23};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i]) == f_gold(param0[i],param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MINIMUM_INSERTIONS_SORT_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_INSERTIONS_SORT_ARRAY{
static int f_gold ( int arr [ ] , int N ) {
int [ ] lis = new int [ N ] ;
for ( int i = 0 ;
i < N ;
i ++ ) lis [ i ] = 1 ;
for ( int i = 1 ;
i < N ;
i ++ ) for ( int j = 0 ;
j < i ;
j ++ ) if ( arr [ i ] >= arr [ j ] && lis [ i ] < lis [ j ] + 1 ) lis [ i ] = lis [ j ] + 1 ;
int max = 0 ;
for ( int i = 0 ;
i < N ;
i ++ ) if ( max < lis [ i ] ) max = lis [ i ] ;
return ( N - max ) ;
}
| def f_gold ( arr , N ) :
lis = [ 0 ] * N
for i in range ( N ) :
lis [ i ] = 1
for i in range ( 1 , N ) :
for j in range ( i ) :
if ( arr [ i ] >= arr [ j ] and lis [ i ] < lis [ j ] + 1 ) :
lis [ i ] = lis [ j ] + 1
max = 0
for i in range ( N ) :
if ( max < lis [ i ] ) :
max = lis [ i ]
return ( N - max )
|
using namespace std;
int f_gold ( int arr [ ], int N ) {
int lis [ N ];
for ( int i = 0;
i < N;
i ++ ) lis [ i ] = 1;
for ( int i = 1;
i < N;
i ++ ) for ( int j = 0;
j < i;
j ++ ) if ( arr [ i ] >= arr [ j ] && lis [ i ] < lis [ j ] + 1 ) lis [ i ] = lis [ j ] + 1;
int max = 0;
for ( int i = 0;
i < N;
i ++ ) if ( max < lis [ i ] ) max = lis [ i ];
return ( N - max );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,7,20,22,23,31,33,36,47,61,63,63,71,74,82,91,95,99});
param0.add(new int[]{-84,12,-42,-78,22,72,56,70,28,-72});
param0.add(new int[]{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});
param0.add(new int[]{29,41,4,62,77,74,30,2,14,90,93,10,78,36,66,22,48,89,36,73,70,23,90});
param0.add(new int[]{-80,-72,-68,-66,-58,-50,-48,-32,-28,-24,-22,-18,0,2,6,10,12,14,14,18,24,24,24,28,28,28,34,38,42,42,46,46,46,58,80,82,82,84,84,86,88,90,92,96});
param0.add(new int[]{1,1,0,1,0,1,0,0,1,0});
param0.add(new int[]{26,36,58,64,69,72,79,82,82,87,89,90,95});
param0.add(new int[]{-52,-40,98,40,42,-50,60,-64,-92,36,-88,72,-72,38,-80,-52,68,70,16,22,-30,-74,56,-80,62,-54,-32,-22,-86,-70,88,-76,-46,28,40,-2,-84,68,-98,-16,90,36,-38,-86,20,-40,82,98,54});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{36,62,58,24,99,12,46,3,4,40,54,97,48,94,98,7,17,5,3,36,3});
List<Integer> param1 = new ArrayList<>();
param1.add(15);
param1.add(7);
param1.add(16);
param1.add(13);
param1.add(36);
param1.add(8);
param1.add(8);
param1.add(41);
param1.add(10);
param1.add(16);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([4, 7, 20, 22, 23, 31, 33, 36, 47, 61, 63, 63, 71, 74, 82, 91, 95, 99],15,),
([-84, 12, -42, -78, 22, 72, 56, 70, 28, -72],7,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],16,),
([29, 41, 4, 62, 77, 74, 30, 2, 14, 90, 93, 10, 78, 36, 66, 22, 48, 89, 36, 73, 70, 23, 90],13,),
([-80, -72, -68, -66, -58, -50, -48, -32, -28, -24, -22, -18, 0, 2, 6, 10, 12, 14, 14, 18, 24, 24, 24, 28, 28, 28, 34, 38, 42, 42, 46, 46, 46, 58, 80, 82, 82, 84, 84, 86, 88, 90, 92, 96],36,),
([1, 1, 0, 1, 0, 1, 0, 0, 1, 0],8,),
([26, 36, 58, 64, 69, 72, 79, 82, 82, 87, 89, 90, 95],8,),
([-52, -40, 98, 40, 42, -50, 60, -64, -92, 36, -88, 72, -72, 38, -80, -52, 68, 70, 16, 22, -30, -74, 56, -80, 62, -54, -32, -22, -86, -70, 88, -76, -46, 28, 40, -2, -84, 68, -98, -16, 90, 36, -38, -86, 20, -40, 82, 98, 54],41,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],10,),
([36, 62, 58, 24, 99, 12, 46, 3, 4, 40, 54, 97, 48, 94, 98, 7, 17, 5, 3, 36, 3],16,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{4,7,20,22,23,31,33,36,47,61,63,63,71,74,82,91,95,99},{-84,12,-42,-78,22,72,56,70,28,-72},{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},{29,41,4,62,77,74,30,2,14,90,93,10,78,36,66,22,48,89,36,73,70,23,90},{-80,-72,-68,-66,-58,-50,-48,-32,-28,-24,-22,-18,0,2,6,10,12,14,14,18,24,24,24,28,28,28,34,38,42,42,46,46,46,58,80,82,82,84,84,86,88,90,92,96},{1,1,0,1,0,1,0,0,1,0},{26,36,58,64,69,72,79,82,82,87,89,90,95},{-52,-40,98,40,42,-50,60,-64,-92,36,-88,72,-72,38,-80,-52,68,70,16,22,-30,-74,56,-80,62,-54,-32,-22,-86,-70,88,-76,-46,28,40,-2,-84,68,-98,-16,90,36,-38,-86,20,-40,82,98,54},{0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{36,62,58,24,99,12,46,3,4,40,54,97,48,94,98,7,17,5,3,36,3}};
vector<int> param1 {15,7,16,13,36,8,8,41,10,16};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
DYNAMIC_PROGRAMMING_SET_17_PALINDROME_PARTITIONING_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_SET_17_PALINDROME_PARTITIONING_1{
static int f_gold ( String str ) {
int n = str . length ( ) ;
int [ ] C = new int [ n ] ;
boolean [ ] [ ] P = new boolean [ n ] [ n ] ;
int i , j , k , L ;
for ( i = 0 ;
i < n ;
i ++ ) {
P [ i ] [ i ] = true ;
}
for ( L = 2 ;
L <= n ;
L ++ ) {
for ( i = 0 ;
i < n - L + 1 ;
i ++ ) {
j = i + L - 1 ;
if ( L == 2 ) P [ i ] [ j ] = ( str . charAt ( i ) == str . charAt ( j ) ) ;
else P [ i ] [ j ] = ( str . charAt ( i ) == str . charAt ( j ) ) && P [ i + 1 ] [ j - 1 ] ;
}
}
for ( i = 0 ;
i < n ;
i ++ ) {
if ( P [ 0 ] [ i ] == true ) C [ i ] = 0 ;
else {
C [ i ] = Integer . MAX_VALUE ;
for ( j = 0 ;
j < i ;
j ++ ) {
if ( P [ j + 1 ] [ i ] == true && 1 + C [ j ] < C [ i ] ) C [ i ] = 1 + C [ j ] ;
}
}
}
return C [ n - 1 ] ;
}
| import sys
def f_gold ( str1 ) :
n = len ( str1 ) ;
C = [ 0 ] * ( n + 1 ) ;
P = [ [ False for x in range ( n + 1 ) ] for y in range ( n + 1 ) ] ;
for i in range ( n ) :
P [ i ] [ i ] = True ;
for L in range ( 2 , n + 1 ) :
for i in range ( n - L + 1 ) :
j = i + L - 1 ;
if ( L == 2 ) :
P [ i ] [ j ] = ( str1 [ i ] == str1 [ j ] ) ;
else :
P [ i ] [ j ] = ( ( str1 [ i ] == str1 [ j ] ) and P [ i + 1 ] [ j - 1 ] ) ;
for i in range ( n ) :
if ( P [ 0 ] [ i ] == True ) :
C [ i ] = 0 ;
else :
C [ i ] = sys.maxsize ;
for j in range ( i ) :
if ( P [ j + 1 ] [ i ] == True and 1 + C [ j ] < C [ i ] ) :
C [ i ] = 1 + C [ j ] ;
return C [ n - 1 ] ;
| null |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("YYGWgYrovdsh");
param0.add("56109778");
param0.add("101");
param0.add("RxM");
param0.add("187546405");
param0.add("0110010");
param0.add("wVODAmgvI");
param0.add("56719");
param0.add("10100011001100");
param0.add("Wtpai");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('YYGWgYrovdsh',),
('56109778',),
('101',),
('RxM',),
('187546405',),
('0110010',),
('wVODAmgvI',),
('56719',),
('10100011001100',),
('Wtpai',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) | null |
FIND_INDEX_OF_AN_EXTRA_ELEMENT_PRESENT_IN_ONE_SORTED_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_INDEX_OF_AN_EXTRA_ELEMENT_PRESENT_IN_ONE_SORTED_ARRAY{
static int f_gold ( int arr1 [ ] , int arr2 [ ] , int n ) {
for ( int i = 0 ;
i < n ;
i ++ ) if ( arr1 [ i ] != arr2 [ i ] ) return i ;
return n ;
}
| def f_gold ( arr1 , arr2 , n ) :
for i in range ( 0 , n ) :
if ( arr1 [ i ] != arr2 [ i ] ) :
return i
return n
|
using namespace std;
int f_gold ( int arr1 [ ], int arr2 [ ], int n ) {
for ( int i = 0;
i < n;
i ++ ) if ( arr1 [ i ] != arr2 [ i ] ) return i;
return n;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,6,7,10,11,12,12,16,17,29,32,33,35,35,45,49,52,56,57,58,61,62,63,64,68,71,71,77,79,79,81,82,82,83,83,89,89,93,94,94});
param0.add(new int[]{-48,-92,96,-18,10,-24,-4,96,-16,-78,4,-80,-96,-28,-78,68,2,-60,0});
param0.add(new int[]{1});
param0.add(new int[]{68,98,21,29,71,49});
param0.add(new int[]{-80,-76,-76,-76,-68,-66,-56,-44,-38,-28,-24,-10,8,14,16,18,24,26,30,32,50,64,76,80,90,94,94,94});
param0.add(new int[]{0,0,1,0,1,0,1,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,1,0,0,1,0,1,0,1,0,1,1,1,0,1});
param0.add(new int[]{3,7,16,17,20,22,29,32,34,34,35,40,40,40,41,46,49,58,60,62,63,64,64,68,70,73,76,79,83,86,90,92,99});
param0.add(new int[]{18,-68,-6,-32,-76,-86,-8,76,-46,20,-80,54,-88,-58,-48,-66,-66,18,-28,-74,-72,-26,-92,-78,24,-22,-80,-80,82,-2,-72,-88,-54,-84,-8});
param0.add(new int[]{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});
param0.add(new int[]{74,75,52,58,34,53,51,45,34,28,53,94,10,20,23,12,95,78,48,11});
List<int [ ]> param1 = new ArrayList<>();
param1.add(new int[]{3,12,13,14,15,17,18,19,22,24,28,29,33,37,41,42,44,49,51,51,52,53,56,56,59,60,64,64,67,70,71,78,83,88,88,90,92,93,93,95});
param1.add(new int[]{-38,-40,-50,50,-26,-80,64,54,74,-44,-40,-92,-16,4,-60,-42,-60,-74,38});
param1.add(new int[]{0});
param1.add(new int[]{97,90,25,89,57,41});
param1.add(new int[]{-90,-88,-66,-60,-48,-48,-46,-42,-40,-36,-26,-4,2,4,4,8,16,18,34,50,52,56,64,80,86,90,92,96});
param1.add(new int[]{0,0,0,0,0,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,1});
param1.add(new int[]{4,4,7,13,23,23,25,25,26,34,38,39,39,45,48,50,52,54,58,59,60,65,72,76,80,80,80,84,87,90,92,94,96});
param1.add(new int[]{-30,96,92,-12,-14,-68,-16,20,74,-42,36,84,-82,66,44,70,-92,-56,-28,-68,-4,10,-4,90,72,84,68,14,32,60,40,60,-34,58,-56});
param1.add(new int[]{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});
param1.add(new int[]{62,56,17,1,11,30,59,18,99,21,86,49,24,85,25,56,21,66,23,96});
List<Integer> param2 = new ArrayList<>();
param2.add(36);
param2.add(16);
param2.add(0);
param2.add(3);
param2.add(14);
param2.add(22);
param2.add(26);
param2.add(17);
param2.add(24);
param2.add(17);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([1, 6, 7, 10, 11, 12, 12, 16, 17, 29, 32, 33, 35, 35, 45, 49, 52, 56, 57, 58, 61, 62, 63, 64, 68, 71, 71, 77, 79, 79, 81, 82, 82, 83, 83, 89, 89, 93, 94, 94],[3, 12, 13, 14, 15, 17, 18, 19, 22, 24, 28, 29, 33, 37, 41, 42, 44, 49, 51, 51, 52, 53, 56, 56, 59, 60, 64, 64, 67, 70, 71, 78, 83, 88, 88, 90, 92, 93, 93, 95],36,),
([-48, -92, 96, -18, 10, -24, -4, 96, -16, -78, 4, -80, -96, -28, -78, 68, 2, -60, 0],[-38, -40, -50, 50, -26, -80, 64, 54, 74, -44, -40, -92, -16, 4, -60, -42, -60, -74, 38],16,),
([1],[0],0,),
([68, 98, 21, 29, 71, 49],[97, 90, 25, 89, 57, 41],3,),
([-80, -76, -76, -76, -68, -66, -56, -44, -38, -28, -24, -10, 8, 14, 16, 18, 24, 26, 30, 32, 50, 64, 76, 80, 90, 94, 94, 94],[-90, -88, -66, -60, -48, -48, -46, -42, -40, -36, -26, -4, 2, 4, 4, 8, 16, 18, 34, 50, 52, 56, 64, 80, 86, 90, 92, 96],14,),
([0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1],[0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1],22,),
([3, 7, 16, 17, 20, 22, 29, 32, 34, 34, 35, 40, 40, 40, 41, 46, 49, 58, 60, 62, 63, 64, 64, 68, 70, 73, 76, 79, 83, 86, 90, 92, 99],[4, 4, 7, 13, 23, 23, 25, 25, 26, 34, 38, 39, 39, 45, 48, 50, 52, 54, 58, 59, 60, 65, 72, 76, 80, 80, 80, 84, 87, 90, 92, 94, 96],26,),
([18, -68, -6, -32, -76, -86, -8, 76, -46, 20, -80, 54, -88, -58, -48, -66, -66, 18, -28, -74, -72, -26, -92, -78, 24, -22, -80, -80, 82, -2, -72, -88, -54, -84, -8],[-30, 96, 92, -12, -14, -68, -16, 20, 74, -42, 36, 84, -82, 66, 44, 70, -92, -56, -28, -68, -4, 10, -4, 90, 72, 84, 68, 14, 32, 60, 40, 60, -34, 58, -56],17,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],24,),
([74, 75, 52, 58, 34, 53, 51, 45, 34, 28, 53, 94, 10, 20, 23, 12, 95, 78, 48, 11],[62, 56, 17, 1, 11, 30, 59, 18, 99, 21, 86, 49, 24, 85, 25, 56, 21, 66, 23, 96],17,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,6,7,10,11,12,12,16,17,29,32,33,35,35,45,49,52,56,57,58,61,62,63,64,68,71,71,77,79,79,81,82,82,83,83,89,89,93,94,94},{-48,-92,96,-18,10,-24,-4,96,-16,-78,4,-80,-96,-28,-78,68,2,-60,0},{1},{68,98,21,29,71,49},{-80,-76,-76,-76,-68,-66,-56,-44,-38,-28,-24,-10,8,14,16,18,24,26,30,32,50,64,76,80,90,94,94,94},{0,0,1,0,1,0,1,1,1,1,0,1,0,0,0,1,1,1,1,1,1,1,1,0,0,1,0,1,0,1,0,1,1,1,0,1},{3,7,16,17,20,22,29,32,34,34,35,40,40,40,41,46,49,58,60,62,63,64,64,68,70,73,76,79,83,86,90,92,99},{18,-68,-6,-32,-76,-86,-8,76,-46,20,-80,54,-88,-58,-48,-66,-66,18,-28,-74,-72,-26,-92,-78,24,-22,-80,-80,82,-2,-72,-88,-54,-84,-8},{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},{74,75,52,58,34,53,51,45,34,28,53,94,10,20,23,12,95,78,48,11}};
vector<vector<int>> param1 {{3,12,13,14,15,17,18,19,22,24,28,29,33,37,41,42,44,49,51,51,52,53,56,56,59,60,64,64,67,70,71,78,83,88,88,90,92,93,93,95},{-38,-40,-50,50,-26,-80,64,54,74,-44,-40,-92,-16,4,-60,-42,-60,-74,38},{0},{97,90,25,89,57,41},{-90,-88,-66,-60,-48,-48,-46,-42,-40,-36,-26,-4,2,4,4,8,16,18,34,50,52,56,64,80,86,90,92,96},{0,0,0,0,0,1,1,1,1,1,1,1,1,0,1,0,1,0,0,0,0,0,1,1,0,1,1,0,0,0,0,0,1,0,0,1},{4,4,7,13,23,23,25,25,26,34,38,39,39,45,48,50,52,54,58,59,60,65,72,76,80,80,80,84,87,90,92,94,96},{-30,96,92,-12,-14,-68,-16,20,74,-42,36,84,-82,66,44,70,-92,-56,-28,-68,-4,10,-4,90,72,84,68,14,32,60,40,60,-34,58,-56},{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},{62,56,17,1,11,30,59,18,99,21,86,49,24,85,25,56,21,66,23,96}};
vector<int> param2 {36,16,0,3,14,22,26,17,24,17};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),¶m1[i].front(),param2[i]) == f_gold(¶m0[i].front(),¶m1[i].front(),param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
FIND_MEDIAN_ROW_WISE_SORTED_MATRIX |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_MEDIAN_ROW_WISE_SORTED_MATRIX{
static int f_gold ( int m [ ] [ ] , int r , int c ) {
int max = Integer . MIN_VALUE ;
int min = Integer . MAX_VALUE ;
for ( int i = 0 ;
i < r ;
i ++ ) {
if ( m [ i ] [ 0 ] < min ) min = m [ i ] [ 0 ] ;
if ( m [ i ] [ c - 1 ] > max ) max = m [ i ] [ c - 1 ] ;
}
int desired = ( r * c + 1 ) / 2 ;
while ( min < max ) {
int mid = min + ( max - min ) / 2 ;
int place = 0 ;
int get = 0 ;
for ( int i = 0 ;
i < r ;
++ i ) {
get = Arrays . binarySearch ( m [ i ] , mid ) ;
if ( get < 0 ) get = Math . abs ( get ) - 1 ;
else {
while ( get < m [ i ] . length && m [ i ] [ get ] == mid ) get += 1 ;
}
place = place + get ;
}
if ( place < desired ) min = mid + 1 ;
else max = mid ;
}
return min ;
}
| null | null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ] [ ]> param0 = new ArrayList<>();
param0.add(new int[][]{new int[]{1,3,5}, new int[]{2,6,9}, new int[]{3,6,9}});
param0.add(new int[][]{new int[]{7,22,92,20,32,19,28,89,86,66,85,70,97,42,54,67,64,24,12,69},new int[]{86,84,97,68,26,16,84,19,31,3,79,55,11,16,47,39,52,1,32,72},new int[]{19,59,90,41,85,86,11,71,70,25,96,33,95,16,36,17,45,26,23,45},new int[]{47,56,11,30,25,98,21,2,67,5,45,66,95,64,23,78,18,75,58,60},new int[]{15,85,69,67,82,8,38,26,96,64,77,64,74,1,42,11,69,1,65,83},new int[]{50,69,76,92,60,37,23,5,87,88,81,4,17,30,54,89,81,78,23,24},new int[]{17,59,52,46,81,78,59,79,19,69,17,97,6,25,47,17,33,11,33,28},new int[]{41,59,5,85,30,46,90,56,3,85,12,7,26,44,56,55,13,78,25,81},new int[]{16,92,41,82,4,40,51,81,55,33,39,24,83,63,60,98,94,52,49,95},new int[]{66,41,15,57,49,59,74,6,97,64,23,42,69,40,31,14,70,97,45,96},new int[]{12,39,22,78,35,88,99,79,13,40,21,58,67,72,14,63,10,97,72,56},new int[]{4,55,9,61,65,61,56,87,77,93,53,44,56,94,39,23,21,77,95,13},new int[]{59,26,88,89,47,4,85,71,70,70,43,39,31,73,2,85,7,1,7,9},new int[]{89,48,55,77,95,60,70,78,58,49,30,22,4,93,66,30,24,80,25,65},new int[]{76,16,55,27,93,93,68,60,58,96,57,48,41,68,34,34,2,92,1,87},new int[]{37,83,59,91,43,59,76,65,13,1,45,74,14,40,22,46,84,47,59,92},new int[]{12,57,80,65,18,68,70,58,51,62,62,35,76,27,56,29,43,17,37,40},new int[]{91,57,6,59,59,71,43,84,74,15,15,87,10,68,33,76,9,27,62,11},new int[]{96,15,71,90,8,69,66,2,74,17,77,9,80,71,76,4,31,96,3,41},new int[]{7,66,75,50,60,71,47,57,84,22,22,89,18,74,62,12,29,3,53,26}});
param0.add(new int[][]{new int[]{99,84,78,41,13,40,92,51,96,2,36,14,26,66,11,73,50,71,35,81,90,29,38,33,75,98,6,18,31,79,94,77,5,84,40,47},new int[]{63,82,43,2,76,20,24,73,35,55,52,95,45,47,93,51,29,68,50,14,28,58,33,72,51,1,68,29,35,18,44,55,36,19,49,21},new int[]{53,80,70,90,1,82,1,27,19,99,90,52,79,70,63,95,98,81,67,84,2,37,53,73,87,97,39,31,19,42,51,68,34,54,58,15},new int[]{29,57,6,46,71,27,89,1,73,22,22,53,66,70,93,65,55,81,96,44,37,38,68,5,23,60,42,81,98,24,42,48,98,99,6,67},new int[]{16,29,74,58,93,95,3,22,65,31,5,91,38,20,65,87,64,68,30,68,7,61,92,52,31,17,78,19,7,23,66,54,76,43,11,29},new int[]{35,61,28,58,96,7,17,66,22,28,57,2,92,84,61,75,45,21,82,56,60,95,67,36,41,19,48,7,94,75,11,81,61,96,4,56},new int[]{6,62,30,59,43,61,56,58,59,77,65,60,53,11,80,49,42,89,62,66,91,20,94,17,89,44,16,58,21,53,82,10,6,17,12,42},new int[]{60,33,36,94,23,3,73,67,62,46,9,83,22,78,50,95,98,54,53,87,33,41,92,21,26,10,64,23,67,10,1,28,77,39,78,58},new int[]{38,65,2,70,18,52,54,18,22,47,76,75,73,28,42,39,19,20,68,27,65,91,46,64,64,57,50,92,99,1,3,4,27,37,23,27},new int[]{89,82,2,10,44,98,90,27,96,37,75,49,29,77,8,88,60,93,65,77,54,25,7,22,97,15,3,55,8,48,65,76,95,92,83,82},new int[]{52,77,99,38,22,57,13,36,54,47,47,70,72,88,80,83,38,48,67,22,22,62,87,1,86,63,80,42,67,2,61,61,10,36,57,16},new int[]{13,34,22,19,18,48,10,83,27,14,12,76,86,9,35,14,24,67,90,46,26,46,99,71,29,5,30,12,89,61,14,31,43,76,62,52},new int[]{67,89,45,23,94,5,58,97,40,12,94,17,15,43,67,75,14,59,81,96,35,30,69,13,98,21,90,38,56,70,68,82,95,24,73,27},new int[]{8,90,77,64,57,5,19,52,78,45,37,96,15,58,27,81,98,91,91,8,48,26,78,9,76,15,98,86,12,89,33,4,5,16,53,45},new int[]{68,19,13,3,5,15,91,33,84,41,34,17,41,58,7,44,37,44,37,15,98,3,66,98,60,99,63,84,17,95,81,74,87,30,37,44},new int[]{66,41,60,70,13,56,24,3,64,29,16,88,4,71,54,20,79,73,57,99,67,56,89,64,67,15,75,88,70,21,78,27,77,87,66,95},new int[]{77,16,1,66,96,66,4,66,4,77,45,1,57,67,15,67,97,14,10,87,43,8,1,45,92,75,73,43,11,41,65,40,52,67,87,83},new int[]{45,9,70,80,45,83,19,3,44,13,26,20,64,23,83,31,70,99,51,6,17,65,92,44,61,95,16,68,67,7,60,23,68,20,77,72},new int[]{36,98,68,26,35,53,20,10,70,94,3,84,46,67,80,4,40,39,17,29,4,74,73,75,65,95,17,64,47,18,71,26,24,33,90,29},new int[]{88,46,76,92,26,41,25,15,95,34,51,72,27,4,76,95,85,20,48,53,63,17,95,79,32,66,92,85,50,13,97,27,26,53,34,82},new int[]{74,83,57,12,88,65,9,93,45,92,99,82,44,48,19,86,82,54,76,73,36,15,9,9,46,31,55,70,58,15,40,10,1,72,24,85},new int[]{64,48,94,50,3,70,64,25,56,41,59,33,75,12,1,68,69,99,59,75,30,33,40,85,22,25,98,4,12,4,23,70,58,97,35,58},new int[]{97,6,7,21,15,66,87,67,12,49,79,62,33,61,13,13,59,28,77,24,30,4,13,76,1,44,49,81,24,34,39,42,7,23,21,43},new int[]{60,24,67,93,28,66,4,81,84,36,57,90,57,86,19,31,42,60,89,30,48,73,30,41,32,59,48,79,99,65,21,36,67,79,88,16},new int[]{58,7,80,28,50,12,25,30,72,11,60,42,55,36,49,46,94,70,35,94,14,37,92,40,52,41,5,21,55,49,61,6,51,61,62,24},new int[]{52,16,7,42,90,21,48,60,82,17,21,52,6,19,66,19,22,80,25,44,11,76,28,66,38,76,25,2,33,13,56,52,45,50,59,64},new int[]{88,84,84,47,12,45,37,8,97,31,29,18,56,20,72,46,88,1,58,67,75,42,43,3,21,69,65,78,68,19,47,20,7,60,48,9},new int[]{34,42,13,68,36,19,81,60,89,14,5,7,78,97,76,52,4,52,56,6,65,84,90,87,76,13,59,57,82,95,46,53,28,69,39,20},new int[]{20,98,50,14,15,36,30,18,98,26,83,64,68,91,55,67,44,59,12,36,2,42,34,31,69,20,38,75,95,89,4,85,62,1,42,51},new int[]{37,43,92,62,51,53,1,64,16,2,2,58,17,86,80,77,7,62,17,21,95,79,64,43,87,53,41,26,94,75,26,70,67,89,79,59},new int[]{21,42,70,23,57,53,76,27,62,79,72,25,43,48,61,19,35,21,18,93,91,40,74,53,5,22,56,14,40,1,77,27,49,58,81,72},new int[]{92,26,20,83,14,25,36,28,8,49,97,6,89,1,94,5,73,8,88,89,41,72,85,19,3,39,16,65,74,70,69,17,21,93,62,31},new int[]{3,38,60,92,92,65,76,16,89,82,8,70,51,50,73,18,94,84,82,29,75,82,33,3,92,5,80,59,4,18,27,18,66,6,99,83},new int[]{93,11,38,65,59,54,21,99,8,67,15,81,92,61,51,41,78,17,39,20,39,70,70,77,35,99,27,32,98,3,32,71,34,21,29,4},new int[]{68,1,31,45,81,71,52,44,50,36,21,23,77,34,69,31,12,28,48,28,7,34,86,51,88,78,80,11,94,38,42,7,46,45,3,79},new int[]{57,30,97,52,81,54,48,84,33,91,20,98,95,5,82,83,17,87,2,24,51,48,44,1,52,22,14,77,76,71,66,67,40,36,77,58}});
param0.add(new int[][]{new int[]{37,14,64,26,40,7,92,8,79,5,97,43,36,59,3,62,22,22,96,38,50,87,53,85,4,79,21,20,84,25,45,64,61,53,95,68},new int[]{56,93,99,94,58,73,37,5,18,33,13,33,40,66,12,93,93,47,48,23,40,5,36,31,23,16,72,9,54,66,18,47,83,37,40,72},new int[]{81,69,72,74,3,67,95,91,92,38,27,16,15,72,49,28,79,60,24,69,70,60,55,5,25,40,7,31,61,3,52,82,64,93,65,56},new int[]{29,59,40,33,88,35,71,97,68,35,34,74,74,20,44,81,41,77,7,94,22,11,13,23,74,28,17,47,94,22,49,40,84,6,82,95},new int[]{26,47,66,45,31,50,13,38,99,25,96,29,35,28,83,19,7,49,83,72,14,99,8,66,64,93,24,15,72,3,11,71,39,5,21,22},new int[]{96,38,7,90,91,53,53,43,51,4,18,2,58,33,65,94,63,89,90,31,80,68,13,27,57,14,52,63,80,73,94,9,39,91,7,57},new int[]{55,7,83,80,16,47,98,63,93,96,79,33,21,95,39,29,16,45,87,71,32,43,30,10,15,13,58,86,23,53,34,70,45,32,53,76},new int[]{31,44,79,76,99,65,25,10,33,57,42,52,63,15,8,38,28,72,88,2,3,25,34,36,81,52,19,93,62,52,83,30,11,9,98,20},new int[]{4,69,53,77,68,10,66,55,10,47,66,80,71,73,24,73,46,93,8,12,2,9,71,29,96,84,23,89,79,33,94,16,9,74,36,55},new int[]{32,47,14,35,14,1,51,88,76,48,58,41,73,13,57,26,15,80,10,17,10,47,10,61,35,8,10,71,98,65,69,81,48,20,68,46},new int[]{98,36,1,50,60,29,20,29,16,80,40,88,17,91,73,20,46,24,42,85,81,50,31,14,37,13,93,97,85,43,6,79,14,32,63,9},new int[]{46,74,83,67,32,1,16,32,66,83,47,79,5,14,69,11,27,39,7,2,49,42,23,21,87,1,29,51,35,35,37,47,18,97,6,74},new int[]{28,58,76,68,25,71,38,84,55,44,23,59,72,81,29,48,99,54,26,10,75,79,82,68,91,69,70,10,19,76,59,24,80,73,77,18},new int[]{32,19,38,21,56,85,57,49,6,55,2,6,81,30,55,11,25,35,73,89,8,67,90,86,24,21,16,46,36,10,66,97,91,17,75,73},new int[]{57,10,75,79,66,17,75,32,69,18,46,46,2,27,8,92,28,56,49,69,94,91,27,89,27,12,4,52,57,34,50,24,36,53,17,32},new int[]{54,60,55,62,59,76,6,32,2,16,55,91,68,28,80,23,47,10,61,82,99,53,68,85,59,90,16,36,19,21,99,39,37,57,21,85},new int[]{13,1,35,97,50,53,9,95,86,57,6,48,59,91,87,94,67,84,22,21,15,49,79,50,47,79,69,41,84,22,92,91,77,62,78,10},new int[]{74,19,91,88,43,65,27,8,54,81,28,44,91,97,24,65,8,2,18,79,61,42,40,4,64,39,79,90,77,10,34,91,27,45,88,95},new int[]{10,77,83,37,3,15,62,9,67,4,29,29,31,60,22,82,66,44,35,12,22,90,89,32,9,64,59,74,64,99,48,53,32,54,41,67},new int[]{55,94,35,58,69,94,1,9,49,68,46,84,88,37,77,77,19,81,20,39,15,97,93,72,21,54,10,49,1,32,88,14,28,40,52,27},new int[]{15,61,89,62,1,4,39,27,31,51,84,42,63,88,81,30,7,54,97,59,68,72,66,29,59,34,53,81,40,58,84,29,70,84,91,70},new int[]{49,6,7,36,70,98,1,94,22,81,42,84,32,32,6,6,72,11,29,33,1,91,72,77,37,37,93,26,41,90,96,42,60,88,3,13},new int[]{11,57,69,65,98,32,13,17,66,21,85,70,54,94,15,15,9,76,71,88,21,9,96,66,71,2,56,12,56,79,99,51,70,59,71,11},new int[]{3,34,95,85,93,19,7,11,63,67,56,43,56,45,60,33,28,96,57,52,4,99,17,35,42,60,26,48,64,17,98,72,73,7,65,52},new int[]{41,16,66,72,86,56,27,18,63,80,26,22,58,1,96,46,86,27,44,33,94,83,33,54,25,6,48,93,60,62,15,76,59,38,15,31},new int[]{65,20,29,75,73,16,80,33,55,19,89,50,34,64,24,32,3,13,94,87,94,12,62,45,24,24,94,81,15,50,88,96,88,67,45,65},new int[]{20,21,12,85,83,19,2,33,37,10,32,94,81,30,14,5,36,77,58,80,13,93,88,18,8,69,48,78,3,70,17,51,57,43,42,29},new int[]{86,98,55,70,43,60,41,91,49,78,84,27,3,81,68,42,77,54,1,21,67,47,89,59,1,14,98,40,67,9,69,25,64,60,33,5},new int[]{76,52,75,33,16,3,5,62,19,11,85,73,18,12,43,87,50,40,77,35,57,56,28,62,99,87,15,8,15,65,35,58,76,9,39,97},new int[]{21,95,60,94,43,63,42,83,34,17,98,65,25,99,58,10,97,78,6,50,20,46,76,91,11,79,28,2,64,14,69,74,78,82,98,81},new int[]{28,38,95,33,54,60,4,54,87,21,25,51,15,78,13,61,97,21,44,61,24,89,35,23,68,55,21,24,90,61,89,8,70,62,98,3},new int[]{16,6,21,3,65,71,24,20,34,46,72,89,38,28,37,61,25,76,43,20,82,33,33,39,12,78,20,18,74,17,5,64,28,33,38,85},new int[]{39,92,65,3,77,26,70,89,35,19,50,35,86,11,89,26,10,46,28,83,19,36,18,26,49,55,8,5,72,30,8,36,74,27,15,84},new int[]{38,82,39,76,43,82,35,51,38,91,72,35,52,96,9,44,8,72,1,25,71,32,62,10,86,17,11,47,56,41,16,25,30,76,41,61},new int[]{49,90,90,76,42,63,95,26,38,28,70,1,66,91,42,8,50,10,73,52,11,4,30,37,91,17,9,6,93,69,49,1,18,14,12,68},new int[]{72,70,60,84,87,81,65,53,39,49,78,2,16,48,45,26,11,55,97,13,27,62,12,63,3,4,15,92,47,78,24,41,70,75,93,16}});
param0.add(new int[][]{new int[]{82,57,41,47,46,74,62,36,30,15,18,29,58,93,22,55,23,93,44,70,60,88,5,87,34,12,75,67,88,93,41,95,8,2},new int[]{93,58,37,80,60,41,72,36,78,76,91,19,51,54,77,29,67,8,61,56,78,7,68,21,45,12,95,73,7,45,35,40,11,42},new int[]{2,34,54,99,80,51,32,79,74,12,13,30,86,71,80,45,97,87,97,70,46,32,83,36,30,3,37,82,98,80,4,68,43,7},new int[]{82,43,37,99,66,46,69,3,35,15,80,27,76,69,53,67,75,39,6,14,87,4,16,7,27,67,3,32,48,68,10,1,18,94},new int[]{28,43,80,22,64,30,41,39,74,25,11,87,22,20,5,22,81,18,79,94,76,2,3,44,78,36,37,78,23,53,79,62,71,58},new int[]{33,57,49,38,76,51,58,24,78,42,71,20,93,44,54,47,7,5,97,52,77,32,27,50,66,77,38,56,63,30,46,70,67,51},new int[]{94,59,83,59,50,80,68,52,45,9,64,8,49,55,90,9,12,92,69,80,19,87,8,18,26,43,26,79,14,7,89,2,48,70},new int[]{73,56,21,75,7,96,40,27,77,2,13,4,68,26,87,20,94,89,57,27,64,20,80,4,73,71,47,20,41,61,96,65,73,40},new int[]{83,40,98,54,98,23,65,36,56,87,64,93,87,47,87,42,27,91,91,23,87,85,71,85,45,84,32,39,54,44,64,70,82,6},new int[]{8,66,40,63,84,42,77,72,90,62,74,73,92,7,1,97,43,13,98,11,93,91,35,38,89,45,51,15,59,66,14,14,41,24},new int[]{5,34,32,92,46,77,16,85,22,87,32,76,41,22,53,23,35,89,43,62,45,94,57,94,67,55,31,54,36,35,14,22,15,87},new int[]{72,50,24,42,40,49,97,71,9,98,43,62,20,19,96,21,90,9,61,34,70,33,79,82,87,59,71,14,78,53,54,84,98,94},new int[]{44,29,7,94,94,46,90,69,89,94,34,46,19,30,8,86,94,18,87,60,88,44,52,80,8,13,42,78,20,96,35,72,66,87},new int[]{49,66,92,69,89,1,51,86,71,54,87,88,26,78,95,91,22,49,46,17,94,60,85,8,61,61,2,48,46,61,6,13,29,63},new int[]{99,94,46,34,84,15,74,24,82,3,28,50,76,97,16,49,42,3,33,88,1,51,78,9,99,16,73,76,31,49,6,30,45,89},new int[]{29,52,29,86,68,73,85,11,77,20,74,57,87,96,88,44,11,33,91,59,87,68,49,15,3,67,89,86,11,75,55,8,37,28},new int[]{20,22,58,46,75,23,98,34,50,47,88,49,3,30,23,65,18,52,67,88,25,2,58,86,73,54,16,63,43,44,16,79,7,27},new int[]{18,7,86,62,61,62,62,13,59,83,26,17,17,16,57,13,69,98,19,93,93,91,76,54,69,61,94,49,29,59,23,61,1,69},new int[]{48,4,11,43,14,32,56,77,96,50,62,9,31,51,50,81,77,30,26,11,3,54,83,22,49,55,86,63,96,71,64,88,73,47},new int[]{89,86,24,44,7,53,23,65,37,69,23,42,85,15,66,85,18,40,18,18,79,59,75,76,65,99,32,63,10,12,87,91,1,97},new int[]{19,23,11,49,68,67,75,48,9,24,39,9,15,1,75,23,9,6,12,54,15,3,1,13,97,75,62,80,3,16,32,90,28,91},new int[]{81,48,48,27,12,35,19,97,17,9,46,12,33,79,29,13,67,99,58,85,99,99,95,77,96,63,82,18,10,80,87,31,53,98},new int[]{44,29,49,80,57,94,89,37,48,83,96,59,12,15,56,79,84,60,70,19,53,29,62,27,99,97,83,40,36,69,20,98,48,71},new int[]{98,55,58,92,39,86,41,50,59,56,53,63,41,30,55,85,61,40,73,36,13,46,97,90,1,60,2,36,45,94,80,9,15,39},new int[]{55,59,86,79,4,16,11,96,22,65,54,90,3,96,97,97,66,86,57,12,66,8,81,4,44,65,6,62,40,86,35,50,40,11},new int[]{66,18,73,70,34,12,21,60,90,10,16,79,23,21,61,43,16,58,11,84,21,16,75,33,86,89,33,98,15,65,4,81,92,32},new int[]{8,36,83,56,88,3,14,96,76,95,34,95,36,96,35,32,80,1,52,13,75,75,25,64,5,63,85,99,76,52,46,77,67,76},new int[]{47,34,20,39,52,50,68,41,43,49,71,47,57,67,46,41,77,29,41,85,46,25,3,30,86,2,9,58,4,72,19,85,14,1},new int[]{20,83,80,74,66,65,8,9,39,64,57,82,15,80,85,25,88,16,49,73,79,48,77,60,61,44,24,51,33,12,10,31,56,4},new int[]{36,10,67,22,85,38,46,67,29,51,60,59,5,3,64,94,47,40,8,56,77,54,84,77,6,74,53,26,70,26,28,76,53,61},new int[]{40,68,88,15,88,13,67,91,45,79,26,56,23,39,97,21,14,13,32,12,63,52,74,22,47,25,93,71,35,93,80,72,51,59},new int[]{73,20,19,16,62,29,98,92,34,81,4,55,52,98,30,59,64,38,30,95,43,96,56,98,82,6,3,40,78,38,17,51,27,37},new int[]{26,78,60,88,21,65,62,42,96,63,75,58,81,62,67,29,19,97,5,66,9,41,25,84,75,12,65,88,81,16,55,38,43,8},new int[]{53,61,88,70,46,9,67,23,31,34,35,48,81,21,67,38,53,35,98,14,80,58,68,73,38,15,54,65,10,11,95,36,98,57}});
param0.add(new int[][]{new int[]{37,18,39,36},new int[]{40,7,76,19},new int[]{37,8,74,36},new int[]{71,92,41,43}});
param0.add(new int[][]{new int[]{65,54,93,86,22,47,45,88,25,20,30,51,71,3,70,80,77,7,29,55,75,2,88,26,45,54,38,9,70,54,47,94,78,48,78,78,24},new int[]{82,2,96,90,31,21,93,78,64,49,47,1,34,32,63,63,52,39,76,48,3,14,86,26,35,87,4,45,26,53,64,26,90,94,29,96,61},new int[]{14,93,53,59,69,30,22,96,81,94,6,5,41,86,47,23,77,53,40,61,80,14,22,68,81,3,67,73,38,7,13,96,55,2,37,77,93},new int[]{77,50,20,49,11,50,41,73,4,43,79,31,2,12,85,30,44,87,75,36,25,71,50,72,22,36,3,78,27,90,7,37,55,44,72,60,59},new int[]{52,4,2,17,85,84,30,48,2,79,66,27,21,89,93,5,65,25,25,48,11,97,19,18,7,87,4,21,41,77,91,6,77,63,18,27,87},new int[]{46,46,95,85,89,45,43,80,50,80,21,33,92,30,1,69,33,75,72,95,85,89,18,12,12,99,64,29,78,77,19,84,2,12,44,74,36},new int[]{17,7,18,13,77,60,12,79,48,51,67,60,10,23,4,25,65,61,69,69,47,27,62,71,49,61,88,87,72,30,31,16,92,65,11,62,38},new int[]{87,96,96,93,95,59,19,9,96,95,69,23,55,85,20,13,57,20,47,77,7,34,56,53,53,81,63,30,68,4,37,39,36,15,86,75,36},new int[]{96,19,16,74,81,43,6,97,84,14,28,6,19,6,5,66,48,70,14,78,94,45,40,88,30,75,78,22,3,29,48,8,49,7,24,5,84},new int[]{64,5,49,70,92,15,59,90,21,85,9,47,41,56,74,48,62,89,85,98,31,66,16,35,49,31,76,54,23,17,14,97,48,48,6,23,48},new int[]{49,61,31,5,67,38,28,31,58,54,17,22,64,13,44,85,47,85,6,10,58,40,14,23,71,88,15,87,5,41,20,52,10,87,27,51,60},new int[]{95,6,77,28,16,17,46,95,10,31,59,39,6,84,49,21,16,25,39,36,34,72,14,57,49,87,76,84,60,88,77,33,34,32,55,29,27},new int[]{77,86,71,71,93,14,2,7,81,33,22,14,54,1,72,41,8,29,81,91,45,8,6,51,94,23,79,60,41,14,27,67,12,67,40,65,17},new int[]{18,10,59,12,17,22,14,41,8,17,79,6,71,50,96,43,9,84,42,45,39,66,64,82,61,38,66,79,11,3,9,43,87,63,10,88,32},new int[]{68,7,93,45,46,60,29,64,73,46,2,3,92,84,42,68,62,30,31,41,22,73,9,31,16,35,22,52,59,95,13,92,51,39,59,39,71},new int[]{89,48,65,50,46,35,63,75,98,82,31,60,16,51,94,55,37,25,28,24,98,21,11,53,91,73,16,11,14,43,79,86,42,86,89,86,67},new int[]{30,65,45,3,47,81,97,77,61,56,8,32,57,26,70,76,8,93,20,13,45,8,18,26,84,33,8,76,66,16,43,11,81,94,44,8,87},new int[]{74,70,65,75,87,67,78,77,20,99,49,15,5,53,41,85,49,75,71,76,68,23,26,48,60,66,16,98,75,87,51,23,51,55,94,45,84},new int[]{80,11,46,95,88,58,26,66,57,79,45,22,26,49,68,6,22,38,23,64,89,67,20,33,20,70,76,44,83,25,49,82,15,27,88,21,79},new int[]{26,10,67,93,38,55,69,88,69,32,90,48,27,76,32,36,55,70,13,50,95,18,29,10,39,3,82,48,93,42,47,26,32,27,75,70,95},new int[]{8,88,18,73,22,63,50,74,1,3,90,56,7,27,15,87,85,77,32,49,84,69,32,53,28,92,76,70,90,81,36,62,10,90,80,96,80},new int[]{14,25,65,39,43,80,97,86,92,50,23,2,15,44,44,63,37,5,32,87,23,97,70,48,33,20,2,84,87,90,54,26,2,66,97,74,28},new int[]{15,82,91,52,39,76,14,31,73,46,40,59,26,91,16,2,81,93,96,63,25,67,41,55,99,3,27,14,33,85,10,53,81,71,91,95,40},new int[]{98,24,10,49,28,33,47,13,44,93,27,75,74,29,78,85,40,89,7,79,72,86,77,39,25,28,51,80,71,49,57,70,15,99,2,12,78},new int[]{53,60,66,43,34,28,5,35,16,38,99,46,44,44,5,46,46,77,65,29,2,63,81,36,38,88,18,8,28,4,38,82,64,72,58,63,20},new int[]{60,35,81,37,75,63,35,52,18,57,20,59,68,26,13,21,88,95,55,42,83,97,99,23,70,44,26,65,76,51,74,90,27,37,40,27,65},new int[]{60,56,78,52,53,14,32,96,83,72,35,49,14,59,5,95,32,88,22,61,21,33,79,51,48,15,3,94,57,56,62,18,72,83,56,48,91},new int[]{5,90,14,41,60,50,63,65,32,91,18,18,41,75,70,51,93,36,5,34,15,9,97,81,11,42,63,41,61,30,13,75,7,58,42,64,45},new int[]{85,71,22,96,4,79,39,85,41,41,41,28,43,64,6,66,31,91,9,1,15,23,17,58,71,67,98,53,83,30,10,55,42,48,82,23,87},new int[]{4,99,73,75,65,10,95,14,92,36,88,28,59,4,78,69,96,17,98,37,62,90,31,92,28,93,53,36,26,86,99,28,61,22,50,35,82},new int[]{69,93,11,88,38,59,45,44,25,16,20,54,13,35,12,63,4,36,94,93,82,93,9,74,10,53,8,59,19,44,44,34,53,3,87,2,60},new int[]{46,15,99,7,61,35,35,69,49,83,95,2,34,13,64,35,98,78,35,26,44,7,39,85,79,13,84,98,90,4,98,84,19,31,83,43,64},new int[]{2,90,22,81,88,76,22,84,67,15,43,14,74,20,23,54,73,62,62,64,74,53,61,53,3,12,20,25,89,28,16,51,40,21,71,76,99},new int[]{82,82,11,32,97,47,45,97,79,18,86,6,59,86,6,15,94,61,30,46,96,84,17,93,75,84,84,8,50,17,57,58,76,96,86,27,58},new int[]{51,47,57,50,90,31,29,95,24,63,68,78,77,23,8,13,1,63,27,81,41,9,27,90,21,46,48,68,14,42,59,75,62,4,59,34,5},new int[]{32,80,92,66,35,8,57,25,23,36,25,17,63,64,90,37,85,5,24,74,66,90,73,48,30,39,63,96,57,72,61,3,4,89,49,91,16},new int[]{23,26,79,26,25,42,75,77,44,1,36,95,22,5,19,95,87,61,86,57,95,21,67,53,60,61,75,12,42,89,48,85,71,95,75,65,78}});
param0.add(new int[][]{new int[]{69,40,56,69,66,38,70,81,5,78,60,47,92,76,97,40,24,18,75,89,83,68,62,7,82,15,79,66,36,59,71,29,25,55,21,49,12,8,85,41,24,36,2},new int[]{29,13,89,7,40,59,58,11,29,17,13,9,94,42,9,21,78,27,55,35,91,40,89,12,72,29,5,60,19,35,46,46,45,39,41,89,18,59,87,30,65,90,84},new int[]{41,85,55,59,45,84,67,17,91,82,74,20,23,64,8,65,60,7,4,28,19,6,26,40,19,81,93,21,5,17,38,62,40,7,27,31,98,62,26,70,31,12,15},new int[]{58,1,62,59,90,37,6,24,47,64,36,83,56,82,80,17,11,4,80,9,87,74,90,39,67,84,81,47,28,1,36,89,97,50,85,94,77,39,50,23,53,6,83},new int[]{10,16,77,22,66,42,90,5,94,37,86,51,82,93,19,4,72,27,55,93,97,7,61,99,68,26,59,77,75,39,34,25,85,36,66,89,96,65,97,6,13,17,80},new int[]{38,86,43,41,71,2,1,19,16,34,93,72,90,11,74,68,51,98,49,23,2,97,32,54,20,77,67,93,18,70,14,68,90,76,61,38,58,92,41,6,4,72,44},new int[]{95,96,4,28,7,9,67,53,97,20,19,16,3,6,93,54,98,78,26,34,9,55,33,60,19,73,39,6,23,57,9,90,10,70,14,17,68,78,24,13,59,65,38},new int[]{97,17,14,81,46,16,71,47,76,23,6,38,30,22,1,67,40,1,97,48,39,44,49,61,75,54,96,19,21,75,86,19,28,96,90,19,15,5,12,23,49,81,11},new int[]{95,41,58,72,40,22,96,10,39,51,45,70,99,75,18,97,41,77,69,53,64,46,25,68,47,29,24,85,58,75,27,48,41,74,11,43,73,3,49,49,44,6,48},new int[]{89,71,27,50,86,83,94,86,23,76,66,29,93,14,73,90,29,5,86,59,93,77,18,71,77,61,48,85,92,44,38,3,28,54,45,86,43,33,13,41,57,5,8},new int[]{66,44,43,81,4,19,34,62,81,89,5,81,11,58,16,80,70,82,3,18,7,75,47,15,62,78,23,36,17,22,24,27,17,23,71,1,50,63,50,91,98,37,15},new int[]{56,82,56,68,29,87,43,86,20,86,12,99,90,14,61,84,76,61,9,97,88,73,24,94,69,8,79,45,53,20,58,79,86,96,70,33,61,11,92,3,49,57,67},new int[]{29,11,55,96,50,15,4,32,52,62,98,74,94,41,82,17,5,72,69,81,39,91,32,7,86,76,50,88,49,43,17,71,81,20,91,45,74,70,48,32,8,44,62},new int[]{83,83,22,35,28,33,6,12,97,50,98,61,50,76,37,67,61,92,11,80,54,67,86,58,49,79,99,84,43,68,93,84,29,14,1,18,81,15,89,13,97,24,34},new int[]{11,62,47,25,32,65,29,41,75,22,76,1,16,16,3,94,3,99,52,31,35,50,76,94,89,23,81,65,81,59,35,63,18,10,47,33,6,21,47,30,90,71,21},new int[]{45,97,50,3,76,33,88,71,58,72,47,37,54,35,63,7,4,34,39,86,33,75,9,15,92,30,44,23,68,78,83,88,57,45,71,18,45,49,15,47,5,62,84},new int[]{7,74,65,98,87,94,40,83,57,33,98,80,34,30,24,96,36,16,83,58,3,81,31,3,12,38,46,94,62,70,77,53,34,5,86,73,33,27,12,18,47,42,73},new int[]{89,30,37,42,16,27,23,70,95,78,27,17,6,78,83,10,45,56,31,91,40,3,47,92,24,11,75,31,47,78,43,11,56,6,1,76,2,36,73,80,41,98,65},new int[]{33,66,93,73,8,92,3,44,11,1,48,70,42,77,45,91,87,34,32,61,93,6,78,78,97,88,62,35,11,14,45,26,90,40,34,79,92,95,66,22,41,59,99},new int[]{82,32,35,70,4,94,76,8,53,85,31,22,14,73,33,16,18,16,30,12,14,94,85,6,24,13,52,92,81,74,77,97,71,69,97,98,14,85,82,78,91,39,48},new int[]{26,28,65,13,99,86,45,3,50,85,1,99,52,38,10,88,63,52,8,58,49,4,34,32,25,31,10,35,40,77,60,78,68,3,67,3,64,48,53,8,47,61,27},new int[]{73,70,20,10,28,68,52,2,38,1,43,58,64,3,69,8,16,76,84,14,92,33,43,42,46,47,88,2,70,33,69,59,44,88,28,48,64,97,58,18,89,37,29},new int[]{52,61,77,53,80,77,20,67,43,58,14,12,33,81,82,12,45,26,28,77,12,57,4,84,57,10,49,45,47,74,28,12,22,64,85,45,15,80,64,66,50,79,79},new int[]{87,82,93,43,33,93,37,17,26,43,58,9,21,65,63,73,27,78,36,59,95,46,99,30,82,17,81,52,47,92,88,37,99,92,14,36,35,58,50,6,62,62,38},new int[]{85,92,9,13,80,23,96,33,54,45,48,85,68,61,99,52,46,44,75,49,37,41,22,42,58,52,53,49,13,62,36,52,41,37,19,58,24,63,55,4,25,61,31},new int[]{21,94,5,68,96,5,16,91,12,65,66,72,43,98,25,98,46,1,78,32,61,29,48,83,94,23,69,87,99,53,71,95,78,91,87,26,71,21,88,81,60,55,73},new int[]{79,68,88,95,12,8,17,43,9,17,16,51,35,52,77,12,94,67,69,13,13,28,47,44,63,69,20,92,36,45,82,57,87,91,2,42,50,31,82,48,87,80,26},new int[]{25,35,86,73,34,45,23,91,74,16,4,54,95,68,53,14,80,83,3,42,67,50,20,55,66,84,53,26,19,63,33,98,28,48,53,56,49,78,63,14,29,53,26},new int[]{33,69,66,73,19,91,59,91,90,78,3,58,21,46,40,72,70,66,57,6,59,39,75,69,74,52,38,71,82,74,57,7,36,95,50,72,40,74,40,51,92,90,20},new int[]{2,87,23,81,41,57,21,39,26,95,72,51,71,21,58,50,23,77,42,42,92,40,27,96,20,62,13,42,66,43,83,49,79,91,12,40,74,92,68,4,92,42,93},new int[]{12,22,68,89,72,93,71,8,18,90,60,73,61,31,6,79,18,54,40,51,74,72,89,98,36,6,23,48,20,61,87,55,87,36,45,86,87,42,73,29,21,62,37},new int[]{37,30,67,33,61,48,43,80,28,20,43,74,28,8,88,65,17,60,20,13,13,31,22,15,79,98,47,36,96,13,84,25,53,86,67,41,29,41,68,82,54,40,21},new int[]{95,98,17,90,89,4,60,92,38,66,52,67,29,28,60,91,7,21,38,78,44,87,52,99,94,93,73,51,23,69,14,15,15,35,11,93,37,72,21,15,45,76,97},new int[]{8,24,32,71,25,46,81,95,10,50,56,72,1,9,48,26,10,90,58,45,18,59,57,67,28,81,15,35,42,25,13,66,99,57,61,86,82,85,11,57,43,47,42},new int[]{4,62,25,34,56,69,41,33,44,71,92,84,74,30,67,28,95,40,31,66,95,18,10,32,72,85,85,43,46,85,95,27,93,78,9,11,71,5,72,59,67,33,83},new int[]{47,32,41,9,11,35,12,12,98,50,51,36,98,30,41,3,98,49,55,32,79,8,51,49,73,90,63,22,38,94,33,14,69,10,44,25,84,52,75,51,51,34,16},new int[]{68,57,53,52,28,74,88,48,73,6,37,10,61,95,41,52,34,9,29,41,1,64,12,23,1,95,25,38,4,43,90,61,32,28,33,27,1,8,85,23,32,3,44},new int[]{54,6,70,49,59,57,89,61,56,41,14,83,77,37,41,30,92,42,36,56,71,83,78,26,84,14,39,96,60,94,28,44,45,18,30,70,70,3,7,34,82,65,27},new int[]{54,79,43,24,91,62,93,84,40,30,44,82,83,15,49,87,43,6,50,46,40,30,74,30,1,29,89,95,15,17,8,74,46,57,79,28,90,84,77,31,51,78,29},new int[]{78,14,84,41,35,5,64,79,56,77,1,7,12,96,21,76,36,33,4,51,49,73,39,71,18,59,23,20,31,89,67,53,54,62,20,25,94,51,21,48,99,54,99},new int[]{94,16,87,60,75,12,99,69,56,44,38,22,81,21,91,13,94,46,59,79,18,43,55,75,71,98,32,77,16,90,40,41,54,34,85,18,20,76,85,96,9,47,61},new int[]{11,11,28,81,97,98,24,21,35,37,11,32,26,18,76,20,34,91,54,98,65,79,14,43,27,67,2,76,63,51,98,93,87,49,73,15,1,37,10,21,35,50,34},new int[]{75,48,54,68,74,10,31,11,4,87,75,5,22,39,41,11,58,11,48,72,53,57,40,98,49,62,61,52,28,66,77,42,78,69,35,98,9,7,57,36,35,14,74}});
param0.add(new int[][]{new int[]{74,32,24,39,84,34,39,40,15,49,60,14,15,12,18,15,6},new int[]{61,8,50,18,95,67,24,95,91,88,40,24,56,45,12,39,91},new int[]{29,1,1,37,12,68,71,48,40,15,26,55,25,95,42,25,25},new int[]{25,17,75,21,58,16,97,7,75,5,98,79,25,8,1,62,33},new int[]{78,47,60,43,5,90,22,63,2,99,3,1,98,11,99,69,93},new int[]{17,1,33,46,30,77,52,9,72,75,3,48,26,84,53,12,66},new int[]{83,65,93,23,6,43,98,83,96,83,59,94,97,61,42,65,24},new int[]{35,25,15,27,15,16,62,56,22,87,65,17,59,11,2,93,58},new int[]{70,12,55,3,77,66,92,66,1,80,65,31,96,18,46,26,24},new int[]{41,30,8,68,46,60,46,89,90,74,1,95,62,46,19,3,86},new int[]{58,90,79,63,77,10,54,18,69,59,44,96,49,56,20,24,79},new int[]{40,58,23,41,59,14,43,11,86,99,31,17,82,53,46,78,25},new int[]{25,55,22,90,42,12,55,43,96,38,5,54,17,85,17,32,62},new int[]{34,59,69,90,4,84,95,72,70,81,89,4,14,81,60,79,89},new int[]{51,13,99,74,30,82,67,18,21,89,44,57,56,47,7,95,99},new int[]{69,73,65,19,41,96,66,82,17,58,99,68,47,65,14,77,16},new int[]{33,99,5,56,37,12,73,65,37,82,65,47,7,23,17,42,62}});
param0.add(new int[][]{new int[]{49,31,43,10,49,12,37,33,44,33,45,47,72,76,53,27,59,99,91,75,50,74,20,97,56,18,80,65,79,54,5,15,62,86,38,45,89,61,52,97,60,24,63,60},new int[]{10,46,68,6,73,44,78,92,82,31,35,35,19,33,95,89,59,47,71,68,2,89,25,34,53,25,22,37,1,32,79,48,78,7,67,66,57,36,93,74,13,83,44,82},new int[]{62,68,47,30,73,35,51,53,10,43,1,2,5,32,95,39,28,71,51,2,75,48,83,27,48,64,87,95,70,49,9,33,23,93,94,70,60,17,2,39,14,80,37,88},new int[]{68,29,90,19,18,92,92,31,12,85,32,68,23,58,13,17,95,22,73,6,73,66,59,62,8,48,9,99,21,38,76,41,3,24,28,61,55,42,73,4,91,3,75,73},new int[]{62,47,94,35,62,61,97,15,94,75,52,64,56,31,2,71,61,57,9,90,52,10,31,15,17,27,54,61,14,92,72,50,92,30,41,93,12,99,83,54,46,69,76,70},new int[]{5,88,18,25,58,56,28,49,88,87,65,78,83,38,97,70,34,23,91,14,86,38,78,86,45,61,9,75,76,89,2,9,50,45,35,96,62,78,93,57,83,46,69,81},new int[]{98,86,75,30,50,93,15,36,39,81,60,27,54,2,70,4,87,47,95,48,57,65,58,51,47,77,70,34,37,80,55,96,44,79,68,43,76,10,66,88,16,35,40,81},new int[]{72,93,62,34,42,95,81,4,63,23,11,23,61,69,52,61,96,5,17,87,34,94,91,97,16,95,4,52,20,48,96,98,51,45,80,93,49,93,56,3,42,71,42,85},new int[]{99,29,95,17,85,28,60,87,95,92,47,11,65,60,88,61,77,43,39,91,1,9,85,74,9,3,29,86,42,43,94,24,3,8,45,26,99,51,95,55,33,35,80,11},new int[]{49,79,25,78,73,10,87,45,6,28,13,77,64,30,5,71,55,90,87,52,28,24,97,77,49,98,77,95,93,95,48,31,24,94,71,20,2,82,76,58,54,85,39,19},new int[]{70,73,4,20,3,73,91,62,69,68,19,16,22,80,21,56,60,34,69,80,66,13,96,78,21,60,68,74,46,16,55,11,33,86,50,52,75,92,62,98,41,11,7,79},new int[]{84,16,29,5,85,64,15,6,49,87,51,42,93,65,5,73,79,97,24,37,53,6,39,75,89,62,82,86,60,41,78,10,81,93,70,7,5,27,35,55,17,7,61,65},new int[]{15,58,49,75,52,26,43,53,56,78,77,68,33,14,77,17,39,48,6,22,87,37,43,45,99,96,65,4,68,97,57,34,30,39,79,96,90,39,72,90,17,94,99,12},new int[]{6,29,14,1,91,39,6,97,44,41,95,32,97,84,5,47,17,33,42,23,70,50,29,64,4,7,79,62,59,21,16,70,13,8,97,61,3,46,62,23,8,20,30,75},new int[]{54,20,2,98,17,15,65,69,98,69,72,68,43,12,94,83,22,92,94,70,20,15,8,37,28,11,70,27,42,75,83,76,81,8,59,60,95,62,19,43,60,51,84,64},new int[]{66,70,91,48,18,20,73,67,40,18,12,83,26,97,33,6,58,57,9,10,44,53,27,81,52,84,64,54,13,31,81,49,75,27,13,46,51,43,79,86,89,19,29,87},new int[]{83,67,19,13,97,88,38,35,33,45,57,49,66,83,39,47,33,91,50,66,33,49,71,10,28,89,95,44,13,95,29,40,9,95,29,4,81,81,19,48,67,97,42,82},new int[]{85,58,88,59,16,95,60,67,17,64,33,71,22,7,97,5,13,94,10,14,71,31,4,48,63,4,78,79,57,35,98,14,77,24,23,53,80,99,27,98,85,8,33,92},new int[]{91,17,58,62,78,30,46,17,67,57,6,56,89,70,50,67,35,19,75,15,37,96,31,55,86,71,1,96,54,85,34,72,27,43,87,16,78,25,69,3,68,75,72,59},new int[]{97,61,86,15,61,12,63,24,71,24,78,62,13,10,65,5,98,47,8,51,78,37,81,43,86,57,44,65,49,39,76,30,93,80,66,51,79,46,8,6,59,5,78,68},new int[]{3,32,88,62,88,30,49,12,89,50,82,18,93,47,63,44,21,48,66,32,94,45,51,53,28,89,62,29,61,8,46,31,66,62,18,55,85,37,86,30,83,21,78,13},new int[]{99,19,4,21,24,45,13,22,87,49,48,17,20,32,50,62,15,42,11,37,68,38,81,61,61,93,15,28,87,67,21,29,61,16,43,24,96,31,98,85,13,25,6,86},new int[]{79,43,82,95,51,75,89,41,89,82,35,44,14,56,84,58,43,59,55,37,34,46,48,90,40,20,42,72,64,23,51,99,12,51,3,7,37,20,88,58,89,19,27,77},new int[]{86,36,60,23,84,30,83,91,39,66,34,9,85,84,72,50,85,80,1,2,69,35,74,45,10,63,26,79,3,79,46,39,80,50,60,87,19,10,4,97,39,77,75,43},new int[]{72,93,98,37,85,18,29,94,46,50,17,23,6,91,35,37,89,49,3,40,60,35,40,59,4,41,55,5,65,31,60,43,9,91,58,16,70,88,89,34,35,85,96,77},new int[]{38,50,94,12,97,30,44,87,89,94,96,94,92,2,74,9,71,12,34,79,49,51,12,6,26,69,49,51,74,85,92,41,11,47,14,16,44,58,21,14,76,26,73,3},new int[]{88,49,41,19,12,55,2,28,42,65,29,3,87,8,78,28,42,85,3,60,51,78,19,4,87,7,41,16,65,53,55,20,90,4,37,82,81,22,44,98,61,72,46,26},new int[]{3,89,55,37,47,48,36,15,7,31,61,46,15,13,22,50,52,56,44,87,67,20,83,46,48,30,42,96,41,30,24,12,44,53,17,73,79,25,12,78,84,46,49,45},new int[]{37,27,30,25,92,81,26,71,47,39,84,8,28,15,81,91,26,53,15,55,13,20,81,89,85,8,17,34,48,10,95,78,75,75,29,16,19,86,24,43,56,39,9,93},new int[]{48,33,42,91,92,34,45,36,32,82,26,80,96,33,88,43,6,52,60,78,84,90,78,59,44,24,71,67,40,90,20,25,94,32,71,52,85,21,49,23,64,12,68,83},new int[]{5,65,95,64,43,48,2,66,75,73,67,33,23,82,62,74,59,95,80,27,68,43,54,65,46,12,55,58,9,93,46,37,65,83,77,64,73,22,25,9,35,53,46,46},new int[]{63,57,73,7,81,76,73,6,88,19,55,64,81,78,65,56,82,94,88,80,18,11,64,34,38,66,36,27,8,80,79,1,90,95,67,65,4,10,97,71,79,73,69,33},new int[]{42,29,63,25,19,81,29,85,79,90,3,30,81,6,77,71,41,80,5,81,65,73,50,77,92,21,71,69,56,72,23,33,65,94,24,87,21,77,98,41,87,85,22,46},new int[]{29,53,23,22,98,8,88,44,9,31,11,49,95,52,54,67,25,77,80,44,22,13,19,58,61,92,21,26,41,42,51,81,61,7,90,57,58,24,17,58,64,14,4,80},new int[]{20,33,49,18,28,82,53,12,84,69,58,36,63,64,11,41,32,1,22,22,54,77,47,69,31,80,30,90,83,9,54,83,69,10,97,89,8,56,26,32,87,12,38,32},new int[]{96,26,2,94,39,99,5,84,60,81,23,97,60,40,76,57,59,28,5,86,2,41,66,33,69,88,83,38,29,72,50,68,71,89,58,2,7,72,63,47,29,61,85,85},new int[]{89,31,91,33,39,14,34,31,48,70,26,93,52,32,5,52,61,19,73,17,38,65,77,21,14,83,53,14,72,63,25,18,77,88,56,9,90,23,98,13,39,14,61,93},new int[]{91,86,41,21,62,43,25,29,22,77,92,13,86,46,91,94,58,28,41,41,20,99,51,8,50,32,43,61,85,86,88,85,44,36,68,11,8,4,74,12,97,37,65,81},new int[]{14,98,40,91,24,82,63,16,51,16,58,35,68,98,33,87,74,57,75,68,92,12,17,69,96,2,77,85,13,32,41,20,59,1,47,47,87,77,5,99,4,93,66,48},new int[]{54,3,22,78,77,2,55,73,16,12,56,50,66,97,85,79,78,11,18,51,89,72,66,84,57,26,74,72,94,6,98,56,47,80,19,3,13,82,41,41,7,22,31,83},new int[]{19,47,15,72,93,56,50,17,34,42,85,29,72,6,68,24,20,83,81,52,88,91,23,78,54,75,87,8,12,45,57,65,68,4,62,77,31,54,31,32,40,4,7,56},new int[]{57,46,49,50,49,80,43,65,6,86,30,72,67,54,74,25,42,72,61,38,36,41,47,87,31,2,68,34,8,56,96,11,87,70,74,68,67,12,61,1,78,92,11,30},new int[]{2,6,24,78,36,2,67,26,29,87,50,7,60,68,79,23,22,71,50,82,89,48,15,6,59,76,80,26,39,72,27,91,65,43,41,61,32,3,94,61,17,9,57,48},new int[]{7,32,93,58,82,5,98,39,15,70,32,53,59,3,25,57,51,17,47,11,35,6,25,17,55,30,10,28,67,55,82,80,26,83,81,41,61,57,45,28,20,38,94,13}});
List<Integer> param1 = new ArrayList<>();
param1.add(3);
param1.add(10);
param1.add(24);
param1.add(30);
param1.add(22);
param1.add(3);
param1.add(32);
param1.add(39);
param1.add(14);
param1.add(34);
List<Integer> param2 = new ArrayList<>();
param2.add(3);
param2.add(13);
param2.add(29);
param2.add(28);
param2.add(33);
param2.add(3);
param2.add(21);
param2.add(39);
param2.add(13);
param2.add(26);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} | null | null |
FIND_REPETITIVE_ELEMENT_1_N_1_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_REPETITIVE_ELEMENT_1_N_1_2{
static int f_gold ( int arr [ ] , int n ) {
int res = 0 ;
for ( int i = 0 ;
i < n - 1 ;
i ++ ) res = res ^ ( i + 1 ) ^ arr [ i ] ;
res = res ^ arr [ n - 1 ] ;
return res ;
}
| def f_gold ( arr , n ) :
res = 0
for i in range ( 0 , n - 1 ) :
res = res ^ ( i + 1 ) ^ arr [ i ]
res = res ^ arr [ n - 1 ]
return res
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int res = 0;
for ( int i = 0;
i < n - 1;
i ++ ) res = res ^ ( i + 1 ) ^ arr [ i ];
res = res ^ arr [ n - 1 ];
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,2,4,5,5,7,7,7,8,11,14,15,18,19,20,25,25,29,29,31,32,32,33,38,42,48,52,55,60,61,63,71,74,78,82,82,84,84,87,87,88,90,93,94,94});
param0.add(new int[]{46,2,62,60,92,4,26,66,66,90,26,-14,76,-20,-68});
param0.add(new int[]{0,0,0,1,1,1,1,1});
param0.add(new int[]{87,67,11,47,64,81,94,75,58,77,18,2,85,26,6,44,55,19,46,49,5,69,44,12,42,66,46,9,26,49,68,95,6,9,11,72,5,67});
param0.add(new int[]{-98,-94,-92,-82,-78,-64,-62,-58,-52,-44,-40,-38,-8,6,10,20,22,28,30,30,36,54,54,58,64,68,76,78,84,88,90,94,96});
param0.add(new int[]{1,0,0,1,1,0,0,0,1,0,0,0,1,1,1,0,1,0,1,0,0,0,0,0,1,1});
param0.add(new int[]{1,14,15,15,21,34,38,39,41,50,60,74,96,97});
param0.add(new int[]{96,-12,-16,-52});
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,1,1,1,1,1,1,1});
param0.add(new int[]{66,21,21,59,78,8,46,41,16,32,97,93,32,86,91,61,67,61,97,49,66,35,24,35,65,45,83});
List<Integer> param1 = new ArrayList<>();
param1.add(31);
param1.add(8);
param1.add(4);
param1.add(34);
param1.add(29);
param1.add(17);
param1.add(7);
param1.add(3);
param1.add(21);
param1.add(25);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([2, 2, 4, 5, 5, 7, 7, 7, 8, 11, 14, 15, 18, 19, 20, 25, 25, 29, 29, 31, 32, 32, 33, 38, 42, 48, 52, 55, 60, 61, 63, 71, 74, 78, 82, 82, 84, 84, 87, 87, 88, 90, 93, 94, 94],31,),
([46, 2, 62, 60, 92, 4, 26, 66, 66, 90, 26, -14, 76, -20, -68],8,),
([0, 0, 0, 1, 1, 1, 1, 1],4,),
([87, 67, 11, 47, 64, 81, 94, 75, 58, 77, 18, 2, 85, 26, 6, 44, 55, 19, 46, 49, 5, 69, 44, 12, 42, 66, 46, 9, 26, 49, 68, 95, 6, 9, 11, 72, 5, 67],34,),
([-98, -94, -92, -82, -78, -64, -62, -58, -52, -44, -40, -38, -8, 6, 10, 20, 22, 28, 30, 30, 36, 54, 54, 58, 64, 68, 76, 78, 84, 88, 90, 94, 96],29,),
([1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1],17,),
([1, 14, 15, 15, 21, 34, 38, 39, 41, 50, 60, 74, 96, 97],7,),
([96, -12, -16, -52],3,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],21,),
([66, 21, 21, 59, 78, 8, 46, 41, 16, 32, 97, 93, 32, 86, 91, 61, 67, 61, 97, 49, 66, 35, 24, 35, 65, 45, 83],25,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,2,4,5,5,7,7,7,8,11,14,15,18,19,20,25,25,29,29,31,32,32,33,38,42,48,52,55,60,61,63,71,74,78,82,82,84,84,87,87,88,90,93,94,94},{46,2,62,60,92,4,26,66,66,90,26,-14,76,-20,-68},{0,0,0,1,1,1,1,1},{87,67,11,47,64,81,94,75,58,77,18,2,85,26,6,44,55,19,46,49,5,69,44,12,42,66,46,9,26,49,68,95,6,9,11,72,5,67},{-98,-94,-92,-82,-78,-64,-62,-58,-52,-44,-40,-38,-8,6,10,20,22,28,30,30,36,54,54,58,64,68,76,78,84,88,90,94,96},{1,0,0,1,1,0,0,0,1,0,0,0,1,1,1,0,1,0,1,0,0,0,0,0,1,1},{1,14,15,15,21,34,38,39,41,50,60,74,96,97},{96,-12,-16,-52},{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},{66,21,21,59,78,8,46,41,16,32,97,93,32,86,91,61,67,61,97,49,66,35,24,35,65,45,83}};
vector<int> param1 {31,8,4,34,29,17,7,3,21,25};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
DECIMAL_BINARY_CONVERSION_WITHOUT_USING_ARITHMETIC_OPERATORS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DECIMAL_BINARY_CONVERSION_WITHOUT_USING_ARITHMETIC_OPERATORS{
static String f_gold ( int n ) {
if ( n == 0 ) return "0" ;
String bin = "" ;
while ( n > 0 ) {
bin = ( ( n & 1 ) == 0 ? '0' : '1' ) + bin ;
n >>= 1 ;
}
return bin ;
}
| def f_gold ( n ) :
if ( n == 0 ) :
return "0" ;
bin = "" ;
while ( n > 0 ) :
if ( n & 1 == 0 ) :
bin = '0' + bin ;
else :
bin = '1' + bin ;
n = n >> 1 ;
return bin ;
|
using namespace std;
string f_gold ( int n ) {
if ( n == 0 ) return "0";
string bin = "";
while ( n > 0 ) {
bin = ( ( n & 1 ) == 0 ? '0' : '1' ) + bin;
n >>= 1;
}
return bin;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(35);
param0.add(17);
param0.add(8);
param0.add(99);
param0.add(57);
param0.add(39);
param0.add(99);
param0.add(14);
param0.add(22);
param0.add(7);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)).equals(f_gold(param0.get(i))))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(35,),
(17,),
(8,),
(99,),
(57,),
(39,),
(99,),
(14,),
(22,),
(7,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {35,17,8,99,57,39,99,14,22,7};
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();
return 0;
} |
CHANGE_BITS_CAN_MADE_ONE_FLIP |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHANGE_BITS_CAN_MADE_ONE_FLIP{
static boolean f_gold ( String str ) {
int zeros = 0 , ones = 0 ;
for ( int i = 0 ;
i < str . length ( ) ;
i ++ ) {
char ch = str . charAt ( i ) ;
if ( ch == '0' ) ++ zeros ;
else ++ ones ;
}
return ( zeros == 1 || ones == 1 ) ;
}
| def f_gold ( str ) :
zeros = 0
ones = 0
for i in range ( 0 , len ( str ) ) :
ch = str [ i ] ;
if ( ch == '0' ) :
zeros = zeros + 1
else :
ones = ones + 1
return ( zeros == 1 or ones == 1 ) ;
|
using namespace std;
bool f_gold ( string str ) {
int zeros = 0, ones = 0;
for ( char ch : str ) ( ch == '0' ) ? ++ zeros : ++ ones;
return ( zeros == 1 || ones == 1 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("00001");
param0.add("0000");
param0.add("11");
param0.add("111110");
param0.add("1");
param0.add("111010111010");
param0.add("hUInqJXNdbfP");
param0.add("5191");
param0.add("1110101101");
param0.add("NupSrU xz");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
("00001",),
("0000",),
("11",),
("111110",),
("1",),
("111010111010",),
("hUInqJXNdbfP",),
("5191",),
("1110101101",),
('NupSrU xz',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<string> param0 {"00001","0000","11","111110","1","111010111010","hUInqJXNdbfP","5191","1110101101","NupSrU xz"};
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();
return 0;
} |
POSITION_OF_RIGHTMOST_SET_BIT_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class POSITION_OF_RIGHTMOST_SET_BIT_1{
static int f_gold ( int n ) {
int position = 1 ;
int m = 1 ;
while ( ( n & m ) == 0 ) {
m = m << 1 ;
position ++ ;
}
return position ;
}
| def f_gold ( n ) :
position = 1
m = 1
while ( not ( n & m ) ) :
m = m << 1
position += 1
return position
|
using namespace std;
int f_gold ( int n ) {
int position = 1;
int m = 1;
while ( ! ( n & m ) ) {
m = m << 1;
position ++;
}
return position;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(17);
param0.add(97);
param0.add(73);
param0.add(68);
param0.add(6);
param0.add(84);
param0.add(72);
param0.add(66);
param0.add(57);
param0.add(11);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(17,),
(97,),
(73,),
(68,),
(6,),
(84,),
(72,),
(66,),
(57,),
(11,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {17,97,73,68,6,84,72,66,57,11};
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();
return 0;
} |
CHECK_LARGE_NUMBER_DIVISIBLE_4_NOT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_LARGE_NUMBER_DIVISIBLE_4_NOT{
static boolean f_gold ( String str ) {
int n = str . length ( ) ;
if ( n == 0 ) return false ;
if ( n == 1 ) return ( ( str . charAt ( 0 ) - '0' ) % 4 == 0 ) ;
int last = str . charAt ( n - 1 ) - '0' ;
int second_last = str . charAt ( n - 2 ) - '0' ;
return ( ( second_last * 10 + last ) % 4 == 0 ) ;
}
| null |
using namespace std;
bool f_gold ( string str ) {
int n = str . length ( );
if ( n == 0 ) return false;
if ( n == 1 ) return ( ( str [ 0 ] - '0' ) % 4 == 0 );
int last = str [ n - 1 ] - '0';
int second_last = str [ n - 2 ] - '0';
return ( ( second_last * 10 + last ) % 4 == 0 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("PjAFZXQgN");
param0.add("12325195609714");
param0.add("00101111101");
param0.add("xOtbXZiA");
param0.add("980");
param0.add("000000100");
param0.add("zFacc W");
param0.add("8");
param0.add("110011");
param0.add("afiutekeSfYrX");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} | null |
int main() {
int n_success = 0;
vector<string> param0 {"PjAFZXQgN","12325195609714","00101111101","xOtbXZiA","980","000000100","zFacc W","8","110011","afiutekeSfYrX"};
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();
return 0;
} |
NUMBER_SUBSTRINGS_STRING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_SUBSTRINGS_STRING{
static int f_gold ( String str ) {
int n = str . length ( ) ;
return n * ( n + 1 ) / 2 ;
}
| def f_gold ( str ) :
n = len ( str ) ;
return int ( n * ( n + 1 ) / 2 ) ;
|
using namespace std;
int f_gold ( string str ) {
int n = str . length ( );
return n * ( n + 1 ) / 2;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("gZFGZsHCimLf");
param0.add("505357");
param0.add("011011101");
param0.add("ovfwP Osauz");
param0.add("92132238746026");
param0.add("01100");
param0.add("RaOWYQRfiWKSyC");
param0.add("861330202");
param0.add("001100010");
param0.add("uvpKlGUBLOMba");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('gZFGZsHCimLf',),
('505357',),
('011011101',),
('ovfwP Osauz',),
('92132238746026',),
('01100',),
('RaOWYQRfiWKSyC',),
('861330202',),
('001100010',),
('uvpKlGUBLOMba',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<string> param0 {"gZFGZsHCimLf","505357","011011101","ovfwP Osauz","92132238746026","01100","RaOWYQRfiWKSyC","861330202","001100010","uvpKlGUBLOMba"};
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();
return 0;
} |
FIND_THE_ELEMENT_BEFORE_WHICH_ALL_THE_ELEMENTS_ARE_SMALLER_THAN_IT_AND_AFTER_WHICH_ALL_ARE_GREATER_THAN_IT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THE_ELEMENT_BEFORE_WHICH_ALL_THE_ELEMENTS_ARE_SMALLER_THAN_IT_AND_AFTER_WHICH_ALL_ARE_GREATER_THAN_IT{
static int f_gold ( int [ ] arr , int n ) {
int [ ] leftMax = new int [ n ] ;
leftMax [ 0 ] = Integer . MIN_VALUE ;
for ( int i = 1 ;
i < n ;
i ++ ) leftMax [ i ] = Math . max ( leftMax [ i - 1 ] , arr [ i - 1 ] ) ;
int rightMin = Integer . MAX_VALUE ;
for ( int i = n - 1 ;
i >= 0 ;
i -- ) {
if ( leftMax [ i ] < arr [ i ] && rightMin > arr [ i ] ) return i ;
rightMin = Math . min ( rightMin , arr [ i ] ) ;
}
return - 1 ;
}
| def f_gold ( arr , n ) :
leftMax = [ None ] * n
leftMax [ 0 ] = float ( '-inf' )
for i in range ( 1 , n ) :
leftMax [ i ] = max ( leftMax [ i - 1 ] , arr [ i - 1 ] )
rightMin = float ( 'inf' )
for i in range ( n - 1 , - 1 , - 1 ) :
if leftMax [ i ] < arr [ i ] and rightMin > arr [ i ] :
return i
rightMin = min ( rightMin , arr [ i ] )
return - 1
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int leftMax [ n ];
leftMax [ 0 ] = INT_MIN;
for ( int i = 1;
i < n;
i ++ ) leftMax [ i ] = max ( leftMax [ i - 1 ], arr [ i - 1 ] );
int rightMin = INT_MAX;
for ( int i = n - 1;
i >= 0;
i -- ) {
if ( leftMax [ i ] < arr [ i ] && rightMin > arr [ i ] ) return i;
rightMin = min ( rightMin, arr [ i ] );
}
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,24,30,33,56,67,87,90});
param0.add(new int[]{72,-48,12,4,46,36,2,58,82,-88,-14,56,90,76,18,-6,-28,18,88,90,40,-68,-10,-82,-28,16,32,-90,12,-86,-16,78,-98,-52,-26,80,6,50,40,-12,52,38,-92,94,-32,14,-80,-88,48});
param0.add(new int[]{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});
param0.add(new int[]{51,87,46,76,2,89,56,34,49,61,44,73,14,60,89});
param0.add(new int[]{-90,-90,-80,-72,-68,-64,-62,-62,-60,-46,-44,-44,-44,-42,-42,-32,-22,-22,-18,-2,4,6,10,12,14,30,34,34,40,56,56,56,58,68,74,78,78,82,84,86,88,90,92});
param0.add(new int[]{0,0,0,1,1,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,1,0,1,0,0,0,0,0,1,0,0,1,1,1,0,0,0,1,1,0});
param0.add(new int[]{7,8,11,12,15,17,28,34,57,61,66,76,92});
param0.add(new int[]{-22,-96,-78,-60,34,-18,86,-42,-78,76,8,28,-80,80,6,-72,34,66,84,50,-4,18,72,-66,-68,-24,56,-12,-70,24,-82});
param0.add(new int[]{0,0,0,0,0,0,1,1,1,1,1});
param0.add(new int[]{79,81,55,6,78,93,81,33,29,1,27,49,21,58,22,65,44,95,6,51,75,42,14,55,79,82,90,8,15,15,53,98,76,43,33});
List<Integer> param1 = new ArrayList<>();
param1.add(4);
param1.add(28);
param1.add(30);
param1.add(11);
param1.add(29);
param1.add(26);
param1.add(9);
param1.add(19);
param1.add(9);
param1.add(30);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([4, 24, 30, 33, 56, 67, 87, 90],4,),
([72, -48, 12, 4, 46, 36, 2, 58, 82, -88, -14, 56, 90, 76, 18, -6, -28, 18, 88, 90, 40, -68, -10, -82, -28, 16, 32, -90, 12, -86, -16, 78, -98, -52, -26, 80, 6, 50, 40, -12, 52, 38, -92, 94, -32, 14, -80, -88, 48],28,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],30,),
([51, 87, 46, 76, 2, 89, 56, 34, 49, 61, 44, 73, 14, 60, 89],11,),
([-90, -90, -80, -72, -68, -64, -62, -62, -60, -46, -44, -44, -44, -42, -42, -32, -22, -22, -18, -2, 4, 6, 10, 12, 14, 30, 34, 34, 40, 56, 56, 56, 58, 68, 74, 78, 78, 82, 84, 86, 88, 90, 92],29,),
([0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0],26,),
([7, 8, 11, 12, 15, 17, 28, 34, 57, 61, 66, 76, 92],9,),
([-22, -96, -78, -60, 34, -18, 86, -42, -78, 76, 8, 28, -80, 80, 6, -72, 34, 66, 84, 50, -4, 18, 72, -66, -68, -24, 56, -12, -70, 24, -82],19,),
([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],9,),
([79, 81, 55, 6, 78, 93, 81, 33, 29, 1, 27, 49, 21, 58, 22, 65, 44, 95, 6, 51, 75, 42, 14, 55, 79, 82, 90, 8, 15, 15, 53, 98, 76, 43, 33],30,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{4,24,30,33,56,67,87,90},{72,-48,12,4,46,36,2,58,82,-88,-14,56,90,76,18,-6,-28,18,88,90,40,-68,-10,-82,-28,16,32,-90,12,-86,-16,78,-98,-52,-26,80,6,50,40,-12,52,38,-92,94,-32,14,-80,-88,48},{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},{51,87,46,76,2,89,56,34,49,61,44,73,14,60,89},{-90,-90,-80,-72,-68,-64,-62,-62,-60,-46,-44,-44,-44,-42,-42,-32,-22,-22,-18,-2,4,6,10,12,14,30,34,34,40,56,56,56,58,68,74,78,78,82,84,86,88,90,92},{0,0,0,1,1,0,1,1,1,0,0,1,1,1,0,0,1,1,1,0,1,0,1,0,0,0,0,0,1,0,0,1,1,1,0,0,0,1,1,0},{7,8,11,12,15,17,28,34,57,61,66,76,92},{-22,-96,-78,-60,34,-18,86,-42,-78,76,8,28,-80,80,6,-72,34,66,84,50,-4,18,72,-66,-68,-24,56,-12,-70,24,-82},{0,0,0,0,0,0,1,1,1,1,1},{79,81,55,6,78,93,81,33,29,1,27,49,21,58,22,65,44,95,6,51,75,42,14,55,79,82,90,8,15,15,53,98,76,43,33}};
vector<int> param1 {4,28,30,11,29,26,9,19,9,30};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MINIMIZE_THE_SUM_OF_DIGITS_OF_A_AND_B_SUCH_THAT_A_B_N |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMIZE_THE_SUM_OF_DIGITS_OF_A_AND_B_SUCH_THAT_A_B_N{
static int f_gold ( int n ) {
int sum = 0 ;
while ( n > 0 ) {
sum += ( n % 10 ) ;
n /= 10 ;
}
if ( sum == 1 ) return 10 ;
return sum ;
}
| def f_gold ( n ) :
sum = 0 ;
while ( n > 0 ) :
sum += ( n % 10 ) ;
n //= 10 ;
if ( sum == 1 ) :
return 10 ;
return sum ;
|
using namespace std;
int f_gold ( int n ) {
int sum = 0;
while ( n > 0 ) {
sum += ( n % 10 );
n /= 10;
}
if ( sum == 1 ) return 10;
return sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(2);
param0.add(39);
param0.add(31);
param0.add(45);
param0.add(35);
param0.add(94);
param0.add(67);
param0.add(50);
param0.add(4);
param0.add(63);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(2,),
(39,),
(31,),
(45,),
(35,),
(94,),
(67,),
(50,),
(4,),
(63,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {2,39,31,45,35,94,67,50,4,63};
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();
return 0;
} |
EULERIAN_NUMBER_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class EULERIAN_NUMBER_1{
public static int f_gold ( int n , int m ) {
int [ ] [ ] dp = new int [ n + 1 ] [ m + 1 ] ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
for ( int j = 0 ;
j <= m ;
j ++ ) {
if ( i > j ) {
if ( j == 0 ) dp [ i ] [ j ] = 1 ;
else dp [ i ] [ j ] = ( ( i - j ) * dp [ i - 1 ] [ j - 1 ] ) + ( ( j + 1 ) * dp [ i - 1 ] [ j ] ) ;
}
}
}
return dp [ n ] [ m ] ;
}
| def f_gold ( n , m ) :
dp = [ [ 0 for x in range ( m + 1 ) ] for y in range ( n + 1 ) ]
for i in range ( 1 , n + 1 ) :
for j in range ( 0 , m + 1 ) :
if ( i > j ) :
if ( j == 0 ) :
dp [ i ] [ j ] = 1
else :
dp [ i ] [ j ] = ( ( ( i - j ) * dp [ i - 1 ] [ j - 1 ] ) + ( ( j + 1 ) * dp [ i - 1 ] [ j ] ) )
return dp [ n ] [ m ]
|
using namespace std;
int f_gold ( int n, int m ) {
int dp [ n + 1 ] [ m + 1 ];
memset ( dp, 0, sizeof ( dp ) );
for ( int i = 1;
i <= n;
i ++ ) {
for ( int j = 0;
j <= m;
j ++ ) {
if ( i > j ) {
if ( j == 0 ) dp [ i ] [ j ] = 1;
else dp [ i ] [ j ] = ( ( i - j ) * dp [ i - 1 ] [ j - 1 ] ) + ( ( j + 1 ) * dp [ i - 1 ] [ j ] );
}
}
}
return dp [ n ] [ m ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(27);
param0.add(77);
param0.add(35);
param0.add(26);
param0.add(6);
param0.add(66);
param0.add(44);
param0.add(26);
param0.add(74);
param0.add(65);
List<Integer> param1 = new ArrayList<>();
param1.add(7);
param1.add(34);
param1.add(22);
param1.add(20);
param1.add(10);
param1.add(47);
param1.add(29);
param1.add(33);
param1.add(86);
param1.add(97);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(27,7,),
(77,34,),
(35,22,),
(26,20,),
(6,10,),
(66,47,),
(44,29,),
(26,33,),
(74,86,),
(65,97,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {27,77,35,26,6,66,44,26,74,65};
vector<int> param1 {7,34,22,20,10,47,29,33,86,97};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MINIMUM_SWAPS_REQUIRED_BRING_ELEMENTS_LESS_EQUAL_K_TOGETHER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_SWAPS_REQUIRED_BRING_ELEMENTS_LESS_EQUAL_K_TOGETHER{
static int f_gold ( int arr [ ] , int n , int k ) {
int count = 0 ;
for ( int i = 0 ;
i < n ;
++ i ) if ( arr [ i ] <= k ) ++ count ;
int bad = 0 ;
for ( int i = 0 ;
i < count ;
++ i ) if ( arr [ i ] > k ) ++ bad ;
int ans = bad ;
for ( int i = 0 , j = count ;
j < n ;
++ i , ++ j ) {
if ( arr [ i ] > k ) -- bad ;
if ( arr [ j ] > k ) ++ bad ;
ans = Math . min ( ans , bad ) ;
}
return ans ;
}
| def f_gold ( arr , n , k ) :
count = 0
for i in range ( 0 , n ) :
if ( arr [ i ] <= k ) :
count = count + 1
bad = 0
for i in range ( 0 , count ) :
if ( arr [ i ] > k ) :
bad = bad + 1
ans = bad
j = count
for i in range ( 0 , n ) :
if ( j == n ) :
break
if ( arr [ i ] > k ) :
bad = bad - 1
if ( arr [ j ] > k ) :
bad = bad + 1
ans = min ( ans , bad )
j = j + 1
return ans
| null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{7,12,15,30,33,34,53,66,73,74,76,77,85,90});
param0.add(new int[]{-62,-20,-26,-24,92,66,-74,-4,18,-82,-36,92,-4,92,-80,56,-24,4,-48,-10,-14,-46,-16,-58,-58,-6,-68,-22,-82,-16,76,-30,-86,-38,-66,28,58,30,-44,-56});
param0.add(new int[]{0,0,0,0,0,1,1});
param0.add(new int[]{8,48,64,77,61,60,96,95,41,68,9,67,10,66,16,59,83,21,47,16,13,85,52,11,48,31,99,57,57,44,66,93,80,69,23,2,55,90});
param0.add(new int[]{-80,-58,-40,-34,14,36,48,56,58,60,84,90,92,92});
param0.add(new int[]{1,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,0,1,0,1,0,1,1,0,1,0,0,0,1});
param0.add(new int[]{4,4,8,9,13,17,18,19,21,22,22,23,27,28,30,44,46,48,53,53,55,60,61,62,68,70,70,71,73,80,82,82,85,88,90,93,99});
param0.add(new int[]{-28,50,82,-32,32,-78,12,50,38,34,-10,6,86,-56,-2});
param0.add(new int[]{0,0,0,0,1,1,1,1,1,1});
param0.add(new int[]{37,88,83,91,11,39,98,70,93,74,24,90,66,3,6,28});
List<Integer> param1 = new ArrayList<>();
param1.add(9);
param1.add(24);
param1.add(5);
param1.add(36);
param1.add(7);
param1.add(26);
param1.add(28);
param1.add(13);
param1.add(9);
param1.add(12);
List<Integer> param2 = new ArrayList<>();
param2.add(8);
param2.add(28);
param2.add(6);
param2.add(24);
param2.add(8);
param2.add(23);
param2.add(36);
param2.add(9);
param2.add(8);
param2.add(12);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([7, 12, 15, 30, 33, 34, 53, 66, 73, 74, 76, 77, 85, 90],9,8,),
([-62, -20, -26, -24, 92, 66, -74, -4, 18, -82, -36, 92, -4, 92, -80, 56, -24, 4, -48, -10, -14, -46, -16, -58, -58, -6, -68, -22, -82, -16, 76, -30, -86, -38, -66, 28, 58, 30, -44, -56],24,28,),
([0, 0, 0, 0, 0, 1, 1],5,6,),
([8, 48, 64, 77, 61, 60, 96, 95, 41, 68, 9, 67, 10, 66, 16, 59, 83, 21, 47, 16, 13, 85, 52, 11, 48, 31, 99, 57, 57, 44, 66, 93, 80, 69, 23, 2, 55, 90],36,24,),
([-80, -58, -40, -34, 14, 36, 48, 56, 58, 60, 84, 90, 92, 92],7,8,),
([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1],26,23,),
([4, 4, 8, 9, 13, 17, 18, 19, 21, 22, 22, 23, 27, 28, 30, 44, 46, 48, 53, 53, 55, 60, 61, 62, 68, 70, 70, 71, 73, 80, 82, 82, 85, 88, 90, 93, 99],28,36,),
([-28, 50, 82, -32, 32, -78, 12, 50, 38, 34, -10, 6, 86, -56, -2],13,9,),
([0, 0, 0, 0, 1, 1, 1, 1, 1, 1],9,8,),
([37, 88, 83, 91, 11, 39, 98, 70, 93, 74, 24, 90, 66, 3, 6, 28],12,12,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) | null |
MINIMUM_NUMBER_SUBSETS_DISTINCT_ELEMENTS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_NUMBER_SUBSETS_DISTINCT_ELEMENTS{
public static int f_gold ( int ar [ ] , int n ) {
int res = 0 ;
Arrays . sort ( ar ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int count = 1 ;
for ( ;
i < n - 1 ;
i ++ ) {
if ( ar [ i ] == ar [ i + 1 ] ) count ++ ;
else break ;
}
res = Math . max ( res , count ) ;
}
return res ;
}
| def f_gold ( ar , n ) :
res = 0
ar.sort ( )
for i in range ( 0 , n ) :
count = 1
for i in range ( n - 1 ) :
if ar [ i ] == ar [ i + 1 ] :
count += 1
else :
break
res = max ( res , count )
return res
|
using namespace std;
int f_gold ( int ar [ ], int n ) {
int res = 0;
sort ( ar, ar + n );
for ( int i = 0;
i < n;
i ++ ) {
int count = 1;
for (;
i < n - 1;
i ++ ) {
if ( ar [ i ] == ar [ i + 1 ] ) count ++;
else break;
}
res = max ( res, count );
}
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,2,5,8,16,21,21,22,23,26,26,27,27,29,31,33,36,37,37,38,42,45,47,50,57,58,60,60,62,63,66,66,76,84,84,88,96,99});
param0.add(new int[]{-30,-60,34,4,86,80,-96,-94,52,46,8,82,-94,-96,78,82,-22,-36,78,50,-46,-36,80,24,-14,94,-46,-38,82,4,-24,2,4,-82,-82,-18,-62,12,8,92,70,-10});
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,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{38,47,84,49,48,62,48,41,38,48,92,16,99});
param0.add(new int[]{-88,-64,-40,-38,-38,-16,16,20,28,40,56,58,60,68,74,92});
param0.add(new int[]{1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,1,1,1,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,1,1,1,1,1});
param0.add(new int[]{14,24,82,87,95});
param0.add(new int[]{-34,62,40,-84,52,-76,2,-58,94,22,2,-18,-88,62,-14,46,50,-58,-80,68,-64,90,-58,12,76,-40,40,-46,8,-80,4,-90,14,-10,64,-68});
param0.add(new int[]{0,1,1,1});
param0.add(new int[]{43,41,90,5,6,17,68,68,86,89});
List<Integer> param1 = new ArrayList<>();
param1.add(25);
param1.add(35);
param1.add(34);
param1.add(6);
param1.add(12);
param1.add(29);
param1.add(3);
param1.add(34);
param1.add(3);
param1.add(7);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([1, 2, 5, 8, 16, 21, 21, 22, 23, 26, 26, 27, 27, 29, 31, 33, 36, 37, 37, 38, 42, 45, 47, 50, 57, 58, 60, 60, 62, 63, 66, 66, 76, 84, 84, 88, 96, 99],25,),
([-30, -60, 34, 4, 86, 80, -96, -94, 52, 46, 8, 82, -94, -96, 78, 82, -22, -36, 78, 50, -46, -36, 80, 24, -14, 94, -46, -38, 82, 4, -24, 2, 4, -82, -82, -18, -62, 12, 8, 92, 70, -10],35,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],34,),
([38, 47, 84, 49, 48, 62, 48, 41, 38, 48, 92, 16, 99],6,),
([-88, -64, -40, -38, -38, -16, 16, 20, 28, 40, 56, 58, 60, 68, 74, 92],12,),
([1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],29,),
([14, 24, 82, 87, 95],3,),
([-34, 62, 40, -84, 52, -76, 2, -58, 94, 22, 2, -18, -88, 62, -14, 46, 50, -58, -80, 68, -64, 90, -58, 12, 76, -40, 40, -46, 8, -80, 4, -90, 14, -10, 64, -68],34,),
([0, 1, 1, 1],3,),
([43, 41, 90, 5, 6, 17, 68, 68, 86, 89],7,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,2,5,8,16,21,21,22,23,26,26,27,27,29,31,33,36,37,37,38,42,45,47,50,57,58,60,60,62,63,66,66,76,84,84,88,96,99},{-30,-60,34,4,86,80,-96,-94,52,46,8,82,-94,-96,78,82,-22,-36,78,50,-46,-36,80,24,-14,94,-46,-38,82,4,-24,2,4,-82,-82,-18,-62,12,8,92,70,-10},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{38,47,84,49,48,62,48,41,38,48,92,16,99},{-88,-64,-40,-38,-38,-16,16,20,28,40,56,58,60,68,74,92},{1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,1,1,1,1,0,0,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,1,1,1,1,1},{14,24,82,87,95},{-34,62,40,-84,52,-76,2,-58,94,22,2,-18,-88,62,-14,46,50,-58,-80,68,-64,90,-58,12,76,-40,40,-46,8,-80,4,-90,14,-10,64,-68},{0,1,1,1},{43,41,90,5,6,17,68,68,86,89}};
vector<int> param1 {25,35,34,6,12,29,3,34,3,7};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
ELEMENTS_TO_BE_ADDED_SO_THAT_ALL_ELEMENTS_OF_A_RANGE_ARE_PRESENT_IN_ARRAY_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class ELEMENTS_TO_BE_ADDED_SO_THAT_ALL_ELEMENTS_OF_A_RANGE_ARE_PRESENT_IN_ARRAY_1{
static int f_gold ( int arr [ ] , int n ) {
HashSet < Integer > s = new HashSet < > ( ) ;
int count = 0 , maxm = Integer . MIN_VALUE , minm = Integer . MAX_VALUE ;
for ( int i = 0 ;
i < n ;
i ++ ) {
s . add ( arr [ i ] ) ;
if ( arr [ i ] < minm ) minm = arr [ i ] ;
if ( arr [ i ] > maxm ) maxm = arr [ i ] ;
}
for ( int i = minm ;
i <= maxm ;
i ++ ) if ( ! s . contains ( i ) ) count ++ ;
return count ;
}
| def f_gold ( arr , n ) :
s = dict ( )
count , maxm , minm = 0 , - 10 ** 9 , 10 ** 9
for i in range ( n ) :
s [ arr [ i ] ] = 1
if ( arr [ i ] < minm ) :
minm = arr [ i ]
if ( arr [ i ] > maxm ) :
maxm = arr [ i ]
for i in range ( minm , maxm + 1 ) :
if i not in s.keys ( ) :
count += 1
return count
| null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,4,5,5,11,11,12,14,16,20,23,23,25,27,29,33,33,35,37,39,39,44,44,45,47,51,51,53,55,65,73,73,75,78,79,79,80,82,86,86,87,87,88,90,91,91,94});
param0.add(new int[]{-38,20,-94,-68,-96,36,48,32,44,-56,72,-28,-6,22,-54,-46,58,-60,-80,28,-34,60,-12,-26,-32,28,72,-50,66,-36,28,30,10,14,0,-78,94,-24,-42,-60,66,-12,92,54,-34,-58,56});
param0.add(new int[]{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});
param0.add(new int[]{73,69,12,82,65,55,93,93,88,52,33,94,62,75,61,81,48,43,29,8,28,60,60,58,54,44,25,36,46,88,54,36,83,46,34,44,71,90,68,75,42});
param0.add(new int[]{-98,-94,-88,-80,-74,-70,-70,-56,-50,-48,-40,-24,-22,-14,0,2,2,6,12,22,30,32,32,40,48,52,52,58,64,66,66,68,70,72,74,76,78,94,98,98});
param0.add(new int[]{1,0,1,0,1,1,1,0,0,1,1,1,1,0,1,1,1,0,1,1});
param0.add(new int[]{1,2,3,4,7,11,12,13,14,15,20,21,22,25,25,28,32,32,35,36,37,38,42,42,45,48,48,48,54,67,70,70,71,74,80,81,82,82,85,94});
param0.add(new int[]{-90,92,28,-32,76,94,48,80,52,-12,-6,22,40,26,-18,-84,90,16,-76,52,10,-56,6});
param0.add(new int[]{0,0,0,0,0,0,0,0,1,1,1,1,1,1,1});
param0.add(new int[]{4,21,34,35,71,10,88,44,82,13,79,92,35,73,28,91,33,9,12,76,40,91,4,22,90,53,98,7,30});
List<Integer> param1 = new ArrayList<>();
param1.add(26);
param1.add(31);
param1.add(20);
param1.add(31);
param1.add(22);
param1.add(18);
param1.add(24);
param1.add(11);
param1.add(14);
param1.add(17);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([1, 4, 5, 5, 11, 11, 12, 14, 16, 20, 23, 23, 25, 27, 29, 33, 33, 35, 37, 39, 39, 44, 44, 45, 47, 51, 51, 53, 55, 65, 73, 73, 75, 78, 79, 79, 80, 82, 86, 86, 87, 87, 88, 90, 91, 91, 94],26,),
([-38, 20, -94, -68, -96, 36, 48, 32, 44, -56, 72, -28, -6, 22, -54, -46, 58, -60, -80, 28, -34, 60, -12, -26, -32, 28, 72, -50, 66, -36, 28, 30, 10, 14, 0, -78, 94, -24, -42, -60, 66, -12, 92, 54, -34, -58, 56],31,),
([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],20,),
([73, 69, 12, 82, 65, 55, 93, 93, 88, 52, 33, 94, 62, 75, 61, 81, 48, 43, 29, 8, 28, 60, 60, 58, 54, 44, 25, 36, 46, 88, 54, 36, 83, 46, 34, 44, 71, 90, 68, 75, 42],31,),
([-98, -94, -88, -80, -74, -70, -70, -56, -50, -48, -40, -24, -22, -14, 0, 2, 2, 6, 12, 22, 30, 32, 32, 40, 48, 52, 52, 58, 64, 66, 66, 68, 70, 72, 74, 76, 78, 94, 98, 98],22,),
([1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1],18,),
([1, 2, 3, 4, 7, 11, 12, 13, 14, 15, 20, 21, 22, 25, 25, 28, 32, 32, 35, 36, 37, 38, 42, 42, 45, 48, 48, 48, 54, 67, 70, 70, 71, 74, 80, 81, 82, 82, 85, 94],24,),
([-90, 92, 28, -32, 76, 94, 48, 80, 52, -12, -6, 22, 40, 26, -18, -84, 90, 16, -76, 52, 10, -56, 6],11,),
([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1],14,),
([4, 21, 34, 35, 71, 10, 88, 44, 82, 13, 79, 92, 35, 73, 28, 91, 33, 9, 12, 76, 40, 91, 4, 22, 90, 53, 98, 7, 30],17,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) | null |
FIND_PERIMETER_CYLINDER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_PERIMETER_CYLINDER{
static int f_gold ( int diameter , int height ) {
return 2 * ( diameter + height ) ;
}
| def f_gold ( diameter , height ) :
return 2 * ( diameter + height )
|
using namespace std;
int f_gold ( int diameter, int height ) {
return 2 * ( diameter + height );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(70);
param0.add(97);
param0.add(49);
param0.add(56);
param0.add(87);
param0.add(64);
param0.add(75);
param0.add(90);
param0.add(55);
param0.add(73);
List<Integer> param1 = new ArrayList<>();
param1.add(78);
param1.add(46);
param1.add(26);
param1.add(61);
param1.add(79);
param1.add(21);
param1.add(93);
param1.add(16);
param1.add(16);
param1.add(29);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(70,78,),
(97,46,),
(49,26,),
(56,61,),
(87,79,),
(64,21,),
(75,93,),
(90,16,),
(55,16,),
(73,29,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {70,97,49,56,87,64,75,90,55,73};
vector<int> param1 {78,46,26,61,79,21,93,16,16,29};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
REMOVE_MINIMUM_ELEMENTS_EITHER_SIDE_2MIN_MAX |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class REMOVE_MINIMUM_ELEMENTS_EITHER_SIDE_2MIN_MAX{
static int f_gold ( int arr [ ] , int n ) {
int longest_start = - 1 , longest_end = 0 ;
for ( int start = 0 ;
start < n ;
start ++ ) {
int min = Integer . MAX_VALUE , max = Integer . MIN_VALUE ;
for ( int end = start ;
end < n ;
end ++ ) {
int val = arr [ end ] ;
if ( val < min ) {
min = val ;
}
if ( val > max ) {
max = val ;
}
if ( 2 * min <= max ) {
break ;
}
if ( end - start > longest_end - longest_start || longest_start == - 1 ) {
longest_start = start ;
longest_end = end ;
}
}
}
if ( longest_start == - 1 ) {
return n ;
}
return ( n - ( longest_end - longest_start + 1 ) ) ;
}
| import sys
def f_gold ( arr , n ) :
longest_start = - 1 ;
longest_end = 0 ;
for start in range ( n ) :
min = sys.maxsize ;
max = - sys.maxsize ;
for end in range ( start , n ) :
val = arr [ end ] ;
if ( val < min ) :
min = val ;
if ( val > max ) :
max = val ;
if ( 2 * min <= max ) :
break ;
if ( end - start > longest_end - longest_start or longest_start == - 1 ) :
longest_start = start ;
longest_end = end ;
if ( longest_start == - 1 ) :
return n ;
return ( n - ( longest_end - longest_start + 1 ) ) ;
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int longest_start = - 1, longest_end = 0;
for ( int start = 0;
start < n;
start ++ ) {
int min = INT_MAX, max = INT_MIN;
for ( int end = start;
end < n;
end ++ ) {
int val = arr [ end ];
if ( val < min ) min = val;
if ( val > max ) max = val;
if ( 2 * min <= max ) break;
if ( end - start > longest_end - longest_start || longest_start == - 1 ) {
longest_start = start;
longest_end = end;
}
}
}
if ( longest_start == - 1 ) return n;
return ( n - ( longest_end - longest_start + 1 ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{32,50,66,73,76,87});
param0.add(new int[]{68,74,16,40,6,-44,-36,94,6,-24,-4,-58,-16,24});
param0.add(new int[]{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[]{91,22});
param0.add(new int[]{-84,-80,-78,-76,-58,-54,-52,-48,-42,-42,-40,-38,-34,-32,-28,-24,-6,2,2,4,10,14,16,18,26,26,36,40,50,52,62,64,72,74,84,90,94,96,98});
param0.add(new int[]{1,0,1,1,1,0,1,1,1,0,1,0,0,1,0,1,1,1,1,0,1});
param0.add(new int[]{10,19,25,29,32,37,40,43,43,44,46,51,51,54,56,58,63,79,83,86,87,97,97});
param0.add(new int[]{-48,-28,10,30,78,-72,78,52,-52,-68,56,42,8,-42,16,-56,2,-90,-26,-28,-56,-2,80,-50,98,-64,-96,10,-10,44,98,-48,-88,42,30,24,38,-26,-52,-12,0,34,-82,-80,0,-84,-20});
param0.add(new int[]{0,0,1,1,1,1,1,1});
param0.add(new int[]{25,82});
List<Integer> param1 = new ArrayList<>();
param1.add(5);
param1.add(11);
param1.add(11);
param1.add(1);
param1.add(35);
param1.add(13);
param1.add(11);
param1.add(25);
param1.add(6);
param1.add(1);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([32, 50, 66, 73, 76, 87],5,),
([68, 74, 16, 40, 6, -44, -36, 94, 6, -24, -4, -58, -16, 24],11,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],11,),
([91, 22],1,),
([-84, -80, -78, -76, -58, -54, -52, -48, -42, -42, -40, -38, -34, -32, -28, -24, -6, 2, 2, 4, 10, 14, 16, 18, 26, 26, 36, 40, 50, 52, 62, 64, 72, 74, 84, 90, 94, 96, 98],35,),
([1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 1],13,),
([10, 19, 25, 29, 32, 37, 40, 43, 43, 44, 46, 51, 51, 54, 56, 58, 63, 79, 83, 86, 87, 97, 97],11,),
([-48, -28, 10, 30, 78, -72, 78, 52, -52, -68, 56, 42, 8, -42, 16, -56, 2, -90, -26, -28, -56, -2, 80, -50, 98, -64, -96, 10, -10, 44, 98, -48, -88, 42, 30, 24, 38, -26, -52, -12, 0, 34, -82, -80, 0, -84, -20],25,),
([0, 0, 1, 1, 1, 1, 1, 1],6,),
([25, 82],1,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{32,50,66,73,76,87},{68,74,16,40,6,-44,-36,94,6,-24,-4,-58,-16,24},{0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1},{91,22},{-84,-80,-78,-76,-58,-54,-52,-48,-42,-42,-40,-38,-34,-32,-28,-24,-6,2,2,4,10,14,16,18,26,26,36,40,50,52,62,64,72,74,84,90,94,96,98},{1,0,1,1,1,0,1,1,1,0,1,0,0,1,0,1,1,1,1,0,1},{10,19,25,29,32,37,40,43,43,44,46,51,51,54,56,58,63,79,83,86,87,97,97},{-48,-28,10,30,78,-72,78,52,-52,-68,56,42,8,-42,16,-56,2,-90,-26,-28,-56,-2,80,-50,98,-64,-96,10,-10,44,98,-48,-88,42,30,24,38,-26,-52,-12,0,34,-82,-80,0,-84,-20},{0,0,1,1,1,1,1,1},{25,82}};
vector<int> param1 {5,11,11,1,35,13,11,25,6,1};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
COUNT_OFDIFFERENT_WAYS_EXPRESS_N_SUM_1_3_4 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_OFDIFFERENT_WAYS_EXPRESS_N_SUM_1_3_4{
static int f_gold ( int n ) {
int DP [ ] = new int [ n + 1 ] ;
DP [ 0 ] = DP [ 1 ] = DP [ 2 ] = 1 ;
DP [ 3 ] = 2 ;
for ( int i = 4 ;
i <= n ;
i ++ ) DP [ i ] = DP [ i - 1 ] + DP [ i - 3 ] + DP [ i - 4 ] ;
return DP [ n ] ;
}
| def f_gold ( n ) :
DP = [ 0 for i in range ( 0 , n + 1 ) ]
DP [ 0 ] = DP [ 1 ] = DP [ 2 ] = 1
DP [ 3 ] = 2
for i in range ( 4 , n + 1 ) :
DP [ i ] = DP [ i - 1 ] + DP [ i - 3 ] + DP [ i - 4 ]
return DP [ n ]
|
using namespace std;
int f_gold ( int n ) {
int DP [ n + 1 ];
DP [ 0 ] = DP [ 1 ] = DP [ 2 ] = 1;
DP [ 3 ] = 2;
for ( int i = 4;
i <= n;
i ++ ) DP [ i ] = DP [ i - 1 ] + DP [ i - 3 ] + DP [ i - 4 ];
return DP [ n ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(44);
param0.add(9);
param0.add(19);
param0.add(10);
param0.add(78);
param0.add(94);
param0.add(70);
param0.add(81);
param0.add(81);
param0.add(49);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(44,),
(9,),
(19,),
(10,),
(78,),
(94,),
(70,),
(81,),
(81,),
(49,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {44,9,19,10,78,94,70,81,81,49};
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();
return 0;
} |
SUM_BINOMIAL_COEFFICIENTS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_BINOMIAL_COEFFICIENTS{
static int f_gold ( int n ) {
int C [ ] [ ] = new int [ n + 1 ] [ n + 1 ] ;
for ( int i = 0 ;
i <= n ;
i ++ ) {
for ( int j = 0 ;
j <= Math . min ( i , n ) ;
j ++ ) {
if ( j == 0 || j == i ) C [ i ] [ j ] = 1 ;
else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ;
}
}
int sum = 0 ;
for ( int i = 0 ;
i <= n ;
i ++ ) sum += C [ n ] [ i ] ;
return sum ;
}
| def f_gold ( n ) :
C = [ [ 0 ] * ( n + 2 ) for i in range ( 0 , n + 2 ) ]
for i in range ( 0 , n + 1 ) :
for j in range ( 0 , min ( i , n ) + 1 ) :
if ( j == 0 or j == i ) :
C [ i ] [ j ] = 1
else :
C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ]
sum = 0
for i in range ( 0 , n + 1 ) :
sum += C [ n ] [ i ]
return sum
|
using namespace std;
int f_gold ( int n ) {
int C [ n + 1 ] [ n + 1 ];
for ( int i = 0;
i <= n;
i ++ ) {
for ( int j = 0;
j <= min ( i, n );
j ++ ) {
if ( j == 0 || j == i ) C [ i ] [ j ] = 1;
else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ];
}
}
int sum = 0;
for ( int i = 0;
i <= n;
i ++ ) sum += C [ n ] [ i ];
return sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(8);
param0.add(39);
param0.add(25);
param0.add(44);
param0.add(72);
param0.add(6);
param0.add(72);
param0.add(62);
param0.add(48);
param0.add(39);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(8,),
(39,),
(25,),
(44,),
(72,),
(6,),
(72,),
(62,),
(48,),
(39,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {8,39,25,44,72,6,72,62,48,39};
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();
return 0;
} |
FIBONACCI_MODULO_P |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIBONACCI_MODULO_P{
static int f_gold ( int p ) {
int first = 1 , second = 1 , number = 2 , next = 1 ;
while ( next > 0 ) {
next = ( first + second ) % p ;
first = second ;
second = next ;
number ++ ;
}
return number ;
}
| def f_gold ( p ) :
first = 1
second = 1
number = 2
next = 1
while ( next ) :
next = ( first + second ) % p
first = second
second = next
number = number + 1
return number
|
using namespace std;
int f_gold ( int p ) {
int first = 1, second = 1, number = 2, next = 1;
while ( next ) {
next = ( first + second ) % p;
first = second;
second = next;
number ++;
}
return number;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(51);
param0.add(40);
param0.add(68);
param0.add(7);
param0.add(8);
param0.add(32);
param0.add(93);
param0.add(75);
param0.add(71);
param0.add(15);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(51,),
(40,),
(68,),
(7,),
(8,),
(32,),
(93,),
(75,),
(71,),
(15,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {51,40,68,7,8,32,93,75,71,15};
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();
return 0;
} |
NTH_EVEN_LENGTH_PALINDROME |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NTH_EVEN_LENGTH_PALINDROME{
static String f_gold ( String n ) {
String res = n ;
for ( int j = n . length ( ) - 1 ;
j >= 0 ;
-- j ) res += n . charAt ( j ) ;
return res ;
}
| def f_gold ( n ) :
res = n
for j in range ( len ( n ) - 1 , - 1 , - 1 ) :
res += n [ j ]
return res
|
using namespace std;
string f_gold ( string n ) {
string res = n;
for ( int j = n . length ( ) - 1;
j >= 0;
-- j ) res += n [ j ];
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("lSUhEvxcgfI");
param0.add("77329283");
param0.add("010111111");
param0.add("Stazb");
param0.add("0702");
param0.add("01111111");
param0.add("a");
param0.add("359118754930");
param0.add("11011010010");
param0.add("rznb");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)).equals(f_gold(param0.get(i))))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('lSUhEvxcgfI',),
('77329283',),
('010111111',),
('Stazb',),
('0702',),
('01111111',),
('a',),
('359118754930',),
('11011010010',),
('rznb',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<string> param0 {"lSUhEvxcgfI","77329283","010111111","Stazb","0702","01111111","a","359118754930","11011010010","rznb"};
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();
return 0;
} |
COUNT_TRAILING_ZEROES_FACTORIAL_NUMBER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_TRAILING_ZEROES_FACTORIAL_NUMBER{
static int f_gold ( int n ) {
int count = 0 ;
for ( int i = 5 ;
n / i >= 1 ;
i *= 5 ) count += n / i ;
return count ;
}
| def f_gold ( n ) :
count = 0
i = 5
while ( n / i >= 1 ) :
count += int ( n / i )
i *= 5
return int ( count )
|
using namespace std;
int f_gold ( int n ) {
int count = 0;
for ( int i = 5;
n / i >= 1;
i *= 5 ) count += n / i;
return count;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(9);
param0.add(43);
param0.add(50);
param0.add(32);
param0.add(37);
param0.add(51);
param0.add(33);
param0.add(49);
param0.add(1);
param0.add(75);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(9,),
(43,),
(50,),
(32,),
(37,),
(51,),
(33,),
(49,),
(1,),
(75,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {9,43,50,32,37,51,33,49,1,75};
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();
return 0;
} |
NUMBER_OF_PAIRS_IN_AN_ARRAY_HAVING_SUM_EQUAL_TO_PRODUCT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_OF_PAIRS_IN_AN_ARRAY_HAVING_SUM_EQUAL_TO_PRODUCT{
static int f_gold ( int a [ ] , int n ) {
int zero = 0 , two = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( a [ i ] == 0 ) {
zero ++ ;
}
if ( a [ i ] == 2 ) {
two ++ ;
}
}
int cnt = ( zero * ( zero - 1 ) ) / 2 + ( two * ( two - 1 ) ) / 2 ;
return cnt ;
}
| def f_gold ( a , n ) :
zero = 0
two = 0
for i in range ( n ) :
if a [ i ] == 0 :
zero += 1
if a [ i ] == 2 :
two += 1
cnt = ( zero * ( zero - 1 ) ) // 2 + \
( two * ( two - 1 ) ) // 2
return cnt
|
using namespace std;
int f_gold ( int a [ ], int n ) {
int zero = 0, two = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( a [ i ] == 0 ) {
zero ++;
}
if ( a [ i ] == 2 ) {
two ++;
}
}
int cnt = ( zero * ( zero - 1 ) ) / 2 + ( two * ( two - 1 ) ) / 2;
return cnt;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{9,10,20,26,26,28,31,34,35,36,36,37,39,43,44,44,46,49,54,57,58,63,64,64,65,67,70,70,74,75,77,78,79,81,82,83,84,86,95});
param0.add(new int[]{0,-10,10,0,68,4,-6,-14,74,-80,56,-4,36,56,10,-16,90,84,-38,-40,40,-86,-36,-16,-48,-76,-72,-18,-14,-40,-82,56,-60});
param0.add(new int[]{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});
param0.add(new int[]{88,20,53,21,29,73,62,91,72,34,47,42,98,9,79,80,94,36,7,67,96,34,99,56,37,70,55,36,10,77,41,51,5,37,57,29,56,74,97,31,96,52,13,29,87,58,28,31});
param0.add(new int[]{20});
param0.add(new int[]{1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0,1});
param0.add(new int[]{2,4,9,16,22,23,25,33,33,36,39,48,49,52,53,60,67,68,76,77,79,84,84,86,89});
param0.add(new int[]{-62,42,-88,-44,90,30,52,54,56,-72,-76,90,18,42,62,-84,56,-80,72});
param0.add(new int[]{0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{22,15,28,29,32,16,33,83});
List<Integer> param1 = new ArrayList<>();
param1.add(31);
param1.add(19);
param1.add(22);
param1.add(38);
param1.add(0);
param1.add(21);
param1.add(24);
param1.add(13);
param1.add(15);
param1.add(7);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([9, 10, 20, 26, 26, 28, 31, 34, 35, 36, 36, 37, 39, 43, 44, 44, 46, 49, 54, 57, 58, 63, 64, 64, 65, 67, 70, 70, 74, 75, 77, 78, 79, 81, 82, 83, 84, 86, 95],31,),
([0, -10, 10, 0, 68, 4, -6, -14, 74, -80, 56, -4, 36, 56, 10, -16, 90, 84, -38, -40, 40, -86, -36, -16, -48, -76, -72, -18, -14, -40, -82, 56, -60],19,),
([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],22,),
([88, 20, 53, 21, 29, 73, 62, 91, 72, 34, 47, 42, 98, 9, 79, 80, 94, 36, 7, 67, 96, 34, 99, 56, 37, 70, 55, 36, 10, 77, 41, 51, 5, 37, 57, 29, 56, 74, 97, 31, 96, 52, 13, 29, 87, 58, 28, 31],38,),
([20],0,),
([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1],21,),
([2, 4, 9, 16, 22, 23, 25, 33, 33, 36, 39, 48, 49, 52, 53, 60, 67, 68, 76, 77, 79, 84, 84, 86, 89],24,),
([-62, 42, -88, -44, 90, 30, 52, 54, 56, -72, -76, 90, 18, 42, 62, -84, 56, -80, 72],13,),
([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],15,),
([22, 15, 28, 29, 32, 16, 33, 83],7,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{9,10,20,26,26,28,31,34,35,36,36,37,39,43,44,44,46,49,54,57,58,63,64,64,65,67,70,70,74,75,77,78,79,81,82,83,84,86,95},{0,-10,10,0,68,4,-6,-14,74,-80,56,-4,36,56,10,-16,90,84,-38,-40,40,-86,-36,-16,-48,-76,-72,-18,-14,-40,-82,56,-60},{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},{88,20,53,21,29,73,62,91,72,34,47,42,98,9,79,80,94,36,7,67,96,34,99,56,37,70,55,36,10,77,41,51,5,37,57,29,56,74,97,31,96,52,13,29,87,58,28,31},{20},{1,1,1,1,1,1,1,1,1,1,1,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,1,1,0,1},{2,4,9,16,22,23,25,33,33,36,39,48,49,52,53,60,67,68,76,77,79,84,84,86,89},{-62,42,-88,-44,90,30,52,54,56,-72,-76,90,18,42,62,-84,56,-80,72},{0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1},{22,15,28,29,32,16,33,83}};
vector<int> param1 {31,19,22,38,0,21,24,13,15,7};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
GIVEN_LARGE_NUMBER_CHECK_SUBSEQUENCE_DIGITS_DIVISIBLE_8 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class GIVEN_LARGE_NUMBER_CHECK_SUBSEQUENCE_DIGITS_DIVISIBLE_8{
static boolean f_gold ( String str ) {
int i , j , k , l = str . length ( ) ;
int arr [ ] = new int [ l ] ;
for ( i = 0 ;
i < l ;
i ++ ) {
for ( j = i ;
j < l ;
j ++ ) {
for ( k = j ;
k < l ;
k ++ ) {
if ( arr [ i ] % 8 == 0 ) return true ;
else if ( ( arr [ i ] * 10 + arr [ j ] ) % 8 == 0 && i != j ) return true ;
else if ( ( arr [ i ] * 100 + arr [ j ] * 10 + arr [ k ] ) % 8 == 0 && i != j && j != k && i != k ) return true ;
}
}
}
return false ;
}
| def f_gold ( st ) :
l = len ( st )
arr = [ 0 ] * l
for i in range ( 0 , l ) :
for j in range ( i , l ) :
for k in range ( j , l ) :
if ( arr [ i ] % 8 == 0 ) :
return True
elif ( ( arr [ i ] * 10 + arr [ j ] ) % 8 == 0 and i != j ) :
return True
elif ( ( arr [ i ] * 100 + arr [ j ] * 10 + arr [ k ] ) % 8 == 0 and i != j and j != k and i != k ) :
return True
return False
| null |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("1787075866");
param0.add("8");
param0.add("1110101110111");
param0.add("6673177113");
param0.add("7");
param0.add("000001");
param0.add("dbxMF");
param0.add("71733");
param0.add("01101101100");
param0.add("");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('1787075866',),
('8',),
('1110101110111',),
('6673177113',),
('7',),
('000001',),
('dbxMF',),
('71733',),
('01101101100',),
('',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) | null |
TAIL_RECURSION_FIBONACCI |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class TAIL_RECURSION_FIBONACCI{
static int f_gold ( int n , int a , int b ) {
if ( n == 0 ) return a ;
if ( n == 1 ) return b ;
return f_gold ( n - 1 , b , a + b ) ;
}
| def f_gold ( n , a = 0 , b = 1 ) :
if n == 0 :
return a
if n == 1 :
return b
return f_gold ( n - 1 , b , a + b ) ;
|
using namespace std;
int f_gold ( int n, int a = 0, int b = 1 ) {
if ( n == 0 ) return a;
if ( n == 1 ) return b;
return f_gold ( n - 1, b, a + b );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(4);
param0.add(60);
param0.add(92);
param0.add(73);
param0.add(58);
param0.add(82);
param0.add(53);
param0.add(57);
param0.add(47);
param0.add(83);
List<Integer> param1 = new ArrayList<>();
param1.add(43);
param1.add(48);
param1.add(21);
param1.add(79);
param1.add(38);
param1.add(26);
param1.add(10);
param1.add(37);
param1.add(91);
param1.add(3);
List<Integer> param2 = new ArrayList<>();
param2.add(24);
param2.add(98);
param2.add(69);
param2.add(38);
param2.add(30);
param2.add(12);
param2.add(17);
param2.add(26);
param2.add(99);
param2.add(64);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(4,43,24,),
(60,48,98,),
(92,21,69,),
(73,79,38,),
(58,38,30,),
(82,26,12,),
(53,10,17,),
(57,37,26,),
(47,91,99,),
(83,3,64,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {4,60,92,73,58,82,53,57,47,83};
vector<int> param1 {43,48,21,79,38,26,10,37,91,3};
vector<int> param2 {24,98,69,38,30,12,17,26,99,64};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i]) == f_gold(param0[i],param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
DETECT_IF_TWO_INTEGERS_HAVE_OPPOSITE_SIGNS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DETECT_IF_TWO_INTEGERS_HAVE_OPPOSITE_SIGNS{
static boolean f_gold ( int x , int y ) {
return ( ( x ^ y ) < 0 ) ;
}
| def f_gold ( x , y ) :
return ( ( x ^ y ) < 0 ) ;
|
using namespace std;
bool f_gold ( int x, int y ) {
return ( ( x ^ y ) < 0 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(59);
param0.add(-20);
param0.add(-100);
param0.add(54);
param0.add(-16);
param0.add(-23);
param0.add(93);
param0.add(24);
param0.add(-8);
param0.add(29);
List<Integer> param1 = new ArrayList<>();
param1.add(-99);
param1.add(-21);
param1.add(79);
param1.add(-49);
param1.add(16);
param1.add(-68);
param1.add(37);
param1.add(-61);
param1.add(69);
param1.add(10);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(59,-99,),
(-20,-21,),
(-100,79,),
(54,-49,),
(-16,16,),
(-23,-68,),
(93,37,),
(24,-61,),
(-8,69,),
(29,10,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {59,-20,-100,54,-16,-23,93,24,-8,29};
vector<int> param1 {-99,-21,100,-49,16,-68,37,-61,69,10};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
COUNT_DISTINCT_NON_NEGATIVE_PAIRS_X_Y_SATISFY_INEQUALITY_XX_YY_N_2_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_DISTINCT_NON_NEGATIVE_PAIRS_X_Y_SATISFY_INEQUALITY_XX_YY_N_2_1{
static int f_gold ( int n ) {
int x = 0 , yCount , res = 0 ;
for ( yCount = 0 ;
yCount * yCount < n ;
yCount ++ ) ;
while ( yCount != 0 ) {
res += yCount ;
x ++ ;
while ( yCount != 0 && ( x * x + ( yCount - 1 ) * ( yCount - 1 ) >= n ) ) yCount -- ;
}
return res ;
}
| def f_gold ( n ) :
x = 0
res = 0
yCount = 0
while ( yCount * yCount < n ) :
yCount = yCount + 1
while ( yCount != 0 ) :
res = res + yCount
x = x + 1
while ( yCount != 0 and ( x * x + ( yCount - 1 ) * ( yCount - 1 ) >= n ) ) :
yCount = yCount - 1
return res
|
using namespace std;
int f_gold ( int n ) {
int x = 0, yCount, res = 0;
for ( yCount = 0;
yCount * yCount < n;
yCount ++ );
while ( yCount != 0 ) {
res += yCount;
x ++;
while ( yCount != 0 && ( x * x + ( yCount - 1 ) * ( yCount - 1 ) >= n ) ) yCount --;
}
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(72);
param0.add(75);
param0.add(92);
param0.add(30);
param0.add(45);
param0.add(40);
param0.add(81);
param0.add(17);
param0.add(81);
param0.add(99);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(72,),
(75,),
(92,),
(30,),
(45,),
(40,),
(81,),
(17,),
(81,),
(99,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {72,75,92,30,45,40,81,17,81,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();
return 0;
} |
MAXIMUM_HEIGHT_OF_TRIANGULAR_ARRANGEMENT_OF_ARRAY_VALUES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_HEIGHT_OF_TRIANGULAR_ARRANGEMENT_OF_ARRAY_VALUES{
static int f_gold ( int [ ] a , int n ) {
int result = 1 ;
for ( int i = 1 ;
i <= n ;
++ i ) {
int y = ( i * ( i + 1 ) ) / 2 ;
if ( y < n ) result = i ;
else break ;
}
return result ;
}
| def f_gold ( a , n ) :
result = 1
for i in range ( 1 , n ) :
y = ( i * ( i + 1 ) ) / 2
if ( y < n ) :
result = i
else :
break
return result
|
using namespace std;
int f_gold ( int a [ ], int n ) {
int result = 1;
for ( int i = 1;
i <= n;
++ i ) {
long long y = ( i * ( i + 1 ) ) / 2;
if ( y < n ) result = i;
else break;
}
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{8,10,11,14,14,17,20,20,22,22,22,23,25,30,33,39,39,41,43,45,46,46,46,50,51,53,57,59,60,64,64,66,72,72,75,77,85,85,87,88,90,91,93,94,94,95});
param0.add(new int[]{-44,-90,20,4,-56,-50,-80,74,-82,20,62,-26,-10,-14,-76,82,-88,92,30,44,-62,-86,-20,-96,-60,-88,-78,-40,-48,-92,62,58,94,68,68,44,80,4,48,-92,30,-76,-46,-20,4});
param0.add(new int[]{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});
param0.add(new int[]{8,34,48,10,5,12,80,7,67,1,79,59,63,13,16,23,62,56,99,89,7,80});
param0.add(new int[]{-88,-46,-40,-40,38});
param0.add(new int[]{1,0,0,1,0,1,1,0,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,1,1});
param0.add(new int[]{8,15,35,39,49,81,86,91});
param0.add(new int[]{-24,56,-74,-76,-80,86,90,0,-26,18,72,78,-66,-28,22,22,72,78,-50,-12,20,12,-68,-2,-58,-44,28,-58,90,-28,32,-70,-48,-66,-94,-50,18,-12,80,12,82,56,-64,10,-22});
param0.add(new int[]{0,0});
param0.add(new int[]{62,93,69,40,26,2,29,83,66,68,67,73,12,65,89,57,38,99,42,27,38,24,43,4,4,54,72,47,52,46,53,24,3,41,64,33,88,3,1,7,17,31,20,33,69,21,9,24,59});
List<Integer> param1 = new ArrayList<>();
param1.add(38);
param1.add(36);
param1.add(28);
param1.add(12);
param1.add(3);
param1.add(44);
param1.add(7);
param1.add(36);
param1.add(1);
param1.add(26);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([8, 10, 11, 14, 14, 17, 20, 20, 22, 22, 22, 23, 25, 30, 33, 39, 39, 41, 43, 45, 46, 46, 46, 50, 51, 53, 57, 59, 60, 64, 64, 66, 72, 72, 75, 77, 85, 85, 87, 88, 90, 91, 93, 94, 94, 95],38,),
([-44, -90, 20, 4, -56, -50, -80, 74, -82, 20, 62, -26, -10, -14, -76, 82, -88, 92, 30, 44, -62, -86, -20, -96, -60, -88, -78, -40, -48, -92, 62, 58, 94, 68, 68, 44, 80, 4, 48, -92, 30, -76, -46, -20, 4],36,),
([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],28,),
([8, 34, 48, 10, 5, 12, 80, 7, 67, 1, 79, 59, 63, 13, 16, 23, 62, 56, 99, 89, 7, 80],12,),
([-88, -46, -40, -40, 38],3,),
([1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1],44,),
([8, 15, 35, 39, 49, 81, 86, 91],7,),
([-24, 56, -74, -76, -80, 86, 90, 0, -26, 18, 72, 78, -66, -28, 22, 22, 72, 78, -50, -12, 20, 12, -68, -2, -58, -44, 28, -58, 90, -28, 32, -70, -48, -66, -94, -50, 18, -12, 80, 12, 82, 56, -64, 10, -22],36,),
([0, 0],1,),
([62, 93, 69, 40, 26, 2, 29, 83, 66, 68, 67, 73, 12, 65, 89, 57, 38, 99, 42, 27, 38, 24, 43, 4, 4, 54, 72, 47, 52, 46, 53, 24, 3, 41, 64, 33, 88, 3, 1, 7, 17, 31, 20, 33, 69, 21, 9, 24, 59],26,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{8,10,11,14,14,17,20,20,22,22,22,23,25,30,33,39,39,41,43,45,46,46,46,50,51,53,57,59,60,64,64,66,72,72,75,77,85,85,87,88,90,91,93,94,94,95},{-44,-90,20,4,-56,-50,-80,74,-82,20,62,-26,-10,-14,-76,82,-88,92,30,44,-62,-86,-20,-96,-60,-88,-78,-40,-48,-92,62,58,94,68,68,44,80,4,48,-92,30,-76,-46,-20,4},{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},{8,34,48,10,5,12,80,7,67,1,79,59,63,13,16,23,62,56,99,89,7,80},{-88,-46,-40,-40,38},{1,0,0,1,0,1,1,0,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,0,1,0,1,1,1,0,1,1,1},{8,15,35,39,49,81,86,91},{-24,56,-74,-76,-80,86,90,0,-26,18,72,78,-66,-28,22,22,72,78,-50,-12,20,12,-68,-2,-58,-44,28,-58,90,-28,32,-70,-48,-66,-94,-50,18,-12,80,12,82,56,-64,10,-22},{0,0},{62,93,69,40,26,2,29,83,66,68,67,73,12,65,89,57,38,99,42,27,38,24,43,4,4,54,72,47,52,46,53,24,3,41,64,33,88,3,1,7,17,31,20,33,69,21,9,24,59}};
vector<int> param1 {38,36,28,12,3,44,7,36,1,26};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
COUNT_BINARY_STRINGS_K_TIMES_APPEARING_ADJACENT_TWO_SET_BITS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_BINARY_STRINGS_K_TIMES_APPEARING_ADJACENT_TWO_SET_BITS{
static int f_gold ( int n , int k ) {
int dp [ ] [ ] [ ] = new int [ n + 1 ] [ k + 1 ] [ 2 ] ;
dp [ 1 ] [ 0 ] [ 0 ] = 1 ;
dp [ 1 ] [ 0 ] [ 1 ] = 1 ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
for ( int j = 0 ;
j < i && j < k + 1 ;
j ++ ) {
dp [ i ] [ j ] [ 0 ] = dp [ i - 1 ] [ j ] [ 0 ] + dp [ i - 1 ] [ j ] [ 1 ] ;
dp [ i ] [ j ] [ 1 ] = dp [ i - 1 ] [ j ] [ 0 ] ;
if ( j - 1 >= 0 ) {
dp [ i ] [ j ] [ 1 ] += dp [ i - 1 ] [ j - 1 ] [ 1 ] ;
}
}
}
return dp [ n ] [ k ] [ 0 ] + dp [ n ] [ k ] [ 1 ] ;
}
| def f_gold ( n , k ) :
dp = [ [ [ 0 , 0 ] for __ in range ( k + 1 ) ] for _ in range ( n + 1 ) ]
dp [ 1 ] [ 0 ] [ 0 ] = 1
dp [ 1 ] [ 0 ] [ 1 ] = 1
for i in range ( 2 , n + 1 ) :
for j in range ( k + 1 ) :
dp [ i ] [ j ] [ 0 ] = ( dp [ i - 1 ] [ j ] [ 0 ] + dp [ i - 1 ] [ j ] [ 1 ] )
dp [ i ] [ j ] [ 1 ] = dp [ i - 1 ] [ j ] [ 0 ]
if j >= 1 :
dp [ i ] [ j ] [ 1 ] += dp [ i - 1 ] [ j - 1 ] [ 1 ]
return dp [ n ] [ k ] [ 0 ] + dp [ n ] [ k ] [ 1 ]
| null |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(29);
param0.add(47);
param0.add(77);
param0.add(9);
param0.add(29);
param0.add(94);
param0.add(51);
param0.add(46);
param0.add(18);
param0.add(86);
List<Integer> param1 = new ArrayList<>();
param1.add(85);
param1.add(29);
param1.add(96);
param1.add(91);
param1.add(80);
param1.add(85);
param1.add(87);
param1.add(62);
param1.add(96);
param1.add(86);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(29,85,),
(47,29,),
(77,96,),
(9,91,),
(29,80,),
(94,85,),
(51,87,),
(46,62,),
(18,96,),
(86,86,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) | null |
FORM_SMALLEST_NUMBER_USING_ONE_SWAP_OPERATION |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FORM_SMALLEST_NUMBER_USING_ONE_SWAP_OPERATION{
public static String f_gold ( String str ) {
char [ ] num = str . toCharArray ( ) ;
int n = str . length ( ) ;
int [ ] rightMin = new int [ n ] ;
rightMin [ n - 1 ] = - 1 ;
int right = n - 1 ;
for ( int i = n - 2 ;
i >= 1 ;
i -- ) {
if ( num [ i ] > num [ right ] ) rightMin [ i ] = right ;
else {
rightMin [ i ] = - 1 ;
right = i ;
}
}
int small = - 1 ;
for ( int i = 1 ;
i < n ;
i ++ ) if ( num [ i ] != '0' ) {
if ( small == - 1 ) {
if ( num [ i ] < num [ 0 ] ) small = i ;
}
else if ( num [ i ] < num [ small ] ) small = i ;
}
if ( small != - 1 ) {
char temp ;
temp = num [ 0 ] ;
num [ 0 ] = num [ small ] ;
num [ small ] = temp ;
}
else {
for ( int i = 1 ;
i < n ;
i ++ ) {
if ( rightMin [ i ] != - 1 ) {
char temp ;
temp = num [ i ] ;
num [ i ] = num [ rightMin [ i ] ] ;
num [ rightMin [ i ] ] = temp ;
break ;
}
}
}
return ( new String ( num ) ) ;
}
| def f_gold ( num ) :
num = list ( num )
n = len ( num )
rightMin = [ 0 ] * n
right = 0
rightMin [ n - 1 ] = - 1 ;
right = n - 1 ;
for i in range ( n - 2 , 0 , - 1 ) :
if num [ i ] > num [ right ] :
rightMin [ i ] = right
else :
rightMin [ i ] = - 1
right = i
small = - 1
for i in range ( 1 , n ) :
if num [ i ] != '0' :
if small == - 1 :
if num [ i ] < num [ 0 ] :
small = i
elif num [ i ] < num [ small ] :
small = i
if small != - 1 :
num [ 0 ] , num [ small ] = num [ small ] , num [ 0 ]
else :
for i in range ( 1 , n ) :
if rightMin [ i ] != - 1 :
num [ i ] , num [ rightMin [ i ] ] = num [ rightMin [ i ] ] , num [ i ]
break
return ''.join ( num )
|
using namespace std;
string f_gold ( string num ) {
int n = num . size ( );
int rightMin [ n ], right;
rightMin [ n - 1 ] = - 1;
right = n - 1;
for ( int i = n - 2;
i >= 1;
i -- ) {
if ( num [ i ] >= num [ right ] ) rightMin [ i ] = right;
else {
if ( num [ i ] == num [ i + 1 ] ) {
rightMin [ i ] = right;
}
else {
rightMin [ i ] = - 1;
right = i;
}
}
}
int small = - 1;
for ( int i = 1;
i < n;
i ++ ) if ( num [ i ] != '0' ) {
if ( small == - 1 ) {
if ( num [ i ] < num [ 0 ] ) small = i;
}
else if ( num [ i ] <= num [ small ] ) small = i;
}
if ( small != - 1 ) swap ( num [ 0 ], num [ small ] );
else {
for ( int i = 1;
i < n;
i ++ ) {
if ( rightMin [ i ] != - 1 && num [ i ] != num [ rightMin [ i ] ] ) {
swap ( num [ i ], num [ rightMin [ i ] ] );
break;
}
}
}
return num;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("ncYltuhSxEfG");
param0.add("26615541616459");
param0.add("0101");
param0.add("hK");
param0.add("422162103899");
param0.add("0010");
param0.add("zfcSh");
param0.add("92");
param0.add("0");
param0.add("v");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)).equals(f_gold(param0.get(i))))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('ncYltuhSxEfG',),
('26615541616459',),
('0101',),
('hK',),
('422162103899',),
('0010',),
('zfcSh',),
('92',),
('0',),
('v',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<string> param0 {"ncYltuhSxEfG","26615541616459","0101","hK","422162103899","0010","zfcSh","92","0","v"};
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();
return 0;
} |
COUNT_NUMBER_BINARY_STRINGS_WITHOUT_CONSECUTIVE_1S |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_NUMBER_BINARY_STRINGS_WITHOUT_CONSECUTIVE_1S{
static int f_gold ( int n ) {
int a [ ] = new int [ n ] ;
int b [ ] = new int [ n ] ;
a [ 0 ] = b [ 0 ] = 1 ;
for ( int i = 1 ;
i < n ;
i ++ ) {
a [ i ] = a [ i - 1 ] + b [ i - 1 ] ;
b [ i ] = a [ i - 1 ] ;
}
return a [ n - 1 ] + b [ n - 1 ] ;
}
| def f_gold ( n ) :
a = [ 0 for i in range ( n ) ]
b = [ 0 for i in range ( n ) ]
a [ 0 ] = b [ 0 ] = 1
for i in range ( 1 , n ) :
a [ i ] = a [ i - 1 ] + b [ i - 1 ]
b [ i ] = a [ i - 1 ]
return a [ n - 1 ] + b [ n - 1 ]
|
using namespace std;
int f_gold ( int n ) {
int a [ n ], b [ n ];
a [ 0 ] = b [ 0 ] = 1;
for ( int i = 1;
i < n;
i ++ ) {
a [ i ] = a [ i - 1 ] + b [ i - 1 ];
b [ i ] = a [ i - 1 ];
}
return a [ n - 1 ] + b [ n - 1 ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(86);
param0.add(75);
param0.add(14);
param0.add(5);
param0.add(41);
param0.add(35);
param0.add(30);
param0.add(89);
param0.add(84);
param0.add(53);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(86,),
(75,),
(14,),
(5,),
(41,),
(35,),
(30,),
(89,),
(84,),
(53,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {86,75,14,5,41,35,30,89,84,53};
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();
return 0;
} |
DIVISIBILITY_BY_12_FOR_A_LARGE_NUMBER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DIVISIBILITY_BY_12_FOR_A_LARGE_NUMBER{
static boolean f_gold ( String num ) {
if ( num . length ( ) >= 3 ) {
int d1 = ( int ) num . charAt ( num . length ( ) - 1 ) ;
if ( d1 % 2 != 0 ) return false ;
int d2 = ( int ) num . charAt ( num . length ( ) - 2 ) ;
int sum = 0 ;
for ( int i = 0 ;
i < num . length ( ) ;
i ++ ) sum += num . charAt ( i ) ;
return ( sum % 3 == 0 && ( d2 * 10 + d1 ) % 4 == 0 ) ;
}
else {
int number = Integer . parseInt ( num ) ;
return ( number % 12 == 0 ) ;
}
}
| null |
using namespace std;
bool f_gold ( string num ) {
if ( num . length ( ) >= 3 ) {
int d1 = ( int ) num [ num . length ( ) - 1 ];
if ( d1 % 2 != 0 ) return ( 0 );
int d2 = ( int ) num [ num . length ( ) - 2 ];
int sum = 0;
for ( int i = 0;
i < num . length ( );
i ++ ) sum += num [ i ];
return ( sum % 3 == 0 && ( d2 * 10 + d1 ) % 4 == 0 );
}
else {
int number = stoi ( num );
return ( number % 12 == 0 );
}
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("12244824607284961224");
param0.add("392603977949");
param0.add("11101001111");
param0.add("92387493287593874594898678979792");
param0.add("2233244912");
param0.add("10101");
param0.add("12");
param0.add("254535361");
param0.add("1");
param0.add("hMPxVMpOBt");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} | null |
int main() {
int n_success = 0;
vector<string> param0 {"12244824607284961224","392603977949","11101001111","92387493287593874594898678979792","2233244912","10101","12","254535361","1","hMPxVMpOBt"};
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();
return 0;
} |
CHECK_GIVEN_CIRCLE_LIES_COMPLETELY_INSIDE_RING_FORMED_TWO_CONCENTRIC_CIRCLES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_GIVEN_CIRCLE_LIES_COMPLETELY_INSIDE_RING_FORMED_TWO_CONCENTRIC_CIRCLES{
public static boolean f_gold ( int r , int R , int r1 , int x1 , int y1 ) {
int dis = ( int ) Math . sqrt ( x1 * x1 + y1 * y1 ) ;
return ( dis - r1 >= R && dis + r1 <= r ) ;
}
| import math
def f_gold ( r , R , r1 , x1 , y1 ) :
dis = int ( math.sqrt ( x1 * x1 + y1 * y1 ) )
return ( dis - r1 >= R and dis + r1 <= r )
|
using namespace std;
bool f_gold ( int r, int R, int r1, int x1, int y1 ) {
int dis = sqrt ( x1 * x1 + y1 * y1 );
return ( dis - r1 >= R && dis + r1 <= r );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(8);
param0.add(400);
param0.add(1);
param0.add(61);
param0.add(60);
param0.add(88);
param0.add(60);
param0.add(26);
param0.add(33);
param0.add(70);
List<Integer> param1 = new ArrayList<>();
param1.add(4);
param1.add(1);
param1.add(400);
param1.add(40);
param1.add(49);
param1.add(10);
param1.add(79);
param1.add(88);
param1.add(65);
param1.add(57);
List<Integer> param2 = new ArrayList<>();
param2.add(2);
param2.add(10);
param2.add(10);
param2.add(2);
param2.add(68);
param2.add(69);
param2.add(92);
param2.add(75);
param2.add(57);
param2.add(77);
List<Integer> param3 = new ArrayList<>();
param3.add(6);
param3.add(74);
param3.add(74);
param3.add(50);
param3.add(77);
param3.add(71);
param3.add(29);
param3.add(84);
param3.add(21);
param3.add(52);
List<Integer> param4 = new ArrayList<>();
param4.add(0);
param4.add(38);
param4.add(38);
param4.add(0);
param4.add(71);
param4.add(26);
param4.add(38);
param4.add(10);
param4.add(61);
param4.add(87);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i),param3.get(i),param4.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i),param4.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(8,4,2,6,0,),
(400,1,10,74,38,),
(1,400,10,74,38,),
(61,40,2,50,0,),
(60,49,68,77,71,),
(88,10,69,71,26,),
(60,79,92,29,38,),
(26,88,75,84,10,),
(33,65,57,21,61,),
(70,57,77,52,87,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {8,400,1,61,60,88,60,26,33,70};
vector<int> param1 {4,1,400,40,49,10,79,88,65,57};
vector<int> param2 {2,10,10,2,68,69,92,75,57,77};
vector<int> param3 {6,74,74,50,77,71,29,84,21,52};
vector<int> param4 {0,38,38,0,71,26,38,10,61,87};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i],param3[i],param4[i]) == f_gold(param0[i],param1[i],param2[i],param3[i],param4[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
LONGEST_COMMON_SUBSTRING_SPACE_OPTIMIZED_DP_SOLUTION |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LONGEST_COMMON_SUBSTRING_SPACE_OPTIMIZED_DP_SOLUTION{
static int f_gold ( String X , String Y ) {
int m = X . length ( ) ;
int n = Y . length ( ) ;
int result = 0 ;
int [ ] [ ] len = new int [ 2 ] [ n ] ;
int currRow = 0 ;
for ( int i = 0 ;
i < m ;
i ++ ) {
for ( int j = 0 ;
j < n ;
j ++ ) {
if ( i == 0 || j == 0 ) {
len [ currRow ] [ j ] = 0 ;
}
else if ( X . charAt ( i - 1 ) == Y . charAt ( j - 1 ) ) {
len [ currRow ] [ j ] = len [ ( 1 - currRow ) ] [ ( j - 1 ) ] + 1 ;
result = Math . max ( result , len [ currRow ] [ j ] ) ;
}
else {
len [ currRow ] [ j ] = 0 ;
}
}
currRow = 1 - currRow ;
}
return result ;
}
| null |
using namespace std;
int f_gold ( string X, string Y ) {
int m = X . length ( );
int n = Y . length ( );
int result = 0;
int len [ 2 ] [ n ];
int currRow = 0;
for ( int i = 0;
i <= m;
i ++ ) {
for ( int j = 0;
j <= n;
j ++ ) {
if ( i == 0 || j == 0 ) {
len [ currRow ] [ j ] = 0;
}
else if ( X [ i - 1 ] == Y [ j - 1 ] ) {
len [ currRow ] [ j ] = len [ 1 - currRow ] [ j - 1 ] + 1;
result = max ( result, len [ currRow ] [ j ] );
}
else {
len [ currRow ] [ j ] = 0;
}
}
currRow = 1 - currRow;
}
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("GeeksforGeeks");
param0.add("333940");
param0.add("1000");
param0.add("Facebook");
param0.add("2684247");
param0.add("111");
param0.add("abcdxyz");
param0.add("625330958530");
param0.add("01011000001111");
param0.add("KXm");
List<String> param1 = new ArrayList<>();
param1.add("GeeksQuiz");
param1.add("390");
param1.add("0");
param1.add("nice book");
param1.add("1");
param1.add("10");
param1.add("xyzabcd");
param1.add("412511");
param1.add("1001010001");
param1.add("gF");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} | null |
int main() {
int n_success = 0;
vector<string> param0 {"GeeksforGeeks","333940","1000","Facebook","2684247","111","abcdxyz","625330958530","01011000001111","KXm"};
vector<string> param1 {"GeeksQuiz","390","0","nice book","1","10","xyzabcd","412511","1001010001","gF"};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
COMPUTE_AVERAGE_TWO_NUMBERS_WITHOUT_OVERFLOW_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COMPUTE_AVERAGE_TWO_NUMBERS_WITHOUT_OVERFLOW_1{
static int f_gold ( int a , int b ) {
return ( a / 2 ) + ( b / 2 ) + ( ( a % 2 + b % 2 ) / 2 ) ;
}
| def f_gold ( a , b ) :
return ( a // 2 ) + ( b // 2 ) + ( ( a % 2 + b % 2 ) // 2 )
|
using namespace std;
int f_gold ( int a, int b ) {
return ( a / 2 ) + ( b / 2 ) + ( ( a % 2 + b % 2 ) / 2 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(9);
param0.add(68);
param0.add(51);
param0.add(31);
param0.add(14);
param0.add(73);
param0.add(51);
param0.add(75);
param0.add(98);
param0.add(83);
List<Integer> param1 = new ArrayList<>();
param1.add(81);
param1.add(79);
param1.add(2);
param1.add(49);
param1.add(10);
param1.add(9);
param1.add(13);
param1.add(67);
param1.add(51);
param1.add(74);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(9,81,),
(68,79,),
(51,2,),
(31,49,),
(14,10,),
(73,9,),
(51,13,),
(75,67,),
(98,51,),
(83,74,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {9,68,51,31,14,73,51,75,98,83};
vector<int> param1 {81,79,2,49,10,9,13,67,51,74};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
PROGRAM_AREA_SQUARE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_AREA_SQUARE{
static int f_gold ( int side ) {
int area = side * side ;
return area ;
}
| def f_gold ( side ) :
area = side * side
return area
|
using namespace std;
int f_gold ( int side ) {
int area = side * side;
return area;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(50);
param0.add(64);
param0.add(92);
param0.add(23);
param0.add(38);
param0.add(55);
param0.add(67);
param0.add(56);
param0.add(60);
param0.add(90);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(50,),
(64,),
(92,),
(23,),
(38,),
(55,),
(67,),
(56,),
(60,),
(90,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {50,64,92,23,38,55,67,56,60,90};
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();
return 0;
} |
MAXIMUM_SUM_PAIRS_SPECIFIC_DIFFERENCE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_SUM_PAIRS_SPECIFIC_DIFFERENCE{
static int f_gold ( int arr [ ] , int N , int K ) {
Arrays . sort ( arr ) ;
int dp [ ] = new int [ N ] ;
dp [ 0 ] = 0 ;
for ( int i = 1 ;
i < N ;
i ++ ) {
dp [ i ] = dp [ i - 1 ] ;
if ( arr [ i ] - arr [ i - 1 ] < K ) {
if ( i >= 2 ) dp [ i ] = Math . max ( dp [ i ] , dp [ i - 2 ] + arr [ i ] + arr [ i - 1 ] ) ;
else dp [ i ] = Math . max ( dp [ i ] , arr [ i ] + arr [ i - 1 ] ) ;
}
}
return dp [ N - 1 ] ;
}
| def f_gold ( arr , N , K ) :
arr.sort ( )
dp = [ 0 ] * N
dp [ 0 ] = 0
for i in range ( 1 , N ) :
dp [ i ] = dp [ i - 1 ]
if ( arr [ i ] - arr [ i - 1 ] < K ) :
if ( i >= 2 ) :
dp [ i ] = max ( dp [ i ] , dp [ i - 2 ] + arr [ i ] + arr [ i - 1 ] ) ;
else :
dp [ i ] = max ( dp [ i ] , arr [ i ] + arr [ i - 1 ] ) ;
return dp [ N - 1 ]
|
using namespace std;
int f_gold ( int arr [ ], int N, int K ) {
sort ( arr, arr + N );
int dp [ N ];
dp [ 0 ] = 0;
for ( int i = 1;
i < N;
i ++ ) {
dp [ i ] = dp [ i - 1 ];
if ( arr [ i ] - arr [ i - 1 ] < K ) {
if ( i >= 2 ) dp [ i ] = max ( dp [ i ], dp [ i - 2 ] + arr [ i ] + arr [ i - 1 ] );
else dp [ i ] = max ( dp [ i ], arr [ i ] + arr [ i - 1 ] );
}
}
return dp [ N - 1 ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{48,53,67,78,78,93,95});
param0.add(new int[]{-2,52,18,70,32,88,-70,-32,72,30});
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,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{98,84,13,61,58,90,45,89,45,80,3,5,57,86,40,80,60,51,60,73,67,10,52,56,60,36,34,60,75,63,23,86,51,68,86,13,71,86,99,6,42,2,39,82,16,5,23,47,12});
param0.add(new int[]{-84,-56,68,78});
param0.add(new int[]{0,0,1,0,0,1,1,0,0,0,1,0,1,1,1,1,0});
param0.add(new int[]{1,2,3,9,12,12,16,17,18,19,20,21,21,26,29,42,44,45,48,48,48,54,54,55,60,63,63,64,64,67,67,68,69,74,78,78,79,83,95,95,95,96,97,99});
param0.add(new int[]{40,-48,-14,64,-58,60,-42,-56,54,28,-16,-92,42});
param0.add(new int[]{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});
param0.add(new int[]{64,25,96});
List<Integer> param1 = new ArrayList<>();
param1.add(6);
param1.add(8);
param1.add(37);
param1.add(31);
param1.add(3);
param1.add(14);
param1.add(27);
param1.add(9);
param1.add(21);
param1.add(1);
List<Integer> param2 = new ArrayList<>();
param2.add(4);
param2.add(8);
param2.add(31);
param2.add(37);
param2.add(3);
param2.add(9);
param2.add(42);
param2.add(8);
param2.add(19);
param2.add(1);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([48, 53, 67, 78, 78, 93, 95],6,4,),
([-2, 52, 18, 70, 32, 88, -70, -32, 72, 30],8,8,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],37,31,),
([98, 84, 13, 61, 58, 90, 45, 89, 45, 80, 3, 5, 57, 86, 40, 80, 60, 51, 60, 73, 67, 10, 52, 56, 60, 36, 34, 60, 75, 63, 23, 86, 51, 68, 86, 13, 71, 86, 99, 6, 42, 2, 39, 82, 16, 5, 23, 47, 12],31,37,),
([-84, -56, 68, 78],3,3,),
([0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0],14,9,),
([1, 2, 3, 9, 12, 12, 16, 17, 18, 19, 20, 21, 21, 26, 29, 42, 44, 45, 48, 48, 48, 54, 54, 55, 60, 63, 63, 64, 64, 67, 67, 68, 69, 74, 78, 78, 79, 83, 95, 95, 95, 96, 97, 99],27,42,),
([40, -48, -14, 64, -58, 60, -42, -56, 54, 28, -16, -92, 42],9,8,),
([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],21,19,),
([64, 25, 96],1,1,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{48,53,67,78,78,93,95},{-2,52,18,70,32,88,-70,-32,72,30},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1},{98,84,13,61,58,90,45,89,45,80,3,5,57,86,40,80,60,51,60,73,67,10,52,56,60,36,34,60,75,63,23,86,51,68,86,13,71,86,99,6,42,2,39,82,16,5,23,47,12},{-84,-56,68,78},{0,0,1,0,0,1,1,0,0,0,1,0,1,1,1,1,0},{1,2,3,9,12,12,16,17,18,19,20,21,21,26,29,42,44,45,48,48,48,54,54,55,60,63,63,64,64,67,67,68,69,74,78,78,79,83,95,95,95,96,97,99},{40,-48,-14,64,-58,60,-42,-56,54,28,-16,-92,42},{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},{64,25,96}};
vector<int> param1 {6,8,37,31,3,14,27,9,21,1};
vector<int> param2 {4,8,31,37,3,9,42,8,19,1};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],param2[i]) == f_gold(¶m0[i].front(),param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
AREA_OF_THE_CIRCLE_THAT_HAS_A_SQUARE_AND_A_CIRCLE_INSCRIBED_IN_IT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class AREA_OF_THE_CIRCLE_THAT_HAS_A_SQUARE_AND_A_CIRCLE_INSCRIBED_IN_IT{
static float f_gold ( int a ) {
float area = ( float ) ( Math . PI * a * a ) / 4 ;
return area ;
}
| import math
def f_gold ( a ) :
area = ( math.pi * a * a ) / 4
return area
|
using namespace std;
float f_gold ( int a ) {
float area = ( M_PI * a * a ) / 4.0;
return area;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(77);
param0.add(18);
param0.add(83);
param0.add(39);
param0.add(68);
param0.add(28);
param0.add(71);
param0.add(14);
param0.add(21);
param0.add(73);
for(int i = 0; i < param0.size(); ++i)
{
if(Math.abs(1 - (0.0000001 + Math.abs(f_gold(param0.get(i))) )/ (Math.abs(f_filled(param0.get(i))) + 0.0000001)) < 0.001F)
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(77,),
(18,),
(83,),
(39,),
(68,),
(28,),
(71,),
(14,),
(21,),
(73,)
]
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)) + 0.0000001)) < 0.001:
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {77,18,83,39,68,28,71,14,21,73};
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.001F)
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MULTIPLY_AN_INTEGER_WITH_3_5 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MULTIPLY_AN_INTEGER_WITH_3_5{
static int f_gold ( int x ) {
return ( x << 1 ) + x + ( x >> 1 ) ;
}
| def f_gold ( x ) :
return ( x << 1 ) + x + ( x >> 1 )
|
using namespace std;
int f_gold ( int x ) {
return ( x << 1 ) + x + ( x >> 1 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(58);
param0.add(16);
param0.add(82);
param0.add(33);
param0.add(88);
param0.add(51);
param0.add(81);
param0.add(38);
param0.add(79);
param0.add(89);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(58,),
(16,),
(82,),
(33,),
(88,),
(51,),
(81,),
(38,),
(79,),
(89,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {58,16,82,33,88,51,81,38,79,89};
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();
return 0;
} |
MAXIMUM_SUM_SUBSEQUENCE_LEAST_K_DISTANT_ELEMENTS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_SUM_SUBSEQUENCE_LEAST_K_DISTANT_ELEMENTS{
static int f_gold ( int arr [ ] , int N , int k ) {
int MS [ ] = new int [ N ] ;
MS [ N - 1 ] = arr [ N - 1 ] ;
for ( int i = N - 2 ;
i >= 0 ;
i -- ) {
if ( i + k + 1 >= N ) MS [ i ] = Math . max ( arr [ i ] , MS [ i + 1 ] ) ;
else MS [ i ] = Math . max ( arr [ i ] + MS [ i + k + 1 ] , MS [ i + 1 ] ) ;
}
return MS [ 0 ] ;
}
| def f_gold ( arr , N , k ) :
MS = [ 0 for i in range ( N ) ]
MS [ N - 1 ] = arr [ N - 1 ]
for i in range ( N - 2 , - 1 , - 1 ) :
if ( i + k + 1 >= N ) :
MS [ i ] = max ( arr [ i ] , MS [ i + 1 ] )
else :
MS [ i ] = max ( arr [ i ] + MS [ i + k + 1 ] , MS [ i + 1 ] )
return MS [ 0 ]
|
using namespace std;
int f_gold ( int arr [ ], int N, int k ) {
int MS [ N ];
MS [ N - 1 ] = arr [ N - 1 ];
for ( int i = N - 2;
i >= 0;
i -- ) {
if ( i + k + 1 >= N ) MS [ i ] = max ( arr [ i ], MS [ i + 1 ] );
else MS [ i ] = max ( arr [ i ] + MS [ i + k + 1 ], MS [ i + 1 ] );
}
return MS [ 0 ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,5,20,21,23,26,27,31,33,38,39,41,48,48,50,51,56,57,64,68,69,70,71,74,76,86,97});
param0.add(new int[]{32,34,-40,90,-82,-70,30,26,-76,-46,-84,76,-76});
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,1,1});
param0.add(new int[]{96,15,30,25,83});
param0.add(new int[]{-90,-82,-80,-76,-62,-58,-50,-48,-46,-38,-38,-38,-38,-38,-34,-32,-24,-22,-16,-16,-4,-2,10,10,20,26,26,32,38,38,44,44,46,48,58,62,64,66,76,78,78,82,92,96,96,98});
param0.add(new int[]{1,1,1,1,1,0,0,0,0,1,1,1,0,1,0,0,1,0,0});
param0.add(new int[]{1,2,9,17,24,31,31,33,56,57,61,71,73,74,76,77,79,83,86,95,99});
param0.add(new int[]{-12,52,-44,80,-66,34,42,-46,8,12,-22,-56,74,-98,-44,2,-24,-14,-54,-56,-26,-18,-72});
param0.add(new int[]{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[]{65,1,34,38,15,6,55,21,32,90,39,25,43,48,64,66,88,70,82,75,25,56,23,27,41,33,33,55,60,90,41,58,42,53,38,90,7,15});
List<Integer> param1 = new ArrayList<>();
param1.add(23);
param1.add(9);
param1.add(22);
param1.add(2);
param1.add(27);
param1.add(9);
param1.add(12);
param1.add(13);
param1.add(13);
param1.add(37);
List<Integer> param2 = new ArrayList<>();
param2.add(15);
param2.add(10);
param2.add(34);
param2.add(3);
param2.add(30);
param2.add(9);
param2.add(10);
param2.add(19);
param2.add(13);
param2.add(33);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([3, 5, 20, 21, 23, 26, 27, 31, 33, 38, 39, 41, 48, 48, 50, 51, 56, 57, 64, 68, 69, 70, 71, 74, 76, 86, 97],23,15,),
([32, 34, -40, 90, -82, -70, 30, 26, -76, -46, -84, 76, -76],9,10,),
([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],22,34,),
([96, 15, 30, 25, 83],2,3,),
([-90, -82, -80, -76, -62, -58, -50, -48, -46, -38, -38, -38, -38, -38, -34, -32, -24, -22, -16, -16, -4, -2, 10, 10, 20, 26, 26, 32, 38, 38, 44, 44, 46, 48, 58, 62, 64, 66, 76, 78, 78, 82, 92, 96, 96, 98],27,30,),
([1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0],9,9,),
([1, 2, 9, 17, 24, 31, 31, 33, 56, 57, 61, 71, 73, 74, 76, 77, 79, 83, 86, 95, 99],12,10,),
([-12, 52, -44, 80, -66, 34, 42, -46, 8, 12, -22, -56, 74, -98, -44, 2, -24, -14, -54, -56, -26, -18, -72],13,19,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],13,13,),
([65, 1, 34, 38, 15, 6, 55, 21, 32, 90, 39, 25, 43, 48, 64, 66, 88, 70, 82, 75, 25, 56, 23, 27, 41, 33, 33, 55, 60, 90, 41, 58, 42, 53, 38, 90, 7, 15],37,33,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{3,5,20,21,23,26,27,31,33,38,39,41,48,48,50,51,56,57,64,68,69,70,71,74,76,86,97},{32,34,-40,90,-82,-70,30,26,-76,-46,-84,76,-76},{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},{96,15,30,25,83},{-90,-82,-80,-76,-62,-58,-50,-48,-46,-38,-38,-38,-38,-38,-34,-32,-24,-22,-16,-16,-4,-2,10,10,20,26,26,32,38,38,44,44,46,48,58,62,64,66,76,78,78,82,92,96,96,98},{1,1,1,1,1,0,0,0,0,1,1,1,0,1,0,0,1,0,0},{1,2,9,17,24,31,31,33,56,57,61,71,73,74,76,77,79,83,86,95,99},{-12,52,-44,80,-66,34,42,-46,8,12,-22,-56,74,-98,-44,2,-24,-14,-54,-56,-26,-18,-72},{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1},{65,1,34,38,15,6,55,21,32,90,39,25,43,48,64,66,88,70,82,75,25,56,23,27,41,33,33,55,60,90,41,58,42,53,38,90,7,15}};
vector<int> param1 {23,9,22,2,27,9,12,13,13,37};
vector<int> param2 {15,10,34,3,30,9,10,19,13,33};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],param2[i]) == f_gold(¶m0[i].front(),param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
DYNAMIC_PROGRAMMING_SET_28_MINIMUM_INSERTIONS_TO_FORM_A_PALINDROME |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_SET_28_MINIMUM_INSERTIONS_TO_FORM_A_PALINDROME{
static int f_gold ( char str [ ] , int l , int h ) {
if ( l > h ) return Integer . MAX_VALUE ;
if ( l == h ) return 0 ;
if ( l == h - 1 ) return ( str [ l ] == str [ h ] ) ? 0 : 1 ;
return ( str [ l ] == str [ h ] ) ? f_gold ( str , l + 1 , h - 1 ) : ( Integer . min ( f_gold ( str , l , h - 1 ) , f_gold ( str , l + 1 , h ) ) + 1 ) ;
}
| import sys
def f_gold ( str , l , h ) :
if ( l > h ) :
return sys.maxsize
if ( l == h ) :
return 0
if ( l == h - 1 ) :
return 0 if ( str [ l ] == str [ h ] ) else 1
if ( str [ l ] == str [ h ] ) :
return f_gold ( str , l + 1 , h - 1 )
else :
return ( min ( f_gold ( str , l , h - 1 ) , f_gold ( str , l + 1 , h ) ) + 1 )
|
using namespace std;
int f_gold ( char str [ ], int l, int h ) {
if ( l > h ) return INT_MAX;
if ( l == h ) return 0;
if ( l == h - 1 ) return ( str [ l ] == str [ h ] ) ? 0 : 1;
return ( str [ l ] == str [ h ] ) ? f_gold ( str, l + 1, h - 1 ) : ( min ( f_gold ( str, l, h - 1 ), f_gold ( str, l + 1, h ) ) + 1 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<char [ ]> param0 = new ArrayList<>();
param0.add(new char[]{'F','F','J','K','K','L','P','S','T','V','W','Y','b','d','j','l','t','u','x','y'});
param0.add(new char[]{'0','1','8','8','8','4','4','3','9','6','5','2','8','2','0','2','6','0','7','7','3','2','4','5','9','7','2','4','1','8','7','9','8','0','8','5','4','2','3'});
param0.add(new char[]{'1'});
param0.add(new char[]{'g','y','r','M','v','z',' ','k','S','P','x','p','E','z','T','K','k','B','s','P','p','e','G','t','r','M','p',' ','H','a'});
param0.add(new char[]{'0','1','1','1','1','1','1','2','2','2','2','3','3','3','3','3','4','4','4','5','5','5','5','5','6','6','6','6','6','6','6','7','8','8','8','9','9'});
param0.add(new char[]{'1','1','0','1','0','1','0','1','0','1','1','1','1','1','1','0'});
param0.add(new char[]{' ',' ',' ','B','C','C','D','I','K','O','P','R','T','V','W','a','b','d','j','y'});
param0.add(new char[]{'5','0','8','6','9','3','0','3','2','0','6','2','3','7','8','9','2','0','1','9','4','1','3','1','9','2','3','4','1','2','3','8','1'});
param0.add(new char[]{'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'});
param0.add(new char[]{'X','B','E','v','K','t','k','K','Q','s','V','N','l','k','T','N','J','z','f','p','J','g','S','P','M','b','H','L','v','E','A','n','D','U','c','s','M','Q','P','g','g',' '});
List<Integer> param1 = new ArrayList<>();
param1.add(11);
param1.add(19);
param1.add(0);
param1.add(24);
param1.add(33);
param1.add(13);
param1.add(16);
param1.add(31);
param1.add(37);
param1.add(26);
List<Integer> param2 = new ArrayList<>();
param2.add(11);
param2.add(22);
param2.add(0);
param2.add(27);
param2.add(34);
param2.add(8);
param2.add(14);
param2.add(25);
param2.add(35);
param2.add(27);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(['F', 'F', 'J', 'K', 'K', 'L', 'P', 'S', 'T', 'V', 'W', 'Y', 'b', 'd', 'j', 'l', 't', 'u', 'x', 'y'],11,11,),
(['0', '1', '8', '8', '8', '4', '4', '3', '9', '6', '5', '2', '8', '2', '0', '2', '6', '0', '7', '7', '3', '2', '4', '5', '9', '7', '2', '4', '1', '8', '7', '9', '8', '0', '8', '5', '4', '2', '3'],19,22,),
(['1'],0,0,),
(['g', 'y', 'r', 'M', 'v', 'z', ' ', 'k', 'S', 'P', 'x', 'p', 'E', 'z', 'T', 'K', 'k', 'B', 's', 'P', 'p', 'e', 'G', 't', 'r', 'M', 'p', ' ', 'H', 'a'],24,27,),
(['0', '1', '1', '1', '1', '1', '1', '2', '2', '2', '2', '3', '3', '3', '3', '3', '4', '4', '4', '5', '5', '5', '5', '5', '6', '6', '6', '6', '6', '6', '6', '7', '8', '8', '8', '9', '9'],33,34,),
(['1', '1', '0', '1', '0', '1', '0', '1', '0', '1', '1', '1', '1', '1', '1', '0'],13,8,),
([' ', ' ', ' ', 'B', 'C', 'C', 'D', 'I', 'K', 'O', 'P', 'R', 'T', 'V', 'W', 'a', 'b', 'd', 'j', 'y'],16,14,),
(['5', '0', '8', '6', '9', '3', '0', '3', '2', '0', '6', '2', '3', '7', '8', '9', '2', '0', '1', '9', '4', '1', '3', '1', '9', '2', '3', '4', '1', '2', '3', '8', '1'],31,25,),
(['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'],37,35,),
(['X', 'B', 'E', 'v', 'K', 't', 'k', 'K', 'Q', 's', 'V', 'N', 'l', 'k', 'T', 'N', 'J', 'z', 'f', 'p', 'J', 'g', 'S', 'P', 'M', 'b', 'H', 'L', 'v', 'E', 'A', 'n', 'D', 'U', 'c', 's', 'M', 'Q', 'P', 'g', 'g', ' '],26,27,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<char>> param0 {{'F','F','J','K','K','L','P','S','T','V','W','Y','b','d','j','l','t','u','x','y'},{'0','1','8','8','8','4','4','3','9','6','5','2','8','2','0','2','6','0','7','7','3','2','4','5','9','7','2','4','1','8','7','9','8','0','8','5','4','2','3'},{'1'},{'g','y','r','M','v','z',' ','k','S','P','x','p','E','z','T','K','k','B','s','P','p','e','G','t','r','M','p',' ','H','a'},{'0','1','1','1','1','1','1','2','2','2','2','3','3','3','3','3','4','4','4','5','5','5','5','5','6','6','6','6','6','6','6','7','8','8','8','9','9'},{'1','1','0','1','0','1','0','1','0','1','1','1','1','1','1','0'},{' ',' ',' ','B','C','C','D','I','K','O','P','R','T','V','W','a','b','d','j','y'},{'5','0','8','6','9','3','0','3','2','0','6','2','3','7','8','9','2','0','1','9','4','1','3','1','9','2','3','4','1','2','3','8','1'},{'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'},{'X','B','E','v','K','t','k','K','Q','s','V','N','l','k','T','N','J','z','f','p','J','g','S','P','M','b','H','L','v','E','A','n','D','U','c','s','M','Q','P','g','g',' '}};
vector<int> param1 {11,19,0,24,33,13,16,31,37,26};
vector<int> param2 {11,22,0,27,34,8,14,25,35,27};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],param2[i]) == f_gold(¶m0[i].front(),param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
SEARCH_ALMOST_SORTED_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SEARCH_ALMOST_SORTED_ARRAY{
static int f_gold ( int arr [ ] , int l , int r , int x ) {
if ( r >= l ) {
int mid = l + ( r - l ) / 2 ;
if ( arr [ mid ] == x ) return mid ;
if ( mid > l && arr [ mid - 1 ] == x ) return ( mid - 1 ) ;
if ( mid < r && arr [ mid + 1 ] == x ) return ( mid + 1 ) ;
if ( arr [ mid ] > x ) return f_gold ( arr , l , mid - 2 , x ) ;
return f_gold ( arr , mid + 2 , r , x ) ;
}
return - 1 ;
}
| def f_gold ( arr , l , r , x ) :
if ( r >= l ) :
mid = int ( l + ( r - l ) / 2 )
if ( arr [ mid ] == x ) : return mid
if ( mid > l and arr [ mid - 1 ] == x ) :
return ( mid - 1 )
if ( mid < r and arr [ mid + 1 ] == x ) :
return ( mid + 1 )
if ( arr [ mid ] > x ) :
return f_gold ( arr , l , mid - 2 , x )
return f_gold ( arr , mid + 2 , r , x )
return - 1
|
using namespace std;
int f_gold ( int arr [ ], int l, int r, int x ) {
if ( r >= l ) {
int mid = l + ( r - l ) / 2;
if ( arr [ mid ] == x ) return mid;
if ( mid > l && arr [ mid - 1 ] == x ) return ( mid - 1 );
if ( mid < r && arr [ mid + 1 ] == x ) return ( mid + 1 );
if ( arr [ mid ] > x ) return f_gold ( arr, l, mid - 2, x );
return f_gold ( arr, mid + 2, r, x );
}
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{6,7,15,42,47,54,56,59,59,64,68,70,71,75,91,93});
param0.add(new int[]{6,7,15,42,47,56,54,59,59,64,68,71,70, 75,91,93});
param0.add(new int[]{-92,-96,-68,-40,70});
param0.add(new int[]{-92,-86,-68,-40,70});
param0.add(new int[]{-3,-1,0,30,10,45,70,60});
param0.add(new int[]{-3,-1,0,10,5,45,60,50});
param0.add(new int[]{-3,-1,0,10,30,45,60,70});
param0.add(new int[]{0,0,1});
param0.add(new int[]{1,1,1});
param0.add(new int[]{30,2,30,45});
List<Integer> param1 = new ArrayList<>();
param1.add(0);
param1.add(0);
param1.add(0);
param1.add(0);
param1.add(0);
param1.add(0);
param1.add(0);
param1.add(0);
param1.add(0);
param1.add(0);
List<Integer> param2 = new ArrayList<>();
param2.add(15);
param2.add(15);
param2.add(4);
param2.add(4);
param2.add(7);
param2.add(7);
param2.add(7);
param2.add(2);
param2.add(2);
param2.add(3);
List<Integer> param3 = new ArrayList<>();
param3.add(71);
param3.add(71);
param3.add(-96);
param3.add(20);
param3.add(0);
param3.add(12);
param3.add(18);
param3.add(20);
param3.add(17);
param3.add(28);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i),param3.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
}
|
if __name__ == '__main__':
param = [
([6,7,15,42,47,54,56,59,59,64,68,70,71,75,91,93], 0, 15, 71),
([6,7,15,42,47,56,54,59,59,64,68,71,70, 75,91,93], 0, 15, 71),
([-92,-96,-68,-40,70], 0, 4, , -96),
([-92,-86,-68,-40,70], 0, 4, 20),
([-3,-1,0,30,10,45,70,60], 0, 7, 0),
([-3,-1,0,10,5,45,60,50], 0, 7, 12),
([-3,-1,0,10,30,45,60,70], 0, 7, 18),
([0,0,1], 0, 2, 20),
([1,1,1], 0, 2, 17),
([30,2,30,45], 0, 3, 28)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param)))
|
int main() {
int n_success = 0;
vector<vector<int>> param0 {{6,7,15,42,47,54,56,59,59,64,68,70,71,75,91,93},{6,7,15,42,47,56,54,59,59,64,68,71,70, 75,91,93},{-92,-96,-68,-40,70},{-92,-86,-68,-40,70},{-3,-1,0,30,10,45,70,60},{-3,-1,0,10,5,45,60,50},{-3,-1,0,10,30,45,60,70},{0,0,1},{1,1,1},{30,2,30,45}};
vector<int> param1 {0,0,0,0,0,0,0,0,0,0};
vector<int> param2 {15,15,4,4,7,7,7,2,2,3};
vector<int> param3 {71,71,-96,20,0,12,18,20,17,28};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],param2[i],param3[i]) == f_gold(¶m0[i].front(),param1[i],param2[i],param3[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
}
|
SUM_SERIES_555555_N_TERMS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_SERIES_555555_N_TERMS{
static int f_gold ( int n ) {
return ( int ) ( 0.6172 * ( Math . pow ( 10 , n ) - 1 ) - 0.55 * n ) ;
}
| def f_gold ( n ) :
return ( int ) ( 0.6172 * ( pow ( 10 , n ) - 1 ) - 0.55 * n )
|
using namespace std;
int f_gold ( int n ) {
return 0.6172 * ( pow ( 10, n ) - 1 ) - 0.55 * n;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(18);
param0.add(81);
param0.add(77);
param0.add(84);
param0.add(87);
param0.add(14);
param0.add(15);
param0.add(3);
param0.add(21);
param0.add(60);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(18,),
(81,),
(77,),
(84,),
(87,),
(14,),
(15,),
(3,),
(21,),
(60,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {18,81,77,84,87,14,15,3,21,60};
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();
return 0;
} |
SUM_SUBSETS_SET_FORMED_FIRST_N_NATURAL_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_SUBSETS_SET_FORMED_FIRST_N_NATURAL_NUMBERS{
static long f_gold ( int n ) {
return ( n * ( n + 1 ) / 2 ) * ( 1 << ( n - 1 ) ) ;
}
| def f_gold ( n ) :
return ( n * ( n + 1 ) / 2 ) * ( 1 << ( n - 1 ) )
|
using namespace std;
unsigned long long f_gold ( int n ) {
return ( n * ( n + 1 ) / 2 ) * ( 1 << ( n - 1 ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(76);
param0.add(26);
param0.add(45);
param0.add(35);
param0.add(34);
param0.add(22);
param0.add(3);
param0.add(25);
param0.add(22);
param0.add(78);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(76,),
(26,),
(45,),
(35,),
(34,),
(22,),
(3,),
(25,),
(22,),
(78,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {76,26,45,35,34,22,3,25,22,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();
return 0;
} |
PROGRAM_TO_FIND_REMAINDER_WITHOUT_USING_MODULO_OR_OPERATOR_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_TO_FIND_REMAINDER_WITHOUT_USING_MODULO_OR_OPERATOR_1{
static int f_gold ( int num , int divisor ) {
if ( divisor == 0 ) {
System . out . println ( "Error: divisor " + "can't be zero \n" ) ;
return - 1 ;
}
if ( divisor < 0 ) divisor = - divisor ;
if ( num < 0 ) num = - num ;
int i = 1 ;
int product = 0 ;
while ( product <= num ) {
product = divisor * i ;
i ++ ;
}
return num - ( product - divisor ) ;
}
| def f_gold ( num , divisor ) :
if ( divisor == 0 ) :
return False
if ( divisor < 0 ) :
divisor = - divisor
if ( num < 0 ) :
num = - num
i = 1
product = 0
while ( product <= num ) :
product = divisor * i
i += 1
return num - ( product - divisor )
|
using namespace std;
int f_gold ( int num, int divisor ) {
if ( divisor == 0 ) {
cout << "Error: divisor can't be zero \n";
return - 1;
}
if ( divisor < 0 ) divisor = - divisor;
if ( num < 0 ) num = - num;
int i = 1;
int product = 0;
while ( product <= num ) {
product = divisor * i;
i ++;
}
return num - ( product - divisor );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(34);
param0.add(63);
param0.add(15);
param0.add(56);
param0.add(63);
param0.add(28);
param0.add(54);
param0.add(2);
param0.add(94);
param0.add(82);
List<Integer> param1 = new ArrayList<>();
param1.add(55);
param1.add(22);
param1.add(26);
param1.add(58);
param1.add(94);
param1.add(45);
param1.add(97);
param1.add(58);
param1.add(91);
param1.add(40);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(34,55,),
(63,22,),
(15,26,),
(56,58,),
(63,94,),
(28,45,),
(54,97,),
(2,58,),
(94,91,),
(82,40,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {34,63,15,56,63,28,54,2,94,82};
vector<int> param1 {55,22,26,58,94,45,97,58,91,40};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
COMPOSITE_NUMBER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COMPOSITE_NUMBER{
static boolean f_gold ( int n ) {
if ( n <= 1 ) System . out . println ( "False" ) ;
if ( n <= 3 ) System . out . println ( "False" ) ;
if ( n % 2 == 0 || n % 3 == 0 ) return true ;
for ( int i = 5 ;
i * i <= n ;
i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true ;
return false ;
}
| def f_gold ( n ) :
if ( n <= 1 ) :
return False
if ( n <= 3 ) :
return False
if ( n % 2 == 0 or n % 3 == 0 ) :
return True
i = 5
while ( i * i <= n ) :
if ( n % i == 0 or n % ( i + 2 ) == 0 ) :
return True
i = i + 6
return False
|
using namespace std;
bool f_gold ( int n ) {
if ( n <= 1 ) return false;
if ( n <= 3 ) return false;
if ( n % 2 == 0 || n % 3 == 0 ) return true;
for ( int i = 5;
i * i <= n;
i = i + 6 ) if ( n % i == 0 || n % ( i + 2 ) == 0 ) return true;
return false;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(62);
param0.add(13);
param0.add(29);
param0.add(72);
param0.add(30);
param0.add(20);
param0.add(10);
param0.add(47);
param0.add(91);
param0.add(52);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(62,),
(13,),
(29,),
(72,),
(30,),
(20,),
(10,),
(47,),
(91,),
(52,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {62,13,29,72,30,20,10,47,91,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();
return 0;
} |
PROGRAM_PAGE_REPLACEMENT_ALGORITHMS_SET_2_FIFO |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_PAGE_REPLACEMENT_ALGORITHMS_SET_2_FIFO{
static int f_gold ( int pages [ ] , int n , int capacity ) {
HashSet < Integer > s = new HashSet < > ( capacity ) ;
Queue < Integer > indexes = new LinkedList < > ( ) ;
int page_faults = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( s . size ( ) < capacity ) {
if ( ! s . contains ( pages [ i ] ) ) {
s . add ( pages [ i ] ) ;
page_faults ++ ;
indexes . add ( pages [ i ] ) ;
}
}
else {
if ( ! s . contains ( pages [ i ] ) ) {
int val = indexes . peek ( ) ;
indexes . poll ( ) ;
s . remove ( val ) ;
s . add ( pages [ i ] ) ;
indexes . add ( pages [ i ] ) ;
page_faults ++ ;
}
}
}
return page_faults ;
}
| from queue import Queue
def f_gold ( pages , n , capacity ) :
s = set ( )
indexes = Queue ( )
page_faults = 0
for i in range ( n ) :
if ( len ( s ) < capacity ) :
if ( pages [ i ] not in s ) :
s.add ( pages [ i ] )
page_faults += 1
indexes.put ( pages [ i ] )
else :
if ( pages [ i ] not in s ) :
val = indexes.queue [ 0 ]
indexes.get ( )
s.remove ( val )
s.add ( pages [ i ] )
indexes.put ( pages [ i ] )
page_faults += 1
return page_faults
|
using namespace std;
int f_gold ( int pages [ ], int n, int capacity ) {
unordered_set < int > s;
queue < int > indexes;
int page_faults = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( s . size ( ) < capacity ) {
if ( s . find ( pages [ i ] ) == s . end ( ) ) {
s . insert ( pages [ i ] );
page_faults ++;
indexes . push ( pages [ i ] );
}
}
else {
if ( s . find ( pages [ i ] ) == s . end ( ) ) {
int val = indexes . front ( );
indexes . pop ( );
s . erase ( val );
s . insert ( pages [ i ] );
indexes . push ( pages [ i ] );
page_faults ++;
}
}
}
return page_faults;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,4,6,7,8,11,13,18,26,35,36,37,45,46,46,47,48,49,51,52,53,56,61,74,75,77,80,83,85,86,87,90,93,95,97,98,99,99});
param0.add(new int[]{78,-48,50,-20,-6,58,-8,66,72,68,4,80,58,-26,-82,-56,92,76,20,82,-46,86,38,60,-62,-48,76,8,-66,-4,-98,-96,-52,92});
param0.add(new int[]{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});
param0.add(new int[]{98,78,94,42,62,83,7,62,60,94,16,28,50,15,18,71,86,47,62,89});
param0.add(new int[]{-82,-70,-68,-56,-50,-44,4,18,28,30,30,42,66,78,80});
param0.add(new int[]{1,1,0,0,1,1,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,1,0,0});
param0.add(new int[]{4,5,13,15,18,28,32,40,46,46,55,57,61,63,65,68,77,79,79,96});
param0.add(new int[]{-2,82,2,-74,-6,-24,54,-74,-98,8,-94,-60,-42,-38,36,-38,-58,-70,-28,-34,70,-6,-2,-76,-40,-4,0,-4,76,48,-34,-26,-48,-58,-88,-44,20,-22,78});
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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{4,90,28,71,69,45,92,63,72,76,47,85,36,59,88,46,28,19,50,31,63,13});
List<Integer> param1 = new ArrayList<>();
param1.add(36);
param1.add(33);
param1.add(19);
param1.add(15);
param1.add(9);
param1.add(25);
param1.add(17);
param1.add(31);
param1.add(26);
param1.add(15);
List<Integer> param2 = new ArrayList<>();
param2.add(37);
param2.add(23);
param2.add(13);
param2.add(11);
param2.add(11);
param2.add(25);
param2.add(18);
param2.add(24);
param2.add(24);
param2.add(12);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([4, 4, 6, 7, 8, 11, 13, 18, 26, 35, 36, 37, 45, 46, 46, 47, 48, 49, 51, 52, 53, 56, 61, 74, 75, 77, 80, 83, 85, 86, 87, 90, 93, 95, 97, 98, 99, 99],36,37,),
([78, -48, 50, -20, -6, 58, -8, 66, 72, 68, 4, 80, 58, -26, -82, -56, 92, 76, 20, 82, -46, 86, 38, 60, -62, -48, 76, 8, -66, -4, -98, -96, -52, 92],33,23,),
([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],19,13,),
([98, 78, 94, 42, 62, 83, 7, 62, 60, 94, 16, 28, 50, 15, 18, 71, 86, 47, 62, 89],15,11,),
([-82, -70, -68, -56, -50, -44, 4, 18, 28, 30, 30, 42, 66, 78, 80],9,11,),
([1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0],25,25,),
([4, 5, 13, 15, 18, 28, 32, 40, 46, 46, 55, 57, 61, 63, 65, 68, 77, 79, 79, 96],17,18,),
([-2, 82, 2, -74, -6, -24, 54, -74, -98, 8, -94, -60, -42, -38, 36, -38, -58, -70, -28, -34, 70, -6, -2, -76, -40, -4, 0, -4, 76, 48, -34, -26, -48, -58, -88, -44, 20, -22, 78],31,24,),
([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],26,24,),
([4, 90, 28, 71, 69, 45, 92, 63, 72, 76, 47, 85, 36, 59, 88, 46, 28, 19, 50, 31, 63, 13],15,12,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{4,4,6,7,8,11,13,18,26,35,36,37,45,46,46,47,48,49,51,52,53,56,61,74,75,77,80,83,85,86,87,90,93,95,97,98,99,99},{78,-48,50,-20,-6,58,-8,66,72,68,4,80,58,-26,-82,-56,92,76,20,82,-46,86,38,60,-62,-48,76,8,-66,-4,-98,-96,-52,92},{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},{98,78,94,42,62,83,7,62,60,94,16,28,50,15,18,71,86,47,62,89},{-82,-70,-68,-56,-50,-44,4,18,28,30,30,42,66,78,80},{1,1,0,0,1,1,0,0,1,1,1,1,1,0,0,1,1,1,1,1,1,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,1,0,0},{4,5,13,15,18,28,32,40,46,46,55,57,61,63,65,68,77,79,79,96},{-2,82,2,-74,-6,-24,54,-74,-98,8,-94,-60,-42,-38,36,-38,-58,-70,-28,-34,70,-6,-2,-76,-40,-4,0,-4,76,48,-34,-26,-48,-58,-88,-44,20,-22,78},{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},{4,90,28,71,69,45,92,63,72,76,47,85,36,59,88,46,28,19,50,31,63,13}};
vector<int> param1 {36,33,19,15,9,25,17,31,26,15};
vector<int> param2 {37,23,13,11,11,25,18,24,24,12};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],param2[i]) == f_gold(¶m0[i].front(),param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MAXIMUM_TRIPLET_SUM_ARRAY_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_TRIPLET_SUM_ARRAY_2{
static int f_gold ( int arr [ ] , int n ) {
int maxA = - 100000000 , maxB = - 100000000 ;
int maxC = - 100000000 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( arr [ i ] > maxA ) {
maxC = maxB ;
maxB = maxA ;
maxA = arr [ i ] ;
}
else if ( arr [ i ] > maxB ) {
maxC = maxB ;
maxB = arr [ i ] ;
}
else if ( arr [ i ] > maxC ) maxC = arr [ i ] ;
}
return ( maxA + maxB + maxC ) ;
}
| def f_gold ( arr , n ) :
maxA = - 100000000
maxB = - 100000000
maxC = - 100000000
for i in range ( 0 , n ) :
if ( arr [ i ] > maxA ) :
maxC = maxB
maxB = maxA
maxA = arr [ i ]
elif ( arr [ i ] > maxB ) :
maxC = maxB
maxB = arr [ i ]
elif ( arr [ i ] > maxC ) :
maxC = arr [ i ]
return ( maxA + maxB + maxC )
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int maxA = INT_MIN, maxB = INT_MIN, maxC = INT_MIN;
for ( int i = 0;
i < n;
i ++ ) {
if ( arr [ i ] > maxA ) {
maxC = maxB;
maxB = maxA;
maxA = arr [ i ];
}
else if ( arr [ i ] > maxB ) {
maxC = maxB;
maxB = arr [ i ];
}
else if ( arr [ i ] > maxC ) maxC = arr [ i ];
}
return ( maxA + maxB + maxC );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,7,12,21,22,25,27,28,28,31,32,32,41,45,47,51,53,60,61,61,63,71,74,82,83,85,88,92,96,96});
param0.add(new int[]{-52,26,74,-62,-76});
param0.add(new int[]{0,0,0,0,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{63,71,15,28,31,84,8,17,24,42,66,95,30});
param0.add(new int[]{-94,-92,-92,-90,-88,-88,-86,-82,-80,-78,-66,-54,-52,-52,-46,-46,-42,-36,-32,-24,-24,-14,-14,-14,-12,-10,0,6,8,20,24,24,28,38,38,52,54,56,64,74,74,76,82,94,94});
param0.add(new int[]{0,0,0,1,1,0,1,0,1,1,0,1,0,1,0,0,0,1,0,1,1,1,0,1,0,0,0,0,1,1,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0});
param0.add(new int[]{15,19,80});
param0.add(new int[]{4,80,18,74,36,-30,-72,-28,-32,-16,-8,38,78,-48,98,-64,86,-60,-44,84,-98,40,14,30,44,90,-30,-42,24,-28,24,40,-96,98,90,-68,-54,-52,62,34,-98,68,-56,-94,-78,-12,28});
param0.add(new int[]{0,1,1,1,1,1});
param0.add(new int[]{2,18,96,7,99,83,3,88,23,77,6,28,55,49,69,55,48,76,43,11,43,44,17,74,27,64,76,77,53,26,73,12,19,62,18,34,13,31,97,96,85,27,30,97,89,25});
List<Integer> param1 = new ArrayList<>();
param1.add(28);
param1.add(2);
param1.add(11);
param1.add(6);
param1.add(31);
param1.add(30);
param1.add(2);
param1.add(41);
param1.add(3);
param1.add(41);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([4, 7, 12, 21, 22, 25, 27, 28, 28, 31, 32, 32, 41, 45, 47, 51, 53, 60, 61, 61, 63, 71, 74, 82, 83, 85, 88, 92, 96, 96],28,),
([-52, 26, 74, -62, -76],2,),
([0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],11,),
([63, 71, 15, 28, 31, 84, 8, 17, 24, 42, 66, 95, 30],6,),
([-94, -92, -92, -90, -88, -88, -86, -82, -80, -78, -66, -54, -52, -52, -46, -46, -42, -36, -32, -24, -24, -14, -14, -14, -12, -10, 0, 6, 8, 20, 24, 24, 28, 38, 38, 52, 54, 56, 64, 74, 74, 76, 82, 94, 94],31,),
([0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0],30,),
([15, 19, 80],2,),
([4, 80, 18, 74, 36, -30, -72, -28, -32, -16, -8, 38, 78, -48, 98, -64, 86, -60, -44, 84, -98, 40, 14, 30, 44, 90, -30, -42, 24, -28, 24, 40, -96, 98, 90, -68, -54, -52, 62, 34, -98, 68, -56, -94, -78, -12, 28],41,),
([0, 1, 1, 1, 1, 1],3,),
([2, 18, 96, 7, 99, 83, 3, 88, 23, 77, 6, 28, 55, 49, 69, 55, 48, 76, 43, 11, 43, 44, 17, 74, 27, 64, 76, 77, 53, 26, 73, 12, 19, 62, 18, 34, 13, 31, 97, 96, 85, 27, 30, 97, 89, 25],41,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{4,7,12,21,22,25,27,28,28,31,32,32,41,45,47,51,53,60,61,61,63,71,74,82,83,85,88,92,96,96},{-52,26,74,-62,-76},{0,0,0,0,1,1,1,1,1,1,1,1,1,1,1},{63,71,15,28,31,84,8,17,24,42,66,95,30},{-94,-92,-92,-90,-88,-88,-86,-82,-80,-78,-66,-54,-52,-52,-46,-46,-42,-36,-32,-24,-24,-14,-14,-14,-12,-10,0,6,8,20,24,24,28,38,38,52,54,56,64,74,74,76,82,94,94},{0,0,0,1,1,0,1,0,1,1,0,1,0,1,0,0,0,1,0,1,1,1,0,1,0,0,0,0,1,1,0,0,0,0,1,0,1,1,0,1,0,0,0,1,0},{15,19,80},{4,80,18,74,36,-30,-72,-28,-32,-16,-8,38,78,-48,98,-64,86,-60,-44,84,-98,40,14,30,44,90,-30,-42,24,-28,24,40,-96,98,90,-68,-54,-52,62,34,-98,68,-56,-94,-78,-12,28},{0,1,1,1,1,1},{2,18,96,7,99,83,3,88,23,77,6,28,55,49,69,55,48,76,43,11,43,44,17,74,27,64,76,77,53,26,73,12,19,62,18,34,13,31,97,96,85,27,30,97,89,25}};
vector<int> param1 {28,2,11,6,31,30,2,41,3,41};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
PROGRAM_CALCULATE_AREA_OCTAGON |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_CALCULATE_AREA_OCTAGON{
static double f_gold ( double side ) {
return ( float ) ( 2 * ( 1 + Math . sqrt ( 2 ) ) * side * side ) ;
}
| import math
def f_gold ( side ) :
return ( 2 * ( 1 + ( math.sqrt ( 2 ) ) ) * side * side )
|
using namespace std;
double f_gold ( double side ) {
return ( float ) ( 2 * ( 1 + sqrt ( 2 ) ) * side * side );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Double> param0 = new ArrayList<>();
param0.add(5859.798616323926);
param0.add(-6381.210375893524);
param0.add(2442.246292006922);
param0.add(-9624.81536339737);
param0.add(8679.436805247444);
param0.add(-2682.3245401089525);
param0.add(7216.9161613024435);
param0.add(-5881.789859815442);
param0.add(2497.776395789202);
param0.add(-9598.912195459263);
for(int i = 0; i < param0.size(); ++i)
{
if(Math.abs(1 - (0.0000001 + Math.abs(f_gold(param0.get(i))) )/ (Math.abs(f_filled(param0.get(i))) + 0.0000001)) < 0.001)
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(5859.798616323926,),
(-6381.210375893524,),
(2442.246292006922,),
(-9624.81536339737,),
(8679.436805247444,),
(-2682.3245401089525,),
(7216.9161613024435,),
(-5881.789859815442,),
(2497.776395789202,),
(-9598.912195459263,)
]
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)) + 0.0000001)) < 0.001:
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<double> param0 {5859.798616323926,-6381.210375893524,2442.246292006922,-9624.81536339737,8679.436805247444,-2682.3245401089525,7216.9161613024435,-5881.789859815442,2497.776395789202,-9598.912195459263};
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 << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
PROGRAM_CALCULATE_VOLUME_OCTAHEDRON |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_CALCULATE_VOLUME_OCTAHEDRON{
static double f_gold ( double side ) {
return ( ( side * side * side ) * ( Math . sqrt ( 2 ) / 3 ) ) ;
}
| import math
def f_gold ( side ) :
return ( ( side * side * side ) * ( math.sqrt ( 2 ) / 3 ) )
|
using namespace std;
double f_gold ( double side ) {
return ( ( side * side * side ) * ( sqrt ( 2 ) / 3 ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Double> param0 = new ArrayList<>();
param0.add(3355.322051344013);
param0.add(-891.0551553192736);
param0.add(8242.699647177868);
param0.add(-9259.146104439229);
param0.add(7712.806145993083);
param0.add(-4998.858862079315);
param0.add(9771.127582524628);
param0.add(-5415.8106399098115);
param0.add(670.0774772280249);
param0.add(-7068.634369272122);
for(int i = 0; i < param0.size(); ++i)
{
if(Math.abs(1 - (0.0000001 + Math.abs(f_gold(param0.get(i))) )/ (Math.abs(f_filled(param0.get(i))) + 0.0000001)) < 0.001)
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(3355.322051344013,),
(-891.0551553192736,),
(8242.699647177868,),
(-9259.146104439229,),
(7712.806145993083,),
(-4998.858862079315,),
(9771.127582524628,),
(-5415.8106399098115,),
(670.0774772280249,),
(-7068.634369272122,)
]
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)) + 0.0000001)) < 0.001:
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<double> param0 {3355.322051344013,-891.0551553192736,8242.699647177868,-9259.146104439229,7712.806145993083,-4998.858862079315,9771.127582524628,-5415.8106399098115,670.0774772280249,-7068.634369272122};
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 << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
SEARCH_INSERT_AND_DELETE_IN_A_SORTED_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SEARCH_INSERT_AND_DELETE_IN_A_SORTED_ARRAY{
static int f_gold ( int arr [ ] , int low , int high , int key ) {
if ( high < low ) return - 1 ;
int mid = ( low + high ) / 2 ;
if ( key == arr [ mid ] ) return mid ;
if ( key > arr [ mid ] ) return f_gold ( arr , ( mid + 1 ) , high , key ) ;
return f_gold ( arr , low , ( mid - 1 ) , key ) ;
}
| def f_gold ( arr , low , high , key ) :
if ( high < low ) :
return - 1
mid = ( low + high ) / 2
if ( key == arr [ int ( mid ) ] ) :
return mid
if ( key > arr [ int ( mid ) ] ) :
return f_gold ( arr , ( mid + 1 ) , high , key )
return ( f_gold ( arr , low , ( mid - 1 ) , key ) )
|
using namespace std;
int f_gold ( int arr [ ], int low, int high, int key ) {
if ( high < low ) return - 1;
int mid = ( low + high ) / 2;
if ( key == arr [ mid ] ) return mid;
if ( key > arr [ mid ] ) return f_gold ( arr, ( mid + 1 ), high, key );
return f_gold ( arr, low, ( mid - 1 ), key );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,10,73,91,98});
param0.add(new int[]{30,24,24,-8,64,50,46,-76,26,8,-92,-78,40,-86,96,14,60,38,6,-72,-6,-20,26,-26,0,2});
param0.add(new int[]{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});
param0.add(new int[]{30,79,3,76,18});
param0.add(new int[]{-96,-90,-88,-84,-78,-78,-70,-68,-66,-66,-64,-64,-58,-56,-52,-42,-40,-38,-36,-30,-30,-28,-14,-8,0,14,16,22,24,26,36,40,40,48,48,50,52,54,54,58,64,74,82,88,94});
param0.add(new int[]{1,1,0,0,0,1,1,1,0,0,1,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,1,0,1});
param0.add(new int[]{2,8,8,14,15,16,17,17,18,18,24,25,25,26,36,37,39,39,40,44,46,47,51,54,56,57,57,61,61,67,68,69,72,76,77,81,82,82,82,85,85,87,94,94,98,99});
param0.add(new int[]{-4,84,20,-84,-6,-78,20,56,40,0,98,80,-94,36,-6,-98,50,66,-12,-58,-34,68,-80,-30,-82,-76,-38,-60,92,94,48,-84,20,-66,-32,-92,16,-96,-68,94,-46,30,32,-34,96,-92,-96,-86,-22});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{71,70,13,18,70,62,88,27,17,44,89,28,74,41,20,91,95,79,40,43,38,20,5});
List<Integer> param1 = new ArrayList<>();
param1.add(2);
param1.add(20);
param1.add(30);
param1.add(3);
param1.add(35);
param1.add(25);
param1.add(33);
param1.add(34);
param1.add(19);
param1.add(21);
List<Integer> param2 = new ArrayList<>();
param2.add(4);
param2.add(13);
param2.add(27);
param2.add(2);
param2.add(30);
param2.add(26);
param2.add(40);
param2.add(27);
param2.add(13);
param2.add(22);
List<Integer> param3 = new ArrayList<>();
param3.add(4);
param3.add(21);
param3.add(29);
param3.add(2);
param3.add(40);
param3.add(30);
param3.add(26);
param3.add(34);
param3.add(19);
param3.add(22);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i),param3.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([2, 10, 73, 91, 98],2,4,4,),
([30, 24, 24, -8, 64, 50, 46, -76, 26, 8, -92, -78, 40, -86, 96, 14, 60, 38, 6, -72, -6, -20, 26, -26, 0, 2],20,13,21,),
([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],30,27,29,),
([30, 79, 3, 76, 18],3,2,2,),
([-96, -90, -88, -84, -78, -78, -70, -68, -66, -66, -64, -64, -58, -56, -52, -42, -40, -38, -36, -30, -30, -28, -14, -8, 0, 14, 16, 22, 24, 26, 36, 40, 40, 48, 48, 50, 52, 54, 54, 58, 64, 74, 82, 88, 94],35,30,40,),
([1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1],25,26,30,),
([2, 8, 8, 14, 15, 16, 17, 17, 18, 18, 24, 25, 25, 26, 36, 37, 39, 39, 40, 44, 46, 47, 51, 54, 56, 57, 57, 61, 61, 67, 68, 69, 72, 76, 77, 81, 82, 82, 82, 85, 85, 87, 94, 94, 98, 99],33,40,26,),
([-4, 84, 20, -84, -6, -78, 20, 56, 40, 0, 98, 80, -94, 36, -6, -98, 50, 66, -12, -58, -34, 68, -80, -30, -82, -76, -38, -60, 92, 94, 48, -84, 20, -66, -32, -92, 16, -96, -68, 94, -46, 30, 32, -34, 96, -92, -96, -86, -22],34,27,34,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],19,13,19,),
([71, 70, 13, 18, 70, 62, 88, 27, 17, 44, 89, 28, 74, 41, 20, 91, 95, 79, 40, 43, 38, 20, 5],21,22,22,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,10,73,91,98},{30,24,24,-8,64,50,46,-76,26,8,-92,-78,40,-86,96,14,60,38,6,-72,-6,-20,26,-26,0,2},{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},{30,79,3,76,18},{-96,-90,-88,-84,-78,-78,-70,-68,-66,-66,-64,-64,-58,-56,-52,-42,-40,-38,-36,-30,-30,-28,-14,-8,0,14,16,22,24,26,36,40,40,48,48,50,52,54,54,58,64,74,82,88,94},{1,1,0,0,0,1,1,1,0,0,1,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,1,0,1},{2,8,8,14,15,16,17,17,18,18,24,25,25,26,36,37,39,39,40,44,46,47,51,54,56,57,57,61,61,67,68,69,72,76,77,81,82,82,82,85,85,87,94,94,98,99},{-4,84,20,-84,-6,-78,20,56,40,0,98,80,-94,36,-6,-98,50,66,-12,-58,-34,68,-80,-30,-82,-76,-38,-60,92,94,48,-84,20,-66,-32,-92,16,-96,-68,94,-46,30,32,-34,96,-92,-96,-86,-22},{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{71,70,13,18,70,62,88,27,17,44,89,28,74,41,20,91,95,79,40,43,38,20,5}};
vector<int> param1 {2,20,30,3,35,25,33,34,19,21};
vector<int> param2 {4,13,27,2,30,26,40,27,13,22};
vector<int> param3 {4,21,29,2,40,30,26,34,19,22};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],param2[i],param3[i]) == f_gold(¶m0[i].front(),param1[i],param2[i],param3[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MAXIMUM_NUMBER_SEGMENTS_LENGTHS_B_C |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_NUMBER_SEGMENTS_LENGTHS_B_C{
static int f_gold ( int n , int a , int b , int c ) {
int dp [ ] = new int [ n + 10 ] ;
Arrays . fill ( dp , - 1 ) ;
dp [ 0 ] = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( dp [ i ] != - 1 ) {
if ( i + a <= n ) dp [ i + a ] = Math . max ( dp [ i ] + 1 , dp [ i + a ] ) ;
if ( i + b <= n ) dp [ i + b ] = Math . max ( dp [ i ] + 1 , dp [ i + b ] ) ;
if ( i + c <= n ) dp [ i + c ] = Math . max ( dp [ i ] + 1 , dp [ i + c ] ) ;
}
}
return dp [ n ] ;
}
| def f_gold ( n , a , b , c ) :
dp = [ - 1 ] * ( n + 10 )
dp [ 0 ] = 0
for i in range ( 0 , n ) :
if ( dp [ i ] != - 1 ) :
if ( i + a <= n ) :
dp [ i + a ] = max ( dp [ i ] + 1 , dp [ i + a ] )
if ( i + b <= n ) :
dp [ i + b ] = max ( dp [ i ] + 1 , dp [ i + b ] )
if ( i + c <= n ) :
dp [ i + c ] = max ( dp [ i ] + 1 , dp [ i + c ] )
return dp [ n ]
|
using namespace std;
int f_gold ( int n, int a, int b, int c ) {
int dp [ n + 1 ];
memset ( dp, - 1, sizeof ( dp ) );
dp [ 0 ] = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( dp [ i ] != - 1 ) {
if ( i + a <= n ) dp [ i + a ] = max ( dp [ i ] + 1, dp [ i + a ] );
if ( i + b <= n ) dp [ i + b ] = max ( dp [ i ] + 1, dp [ i + b ] );
if ( i + c <= n ) dp [ i + c ] = max ( dp [ i ] + 1, dp [ i + c ] );
}
}
return dp [ n ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(23);
param0.add(62);
param0.add(32);
param0.add(82);
param0.add(94);
param0.add(44);
param0.add(4);
param0.add(53);
param0.add(9);
param0.add(23);
List<Integer> param1 = new ArrayList<>();
param1.add(16);
param1.add(76);
param1.add(46);
param1.add(48);
param1.add(99);
param1.add(21);
param1.add(57);
param1.add(23);
param1.add(55);
param1.add(15);
List<Integer> param2 = new ArrayList<>();
param2.add(23);
param2.add(81);
param2.add(1);
param2.add(72);
param2.add(62);
param2.add(46);
param2.add(2);
param2.add(80);
param2.add(26);
param2.add(73);
List<Integer> param3 = new ArrayList<>();
param3.add(18);
param3.add(97);
param3.add(78);
param3.add(58);
param3.add(38);
param3.add(60);
param3.add(77);
param3.add(5);
param3.add(85);
param3.add(42);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i),param3.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(23,16,23,18,),
(62,76,81,97,),
(32,46,1,78,),
(82,48,72,58,),
(94,99,62,38,),
(44,21,46,60,),
(4,57,2,77,),
(53,23,80,5,),
(9,55,26,85,),
(23,15,73,42,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {23,62,32,82,94,44,4,53,9,23};
vector<int> param1 {16,76,46,48,99,21,57,23,55,15};
vector<int> param2 {23,81,1,72,62,46,2,80,26,73};
vector<int> param3 {18,97,78,58,38,60,77,5,85,42};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i],param3[i]) == f_gold(param0[i],param1[i],param2[i],param3[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
COUNT_NUMBER_OF_WAYS_TO_COVER_A_DISTANCE_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_NUMBER_OF_WAYS_TO_COVER_A_DISTANCE_1{
static int f_gold ( int dist ) {
int [ ] count = new int [ dist + 1 ] ;
count [ 0 ] = 1 ;
count [ 1 ] = 1 ;
count [ 2 ] = 2 ;
for ( int i = 3 ;
i <= dist ;
i ++ ) count [ i ] = count [ i - 1 ] + count [ i - 2 ] + count [ i - 3 ] ;
return count [ dist ] ;
}
| def f_gold ( dist ) :
count = [ 0 ] * ( dist + 1 )
count [ 0 ] = 1
count [ 1 ] = 1
count [ 2 ] = 2
for i in range ( 3 , dist + 1 ) :
count [ i ] = ( count [ i - 1 ] + count [ i - 2 ] + count [ i - 3 ] )
return count [ dist ] ;
|
using namespace std;
int f_gold ( int dist ) {
int count [ dist + 1 ];
count [ 0 ] = 1, count [ 1 ] = 1, count [ 2 ] = 2;
for ( int i = 3;
i <= dist;
i ++ ) count [ i ] = count [ i - 1 ] + count [ i - 2 ] + count [ i - 3 ];
return count [ dist ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(37);
param0.add(82);
param0.add(87);
param0.add(80);
param0.add(92);
param0.add(58);
param0.add(98);
param0.add(53);
param0.add(11);
param0.add(58);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(37,),
(82,),
(87,),
(80,),
(92,),
(58,),
(98,),
(53,),
(11,),
(58,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {37,82,87,80,92,58,98,53,11,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();
return 0;
} |
MIDDLE_OF_THREE_USING_MINIMUM_COMPARISONS_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MIDDLE_OF_THREE_USING_MINIMUM_COMPARISONS_1{
public static int f_gold ( int a , int b , int c ) {
if ( a > b ) {
if ( b > c ) return b ;
else if ( a > c ) return c ;
else return a ;
}
else {
if ( a > c ) return a ;
else if ( b > c ) return c ;
else return b ;
}
}
| def f_gold ( a , b , c ) :
if a > b :
if ( b > c ) :
return b
elif ( a > c ) :
return c
else :
return a
else :
if ( a > c ) :
return a
elif ( b > c ) :
return c
else :
return b
|
using namespace std;
int f_gold ( int a, int b, int c ) {
if ( a > b ) {
if ( b > c ) return b;
else if ( a > c ) return c;
else return a;
}
else {
if ( a > c ) return a;
else if ( b > c ) return c;
else return b;
}
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(43);
param0.add(76);
param0.add(57);
param0.add(10);
param0.add(59);
param0.add(92);
param0.add(49);
param0.add(16);
param0.add(33);
param0.add(66);
List<Integer> param1 = new ArrayList<>();
param1.add(24);
param1.add(54);
param1.add(5);
param1.add(13);
param1.add(47);
param1.add(14);
param1.add(62);
param1.add(95);
param1.add(41);
param1.add(63);
List<Integer> param2 = new ArrayList<>();
param2.add(7);
param2.add(66);
param2.add(40);
param2.add(4);
param2.add(56);
param2.add(50);
param2.add(65);
param2.add(12);
param2.add(90);
param2.add(46);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(43,24,7,),
(76,54,66,),
(57,5,40,),
(10,13,4,),
(59,47,56,),
(92,14,50,),
(49,62,65,),
(16,95,12,),
(33,41,90,),
(66,63,46,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {43,76,57,10,59,92,49,16,33,66};
vector<int> param1 {24,54,5,13,47,14,62,95,41,63};
vector<int> param2 {7,66,40,4,56,50,65,12,90,46};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i],param2[i]) == f_gold(param0[i],param1[i],param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MINIMUM_STEPS_TO_DELETE_A_STRING_AFTER_REPEATED_DELETION_OF_PALINDROME_SUBSTRINGS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_STEPS_TO_DELETE_A_STRING_AFTER_REPEATED_DELETION_OF_PALINDROME_SUBSTRINGS{
static int f_gold ( String str ) {
int N = str . length ( ) ;
int [ ] [ ] dp = new int [ N + 1 ] [ N + 1 ] ;
for ( int i = 0 ;
i <= N ;
i ++ ) for ( int j = 0 ;
j <= N ;
j ++ ) dp [ i ] [ j ] = 0 ;
for ( int len = 1 ;
len <= N ;
len ++ ) {
for ( int i = 0 , j = len - 1 ;
j < N ;
i ++ , j ++ ) {
if ( len == 1 ) dp [ i ] [ j ] = 1 ;
else {
dp [ i ] [ j ] = 1 + dp [ i + 1 ] [ j ] ;
if ( str . charAt ( i ) == str . charAt ( i + 1 ) ) dp [ i ] [ j ] = Math . min ( 1 + dp [ i + 2 ] [ j ] , dp [ i ] [ j ] ) ;
for ( int K = i + 2 ;
K <= j ;
K ++ ) if ( str . charAt ( i ) == str . charAt ( K ) ) dp [ i ] [ j ] = Math . min ( dp [ i + 1 ] [ K - 1 ] + dp [ K + 1 ] [ j ] , dp [ i ] [ j ] ) ;
}
}
}
return dp [ 0 ] [ N - 1 ] ;
}
| def f_gold(str):
N = len(str)
dp = [[0 for x in range(N + 1)] for y in range(N + 1)]
for l in range(1, N + 1):
i = 0
j = l - 1
while j < N:
if (l == 1):
dp[i][j] = 1
else:
dp[i][j] = 1 + dp[i + 1][j]
if (str[i] == str[i + 1]):
dp[i][j] = min(1 + dp[i + 2][j], dp[i][j])
for K in range(i + 2, j + 1):
if (str[i] == str[K]):
dp[i][j] = min(dp[i + 1][K - 1] +
dp[K + 1][j], dp[i][j])
i += 1
j += 1
return dp[0][N - 1]
|
using namespace std;
int f_gold ( string str ) {
int N = str . length ( );
int dp [ N + 1 ] [ N + 1 ];
for ( int i = 0;
i <= N;
i ++ ) for ( int j = 0;
j <= N;
j ++ ) dp [ i ] [ j ] = 0;
for ( int len = 1;
len <= N;
len ++ ) {
for ( int i = 0, j = len - 1;
j < N;
i ++, j ++ ) {
if ( len == 1 ) dp [ i ] [ j ] = 1;
else {
dp [ i ] [ j ] = 1 + dp [ i + 1 ] [ j ];
if ( str [ i ] == str [ i + 1 ] ) dp [ i ] [ j ] = min ( 1 + dp [ i + 2 ] [ j ], dp [ i ] [ j ] );
for ( int K = i + 2;
K <= j;
K ++ ) if ( str [ i ] == str [ K ] ) dp [ i ] [ j ] = min ( dp [ i + 1 ] [ K - 1 ] + dp [ K + 1 ] [ j ], dp [ i ] [ j ] );
}
}
}
return dp [ 0 ] [ N - 1 ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("YCtLQtHLwr");
param0.add("47713514383248");
param0.add("0100101001111");
param0.add("XfdIYVn");
param0.add("45499225407");
param0.add("000100111001");
param0.add("ZoUQhQwoap");
param0.add("18579027952");
param0.add("00000001111");
param0.add("JD");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('YCtLQtHLwr',),
('47713514383248',),
('0100101001111',),
('XfdIYVn',),
('45499225407',),
('000100111001',),
('ZoUQhQwoap',),
('18579027952',),
('00000001111',),
('JD',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success += 1
print("#Results: %i, %i" % (n_success, len(param)))
|
int main() {
int n_success = 0;
vector<string> param0 {"YCtLQtHLwr","47713514383248","0100101001111","XfdIYVn","45499225407","000100111001","ZoUQhQwoap","18579027952","00000001111","JD"};
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();
return 0;
} |
DYNAMIC_PROGRAMMING_HIGH_EFFORT_VS_LOW_EFFORT_TASKS_PROBLEM |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_HIGH_EFFORT_VS_LOW_EFFORT_TASKS_PROBLEM{
static int f_gold ( int high [ ] , int low [ ] , int n ) {
if ( n <= 0 ) return 0 ;
return Math . max ( high [ n - 1 ] + f_gold ( high , low , ( n - 2 ) ) , low [ n - 1 ] + f_gold ( high , low , ( n - 1 ) ) ) ;
}
| def f_gold ( high , low , n ) :
if ( n <= 0 ) :
return 0
return max ( high [ n - 1 ] + f_gold ( high , low , ( n - 2 ) ) , low [ n - 1 ] + f_gold ( high , low , ( n - 1 ) ) ) ;
|
using namespace std;
int f_gold ( int high [ ], int low [ ], int n ) {
if ( n <= 0 ) return 0;
return max ( high [ n - 1 ] + f_gold ( high, low, ( n - 2 ) ), low [ n - 1 ] + f_gold ( high, low, ( n - 1 ) ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,3,9,10,13,14,15,15,17,22,23,28,30,31,37,42,45,62,62,68,68,68,78,79,82,84,87,90,99});
param0.add(new int[]{-78,-12,26,80,50,4,-80,86,12,-2,18,-50,-90,56,-50,88,-62,96,-44,-82,56});
param0.add(new int[]{1});
param0.add(new int[]{21,28,13,48,26,49,16,70,81,35,74,12,97,61,10,84,94,78,40,30,30,84,41,4,95,79,38,29,9});
param0.add(new int[]{-80,-36,-32,-20,-14,-12,10,12,72});
param0.add(new int[]{1,1,0,1,0,0,0,0,0,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1});
param0.add(new int[]{1,7,9,10,13,14,15,20,23,24,24,24,26,27,29,31,32,33,34,35,46,48,49,51,51,53,53,56,56,60,62,64,64,70,73,73,73,74,77,78,79,79,79,80,86,89,89,92,98});
param0.add(new int[]{56,48,40,-56,44,-86,-28,-32,-34,4,-94,-14,28,-74});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1});
param0.add(new int[]{85,13,35,57,8,48,65,54,88,7,66,30,47,51});
List<int [ ]> param1 = new ArrayList<>();
param1.add(new int[]{5,10,11,14,16,22,24,30,34,35,37,37,39,41,42,42,43,55,57,63,71,76,83,83,85,90,91,97,99});
param1.add(new int[]{-44,-14,14,0,30,78,40,-12,-44,-16,60,-12,-50,-66,70,-98,-56,48,-82,94,14});
param1.add(new int[]{1});
param1.add(new int[]{49,88,25,93,24,56,47,44,33,27,86,57,21,25,64,44,37,99,36,54,17,29,37,17,26,43,61,27,21});
param1.add(new int[]{-76,-54,-50,-28,0,58,70,78,90});
param1.add(new int[]{0,0,1,1,1,0,0,1,1,0,1,1,1,1,0,1,1,1,0,1,1,0,0,0,1});
param1.add(new int[]{1,3,3,4,8,8,10,10,10,12,12,15,15,22,23,28,28,30,31,33,34,35,36,36,36,42,44,44,51,54,57,58,59,59,63,65,66,68,69,71,73,76,77,78,79,79,86,87,93});
param1.add(new int[]{82,-40,-16,-64,12,-6,60,48,-58,-4,42,-28,24,-58});
param1.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1});
param1.add(new int[]{1,42,42,89,3,21,49,98,4,59,26,85,53,34});
List<Integer> param2 = new ArrayList<>();
param2.add(18);
param2.add(16);
param2.add(0);
param2.add(25);
param2.add(4);
param2.add(24);
param2.add(31);
param2.add(8);
param2.add(16);
param2.add(8);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i),param2.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([1, 3, 9, 10, 13, 14, 15, 15, 17, 22, 23, 28, 30, 31, 37, 42, 45, 62, 62, 68, 68, 68, 78, 79, 82, 84, 87, 90, 99],[5, 10, 11, 14, 16, 22, 24, 30, 34, 35, 37, 37, 39, 41, 42, 42, 43, 55, 57, 63, 71, 76, 83, 83, 85, 90, 91, 97, 99],18,),
([-78, -12, 26, 80, 50, 4, -80, 86, 12, -2, 18, -50, -90, 56, -50, 88, -62, 96, -44, -82, 56],[-44, -14, 14, 0, 30, 78, 40, -12, -44, -16, 60, -12, -50, -66, 70, -98, -56, 48, -82, 94, 14],16,),
([1],[1],0,),
([21, 28, 13, 48, 26, 49, 16, 70, 81, 35, 74, 12, 97, 61, 10, 84, 94, 78, 40, 30, 30, 84, 41, 4, 95, 79, 38, 29, 9],[49, 88, 25, 93, 24, 56, 47, 44, 33, 27, 86, 57, 21, 25, 64, 44, 37, 99, 36, 54, 17, 29, 37, 17, 26, 43, 61, 27, 21],25,),
([-80, -36, -32, -20, -14, -12, 10, 12, 72],[-76, -54, -50, -28, 0, 58, 70, 78, 90],4,),
([1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1],[0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1],24,),
([1, 7, 9, 10, 13, 14, 15, 20, 23, 24, 24, 24, 26, 27, 29, 31, 32, 33, 34, 35, 46, 48, 49, 51, 51, 53, 53, 56, 56, 60, 62, 64, 64, 70, 73, 73, 73, 74, 77, 78, 79, 79, 79, 80, 86, 89, 89, 92, 98],[1, 3, 3, 4, 8, 8, 10, 10, 10, 12, 12, 15, 15, 22, 23, 28, 28, 30, 31, 33, 34, 35, 36, 36, 36, 42, 44, 44, 51, 54, 57, 58, 59, 59, 63, 65, 66, 68, 69, 71, 73, 76, 77, 78, 79, 79, 86, 87, 93],31,),
([56, 48, 40, -56, 44, -86, -28, -32, -34, 4, -94, -14, 28, -74],[82, -40, -16, -64, 12, -6, 60, 48, -58, -4, 42, -28, 24, -58],8,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],16,),
([85, 13, 35, 57, 8, 48, 65, 54, 88, 7, 66, 30, 47, 51],[1, 42, 42, 89, 3, 21, 49, 98, 4, 59, 26, 85, 53, 34],8,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,3,9,10,13,14,15,15,17,22,23,28,30,31,37,42,45,62,62,68,68,68,78,79,82,84,87,90,99},{-78,-12,26,80,50,4,-80,86,12,-2,18,-50,-90,56,-50,88,-62,96,-44,-82,56},{1},{21,28,13,48,26,49,16,70,81,35,74,12,97,61,10,84,94,78,40,30,30,84,41,4,95,79,38,29,9},{-80,-36,-32,-20,-14,-12,10,12,72},{1,1,0,1,0,0,0,0,0,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0,1},{1,7,9,10,13,14,15,20,23,24,24,24,26,27,29,31,32,33,34,35,46,48,49,51,51,53,53,56,56,60,62,64,64,70,73,73,73,74,77,78,79,79,79,80,86,89,89,92,98},{56,48,40,-56,44,-86,-28,-32,-34,4,-94,-14,28,-74},{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1},{85,13,35,57,8,48,65,54,88,7,66,30,47,51}};
vector<vector<int>> param1 {{5,10,11,14,16,22,24,30,34,35,37,37,39,41,42,42,43,55,57,63,71,76,83,83,85,90,91,97,99},{-44,-14,14,0,30,78,40,-12,-44,-16,60,-12,-50,-66,70,-98,-56,48,-82,94,14},{1},{49,88,25,93,24,56,47,44,33,27,86,57,21,25,64,44,37,99,36,54,17,29,37,17,26,43,61,27,21},{-76,-54,-50,-28,0,58,70,78,90},{0,0,1,1,1,0,0,1,1,0,1,1,1,1,0,1,1,1,0,1,1,0,0,0,1},{1,3,3,4,8,8,10,10,10,12,12,15,15,22,23,28,28,30,31,33,34,35,36,36,36,42,44,44,51,54,57,58,59,59,63,65,66,68,69,71,73,76,77,78,79,79,86,87,93},{82,-40,-16,-64,12,-6,60,48,-58,-4,42,-28,24,-58},{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1},{1,42,42,89,3,21,49,98,4,59,26,85,53,34}};
vector<int> param2 {18,16,0,25,4,24,31,8,16,8};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),¶m1[i].front(),param2[i]) == f_gold(¶m0[i].front(),¶m1[i].front(),param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
FIND_SUM_MODULO_K_FIRST_N_NATURAL_NUMBER_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_SUM_MODULO_K_FIRST_N_NATURAL_NUMBER_1{
static int f_gold ( int N , int K ) {
int ans = 0 ;
int y = N / K ;
int x = N % K ;
ans = ( K * ( K - 1 ) / 2 ) * y + ( x * ( x + 1 ) ) / 2 ;
return ans ;
}
| def f_gold ( N , K ) :
ans = 0 ;
y = N / K ;
x = N % K ;
ans = ( ( K * ( K - 1 ) / 2 ) * y + ( x * ( x + 1 ) ) / 2 ) ;
return int ( ans ) ;
|
using namespace std;
int f_gold ( int N, int K ) {
int ans = 0;
int y = N / K;
int x = N % K;
ans = ( K * ( K - 1 ) / 2 ) * y + ( x * ( x + 1 ) ) / 2;
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(40);
param0.add(46);
param0.add(97);
param0.add(63);
param0.add(92);
param0.add(60);
param0.add(67);
param0.add(61);
param0.add(74);
param0.add(67);
List<Integer> param1 = new ArrayList<>();
param1.add(90);
param1.add(64);
param1.add(20);
param1.add(1);
param1.add(52);
param1.add(35);
param1.add(40);
param1.add(62);
param1.add(61);
param1.add(41);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(40,90,),
(46,64,),
(97,20,),
(63,1,),
(92,52,),
(60,35,),
(67,40,),
(61,62,),
(74,61,),
(67,41,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {40,46,97,63,92,60,67,61,74,67};
vector<int> param1 {90,64,20,1,52,35,40,62,61,41};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i],param1[i]) == f_gold(param0[i],param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MINIMUM_PERIMETER_N_BLOCKS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_PERIMETER_N_BLOCKS{
public static long f_gold ( int n ) {
int l = ( int ) Math . sqrt ( n ) ;
int sq = l * l ;
if ( sq == n ) return l * 4 ;
else {
long row = n / l ;
long perimeter = 2 * ( l + row ) ;
if ( n % l != 0 ) perimeter += 2 ;
return perimeter ;
}
}
| import math
def f_gold ( n ) :
l = math.sqrt ( n )
sq = l * l
if ( sq == n ) :
return l * 4
else :
row = n / l
perimeter = 2 * ( l + row )
if ( n % l != 0 ) :
perimeter += 2
return perimeter
|
using namespace std;
int f_gold ( int n ) {
int l = sqrt ( n );
int sq = l * l;
if ( sq == n ) return l * 4;
else {
long long int row = n / l;
long long int perimeter = 2 * ( l + row );
if ( n % l != 0 ) perimeter += 2;
return perimeter;
}
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(45);
param0.add(80);
param0.add(54);
param0.add(48);
param0.add(83);
param0.add(68);
param0.add(32);
param0.add(20);
param0.add(68);
param0.add(66);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(45,),
(80,),
(54,),
(48,),
(83,),
(68,),
(32,),
(20,),
(68,),
(66,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {45,80,54,48,83,68,32,20,68,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();
return 0;
} |
TURN_OFF_THE_RIGHTMOST_SET_BIT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class TURN_OFF_THE_RIGHTMOST_SET_BIT{
static int f_gold ( int n ) {
return n & ( n - 1 ) ;
}
| def f_gold ( n ) :
return n & ( n - 1 )
|
using namespace std;
int f_gold ( unsigned int n ) {
return n & ( n - 1 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(9);
param0.add(54);
param0.add(60);
param0.add(32);
param0.add(41);
param0.add(64);
param0.add(4);
param0.add(51);
param0.add(57);
param0.add(92);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(9,),
(54,),
(60,),
(32,),
(41,),
(64,),
(4,),
(51,),
(57,),
(92,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<int> param0 {9,54,60,32,41,64,4,51,57,92};
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();
return 0;
} |
FIND_REPEATED_CHARACTER_PRESENT_FIRST_STRING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_REPEATED_CHARACTER_PRESENT_FIRST_STRING{
static int f_gold ( String s ) {
int p = - 1 , i , j ;
for ( i = 0 ;
i < s . length ( ) ;
i ++ ) {
for ( j = i + 1 ;
j < s . length ( ) ;
j ++ ) {
if ( s . charAt ( i ) == s . charAt ( j ) ) {
p = i ;
break ;
}
}
if ( p != - 1 ) break ;
}
return p ;
}
| def f_gold ( s ) :
p = - 1
for i in range ( len ( s ) ) :
for j in range ( i + 1 , len ( s ) ) :
if ( s [ i ] == s [ j ] ) :
p = i
break
if ( p != - 1 ) :
break
return p
| null |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("ORXMflacQFBv");
param0.add("39977638567848");
param0.add("011110011011");
param0.add("fYjfNy");
param0.add("222280492");
param0.add("11");
param0.add("UjntBg");
param0.add("6866190138212");
param0.add("0000");
param0.add("FWz PWEQgVlRZ");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)) == f_gold(param0.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('ORXMflacQFBv',),
('39977638567848',),
('011110011011',),
('fYjfNy',),
('222280492',),
('11',),
('UjntBg',),
('6866190138212',),
('0000',),
('FWz PWEQgVlRZ',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) | null |
FIND_REPETITIVE_ELEMENT_1_N_1_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_REPETITIVE_ELEMENT_1_N_1_1{
static int f_gold ( int arr [ ] , int n ) {
HashSet < Integer > s = new HashSet < Integer > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( s . contains ( arr [ i ] ) ) return arr [ i ] ;
s . add ( arr [ i ] ) ;
}
return - 1 ;
}
| null |
using namespace std;
int f_gold ( int arr [ ], int n ) {
unordered_set < int > s;
for ( int i = 0;
i < n;
i ++ ) {
if ( s . find ( arr [ i ] ) != s . end ( ) ) return arr [ i ];
s . insert ( arr [ i ] );
}
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{9,10,14,17,30,37,39,42,49,56,68,74,85,85,92});
param0.add(new int[]{62,-18,78,-32,38,90});
param0.add(new int[]{0,0,0,0,1,1,1,1,1,1});
param0.add(new int[]{56,1,96,81,49,18,39,87,97});
param0.add(new int[]{-98,-94,-80,-76,-60,-56,-56,-54,-48,-28,-14,-10,26,30,40,58,64,74,78,82,86,92,96,98});
param0.add(new int[]{1,1,1,0,1,1,0,1,0,1,0,0,1,0,0,0,0,1,0,1,1,1,0});
param0.add(new int[]{5,7,19,20,22,29,33,35,35,36,37,40,44,49,50,53,60,60,61,62,68,68,69,72,72,81,81,83,85,85,90,91,92,97,98});
param0.add(new int[]{14});
param0.add(new int[]{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});
param0.add(new int[]{29,29,14,91,42,70,79,75,9,86,48,47,37,48,69,81,49,37,33,23,42,45,10,33,47,39,96,45,94,48,44,4,6,73,91});
List<Integer> param1 = new ArrayList<>();
param1.add(10);
param1.add(4);
param1.add(7);
param1.add(5);
param1.add(16);
param1.add(11);
param1.add(26);
param1.add(0);
param1.add(18);
param1.add(33);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{9,10,14,17,30,37,39,42,49,56,68,74,85,85,92},{62,-18,78,-32,38,90},{0,0,0,0,1,1,1,1,1,1},{56,1,96,81,49,18,39,87,97},{-98,-94,-80,-76,-60,-56,-56,-54,-48,-28,-14,-10,26,30,40,58,64,74,78,82,86,92,96,98},{1,1,1,0,1,1,0,1,0,1,0,0,1,0,0,0,0,1,0,1,1,1,0},{5,7,19,20,22,29,33,35,35,36,37,40,44,49,50,53,60,60,61,62,68,68,69,72,72,81,81,83,85,85,90,91,92,97,98},{14},{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},{29,29,14,91,42,70,79,75,9,86,48,47,37,48,69,81,49,37,33,23,42,45,10,33,47,39,96,45,94,48,44,4,6,73,91}};
vector<int> param1 {10,4,7,5,16,11,26,0,18,33};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
FIND_THE_MAXIMUM_SUBARRAY_XOR_IN_A_GIVEN_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THE_MAXIMUM_SUBARRAY_XOR_IN_A_GIVEN_ARRAY{
static int f_gold ( int arr [ ] , int n ) {
int ans = Integer . MIN_VALUE ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int curr_xor = 0 ;
for ( int j = i ;
j < n ;
j ++ ) {
curr_xor = curr_xor ^ arr [ j ] ;
ans = Math . max ( ans , curr_xor ) ;
}
}
return ans ;
}
| def f_gold ( arr , n ) :
ans = - 2147483648
for i in range ( n ) :
curr_xor = 0
for j in range ( i , n ) :
curr_xor = curr_xor ^ arr [ j ]
ans = max ( ans , curr_xor )
return ans
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int ans = INT_MIN;
for ( int i = 0;
i < n;
i ++ ) {
int curr_xor = 0;
for ( int j = i;
j < n;
j ++ ) {
curr_xor = curr_xor ^ arr [ j ];
ans = max ( ans, curr_xor );
}
}
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,7,7,11,12,18,20,23,27,30,44,47,53,53,55,57,57,58,61,62,67,74,76,80,86,86});
param0.add(new int[]{-34,-4,68,-82,54,20,6,-18,-70,98,-40,80,-28,78,28,56,26,2,2,-56,-66,44,0,-72,12,54,-40,18,28,-48,-56,72,84,60,76,26,-8,62});
param0.add(new int[]{0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{33,98});
param0.add(new int[]{-92,-80,-76,-76,-74,-58,-44,-38,-34,-32,-30,-24,-20,-18,-4,-2,2,8,44,52,52,56,70,72,80,80,98});
param0.add(new int[]{0,0,0,1,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,1,0,1,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0});
param0.add(new int[]{1,2,3,6,9,15,15,18,19,25,31,31,33,37,39,47,49,51,51,52,52,54,58,59,59,61,62,62,65,66,66,66,66,67,71,76,77,78,79,80,83,86,87,92,97,97,98,99});
param0.add(new int[]{34,-90,64,88,-46,-4,-96,76,-32,10,-8,-24,32,-4,86,-20,-86,-88,-72,64,12,66,-96,-84,16,-58,-48,80,-80,70,-94,-84,56,8,-14,86,72,-16,-18,74,40,34,20,80});
param0.add(new int[]{1,1});
param0.add(new int[]{57,76,2,30,24,12,49,12,5,75,55,17,62,87,21,91,88,10,20,49,46,79,51,33,94,59,48,97,70,49});
List<Integer> param1 = new ArrayList<>();
param1.add(13);
param1.add(21);
param1.add(12);
param1.add(1);
param1.add(15);
param1.add(33);
param1.add(38);
param1.add(35);
param1.add(1);
param1.add(25);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([1, 7, 7, 11, 12, 18, 20, 23, 27, 30, 44, 47, 53, 53, 55, 57, 57, 58, 61, 62, 67, 74, 76, 80, 86, 86],13,),
([-34, -4, 68, -82, 54, 20, 6, -18, -70, 98, -40, 80, -28, 78, 28, 56, 26, 2, 2, -56, -66, 44, 0, -72, 12, 54, -40, 18, 28, -48, -56, 72, 84, 60, 76, 26, -8, 62],21,),
([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],12,),
([33, 98],1,),
([-92, -80, -76, -76, -74, -58, -44, -38, -34, -32, -30, -24, -20, -18, -4, -2, 2, 8, 44, 52, 52, 56, 70, 72, 80, 80, 98],15,),
([0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0],33,),
([1, 2, 3, 6, 9, 15, 15, 18, 19, 25, 31, 31, 33, 37, 39, 47, 49, 51, 51, 52, 52, 54, 58, 59, 59, 61, 62, 62, 65, 66, 66, 66, 66, 67, 71, 76, 77, 78, 79, 80, 83, 86, 87, 92, 97, 97, 98, 99],38,),
([34, -90, 64, 88, -46, -4, -96, 76, -32, 10, -8, -24, 32, -4, 86, -20, -86, -88, -72, 64, 12, 66, -96, -84, 16, -58, -48, 80, -80, 70, -94, -84, 56, 8, -14, 86, 72, -16, -18, 74, 40, 34, 20, 80],35,),
([1, 1],1,),
([57, 76, 2, 30, 24, 12, 49, 12, 5, 75, 55, 17, 62, 87, 21, 91, 88, 10, 20, 49, 46, 79, 51, 33, 94, 59, 48, 97, 70, 49],25,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,7,7,11,12,18,20,23,27,30,44,47,53,53,55,57,57,58,61,62,67,74,76,80,86,86},{-34,-4,68,-82,54,20,6,-18,-70,98,-40,80,-28,78,28,56,26,2,2,-56,-66,44,0,-72,12,54,-40,18,28,-48,-56,72,84,60,76,26,-8,62},{0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1},{33,98},{-92,-80,-76,-76,-74,-58,-44,-38,-34,-32,-30,-24,-20,-18,-4,-2,2,8,44,52,52,56,70,72,80,80,98},{0,0,0,1,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,1,0,1,0,1,0,1,0,0,0,0,1,1,0,1,1,0,0},{1,2,3,6,9,15,15,18,19,25,31,31,33,37,39,47,49,51,51,52,52,54,58,59,59,61,62,62,65,66,66,66,66,67,71,76,77,78,79,80,83,86,87,92,97,97,98,99},{34,-90,64,88,-46,-4,-96,76,-32,10,-8,-24,32,-4,86,-20,-86,-88,-72,64,12,66,-96,-84,16,-58,-48,80,-80,70,-94,-84,56,8,-14,86,72,-16,-18,74,40,34,20,80},{1,1},{57,76,2,30,24,12,49,12,5,75,55,17,62,87,21,91,88,10,20,49,46,79,51,33,94,59,48,97,70,49}};
vector<int> param1 {13,21,12,1,15,33,38,35,1,25};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
STRING_CONTAINING_FIRST_LETTER_EVERY_WORD_GIVEN_STRING_SPACES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class STRING_CONTAINING_FIRST_LETTER_EVERY_WORD_GIVEN_STRING_SPACES{
static String f_gold ( String str ) {
String result = "" ;
boolean v = true ;
for ( int i = 0 ;
i < str . length ( ) ;
i ++ ) {
if ( str . charAt ( i ) == ' ' ) {
v = true ;
}
else if ( str . charAt ( i ) != ' ' && v == true ) {
result += ( str . charAt ( i ) ) ;
v = false ;
}
}
return result ;
}
| def f_gold ( str ) :
result = ""
v = True
for i in range ( len ( str ) ) :
if ( str [ i ] == ' ' ) :
v = True
elif ( str [ i ] != ' ' and v == True ) :
result += ( str [ i ] )
v = False
return result
|
using namespace std;
string f_gold ( string str ) {
string result = "";
bool v = true;
for ( int i = 0;
i < str . length ( );
i ++ ) {
if ( str [ i ] == ' ' ) v = true;
else if ( str [ i ] != ' ' && v == true ) {
result . push_back ( str [ i ] );
v = false;
}
}
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("t a");
param0.add("77 78 2 600 7");
param0.add("011 10 10");
param0.add("kV Co O iR");
param0.add("2");
param0.add("0 11");
param0.add("Y sT wgheC");
param0.add("58 824 6");
param0.add("00 100 001 0111");
param0.add("Q");
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i)).equals(f_gold(param0.get(i))))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
('t a',),
('77 78 2 600 7',),
('011 10 10',),
('kV Co O iR',),
('2',),
('0 11',),
('Y sT wgheC',),
('58 824 6',),
('00 100 001 0111',),
('Q',)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<string> param0 {"t a","77 78 2 600 7","011 10 10","kVCo kV Co O iR","2","0 11","Y sT wgheC","58 824 6","00 100 001 0111","Q"};
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();
return 0;
} |
MAXIMUM_POSSIBLE_DIFFERENCE_TWO_SUBSETS_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_POSSIBLE_DIFFERENCE_TWO_SUBSETS_ARRAY{
static int f_gold ( int [ ] arr , int n ) {
int SubsetSum_1 = 0 , SubsetSum_2 = 0 ;
for ( int i = 0 ;
i <= n - 1 ;
i ++ ) {
boolean isSingleOccurance = true ;
for ( int j = i + 1 ;
j <= n - 1 ;
j ++ ) {
if ( arr [ i ] == arr [ j ] ) {
isSingleOccurance = false ;
arr [ i ] = arr [ j ] = 0 ;
break ;
}
}
if ( isSingleOccurance ) {
if ( arr [ i ] > 0 ) SubsetSum_1 += arr [ i ] ;
else SubsetSum_2 += arr [ i ] ;
}
}
return Math . abs ( SubsetSum_1 - SubsetSum_2 ) ;
}
| def f_gold ( arr , n ) :
SubsetSum_1 = 0
SubsetSum_2 = 0
for i in range ( 0 , n ) :
isSingleOccurance = True
for j in range ( i + 1 , n ) :
if ( arr [ i ] == arr [ j ] ) :
isSingleOccurance = False
arr [ i ] = arr [ j ] = 0
break
if ( isSingleOccurance == True ) :
if ( arr [ i ] > 0 ) :
SubsetSum_1 += arr [ i ]
else :
SubsetSum_2 += arr [ i ]
return abs ( SubsetSum_1 - SubsetSum_2 )
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int SubsetSum_1 = 0, SubsetSum_2 = 0;
for ( int i = 0;
i <= n - 1;
i ++ ) {
bool isSingleOccurance = true;
for ( int j = i + 1;
j <= n - 1;
j ++ ) {
if ( arr [ i ] == arr [ j ] ) {
isSingleOccurance = false;
arr [ i ] = arr [ j ] = 0;
break;
}
}
if ( isSingleOccurance ) {
if ( arr [ i ] > 0 ) SubsetSum_1 += arr [ i ];
else SubsetSum_2 += arr [ i ];
}
}
return abs ( SubsetSum_1 - SubsetSum_2 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{5,14,15,21,42,42,42,46,46,48,48,48,52,52,53,60,62,69,69,79,82,86,96});
param0.add(new int[]{-54,4,-22,94,58,-28,-12,84,64,4,-34,16,-10,-32,50,-78,68,-52,-64,66,64,-28,-38,-18,-84,-66,-36,64,-12,44,48,8,42});
param0.add(new int[]{0,0,0,1});
param0.add(new int[]{63,49,18,36,21,30,45,87});
param0.add(new int[]{-96,-78,-78,-72,-62,-56,-52,-44,-38,-38,-28,-22,-20,-12,-6,-6,-2,2,2,4,36,44,46,50,50,54,66,92});
param0.add(new int[]{0,1,1,0,0,1,1,0,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,0,1,0,0,1,0,0,1,0,1,0,0,1,1,1,0});
param0.add(new int[]{1,2,8,12,13,13,14,17,18,27,28,31,34,37,38,42,43,45,49,52,53,56,56,58,62,66,71,74,87,93,96,99});
param0.add(new int[]{30,-28,-30,86,-8,-80,76,-2,28,30,82,84,-32,82,-88,-24,42,16,-32,-8,78,-8,-46,-6,-86,-86,-24,-12,-32,-72,84,-82,76,-84,80,-50,90,-50,-14,-82,78,48,-10,86,34,-20,-76,58});
param0.add(new int[]{0,1});
param0.add(new int[]{83,86,57,18,98,52,1,37,11,49,10,67,2,60,30,42,8,97,25,55,5,75,9,67});
List<Integer> param1 = new ArrayList<>();
param1.add(15);
param1.add(28);
param1.add(2);
param1.add(6);
param1.add(18);
param1.add(34);
param1.add(25);
param1.add(28);
param1.add(1);
param1.add(16);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)) == f_gold(param0.get(i),param1.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([5, 14, 15, 21, 42, 42, 42, 46, 46, 48, 48, 48, 52, 52, 53, 60, 62, 69, 69, 79, 82, 86, 96],15,),
([-54, 4, -22, 94, 58, -28, -12, 84, 64, 4, -34, 16, -10, -32, 50, -78, 68, -52, -64, 66, 64, -28, -38, -18, -84, -66, -36, 64, -12, 44, 48, 8, 42],28,),
([0, 0, 0, 1],2,),
([63, 49, 18, 36, 21, 30, 45, 87],6,),
([-96, -78, -78, -72, -62, -56, -52, -44, -38, -38, -28, -22, -20, -12, -6, -6, -2, 2, 2, 4, 36, 44, 46, 50, 50, 54, 66, 92],18,),
([0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0],34,),
([1, 2, 8, 12, 13, 13, 14, 17, 18, 27, 28, 31, 34, 37, 38, 42, 43, 45, 49, 52, 53, 56, 56, 58, 62, 66, 71, 74, 87, 93, 96, 99],25,),
([30, -28, -30, 86, -8, -80, 76, -2, 28, 30, 82, 84, -32, 82, -88, -24, 42, 16, -32, -8, 78, -8, -46, -6, -86, -86, -24, -12, -32, -72, 84, -82, 76, -84, 80, -50, 90, -50, -14, -82, 78, 48, -10, 86, 34, -20, -76, 58],28,),
([0, 1],1,),
([83, 86, 57, 18, 98, 52, 1, 37, 11, 49, 10, 67, 2, 60, 30, 42, 8, 97, 25, 55, 5, 75, 9, 67],16,)
]
n_success = 0
for i, parameters_set in enumerate(param):
if f_filled(*parameters_set) == f_gold(*parameters_set):
n_success+=1
print("#Results: %i, %i" % (n_success, len(param))) |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{5,14,15,21,42,42,42,46,46,48,48,48,52,52,53,60,62,69,69,79,82,86,96},{-54,4,-22,94,58,-28,-12,84,64,4,-34,16,-10,-32,50,-78,68,-52,-64,66,64,-28,-38,-18,-84,-66,-36,64,-12,44,48,8,42},{0,0,0,1},{63,49,18,36,21,30,45,87},{-96,-78,-78,-72,-62,-56,-52,-44,-38,-38,-28,-22,-20,-12,-6,-6,-2,2,2,4,36,44,46,50,50,54,66,92},{0,1,1,0,0,1,1,0,1,1,1,0,0,1,1,0,0,0,0,1,1,0,0,1,1,1,0,1,0,0,1,0,0,1,0,1,0,0,1,1,1,0},{1,2,8,12,13,13,14,17,18,27,28,31,34,37,38,42,43,45,49,52,53,56,56,58,62,66,71,74,87,93,96,99},{30,-28,-30,86,-8,-80,76,-2,28,30,82,84,-32,82,-88,-24,42,16,-32,-8,78,-8,-46,-6,-86,-86,-24,-12,-32,-72,84,-82,76,-84,80,-50,90,-50,-14,-82,78,48,-10,86,34,-20,-76,58},{0,1},{83,86,57,18,98,52,1,37,11,49,10,67,2,60,30,42,8,97,25,55,5,75,9,67}};
vector<int> param1 {15,28,2,6,18,34,25,28,1,16};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i]) == f_gold(¶m0[i].front(),param1[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |