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
⌀ |
---|---|---|---|---|---|---|
HOW_TO_TURN_OFF_A_PARTICULAR_BIT_IN_A_NUMBER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class HOW_TO_TURN_OFF_A_PARTICULAR_BIT_IN_A_NUMBER{
static int f_gold ( int n , int k ) {
if ( k <= 0 ) return n ;
return ( n & ~ ( 1 << ( k - 1 ) ) ) ;
}
| def f_gold ( n , k ) :
if ( k <= 0 ) :
return n
return ( n & ~ ( 1 << ( k - 1 ) ) )
|
using namespace std;
int f_gold ( int n, int k ) {
if ( k <= 0 ) return n;
return ( n & ~ ( 1 << ( k - 1 ) ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(49);
param0.add(59);
param0.add(76);
param0.add(27);
param0.add(61);
param0.add(67);
param0.add(63);
param0.add(85);
param0.add(90);
param0.add(24);
List<Integer> param1 = new ArrayList<>();
param1.add(15);
param1.add(69);
param1.add(20);
param1.add(76);
param1.add(60);
param1.add(27);
param1.add(71);
param1.add(25);
param1.add(64);
param1.add(55);
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 = [
(49,15,),
(59,69,),
(76,20,),
(27,76,),
(61,60,),
(67,27,),
(63,71,),
(85,25,),
(90,64,),
(24,55,)
]
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 {49,59,76,27,61,67,63,85,90,24};
vector<int> param1 {15,69,20,76,60,27,71,25,64,55};
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;
} |
STRING_K_DISTINCT_CHARACTERS_NO_CHARACTERS_ADJACENT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class STRING_K_DISTINCT_CHARACTERS_NO_CHARACTERS_ADJACENT{
static String f_gold ( int n , int k ) {
String res = "" ;
for ( int i = 0 ;
i < k ;
i ++ ) res = res + ( char ) ( 'a' + i ) ;
int count = 0 ;
for ( int i = 0 ;
i < n - k ;
i ++ ) {
res = res + ( char ) ( 'a' + count ) ;
count ++ ;
if ( count == k ) count = 0 ;
}
return res ;
}
| def f_gold ( n , k ) :
res = ""
for i in range ( k ) :
res = res + chr ( ord ( 'a' ) + i )
count = 0
for i in range ( n - k ) :
res = res + chr ( ord ( 'a' ) + count )
count += 1
if ( count == k ) :
count = 0 ;
return res
|
using namespace std;
string f_gold ( int n, int k ) {
string res = "";
for ( int i = 0;
i < k;
i ++ ) res = res + ( char ) ( 'a' + i );
int count = 0;
for ( int i = 0;
i < n - k;
i ++ ) {
res = res + ( char ) ( 'a' + count );
count ++;
if ( count == k ) count = 0;
}
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(60);
param0.add(56);
param0.add(16);
param0.add(42);
param0.add(55);
param0.add(64);
param0.add(68);
param0.add(88);
param0.add(64);
param0.add(42);
List<Integer> param1 = new ArrayList<>();
param1.add(71);
param1.add(17);
param1.add(16);
param1.add(60);
param1.add(56);
param1.add(59);
param1.add(24);
param1.add(2);
param1.add(94);
param1.add(79);
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0.get(i),param1.get(i)).equals(f_gold(param0.get(i),param1.get(i))))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(60,71,),
(56,17,),
(16,16,),
(42,60,),
(55,56,),
(64,59,),
(68,24,),
(88,2,),
(64,94,),
(42,79,)
]
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 {60,56,16,42,55,64,68,88,64,42};
vector<int> param1 {71,17,16,60,56,59,24,2,94,79};
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;
} |
NUMBER_WAYS_NODE_MAKE_LOOP_SIZE_K_UNDIRECTED_COMPLETE_CONNECTED_GRAPH_N_NODES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_WAYS_NODE_MAKE_LOOP_SIZE_K_UNDIRECTED_COMPLETE_CONNECTED_GRAPH_N_NODES{
static int f_gold ( int n , int k ) {
int p = 1 ;
if ( k % 2 != 0 ) p = - 1 ;
return ( int ) ( Math . pow ( n - 1 , k ) + p * ( n - 1 ) ) / n ;
}
| def f_gold ( n , k ) :
p = 1
if ( k % 2 ) :
p = - 1
return ( pow ( n - 1 , k ) + p * ( n - 1 ) ) / n
|
using namespace std;
int f_gold ( int n, int k ) {
int p = 1;
if ( k % 2 ) p = - 1;
return ( pow ( n - 1, k ) + p * ( n - 1 ) ) / n;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(27);
param0.add(70);
param0.add(77);
param0.add(83);
param0.add(16);
param0.add(90);
param0.add(39);
param0.add(48);
param0.add(56);
param0.add(10);
List<Integer> param1 = new ArrayList<>();
param1.add(59);
param1.add(87);
param1.add(40);
param1.add(26);
param1.add(2);
param1.add(66);
param1.add(72);
param1.add(26);
param1.add(77);
param1.add(47);
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,59,),
(70,87,),
(77,40,),
(83,26,),
(16,2,),
(90,66,),
(39,72,),
(48,26,),
(56,77,),
(10,47,)
]
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,70,77,83,16,90,39,48,56,10};
vector<int> param1 {59,87,40,26,2,66,72,26,77,47};
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;
} |
BINARY_SEARCH |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class BINARY_SEARCH{
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 ( arr [ mid ] > x ) return f_gold ( arr , l , mid - 1 , x ) ;
return f_gold ( arr , mid + 1 , r , x ) ;
}
return - 1 ;
}
| def f_gold ( arr , l , r , x ) :
if r >= l :
mid = l + ( r - l ) // 2
if arr [ mid ] == x :
return mid
elif arr [ mid ] > x :
return f_gold ( arr , l , mid - 1 , x )
else :
return f_gold ( arr , mid + 1 , r , x )
else :
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 ( arr [ mid ] > x ) return f_gold ( arr, l, mid - 1, x );
return f_gold ( arr, mid + 1, r, x );
}
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,4,4,8,9,13,13,15,18,27,30,32,42,48,50,52,56,66,69,69,77,84,84,93});
param0.add(new int[]{52,-58,-22,-80,44,-52,-34,94,-34,-74,42,60,-62,70,98,32,10,94,26,56,-48,-50,42,2,46,28,-68,-16,-96,-12,66,-46,74,-60,-52,28,-92,-78,32,28,16,34,30,-60,-14});
param0.add(new int[]{0,1});
param0.add(new int[]{28,84,40,81});
param0.add(new int[]{-66,-62,-60,-56,-56,-2,40,44,50,74,82,94});
param0.add(new int[]{1,0,0,0,0,1,0,1,0,1,1});
param0.add(new int[]{15,26,31,36,36,61,68,72,75,79,82,98});
param0.add(new int[]{0,-82,-94,48,48,-96,14,66,76,-30,86,28,-28,-66,-64,92,-94,-66,86,26,8,94,-82,-80,4,-26,76,-46,72,88,-6,8,-30,40,-88,2,-40,-98,-22,-20,4,-12,54,-20,-36,12});
param0.add(new int[]{0,0,0,0,0,0,0,1,1,1,1,1,1});
param0.add(new int[]{81,47});
List<Integer> param1 = new ArrayList<>();
param1.add(19);
param1.add(40);
param1.add(1);
param1.add(2);
param1.add(8);
param1.add(7);
param1.add(6);
param1.add(38);
param1.add(12);
param1.add(1);
List<Integer> param2 = new ArrayList<>();
param2.add(12);
param2.add(35);
param2.add(1);
param2.add(2);
param2.add(6);
param2.add(7);
param2.add(7);
param2.add(33);
param2.add(10);
param2.add(1);
List<Integer> param3 = new ArrayList<>();
param3.add(22);
param3.add(44);
param3.add(1);
param3.add(2);
param3.add(8);
param3.add(10);
param3.add(8);
param3.add(39);
param3.add(6);
param3.add(1);
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 = [
([3, 4, 4, 8, 9, 13, 13, 15, 18, 27, 30, 32, 42, 48, 50, 52, 56, 66, 69, 69, 77, 84, 84, 93],19,12,22,),
([52, -58, -22, -80, 44, -52, -34, 94, -34, -74, 42, 60, -62, 70, 98, 32, 10, 94, 26, 56, -48, -50, 42, 2, 46, 28, -68, -16, -96, -12, 66, -46, 74, -60, -52, 28, -92, -78, 32, 28, 16, 34, 30, -60, -14],40,35,44,),
([0, 1],1,1,1,),
([28, 84, 40, 81],2,2,2,),
([-66, -62, -60, -56, -56, -2, 40, 44, 50, 74, 82, 94],8,6,8,),
([1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1],7,7,10,),
([15, 26, 31, 36, 36, 61, 68, 72, 75, 79, 82, 98],6,7,8,),
([0, -82, -94, 48, 48, -96, 14, 66, 76, -30, 86, 28, -28, -66, -64, 92, -94, -66, 86, 26, 8, 94, -82, -80, 4, -26, 76, -46, 72, 88, -6, 8, -30, 40, -88, 2, -40, -98, -22, -20, 4, -12, 54, -20, -36, 12],38,33,39,),
([0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],12,10,6,),
([81, 47],1,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 {{3,4,4,8,9,13,13,15,18,27,30,32,42,48,50,52,56,66,69,69,77,84,84,93},{52,-58,-22,-80,44,-52,-34,94,-34,-74,42,60,-62,70,98,32,10,94,26,56,-48,-50,42,2,46,28,-68,-16,-96,-12,66,-46,74,-60,-52,28,-92,-78,32,28,16,34,30,-60,-14},{0,1},{28,84,40,81},{-66,-62,-60,-56,-56,-2,40,44,50,74,82,94},{1,0,0,0,0,1,0,1,0,1,1},{15,26,31,36,36,61,68,72,75,79,82,98},{0,-82,-94,48,48,-96,14,66,76,-30,86,28,-28,-66,-64,92,-94,-66,86,26,8,94,-82,-80,4,-26,76,-46,72,88,-6,8,-30,40,-88,2,-40,-98,-22,-20,4,-12,54,-20,-36,12},{0,0,0,0,0,0,0,1,1,1,1,1,1},{81,47}};
vector<int> param1 {19,40,1,2,8,7,6,38,12,1};
vector<int> param2 {12,35,1,2,6,7,7,33,10,1};
vector<int> param3 {22,44,1,2,8,10,8,39,6,1};
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;
} |
DICE_THROW_PROBLEM |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DICE_THROW_PROBLEM{
public static long f_gold ( int m , int n , int x ) {
long [ ] [ ] table = new long [ n + 1 ] [ x + 1 ] ;
for ( int j = 1 ;
j <= m && j <= x ;
j ++ ) table [ 1 ] [ j ] = 1 ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
for ( int j = 1 ;
j <= x ;
j ++ ) {
for ( int k = 1 ;
k < j && k <= m ;
k ++ ) table [ i ] [ j ] += table [ i - 1 ] [ j - k ] ;
}
}
return table [ n ] [ x ] ;
}
| def f_gold ( m , n , x ) :
table = [ [ 0 ] * ( x + 1 ) for i in range ( n + 1 ) ]
for j in range ( 1 , min ( m + 1 , x + 1 ) ) :
table [ 1 ] [ j ] = 1
for i in range ( 2 , n + 1 ) :
for j in range ( 1 , x + 1 ) :
for k in range ( 1 , min ( m + 1 , j ) ) :
table [ i ] [ j ] += table [ i - 1 ] [ j - k ]
return table [ - 1 ] [ - 1 ]
|
using namespace std;
int f_gold ( int m, int n, int x ) {
int table [ n + 1 ] [ x + 1 ];
memset ( table, 0, sizeof ( table ) );
for ( int j = 1;
j <= m && j <= x;
j ++ ) table [ 1 ] [ j ] = 1;
for ( int i = 2;
i <= n;
i ++ ) for ( int j = 1;
j <= x;
j ++ ) for ( int k = 1;
k <= m && k < j;
k ++ ) table [ i ] [ j ] += table [ i - 1 ] [ j - k ];
return table [ n ] [ x ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(94);
param0.add(7);
param0.add(20);
param0.add(90);
param0.add(50);
param0.add(32);
param0.add(46);
param0.add(82);
param0.add(43);
param0.add(6);
List<Integer> param1 = new ArrayList<>();
param1.add(4);
param1.add(12);
param1.add(44);
param1.add(94);
param1.add(58);
param1.add(90);
param1.add(25);
param1.add(50);
param1.add(82);
param1.add(83);
List<Integer> param2 = new ArrayList<>();
param2.add(69);
param2.add(33);
param2.add(24);
param2.add(88);
param2.add(27);
param2.add(29);
param2.add(6);
param2.add(87);
param2.add(70);
param2.add(19);
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 = [
(94,4,69,),
(7,12,33,),
(20,44,24,),
(90,94,88,),
(50,58,27,),
(32,90,29,),
(46,25,6,),
(82,50,87,),
(43,82,70,),
(6,83,19,)
]
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 {94,7,20,90,50,32,46,82,43,6};
vector<int> param1 {4,12,44,94,58,90,25,50,82,83};
vector<int> param2 {69,33,24,88,27,29,6,87,70,19};
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;
} |
COUNT_NUMBER_OF_WAYS_TO_FILL_A_N_X_4_GRID_USING_1_X_4_TILES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_NUMBER_OF_WAYS_TO_FILL_A_N_X_4_GRID_USING_1_X_4_TILES{
static int f_gold ( int n ) {
int [ ] dp = new int [ n + 1 ] ;
dp [ 0 ] = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) {
if ( i >= 1 && i <= 3 ) dp [ i ] = 1 ;
else if ( i == 4 ) dp [ i ] = 2 ;
else {
dp [ i ] = dp [ i - 1 ] + dp [ i - 4 ] ;
}
}
return dp [ n ] ;
}
| def f_gold ( n ) :
dp = [ 0 for _ in range ( n + 1 ) ]
for i in range ( 1 , n + 1 ) :
if i <= 3 :
dp [ i ] = 1
elif i == 4 :
dp [ i ] = 2
else :
dp [ i ] = dp [ i - 1 ] + dp [ i - 4 ]
return dp [ n ]
|
using namespace std;
int f_gold ( int n ) {
int dp [ n + 1 ];
dp [ 0 ] = 0;
for ( int i = 1;
i <= n;
i ++ ) {
if ( i >= 1 && i <= 3 ) dp [ i ] = 1;
else if ( i == 4 ) dp [ i ] = 2;
else dp [ i ] = dp [ i - 1 ] + dp [ i - 4 ];
}
return dp [ n ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(61);
param0.add(22);
param0.add(65);
param0.add(57);
param0.add(36);
param0.add(25);
param0.add(16);
param0.add(26);
param0.add(92);
param0.add(5);
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 = [
(61,),
(22,),
(65,),
(57,),
(36,),
(25,),
(16,),
(26,),
(92,),
(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<int> param0 {61,22,65,57,36,25,16,26,92,5};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
K_TH_DISTINCT_OR_NON_REPEATING_ELEMENT_IN_AN_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class K_TH_DISTINCT_OR_NON_REPEATING_ELEMENT_IN_AN_ARRAY{
static int f_gold ( int arr [ ] , int n , int k ) {
int dist_count = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int j ;
for ( j = 0 ;
j < n ;
j ++ ) if ( i != j && arr [ j ] == arr [ i ] ) break ;
if ( j == n ) dist_count ++ ;
if ( dist_count == k ) return arr [ i ] ;
}
return - 1 ;
}
| def f_gold ( arr , n , k ) :
dist_count = 0
for i in range ( n ) :
j = 0
while j < n :
if ( i != j and arr [ j ] == arr [ i ] ) :
break
j += 1
if ( j == n ) :
dist_count += 1
if ( dist_count == k ) :
return arr [ i ]
return - 1
|
using namespace std;
int f_gold ( int arr [ ], int n, int k ) {
int dist_count = 0;
for ( int i = 0;
i < n;
i ++ ) {
int j;
for ( j = 0;
j < n;
j ++ ) if ( i != j && arr [ j ] == arr [ i ] ) break;
if ( j == n ) dist_count ++;
if ( dist_count == k ) return arr [ i ];
}
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,3,8,18,20,33,53,56,60,71,76,80,81,87,88,89,92,95});
param0.add(new int[]{-78,6,32,52,-12,-32,22,-40,-82,24,30,10,-40});
param0.add(new int[]{0,0,0,0,0,1,1,1,1,1,1});
param0.add(new int[]{3,28,55,21,42,60,96,83,98,75,29,73,51,21,27,65,19,47,12,81,19,94,50,43,21,32,52,44,52,91,49,59,52,10,75,86,46,43,3,49,70,60,77,99,27,63});
param0.add(new int[]{-96,-90,-76,-44,-16,-8,0,0,2,2,8,14,16,18,18,20,20,28,34,44,68,74,84,90});
param0.add(new int[]{0,1,1,0,0,0,0,0,1,0,0,1,0});
param0.add(new int[]{3,4,5,8,9,15,26,26,26,35,39,40,42,43,45,45,48,52,54,56,57,67,74,77,79,80,81,86,87,92,95,97});
param0.add(new int[]{-76,-24,-12,66,-40,26,72,46,-56,58,-68,2,-82});
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,1,1,1,1,1});
param0.add(new int[]{29,83,32,75,5,22,68,64,36,18,7,63,16,42,77,61,1,26,12,41,67,85,85,35,94,18,14,65,8,55,44,34,48,23,8,27,86,2,51,91});
List<Integer> param1 = new ArrayList<>();
param1.add(16);
param1.add(8);
param1.add(7);
param1.add(40);
param1.add(23);
param1.add(10);
param1.add(26);
param1.add(6);
param1.add(27);
param1.add(28);
List<Integer> param2 = new ArrayList<>();
param2.add(16);
param2.add(6);
param2.add(5);
param2.add(39);
param2.add(12);
param2.add(8);
param2.add(24);
param2.add(10);
param2.add(17);
param2.add(24);
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, 3, 8, 18, 20, 33, 53, 56, 60, 71, 76, 80, 81, 87, 88, 89, 92, 95],16,16,),
([-78, 6, 32, 52, -12, -32, 22, -40, -82, 24, 30, 10, -40],8,6,),
([0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],7,5,),
([3, 28, 55, 21, 42, 60, 96, 83, 98, 75, 29, 73, 51, 21, 27, 65, 19, 47, 12, 81, 19, 94, 50, 43, 21, 32, 52, 44, 52, 91, 49, 59, 52, 10, 75, 86, 46, 43, 3, 49, 70, 60, 77, 99, 27, 63],40,39,),
([-96, -90, -76, -44, -16, -8, 0, 0, 2, 2, 8, 14, 16, 18, 18, 20, 20, 28, 34, 44, 68, 74, 84, 90],23,12,),
([0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0],10,8,),
([3, 4, 5, 8, 9, 15, 26, 26, 26, 35, 39, 40, 42, 43, 45, 45, 48, 52, 54, 56, 57, 67, 74, 77, 79, 80, 81, 86, 87, 92, 95, 97],26,24,),
([-76, -24, -12, 66, -40, 26, 72, 46, -56, 58, -68, 2, -82],6,10,),
([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],27,17,),
([29, 83, 32, 75, 5, 22, 68, 64, 36, 18, 7, 63, 16, 42, 77, 61, 1, 26, 12, 41, 67, 85, 85, 35, 94, 18, 14, 65, 8, 55, 44, 34, 48, 23, 8, 27, 86, 2, 51, 91],28,24,)
]
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,3,8,18,20,33,53,56,60,71,76,80,81,87,88,89,92,95},{-78,6,32,52,-12,-32,22,-40,-82,24,30,10,-40},{0,0,0,0,0,1,1,1,1,1,1},{3,28,55,21,42,60,96,83,98,75,29,73,51,21,27,65,19,47,12,81,19,94,50,43,21,32,52,44,52,91,49,59,52,10,75,86,46,43,3,49,70,60,77,99,27,63},{-96,-90,-76,-44,-16,-8,0,0,2,2,8,14,16,18,18,20,20,28,34,44,68,74,84,90},{0,1,1,0,0,0,0,0,1,0,0,1,0},{3,4,5,8,9,15,26,26,26,35,39,40,42,43,45,45,48,52,54,56,57,67,74,77,79,80,81,86,87,92,95,97},{-76,-24,-12,66,-40,26,72,46,-56,58,-68,2,-82},{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},{29,83,32,75,5,22,68,64,36,18,7,63,16,42,77,61,1,26,12,41,67,85,85,35,94,18,14,65,8,55,44,34,48,23,8,27,86,2,51,91}};
vector<int> param1 {16,8,7,40,23,10,26,6,27,28};
vector<int> param2 {16,6,5,39,12,8,24,10,17,24};
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;
} |
COUNT_SUBARRAYS_WITH_SAME_EVEN_AND_ODD_ELEMENTS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_SUBARRAYS_WITH_SAME_EVEN_AND_ODD_ELEMENTS{
static int f_gold ( int [ ] arr , int n ) {
int difference = 0 ;
int ans = 0 ;
int [ ] hash_positive = new int [ n + 1 ] ;
int [ ] hash_negative = new int [ n + 1 ] ;
hash_positive [ 0 ] = 1 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( ( arr [ i ] & 1 ) == 1 ) {
difference ++ ;
}
else {
difference -- ;
}
if ( difference < 0 ) {
ans += hash_negative [ - difference ] ;
hash_negative [ - difference ] ++ ;
}
else {
ans += hash_positive [ difference ] ;
hash_positive [ difference ] ++ ;
}
}
return ans ;
}
| def f_gold ( arr , n ) :
difference = 0
ans = 0
hash_positive = [ 0 ] * ( n + 1 )
hash_negative = [ 0 ] * ( n + 1 )
hash_positive [ 0 ] = 1
for i in range ( n ) :
if ( arr [ i ] & 1 == 1 ) :
difference = difference + 1
else :
difference = difference - 1
if ( difference < 0 ) :
ans += hash_negative [ - difference ]
hash_negative [ - difference ] = hash_negative [ - difference ] + 1
else :
ans += hash_positive [ difference ]
hash_positive [ difference ] = hash_positive [ difference ] + 1
return ans
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int difference = 0;
int ans = 0;
int hash_positive [ n + 1 ], hash_negative [ n + 1 ];
fill_n ( hash_positive, n + 1, 0 );
fill_n ( hash_negative, n + 1, 0 );
hash_positive [ 0 ] = 1;
for ( int i = 0;
i < n;
i ++ ) {
if ( arr [ i ] & 1 == 1 ) difference ++;
else difference --;
if ( difference < 0 ) {
ans += hash_negative [ - difference ];
hash_negative [ - difference ] ++;
}
else {
ans += hash_positive [ difference ];
hash_positive [ difference ] ++;
}
}
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{7,8,12,13,14,19,20,22,28,30,31,31,32,34,34,39,39,43,45,46,47,62,63,63,65,66,69,69,71,76,79,82,83,88,89,92,93,95,97,97});
param0.add(new int[]{20,-98,-44,-82,28,20,-76,-16,42,0,-88,74,56,6,-68,-30,28,88,58,-78,46,2});
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[]{44,4,29,83,28,75,58,89,40,38,29,45,21,87,97,42,95,20,48,38,15,67,23,81,50,53,64,67,30,13,52,56,87,10,80,38,31,19});
param0.add(new int[]{-94,-94,-94,-90,-88,-86,-86,-82,-78,-76,-74,-68,-64,-62,-62,-60,-52,-48,-48,-46,-44,-44,-32,-28,-22,-12,-12,-8,-8,-4,4,6,10,14,28,40,42,52,56,60,60,60,64,68,70,82,82,84,96});
param0.add(new int[]{1,0,0,0,1,0,1,1,1,0,0,0,1,0,0,1,1,1,0,1,1,1,0,0,1,1,0,1,1,1,1,0,1,1,0,0,1,1,1,1});
param0.add(new int[]{6,16,21,26,34,35,44,46,46,86});
param0.add(new int[]{86,12,80,46,-12,6});
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,1,1,1,1,1,1,1});
param0.add(new int[]{71,94,91,19,85,5,87,96,66,17,95,5,32,17,93,48,46,24});
List<Integer> param1 = new ArrayList<>();
param1.add(26);
param1.add(15);
param1.add(24);
param1.add(23);
param1.add(48);
param1.add(27);
param1.add(7);
param1.add(4);
param1.add(15);
param1.add(12);
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 = [
([7, 8, 12, 13, 14, 19, 20, 22, 28, 30, 31, 31, 32, 34, 34, 39, 39, 43, 45, 46, 47, 62, 63, 63, 65, 66, 69, 69, 71, 76, 79, 82, 83, 88, 89, 92, 93, 95, 97, 97],26,),
([20, -98, -44, -82, 28, 20, -76, -16, 42, 0, -88, 74, 56, 6, -68, -30, 28, 88, 58, -78, 46, 2],15,),
([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],24,),
([44, 4, 29, 83, 28, 75, 58, 89, 40, 38, 29, 45, 21, 87, 97, 42, 95, 20, 48, 38, 15, 67, 23, 81, 50, 53, 64, 67, 30, 13, 52, 56, 87, 10, 80, 38, 31, 19],23,),
([-94, -94, -94, -90, -88, -86, -86, -82, -78, -76, -74, -68, -64, -62, -62, -60, -52, -48, -48, -46, -44, -44, -32, -28, -22, -12, -12, -8, -8, -4, 4, 6, 10, 14, 28, 40, 42, 52, 56, 60, 60, 60, 64, 68, 70, 82, 82, 84, 96],48,),
([1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 1],27,),
([6, 16, 21, 26, 34, 35, 44, 46, 46, 86],7,),
([86, 12, 80, 46, -12, 6],4,),
([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],15,),
([71, 94, 91, 19, 85, 5, 87, 96, 66, 17, 95, 5, 32, 17, 93, 48, 46, 24],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 {{7,8,12,13,14,19,20,22,28,30,31,31,32,34,34,39,39,43,45,46,47,62,63,63,65,66,69,69,71,76,79,82,83,88,89,92,93,95,97,97},{20,-98,-44,-82,28,20,-76,-16,42,0,-88,74,56,6,-68,-30,28,88,58,-78,46,2},{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},{44,4,29,83,28,75,58,89,40,38,29,45,21,87,97,42,95,20,48,38,15,67,23,81,50,53,64,67,30,13,52,56,87,10,80,38,31,19},{-94,-94,-94,-90,-88,-86,-86,-82,-78,-76,-74,-68,-64,-62,-62,-60,-52,-48,-48,-46,-44,-44,-32,-28,-22,-12,-12,-8,-8,-4,4,6,10,14,28,40,42,52,56,60,60,60,64,68,70,82,82,84,96},{1,0,0,0,1,0,1,1,1,0,0,0,1,0,0,1,1,1,0,1,1,1,0,0,1,1,0,1,1,1,1,0,1,1,0,0,1,1,1,1},{6,16,21,26,34,35,44,46,46,86},{86,12,80,46,-12,6},{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},{71,94,91,19,85,5,87,96,66,17,95,5,32,17,93,48,46,24}};
vector<int> param1 {26,15,24,23,48,27,7,4,15,12};
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_MINIMUM_DISTANCE_BETWEEN_TWO_NUMBERS_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THE_MINIMUM_DISTANCE_BETWEEN_TWO_NUMBERS_1{
static int f_gold ( int arr [ ] , int n , int x , int y ) {
int i = 0 ;
int min_dist = Integer . MAX_VALUE ;
int prev = 0 ;
for ( i = 0 ;
i < n ;
i ++ ) {
if ( arr [ i ] == x || arr [ i ] == y ) {
prev = i ;
break ;
}
}
for ( ;
i < n ;
i ++ ) {
if ( arr [ i ] == x || arr [ i ] == y ) {
if ( arr [ prev ] != arr [ i ] && ( i - prev ) < min_dist ) {
min_dist = i - prev ;
prev = i ;
}
else prev = i ;
}
}
return min_dist ;
}
| import sys
def f_gold ( arr , n , x , y ) :
min_dist = sys.maxsize
for i in range ( n ) :
if arr [ i ] == x or arr [ i ] == y :
prev = i
break
while i < n :
if arr [ i ] == x or arr [ i ] == y :
if arr [ prev ] != arr [ i ] and ( i - prev ) < min_dist :
min_dist = i - prev
prev = i
else :
prev = i
i += 1
return min_dist
|
using namespace std;
int f_gold ( int arr [ ], int n, int x, int y ) {
int i = 0;
int min_dist = INT_MAX;
int prev;
for ( i = 0;
i < n;
i ++ ) {
if ( arr [ i ] == x || arr [ i ] == y ) {
prev = i;
break;
}
}
for (;
i < n;
i ++ ) {
if ( arr [ i ] == x || arr [ i ] == y ) {
if ( arr [ prev ] != arr [ i ] && ( i - prev ) < min_dist ) {
min_dist = i - prev;
prev = i;
}
else prev = i;
}
}
return min_dist;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,7,7,8,11,14,16,25,34,35,36,36,38,40,41,43,45,47,57,60,64,72,73,74,75,82,83,83,84,84,84,92});
param0.add(new int[]{96,70,88,-64,-42,58,92,66,-14,90,-66,12,88,-12,48,-4,90,24,98,14,32,38,98,78,2,26,12,-36,90,80,40,58,88,64,16});
param0.add(new int[]{0,0,1});
param0.add(new int[]{46,96,82,73,30,36,56,20,5,36,4,7,89,63,54,97,80,56,93,34,90,56,25,27,75,68,14,90});
param0.add(new int[]{-96,-88,-82,-66,-62,-52,-52,-46,-46,-40,-40,-28,-24,-12,0,4,10,24,42,46,48,48,50,60,62,64,64,70,92,98});
param0.add(new int[]{0,0,1,0,1,1,0,1,1,1,1});
param0.add(new int[]{1,2,2,6,10,14,15,18,19,22,23,29,30,37,40,40,41,41,42,42,44,46,46,54,56,72,73,81,83,83,86,88,93});
param0.add(new int[]{46,86,-52,18,-32,86,2,38,72,72,-60,70,-58,66,-66,-72,-74,58,52,58,16,64,62,-62,80,-70,-96,-44,-20,-74,-10,14,-32,48,30,76,-16,80,66,-46,-92,26,-86,28,-76,-24,-98,54,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});
param0.add(new int[]{32,65,10,72,17,58,79,28,67,36,18,35});
List<Integer> param1 = new ArrayList<>();
param1.add(22);
param1.add(25);
param1.add(1);
param1.add(26);
param1.add(24);
param1.add(10);
param1.add(27);
param1.add(30);
param1.add(38);
param1.add(7);
List<Integer> param2 = new ArrayList<>();
param2.add(7);
param2.add(58);
param2.add(1);
param2.add(54);
param2.add(0);
param2.add(0);
param2.add(1);
param2.add(25);
param2.add(0);
param2.add(10);
List<Integer> param3 = new ArrayList<>();
param3.add(40);
param3.add(70);
param3.add(1);
param3.add(82);
param3.add(4);
param3.add(1);
param3.add(42);
param3.add(45);
param3.add(0);
param3.add(7);
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 = [
([4, 7, 7, 8, 11, 14, 16, 25, 34, 35, 36, 36, 38, 40, 41, 43, 45, 47, 57, 60, 64, 72, 73, 74, 75, 82, 83, 83, 84, 84, 84, 92],22,7,40,),
([96, 70, 88, -64, -42, 58, 92, 66, -14, 90, -66, 12, 88, -12, 48, -4, 90, 24, 98, 14, 32, 38, 98, 78, 2, 26, 12, -36, 90, 80, 40, 58, 88, 64, 16],25,58,70,),
([0, 0, 1],1,1,1,),
([46, 96, 82, 73, 30, 36, 56, 20, 5, 36, 4, 7, 89, 63, 54, 97, 80, 56, 93, 34, 90, 56, 25, 27, 75, 68, 14, 90],26,54,82,),
([-96, -88, -82, -66, -62, -52, -52, -46, -46, -40, -40, -28, -24, -12, 0, 4, 10, 24, 42, 46, 48, 48, 50, 60, 62, 64, 64, 70, 92, 98],24,0,4,),
([0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1],10,0,1,),
([1, 2, 2, 6, 10, 14, 15, 18, 19, 22, 23, 29, 30, 37, 40, 40, 41, 41, 42, 42, 44, 46, 46, 54, 56, 72, 73, 81, 83, 83, 86, 88, 93],27,1,42,),
([46, 86, -52, 18, -32, 86, 2, 38, 72, 72, -60, 70, -58, 66, -66, -72, -74, 58, 52, 58, 16, 64, 62, -62, 80, -70, -96, -44, -20, -74, -10, 14, -32, 48, 30, 76, -16, 80, 66, -46, -92, 26, -86, 28, -76, -24, -98, 54, 50],30,25,45,),
([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],38,0,0,),
([32, 65, 10, 72, 17, 58, 79, 28, 67, 36, 18, 35],7,10,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 {{4,7,7,8,11,14,16,25,34,35,36,36,38,40,41,43,45,47,57,60,64,72,73,74,75,82,83,83,84,84,84,92},{96,70,88,-64,-42,58,92,66,-14,90,-66,12,88,-12,48,-4,90,24,98,14,32,38,98,78,2,26,12,-36,90,80,40,58,88,64,16},{0,0,1},{46,96,82,73,30,36,56,20,5,36,4,7,89,63,54,97,80,56,93,34,90,56,25,27,75,68,14,90},{-96,-88,-82,-66,-62,-52,-52,-46,-46,-40,-40,-28,-24,-12,0,4,10,24,42,46,48,48,50,60,62,64,64,70,92,98},{0,0,1,0,1,1,0,1,1,1,1},{1,2,2,6,10,14,15,18,19,22,23,29,30,37,40,40,41,41,42,42,44,46,46,54,56,72,73,81,83,83,86,88,93},{46,86,-52,18,-32,86,2,38,72,72,-60,70,-58,66,-66,-72,-74,58,52,58,16,64,62,-62,80,-70,-96,-44,-20,-74,-10,14,-32,48,30,76,-16,80,66,-46,-92,26,-86,28,-76,-24,-98,54,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},{32,65,10,72,17,58,79,28,67,36,18,35}};
vector<int> param1 {22,25,1,26,24,10,27,30,38,7};
vector<int> param2 {7,58,1,54,0,0,1,25,0,10};
vector<int> param3 {40,70,1,82,4,1,42,45,0,7};
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;
} |
SMALLEST_OF_THREE_INTEGERS_WITHOUT_COMPARISON_OPERATORS_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SMALLEST_OF_THREE_INTEGERS_WITHOUT_COMPARISON_OPERATORS_1{
static int f_gold ( int x , int y , int z ) {
if ( ( y / x ) != 1 ) return ( ( y / z ) != 1 ) ? y : z ;
return ( ( x / z ) != 1 ) ? x : z ;
}
| def f_gold ( x , y , z ) :
if ( not ( y / x ) ) :
return y if ( not ( y / z ) ) else z
return x if ( not ( x / z ) ) else z
|
using namespace std;
int f_gold ( int x, int y, int z ) {
if ( ! ( y / x ) ) return ( ! ( y / z ) ) ? y : z;
return ( ! ( x / z ) ) ? x : z;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(48);
param0.add(11);
param0.add(50);
param0.add(21);
param0.add(94);
param0.add(22);
param0.add(3);
param0.add(67);
param0.add(59);
param0.add(50);
List<Integer> param1 = new ArrayList<>();
param1.add(63);
param1.add(55);
param1.add(89);
param1.add(71);
param1.add(39);
param1.add(44);
param1.add(41);
param1.add(62);
param1.add(2);
param1.add(11);
List<Integer> param2 = new ArrayList<>();
param2.add(56);
param2.add(84);
param2.add(96);
param2.add(74);
param2.add(42);
param2.add(86);
param2.add(68);
param2.add(94);
param2.add(83);
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,63,56,),
(11,55,84,),
(50,89,96,),
(21,71,74,),
(94,39,42,),
(22,44,86,),
(3,41,68,),
(67,62,94,),
(59,2,83,),
(50,11,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<int> param0 {48,11,50,21,94,22,3,67,59,50};
vector<int> param1 {63,55,89,71,39,44,41,62,2,11};
vector<int> param2 {56,84,96,74,42,86,68,94,83,1};
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;
} |
LONGEST_EVEN_LENGTH_SUBSTRING_SUM_FIRST_SECOND_HALF_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LONGEST_EVEN_LENGTH_SUBSTRING_SUM_FIRST_SECOND_HALF_1{
static int f_gold ( String str ) {
int n = str . length ( ) ;
int maxlen = 0 ;
int sum [ ] [ ] = new int [ n ] [ n ] ;
for ( int i = 0 ;
i < n ;
i ++ ) sum [ i ] [ i ] = str . charAt ( i ) - '0' ;
for ( int len = 2 ;
len <= n ;
len ++ ) {
for ( int i = 0 ;
i < n - len + 1 ;
i ++ ) {
int j = i + len - 1 ;
int k = len / 2 ;
sum [ i ] [ j ] = sum [ i ] [ j - k ] + sum [ j - k + 1 ] [ j ] ;
if ( len % 2 == 0 && sum [ i ] [ j - k ] == sum [ ( j - k + 1 ) ] [ j ] && len > maxlen ) maxlen = len ;
}
}
return maxlen ;
}
| null | null |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("jNkTf");
param0.add("7");
param0.add("100001101001");
param0.add("fRXyQrTUjEk");
param0.add("908404");
param0.add("0101010010");
param0.add("svq");
param0.add("19");
param0.add("11100010001");
param0.add("O HgwJyOVfnV");
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 | null |
CHECK_GIVEN_MATRIX_SPARSE_NOT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_GIVEN_MATRIX_SPARSE_NOT{
static boolean f_gold ( int array [ ] [ ] , int m , int n ) {
int counter = 0 ;
for ( int i = 0 ;
i < m ;
++ i ) for ( int j = 0 ;
j < n ;
++ j ) if ( array [ i ] [ j ] == 0 ) ++ counter ;
return ( counter > ( ( m * n ) / 2 ) ) ;
}
| def f_gold ( array , m , n ) :
counter = 0
for i in range ( 0 , m ) :
for j in range ( 0 , n ) :
if ( array [ i ] [ j ] == 0 ) :
counter = counter + 1
return ( counter > ( ( m * n ) // 2 ) )
| null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ] [ ]> param0 = new ArrayList<>();
param0.add(new int[][]{new int[]{79,48,59,39,33,8,8,47,45,54,35,40,70,98,70,81,48,52,74,83,67,46,14,60,47,12},new int[]{95,48,3,19,14,81,2,3,72,55,5,88,98,97,75,61,42,46,49,14,20,16,9,66,21,66},new int[]{98,83,30,38,55,85,23,83,32,84,5,6,76,59,12,22,33,28,36,9,2,9,18,24,65,73},new int[]{58,62,97,33,65,60,11,68,52,60,54,47,82,66,16,20,75,55,38,20,24,46,11,22,1,75},new int[]{3,83,28,4,72,68,64,23,94,1,3,97,46,21,47,41,23,63,1,15,24,36,71,40,87,56},new int[]{87,70,71,85,10,80,33,46,87,36,16,25,15,97,13,87,87,74,37,21,37,4,99,23,31,53},new int[]{37,67,88,27,27,86,32,90,65,26,93,49,91,15,13,9,96,69,56,80,87,41,91,59,46,85},new int[]{65,76,25,87,63,66,39,69,8,43,67,97,94,91,99,34,71,70,95,74,88,21,42,80,16,68},new int[]{48,96,30,38,71,98,72,14,43,37,38,71,37,89,51,85,27,7,20,36,96,75,76,58,50,36},new int[]{77,5,4,57,52,38,62,82,49,46,36,97,70,53,83,74,74,42,72,11,88,75,11,92,40,10},new int[]{72,83,15,66,57,13,85,41,9,30,67,28,1,72,92,51,76,44,52,6,74,33,31,10,71,50},new int[]{42,98,1,67,51,2,18,44,14,56,4,74,34,39,50,27,48,33,67,18,12,86,32,5,90,75},new int[]{90,43,82,96,38,98,79,41,78,36,3,73,74,65,74,34,85,45,77,37,89,9,86,54,10,64},new int[]{53,62,86,98,61,70,18,81,57,96,65,59,12,21,96,31,16,66,13,61,31,70,43,64,84,46},new int[]{53,28,98,9,34,67,46,53,57,37,85,4,29,96,59,32,45,22,52,27,66,20,57,18,97,99},new int[]{32,80,33,40,8,25,13,66,26,33,30,16,37,16,93,50,58,89,87,3,26,42,56,60,81,15},new int[]{46,79,18,27,8,63,81,54,19,21,3,40,86,31,18,50,11,22,80,68,60,3,82,52,30,11},new int[]{48,21,33,73,88,88,15,97,46,7,33,59,91,17,80,76,58,84,10,78,93,47,3,2,17,17},new int[]{67,93,87,24,28,29,20,48,26,25,25,79,47,31,10,55,48,18,59,57,89,20,14,44,34,52},new int[]{87,26,22,3,40,62,64,72,52,71,11,8,79,37,28,81,21,63,90,22,74,85,26,92,57,89},new int[]{80,51,54,52,35,3,13,49,36,3,12,41,91,28,29,30,40,58,73,60,95,61,52,75,91,94},new int[]{90,99,20,51,37,85,46,21,62,17,16,48,61,89,79,55,5,51,88,68,38,62,42,38,16,52},new int[]{95,40,54,18,67,64,52,21,52,98,84,96,48,21,34,84,18,2,47,24,78,15,10,87,88,77},new int[]{89,24,15,93,26,70,3,93,64,62,85,67,6,88,66,14,19,22,33,89,91,7,1,39,37,50},new int[]{40,20,50,29,3,11,66,40,11,65,13,97,87,70,1,37,25,99,81,99,95,66,88,47,54,91},new int[]{36,44,14,79,81,56,56,12,7,31,74,3,18,83,27,18,75,6,46,70,69,1,95,92,12,52}});
param0.add(new int[][]{new int[]{67,41,95,96,46,82,5,44,41,3,55,19,1,18,59,62,56,37,60,49,5,79,68},new int[]{85,12,82,41,38,52,33,75,11,46,3,21,13,93,20,42,52,95,74,69,93,1,81},new int[]{95,24,13,91,41,41,85,4,98,89,97,25,13,33,18,51,54,58,24,7,33,7,65},new int[]{60,17,53,18,95,76,49,84,61,35,53,48,45,88,73,51,51,8,61,97,76,15,38},new int[]{30,58,80,23,72,21,10,98,40,36,54,67,79,97,94,59,86,77,93,36,77,84,5},new int[]{89,42,17,26,96,26,88,89,86,21,97,39,96,57,83,24,6,85,68,12,15,92,16},new int[]{45,85,17,37,50,90,60,57,3,31,32,44,66,61,32,47,2,49,38,99,21,43,95},new int[]{46,50,98,39,76,81,51,16,48,63,37,54,73,30,3,41,74,61,13,4,66,92,49},new int[]{25,60,8,35,12,70,77,66,35,88,40,57,38,97,31,44,6,13,3,68,28,58,72},new int[]{68,78,45,66,58,8,25,90,77,1,55,60,98,54,71,60,18,86,29,48,78,75,4},new int[]{56,95,41,62,43,81,32,55,95,35,61,11,34,70,27,99,59,90,27,33,71,16,35},new int[]{68,16,57,90,76,38,11,75,31,81,12,62,9,3,58,51,88,25,80,72,44,14,15},new int[]{99,24,44,97,54,95,80,78,12,1,86,77,27,55,54,40,65,87,6,16,14,36,87},new int[]{53,8,42,68,29,57,22,34,4,87,69,56,6,81,15,83,81,31,61,7,18,2,81},new int[]{26,43,12,57,23,79,80,26,70,36,33,28,27,72,97,52,13,90,45,1,44,81,38},new int[]{43,82,40,76,62,67,88,72,93,2,18,87,14,1,15,88,32,39,68,31,44,54,16},new int[]{99,50,21,42,96,76,40,78,48,32,66,65,10,62,39,16,41,78,59,50,50,5,83},new int[]{92,92,66,22,29,40,40,16,41,61,64,13,63,76,63,10,91,12,20,88,79,54,47},new int[]{61,68,76,59,98,25,18,44,3,95,61,77,12,39,79,83,92,13,75,39,6,5,65},new int[]{49,12,1,19,6,19,8,86,44,61,23,88,6,52,85,67,13,74,64,46,54,96,86},new int[]{2,39,65,66,43,54,6,96,27,88,90,65,26,65,23,89,26,78,76,94,37,83,3},new int[]{46,32,63,18,68,16,40,27,77,56,92,52,14,6,15,3,22,48,40,51,13,95,21},new int[]{28,13,95,35,18,71,3,37,46,77,61,89,52,94,46,90,59,3,19,49,79,14,49}});
param0.add(new int[][]{new int[]{54,80,87,13,57,54,87,86,35,80,99,77,74,67,40,17,2,58,15,68,51,81,39,80,19,51,2,90},new int[]{91,30,51,84,38,71,75,65,72,14,2,93,22,1,32,18,39,41,69,18,94,21,5,12,50,10,89,85},new int[]{47,9,38,92,12,34,4,35,7,80,82,20,97,74,6,41,22,60,39,84,81,73,79,73,73,36,17,6},new int[]{7,58,59,11,60,12,79,26,93,56,6,87,74,91,87,6,5,35,80,73,16,81,40,92,98,30,73,39},new int[]{60,35,37,72,3,55,13,47,47,87,50,33,52,15,76,10,24,24,77,62,57,66,61,28,33,40,45,65},new int[]{71,80,22,56,73,49,79,4,8,73,27,16,27,35,47,36,73,19,86,37,95,73,46,57,29,19,44,9},new int[]{62,34,21,35,50,13,75,34,74,12,95,30,75,30,10,48,49,8,75,31,15,95,65,86,69,4,59,46},new int[]{55,27,65,56,88,34,92,9,71,38,35,64,72,19,25,82,80,77,46,33,51,55,35,74,24,76,16,14},new int[]{7,7,61,69,10,36,34,91,47,37,52,23,46,16,65,85,1,85,58,61,61,15,36,62,39,88,85,35},new int[]{62,81,60,3,16,7,82,42,49,99,49,10,67,87,10,33,63,71,1,33,93,98,48,58,21,26,82,47},new int[]{3,5,47,13,28,79,22,51,58,41,74,52,88,43,84,70,40,24,29,83,59,23,63,58,2,32,32,81},new int[]{86,20,78,78,53,93,60,99,51,87,70,30,99,16,52,14,99,21,96,48,5,86,89,48,15,79,55,57},new int[]{92,16,18,8,89,97,99,62,26,58,19,25,3,87,56,45,94,76,80,23,93,56,61,63,33,5,83,91},new int[]{54,92,96,19,75,7,54,70,29,40,35,11,21,41,72,65,41,60,58,58,81,11,44,32,50,71,48,58},new int[]{36,34,49,92,54,31,67,69,91,4,23,34,43,5,47,66,93,20,40,19,80,57,77,24,31,21,7,20},new int[]{64,55,68,71,33,93,9,44,10,50,92,24,66,88,72,92,11,55,67,33,61,29,88,76,58,14,42,34},new int[]{17,23,25,42,98,72,96,14,43,38,14,96,30,93,14,86,43,17,16,57,52,22,47,63,11,76,3,39},new int[]{45,3,94,41,65,72,49,18,42,81,49,8,19,8,5,47,47,71,23,13,20,62,43,44,49,61,83,97},new int[]{15,97,29,80,77,46,44,71,86,75,45,76,70,44,41,68,78,76,60,13,75,37,49,34,2,94,43,86},new int[]{23,12,73,12,86,62,39,61,9,26,31,73,97,48,74,10,31,55,6,39,3,80,38,48,99,35,47,93},new int[]{84,75,94,3,7,20,17,77,30,36,45,68,98,73,17,29,87,69,19,38,71,86,84,36,55,51,85,44},new int[]{60,12,36,49,28,96,10,20,61,87,4,68,46,19,94,49,96,96,16,69,19,51,92,59,78,2,34,40},new int[]{13,54,9,18,58,3,33,77,52,93,97,12,8,71,6,69,11,71,54,6,80,64,28,82,19,98,28,46},new int[]{54,68,45,43,98,63,32,70,81,32,31,39,23,32,84,87,99,91,43,97,96,42,65,98,74,5,94,88},new int[]{17,29,96,93,95,20,40,37,56,74,98,15,22,83,18,75,81,99,6,27,38,29,72,57,40,26,94,49},new int[]{79,96,80,43,95,44,13,62,30,10,98,65,59,46,90,56,93,38,68,40,76,19,30,20,19,80,56,5},new int[]{75,90,50,89,77,6,72,68,73,94,5,21,80,36,36,88,7,49,69,16,44,78,86,59,86,49,26,33},new int[]{94,79,16,65,95,4,84,59,56,78,36,5,47,40,4,17,21,17,57,27,26,35,26,1,32,13,88,72}});
param0.add(new int[][]{new int[]{39,82,13,38,88,30,51,34,53,58,54,87,30,72,77,48,55,34,87},new int[]{70,86,28,68,52,48,78,42,68,21,27,35,41,53,76,18,39,24,61},new int[]{16,38,21,46,59,52,95,97,88,90,43,83,11,25,40,18,37,47,3},new int[]{53,9,6,43,54,79,86,88,68,7,79,21,70,88,77,63,90,45,64},new int[]{99,16,85,5,92,38,81,26,48,18,1,43,8,59,28,47,51,31,90},new int[]{4,87,14,14,97,51,81,65,25,1,22,32,46,85,90,21,85,42,44},new int[]{8,96,27,63,63,65,73,66,9,54,89,93,26,72,58,71,25,67,22},new int[]{76,76,64,6,24,23,29,82,7,76,93,28,54,79,47,45,53,93,24},new int[]{13,30,78,6,4,21,75,30,78,42,11,19,36,4,40,35,64,19,56},new int[]{61,15,99,3,59,34,15,16,3,74,70,81,11,56,24,79,31,95,30},new int[]{86,49,28,58,35,14,20,83,59,88,68,16,29,74,54,64,39,89,34},new int[]{79,40,23,60,79,43,88,1,21,5,51,30,20,72,63,28,56,80,2},new int[]{46,70,71,17,9,12,98,70,89,72,99,25,10,9,58,67,91,97,55},new int[]{84,89,11,89,91,37,34,88,35,68,92,53,90,40,12,56,16,51,32},new int[]{18,89,27,59,9,86,56,35,70,5,30,5,53,42,75,63,28,14,20},new int[]{21,83,86,48,24,16,5,97,65,79,51,42,2,36,2,70,64,31,19},new int[]{94,81,22,39,33,76,10,41,94,25,33,15,78,17,42,53,46,69,50},new int[]{45,90,30,89,62,86,37,35,8,38,64,17,6,20,92,83,84,28,41},new int[]{51,97,5,17,16,93,15,74,74,98,24,25,66,71,95,44,47,39,41}});
param0.add(new int[][]{new int[]{45,34,40,86,92,30,11,67,66,18,30,47,69,10,98,55,85,39,46,78},new int[]{49,6,79,57,39,75,91,82,91,18,86,11,46,94,96,93,31,73,98,60},new int[]{40,27,52,15,85,14,9,6,47,67,46,13,29,75,53,71,80,56,88,30},new int[]{36,24,45,38,71,83,10,64,26,16,31,30,33,89,69,93,59,14,19,91},new int[]{23,84,17,24,58,16,79,4,84,37,91,9,15,34,52,9,24,1,81,30},new int[]{34,83,45,69,25,64,16,98,87,41,68,1,17,10,81,9,87,16,48,1},new int[]{26,8,59,97,5,70,41,34,95,34,92,34,76,27,83,84,90,83,39,81},new int[]{58,55,22,85,45,11,27,6,71,61,97,72,78,81,93,9,21,60,96,37},new int[]{2,25,36,41,31,74,4,1,70,34,45,6,19,23,5,72,48,3,66,90},new int[]{37,17,39,34,86,86,49,64,89,98,23,48,76,47,34,81,77,11,67,20},new int[]{6,4,27,99,14,45,92,84,63,36,50,24,98,16,81,89,94,33,13,4},new int[]{51,11,25,40,65,38,4,73,67,76,81,43,87,55,28,26,49,51,97,41},new int[]{10,68,99,15,59,15,1,35,8,40,58,29,36,63,51,54,41,83,92,8},new int[]{26,35,58,32,90,53,11,57,43,67,9,95,98,74,29,24,8,40,83,34},new int[]{46,96,63,39,20,39,69,98,23,30,29,13,24,95,72,27,18,31,78,68},new int[]{15,75,63,63,95,80,19,52,10,53,88,55,94,73,85,47,85,6,80,99},new int[]{67,79,6,51,9,27,54,1,69,13,39,14,64,7,85,72,90,66,87,55},new int[]{55,88,18,52,43,74,81,63,6,8,62,71,28,93,4,49,75,79,66,7},new int[]{34,21,47,36,76,83,10,31,91,83,12,14,43,91,51,23,45,27,66,63},new int[]{96,65,87,13,87,14,33,15,79,29,14,84,77,95,47,48,44,17,78,82}});
param0.add(new int[][]{new int[]{42,12,11,27,59,79,58,6,82,98,65,11,95,88,36,77,61,28,50,28,70,14,95,80,20,65,34,20,88,46,82},new int[]{1,96,71,86,2,9,74,20,86,87,24,96,26,21,1,69,81,31,10,37,36,39,1,27,75,69,30,36,72,28,98},new int[]{18,65,21,19,89,33,81,88,43,82,73,24,95,93,47,28,17,84,14,83,26,60,11,59,10,88,15,56,70,87,6},new int[]{66,16,52,35,8,58,36,40,75,53,58,99,56,22,72,14,68,44,41,64,8,50,37,36,15,19,45,15,43,53,88},new int[]{73,21,71,14,86,73,13,23,69,2,31,46,92,48,21,1,90,16,38,69,86,43,49,64,6,67,78,26,55,14,57},new int[]{82,84,40,95,26,69,81,37,37,83,31,49,24,25,55,95,60,16,31,51,68,54,21,67,88,72,67,88,60,43,52},new int[]{44,44,36,89,17,72,6,53,12,96,46,89,63,84,33,17,61,24,53,7,51,32,98,74,86,38,31,72,95,97,81},new int[]{85,45,94,87,79,71,68,12,22,58,22,85,14,7,37,88,36,92,47,34,5,72,97,54,65,46,12,66,25,46,8},new int[]{58,48,97,83,67,99,28,41,80,28,94,82,76,16,59,78,65,11,28,7,95,29,58,68,14,38,47,12,69,66,18},new int[]{53,14,30,70,31,44,10,1,79,76,33,79,65,54,25,96,51,80,53,66,10,42,46,57,41,39,51,13,4,28,44},new int[]{54,45,31,12,11,54,5,58,36,27,84,18,78,61,49,31,31,88,10,13,19,43,28,9,34,51,17,83,15,49,62},new int[]{71,83,64,18,74,48,19,52,99,50,98,49,8,73,43,85,52,19,77,83,81,43,73,63,80,45,43,80,63,6,52},new int[]{47,20,16,17,59,58,56,14,39,1,66,15,76,22,23,53,97,17,76,24,66,62,46,63,87,9,31,72,14,68,50},new int[]{64,94,13,2,45,48,57,13,11,31,34,7,24,90,24,66,26,61,9,15,8,28,86,76,37,4,92,35,72,93,93},new int[]{58,80,95,77,7,36,55,28,37,2,85,62,43,9,46,14,29,63,16,14,40,80,94,86,32,1,45,48,43,44,47},new int[]{94,14,6,63,92,78,80,77,40,19,74,67,13,14,25,74,76,76,62,25,55,23,61,98,32,39,61,86,4,47,69},new int[]{20,46,96,16,79,16,86,10,30,20,25,69,74,88,15,91,74,97,2,5,13,37,92,8,99,14,46,19,19,74,67},new int[]{26,34,34,85,1,51,34,55,91,6,24,45,7,94,21,77,88,14,36,59,10,26,6,33,18,40,9,13,53,42,24},new int[]{46,40,59,19,6,86,68,5,55,32,75,24,8,90,1,58,83,20,23,33,5,76,13,52,87,6,35,28,2,1,94},new int[]{42,82,23,86,81,20,39,5,51,50,92,87,74,50,40,87,39,9,82,71,15,81,8,99,36,16,40,8,10,74,96},new int[]{5,36,89,45,15,98,24,17,30,40,27,73,31,71,56,30,92,84,18,29,22,32,41,22,54,94,87,93,78,87,75},new int[]{59,94,45,80,53,46,25,43,26,66,24,35,93,77,76,88,48,63,86,59,84,12,50,91,30,51,33,95,56,91,73},new int[]{90,74,86,27,96,47,7,33,42,67,94,71,10,49,19,46,49,12,91,86,43,34,87,35,71,24,10,89,6,19,48},new int[]{50,66,60,59,81,36,45,77,60,2,24,89,58,34,38,90,92,63,80,85,47,1,1,35,21,11,78,39,42,65,74},new int[]{1,87,40,86,74,21,38,82,16,26,8,16,44,92,83,64,79,2,75,95,40,35,57,56,55,12,59,94,94,35,94},new int[]{35,64,13,52,28,88,14,55,63,81,51,1,98,97,42,13,24,33,40,85,88,4,86,63,34,82,70,42,76,57,36},new int[]{82,10,12,74,92,50,4,74,42,91,76,86,97,6,92,64,83,2,64,15,59,43,24,48,95,16,36,69,21,11,88},new int[]{23,19,93,9,85,70,28,44,28,79,48,78,38,24,77,41,46,73,97,50,81,7,44,66,98,7,17,99,27,98,16},new int[]{98,24,28,57,76,91,95,14,27,87,68,78,75,5,61,43,86,36,1,48,11,36,92,5,4,44,32,72,18,61,82},new int[]{74,52,92,80,86,94,3,63,40,42,69,93,95,57,55,88,47,23,92,24,92,16,35,73,40,76,98,25,29,18,99},new int[]{54,18,49,72,31,41,51,75,72,54,76,74,42,72,63,89,4,3,19,34,63,25,93,77,45,46,5,85,30,93,18}});
param0.add(new int[][]{new int[]{31,83,88,14,5,89,29,61,90,20,15,11,57,68,68,11,8,72,4,96,69,42,26,96,55,42,48,89},new int[]{40,32,27,51,96,95,49,46,65,66,48,71,86,96,95,51,1,50,9,65,17,35,5,63,50,53,79,46},new int[]{93,89,15,91,97,99,42,74,43,90,50,41,42,41,72,51,64,28,69,81,53,64,66,44,55,72,48,79},new int[]{62,71,53,27,36,9,97,5,58,99,91,90,45,50,27,67,76,83,80,58,81,46,94,56,32,46,81,10},new int[]{74,60,54,4,68,71,98,4,2,96,21,48,68,21,32,82,61,63,74,27,29,15,14,38,35,87,2,62},new int[]{41,71,71,83,67,39,88,38,84,65,84,84,19,11,19,75,36,98,81,19,67,3,75,41,17,29,39,86},new int[]{48,58,48,48,26,84,42,94,22,89,29,59,71,53,21,30,2,17,68,42,66,97,95,64,89,52,1,62},new int[]{65,64,7,14,73,61,98,8,26,55,98,72,19,22,47,61,90,86,99,82,91,18,12,45,88,77,40,53},new int[]{22,19,71,37,53,90,29,28,20,14,8,98,52,59,97,22,90,83,99,94,60,75,16,83,43,53,49,88},new int[]{83,71,91,80,33,91,19,23,42,21,77,80,64,67,39,12,38,87,5,1,98,52,12,73,14,48,85,68},new int[]{32,34,50,56,19,81,20,17,23,32,83,56,96,87,94,88,91,21,27,10,53,57,3,80,90,72,13,25},new int[]{83,78,50,75,10,50,44,86,45,27,82,63,17,99,37,99,51,27,6,20,25,15,83,53,95,14,27,36},new int[]{37,59,5,5,54,95,23,26,55,77,58,63,23,88,20,83,89,11,39,80,40,75,48,26,70,93,6,6},new int[]{64,69,75,19,11,23,73,83,23,53,45,10,34,6,95,52,87,20,27,90,23,83,65,21,64,48,12,38},new int[]{79,9,79,55,45,30,21,52,55,31,83,17,42,68,86,55,63,49,57,16,18,5,10,96,12,52,44,51},new int[]{39,29,63,29,91,23,16,41,88,1,22,43,14,43,74,84,40,53,78,85,25,88,95,18,4,69,71,69},new int[]{98,52,2,83,27,24,72,22,50,24,42,39,57,89,94,90,20,63,59,71,92,64,64,9,71,95,12,42},new int[]{81,10,77,3,50,2,50,52,87,83,32,80,18,15,63,16,59,44,23,14,89,14,20,93,66,22,97,36},new int[]{85,87,81,24,2,41,66,56,86,31,41,79,10,49,68,18,90,50,37,18,77,48,30,77,10,41,38,90},new int[]{27,4,40,48,20,70,90,81,98,41,56,2,46,57,28,21,60,60,42,89,87,90,16,58,56,76,89,36},new int[]{33,9,29,18,59,89,83,54,22,11,44,9,26,91,76,36,93,73,91,89,89,1,95,61,19,65,82,57},new int[]{30,78,79,87,39,53,77,49,34,1,22,74,71,77,39,25,40,91,21,69,56,40,98,65,19,60,95,43},new int[]{66,4,31,83,70,97,24,72,60,73,21,47,47,19,21,6,85,61,15,93,83,45,8,29,22,34,8,51},new int[]{51,96,68,8,55,48,54,62,71,29,83,95,84,5,39,96,61,87,55,47,69,93,79,1,49,75,11,34},new int[]{19,60,96,25,29,36,41,92,13,28,5,58,97,76,71,89,36,89,21,32,60,31,92,53,92,1,69,22},new int[]{21,47,54,12,93,11,86,4,54,25,52,84,14,86,54,19,31,38,52,24,88,16,87,45,14,97,25,81},new int[]{15,92,56,70,82,14,58,46,62,61,25,16,10,35,23,18,19,8,25,80,10,18,30,63,74,56,98,20},new int[]{60,17,40,74,8,64,22,37,82,10,36,27,21,30,6,78,17,60,87,42,87,9,19,33,19,20,94,18}});
param0.add(new int[][]{new int[]{86,39,88,64,64,37,73,80,25,79,52,51,19,48,70,73,48,63,88,16,65,48,18,28,86,68,39,5,55,72,32,80,36,99,34},new int[]{48,65,65,73,63,75,55,30,69,9,72,86,91,97,40,82,5,27,81,60,14,1,26,40,66,25,90,67,99,91,72,58,90,15,32},new int[]{23,80,72,57,90,2,90,95,85,57,31,8,50,43,82,6,52,75,80,62,45,2,12,63,85,70,26,16,70,81,7,32,37,94,98},new int[]{15,21,54,26,33,81,87,40,92,3,85,11,78,60,22,41,52,56,59,35,32,46,52,94,7,87,37,97,93,62,28,5,49,82,22},new int[]{76,57,20,20,21,61,42,5,77,98,55,66,19,93,10,63,95,65,56,79,97,53,34,6,10,40,40,31,85,64,41,69,13,87,53},new int[]{6,47,51,40,50,99,74,22,81,41,4,80,4,43,91,22,21,15,63,17,34,66,39,55,36,66,97,38,55,87,18,97,31,89,65},new int[]{75,45,99,54,56,42,4,40,26,96,88,36,81,33,95,53,81,39,28,25,75,8,69,40,16,30,37,78,71,31,87,42,22,36,17},new int[]{40,19,21,62,43,32,10,82,99,29,95,44,95,94,16,14,1,50,32,96,88,83,15,1,84,6,45,63,14,11,83,74,76,96,53},new int[]{78,42,30,64,97,13,16,42,44,61,2,67,81,11,51,80,99,2,42,54,51,51,96,3,16,49,5,44,75,56,74,48,72,43,7},new int[]{30,13,90,78,1,17,42,50,87,19,86,72,78,4,86,39,8,43,49,48,19,60,27,24,74,73,13,59,32,34,55,93,24,84,56},new int[]{71,81,10,4,78,71,76,75,47,17,8,27,67,21,59,79,47,26,30,40,80,44,54,37,11,9,94,73,42,82,49,19,47,75,59},new int[]{59,76,5,83,49,4,17,80,90,96,52,83,24,8,81,92,32,77,76,70,34,47,63,68,15,66,20,92,55,81,77,17,8,81,73},new int[]{42,41,17,73,48,41,60,14,37,36,68,95,62,2,48,41,85,76,85,91,11,4,18,24,71,25,27,57,81,80,62,4,18,72,8},new int[]{38,10,4,2,15,22,30,4,70,25,43,60,74,55,1,50,1,20,99,52,27,42,12,51,10,3,91,27,69,82,98,21,70,1,36},new int[]{11,38,88,76,14,36,99,12,60,88,12,30,57,95,77,4,74,43,20,3,15,30,26,91,88,21,96,31,22,65,79,32,38,97,20},new int[]{91,68,2,42,32,36,69,28,59,46,34,14,94,2,13,60,38,54,14,30,2,83,99,20,65,77,61,1,27,14,15,26,38,65,4},new int[]{94,68,94,65,13,26,89,89,27,10,22,34,32,84,91,6,97,95,53,88,53,77,54,35,61,52,29,25,88,35,73,83,95,13,11},new int[]{12,14,83,83,42,39,88,9,99,11,13,11,78,75,96,30,3,76,68,78,15,98,46,92,71,64,45,22,71,80,4,91,60,66,22},new int[]{10,29,19,7,13,42,4,98,67,72,47,42,54,72,3,6,58,55,12,96,62,46,83,78,22,16,98,36,25,92,67,32,11,15,2},new int[]{39,67,9,76,60,65,51,86,92,15,34,71,79,34,76,71,69,38,88,26,17,85,91,85,6,18,96,7,6,71,95,49,98,78,5},new int[]{89,10,38,46,2,86,85,95,58,25,7,14,61,61,82,75,78,32,28,84,74,64,1,2,99,54,29,8,67,29,96,95,76,83,94},new int[]{16,74,25,21,88,17,42,20,7,10,85,58,88,82,14,47,87,59,23,53,34,50,51,84,32,98,50,40,25,31,74,35,58,43,89},new int[]{5,35,15,66,10,31,80,97,78,68,70,1,30,19,73,2,61,77,37,72,59,3,97,99,16,68,24,35,33,60,28,17,11,27,92},new int[]{39,7,84,66,13,77,85,75,47,93,22,38,11,24,13,88,42,29,14,23,68,95,41,30,43,73,91,16,37,18,14,51,46,22,39},new int[]{23,80,42,44,50,99,71,76,57,68,10,39,4,25,24,53,15,31,64,84,50,87,61,3,34,82,81,4,59,35,7,46,32,20,56},new int[]{81,91,69,77,25,97,84,86,33,18,24,71,98,70,66,41,36,92,65,4,12,25,19,19,49,30,20,90,30,67,11,12,5,27,54},new int[]{36,75,39,62,33,96,58,29,40,24,58,25,78,3,30,99,26,82,62,77,62,81,14,34,26,29,13,34,65,21,99,61,33,24,12},new int[]{23,36,37,10,68,81,51,93,63,32,8,2,58,68,39,59,54,45,31,52,95,18,61,50,4,42,2,48,84,51,62,36,1,75,16},new int[]{51,30,65,41,21,92,69,37,82,90,94,83,58,69,15,70,76,53,26,33,68,21,7,29,57,75,23,49,54,14,85,93,45,3,66},new int[]{11,77,15,97,25,31,51,21,51,45,28,85,69,24,81,54,14,30,37,83,59,40,15,29,49,61,90,47,81,46,86,36,50,69,87},new int[]{37,31,92,34,89,71,27,44,82,49,16,10,66,50,66,83,61,7,16,13,56,84,87,71,84,25,92,2,24,53,44,14,30,58,51},new int[]{44,46,26,61,98,73,52,50,29,62,67,4,16,14,96,64,58,51,62,45,90,59,59,76,17,94,65,69,7,98,36,79,6,88,79},new int[]{31,74,85,47,10,66,82,98,24,16,63,86,6,15,96,33,45,6,39,8,23,83,46,11,35,26,1,41,10,11,45,65,49,49,14},new int[]{38,49,34,11,77,96,90,2,3,18,14,32,14,86,13,55,66,86,28,47,88,40,8,51,28,76,95,22,9,70,99,98,71,78,25},new int[]{59,83,92,82,62,79,88,91,65,45,82,96,99,72,63,35,89,96,93,83,11,89,33,3,54,62,71,65,67,71,69,30,79,6,16}});
param0.add(new int[][]{new int[]{93,31,15,23,44,84,3,83,86,47,93},new int[]{79,70,36,92,40,24,18,39,41,97,9},new int[]{11,36,96,6,22,15,34,56,34,68,34},new int[]{52,69,93,9,63,72,7,78,84,87,16},new int[]{53,5,78,45,85,29,33,32,34,93,78},new int[]{41,43,9,62,60,66,82,69,35,97,64},new int[]{34,33,87,61,11,92,47,56,60,85,3},new int[]{32,44,45,55,46,6,67,16,12,34,11},new int[]{24,47,38,60,54,10,71,86,75,86,4},new int[]{80,33,53,67,42,69,3,87,73,15,96},new int[]{22,38,56,60,17,44,73,96,75,3,27}});
param0.add(new int[][]{new int[]{65}});
List<Integer> param1 = new ArrayList<>();
param1.add(25);
param1.add(22);
param1.add(27);
param1.add(11);
param1.add(14);
param1.add(22);
param1.add(24);
param1.add(20);
param1.add(10);
param1.add(0);
List<Integer> param2 = new ArrayList<>();
param2.add(16);
param2.add(12);
param2.add(20);
param2.add(9);
param2.add(14);
param2.add(20);
param2.add(19);
param2.add(22);
param2.add(8);
param2.add(0);
for(int i =0; i < param0.size(); i+=2 ){
for(int j =0; j < param0.get(i).length; ++j ){
for(int k =0; k < param0.get(i)[j].length; ++k){
param0.get(i)[j][k]= param0.get(i)[j][k] %2 == 0 || param0.get(i)[j][k] % 3 == 0 ? 0 : param0.get(i)[j][k];
}
}
}
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 = [
([[79, 48, 59, 39, 33, 8, 8, 47, 45, 54, 35, 40, 70, 98, 70, 81, 48, 52, 74, 83, 67, 46, 14, 60, 47, 12], [95, 48, 3, 19, 14, 81, 2, 3, 72, 55, 5, 88, 98, 97, 75, 61, 42, 46, 49, 14, 20, 16, 9, 66, 21, 66], [98, 83, 30, 38, 55, 85, 23, 83, 32, 84, 5, 6, 76, 59, 12, 22, 33, 28, 36, 9, 2, 9, 18, 24, 65, 73], [58, 62, 97, 33, 65, 60, 11, 68, 52, 60, 54, 47, 82, 66, 16, 20, 75, 55, 38, 20, 24, 46, 11, 22, 1, 75], [3, 83, 28, 4, 72, 68, 64, 23, 94, 1, 3, 97, 46, 21, 47, 41, 23, 63, 1, 15, 24, 36, 71, 40, 87, 56], [87, 70, 71, 85, 10, 80, 33, 46, 87, 36, 16, 25, 15, 97, 13, 87, 87, 74, 37, 21, 37, 4, 99, 23, 31, 53], [37, 67, 88, 27, 27, 86, 32, 90, 65, 26, 93, 49, 91, 15, 13, 9, 96, 69, 56, 80, 87, 41, 91, 59, 46, 85], [65, 76, 25, 87, 63, 66, 39, 69, 8, 43, 67, 97, 94, 91, 99, 34, 71, 70, 95, 74, 88, 21, 42, 80, 16, 68], [48, 96, 30, 38, 71, 98, 72, 14, 43, 37, 38, 71, 37, 89, 51, 85, 27, 7, 20, 36, 96, 75, 76, 58, 50, 36], [77, 5, 4, 57, 52, 38, 62, 82, 49, 46, 36, 97, 70, 53, 83, 74, 74, 42, 72, 11, 88, 75, 11, 92, 40, 10], [72, 83, 15, 66, 57, 13, 85, 41, 9, 30, 67, 28, 1, 72, 92, 51, 76, 44, 52, 6, 74, 33, 31, 10, 71, 50], [42, 98, 1, 67, 51, 2, 18, 44, 14, 56, 4, 74, 34, 39, 50, 27, 48, 33, 67, 18, 12, 86, 32, 5, 90, 75], [90, 43, 82, 96, 38, 98, 79, 41, 78, 36, 3, 73, 74, 65, 74, 34, 85, 45, 77, 37, 89, 9, 86, 54, 10, 64], [53, 62, 86, 98, 61, 70, 18, 81, 57, 96, 65, 59, 12, 21, 96, 31, 16, 66, 13, 61, 31, 70, 43, 64, 84, 46], [53, 28, 98, 9, 34, 67, 46, 53, 57, 37, 85, 4, 29, 96, 59, 32, 45, 22, 52, 27, 66, 20, 57, 18, 97, 99], [32, 80, 33, 40, 8, 25, 13, 66, 26, 33, 30, 16, 37, 16, 93, 50, 58, 89, 87, 3, 26, 42, 56, 60, 81, 15], [46, 79, 18, 27, 8, 63, 81, 54, 19, 21, 3, 40, 86, 31, 18, 50, 11, 22, 80, 68, 60, 3, 82, 52, 30, 11], [48, 21, 33, 73, 88, 88, 15, 97, 46, 7, 33, 59, 91, 17, 80, 76, 58, 84, 10, 78, 93, 47, 3, 2, 17, 17], [67, 93, 87, 24, 28, 29, 20, 48, 26, 25, 25, 79, 47, 31, 10, 55, 48, 18, 59, 57, 89, 20, 14, 44, 34, 52], [87, 26, 22, 3, 40, 62, 64, 72, 52, 71, 11, 8, 79, 37, 28, 81, 21, 63, 90, 22, 74, 85, 26, 92, 57, 89], [80, 51, 54, 52, 35, 3, 13, 49, 36, 3, 12, 41, 91, 28, 29, 30, 40, 58, 73, 60, 95, 61, 52, 75, 91, 94], [90, 99, 20, 51, 37, 85, 46, 21, 62, 17, 16, 48, 61, 89, 79, 55, 5, 51, 88, 68, 38, 62, 42, 38, 16, 52], [95, 40, 54, 18, 67, 64, 52, 21, 52, 98, 84, 96, 48, 21, 34, 84, 18, 2, 47, 24, 78, 15, 10, 87, 88, 77], [89, 24, 15, 93, 26, 70, 3, 93, 64, 62, 85, 67, 6, 88, 66, 14, 19, 22, 33, 89, 91, 7, 1, 39, 37, 50], [40, 20, 50, 29, 3, 11, 66, 40, 11, 65, 13, 97, 87, 70, 1, 37, 25, 99, 81, 99, 95, 66, 88, 47, 54, 91], [36, 44, 14, 79, 81, 56, 56, 12, 7, 31, 74, 3, 18, 83, 27, 18, 75, 6, 46, 70, 69, 1, 95, 92, 12, 52]],25,16,),
([[67, 41, 95, 96, 46, 82, 5, 44, 41, 3, 55, 19, 1, 18, 59, 62, 56, 37, 60, 49, 5, 79, 68], [85, 12, 82, 41, 38, 52, 33, 75, 11, 46, 3, 21, 13, 93, 20, 42, 52, 95, 74, 69, 93, 1, 81], [95, 24, 13, 91, 41, 41, 85, 4, 98, 89, 97, 25, 13, 33, 18, 51, 54, 58, 24, 7, 33, 7, 65], [60, 17, 53, 18, 95, 76, 49, 84, 61, 35, 53, 48, 45, 88, 73, 51, 51, 8, 61, 97, 76, 15, 38], [30, 58, 80, 23, 72, 21, 10, 98, 40, 36, 54, 67, 79, 97, 94, 59, 86, 77, 93, 36, 77, 84, 5], [89, 42, 17, 26, 96, 26, 88, 89, 86, 21, 97, 39, 96, 57, 83, 24, 6, 85, 68, 12, 15, 92, 16], [45, 85, 17, 37, 50, 90, 60, 57, 3, 31, 32, 44, 66, 61, 32, 47, 2, 49, 38, 99, 21, 43, 95], [46, 50, 98, 39, 76, 81, 51, 16, 48, 63, 37, 54, 73, 30, 3, 41, 74, 61, 13, 4, 66, 92, 49], [25, 60, 8, 35, 12, 70, 77, 66, 35, 88, 40, 57, 38, 97, 31, 44, 6, 13, 3, 68, 28, 58, 72], [68, 78, 45, 66, 58, 8, 25, 90, 77, 1, 55, 60, 98, 54, 71, 60, 18, 86, 29, 48, 78, 75, 4], [56, 95, 41, 62, 43, 81, 32, 55, 95, 35, 61, 11, 34, 70, 27, 99, 59, 90, 27, 33, 71, 16, 35], [68, 16, 57, 90, 76, 38, 11, 75, 31, 81, 12, 62, 9, 3, 58, 51, 88, 25, 80, 72, 44, 14, 15], [99, 24, 44, 97, 54, 95, 80, 78, 12, 1, 86, 77, 27, 55, 54, 40, 65, 87, 6, 16, 14, 36, 87], [53, 8, 42, 68, 29, 57, 22, 34, 4, 87, 69, 56, 6, 81, 15, 83, 81, 31, 61, 7, 18, 2, 81], [26, 43, 12, 57, 23, 79, 80, 26, 70, 36, 33, 28, 27, 72, 97, 52, 13, 90, 45, 1, 44, 81, 38], [43, 82, 40, 76, 62, 67, 88, 72, 93, 2, 18, 87, 14, 1, 15, 88, 32, 39, 68, 31, 44, 54, 16], [99, 50, 21, 42, 96, 76, 40, 78, 48, 32, 66, 65, 10, 62, 39, 16, 41, 78, 59, 50, 50, 5, 83], [92, 92, 66, 22, 29, 40, 40, 16, 41, 61, 64, 13, 63, 76, 63, 10, 91, 12, 20, 88, 79, 54, 47], [61, 68, 76, 59, 98, 25, 18, 44, 3, 95, 61, 77, 12, 39, 79, 83, 92, 13, 75, 39, 6, 5, 65], [49, 12, 1, 19, 6, 19, 8, 86, 44, 61, 23, 88, 6, 52, 85, 67, 13, 74, 64, 46, 54, 96, 86], [2, 39, 65, 66, 43, 54, 6, 96, 27, 88, 90, 65, 26, 65, 23, 89, 26, 78, 76, 94, 37, 83, 3], [46, 32, 63, 18, 68, 16, 40, 27, 77, 56, 92, 52, 14, 6, 15, 3, 22, 48, 40, 51, 13, 95, 21], [28, 13, 95, 35, 18, 71, 3, 37, 46, 77, 61, 89, 52, 94, 46, 90, 59, 3, 19, 49, 79, 14, 49]],22,12,),
([[54, 80, 87, 13, 57, 54, 87, 86, 35, 80, 99, 77, 74, 67, 40, 17, 2, 58, 15, 68, 51, 81, 39, 80, 19, 51, 2, 90], [91, 30, 51, 84, 38, 71, 75, 65, 72, 14, 2, 93, 22, 1, 32, 18, 39, 41, 69, 18, 94, 21, 5, 12, 50, 10, 89, 85], [47, 9, 38, 92, 12, 34, 4, 35, 7, 80, 82, 20, 97, 74, 6, 41, 22, 60, 39, 84, 81, 73, 79, 73, 73, 36, 17, 6], [7, 58, 59, 11, 60, 12, 79, 26, 93, 56, 6, 87, 74, 91, 87, 6, 5, 35, 80, 73, 16, 81, 40, 92, 98, 30, 73, 39], [60, 35, 37, 72, 3, 55, 13, 47, 47, 87, 50, 33, 52, 15, 76, 10, 24, 24, 77, 62, 57, 66, 61, 28, 33, 40, 45, 65], [71, 80, 22, 56, 73, 49, 79, 4, 8, 73, 27, 16, 27, 35, 47, 36, 73, 19, 86, 37, 95, 73, 46, 57, 29, 19, 44, 9], [62, 34, 21, 35, 50, 13, 75, 34, 74, 12, 95, 30, 75, 30, 10, 48, 49, 8, 75, 31, 15, 95, 65, 86, 69, 4, 59, 46], [55, 27, 65, 56, 88, 34, 92, 9, 71, 38, 35, 64, 72, 19, 25, 82, 80, 77, 46, 33, 51, 55, 35, 74, 24, 76, 16, 14], [7, 7, 61, 69, 10, 36, 34, 91, 47, 37, 52, 23, 46, 16, 65, 85, 1, 85, 58, 61, 61, 15, 36, 62, 39, 88, 85, 35], [62, 81, 60, 3, 16, 7, 82, 42, 49, 99, 49, 10, 67, 87, 10, 33, 63, 71, 1, 33, 93, 98, 48, 58, 21, 26, 82, 47], [3, 5, 47, 13, 28, 79, 22, 51, 58, 41, 74, 52, 88, 43, 84, 70, 40, 24, 29, 83, 59, 23, 63, 58, 2, 32, 32, 81], [86, 20, 78, 78, 53, 93, 60, 99, 51, 87, 70, 30, 99, 16, 52, 14, 99, 21, 96, 48, 5, 86, 89, 48, 15, 79, 55, 57], [92, 16, 18, 8, 89, 97, 99, 62, 26, 58, 19, 25, 3, 87, 56, 45, 94, 76, 80, 23, 93, 56, 61, 63, 33, 5, 83, 91], [54, 92, 96, 19, 75, 7, 54, 70, 29, 40, 35, 11, 21, 41, 72, 65, 41, 60, 58, 58, 81, 11, 44, 32, 50, 71, 48, 58], [36, 34, 49, 92, 54, 31, 67, 69, 91, 4, 23, 34, 43, 5, 47, 66, 93, 20, 40, 19, 80, 57, 77, 24, 31, 21, 7, 20], [64, 55, 68, 71, 33, 93, 9, 44, 10, 50, 92, 24, 66, 88, 72, 92, 11, 55, 67, 33, 61, 29, 88, 76, 58, 14, 42, 34], [17, 23, 25, 42, 98, 72, 96, 14, 43, 38, 14, 96, 30, 93, 14, 86, 43, 17, 16, 57, 52, 22, 47, 63, 11, 76, 3, 39], [45, 3, 94, 41, 65, 72, 49, 18, 42, 81, 49, 8, 19, 8, 5, 47, 47, 71, 23, 13, 20, 62, 43, 44, 49, 61, 83, 97], [15, 97, 29, 80, 77, 46, 44, 71, 86, 75, 45, 76, 70, 44, 41, 68, 78, 76, 60, 13, 75, 37, 49, 34, 2, 94, 43, 86], [23, 12, 73, 12, 86, 62, 39, 61, 9, 26, 31, 73, 97, 48, 74, 10, 31, 55, 6, 39, 3, 80, 38, 48, 99, 35, 47, 93], [84, 75, 94, 3, 7, 20, 17, 77, 30, 36, 45, 68, 98, 73, 17, 29, 87, 69, 19, 38, 71, 86, 84, 36, 55, 51, 85, 44], [60, 12, 36, 49, 28, 96, 10, 20, 61, 87, 4, 68, 46, 19, 94, 49, 96, 96, 16, 69, 19, 51, 92, 59, 78, 2, 34, 40], [13, 54, 9, 18, 58, 3, 33, 77, 52, 93, 97, 12, 8, 71, 6, 69, 11, 71, 54, 6, 80, 64, 28, 82, 19, 98, 28, 46], [54, 68, 45, 43, 98, 63, 32, 70, 81, 32, 31, 39, 23, 32, 84, 87, 99, 91, 43, 97, 96, 42, 65, 98, 74, 5, 94, 88], [17, 29, 96, 93, 95, 20, 40, 37, 56, 74, 98, 15, 22, 83, 18, 75, 81, 99, 6, 27, 38, 29, 72, 57, 40, 26, 94, 49], [79, 96, 80, 43, 95, 44, 13, 62, 30, 10, 98, 65, 59, 46, 90, 56, 93, 38, 68, 40, 76, 19, 30, 20, 19, 80, 56, 5], [75, 90, 50, 89, 77, 6, 72, 68, 73, 94, 5, 21, 80, 36, 36, 88, 7, 49, 69, 16, 44, 78, 86, 59, 86, 49, 26, 33], [94, 79, 16, 65, 95, 4, 84, 59, 56, 78, 36, 5, 47, 40, 4, 17, 21, 17, 57, 27, 26, 35, 26, 1, 32, 13, 88, 72]],27,20,),
([[39, 82, 13, 38, 88, 30, 51, 34, 53, 58, 54, 87, 30, 72, 77, 48, 55, 34, 87], [70, 86, 28, 68, 52, 48, 78, 42, 68, 21, 27, 35, 41, 53, 76, 18, 39, 24, 61], [16, 38, 21, 46, 59, 52, 95, 97, 88, 90, 43, 83, 11, 25, 40, 18, 37, 47, 3], [53, 9, 6, 43, 54, 79, 86, 88, 68, 7, 79, 21, 70, 88, 77, 63, 90, 45, 64], [99, 16, 85, 5, 92, 38, 81, 26, 48, 18, 1, 43, 8, 59, 28, 47, 51, 31, 90], [4, 87, 14, 14, 97, 51, 81, 65, 25, 1, 22, 32, 46, 85, 90, 21, 85, 42, 44], [8, 96, 27, 63, 63, 65, 73, 66, 9, 54, 89, 93, 26, 72, 58, 71, 25, 67, 22], [76, 76, 64, 6, 24, 23, 29, 82, 7, 76, 93, 28, 54, 79, 47, 45, 53, 93, 24], [13, 30, 78, 6, 4, 21, 75, 30, 78, 42, 11, 19, 36, 4, 40, 35, 64, 19, 56], [61, 15, 99, 3, 59, 34, 15, 16, 3, 74, 70, 81, 11, 56, 24, 79, 31, 95, 30], [86, 49, 28, 58, 35, 14, 20, 83, 59, 88, 68, 16, 29, 74, 54, 64, 39, 89, 34], [79, 40, 23, 60, 79, 43, 88, 1, 21, 5, 51, 30, 20, 72, 63, 28, 56, 80, 2], [46, 70, 71, 17, 9, 12, 98, 70, 89, 72, 99, 25, 10, 9, 58, 67, 91, 97, 55], [84, 89, 11, 89, 91, 37, 34, 88, 35, 68, 92, 53, 90, 40, 12, 56, 16, 51, 32], [18, 89, 27, 59, 9, 86, 56, 35, 70, 5, 30, 5, 53, 42, 75, 63, 28, 14, 20], [21, 83, 86, 48, 24, 16, 5, 97, 65, 79, 51, 42, 2, 36, 2, 70, 64, 31, 19], [94, 81, 22, 39, 33, 76, 10, 41, 94, 25, 33, 15, 78, 17, 42, 53, 46, 69, 50], [45, 90, 30, 89, 62, 86, 37, 35, 8, 38, 64, 17, 6, 20, 92, 83, 84, 28, 41], [51, 97, 5, 17, 16, 93, 15, 74, 74, 98, 24, 25, 66, 71, 95, 44, 47, 39, 41]],11,9,),
([[45, 34, 40, 86, 92, 30, 11, 67, 66, 18, 30, 47, 69, 10, 98, 55, 85, 39, 46, 78], [49, 6, 79, 57, 39, 75, 91, 82, 91, 18, 86, 11, 46, 94, 96, 93, 31, 73, 98, 60], [40, 27, 52, 15, 85, 14, 9, 6, 47, 67, 46, 13, 29, 75, 53, 71, 80, 56, 88, 30], [36, 24, 45, 38, 71, 83, 10, 64, 26, 16, 31, 30, 33, 89, 69, 93, 59, 14, 19, 91], [23, 84, 17, 24, 58, 16, 79, 4, 84, 37, 91, 9, 15, 34, 52, 9, 24, 1, 81, 30], [34, 83, 45, 69, 25, 64, 16, 98, 87, 41, 68, 1, 17, 10, 81, 9, 87, 16, 48, 1], [26, 8, 59, 97, 5, 70, 41, 34, 95, 34, 92, 34, 76, 27, 83, 84, 90, 83, 39, 81], [58, 55, 22, 85, 45, 11, 27, 6, 71, 61, 97, 72, 78, 81, 93, 9, 21, 60, 96, 37], [2, 25, 36, 41, 31, 74, 4, 1, 70, 34, 45, 6, 19, 23, 5, 72, 48, 3, 66, 90], [37, 17, 39, 34, 86, 86, 49, 64, 89, 98, 23, 48, 76, 47, 34, 81, 77, 11, 67, 20], [6, 4, 27, 99, 14, 45, 92, 84, 63, 36, 50, 24, 98, 16, 81, 89, 94, 33, 13, 4], [51, 11, 25, 40, 65, 38, 4, 73, 67, 76, 81, 43, 87, 55, 28, 26, 49, 51, 97, 41], [10, 68, 99, 15, 59, 15, 1, 35, 8, 40, 58, 29, 36, 63, 51, 54, 41, 83, 92, 8], [26, 35, 58, 32, 90, 53, 11, 57, 43, 67, 9, 95, 98, 74, 29, 24, 8, 40, 83, 34], [46, 96, 63, 39, 20, 39, 69, 98, 23, 30, 29, 13, 24, 95, 72, 27, 18, 31, 78, 68], [15, 75, 63, 63, 95, 80, 19, 52, 10, 53, 88, 55, 94, 73, 85, 47, 85, 6, 80, 99], [67, 79, 6, 51, 9, 27, 54, 1, 69, 13, 39, 14, 64, 7, 85, 72, 90, 66, 87, 55], [55, 88, 18, 52, 43, 74, 81, 63, 6, 8, 62, 71, 28, 93, 4, 49, 75, 79, 66, 7], [34, 21, 47, 36, 76, 83, 10, 31, 91, 83, 12, 14, 43, 91, 51, 23, 45, 27, 66, 63], [96, 65, 87, 13, 87, 14, 33, 15, 79, 29, 14, 84, 77, 95, 47, 48, 44, 17, 78, 82]],14,14,),
([[42, 12, 11, 27, 59, 79, 58, 6, 82, 98, 65, 11, 95, 88, 36, 77, 61, 28, 50, 28, 70, 14, 95, 80, 20, 65, 34, 20, 88, 46, 82], [1, 96, 71, 86, 2, 9, 74, 20, 86, 87, 24, 96, 26, 21, 1, 69, 81, 31, 10, 37, 36, 39, 1, 27, 75, 69, 30, 36, 72, 28, 98], [18, 65, 21, 19, 89, 33, 81, 88, 43, 82, 73, 24, 95, 93, 47, 28, 17, 84, 14, 83, 26, 60, 11, 59, 10, 88, 15, 56, 70, 87, 6], [66, 16, 52, 35, 8, 58, 36, 40, 75, 53, 58, 99, 56, 22, 72, 14, 68, 44, 41, 64, 8, 50, 37, 36, 15, 19, 45, 15, 43, 53, 88], [73, 21, 71, 14, 86, 73, 13, 23, 69, 2, 31, 46, 92, 48, 21, 1, 90, 16, 38, 69, 86, 43, 49, 64, 6, 67, 78, 26, 55, 14, 57], [82, 84, 40, 95, 26, 69, 81, 37, 37, 83, 31, 49, 24, 25, 55, 95, 60, 16, 31, 51, 68, 54, 21, 67, 88, 72, 67, 88, 60, 43, 52], [44, 44, 36, 89, 17, 72, 6, 53, 12, 96, 46, 89, 63, 84, 33, 17, 61, 24, 53, 7, 51, 32, 98, 74, 86, 38, 31, 72, 95, 97, 81], [85, 45, 94, 87, 79, 71, 68, 12, 22, 58, 22, 85, 14, 7, 37, 88, 36, 92, 47, 34, 5, 72, 97, 54, 65, 46, 12, 66, 25, 46, 8], [58, 48, 97, 83, 67, 99, 28, 41, 80, 28, 94, 82, 76, 16, 59, 78, 65, 11, 28, 7, 95, 29, 58, 68, 14, 38, 47, 12, 69, 66, 18], [53, 14, 30, 70, 31, 44, 10, 1, 79, 76, 33, 79, 65, 54, 25, 96, 51, 80, 53, 66, 10, 42, 46, 57, 41, 39, 51, 13, 4, 28, 44], [54, 45, 31, 12, 11, 54, 5, 58, 36, 27, 84, 18, 78, 61, 49, 31, 31, 88, 10, 13, 19, 43, 28, 9, 34, 51, 17, 83, 15, 49, 62], [71, 83, 64, 18, 74, 48, 19, 52, 99, 50, 98, 49, 8, 73, 43, 85, 52, 19, 77, 83, 81, 43, 73, 63, 80, 45, 43, 80, 63, 6, 52], [47, 20, 16, 17, 59, 58, 56, 14, 39, 1, 66, 15, 76, 22, 23, 53, 97, 17, 76, 24, 66, 62, 46, 63, 87, 9, 31, 72, 14, 68, 50], [64, 94, 13, 2, 45, 48, 57, 13, 11, 31, 34, 7, 24, 90, 24, 66, 26, 61, 9, 15, 8, 28, 86, 76, 37, 4, 92, 35, 72, 93, 93], [58, 80, 95, 77, 7, 36, 55, 28, 37, 2, 85, 62, 43, 9, 46, 14, 29, 63, 16, 14, 40, 80, 94, 86, 32, 1, 45, 48, 43, 44, 47], [94, 14, 6, 63, 92, 78, 80, 77, 40, 19, 74, 67, 13, 14, 25, 74, 76, 76, 62, 25, 55, 23, 61, 98, 32, 39, 61, 86, 4, 47, 69], [20, 46, 96, 16, 79, 16, 86, 10, 30, 20, 25, 69, 74, 88, 15, 91, 74, 97, 2, 5, 13, 37, 92, 8, 99, 14, 46, 19, 19, 74, 67], [26, 34, 34, 85, 1, 51, 34, 55, 91, 6, 24, 45, 7, 94, 21, 77, 88, 14, 36, 59, 10, 26, 6, 33, 18, 40, 9, 13, 53, 42, 24], [46, 40, 59, 19, 6, 86, 68, 5, 55, 32, 75, 24, 8, 90, 1, 58, 83, 20, 23, 33, 5, 76, 13, 52, 87, 6, 35, 28, 2, 1, 94], [42, 82, 23, 86, 81, 20, 39, 5, 51, 50, 92, 87, 74, 50, 40, 87, 39, 9, 82, 71, 15, 81, 8, 99, 36, 16, 40, 8, 10, 74, 96], [5, 36, 89, 45, 15, 98, 24, 17, 30, 40, 27, 73, 31, 71, 56, 30, 92, 84, 18, 29, 22, 32, 41, 22, 54, 94, 87, 93, 78, 87, 75], [59, 94, 45, 80, 53, 46, 25, 43, 26, 66, 24, 35, 93, 77, 76, 88, 48, 63, 86, 59, 84, 12, 50, 91, 30, 51, 33, 95, 56, 91, 73], [90, 74, 86, 27, 96, 47, 7, 33, 42, 67, 94, 71, 10, 49, 19, 46, 49, 12, 91, 86, 43, 34, 87, 35, 71, 24, 10, 89, 6, 19, 48], [50, 66, 60, 59, 81, 36, 45, 77, 60, 2, 24, 89, 58, 34, 38, 90, 92, 63, 80, 85, 47, 1, 1, 35, 21, 11, 78, 39, 42, 65, 74], [1, 87, 40, 86, 74, 21, 38, 82, 16, 26, 8, 16, 44, 92, 83, 64, 79, 2, 75, 95, 40, 35, 57, 56, 55, 12, 59, 94, 94, 35, 94], [35, 64, 13, 52, 28, 88, 14, 55, 63, 81, 51, 1, 98, 97, 42, 13, 24, 33, 40, 85, 88, 4, 86, 63, 34, 82, 70, 42, 76, 57, 36], [82, 10, 12, 74, 92, 50, 4, 74, 42, 91, 76, 86, 97, 6, 92, 64, 83, 2, 64, 15, 59, 43, 24, 48, 95, 16, 36, 69, 21, 11, 88], [23, 19, 93, 9, 85, 70, 28, 44, 28, 79, 48, 78, 38, 24, 77, 41, 46, 73, 97, 50, 81, 7, 44, 66, 98, 7, 17, 99, 27, 98, 16], [98, 24, 28, 57, 76, 91, 95, 14, 27, 87, 68, 78, 75, 5, 61, 43, 86, 36, 1, 48, 11, 36, 92, 5, 4, 44, 32, 72, 18, 61, 82], [74, 52, 92, 80, 86, 94, 3, 63, 40, 42, 69, 93, 95, 57, 55, 88, 47, 23, 92, 24, 92, 16, 35, 73, 40, 76, 98, 25, 29, 18, 99], [54, 18, 49, 72, 31, 41, 51, 75, 72, 54, 76, 74, 42, 72, 63, 89, 4, 3, 19, 34, 63, 25, 93, 77, 45, 46, 5, 85, 30, 93, 18]],22,20,),
([[31, 83, 88, 14, 5, 89, 29, 61, 90, 20, 15, 11, 57, 68, 68, 11, 8, 72, 4, 96, 69, 42, 26, 96, 55, 42, 48, 89], [40, 32, 27, 51, 96, 95, 49, 46, 65, 66, 48, 71, 86, 96, 95, 51, 1, 50, 9, 65, 17, 35, 5, 63, 50, 53, 79, 46], [93, 89, 15, 91, 97, 99, 42, 74, 43, 90, 50, 41, 42, 41, 72, 51, 64, 28, 69, 81, 53, 64, 66, 44, 55, 72, 48, 79], [62, 71, 53, 27, 36, 9, 97, 5, 58, 99, 91, 90, 45, 50, 27, 67, 76, 83, 80, 58, 81, 46, 94, 56, 32, 46, 81, 10], [74, 60, 54, 4, 68, 71, 98, 4, 2, 96, 21, 48, 68, 21, 32, 82, 61, 63, 74, 27, 29, 15, 14, 38, 35, 87, 2, 62], [41, 71, 71, 83, 67, 39, 88, 38, 84, 65, 84, 84, 19, 11, 19, 75, 36, 98, 81, 19, 67, 3, 75, 41, 17, 29, 39, 86], [48, 58, 48, 48, 26, 84, 42, 94, 22, 89, 29, 59, 71, 53, 21, 30, 2, 17, 68, 42, 66, 97, 95, 64, 89, 52, 1, 62], [65, 64, 7, 14, 73, 61, 98, 8, 26, 55, 98, 72, 19, 22, 47, 61, 90, 86, 99, 82, 91, 18, 12, 45, 88, 77, 40, 53], [22, 19, 71, 37, 53, 90, 29, 28, 20, 14, 8, 98, 52, 59, 97, 22, 90, 83, 99, 94, 60, 75, 16, 83, 43, 53, 49, 88], [83, 71, 91, 80, 33, 91, 19, 23, 42, 21, 77, 80, 64, 67, 39, 12, 38, 87, 5, 1, 98, 52, 12, 73, 14, 48, 85, 68], [32, 34, 50, 56, 19, 81, 20, 17, 23, 32, 83, 56, 96, 87, 94, 88, 91, 21, 27, 10, 53, 57, 3, 80, 90, 72, 13, 25], [83, 78, 50, 75, 10, 50, 44, 86, 45, 27, 82, 63, 17, 99, 37, 99, 51, 27, 6, 20, 25, 15, 83, 53, 95, 14, 27, 36], [37, 59, 5, 5, 54, 95, 23, 26, 55, 77, 58, 63, 23, 88, 20, 83, 89, 11, 39, 80, 40, 75, 48, 26, 70, 93, 6, 6], [64, 69, 75, 19, 11, 23, 73, 83, 23, 53, 45, 10, 34, 6, 95, 52, 87, 20, 27, 90, 23, 83, 65, 21, 64, 48, 12, 38], [79, 9, 79, 55, 45, 30, 21, 52, 55, 31, 83, 17, 42, 68, 86, 55, 63, 49, 57, 16, 18, 5, 10, 96, 12, 52, 44, 51], [39, 29, 63, 29, 91, 23, 16, 41, 88, 1, 22, 43, 14, 43, 74, 84, 40, 53, 78, 85, 25, 88, 95, 18, 4, 69, 71, 69], [98, 52, 2, 83, 27, 24, 72, 22, 50, 24, 42, 39, 57, 89, 94, 90, 20, 63, 59, 71, 92, 64, 64, 9, 71, 95, 12, 42], [81, 10, 77, 3, 50, 2, 50, 52, 87, 83, 32, 80, 18, 15, 63, 16, 59, 44, 23, 14, 89, 14, 20, 93, 66, 22, 97, 36], [85, 87, 81, 24, 2, 41, 66, 56, 86, 31, 41, 79, 10, 49, 68, 18, 90, 50, 37, 18, 77, 48, 30, 77, 10, 41, 38, 90], [27, 4, 40, 48, 20, 70, 90, 81, 98, 41, 56, 2, 46, 57, 28, 21, 60, 60, 42, 89, 87, 90, 16, 58, 56, 76, 89, 36], [33, 9, 29, 18, 59, 89, 83, 54, 22, 11, 44, 9, 26, 91, 76, 36, 93, 73, 91, 89, 89, 1, 95, 61, 19, 65, 82, 57], [30, 78, 79, 87, 39, 53, 77, 49, 34, 1, 22, 74, 71, 77, 39, 25, 40, 91, 21, 69, 56, 40, 98, 65, 19, 60, 95, 43], [66, 4, 31, 83, 70, 97, 24, 72, 60, 73, 21, 47, 47, 19, 21, 6, 85, 61, 15, 93, 83, 45, 8, 29, 22, 34, 8, 51], [51, 96, 68, 8, 55, 48, 54, 62, 71, 29, 83, 95, 84, 5, 39, 96, 61, 87, 55, 47, 69, 93, 79, 1, 49, 75, 11, 34], [19, 60, 96, 25, 29, 36, 41, 92, 13, 28, 5, 58, 97, 76, 71, 89, 36, 89, 21, 32, 60, 31, 92, 53, 92, 1, 69, 22], [21, 47, 54, 12, 93, 11, 86, 4, 54, 25, 52, 84, 14, 86, 54, 19, 31, 38, 52, 24, 88, 16, 87, 45, 14, 97, 25, 81], [15, 92, 56, 70, 82, 14, 58, 46, 62, 61, 25, 16, 10, 35, 23, 18, 19, 8, 25, 80, 10, 18, 30, 63, 74, 56, 98, 20], [60, 17, 40, 74, 8, 64, 22, 37, 82, 10, 36, 27, 21, 30, 6, 78, 17, 60, 87, 42, 87, 9, 19, 33, 19, 20, 94, 18]],24,19,),
([[86, 39, 88, 64, 64, 37, 73, 80, 25, 79, 52, 51, 19, 48, 70, 73, 48, 63, 88, 16, 65, 48, 18, 28, 86, 68, 39, 5, 55, 72, 32, 80, 36, 99, 34], [48, 65, 65, 73, 63, 75, 55, 30, 69, 9, 72, 86, 91, 97, 40, 82, 5, 27, 81, 60, 14, 1, 26, 40, 66, 25, 90, 67, 99, 91, 72, 58, 90, 15, 32], [23, 80, 72, 57, 90, 2, 90, 95, 85, 57, 31, 8, 50, 43, 82, 6, 52, 75, 80, 62, 45, 2, 12, 63, 85, 70, 26, 16, 70, 81, 7, 32, 37, 94, 98], [15, 21, 54, 26, 33, 81, 87, 40, 92, 3, 85, 11, 78, 60, 22, 41, 52, 56, 59, 35, 32, 46, 52, 94, 7, 87, 37, 97, 93, 62, 28, 5, 49, 82, 22], [76, 57, 20, 20, 21, 61, 42, 5, 77, 98, 55, 66, 19, 93, 10, 63, 95, 65, 56, 79, 97, 53, 34, 6, 10, 40, 40, 31, 85, 64, 41, 69, 13, 87, 53], [6, 47, 51, 40, 50, 99, 74, 22, 81, 41, 4, 80, 4, 43, 91, 22, 21, 15, 63, 17, 34, 66, 39, 55, 36, 66, 97, 38, 55, 87, 18, 97, 31, 89, 65], [75, 45, 99, 54, 56, 42, 4, 40, 26, 96, 88, 36, 81, 33, 95, 53, 81, 39, 28, 25, 75, 8, 69, 40, 16, 30, 37, 78, 71, 31, 87, 42, 22, 36, 17], [40, 19, 21, 62, 43, 32, 10, 82, 99, 29, 95, 44, 95, 94, 16, 14, 1, 50, 32, 96, 88, 83, 15, 1, 84, 6, 45, 63, 14, 11, 83, 74, 76, 96, 53], [78, 42, 30, 64, 97, 13, 16, 42, 44, 61, 2, 67, 81, 11, 51, 80, 99, 2, 42, 54, 51, 51, 96, 3, 16, 49, 5, 44, 75, 56, 74, 48, 72, 43, 7], [30, 13, 90, 78, 1, 17, 42, 50, 87, 19, 86, 72, 78, 4, 86, 39, 8, 43, 49, 48, 19, 60, 27, 24, 74, 73, 13, 59, 32, 34, 55, 93, 24, 84, 56], [71, 81, 10, 4, 78, 71, 76, 75, 47, 17, 8, 27, 67, 21, 59, 79, 47, 26, 30, 40, 80, 44, 54, 37, 11, 9, 94, 73, 42, 82, 49, 19, 47, 75, 59], [59, 76, 5, 83, 49, 4, 17, 80, 90, 96, 52, 83, 24, 8, 81, 92, 32, 77, 76, 70, 34, 47, 63, 68, 15, 66, 20, 92, 55, 81, 77, 17, 8, 81, 73], [42, 41, 17, 73, 48, 41, 60, 14, 37, 36, 68, 95, 62, 2, 48, 41, 85, 76, 85, 91, 11, 4, 18, 24, 71, 25, 27, 57, 81, 80, 62, 4, 18, 72, 8], [38, 10, 4, 2, 15, 22, 30, 4, 70, 25, 43, 60, 74, 55, 1, 50, 1, 20, 99, 52, 27, 42, 12, 51, 10, 3, 91, 27, 69, 82, 98, 21, 70, 1, 36], [11, 38, 88, 76, 14, 36, 99, 12, 60, 88, 12, 30, 57, 95, 77, 4, 74, 43, 20, 3, 15, 30, 26, 91, 88, 21, 96, 31, 22, 65, 79, 32, 38, 97, 20], [91, 68, 2, 42, 32, 36, 69, 28, 59, 46, 34, 14, 94, 2, 13, 60, 38, 54, 14, 30, 2, 83, 99, 20, 65, 77, 61, 1, 27, 14, 15, 26, 38, 65, 4], [94, 68, 94, 65, 13, 26, 89, 89, 27, 10, 22, 34, 32, 84, 91, 6, 97, 95, 53, 88, 53, 77, 54, 35, 61, 52, 29, 25, 88, 35, 73, 83, 95, 13, 11], [12, 14, 83, 83, 42, 39, 88, 9, 99, 11, 13, 11, 78, 75, 96, 30, 3, 76, 68, 78, 15, 98, 46, 92, 71, 64, 45, 22, 71, 80, 4, 91, 60, 66, 22], [10, 29, 19, 7, 13, 42, 4, 98, 67, 72, 47, 42, 54, 72, 3, 6, 58, 55, 12, 96, 62, 46, 83, 78, 22, 16, 98, 36, 25, 92, 67, 32, 11, 15, 2], [39, 67, 9, 76, 60, 65, 51, 86, 92, 15, 34, 71, 79, 34, 76, 71, 69, 38, 88, 26, 17, 85, 91, 85, 6, 18, 96, 7, 6, 71, 95, 49, 98, 78, 5], [89, 10, 38, 46, 2, 86, 85, 95, 58, 25, 7, 14, 61, 61, 82, 75, 78, 32, 28, 84, 74, 64, 1, 2, 99, 54, 29, 8, 67, 29, 96, 95, 76, 83, 94], [16, 74, 25, 21, 88, 17, 42, 20, 7, 10, 85, 58, 88, 82, 14, 47, 87, 59, 23, 53, 34, 50, 51, 84, 32, 98, 50, 40, 25, 31, 74, 35, 58, 43, 89], [5, 35, 15, 66, 10, 31, 80, 97, 78, 68, 70, 1, 30, 19, 73, 2, 61, 77, 37, 72, 59, 3, 97, 99, 16, 68, 24, 35, 33, 60, 28, 17, 11, 27, 92], [39, 7, 84, 66, 13, 77, 85, 75, 47, 93, 22, 38, 11, 24, 13, 88, 42, 29, 14, 23, 68, 95, 41, 30, 43, 73, 91, 16, 37, 18, 14, 51, 46, 22, 39], [23, 80, 42, 44, 50, 99, 71, 76, 57, 68, 10, 39, 4, 25, 24, 53, 15, 31, 64, 84, 50, 87, 61, 3, 34, 82, 81, 4, 59, 35, 7, 46, 32, 20, 56], [81, 91, 69, 77, 25, 97, 84, 86, 33, 18, 24, 71, 98, 70, 66, 41, 36, 92, 65, 4, 12, 25, 19, 19, 49, 30, 20, 90, 30, 67, 11, 12, 5, 27, 54], [36, 75, 39, 62, 33, 96, 58, 29, 40, 24, 58, 25, 78, 3, 30, 99, 26, 82, 62, 77, 62, 81, 14, 34, 26, 29, 13, 34, 65, 21, 99, 61, 33, 24, 12], [23, 36, 37, 10, 68, 81, 51, 93, 63, 32, 8, 2, 58, 68, 39, 59, 54, 45, 31, 52, 95, 18, 61, 50, 4, 42, 2, 48, 84, 51, 62, 36, 1, 75, 16], [51, 30, 65, 41, 21, 92, 69, 37, 82, 90, 94, 83, 58, 69, 15, 70, 76, 53, 26, 33, 68, 21, 7, 29, 57, 75, 23, 49, 54, 14, 85, 93, 45, 3, 66], [11, 77, 15, 97, 25, 31, 51, 21, 51, 45, 28, 85, 69, 24, 81, 54, 14, 30, 37, 83, 59, 40, 15, 29, 49, 61, 90, 47, 81, 46, 86, 36, 50, 69, 87], [37, 31, 92, 34, 89, 71, 27, 44, 82, 49, 16, 10, 66, 50, 66, 83, 61, 7, 16, 13, 56, 84, 87, 71, 84, 25, 92, 2, 24, 53, 44, 14, 30, 58, 51], [44, 46, 26, 61, 98, 73, 52, 50, 29, 62, 67, 4, 16, 14, 96, 64, 58, 51, 62, 45, 90, 59, 59, 76, 17, 94, 65, 69, 7, 98, 36, 79, 6, 88, 79], [31, 74, 85, 47, 10, 66, 82, 98, 24, 16, 63, 86, 6, 15, 96, 33, 45, 6, 39, 8, 23, 83, 46, 11, 35, 26, 1, 41, 10, 11, 45, 65, 49, 49, 14], [38, 49, 34, 11, 77, 96, 90, 2, 3, 18, 14, 32, 14, 86, 13, 55, 66, 86, 28, 47, 88, 40, 8, 51, 28, 76, 95, 22, 9, 70, 99, 98, 71, 78, 25], [59, 83, 92, 82, 62, 79, 88, 91, 65, 45, 82, 96, 99, 72, 63, 35, 89, 96, 93, 83, 11, 89, 33, 3, 54, 62, 71, 65, 67, 71, 69, 30, 79, 6, 16]],20,22,),
([[93, 31, 15, 23, 44, 84, 3, 83, 86, 47, 93], [79, 70, 36, 92, 40, 24, 18, 39, 41, 97, 9], [11, 36, 96, 6, 22, 15, 34, 56, 34, 68, 34], [52, 69, 93, 9, 63, 72, 7, 78, 84, 87, 16], [53, 5, 78, 45, 85, 29, 33, 32, 34, 93, 78], [41, 43, 9, 62, 60, 66, 82, 69, 35, 97, 64], [34, 33, 87, 61, 11, 92, 47, 56, 60, 85, 3], [32, 44, 45, 55, 46, 6, 67, 16, 12, 34, 11], [24, 47, 38, 60, 54, 10, 71, 86, 75, 86, 4], [80, 33, 53, 67, 42, 69, 3, 87, 73, 15, 96], [22, 38, 56, 60, 17, 44, 73, 96, 75, 3, 27]],10,8,),
([[65]],0,0,)
]
for i, p_set in enumerate(param):
param[i] = list(param[i])
if i % 2 == 0:
param[i][0] = [[0 if e % 2 == 0 or e % 3 == 0 else e for e in l] for l in p_set[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))) | null |
COUNT_CHARACTERS_POSITION_ENGLISH_ALPHABETS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_CHARACTERS_POSITION_ENGLISH_ALPHABETS{
static int f_gold ( String str ) {
int result = 0 ;
for ( int i = 0 ;
i < str . length ( ) ;
i ++ ) {
if ( i == ( str . charAt ( i ) - 'a' ) || i == ( str . charAt ( i ) - 'A' ) ) {
result ++ ;
}
}
return result ;
}
| def f_gold ( str ) :
result = 0
for i in range ( len ( str ) ) :
if ( ( i == ord ( str [ i ] ) - ord ( 'a' ) ) or ( i == ord ( str [ i ] ) - ord ( 'A' ) ) ) :
result += 1
return result
|
using namespace std;
int f_gold ( string str ) {
int result = 0;
for ( int i = 0;
i < str . size ( );
i ++ ) if ( i == ( str [ i ] - 'a' ) || i == ( str [ i ] - 'A' ) ) result ++;
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("lLkhFeZGcb");
param0.add("ABcED");
param0.add("geeksforgeeks");
param0.add("Alphabetical");
param0.add("abababab");
param0.add("bcdefgxyz");
param0.add("cBzaqx L");
param0.add(" bcd");
param0.add("11");
param0.add("MqqKY");
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 = [
('lLkhFeZGcb',),
('ABcED',),
('geeksforgeeks',),
('Alphabetical',),
('abababab',),
('bcdefgxyz',),
('cBzaqx L',),
(' bcd',),
('11',),
('MqqKY',)
]
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 {"lLkhFeZGcb","ABcED","geeksforgeeks","Alphabetical","abababab","bcdefgxyz","cBzaqx L"," bcd","11","MqqKY"};
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;
} |
N_TH_TERM_SERIES_2_12_36_80_150 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class N_TH_TERM_SERIES_2_12_36_80_150{
public static int f_gold ( int n ) {
return ( n * n ) + ( n * n * n ) ;
}
| def f_gold ( n ) :
return ( n * n ) + ( n * n * n )
|
using namespace std;
int f_gold ( int n ) {
return ( n * n ) + ( n * n * n );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(90);
param0.add(95);
param0.add(22);
param0.add(29);
param0.add(62);
param0.add(40);
param0.add(52);
param0.add(21);
param0.add(33);
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 = [
(90,),
(95,),
(22,),
(29,),
(62,),
(40,),
(52,),
(21,),
(33,),
(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 {90,95,22,29,62,40,52,21,33,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;
} |
COUNT_STRINGS_ADJACENT_CHARACTERS_DIFFERENCE_ONE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_STRINGS_ADJACENT_CHARACTERS_DIFFERENCE_ONE{
static long f_gold ( int n ) {
long [ ] [ ] dp = new long [ n + 1 ] [ 27 ] ;
for ( int i = 0 ;
i < n + 1 ;
i ++ ) {
for ( int j = 0 ;
j < 27 ;
j ++ ) {
dp [ i ] [ j ] = 0 ;
}
}
for ( int i = 0 ;
i <= 25 ;
i ++ ) {
dp [ 1 ] [ i ] = 1 ;
}
for ( int i = 2 ;
i <= n ;
i ++ ) {
for ( int j = 0 ;
j <= 25 ;
j ++ ) {
if ( j == 0 ) {
dp [ i ] [ j ] = dp [ i - 1 ] [ j + 1 ] ;
}
else {
dp [ i ] [ j ] = ( dp [ i - 1 ] [ j - 1 ] + dp [ i - 1 ] [ j + 1 ] ) ;
}
}
}
long sum = 0 ;
for ( int i = 0 ;
i <= 25 ;
i ++ ) {
sum = ( sum + dp [ n ] [ i ] ) ;
}
return sum ;
}
| def f_gold ( n ) :
dp = [ [ 0 for j in range ( 27 ) ] for i in range ( n + 1 ) ]
for i in range ( 0 , 26 ) :
dp [ 1 ] [ i ] = 1
for i in range ( 2 , n + 1 ) :
for j in range ( 0 , 26 ) :
if ( j == 0 ) :
dp [ i ] [ j ] = dp [ i - 1 ] [ j + 1 ] ;
else :
dp [ i ] [ j ] = ( dp [ i - 1 ] [ j - 1 ] + dp [ i - 1 ] [ j + 1 ] )
sum = 0
for i in range ( 0 , 26 ) :
sum = sum + dp [ n ] [ i ]
return sum
|
using namespace std;
int f_gold ( int n ) {
long int dp [ n + 1 ] [ 27 ];
memset ( dp, 0, sizeof ( dp ) );
for ( int i = 0;
i <= 25;
i ++ ) dp [ 1 ] [ i ] = 1;
for ( int i = 2;
i <= n;
i ++ ) {
for ( int j = 0;
j <= 25;
j ++ ) if ( j == 0 ) dp [ i ] [ j ] = dp [ i - 1 ] [ j + 1 ];
else dp [ i ] [ j ] = ( dp [ i - 1 ] [ j - 1 ] + dp [ i - 1 ] [ j + 1 ] );
}
long int sum = 0;
for ( int i = 0;
i <= 25;
i ++ ) sum = ( sum + dp [ n ] [ i ] );
return sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(7);
param0.add(47);
param0.add(72);
param0.add(66);
param0.add(71);
param0.add(56);
param0.add(61);
param0.add(68);
param0.add(78);
param0.add(22);
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 = [
(7,),
(47,),
(72,),
(66,),
(71,),
(56,),
(61,),
(68,),
(78,),
(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<int> param0 {7,47,72,66,71,56,61,68,78,22};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
DIVISIBILITY_BY_7 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DIVISIBILITY_BY_7{
static boolean f_gold ( int num ) {
if ( num < 0 ) return f_gold ( - num ) ;
if ( num == 0 || num == 7 ) return true ;
if ( num < 10 ) return false ;
return f_gold ( num / 10 - 2 * ( num - num / 10 * 10 ) ) ;
}
| def f_gold ( num ) :
if num < 0 :
return f_gold ( - num )
if ( num == 0 or num == 7 ) :
return True
if ( num < 10 ) :
return False
return f_gold ( num / 10 - 2 * ( num - num / 10 * 10 ) )
|
using namespace std;
int f_gold ( int num ) {
if ( num < 0 ) return f_gold ( - num );
if ( num == 0 || num == 7 ) return 1;
if ( num < 10 ) return 0;
return f_gold ( num / 10 - 2 * ( num - num / 10 * 10 ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(0);
param0.add(-21);
param0.add(7);
param0.add(63);
param0.add(84);
param0.add(73);
param0.add(81);
param0.add(-10);
param0.add(47);
param0.add(23);
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 = [
(0,),
(-21,),
(7,),
(63,),
(84,),
(73,),
(81,),
(-10,),
(47,),
(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 {0,-21,7,63,84,73,81,-10,47,23};
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_OF_SUB_STRINGS_THAT_DO_NOT_CONTAIN_ALL_THE_CHARACTERS_FROM_THE_SET_A_B_C_AT_THE_SAME_TIME |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_OF_SUB_STRINGS_THAT_DO_NOT_CONTAIN_ALL_THE_CHARACTERS_FROM_THE_SET_A_B_C_AT_THE_SAME_TIME{
static int f_gold ( char str [ ] , int n ) {
int ans = ( n * ( n + 1 ) ) / 2 ;
int a_index = 0 ;
int b_index = 0 ;
int c_index = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( str [ i ] == 'a' ) {
a_index = i + 1 ;
ans -= Math . min ( b_index , c_index ) ;
}
else if ( str [ i ] == 'b' ) {
b_index = i + 1 ;
ans -= Math . min ( a_index , c_index ) ;
}
else {
c_index = i + 1 ;
ans -= Math . min ( a_index , b_index ) ;
}
}
return ans ;
}
| null |
using namespace std;
int f_gold ( char str [ ], int n ) {
int ans = ( n * ( n + 1 ) ) / 2;
int a_index = 0;
int b_index = 0;
int c_index = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( str [ i ] == 'a' ) {
a_index = i + 1;
ans -= min ( b_index, c_index );
}
else if ( str [ i ] == 'b' ) {
b_index = i + 1;
ans -= min ( a_index, c_index );
}
else {
c_index = i + 1;
ans -= min ( a_index, b_index );
}
}
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<char [ ]> param0 = new ArrayList<>();
param0.add(new char[]{'E','F','G','I','K','M','O','Q','Q','S','T','U','X','Z','a','b','c','d','e','f','h','h','i','j','l','m','s','s','t','x','y','y'});
param0.add(new char[]{'1','3','5','6','6','4','6','1','8','0','3','8','3','5','9','6','8','5','7','2','3','7','1','7','6','1','8','9','3','6','7','0','8','5','8','3','2','6','7','4','5','1','3','3','7','5','6'});
param0.add(new char[]{'0','0','0','0','0','0','0','1','1','1','1','1','1','1','1','1','1','1','1','1'});
param0.add(new char[]{'c','Z','s','F','v',' ','Y','e','u','I','P','y','j','o','n'});
param0.add(new char[]{'0','0','2','2','3','3','4','5','6','6','6','7','8','9'});
param0.add(new char[]{'0','1','0','1','1','1','1','0','0','0','1','1','0','0','0','0','0','0','1','1','1','1','0','1','0','1','1','1','1','1','0','0'});
param0.add(new char[]{'E','G','G','J','L','O','O','S','T','U','V','V','Y','c','d','e','f','g','g','j','m','n','p','q','q','r','u','u','x'});
param0.add(new char[]{'8','1','9','6','4','3','8','2','8','5','5','3','0','1','7','3','1','5','4','8','2','3','3','2','2','4','9','6','3','1','4','1','4','0','4','9','4','8','4','7'});
param0.add(new char[]{'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 char[]{'j','z','H','Q'});
List<Integer> param1 = new ArrayList<>();
param1.add(23);
param1.add(24);
param1.add(15);
param1.add(9);
param1.add(8);
param1.add(19);
param1.add(21);
param1.add(36);
param1.add(33);
param1.add(2);
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<char>> param0 {{'E','F','G','I','K','M','O','Q','Q','S','T','U','X','Z','a','b','c','d','e','f','h','h','i','j','l','m','s','s','t','x','y','y'},{'1','3','5','6','6','4','6','1','8','0','3','8','3','5','9','6','8','5','7','2','3','7','1','7','6','1','8','9','3','6','7','0','8','5','8','3','2','6','7','4','5','1','3','3','7','5','6'},{'0','0','0','0','0','0','0','1','1','1','1','1','1','1','1','1','1','1','1','1'},{'c','Z','s','F','v',' ','Y','e','u','I','P','y','j','o','n'},{'0','0','2','2','3','3','4','5','6','6','6','7','8','9'},{'0','1','0','1','1','1','1','0','0','0','1','1','0','0','0','0','0','0','1','1','1','1','0','1','0','1','1','1','1','1','0','0'},{'E','G','G','J','L','O','O','S','T','U','V','V','Y','c','d','e','f','g','g','j','m','n','p','q','q','r','u','u','x'},{'8','1','9','6','4','3','8','2','8','5','5','3','0','1','7','3','1','5','4','8','2','3','3','2','2','4','9','6','3','1','4','1','4','0','4','9','4','8','4','7'},{'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'},{'j','z','H','Q'}};
vector<int> param1 {23,24,15,9,8,19,21,36,33,2};
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;
} |
MODULUS_TWO_FLOAT_DOUBLE_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MODULUS_TWO_FLOAT_DOUBLE_NUMBERS{
static double f_gold ( double a , double b ) {
if ( a < 0 ) a = - a ;
if ( b < 0 ) b = - b ;
double mod = a ;
while ( mod >= b ) mod = mod - b ;
if ( a < 0 ) return - mod ;
return mod ;
}
| def f_gold ( a , b ) :
if ( a < 0 ) :
a = - a
if ( b < 0 ) :
b = - b
mod = a
while ( mod >= b ) :
mod = mod - b
if ( a < 0 ) :
return - mod
return mod
|
using namespace std;
double f_gold ( double a, double b ) {
double mod;
if ( a < 0 ) mod = - a;
else mod = a;
if ( b < 0 ) b = - b;
while ( mod >= b ) mod = mod - b;
if ( a < 0 ) return - mod;
return mod;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Double> param0 = new ArrayList<>();
param0.add(3243.229719038493);
param0.add(-4362.665881044217);
param0.add(7255.066257575837);
param0.add(-6929.554320261099);
param0.add(3569.942027998315);
param0.add(-6513.849053096595);
param0.add(7333.183189243961);
param0.add(-2856.1752826258803);
param0.add(9787.228111241662);
param0.add(-1722.873699288031);
List<Double> param1 = new ArrayList<>();
param1.add(5659.926861939672);
param1.add(-9196.507113304497);
param1.add(2623.200060506935);
param1.add(-3009.0234530313287);
param1.add(6920.809419868375);
param1.add(-70.95992406437102);
param1.add(580.3500610971768);
param1.add(-9625.97442825802);
param1.add(2419.6844962423256);
param1.add(-8370.700544254058);
for(int i = 0; i < param0.size(); ++i)
{
if(Math.abs(1 - (0.0000001 + Math.abs(f_gold(param0.get(i),param1.get(i))) )/ (Math.abs(f_filled(param0.get(i),param1.get(i))) + 0.0000001)) < 0.001)
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
(3243.229719038493,5659.926861939672,),
(-4362.665881044217,-9196.507113304497,),
(7255.066257575837,2623.200060506935,),
(-6929.554320261099,-3009.0234530313287,),
(3569.942027998315,6920.809419868375,),
(-6513.849053096595,-70.95992406437102,),
(7333.183189243961,580.3500610971768,),
(-2856.1752826258803,-9625.97442825802,),
(9787.228111241662,2419.6844962423256,),
(-1722.873699288031,-8370.700544254058,)
]
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 {3243.229719038493,-4362.665881044217,7255.066257575837,-6929.554320261099,3569.942027998315,-6513.849053096595,7333.183189243961,-2856.1752826258803,9787.228111241662,-1722.873699288031};
vector<double> param1 {5659.926861939672,-9196.507113304497,2623.200060506935,-3009.0234530313287,6920.809419868375,-70.95992406437102,580.3500610971768,-9625.97442825802,2419.6844962423256,-8370.700544254058};
for(int i = 0; i < param0.size(); ++i)
{
if(abs(1 - (0.0000001 + abs(f_gold(param0[i],param1[i])) )/ (abs(f_filled(param0[i],param1[i])) + 0.0000001)) < 0.001)
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
FIND_THREE_ELEMENT_FROM_DIFFERENT_THREE_ARRAYS_SUCH_THAT_THAT_A_B_C_K |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THREE_ELEMENT_FROM_DIFFERENT_THREE_ARRAYS_SUCH_THAT_THAT_A_B_C_K{
static boolean f_gold ( int a1 [ ] , int a2 [ ] , int a3 [ ] , int n1 , int n2 , int n3 , int sum ) {
for ( int i = 0 ;
i < n1 ;
i ++ ) for ( int j = 0 ;
j < n2 ;
j ++ ) for ( int k = 0 ;
k < n3 ;
k ++ ) if ( a1 [ i ] + a2 [ j ] + a3 [ k ] == sum ) return true ;
return false ;
}
| def f_gold ( a1 , a2 , a3 , n1 , n2 , n3 , sum ) :
for i in range ( 0 , n1 ) :
for j in range ( 0 , n2 ) :
for k in range ( 0 , n3 ) :
if ( a1 [ i ] + a2 [ j ] + a3 [ k ] == sum ) :
return True
return False
|
using namespace std;
bool f_gold ( int a1 [ ], int a2 [ ], int a3 [ ], int n1, int n2, int n3, int sum ) {
for ( int i = 0;
i < n1;
i ++ ) for ( int j = 0;
j < n2;
j ++ ) for ( int k = 0;
k < n3;
k ++ ) if ( a1 [ i ] + a2 [ j ] + a3 [ k ] == sum ) return true;
return false;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,9,10,19,24,25,26,30,36,43,44,49,52,62,66,69,72,77,80,80,82,84,90,93,94,98});
param0.add(new int[]{-24,-80,-72,80,-96,-94,64,18,12,16,74,16,54,66,-96,-90,54,72,-32,-2,90,-18,-98,12,-42,-30,-82,-56,-86,40});
param0.add(new int[]{0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{28,15,21,28,85,68,24});
param0.add(new int[]{-86,-82,-66,-44,-44,-38,-22,-6,-2,14,26,40,54,58,60,66,72,80,94,96,98});
param0.add(new int[]{1,1,1,0,1,1,1,0,0,1,1,1,1,0,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0,0,1,0,1});
param0.add(new int[]{44,53,85,85,86,88,93});
param0.add(new int[]{70,-38,62,-34,74,-32,-58,-34,-54});
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[]{41,64,39,96,54,54,57,4,82,43,44,56,1});
List<int [ ]> param1 = new ArrayList<>();
param1.add(new int[]{4,8,17,20,22,25,27,30,31,33,35,35,38,41,49,51,60,61,66,67,69,82,84,85,86,88});
param1.add(new int[]{30,-60,-24,18,40,44,-40,62,66,-38,50,-74,-42,-86,-82,-8,50,-72,-2,-48,-38,-20,-8,56,-32,68,94,80,-48,0});
param1.add(new int[]{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1});
param1.add(new int[]{57,46,47,49,16,81,60});
param1.add(new int[]{-96,-86,-74,-56,-52,-42,-32,-22,-16,-10,-4,-4,10,42,48,52,58,62,84,90,96});
param1.add(new int[]{0,1,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,1,0,1});
param1.add(new int[]{4,5,8,15,29,40,91});
param1.add(new int[]{48,-86,-18,14,88,92,-56,-8,-74});
param1.add(new int[]{0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1});
param1.add(new int[]{44,58,40,87,22,82,8,81,88,42,15,14,81});
List<int [ ]> param2 = new ArrayList<>();
param2.add(new int[]{12,14,17,20,22,27,29,31,32,38,41,43,56,59,59,64,66,67,68,69,71,76,83,83,85,99});
param2.add(new int[]{-24,80,50,-56,-92,20,86,-42,-30,96,40,-32,-64,54,-38,-72,-70,54,-28,98,60,98,-12,-30,-30,68,-66,68,-58,52});
param2.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1});
param2.add(new int[]{76,49,6,44,71,24,57});
param2.add(new int[]{-92,-92,-90,-82,-62,-44,-42,-40,-38,-36,-22,-20,-8,12,22,26,30,44,54,64,86});
param2.add(new int[]{1,0,1,0,0,0,1,1,1,0,1,1,1,0,0,0,1,1,0,0,1,1,1,0,1,0,0,0,0,1,1,1,0,0});
param2.add(new int[]{30,53,71,75,76,82,84});
param2.add(new int[]{8,8,32,76,76,94,22,-60,-42});
param2.add(new int[]{0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1});
param2.add(new int[]{64,20,24,42,37,46,6,47,12,93,8,5,11});
List<Integer> param3 = new ArrayList<>();
param3.add(25);
param3.add(26);
param3.add(14);
param3.add(6);
param3.add(13);
param3.add(25);
param3.add(5);
param3.add(6);
param3.add(15);
param3.add(7);
List<Integer> param4 = new ArrayList<>();
param4.add(18);
param4.add(22);
param4.add(14);
param4.add(5);
param4.add(20);
param4.add(25);
param4.add(3);
param4.add(6);
param4.add(14);
param4.add(8);
List<Integer> param5 = new ArrayList<>();
param5.add(16);
param5.add(20);
param5.add(14);
param5.add(5);
param5.add(17);
param5.add(23);
param5.add(4);
param5.add(6);
param5.add(10);
param5.add(6);
List<Integer> param6 = new ArrayList<>();
param6.add(222);
param6.add(21);
param6.add(2);
param6.add(73);
param6.add(6);
param6.add(0);
param6.add(3);
param6.add(7);
param6.add(13);
param6.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),param4.get(i),param5.get(i),param6.get(i)) == f_gold(param0.get(i),param1.get(i),param2.get(i),param3.get(i),param4.get(i),param5.get(i),param6.get(i)))
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([4, 9, 10, 19, 24, 25, 26, 30, 36, 43, 44, 49, 52, 62, 66, 69, 72, 77, 80, 80, 82, 84, 90, 93, 94, 98],[4, 8, 17, 20, 22, 25, 27, 30, 31, 33, 35, 35, 38, 41, 49, 51, 60, 61, 66, 67, 69, 82, 84, 85, 86, 88],[12, 14, 17, 20, 22, 27, 29, 31, 32, 38, 41, 43, 56, 59, 59, 64, 66, 67, 68, 69, 71, 76, 83, 83, 85, 99],25,18,16,222,),
([-24, -80, -72, 80, -96, -94, 64, 18, 12, 16, 74, 16, 54, 66, -96, -90, 54, 72, -32, -2, 90, -18, -98, 12, -42, -30, -82, -56, -86, 40],[30, -60, -24, 18, 40, 44, -40, 62, 66, -38, 50, -74, -42, -86, -82, -8, 50, -72, -2, -48, -38, -20, -8, 56, -32, 68, 94, 80, -48, 0],[-24, 80, 50, -56, -92, 20, 86, -42, -30, 96, 40, -32, -64, 54, -38, -72, -70, 54, -28, 98, 60, 98, -12, -30, -30, 68, -66, 68, -58, 52],26,22,20,21,),
([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, 1, 1, 1, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1],14,14,14,2,),
([28, 15, 21, 28, 85, 68, 24],[57, 46, 47, 49, 16, 81, 60],[76, 49, 6, 44, 71, 24, 57],6,5,5,73,),
([-86, -82, -66, -44, -44, -38, -22, -6, -2, 14, 26, 40, 54, 58, 60, 66, 72, 80, 94, 96, 98],[-96, -86, -74, -56, -52, -42, -32, -22, -16, -10, -4, -4, 10, 42, 48, 52, 58, 62, 84, 90, 96],[-92, -92, -90, -82, -62, -44, -42, -40, -38, -36, -22, -20, -8, 12, 22, 26, 30, 44, 54, 64, 86],13,20,17,6,),
([1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1],[0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1],[1, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0],25,25,23,0,),
([44, 53, 85, 85, 86, 88, 93],[4, 5, 8, 15, 29, 40, 91],[30, 53, 71, 75, 76, 82, 84],5,3,4,3,),
([70, -38, 62, -34, 74, -32, -58, -34, -54],[48, -86, -18, 14, 88, 92, -56, -8, -74],[8, 8, 32, 76, 76, 94, 22, -60, -42],6,6,6,7,),
([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, 1, 1, 1, 1, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1],15,14,10,13,),
([41, 64, 39, 96, 54, 54, 57, 4, 82, 43, 44, 56, 1],[44, 58, 40, 87, 22, 82, 8, 81, 88, 42, 15, 14, 81],[64, 20, 24, 42, 37, 46, 6, 47, 12, 93, 8, 5, 11],7,8,6,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 {{4,9,10,19,24,25,26,30,36,43,44,49,52,62,66,69,72,77,80,80,82,84,90,93,94,98},{-24,-80,-72,80,-96,-94,64,18,12,16,74,16,54,66,-96,-90,54,72,-32,-2,90,-18,-98,12,-42,-30,-82,-56,-86,40},{0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1},{28,15,21,28,85,68,24},{-86,-82,-66,-44,-44,-38,-22,-6,-2,14,26,40,54,58,60,66,72,80,94,96,98},{1,1,1,0,1,1,1,0,0,1,1,1,1,0,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,0,0,1,0,1},{44,53,85,85,86,88,93},{70,-38,62,-34,74,-32,-58,-34,-54},{0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1},{41,64,39,96,54,54,57,4,82,43,44,56,1}};
vector<vector<int>> param1 {{4,8,17,20,22,25,27,30,31,33,35,35,38,41,49,51,60,61,66,67,69,82,84,85,86,88},{30,-60,-24,18,40,44,-40,62,66,-38,50,-74,-42,-86,-82,-8,50,-72,-2,-48,-38,-20,-8,56,-32,68,94,80,-48,0},{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1},{57,46,47,49,16,81,60},{-96,-86,-74,-56,-52,-42,-32,-22,-16,-10,-4,-4,10,42,48,52,58,62,84,90,96},{0,1,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,1,0,1,1,0,1,0,1},{4,5,8,15,29,40,91},{48,-86,-18,14,88,92,-56,-8,-74},{0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{44,58,40,87,22,82,8,81,88,42,15,14,81}};
vector<vector<int>> param2 {{12,14,17,20,22,27,29,31,32,38,41,43,56,59,59,64,66,67,68,69,71,76,83,83,85,99},{-24,80,50,-56,-92,20,86,-42,-30,96,40,-32,-64,54,-38,-72,-70,54,-28,98,60,98,-12,-30,-30,68,-66,68,-58,52},{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1},{76,49,6,44,71,24,57},{-92,-92,-90,-82,-62,-44,-42,-40,-38,-36,-22,-20,-8,12,22,26,30,44,54,64,86},{1,0,1,0,0,0,1,1,1,0,1,1,1,0,0,0,1,1,0,0,1,1,1,0,1,0,0,0,0,1,1,1,0,0},{30,53,71,75,76,82,84},{8,8,32,76,76,94,22,-60,-42},{0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1},{64,20,24,42,37,46,6,47,12,93,8,5,11}};
vector<int> param3 {25,26,14,6,13,25,5,6,15,7};
vector<int> param4 {18,22,14,5,20,25,3,6,14,8};
vector<int> param5 {16,20,14,5,17,23,4,6,10,6};
vector<int> param6 {222,21,2,73,6,0,3,7,13,10};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),¶m1[i].front(),¶m2[i].front(),param3[i],param4[i],param5[i],param6[i]) == f_gold(¶m0[i].front(),¶m1[i].front(),¶m2[i].front(),param3[i],param4[i],param5[i],param6[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
FIND_UNIT_DIGIT_X_RAISED_POWER_Y_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_UNIT_DIGIT_X_RAISED_POWER_Y_1{
static int f_gold ( int x , int y ) {
x = x % 10 ;
if ( y != 0 ) y = y % 4 + 4 ;
return ( ( ( int ) ( Math . pow ( x , y ) ) ) % 10 ) ;
}
| import math
def f_gold ( x , y ) :
x = x % 10
if y != 0 :
y = y % 4 + 4
return ( ( ( int ) ( math.pow ( x , y ) ) ) % 10 )
|
using namespace std;
int f_gold ( int x, int y ) {
x = x % 10;
if ( y != 0 ) y = y % 4 + 4;
return ( ( ( int ) ( pow ( x, y ) ) ) % 10 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(37);
param0.add(70);
param0.add(26);
param0.add(9);
param0.add(82);
param0.add(95);
param0.add(43);
param0.add(7);
param0.add(19);
param0.add(49);
List<Integer> param1 = new ArrayList<>();
param1.add(17);
param1.add(52);
param1.add(23);
param1.add(96);
param1.add(71);
param1.add(36);
param1.add(40);
param1.add(27);
param1.add(56);
param1.add(28);
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 = [
(37,17,),
(70,52,),
(26,23,),
(9,96,),
(82,71,),
(95,36,),
(43,40,),
(7,27,),
(19,56,),
(49,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<int> param0 {37,70,26,9,82,95,43,7,19,49};
vector<int> param1 {17,52,23,96,71,36,40,27,56,28};
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_NUMBER_2X2_SQUARES_CAN_FIT_INSIDE_RIGHT_ISOSCELES_TRIANGLE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_NUMBER_2X2_SQUARES_CAN_FIT_INSIDE_RIGHT_ISOSCELES_TRIANGLE{
public static int f_gold ( int base ) {
base = ( base - 2 ) ;
base = base / 2 ;
return base * ( base + 1 ) / 2 ;
}
| def f_gold ( base ) :
base = ( base - 2 )
base = base / 2
return base * ( base + 1 ) / 2
|
using namespace std;
int f_gold ( int base ) {
base = ( base - 2 );
base = base / 2;
return base * ( base + 1 ) / 2;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(95);
param0.add(49);
param0.add(10);
param0.add(73);
param0.add(74);
param0.add(40);
param0.add(10);
param0.add(94);
param0.add(64);
param0.add(16);
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 = [
(95,),
(49,),
(10,),
(73,),
(74,),
(40,),
(10,),
(94,),
(64,),
(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 {95,49,10,73,74,40,10,94,64,16};
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;
} |
PRIMALITY_TEST_SET_5USING_LUCAS_LEHMER_SERIES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PRIMALITY_TEST_SET_5USING_LUCAS_LEHMER_SERIES{
static boolean f_gold ( int p ) {
double checkNumber = Math . pow ( 2 , p ) - 1 ;
double nextval = 4 % checkNumber ;
for ( int i = 1 ;
i < p - 1 ;
i ++ ) nextval = ( nextval * nextval - 2 ) % checkNumber ;
return ( nextval == 0 ) ;
}
| def f_gold ( p ) :
checkNumber = 2 ** p - 1
nextval = 4 % checkNumber
for i in range ( 1 , p - 1 ) :
nextval = ( nextval * nextval - 2 ) % checkNumber
if ( nextval == 0 ) : return True
else : return False
|
using namespace std;
bool f_gold ( int p ) {
long long checkNumber = pow ( 2, p ) - 1;
long long nextval = 4 % checkNumber;
for ( int i = 1;
i < p - 1;
i ++ ) nextval = ( nextval * nextval - 2 ) % checkNumber;
return ( nextval == 0 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(11);
param0.add(27);
param0.add(31);
param0.add(47);
param0.add(3);
param0.add(14);
param0.add(41);
param0.add(72);
param0.add(39);
param0.add(22);
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 = [
(11,),
(27,),
(31,),
(47,),
(3,),
(14,),
(41,),
(72,),
(39,),
(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<int> param0 {11,27,31,47,3,14,41,72,39,22};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
MINIMUM_SUM_CHOOSING_MINIMUM_PAIRS_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_SUM_CHOOSING_MINIMUM_PAIRS_ARRAY{
static int f_gold ( int [ ] A , int n ) {
int min_val = Arrays . stream ( A ) . min ( ) . getAsInt ( ) ;
return ( min_val * ( n - 1 ) ) ;
}
| null |
using namespace std;
int f_gold ( int A [ ], int n ) {
int min_val = * min_element ( A, A + n );
return ( min_val * ( n - 1 ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,9,10,13,13,15,16,16,17,18,18,23,24,24,25,25,25,32,32,36,38,39,40,40,40,41,43,48,51,56,59,60,70,72,74,76,79,83,83,85,88,90,92,94,95,95});
param0.add(new int[]{46,-10,56,46,-30,-68,50,8,72,-2,38,-12,20,-30,-38,-78,-18,-34,16,94,30,-86,36,88,-26,-56,-98,-92,96,-70,-78,-60,20,-54,36,-12,78,24,14,98,-14,-88,76,12});
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});
param0.add(new int[]{59,64,29,99,29,63,29,63,88,94,82,92,99,56,51,74,73,22,42,37,21,36,68,69,16,81,3,85,67,13,41,87,67,99,83,47,95,90,24,31,1,54,61,35,51,13});
param0.add(new int[]{-98,-92,-82,-78,-76,-72,-64,-60,-44,-28,-22,-22,-14,-12,2,2,4,6,10,14,16,24,28,28,32,34,36,46,46,48,52,60,62,66,68,72,74,84,96});
param0.add(new int[]{1,1,1,1,1,0,1});
param0.add(new int[]{5,20,34,37,51,55,89});
param0.add(new int[]{-70,78,-52,-82,-24,96,-32,8,-50,38,-76,-56,64,-28,-22,94,52,-32,66,-34,-30,14,42,98,96,-56,50,50,-24,-56,70,6,78,86,52,-40,92,46,46,-14,-74,40});
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,1,1,1});
param0.add(new int[]{51,42,29,30,65,42,7,2,90,85,1,47,79,98,90,66,47,54,32,83});
List<Integer> param1 = new ArrayList<>();
param1.add(26);
param1.add(25);
param1.add(32);
param1.add(45);
param1.add(31);
param1.add(6);
param1.add(3);
param1.add(33);
param1.add(26);
param1.add(19);
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 {{4,9,10,13,13,15,16,16,17,18,18,23,24,24,25,25,25,32,32,36,38,39,40,40,40,41,43,48,51,56,59,60,70,72,74,76,79,83,83,85,88,90,92,94,95,95},{46,-10,56,46,-30,-68,50,8,72,-2,38,-12,20,-30,-38,-78,-18,-34,16,94,30,-86,36,88,-26,-56,-98,-92,96,-70,-78,-60,20,-54,36,-12,78,24,14,98,-14,-88,76,12},{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},{59,64,29,99,29,63,29,63,88,94,82,92,99,56,51,74,73,22,42,37,21,36,68,69,16,81,3,85,67,13,41,87,67,99,83,47,95,90,24,31,1,54,61,35,51,13},{-98,-92,-82,-78,-76,-72,-64,-60,-44,-28,-22,-22,-14,-12,2,2,4,6,10,14,16,24,28,28,32,34,36,46,46,48,52,60,62,66,68,72,74,84,96},{1,1,1,1,1,0,1},{5,20,34,37,51,55,89},{-70,78,-52,-82,-24,96,-32,8,-50,38,-76,-56,64,-28,-22,94,52,-32,66,-34,-30,14,42,98,96,-56,50,50,-24,-56,70,6,78,86,52,-40,92,46,46,-14,-74,40},{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},{51,42,29,30,65,42,7,2,90,85,1,47,79,98,90,66,47,54,32,83}};
vector<int> param1 {26,25,32,45,31,6,3,33,26,19};
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;
} |
SEQUENCES_GIVEN_LENGTH_EVERY_ELEMENT_EQUAL_TWICE_PREVIOUS_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SEQUENCES_GIVEN_LENGTH_EVERY_ELEMENT_EQUAL_TWICE_PREVIOUS_1{
static int f_gold ( int m , int n ) {
int T [ ] [ ] = new int [ m + 1 ] [ n + 1 ] ;
for ( int i = 0 ;
i < m + 1 ;
i ++ ) {
for ( int j = 0 ;
j < n + 1 ;
j ++ ) {
if ( i == 0 || j == 0 ) T [ i ] [ j ] = 0 ;
else if ( i < j ) T [ i ] [ j ] = 0 ;
else if ( j == 1 ) T [ i ] [ j ] = i ;
else T [ i ] [ j ] = T [ i - 1 ] [ j ] + T [ i / 2 ] [ j - 1 ] ;
}
}
return T [ m ] [ n ] ;
}
| def f_gold ( m , n ) :
T = [ [ 0 for i in range ( n + 1 ) ] for i in range ( m + 1 ) ]
for i in range ( m + 1 ) :
for j in range ( n + 1 ) :
if i == 0 or j == 0 :
T [ i ] [ j ] = 0
elif i < j :
T [ i ] [ j ] = 0
elif j == 1 :
T [ i ] [ j ] = i
else :
T [ i ] [ j ] = T [ i - 1 ] [ j ] + T [ i // 2 ] [ j - 1 ]
return T [ m ] [ n ]
|
using namespace std;
int f_gold ( int m, int n ) {
int T [ m + 1 ] [ n + 1 ];
for ( int i = 0;
i < m + 1;
i ++ ) {
for ( int j = 0;
j < n + 1;
j ++ ) {
if ( i == 0 || j == 0 ) T [ i ] [ j ] = 0;
else if ( i < j ) T [ i ] [ j ] = 0;
else if ( j == 1 ) T [ i ] [ j ] = i;
else T [ i ] [ j ] = T [ i - 1 ] [ j ] + T [ i / 2 ] [ j - 1 ];
}
}
return T [ m ] [ n ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(10);
param0.add(5);
param0.add(2);
param0.add(83);
param0.add(91);
param0.add(18);
param0.add(83);
param0.add(98);
param0.add(43);
param0.add(31);
List<Integer> param1 = new ArrayList<>();
param1.add(4);
param1.add(2);
param1.add(8);
param1.add(7);
param1.add(0);
param1.add(53);
param1.add(41);
param1.add(53);
param1.add(37);
param1.add(20);
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 = [
(10,4,),
(5,2,),
(2,8,),
(83,7,),
(91,0,),
(18,53,),
(83,41,),
(98,53,),
(43,37,),
(31,20,)
]
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 {10,5,2,83,91,18,83,98,43,31};
vector<int> param1 {4,2,8,7,0,53,41,53,37,20};
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;
}
|
MEDIAN_OF_TWO_SORTED_ARRAYS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MEDIAN_OF_TWO_SORTED_ARRAYS{
static int f_gold ( int ar1 [ ] , int ar2 [ ] , int n ) {
int i = 0 ;
int j = 0 ;
int count ;
int m1 = - 1 , m2 = - 1 ;
for ( count = 0 ;
count <= n ;
count ++ ) {
if ( i == n ) {
m1 = m2 ;
m2 = ar2 [ 0 ] ;
break ;
}
else if ( j == n ) {
m1 = m2 ;
m2 = ar1 [ 0 ] ;
break ;
}
if ( ar1 [ i ] < ar2 [ j ] ) {
m1 = m2 ;
m2 = ar1 [ i ] ;
i ++ ;
}
else {
m1 = m2 ;
m2 = ar2 [ j ] ;
j ++ ;
}
}
return ( m1 + m2 ) / 2 ;
}
| def f_gold ( ar1 , ar2 , n ) :
i = 0
j = 0
m1 = - 1
m2 = - 1
count = 0
while count < n + 1 :
count += 1
if i == n :
m1 = m2
m2 = ar2 [ 0 ]
break
elif j == n :
m1 = m2
m2 = ar1 [ 0 ]
break
if ar1 [ i ] < ar2 [ j ] :
m1 = m2
m2 = ar1 [ i ]
i += 1
else :
m1 = m2
m2 = ar2 [ j ]
j += 1
return ( m1 + m2 ) / 2
|
using namespace std;
int f_gold ( int ar1 [ ], int ar2 [ ], int n ) {
int i = 0;
int j = 0;
int count;
int m1 = - 1, m2 = - 1;
for ( count = 0;
count <= n;
count ++ ) {
if ( i == n ) {
m1 = m2;
m2 = ar2 [ 0 ];
break;
}
else if ( j == n ) {
m1 = m2;
m2 = ar1 [ 0 ];
break;
}
if ( ar1 [ i ] < ar2 [ j ] ) {
m1 = m2;
m2 = ar1 [ i ];
i ++;
}
else {
m1 = m2;
m2 = ar2 [ j ];
j ++;
}
}
return ( m1 + m2 ) / 2;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,6,18,21,23,27,44,44,69,72,78,88,90,98});
param0.add(new int[]{90,54,24,-10,-84,-74,58,96,-28,-92,-18,90,70,-60,72,78,10,42,-2,-18,-38,-16,18,-86,40,-46,-38,66,20,-16,48});
param0.add(new int[]{0,1,1});
param0.add(new int[]{53,17,94,21,16,75,67,51,44,71,65,82});
param0.add(new int[]{-96,-92,-80,-68,-64,-64,-60,-56,-52,-50,-50,-22,-20,-4,-2,0,6,20,22,28,38,40,48,50,56,58,64,64,80,82,90,92,92,92});
param0.add(new int[]{0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,1,1,0,0,1,1,1,1,0,1,0,0,0,0,0,0,0,1,0,1,1,1,0,1,1,1,1});
param0.add(new int[]{8,15,17,19,21,32,34,38,41,41,49,49,51,54,54,56,56,57,59,63,70,74,79,79,84,84,86,88,89,93,98});
param0.add(new int[]{96,-42,-94,-46,-68,76,8,16,-54,-94,76,24,94,10,34,78,-30,0,-52,80,98,-58,92,12,26,64});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1});
param0.add(new int[]{61,69,66,3});
List<int [ ]> param1 = new ArrayList<>();
param1.add(new int[]{6,12,16,18,26,34,48,48,49,56,61,79,81,89});
param1.add(new int[]{-72,-62,14,-58,70,54,88,-40,-94,4,60,-16,-38,-98,-70,-46,66,42,26,36,56,-4,32,30,-46,-42,-72,44,16,4,24});
param1.add(new int[]{0,1,1});
param1.add(new int[]{98,50,8,11,80,41,59,24,94,41,75,78});
param1.add(new int[]{-88,-72,-72,-58,-54,-50,-48,-34,-24,-14,-14,-14,-10,-6,4,12,16,18,26,30,32,34,40,46,52,54,58,62,62,72,82,82,92,98});
param1.add(new int[]{1,1,1,1,0,0,0,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,1,1,0,0,1,1,0,1,0,1,1,0,1,0,0,0,0,1});
param1.add(new int[]{5,6,17,18,22,29,32,33,36,44,45,47,59,59,60,65,67,68,69,71,72,76,78,81,84,85,85,86,86,87,92});
param1.add(new int[]{88,78,-26,10,84,34,56,-8,-30,46,48,20,26,-78,96,44,92,-44,-86,24,-58,-96,-86,-12,-98,18});
param1.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1});
param1.add(new int[]{39,84,97,15});
List<Integer> param2 = new ArrayList<>();
param2.add(12);
param2.add(16);
param2.add(2);
param2.add(10);
param2.add(25);
param2.add(40);
param2.add(29);
param2.add(17);
param2.add(17);
param2.add(3);
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, 6, 18, 21, 23, 27, 44, 44, 69, 72, 78, 88, 90, 98],[6, 12, 16, 18, 26, 34, 48, 48, 49, 56, 61, 79, 81, 89],12,),
([90, 54, 24, -10, -84, -74, 58, 96, -28, -92, -18, 90, 70, -60, 72, 78, 10, 42, -2, -18, -38, -16, 18, -86, 40, -46, -38, 66, 20, -16, 48],[-72, -62, 14, -58, 70, 54, 88, -40, -94, 4, 60, -16, -38, -98, -70, -46, 66, 42, 26, 36, 56, -4, 32, 30, -46, -42, -72, 44, 16, 4, 24],16,),
([0, 1, 1],[0, 1, 1],2,),
([53, 17, 94, 21, 16, 75, 67, 51, 44, 71, 65, 82],[98, 50, 8, 11, 80, 41, 59, 24, 94, 41, 75, 78],10,),
([-96, -92, -80, -68, -64, -64, -60, -56, -52, -50, -50, -22, -20, -4, -2, 0, 6, 20, 22, 28, 38, 40, 48, 50, 56, 58, 64, 64, 80, 82, 90, 92, 92, 92],[-88, -72, -72, -58, -54, -50, -48, -34, -24, -14, -14, -14, -10, -6, 4, 12, 16, 18, 26, 30, 32, 34, 40, 46, 52, 54, 58, 62, 62, 72, 82, 82, 92, 98],25,),
([0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1],[1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1],40,),
([8, 15, 17, 19, 21, 32, 34, 38, 41, 41, 49, 49, 51, 54, 54, 56, 56, 57, 59, 63, 70, 74, 79, 79, 84, 84, 86, 88, 89, 93, 98],[5, 6, 17, 18, 22, 29, 32, 33, 36, 44, 45, 47, 59, 59, 60, 65, 67, 68, 69, 71, 72, 76, 78, 81, 84, 85, 85, 86, 86, 87, 92],29,),
([96, -42, -94, -46, -68, 76, 8, 16, -54, -94, 76, 24, 94, 10, 34, 78, -30, 0, -52, 80, 98, -58, 92, 12, 26, 64],[88, 78, -26, 10, 84, 34, 56, -8, -30, 46, 48, 20, 26, -78, 96, 44, 92, -44, -86, 24, -58, -96, -86, -12, -98, 18],17,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1],17,),
([61, 69, 66, 3],[39, 84, 97, 15],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<vector<int>> param0 {{2,6,18,21,23,27,44,44,69,72,78,88,90,98},{90,54,24,-10,-84,-74,58,96,-28,-92,-18,90,70,-60,72,78,10,42,-2,-18,-38,-16,18,-86,40,-46,-38,66,20,-16,48},{0,1,1},{53,17,94,21,16,75,67,51,44,71,65,82},{-96,-92,-80,-68,-64,-64,-60,-56,-52,-50,-50,-22,-20,-4,-2,0,6,20,22,28,38,40,48,50,56,58,64,64,80,82,90,92,92,92},{0,0,0,1,0,0,0,0,0,1,1,0,1,1,0,0,1,1,0,0,1,1,1,1,0,1,0,0,0,0,0,0,0,1,0,1,1,1,0,1,1,1,1},{8,15,17,19,21,32,34,38,41,41,49,49,51,54,54,56,56,57,59,63,70,74,79,79,84,84,86,88,89,93,98},{96,-42,-94,-46,-68,76,8,16,-54,-94,76,24,94,10,34,78,-30,0,-52,80,98,-58,92,12,26,64},{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1},{61,69,66,3}};
vector<vector<int>> param1 {{6,12,16,18,26,34,48,48,49,56,61,79,81,89},{-72,-62,14,-58,70,54,88,-40,-94,4,60,-16,-38,-98,-70,-46,66,42,26,36,56,-4,32,30,-46,-42,-72,44,16,4,24},{0,1,1},{98,50,8,11,80,41,59,24,94,41,75,78},{-88,-72,-72,-58,-54,-50,-48,-34,-24,-14,-14,-14,-10,-6,4,12,16,18,26,30,32,34,40,46,52,54,58,62,62,72,82,82,92,98},{1,1,1,1,0,0,0,1,1,1,0,0,0,1,0,1,1,0,0,1,0,1,0,0,0,1,1,0,0,1,1,0,1,0,1,1,0,1,0,0,0,0,1},{5,6,17,18,22,29,32,33,36,44,45,47,59,59,60,65,67,68,69,71,72,76,78,81,84,85,85,86,86,87,92},{88,78,-26,10,84,34,56,-8,-30,46,48,20,26,-78,96,44,92,-44,-86,24,-58,-96,-86,-12,-98,18},{0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1},{39,84,97,15}};
vector<int> param2 {12,16,2,10,25,40,29,17,17,3};
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;
} |
STEINS_ALGORITHM_FOR_FINDING_GCD_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class STEINS_ALGORITHM_FOR_FINDING_GCD_1{
static int f_gold ( int a , int b ) {
if ( a == b ) return a ;
if ( a == 0 ) return b ;
if ( b == 0 ) return a ;
if ( ( ~ a & 1 ) == 1 ) {
if ( ( b & 1 ) == 1 ) return f_gold ( a >> 1 , b ) ;
else return f_gold ( a >> 1 , b >> 1 ) << 1 ;
}
if ( ( ~ b & 1 ) == 1 ) return f_gold ( a , b >> 1 ) ;
if ( a > b ) return f_gold ( ( a - b ) >> 1 , b ) ;
return f_gold ( ( b - a ) >> 1 , a ) ;
}
| def f_gold ( a , b ) :
if ( a == b ) :
return a
if ( a == 0 ) :
return b
if ( b == 0 ) :
return a
if ( ( ~ a & 1 ) == 1 ) :
if ( ( b & 1 ) == 1 ) :
return f_gold ( a >> 1 , b )
else :
return ( f_gold ( a >> 1 , b >> 1 ) << 1 )
if ( ( ~ b & 1 ) == 1 ) :
return f_gold ( a , b >> 1 )
if ( a > b ) :
return f_gold ( ( a - b ) >> 1 , b )
return f_gold ( ( b - a ) >> 1 , a )
|
using namespace std;
int f_gold ( int a, int b ) {
if ( a == b ) return a;
if ( a == 0 ) return b;
if ( b == 0 ) return a;
if ( ~ a & 1 ) {
if ( b & 1 ) return f_gold ( a >> 1, b );
else return f_gold ( a >> 1, b >> 1 ) << 1;
}
if ( ~ b & 1 ) return f_gold ( a, b >> 1 );
if ( a > b ) return f_gold ( ( a - b ) >> 1, b );
return f_gold ( ( b - a ) >> 1, a );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(52);
param0.add(36);
param0.add(12);
param0.add(69);
param0.add(45);
param0.add(7);
param0.add(45);
param0.add(62);
param0.add(96);
param0.add(89);
List<Integer> param1 = new ArrayList<>();
param1.add(29);
param1.add(94);
param1.add(6);
param1.add(7);
param1.add(11);
param1.add(51);
param1.add(55);
param1.add(86);
param1.add(63);
param1.add(12);
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 = [
(52,29,),
(36,94,),
(12,6,),
(69,7,),
(45,11,),
(7,51,),
(45,55,),
(62,86,),
(96,63,),
(89,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<int> param0 {52,36,12,69,45,7,45,62,96,89};
vector<int> param1 {29,94,6,7,11,51,55,86,63,12};
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;
} |
COUNTING_PAIRS_PERSON_CAN_FORM_PAIR_ONE_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNTING_PAIRS_PERSON_CAN_FORM_PAIR_ONE_1{
static int f_gold ( int x ) {
int dp [ ] = new int [ x + 1 ] ;
dp [ 0 ] = dp [ 1 ] = 1 ;
for ( int i = 2 ;
i <= x ;
i ++ ) dp [ i ] = dp [ i - 1 ] + ( i - 1 ) * dp [ i - 2 ] ;
return dp [ x ] ;
}
| null |
using namespace std;
int f_gold ( int x ) {
int dp [ x + 1 ];
dp [ 0 ] = dp [ 1 ] = 1;
for ( int i = 2;
i <= x;
i ++ ) dp [ i ] = dp [ i - 1 ] + ( i - 1 ) * dp [ i - 2 ];
return dp [ x ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(22);
param0.add(92);
param0.add(15);
param0.add(81);
param0.add(3);
param0.add(30);
param0.add(88);
param0.add(4);
param0.add(43);
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());
}
} | null |
int main() {
int n_success = 0;
vector<int> param0 {22,92,15,81,3,30,88,4,43,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;
} |
GIVEN_A_SORTED_AND_ROTATED_ARRAY_FIND_IF_THERE_IS_A_PAIR_WITH_A_GIVEN_SUM |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class GIVEN_A_SORTED_AND_ROTATED_ARRAY_FIND_IF_THERE_IS_A_PAIR_WITH_A_GIVEN_SUM{
static boolean f_gold ( int arr [ ] , int n , int x ) {
int i ;
for ( i = 0 ;
i < n - 1 ;
i ++ ) if ( arr [ i ] > arr [ i + 1 ] ) break ;
int l = ( i + 1 ) % n ;
int r = i ;
while ( l != r ) {
if ( arr [ l ] + arr [ r ] == x ) return true ;
if ( arr [ l ] + arr [ r ] < x ) l = ( l + 1 ) % n ;
else r = ( n + r - 1 ) % n ;
}
return false ;
}
| def f_gold ( arr , n , x ) :
for i in range ( 0 , n - 1 ) :
if ( arr [ i ] > arr [ i + 1 ] ) :
break ;
l = ( i + 1 ) % n
r = i
while ( l != r ) :
if ( arr [ l ] + arr [ r ] == x ) :
return True ;
if ( arr [ l ] + arr [ r ] < x ) :
l = ( l + 1 ) % n ;
else :
r = ( n + r - 1 ) % n ;
return False ;
|
using namespace std;
bool f_gold ( int arr [ ], int n, int x ) {
int i;
for ( i = 0;
i < n - 1;
i ++ ) if ( arr [ i ] > arr [ i + 1 ] ) break;
int l = ( i + 1 ) % n;
int r = i;
while ( l != r ) {
if ( arr [ l ] + arr [ r ] == x ) return true;
if ( arr [ l ] + arr [ r ] < x ) l = ( l + 1 ) % n;
else r = ( n + r - 1 ) % n;
}
return false;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,8,10,15,18,19,20,20,21,22,26,30,32,34,43,45,50,50,51,52,53,56,57,58,62,63,65,82,86,91,91,92,92,93,97});
param0.add(new int[]{30,-34,86,-30,-26,2,90,8,26,-8,-8,0,-86,68,22,72,-76,48,-24,90,-22,-58,-54,90,-12,-12,88,72,-58,68,84,22,60,66,-52,-38,-90,62,30,-26,88,-36,92,32,-32,-42,-90,-40,-10});
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,1,1,1,1});
param0.add(new int[]{20,68,40,19,74,69});
param0.add(new int[]{-98,-94,-94,-94,-90,-88,-88,-78,-74,-70,-68,-66,-64,-62,-54,-50,-40,-40,-40,-40,-28,-22,-22,-18,-14,-12,0,6,6,8,12,20,22,26,28,36,42,44,48,52,56,60,68,84});
param0.add(new int[]{1,1,0});
param0.add(new int[]{12,22,38,76,80,86});
param0.add(new int[]{-36,-10,-26,34,-50,66,-2,-14,-62,60,-48,94,-70,6,-60,-90,28,-4,-20,-52,40,-76,-92,-14,54,4,-58,38,-74,-96,-88,86,-54,98,48,68,78,-28,-80,-46});
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[]{69,99,25,52,41,51,7,33,42,91,85,57,91,89,86,11,70,67,30,92,81,23,51,98,85,5,50,44});
List<Integer> param1 = new ArrayList<>();
param1.add(17);
param1.add(41);
param1.add(26);
param1.add(4);
param1.add(28);
param1.add(2);
param1.add(4);
param1.add(26);
param1.add(17);
param1.add(21);
List<Integer> param2 = new ArrayList<>();
param2.add(30);
param2.add(10);
param2.add(1);
param2.add(88);
param2.add(94);
param2.add(60);
param2.add(3);
param2.add(37);
param2.add(20);
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 = [
([3, 8, 10, 15, 18, 19, 20, 20, 21, 22, 26, 30, 32, 34, 43, 45, 50, 50, 51, 52, 53, 56, 57, 58, 62, 63, 65, 82, 86, 91, 91, 92, 92, 93, 97],17,30,),
([30, -34, 86, -30, -26, 2, 90, 8, 26, -8, -8, 0, -86, 68, 22, 72, -76, 48, -24, 90, -22, -58, -54, 90, -12, -12, 88, 72, -58, 68, 84, 22, 60, 66, -52, -38, -90, 62, 30, -26, 88, -36, 92, 32, -32, -42, -90, -40, -10],41,10,),
([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],26,1,),
([20, 68, 40, 19, 74, 69],4,88,),
([-98, -94, -94, -94, -90, -88, -88, -78, -74, -70, -68, -66, -64, -62, -54, -50, -40, -40, -40, -40, -28, -22, -22, -18, -14, -12, 0, 6, 6, 8, 12, 20, 22, 26, 28, 36, 42, 44, 48, 52, 56, 60, 68, 84],28,94,),
([1, 1, 0],2,60,),
([12, 22, 38, 76, 80, 86],4,3,),
([-36, -10, -26, 34, -50, 66, -2, -14, -62, 60, -48, 94, -70, 6, -60, -90, 28, -4, -20, -52, 40, -76, -92, -14, 54, 4, -58, 38, -74, -96, -88, 86, -54, 98, 48, 68, 78, -28, -80, -46],26,37,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],17,20,),
([69, 99, 25, 52, 41, 51, 7, 33, 42, 91, 85, 57, 91, 89, 86, 11, 70, 67, 30, 92, 81, 23, 51, 98, 85, 5, 50, 44],21,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<int>> param0 {
{3,8,10,15,18,19,20,20,21,22,26,30,32,34,43,45,50,50,51,52,53,56,57,58,62,63,65,82,86,91,91,92,92,93,97},
{30,-34,86,-30,-26,2,90,8,26,-8,-8,0,-86,68,22,72,-76,48,-24,90,-22,-58,-54,90,-12,-12,88,72,-58,68,84,22,60,66,-52,-38,-90,62,30,-26,88,-36,92,32,-32,-42,-90,-40,-10},
{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},
{20,68,40,19,74,69},
{-98,-94,-94,-94,-90,-88,-88,-78,-74,-70,-68,-66,-64,-62,-54,-50,-40,-40,-40,-40,-28,-22,-22,-18,-14,-12,0,6,6,8,12,20,22,26,28,36,42,44,48,52,56,60,68,84},
{1,1,0},
{12,22,38,76,80,86},
{-36,-10,-26,34,-50,66,-2,-14,-62,60,-48,94,-70,6,-60,-90,28,-4,-20,-52,40,-76,-92,-14,54,4,-58,38,-74,-96,-88,86,-54,98,48,68,78,-28,-80,-46},
{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},
{69,99,25,52,41,51,7,33,42,91,85,57,91,89,86,11,70,67,30,92,81,23,51,98,85,5,50,44}};
vector<int> param1 {17,41,26,4,28,2,4,26,17,21};
vector<int> param2 {30,10,1,88,-94,60,3,37,20,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;
} |
DYNAMIC_PROGRAMMING_SET_8_MATRIX_CHAIN_MULTIPLICATION_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_SET_8_MATRIX_CHAIN_MULTIPLICATION_1{
static int f_gold ( int p [ ] , int n ) {
int m [ ] [ ] = new int [ n ] [ n ] ;
int i , j , k , L , q ;
for ( i = 1 ;
i < n ;
i ++ ) m [ i ] [ i ] = 0 ;
for ( L = 2 ;
L < n ;
L ++ ) {
for ( i = 1 ;
i < n - L + 1 ;
i ++ ) {
j = i + L - 1 ;
if ( j == n ) continue ;
m [ i ] [ j ] = Integer . MAX_VALUE ;
for ( k = i ;
k <= j - 1 ;
k ++ ) {
q = m [ i ] [ k ] + m [ k + 1 ] [ j ] + p [ i - 1 ] * p [ k ] * p [ j ] ;
if ( q < m [ i ] [ j ] ) m [ i ] [ j ] = q ;
}
}
}
return m [ 1 ] [ n - 1 ] ;
}
| null |
using namespace std;
int f_gold ( int p [ ], int n ) {
int m [ n ] [ n ];
int i, j, k, L, q;
for ( i = 1;
i < n;
i ++ ) m [ i ] [ i ] = 0;
for ( L = 2;
L < n;
L ++ ) {
for ( i = 1;
i < n - L + 1;
i ++ ) {
j = i + L - 1;
m [ i ] [ j ] = INT_MAX;
for ( k = i;
k <= j - 1;
k ++ ) {
q = m [ i ] [ k ] + m [ k + 1 ] [ j ] + p [ i - 1 ] * p [ k ] * p [ j ];
if ( q < m [ i ] [ j ] ) m [ i ] [ j ] = q;
}
}
}
return m [ 1 ] [ n - 1 ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,4,11,17,26,33,37,51,62,70,71,73,74,74,81,82,83,90,95,98,98});
param0.add(new int[]{-50,74,-8,2,-24,28,-86,34,-36,92,-70,-98});
param0.add(new int[]{0,0,0,1,1,1,1});
param0.add(new int[]{4,73,3,88,79,40,25,58,39,53,32,20,95,60,60,98,23,95,42,26,95,14,43,97,30,83,29,37,74,72,37,31,32,83,57,40,56,95,8,79,67,62});
param0.add(new int[]{-92,-88,-88,-88,-86,-84,-80,-78,-76,-74,-72,-68,-68,-66,-62,-42,-34,-30,-28,-24,-20,-14,-12,-10,-8,-8,-8,6,10,26,26,36,38,42,46,48,48,54,54,58,60,66,70,76,78,80,82,98});
param0.add(new int[]{1,1,0,1,0,0,1});
param0.add(new int[]{8,25,38,39,41,57,71,89});
param0.add(new int[]{76,-28,20,62,-44,8,-46,52,26,76,22,38,-36,10,2,-86,42,-62,-68,-56,10});
param0.add(new int[]{0,0,0,0,1,1,1});
param0.add(new int[]{98,96,76,76,8,4,53,34,54,10,98,46,58,7,36,72,32,59,52,99,40,52,50,43,26,93,76,90,12,82,31,50,55,34,61,78});
List<Integer> param1 = new ArrayList<>();
param1.add(20);
param1.add(10);
param1.add(3);
param1.add(41);
param1.add(47);
param1.add(4);
param1.add(6);
param1.add(18);
param1.add(5);
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());
}
} | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,4,11,17,26,33,37,51,62,70,71,73,74,74,81,82,83,90,95,98,98},{-50,74,-8,2,-24,28,-86,34,-36,92,-70,-98},{0,0,0,1,1,1,1},{4,73,3,88,79,40,25,58,39,53,32,20,95,60,60,98,23,95,42,26,95,14,43,97,30,83,29,37,74,72,37,31,32,83,57,40,56,95,8,79,67,62},{-92,-88,-88,-88,-86,-84,-80,-78,-76,-74,-72,-68,-68,-66,-62,-42,-34,-30,-28,-24,-20,-14,-12,-10,-8,-8,-8,6,10,26,26,36,38,42,46,48,48,54,54,58,60,66,70,76,78,80,82,98},{1,1,0,1,0,0,1},{8,25,38,39,41,57,71,89},{76,-28,20,62,-44,8,-46,52,26,76,22,38,-36,10,2,-86,42,-62,-68,-56,10},{0,0,0,0,1,1,1},{98,96,76,76,8,4,53,34,54,10,98,46,58,7,36,72,32,59,52,99,40,52,50,43,26,93,76,90,12,82,31,50,55,34,61,78}};
vector<int> param1 {20,10,3,41,47,4,6,18,5,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;
} |
FIND_EQUAL_POINT_STRING_BRACKETS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_EQUAL_POINT_STRING_BRACKETS{
static int f_gold ( String str ) {
int len = str . length ( ) ;
int open [ ] = new int [ len + 1 ] ;
int close [ ] = new int [ len + 1 ] ;
int index = - 1 ;
open [ 0 ] = 0 ;
close [ len ] = 0 ;
if ( str . charAt ( 0 ) == '(' ) open [ 1 ] = 1 ;
if ( str . charAt ( len - 1 ) == ')' ) close [ len - 1 ] = 1 ;
for ( int i = 1 ;
i < len ;
i ++ ) {
if ( str . charAt ( i ) == '(' ) open [ i + 1 ] = open [ i ] + 1 ;
else open [ i + 1 ] = open [ i ] ;
}
for ( int i = len - 2 ;
i >= 0 ;
i -- ) {
if ( str . charAt ( i ) == ')' ) close [ i ] = close [ i + 1 ] + 1 ;
else close [ i ] = close [ i + 1 ] ;
}
if ( open [ len ] == 0 ) return len ;
if ( close [ 0 ] == 0 ) return 0 ;
for ( int i = 0 ;
i <= len ;
i ++ ) if ( open [ i ] == close [ i ] ) index = i ;
return index ;
}
| def f_gold ( str ) :
l = len ( str )
open = [ None ] * ( l + 1 )
close = [ None ] * ( l + 1 )
index = - 1
open [ 0 ] = 0
close [ l ] = 0
if ( str [ 0 ] == '(' ) :
open [ 1 ] = 1
if ( str [ l - 1 ] == ')' ) :
close [ l - 1 ] = 1
for i in range ( 1 , l ) :
if ( str [ i ] == '(' ) :
open [ i + 1 ] = open [ i ] + 1
else :
open [ i + 1 ] = open [ i ]
for i in range ( l - 2 , - 1 , - 1 ) :
if ( str [ i ] == ')' ) :
close [ i ] = close [ i + 1 ] + 1
else :
close [ i ] = close [ i + 1 ]
if ( open [ l ] == 0 ) :
return len
if ( close [ 0 ] == 0 ) :
return 0
for i in range ( l + 1 ) :
if ( open [ i ] == close [ i ] ) :
index = i
return index
|
using namespace std;
int f_gold ( string str ) {
int len = str . length ( );
int open [ len + 1 ], close [ len + 1 ];
int index = - 1;
memset ( open, 0, sizeof ( open ) );
memset ( close, 0, sizeof ( close ) );
open [ 0 ] = 0;
close [ len ] = 0;
if ( str [ 0 ] == '(' ) open [ 1 ] = 1;
if ( str [ len - 1 ] == ')' ) close [ len - 1 ] = 1;
for ( int i = 1;
i < len;
i ++ ) {
if ( str [ i ] == '(' ) open [ i + 1 ] = open [ i ] + 1;
else open [ i + 1 ] = open [ i ];
}
for ( int i = len - 2;
i >= 0;
i -- ) {
if ( str [ i ] == ')' ) close [ i ] = close [ i + 1 ] + 1;
else close [ i ] = close [ i + 1 ];
}
if ( open [ len ] == 0 ) return len;
if ( close [ 0 ] == 0 ) return 0;
for ( int i = 0;
i <= len;
i ++ ) if ( open [ i ] == close [ i ] ) index = i;
return index;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("(())))(");
param0.add("))");
param0.add("((");
param0.add("))(()(()()(");
param0.add(")((()(()");
param0.add("))(()");
param0.add("()))");
param0.add("()");
param0.add("1100110");
param0.add("dhfSnebD");
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 = [
("(())))(",),
("))",),
("((",),
("))(()(()()(",),
(")((()(()",),
("))(()",),
("()))",),
("()",),
('1100110',),
('dhfSnebD',)
]
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 {"(())))(","))","((","))(()(()()(",")((()(()","))(()","()))","()","1100110","dhfSnebD"};
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;
} |
CIRCLE_LATTICE_POINTS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CIRCLE_LATTICE_POINTS{
static int f_gold ( int r ) {
if ( r <= 0 ) return 0 ;
int result = 4 ;
for ( int x = 1 ;
x < r ;
x ++ ) {
int ySquare = r * r - x * x ;
int y = ( int ) Math . sqrt ( ySquare ) ;
if ( y * y == ySquare ) result += 4 ;
}
return result ;
}
| import math
def f_gold ( r ) :
if ( r <= 0 ) :
return 0
result = 4
for x in range ( 1 , r ) :
ySquare = r * r - x * x
y = int ( math.sqrt ( ySquare ) )
if ( y * y == ySquare ) :
result += 4
return result
|
using namespace std;
int f_gold ( int r ) {
if ( r <= 0 ) return 0;
int result = 4;
for ( int x = 1;
x < r;
x ++ ) {
int ySquare = r * r - x * x;
int y = sqrt ( ySquare );
if ( y * y == ySquare ) result += 4;
}
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(34);
param0.add(56);
param0.add(90);
param0.add(47);
param0.add(36);
param0.add(63);
param0.add(21);
param0.add(76);
param0.add(18);
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 = [
(34,),
(56,),
(90,),
(47,),
(36,),
(63,),
(21,),
(76,),
(18,),
(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 {34,56,90,47,36,63,21,76,18,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;
} |
LARGEST_SUBARRAY_WITH_EQUAL_NUMBER_OF_0S_AND_1S_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LARGEST_SUBARRAY_WITH_EQUAL_NUMBER_OF_0S_AND_1S_1{
static int f_gold ( int arr [ ] , int n ) {
HashMap < Integer , Integer > hM = new HashMap < Integer , Integer > ( ) ;
int sum = 0 ;
int max_len = 0 ;
int ending_index = - 1 ;
int start_index = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
arr [ i ] = ( arr [ i ] == 0 ) ? - 1 : 1 ;
}
for ( int i = 0 ;
i < n ;
i ++ ) {
sum += arr [ i ] ;
if ( sum == 0 ) {
max_len = i + 1 ;
ending_index = i ;
}
if ( hM . containsKey ( sum + n ) ) {
if ( max_len < i - hM . get ( sum + n ) ) {
max_len = i - hM . get ( sum + n ) ;
ending_index = i ;
}
}
else hM . put ( sum + n , i ) ;
}
for ( int i = 0 ;
i < n ;
i ++ ) {
arr [ i ] = ( arr [ i ] == - 1 ) ? 0 : 1 ;
}
int end = ending_index - max_len + 1 ;
System . out . println ( end + " to " + ending_index ) ;
return max_len ;
}
| def f_gold ( arr , n ) :
hash_map = { } ;
curr_sum = 0 ;
max_len = 0 ;
ending_index = - 1 ;
for i in range ( 0 , n ) :
if ( arr [ i ] == 0 ) :
arr [ i ] = - 1 ;
else :
arr [ i ] = 1 ;
for i in range ( 0 , n ) :
curr_sum = curr_sum + arr [ i ] ;
if ( curr_sum == 0 ) :
max_len = i + 1 ;
ending_index = i ;
if ( curr_sum + n ) in hash_map :
max_len = max ( max_len , i - hash_map [ curr_sum + n ] )
else :
hash_map [ curr_sum ] = i ;
for i in range ( 0 , n ) :
if ( arr [ i ] == - 1 ) :
arr [ i ] = 0 ;
else :
arr [ i ] = 1 ;
print ( ending_index - max_len + 1 , end = " " ) ;
print ( "to" , end = " " ) ;
print ( ending_index ) ;
return max_len ;
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
unordered_map < int, int > hM;
int sum = 0;
int max_len = 0;
int ending_index = - 1;
for ( int i = 0;
i < n;
i ++ ) arr [ i ] = ( arr [ i ] == 0 ) ? - 1 : 1;
for ( int i = 0;
i < n;
i ++ ) {
sum += arr [ i ];
if ( sum == 0 ) {
max_len = i + 1;
ending_index = i;
}
if ( hM . find ( sum + n ) != hM . end ( ) ) {
if ( max_len < i - hM [ sum + n ] ) {
max_len = i - hM [ sum + n ];
ending_index = i;
}
}
else hM [ sum + n ] = i;
}
for ( int i = 0;
i < n;
i ++ ) arr [ i ] = ( arr [ i ] == - 1 ) ? 0 : 1;
printf ( "%d to %d\n", ending_index - max_len + 1, ending_index );
return max_len;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,6,16,16,18,19,22,39,40,42,60,66,69,70,70,73,74,80,99});
param0.add(new int[]{-88,-66});
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});
param0.add(new int[]{85,98,67,27,98,13,96,32,26,44,32});
param0.add(new int[]{-96,-94,-90,-88,-86,-66,-64,-52,-46,-46,-42,-40,-38,-32,-28,-22,-16,-10,-8,-8,-4,2,10,26,26,28,28,40,40,42,50,60,66,68,72,74,86,92,94});
param0.add(new int[]{1,1,1,1,1,1,0,0,0});
param0.add(new int[]{25,64,86});
param0.add(new int[]{-4,78,-76,12,4,-38,-98,-26,-8,-98,56,0,-34,36,-90,-36,54,-68,12,-44,62,60,-34,-52,18});
param0.add(new int[]{0,0,0,0,0,0,0,0,1,1,1,1,1,1,1});
param0.add(new int[]{2,25,45,98,71,8,58,94,53});
List<Integer> param1 = new ArrayList<>();
param1.add(9);
param1.add(1);
param1.add(19);
param1.add(8);
param1.add(34);
param1.add(4);
param1.add(1);
param1.add(17);
param1.add(9);
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 = [
([3, 6, 16, 16, 18, 19, 22, 39, 40, 42, 60, 66, 69, 70, 70, 73, 74, 80, 99],9,),
([-88, -66],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],19,),
([85, 98, 67, 27, 98, 13, 96, 32, 26, 44, 32],8,),
([-96, -94, -90, -88, -86, -66, -64, -52, -46, -46, -42, -40, -38, -32, -28, -22, -16, -10, -8, -8, -4, 2, 10, 26, 26, 28, 28, 40, 40, 42, 50, 60, 66, 68, 72, 74, 86, 92, 94],34,),
([1, 1, 1, 1, 1, 1, 0, 0, 0],4,),
([25, 64, 86],1,),
([-4, 78, -76, 12, 4, -38, -98, -26, -8, -98, 56, 0, -34, 36, -90, -36, 54, -68, 12, -44, 62, 60, -34, -52, 18],17,),
([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1],9,),
([2, 25, 45, 98, 71, 8, 58, 94, 53],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 {{3,6,16,16,18,19,22,39,40,42,60,66,69,70,70,73,74,80,99},{-88,-66},{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},{85,98,67,27,98,13,96,32,26,44,32},{-96,-94,-90,-88,-86,-66,-64,-52,-46,-46,-42,-40,-38,-32,-28,-22,-16,-10,-8,-8,-4,2,10,26,26,28,28,40,40,42,50,60,66,68,72,74,86,92,94},{1,1,1,1,1,1,0,0,0},{25,64,86},{-4,78,-76,12,4,-38,-98,-26,-8,-98,56,0,-34,36,-90,-36,54,-68,12,-44,62,60,-34,-52,18},{0,0,0,0,0,0,0,0,1,1,1,1,1,1,1},{2,25,45,98,71,8,58,94,53}};
vector<int> param1 {9,1,19,8,34,4,1,17,9,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;
} |
MAXIMUM_AVERAGE_SUM_PARTITION_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_AVERAGE_SUM_PARTITION_ARRAY{
static double f_gold ( int [ ] A , int K ) {
int n = A . length ;
double [ ] pre_sum = new double [ n + 1 ] ;
pre_sum [ 0 ] = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) pre_sum [ i + 1 ] = pre_sum [ i ] + A [ i ] ;
double [ ] dp = new double [ n ] ;
double sum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) dp [ i ] = ( pre_sum [ n ] - pre_sum [ i ] ) / ( n - i ) ;
for ( int k = 0 ;
k < K - 1 ;
k ++ ) for ( int i = 0 ;
i < n ;
i ++ ) for ( int j = i + 1 ;
j < n ;
j ++ ) dp [ i ] = Math . max ( dp [ i ] , ( pre_sum [ j ] - pre_sum [ i ] ) / ( j - i ) + dp [ j ] ) ;
return dp [ 0 ] ;
}
| def f_gold ( A , K ) :
n = len ( A ) ;
pre_sum = [ 0 ] * ( n + 1 ) ;
pre_sum [ 0 ] = 0 ;
for i in range ( n ) :
pre_sum [ i + 1 ] = pre_sum [ i ] + A [ i ] ;
dp = [ 0 ] * n ;
sum = 0 ;
for i in range ( n ) :
dp [ i ] = ( pre_sum [ n ] - pre_sum [ i ] ) / ( n - i ) ;
for k in range ( K - 1 ) :
for i in range ( n ) :
for j in range ( i + 1 , n ) :
dp [ i ] = max ( dp [ i ] , ( pre_sum [ j ] - pre_sum [ i ] ) / ( j - i ) + dp [ j ] ) ;
return int ( dp [ 0 ] ) ;
|
using namespace std;
double f_gold ( vector < int > & A, int K ) {
int n = A . size ( );
double pre_sum [ n + 1 ];
pre_sum [ 0 ] = 0;
for ( int i = 0;
i < n;
i ++ ) pre_sum [ i + 1 ] = pre_sum [ i ] + A [ i ];
double dp [ n ] = {
0 };
double sum = 0;
for ( int i = 0;
i < n;
i ++ ) dp [ i ] = ( pre_sum [ n ] - pre_sum [ i ] ) / ( n - i );
for ( int k = 0;
k < K - 1;
k ++ ) for ( int i = 0;
i < n;
i ++ ) for ( int j = i + 1;
j < n;
j ++ ) dp [ i ] = max ( dp [ i ], ( pre_sum [ j ] - pre_sum [ i ] ) / ( j - i ) + dp [ j ] );
return dp [ 0 ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,11,14,27,32,37,39,49,52,53,57,62,67,67,68,69,76,77,78,81,85,85,87,91,91,91,99,99,99});
param0.add(new int[]{80,12,32,44,24,82,-40,42,26,36,58,52,-34,44,12,-18,-72,52,2,-8,22,-18,98,-60,62,92,-46,20,20,-46,52,94,0,-28,-22,80,26,-92,-50,48,-80});
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});
param0.add(new int[]{32,16,67,53,99,56,80,92,84,21,36,46,94,31,63,67,59,88,41,17,74,47,95,12,27,99,32,4,82,31,65,40,93,72,23,33,93,9,62,47});
param0.add(new int[]{-92,-86,-80,-78,-72,-70,-70,-68,-66,-62,-60,-54,-54,-52,-52,-40,-36,-32,-28,-26,-22,-22,-20,-16,-16,-8,0,6,8,10,14,18,20,42,46,52,60,66,68,70,74,86,88,88,92,94,98});
param0.add(new int[]{1,0,0,0,1,0,1,1,0,1,0,1,1,1,1,0,1,0,0});
param0.add(new int[]{1,1,3,3,6,7,10,11,12,13,16,16,22,23,24,27,28,30,30,30,31,33,35,35,39,40,41,52,52,58,59,60,61,61,66,66,71,73,74,75,75,76,80,83,85,95,96,97,97});
param0.add(new int[]{28,-52,48,96,54,94,60,18});
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,1,1,1,1,1,1,1});
param0.add(new int[]{26,80,12,87,90,98,46,91,38,46,20,64,53,4,60,87,44,88,22,30});
List<Integer> param1 = new ArrayList<>();
param1.add(24);
param1.add(26);
param1.add(15);
param1.add(36);
param1.add(36);
param1.add(16);
param1.add(34);
param1.add(7);
param1.add(31);
param1.add(19);
for(int i = 0; i < param0.size(); ++i)
{
if(Math.abs(1 - (0.0000001 + Math.abs(f_gold(param0.get(i),param1.get(i))) )/ (Math.abs(f_filled(param0.get(i),param1.get(i))) + 0.0000001)) < 0.001)
{
n_success+=1;
}
}
System.out.println("#Results:" + n_success + ", " + param0.size());
}
} |
if __name__ == '__main__':
param = [
([4, 11, 14, 27, 32, 37, 39, 49, 52, 53, 57, 62, 67, 67, 68, 69, 76, 77, 78, 81, 85, 85, 87, 91, 91, 91, 99, 99, 99],24,),
([80, 12, 32, 44, 24, 82, -40, 42, 26, 36, 58, 52, -34, 44, 12, -18, -72, 52, 2, -8, 22, -18, 98, -60, 62, 92, -46, 20, 20, -46, 52, 94, 0, -28, -22, 80, 26, -92, -50, 48, -80],26,),
([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],15,),
([32, 16, 67, 53, 99, 56, 80, 92, 84, 21, 36, 46, 94, 31, 63, 67, 59, 88, 41, 17, 74, 47, 95, 12, 27, 99, 32, 4, 82, 31, 65, 40, 93, 72, 23, 33, 93, 9, 62, 47],36,),
([-92, -86, -80, -78, -72, -70, -70, -68, -66, -62, -60, -54, -54, -52, -52, -40, -36, -32, -28, -26, -22, -22, -20, -16, -16, -8, 0, 6, 8, 10, 14, 18, 20, 42, 46, 52, 60, 66, 68, 70, 74, 86, 88, 88, 92, 94, 98],36,),
([1, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0],16,),
([1, 1, 3, 3, 6, 7, 10, 11, 12, 13, 16, 16, 22, 23, 24, 27, 28, 30, 30, 30, 31, 33, 35, 35, 39, 40, 41, 52, 52, 58, 59, 60, 61, 61, 66, 66, 71, 73, 74, 75, 75, 76, 80, 83, 85, 95, 96, 97, 97],34,),
([28, -52, 48, 96, 54, 94, 60, 18],7,),
([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],31,),
([26, 80, 12, 87, 90, 98, 46, 91, 38, 46, 20, 64, 53, 4, 60, 87, 44, 88, 22, 30],19,)
]
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<vector<int>> param0 {{4,11,14,27,32,37,39,49,52,53,57,62,67,67,68,69,76,77,78,81,85,85,87,91,91,91,99,99,99},{80,12,32,44,24,82,-40,42,26,36,58,52,-34,44,12,-18,-72,52,2,-8,22,-18,98,-60,62,92,-46,20,20,-46,52,94,0,-28,-22,80,26,-92,-50,48,-80},{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},{32,16,67,53,99,56,80,92,84,21,36,46,94,31,63,67,59,88,41,17,74,47,95,12,27,99,32,4,82,31,65,40,93,72,23,33,93,9,62,47},{-92,-86,-80,-78,-72,-70,-70,-68,-66,-62,-60,-54,-54,-52,-52,-40,-36,-32,-28,-26,-22,-22,-20,-16,-16,-8,0,6,8,10,14,18,20,42,46,52,60,66,68,70,74,86,88,88,92,94,98},{1,0,0,0,1,0,1,1,0,1,0,1,1,1,1,0,1,0,0},{1,1,3,3,6,7,10,11,12,13,16,16,22,23,24,27,28,30,30,30,31,33,35,35,39,40,41,52,52,58,59,60,61,61,66,66,71,73,74,75,75,76,80,83,85,95,96,97,97},{28,-52,48,96,54,94,60,18},{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},{26,80,12,87,90,98,46,91,38,46,20,64,53,4,60,87,44,88,22,30}};
vector<int> param1 {24,26,15,36,36,16,34,7,31,19};
for(int i = 0; i < param0.size(); ++i)
{
if(abs(1 - (0.0000001 + abs(f_gold(param0[i],param1[i])) )/ (abs(f_filled(param0[i],param1[i])) + 0.0000001)) < 0.001)
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
FRIENDS_PAIRING_PROBLEM_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FRIENDS_PAIRING_PROBLEM_2{
static int f_gold ( int n ) {
int a = 1 , b = 2 , c = 0 ;
if ( n <= 2 ) {
return n ;
}
for ( int i = 3 ;
i <= n ;
i ++ ) {
c = b + ( i - 1 ) * a ;
a = b ;
b = c ;
}
return c ;
}
| def f_gold ( n ) :
a , b , c = 1 , 2 , 0 ;
if ( n <= 2 ) :
return n ;
for i in range ( 3 , n + 1 ) :
c = b + ( i - 1 ) * a ;
a = b ;
b = c ;
return c ;
|
using namespace std;
int f_gold ( int n ) {
int a = 1, b = 2, c = 0;
if ( n <= 2 ) {
return n;
}
for ( int i = 3;
i <= n;
i ++ ) {
c = b + ( i - 1 ) * a;
a = b;
b = c;
}
return c;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(24);
param0.add(1);
param0.add(91);
param0.add(90);
param0.add(89);
param0.add(29);
param0.add(3);
param0.add(60);
param0.add(75);
param0.add(14);
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,),
(1,),
(91,),
(90,),
(89,),
(29,),
(3,),
(60,),
(75,),
(14,)
]
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,1,91,90,89,29,3,60,75,14};
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;
} |
MINIMUM_OPERATIONS_MAKE_GCD_ARRAY_MULTIPLE_K |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_OPERATIONS_MAKE_GCD_ARRAY_MULTIPLE_K{
static int f_gold ( int a [ ] , int n , int k ) {
int result = 0 ;
for ( int i = 0 ;
i < n ;
++ i ) {
if ( a [ i ] != 1 && a [ i ] > k ) {
result = result + Math . min ( a [ i ] % k , k - a [ i ] % k ) ;
}
else {
result = result + k - a [ i ] ;
}
}
return result ;
}
| def f_gold ( a , n , k ) :
result = 0
for i in range ( n ) :
if ( a [ i ] != 1 and a [ i ] > k ) :
result = ( result + min ( a [ i ] % k , k - a [ i ] % k ) )
else :
result = result + k - a [ i ]
return result
|
using namespace std;
int f_gold ( int a [ ], int n, int k ) {
int result = 0;
for ( int i = 0;
i < n;
++ i ) {
if ( a [ i ] != 1 && a [ i ] > k ) {
result = result + min ( a [ i ] % k, k - a [ i ] % k );
}
else {
result = result + k - a [ i ];
}
}
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,7,27,32,36,37,44,48,50,64,86});
param0.add(new int[]{-22,6,-20,60,-74,98,52,-22});
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,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{77,11,51,11,84,79,43,12,14,50,15,6,85,32,74,49,7,2,58});
param0.add(new int[]{-90,-66,-64,-58,-46,-44,-32,-30,-30,-22,-18,-14,12,12,18,34,44,60,70,70,74,76,86,98,98});
param0.add(new int[]{1,1,0,0,0,0,1,0,0,1,1,1,0,1,1,1,0,0,0,1,1,1,1,0,1,0,1,1,1,1,1,0,0,0,0,1,1});
param0.add(new int[]{9,22,27,27,37,53,53,56,63,73,76,81,82});
param0.add(new int[]{-46,60,80,80,42,-98,30,-48,4,-32,-78,40,52,26,88,4,22,62,88,-94,2,0,58,38,52,-50,-52,58,-62,30,-38,-8,-82,-66});
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});
param0.add(new int[]{42,69,93,82,8,23,73,1,77,39,49,4,95,85});
List<Integer> param1 = new ArrayList<>();
param1.add(5);
param1.add(5);
param1.add(23);
param1.add(9);
param1.add(12);
param1.add(36);
param1.add(10);
param1.add(18);
param1.add(19);
param1.add(12);
List<Integer> param2 = new ArrayList<>();
param2.add(10);
param2.add(4);
param2.add(29);
param2.add(17);
param2.add(22);
param2.add(31);
param2.add(11);
param2.add(19);
param2.add(22);
param2.add(13);
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, 7, 27, 32, 36, 37, 44, 48, 50, 64, 86],5,10,),
([-22, 6, -20, 60, -74, 98, 52, -22],5,4,),
([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],23,29,),
([77, 11, 51, 11, 84, 79, 43, 12, 14, 50, 15, 6, 85, 32, 74, 49, 7, 2, 58],9,17,),
([-90, -66, -64, -58, -46, -44, -32, -30, -30, -22, -18, -14, 12, 12, 18, 34, 44, 60, 70, 70, 74, 76, 86, 98, 98],12,22,),
([1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1],36,31,),
([9, 22, 27, 27, 37, 53, 53, 56, 63, 73, 76, 81, 82],10,11,),
([-46, 60, 80, 80, 42, -98, 30, -48, 4, -32, -78, 40, 52, 26, 88, 4, 22, 62, 88, -94, 2, 0, 58, 38, 52, -50, -52, 58, -62, 30, -38, -8, -82, -66],18,19,),
([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],19,22,),
([42, 69, 93, 82, 8, 23, 73, 1, 77, 39, 49, 4, 95, 85],12,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 {{3,7,27,32,36,37,44,48,50,64,86},{-22,6,-20,60,-74,98,52,-22},{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},{77,11,51,11,84,79,43,12,14,50,15,6,85,32,74,49,7,2,58},{-90,-66,-64,-58,-46,-44,-32,-30,-30,-22,-18,-14,12,12,18,34,44,60,70,70,74,76,86,98,98},{1,1,0,0,0,0,1,0,0,1,1,1,0,1,1,1,0,0,0,1,1,1,1,0,1,0,1,1,1,1,1,0,0,0,0,1,1},{9,22,27,27,37,53,53,56,63,73,76,81,82},{-46,60,80,80,42,-98,30,-48,4,-32,-78,40,52,26,88,4,22,62,88,-94,2,0,58,38,52,-50,-52,58,-62,30,-38,-8,-82,-66},{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},{42,69,93,82,8,23,73,1,77,39,49,4,95,85}};
vector<int> param1 {5,5,23,9,12,36,10,18,19,12};
vector<int> param2 {10,4,29,17,22,31,11,19,22,13};
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;
} |
MINIMUM_PRODUCT_K_INTEGERS_ARRAY_POSITIVE_INTEGERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_PRODUCT_K_INTEGERS_ARRAY_POSITIVE_INTEGERS{
public static int f_gold ( int [ ] arr , int n , int k ) {
PriorityQueue < Integer > pq = new PriorityQueue < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) pq . add ( arr [ i ] ) ;
int count = 0 , ans = 1 ;
while ( pq . isEmpty ( ) == false && count < k ) {
ans = ans * pq . element ( ) ;
pq . remove ( ) ;
count ++ ;
}
return ans ;
}
| null |
using namespace std;
int f_gold ( int arr [ ], int n, int k ) {
priority_queue < int, vector < int >, greater < int > > pq;
for ( int i = 0;
i < n;
i ++ ) pq . push ( arr [ i ] );
int count = 0, ans = 1;
while ( pq . empty ( ) == false && count < k ) {
ans = ans * pq . top ( );
pq . pop ( );
count ++;
}
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{57,66,91});
param0.add(new int[]{-44,86,28,-70,-12,96,-10,74,-50,-52,-6,64,-62,92,-24,90,-26,-4,-92,-24,-84,76,-92,62,-62,-86,-86,-14,50,30,62,2,-88,-78,-48});
param0.add(new int[]{0,0,1,1});
param0.add(new int[]{99,85,37,27,55,20,76,38,33,78,24,80,74,42,15,16,97,51,71,92,18,63,47,10,6,72,40,21,14,68,98,49,48,64,50,66,44,1,26,55,61,43,9,16,8,42,51,98,1});
param0.add(new int[]{-58,-12,16,18,24});
param0.add(new int[]{0,0,1,0,0,1,0,1,0,0,0,0,0,1,1,1});
param0.add(new int[]{5,10,13,14,19,21,22,25,28,36,39,44,46,53,54,55,55,67,73,75,77,78,80,84,91,94,96});
param0.add(new int[]{18,-44,46,64,86,-36,8,-10,-50,-98,-6,-38,-34,14,-34,86,58,-30,76,6,38,98,78,56,-56,-66,-58,62,92,-94});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{69,74,28,75,84,52,5,19,80,12,76,14,28,63,30,29,16,74,28,48,97,77,62,19,67,26,14,44,52,86,9,31,41,14,66,27,36,98,48,37,2,12,2});
List<Integer> param1 = new ArrayList<>();
param1.add(2);
param1.add(29);
param1.add(3);
param1.add(36);
param1.add(2);
param1.add(8);
param1.add(23);
param1.add(23);
param1.add(13);
param1.add(27);
List<Integer> param2 = new ArrayList<>();
param2.add(2);
param2.add(21);
param2.add(3);
param2.add(47);
param2.add(3);
param2.add(15);
param2.add(23);
param2.add(20);
param2.add(17);
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());
}
} | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{57,66,91},{-44,86,28,-70,-12,96,-10,74,-50,-52,-6,64,-62,92,-24,90,-26,-4,-92,-24,-84,76,-92,62,-62,-86,-86,-14,50,30,62,2,-88,-78,-48},{0,0,1,1},{99,85,37,27,55,20,76,38,33,78,24,80,74,42,15,16,97,51,71,92,18,63,47,10,6,72,40,21,14,68,98,49,48,64,50,66,44,1,26,55,61,43,9,16,8,42,51,98,1},{-58,-12,16,18,24},{0,0,1,0,0,1,0,1,0,0,0,0,0,1,1,1},{5,10,13,14,19,21,22,25,28,36,39,44,46,53,54,55,55,67,73,75,77,78,80,84,91,94,96},{18,-44,46,64,86,-36,8,-10,-50,-98,-6,-38,-34,14,-34,86,58,-30,76,6,38,98,78,56,-56,-66,-58,62,92,-94},{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{69,74,28,75,84,52,5,19,80,12,76,14,28,63,30,29,16,74,28,48,97,77,62,19,67,26,14,44,52,86,9,31,41,14,66,27,36,98,48,37,2,12,2}};
vector<int> param1 {2,29,3,36,2,8,23,23,13,27};
vector<int> param2 {2,21,3,47,3,15,23,20,17,23};
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;
} |
COUNT_PALINDROME_SUB_STRINGS_STRING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_PALINDROME_SUB_STRINGS_STRING{
static int f_gold ( char str [ ] , int n ) {
int dp [ ] [ ] = new int [ n ] [ n ] ;
boolean P [ ] [ ] = new boolean [ n ] [ n ] ;
for ( int i = 0 ;
i < n ;
i ++ ) P [ i ] [ i ] = true ;
for ( int i = 0 ;
i < n - 1 ;
i ++ ) {
if ( str [ i ] == str [ i + 1 ] ) {
P [ i ] [ i + 1 ] = true ;
dp [ i ] [ i + 1 ] = 1 ;
}
}
for ( int gap = 2 ;
gap < n ;
gap ++ ) {
for ( int i = 0 ;
i < n - gap ;
i ++ ) {
int j = gap + i ;
if ( str [ i ] == str [ j ] && P [ i + 1 ] [ j - 1 ] ) P [ i ] [ j ] = true ;
if ( P [ i ] [ j ] == true ) dp [ i ] [ j ] = dp [ i ] [ j - 1 ] + dp [ i + 1 ] [ j ] + 1 - dp [ i + 1 ] [ j - 1 ] ;
else dp [ i ] [ j ] = dp [ i ] [ j - 1 ] + dp [ i + 1 ] [ j ] - dp [ i + 1 ] [ j - 1 ] ;
}
}
return dp [ 0 ] [ n - 1 ] ;
}
| def f_gold ( str , n ) :
dp = [ [ 0 for x in range ( n ) ] for y in range ( n ) ]
P = [ [ False for x in range ( n ) ] for y in range ( n ) ]
for i in range ( n ) :
P [ i ] [ i ] = True
for i in range ( n - 1 ) :
if ( str [ i ] == str [ i + 1 ] ) :
P [ i ] [ i + 1 ] = True
dp [ i ] [ i + 1 ] = 1
for gap in range ( 2 , n ) :
for i in range ( n - gap ) :
j = gap + i ;
if ( str [ i ] == str [ j ] and P [ i + 1 ] [ j - 1 ] ) :
P [ i ] [ j ] = True
if ( P [ i ] [ j ] == True ) :
dp [ i ] [ j ] = ( dp [ i ] [ j - 1 ] + dp [ i + 1 ] [ j ] + 1 - dp [ i + 1 ] [ j - 1 ] )
else :
dp [ i ] [ j ] = ( dp [ i ] [ j - 1 ] + dp [ i + 1 ] [ j ] - dp [ i + 1 ] [ j - 1 ] )
return dp [ 0 ] [ n - 1 ]
|
using namespace std;
int f_gold ( char str [ ], int n ) {
int dp [ n ] [ n ];
memset ( dp, 0, sizeof ( dp ) );
bool P [ n ] [ n ];
memset ( P, false, sizeof ( P ) );
for ( int i = 0;
i < n;
i ++ ) P [ i ] [ i ] = true;
for ( int i = 0;
i < n - 1;
i ++ ) {
if ( str [ i ] == str [ i + 1 ] ) {
P [ i ] [ i + 1 ] = true;
dp [ i ] [ i + 1 ] = 1;
}
}
for ( int gap = 2;
gap < n;
gap ++ ) {
for ( int i = 0;
i < n - gap;
i ++ ) {
int j = gap + i;
if ( str [ i ] == str [ j ] && P [ i + 1 ] [ j - 1 ] ) P [ i ] [ j ] = true;
if ( P [ i ] [ j ] == true ) dp [ i ] [ j ] = dp [ i ] [ j - 1 ] + dp [ i + 1 ] [ j ] + 1 - dp [ i + 1 ] [ j - 1 ];
else dp [ i ] [ j ] = dp [ i ] [ j - 1 ] + dp [ i + 1 ] [ j ] - dp [ i + 1 ] [ j - 1 ];
}
}
return dp [ 0 ] [ n - 1 ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<char [ ]> param0 = new ArrayList<>();
param0.add(new char[]{'E','E','J','P','T','U','X','Y','Z','e','f','h','l','m','n','o','z'});
param0.add(new char[]{'8','7','3','4','9','5','3','1','4','0','6','8','2','5','8','3','5','2','8','6','6','3','5','7','5','5','3','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','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[]{'f','E','e','z','B','o','i','v','K','u','P','C','z','f','k','J','t','R','t','A','f','G','D','X','H','e','p','l','l','k','Z','Y','u','g','H','C','f','J','H','W'});
param0.add(new char[]{'0','0','0','1','1','1','1','1','1','2','2','2','3','3','3','3','3','4','4','4','4','4','4','5','5','5','5','6','6','7','7','9','9','9','9','9','9'});
param0.add(new char[]{'1','0','1','1','0','0','1','1','1','0','1','0','1','1','0','1','0','1','1','1','1','1','0','1','1','0','1','0','1','1','0','0','1','0','1','0','0','0','0','0','1','1','0','1','0','1'});
param0.add(new char[]{'C','C','D','F','L','M','P','X','a','f','i','j','w'});
param0.add(new char[]{'7','9','0','2','8','0','7','5','9','4','5','4','8','1','9','5','3','2','4','1','2'});
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','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[]{'m','X','N','M'});
List<Integer> param1 = new ArrayList<>();
param1.add(11);
param1.add(27);
param1.add(23);
param1.add(27);
param1.add(35);
param1.add(43);
param1.add(9);
param1.add(16);
param1.add(32);
param1.add(3);
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 = [
(['E', 'E', 'J', 'P', 'T', 'U', 'X', 'Y', 'Z', 'e', 'f', 'h', 'l', 'm', 'n', 'o', 'z'],11,),
(['8', '7', '3', '4', '9', '5', '3', '1', '4', '0', '6', '8', '2', '5', '8', '3', '5', '2', '8', '6', '6', '3', '5', '7', '5', '5', '3', '7'],27,),
(['0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1'],23,),
(['f', 'E', 'e', 'z', 'B', 'o', 'i', 'v', 'K', 'u', 'P', 'C', 'z', 'f', 'k', 'J', 't', 'R', 't', 'A', 'f', 'G', 'D', 'X', 'H', 'e', 'p', 'l', 'l', 'k', 'Z', 'Y', 'u', 'g', 'H', 'C', 'f', 'J', 'H', 'W'],27,),
(['0', '0', '0', '1', '1', '1', '1', '1', '1', '2', '2', '2', '3', '3', '3', '3', '3', '4', '4', '4', '4', '4', '4', '5', '5', '5', '5', '6', '6', '7', '7', '9', '9', '9', '9', '9', '9'],35,),
(['1', '0', '1', '1', '0', '0', '1', '1', '1', '0', '1', '0', '1', '1', '0', '1', '0', '1', '1', '1', '1', '1', '0', '1', '1', '0', '1', '0', '1', '1', '0', '0', '1', '0', '1', '0', '0', '0', '0', '0', '1', '1', '0', '1', '0', '1'],43,),
(['C', 'C', 'D', 'F', 'L', 'M', 'P', 'X', 'a', 'f', 'i', 'j', 'w'],9,),
(['7', '9', '0', '2', '8', '0', '7', '5', '9', '4', '5', '4', '8', '1', '9', '5', '3', '2', '4', '1', '2'],16,),
(['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'],32,),
(['m', 'X', 'N', 'M'],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<vector<char>> param0 {{'E','E','J','P','T','U','X','Y','Z','e','f','h','l','m','n','o','z'},{'8','7','3','4','9','5','3','1','4','0','6','8','2','5','8','3','5','2','8','6','6','3','5','7','5','5','3','7'},{'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'},{'f','E','e','z','B','o','i','v','K','u','P','C','z','f','k','J','t','R','t','A','f','G','D','X','H','e','p','l','l','k','Z','Y','u','g','H','C','f','J','H','W'},{'0','0','0','1','1','1','1','1','1','2','2','2','3','3','3','3','3','4','4','4','4','4','4','5','5','5','5','6','6','7','7','9','9','9','9','9','9'},{'1','0','1','1','0','0','1','1','1','0','1','0','1','1','0','1','0','1','1','1','1','1','0','1','1','0','1','0','1','1','0','0','1','0','1','0','0','0','0','0','1','1','0','1','0','1'},{'C','C','D','F','L','M','P','X','a','f','i','j','w'},{'7','9','0','2','8','0','7','5','9','4','5','4','8','1','9','5','3','2','4','1','2'},{'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'},{'m','X','N','M'}};
vector<int> param1 {11,27,23,27,35,43,9,16,32,3};
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;
} |
MIDDLE_OF_THREE_USING_MINIMUM_COMPARISONS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MIDDLE_OF_THREE_USING_MINIMUM_COMPARISONS{
public static int f_gold ( int a , int b , int c ) {
if ( ( a < b && b < c ) || ( c < b && b < a ) ) return b ;
else if ( ( b < a && a < c ) || ( c < a && a < b ) ) return a ;
else return c ;
}
| def f_gold ( a , b , c ) :
if ( ( a < b and b < c ) or ( c < b and b < a ) ) :
return b ;
if ( ( b < a and a < c ) or ( c < a and a < b ) ) :
return a ;
else :
return c
|
using namespace std;
int f_gold ( int a, int b, int c ) {
if ( ( a < b && b < c ) || ( c < b && b < a ) ) return b;
else if ( ( b < a && a < c ) || ( c < a && a < b ) ) return a;
else return c;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(56);
param0.add(56);
param0.add(36);
param0.add(71);
param0.add(3);
param0.add(84);
param0.add(30);
param0.add(82);
param0.add(90);
param0.add(38);
List<Integer> param1 = new ArrayList<>();
param1.add(5);
param1.add(60);
param1.add(56);
param1.add(54);
param1.add(70);
param1.add(57);
param1.add(80);
param1.add(54);
param1.add(70);
param1.add(4);
List<Integer> param2 = new ArrayList<>();
param2.add(82);
param2.add(17);
param2.add(51);
param2.add(6);
param2.add(81);
param2.add(47);
param2.add(85);
param2.add(32);
param2.add(55);
param2.add(5);
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 = [
(56,5,82,),
(56,60,17,),
(36,56,51,),
(71,54,6,),
(3,70,81,),
(84,57,47,),
(30,80,85,),
(82,54,32,),
(90,70,55,),
(38,4,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<int> param0 {56,56,36,71,3,84,30,82,90,38};
vector<int> param1 {5,60,56,54,70,57,80,54,70,4};
vector<int> param2 {82,17,51,6,81,47,85,32,55,5};
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;
} |
SWAP_TWO_NIBBLES_BYTE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SWAP_TWO_NIBBLES_BYTE{
static int f_gold ( int x ) {
return ( ( x & 0x0F ) << 4 | ( x & 0xF0 ) >> 4 ) ;
}
| def f_gold ( x ) :
return ( ( x & 0x0F ) << 4 | ( x & 0xF0 ) >> 4 )
|
using namespace std;
int f_gold ( int x ) {
return ( ( x & 0x0F ) << 4 | ( x & 0xF0 ) >> 4 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(57);
param0.add(99);
param0.add(66);
param0.add(97);
param0.add(95);
param0.add(42);
param0.add(95);
param0.add(89);
param0.add(3);
param0.add(84);
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,),
(99,),
(66,),
(97,),
(95,),
(42,),
(95,),
(89,),
(3,),
(84,)
]
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,99,66,97,95,42,95,89,3,84};
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_MATRIX_ELEMENT_ELEMENT_INTEGER_DIVISION_ROW_COLUMN_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_MATRIX_ELEMENT_ELEMENT_INTEGER_DIVISION_ROW_COLUMN_1{
static int f_gold ( int n ) {
int ans = 0 , temp = 0 , num ;
for ( int i = 1 ;
i <= n && temp < n ;
i ++ ) {
temp = i - 1 ;
num = 1 ;
while ( temp < n ) {
if ( temp + i <= n ) ans += ( i * num ) ;
else ans += ( ( n - temp ) * num ) ;
temp += i ;
num ++ ;
}
}
return ans ;
}
| def f_gold ( n ) :
ans = 0 ; temp = 0 ;
for i in range ( 1 , n + 1 ) :
if temp < n :
temp = i - 1
num = 1
while temp < n :
if temp + i <= n :
ans += i * num
else :
ans += ( n - temp ) * num
temp += i
num += 1
return ans
|
using namespace std;
int f_gold ( int n ) {
int ans = 0, temp = 0, num;
for ( int i = 1;
i <= n && temp < n;
i ++ ) {
temp = i - 1;
num = 1;
while ( temp < n ) {
if ( temp + i <= n ) ans += ( i * num );
else ans += ( ( n - temp ) * num );
temp += i;
num ++;
}
}
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(35);
param0.add(93);
param0.add(7);
param0.add(81);
param0.add(80);
param0.add(47);
param0.add(7);
param0.add(41);
param0.add(59);
param0.add(34);
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 = [
(35,),
(93,),
(7,),
(81,),
(80,),
(47,),
(7,),
(41,),
(59,),
(34,)
]
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,93,7,81,80,47,7,41,59,34};
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_FIBONACCI_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_FIBONACCI_NUMBERS{
static int f_gold ( int n ) {
if ( n <= 0 ) return 0 ;
int fibo [ ] = new int [ n + 1 ] ;
fibo [ 0 ] = 0 ;
fibo [ 1 ] = 1 ;
int sum = fibo [ 0 ] + fibo [ 1 ] ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
fibo [ i ] = fibo [ i - 1 ] + fibo [ i - 2 ] ;
sum += fibo [ i ] ;
}
return sum ;
}
| def f_gold ( n ) :
if ( n <= 0 ) :
return 0
fibo = [ 0 ] * ( n + 1 )
fibo [ 1 ] = 1
sm = fibo [ 0 ] + fibo [ 1 ]
for i in range ( 2 , n + 1 ) :
fibo [ i ] = fibo [ i - 1 ] + fibo [ i - 2 ]
sm = sm + fibo [ i ]
return sm
|
using namespace std;
int f_gold ( int n ) {
if ( n <= 0 ) return 0;
int fibo [ n + 1 ];
fibo [ 0 ] = 0, fibo [ 1 ] = 1;
int sum = fibo [ 0 ] + fibo [ 1 ];
for ( int i = 2;
i <= n;
i ++ ) {
fibo [ i ] = fibo [ i - 1 ] + fibo [ i - 2 ];
sum += fibo [ i ];
}
return sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(9);
param0.add(50);
param0.add(7);
param0.add(21);
param0.add(21);
param0.add(91);
param0.add(11);
param0.add(25);
param0.add(62);
param0.add(4);
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,),
(50,),
(7,),
(21,),
(21,),
(91,),
(11,),
(25,),
(62,),
(4,)
]
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,50,7,21,21,91,11,25,62,4};
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_INCREASING_SUBSEQUENCE_LCS_LIS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LONGEST_COMMON_INCREASING_SUBSEQUENCE_LCS_LIS{
static int f_gold ( int arr1 [ ] , int n , int arr2 [ ] , int m ) {
int table [ ] = new int [ m ] ;
for ( int j = 0 ;
j < m ;
j ++ ) table [ j ] = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int current = 0 ;
for ( int j = 0 ;
j < m ;
j ++ ) {
if ( arr1 [ i ] == arr2 [ j ] ) if ( current + 1 > table [ j ] ) table [ j ] = current + 1 ;
if ( arr1 [ i ] > arr2 [ j ] ) if ( table [ j ] > current ) current = table [ j ] ;
}
}
int result = 0 ;
for ( int i = 0 ;
i < m ;
i ++ ) if ( table [ i ] > result ) result = table [ i ] ;
return result ;
}
| def f_gold ( arr1 , n , arr2 , m ) :
table = [ 0 ] * m
for j in range ( m ) :
table [ j ] = 0
for i in range ( n ) :
current = 0
for j in range ( m ) :
if ( arr1 [ i ] == arr2 [ j ] ) :
if ( current + 1 > table [ j ] ) :
table [ j ] = current + 1
if ( arr1 [ i ] > arr2 [ j ] ) :
if ( table [ j ] > current ) :
current = table [ j ]
result = 0
for i in range ( m ) :
if ( table [ i ] > result ) :
result = table [ i ]
return result
|
using namespace std;
int f_gold ( int arr1 [ ], int n, int arr2 [ ], int m ) {
int table [ m ];
for ( int j = 0;
j < m;
j ++ ) table [ j ] = 0;
for ( int i = 0;
i < n;
i ++ ) {
int current = 0;
for ( int j = 0;
j < m;
j ++ ) {
if ( arr1 [ i ] == arr2 [ j ] ) if ( current + 1 > table [ j ] ) table [ j ] = current + 1;
if ( arr1 [ i ] > arr2 [ j ] ) if ( table [ j ] > current ) current = table [ j ];
}
}
int result = 0;
for ( int i = 0;
i < m;
i ++ ) if ( table [ i ] > result ) result = table [ i ];
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,7,9,35,43,51,51,66,88});
param0.add(new int[]{-52,52,-92,-46,-94,30,-36,18,-98,22,-36,96,-88,-50,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});
param0.add(new int[]{5,74,29});
param0.add(new int[]{-84,-74,-70,-62,-56,-56,-52,-2,6,24,28,44,44,52});
param0.add(new int[]{0,0,0,1,0,1,0,0,1,1,1,1,0,0,1,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0});
param0.add(new int[]{3,4,4,7,15,15,16,22,32,32,37,39,39,41,43,46,47,47,49,75,79,80,86,88,93});
param0.add(new int[]{70,-64,0,52,32,-98,38,-8,34,70,98,58,-48,-60,-28,-22,-72,82,-98,-36});
param0.add(new int[]{0,0,1,1,1,1,1,1});
param0.add(new int[]{46,87,98});
List<Integer> param1 = new ArrayList<>();
param1.add(5);
param1.add(7);
param1.add(36);
param1.add(1);
param1.add(8);
param1.add(17);
param1.add(19);
param1.add(16);
param1.add(7);
param1.add(2);
List<int [ ]> param2 = new ArrayList<>();
param2.add(new int[]{10,21,38,50,65,67,87,93,99});
param2.add(new int[]{-58,40,56,-62,-92,-94,40,18,-2,-76,-78,-14,44,84,4});
param2.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,1,1,1,1,1,1,1,1,1,1});
param2.add(new int[]{57,33,48});
param2.add(new int[]{-98,-96,-88,-66,-32,-26,-24,-20,-4,20,48,74,90,96});
param2.add(new int[]{1,0,1,1,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,0});
param2.add(new int[]{9,12,15,20,22,27,28,28,30,31,35,39,47,58,58,60,73,74,76,78,80,86,95,96,98});
param2.add(new int[]{-18,88,-40,-52,30,-10,-18,-56,84,-22,-64,80,-14,-64,40,92,48,-8,24,82});
param2.add(new int[]{0,1,1,1,1,1,1,1});
param2.add(new int[]{67,31,54});
List<Integer> param3 = new ArrayList<>();
param3.add(8);
param3.add(10);
param3.add(22);
param3.add(1);
param3.add(12);
param3.add(15);
param3.add(14);
param3.add(12);
param3.add(7);
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 = [
([1, 7, 9, 35, 43, 51, 51, 66, 88],5,[10, 21, 38, 50, 65, 67, 87, 93, 99],8,),
([-52, 52, -92, -46, -94, 30, -36, 18, -98, 22, -36, 96, -88, -50, 50],7,[-58, 40, 56, -62, -92, -94, 40, 18, -2, -76, -78, -14, 44, 84, 4],10,),
([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],36,[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],22,),
([5, 74, 29],1,[57, 33, 48],1,),
([-84, -74, -70, -62, -56, -56, -52, -2, 6, 24, 28, 44, 44, 52],8,[-98, -96, -88, -66, -32, -26, -24, -20, -4, 20, 48, 74, 90, 96],12,),
([0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0],17,[1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0],15,),
([3, 4, 4, 7, 15, 15, 16, 22, 32, 32, 37, 39, 39, 41, 43, 46, 47, 47, 49, 75, 79, 80, 86, 88, 93],19,[9, 12, 15, 20, 22, 27, 28, 28, 30, 31, 35, 39, 47, 58, 58, 60, 73, 74, 76, 78, 80, 86, 95, 96, 98],14,),
([70, -64, 0, 52, 32, -98, 38, -8, 34, 70, 98, 58, -48, -60, -28, -22, -72, 82, -98, -36],16,[-18, 88, -40, -52, 30, -10, -18, -56, 84, -22, -64, 80, -14, -64, 40, 92, 48, -8, 24, 82],12,),
([0, 0, 1, 1, 1, 1, 1, 1],7,[0, 1, 1, 1, 1, 1, 1, 1],7,),
([46, 87, 98],2,[67, 31, 54],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 {{1,7,9,35,43,51,51,66,88},{-52,52,-92,-46,-94,30,-36,18,-98,22,-36,96,-88,-50,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},{5,74,29},{-84,-74,-70,-62,-56,-56,-52,-2,6,24,28,44,44,52},{0,0,0,1,0,1,0,0,1,1,1,1,0,0,1,0,1,0,1,1,0,0,1,0,1,1,0,0,1,0},{3,4,4,7,15,15,16,22,32,32,37,39,39,41,43,46,47,47,49,75,79,80,86,88,93},{70,-64,0,52,32,-98,38,-8,34,70,98,58,-48,-60,-28,-22,-72,82,-98,-36},{0,0,1,1,1,1,1,1},{46,87,98}};
vector<int> param1 {5,7,36,1,8,17,19,16,7,2};
vector<vector<int>> param2 {{10,21,38,50,65,67,87,93,99},{-58,40,56,-62,-92,-94,40,18,-2,-76,-78,-14,44,84,4},{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},{57,33,48},{-98,-96,-88,-66,-32,-26,-24,-20,-4,20,48,74,90,96},{1,0,1,1,0,0,0,0,1,1,1,0,1,0,0,0,0,1,0,0,0,0,1,1,1,1,1,1,1,0},{9,12,15,20,22,27,28,28,30,31,35,39,47,58,58,60,73,74,76,78,80,86,95,96,98},{-18,88,-40,-52,30,-10,-18,-56,84,-22,-64,80,-14,-64,40,92,48,-8,24,82},{0,1,1,1,1,1,1,1},{67,31,54}};
vector<int> param3 {8,10,22,1,12,15,14,12,7,2};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(¶m0[i].front(),param1[i],¶m2[i].front(),param3[i]) == f_gold(¶m0[i].front(),param1[i],¶m2[i].front(),param3[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
COUNT_SUBSETS_DISTINCT_EVEN_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_SUBSETS_DISTINCT_EVEN_NUMBERS{
static int f_gold ( int arr [ ] , int n ) {
HashSet < Integer > us = new HashSet < > ( ) ;
int even_count = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) if ( arr [ i ] % 2 == 0 ) us . add ( arr [ i ] ) ;
even_count = us . size ( ) ;
return ( int ) ( Math . pow ( 2 , even_count ) - 1 ) ;
}
| null |
using namespace std;
int f_gold ( int arr [ ], int n ) {
unordered_set < int > us;
int even_count = 0;
for ( int i = 0;
i < n;
i ++ ) if ( arr [ i ] % 2 == 0 ) us . insert ( arr [ i ] );
unordered_set < int > :: iterator itr;
for ( itr = us . begin ( );
itr != us . end ( );
itr ++ ) even_count ++;
return ( pow ( 2, even_count ) - 1 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,8,14,22,24,24,26,32,33,46,50,51,51,52,53,71,76,93});
param0.add(new int[]{-62,30,12,30,22,6,-42,80,-62,34,32,-72,-6,-16,42,82,-78,-20,-96,44,-24,-50,-50,-94,72,-90,38,84,-86,-24,-62,86,94,6,90,12,-36,0,44,4,-78,-86,-12,-18,26,32,90,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,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[]{70,55,67,9,78,57,31,25});
param0.add(new int[]{-98,-90,-80,-80,-68,-68,-50,-44,-38,-34,-18,-16,-10,-8,14,14,16,24,26,28,30,40,44,46,52,54,58,66,74,74,74,76,80,86,94,96});
param0.add(new int[]{0,1,1,0,1,0,0,1,0,0,1,1,1,1,0,0,0,0,0,1});
param0.add(new int[]{7,10,11,13,14,16,20,26,30,31,33,33,35,39,42,50,51,52,55,57,58,59,62,63,63,65,67,67,68,69,69,71,73,73,74,76,82,86,87,87,87,88,94,99});
param0.add(new int[]{-6,8,-14,2,-36,-44,-50,-4,-4,-22,94,-94,-62,4,-84,-82,88,84,28,76,-84,-72,14,-28,96,18,-56,-96,2,-66,62,-78,88,34,0,-48,-76,-84,-2,-98,58,38,56});
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,1,1,1,1});
param0.add(new int[]{75,92,42,5,53,78,42,97,99,56,23,16,90,1,79,49,63,95,12,21,82,31,10,35,34,80,22,73,68,68,48,11,15,60,24,57,74,18,30,57,66,97,78,65,79});
List<Integer> param1 = new ArrayList<>();
param1.add(16);
param1.add(47);
param1.add(32);
param1.add(6);
param1.add(30);
param1.add(11);
param1.add(39);
param1.add(23);
param1.add(17);
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());
}
} | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{2,8,14,22,24,24,26,32,33,46,50,51,51,52,53,71,76,93},{-62,30,12,30,22,6,-42,80,-62,34,32,-72,-6,-16,42,82,-78,-20,-96,44,-24,-50,-50,-94,72,-90,38,84,-86,-24,-62,86,94,6,90,12,-36,0,44,4,-78,-86,-12,-18,26,32,90,76},{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},{70,55,67,9,78,57,31,25},{-98,-90,-80,-80,-68,-68,-50,-44,-38,-34,-18,-16,-10,-8,14,14,16,24,26,28,30,40,44,46,52,54,58,66,74,74,74,76,80,86,94,96},{0,1,1,0,1,0,0,1,0,0,1,1,1,1,0,0,0,0,0,1},{7,10,11,13,14,16,20,26,30,31,33,33,35,39,42,50,51,52,55,57,58,59,62,63,63,65,67,67,68,69,69,71,73,73,74,76,82,86,87,87,87,88,94,99},{-6,8,-14,2,-36,-44,-50,-4,-4,-22,94,-94,-62,4,-84,-82,88,84,28,76,-84,-72,14,-28,96,18,-56,-96,2,-66,62,-78,88,34,0,-48,-76,-84,-2,-98,58,38,56},{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},{75,92,42,5,53,78,42,97,99,56,23,16,90,1,79,49,63,95,12,21,82,31,10,35,34,80,22,73,68,68,48,11,15,60,24,57,74,18,30,57,66,97,78,65,79}};
vector<int> param1 {16,47,32,6,30,11,39,23,17,29};
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_ROTATION_COUNT_ROTATED_SORTED_ARRAY_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_ROTATION_COUNT_ROTATED_SORTED_ARRAY_1{
static int f_gold ( int arr [ ] , int low , int high ) {
if ( high < low ) return 0 ;
if ( high == low ) return low ;
int mid = low + ( high - low ) / 2 ;
if ( mid < high && arr [ mid + 1 ] < arr [ mid ] ) return ( mid + 1 ) ;
if ( mid > low && arr [ mid ] < arr [ mid - 1 ] ) return mid ;
if ( arr [ high ] > arr [ mid ] ) return f_gold ( arr , low , mid - 1 ) ;
return f_gold ( arr , mid + 1 , high ) ;
}
| def f_gold ( arr , low , high ) :
if ( high < low ) :
return 0
if ( high == low ) :
return low
mid = low + ( high - low ) / 2 ;
mid = int ( mid )
if ( mid < high and arr [ mid + 1 ] < arr [ mid ] ) :
return ( mid + 1 )
if ( mid > low and arr [ mid ] < arr [ mid - 1 ] ) :
return mid
if ( arr [ high ] > arr [ mid ] ) :
return f_gold ( arr , low , mid - 1 ) ;
return f_gold ( arr , mid + 1 , high )
|
using namespace std;
int f_gold ( int arr [ ], int low, int high ) {
if ( high < low ) return 0;
if ( high == low ) return low;
int mid = low + ( high - low ) / 2;
if ( mid < high && arr [ mid + 1 ] < arr [ mid ] ) return ( mid + 1 );
if ( mid > low && arr [ mid ] < arr [ mid - 1 ] ) return mid;
if ( arr [ high ] > arr [ mid ] ) return f_gold ( arr, low, mid - 1 );
return f_gold ( arr, mid + 1, high );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,16,38,39,48,74,79});
param0.add(new int[]{-46,72,72,-66,96,92,40,8,94,-84,6,-90,38,-6,48,-20,-86,-76,88,-50,-44,-14,54,-6,-2,72,8,-64,-46,44,-88,50,86,38,42,-56});
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,1,1});
param0.add(new int[]{48,74,59,57,95,11,25,61,46,54,34,84,7,97,62,57,99,93,76,5,76,93,35,84,37,60,65,16,30,73,42,61,74,77,48,62,84,93,64,57,68,46,28,77});
param0.add(new int[]{-72,-68,-66,-66,-62,-62,-52,-48,-42,-42,-42,-38,-30,-22,-20,-20,-16,-16,-14,0,2,2,2,4,12,20,22,26,32,34,46,46,64,64,64,66,68,68,68,74,80,84,84,88,88,90,96,98});
param0.add(new int[]{1});
param0.add(new int[]{7,11,20,21,22,27,30,30,34,35,36,37,38,60,61,63,63,69,70,75,80,84,88,97});
param0.add(new int[]{-2,70,-40});
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,1});
param0.add(new int[]{71,71,27,10,97,43,55,71,6,6,77,48,77,2,83,51,61,19,2,51,26,70,20,23,54,15,6,92,35,75,8,57,50,49,88,21,36});
List<Integer> param1 = new ArrayList<>();
param1.add(6);
param1.add(32);
param1.add(16);
param1.add(24);
param1.add(29);
param1.add(0);
param1.add(23);
param1.add(2);
param1.add(30);
param1.add(24);
List<Integer> param2 = new ArrayList<>();
param2.add(6);
param2.add(21);
param2.add(29);
param2.add(26);
param2.add(43);
param2.add(0);
param2.add(22);
param2.add(1);
param2.add(17);
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 = [
([4, 16, 38, 39, 48, 74, 79],6,6,),
([-46, 72, 72, -66, 96, 92, 40, 8, 94, -84, 6, -90, 38, -6, 48, -20, -86, -76, 88, -50, -44, -14, 54, -6, -2, 72, 8, -64, -46, 44, -88, 50, 86, 38, 42, -56],32,21,),
([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],16,29,),
([48, 74, 59, 57, 95, 11, 25, 61, 46, 54, 34, 84, 7, 97, 62, 57, 99, 93, 76, 5, 76, 93, 35, 84, 37, 60, 65, 16, 30, 73, 42, 61, 74, 77, 48, 62, 84, 93, 64, 57, 68, 46, 28, 77],24,26,),
([-72, -68, -66, -66, -62, -62, -52, -48, -42, -42, -42, -38, -30, -22, -20, -20, -16, -16, -14, 0, 2, 2, 2, 4, 12, 20, 22, 26, 32, 34, 46, 46, 64, 64, 64, 66, 68, 68, 68, 74, 80, 84, 84, 88, 88, 90, 96, 98],29,43,),
([1],0,0,),
([7, 11, 20, 21, 22, 27, 30, 30, 34, 35, 36, 37, 38, 60, 61, 63, 63, 69, 70, 75, 80, 84, 88, 97],23,22,),
([-2, 70, -40],2,1,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],30,17,),
([71, 71, 27, 10, 97, 43, 55, 71, 6, 6, 77, 48, 77, 2, 83, 51, 61, 19, 2, 51, 26, 70, 20, 23, 54, 15, 6, 92, 35, 75, 8, 57, 50, 49, 88, 21, 36],24,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 {{4,16,38,39,48,74,79},{-46,72,72,-66,96,92,40,8,94,-84,6,-90,38,-6,48,-20,-86,-76,88,-50,-44,-14,54,-6,-2,72,8,-64,-46,44,-88,50,86,38,42,-56},{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},{48,74,59,57,95,11,25,61,46,54,34,84,7,97,62,57,99,93,76,5,76,93,35,84,37,60,65,16,30,73,42,61,74,77,48,62,84,93,64,57,68,46,28,77},{-72,-68,-66,-66,-62,-62,-52,-48,-42,-42,-42,-38,-30,-22,-20,-20,-16,-16,-14,0,2,2,2,4,12,20,22,26,32,34,46,46,64,64,64,66,68,68,68,74,80,84,84,88,88,90,96,98},{1},{7,11,20,21,22,27,30,30,34,35,36,37,38,60,61,63,63,69,70,75,80,84,88,97},{-2,70,-40},{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},{71,71,27,10,97,43,55,71,6,6,77,48,77,2,83,51,61,19,2,51,26,70,20,23,54,15,6,92,35,75,8,57,50,49,88,21,36}};
vector<int> param1 {6,32,16,24,29,0,23,2,30,24};
vector<int> param2 {6,21,29,26,43,0,22,1,17,22};
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;
} |
LENGTH_OF_THE_LONGEST_ARITHMATIC_PROGRESSION_IN_A_SORTED_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LENGTH_OF_THE_LONGEST_ARITHMATIC_PROGRESSION_IN_A_SORTED_ARRAY{
static int f_gold ( int set [ ] , int n ) {
if ( n <= 2 ) return n ;
int L [ ] [ ] = new int [ n ] [ n ] ;
int llap = 2 ;
for ( int i = 0 ;
i < n ;
i ++ ) L [ i ] [ n - 1 ] = 2 ;
for ( int j = n - 2 ;
j >= 1 ;
j -- ) {
int i = j - 1 , k = j + 1 ;
while ( i >= 0 && k <= n - 1 ) {
if ( set [ i ] + set [ k ] < 2 * set [ j ] ) k ++ ;
else if ( set [ i ] + set [ k ] > 2 * set [ j ] ) {
L [ i ] [ j ] = 2 ;
i -- ;
}
else {
L [ i ] [ j ] = L [ j ] [ k ] + 1 ;
llap = Math . max ( llap , L [ i ] [ j ] ) ;
i -- ;
k ++ ;
}
}
while ( i >= 0 ) {
L [ i ] [ j ] = 2 ;
i -- ;
}
}
return llap ;
}
| def f_gold ( set , n ) :
if ( n <= 2 ) :
return n
L = [ [ 0 for x in range ( n ) ] for y in range ( n ) ]
llap = 2
for i in range ( n ) :
L [ i ] [ n - 1 ] = 2
for j in range ( n - 2 , 0 , - 1 ) :
i = j - 1
k = j + 1
while ( i >= 0 and k <= n - 1 ) :
if ( set [ i ] + set [ k ] < 2 * set [ j ] ) :
k += 1
elif ( set [ i ] + set [ k ] > 2 * set [ j ] ) :
L [ i ] [ j ] = 2
i -= 1
else :
L [ i ] [ j ] = L [ j ] [ k ] + 1
llap = max ( llap , L [ i ] [ j ] )
i -= 1
k += 1
while ( i >= 0 ) :
L [ i ] [ j ] = 2
i -= 1
return llap
|
using namespace std;
int f_gold ( int set [ ], int n ) {
if ( n <= 2 ) return n;
int L [ n ] [ n ];
int llap = 2;
for ( int i = 0;
i < n;
i ++ ) L [ i ] [ n - 1 ] = 2;
for ( int j = n - 2;
j >= 1;
j -- ) {
int i = j - 1, k = j + 1;
while ( i >= 0 && k <= n - 1 ) {
if ( set [ i ] + set [ k ] < 2 * set [ j ] ) k ++;
else if ( set [ i ] + set [ k ] > 2 * set [ j ] ) {
L [ i ] [ j ] = 2, i --;
}
else {
L [ i ] [ j ] = L [ j ] [ k ] + 1;
llap = max ( llap, L [ i ] [ j ] );
i --;
k ++;
}
}
while ( i >= 0 ) {
L [ i ] [ j ] = 2;
i --;
}
}
return llap;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{3,4,4,7,8,19,21,22,25,27,28,29,38,40,41,42,43,46,50,50,53,53,54,55,60,64,64,69,70,75,77,81,81,82,86,87,87,88,91,94,97});
param0.add(new int[]{40,-6,50,-18,42,78,38,-90,-44,-42,-86,78,-68,2,-32,-20,-44,54,80,54,70,26,82,-14,-74,-20,74,82});
param0.add(new int[]{0,0,0,0,1,1,1});
param0.add(new int[]{76,80});
param0.add(new int[]{-92,-90,-88,-76,-76,-60,-46,-40,-24,-8,-8,-6,2,12,36,38,58,76,80});
param0.add(new int[]{1,1,1,0,0,0,0,1,1,1,0,0,0,1,0,1,1});
param0.add(new int[]{5,8,11,27,27,32,32,37,50,51,55,61,62,68,73,83});
param0.add(new int[]{52,-74,-32,-64,-52,-60,-70,36,70,40,40,-18,90,-70,-82,-64,-8,-6,36,4,-58,62,-96,78,36,90,-70,-6,-84,24,84,32,-90,36,70,-60,-56,78,48,34,-16,80,82,58,14,-6,-8,76});
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});
param0.add(new int[]{11,21,76,45,8,49,97,66,17,11,87,4,34,89,79,88,6,91,19,56,91,25,17,90,26,59,34,32,43,17,98,39,72,78,93,43});
List<Integer> param1 = new ArrayList<>();
param1.add(27);
param1.add(21);
param1.add(5);
param1.add(1);
param1.add(13);
param1.add(15);
param1.add(8);
param1.add(29);
param1.add(27);
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 = [
([3, 4, 4, 7, 8, 19, 21, 22, 25, 27, 28, 29, 38, 40, 41, 42, 43, 46, 50, 50, 53, 53, 54, 55, 60, 64, 64, 69, 70, 75, 77, 81, 81, 82, 86, 87, 87, 88, 91, 94, 97],27,),
([40, -6, 50, -18, 42, 78, 38, -90, -44, -42, -86, 78, -68, 2, -32, -20, -44, 54, 80, 54, 70, 26, 82, -14, -74, -20, 74, 82],21,),
([0, 0, 0, 0, 1, 1, 1],5,),
([76, 80],1,),
([-92, -90, -88, -76, -76, -60, -46, -40, -24, -8, -8, -6, 2, 12, 36, 38, 58, 76, 80],13,),
([1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1],15,),
([5, 8, 11, 27, 27, 32, 32, 37, 50, 51, 55, 61, 62, 68, 73, 83],8,),
([52, -74, -32, -64, -52, -60, -70, 36, 70, 40, 40, -18, 90, -70, -82, -64, -8, -6, 36, 4, -58, 62, -96, 78, 36, 90, -70, -6, -84, 24, 84, 32, -90, 36, 70, -60, -56, 78, 48, 34, -16, 80, 82, 58, 14, -6, -8, 76],29,),
([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],27,),
([11, 21, 76, 45, 8, 49, 97, 66, 17, 11, 87, 4, 34, 89, 79, 88, 6, 91, 19, 56, 91, 25, 17, 90, 26, 59, 34, 32, 43, 17, 98, 39, 72, 78, 93, 43],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 {{3,4,4,7,8,19,21,22,25,27,28,29,38,40,41,42,43,46,50,50,53,53,54,55,60,64,64,69,70,75,77,81,81,82,86,87,87,88,91,94,97},{40,-6,50,-18,42,78,38,-90,-44,-42,-86,78,-68,2,-32,-20,-44,54,80,54,70,26,82,-14,-74,-20,74,82},{0,0,0,0,1,1,1},{76,80},{-92,-90,-88,-76,-76,-60,-46,-40,-24,-8,-8,-6,2,12,36,38,58,76,80},{1,1,1,0,0,0,0,1,1,1,0,0,0,1,0,1,1},{5,8,11,27,27,32,32,37,50,51,55,61,62,68,73,83},{52,-74,-32,-64,-52,-60,-70,36,70,40,40,-18,90,-70,-82,-64,-8,-6,36,4,-58,62,-96,78,36,90,-70,-6,-84,24,84,32,-90,36,70,-60,-56,78,48,34,-16,80,82,58,14,-6,-8,76},{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},{11,21,76,45,8,49,97,66,17,11,87,4,34,89,79,88,6,91,19,56,91,25,17,90,26,59,34,32,43,17,98,39,72,78,93,43}};
vector<int> param1 {27,21,5,1,13,15,8,29,27,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;
} |
FIND_UNIT_DIGIT_X_RAISED_POWER_Y |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_UNIT_DIGIT_X_RAISED_POWER_Y{
static int f_gold ( int x , int y ) {
int res = 1 ;
for ( int i = 0 ;
i < y ;
i ++ ) res = ( res * x ) % 10 ;
return res ;
}
| def f_gold ( x , y ) :
res = 1
for i in range ( y ) :
res = ( res * x ) % 10
return res
|
using namespace std;
int f_gold ( int x, int y ) {
int res = 1;
for ( int i = 0;
i < y;
i ++ ) res = ( res * x ) % 10;
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(33);
param0.add(95);
param0.add(21);
param0.add(3);
param0.add(40);
param0.add(64);
param0.add(17);
param0.add(58);
param0.add(44);
param0.add(27);
List<Integer> param1 = new ArrayList<>();
param1.add(55);
param1.add(7);
param1.add(63);
param1.add(62);
param1.add(53);
param1.add(24);
param1.add(23);
param1.add(74);
param1.add(13);
param1.add(54);
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 = [
(33,55,),
(95,7,),
(21,63,),
(3,62,),
(40,53,),
(64,24,),
(17,23,),
(58,74,),
(44,13,),
(27,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 {33,95,21,3,40,64,17,58,44,27};
vector<int> param1 {55,7,63,62,53,24,23,74,13,54};
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;
} |
FIND_THE_ELEMENT_THAT_APPEARS_ONCE_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THE_ELEMENT_THAT_APPEARS_ONCE_2{
static int f_gold ( int a [ ] , int n ) {
HashSet < Integer > s = new HashSet < Integer > ( ) ;
for ( int i : a ) {
s . add ( i ) ;
}
int arr_sum = 0 ;
for ( int i : a ) {
arr_sum += i ;
}
int set_sum = 0 ;
for ( int i : s ) {
set_sum += i ;
}
return ( 3 * set_sum - arr_sum ) / 2 ;
}
| null |
using namespace std;
int f_gold ( int a [ ], int n ) {
unordered_set < int > s ( a, a + n );
int arr_sum = accumulate ( a, a + n, 0 );
int set_sum = accumulate ( s . begin ( ), s . end ( ), 0 );
return ( 3 * set_sum - arr_sum ) / 2;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{1,3,3,12,16,28,31,44,48,57,59,60,68,69,70,70,72,73,76,78,78,79,84,86,93,96});
param0.add(new int[]{-2,-62,8,-96,-50,-70,-48,-20,76,-54,-62,8,30,-68,-64,-94,-10,-78,-68,-98,0,30,62,-40,-36,90,-46,38,28,-86,-20,12,56,-50,82,-18,-28,-62,88,-58});
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[]{85,33,83,92,40,53,18,39,17,71,15,85,44,12,56,77,54,87,11,74,11,9,73,72,64,98,18,13,74,64,59,44,95,56,6,96,47,36,35,51,30,39,91,74,68});
param0.add(new int[]{-94,-90,-82,-80,-74,-40,-40,-38,-36,-28,-26,-20,-16,-14,-14,-10,-8,-8,10,14,18,22,22,28,28,30,74,82});
param0.add(new int[]{1,1,1,1,1,0,1,0,1,1,0,0,0,0,1,0,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1,1,1,1,1,1});
param0.add(new int[]{2,6,6,12,13,13,15,16,24,25,29,36,42,44,47,47,47,48,51,51,55,55,55,58,58,60,61,62,62,64,66,70,70,75,76,77,78,78,79,80,80,82,83,83,84,85,90,99});
param0.add(new int[]{-94,50,-86,-94,92,-50,74,-54,54,-20,-28,-44,-94,-80,-12,-38,64,-22,38,70,-4,62,66,88,-94,72,88,32,-80,60,-70,-74,-66,82,82});
param0.add(new int[]{0,0,0,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{62,29,76,58,16,7,83,45,17,67,88,78,6,36,33,99,39,59,77,64,32,20,10,92,3,20,7,14,11,28});
List<Integer> param1 = new ArrayList<>();
param1.add(14);
param1.add(26);
param1.add(18);
param1.add(35);
param1.add(27);
param1.add(35);
param1.add(42);
param1.add(34);
param1.add(7);
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());
}
} | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{1,3,3,12,16,28,31,44,48,57,59,60,68,69,70,70,72,73,76,78,78,79,84,86,93,96},{-2,-62,8,-96,-50,-70,-48,-20,76,-54,-62,8,30,-68,-64,-94,-10,-78,-68,-98,0,30,62,-40,-36,90,-46,38,28,-86,-20,12,56,-50,82,-18,-28,-62,88,-58},{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},{85,33,83,92,40,53,18,39,17,71,15,85,44,12,56,77,54,87,11,74,11,9,73,72,64,98,18,13,74,64,59,44,95,56,6,96,47,36,35,51,30,39,91,74,68},{-94,-90,-82,-80,-74,-40,-40,-38,-36,-28,-26,-20,-16,-14,-14,-10,-8,-8,10,14,18,22,22,28,28,30,74,82},{1,1,1,1,1,0,1,0,1,1,0,0,0,0,1,0,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1,1,1,1,1,1},{2,6,6,12,13,13,15,16,24,25,29,36,42,44,47,47,47,48,51,51,55,55,55,58,58,60,61,62,62,64,66,70,70,75,76,77,78,78,79,80,80,82,83,83,84,85,90,99},{-94,50,-86,-94,92,-50,74,-54,54,-20,-28,-44,-94,-80,-12,-38,64,-22,38,70,-4,62,66,88,-94,72,88,32,-80,60,-70,-74,-66,82,82},{0,0,0,1,1,1,1,1,1,1,1,1,1,1},{62,29,76,58,16,7,83,45,17,67,88,78,6,36,33,99,39,59,77,64,32,20,10,92,3,20,7,14,11,28}};
vector<int> param1 {14,26,18,35,27,35,42,34,7,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;
} |
NUMBER_RECTANGLES_NM_GRID |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_RECTANGLES_NM_GRID{
public static long f_gold ( int n , int m ) {
return ( m * n * ( n + 1 ) * ( m + 1 ) ) / 4 ;
}
| def f_gold ( n , m ) :
return ( m * n * ( n + 1 ) * ( m + 1 ) ) // 4
|
using namespace std;
int f_gold ( int n, int m ) {
return ( m * n * ( n + 1 ) * ( m + 1 ) ) / 4;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(86);
param0.add(33);
param0.add(3);
param0.add(91);
param0.add(33);
param0.add(13);
param0.add(75);
param0.add(58);
param0.add(50);
param0.add(4);
List<Integer> param1 = new ArrayList<>();
param1.add(70);
param1.add(65);
param1.add(5);
param1.add(12);
param1.add(27);
param1.add(75);
param1.add(36);
param1.add(64);
param1.add(51);
param1.add(44);
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 = [
(86,70,),
(33,65,),
(3,5,),
(91,12,),
(33,27,),
(13,75,),
(75,36,),
(58,64,),
(50,51,),
(4,44,)
]
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,33,3,91,33,13,75,58,50,4};
vector<int> param1 {70,65,5,12,27,75,36,64,51,44};
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;
} |
COIN_GAME_WINNER_EVERY_PLAYER_THREE_CHOICES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COIN_GAME_WINNER_EVERY_PLAYER_THREE_CHOICES{
static boolean f_gold ( int x , int y , int n ) {
boolean [ ] dp = new boolean [ n + 1 ] ;
Arrays . fill ( dp , false ) ;
dp [ 0 ] = false ;
dp [ 1 ] = true ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
if ( i - 1 >= 0 && dp [ i - 1 ] == false ) dp [ i ] = true ;
else if ( i - x >= 0 && dp [ i - x ] == false ) dp [ i ] = true ;
else if ( i - y >= 0 && dp [ i - y ] == false ) dp [ i ] = true ;
else dp [ i ] = false ;
}
return dp [ n ] ;
}
| def f_gold ( x , y , n ) :
dp = [ 0 for i in range ( n + 1 ) ]
dp [ 0 ] = False
dp [ 1 ] = True
for i in range ( 2 , n + 1 ) :
if ( i - 1 >= 0 and not dp [ i - 1 ] ) :
dp [ i ] = True
elif ( i - x >= 0 and not dp [ i - x ] ) :
dp [ i ] = True
elif ( i - y >= 0 and not dp [ i - y ] ) :
dp [ i ] = True
else :
dp [ i ] = False
return dp [ n ]
|
using namespace std;
bool f_gold ( int x, int y, int n ) {
int dp [ n + 1 ];
dp [ 0 ] = false;
dp [ 1 ] = true;
for ( int i = 2;
i <= n;
i ++ ) {
if ( i - 1 >= 0 and ! dp [ i - 1 ] ) dp [ i ] = true;
else if ( i - x >= 0 and ! dp [ i - x ] ) dp [ i ] = true;
else if ( i - y >= 0 and ! dp [ i - y ] ) dp [ i ] = true;
else dp [ i ] = false;
}
return dp [ n ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(6);
param0.add(32);
param0.add(99);
param0.add(22);
param0.add(26);
param0.add(67);
param0.add(69);
param0.add(39);
param0.add(7);
param0.add(91);
List<Integer> param1 = new ArrayList<>();
param1.add(27);
param1.add(88);
param1.add(18);
param1.add(1);
param1.add(78);
param1.add(51);
param1.add(57);
param1.add(8);
param1.add(82);
param1.add(56);
List<Integer> param2 = new ArrayList<>();
param2.add(51);
param2.add(69);
param2.add(48);
param2.add(74);
param2.add(95);
param2.add(27);
param2.add(91);
param2.add(9);
param2.add(41);
param2.add(7);
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 = [
(6,27,51,),
(32,88,69,),
(99,18,48,),
(22,1,74,),
(26,78,95,),
(67,51,27,),
(69,57,91,),
(39,8,9,),
(7,82,41,),
(91,56,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 {6,32,99,22,26,67,69,39,7,91};
vector<int> param1 {27,88,18,1,78,51,57,8,82,56};
vector<int> param2 {51,69,48,74,95,27,91,9,41,7};
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;
} |
NUMBER_VISIBLE_BOXES_PUTTING_ONE_INSIDE_ANOTHER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_VISIBLE_BOXES_PUTTING_ONE_INSIDE_ANOTHER{
static int f_gold ( int [ ] arr , int n ) {
Queue < Integer > q = new LinkedList < > ( ) ;
Arrays . sort ( arr ) ;
q . add ( arr [ 0 ] ) ;
for ( int i = 1 ;
i < n ;
i ++ ) {
int now = q . element ( ) ;
if ( arr [ i ] >= 2 * now ) q . remove ( ) ;
q . add ( arr [ i ] ) ;
}
return q . size ( ) ;
}
| import collections
def f_gold ( arr , n ) :
q = collections.deque ( [ ] )
arr.sort ( )
q.append ( arr [ 0 ] )
for i in range ( 1 , n ) :
now = q [ 0 ]
if ( arr [ i ] >= 2 * now ) :
q.popleft ( )
q.append ( arr [ i ] )
return len ( q )
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
queue < int > q;
sort ( arr, arr + n );
q . push ( arr [ 0 ] );
for ( int i = 1;
i < n;
i ++ ) {
int now = q . front ( );
if ( arr [ i ] >= 2 * now ) q . pop ( );
q . push ( arr [ i ] );
}
return q . size ( );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,3,17,17,18,28,28,29,34,43,44,52,54,80,84,84,91,92,97});
param0.add(new int[]{-34,70,-90,-10,-26,64,4,28,24,-90,-78,72,74,80,82,-94});
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[]{20,87,5,62,12,81,30,83,96,16,2,76,3,8,37,53,55,88});
param0.add(new int[]{-94,-92,-60,-58,-54,-42,-36,-12,-8,-2,8,14,18,20,26,32,38,56,58,60,70,78,80,86,98});
param0.add(new int[]{0,1,1,1,0,0,1,1,1,1,1,1,1,1,0,0});
param0.add(new int[]{1,1,2,3,3,11,16,18,19,21,21,22,22,24,27,28,29,43,43,52,55,57,60,62,62,63,65,66,70,70,73,77,78,79,79,80,85,85,86,88,89,90,97,98});
param0.add(new int[]{88,12,-22,-60,30,-30,-14,80,-58,-80,-10,86,-94,-14,4,-18,-18,54,-82,-8,-68,-6,-44,-44,50,88,-78,-42,12,52,44,14,6,48,18,-30,4});
param0.add(new int[]{0,0,0,0,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{82,62,43,39,5,90,75,50,16,83,52,69,71,3,89,10,51,69,32,96,5,43,83,12,31,81,22,59,52,47,86,49,56,90,31,59});
List<Integer> param1 = new ArrayList<>();
param1.add(12);
param1.add(10);
param1.add(40);
param1.add(9);
param1.add(18);
param1.add(9);
param1.add(30);
param1.add(21);
param1.add(7);
param1.add(28);
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, 3, 17, 17, 18, 28, 28, 29, 34, 43, 44, 52, 54, 80, 84, 84, 91, 92, 97],12,),
([-34, 70, -90, -10, -26, 64, 4, 28, 24, -90, -78, 72, 74, 80, 82, -94],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],40,),
([20, 87, 5, 62, 12, 81, 30, 83, 96, 16, 2, 76, 3, 8, 37, 53, 55, 88],9,),
([-94, -92, -60, -58, -54, -42, -36, -12, -8, -2, 8, 14, 18, 20, 26, 32, 38, 56, 58, 60, 70, 78, 80, 86, 98],18,),
([0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],9,),
([1, 1, 2, 3, 3, 11, 16, 18, 19, 21, 21, 22, 22, 24, 27, 28, 29, 43, 43, 52, 55, 57, 60, 62, 62, 63, 65, 66, 70, 70, 73, 77, 78, 79, 79, 80, 85, 85, 86, 88, 89, 90, 97, 98],30,),
([88, 12, -22, -60, 30, -30, -14, 80, -58, -80, -10, 86, -94, -14, 4, -18, -18, 54, -82, -8, -68, -6, -44, -44, 50, 88, -78, -42, 12, 52, 44, 14, 6, 48, 18, -30, 4],21,),
([0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],7,),
([82, 62, 43, 39, 5, 90, 75, 50, 16, 83, 52, 69, 71, 3, 89, 10, 51, 69, 32, 96, 5, 43, 83, 12, 31, 81, 22, 59, 52, 47, 86, 49, 56, 90, 31, 59],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 {{2,3,17,17,18,28,28,29,34,43,44,52,54,80,84,84,91,92,97},{-34,70,-90,-10,-26,64,4,28,24,-90,-78,72,74,80,82,-94},{0,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},{20,87,5,62,12,81,30,83,96,16,2,76,3,8,37,53,55,88},{-94,-92,-60,-58,-54,-42,-36,-12,-8,-2,8,14,18,20,26,32,38,56,58,60,70,78,80,86,98},{0,1,1,1,0,0,1,1,1,1,1,1,1,1,0,0},{1,1,2,3,3,11,16,18,19,21,21,22,22,24,27,28,29,43,43,52,55,57,60,62,62,63,65,66,70,70,73,77,78,79,79,80,85,85,86,88,89,90,97,98},{88,12,-22,-60,30,-30,-14,80,-58,-80,-10,86,-94,-14,4,-18,-18,54,-82,-8,-68,-6,-44,-44,50,88,-78,-42,12,52,44,14,6,48,18,-30,4},{0,0,0,0,1,1,1,1,1,1,1,1,1},{82,62,43,39,5,90,75,50,16,83,52,69,71,3,89,10,51,69,32,96,5,43,83,12,31,81,22,59,52,47,86,49,56,90,31,59}};
vector<int> param1 {12,10,40,9,18,9,30,21,7,28};
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;
} |
SUM_K_TH_GROUP_ODD_POSITIVE_NUMBERS_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_K_TH_GROUP_ODD_POSITIVE_NUMBERS_1{
public static int f_gold ( int k ) {
return k * k * k ;
}
| def f_gold ( k ) :
return k * k * k
|
using namespace std;
int f_gold ( int k ) {
return k * k * k;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(57);
param0.add(96);
param0.add(14);
param0.add(64);
param0.add(24);
param0.add(74);
param0.add(85);
param0.add(27);
param0.add(78);
param0.add(1);
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,),
(96,),
(14,),
(64,),
(24,),
(74,),
(85,),
(27,),
(78,),
(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<int> param0 {57,96,14,64,24,74,85,27,78,1};
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;
} |
NON_REPEATING_ELEMENT_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NON_REPEATING_ELEMENT_1{
static int f_gold ( int arr [ ] , int n ) {
Map < Integer , Integer > m = new HashMap < > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( m . containsKey ( arr [ i ] ) ) {
m . put ( arr [ i ] , m . get ( arr [ i ] ) + 1 ) ;
}
else {
m . put ( arr [ i ] , 1 ) ;
}
}
for ( int i = 0 ;
i < n ;
i ++ ) if ( m . get ( arr [ i ] ) == 1 ) return arr [ i ] ;
return - 1 ;
}
| null |
using namespace std;
int f_gold ( int arr [ ], int n ) {
unordered_map < int, int > mp;
for ( int i = 0;
i < n;
i ++ ) mp [ arr [ i ] ] ++;
for ( int i = 0;
i < n;
i ++ ) if ( mp [ arr [ i ] ] == 1 ) return arr [ i ];
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{6,7,14,18,18,18,21,25,28,38,40,42,42,45,48,50,50,50,53,54,58,59,62,65,65,66,67,68,69,73,74,76,77,83,84,85,87});
param0.add(new int[]{24,-84,86,-50,60,-36,92,70,84,40,-8,74,-24,-38,98,40,-78,-36,38,-22,-98,82,-22,80,-80,-62,16,-46,18,64,16,2,24,-92,-46,42,38,8,72,8,14,-68,18,16,-82,8,58,-2});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1});
param0.add(new int[]{59,77,13,49,90});
param0.add(new int[]{-80,-76,-66,-60,-44,-42,-38,-36,-32,-30,-24,-18,-6,2,4,14,32,42,54,70,92,98});
param0.add(new int[]{0,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,0,0,0,0,0,0,0});
param0.add(new int[]{6,22,24,27,29,30,35,42,57,59,59,63,71,73,76,98});
param0.add(new int[]{-82,-48,36});
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,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{88,49,13,64,30,60,26,55,55,97,98,69,72,72,79,59,46,87,76,61,87,12,91,8,34,15,93,64,83,33,69,58,32,14,72,67,25,7,55,21,12,78,63});
List<Integer> param1 = new ArrayList<>();
param1.add(33);
param1.add(25);
param1.add(16);
param1.add(2);
param1.add(12);
param1.add(33);
param1.add(13);
param1.add(1);
param1.add(35);
param1.add(24);
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 {{6,7,14,18,18,18,21,25,28,38,40,42,42,45,48,50,50,50,53,54,58,59,62,65,65,66,67,68,69,73,74,76,77,83,84,85,87},{24,-84,86,-50,60,-36,92,70,84,40,-8,74,-24,-38,98,40,-78,-36,38,-22,-98,82,-22,80,-80,-62,16,-46,18,64,16,2,24,-92,-46,42,38,8,72,8,14,-68,18,16,-82,8,58,-2},{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1},{59,77,13,49,90},{-80,-76,-66,-60,-44,-42,-38,-36,-32,-30,-24,-18,-6,2,4,14,32,42,54,70,92,98},{0,0,0,0,1,0,1,0,0,1,0,0,0,1,0,1,1,1,0,1,0,1,0,1,1,0,0,1,1,1,1,0,0,0,0,0,0,0},{6,22,24,27,29,30,35,42,57,59,59,63,71,73,76,98},{-82,-48,36},{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},{88,49,13,64,30,60,26,55,55,97,98,69,72,72,79,59,46,87,76,61,87,12,91,8,34,15,93,64,83,33,69,58,32,14,72,67,25,7,55,21,12,78,63}};
vector<int> param1 {33,25,16,2,12,33,13,1,35,24};
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;
} |
TILING_WITH_DOMINOES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class TILING_WITH_DOMINOES{
static int f_gold ( int n ) {
int [ ] A = new int [ n + 1 ] ;
int [ ] B = new int [ n + 1 ] ;
A [ 0 ] = 1 ;
A [ 1 ] = 0 ;
B [ 0 ] = 0 ;
B [ 1 ] = 1 ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
A [ i ] = A [ i - 2 ] + 2 * B [ i - 1 ] ;
B [ i ] = A [ i - 1 ] + B [ i - 2 ] ;
}
return A [ n ] ;
}
| def f_gold ( n ) :
A = [ 0 ] * ( n + 1 )
B = [ 0 ] * ( n + 1 )
A [ 0 ] = 1
A [ 1 ] = 0
B [ 0 ] = 0
B [ 1 ] = 1
for i in range ( 2 , n + 1 ) :
A [ i ] = A [ i - 2 ] + 2 * B [ i - 1 ]
B [ i ] = A [ i - 1 ] + B [ i - 2 ]
return A [ n ]
|
using namespace std;
int f_gold ( int n ) {
int A [ n + 1 ], B [ n + 1 ];
A [ 0 ] = 1, A [ 1 ] = 0, B [ 0 ] = 0, B [ 1 ] = 1;
for ( int i = 2;
i <= n;
i ++ ) {
A [ i ] = A [ i - 2 ] + 2 * B [ i - 1 ];
B [ i ] = A [ i - 1 ] + B [ i - 2 ];
}
return A [ n ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(29);
param0.add(13);
param0.add(25);
param0.add(65);
param0.add(27);
param0.add(42);
param0.add(19);
param0.add(50);
param0.add(59);
param0.add(13);
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 = [
(29,),
(13,),
(25,),
(65,),
(27,),
(42,),
(19,),
(50,),
(59,),
(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<int> param0 {29,13,25,65,27,42,19,50,59,13};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
BASIC_AND_EXTENDED_EUCLIDEAN_ALGORITHMS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class BASIC_AND_EXTENDED_EUCLIDEAN_ALGORITHMS{
public static int f_gold ( int a , int b ) {
if ( a == 0 ) return b ;
return f_gold ( b % a , a ) ;
}
| def f_gold ( a , b ) :
if a == 0 :
return b
return f_gold ( b % a , a )
|
using namespace std;
int f_gold ( int a, int b ) {
if ( a == 0 ) return b;
return f_gold ( b % a, a );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(46);
param0.add(26);
param0.add(40);
param0.add(58);
param0.add(25);
param0.add(2);
param0.add(8);
param0.add(21);
param0.add(82);
param0.add(17);
List<Integer> param1 = new ArrayList<>();
param1.add(89);
param1.add(82);
param1.add(12);
param1.add(4);
param1.add(44);
param1.add(87);
param1.add(65);
param1.add(87);
param1.add(10);
param1.add(61);
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,89,),
(26,82,),
(40,12,),
(58,4,),
(25,44,),
(2,87,),
(8,65,),
(21,87,),
(82,10,),
(17,61,)
]
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 {46,26,40,58,25,2,8,21,82,17};
vector<int> param1 {89,82,12,4,44,87,65,87,10,61};
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;
} |
FIND_MAXIMUM_AVERAGE_SUBARRAY_OF_K_LENGTH_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_MAXIMUM_AVERAGE_SUBARRAY_OF_K_LENGTH_1{
static int f_gold ( int arr [ ] , int n , int k ) {
if ( k > n ) return - 1 ;
int sum = arr [ 0 ] ;
for ( int i = 1 ;
i < k ;
i ++ ) sum += arr [ i ] ;
int max_sum = sum , max_end = k - 1 ;
for ( int i = k ;
i < n ;
i ++ ) {
sum = sum + arr [ i ] - arr [ i - k ] ;
if ( sum > max_sum ) {
max_sum = sum ;
max_end = i ;
}
}
return max_end - k + 1 ;
}
| def f_gold ( arr , n , k ) :
if ( k > n ) :
return - 1
sum = arr [ 0 ]
for i in range ( 1 , k ) :
sum += arr [ i ]
max_sum = sum
max_end = k - 1
for i in range ( k , n ) :
sum = sum + arr [ i ] - arr [ i - k ]
if ( sum > max_sum ) :
max_sum = sum
max_end = i
return max_end - k + 1
|
using namespace std;
int f_gold ( int arr [ ], int n, int k ) {
if ( k > n ) return - 1;
int sum = arr [ 0 ];
for ( int i = 1;
i < k;
i ++ ) sum += arr [ i ];
int max_sum = sum, max_end = k - 1;
for ( int i = k;
i < n;
i ++ ) {
int sum = sum + arr [ i ] - arr [ i - k ];
if ( sum > max_sum ) {
max_sum = sum;
max_end = i;
}
}
return max_end - k + 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,5,11,37,41,49,49,63,98});
param0.add(new int[]{84,-72,12,0,86,-32,-18,48,60,42,8,-6,-10,-6,-52,-84,-98,76,-10,-14,-94,-48,94,-10,-20,40,-52,0,94,-68,44,-34,-26,-6,-94,34,-80,-62,-40,56,52,-20,74,-46,-88,-26,22});
param0.add(new int[]{0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{94,97,74,88,14,66,65,50,76,55,70,93,53,30,2,60,65,24,80,73,84,95,49,32,55,70,17,26,96,20,36,2,89,49,83,67,42,51,71,11,61,78,17,78,94,68});
param0.add(new int[]{-98,-90,-60,-38,38,42});
param0.add(new int[]{1,0,0,1,1,1,1});
param0.add(new int[]{4,9,17,17,19,32,35,36,37,40,44,45,47,48,48,56,56,60,61,65,66,79,83,91,93,99});
param0.add(new int[]{78,82,-92,-46,-16,-64,28,60,64,52,54,-84,70,22,24,0,-14,20,-90,30,0,86,12,72,-64,-52,86,16,-42});
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[]{81,77,6,3,72,24,75,47,17,29,69,15,15,50,30,83,11,7,59,7,12,82,45,76,9,48,98,49,29,66,3,53,37,13,72,58,37,87,55});
List<Integer> param1 = new ArrayList<>();
param1.add(8);
param1.add(34);
param1.add(11);
param1.add(35);
param1.add(3);
param1.add(3);
param1.add(22);
param1.add(25);
param1.add(25);
param1.add(34);
List<Integer> param2 = new ArrayList<>();
param2.add(7);
param2.add(43);
param2.add(18);
param2.add(33);
param2.add(5);
param2.add(4);
param2.add(24);
param2.add(27);
param2.add(20);
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 = [
([2, 5, 11, 37, 41, 49, 49, 63, 98],8,7,),
([84, -72, 12, 0, 86, -32, -18, 48, 60, 42, 8, -6, -10, -6, -52, -84, -98, 76, -10, -14, -94, -48, 94, -10, -20, 40, -52, 0, 94, -68, 44, -34, -26, -6, -94, 34, -80, -62, -40, 56, 52, -20, 74, -46, -88, -26, 22],34,43,),
([0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],11,18,),
([94, 97, 74, 88, 14, 66, 65, 50, 76, 55, 70, 93, 53, 30, 2, 60, 65, 24, 80, 73, 84, 95, 49, 32, 55, 70, 17, 26, 96, 20, 36, 2, 89, 49, 83, 67, 42, 51, 71, 11, 61, 78, 17, 78, 94, 68],35,33,),
([-98, -90, -60, -38, 38, 42],3,5,),
([1, 0, 0, 1, 1, 1, 1],3,4,),
([4, 9, 17, 17, 19, 32, 35, 36, 37, 40, 44, 45, 47, 48, 48, 56, 56, 60, 61, 65, 66, 79, 83, 91, 93, 99],22,24,),
([78, 82, -92, -46, -16, -64, 28, 60, 64, 52, 54, -84, 70, 22, 24, 0, -14, 20, -90, 30, 0, 86, 12, 72, -64, -52, 86, 16, -42],25,27,),
([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],25,20,),
([81, 77, 6, 3, 72, 24, 75, 47, 17, 29, 69, 15, 15, 50, 30, 83, 11, 7, 59, 7, 12, 82, 45, 76, 9, 48, 98, 49, 29, 66, 3, 53, 37, 13, 72, 58, 37, 87, 55],34,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 {{2,5,11,37,41,49,49,63,98},{84,-72,12,0,86,-32,-18,48,60,42,8,-6,-10,-6,-52,-84,-98,76,-10,-14,-94,-48,94,-10,-20,40,-52,0,94,-68,44,-34,-26,-6,-94,34,-80,-62,-40,56,52,-20,74,-46,-88,-26,22},{0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1},{94,97,74,88,14,66,65,50,76,55,70,93,53,30,2,60,65,24,80,73,84,95,49,32,55,70,17,26,96,20,36,2,89,49,83,67,42,51,71,11,61,78,17,78,94,68},{-98,-90,-60,-38,38,42},{1,0,0,1,1,1,1},{4,9,17,17,19,32,35,36,37,40,44,45,47,48,48,56,56,60,61,65,66,79,83,91,93,99},{78,82,-92,-46,-16,-64,28,60,64,52,54,-84,70,22,24,0,-14,20,-90,30,0,86,12,72,-64,-52,86,16,-42},{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},{81,77,6,3,72,24,75,47,17,29,69,15,15,50,30,83,11,7,59,7,12,82,45,76,9,48,98,49,29,66,3,53,37,13,72,58,37,87,55}};
vector<int> param1 {8,34,11,35,3,3,22,25,25,34};
vector<int> param2 {7,43,18,33,5,4,24,27,20,23};
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;
} |
COUNT_BINARY_DIGIT_NUMBERS_SMALLER_N |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_BINARY_DIGIT_NUMBERS_SMALLER_N{
static int f_gold ( int N ) {
Queue < Integer > q = new LinkedList < > ( ) ;
q . add ( 1 ) ;
int cnt = 0 ;
int t ;
while ( q . size ( ) > 0 ) {
t = q . peek ( ) ;
q . remove ( ) ;
if ( t <= N ) {
cnt ++ ;
q . add ( t * 10 ) ;
q . add ( t * 10 + 1 ) ;
}
}
return cnt ;
}
| null |
using namespace std;
int f_gold ( int N ) {
queue < int > q;
q . push ( 1 );
int cnt = 0;
int t;
while ( ! q . empty ( ) ) {
t = q . front ( );
q . pop ( );
if ( t <= N ) {
cnt ++;
q . push ( t * 10 );
q . push ( t * 10 + 1 );
}
}
return cnt;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(1);
param0.add(3);
param0.add(150932532);
param0.add(71);
param0.add(44);
param0.add(36);
param0.add(88);
param0.add(69);
param0.add(53);
param0.add(20);
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<int> param0 {1,3,150932532,71,44,36,88,69,53,20};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
LENGTH_LONGEST_STRICT_BITONIC_SUBSEQUENCE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class LENGTH_LONGEST_STRICT_BITONIC_SUBSEQUENCE{
static int f_gold ( int arr [ ] , int n ) {
HashMap < Integer , Integer > inc = new HashMap < Integer , Integer > ( ) ;
HashMap < Integer , Integer > dcr = new HashMap < Integer , Integer > ( ) ;
int len_inc [ ] = new int [ n ] ;
int len_dcr [ ] = new int [ n ] ;
int longLen = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int len = 0 ;
if ( inc . containsKey ( arr [ i ] - 1 ) ) len = inc . get ( arr [ i ] - 1 ) ;
len_inc [ i ] = len + 1 ;
inc . put ( arr [ i ] , len_inc [ i ] ) ;
}
for ( int i = n - 1 ;
i >= 0 ;
i -- ) {
int len = 0 ;
if ( dcr . containsKey ( arr [ i ] - 1 ) ) len = dcr . get ( arr [ i ] - 1 ) ;
len_dcr [ i ] = len + 1 ;
dcr . put ( arr [ i ] , len_dcr [ i ] ) ;
}
for ( int i = 0 ;
i < n ;
i ++ ) if ( longLen < ( len_inc [ i ] + len_dcr [ i ] - 1 ) ) longLen = len_inc [ i ] + len_dcr [ i ] - 1 ;
return longLen ;
}
| def f_gold ( arr , n ) :
inc , dcr = dict ( ) , dict ( )
len_inc , len_dcr = [ 0 ] * n , [ 0 ] * n
longLen = 0
for i in range ( n ) :
len = 0
if inc.get ( arr [ i ] - 1 ) in inc.values ( ) :
len = inc.get ( arr [ i ] - 1 )
inc [ arr [ i ] ] = len_inc [ i ] = len + 1
for i in range ( n - 1 , - 1 , - 1 ) :
len = 0
if dcr.get ( arr [ i ] - 1 ) in dcr.values ( ) :
len = dcr.get ( arr [ i ] - 1 )
dcr [ arr [ i ] ] = len_dcr [ i ] = len + 1
for i in range ( n ) :
if longLen < ( len_inc [ i ] + len_dcr [ i ] - 1 ) :
longLen = len_inc [ i ] + len_dcr [ i ] - 1
return longLen
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
unordered_map < int, int > inc, dcr;
int len_inc [ n ], len_dcr [ n ];
int longLen = 0;
for ( int i = 0;
i < n;
i ++ ) {
int len = 0;
if ( inc . find ( arr [ i ] - 1 ) != inc . end ( ) ) len = inc [ arr [ i ] - 1 ];
inc [ arr [ i ] ] = len_inc [ i ] = len + 1;
}
for ( int i = n - 1;
i >= 0;
i -- ) {
int len = 0;
if ( dcr . find ( arr [ i ] - 1 ) != dcr . end ( ) ) len = dcr [ arr [ i ] - 1 ];
dcr [ arr [ i ] ] = len_dcr [ i ] = len + 1;
}
for ( int i = 0;
i < n;
i ++ ) if ( longLen < ( len_inc [ i ] + len_dcr [ i ] - 1 ) ) longLen = len_inc [ i ] + len_dcr [ i ] - 1;
return longLen;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{78});
param0.add(new int[]{-6,-18,-48,58,-54,76,80,-56,86,58,-86,-86,-88,32,12,58,58,-16,86,-24,84,86,36,18,30,-32,-4,-36,-72,-4,42,94});
param0.add(new int[]{0,1});
param0.add(new int[]{92,26,72,8,66,28,34,61,28});
param0.add(new int[]{-86,-82,-76,-68,-66,-64,-62,-56,-48,-42,-38,-30,-22,-18,-10,-10,-4,-2,4,28,42,44,50,50,56,58,60,76,82,86,86,98});
param0.add(new int[]{0,0,1,0,1,1,0,0,1,0,1,1,0,1,1,1,0,0,0,0,1,0});
param0.add(new int[]{3,4,8,9,12,13,16,19,23,25,29,31,34,36,38,41,42,47,49,50,51,51,58,63,66,70,73,74,75,75,75,76,76,80,82,83,83,84,86,89,90,91,91,95,96});
param0.add(new int[]{4,-76,60,48,-14,72});
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[]{66,80,79,72,1,67,20,67,32,40,22,64,58,67,10,21,37,49});
List<Integer> param1 = new ArrayList<>();
param1.add(0);
param1.add(18);
param1.add(1);
param1.add(5);
param1.add(25);
param1.add(17);
param1.add(44);
param1.add(3);
param1.add(17);
param1.add(15);
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 = [
([78],0,),
([-6, -18, -48, 58, -54, 76, 80, -56, 86, 58, -86, -86, -88, 32, 12, 58, 58, -16, 86, -24, 84, 86, 36, 18, 30, -32, -4, -36, -72, -4, 42, 94],18,),
([0, 1],1,),
([92, 26, 72, 8, 66, 28, 34, 61, 28],5,),
([-86, -82, -76, -68, -66, -64, -62, -56, -48, -42, -38, -30, -22, -18, -10, -10, -4, -2, 4, 28, 42, 44, 50, 50, 56, 58, 60, 76, 82, 86, 86, 98],25,),
([0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0],17,),
([3, 4, 8, 9, 12, 13, 16, 19, 23, 25, 29, 31, 34, 36, 38, 41, 42, 47, 49, 50, 51, 51, 58, 63, 66, 70, 73, 74, 75, 75, 75, 76, 76, 80, 82, 83, 83, 84, 86, 89, 90, 91, 91, 95, 96],44,),
([4, -76, 60, 48, -14, 72],3,),
([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],17,),
([66, 80, 79, 72, 1, 67, 20, 67, 32, 40, 22, 64, 58, 67, 10, 21, 37, 49],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<vector<int>> param0 {{78},{-6,-18,-48,58,-54,76,80,-56,86,58,-86,-86,-88,32,12,58,58,-16,86,-24,84,86,36,18,30,-32,-4,-36,-72,-4,42,94},{0,1},{92,26,72,8,66,28,34,61,28},{-86,-82,-76,-68,-66,-64,-62,-56,-48,-42,-38,-30,-22,-18,-10,-10,-4,-2,4,28,42,44,50,50,56,58,60,76,82,86,86,98},{0,0,1,0,1,1,0,0,1,0,1,1,0,1,1,1,0,0,0,0,1,0},{3,4,8,9,12,13,16,19,23,25,29,31,34,36,38,41,42,47,49,50,51,51,58,63,66,70,73,74,75,75,75,76,76,80,82,83,83,84,86,89,90,91,91,95,96},{4,-76,60,48,-14,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,1},{66,80,79,72,1,67,20,67,32,40,22,64,58,67,10,21,37,49}};
vector<int> param1 {0,18,1,5,25,17,44,3,17,15};
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_A_TRIPLET_THAT_SUM_TO_A_GIVEN_VALUE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_A_TRIPLET_THAT_SUM_TO_A_GIVEN_VALUE{
static boolean f_gold ( int A [ ] , int arr_size , int sum ) {
int l , r ;
for ( int i = 0 ;
i < arr_size - 2 ;
i ++ ) {
for ( int j = i + 1 ;
j < arr_size - 1 ;
j ++ ) {
for ( int k = j + 1 ;
k < arr_size ;
k ++ ) {
if ( A [ i ] + A [ j ] + A [ k ] == sum ) {
System . out . print ( "Triplet is " + A [ i ] + ", " + A [ j ] + ", " + A [ k ] ) ;
return true ;
}
}
}
}
return false ;
}
| def f_gold ( A , arr_size , sum ) :
for i in range ( 0 , arr_size - 2 ) :
for j in range ( i + 1 , arr_size - 1 ) :
for k in range ( j + 1 , arr_size ) :
if A [ i ] + A [ j ] + A [ k ] == sum :
print ( "Triplet is" , A [ i ] , ", " , A [ j ] , ", " , A [ k ] )
return True
return False
|
using namespace std;
bool f_gold ( int A [ ], int arr_size, int sum ) {
int l, r;
for ( int i = 0;
i < arr_size - 2;
i ++ ) {
for ( int j = i + 1;
j < arr_size - 1;
j ++ ) {
for ( int k = j + 1;
k < arr_size;
k ++ ) {
if ( A [ i ] + A [ j ] + A [ k ] == sum ) {
cout << "Triplet is " << A [ i ] << ", " << A [ j ] << ", " << A [ k ];
return true;
}
}
}
}
return false;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{15,18,38,47,75,88});
param0.add(new int[]{28,-2,62,38,86,-86,56,58,96,6,-28,8,68,-16,-80,-4,98,-92,4,-4,58,-62,46,64});
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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{19,77,17,91,6,35,22,4,30,23,97,56,78,16,22,23,95,57,43,27,47,44,23,10,3,94,55,22,93,32,89,28,64,22,13,24,38,44,6,1,80});
param0.add(new int[]{-98,-98,-94,-88,-80,-74,-68,-68,-64,-44,-36,-24,-10,-8,-8,0,4,6,8,8,12,14,16,38,50,52,54,56,66,68,76,88});
param0.add(new int[]{1,1,0,0,1,0,1,1});
param0.add(new int[]{7,22,24,30,42,44,49,49,65,70,70,74,74,75,90,95,96});
param0.add(new int[]{40,-76,-68,-86,-14,82,-20,54,-26,56,-24,-44,44,60,52,-20,80,-24,-90,-30,-2});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{33,92,6,99,83,97,49,97,85,52});
List<Integer> param1 = new ArrayList<>();
param1.add(5);
param1.add(22);
param1.add(27);
param1.add(22);
param1.add(18);
param1.add(4);
param1.add(8);
param1.add(11);
param1.add(15);
param1.add(6);
List<Integer> param2 = new ArrayList<>();
param2.add(4);
param2.add(18);
param2.add(23);
param2.add(29);
param2.add(19);
param2.add(5);
param2.add(13);
param2.add(18);
param2.add(17);
param2.add(7);
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 = [
([15, 18, 38, 47, 75, 88],5,4,),
([28, -2, 62, 38, 86, -86, 56, 58, 96, 6, -28, 8, 68, -16, -80, -4, 98, -92, 4, -4, 58, -62, 46, 64],22,18,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],27,23,),
([19, 77, 17, 91, 6, 35, 22, 4, 30, 23, 97, 56, 78, 16, 22, 23, 95, 57, 43, 27, 47, 44, 23, 10, 3, 94, 55, 22, 93, 32, 89, 28, 64, 22, 13, 24, 38, 44, 6, 1, 80],22,29,),
([-98, -98, -94, -88, -80, -74, -68, -68, -64, -44, -36, -24, -10, -8, -8, 0, 4, 6, 8, 8, 12, 14, 16, 38, 50, 52, 54, 56, 66, 68, 76, 88],18,19,),
([1, 1, 0, 0, 1, 0, 1, 1],4,5,),
([7, 22, 24, 30, 42, 44, 49, 49, 65, 70, 70, 74, 74, 75, 90, 95, 96],8,13,),
([40, -76, -68, -86, -14, 82, -20, 54, -26, 56, -24, -44, 44, 60, 52, -20, 80, -24, -90, -30, -2],11,18,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],15,17,),
([33, 92, 6, 99, 83, 97, 49, 97, 85, 52],6,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 {{15,18,38,47,75,88},{28,-2,62,38,86,-86,56,58,96,6,-28,8,68,-16,-80,-4,98,-92,4,-4,58,-62,46,64},{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},{19,77,17,91,6,35,22,4,30,23,97,56,78,16,22,23,95,57,43,27,47,44,23,10,3,94,55,22,93,32,89,28,64,22,13,24,38,44,6,1,80},{-98,-98,-94,-88,-80,-74,-68,-68,-64,-44,-36,-24,-10,-8,-8,0,4,6,8,8,12,14,16,38,50,52,54,56,66,68,76,88},{1,1,0,0,1,0,1,1},{7,22,24,30,42,44,49,49,65,70,70,74,74,75,90,95,96},{40,-76,-68,-86,-14,82,-20,54,-26,56,-24,-44,44,60,52,-20,80,-24,-90,-30,-2},{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{33,92,6,99,83,97,49,97,85,52}};
vector<int> param1 {5,22,27,22,18,4,8,11,15,6};
vector<int> param2 {4,18,23,29,19,5,13,18,17,7};
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;
} |
PRIME_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PRIME_NUMBERS{
static boolean f_gold ( int n ) {
if ( n <= 1 ) return false ;
for ( int i = 2 ;
i < n ;
i ++ ) if ( n % i == 0 ) return false ;
return true ;
}
| def f_gold ( n ) :
if ( n <= 1 ) :
return False
for i in range ( 2 , n ) :
if ( n % i == 0 ) :
return False
return True
|
using namespace std;
bool f_gold ( int n ) {
if ( n <= 1 ) return false;
for ( int i = 2;
i < n;
i ++ ) if ( n % i == 0 ) return false;
return true;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(2);
param0.add(74);
param0.add(46);
param0.add(38);
param0.add(51);
param0.add(48);
param0.add(6);
param0.add(14);
param0.add(31);
param0.add(10);
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,),
(74,),
(46,),
(38,),
(51,),
(48,),
(6,),
(14,),
(31,),
(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 {2,74,46,38,51,48,6,14,31,10};
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_SERIES_12_32_52_2N_12_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_SERIES_12_32_52_2N_12_1{
static int f_gold ( int n ) {
return ( n * ( 2 * n - 1 ) * ( 2 * n + 1 ) ) / 3 ;
}
| def f_gold ( n ) :
return int ( ( n * ( 2 * n - 1 ) * ( 2 * n + 1 ) ) / 3 )
|
using namespace std;
int f_gold ( int n ) {
return ( n * ( 2 * n - 1 ) * ( 2 * n + 1 ) ) / 3;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(84);
param0.add(74);
param0.add(91);
param0.add(34);
param0.add(36);
param0.add(28);
param0.add(70);
param0.add(7);
param0.add(24);
param0.add(47);
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 = [
(84,),
(74,),
(91,),
(34,),
(36,),
(28,),
(70,),
(7,),
(24,),
(47,)
]
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 {84,74,91,34,36,28,70,7,24,47};
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_MAXIMUM_PRODUCT_OF_A_TRIPLET_IN_ARRAY_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_MAXIMUM_PRODUCT_OF_A_TRIPLET_IN_ARRAY_1{
static int f_gold ( int arr [ ] , int n ) {
if ( n < 3 ) {
return - 1 ;
}
Arrays . sort ( arr ) ;
return Math . max ( arr [ 0 ] * arr [ 1 ] * arr [ n - 1 ] , arr [ n - 1 ] * arr [ n - 2 ] * arr [ n - 3 ] ) ;
}
| def f_gold ( arr , n ) :
if n < 3 :
return - 1
arr.sort ( )
return max ( arr [ 0 ] * arr [ 1 ] * arr [ n - 1 ] , arr [ n - 1 ] * arr [ n - 2 ] * arr [ n - 3 ] )
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
if ( n < 3 ) return - 1;
sort ( arr, arr + n );
return max ( arr [ 0 ] * arr [ 1 ] * arr [ n - 1 ], 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[]{5,8,14,15,18,21,21,21,27,29,30,33,34,34,35,37,40,41,44,44,46,49,54,58,60,61,61,63,66,69,69,70,81,82,82,90,90,90,91,92,92,96,97,99});
param0.add(new int[]{72,-32,-2,-76,-56,70,-52,12,-50,32,-98,48,-32,-90,-66,-98,56,-58,-88,50,-22,18,-60,68,70,28});
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,1});
param0.add(new int[]{38,69,18,72,99,49,17,76,86,53,6,94,66,5,2,62,99,5,31,81,63,91,95,74,76,18,77});
param0.add(new int[]{-92,-58,-8,20,24,24,42,98});
param0.add(new int[]{0,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,0,0,1,1,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0});
param0.add(new int[]{46,64,81});
param0.add(new int[]{4,-26,20,34,-4,-40,76,94,-14,-80,42,60,92,-96,44,58,34,68,96,-8,-18,-92});
param0.add(new int[]{0,0,0,1,1,1,1,1});
param0.add(new int[]{61,17,28,18,52,58,41,75,98,79,1,97,73,17,79,4,46,70,6,83,23,94,1});
List<Integer> param1 = new ArrayList<>();
param1.add(39);
param1.add(18);
param1.add(17);
param1.add(21);
param1.add(4);
param1.add(38);
param1.add(1);
param1.add(17);
param1.add(7);
param1.add(19);
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, 8, 14, 15, 18, 21, 21, 21, 27, 29, 30, 33, 34, 34, 35, 37, 40, 41, 44, 44, 46, 49, 54, 58, 60, 61, 61, 63, 66, 69, 69, 70, 81, 82, 82, 90, 90, 90, 91, 92, 92, 96, 97, 99],39,),
([72, -32, -2, -76, -56, 70, -52, 12, -50, 32, -98, 48, -32, -90, -66, -98, 56, -58, -88, 50, -22, 18, -60, 68, 70, 28],18,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],17,),
([38, 69, 18, 72, 99, 49, 17, 76, 86, 53, 6, 94, 66, 5, 2, 62, 99, 5, 31, 81, 63, 91, 95, 74, 76, 18, 77],21,),
([-92, -58, -8, 20, 24, 24, 42, 98],4,),
([0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0],38,),
([46, 64, 81],1,),
([4, -26, 20, 34, -4, -40, 76, 94, -14, -80, 42, 60, 92, -96, 44, 58, 34, 68, 96, -8, -18, -92],17,),
([0, 0, 0, 1, 1, 1, 1, 1],7,),
([61, 17, 28, 18, 52, 58, 41, 75, 98, 79, 1, 97, 73, 17, 79, 4, 46, 70, 6, 83, 23, 94, 1],19,)
]
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,8,14,15,18,21,21,21,27,29,30,33,34,34,35,37,40,41,44,44,46,49,54,58,60,61,61,63,66,69,69,70,81,82,82,90,90,90,91,92,92,96,97,99},{72,-32,-2,-76,-56,70,-52,12,-50,32,-98,48,-32,-90,-66,-98,56,-58,-88,50,-22,18,-60,68,70,28},{0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{38,69,18,72,99,49,17,76,86,53,6,94,66,5,2,62,99,5,31,81,63,91,95,74,76,18,77},{-92,-58,-8,20,24,24,42,98},{0,1,1,0,1,0,0,1,0,1,0,0,1,1,0,1,0,0,1,1,0,0,0,1,0,0,0,1,1,1,0,0,1,0,0,0,1,1,0,1,1,1,1,0},{46,64,81},{4,-26,20,34,-4,-40,76,94,-14,-80,42,60,92,-96,44,58,34,68,96,-8,-18,-92},{0,0,0,1,1,1,1,1},{61,17,28,18,52,58,41,75,98,79,1,97,73,17,79,4,46,70,6,83,23,94,1}};
vector<int> param1 {39,18,17,21,4,38,1,17,7,19};
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;
} |
PANGRAM_CHECKING |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PANGRAM_CHECKING{
public static boolean f_gold ( String str ) {
boolean [ ] mark = new boolean [ 26 ] ;
int index = 0 ;
for ( int i = 0 ;
i < str . length ( ) ;
i ++ ) {
if ( 'A' <= str . charAt ( i ) && str . charAt ( i ) <= 'Z' ) index = str . charAt ( i ) - 'A' ;
else if ( 'a' <= str . charAt ( i ) && str . charAt ( i ) <= 'z' ) index = str . charAt ( i ) - 'a' ;
mark [ index ] = true ;
}
for ( int i = 0 ;
i <= 25 ;
i ++ ) if ( mark [ i ] == false ) return ( false ) ;
return ( true ) ;
}
| null |
using namespace std;
bool f_gold ( string & str ) {
vector < bool > mark ( 26, false );
int index;
for ( int i = 0;
i < str . length ( );
i ++ ) {
if ( 'A' <= str [ i ] && str [ i ] <= 'Z' ) index = str [ i ] - 'A';
else if ( 'a' <= str [ i ] && str [ i ] <= 'z' ) index = str [ i ] - 'a';
mark [ index ] = true;
}
for ( int i = 0;
i <= 25;
i ++ ) if ( mark [ i ] == false ) return ( false );
return ( true );
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("The quick brown fox jumps over the lazy dog ");
param0.add("The quick brown fox jumps over the dog");
param0.add("abcdefghijklmnopqrstuvwxyz");
param0.add("AbcdefghijKlmnopqrstUVwxyz");
param0.add("The quicK broWn fOX jumps over the laZYy dog ");
param0.add("AbcdefghijKlmnopqrstVwxyz");
param0.add("U");
param0.add("397548458372");
param0.add("11");
param0.add("iwCiUFU r");
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 {
"The quick brown fox jumps over the lazy dog ",
"The quick brown fox jumps over the dog",
"abcdefghijklmnopqrstuvwxyz",
"AbcdefghijKlmnopqrstUVwxyz",
"The quicK broWn fOX jumps over the laZYy dog ",
"AbcdefghijKlmnopqrstVwxyz",
"U",
"397548458372",
"11",
"iwCiUFU r"};
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;
} |
HEIGHT_COMPLETE_BINARY_TREE_HEAP_N_NODES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class HEIGHT_COMPLETE_BINARY_TREE_HEAP_N_NODES{
static int f_gold ( int N ) {
return ( int ) Math . ceil ( Math . log ( N + 1 ) / Math . log ( 2 ) ) - 1 ;
}
| import math
def f_gold(N):
return math.ceil(math.log2(N + 1)) - 1
|
using namespace std;
int f_gold ( int N ) {
return ceil ( log2 ( N + 1 ) ) - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(65);
param0.add(94);
param0.add(52);
param0.add(31);
param0.add(9);
param0.add(1);
param0.add(41);
param0.add(98);
param0.add(45);
param0.add(24);
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 = [
(65,),
(94,),
(52,),
(31,),
(9,),
(1,),
(41,),
(98,),
(45,),
(24,)
]
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 {65,94,52,31,9,1,41,98,45,24};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
HOW_CAN_WE_SUM_THE_DIGITS_OF_A_GIVEN_NUMBER_IN_SINGLE_STATEMENT_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class HOW_CAN_WE_SUM_THE_DIGITS_OF_A_GIVEN_NUMBER_IN_SINGLE_STATEMENT_2{
static int f_gold ( int no ) {
return no == 0 ? 0 : no % 10 + f_gold ( no / 10 ) ;
}
| def f_gold ( no ) :
return 0 if no == 0 else int ( no % 10 ) + f_gold ( int ( no / 10 ) )
| null |
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(73);
param0.add(91);
param0.add(27);
param0.add(79);
param0.add(31);
param0.add(84);
param0.add(68);
param0.add(9);
param0.add(85);
param0.add(35);
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 = [
(73,),
(91,),
(27,),
(79,),
(31,),
(84,),
(68,),
(9,),
(85,),
(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))) | null |
POSSIBLE_TO_MAKE_A_DIVISIBLE_BY_3_NUMBER_USING_ALL_DIGITS_IN_AN_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class POSSIBLE_TO_MAKE_A_DIVISIBLE_BY_3_NUMBER_USING_ALL_DIGITS_IN_AN_ARRAY{
public static boolean f_gold ( int arr [ ] , int n ) {
int remainder = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) remainder = ( remainder + arr [ i ] ) % 3 ;
return ( remainder == 0 ) ;
}
| def f_gold ( arr , n ) :
remainder = 0
for i in range ( 0 , n ) :
remainder = ( remainder + arr [ i ] ) % 3
return ( remainder == 0 )
|
using namespace std;
bool f_gold ( int arr [ ], int n ) {
int remainder = 0;
for ( int i = 0;
i < n;
i ++ ) remainder = ( remainder + arr [ i ] ) % 3;
return ( remainder == 0 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,4,9,11,12,15,16,19,21,21,23,23,24,30,31,31,32,34,37,41,41,43,45,46,47,54,58,60,62,66,66,74,74,75,75,77,77,85,89,90,92,92,93,95,98});
param0.add(new int[]{0,66,92,24,-8,88,-92,86,80,82,42,-20,-56,-2,-84,32});
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,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[]{99,83,11,99,80,76,32,12,94,66,76});
param0.add(new int[]{-88,-84,-80,-80,-80,-80,-72,-68,-64,-62,-60,-52,-48,-44,-36,-24,-20,-18,-14,-8,-6,-6,-4,6,10,14,18,24,26,26,50,50,52,60,76,90,96,98});
param0.add(new int[]{0,1,0,0,1,1,0,0,0,1,1,1,0,1,0,0,0,0,0,1,1,0,1});
param0.add(new int[]{6,6,8,8,10,24,24,26,27,30,34,34,36,36,39,40,41,44,45,50,52,53,57,62,64,64,70,71,72,78,78,79,80,82,89,95,96});
param0.add(new int[]{-28,-84,-14,-20,-14,-26,28,-66,48,82,-46,-10,-94,76,56,-6,72,-92,-32,66,50,-72,64,12,48,88,-36,-12,-6,-18,-36,-34,44,40,-54});
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,1,1,1});
param0.add(new int[]{17,47,89,75,57,69,70,57,83,79,57,49});
List<Integer> param1 = new ArrayList<>();
param1.add(30);
param1.add(14);
param1.add(29);
param1.add(5);
param1.add(19);
param1.add(14);
param1.add(28);
param1.add(25);
param1.add(19);
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, 4, 9, 11, 12, 15, 16, 19, 21, 21, 23, 23, 24, 30, 31, 31, 32, 34, 37, 41, 41, 43, 45, 46, 47, 54, 58, 60, 62, 66, 66, 74, 74, 75, 75, 77, 77, 85, 89, 90, 92, 92, 93, 95, 98],30,),
([0, 66, 92, 24, -8, 88, -92, 86, 80, 82, 42, -20, -56, -2, -84, 32],14,),
([0, 0, 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],29,),
([99, 83, 11, 99, 80, 76, 32, 12, 94, 66, 76],5,),
([-88, -84, -80, -80, -80, -80, -72, -68, -64, -62, -60, -52, -48, -44, -36, -24, -20, -18, -14, -8, -6, -6, -4, 6, 10, 14, 18, 24, 26, 26, 50, 50, 52, 60, 76, 90, 96, 98],19,),
([0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1],14,),
([6, 6, 8, 8, 10, 24, 24, 26, 27, 30, 34, 34, 36, 36, 39, 40, 41, 44, 45, 50, 52, 53, 57, 62, 64, 64, 70, 71, 72, 78, 78, 79, 80, 82, 89, 95, 96],28,),
([-28, -84, -14, -20, -14, -26, 28, -66, 48, 82, -46, -10, -94, 76, 56, -6, 72, -92, -32, 66, 50, -72, 64, 12, 48, 88, -36, -12, -6, -18, -36, -34, 44, 40, -54],25,),
([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],19,),
([17, 47, 89, 75, 57, 69, 70, 57, 83, 79, 57, 49],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,4,9,11,12,15,16,19,21,21,23,23,24,30,31,31,32,34,37,41,41,43,45,46,47,54,58,60,62,66,66,74,74,75,75,77,77,85,89,90,92,92,93,95,98},{0,66,92,24,-8,88,-92,86,80,82,42,-20,-56,-2,-84,32},{0,0,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},{99,83,11,99,80,76,32,12,94,66,76},{-88,-84,-80,-80,-80,-80,-72,-68,-64,-62,-60,-52,-48,-44,-36,-24,-20,-18,-14,-8,-6,-6,-4,6,10,14,18,24,26,26,50,50,52,60,76,90,96,98},{0,1,0,0,1,1,0,0,0,1,1,1,0,1,0,0,0,0,0,1,1,0,1},{6,6,8,8,10,24,24,26,27,30,34,34,36,36,39,40,41,44,45,50,52,53,57,62,64,64,70,71,72,78,78,79,80,82,89,95,96},{-28,-84,-14,-20,-14,-26,28,-66,48,82,-46,-10,-94,76,56,-6,72,-92,-32,66,50,-72,64,12,48,88,-36,-12,-6,-18,-36,-34,44,40,-54},{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},{17,47,89,75,57,69,70,57,83,79,57,49}};
vector<int> param1 {30,14,29,5,19,14,28,25,19,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;
} |
FIND_NUMBER_TIMES_STRING_OCCURS_GIVEN_STRING_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_NUMBER_TIMES_STRING_OCCURS_GIVEN_STRING_1{
static int f_gold ( String a , String b ) {
int m = a . length ( ) ;
int n = b . length ( ) ;
int lookup [ ] [ ] = new int [ m + 1 ] [ n + 1 ] ;
for ( int i = 0 ;
i <= n ;
++ i ) lookup [ 0 ] [ i ] = 0 ;
for ( int i = 0 ;
i <= m ;
++ i ) lookup [ i ] [ 0 ] = 1 ;
for ( int i = 1 ;
i <= m ;
i ++ ) {
for ( int j = 1 ;
j <= n ;
j ++ ) {
if ( a . charAt ( i - 1 ) == b . charAt ( j - 1 ) ) lookup [ i ] [ j ] = lookup [ i - 1 ] [ j - 1 ] + lookup [ i - 1 ] [ j ] ;
else lookup [ i ] [ j ] = lookup [ i - 1 ] [ j ] ;
}
}
return lookup [ m ] [ n ] ;
}
| def f_gold ( a , b ) :
m = len ( a )
n = len ( b )
lookup = [ [ 0 ] * ( n + 1 ) for i in range ( m + 1 ) ]
for i in range ( n + 1 ) :
lookup [ 0 ] [ i ] = 0
for i in range ( m + 1 ) :
lookup [ i ] [ 0 ] = 1
for i in range ( 1 , m + 1 ) :
for j in range ( 1 , n + 1 ) :
if a [ i - 1 ] == b [ j - 1 ] :
lookup [ i ] [ j ] = lookup [ i - 1 ] [ j - 1 ] + lookup [ i - 1 ] [ j ]
else :
lookup [ i ] [ j ] = lookup [ i - 1 ] [ j ]
return lookup [ m ] [ n ]
|
using namespace std;
int f_gold ( string a, string b ) {
int m = a . length ( );
int n = b . length ( );
int lookup [ m + 1 ] [ n + 1 ] = {
{
0 }
};
for ( int i = 0;
i <= n;
++ i ) lookup [ 0 ] [ i ] = 0;
for ( int i = 0;
i <= m;
++ i ) lookup [ i ] [ 0 ] = 1;
for ( int i = 1;
i <= m;
i ++ ) {
for ( int j = 1;
j <= n;
j ++ ) {
if ( a [ i - 1 ] == b [ j - 1 ] ) lookup [ i ] [ j ] = lookup [ i - 1 ] [ j - 1 ] + lookup [ i - 1 ] [ j ];
else lookup [ i ] [ j ] = lookup [ i - 1 ] [ j ];
}
}
return lookup [ m ] [ n ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("fZOKCdZ Lav");
param0.add("2");
param0.add("1000001110");
param0.add("IAOyBzgIWHo");
param0.add("211806");
param0.add("1");
param0.add("CVaQTG");
param0.add("6265187228");
param0.add("10111101101000");
param0.add("vEi");
List<String> param1 = new ArrayList<>();
param1.add("fKA");
param1.add("187012");
param1.add("0");
param1.add("oA");
param1.add("10");
param1.add("001011100");
param1.add("CT");
param1.add("628");
param1.add("01111");
param1.add("bigsvkQG");
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 = [
('fZOKCdZ Lav','fKA',),
('2','187012',),
('1000001110','0',),
('IAOyBzgIWHo','oA',),
('211806','10',),
('1','001011100',),
('CVaQTG','CT',),
('6265187228','628',),
('10111101101000','01111',),
('vEi','bigsvkQG',)
]
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 {"fZOKCdZ Lav","2","1000001110","IAOyBzgIWHo","211806","1","CVaQTG","6265187228","10111101101000","vEi"};
vector<string> param1 {"fKA","187012","0","oA","10","001011100","CT","628","01111","bigsvkQG"};
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;
} |
CHECK_DIVISIBILITY_LARGE_NUMBER_999 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_DIVISIBILITY_LARGE_NUMBER_999{
static boolean f_gold ( String num ) {
int n = num . length ( ) ;
if ( n == 0 && num . charAt ( 0 ) == '0' ) return true ;
if ( n % 3 == 1 ) num = "00" + num ;
if ( n % 3 == 2 ) num = "0" + num ;
int gSum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int group = 0 ;
group += ( num . charAt ( i ++ ) - '0' ) * 100 ;
group += ( num . charAt ( i ++ ) - '0' ) * 10 ;
group += num . charAt ( i ) - '0' ;
gSum += group ;
}
if ( gSum > 1000 ) {
num = Integer . toString ( gSum ) ;
n = num . length ( ) ;
gSum = f_gold ( num ) ? 1 : 0 ;
}
return ( gSum == 999 ) ;
}
| null |
using namespace std;
bool f_gold ( string num ) {
int n = num . length ( );
if ( n == 0 && num [ 0 ] == '0' ) return true;
if ( n % 3 == 1 ) num = "00" + num;
if ( n % 3 == 2 ) num = "0" + num;
int gSum = 0;
for ( int i = 0;
i < n;
i ++ ) {
int group = 0;
group += ( num [ i ++ ] - '0' ) * 100;
group += ( num [ i ++ ] - '0' ) * 10;
group += num [ i ] - '0';
gSum += group;
}
if ( gSum > 1000 ) {
num = to_string ( gSum );
n = num . length ( );
gSum = f_gold ( num );
}
return ( gSum == 999 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("235764");
param0.add("321308924");
param0.add("101111");
param0.add("1998");
param0.add("339589");
param0.add("0000101");
param0.add("264735");
param0.add("19570453184");
param0.add("000");
param0.add("SsHh");
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 {"235764","321308924","101111","1998","339589","0000101","264735","19570453184","000","SsHh"};
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;
} |
K_TH_DISTINCT_OR_NON_REPEATING_ELEMENT_IN_AN_ARRAY_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class K_TH_DISTINCT_OR_NON_REPEATING_ELEMENT_IN_AN_ARRAY_1{
static int f_gold ( int arr [ ] , int n , int k ) {
Map < Integer , Integer > h = new HashMap < Integer , Integer > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( h . containsKey ( arr [ i ] ) ) h . put ( arr [ i ] , h . get ( arr [ i ] ) + 1 ) ;
else h . put ( arr [ i ] , 1 ) ;
}
if ( h . size ( ) < k ) return - 1 ;
int dist_count = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( h . get ( arr [ i ] ) == 1 ) dist_count ++ ;
if ( dist_count == k ) return arr [ i ] ;
}
return - 1 ;
}
| def f_gold ( arr , size , KthIndex ) :
dict = { }
vect = [ ]
for i in range ( size ) :
if ( arr [ i ] in dict ) :
dict [ arr [ i ] ] = dict [ arr [ i ] ] + 1
else :
dict [ arr [ i ] ] = 1
for i in range ( size ) :
if ( dict [ arr [ i ] ] > 1 ) :
continue
else :
KthIndex = KthIndex - 1
if ( KthIndex == 0 ) :
return arr [ i ]
return - 1
|
using namespace std;
int f_gold ( int arr [ ], int n, int k ) {
unordered_map < int, int > h;
for ( int i = 0;
i < n;
i ++ ) h [ arr [ i ] ] ++;
if ( h . size ( ) < k ) return - 1;
int dist_count = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( h [ arr [ i ] ] == 1 ) dist_count ++;
if ( dist_count == k ) return arr [ i ];
}
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{17,25,27,27,73,91});
param0.add(new int[]{-86,-74,-88,28,-32,20,-34,32});
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,1});
param0.add(new int[]{5,11,36,27,6,24,58,44,14,68});
param0.add(new int[]{-98,-98,-94,-92,-86,-86,-70,-66,-64,-64,-58,-52,-46,-44,-44,-38,-38,-28,-24,-12,-10,-4,-2,2,8,10,12,20,22,26,26,36,42,52,54,60,60,68,82,82,92,98});
param0.add(new int[]{0,1,0,0,1,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,0,0,1,0,1,1,1,1});
param0.add(new int[]{3,8,9,10,10,13,14,16,18,23,24,25,27,28,30,33,36,39,42,42,44,45,45,48,52,52,55,55,59,59,59,60,61,61,66,66,67,68,71,72,75,76,79,80,94,94});
param0.add(new int[]{-12,56,-48,52,-96,-84,32,-12,-6,82,70,18,66,-6,-22,-46,-54,18,-14,-32,68,82,-44,-42,10,56,8,-56,24,20,-38,30,-52,-66,82,-64,68,-82,52,-88,-34,-26,94,58,-4,-84,-60});
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});
param0.add(new int[]{1,23,75,84,28,34,15,13,51,69,94,45,38,38});
List<Integer> param1 = new ArrayList<>();
param1.add(5);
param1.add(5);
param1.add(33);
param1.add(7);
param1.add(27);
param1.add(27);
param1.add(44);
param1.add(37);
param1.add(22);
param1.add(13);
List<Integer> param2 = new ArrayList<>();
param2.add(3);
param2.add(6);
param2.add(32);
param2.add(5);
param2.add(27);
param2.add(20);
param2.add(26);
param2.add(46);
param2.add(21);
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 = [
([17, 25, 27, 27, 73, 91],5,3,),
([-86, -74, -88, 28, -32, 20, -34, 32],5,6,),
([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],33,32,),
([5, 11, 36, 27, 6, 24, 58, 44, 14, 68],7,5,),
([-98, -98, -94, -92, -86, -86, -70, -66, -64, -64, -58, -52, -46, -44, -44, -38, -38, -28, -24, -12, -10, -4, -2, 2, 8, 10, 12, 20, 22, 26, 26, 36, 42, 52, 54, 60, 60, 68, 82, 82, 92, 98],27,27,),
([0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1],27,20,),
([3, 8, 9, 10, 10, 13, 14, 16, 18, 23, 24, 25, 27, 28, 30, 33, 36, 39, 42, 42, 44, 45, 45, 48, 52, 52, 55, 55, 59, 59, 59, 60, 61, 61, 66, 66, 67, 68, 71, 72, 75, 76, 79, 80, 94, 94],44,26,),
([-12, 56, -48, 52, -96, -84, 32, -12, -6, 82, 70, 18, 66, -6, -22, -46, -54, 18, -14, -32, 68, 82, -44, -42, 10, 56, 8, -56, 24, 20, -38, 30, -52, -66, 82, -64, 68, -82, 52, -88, -34, -26, 94, 58, -4, -84, -60],37,46,),
([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],22,21,),
([1, 23, 75, 84, 28, 34, 15, 13, 51, 69, 94, 45, 38, 38],13,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 {{17,25,27,27,73,91},{-86,-74,-88,28,-32,20,-34,32},{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},{5,11,36,27,6,24,58,44,14,68},{-98,-98,-94,-92,-86,-86,-70,-66,-64,-64,-58,-52,-46,-44,-44,-38,-38,-28,-24,-12,-10,-4,-2,2,8,10,12,20,22,26,26,36,42,52,54,60,60,68,82,82,92,98},{0,1,0,0,1,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,0,0,1,0,1,1,1,1},{3,8,9,10,10,13,14,16,18,23,24,25,27,28,30,33,36,39,42,42,44,45,45,48,52,52,55,55,59,59,59,60,61,61,66,66,67,68,71,72,75,76,79,80,94,94},{-12,56,-48,52,-96,-84,32,-12,-6,82,70,18,66,-6,-22,-46,-54,18,-14,-32,68,82,-44,-42,10,56,8,-56,24,20,-38,30,-52,-66,82,-64,68,-82,52,-88,-34,-26,94,58,-4,-84,-60},{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,23,75,84,28,34,15,13,51,69,94,45,38,38}};
vector<int> param1 {5,5,33,7,27,27,44,37,22,13};
vector<int> param2 {3,6,32,5,27,20,26,46,21,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;
} |
CHECK_LARGE_NUMBER_DIVISIBLE_6_NOT |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_LARGE_NUMBER_DIVISIBLE_6_NOT{
static boolean f_gold ( String str ) {
int n = str . length ( ) ;
if ( ( str . charAt ( n - 1 ) - '0' ) % 2 != 0 ) return false ;
int digitSum = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) digitSum += ( str . charAt ( i ) - '0' ) ;
return ( digitSum % 3 == 0 ) ;
}
| null |
using namespace std;
bool f_gold ( string str ) {
int n = str . length ( );
if ( ( str [ n - 1 ] - '0' ) % 2 != 0 ) return false;
int digitSum = 0;
for ( int i = 0;
i < n;
i ++ ) digitSum += ( str [ i ] - '0' );
return ( digitSum % 3 == 0 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("2112");
param0.add("1124");
param0.add("1110");
param0.add("O");
param0.add("65530186");
param0.add("132");
param0.add("UqOE");
param0.add("587");
param0.add("1010");
param0.add("QETUfLQ");
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 {"2112","1124","1110","O","65530186","132","UqOE","587","1010","QETUfLQ"};
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_REVERSING_SUB_ARRAY_MAKE_ARRAY_SORTED |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_REVERSING_SUB_ARRAY_MAKE_ARRAY_SORTED{
static boolean f_gold ( int arr [ ] , int n ) {
int temp [ ] = new int [ n ] ;
for ( int i = 0 ;
i < n ;
i ++ ) {
temp [ i ] = arr [ i ] ;
}
Arrays . sort ( temp ) ;
int front ;
for ( front = 0 ;
front < n ;
front ++ ) {
if ( temp [ front ] != arr [ front ] ) {
break ;
}
}
int back ;
for ( back = n - 1 ;
back >= 0 ;
back -- ) {
if ( temp [ back ] != arr [ back ] ) {
break ;
}
}
if ( front >= back ) {
return true ;
}
do {
front ++ ;
if ( arr [ front - 1 ] < arr [ front ] ) {
return false ;
}
}
while ( front != back ) ;
return true ;
}
| def f_gold ( arr , n ) :
temp = [ 0 ] * n
for i in range ( n ) :
temp [ i ] = arr [ i ]
temp.sort ( )
for front in range ( n ) :
if temp [ front ] != arr [ front ] :
break
for back in range ( n - 1 , - 1 , - 1 ) :
if temp [ back ] != arr [ back ] :
break
if front >= back :
return True
while front != back :
front += 1
if arr [ front - 1 ] < arr [ front ] :
return False
return True
|
using namespace std;
bool f_gold ( int arr [ ], int n ) {
int temp [ n ];
for ( int i = 0;
i < n;
i ++ ) temp [ i ] = arr [ i ];
sort ( temp, temp + n );
int front;
for ( front = 0;
front < n;
front ++ ) if ( temp [ front ] != arr [ front ] ) break;
int back;
for ( back = n - 1;
back >= 0;
back -- ) if ( temp [ back ] != arr [ back ] ) break;
if ( front >= back ) return true;
do {
front ++;
if ( arr [ front - 1 ] < arr [ front ] ) return false;
}
while ( front != back );
return true;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{5,9,9,16,17,22,32,40,45,53,57,58,66,69,76,80,91,93,94});
param0.add(new int[]{52,-76,-18,86,56});
param0.add(new int[]{0,0,1});
param0.add(new int[]{66,44,98,44});
param0.add(new int[]{-96,-62,-56,-46,-44,-38,-38,-26,-22,-22,-16,-12,-6,12,22,34,36,44,44,68,70,74,94});
param0.add(new int[]{1,1,0,0,1,1,1,1,0,1,1,1,0,0,1,1,1,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,0,0,1,1});
param0.add(new int[]{5,9,11,12,13,16,19,23,23,23,25,27,27,28,31,36,40,44,48,59,60,63,66,66,67,67,69,69,70,71,73,76,76,79,86,86,92,92,93,93});
param0.add(new int[]{6,82,-88,-46,-60,70,-54,-96,-94,46,-52,48,-26,-50,-92,-92,6,-6,42,0,-66,-96,66,6,-68,-30,-54,76,60,30,72,-66,-12,-74});
param0.add(new int[]{0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{62,54,36,35,36,91,45,87,74,49,15,15,73,77,63,70,74,65,11,18});
List<Integer> param1 = new ArrayList<>();
param1.add(10);
param1.add(3);
param1.add(1);
param1.add(2);
param1.add(14);
param1.add(27);
param1.add(34);
param1.add(28);
param1.add(13);
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, 9, 9, 16, 17, 22, 32, 40, 45, 53, 57, 58, 66, 69, 76, 80, 91, 93, 94],10,),
([52, -76, -18, 86, 56],3,),
([0, 0, 1],1,),
([66, 44, 98, 44],2,),
([-96, -62, -56, -46, -44, -38, -38, -26, -22, -22, -16, -12, -6, 12, 22, 34, 36, 44, 44, 68, 70, 74, 94],14,),
([1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1],27,),
([5, 9, 11, 12, 13, 16, 19, 23, 23, 23, 25, 27, 27, 28, 31, 36, 40, 44, 48, 59, 60, 63, 66, 66, 67, 67, 69, 69, 70, 71, 73, 76, 76, 79, 86, 86, 92, 92, 93, 93],34,),
([6, 82, -88, -46, -60, 70, -54, -96, -94, 46, -52, 48, -26, -50, -92, -92, 6, -6, 42, 0, -66, -96, 66, 6, -68, -30, -54, 76, 60, 30, 72, -66, -12, -74],28,),
([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],13,),
([62, 54, 36, 35, 36, 91, 45, 87, 74, 49, 15, 15, 73, 77, 63, 70, 74, 65, 11, 18],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,9,9,16,17,22,32,40,45,53,57,58,66,69,76,80,91,93,94},{52,-76,-18,86,56},{0,0,1},{66,44,98,44},{-96,-62,-56,-46,-44,-38,-38,-26,-22,-22,-16,-12,-6,12,22,34,36,44,44,68,70,74,94},{1,1,0,0,1,1,1,1,0,1,1,1,0,0,1,1,1,0,0,1,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,0,0,1,1},{5,9,11,12,13,16,19,23,23,23,25,27,27,28,31,36,40,44,48,59,60,63,66,66,67,67,69,69,70,71,73,76,76,79,86,86,92,92,93,93},{6,82,-88,-46,-60,70,-54,-96,-94,46,-52,48,-26,-50,-92,-92,6,-6,42,0,-66,-96,66,6,-68,-30,-54,76,60,30,72,-66,-12,-74},{0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1},{62,54,36,35,36,91,45,87,74,49,15,15,73,77,63,70,74,65,11,18}};
vector<int> param1 {10,3,1,2,14,27,34,28,13,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;
} |
REMAINDER_7_LARGE_NUMBERS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class REMAINDER_7_LARGE_NUMBERS{
static int f_gold ( String num ) {
int series [ ] = {
1 , 3 , 2 , - 1 , - 3 , - 2 };
int series_index = 0 ;
int result = 0 ;
for ( int i = num . length ( ) - 1 ;
i >= 0 ;
i -- ) {
int digit = num . charAt ( i ) - '0' ;
result += digit * series [ series_index ] ;
series_index = ( series_index + 1 ) % 6 ;
result %= 7 ;
}
if ( result < 0 ) result = ( result + 7 ) % 7 ;
return result ;
}
| def f_gold ( num ) :
series = [ 1 , 3 , 2 , - 1 , - 3 , - 2 ] ;
series_index = 0 ;
result = 0 ;
for i in range ( ( len ( num ) - 1 ) , - 1 , - 1 ) :
digit = ord ( num [ i ] ) - 48 ;
result += digit * series [ series_index ] ;
series_index = ( series_index + 1 ) % 6 ;
result %= 7 ;
if ( result < 0 ) :
result = ( result + 7 ) % 7 ;
return result ;
|
using namespace std;
int f_gold ( string num ) {
int series [ ] = {
1, 3, 2, - 1, - 3, - 2 };
int series_index = 0;
int result = 0;
for ( int i = num . size ( ) - 1;
i >= 0;
i -- ) {
int digit = num [ i ] - '0';
result += digit * series [ series_index ];
series_index = ( series_index + 1 ) % 6;
result %= 7;
}
if ( result < 0 ) result = ( result + 7 ) % 7;
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("K");
param0.add("850076");
param0.add("00111");
param0.add("X");
param0.add("1");
param0.add("10010001100");
param0.add(" pgPeLz");
param0.add("53212456821275");
param0.add("101");
param0.add("V");
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 = [
('K',),
('850076',),
('00111',),
('X',),
('1',),
('10010001100',),
(' pgPeLz',),
('53212456821275',),
('101',),
('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 {"K","850076","00111","X","1","10010001100"," pgPeLz","53212456821275","101","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;
} |
FRIENDS_PAIRING_PROBLEM |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FRIENDS_PAIRING_PROBLEM{
static int f_gold ( int n ) {
int dp [ ] = new int [ n + 1 ] ;
for ( int i = 0 ;
i <= n ;
i ++ ) {
if ( i <= 2 ) dp [ i ] = i ;
else dp [ i ] = dp [ i - 1 ] + ( i - 1 ) * dp [ i - 2 ] ;
}
return dp [ n ] ;
}
| def f_gold ( n ) :
dp = [ 0 for i in range ( n + 1 ) ]
for i in range ( n + 1 ) :
if ( i <= 2 ) :
dp [ i ] = i
else :
dp [ i ] = dp [ i - 1 ] + ( i - 1 ) * dp [ i - 2 ]
return dp [ n ]
|
using namespace std;
int f_gold ( int n ) {
int dp [ n + 1 ];
for ( int i = 0;
i <= n;
i ++ ) {
if ( i <= 2 ) dp [ i ] = i;
else dp [ i ] = dp [ i - 1 ] + ( i - 1 ) * dp [ i - 2 ];
}
return dp [ n ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(99);
param0.add(62);
param0.add(87);
param0.add(87);
param0.add(61);
param0.add(88);
param0.add(73);
param0.add(62);
param0.add(98);
param0.add(57);
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 = [
(99,),
(62,),
(87,),
(87,),
(61,),
(88,),
(73,),
(62,),
(98,),
(57,)
]
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 {99,62,87,87,61,88,73,62,98,57};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
CHECK_CHARACTERS_GIVEN_STRING_CAN_REARRANGED_FORM_PALINDROME_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_CHARACTERS_GIVEN_STRING_CAN_REARRANGED_FORM_PALINDROME_1{
static boolean f_gold ( String str ) {
List < Character > list = new ArrayList < Character > ( ) ;
for ( int i = 0 ;
i < str . length ( ) ;
i ++ ) {
if ( list . contains ( str . charAt ( i ) ) ) list . remove ( ( Character ) str . charAt ( i ) ) ;
else list . add ( str . charAt ( i ) ) ;
}
if ( str . length ( ) % 2 == 0 && list . isEmpty ( ) || ( str . length ( ) % 2 == 1 && list . size ( ) == 1 ) ) return true ;
else return false ;
}
| null |
using namespace std;
bool f_gold ( string str ) {
vector < char > list;
for ( int i = 0;
i < str . length ( );
i ++ ) {
auto pos = find ( list . begin ( ), list . end ( ), str [ i ] );
if ( pos != list . end ( ) ) {
auto posi = find ( list . begin ( ), list . end ( ), str [ i ] );
list . erase ( posi );
}
else list . push_back ( str [ i ] );
}
if ( str . length ( ) % 2 == 0 && list . empty ( ) || ( str . length ( ) % 2 == 1 && list . size ( ) == 1 ) ) return true;
else return false;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("abccba");
param0.add("2674377254");
param0.add("11");
param0.add("abcdecba");
param0.add("26382426486138");
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());
}
} | null |
int main() {
int n_success = 0;
vector<string> param0 {"abccba","2674377254","11","abcdecba","26382426486138","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;
} |
FIND_WHETHER_A_GIVEN_NUMBER_IS_A_POWER_OF_4_OR_NOT_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_WHETHER_A_GIVEN_NUMBER_IS_A_POWER_OF_4_OR_NOT_1{
static int f_gold ( int n ) {
int count = 0 ;
int x = n & ( n - 1 ) ;
if ( n > 0 && x == 0 ) {
while ( n > 1 ) {
n >>= 1 ;
count += 1 ;
}
return ( count % 2 == 0 ) ? 1 : 0 ;
}
return 0 ;
}
| def f_gold ( n ) :
count = 0
if ( n and ( not ( n & ( n - 1 ) ) ) ) :
while ( n > 1 ) :
n >>= 1
count += 1
if ( count % 2 == 0 ) :
return True
else :
return False
|
using namespace std;
bool f_gold ( unsigned int n ) {
int count = 0;
if ( n && ! ( n & ( n - 1 ) ) ) {
while ( n > 1 ) {
n >>= 1;
count += 1;
}
return ( count % 2 == 0 ) ? 1 : 0;
}
return 0;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(1);
param0.add(4);
param0.add(64);
param0.add(-64);
param0.add(128);
param0.add(1024);
param0.add(45);
param0.add(33);
param0.add(66);
param0.add(74);
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 = [
(1,),
(4,),
(64,),
(-64,),
(128,),
(1024,),
(45,),
(33,),
(66,),
(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 {1,4,64,-64,128,1024,45,33,66,74};
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_POSSIBLE_WAYS_TO_CONSTRUCT_BUILDINGS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_POSSIBLE_WAYS_TO_CONSTRUCT_BUILDINGS{
static int f_gold ( int N ) {
if ( N == 1 ) return 4 ;
int countB = 1 , countS = 1 , prev_countB , prev_countS ;
for ( int i = 2 ;
i <= N ;
i ++ ) {
prev_countB = countB ;
prev_countS = countS ;
countS = prev_countB + prev_countS ;
countB = prev_countS ;
}
int result = countS + countB ;
return ( result * result ) ;
}
| def f_gold ( N ) :
if ( N == 1 ) :
return 4
countB = 1
countS = 1
for i in range ( 2 , N + 1 ) :
prev_countB = countB
prev_countS = countS
countS = prev_countB + prev_countS
countB = prev_countS
result = countS + countB
return ( result * result )
|
using namespace std;
int f_gold ( int N ) {
if ( N == 1 ) return 4;
int countB = 1, countS = 1, prev_countB, prev_countS;
for ( int i = 2;
i <= N;
i ++ ) {
prev_countB = countB;
prev_countS = countS;
countS = prev_countB + prev_countS;
countB = prev_countS;
}
int result = countS + countB;
return ( result * result );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(17);
param0.add(66);
param0.add(53);
param0.add(97);
param0.add(34);
param0.add(54);
param0.add(9);
param0.add(99);
param0.add(59);
param0.add(87);
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,),
(66,),
(53,),
(97,),
(34,),
(54,),
(9,),
(99,),
(59,),
(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 {17,66,53,97,34,54,9,99,59,87};
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_PAIRWISE_PRODUCTS_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_PAIRWISE_PRODUCTS_1{
static int f_gold ( int n ) {
int multiTerms = n * ( n + 1 ) / 2 ;
int sum = multiTerms ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
multiTerms = multiTerms - ( i - 1 ) ;
sum = sum + multiTerms * i ;
}
return sum ;
}
| def f_gold ( n ) :
multiTerms = n * ( n + 1 ) // 2
sm = multiTerms
for i in range ( 2 , n + 1 ) :
multiTerms = multiTerms - ( i - 1 )
sm = sm + multiTerms * i
return sm
|
using namespace std;
long long int f_gold ( int n ) {
long long int multiTerms = n * ( n + 1 ) / 2;
long long int sum = multiTerms;
for ( int i = 2;
i <= n;
i ++ ) {
multiTerms = multiTerms - ( i - 1 );
sum = sum + multiTerms * i;
}
return sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(41);
param0.add(50);
param0.add(67);
param0.add(18);
param0.add(60);
param0.add(6);
param0.add(27);
param0.add(46);
param0.add(50);
param0.add(20);
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 = [
(41,),
(50,),
(67,),
(18,),
(60,),
(6,),
(27,),
(46,),
(50,),
(20,)
]
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 {41,50,67,18,60,6,27,46,50,20};
for(int i = 0; i < param0.size(); ++i)
{
if(f_filled(param0[i]) == f_gold(param0[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
REMOVE_MINIMUM_NUMBER_ELEMENTS_NO_COMMON_ELEMENT_EXIST_ARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class REMOVE_MINIMUM_NUMBER_ELEMENTS_NO_COMMON_ELEMENT_EXIST_ARRAY{
public static int f_gold ( int a [ ] , int b [ ] , int n , int m ) {
HashMap < Integer , Integer > countA = new HashMap < Integer , Integer > ( ) ;
HashMap < Integer , Integer > countB = new HashMap < Integer , Integer > ( ) ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( countA . containsKey ( a [ i ] ) ) countA . put ( a [ i ] , countA . get ( a [ i ] ) + 1 ) ;
else countA . put ( a [ i ] , 1 ) ;
}
for ( int i = 0 ;
i < m ;
i ++ ) {
if ( countB . containsKey ( b [ i ] ) ) countB . put ( b [ i ] , countB . get ( b [ i ] ) + 1 ) ;
else countB . put ( b [ i ] , 1 ) ;
}
int res = 0 ;
Set < Integer > s = countA . keySet ( ) ;
for ( int x : s ) if ( countB . containsKey ( x ) ) res += Math . min ( countB . get ( x ) , countA . get ( x ) ) ;
return res ;
}
| def f_gold ( a , b , n , m ) :
countA = dict ( )
countB = dict ( )
for i in range ( n ) :
countA [ a [ i ] ] = countA.get ( a [ i ] , 0 ) + 1
for i in range ( n ) :
countB [ b [ i ] ] = countB.get ( b [ i ] , 0 ) + 1
res = 0
for x in countA :
if x in countB.keys ( ) :
res += min ( countA [ x ] , countB [ x ] )
return res
|
using namespace std;
int f_gold ( int a [ ], int b [ ], int n, int m ) {
unordered_map < int, int > countA, countB;
for ( int i = 0;
i < n;
i ++ ) countA [ a [ i ] ] ++;
for ( int i = 0;
i < m;
i ++ ) countB [ b [ i ] ] ++;
int res = 0;
for ( auto x : countA ) if ( countB . find ( x . first ) != countB . end ( ) ) res += min ( x . second, countB [ x . first ] );
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{4,7,10,12,12,24,29,38,45,51,53,54,59,68,72,73,85,86,88,92,92,95});
param0.add(new int[]{-6,48,-70,14,-86,56,80,-64,64,-88,-14,78,14,-18,52,2,22,88});
param0.add(new int[]{0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1});
param0.add(new int[]{10,93,2,16,36,49,36,86,6,99,95,2});
param0.add(new int[]{-98,-96,-80,-64,-42,-30,-6,10,62,66,82});
param0.add(new int[]{1,1,0,1,1});
param0.add(new int[]{7,11,13,15,21,33,36,39,66,99});
param0.add(new int[]{-40});
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,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[]{79,91,31,16,28,45,37,43,73,73,76,28,71,60,64,60,99,36,47,38,65,34,22,94,84,51,72,45,71,2});
List<int [ ]> param1 = new ArrayList<>();
param1.add(new int[]{7,9,17,23,25,26,29,32,35,56,56,58,59,59,62,63,72,82,85,86,95,97});
param1.add(new int[]{-62,-58,60,-30,42,8,66,-48,-18,64,-76,-90,-48,-90,-24,64,-88,-98});
param1.add(new int[]{0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1});
param1.add(new int[]{99,28,7,21,62,89,82,41,43,77,8,14});
param1.add(new int[]{-62,-50,-42,24,44,46,52,54,60,72,72});
param1.add(new int[]{1,1,1,0,0});
param1.add(new int[]{23,36,42,44,62,65,70,78,82,89});
param1.add(new int[]{-98});
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,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 int[]{58,94,12,27,98,38,75,20,94,43,32,90,23,41,88,2,62,96,53,57,48,79,6,16,11,46,73,57,67,7});
List<Integer> param2 = new ArrayList<>();
param2.add(15);
param2.add(15);
param2.add(10);
param2.add(6);
param2.add(9);
param2.add(4);
param2.add(9);
param2.add(0);
param2.add(31);
param2.add(18);
List<Integer> param3 = new ArrayList<>();
param3.add(13);
param3.add(9);
param3.add(10);
param3.add(10);
param3.add(6);
param3.add(2);
param3.add(9);
param3.add(0);
param3.add(26);
param3.add(18);
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 = [
([4, 7, 10, 12, 12, 24, 29, 38, 45, 51, 53, 54, 59, 68, 72, 73, 85, 86, 88, 92, 92, 95],[7, 9, 17, 23, 25, 26, 29, 32, 35, 56, 56, 58, 59, 59, 62, 63, 72, 82, 85, 86, 95, 97],15,13,),
([-6, 48, -70, 14, -86, 56, 80, -64, 64, -88, -14, 78, 14, -18, 52, 2, 22, 88],[-62, -58, 60, -30, 42, 8, 66, -48, -18, 64, -76, -90, -48, -90, -24, 64, -88, -98],15,9,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1],[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],10,10,),
([10, 93, 2, 16, 36, 49, 36, 86, 6, 99, 95, 2],[99, 28, 7, 21, 62, 89, 82, 41, 43, 77, 8, 14],6,10,),
([-98, -96, -80, -64, -42, -30, -6, 10, 62, 66, 82],[-62, -50, -42, 24, 44, 46, 52, 54, 60, 72, 72],9,6,),
([1, 1, 0, 1, 1],[1, 1, 1, 0, 0],4,2,),
([7, 11, 13, 15, 21, 33, 36, 39, 66, 99],[23, 36, 42, 44, 62, 65, 70, 78, 82, 89],9,9,),
([-40],[-98],0,0,),
([0, 0, 0, 0, 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],[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],31,26,),
([79, 91, 31, 16, 28, 45, 37, 43, 73, 73, 76, 28, 71, 60, 64, 60, 99, 36, 47, 38, 65, 34, 22, 94, 84, 51, 72, 45, 71, 2],[58, 94, 12, 27, 98, 38, 75, 20, 94, 43, 32, 90, 23, 41, 88, 2, 62, 96, 53, 57, 48, 79, 6, 16, 11, 46, 73, 57, 67, 7],18,18,)
]
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,10,12,12,24,29,38,45,51,53,54,59,68,72,73,85,86,88,92,92,95},{-6,48,-70,14,-86,56,80,-64,64,-88,-14,78,14,-18,52,2,22,88},{0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1},{10,93,2,16,36,49,36,86,6,99,95,2},{-98,-96,-80,-64,-42,-30,-6,10,62,66,82},{1,1,0,1,1},{7,11,13,15,21,33,36,39,66,99},{-40},{0,0,0,0,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},{79,91,31,16,28,45,37,43,73,73,76,28,71,60,64,60,99,36,47,38,65,34,22,94,84,51,72,45,71,2}};
vector<vector<int>> param1 {{7,9,17,23,25,26,29,32,35,56,56,58,59,59,62,63,72,82,85,86,95,97},{-62,-58,60,-30,42,8,66,-48,-18,64,-76,-90,-48,-90,-24,64,-88,-98},{0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{99,28,7,21,62,89,82,41,43,77,8,14},{-62,-50,-42,24,44,46,52,54,60,72,72},{1,1,1,0,0},{23,36,42,44,62,65,70,78,82,89},{-98},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{58,94,12,27,98,38,75,20,94,43,32,90,23,41,88,2,62,96,53,57,48,79,6,16,11,46,73,57,67,7}};
vector<int> param2 {15,15,10,6,9,4,9,0,31,18};
vector<int> param3 {13,9,10,10,6,2,9,0,26,18};
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;
} |
N_TH_NUMBER_WHOSE_SUM_OF_DIGITS_IS_TEN_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class N_TH_NUMBER_WHOSE_SUM_OF_DIGITS_IS_TEN_2{
public static int f_gold ( int n ) {
int nthElement = 19 + ( n - 1 ) * 9 ;
int outliersCount = ( int ) Math . log10 ( nthElement ) - 1 ;
nthElement += 9 * outliersCount ;
return nthElement ;
}
| import math
def f_gold ( n ) :
nthElement = 19 + ( n - 1 ) * 9
outliersCount = int ( math.log10 ( nthElement ) ) - 1
nthElement += 9 * outliersCount
return nthElement
|
using namespace std;
int f_gold ( int n ) {
int nthElement = 19 + ( n - 1 ) * 9;
int outliersCount = ( int ) log10 ( nthElement ) - 1;
nthElement += 9 * outliersCount;
return nthElement;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(68);
param0.add(70);
param0.add(69);
param0.add(93);
param0.add(99);
param0.add(44);
param0.add(91);
param0.add(8);
param0.add(83);
param0.add(51);
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 = [
(68,),
(70,),
(69,),
(93,),
(99,),
(44,),
(91,),
(8,),
(83,),
(51,)
]
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 {68,70,69,93,99,44,91,8,83,51};
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_MAXIMUM_AVERAGE_SUBARRAY_OF_K_LENGTH |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_MAXIMUM_AVERAGE_SUBARRAY_OF_K_LENGTH{
static int f_gold ( int [ ] arr , int n , int k ) {
if ( k > n ) return - 1 ;
int [ ] csum = new int [ n ] ;
csum [ 0 ] = arr [ 0 ] ;
for ( int i = 1 ;
i < n ;
i ++ ) csum [ i ] = csum [ i - 1 ] + arr [ i ] ;
int max_sum = csum [ k - 1 ] , max_end = k - 1 ;
for ( int i = k ;
i < n ;
i ++ ) {
int curr_sum = csum [ i ] - csum [ i - k ] ;
if ( curr_sum > max_sum ) {
max_sum = curr_sum ;
max_end = i ;
}
}
return max_end - k + 1 ;
}
| def f_gold ( arr , n , k ) :
if k > n :
return - 1
csum = [ 0 ] * n
csum [ 0 ] = arr [ 0 ]
for i in range ( 1 , n ) :
csum [ i ] = csum [ i - 1 ] + arr [ i ] ;
max_sum = csum [ k - 1 ]
max_end = k - 1
for i in range ( k , n ) :
curr_sum = csum [ i ] - csum [ i - k ]
if curr_sum > max_sum :
max_sum = curr_sum
max_end = i
return max_end - k + 1
|
using namespace std;
int f_gold ( int arr [ ], int n, int k ) {
if ( k > n ) return - 1;
int * csum = new int [ n ];
csum [ 0 ] = arr [ 0 ];
for ( int i = 1;
i < n;
i ++ ) csum [ i ] = csum [ i - 1 ] + arr [ i ];
int max_sum = csum [ k - 1 ], max_end = k - 1;
for ( int i = k;
i < n;
i ++ ) {
int curr_sum = csum [ i ] - csum [ i - k ];
if ( curr_sum > max_sum ) {
max_sum = curr_sum;
max_end = i;
}
}
delete [ ] csum;
return max_end - k + 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,4,6,19,21,23,32,34,47,51,56,57,57,65,68,68,69,70,71,73,74,74,77,77,79,82,82,86,87,87,88,89,90,91,92});
param0.add(new int[]{24,62,-32,-28,42,-46,-96,-70,-68,60,44,34,-30,96,-26,92,62,42,-46,-38,44,54,-94,52,66,68,-96,-58,84,-2,66,30,42});
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});
param0.add(new int[]{94,6,48,34,31});
param0.add(new int[]{-98,-88,-82,-80,-76,-70,-70,-60,-60,-52,-50,-46,-44,-44,-44,-20,-18,-12,-12,-12,-10,-8,-6,-4,4,4,18,28,32,34,42,42,44,46,48,54,60,70,70,72,78,78,78,78,84,86,90,96,98});
param0.add(new int[]{0,1,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0});
param0.add(new int[]{1,5,13,17,26,26,32,35,38,38,39,45,52,58,60,61,62,63,82,83,85,89,89,91});
param0.add(new int[]{-68,-52,4,-90,90,88,38,-18,86,4,14,-32,-14,-44,-88,-50,-12,-26,-68,-20,-30,22,0,14,-40,58,-6,28,-44,8,28,96,-46,-12});
param0.add(new int[]{0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{17,33,36,34,32,10,37,48,47,32,21,18,75,8,18,52,21,73,25,25,80,32,10,24,1,89,7,42,86,85,73,12,20,20,1,74,77,4,24,74,8});
List<Integer> param1 = new ArrayList<>();
param1.add(29);
param1.add(23);
param1.add(32);
param1.add(4);
param1.add(45);
param1.add(15);
param1.add(13);
param1.add(32);
param1.add(13);
param1.add(20);
List<Integer> param2 = new ArrayList<>();
param2.add(20);
param2.add(31);
param2.add(31);
param2.add(3);
param2.add(30);
param2.add(8);
param2.add(22);
param2.add(22);
param2.add(11);
param2.add(28);
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, 19, 21, 23, 32, 34, 47, 51, 56, 57, 57, 65, 68, 68, 69, 70, 71, 73, 74, 74, 77, 77, 79, 82, 82, 86, 87, 87, 88, 89, 90, 91, 92],29,20,),
([24, 62, -32, -28, 42, -46, -96, -70, -68, 60, 44, 34, -30, 96, -26, 92, 62, 42, -46, -38, 44, 54, -94, 52, 66, 68, -96, -58, 84, -2, 66, 30, 42],23,31,),
([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],32,31,),
([94, 6, 48, 34, 31],4,3,),
([-98, -88, -82, -80, -76, -70, -70, -60, -60, -52, -50, -46, -44, -44, -44, -20, -18, -12, -12, -12, -10, -8, -6, -4, 4, 4, 18, 28, 32, 34, 42, 42, 44, 46, 48, 54, 60, 70, 70, 72, 78, 78, 78, 78, 84, 86, 90, 96, 98],45,30,),
([0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0],15,8,),
([1, 5, 13, 17, 26, 26, 32, 35, 38, 38, 39, 45, 52, 58, 60, 61, 62, 63, 82, 83, 85, 89, 89, 91],13,22,),
([-68, -52, 4, -90, 90, 88, 38, -18, 86, 4, 14, -32, -14, -44, -88, -50, -12, -26, -68, -20, -30, 22, 0, 14, -40, 58, -6, 28, -44, 8, 28, 96, -46, -12],32,22,),
([0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1],13,11,),
([17, 33, 36, 34, 32, 10, 37, 48, 47, 32, 21, 18, 75, 8, 18, 52, 21, 73, 25, 25, 80, 32, 10, 24, 1, 89, 7, 42, 86, 85, 73, 12, 20, 20, 1, 74, 77, 4, 24, 74, 8],20,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 {{2,4,6,19,21,23,32,34,47,51,56,57,57,65,68,68,69,70,71,73,74,74,77,77,79,82,82,86,87,87,88,89,90,91,92},{24,62,-32,-28,42,-46,-96,-70,-68,60,44,34,-30,96,-26,92,62,42,-46,-38,44,54,-94,52,66,68,-96,-58,84,-2,66,30,42},{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},{94,6,48,34,31},{-98,-88,-82,-80,-76,-70,-70,-60,-60,-52,-50,-46,-44,-44,-44,-20,-18,-12,-12,-12,-10,-8,-6,-4,4,4,18,28,32,34,42,42,44,46,48,54,60,70,70,72,78,78,78,78,84,86,90,96,98},{0,1,0,0,1,0,1,1,0,0,1,1,0,0,0,0,0},{1,5,13,17,26,26,32,35,38,38,39,45,52,58,60,61,62,63,82,83,85,89,89,91},{-68,-52,4,-90,90,88,38,-18,86,4,14,-32,-14,-44,-88,-50,-12,-26,-68,-20,-30,22,0,14,-40,58,-6,28,-44,8,28,96,-46,-12},{0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{17,33,36,34,32,10,37,48,47,32,21,18,75,8,18,52,21,73,25,25,80,32,10,24,1,89,7,42,86,85,73,12,20,20,1,74,77,4,24,74,8}};
vector<int> param1 {29,23,32,4,45,15,13,32,13,20};
vector<int> param2 {20,31,31,3,30,8,22,22,11,28};
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;
} |
NUMBER_ORDERED_PAIRS_AI_AJ_0 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_ORDERED_PAIRS_AI_AJ_0{
static int f_gold ( int a [ ] , int n ) {
int count = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
for ( int j = i + 1 ;
j < n ;
j ++ ) if ( ( a [ i ] & a [ j ] ) == 0 ) count += 2 ;
}
return count ;
}
| def f_gold ( a , n ) :
count = 0
for i in range ( 0 , n ) :
for j in range ( i + 1 , n ) :
if ( a [ i ] & a [ j ] ) == 0 :
count += 2
return count
|
using namespace std;
int f_gold ( int a [ ], int n ) {
int count = 0;
for ( int i = 0;
i < n;
i ++ ) {
for ( int j = i + 1;
j < n;
j ++ ) if ( ( a [ i ] & a [ j ] ) == 0 ) count += 2;
}
return count;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{17,20,32,35,35,36,43,47,59,59,68,69,70,70,75,82,88,94,96,99});
param0.add(new int[]{-78,-40,58,-36,34,-12,-38,48,-66,16,50,-26,-22,46,-70,-68,-44,-52,-78,-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,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{49,57,17,37,56,61,10,3,33,33,70,35,50,85,48,65,83,21,96,19,66,43,69,17,60,87,82,3,83,44,63,19,55,58,77,76,50,96});
param0.add(new int[]{-94,-88,-86,-80,-80,-72,-64,-60,-58,-58,-58,-50,-44,-32,-8,-8,0,6,8,10,14,14,18,28,34,34,46,54,56,56,56,64,66,66,70,82,84,88,96});
param0.add(new int[]{1,1,1,0,1,0,1,1,0,0,1,0,1,0,1,1,0});
param0.add(new int[]{1,3,10,11,13,14,15,17,20,25,26,26,27,29,32,36,36,36,42,46,47,49,51,54,54,55,60,66,67,68,68,68,72,77,78,79,83,84,92,98});
param0.add(new int[]{-76,-72,16,38,-60,44,-2,-76,-76,-56,40,36,50,-50,-32,48,-96,80,84,60,84,38,-54,-42,48,30,66,-62,-52,-94,64,-16,54,98});
param0.add(new int[]{0,0,1,1,1,1});
param0.add(new int[]{63,82,22,84,11,62,18,43,57,25,4,27,62,46,55,16,1,9,10,73,36,80,95,87,47,64,27,25,70});
List<Integer> param1 = new ArrayList<>();
param1.add(17);
param1.add(11);
param1.add(23);
param1.add(37);
param1.add(33);
param1.add(13);
param1.add(32);
param1.add(28);
param1.add(5);
param1.add(22);
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 = [
([17, 20, 32, 35, 35, 36, 43, 47, 59, 59, 68, 69, 70, 70, 75, 82, 88, 94, 96, 99],17,),
([-78, -40, 58, -36, 34, -12, -38, 48, -66, 16, 50, -26, -22, 46, -70, -68, -44, -52, -78, -50],11,),
([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],23,),
([49, 57, 17, 37, 56, 61, 10, 3, 33, 33, 70, 35, 50, 85, 48, 65, 83, 21, 96, 19, 66, 43, 69, 17, 60, 87, 82, 3, 83, 44, 63, 19, 55, 58, 77, 76, 50, 96],37,),
([-94, -88, -86, -80, -80, -72, -64, -60, -58, -58, -58, -50, -44, -32, -8, -8, 0, 6, 8, 10, 14, 14, 18, 28, 34, 34, 46, 54, 56, 56, 56, 64, 66, 66, 70, 82, 84, 88, 96],33,),
([1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 0],13,),
([1, 3, 10, 11, 13, 14, 15, 17, 20, 25, 26, 26, 27, 29, 32, 36, 36, 36, 42, 46, 47, 49, 51, 54, 54, 55, 60, 66, 67, 68, 68, 68, 72, 77, 78, 79, 83, 84, 92, 98],32,),
([-76, -72, 16, 38, -60, 44, -2, -76, -76, -56, 40, 36, 50, -50, -32, 48, -96, 80, 84, 60, 84, 38, -54, -42, 48, 30, 66, -62, -52, -94, 64, -16, 54, 98],28,),
([0, 0, 1, 1, 1, 1],5,),
([63, 82, 22, 84, 11, 62, 18, 43, 57, 25, 4, 27, 62, 46, 55, 16, 1, 9, 10, 73, 36, 80, 95, 87, 47, 64, 27, 25, 70],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 {{17,20,32,35,35,36,43,47,59,59,68,69,70,70,75,82,88,94,96,99},{-78,-40,58,-36,34,-12,-38,48,-66,16,50,-26,-22,46,-70,-68,-44,-52,-78,-50},{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},{49,57,17,37,56,61,10,3,33,33,70,35,50,85,48,65,83,21,96,19,66,43,69,17,60,87,82,3,83,44,63,19,55,58,77,76,50,96},{-94,-88,-86,-80,-80,-72,-64,-60,-58,-58,-58,-50,-44,-32,-8,-8,0,6,8,10,14,14,18,28,34,34,46,54,56,56,56,64,66,66,70,82,84,88,96},{1,1,1,0,1,0,1,1,0,0,1,0,1,0,1,1,0},{1,3,10,11,13,14,15,17,20,25,26,26,27,29,32,36,36,36,42,46,47,49,51,54,54,55,60,66,67,68,68,68,72,77,78,79,83,84,92,98},{-76,-72,16,38,-60,44,-2,-76,-76,-56,40,36,50,-50,-32,48,-96,80,84,60,84,38,-54,-42,48,30,66,-62,-52,-94,64,-16,54,98},{0,0,1,1,1,1},{63,82,22,84,11,62,18,43,57,25,4,27,62,46,55,16,1,9,10,73,36,80,95,87,47,64,27,25,70}};
vector<int> param1 {17,11,23,37,33,13,32,28,5,22};
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;
} |
CHECK_WHETHER_LARGE_NUMBER_DIVISIBLE_7 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class CHECK_WHETHER_LARGE_NUMBER_DIVISIBLE_7{
static boolean f_gold ( String num ) {
int n = num . length ( ) ;
if ( n == 0 && num . charAt ( 0 ) == '0' ) return true ;
if ( n % 3 == 1 ) num = "00" + num ;
if ( n % 3 == 2 ) num = "0" + num ;
n = num . length ( ) ;
int gSum = 0 , p = 1 ;
for ( int i = n - 1 ;
i >= 0 ;
i -- ) {
int group = 0 ;
group += num . charAt ( i -- ) - '0' ;
group += ( num . charAt ( i -- ) - '0' ) * 10 ;
group += ( num . charAt ( i ) - '0' ) * 100 ;
gSum = gSum + group * p ;
p = p * - 1 ;
}
return ( gSum % 7 == 0 ) ;
}
| null | null |
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("8955795758");
param0.add("0515");
param0.add("101");
param0.add("14");
param0.add("0");
param0.add("9250318");
param0.add("336");
param0.add("68143991");
param0.add("11010001");
param0.add("zsS");
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 | null |
NUMBER_SUBSEQUENCES_AB_STRING_REPEATED_K_TIMES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class NUMBER_SUBSEQUENCES_AB_STRING_REPEATED_K_TIMES{
static int f_gold ( String s , int K ) {
int n = s . length ( ) ;
int C = 0 , c1 = 0 , c2 = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
if ( s . charAt ( i ) == 'a' ) c1 ++ ;
if ( s . charAt ( i ) == 'b' ) {
c2 ++ ;
C += c1 ;
}
}
return C * K + ( K * ( K - 1 ) / 2 ) * c1 * c2 ;
}
| def f_gold ( s , K ) :
n = len ( s )
c1 = 0
c2 = 0
C = 0
for i in range ( n ) :
if s [ i ] == 'a' :
c1 += 1
if s [ i ] == 'b' :
c2 += 1
C += c1
return C * K + ( K * ( K - 1 ) / 2 ) * c1 * c2
|
using namespace std;
int f_gold ( string s, int K ) {
int n = s . length ( );
int C, c1 = 0, c2 = 0;
for ( int i = 0;
i < n;
i ++ ) {
if ( s [ i ] == 'a' ) c1 ++;
if ( s [ i ] == 'b' ) {
c2 ++;
C += c1;
}
}
return C * K + ( K * ( K - 1 ) / 2 ) * c1 * c2;
}
|
public static void main(String args[]) {
int n_success = 0;
List<String> param0 = new ArrayList<>();
param0.add("abbc");
param0.add("abahk");
param0.add("hugbabab");
param0.add("abadbc");
param0.add("nkg9");
param0.add("jh7dab");
param0.add("abd");
param0.add("aabb8yk");
param0.add("1111");
param0.add("PFXAhru");
List<Integer> param1 = new ArrayList<>();
param1.add(96);
param1.add(7);
param1.add(59);
param1.add(60);
param1.add(8);
param1.add(41);
param1.add(87);
param1.add(4);
param1.add(18);
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 = [
('abbc',96,),
('abahk',7,),
('hugbabab',5,),
('abadbc',60,),
('nkg9',8,),
('jh7dab',41,),
('abd',87,),
('aabb8yk',4,),
('1111',18,),
('PFXAhr',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<string> param0 {"KdJ","031","11000","zPbB","9","1010","c","06064629743411","1111","PFXAhru"};
vector<int> param1 {96,70,59,60,80,41,87,4,18,83};
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_SUM_BITONIC_SUBARRAY |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_SUM_BITONIC_SUBARRAY{
static int f_gold ( int arr [ ] , int n ) {
int [ ] msis = new int [ n ] ;
int [ ] msds = new int [ n ] ;
int max_sum = Integer . MIN_VALUE ;
msis [ 0 ] = arr [ 0 ] ;
for ( int i = 1 ;
i < n ;
i ++ ) if ( arr [ i ] > arr [ i - 1 ] ) msis [ i ] = msis [ i - 1 ] + arr [ i ] ;
else msis [ i ] = arr [ i ] ;
msds [ n - 1 ] = arr [ n - 1 ] ;
for ( int i = n - 2 ;
i >= 0 ;
i -- ) if ( arr [ i ] > arr [ i + 1 ] ) msds [ i ] = msds [ i + 1 ] + arr [ i ] ;
else msds [ i ] = arr [ i ] ;
for ( int i = 0 ;
i < n ;
i ++ ) if ( max_sum < ( msis [ i ] + msds [ i ] - arr [ i ] ) ) max_sum = msis [ i ] + msds [ i ] - arr [ i ] ;
return max_sum ;
}
| def f_gold ( arr , n ) :
msis = [ None ] * n
msds = [ None ] * n
max_sum = 0
msis [ 0 ] = arr [ 0 ]
for i in range ( 1 , n ) :
if ( arr [ i ] > arr [ i - 1 ] ) :
msis [ i ] = msis [ i - 1 ] + arr [ i ]
else :
msis [ i ] = arr [ i ]
msds [ n - 1 ] = arr [ n - 1 ]
for i in range ( n - 2 , - 1 , - 1 ) :
if ( arr [ i ] > arr [ i + 1 ] ) :
msds [ i ] = msds [ i + 1 ] + arr [ i ]
else :
msds [ i ] = arr [ i ]
for i in range ( n ) :
if ( max_sum < ( msis [ i ] + msds [ i ] - arr [ i ] ) ) :
max_sum = ( msis [ i ] + msds [ i ] - arr [ i ] )
return max_sum
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int msis [ n ], msds [ n ];
int max_sum = INT_MIN;
msis [ 0 ] = arr [ 0 ];
for ( int i = 1;
i < n;
i ++ ) if ( arr [ i ] > arr [ i - 1 ] ) msis [ i ] = msis [ i - 1 ] + arr [ i ];
else msis [ i ] = arr [ i ];
msds [ n - 1 ] = arr [ n - 1 ];
for ( int i = n - 2;
i >= 0;
i -- ) if ( arr [ i ] > arr [ i + 1 ] ) msds [ i ] = msds [ i + 1 ] + arr [ i ];
else msds [ i ] = arr [ i ];
for ( int i = 0;
i < n;
i ++ ) if ( max_sum < ( msis [ i ] + msds [ i ] - arr [ i ] ) ) max_sum = msis [ i ] + msds [ i ] - arr [ i ];
return max_sum;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{7,12,16,23,26,27,39,39,40,44,57,58,77,78,81,82,84,86,91,94,94,95,97});
param0.add(new int[]{72,38,-60,98,-52,-38,-2,94,34,56,90,46,6,-2,30,-96,-76,-96,-76,32,68,64,-32,-4,72,-62,58,20,-84,0,-96,70,-22,-56,70,-74,-90,-86,-14,82,-90,40,-64,94});
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,1,1,1,1,1,1});
param0.add(new int[]{69,31,85,84,28,28});
param0.add(new int[]{-80,-74,-24,-22,-22,4,20,28,30,32,36,58,58,68,92,94,98});
param0.add(new int[]{1,1,0,0,0,1,0,1,1,1,1});
param0.add(new int[]{2,2,2,4,6,7,8,10,15,17,19,20,21,27,28,29,32,32,40,44,46,47,49,50,50,52,55,56,58,59,64,69,73,74,74,77,80,80,84,89,91,95,96,96,97,98,98,99});
param0.add(new int[]{26,-86,8,64,-40,64,60,-16,54,-42,-86,14,-48,-20,-42,-4,-34,-52,-74,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,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{8,5,5,56,5,38});
List<Integer> param1 = new ArrayList<>();
param1.add(13);
param1.add(37);
param1.add(33);
param1.add(5);
param1.add(16);
param1.add(10);
param1.add(46);
param1.add(18);
param1.add(27);
param1.add(3);
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 = [
([7, 12, 16, 23, 26, 27, 39, 39, 40, 44, 57, 58, 77, 78, 81, 82, 84, 86, 91, 94, 94, 95, 97],13,),
([72, 38, -60, 98, -52, -38, -2, 94, 34, 56, 90, 46, 6, -2, 30, -96, -76, -96, -76, 32, 68, 64, -32, -4, 72, -62, 58, 20, -84, 0, -96, 70, -22, -56, 70, -74, -90, -86, -14, 82, -90, 40, -64, 94],37,),
([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],33,),
([69, 31, 85, 84, 28, 28],5,),
([-80, -74, -24, -22, -22, 4, 20, 28, 30, 32, 36, 58, 58, 68, 92, 94, 98],16,),
([1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1],10,),
([2, 2, 2, 4, 6, 7, 8, 10, 15, 17, 19, 20, 21, 27, 28, 29, 32, 32, 40, 44, 46, 47, 49, 50, 50, 52, 55, 56, 58, 59, 64, 69, 73, 74, 74, 77, 80, 80, 84, 89, 91, 95, 96, 96, 97, 98, 98, 99],46,),
([26, -86, 8, 64, -40, 64, 60, -16, 54, -42, -86, 14, -48, -20, -42, -4, -34, -52, -74, 22, 10],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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],27,),
([8, 5, 5, 56, 5, 38],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<vector<int>> param0 {{7,12,16,23,26,27,39,39,40,44,57,58,77,78,81,82,84,86,91,94,94,95,97},{72,38,-60,98,-52,-38,-2,94,34,56,90,46,6,-2,30,-96,-76,-96,-76,32,68,64,-32,-4,72,-62,58,20,-84,0,-96,70,-22,-56,70,-74,-90,-86,-14,82,-90,40,-64,94},{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},{69,31,85,84,28,28},{-80,-74,-24,-22,-22,4,20,28,30,32,36,58,58,68,92,94,98},{1,1,0,0,0,1,0,1,1,1,1},{2,2,2,4,6,7,8,10,15,17,19,20,21,27,28,29,32,32,40,44,46,47,49,50,50,52,55,56,58,59,64,69,73,74,74,77,80,80,84,89,91,95,96,96,97,98,98,99},{26,-86,8,64,-40,64,60,-16,54,-42,-86,14,-48,-20,-42,-4,-34,-52,-74,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,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{8,5,5,56,5,38}};
vector<int> param1 {13,37,33,5,16,10,46,18,27,3};
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;
} |
MAXIMUM_GAMES_PLAYED_WINNER |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MAXIMUM_GAMES_PLAYED_WINNER{
static int f_gold ( int N ) {
int [ ] dp = new int [ N ] ;
dp [ 0 ] = 1 ;
dp [ 1 ] = 2 ;
int i = 2 ;
do {
dp [ i ] = dp [ i - 1 ] + dp [ i - 2 ] ;
}
while ( dp [ i ++ ] <= N ) ;
return ( i - 2 ) ;
}
| def f_gold ( N ) :
dp = [ 0 for i in range ( N ) ]
dp [ 0 ] = 1
dp [ 1 ] = 2
i = 1
while dp [ i ] <= N :
i = i + 1
dp [ i ] = dp [ i - 1 ] + dp [ i - 2 ]
return ( i - 1 )
|
using namespace std;
int f_gold ( int N ) {
int dp [ N ];
dp [ 0 ] = 1;
dp [ 1 ] = 2;
int i = 2;
do {
dp [ i ] = dp [ i - 1 ] + dp [ i - 2 ];
}
while ( dp [ i ++ ] <= N );
return ( i - 2 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(73);
param0.add(28);
param0.add(33);
param0.add(23);
param0.add(84);
param0.add(31);
param0.add(48);
param0.add(46);
param0.add(45);
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 = [
(73,),
(28,),
(33,),
(23,),
(84,),
(31,),
(48,),
(46,),
(45,),
(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 {73,28,33,23,84,31,48,46,45,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;
} |
EFFICIENT_SEARCH_IN_AN_ARRAY_WHERE_DIFFERENCE_BETWEEN_ADJACENT_IS_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class EFFICIENT_SEARCH_IN_AN_ARRAY_WHERE_DIFFERENCE_BETWEEN_ADJACENT_IS_1{
static int f_gold ( int arr [ ] , int n , int x ) {
int i = 0 ;
while ( i <= n - 1 ) {
if ( arr [ i ] == x ) return i ;
i += Math . abs ( arr [ i ] - x ) ;
}
return - 1 ;
}
| def f_gold(arr, n, x):
i = 0
while (i <= n - 1):
if (arr[i] == x):
return i
i += abs(arr[i] - x)
return - 1
|
using namespace std;
int f_gold ( int arr [ ], int n, int x ) {
int i = 0;
while ( i <= n - 1 ) {
if ( arr [ i ] == x ) return i;
i += abs ( arr [ i ] - x );
}
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{5, 4, 5, 6, 5, 4, 3, 2});
param0.add(new int[]{5, 4, 5, 6, 5, 4, 3, 2});
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,1,1,1,1,1,1,1,1,1,1});
param0.add(new int[]{50,51,52,51,50,49,48});
param0.add(new int[]{-86,-68,-32,-6,6,10,30,34,58,92});
param0.add(new int[]{1,1,1,0,0,1,0,0,0,1,1,1,0,1,0,0,1,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,1,0,1,0,1,1,1,0,0});
param0.add(new int[]{58});
param0.add(new int[]{-64,78,58,36,48,80,-80,74,-98,46,-48,24,80,72,90,-46,14,68,38,58,-54,80,44,-62,34,-28,92,84,90,44,-26,88,18,22,-32,54,58,92});
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,1,1,1,1,1});
param0.add(new int[]{5});
List<Integer> param1 = new ArrayList<>();
param1.add(8);
param1.add(8);
param1.add(15);
param1.add(7);
param1.add(6);
param1.add(27);
param1.add(0);
param1.add(24);
param1.add(35);
param1.add(0);
List<Integer> param2 = new ArrayList<>();
param2.add(6);
param2.add(3);
param2.add(1);
param2.add(49);
param2.add(6);
param2.add(22);
param2.add(0);
param2.add(34);
param2.add(1);
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 = [
([5, 4, 5, 6, 5, 4, 3, 2], 29, 6,),
([5, 4, 5, 6, 5, 4, 3, 2], 19, 3,),
([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, 1,),
([50, 51, 52, 51, 50, 49, 48], 17, 49,),
([-86, -68, -32, -6, 6, 10, 30, 34, 58, 92], 6, 6,),
([1, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0], 27, 22,),
([58], 0, 0,),
([-64, 78, 58, 36, 48, 80, -80, 74, -98, 46, -48, 24, 80, 72, 90, -46, 14, 68, 38, 58, -
54, 80, 44, -62, 34, -28, 92, 84, 90, 44, -26, 88, 18, 22, -32, 54, 58, 92], 24, 34,),
([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], 35, 1,),
([5], 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 {
{5, 4, 5, 6, 5, 4, 3, 2},
{5, 4, 5, 6, 5, 4, 3, 2},
{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},
{50,51,52,51,50,49,48},
{-86,-68,-32,-6,6,10,30,34,58,92},
{1,1,1,0,0,1,0,0,0,1,1,1,0,1,0,0,1,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,1,0,1,0,1,1,1,0,0},
{58},
{-64,78,58,36,48,80,-80,74,-98,46,-48,24,80,72,90,-46,14,68,38,58,-54,80,44,-62,34,-28,92,84,90,44,-26,88,18,22,-32,54,58,92},
{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},
{5}};
vector<int> param1 {8,8,15,7,6,27,0,24,35,0};
vector<int> param2 {6,3,1,49,6,22,0,34,1,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;
} |
COUNT_SET_BITS_IN_AN_INTEGER_3 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_SET_BITS_IN_AN_INTEGER_3{
public static int f_gold ( int n ) {
if ( n == 0 ) return 0 ;
else return 1 + f_gold ( n & ( n - 1 ) ) ;
}
| def f_gold ( n ) :
if ( n == 0 ) :
return 0
else :
return 1 + f_gold ( n & ( n - 1 ) )
|
using namespace std;
int f_gold ( int n ) {
if ( n == 0 ) return 0;
else return 1 + f_gold ( n & ( n - 1 ) );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(6);
param0.add(58);
param0.add(90);
param0.add(69);
param0.add(15);
param0.add(54);
param0.add(60);
param0.add(51);
param0.add(46);
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 = [
(6,),
(58,),
(90,),
(69,),
(15,),
(54,),
(60,),
(51,),
(46,),
(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 {6,58,90,69,15,54,60,51,46,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_N_UNDER_MODULO_P |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COMPUTE_N_UNDER_MODULO_P{
static int f_gold ( int n , int p ) {
if ( n >= p ) return 0 ;
int result = 1 ;
for ( int i = 1 ;
i <= n ;
i ++ ) result = ( result * i ) % p ;
return result ;
}
| def f_gold ( n , p ) :
if n >= p :
return 0
result = 1
for i in range ( 1 , n + 1 ) :
result = ( result * i ) % p
return result
|
using namespace std;
int f_gold ( int n, int p ) {
if ( n >= p ) return 0;
int result = 1;
for ( int i = 1;
i <= n;
i ++ ) result = ( result * i ) % p;
return result;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(85);
param0.add(14);
param0.add(83);
param0.add(30);
param0.add(96);
param0.add(55);
param0.add(82);
param0.add(12);
param0.add(38);
param0.add(46);
List<Integer> param1 = new ArrayList<>();
param1.add(18);
param1.add(13);
param1.add(21);
param1.add(35);
param1.add(51);
param1.add(58);
param1.add(71);
param1.add(74);
param1.add(3);
param1.add(73);
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 = [
(85,18,),
(14,13,),
(83,21,),
(30,35,),
(96,51,),
(55,58,),
(82,71,),
(12,74,),
(38,3,),
(46,73,)
]
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 {85,14,83,30,96,55,82,12,38,46};
vector<int> param1 {18,13,21,35,51,58,71,74,3,73};
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_SUM_PRODUCT_TWO_ARRAYS |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class MINIMUM_SUM_PRODUCT_TWO_ARRAYS{
static int f_gold ( int a [ ] , int b [ ] , int n , int k ) {
int diff = 0 , res = 0 ;
int temp = 0 ;
for ( int i = 0 ;
i < n ;
i ++ ) {
int pro = a [ i ] * b [ i ] ;
res = res + pro ;
if ( pro < 0 && b [ i ] < 0 ) temp = ( a [ i ] + 2 * k ) * b [ i ] ;
else if ( pro < 0 && a [ i ] < 0 ) temp = ( a [ i ] - 2 * k ) * b [ i ] ;
else if ( pro > 0 && a [ i ] < 0 ) temp = ( a [ i ] + 2 * k ) * b [ i ] ;
else if ( pro > 0 && a [ i ] > 0 ) temp = ( a [ i ] - 2 * k ) * b [ i ] ;
int d = Math . abs ( pro - temp ) ;
if ( d > diff ) diff = d ;
}
return res - diff ;
}
| null |
using namespace std;
int f_gold ( int a [ ], int b [ ], int n, int k ) {
int diff = 0, res = 0;
int temp;
for ( int i = 0;
i < n;
i ++ ) {
int pro = a [ i ] * b [ i ];
res = res + pro;
if ( pro < 0 && b [ i ] < 0 ) temp = ( a [ i ] + 2 * k ) * b [ i ];
else if ( pro < 0 && a [ i ] < 0 ) temp = ( a [ i ] - 2 * k ) * b [ i ];
else if ( pro > 0 && a [ i ] < 0 ) temp = ( a [ i ] + 2 * k ) * b [ i ];
else if ( pro > 0 && a [ i ] > 0 ) temp = ( a [ i ] - 2 * k ) * b [ i ];
int d = abs ( pro - temp );
if ( d > diff ) diff = d;
}
return res - diff;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{8,9,9,16,19,21,24,26,26,27,31,33,36,44,46,47,69,71,72,74,74,74,74,76,76,77,89,91,91});
param0.add(new int[]{-64,-58,26,-42,-18,-52,26,-70,0,-68,38,-98,-14,-92,-74,-90,86,-76,-8,-80,-80,54,-26,-56,48,86,-60});
param0.add(new int[]{0,0,0,0,1,1,1,1});
param0.add(new int[]{62,73,67,96,95,31,58,13,63,13,29,97,7,36,13,54,67,8,9,36,6,29,92,7,82,5,27,65,80,20,22,1,11,67,23,31,86,27,53,87,39,99,69});
param0.add(new int[]{-86,-82,-42,-30,-12,-4,14,16,20,20,22,26,30,40,46,48,48,50,60,60,66,70,74,76,90,96,96,98});
param0.add(new int[]{1,1,1,0,1,0,0,1,1,1,1,1,0,1,1,0,1,1,1,0,0,0,1,0,1,1,1,1,1,0,0,1});
param0.add(new int[]{4,7,14,14,30,38,44,49,51,53,54,56,58,62,67,76,86,86,88,91,95});
param0.add(new int[]{2,90,-92,58,56,94,12,-2,86,-70,46,-80,42,-6,72,-52,4,96,-42,50,-28,42,8,26,46,70,-2,-24,-36,50,26,70,74,-52,34,-88,-66,74,52,62,-24,-80,40,42,90});
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,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[]{61,96,7,59,86,74,7,95,13,52,18,77,25,97,74,18});
List<int [ ]> param1 = new ArrayList<>();
param1.add(new int[]{1,8,10,10,12,16,17,19,20,20,23,33,37,38,58,66,69,70,70,76,79,80,83,84,84,86,87,87,93});
param1.add(new int[]{90,-2,-8,12,-58,46,-54,-40,-10,-76,-62,66,42,-66,4,-6,50,8,-18,92,-42,30,-34,74,-86,-56,52});
param1.add(new int[]{0,0,0,0,0,1,1,1});
param1.add(new int[]{88,64,94,64,4,23,6,85,92,68,78,53,96,88,69,28,12,34,92,67,39,68,72,64,10,14,26,61,96,1,79,87,45,9,16,70,63,84,79,63,11,85,46});
param1.add(new int[]{-98,-78,-68,-68,-64,-40,-38,-38,-26,-12,-6,0,2,8,18,34,52,58,64,64,70,72,76,82,84,90,96,96});
param1.add(new int[]{1,0,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,0,1,1,0,0,0});
param1.add(new int[]{2,2,7,19,20,21,22,26,42,45,46,46,59,63,63,72,73,74,77,83,89});
param1.add(new int[]{98,62,-52,-92,-14,-92,62,86,20,36,-80,-12,-38,70,-28,-28,42,-10,94,-16,-72,-96,76,-14,-18,-12,38,14,46,16,-90,10,-34,-6,-34,-62,96,14,0,-10,32,-6,96,-72,-2});
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,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 int[]{56,38,75,57,82,30,38,79,39,73,74,73,36,10,80,50});
List<Integer> param2 = new ArrayList<>();
param2.add(20);
param2.add(20);
param2.add(7);
param2.add(23);
param2.add(14);
param2.add(20);
param2.add(11);
param2.add(25);
param2.add(46);
param2.add(13);
List<Integer> param3 = new ArrayList<>();
param3.add(28);
param3.add(16);
param3.add(5);
param3.add(23);
param3.add(14);
param3.add(16);
param3.add(17);
param3.add(25);
param3.add(33);
param3.add(12);
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());
}
} | null |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{8,9,9,16,19,21,24,26,26,27,31,33,36,44,46,47,69,71,72,74,74,74,74,76,76,77,89,91,91},{-64,-58,26,-42,-18,-52,26,-70,0,-68,38,-98,-14,-92,-74,-90,86,-76,-8,-80,-80,54,-26,-56,48,86,-60},{0,0,0,0,1,1,1,1},{62,73,67,96,95,31,58,13,63,13,29,97,7,36,13,54,67,8,9,36,6,29,92,7,82,5,27,65,80,20,22,1,11,67,23,31,86,27,53,87,39,99,69},{-86,-82,-42,-30,-12,-4,14,16,20,20,22,26,30,40,46,48,48,50,60,60,66,70,74,76,90,96,96,98},{1,1,1,0,1,0,0,1,1,1,1,1,0,1,1,0,1,1,1,0,0,0,1,0,1,1,1,1,1,0,0,1},{4,7,14,14,30,38,44,49,51,53,54,56,58,62,67,76,86,86,88,91,95},{2,90,-92,58,56,94,12,-2,86,-70,46,-80,42,-6,72,-52,4,96,-42,50,-28,42,8,26,46,70,-2,-24,-36,50,26,70,74,-52,34,-88,-66,74,52,62,-24,-80,40,42,90},{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,1,1},{61,96,7,59,86,74,7,95,13,52,18,77,25,97,74,18}};
vector<vector<int>> param1 {{1,8,10,10,12,16,17,19,20,20,23,33,37,38,58,66,69,70,70,76,79,80,83,84,84,86,87,87,93},{90,-2,-8,12,-58,46,-54,-40,-10,-76,-62,66,42,-66,4,-6,50,8,-18,92,-42,30,-34,74,-86,-56,52},{0,0,0,0,0,1,1,1},{88,64,94,64,4,23,6,85,92,68,78,53,96,88,69,28,12,34,92,67,39,68,72,64,10,14,26,61,96,1,79,87,45,9,16,70,63,84,79,63,11,85,46},{-98,-78,-68,-68,-64,-40,-38,-38,-26,-12,-6,0,2,8,18,34,52,58,64,64,70,72,76,82,84,90,96,96},{1,0,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,1,0,0,1,0,1,1,0,0,0},{2,2,7,19,20,21,22,26,42,45,46,46,59,63,63,72,73,74,77,83,89},{98,62,-52,-92,-14,-92,62,86,20,36,-80,-12,-38,70,-28,-28,42,-10,94,-16,-72,-96,76,-14,-18,-12,38,14,46,16,-90,10,-34,-6,-34,-62,96,14,0,-10,32,-6,96,-72,-2},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{56,38,75,57,82,30,38,79,39,73,74,73,36,10,80,50}};
vector<int> param2 {20,20,7,23,14,20,11,25,46,13};
vector<int> param3 {28,16,5,23,14,16,17,25,33,12};
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;
} |
COUNT_FACTORIAL_NUMBERS_IN_A_GIVEN_RANGE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_FACTORIAL_NUMBERS_IN_A_GIVEN_RANGE{
static int f_gold ( int low , int high ) {
int fact = 1 , x = 1 ;
while ( fact < low ) {
fact = fact * x ;
x ++ ;
}
int res = 0 ;
while ( fact <= high ) {
res ++ ;
fact = fact * x ;
x ++ ;
}
return res ;
}
| def f_gold ( low , high ) :
fact = 1
x = 1
while ( fact < low ) :
fact = fact * x
x += 1
res = 0
while ( fact <= high ) :
res += 1
fact = fact * x
x += 1
return res
|
using namespace std;
int f_gold ( int low, int high ) {
int fact = 1, x = 1;
while ( fact < low ) {
fact = fact * x;
x ++;
}
int res = 0;
while ( fact <= high ) {
res ++;
fact = fact * x;
x ++;
}
return res;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(57);
param0.add(57);
param0.add(31);
param0.add(62);
param0.add(49);
param0.add(82);
param0.add(31);
param0.add(5);
param0.add(76);
param0.add(55);
List<Integer> param1 = new ArrayList<>();
param1.add(79);
param1.add(21);
param1.add(37);
param1.add(87);
param1.add(98);
param1.add(76);
param1.add(45);
param1.add(52);
param1.add(43);
param1.add(6);
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 = [
(57,79,),
(57,21,),
(31,37,),
(62,87,),
(49,98,),
(82,76,),
(31,45,),
(5,52,),
(76,43,),
(55,6,)
]
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,57,31,62,49,82,31,5,76,55};
vector<int> param1 {79,21,37,87,98,76,45,52,43,6};
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;
} |
FIND_THE_ELEMENT_THAT_APPEARS_ONCE |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_THE_ELEMENT_THAT_APPEARS_ONCE{
static int f_gold ( int arr [ ] , int n ) {
int ones = 0 , twos = 0 ;
int common_bit_mask ;
for ( int i = 0 ;
i < n ;
i ++ ) {
twos = twos | ( ones & arr [ i ] ) ;
ones = ones ^ arr [ i ] ;
common_bit_mask = ~ ( ones & twos ) ;
ones &= common_bit_mask ;
twos &= common_bit_mask ;
}
return ones ;
}
| def f_gold ( arr , n ) :
ones = 0
twos = 0
for i in range ( n ) :
twos = twos | ( ones & arr [ i ] )
ones = ones ^ arr [ i ]
common_bit_mask = ~ ( ones & twos )
ones &= common_bit_mask
twos &= common_bit_mask
return ones
|
using namespace std;
int f_gold ( int arr [ ], int n ) {
int ones = 0, twos = 0;
int common_bit_mask;
for ( int i = 0;
i < n;
i ++ ) {
twos = twos | ( ones & arr [ i ] );
ones = ones ^ arr [ i ];
common_bit_mask = ~ ( ones & twos );
ones &= common_bit_mask;
twos &= common_bit_mask;
}
return ones;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{7,26,26,48,59,62,66,70,72,75,76,81,97,98});
param0.add(new int[]{-42,-48,-64,-74,56,-34,20,16,34,-84,86,38,56,-86,30,-74,-96,96,12,10,-46,10,-36,38,34,-46,-20,14,12,62,-54,20,-82,24,96});
param0.add(new int[]{0,0,1,1});
param0.add(new int[]{68,91,61,6,32,47,76,69,44,71,29,79,74,33,44,33,45,75,43,82,83,81,95,16,86,33,69,61,73,21,54,17,98,62,14,72,80,31,56,82,14,48,76});
param0.add(new int[]{-98,-96,-92,-62,-52,-42,-42,-26,4,10,14,38,64,66,72,74,82});
param0.add(new int[]{0,1,1,1,0,0,0,1,0,1});
param0.add(new int[]{53,63,63});
param0.add(new int[]{-96,-38,-26,-46,68,-36,20,-18,-10,52,40,94,-8,-64,82,-22});
param0.add(new int[]{0,0,0,0,0,1,1});
param0.add(new int[]{99,46,48,81,27,97,26,50,77,32,45,99,46});
List<Integer> param1 = new ArrayList<>();
param1.add(7);
param1.add(27);
param1.add(3);
param1.add(38);
param1.add(14);
param1.add(5);
param1.add(2);
param1.add(15);
param1.add(3);
param1.add(12);
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 = [
([7, 26, 26, 48, 59, 62, 66, 70, 72, 75, 76, 81, 97, 98],7,),
([-42, -48, -64, -74, 56, -34, 20, 16, 34, -84, 86, 38, 56, -86, 30, -74, -96, 96, 12, 10, -46, 10, -36, 38, 34, -46, -20, 14, 12, 62, -54, 20, -82, 24, 96],27,),
([0, 0, 1, 1],3,),
([68, 91, 61, 6, 32, 47, 76, 69, 44, 71, 29, 79, 74, 33, 44, 33, 45, 75, 43, 82, 83, 81, 95, 16, 86, 33, 69, 61, 73, 21, 54, 17, 98, 62, 14, 72, 80, 31, 56, 82, 14, 48, 76],38,),
([-98, -96, -92, -62, -52, -42, -42, -26, 4, 10, 14, 38, 64, 66, 72, 74, 82],14,),
([0, 1, 1, 1, 0, 0, 0, 1, 0, 1],5,),
([53, 63, 63],2,),
([-96, -38, -26, -46, 68, -36, 20, -18, -10, 52, 40, 94, -8, -64, 82, -22],15,),
([0, 0, 0, 0, 0, 1, 1],3,),
([99, 46, 48, 81, 27, 97, 26, 50, 77, 32, 45, 99, 46],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 {{7,26,26,48,59,62,66,70,72,75,76,81,97,98},{-42,-48,-64,-74,56,-34,20,16,34,-84,86,38,56,-86,30,-74,-96,96,12,10,-46,10,-36,38,34,-46,-20,14,12,62,-54,20,-82,24,96},{0,0,1,1},{68,91,61,6,32,47,76,69,44,71,29,79,74,33,44,33,45,75,43,82,83,81,95,16,86,33,69,61,73,21,54,17,98,62,14,72,80,31,56,82,14,48,76},{-98,-96,-92,-62,-52,-42,-42,-26,4,10,14,38,64,66,72,74,82},{0,1,1,1,0,0,0,1,0,1},{53,63,63},{-96,-38,-26,-46,68,-36,20,-18,-10,52,40,94,-8,-64,82,-22},{0,0,0,0,0,1,1},{99,46,48,81,27,97,26,50,77,32,45,99,46}};
vector<int> param1 {7,27,3,38,14,5,2,15,3,12};
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;
} |
PAINTING_FENCE_ALGORITHM |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PAINTING_FENCE_ALGORITHM{
static long f_gold ( int n , int k ) {
long total = k ;
int mod = 1000000007 ;
int same = 0 , diff = k ;
for ( int i = 2 ;
i <= n ;
i ++ ) {
same = diff ;
diff = ( int ) total * ( k - 1 ) ;
diff = diff % mod ;
total = ( same + diff ) % mod ;
}
return total ;
}
| def f_gold ( n , k ) :
total = k
mod = 1000000007
same , diff = 0 , k
for i in range ( 2 , n + 1 ) :
same = diff
diff = total * ( k - 1 )
diff = diff % mod
total = ( same + diff ) % mod
return total
|
using namespace std;
long f_gold ( int n, int k ) {
long total = k;
int mod = 1000000007;
int same = 0, diff = k;
for ( int i = 2;
i <= n;
i ++ ) {
same = diff;
diff = total * ( k - 1 );
diff = diff % mod;
total = ( same + diff ) % mod;
}
return total;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(6);
param0.add(23);
param0.add(89);
param0.add(63);
param0.add(23);
param0.add(44);
param0.add(81);
param0.add(43);
param0.add(9);
param0.add(41);
List<Integer> param1 = new ArrayList<>();
param1.add(30);
param1.add(87);
param1.add(31);
param1.add(36);
param1.add(68);
param1.add(66);
param1.add(18);
param1.add(73);
param1.add(42);
param1.add(98);
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,30,),
(23,87,),
(89,31,),
(63,36,),
(23,68,),
(44,66,),
(81,18,),
(43,73,),
(9,42,),
(41,98,)
]
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 {6,23,89,63,23,44,81,43,9,41};
vector<int> param1 {30,87,31,36,68,66,18,73,42,98};
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_POSSIBLE_PATHS_TOP_LEFT_BOTTOM_RIGHT_NXM_MATRIX_2 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_POSSIBLE_PATHS_TOP_LEFT_BOTTOM_RIGHT_NXM_MATRIX_2{
static int f_gold ( int m , int n ) {
int [ ] dp = new int [ n ] ;
dp [ 0 ] = 1 ;
for ( int i = 0 ;
i < m ;
i ++ ) {
for ( int j = 1 ;
j < n ;
j ++ ) {
dp [ j ] += dp [ j - 1 ] ;
}
}
return dp [ n - 1 ] ;
}
| def f_gold ( p , q ) :
dp = [ 1 for i in range ( q ) ]
for i in range ( p - 1 ) :
for j in range ( 1 , q ) :
dp [ j ] += dp [ j - 1 ]
return dp [ q - 1 ]
|
using namespace std;
int f_gold ( int m, int n ) {
int dp [ n ] = {
1 };
dp [ 0 ] = 1;
for ( int i = 0;
i < m;
i ++ ) {
for ( int j = 1;
j < n;
j ++ ) {
dp [ j ] += dp [ j - 1 ];
}
}
return dp [ n - 1 ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(73);
param0.add(70);
param0.add(53);
param0.add(80);
param0.add(9);
param0.add(38);
param0.add(41);
param0.add(80);
param0.add(42);
param0.add(54);
List<Integer> param1 = new ArrayList<>();
param1.add(75);
param1.add(5);
param1.add(62);
param1.add(70);
param1.add(59);
param1.add(48);
param1.add(49);
param1.add(72);
param1.add(52);
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 = [
(73,75,),
(70,5,),
(53,62,),
(80,70,),
(9,59,),
(38,48,),
(41,49,),
(80,72,),
(42,52,),
(54,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<int> param0 {73,70,53,80,9,38,41,80,42,54};
vector<int> param1 {75,5,62,70,59,48,49,72,52,1};
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;
} |
FIND_A_FIXED_POINT_IN_A_GIVEN_ARRAY_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class FIND_A_FIXED_POINT_IN_A_GIVEN_ARRAY_1{
static int f_gold ( int arr [ ] , int low , int high ) {
if ( high >= low ) {
int mid = ( low + high ) / 2 ;
if ( mid == arr [ mid ] ) return mid ;
if ( mid > arr [ mid ] ) return f_gold ( arr , ( mid + 1 ) , high ) ;
else return f_gold ( arr , low , ( mid - 1 ) ) ;
}
return - 1 ;
}
| null |
using namespace std;
int f_gold ( int arr [ ], int low, int high ) {
if ( high >= low ) {
int mid = ( low + high ) / 2;
if ( mid == arr [ mid ] ) return mid;
if ( mid > arr [ mid ] ) return f_gold ( arr, ( mid + 1 ), high );
else return f_gold ( arr, low, ( mid - 1 ) );
}
return - 1;
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{13,20,20,27,32,35,37,51,63,64,71,75,77,80,82,82,86,90,90,92,95,97,98});
param0.add(new int[]{-10, -5, 0, 3, 7});
param0.add(new int[]{0, 2, 5, 8, 17});
param0.add(new int[]{-10, -5, 3, 4, 7, 9});
param0.add(new int[]{-10, -5, 2, 4, 7, 9});
param0.add(new int[]{1,1,0,1,1,0,1,0,0});
param0.add(new int[]{1,4,16,16,19,28,34,34,35,36,37,46,49,52,54,60,60,60,63,70,75,77,80,81,81,84,85,87,93,99});
param0.add(new int[]{30,30,-94,-10,2,58});
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,1});
param0.add(new int[]{72,38,91,63,30,67,39,29,96,42});
List<Integer> param1 = new ArrayList<>();
param1.add(0);
param1.add(0);
param1.add(0);
param1.add(1);
param1.add(2);
param1.add(0);
param1.add(0);
param1.add(0);
param1.add(0);
param1.add(0);
List<Integer> param2 = new ArrayList<>();
param2.add(16);
param2.add(4);
param2.add(4);
param2.add(5);
param2.add(5);
param2.add(7);
param2.add(5);
param2.add(5);
param2.add(12);
param2.add(7);
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 |
int main() {
int n_success = 0;
vector<vector<int>> param0 {{13,20,20,27,32,35,37,51,63,64,71,75,77,80,82,82,86,90,90,92,95,97,98},
{-10, -5, 0, 3, 7},
{0, 2, 5, 8, 17},
{-10, -5, 3, 4, 7, 9},
{-10, -5, 2, 4, 7, 9},
{1,1,0,1,1,0,1,0,0},
{1,4,16,16,19,28,34,34,35,36,37,46,49,52,54,60,60,60,63,70,75,77,80,81,81,84,85,87,93,99},
{30,30,-94,-10,2,58},
{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},
{72,38,91,63,30,67,39,29,96,42}};
vector<int> param1 {0,0,0,1,2,0,0,0,0,0};
vector<int> param2 {16,4,4,5,5,7,5,5,12,7};
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;
} |
SUM_MATRIX_ELEMENT_ELEMENT_INTEGER_DIVISION_ROW_COLUMN |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class SUM_MATRIX_ELEMENT_ELEMENT_INTEGER_DIVISION_ROW_COLUMN{
static int f_gold ( int n ) {
int ans = 0 ;
for ( int i = 1 ;
i <= n ;
i ++ ) for ( int j = 1 ;
j <= n ;
j ++ ) ans += ( i / j ) ;
return ans ;
}
| def f_gold ( N ) :
ans = 0
for i in range ( 1 , N + 1 ) :
for j in range ( 1 , N + 1 ) :
ans += i // j
return ans
|
using namespace std;
int f_gold ( int n ) {
int ans = 0;
for ( int i = 1;
i <= n;
i ++ ) for ( int j = 1;
j <= n;
j ++ ) ans += ( i / j );
return ans;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(60);
param0.add(74);
param0.add(8);
param0.add(74);
param0.add(34);
param0.add(66);
param0.add(96);
param0.add(11);
param0.add(45);
param0.add(72);
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 = [
(60,),
(74,),
(8,),
(74,),
(34,),
(66,),
(96,),
(11,),
(45,),
(72,)
]
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 {60,74,8,74,34,66,96,11,45,72};
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;
} |
DOUBLE_FACTORIAL |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DOUBLE_FACTORIAL{
static long f_gold ( long n ) {
if ( n == 0 || n == 1 ) return 1 ;
return n * f_gold ( n - 2 ) ;
}
| def f_gold ( n ) :
if ( n == 0 or n == 1 ) :
return 1 ;
return n * f_gold ( n - 2 ) ;
|
using namespace std;
unsigned int f_gold ( unsigned int n ) {
if ( n == 0 || n == 1 ) return 1;
return n * f_gold ( n - 2 );
}
|
public static void main(String args[]) {
int n_success = 0;
List<Long> param0 = new ArrayList<>();
param0.add(52L);
param0.add(93L);
param0.add(15L);
param0.add(72L);
param0.add(61L);
param0.add(21L);
param0.add(83L);
param0.add(87L);
param0.add(75L);
param0.add(75L);
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 = [
(52,),
(93,),
(15,),
(72,),
(61,),
(21,),
(83,),
(87,),
(75,),
(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<long> param0 {52,93,15,72,61,21,83,87,75,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;
} |
COUNT_NUMBER_WAYS_TILE_FLOOR_SIZE_N_X_M_USING_1_X_M_SIZE_TILES |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class COUNT_NUMBER_WAYS_TILE_FLOOR_SIZE_N_X_M_USING_1_X_M_SIZE_TILES{
static int f_gold ( int n , int m ) {
int count [ ] = new int [ n + 1 ] ;
count [ 0 ] = 0 ;
int i ;
for ( i = 1 ;
i <= n ;
i ++ ) {
if ( i > m ) count [ i ] = count [ i - 1 ] + count [ i - m ] ;
else if ( i < m ) count [ i ] = 1 ;
else count [ i ] = 2 ;
}
return count [ n ] ;
}
| def f_gold ( n , m ) :
count = [ ]
for i in range ( n + 2 ) :
count.append ( 0 )
count [ 0 ] = 0
for i in range ( 1 , n + 1 ) :
if ( i > m ) :
count [ i ] = count [ i - 1 ] + count [ i - m ]
elif ( i < m ) :
count [ i ] = 1
else :
count [ i ] = 2
return count [ n ]
|
using namespace std;
int f_gold ( int n, int m ) {
int count [ n + 1 ];
count [ 0 ] = 0;
for ( int i = 1;
i <= n;
i ++ ) {
if ( i > m ) count [ i ] = count [ i - 1 ] + count [ i - m ];
else if ( i < m ) count [ i ] = 1;
else count [ i ] = 2;
}
return count [ n ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<Integer> param0 = new ArrayList<>();
param0.add(93);
param0.add(17);
param0.add(38);
param0.add(33);
param0.add(78);
param0.add(40);
param0.add(95);
param0.add(12);
param0.add(69);
param0.add(78);
List<Integer> param1 = new ArrayList<>();
param1.add(54);
param1.add(4);
param1.add(39);
param1.add(64);
param1.add(35);
param1.add(61);
param1.add(6);
param1.add(8);
param1.add(60);
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 = [
(93,54,),
(17,4,),
(38,39,),
(33,64,),
(78,35,),
(40,61,),
(95,6,),
(12,8,),
(69,60,),
(78,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<int> param0 {93,17,38,33,78,40,95,12,69,78};
vector<int> param1 {54,4,39,64,35,61,6,8,60,21};
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_PRINT_IDENTITY_MATRIX_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_PRINT_IDENTITY_MATRIX_1{
static boolean f_gold ( int mat [ ] [ ] , int N ) {
for ( int row = 0 ;
row < N ;
row ++ ) {
for ( int col = 0 ;
col < N ;
col ++ ) {
if ( row == col && mat [ row ] [ col ] != 1 ) return false ;
else if ( row != col && mat [ row ] [ col ] != 0 ) return false ;
}
}
return true ;
}
| def f_gold ( mat , N ) :
for row in range ( N ) :
for col in range ( N ) :
if ( row == col and mat [ row ] [ col ] != 1 ) :
return False ;
elif ( row != col and mat [ row ] [ col ] != 0 ) :
return False ;
return True ;
| null |
public static void main(String args[]) {
int n_success = 0;
List<int [ ] [ ]> param0 = new ArrayList<>();
param0.add(new int[][]{new int[]{}});
param0.add(new int[][]{new int[]{1}});
param0.add(new int[][]{new int[]{1,0,0,0},new int[]{0,1,0,0},new int[]{0,0,1,0},new int[]{0,0,0,1}});
param0.add(new int[][]{new int[]{1,0,0,0},new int[]{0,1,0,0},new int[]{0,0,1,0},new int[]{1,0,0,1}});
param0.add(new int[][]{new int[]{80,68,67,24,55,89,15,35,7,28,36,65,76,4,97,99,82,21,14,55,66,43,28,81,94,23,43,97,74},new int[]{94,39,98,29,57,15,49,96,28,97,8,4,39,58,71,76,88,85,9,89,93,64,44,64,41,47,26,70,75},new int[]{47,8,15,88,50,27,9,88,95,51,96,43,14,14,38,63,40,60,41,80,13,74,29,26,52,95,86,39,66},new int[]{40,65,70,92,28,99,1,80,18,13,45,88,67,16,75,91,37,2,80,33,64,4,59,6,11,11,25,39,7},new int[]{43,70,31,99,4,1,98,30,76,89,2,14,6,28,56,19,30,87,98,75,37,39,1,84,29,92,71,67,54},new int[]{18,97,8,12,59,68,25,40,24,82,22,43,73,59,17,92,67,90,14,95,8,41,3,7,69,59,15,63,88},new int[]{32,57,74,7,87,61,83,38,83,68,1,89,92,76,94,21,25,27,62,29,21,88,14,59,20,77,7,35,5},new int[]{22,72,82,3,58,73,55,65,23,83,65,96,63,16,92,63,60,76,91,58,7,65,3,61,13,12,6,88,83},new int[]{15,52,62,34,57,88,56,16,25,23,50,90,57,94,56,62,33,20,71,66,7,10,88,35,47,42,61,9,1},new int[]{85,33,29,35,54,26,37,63,35,16,22,97,68,22,14,70,84,89,93,85,54,15,15,77,15,80,81,60,64},new int[]{4,62,17,84,89,79,9,58,43,16,10,32,36,93,76,7,44,93,12,19,25,34,80,53,65,69,9,71,56},new int[]{65,37,85,44,43,68,55,69,55,52,47,38,41,37,32,24,35,59,46,41,48,51,87,64,75,71,94,17,60},new int[]{50,6,95,63,14,78,8,83,46,7,32,90,3,25,88,78,11,34,57,10,18,33,75,14,68,6,98,12,36},new int[]{11,73,12,20,89,5,78,56,3,36,98,63,11,88,4,9,87,20,62,87,23,3,54,51,99,10,30,34,33},new int[]{79,23,94,80,42,32,29,28,18,35,74,94,89,52,11,74,5,15,78,99,38,94,95,89,92,79,74,13,24},new int[]{74,87,21,34,25,60,49,92,29,88,22,65,27,24,89,32,90,42,67,24,71,47,79,12,73,42,2,80,13},new int[]{79,84,54,87,94,43,62,11,48,36,26,22,27,31,14,87,30,23,6,43,64,76,68,2,33,14,13,63,4},new int[]{77,96,66,22,59,32,40,81,24,58,39,63,53,3,68,37,29,11,50,38,74,64,70,5,75,46,47,15,75},new int[]{5,87,49,47,42,18,34,58,72,65,68,73,17,74,93,85,97,97,93,36,97,70,49,84,24,73,21,36,92},new int[]{97,58,52,86,90,71,1,92,71,85,32,71,27,68,71,96,57,62,81,98,25,89,13,84,59,91,83,92,43},new int[]{74,54,73,63,20,19,13,22,96,46,80,60,68,40,12,34,43,41,57,49,24,69,54,29,20,65,13,50,54},new int[]{93,26,9,10,61,46,49,40,3,93,22,24,99,19,77,92,10,27,28,5,8,4,56,9,52,76,89,28,82},new int[]{73,33,56,17,7,59,85,95,64,16,40,86,27,59,65,49,55,27,35,93,97,27,73,14,78,33,27,84,5},new int[]{37,93,55,95,95,70,37,78,49,62,65,26,85,16,70,36,39,59,33,24,62,53,80,30,91,28,44,92,12},new int[]{45,91,17,24,74,67,90,86,68,26,55,20,65,9,51,69,74,76,3,90,3,64,81,81,89,73,60,76,21},new int[]{4,53,19,1,88,95,30,83,85,76,74,29,59,52,92,46,74,93,67,96,46,88,45,87,56,28,49,57,96},new int[]{10,41,45,41,2,48,49,20,48,21,60,57,10,69,47,91,34,23,5,89,61,36,51,19,59,23,96,90,94},new int[]{16,12,62,79,4,78,25,56,40,44,66,42,75,95,91,17,78,79,41,79,17,7,99,81,47,36,67,74,68},new int[]{78,88,92,77,75,10,5,97,22,77,70,97,86,14,3,6,39,95,21,38,33,68,52,24,22,38,37,98,46}});
param0.add(new int[][]{new int[]{54,16,12,57,31,31,71,17,46},new int[]{74,81,65,60,4,64,19,31,18},new int[]{42,3,51,46,58,13,72,29,69},new int[]{6,81,28,72,32,8,11,14,16},new int[]{9,2,29,22,52,42,78,46,15},new int[]{70,89,42,58,72,9,21,23,34},new int[]{37,33,35,32,96,38,69,53,18},new int[]{35,19,88,73,2,67,92,61,29},new int[]{49,40,86,14,67,89,37,66,29}});
param0.add(new int[][]{new int[]{6,45,61,50,95,16,88,4,77,57,23,14,58,9,94,61,56,58,52,22,3,88,34,16,75,37,40,45,19,5,38,43,25,90,33,54,45,58,91,26,72,59,90,58},new int[]{57,23,46,56,38,75,35,81,92,15,69,75,73,74,2,25,82,15,3,66,55,50,78,42,27,20,59,82,84,99,77,60,29,87,2,93,4,73,58,75,24,91,34,60},new int[]{48,16,15,20,93,77,91,76,26,29,82,81,6,17,65,78,72,13,17,21,70,68,27,5,86,42,29,93,22,85,83,47,34,71,20,66,38,51,11,98,69,33,11,61},new int[]{52,98,3,21,45,88,95,71,96,74,5,34,29,25,22,4,45,34,27,34,25,6,20,64,95,6,38,70,47,12,16,31,36,69,52,3,42,99,39,51,4,83,43,89},new int[]{82,5,49,81,7,20,64,69,5,76,7,66,34,32,73,21,39,84,11,79,12,75,41,22,9,55,83,58,20,91,23,55,14,41,90,34,28,82,71,31,75,97,13,70},new int[]{14,38,99,57,37,89,94,35,32,3,8,80,7,36,13,14,62,18,9,65,10,62,18,23,79,18,19,27,85,5,24,89,4,18,79,55,50,53,93,98,47,79,11,44},new int[]{36,45,81,66,95,20,70,67,48,14,53,71,38,92,33,65,19,93,70,82,49,39,20,99,49,26,62,14,51,43,50,67,79,71,1,79,44,88,77,29,16,17,79,37},new int[]{47,63,92,95,43,92,58,38,70,7,33,6,22,24,57,14,16,99,86,58,7,60,18,86,66,12,99,35,62,84,16,64,7,64,37,26,89,95,46,22,82,41,63,81},new int[]{44,45,67,38,12,94,31,12,24,7,81,14,25,88,7,44,78,20,67,49,64,52,5,3,79,95,29,50,30,76,57,35,11,10,73,35,62,92,19,47,61,2,21,18},new int[]{26,32,78,90,56,43,74,23,88,4,86,76,75,51,45,76,49,47,27,34,53,44,52,31,79,34,51,75,38,20,58,29,11,42,82,67,83,48,32,6,89,88,36,2},new int[]{75,60,53,13,83,51,2,9,67,24,12,85,4,11,94,3,51,30,7,13,47,80,21,11,52,13,31,99,10,60,53,8,4,86,74,41,98,64,11,4,48,55,58,8},new int[]{2,30,97,44,20,75,85,39,34,37,66,61,85,96,26,13,78,59,37,25,20,50,21,90,39,22,51,9,49,2,83,89,98,11,32,91,57,83,80,23,48,62,14,20},new int[]{43,87,42,65,98,57,25,16,20,23,86,8,47,82,85,56,95,80,72,83,35,17,35,51,7,64,49,87,99,37,25,55,86,58,82,59,73,4,97,76,70,36,39,51},new int[]{38,79,75,87,98,4,60,71,43,12,30,59,89,91,67,85,59,74,94,10,36,88,59,15,90,20,62,67,7,65,48,85,72,42,24,33,85,37,70,8,91,33,60,36},new int[]{65,64,13,60,62,41,27,90,90,72,40,55,83,31,54,47,1,86,27,93,91,95,44,56,6,72,93,67,17,24,19,52,46,25,58,37,42,71,62,96,38,4,80,44},new int[]{25,70,58,20,57,12,57,29,95,36,54,63,48,92,43,87,72,58,39,85,42,53,1,7,1,56,52,4,47,50,12,4,57,9,54,72,6,50,67,1,20,88,70,59},new int[]{9,39,54,75,64,97,52,37,52,22,14,87,16,69,20,85,45,43,96,14,14,12,35,79,23,85,23,27,82,1,63,1,69,26,82,14,95,30,13,87,95,73,52,18},new int[]{6,50,3,2,89,32,77,57,75,12,49,25,53,14,23,77,32,40,48,25,66,28,42,86,68,80,88,40,85,24,41,64,77,8,8,72,51,86,72,58,36,95,74,34},new int[]{70,93,46,18,15,36,4,3,8,86,82,87,44,93,54,95,26,25,59,81,58,14,15,60,98,87,24,59,43,3,91,91,42,37,4,88,2,96,49,93,60,87,58,23},new int[]{60,63,45,25,49,83,69,50,69,72,72,60,68,66,46,20,32,31,47,72,54,64,18,96,24,99,73,31,97,28,81,36,35,87,64,97,56,11,15,58,5,99,20,91},new int[]{48,71,80,56,84,33,73,39,19,51,80,90,54,22,50,30,41,22,74,29,74,16,26,75,89,31,32,73,64,89,37,87,51,20,59,41,18,23,54,53,79,87,69,72},new int[]{37,2,19,48,66,62,73,81,90,78,3,66,10,49,32,44,67,24,28,63,79,25,89,59,63,55,22,92,22,9,37,36,48,88,47,92,83,44,38,60,87,67,85,10},new int[]{67,95,54,94,33,72,62,96,67,16,87,35,54,38,79,59,53,57,96,51,52,78,72,22,80,86,53,38,47,72,95,22,72,10,53,95,49,22,13,12,29,50,36,60},new int[]{91,79,47,95,10,98,88,93,69,89,80,90,55,17,76,40,46,42,41,56,62,40,19,87,95,46,37,61,33,96,85,83,60,37,73,55,70,56,27,42,50,32,86,97},new int[]{65,30,27,47,8,3,73,16,19,68,38,37,90,62,83,12,15,34,29,26,48,90,64,28,61,17,86,10,81,92,23,75,16,97,76,89,61,4,54,92,70,91,67,92},new int[]{68,8,75,73,41,37,79,63,2,96,29,18,80,66,63,88,95,13,31,83,51,56,39,69,79,9,1,84,86,66,74,27,10,35,40,96,41,42,18,95,54,74,11,71},new int[]{64,45,42,50,83,34,54,55,99,11,74,78,20,29,47,41,68,12,8,14,42,63,98,55,36,20,79,75,30,57,17,75,33,39,39,4,15,39,48,32,61,13,4,5},new int[]{34,40,40,57,3,45,81,4,34,43,63,51,55,65,91,29,59,9,23,90,79,80,82,24,91,31,45,76,32,91,81,59,69,92,98,54,48,48,9,54,51,52,46,72},new int[]{14,30,64,76,37,19,73,70,80,21,32,65,6,82,82,63,9,84,83,18,18,72,18,34,3,69,3,40,27,4,20,6,59,41,64,5,49,1,4,48,51,3,73,98},new int[]{78,67,32,90,78,32,16,15,20,39,75,80,20,67,4,6,6,45,48,97,13,39,50,4,62,92,78,12,88,89,27,69,17,59,27,79,36,66,14,81,32,68,46,77},new int[]{25,26,66,77,45,94,29,69,7,55,43,41,14,68,98,98,75,81,91,93,58,36,75,16,52,95,41,76,6,2,12,50,66,7,63,24,96,36,12,47,58,86,20,8},new int[]{43,30,21,45,62,76,21,12,5,98,24,39,66,8,10,47,52,62,69,33,43,63,94,47,89,35,2,97,68,27,91,67,79,76,63,44,62,26,71,41,65,11,63,68},new int[]{83,26,88,87,27,89,90,44,25,11,24,51,63,87,21,47,30,87,41,10,51,68,19,99,3,60,9,1,88,96,50,51,4,7,21,19,81,12,3,68,86,76,94,27},new int[]{70,20,21,16,66,54,91,72,58,19,87,21,83,86,36,55,90,93,21,99,40,83,70,10,74,29,47,2,90,40,54,7,42,58,81,86,96,50,78,91,13,8,19,75},new int[]{48,77,22,83,16,42,23,23,66,28,93,6,55,33,71,80,69,45,17,65,61,36,96,88,34,91,96,16,38,82,14,46,93,30,80,71,78,32,88,10,49,64,80,71},new int[]{43,22,43,14,39,21,40,9,28,58,67,37,48,21,15,23,65,37,95,9,78,72,24,15,61,34,60,71,89,67,54,12,65,93,7,33,32,66,15,77,35,49,7,37},new int[]{11,94,76,42,84,60,54,9,48,62,66,29,46,66,39,5,50,42,11,70,68,44,97,32,66,78,94,30,74,62,30,9,72,93,86,56,39,33,3,69,90,82,84,52},new int[]{58,42,85,13,96,49,7,2,15,63,99,30,99,61,4,70,61,2,41,89,65,73,26,81,80,99,19,60,97,47,82,52,99,46,20,64,72,76,77,87,83,71,61,27},new int[]{52,73,93,29,14,16,36,20,50,20,82,46,13,97,48,91,3,64,95,94,57,80,35,72,96,88,2,90,46,85,12,85,6,72,26,43,6,23,98,98,57,5,88,33},new int[]{16,41,49,59,67,92,11,44,53,79,8,47,38,89,16,59,8,57,45,87,27,63,52,23,70,22,27,95,39,42,53,70,77,14,37,66,40,42,83,19,15,51,42,31},new int[]{11,64,69,92,73,96,98,93,44,68,87,34,37,60,65,74,41,20,72,60,58,91,84,58,54,16,68,88,17,9,20,10,2,24,80,41,15,99,74,19,83,88,77,97},new int[]{1,23,97,64,27,1,39,25,98,41,57,7,11,26,60,53,1,88,78,45,83,1,7,43,35,34,68,40,20,64,82,66,61,46,54,50,30,55,51,83,9,47,89,94},new int[]{58,17,59,16,88,29,50,63,79,86,5,74,37,36,17,23,2,55,85,19,88,94,98,10,80,3,18,2,90,24,45,95,42,7,59,46,44,93,35,30,4,89,62,45},new int[]{30,12,55,36,47,2,26,57,75,42,38,56,75,95,26,95,37,73,28,31,29,46,25,96,15,77,85,19,76,71,83,23,1,93,59,94,64,45,37,9,92,92,66,5}});
param0.add(new int[][]{new int[]{65,34,26,9,37,67,53,2,72,64,94,58,2,94,35,57,91,79,54,72,39,11,27,46,26,53,1,43,93,8,32,94,4},new int[]{70,74,34,17,26,35,12,1,81,4,69,57,12,53,47,75,31,54,38,4,75,27,12,68,75,76,32,30,97,65,71,82,58},new int[]{55,76,56,98,18,2,69,56,84,19,8,83,11,32,19,33,18,70,85,12,21,53,84,42,79,57,48,74,4,32,56,93,25},new int[]{81,46,85,84,85,1,12,93,15,95,36,6,66,53,15,15,22,13,52,78,51,78,13,12,16,6,33,46,74,60,42,23,86},new int[]{24,32,97,90,96,79,70,38,1,40,31,81,50,18,5,83,71,28,59,22,85,88,9,42,42,80,1,53,69,19,28,6,7},new int[]{94,36,5,98,38,21,4,80,67,31,67,25,86,20,25,51,91,81,49,36,34,90,15,17,73,93,29,64,65,69,15,99,85},new int[]{51,3,38,69,97,30,29,16,18,38,53,56,27,45,82,52,93,83,38,48,58,63,75,35,57,3,64,35,91,2,3,11,17},new int[]{42,87,47,48,84,66,97,47,22,24,25,13,60,82,36,33,6,21,37,70,99,46,59,7,48,43,85,61,88,23,28,62,67},new int[]{39,1,60,53,83,73,88,11,94,21,35,42,70,76,11,21,37,94,77,44,16,18,11,48,23,31,88,99,47,51,5,84,39},new int[]{76,36,4,40,26,32,68,98,87,61,86,9,7,19,87,82,25,89,88,17,71,90,93,96,93,38,79,40,37,39,50,78,27},new int[]{93,50,25,86,64,79,31,5,2,79,17,28,43,55,75,86,80,44,40,79,22,86,76,39,29,94,55,21,58,16,11,25,3},new int[]{65,46,21,53,94,31,36,95,56,15,61,79,47,91,6,3,77,58,19,1,14,3,88,14,25,26,87,31,32,92,34,1,10},new int[]{32,23,80,11,71,66,61,14,5,4,20,46,14,22,46,33,79,10,23,40,27,14,53,96,36,18,88,72,21,89,54,41,15},new int[]{58,51,83,78,50,9,74,89,78,45,35,48,16,22,87,98,55,14,45,66,39,69,15,63,90,99,58,71,72,58,66,60,59},new int[]{75,60,51,45,94,80,68,18,55,52,91,83,75,66,82,59,25,32,60,99,55,18,44,8,47,70,23,50,47,70,7,82,75},new int[]{99,87,34,94,16,25,38,55,34,47,95,19,23,33,65,4,12,69,58,37,49,64,31,15,8,81,49,21,43,17,36,69,66},new int[]{36,37,27,32,39,87,14,14,20,91,54,77,73,98,84,49,31,88,35,60,64,92,11,25,83,61,81,9,17,75,41,26,9},new int[]{56,72,59,52,16,37,54,75,37,61,38,68,69,30,45,88,94,90,63,37,68,93,36,66,81,75,22,26,70,1,91,57,48},new int[]{12,1,43,29,13,3,73,28,90,13,17,93,52,42,98,43,50,25,73,54,77,70,68,53,34,14,36,19,74,2,3,62,91},new int[]{53,16,54,88,98,49,27,72,31,44,42,79,26,27,2,29,98,49,13,86,43,39,15,35,93,47,36,30,55,50,14,6,62},new int[]{78,34,23,81,13,49,39,23,3,56,41,98,47,22,13,60,99,73,1,12,63,72,96,76,28,40,41,59,78,36,67,94,80},new int[]{49,16,72,51,7,35,73,49,91,86,45,12,4,60,56,32,55,92,19,93,55,11,79,31,58,36,61,16,68,36,80,2,61},new int[]{5,36,19,30,33,96,99,83,98,89,30,33,31,36,31,65,94,40,31,13,42,60,66,2,74,95,41,77,59,60,23,29,50},new int[]{44,80,2,23,40,79,46,11,47,85,79,1,36,61,2,56,79,51,31,3,44,76,47,12,37,43,13,43,47,2,98,56,7},new int[]{16,78,74,73,14,67,14,10,48,6,18,81,76,3,95,20,59,93,2,69,49,45,12,25,31,17,37,17,9,21,88,21,10},new int[]{76,93,65,22,27,8,28,66,46,92,12,73,84,28,43,95,15,83,77,90,32,85,52,89,21,82,11,21,11,98,70,31,43},new int[]{44,70,41,47,92,72,99,44,62,51,70,76,10,37,50,27,39,42,81,59,82,41,33,57,57,4,14,34,95,59,33,16,2},new int[]{22,63,34,90,6,55,79,36,55,52,96,12,19,95,26,58,31,41,77,55,25,22,13,64,39,2,53,77,70,60,40,99,14},new int[]{81,48,68,96,21,87,19,85,97,55,12,43,26,17,74,82,37,66,79,27,39,8,33,69,69,51,64,64,65,55,69,40,64},new int[]{87,40,17,98,18,93,65,49,93,30,55,5,70,42,31,1,23,72,23,4,25,27,77,39,19,20,89,83,70,31,97,14,67},new int[]{13,48,77,97,13,89,48,57,27,18,84,78,58,84,73,45,97,6,12,27,63,83,59,51,75,15,28,89,14,24,34,91,77},new int[]{92,66,37,4,47,78,71,32,83,73,64,91,27,29,83,9,39,58,80,63,43,59,14,22,75,40,39,66,91,12,83,94,59},new int[]{76,33,76,72,72,20,38,51,14,15,85,73,91,6,11,38,69,33,33,80,82,48,38,10,66,80,57,74,23,85,93,17,63}});
param0.add(new int[][]{new int[]{20,59,92,38,68,74,80,12,75,17,90,28,32,68,51,92,9,87,92,42,1,58,4,54,95,81,87,47,29,71,32},new int[]{91,56,90,35,34,99,8,1,13,48,11,13,98,49,66,59,93,31,94,67,76,95,12,9,3,97,74,32,52,88,51},new int[]{78,15,37,60,60,51,19,57,62,95,22,82,60,17,70,11,38,99,11,81,53,98,69,80,85,22,66,18,6,85,35},new int[]{61,35,21,18,30,38,26,82,1,31,86,8,68,82,95,73,51,5,27,97,67,64,52,15,59,45,36,76,75,94,96},new int[]{84,55,25,87,88,21,76,60,54,69,74,12,36,77,84,1,34,16,19,69,34,75,97,87,13,52,38,9,75,94,14},new int[]{47,82,61,86,67,43,66,51,25,35,15,48,16,93,50,91,44,57,52,56,3,11,97,92,25,37,99,14,68,34,64},new int[]{31,12,98,9,45,80,4,61,55,46,38,31,40,42,27,53,49,59,20,19,62,16,9,52,95,75,87,70,96,90,74},new int[]{88,20,61,40,55,58,43,50,34,77,73,86,17,24,98,56,14,47,41,90,41,32,63,66,88,57,6,66,20,9,26},new int[]{16,54,1,53,79,34,12,30,7,23,9,46,40,45,3,44,83,99,63,56,38,76,82,11,18,59,88,74,42,21,44},new int[]{38,50,80,48,98,72,60,51,67,96,55,70,71,70,87,87,12,42,87,65,19,14,20,19,84,32,21,48,30,23,58},new int[]{7,23,15,17,86,87,76,92,19,13,15,21,65,52,12,37,74,19,13,33,73,60,39,50,37,32,62,58,10,20,31},new int[]{69,27,28,76,93,14,24,96,83,94,77,47,14,11,39,86,40,24,69,30,45,24,9,24,93,32,3,86,87,61,87},new int[]{47,83,78,32,86,32,92,82,10,76,45,83,6,77,91,63,78,24,86,61,90,51,44,88,11,81,90,33,17,23,97},new int[]{84,97,32,2,6,19,17,53,25,60,15,42,17,76,86,35,29,28,69,95,60,92,6,31,80,21,2,52,14,46,32},new int[]{1,71,62,39,44,88,75,39,9,53,48,76,63,27,69,71,22,89,15,25,1,75,39,75,31,86,52,29,38,64,76},new int[]{48,70,75,49,76,5,82,72,83,58,66,43,25,87,73,6,9,87,42,47,82,43,71,19,7,17,61,78,44,3,31},new int[]{78,89,29,56,19,7,68,28,81,68,91,88,41,98,8,3,12,11,85,78,1,21,19,69,32,72,62,9,26,20,14},new int[]{94,60,73,46,60,12,21,21,47,91,56,74,88,76,60,84,10,38,4,23,20,46,59,8,19,51,14,6,15,25,69},new int[]{4,48,57,98,25,86,76,78,66,21,16,71,18,65,95,33,10,7,50,21,81,52,30,92,15,40,7,20,90,1,9},new int[]{92,58,71,51,54,56,57,21,32,7,54,97,57,32,71,81,51,25,82,81,35,25,45,69,82,20,31,77,20,70,17},new int[]{55,96,60,73,88,63,2,90,14,37,9,94,55,44,55,96,84,54,20,90,6,54,34,7,16,58,58,88,72,44,68},new int[]{98,72,10,44,74,20,96,24,85,9,23,58,7,32,30,65,75,28,57,25,37,61,94,38,5,45,86,77,55,50,23},new int[]{9,43,13,86,41,42,4,64,59,31,90,68,99,93,10,88,89,83,84,95,52,25,99,95,75,1,27,99,92,61,95},new int[]{23,9,95,28,79,76,53,1,13,47,30,14,81,43,84,84,99,77,44,52,47,35,90,64,77,47,66,32,77,96,40},new int[]{53,27,68,47,54,21,53,24,38,1,85,65,33,50,32,60,37,6,54,15,78,35,98,88,73,32,84,10,31,79,55},new int[]{45,44,77,84,86,83,10,64,60,57,20,71,9,92,78,61,29,62,63,39,49,58,88,5,25,61,59,55,39,12,9},new int[]{12,35,58,74,10,97,46,66,22,77,6,87,64,20,55,65,68,10,15,51,24,96,93,36,5,20,59,3,22,76,18},new int[]{29,27,6,76,52,73,81,12,7,55,18,30,81,15,86,93,48,40,63,78,8,5,79,83,93,78,91,7,94,7,83},new int[]{10,29,80,26,28,72,4,94,69,37,89,26,40,78,22,1,99,4,73,79,51,89,83,79,30,41,17,71,10,32,99},new int[]{39,61,3,58,92,51,77,76,79,30,44,5,30,3,95,15,50,89,39,73,53,82,1,18,76,99,29,65,75,32,32},new int[]{38,40,23,94,62,91,94,42,32,52,10,23,51,7,77,52,86,13,65,12,25,26,84,32,19,36,94,91,48,50,11}});
param0.add(new int[][]{new int[]{93,83,42,36,3,96,99,4,83,84,92,19,69,39,25,37,46,22,48,91,51,83,1,5,31,15,80,59,40,93,95},new int[]{54,11,90,56,27,57,45,62,95,13,85,33,86,20,39,58,72,86,29,60,14,95,58,85,72,58,90,6,73,96,83},new int[]{33,22,85,19,97,11,52,56,85,45,6,97,69,99,37,43,16,45,91,6,44,85,1,20,38,8,8,43,76,88,25},new int[]{69,43,13,63,41,26,51,26,83,20,65,38,60,76,13,80,51,90,70,63,88,47,82,52,15,55,98,12,36,21,81},new int[]{2,91,37,21,77,38,47,83,46,50,21,80,13,54,53,31,44,94,85,47,20,54,23,60,86,86,56,35,86,88,18},new int[]{46,75,65,1,94,23,37,13,73,70,90,44,12,54,50,69,28,80,64,10,44,71,6,68,63,79,22,10,96,19,95},new int[]{13,71,30,9,50,85,17,41,16,58,27,14,25,59,51,15,48,61,50,15,39,7,79,49,43,21,28,32,60,5,8},new int[]{40,81,37,19,62,87,90,26,23,70,64,89,35,10,1,50,94,20,75,48,62,41,59,43,38,78,4,44,37,73,16},new int[]{97,37,78,7,32,92,29,80,85,68,52,98,15,27,54,46,37,33,40,20,72,68,50,49,50,22,52,96,94,54,29},new int[]{35,66,92,81,84,52,72,10,3,52,10,22,25,14,22,43,78,75,95,55,11,95,93,14,16,81,14,82,61,82,7},new int[]{92,56,47,97,57,39,82,67,14,63,49,24,27,33,12,98,16,70,55,13,12,29,59,8,15,78,60,94,36,50,79},new int[]{79,56,75,54,90,10,59,53,87,86,48,65,9,10,5,55,35,37,75,75,72,63,41,43,96,33,51,49,55,97,89},new int[]{51,24,59,88,43,51,67,10,84,22,15,62,77,24,75,34,97,71,3,46,38,59,82,53,52,69,2,57,21,89,88},new int[]{33,49,78,9,9,85,92,47,9,36,67,24,14,66,72,45,11,49,2,44,87,98,3,28,15,22,42,30,28,26,45},new int[]{30,97,41,94,2,35,30,83,75,35,77,12,40,15,9,39,64,47,63,92,54,33,23,4,3,42,32,55,16,46,20},new int[]{11,80,79,61,36,97,56,15,15,5,55,11,96,66,51,51,99,45,55,77,33,49,91,96,58,10,53,69,12,6,6},new int[]{23,73,85,83,94,51,28,20,39,36,50,60,74,68,38,30,65,71,78,69,78,87,26,49,20,44,10,72,97,1,17},new int[]{12,50,96,79,8,43,71,63,13,88,21,13,62,80,42,85,19,53,97,62,21,75,86,78,91,35,88,9,3,73,28},new int[]{28,62,83,54,34,11,79,29,20,74,75,68,46,22,4,59,89,29,24,56,8,49,12,87,89,95,90,21,48,39,29},new int[]{98,88,4,74,67,38,35,65,58,36,35,24,59,12,49,92,84,27,56,81,48,43,73,65,51,84,39,93,56,24,94},new int[]{94,92,81,45,74,80,98,72,40,20,41,34,23,59,59,28,83,13,23,74,12,89,90,82,2,12,49,50,51,2,52},new int[]{29,74,58,85,1,37,5,66,26,58,7,84,70,73,16,6,98,87,51,49,87,89,24,30,80,16,76,50,6,74,9},new int[]{14,96,38,81,29,8,19,75,17,83,63,5,57,46,3,52,46,47,94,96,18,22,77,14,9,60,94,50,7,37,30},new int[]{85,76,84,18,58,48,45,54,93,16,10,22,30,5,62,51,18,44,27,23,55,56,28,58,13,14,6,85,32,25,30},new int[]{70,19,93,74,98,7,55,67,38,49,77,85,37,65,80,83,67,15,99,71,51,81,25,77,65,37,62,80,8,78,48},new int[]{1,76,42,12,54,26,18,30,9,61,74,7,58,5,48,43,41,18,70,24,8,15,41,47,46,44,9,95,82,24,3},new int[]{17,28,29,45,1,80,41,27,18,50,1,43,84,92,19,18,23,2,68,7,18,27,32,9,65,85,21,33,89,74,72},new int[]{98,66,13,88,97,14,26,83,71,6,59,65,34,10,39,78,45,95,70,22,89,93,98,58,63,80,93,98,31,73,85},new int[]{56,76,20,78,84,26,43,32,39,14,64,37,99,54,44,6,98,26,9,29,78,19,41,51,33,37,33,93,55,93,42},new int[]{56,29,87,54,47,91,90,47,11,43,63,8,53,88,76,63,87,41,64,81,39,85,74,56,4,3,58,86,20,85,53},new int[]{64,65,80,69,83,7,3,64,27,52,18,45,3,51,86,16,59,73,4,48,47,20,20,34,74,40,16,37,30,86,93}});
List<Integer> param1 = new ArrayList<>();
param1.add(0);
param1.add(1);
param1.add(4);
param1.add(4);
param1.add(17);
param1.add(4);
param1.add(35);
param1.add(30);
param1.add(25);
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 = [
([[]],0,),
([[1]],1,),
([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],4,),
([[1,0,0,0],[0,1,0,0],[0,0,1,0],[1,0,0,1]],4,),
([[7, 28, 37, 88, 70, 41, 11, 67, 9, 9, 35, 80, 99, 45, 41, 88, 51, 25, 54, 40, 28, 72, 91, 71, 72, 14], [4, 90, 11, 18, 54, 57, 43, 53, 69, 55, 74, 57, 27, 84, 14, 77, 16, 56, 93, 60, 87, 35, 29, 17, 19, 98], [37, 91, 56, 85, 69, 17, 68, 81, 85, 58, 43, 96, 26, 16, 91, 46, 85, 4, 33, 25, 80, 80, 43, 53, 80, 3], [53, 92, 40, 1, 6, 75, 90, 33, 3, 87, 22, 46, 87, 44, 99, 26, 49, 45, 57, 1, 58, 8, 10, 50, 77, 6], [94, 17, 54, 45, 67, 91, 14, 7, 87, 87, 60, 99, 46, 32, 45, 59, 92, 98, 82, 13, 44, 72, 89, 76, 75, 54], [96, 46, 82, 21, 97, 70, 95, 9, 20, 52, 46, 80, 21, 25, 7, 57, 90, 20, 50, 68, 86, 84, 20, 49, 72, 11], [75, 19, 51, 52, 16, 72, 68, 30, 18, 96, 88, 21, 17, 42, 68, 7, 9, 13, 28, 20, 72, 14, 67, 89, 74, 44], [86, 59, 47, 73, 13, 32, 31, 77, 31, 55, 28, 10, 7, 11, 5, 69, 63, 43, 54, 97, 38, 33, 88, 44, 81, 92], [46, 87, 97, 25, 96, 30, 79, 8, 38, 54, 1, 79, 12, 23, 92, 25, 22, 34, 27, 38, 71, 29, 40, 12, 34, 85], [3, 82, 23, 40, 75, 92, 60, 24, 51, 81, 73, 56, 28, 96, 42, 31, 65, 61, 80, 54, 33, 71, 31, 63, 15, 98], [37, 79, 60, 59, 45, 43, 91, 9, 45, 31, 6, 50, 92, 95, 37, 85, 5, 78, 98, 76, 38, 38, 39, 97, 32, 88], [47, 54, 98, 76, 58, 19, 62, 32, 37, 63, 42, 71, 20, 17, 32, 30, 25, 62, 18, 52, 20, 70, 19, 34, 22, 50], [17, 44, 72, 87, 85, 39, 69, 87, 97, 69, 47, 32, 47, 37, 55, 40, 52, 93, 11, 5, 37, 59, 22, 28, 86, 74], [60, 87, 13, 48, 18, 7, 38, 65, 28, 30, 55, 33, 26, 80, 93, 8, 97, 92, 60, 35, 79, 46, 23, 34, 69, 25], [69, 89, 92, 94, 96, 26, 6, 76, 82, 12, 60, 16, 57, 33, 73, 21, 99, 71, 52, 79, 73, 3, 41, 43, 98, 43], [83, 94, 99, 92, 7, 12, 22, 48, 17, 28, 70, 46, 86, 60, 52, 43, 32, 41, 26, 35, 82, 68, 83, 41, 31, 20], [92, 61, 66, 51, 74, 84, 27, 34, 31, 6, 98, 85, 29, 45, 40, 36, 30, 95, 65, 44, 48, 53, 62, 55, 48, 39], [33, 17, 57, 20, 94, 60, 19, 81, 14, 43, 63, 49, 39, 92, 60, 11, 29, 38, 94, 84, 41, 85, 27, 88, 47, 60], [65, 63, 62, 96, 87, 87, 53, 39, 45, 32, 71, 77, 8, 33, 18, 17, 75, 57, 55, 21, 21, 49, 44, 84, 98, 49], [50, 42, 41, 95, 20, 33, 18, 69, 18, 90, 28, 97, 27, 47, 26, 87, 23, 24, 8, 51, 90, 40, 60, 18, 6, 41], [76, 98, 96, 10, 27, 98, 3, 66, 54, 51, 69, 76, 14, 36, 29, 30, 53, 8, 6, 45, 72, 50, 3, 71, 49, 46], [31, 34, 36, 75, 23, 27, 53, 32, 3, 42, 87, 28, 77, 21, 13, 89, 8, 18, 48, 43, 61, 33, 15, 26, 83, 95], [55, 79, 11, 90, 76, 74, 19, 88, 53, 43, 22, 28, 39, 84, 3, 63, 21, 98, 51, 91, 94, 37, 2, 92, 59, 84], [81, 36, 20, 40, 11, 85, 51, 43, 23, 59, 22, 90, 52, 49, 81, 96, 25, 70, 80, 99, 19, 83, 6, 88, 54, 24], [97, 97, 33, 56, 42, 86, 62, 50, 51, 1, 91, 60, 21, 58, 68, 85, 63, 62, 13, 68, 43, 12, 7, 40, 97, 54], [46, 13, 97, 14, 53, 75, 56, 17, 81, 91, 24, 52, 26, 97, 26, 27, 79, 43, 44, 87, 10, 94, 97, 56, 80, 25]],25,),
([[80, 68, 67, 24, 55, 89, 15, 35, 7, 28, 36, 65, 76, 4, 97, 99, 82, 21, 14, 55, 66, 43, 28, 81, 94, 23, 43, 97, 74], [94, 39, 98, 29, 57, 15, 49, 96, 28, 97, 8, 4, 39, 58, 71, 76, 88, 85, 9, 89, 93, 64, 44, 64, 41, 47, 26, 70, 75], [47, 8, 15, 88, 50, 27, 9, 88, 95, 51, 96, 43, 14, 14, 38, 63, 40, 60, 41, 80, 13, 74, 29, 26, 52, 95, 86, 39, 66], [40, 65, 70, 92, 28, 99, 1, 80, 18, 13, 45, 88, 67, 16, 75, 91, 37, 2, 80, 33, 64, 4, 59, 6, 11, 11, 25, 39, 7], [43, 70, 31, 99, 4, 1, 98, 30, 76, 89, 2, 14, 6, 28, 56, 19, 30, 87, 98, 75, 37, 39, 1, 84, 29, 92, 71, 67, 54], [18, 97, 8, 12, 59, 68, 25, 40, 24, 82, 22, 43, 73, 59, 17, 92, 67, 90, 14, 95, 8, 41, 3, 7, 69, 59, 15, 63, 88], [32, 57, 74, 7, 87, 61, 83, 38, 83, 68, 1, 89, 92, 76, 94, 21, 25, 27, 62, 29, 21, 88, 14, 59, 20, 77, 7, 35, 5], [22, 72, 82, 3, 58, 73, 55, 65, 23, 83, 65, 96, 63, 16, 92, 63, 60, 76, 91, 58, 7, 65, 3, 61, 13, 12, 6, 88, 83], [15, 52, 62, 34, 57, 88, 56, 16, 25, 23, 50, 90, 57, 94, 56, 62, 33, 20, 71, 66, 7, 10, 88, 35, 47, 42, 61, 9, 1], [85, 33, 29, 35, 54, 26, 37, 63, 35, 16, 22, 97, 68, 22, 14, 70, 84, 89, 93, 85, 54, 15, 15, 77, 15, 80, 81, 60, 64], [4, 62, 17, 84, 89, 79, 9, 58, 43, 16, 10, 32, 36, 93, 76, 7, 44, 93, 12, 19, 25, 34, 80, 53, 65, 69, 9, 71, 56], [65, 37, 85, 44, 43, 68, 55, 69, 55, 52, 47, 38, 41, 37, 32, 24, 35, 59, 46, 41, 48, 51, 87, 64, 75, 71, 94, 17, 60], [50, 6, 95, 63, 14, 78, 8, 83, 46, 7, 32, 90, 3, 25, 88, 78, 11, 34, 57, 10, 18, 33, 75, 14, 68, 6, 98, 12, 36], [11, 73, 12, 20, 89, 5, 78, 56, 3, 36, 98, 63, 11, 88, 4, 9, 87, 20, 62, 87, 23, 3, 54, 51, 99, 10, 30, 34, 33], [79, 23, 94, 80, 42, 32, 29, 28, 18, 35, 74, 94, 89, 52, 11, 74, 5, 15, 78, 99, 38, 94, 95, 89, 92, 79, 74, 13, 24], [74, 87, 21, 34, 25, 60, 49, 92, 29, 88, 22, 65, 27, 24, 89, 32, 90, 42, 67, 24, 71, 47, 79, 12, 73, 42, 2, 80, 13], [79, 84, 54, 87, 94, 43, 62, 11, 48, 36, 26, 22, 27, 31, 14, 87, 30, 23, 6, 43, 64, 76, 68, 2, 33, 14, 13, 63, 4], [77, 96, 66, 22, 59, 32, 40, 81, 24, 58, 39, 63, 53, 3, 68, 37, 29, 11, 50, 38, 74, 64, 70, 5, 75, 46, 47, 15, 75], [5, 87, 49, 47, 42, 18, 34, 58, 72, 65, 68, 73, 17, 74, 93, 85, 97, 97, 93, 36, 97, 70, 49, 84, 24, 73, 21, 36, 92], [97, 58, 52, 86, 90, 71, 1, 92, 71, 85, 32, 71, 27, 68, 71, 96, 57, 62, 81, 98, 25, 89, 13, 84, 59, 91, 83, 92, 43], [74, 54, 73, 63, 20, 19, 13, 22, 96, 46, 80, 60, 68, 40, 12, 34, 43, 41, 57, 49, 24, 69, 54, 29, 20, 65, 13, 50, 54], [93, 26, 9, 10, 61, 46, 49, 40, 3, 93, 22, 24, 99, 19, 77, 92, 10, 27, 28, 5, 8, 4, 56, 9, 52, 76, 89, 28, 82], [73, 33, 56, 17, 7, 59, 85, 95, 64, 16, 40, 86, 27, 59, 65, 49, 55, 27, 35, 93, 97, 27, 73, 14, 78, 33, 27, 84, 5], [37, 93, 55, 95, 95, 70, 37, 78, 49, 62, 65, 26, 85, 16, 70, 36, 39, 59, 33, 24, 62, 53, 80, 30, 91, 28, 44, 92, 12], [45, 91, 17, 24, 74, 67, 90, 86, 68, 26, 55, 20, 65, 9, 51, 69, 74, 76, 3, 90, 3, 64, 81, 81, 89, 73, 60, 76, 21], [4, 53, 19, 1, 88, 95, 30, 83, 85, 76, 74, 29, 59, 52, 92, 46, 74, 93, 67, 96, 46, 88, 45, 87, 56, 28, 49, 57, 96], [10, 41, 45, 41, 2, 48, 49, 20, 48, 21, 60, 57, 10, 69, 47, 91, 34, 23, 5, 89, 61, 36, 51, 19, 59, 23, 96, 90, 94], [16, 12, 62, 79, 4, 78, 25, 56, 40, 44, 66, 42, 75, 95, 91, 17, 78, 79, 41, 79, 17, 7, 99, 81, 47, 36, 67, 74, 68], [78, 88, 92, 77, 75, 10, 5, 97, 22, 77, 70, 97, 86, 14, 3, 6, 39, 95, 21, 38, 33, 68, 52, 24, 22, 38, 37, 98, 46]],17,),
([[54, 16, 12, 57, 31, 31, 71, 17, 46], [74, 81, 65, 60, 4, 64, 19, 31, 18], [42, 3, 51, 46, 58, 13, 72, 29, 69], [6, 81, 28, 72, 32, 8, 11, 14, 16], [9, 2, 29, 22, 52, 42, 78, 46, 15], [70, 89, 42, 58, 72, 9, 21, 23, 34], [37, 33, 35, 32, 96, 38, 69, 53, 18], [35, 19, 88, 73, 2, 67, 92, 61, 29], [49, 40, 86, 14, 67, 89, 37, 66, 29]],4,),
([[6, 45, 61, 50, 95, 16, 88, 4, 77, 57, 23, 14, 58, 9, 94, 61, 56, 58, 52, 22, 3, 88, 34, 16, 75, 37, 40, 45, 19, 5, 38, 43, 25, 90, 33, 54, 45, 58, 91, 26, 72, 59, 90, 58], [57, 23, 46, 56, 38, 75, 35, 81, 92, 15, 69, 75, 73, 74, 2, 25, 82, 15, 3, 66, 55, 50, 78, 42, 27, 20, 59, 82, 84, 99, 77, 60, 29, 87, 2, 93, 4, 73, 58, 75, 24, 91, 34, 60], [48, 16, 15, 20, 93, 77, 91, 76, 26, 29, 82, 81, 6, 17, 65, 78, 72, 13, 17, 21, 70, 68, 27, 5, 86, 42, 29, 93, 22, 85, 83, 47, 34, 71, 20, 66, 38, 51, 11, 98, 69, 33, 11, 61], [52, 98, 3, 21, 45, 88, 95, 71, 96, 74, 5, 34, 29, 25, 22, 4, 45, 34, 27, 34, 25, 6, 20, 64, 95, 6, 38, 70, 47, 12, 16, 31, 36, 69, 52, 3, 42, 99, 39, 51, 4, 83, 43, 89], [82, 5, 49, 81, 7, 20, 64, 69, 5, 76, 7, 66, 34, 32, 73, 21, 39, 84, 11, 79, 12, 75, 41, 22, 9, 55, 83, 58, 20, 91, 23, 55, 14, 41, 90, 34, 28, 82, 71, 31, 75, 97, 13, 70], [14, 38, 99, 57, 37, 89, 94, 35, 32, 3, 8, 80, 7, 36, 13, 14, 62, 18, 9, 65, 10, 62, 18, 23, 79, 18, 19, 27, 85, 5, 24, 89, 4, 18, 79, 55, 50, 53, 93, 98, 47, 79, 11, 44], [36, 45, 81, 66, 95, 20, 70, 67, 48, 14, 53, 71, 38, 92, 33, 65, 19, 93, 70, 82, 49, 39, 20, 99, 49, 26, 62, 14, 51, 43, 50, 67, 79, 71, 1, 79, 44, 88, 77, 29, 16, 17, 79, 37], [47, 63, 92, 95, 43, 92, 58, 38, 70, 7, 33, 6, 22, 24, 57, 14, 16, 99, 86, 58, 7, 60, 18, 86, 66, 12, 99, 35, 62, 84, 16, 64, 7, 64, 37, 26, 89, 95, 46, 22, 82, 41, 63, 81], [44, 45, 67, 38, 12, 94, 31, 12, 24, 7, 81, 14, 25, 88, 7, 44, 78, 20, 67, 49, 64, 52, 5, 3, 79, 95, 29, 50, 30, 76, 57, 35, 11, 10, 73, 35, 62, 92, 19, 47, 61, 2, 21, 18], [26, 32, 78, 90, 56, 43, 74, 23, 88, 4, 86, 76, 75, 51, 45, 76, 49, 47, 27, 34, 53, 44, 52, 31, 79, 34, 51, 75, 38, 20, 58, 29, 11, 42, 82, 67, 83, 48, 32, 6, 89, 88, 36, 2], [75, 60, 53, 13, 83, 51, 2, 9, 67, 24, 12, 85, 4, 11, 94, 3, 51, 30, 7, 13, 47, 80, 21, 11, 52, 13, 31, 99, 10, 60, 53, 8, 4, 86, 74, 41, 98, 64, 11, 4, 48, 55, 58, 8], [2, 30, 97, 44, 20, 75, 85, 39, 34, 37, 66, 61, 85, 96, 26, 13, 78, 59, 37, 25, 20, 50, 21, 90, 39, 22, 51, 9, 49, 2, 83, 89, 98, 11, 32, 91, 57, 83, 80, 23, 48, 62, 14, 20], [43, 87, 42, 65, 98, 57, 25, 16, 20, 23, 86, 8, 47, 82, 85, 56, 95, 80, 72, 83, 35, 17, 35, 51, 7, 64, 49, 87, 99, 37, 25, 55, 86, 58, 82, 59, 73, 4, 97, 76, 70, 36, 39, 51], [38, 79, 75, 87, 98, 4, 60, 71, 43, 12, 30, 59, 89, 91, 67, 85, 59, 74, 94, 10, 36, 88, 59, 15, 90, 20, 62, 67, 7, 65, 48, 85, 72, 42, 24, 33, 85, 37, 70, 8, 91, 33, 60, 36], [65, 64, 13, 60, 62, 41, 27, 90, 90, 72, 40, 55, 83, 31, 54, 47, 1, 86, 27, 93, 91, 95, 44, 56, 6, 72, 93, 67, 17, 24, 19, 52, 46, 25, 58, 37, 42, 71, 62, 96, 38, 4, 80, 44], [25, 70, 58, 20, 57, 12, 57, 29, 95, 36, 54, 63, 48, 92, 43, 87, 72, 58, 39, 85, 42, 53, 1, 7, 1, 56, 52, 4, 47, 50, 12, 4, 57, 9, 54, 72, 6, 50, 67, 1, 20, 88, 70, 59], [9, 39, 54, 75, 64, 97, 52, 37, 52, 22, 14, 87, 16, 69, 20, 85, 45, 43, 96, 14, 14, 12, 35, 79, 23, 85, 23, 27, 82, 1, 63, 1, 69, 26, 82, 14, 95, 30, 13, 87, 95, 73, 52, 18], [6, 50, 3, 2, 89, 32, 77, 57, 75, 12, 49, 25, 53, 14, 23, 77, 32, 40, 48, 25, 66, 28, 42, 86, 68, 80, 88, 40, 85, 24, 41, 64, 77, 8, 8, 72, 51, 86, 72, 58, 36, 95, 74, 34], [70, 93, 46, 18, 15, 36, 4, 3, 8, 86, 82, 87, 44, 93, 54, 95, 26, 25, 59, 81, 58, 14, 15, 60, 98, 87, 24, 59, 43, 3, 91, 91, 42, 37, 4, 88, 2, 96, 49, 93, 60, 87, 58, 23], [60, 63, 45, 25, 49, 83, 69, 50, 69, 72, 72, 60, 68, 66, 46, 20, 32, 31, 47, 72, 54, 64, 18, 96, 24, 99, 73, 31, 97, 28, 81, 36, 35, 87, 64, 97, 56, 11, 15, 58, 5, 99, 20, 91], [48, 71, 80, 56, 84, 33, 73, 39, 19, 51, 80, 90, 54, 22, 50, 30, 41, 22, 74, 29, 74, 16, 26, 75, 89, 31, 32, 73, 64, 89, 37, 87, 51, 20, 59, 41, 18, 23, 54, 53, 79, 87, 69, 72], [37, 2, 19, 48, 66, 62, 73, 81, 90, 78, 3, 66, 10, 49, 32, 44, 67, 24, 28, 63, 79, 25, 89, 59, 63, 55, 22, 92, 22, 9, 37, 36, 48, 88, 47, 92, 83, 44, 38, 60, 87, 67, 85, 10], [67, 95, 54, 94, 33, 72, 62, 96, 67, 16, 87, 35, 54, 38, 79, 59, 53, 57, 96, 51, 52, 78, 72, 22, 80, 86, 53, 38, 47, 72, 95, 22, 72, 10, 53, 95, 49, 22, 13, 12, 29, 50, 36, 60], [91, 79, 47, 95, 10, 98, 88, 93, 69, 89, 80, 90, 55, 17, 76, 40, 46, 42, 41, 56, 62, 40, 19, 87, 95, 46, 37, 61, 33, 96, 85, 83, 60, 37, 73, 55, 70, 56, 27, 42, 50, 32, 86, 97], [65, 30, 27, 47, 8, 3, 73, 16, 19, 68, 38, 37, 90, 62, 83, 12, 15, 34, 29, 26, 48, 90, 64, 28, 61, 17, 86, 10, 81, 92, 23, 75, 16, 97, 76, 89, 61, 4, 54, 92, 70, 91, 67, 92], [68, 8, 75, 73, 41, 37, 79, 63, 2, 96, 29, 18, 80, 66, 63, 88, 95, 13, 31, 83, 51, 56, 39, 69, 79, 9, 1, 84, 86, 66, 74, 27, 10, 35, 40, 96, 41, 42, 18, 95, 54, 74, 11, 71], [64, 45, 42, 50, 83, 34, 54, 55, 99, 11, 74, 78, 20, 29, 47, 41, 68, 12, 8, 14, 42, 63, 98, 55, 36, 20, 79, 75, 30, 57, 17, 75, 33, 39, 39, 4, 15, 39, 48, 32, 61, 13, 4, 5], [34, 40, 40, 57, 3, 45, 81, 4, 34, 43, 63, 51, 55, 65, 91, 29, 59, 9, 23, 90, 79, 80, 82, 24, 91, 31, 45, 76, 32, 91, 81, 59, 69, 92, 98, 54, 48, 48, 9, 54, 51, 52, 46, 72], [14, 30, 64, 76, 37, 19, 73, 70, 80, 21, 32, 65, 6, 82, 82, 63, 9, 84, 83, 18, 18, 72, 18, 34, 3, 69, 3, 40, 27, 4, 20, 6, 59, 41, 64, 5, 49, 1, 4, 48, 51, 3, 73, 98], [78, 67, 32, 90, 78, 32, 16, 15, 20, 39, 75, 80, 20, 67, 4, 6, 6, 45, 48, 97, 13, 39, 50, 4, 62, 92, 78, 12, 88, 89, 27, 69, 17, 59, 27, 79, 36, 66, 14, 81, 32, 68, 46, 77], [25, 26, 66, 77, 45, 94, 29, 69, 7, 55, 43, 41, 14, 68, 98, 98, 75, 81, 91, 93, 58, 36, 75, 16, 52, 95, 41, 76, 6, 2, 12, 50, 66, 7, 63, 24, 96, 36, 12, 47, 58, 86, 20, 8], [43, 30, 21, 45, 62, 76, 21, 12, 5, 98, 24, 39, 66, 8, 10, 47, 52, 62, 69, 33, 43, 63, 94, 47, 89, 35, 2, 97, 68, 27, 91, 67, 79, 76, 63, 44, 62, 26, 71, 41, 65, 11, 63, 68], [83, 26, 88, 87, 27, 89, 90, 44, 25, 11, 24, 51, 63, 87, 21, 47, 30, 87, 41, 10, 51, 68, 19, 99, 3, 60, 9, 1, 88, 96, 50, 51, 4, 7, 21, 19, 81, 12, 3, 68, 86, 76, 94, 27], [70, 20, 21, 16, 66, 54, 91, 72, 58, 19, 87, 21, 83, 86, 36, 55, 90, 93, 21, 99, 40, 83, 70, 10, 74, 29, 47, 2, 90, 40, 54, 7, 42, 58, 81, 86, 96, 50, 78, 91, 13, 8, 19, 75], [48, 77, 22, 83, 16, 42, 23, 23, 66, 28, 93, 6, 55, 33, 71, 80, 69, 45, 17, 65, 61, 36, 96, 88, 34, 91, 96, 16, 38, 82, 14, 46, 93, 30, 80, 71, 78, 32, 88, 10, 49, 64, 80, 71], [43, 22, 43, 14, 39, 21, 40, 9, 28, 58, 67, 37, 48, 21, 15, 23, 65, 37, 95, 9, 78, 72, 24, 15, 61, 34, 60, 71, 89, 67, 54, 12, 65, 93, 7, 33, 32, 66, 15, 77, 35, 49, 7, 37], [11, 94, 76, 42, 84, 60, 54, 9, 48, 62, 66, 29, 46, 66, 39, 5, 50, 42, 11, 70, 68, 44, 97, 32, 66, 78, 94, 30, 74, 62, 30, 9, 72, 93, 86, 56, 39, 33, 3, 69, 90, 82, 84, 52], [58, 42, 85, 13, 96, 49, 7, 2, 15, 63, 99, 30, 99, 61, 4, 70, 61, 2, 41, 89, 65, 73, 26, 81, 80, 99, 19, 60, 97, 47, 82, 52, 99, 46, 20, 64, 72, 76, 77, 87, 83, 71, 61, 27], [52, 73, 93, 29, 14, 16, 36, 20, 50, 20, 82, 46, 13, 97, 48, 91, 3, 64, 95, 94, 57, 80, 35, 72, 96, 88, 2, 90, 46, 85, 12, 85, 6, 72, 26, 43, 6, 23, 98, 98, 57, 5, 88, 33], [16, 41, 49, 59, 67, 92, 11, 44, 53, 79, 8, 47, 38, 89, 16, 59, 8, 57, 45, 87, 27, 63, 52, 23, 70, 22, 27, 95, 39, 42, 53, 70, 77, 14, 37, 66, 40, 42, 83, 19, 15, 51, 42, 31], [11, 64, 69, 92, 73, 96, 98, 93, 44, 68, 87, 34, 37, 60, 65, 74, 41, 20, 72, 60, 58, 91, 84, 58, 54, 16, 68, 88, 17, 9, 20, 10, 2, 24, 80, 41, 15, 99, 74, 19, 83, 88, 77, 97], [1, 23, 97, 64, 27, 1, 39, 25, 98, 41, 57, 7, 11, 26, 60, 53, 1, 88, 78, 45, 83, 1, 7, 43, 35, 34, 68, 40, 20, 64, 82, 66, 61, 46, 54, 50, 30, 55, 51, 83, 9, 47, 89, 94], [58, 17, 59, 16, 88, 29, 50, 63, 79, 86, 5, 74, 37, 36, 17, 23, 2, 55, 85, 19, 88, 94, 98, 10, 80, 3, 18, 2, 90, 24, 45, 95, 42, 7, 59, 46, 44, 93, 35, 30, 4, 89, 62, 45], [30, 12, 55, 36, 47, 2, 26, 57, 75, 42, 38, 56, 75, 95, 26, 95, 37, 73, 28, 31, 29, 46, 25, 96, 15, 77, 85, 19, 76, 71, 83, 23, 1, 93, 59, 94, 64, 45, 37, 9, 92, 92, 66, 5]],35,),
([[65, 34, 26, 9, 37, 67, 53, 2, 72, 64, 94, 58, 2, 94, 35, 57, 91, 79, 54, 72, 39, 11, 27, 46, 26, 53, 1, 43, 93, 8, 32, 94, 4], [70, 74, 34, 17, 26, 35, 12, 1, 81, 4, 69, 57, 12, 53, 47, 75, 31, 54, 38, 4, 75, 27, 12, 68, 75, 76, 32, 30, 97, 65, 71, 82, 58], [55, 76, 56, 98, 18, 2, 69, 56, 84, 19, 8, 83, 11, 32, 19, 33, 18, 70, 85, 12, 21, 53, 84, 42, 79, 57, 48, 74, 4, 32, 56, 93, 25], [81, 46, 85, 84, 85, 1, 12, 93, 15, 95, 36, 6, 66, 53, 15, 15, 22, 13, 52, 78, 51, 78, 13, 12, 16, 6, 33, 46, 74, 60, 42, 23, 86], [24, 32, 97, 90, 96, 79, 70, 38, 1, 40, 31, 81, 50, 18, 5, 83, 71, 28, 59, 22, 85, 88, 9, 42, 42, 80, 1, 53, 69, 19, 28, 6, 7], [94, 36, 5, 98, 38, 21, 4, 80, 67, 31, 67, 25, 86, 20, 25, 51, 91, 81, 49, 36, 34, 90, 15, 17, 73, 93, 29, 64, 65, 69, 15, 99, 85], [51, 3, 38, 69, 97, 30, 29, 16, 18, 38, 53, 56, 27, 45, 82, 52, 93, 83, 38, 48, 58, 63, 75, 35, 57, 3, 64, 35, 91, 2, 3, 11, 17], [42, 87, 47, 48, 84, 66, 97, 47, 22, 24, 25, 13, 60, 82, 36, 33, 6, 21, 37, 70, 99, 46, 59, 7, 48, 43, 85, 61, 88, 23, 28, 62, 67], [39, 1, 60, 53, 83, 73, 88, 11, 94, 21, 35, 42, 70, 76, 11, 21, 37, 94, 77, 44, 16, 18, 11, 48, 23, 31, 88, 99, 47, 51, 5, 84, 39], [76, 36, 4, 40, 26, 32, 68, 98, 87, 61, 86, 9, 7, 19, 87, 82, 25, 89, 88, 17, 71, 90, 93, 96, 93, 38, 79, 40, 37, 39, 50, 78, 27], [93, 50, 25, 86, 64, 79, 31, 5, 2, 79, 17, 28, 43, 55, 75, 86, 80, 44, 40, 79, 22, 86, 76, 39, 29, 94, 55, 21, 58, 16, 11, 25, 3], [65, 46, 21, 53, 94, 31, 36, 95, 56, 15, 61, 79, 47, 91, 6, 3, 77, 58, 19, 1, 14, 3, 88, 14, 25, 26, 87, 31, 32, 92, 34, 1, 10], [32, 23, 80, 11, 71, 66, 61, 14, 5, 4, 20, 46, 14, 22, 46, 33, 79, 10, 23, 40, 27, 14, 53, 96, 36, 18, 88, 72, 21, 89, 54, 41, 15], [58, 51, 83, 78, 50, 9, 74, 89, 78, 45, 35, 48, 16, 22, 87, 98, 55, 14, 45, 66, 39, 69, 15, 63, 90, 99, 58, 71, 72, 58, 66, 60, 59], [75, 60, 51, 45, 94, 80, 68, 18, 55, 52, 91, 83, 75, 66, 82, 59, 25, 32, 60, 99, 55, 18, 44, 8, 47, 70, 23, 50, 47, 70, 7, 82, 75], [99, 87, 34, 94, 16, 25, 38, 55, 34, 47, 95, 19, 23, 33, 65, 4, 12, 69, 58, 37, 49, 64, 31, 15, 8, 81, 49, 21, 43, 17, 36, 69, 66], [36, 37, 27, 32, 39, 87, 14, 14, 20, 91, 54, 77, 73, 98, 84, 49, 31, 88, 35, 60, 64, 92, 11, 25, 83, 61, 81, 9, 17, 75, 41, 26, 9], [56, 72, 59, 52, 16, 37, 54, 75, 37, 61, 38, 68, 69, 30, 45, 88, 94, 90, 63, 37, 68, 93, 36, 66, 81, 75, 22, 26, 70, 1, 91, 57, 48], [12, 1, 43, 29, 13, 3, 73, 28, 90, 13, 17, 93, 52, 42, 98, 43, 50, 25, 73, 54, 77, 70, 68, 53, 34, 14, 36, 19, 74, 2, 3, 62, 91], [53, 16, 54, 88, 98, 49, 27, 72, 31, 44, 42, 79, 26, 27, 2, 29, 98, 49, 13, 86, 43, 39, 15, 35, 93, 47, 36, 30, 55, 50, 14, 6, 62], [78, 34, 23, 81, 13, 49, 39, 23, 3, 56, 41, 98, 47, 22, 13, 60, 99, 73, 1, 12, 63, 72, 96, 76, 28, 40, 41, 59, 78, 36, 67, 94, 80], [49, 16, 72, 51, 7, 35, 73, 49, 91, 86, 45, 12, 4, 60, 56, 32, 55, 92, 19, 93, 55, 11, 79, 31, 58, 36, 61, 16, 68, 36, 80, 2, 61], [5, 36, 19, 30, 33, 96, 99, 83, 98, 89, 30, 33, 31, 36, 31, 65, 94, 40, 31, 13, 42, 60, 66, 2, 74, 95, 41, 77, 59, 60, 23, 29, 50], [44, 80, 2, 23, 40, 79, 46, 11, 47, 85, 79, 1, 36, 61, 2, 56, 79, 51, 31, 3, 44, 76, 47, 12, 37, 43, 13, 43, 47, 2, 98, 56, 7], [16, 78, 74, 73, 14, 67, 14, 10, 48, 6, 18, 81, 76, 3, 95, 20, 59, 93, 2, 69, 49, 45, 12, 25, 31, 17, 37, 17, 9, 21, 88, 21, 10], [76, 93, 65, 22, 27, 8, 28, 66, 46, 92, 12, 73, 84, 28, 43, 95, 15, 83, 77, 90, 32, 85, 52, 89, 21, 82, 11, 21, 11, 98, 70, 31, 43], [44, 70, 41, 47, 92, 72, 99, 44, 62, 51, 70, 76, 10, 37, 50, 27, 39, 42, 81, 59, 82, 41, 33, 57, 57, 4, 14, 34, 95, 59, 33, 16, 2], [22, 63, 34, 90, 6, 55, 79, 36, 55, 52, 96, 12, 19, 95, 26, 58, 31, 41, 77, 55, 25, 22, 13, 64, 39, 2, 53, 77, 70, 60, 40, 99, 14], [81, 48, 68, 96, 21, 87, 19, 85, 97, 55, 12, 43, 26, 17, 74, 82, 37, 66, 79, 27, 39, 8, 33, 69, 69, 51, 64, 64, 65, 55, 69, 40, 64], [87, 40, 17, 98, 18, 93, 65, 49, 93, 30, 55, 5, 70, 42, 31, 1, 23, 72, 23, 4, 25, 27, 77, 39, 19, 20, 89, 83, 70, 31, 97, 14, 67], [13, 48, 77, 97, 13, 89, 48, 57, 27, 18, 84, 78, 58, 84, 73, 45, 97, 6, 12, 27, 63, 83, 59, 51, 75, 15, 28, 89, 14, 24, 34, 91, 77], [92, 66, 37, 4, 47, 78, 71, 32, 83, 73, 64, 91, 27, 29, 83, 9, 39, 58, 80, 63, 43, 59, 14, 22, 75, 40, 39, 66, 91, 12, 83, 94, 59], [76, 33, 76, 72, 72, 20, 38, 51, 14, 15, 85, 73, 91, 6, 11, 38, 69, 33, 33, 80, 82, 48, 38, 10, 66, 80, 57, 74, 23, 85, 93, 17, 63]],30,),
([[20, 59, 92, 38, 68, 74, 80, 12, 75, 17, 90, 28, 32, 68, 51, 92, 9, 87, 92, 42, 1, 58, 4, 54, 95, 81, 87, 47, 29, 71, 32], [91, 56, 90, 35, 34, 99, 8, 1, 13, 48, 11, 13, 98, 49, 66, 59, 93, 31, 94, 67, 76, 95, 12, 9, 3, 97, 74, 32, 52, 88, 51], [78, 15, 37, 60, 60, 51, 19, 57, 62, 95, 22, 82, 60, 17, 70, 11, 38, 99, 11, 81, 53, 98, 69, 80, 85, 22, 66, 18, 6, 85, 35], [61, 35, 21, 18, 30, 38, 26, 82, 1, 31, 86, 8, 68, 82, 95, 73, 51, 5, 27, 97, 67, 64, 52, 15, 59, 45, 36, 76, 75, 94, 96], [84, 55, 25, 87, 88, 21, 76, 60, 54, 69, 74, 12, 36, 77, 84, 1, 34, 16, 19, 69, 34, 75, 97, 87, 13, 52, 38, 9, 75, 94, 14], [47, 82, 61, 86, 67, 43, 66, 51, 25, 35, 15, 48, 16, 93, 50, 91, 44, 57, 52, 56, 3, 11, 97, 92, 25, 37, 99, 14, 68, 34, 64], [31, 12, 98, 9, 45, 80, 4, 61, 55, 46, 38, 31, 40, 42, 27, 53, 49, 59, 20, 19, 62, 16, 9, 52, 95, 75, 87, 70, 96, 90, 74], [88, 20, 61, 40, 55, 58, 43, 50, 34, 77, 73, 86, 17, 24, 98, 56, 14, 47, 41, 90, 41, 32, 63, 66, 88, 57, 6, 66, 20, 9, 26], [16, 54, 1, 53, 79, 34, 12, 30, 7, 23, 9, 46, 40, 45, 3, 44, 83, 99, 63, 56, 38, 76, 82, 11, 18, 59, 88, 74, 42, 21, 44], [38, 50, 80, 48, 98, 72, 60, 51, 67, 96, 55, 70, 71, 70, 87, 87, 12, 42, 87, 65, 19, 14, 20, 19, 84, 32, 21, 48, 30, 23, 58], [7, 23, 15, 17, 86, 87, 76, 92, 19, 13, 15, 21, 65, 52, 12, 37, 74, 19, 13, 33, 73, 60, 39, 50, 37, 32, 62, 58, 10, 20, 31], [69, 27, 28, 76, 93, 14, 24, 96, 83, 94, 77, 47, 14, 11, 39, 86, 40, 24, 69, 30, 45, 24, 9, 24, 93, 32, 3, 86, 87, 61, 87], [47, 83, 78, 32, 86, 32, 92, 82, 10, 76, 45, 83, 6, 77, 91, 63, 78, 24, 86, 61, 90, 51, 44, 88, 11, 81, 90, 33, 17, 23, 97], [84, 97, 32, 2, 6, 19, 17, 53, 25, 60, 15, 42, 17, 76, 86, 35, 29, 28, 69, 95, 60, 92, 6, 31, 80, 21, 2, 52, 14, 46, 32], [1, 71, 62, 39, 44, 88, 75, 39, 9, 53, 48, 76, 63, 27, 69, 71, 22, 89, 15, 25, 1, 75, 39, 75, 31, 86, 52, 29, 38, 64, 76], [48, 70, 75, 49, 76, 5, 82, 72, 83, 58, 66, 43, 25, 87, 73, 6, 9, 87, 42, 47, 82, 43, 71, 19, 7, 17, 61, 78, 44, 3, 31], [78, 89, 29, 56, 19, 7, 68, 28, 81, 68, 91, 88, 41, 98, 8, 3, 12, 11, 85, 78, 1, 21, 19, 69, 32, 72, 62, 9, 26, 20, 14], [94, 60, 73, 46, 60, 12, 21, 21, 47, 91, 56, 74, 88, 76, 60, 84, 10, 38, 4, 23, 20, 46, 59, 8, 19, 51, 14, 6, 15, 25, 69], [4, 48, 57, 98, 25, 86, 76, 78, 66, 21, 16, 71, 18, 65, 95, 33, 10, 7, 50, 21, 81, 52, 30, 92, 15, 40, 7, 20, 90, 1, 9], [92, 58, 71, 51, 54, 56, 57, 21, 32, 7, 54, 97, 57, 32, 71, 81, 51, 25, 82, 81, 35, 25, 45, 69, 82, 20, 31, 77, 20, 70, 17], [55, 96, 60, 73, 88, 63, 2, 90, 14, 37, 9, 94, 55, 44, 55, 96, 84, 54, 20, 90, 6, 54, 34, 7, 16, 58, 58, 88, 72, 44, 68], [98, 72, 10, 44, 74, 20, 96, 24, 85, 9, 23, 58, 7, 32, 30, 65, 75, 28, 57, 25, 37, 61, 94, 38, 5, 45, 86, 77, 55, 50, 23], [9, 43, 13, 86, 41, 42, 4, 64, 59, 31, 90, 68, 99, 93, 10, 88, 89, 83, 84, 95, 52, 25, 99, 95, 75, 1, 27, 99, 92, 61, 95], [23, 9, 95, 28, 79, 76, 53, 1, 13, 47, 30, 14, 81, 43, 84, 84, 99, 77, 44, 52, 47, 35, 90, 64, 77, 47, 66, 32, 77, 96, 40], [53, 27, 68, 47, 54, 21, 53, 24, 38, 1, 85, 65, 33, 50, 32, 60, 37, 6, 54, 15, 78, 35, 98, 88, 73, 32, 84, 10, 31, 79, 55], [45, 44, 77, 84, 86, 83, 10, 64, 60, 57, 20, 71, 9, 92, 78, 61, 29, 62, 63, 39, 49, 58, 88, 5, 25, 61, 59, 55, 39, 12, 9], [12, 35, 58, 74, 10, 97, 46, 66, 22, 77, 6, 87, 64, 20, 55, 65, 68, 10, 15, 51, 24, 96, 93, 36, 5, 20, 59, 3, 22, 76, 18], [29, 27, 6, 76, 52, 73, 81, 12, 7, 55, 18, 30, 81, 15, 86, 93, 48, 40, 63, 78, 8, 5, 79, 83, 93, 78, 91, 7, 94, 7, 83], [10, 29, 80, 26, 28, 72, 4, 94, 69, 37, 89, 26, 40, 78, 22, 1, 99, 4, 73, 79, 51, 89, 83, 79, 30, 41, 17, 71, 10, 32, 99], [39, 61, 3, 58, 92, 51, 77, 76, 79, 30, 44, 5, 30, 3, 95, 15, 50, 89, 39, 73, 53, 82, 1, 18, 76, 99, 29, 65, 75, 32, 32], [38, 40, 23, 94, 62, 91, 94, 42, 32, 52, 10, 23, 51, 7, 77, 52, 86, 13, 65, 12, 25, 26, 84, 32, 19, 36, 94, 91, 48, 50, 11]],25,),
([[93, 83, 42, 36, 3, 96, 99, 4, 83, 84, 92, 19, 69, 39, 25, 37, 46, 22, 48, 91, 51, 83, 1, 5, 31, 15, 80, 59, 40, 93, 95], [54, 11, 90, 56, 27, 57, 45, 62, 95, 13, 85, 33, 86, 20, 39, 58, 72, 86, 29, 60, 14, 95, 58, 85, 72, 58, 90, 6, 73, 96, 83], [33, 22, 85, 19, 97, 11, 52, 56, 85, 45, 6, 97, 69, 99, 37, 43, 16, 45, 91, 6, 44, 85, 1, 20, 38, 8, 8, 43, 76, 88, 25], [69, 43, 13, 63, 41, 26, 51, 26, 83, 20, 65, 38, 60, 76, 13, 80, 51, 90, 70, 63, 88, 47, 82, 52, 15, 55, 98, 12, 36, 21, 81], [2, 91, 37, 21, 77, 38, 47, 83, 46, 50, 21, 80, 13, 54, 53, 31, 44, 94, 85, 47, 20, 54, 23, 60, 86, 86, 56, 35, 86, 88, 18], [46, 75, 65, 1, 94, 23, 37, 13, 73, 70, 90, 44, 12, 54, 50, 69, 28, 80, 64, 10, 44, 71, 6, 68, 63, 79, 22, 10, 96, 19, 95], [13, 71, 30, 9, 50, 85, 17, 41, 16, 58, 27, 14, 25, 59, 51, 15, 48, 61, 50, 15, 39, 7, 79, 49, 43, 21, 28, 32, 60, 5, 8], [40, 81, 37, 19, 62, 87, 90, 26, 23, 70, 64, 89, 35, 10, 1, 50, 94, 20, 75, 48, 62, 41, 59, 43, 38, 78, 4, 44, 37, 73, 16], [97, 37, 78, 7, 32, 92, 29, 80, 85, 68, 52, 98, 15, 27, 54, 46, 37, 33, 40, 20, 72, 68, 50, 49, 50, 22, 52, 96, 94, 54, 29], [35, 66, 92, 81, 84, 52, 72, 10, 3, 52, 10, 22, 25, 14, 22, 43, 78, 75, 95, 55, 11, 95, 93, 14, 16, 81, 14, 82, 61, 82, 7], [92, 56, 47, 97, 57, 39, 82, 67, 14, 63, 49, 24, 27, 33, 12, 98, 16, 70, 55, 13, 12, 29, 59, 8, 15, 78, 60, 94, 36, 50, 79], [79, 56, 75, 54, 90, 10, 59, 53, 87, 86, 48, 65, 9, 10, 5, 55, 35, 37, 75, 75, 72, 63, 41, 43, 96, 33, 51, 49, 55, 97, 89], [51, 24, 59, 88, 43, 51, 67, 10, 84, 22, 15, 62, 77, 24, 75, 34, 97, 71, 3, 46, 38, 59, 82, 53, 52, 69, 2, 57, 21, 89, 88], [33, 49, 78, 9, 9, 85, 92, 47, 9, 36, 67, 24, 14, 66, 72, 45, 11, 49, 2, 44, 87, 98, 3, 28, 15, 22, 42, 30, 28, 26, 45], [30, 97, 41, 94, 2, 35, 30, 83, 75, 35, 77, 12, 40, 15, 9, 39, 64, 47, 63, 92, 54, 33, 23, 4, 3, 42, 32, 55, 16, 46, 20], [11, 80, 79, 61, 36, 97, 56, 15, 15, 5, 55, 11, 96, 66, 51, 51, 99, 45, 55, 77, 33, 49, 91, 96, 58, 10, 53, 69, 12, 6, 6], [23, 73, 85, 83, 94, 51, 28, 20, 39, 36, 50, 60, 74, 68, 38, 30, 65, 71, 78, 69, 78, 87, 26, 49, 20, 44, 10, 72, 97, 1, 17], [12, 50, 96, 79, 8, 43, 71, 63, 13, 88, 21, 13, 62, 80, 42, 85, 19, 53, 97, 62, 21, 75, 86, 78, 91, 35, 88, 9, 3, 73, 28], [28, 62, 83, 54, 34, 11, 79, 29, 20, 74, 75, 68, 46, 22, 4, 59, 89, 29, 24, 56, 8, 49, 12, 87, 89, 95, 90, 21, 48, 39, 29], [98, 88, 4, 74, 67, 38, 35, 65, 58, 36, 35, 24, 59, 12, 49, 92, 84, 27, 56, 81, 48, 43, 73, 65, 51, 84, 39, 93, 56, 24, 94], [94, 92, 81, 45, 74, 80, 98, 72, 40, 20, 41, 34, 23, 59, 59, 28, 83, 13, 23, 74, 12, 89, 90, 82, 2, 12, 49, 50, 51, 2, 52], [29, 74, 58, 85, 1, 37, 5, 66, 26, 58, 7, 84, 70, 73, 16, 6, 98, 87, 51, 49, 87, 89, 24, 30, 80, 16, 76, 50, 6, 74, 9], [14, 96, 38, 81, 29, 8, 19, 75, 17, 83, 63, 5, 57, 46, 3, 52, 46, 47, 94, 96, 18, 22, 77, 14, 9, 60, 94, 50, 7, 37, 30], [85, 76, 84, 18, 58, 48, 45, 54, 93, 16, 10, 22, 30, 5, 62, 51, 18, 44, 27, 23, 55, 56, 28, 58, 13, 14, 6, 85, 32, 25, 30], [70, 19, 93, 74, 98, 7, 55, 67, 38, 49, 77, 85, 37, 65, 80, 83, 67, 15, 99, 71, 51, 81, 25, 77, 65, 37, 62, 80, 8, 78, 48], [1, 76, 42, 12, 54, 26, 18, 30, 9, 61, 74, 7, 58, 5, 48, 43, 41, 18, 70, 24, 8, 15, 41, 47, 46, 44, 9, 95, 82, 24, 3], [17, 28, 29, 45, 1, 80, 41, 27, 18, 50, 1, 43, 84, 92, 19, 18, 23, 2, 68, 7, 18, 27, 32, 9, 65, 85, 21, 33, 89, 74, 72], [98, 66, 13, 88, 97, 14, 26, 83, 71, 6, 59, 65, 34, 10, 39, 78, 45, 95, 70, 22, 89, 93, 98, 58, 63, 80, 93, 98, 31, 73, 85], [56, 76, 20, 78, 84, 26, 43, 32, 39, 14, 64, 37, 99, 54, 44, 6, 98, 26, 9, 29, 78, 19, 41, 51, 33, 37, 33, 93, 55, 93, 42], [56, 29, 87, 54, 47, 91, 90, 47, 11, 43, 63, 8, 53, 88, 76, 63, 87, 41, 64, 81, 39, 85, 74, 56, 4, 3, 58, 86, 20, 85, 53], [64, 65, 80, 69, 83, 7, 3, 64, 27, 52, 18, 45, 3, 51, 86, 16, 59, 73, 4, 48, 47, 20, 20, 34, 74, 40, 16, 37, 30, 86, 93]],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))) | null |
DYNAMIC_PROGRAMMING_SET_3_LONGEST_INCREASING_SUBSEQUENCE_1 |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_SET_3_LONGEST_INCREASING_SUBSEQUENCE_1{
static int f_gold ( int arr [ ] , int n ) {
int f_gold [ ] = new int [ n ] ;
int i , j , max = 0 ;
for ( i = 0 ;
i < n ;
i ++ ) f_gold [ i ] = 1 ;
for ( i = 1 ;
i < n ;
i ++ ) for ( j = 0 ;
j < i ;
j ++ ) if ( arr [ i ] > arr [ j ] && f_gold [ i ] < f_gold [ j ] + 1 ) f_gold [ i ] = f_gold [ j ] + 1 ;
for ( i = 0 ;
i < n ;
i ++ ) if ( max < f_gold [ i ] ) max = f_gold [ i ] ;
return max ;
}
| null |
using namespace std;
int f_gold ( int arr [ ], int n ) {
int f_gold [ n ];
f_gold [ 0 ] = 1;
for ( int i = 1;
i < n;
i ++ ) {
f_gold [ i ] = 1;
for ( int j = 0;
j < i;
j ++ ) if ( arr [ i ] > arr [ j ] && f_gold [ i ] < f_gold [ j ] + 1 ) f_gold [ i ] = f_gold [ j ] + 1;
}
return * max_element ( f_gold, f_gold + n );
}
|
public static void main(String args[]) {
int n_success = 0;
List<int [ ]> param0 = new ArrayList<>();
param0.add(new int[]{2,3,5,6,8,12,12,17,17,18,22,22,26,26,31,31,31,31,32,35,35,38,41,42,49,49,60,60,61,63,64,68,69,70,71,72,76,77,80,83,83,89,90,90,90,96});
param0.add(new int[]{-24,-16,-64,28,-30,-26,-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[]{11,42,44,52,15,35,48});
param0.add(new int[]{-54});
param0.add(new int[]{1,0,1,1,1,0,1,1,1,1,1,1,0,1,0,0,0,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0});
param0.add(new int[]{2,5,6,10,13,15,18,18,19,27,30,32,34,40,47,50,53,54,55,56,56,56,59,60,63,64,71,80,83,84,86,95});
param0.add(new int[]{-80,60,-6,0,-50,82,-84,36,-96,-32,-14,16,60,-14,0,-22,28,12,8,-86,38,56,-32,-6,-80,-42,56,10,72,12,96,84});
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,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[]{10,38,45,57,44,13,8,62,74,54,37,75,35,60,36,33,14,71,4,21,6,8,30,5,2,5,4,20,33,69,83,87,83,52,77,79,49,25,11,35,98,31,52,82,13,25,17,35,53});
List<Integer> param1 = new ArrayList<>();
param1.add(40);
param1.add(4);
param1.add(11);
param1.add(6);
param1.add(0);
param1.add(22);
param1.add(24);
param1.add(16);
param1.add(37);
param1.add(28);
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,3,5,6,8,12,12,17,17,18,22,22,26,26,31,31,31,31,32,35,35,38,41,42,49,49,60,60,61,63,64,68,69,70,71,72,76,77,80,83,83,89,90,90,90,96},{-24,-16,-64,28,-30,-26,-14},{0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1},{11,42,44,52,15,35,48},{-54},{1,0,1,1,1,0,1,1,1,1,1,1,0,1,0,0,0,1,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0},{2,5,6,10,13,15,18,18,19,27,30,32,34,40,47,50,53,54,55,56,56,56,59,60,63,64,71,80,83,84,86,95},{-80,60,-6,0,-50,82,-84,36,-96,-32,-14,16,60,-14,0,-22,28,12,8,-86,38,56,-32,-6,-80,-42,56,10,72,12,96,84},{0,0,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},{10,38,45,57,44,13,8,62,74,54,37,75,35,60,36,33,14,71,4,21,6,8,30,5,2,5,4,20,33,69,83,87,83,52,77,79,49,25,11,35,98,31,52,82,13,25,17,35,53}};
vector<int> param1 {40,4,11,6,0,22,24,16,37,28};
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_37_BOOLEAN_PARENTHESIZATION_PROBLEM |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class DYNAMIC_PROGRAMMING_SET_37_BOOLEAN_PARENTHESIZATION_PROBLEM{
static int f_gold ( char symb [ ] , char oper [ ] , int n ) {
int F [ ] [ ] = new int [ n ] [ n ] ;
int T [ ] [ ] = new int [ n ] [ n ] ;
for ( int i = 0 ;
i < n ;
i ++ ) {
F [ i ] [ i ] = ( symb [ i ] == 'F' ) ? 1 : 0 ;
T [ i ] [ i ] = ( symb [ i ] == 'T' ) ? 1 : 0 ;
}
for ( int gap = 1 ;
gap < n ;
++ gap ) {
for ( int i = 0 , j = gap ;
j < n ;
++ i , ++ j ) {
T [ i ] [ j ] = F [ i ] [ j ] = 0 ;
for ( int g = 0 ;
g < gap ;
g ++ ) {
int k = i + g ;
int tik = T [ i ] [ k ] + F [ i ] [ k ] ;
int tkj = T [ k + 1 ] [ j ] + F [ k + 1 ] [ j ] ;
if ( oper [ k ] == '&' ) {
T [ i ] [ j ] += T [ i ] [ k ] * T [ k + 1 ] [ j ] ;
F [ i ] [ j ] += ( tik * tkj - T [ i ] [ k ] * T [ k + 1 ] [ j ] ) ;
}
if ( oper [ k ] == '|' ) {
F [ i ] [ j ] += F [ i ] [ k ] * F [ k + 1 ] [ j ] ;
T [ i ] [ j ] += ( tik * tkj - F [ i ] [ k ] * F [ k + 1 ] [ j ] ) ;
}
if ( oper [ k ] == '^' ) {
T [ i ] [ j ] += F [ i ] [ k ] * T [ k + 1 ] [ j ] + T [ i ] [ k ] * F [ k + 1 ] [ j ] ;
F [ i ] [ j ] += T [ i ] [ k ] * T [ k + 1 ] [ j ] + F [ i ] [ k ] * F [ k + 1 ] [ j ] ;
}
}
}
}
return T [ 0 ] [ n - 1 ] ;
}
| def f_gold ( symb , oper , n ) :
F = [ [ 0 for i in range ( n + 1 ) ] for i in range ( n + 1 ) ]
T = [ [ 0 for i in range ( n + 1 ) ] for i in range ( n + 1 ) ]
for i in range ( n ) :
if symb [ i ] == 'F' :
F [ i ] [ i ] = 1
else :
F [ i ] [ i ] = 0
if symb [ i ] == 'T' :
T [ i ] [ i ] = 1
else :
T [ i ] [ i ] = 0
for gap in range ( 1 , n ) :
i = 0
for j in range ( gap , n ) :
T [ i ] [ j ] = F [ i ] [ j ] = 0
for g in range ( gap ) :
k = i + g
tik = T [ i ] [ k ] + F [ i ] [ k ] ;
tkj = T [ k + 1 ] [ j ] + F [ k + 1 ] [ j ] ;
if oper [ k ] == '&' :
T [ i ] [ j ] += T [ i ] [ k ] * T [ k + 1 ] [ j ]
F [ i ] [ j ] += ( tik * tkj - T [ i ] [ k ] * T [ k + 1 ] [ j ] )
if oper [ k ] == '|' :
F [ i ] [ j ] += F [ i ] [ k ] * F [ k + 1 ] [ j ]
T [ i ] [ j ] += ( tik * tkj - F [ i ] [ k ] * F [ k + 1 ] [ j ] )
if oper [ k ] == '^' :
T [ i ] [ j ] += ( F [ i ] [ k ] * T [ k + 1 ] [ j ] + T [ i ] [ k ] * F [ k + 1 ] [ j ] )
F [ i ] [ j ] += ( T [ i ] [ k ] * T [ k + 1 ] [ j ] + F [ i ] [ k ] * F [ k + 1 ] [ j ] )
i += 1
return T [ 0 ] [ n - 1 ]
|
using namespace std;
int f_gold ( char symb [ ], char oper [ ], int n ) {
int F [ n ] [ n ], T [ n ] [ n ];
for ( int i = 0;
i < n;
i ++ ) {
F [ i ] [ i ] = ( symb [ i ] == 'F' ) ? 1 : 0;
T [ i ] [ i ] = ( symb [ i ] == 'T' ) ? 1 : 0;
}
for ( int gap = 1;
gap < n;
++ gap ) {
for ( int i = 0, j = gap;
j < n;
++ i, ++ j ) {
T [ i ] [ j ] = F [ i ] [ j ] = 0;
for ( int g = 0;
g < gap;
g ++ ) {
int k = i + g;
int tik = T [ i ] [ k ] + F [ i ] [ k ];
int tkj = T [ k + 1 ] [ j ] + F [ k + 1 ] [ j ];
if ( oper [ k ] == '&' ) {
T [ i ] [ j ] += T [ i ] [ k ] * T [ k + 1 ] [ j ];
F [ i ] [ j ] += ( tik * tkj - T [ i ] [ k ] * T [ k + 1 ] [ j ] );
}
if ( oper [ k ] == '|' ) {
F [ i ] [ j ] += F [ i ] [ k ] * F [ k + 1 ] [ j ];
T [ i ] [ j ] += ( tik * tkj - F [ i ] [ k ] * F [ k + 1 ] [ j ] );
}
if ( oper [ k ] == '^' ) {
T [ i ] [ j ] += F [ i ] [ k ] * T [ k + 1 ] [ j ] + T [ i ] [ k ] * F [ k + 1 ] [ j ];
F [ i ] [ j ] += T [ i ] [ k ] * T [ k + 1 ] [ j ] + F [ i ] [ k ] * F [ k + 1 ] [ j ];
}
}
}
}
return T [ 0 ] [ n - 1 ];
}
|
public static void main(String args[]) {
int n_success = 0;
List<char [ ]> param0 = new ArrayList<>();
param0.add("TTFT".toCharArray());
param0.add("TFT".toCharArray());
param0.add("TFF".toCharArray());
param0.add("TTFT".toCharArray());
param0.add("TTFT".toCharArray());
param0.add("TTFT".toCharArray());
param0.add("TTFT".toCharArray());
param0.add("TTFT".toCharArray());
param0.add("TTFT".toCharArray());
param0.add("TTFT".toCharArray());
List<char [ ]> param1 = new ArrayList<>();
param1.add("|&^".toCharArray());
param1.add("^&".toCharArray());
param1.add("^|".toCharArray());
param1.add("|||".toCharArray());
param1.add("&&&".toCharArray());
param1.add("&&^".toCharArray());
param1.add("^&|".toCharArray());
param1.add("^^^".toCharArray());
param1.add("^||".toCharArray());
param1.add("|^|".toCharArray());
param1.add("&^|".toCharArray());
List<Integer> param2 = new ArrayList<>();
param2.add(4);
param2.add(3);
param2.add(3);
param2.add(4);
param2.add(4);
param2.add(4);
param2.add(4);
param2.add(4);
param2.add(4);
param2.add(4);
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 = [
("TTFT", "|&^",4,),
("TFT", "^&",3,),
("TFF", "^|",3,),
("TTFT", "|||",4,),
("TTFT", "&&&",4,),
("TTFT", "&&^",4,),
("TTFT", "^&|",4,),
("TTFT", "^^^",4,),
("TTFT", "^||",4,),
("TTFT", "|^|",4,)
]
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 {
"TTFT",
"TFT",
"TFF",
"TTFT",
"TTFT",
"TTFT",
"TTFT",
"TTFT",
"TTFT",
"TTFT"
};
vector<string> param1 {
"|&^",
"^&",
"^|",
"|||",
"&&&",
"&&^",
"^&|",
"^^^",
"^||",
"|^|"
};
vector<int> param2 {4,3,3,4,4,4,4,4,4,4};
for(int i = 0; i < param0.size(); ++i)
{
char* arr0 = new char[param0[i].length() + 1];
arr0 = strncpy(arr0, param0[i].c_str(), sizeof(arr0));
char* arr1 = new char[param1[i].length() + 1];
arr1 = strncpy(arr1, param1[i].c_str(), sizeof(arr1));
if(f_filled(arr0,arr1,param2[i]) == f_gold(arr0,arr1,param2[i]))
{
n_success+=1;
}
}
cout << "#Results:" << " " << n_success << ", " << param0.size();
return 0;
} |
PROGRAM_TO_FIND_THE_AREA_OF_PENTAGON |
import java.util. *;
import java.util.stream.*;
import java.lang.*;
import javafx.util.Pair;
public class PROGRAM_TO_FIND_THE_AREA_OF_PENTAGON{
static float f_gold ( float a ) {
float area ;
area = ( float ) ( Math . sqrt ( 5 * ( 5 + 2 * ( Math . sqrt ( 5 ) ) ) ) * a * a ) / 4 ;
return area ;
}
| from math import sqrt
def f_gold ( a ) :
area = ( sqrt ( 5 * ( 5 + 2 * ( sqrt ( 5 ) ) ) ) * a * a ) / 4
return area
|
using namespace std;
float f_gold ( float a ) {
float area;
area = ( sqrt ( 5 * ( 5 + 2 * ( sqrt ( 5 ) ) ) ) * a * a ) / 4;
return area;
}
|
public static void main(String args[]) {
int n_success = 0;
List<Float> param0 = new ArrayList<>();
param0.add(2009.019461888707F);
param0.add(-1480.5131394215787F);
param0.add(357.7870347569567F);
param0.add(-8040.293697508038F);
param0.add(3821.882657293133F);
param0.add(-6840.635072240347F);
param0.add(1623.036598830132F);
param0.add(-9714.00706195298F);
param0.add(3916.454769669618F);
param0.add(-669.068424712943F);
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 = [
(2009.019461888707,),
(-1480.5131394215787,),
(357.7870347569567,),
(-8040.293697508038,),
(3821.882657293133,),
(-6840.635072240347,),
(1623.036598830132,),
(-9714.00706195298,),
(3916.454769669618,),
(-669.068424712943,)
]
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<float> param0 {2009.019461888707F,-1480.5131394215787F,357.7870347569567F,-8040.293697508038F,3821.882657293133F,-6840.635072240347F,1623.036598830132F,-9714.00706195298F,3916.454769669618F,-669.068424712943F};
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;
} |